[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 06/11] xen/platform_op: Wrap around XENPF_enter_acpi_sleep


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 25 Jul 2025 14:15:25 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hQfkmLAlNfoJrk50r8mpXwdwQ271RHY6FOQJ2Macq+Q=; b=KeFmt7VoLDEn0bYbz4oD4xi58gM+3aVX2PEGJdkKErXdsjnyT8fZNwyHSjwqfket2Yo3jT8IfNAFByVP/OougqG+nPSByTaP7YqfLN+9D5hm6EiK6xjNdvdcwcnkHDxY+dQ+ymx/Ty8RCHM42+udpJ0q8UWyLB+5K+MPD1cY1P1x8T2fY21u8HxNnivcvIYi2I4OSaAZ1P+J9ejmuQdxhhUUSZuX27wLkjh+1FU6946TuXhq/qUSV1YYV/iF5YGnboNx6X4m4757ddLv4xTF4mbY22X/4Y/1pbiaXLLRmhCdmbEd+unELZWeuB/JMFtpEc2VIpdcgrBTcjZob9E1Cg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NI6BUn2anC7iRl2CI7ISaSYHhDkrSKgmLmYyAAe2TPXW27FvVut3NkYotl+NjZnTbSia1fYFZ8qHwp+RztVufiZ0VTLkBkn2LB/bKsRhWFKbq+QPEKDv23osPq1glK0eYf6+tDWBLWbaaQ6e407zPWjdMZlKe+zkyJi/KVf0NZd24N9V/NJ5kqPmJsiixaebIXlyGEsqP77FbAC1Nmry7IYc61LUQG15CRjSl+JJtXCd4BLssvlyqYZDfg0x73QigEDWfMKP/vr9TLWbpF4hgyfj1/atCXuNPyN7U51GGQiyEp/saWKx0lQxb0REvEFu5ICv6KnmyZ4VT8PouAoiTw==
  • Cc: Huang Rui <ray.huang@xxxxxxx>, Jiqian Chen <Jiqian.Chen@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Lukasz Hawrylko" <lukasz@xxxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Mateusz Mówka <mateusz.mowka@xxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>
  • Delivery-date: Fri, 25 Jul 2025 06:16:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Wrap call stack functions of XENPF_enter_acpi_sleep:
acpi_enter_sleep
        enter_state_helper
                enter_state
                        freeze_domains
                        scheduler_disable
                                schedule_dummy
                        disable_nonboot_cpus
                        acpi_sleep_prepare
                        device_power_down
                                console_suspend
                                        console_steal
                                        suspend_steal_fn
                                        serial_suspend
                                i8259A_suspend
                                        save_ELCR
                                ioapic_suspend
                                iommu_suspend
                                lapic_suspend
                        device_power_up
                                lapic_resume
                                        resume_x2apic
                                iommu_resume
                                ioapic_resume
                                i8259A_resume
                                console_resume
                                        serial_resume
                                        console_giveback
                        tboot_s3_resume
                        tboot_s3_error
                        acpi_sleep_post
                        enable_nonboot_cpus
                        thaw_domains

Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
---
cc: Jan Beulich <jbeulich@xxxxxxxx>
cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
cc: Michal Orzel <michal.orzel@xxxxxxx>
cc: Julien Grall <julien@xxxxxxx>
cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
cc: Lukasz Hawrylko <lukasz@xxxxxxxxxxx>
cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
cc: "Mateusz Mówka" <mateusz.mowka@xxxxxxxxx>
cc: Dario Faggioli <dfaggioli@xxxxxxxx>
cc: Juergen Gross <jgross@xxxxxxxx>
cc: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
 xen/arch/x86/acpi/power.c       | 4 ++++
 xen/arch/x86/apic.c             | 4 ++++
 xen/arch/x86/i8259.c            | 2 ++
 xen/arch/x86/io_apic.c          | 2 ++
 xen/arch/x86/tboot.c            | 2 ++
 xen/common/cpu.c                | 2 ++
 xen/common/domain.c             | 4 ++--
 xen/common/sched/core.c         | 2 ++
 xen/drivers/char/console.c      | 6 ++++--
 xen/drivers/passthrough/iommu.c | 2 ++
 10 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 2ac162c997fe..a0c76a146793 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -66,7 +66,9 @@ static int __init cf_check parse_acpi_sleep(const char *s)
 }
 custom_param("acpi_sleep", parse_acpi_sleep);
 
+#ifdef CONFIG_PLATFORM_OP
 static DEFINE_SPINLOCK(pm_lock);
+#endif
 
 struct acpi_sleep_info acpi_sinfo;
 
@@ -84,6 +86,7 @@ enum dev_power_saved
     SAVED_ALL,
 };
 
+#ifdef CONFIG_PLATFORM_OP
 static int device_power_down(void)
 {
     if ( console_suspend() )
@@ -376,6 +379,7 @@ int acpi_enter_sleep(const struct xenpf_enter_acpi_sleep 
*sleep)
 
     return continue_hypercall_on_cpu(0, enter_state_helper, &acpi_sinfo);
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 static int acpi_get_wake_status(void)
 {
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 0fd8bdba7067..1ee9ee120cb2 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -479,12 +479,14 @@ static void __enable_x2apic(void)
     }
 }
 
+#ifdef CONFIG_PLATFORM_OP
 static void resume_x2apic(void)
 {
     if ( iommu_x2apic_enabled )
         iommu_enable_x2apic();
     __enable_x2apic();
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 void setup_local_APIC(bool bsp)
 {
@@ -635,6 +637,7 @@ void setup_local_APIC(bool bsp)
     apic_pm_activate();
 }
 
+#ifdef CONFIG_PLATFORM_OP
 int lapic_suspend(void)
 {
     unsigned long flags;
@@ -727,6 +730,7 @@ int lapic_resume(void)
     local_irq_restore(flags);
     return 0;
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 
 /*
diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c
index 5c7e21a7515c..8a7c89f3827e 100644
--- a/xen/arch/x86/i8259.c
+++ b/xen/arch/x86/i8259.c
@@ -255,6 +255,7 @@ static bool _mask_and_ack_8259A_irq(unsigned int irq)
     return is_real_irq;
 }
 
+#ifdef CONFIG_PLATFORM_OP
 static char irq_trigger[2];
 /**
  * ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ
@@ -284,6 +285,7 @@ int i8259A_suspend(void)
     save_ELCR(irq_trigger);
     return 0;
 }
+#endif
 
 void init_8259A(int auto_eoi)
 {
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 1816e1c0b9f4..117ceeec633a 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2174,6 +2174,7 @@ void __init setup_IO_APIC(void)
     register_keyhandler('z', _print_IO_APIC_keyhandler, "dump IOAPIC info", 1);
 }
 
+#ifdef CONFIG_PLATFORM_OP
 void ioapic_suspend(void)
 {
     struct IO_APIC_route_entry *entry = ioapic_pm_state;
@@ -2211,6 +2212,7 @@ void ioapic_resume(void)
     }
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 /* --------------------------------------------------------------------------
                           ACPI-based IOAPIC Configuration
diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index d5db60d335e3..ee142759acda 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -471,6 +471,7 @@ int __init cf_check 
tboot_parse_dmar_table(acpi_table_handler dmar_handler)
 
 static vmac_t orig_mac, resume_mac;
 
+#ifdef CONFIG_PLATFORM_OP
 int tboot_s3_resume(void)
 {
     if ( !tboot_in_measured_env() )
@@ -512,6 +513,7 @@ void tboot_s3_error(int error)
     printk("MAC for %s after S3 is: 0x%08"PRIx64"\n", what, resume_mac);
     panic("Memory integrity was lost on resume (%d)\n", error);
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 int tboot_wake_ap(int apicid, unsigned long sipi_vec)
 {
diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index f09af0444b6a..32e803d65da3 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -190,6 +190,7 @@ void notify_cpu_starting(unsigned int cpu)
     cpu_notifier_call_chain(cpu, CPU_STARTING, NULL, true);
 }
 
+#ifdef CONFIG_PLATFORM_OP
 static cpumask_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
@@ -247,3 +248,4 @@ void enable_nonboot_cpus(void)
 
     cpumask_clear(&frozen_cpus);
 }
+#endif /* CONFIG_PLATFORM_OP */
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 303c338ef293..5eeb3efdfad0 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -2411,7 +2411,7 @@ domid_t get_initial_domain_id(void)
     return 0;
 }
 
-#ifdef CONFIG_SYSTEM_SUSPEND
+#if defined(CONFIG_SYSTEM_SUSPEND) && defined(CONFIG_PLATFORM_OP)
 
 void freeze_domains(void)
 {
@@ -2438,7 +2438,7 @@ void thaw_domains(void)
     rcu_read_unlock(&domlist_read_lock);
 }
 
-#endif /* CONFIG_SYSTEM_SUSPEND */
+#endif /* CONFIG_SYSTEM_SUSPEND and CONFIG_PLATFORM_OP*/
 
 /*
  * Local variables:
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index ea95dea65a58..2ab86e6227df 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2967,6 +2967,7 @@ const cpumask_t *sched_get_opt_cpumask(enum sched_gran 
opt, unsigned int cpu)
     return mask;
 }
 
+#ifdef CONFIG_PLATFORM_OP
 static void cf_check schedule_dummy(void)
 {
     sched_tasklet_check_cpu(smp_processor_id());
@@ -2978,6 +2979,7 @@ void scheduler_disable(void)
     open_softirq(SCHEDULE_SOFTIRQ, schedule_dummy);
     open_softirq(SCHED_SLAVE_SOFTIRQ, schedule_dummy);
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 void scheduler_enable(void)
 {
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index c5afac9f7259..83da6f095aff 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -428,6 +428,7 @@ static unsigned int serial_rx_cons, serial_rx_prod;
 
 static void (*serial_steal_fn)(const char *str, size_t nr) = early_puts;
 
+#ifdef CONFIG_PLATFORM_OP
 int console_steal(int handle, void (*fn)(const char *str, size_t nr))
 {
     if ( (handle == -1) || (handle != sercon_handle) )
@@ -445,6 +446,7 @@ void console_giveback(int id)
     if ( id == 1 )
         serial_steal_fn = NULL;
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 void console_serial_puts(const char *s, size_t nr)
 {
@@ -1367,7 +1369,7 @@ void panic(const char *fmt, ...)
         machine_restart(5000);
 }
 
-#ifdef CONFIG_SYSTEM_SUSPEND
+#if defined(CONFIG_SYSTEM_SUSPEND) && defined(CONFIG_PLATFORM_OP)
 
 /*
  * **************************************************************
@@ -1392,7 +1394,7 @@ int console_resume(void)
     return 0;
 }
 
-#endif /* CONFIG_SYSTEM_SUSPEND */
+#endif /* CONFIG_SYSTEM_SUSPEND and CONFIG_PLATFORM_OP*/
 
 /*
  * Local variables:
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index c9425d6971cb..0a0080452721 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -611,6 +611,7 @@ int __init iommu_setup(void)
     return rc;
 }
 
+#ifdef CONFIG_PLATFORM_OP
 int iommu_suspend(void)
 {
     if ( iommu_enabled )
@@ -624,6 +625,7 @@ void iommu_resume(void)
     if ( iommu_enabled )
         iommu_vcall(iommu_get_ops(), resume);
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 int iommu_do_domctl(
     struct xen_domctl *domctl, struct domain *d,
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.