All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Prepare for running ACPI on !x86 and !ia64
@ 2014-02-08 13:10 Hanjun Guo
  2014-02-08 13:10 ` [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64 Hanjun Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Hanjun Guo @ 2014-02-08 13:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, patches, linux-kernel, linaro-acpi, Hanjun Guo

Some of the ACPI code is arch-dependent and make the code can't be
compiled on !x86 or !ia64, the first two patches just do some rework
on the idle_boot_override and _PDC related stuff to make the ACPI
code more arch-independent.

The third patch just introduce map_gic_id() for ACPI processor core
followed by the ACPI 5.0 spec.

I have compiled the kernel successfully after appling this patch set
on x86 and ia64.

Changes for v2:
a) add #if defined(CONFIG_X86) || defined(CONFIG_IA64) for
   idle_boot_override related code;
b) Rebased on 3.14-rc1.

Changes since the RFC version:
a) Remove the RFC tag;
b) Move idle_boot_override out of the arch directory suggested
   by Alan;
c) Make these 3 patches as a separate patch set since there are
   not not related to the ARM/ARM64 platform.

Hanjun Guo (3):
  ACPI / idle: Make idle_boot_override depend on x86 and ia64
  ACPI / processor_core: Rework _PDC related stuff to make it more
    arch-independent
  ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method

 arch/ia64/include/asm/acpi.h  |    5 +--
 arch/ia64/kernel/acpi.c       |   17 +++++++++
 arch/x86/include/asm/acpi.h   |   19 +--------
 arch/x86/kernel/acpi/cstate.c |   31 +++++++++++++++
 drivers/acpi/processor_core.c |   85 ++++++++++++++++++++++++-----------------
 5 files changed, 99 insertions(+), 58 deletions(-)

-- 
1.7.9.5


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

* [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64
  2014-02-08 13:10 [PATCH v2 0/3] Prepare for running ACPI on !x86 and !ia64 Hanjun Guo
@ 2014-02-08 13:10 ` Hanjun Guo
  2014-02-10  1:55   ` Lan Tianyu
  2014-02-18  1:13   ` Rafael J. Wysocki
  2014-02-08 13:10 ` [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
  2014-02-08 13:10 ` [PATCH v2 3/3] ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Hanjun Guo
  2 siblings, 2 replies; 10+ messages in thread
From: Hanjun Guo @ 2014-02-08 13:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, patches, linux-kernel, linaro-acpi, Hanjun Guo

idle_boot_override depends on x86 and ia64 now, and we can not
foresee it will be used on ARM or ARM64,so move the code into
CONFIG_X86 and CONFIG_IA64 #ifdefs to make processor_core.c
can be compiled on ARM64.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/processor_core.c |   40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 46583d7..01b2656 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -19,24 +19,6 @@
 #define _COMPONENT		ACPI_PROCESSOR_COMPONENT
 ACPI_MODULE_NAME("processor_core");
 
-static int __init set_no_mwait(const struct dmi_system_id *id)
-{
-	printk(KERN_NOTICE PREFIX "%s detected - "
-		"disabling mwait for CPU C-states\n", id->ident);
-	boot_option_idle_override = IDLE_NOMWAIT;
-	return 0;
-}
-
-static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
-	{
-	set_no_mwait, "Extensa 5220", {
-	DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
-	DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
-	DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
-	DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
-	{},
-};
-
 static int map_lapic_id(struct acpi_subtable_header *entry,
 		 u32 acpi_id, int *apic_id)
 {
@@ -379,13 +361,35 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
 	return AE_OK;
 }
 
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
+static int __init set_no_mwait(const struct dmi_system_id *id)
+{
+	printk(KERN_NOTICE PREFIX "%s detected - "
+		"disabling mwait for CPU C-states\n", id->ident);
+	boot_option_idle_override = IDLE_NOMWAIT;
+	return 0;
+}
+
+static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
+	{
+	set_no_mwait, "Extensa 5220", {
+	DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+	DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+	DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
+	DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
+	{},
+};
+#endif
+
 void __init acpi_early_processor_set_pdc(void)
 {
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
 	/*
 	 * Check whether the system is DMI table. If yes, OSPM
 	 * should not use mwait for CPU-states.
 	 */
 	dmi_check_system(processor_idle_dmi_table);
+#endif
 
 	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
 			    ACPI_UINT32_MAX,
-- 
1.7.9.5

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

* [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent
  2014-02-08 13:10 [PATCH v2 0/3] Prepare for running ACPI on !x86 and !ia64 Hanjun Guo
  2014-02-08 13:10 ` [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64 Hanjun Guo
@ 2014-02-08 13:10 ` Hanjun Guo
  2014-02-10  2:21   ` Lan Tianyu
  2014-02-08 13:10 ` [PATCH v2 3/3] ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Hanjun Guo
  2 siblings, 1 reply; 10+ messages in thread
From: Hanjun Guo @ 2014-02-08 13:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, patches, linux-kernel, linaro-acpi, Hanjun Guo,
	Graeme Gregory

_PDC related stuff in processor_core.c is little bit X86/IA64 dependent,
rework the code to make it more arch-independent, no functional change
in this patch.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
---
 arch/ia64/include/asm/acpi.h  |    5 +----
 arch/ia64/kernel/acpi.c       |   17 +++++++++++++++++
 arch/x86/include/asm/acpi.h   |   19 +------------------
 arch/x86/kernel/acpi/cstate.c |   31 +++++++++++++++++++++++++++++++
 drivers/acpi/processor_core.c |   19 +------------------
 5 files changed, 51 insertions(+), 40 deletions(-)

diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..d2b8b9d 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -152,10 +152,7 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
 #endif
 
 static inline bool arch_has_acpi_pdc(void) { return true; }
-static inline void arch_acpi_set_pdc_bits(u32 *buf)
-{
-	buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
-}
+extern void arch_acpi_set_pdc_bits(u32 *buf);
 
 #define acpi_unlazy_tlb(x)
 
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 07d209c..d71f64a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -1014,3 +1014,20 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);
  * TBD when when IA64 starts to support suspend...
  */
 int acpi_suspend_lowlevel(void) { return 0; }
+
+void arch_acpi_set_pdc_bits(u32 *buf)
+{
+	/* Enable coordination with firmware's _TSD info */
+	buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
+	if (boot_option_idle_override == IDLE_NOMWAIT) {
+		/*
+		 * If mwait is disabled for CPU C-states, the C2C3_FFH access
+		 * mode will be disabled in the parameter of _PDC object.
+		 * Of course C1_FFH access mode will also be disabled.
+		 */
+		buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
+
+	}
+
+	buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
+}
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e9f71bc 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -147,24 +147,7 @@ static inline bool arch_has_acpi_pdc(void)
 		c->x86_vendor == X86_VENDOR_CENTAUR);
 }
 
-static inline void arch_acpi_set_pdc_bits(u32 *buf)
-{
-	struct cpuinfo_x86 *c = &cpu_data(0);
-
-	buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
-
-	if (cpu_has(c, X86_FEATURE_EST))
-		buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
-
-	if (cpu_has(c, X86_FEATURE_ACPI))
-		buf[2] |= ACPI_PDC_T_FFH;
-
-	/*
-	 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
-	 */
-	if (!cpu_has(c, X86_FEATURE_MWAIT))
-		buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
-}
+extern void arch_acpi_set_pdc_bits(u32 *buf);
 
 #else /* !CONFIG_ACPI */
 
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index e69182f..aa9aed9 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -16,6 +16,37 @@
 #include <asm/mwait.h>
 #include <asm/special_insns.h>
 
+void arch_acpi_set_pdc_bits(u32 *buf)
+{
+	struct cpuinfo_x86 *c = &cpu_data(0);
+
+	/* Enable coordination with firmware's _TSD info */
+	buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
+	if (boot_option_idle_override == IDLE_NOMWAIT) {
+		/*
+		 * If mwait is disabled for CPU C-states, the C2C3_FFH access
+		 * mode will be disabled in the parameter of _PDC object.
+		 * Of course C1_FFH access mode will also be disabled.
+		 */
+		buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
+
+	}
+
+	buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
+
+	if (cpu_has(c, X86_FEATURE_EST))
+		buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
+
+	if (cpu_has(c, X86_FEATURE_ACPI))
+		buf[2] |= ACPI_PDC_T_FFH;
+
+	/*
+	 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
+	 */
+	if (!cpu_has(c, X86_FEATURE_MWAIT))
+		buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
+}
+
 /*
  * Initialize bm_flags based on the CPU cache properties
  * On SMP it depends on cache configuration
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 01b2656..31a4281 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -255,9 +255,6 @@ static void acpi_set_pdc_bits(u32 *buf)
 	buf[0] = ACPI_PDC_REVISION_ID;
 	buf[1] = 1;
 
-	/* Enable coordination with firmware's _TSD info */
-	buf[2] = ACPI_PDC_SMP_T_SWCOORD;
-
 	/* Twiddle arch-specific bits needed for _PDC */
 	arch_acpi_set_pdc_bits(buf);
 }
@@ -282,7 +279,7 @@ static struct acpi_object_list *acpi_processor_alloc_pdc(void)
 		return NULL;
 	}
 
-	buf = kmalloc(12, GFP_KERNEL);
+	buf = kzalloc(12, GFP_KERNEL);
 	if (!buf) {
 		printk(KERN_ERR "Memory allocation error\n");
 		kfree(obj);
@@ -310,20 +307,6 @@ acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
 {
 	acpi_status status = AE_OK;
 
-	if (boot_option_idle_override == IDLE_NOMWAIT) {
-		/*
-		 * If mwait is disabled for CPU C-states, the C2C3_FFH access
-		 * mode will be disabled in the parameter of _PDC object.
-		 * Of course C1_FFH access mode will also be disabled.
-		 */
-		union acpi_object *obj;
-		u32 *buffer = NULL;
-
-		obj = pdc_in->pointer;
-		buffer = (u32 *)(obj->buffer.pointer);
-		buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
-
-	}
 	status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
 
 	if (ACPI_FAILURE(status))
-- 
1.7.9.5

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

* [PATCH v2 3/3] ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method
  2014-02-08 13:10 [PATCH v2 0/3] Prepare for running ACPI on !x86 and !ia64 Hanjun Guo
  2014-02-08 13:10 ` [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64 Hanjun Guo
  2014-02-08 13:10 ` [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
@ 2014-02-08 13:10 ` Hanjun Guo
  2 siblings, 0 replies; 10+ messages in thread
From: Hanjun Guo @ 2014-02-08 13:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, patches, linux-kernel, linaro-acpi, Hanjun Guo

Get apic id from MADT or _MAT method is not implemented on arm/arm64,
and ACPI 5.0 introduces GIC Structure for it, so this patch introduces
map_gic_id() to get apic id followed the ACPI 5.0 spec.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/processor_core.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 31a4281..5a50f03 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -71,6 +71,27 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
 	return 0;
 }
 
+static int map_gic_id(struct acpi_subtable_header *entry,
+		int device_declaration, u32 acpi_id, int *apic_id)
+{
+	struct acpi_madt_generic_interrupt *gic =
+		(struct acpi_madt_generic_interrupt *)entry;
+
+	if (!(gic->flags & ACPI_MADT_ENABLED))
+		return -ENODEV;
+
+	/* In the GIC interrupt model, logical processors are
+	 * required to have a Processor Device object in the DSDT,
+	 * so we should check device_declaration here
+	 */
+	if (device_declaration && (gic->uid == acpi_id)) {
+		*apic_id = gic->gic_id;
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 static int map_madt_entry(int type, u32 acpi_id)
 {
 	unsigned long madt_end, entry;
@@ -106,6 +127,9 @@ static int map_madt_entry(int type, u32 acpi_id)
 		} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
 			if (!map_lsapic_id(header, type, acpi_id, &apic_id))
 				break;
+		} else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
+			if (!map_gic_id(header, type, acpi_id, &apic_id))
+				break;
 		}
 		entry += header->length;
 	}
@@ -136,6 +160,8 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 		map_lapic_id(header, acpi_id, &apic_id);
 	} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
 		map_lsapic_id(header, type, acpi_id, &apic_id);
+	} else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
+		map_gic_id(header, type, acpi_id, &apic_id);
 	}
 
 exit:
-- 
1.7.9.5

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

* Re: [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64
  2014-02-08 13:10 ` [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64 Hanjun Guo
@ 2014-02-10  1:55   ` Lan Tianyu
  2014-02-18  1:13   ` Rafael J. Wysocki
  1 sibling, 0 replies; 10+ messages in thread
From: Lan Tianyu @ 2014-02-10  1:55 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, linux-acpi, Patch Tracking,
	linux-kernel@vger kernel org, linaro-acpi

2014-02-08 Hanjun Guo <hanjun.guo@linaro.org>:
> idle_boot_override depends on x86 and ia64 now, and we can not
> foresee it will be used on ARM or ARM64,so move the code into
> CONFIG_X86 and CONFIG_IA64 #ifdefs to make processor_core.c
> can be compiled on ARM64.
>

Reviewed-by: Lan Tianyu <tianyu.lan@intel.com>

> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  drivers/acpi/processor_core.c |   40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
> index 46583d7..01b2656 100644
> --- a/drivers/acpi/processor_core.c
> +++ b/drivers/acpi/processor_core.c
> @@ -19,24 +19,6 @@
>  #define _COMPONENT             ACPI_PROCESSOR_COMPONENT
>  ACPI_MODULE_NAME("processor_core");
>
> -static int __init set_no_mwait(const struct dmi_system_id *id)
> -{
> -       printk(KERN_NOTICE PREFIX "%s detected - "
> -               "disabling mwait for CPU C-states\n", id->ident);
> -       boot_option_idle_override = IDLE_NOMWAIT;
> -       return 0;
> -}
> -
> -static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
> -       {
> -       set_no_mwait, "Extensa 5220", {
> -       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
> -       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> -       DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
> -       DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
> -       {},
> -};
> -
>  static int map_lapic_id(struct acpi_subtable_header *entry,
>                  u32 acpi_id, int *apic_id)
>  {
> @@ -379,13 +361,35 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
>         return AE_OK;
>  }
>
> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
> +static int __init set_no_mwait(const struct dmi_system_id *id)
> +{
> +       printk(KERN_NOTICE PREFIX "%s detected - "
> +               "disabling mwait for CPU C-states\n", id->ident);
> +       boot_option_idle_override = IDLE_NOMWAIT;
> +       return 0;
> +}
> +
> +static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
> +       {
> +       set_no_mwait, "Extensa 5220", {
> +       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
> +       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> +       DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
> +       DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
> +       {},
> +};
> +#endif
> +
>  void __init acpi_early_processor_set_pdc(void)
>  {
> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
>         /*
>          * Check whether the system is DMI table. If yes, OSPM
>          * should not use mwait for CPU-states.
>          */
>         dmi_check_system(processor_idle_dmi_table);
> +#endif
>
>         acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
>                             ACPI_UINT32_MAX,
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best regards
Tianyu Lan

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

* Re: [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent
  2014-02-08 13:10 ` [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
@ 2014-02-10  2:21   ` Lan Tianyu
  2014-02-10  7:09       ` Hanjun Guo
  0 siblings, 1 reply; 10+ messages in thread
From: Lan Tianyu @ 2014-02-10  2:21 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, linux-acpi, Patch Tracking,
	linux-kernel@vger kernel org, linaro-acpi, Graeme Gregory

2014-02-08 21:10 GMT+08:00 Hanjun Guo <hanjun.guo@linaro.org>:
> _PDC related stuff in processor_core.c is little bit X86/IA64 dependent,
> rework the code to make it more arch-independent, no functional change
> in this patch.
>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> ---
>  arch/ia64/include/asm/acpi.h  |    5 +----
>  arch/ia64/kernel/acpi.c       |   17 +++++++++++++++++
>  arch/x86/include/asm/acpi.h   |   19 +------------------
>  arch/x86/kernel/acpi/cstate.c |   31 +++++++++++++++++++++++++++++++
>  drivers/acpi/processor_core.c |   19 +------------------
>  5 files changed, 51 insertions(+), 40 deletions(-)
>
> diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
> index d651102..d2b8b9d 100644
> --- a/arch/ia64/include/asm/acpi.h
> +++ b/arch/ia64/include/asm/acpi.h
> @@ -152,10 +152,7 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
>  #endif
>
>  static inline bool arch_has_acpi_pdc(void) { return true; }
> -static inline void arch_acpi_set_pdc_bits(u32 *buf)
> -{
> -       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
> -}
> +extern void arch_acpi_set_pdc_bits(u32 *buf);
>
>  #define acpi_unlazy_tlb(x)
>
> diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
> index 07d209c..d71f64a 100644
> --- a/arch/ia64/kernel/acpi.c
> +++ b/arch/ia64/kernel/acpi.c
> @@ -1014,3 +1014,20 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);
>   * TBD when when IA64 starts to support suspend...
>   */
>  int acpi_suspend_lowlevel(void) { return 0; }
> +
> +void arch_acpi_set_pdc_bits(u32 *buf)
> +{
> +       /* Enable coordination with firmware's _TSD info */
> +       buf[2] |= ACPI_PDC_SMP_T_SWCOORD;

Hi Hanjun:
            You can write like this.
            buf[2] |= ACPI_PDC_SMP_T_SWCOORD | ACPI_PDC_EST_CAPABILITY_SMP;

> +       if (boot_option_idle_override == IDLE_NOMWAIT) {
> +               /*
> +                * If mwait is disabled for CPU C-states, the C2C3_FFH access
> +                * mode will be disabled in the parameter of _PDC object.
> +                * Of course C1_FFH access mode will also be disabled.
> +                */
> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
> +
> +       }
> +
> +       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
> +}
> diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
> index c8c1e70..e9f71bc 100644
> --- a/arch/x86/include/asm/acpi.h
> +++ b/arch/x86/include/asm/acpi.h
> @@ -147,24 +147,7 @@ static inline bool arch_has_acpi_pdc(void)
>                 c->x86_vendor == X86_VENDOR_CENTAUR);
>  }
>
> -static inline void arch_acpi_set_pdc_bits(u32 *buf)
> -{
> -       struct cpuinfo_x86 *c = &cpu_data(0);
> -
> -       buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
> -
> -       if (cpu_has(c, X86_FEATURE_EST))
> -               buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
> -
> -       if (cpu_has(c, X86_FEATURE_ACPI))
> -               buf[2] |= ACPI_PDC_T_FFH;
> -
> -       /*
> -        * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
> -        */
> -       if (!cpu_has(c, X86_FEATURE_MWAIT))
> -               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
> -}
> +extern void arch_acpi_set_pdc_bits(u32 *buf);
>
>  #else /* !CONFIG_ACPI */
>
> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
> index e69182f..aa9aed9 100644
> --- a/arch/x86/kernel/acpi/cstate.c
> +++ b/arch/x86/kernel/acpi/cstate.c
> @@ -16,6 +16,37 @@
>  #include <asm/mwait.h>
>  #include <asm/special_insns.h>
>
> +void arch_acpi_set_pdc_bits(u32 *buf)
> +{
> +       struct cpuinfo_x86 *c = &cpu_data(0);
> +
> +       /* Enable coordination with firmware's _TSD info */
> +       buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
> +       if (boot_option_idle_override == IDLE_NOMWAIT) {
> +               /*
> +                * If mwait is disabled for CPU C-states, the C2C3_FFH access
> +                * mode will be disabled in the parameter of _PDC object.
> +                * Of course C1_FFH access mode will also be disabled.
> +                */
> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
> +
> +       }
> +
> +       buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;

This is not right. ACPI_PDC_C_CAPABILITY_SMP contians ACPI_PDC_C_C1_FFH and
ACPI_PDC_C_C2C3_FFH. boot_option_idle_override is meaningless here.

You should keep original order and put the check at last.


> +
> +       if (cpu_has(c, X86_FEATURE_EST))
> +               buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
> +
> +       if (cpu_has(c, X86_FEATURE_ACPI))
> +               buf[2] |= ACPI_PDC_T_FFH;
> +
> +       /*
> +        * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
> +        */
> +       if (!cpu_has(c, X86_FEATURE_MWAIT))
> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
> +}
> +
>  /*
>   * Initialize bm_flags based on the CPU cache properties
>   * On SMP it depends on cache configuration
> diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
> index 01b2656..31a4281 100644
> --- a/drivers/acpi/processor_core.c
> +++ b/drivers/acpi/processor_core.c
> @@ -255,9 +255,6 @@ static void acpi_set_pdc_bits(u32 *buf)
>         buf[0] = ACPI_PDC_REVISION_ID;
>         buf[1] = 1;
>
> -       /* Enable coordination with firmware's _TSD info */
> -       buf[2] = ACPI_PDC_SMP_T_SWCOORD;
> -
>         /* Twiddle arch-specific bits needed for _PDC */
>         arch_acpi_set_pdc_bits(buf);
>  }
> @@ -282,7 +279,7 @@ static struct acpi_object_list *acpi_processor_alloc_pdc(void)
>                 return NULL;
>         }
>
> -       buf = kmalloc(12, GFP_KERNEL);
> +       buf = kzalloc(12, GFP_KERNEL);
>         if (!buf) {
>                 printk(KERN_ERR "Memory allocation error\n");
>                 kfree(obj);
> @@ -310,20 +307,6 @@ acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
>  {
>         acpi_status status = AE_OK;
>
> -       if (boot_option_idle_override == IDLE_NOMWAIT) {
> -               /*
> -                * If mwait is disabled for CPU C-states, the C2C3_FFH access
> -                * mode will be disabled in the parameter of _PDC object.
> -                * Of course C1_FFH access mode will also be disabled.
> -                */
> -               union acpi_object *obj;
> -               u32 *buffer = NULL;
> -
> -               obj = pdc_in->pointer;
> -               buffer = (u32 *)(obj->buffer.pointer);
> -               buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
> -
> -       }
>         status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
>
>         if (ACPI_FAILURE(status))
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best regards
Tianyu Lan

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

* Re: [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent
  2014-02-10  2:21   ` Lan Tianyu
@ 2014-02-10  7:09       ` Hanjun Guo
  0 siblings, 0 replies; 10+ messages in thread
From: Hanjun Guo @ 2014-02-10  7:09 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Rafael J. Wysocki, linux-acpi, Patch Tracking,
	linux-kernel@vger kernel org, linaro-acpi, Graeme Gregory

Hi Tianyu,

On 2014年02月10日 10:21, Lan Tianyu wrote:
> 2014-02-08 21:10 GMT+08:00 Hanjun Guo <hanjun.guo@linaro.org>:
>> _PDC related stuff in processor_core.c is little bit X86/IA64 dependent,
>> rework the code to make it more arch-independent, no functional change
>> in this patch.
>>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
>> ---
>>   arch/ia64/include/asm/acpi.h  |    5 +----
>>   arch/ia64/kernel/acpi.c       |   17 +++++++++++++++++
>>   arch/x86/include/asm/acpi.h   |   19 +------------------
>>   arch/x86/kernel/acpi/cstate.c |   31 +++++++++++++++++++++++++++++++
>>   drivers/acpi/processor_core.c |   19 +------------------
>>   5 files changed, 51 insertions(+), 40 deletions(-)
>>
>> diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
>> index d651102..d2b8b9d 100644
>> --- a/arch/ia64/include/asm/acpi.h
>> +++ b/arch/ia64/include/asm/acpi.h
>> @@ -152,10 +152,7 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
>>   #endif
>>
>>   static inline bool arch_has_acpi_pdc(void) { return true; }
>> -static inline void arch_acpi_set_pdc_bits(u32 *buf)
>> -{
>> -       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
>> -}
>> +extern void arch_acpi_set_pdc_bits(u32 *buf);
>>
>>   #define acpi_unlazy_tlb(x)
>>
>> diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
>> index 07d209c..d71f64a 100644
>> --- a/arch/ia64/kernel/acpi.c
>> +++ b/arch/ia64/kernel/acpi.c
>> @@ -1014,3 +1014,20 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);
>>    * TBD when when IA64 starts to support suspend...
>>    */
>>   int acpi_suspend_lowlevel(void) { return 0; }
>> +
>> +void arch_acpi_set_pdc_bits(u32 *buf)
>> +{
>> +       /* Enable coordination with firmware's _TSD info */
>> +       buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
> Hi Hanjun:
>              You can write like this.
>              buf[2] |= ACPI_PDC_SMP_T_SWCOORD | ACPI_PDC_EST_CAPABILITY_SMP;

Thanks for the suggestion, will update it.

>
>> +       if (boot_option_idle_override == IDLE_NOMWAIT) {
>> +               /*
>> +                * If mwait is disabled for CPU C-states, the C2C3_FFH access
>> +                * mode will be disabled in the parameter of _PDC object.
>> +                * Of course C1_FFH access mode will also be disabled.
>> +                */
>> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
>> +
>> +       }
>> +
>> +       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
>> +}
>> diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
>> index c8c1e70..e9f71bc 100644
>> --- a/arch/x86/include/asm/acpi.h
>> +++ b/arch/x86/include/asm/acpi.h
>> @@ -147,24 +147,7 @@ static inline bool arch_has_acpi_pdc(void)
>>                  c->x86_vendor == X86_VENDOR_CENTAUR);
>>   }
>>
>> -static inline void arch_acpi_set_pdc_bits(u32 *buf)
>> -{
>> -       struct cpuinfo_x86 *c = &cpu_data(0);
>> -
>> -       buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
>> -
>> -       if (cpu_has(c, X86_FEATURE_EST))
>> -               buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
>> -
>> -       if (cpu_has(c, X86_FEATURE_ACPI))
>> -               buf[2] |= ACPI_PDC_T_FFH;
>> -
>> -       /*
>> -        * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
>> -        */
>> -       if (!cpu_has(c, X86_FEATURE_MWAIT))
>> -               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
>> -}
>> +extern void arch_acpi_set_pdc_bits(u32 *buf);
>>
>>   #else /* !CONFIG_ACPI */
>>
>> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
>> index e69182f..aa9aed9 100644
>> --- a/arch/x86/kernel/acpi/cstate.c
>> +++ b/arch/x86/kernel/acpi/cstate.c
>> @@ -16,6 +16,37 @@
>>   #include <asm/mwait.h>
>>   #include <asm/special_insns.h>
>>
>> +void arch_acpi_set_pdc_bits(u32 *buf)
>> +{
>> +       struct cpuinfo_x86 *c = &cpu_data(0);
>> +
>> +       /* Enable coordination with firmware's _TSD info */
>> +       buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
>> +       if (boot_option_idle_override == IDLE_NOMWAIT) {
>> +               /*
>> +                * If mwait is disabled for CPU C-states, the C2C3_FFH access
>> +                * mode will be disabled in the parameter of _PDC object.
>> +                * Of course C1_FFH access mode will also be disabled.
>> +                */
>> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
>> +
>> +       }
>> +
>> +       buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
> This is not right. ACPI_PDC_C_CAPABILITY_SMP contians ACPI_PDC_C_C1_FFH and
> ACPI_PDC_C_C2C3_FFH. boot_option_idle_override is meaningless here.
>
> You should keep original order and put the check at last.

Good catch! I will update this patch, thanks for your review :)

Best regards
Hanjun
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent
@ 2014-02-10  7:09       ` Hanjun Guo
  0 siblings, 0 replies; 10+ messages in thread
From: Hanjun Guo @ 2014-02-10  7:09 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Rafael J. Wysocki, linux-acpi, Patch Tracking,
	linux-kernel@vger kernel org, linaro-acpi, Graeme Gregory

Hi Tianyu,

On 2014年02月10日 10:21, Lan Tianyu wrote:
> 2014-02-08 21:10 GMT+08:00 Hanjun Guo <hanjun.guo@linaro.org>:
>> _PDC related stuff in processor_core.c is little bit X86/IA64 dependent,
>> rework the code to make it more arch-independent, no functional change
>> in this patch.
>>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
>> ---
>>   arch/ia64/include/asm/acpi.h  |    5 +----
>>   arch/ia64/kernel/acpi.c       |   17 +++++++++++++++++
>>   arch/x86/include/asm/acpi.h   |   19 +------------------
>>   arch/x86/kernel/acpi/cstate.c |   31 +++++++++++++++++++++++++++++++
>>   drivers/acpi/processor_core.c |   19 +------------------
>>   5 files changed, 51 insertions(+), 40 deletions(-)
>>
>> diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
>> index d651102..d2b8b9d 100644
>> --- a/arch/ia64/include/asm/acpi.h
>> +++ b/arch/ia64/include/asm/acpi.h
>> @@ -152,10 +152,7 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
>>   #endif
>>
>>   static inline bool arch_has_acpi_pdc(void) { return true; }
>> -static inline void arch_acpi_set_pdc_bits(u32 *buf)
>> -{
>> -       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
>> -}
>> +extern void arch_acpi_set_pdc_bits(u32 *buf);
>>
>>   #define acpi_unlazy_tlb(x)
>>
>> diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
>> index 07d209c..d71f64a 100644
>> --- a/arch/ia64/kernel/acpi.c
>> +++ b/arch/ia64/kernel/acpi.c
>> @@ -1014,3 +1014,20 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);
>>    * TBD when when IA64 starts to support suspend...
>>    */
>>   int acpi_suspend_lowlevel(void) { return 0; }
>> +
>> +void arch_acpi_set_pdc_bits(u32 *buf)
>> +{
>> +       /* Enable coordination with firmware's _TSD info */
>> +       buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
> Hi Hanjun:
>              You can write like this.
>              buf[2] |= ACPI_PDC_SMP_T_SWCOORD | ACPI_PDC_EST_CAPABILITY_SMP;

Thanks for the suggestion, will update it.

>
>> +       if (boot_option_idle_override == IDLE_NOMWAIT) {
>> +               /*
>> +                * If mwait is disabled for CPU C-states, the C2C3_FFH access
>> +                * mode will be disabled in the parameter of _PDC object.
>> +                * Of course C1_FFH access mode will also be disabled.
>> +                */
>> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
>> +
>> +       }
>> +
>> +       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
>> +}
>> diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
>> index c8c1e70..e9f71bc 100644
>> --- a/arch/x86/include/asm/acpi.h
>> +++ b/arch/x86/include/asm/acpi.h
>> @@ -147,24 +147,7 @@ static inline bool arch_has_acpi_pdc(void)
>>                  c->x86_vendor == X86_VENDOR_CENTAUR);
>>   }
>>
>> -static inline void arch_acpi_set_pdc_bits(u32 *buf)
>> -{
>> -       struct cpuinfo_x86 *c = &cpu_data(0);
>> -
>> -       buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
>> -
>> -       if (cpu_has(c, X86_FEATURE_EST))
>> -               buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
>> -
>> -       if (cpu_has(c, X86_FEATURE_ACPI))
>> -               buf[2] |= ACPI_PDC_T_FFH;
>> -
>> -       /*
>> -        * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
>> -        */
>> -       if (!cpu_has(c, X86_FEATURE_MWAIT))
>> -               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
>> -}
>> +extern void arch_acpi_set_pdc_bits(u32 *buf);
>>
>>   #else /* !CONFIG_ACPI */
>>
>> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
>> index e69182f..aa9aed9 100644
>> --- a/arch/x86/kernel/acpi/cstate.c
>> +++ b/arch/x86/kernel/acpi/cstate.c
>> @@ -16,6 +16,37 @@
>>   #include <asm/mwait.h>
>>   #include <asm/special_insns.h>
>>
>> +void arch_acpi_set_pdc_bits(u32 *buf)
>> +{
>> +       struct cpuinfo_x86 *c = &cpu_data(0);
>> +
>> +       /* Enable coordination with firmware's _TSD info */
>> +       buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
>> +       if (boot_option_idle_override == IDLE_NOMWAIT) {
>> +               /*
>> +                * If mwait is disabled for CPU C-states, the C2C3_FFH access
>> +                * mode will be disabled in the parameter of _PDC object.
>> +                * Of course C1_FFH access mode will also be disabled.
>> +                */
>> +               buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
>> +
>> +       }
>> +
>> +       buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
> This is not right. ACPI_PDC_C_CAPABILITY_SMP contians ACPI_PDC_C_C1_FFH and
> ACPI_PDC_C_C2C3_FFH. boot_option_idle_override is meaningless here.
>
> You should keep original order and put the check at last.

Good catch! I will update this patch, thanks for your review :)

Best regards
Hanjun

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

* Re: [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64
  2014-02-08 13:10 ` [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64 Hanjun Guo
  2014-02-10  1:55   ` Lan Tianyu
@ 2014-02-18  1:13   ` Rafael J. Wysocki
  2014-02-18  8:59     ` Hanjun Guo
  1 sibling, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2014-02-18  1:13 UTC (permalink / raw)
  To: Hanjun Guo; +Cc: linux-acpi, patches, linux-kernel, linaro-acpi

On Saturday, February 08, 2014 09:10:16 PM Hanjun Guo wrote:
> idle_boot_override depends on x86 and ia64 now, and we can not
> foresee it will be used on ARM or ARM64,so move the code into
> CONFIG_X86 and CONFIG_IA64 #ifdefs to make processor_core.c
> can be compiled on ARM64.
> 
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  drivers/acpi/processor_core.c |   40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
> index 46583d7..01b2656 100644
> --- a/drivers/acpi/processor_core.c
> +++ b/drivers/acpi/processor_core.c
> @@ -19,24 +19,6 @@
>  #define _COMPONENT		ACPI_PROCESSOR_COMPONENT
>  ACPI_MODULE_NAME("processor_core");
>  
> -static int __init set_no_mwait(const struct dmi_system_id *id)
> -{
> -	printk(KERN_NOTICE PREFIX "%s detected - "
> -		"disabling mwait for CPU C-states\n", id->ident);
> -	boot_option_idle_override = IDLE_NOMWAIT;
> -	return 0;
> -}
> -
> -static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
> -	{
> -	set_no_mwait, "Extensa 5220", {
> -	DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
> -	DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> -	DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
> -	DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
> -	{},
> -};
> -
>  static int map_lapic_id(struct acpi_subtable_header *entry,
>  		 u32 acpi_id, int *apic_id)
>  {
> @@ -379,13 +361,35 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
>  	return AE_OK;
>  }
>  
> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
> +static int __init set_no_mwait(const struct dmi_system_id *id)
> +{
> +	printk(KERN_NOTICE PREFIX "%s detected - "
> +		"disabling mwait for CPU C-states\n", id->ident);
> +	boot_option_idle_override = IDLE_NOMWAIT;
> +	return 0;
> +}
> +
> +static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
> +	{
> +	set_no_mwait, "Extensa 5220", {
> +	DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
> +	DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> +	DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
> +	DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
> +	{},
> +};
> +#endif
> +
>  void __init acpi_early_processor_set_pdc(void)
>  {
> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
>  	/*
>  	 * Check whether the system is DMI table. If yes, OSPM
>  	 * should not use mwait for CPU-states.
>  	 */
>  	dmi_check_system(processor_idle_dmi_table);
> +#endif

Please define processor_dmi_check() under the #if above and an empty static
inline counterpart of it for the case when the #if condition is not satisfied.
Then just call processor_dmi_check() here without the #if block in the body
of the function. 

There is a general rule to avoid preprocessor directives in function bodies.

>  
>  	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
>  			    ACPI_UINT32_MAX,
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64
  2014-02-18  1:13   ` Rafael J. Wysocki
@ 2014-02-18  8:59     ` Hanjun Guo
  0 siblings, 0 replies; 10+ messages in thread
From: Hanjun Guo @ 2014-02-18  8:59 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, patches, linux-kernel, linaro-acpi

On 2014-2-18 9:13, Rafael J. Wysocki wrote:
> On Saturday, February 08, 2014 09:10:16 PM Hanjun Guo wrote:
>> idle_boot_override depends on x86 and ia64 now, and we can not
>> foresee it will be used on ARM or ARM64,so move the code into
>> CONFIG_X86 and CONFIG_IA64 #ifdefs to make processor_core.c
>> can be compiled on ARM64.
>>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> ---
>>  drivers/acpi/processor_core.c |   40 ++++++++++++++++++++++------------------
>>  1 file changed, 22 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
>> index 46583d7..01b2656 100644
>> --- a/drivers/acpi/processor_core.c
>> +++ b/drivers/acpi/processor_core.c
>> @@ -19,24 +19,6 @@
>>  #define _COMPONENT		ACPI_PROCESSOR_COMPONENT
>>  ACPI_MODULE_NAME("processor_core");
>>  
>> -static int __init set_no_mwait(const struct dmi_system_id *id)
>> -{
>> -	printk(KERN_NOTICE PREFIX "%s detected - "
>> -		"disabling mwait for CPU C-states\n", id->ident);
>> -	boot_option_idle_override = IDLE_NOMWAIT;
>> -	return 0;
>> -}
>> -
>> -static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
>> -	{
>> -	set_no_mwait, "Extensa 5220", {
>> -	DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
>> -	DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
>> -	DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
>> -	DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
>> -	{},
>> -};
>> -
>>  static int map_lapic_id(struct acpi_subtable_header *entry,
>>  		 u32 acpi_id, int *apic_id)
>>  {
>> @@ -379,13 +361,35 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
>>  	return AE_OK;
>>  }
>>  
>> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
>> +static int __init set_no_mwait(const struct dmi_system_id *id)
>> +{
>> +	printk(KERN_NOTICE PREFIX "%s detected - "
>> +		"disabling mwait for CPU C-states\n", id->ident);
>> +	boot_option_idle_override = IDLE_NOMWAIT;
>> +	return 0;
>> +}
>> +
>> +static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
>> +	{
>> +	set_no_mwait, "Extensa 5220", {
>> +	DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
>> +	DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
>> +	DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
>> +	DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
>> +	{},
>> +};
>> +#endif
>> +
>>  void __init acpi_early_processor_set_pdc(void)
>>  {
>> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
>>  	/*
>>  	 * Check whether the system is DMI table. If yes, OSPM
>>  	 * should not use mwait for CPU-states.
>>  	 */
>>  	dmi_check_system(processor_idle_dmi_table);
>> +#endif
> 
> Please define processor_dmi_check() under the #if above and an empty static
> inline counterpart of it for the case when the #if condition is not satisfied.
> Then just call processor_dmi_check() here without the #if block in the body
> of the function. 
> 
> There is a general rule to avoid preprocessor directives in function bodies.

Ok,will update soon, thanks for the comments.

Thanks
Hanjun

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

end of thread, other threads:[~2014-02-18  8:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-08 13:10 [PATCH v2 0/3] Prepare for running ACPI on !x86 and !ia64 Hanjun Guo
2014-02-08 13:10 ` [PATCH v2 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64 Hanjun Guo
2014-02-10  1:55   ` Lan Tianyu
2014-02-18  1:13   ` Rafael J. Wysocki
2014-02-18  8:59     ` Hanjun Guo
2014-02-08 13:10 ` [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
2014-02-10  2:21   ` Lan Tianyu
2014-02-10  7:09     ` Hanjun Guo
2014-02-10  7:09       ` Hanjun Guo
2014-02-08 13:10 ` [PATCH v2 3/3] ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Hanjun Guo

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.