All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][pvops_dom0][4/4] use physical acpi_id in acpi processor parsing logic
@ 2009-07-19  6:46 Yu, Ke
  2009-07-20 20:36 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 5+ messages in thread
From: Yu, Ke @ 2009-07-19  6:46 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Tian, Kevin, xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 2666 bytes --]

use physical acpi_id in acpi processor parsing logic

xen domain0 is seeing vCPU, while xen need the acpi info of physical CPU, so this patch hack the acpi processor parsing logic to use physical acpi_id instead vcpu id

From: Yu Ke <ke.yu@intel.com>

Signed-off-by: Yu Ke <ke.yu@intel.com>
---

 arch/x86/kernel/acpi/processor.c |    4 ++++
 drivers/acpi/processor_core.c    |   11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)


diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 9f0b296..d4d57a9 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -11,6 +11,7 @@
 
 #include <acpi/processor.h>
 #include <asm/acpi.h>
+#include <asm/xen/hypervisor.h>
 
 static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
 {
@@ -82,6 +83,9 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
 {
 	struct cpuinfo_x86 *c = &cpu_data(pr->id);
 
+	if (xen_pv_domain())
+		c = &cpu_data(0);
+
 	pr->pdc = NULL;
 	if (c->x86_vendor == X86_VENDOR_INTEL)
 		init_intel_pdc(pr, c);
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 0b6facc..a124c4a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -638,6 +638,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
 
 	pr->id = cpu_index;
 
+	if (xen_pv_domain())
+		pr->id = pr->acpi_id;
+
 	/*
 	 *  Extra Processor objects may be enumerated on MP systems with
 	 *  less than the max # of CPUs. They should be ignored _iff
@@ -703,14 +706,16 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 		return 0;
 	}
 
-	BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
+	if (!xen_pv_domain())
+		BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
 
 	/*
 	 * Buggy BIOS check
 	 * ACPI id of processors can be reported wrongly by the BIOS.
 	 * Don't trust it blindly
 	 */
-	if (per_cpu(processor_device_array, pr->id) != NULL &&
+	if (!xen_pv_domain() &&
+		per_cpu(processor_device_array, pr->id) != NULL &&
 	    per_cpu(processor_device_array, pr->id) != device) {
 		printk(KERN_WARNING "BIOS reported wrong ACPI id "
 			"for the processor\n");
@@ -725,7 +730,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 		goto end;
 
 	sysdev = get_cpu_sysdev(pr->id);
-	if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
+	if (sysdev != NULL && sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
 		return -EFAULT;
 
 	/* _PDC call should be done before doing anything else (if reqd.). */


[-- Attachment #2: xen-vcpu-pcpu-mapping.patch --]
[-- Type: application/octet-stream, Size: 2586 bytes --]

use physical acpi_id in acpi processor parsing logic

xen domain0 is seeing vCPU, while xen need the acpi info of physical CPU, so this patch hack the acpi processor parsing logic to use physical acpi_id instead vcpu id

From: Yu Ke <ke.yu@intel.com>

Signed-off-by: Yu Ke <ke.yu@intel.com>
---

 arch/x86/kernel/acpi/processor.c |    4 ++++
 drivers/acpi/processor_core.c    |   11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)


diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 9f0b296..d4d57a9 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -11,6 +11,7 @@
 
 #include <acpi/processor.h>
 #include <asm/acpi.h>
+#include <asm/xen/hypervisor.h>
 
 static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
 {
@@ -82,6 +83,9 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
 {
 	struct cpuinfo_x86 *c = &cpu_data(pr->id);
 
+	if (xen_pv_domain())
+		c = &cpu_data(0);
+
 	pr->pdc = NULL;
 	if (c->x86_vendor == X86_VENDOR_INTEL)
 		init_intel_pdc(pr, c);
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 0b6facc..a124c4a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -638,6 +638,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
 
 	pr->id = cpu_index;
 
+	if (xen_pv_domain())
+		pr->id = pr->acpi_id;
+
 	/*
 	 *  Extra Processor objects may be enumerated on MP systems with
 	 *  less than the max # of CPUs. They should be ignored _iff
@@ -703,14 +706,16 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 		return 0;
 	}
 
-	BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
+	if (!xen_pv_domain())
+		BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
 
 	/*
 	 * Buggy BIOS check
 	 * ACPI id of processors can be reported wrongly by the BIOS.
 	 * Don't trust it blindly
 	 */
-	if (per_cpu(processor_device_array, pr->id) != NULL &&
+	if (!xen_pv_domain() &&
+		per_cpu(processor_device_array, pr->id) != NULL &&
 	    per_cpu(processor_device_array, pr->id) != device) {
 		printk(KERN_WARNING "BIOS reported wrong ACPI id "
 			"for the processor\n");
@@ -725,7 +730,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 		goto end;
 
 	sysdev = get_cpu_sysdev(pr->id);
-	if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
+	if (sysdev != NULL && sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
 		return -EFAULT;
 
 	/* _PDC call should be done before doing anything else (if reqd.). */

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-29  2:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-19  6:46 [PATCH][pvops_dom0][4/4] use physical acpi_id in acpi processor parsing logic Yu, Ke
2009-07-20 20:36 ` Jeremy Fitzhardinge
2009-07-21  8:07   ` Yu, Ke
2009-07-28 17:53     ` Jeremy Fitzhardinge
2009-07-29  2:35       ` Yu, Ke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.