Skip to contentSkip to conversation

linux: make Xen cpufreq handling also work without _PSD objects

PATCH New Jan Beulich 1 participant 1 message Sep 8, 2008 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: make Xen cpufreq handling also work without _PSD objects

_PSD objects are optional according to the ACPI spec.

Also eliminate a pointless static variable.

As usual, written and tested on 2.6.27-rc5 and made apply to the 2.6.18 tree without further testing.

arch/i386/kernel/acpi/processor_extcntl_xen.c +4 -6
Index: head-2008-09-01/arch/i386/kernel/acpi/processor_extcntl_xen.c
===================================================================
@@ -32,8 +32,6 @@
 #include <acpi/processor.h>
 #include <asm/hypercall.h>
 
-static int xen_processor_pmbits;
-
 static int xen_cx_notifier(struct acpi_processor *pr, int action)
 {
 	int ret, count = 0, i;
@@ -215,13 +213,13 @@ static struct processor_extcntl_ops xen_
 
 void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **ops)
 {
-	xen_processor_pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8;
+	unsigned int pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8;
 
-	if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX)
+	if (pmbits & XEN_PROCESSOR_PM_CX)
 		xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
-	if (xen_processor_pmbits & XEN_PROCESSOR_PM_PX)
+	if (pmbits & XEN_PROCESSOR_PM_PX)
 		xen_extcntl_ops.pm_ops[PM_TYPE_PERF] = xen_px_notifier;
-	if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX)
+	if (pmbits & XEN_PROCESSOR_PM_TX)
 		xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier;
 
 	*ops = &xen_extcntl_ops;
drivers/acpi/processor_extcntl.c +13 -4
Index: head-2008-09-01/drivers/acpi/processor_extcntl.c
===================================================================
@@ -195,13 +195,22 @@ static int processor_extcntl_get_perform
 	 * processor objects to external logic. In this case, it's preferred
 	 * to use ACPI ID instead.
 	 */
-	pr->performance->domain_info.num_processors = 0;
+	pdomain = &pr->performance->domain_info;
+	pdomain->num_processors = 0;
 	ret = acpi_processor_get_psd(pr);
-	if (ret < 0)
-		goto err_out;
+	if (ret < 0) {
+		/*
+		 * _PSD is optional - assume no coordination if absent (or
+		 * broken), matching native kernels' behavior.
+		 */
+		pdomain->num_entries = ACPI_PSD_REV0_ENTRIES;
+		pdomain->revision = ACPI_PSD_REV0_REVISION;
+		pdomain->domain = pr->acpi_id;
+		pdomain->coord_type = DOMAIN_COORD_TYPE_SW_ALL;
+		pdomain->num_processors = 1;
+	}
 
 	/* Some sanity check */
-	pdomain = &pr->performance->domain_info;
 	if ((pdomain->revision != ACPI_PSD_REV0_REVISION) ||
 	    (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) ||
 	    ((pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL) &&