Skip to contentSkip to conversation

xen/acpi: upload power and performance related data from a PVH dom0

PATCH New Jason Andryuk 1 participant 1 message Dec 3, 2024 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xen/acpi: upload power and performance related data from a PVH dom0

From: Roger Pau Monne <[email protected]>

When running as a PVH dom0 the ACPI MADT is crafted by Xen in order to report the correct numbers of vCPUs that dom0 has, so the host MADT is not provided to dom0. This creates issues when parsing the power and performance related data from ACPI dynamic tables, as the ACPI Processor UIDs found on the dynamic code are likely to not match the ones crafted by Xen in the dom0 MADT.

Xen would rely on Linux having filled at least the power and performance related data of the vCPUs on the system, and would clone that information in order to setup the remaining pCPUs on the system if dom0 vCPUs < pCPUs. However when running as PVH dom0 it's likely that none of dom0 CPUs will have the power and performance data filled, and hence the Xen ACPI Processor driver needs to fetch that information by itself.

In order to do so correctly, introduce a new helper to fetch the _CST data without taking into account the system capabilities from the CPUID output, as the capabilities reported to dom0 in CPUID might be different from the ones on the host.

Note that the newly introduced code will only fetch the _CST, _PSS, _PPC and _PCT from a single CPU, and clone that information for all the other Processors. This won't work on an heterogeneous system with Processors having different power and performance related data between them.

---
v2:
Add second buffer for _CST. Call was failing with AE_BUFFER_OVERFLOW(0x000b)

v3:
Upgrade some failures to pr_err
Only set pr_initialized when acpi_processor_get_performance_info() and xen_acpi_processor_evaluate_cst() both succeed.
Remove BUG_ON(!pr_backup) - checkpatch complains and the case is handled earlier.

---
 drivers/xen/pcpu.c               |   3 +-
 drivers/xen/xen-acpi-processor.c | 232 ++++++++++++++++++++++++++++---
 include/xen/xen.h                |   2 +-
 3 files changed, 216 insertions(+), 21 deletions(-)
drivers/xen/pcpu.c +2 -1
index c63f317e3df3..dc9f2c14bf62 100644
@@ -388,7 +388,7 @@ static int __init xen_pcpu_init(void)
 arch_initcall(xen_pcpu_init);
 
 #ifdef CONFIG_ACPI
-bool __init xen_processor_present(uint32_t acpi_id)
+bool xen_processor_present(uint32_t acpi_id)
 {
 	const struct pcpu *pcpu;
 	bool online = false;
@@ -403,6 +403,7 @@ bool __init xen_processor_present(uint32_t acpi_id)
 
 	return online;
 }
+EXPORT_SYMBOL_GPL(xen_processor_present);
 
 void xen_sanitize_proc_cap_bits(uint32_t *cap)
 {
drivers/xen/xen-acpi-processor.c +213 -19

310 lines not on this page · raw message

include/xen/xen.h +1 -1
index a1e5b3f18d69..6ff3e2f40803 100644
@@ -81,7 +81,7 @@ static inline void xen_free_unpopulated_pages(unsigned int nr_pages,
 #endif
 
 #if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI) && defined(CONFIG_X86)
-bool __init xen_processor_present(uint32_t acpi_id);
+bool xen_processor_present(uint32_t acpi_id);
 #else
 #include <linux/bug.h>
 static inline bool xen_processor_present(uint32_t acpi_id)
Signature · 1 line
2.34.1