All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-24 14:02 ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

Some fixes since last version:

 - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
   compile errors on XEN ACPI, Stefano and Julien are ok with this
   temporary solution.
 - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
   is passed", which will fix the problem that the device tree will
   be unflattened even if acpi=force passed, that will not obey the
   policy.
 - update patch "irqchip: Add GICv2 specific ACPI boot support",
   which will cause compile error on i386 with both DT and ACPI
   enabled:

   All error/warnings:

    In file included from include/linux/acpi_irq.h:4:0,
                     from drivers/irqchip/irqchip.c:11:
    arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
     extern bool handle_irq(unsigned irq, struct pt_regs *regs);
            ^
    arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
    inside parameter list
     extern bool handle_irq(unsigned irq, struct pt_regs *regs);
                                                 ^
    arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
    definition or declaration, which is probably not what you want
    ....

   That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
   and <linux/acpi_irq.h> will be put on the top of all head files,
   so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
   <linux/irq.h>, it will include <linux/*.h> before include
   <asm/irq.h>), this is the only update for this patch.

Lorenzo will send some cleanup patches on top of this one soon.

Thanks
Hanjun

Al Stone (4):
  ARM64 / ACPI: Get RSDP and ACPI boot-time tables
  ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
  ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
    ARM64
  ARM64 / ACPI: additions of ACPI documentation for arm64

Graeme Gregory (6):
  ACPI: add arm64 to the platforms that use ioremap
  ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
  ARM64 / ACPI: If we chose to boot from acpi then disable FDT
  ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
  ARM64 / ACPI: Enable ARM64 in Kconfig
  Documentation: ACPI for ARM64

Hanjun Guo (10):
  ACPI / table: Use pr_debug() instead of pr_info() for MADT table
    scanning
  ARM64 / ACPI: Introduce PCI stub functions for ACPI
  ACPI / table: Print GIC information when MADT is parsed
  ARM64 / ACPI: Parse MADT for SMP initialization
  ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  ACPI / processor: Make it possible to get CPU hardware ID via GICC
  ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
  clocksource / arch_timer: Parse GTDT to initialize arch timer
  XEN / ACPI: Make XEN ACPI depend on X86
  ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed

Mark Salter (2):
  ARM64: allow late use of early_ioremap
  ACPI: fix acpi_os_ioremap for arm64

Tomasz Nowicki (1):
  irqchip: Add GICv2 specific ACPI boot support

 Documentation/arm64/acpi_object_usage.txt | 593 ++++++++++++++++++++++++++++++
 Documentation/arm64/arm-acpi.txt          | 505 +++++++++++++++++++++++++
 Documentation/kernel-parameters.txt       |   3 +-
 arch/arm64/Kconfig                        |   3 +
 arch/arm64/include/asm/acenv.h            |  18 +
 arch/arm64/include/asm/acpi.h             |  99 +++++
 arch/arm64/include/asm/cpu_ops.h          |   1 +
 arch/arm64/include/asm/fixmap.h           |   3 +
 arch/arm64/include/asm/irq.h              |  13 +
 arch/arm64/include/asm/pci.h              |   6 +
 arch/arm64/include/asm/psci.h             |   3 +-
 arch/arm64/include/asm/smp.h              |   5 +-
 arch/arm64/kernel/Makefile                |   1 +
 arch/arm64/kernel/acpi.c                  | 392 ++++++++++++++++++++
 arch/arm64/kernel/cpu_ops.c               |   2 +-
 arch/arm64/kernel/pci.c                   |  25 ++
 arch/arm64/kernel/psci.c                  |  78 ++--
 arch/arm64/kernel/setup.c                 |  21 +-
 arch/arm64/kernel/smp.c                   |   2 +-
 arch/arm64/kernel/time.c                  |   7 +
 arch/ia64/Kconfig                         |   1 +
 arch/ia64/kernel/acpi.c                   |   2 +-
 arch/x86/Kconfig                          |   1 +
 arch/x86/kernel/acpi/boot.c               |   2 +-
 drivers/acpi/Kconfig                      |   7 +-
 drivers/acpi/Makefile                     |   2 +-
 drivers/acpi/acpi_processor.c             |   7 +-
 drivers/acpi/bus.c                        |   3 +
 drivers/acpi/internal.h                   |   4 +
 drivers/acpi/osl.c                        |   6 +-
 drivers/acpi/processor_core.c             |  60 ++-
 drivers/acpi/tables.c                     |  52 ++-
 drivers/clocksource/arm_arch_timer.c      | 132 +++++--
 drivers/irqchip/irq-gic.c                 | 102 +++++
 drivers/irqchip/irqchip.c                 |   3 +
 drivers/xen/Kconfig                       |   4 +
 drivers/xen/Makefile                      |   2 +-
 include/acpi/acpi_io.h                    |   4 +
 include/acpi/processor.h                  |   6 +-
 include/linux/acpi.h                      |   8 +-
 include/linux/acpi_irq.h                  |  10 +
 include/linux/clocksource.h               |   6 +
 include/linux/irqchip/arm-gic-acpi.h      |  31 ++
 43 files changed, 2129 insertions(+), 106 deletions(-)
 create mode 100644 Documentation/arm64/acpi_object_usage.txt
 create mode 100644 Documentation/arm64/arm-acpi.txt
 create mode 100644 arch/arm64/include/asm/acenv.h
 create mode 100644 arch/arm64/include/asm/acpi.h
 create mode 100644 arch/arm64/kernel/acpi.c
 create mode 100644 include/linux/acpi_irq.h
 create mode 100644 include/linux/irqchip/arm-gic-acpi.h

-- 
1.9.1


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

* [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-24 14:02 ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Some fixes since last version:

 - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
   compile errors on XEN ACPI, Stefano and Julien are ok with this
   temporary solution.
 - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
   is passed", which will fix the problem that the device tree will
   be unflattened even if acpi=force passed, that will not obey the
   policy.
 - update patch "irqchip: Add GICv2 specific ACPI boot support",
   which will cause compile error on i386 with both DT and ACPI
   enabled:

   All error/warnings:

    In file included from include/linux/acpi_irq.h:4:0,
                     from drivers/irqchip/irqchip.c:11:
    arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
     extern bool handle_irq(unsigned irq, struct pt_regs *regs);
            ^
    arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
    inside parameter list
     extern bool handle_irq(unsigned irq, struct pt_regs *regs);
                                                 ^
    arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
    definition or declaration, which is probably not what you want
    ....

   That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
   and <linux/acpi_irq.h> will be put on the top of all head files,
   so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
   <linux/irq.h>, it will include <linux/*.h> before include
   <asm/irq.h>), this is the only update for this patch.

Lorenzo will send some cleanup patches on top of this one soon.

Thanks
Hanjun

Al Stone (4):
  ARM64 / ACPI: Get RSDP and ACPI boot-time tables
  ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
  ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
    ARM64
  ARM64 / ACPI: additions of ACPI documentation for arm64

Graeme Gregory (6):
  ACPI: add arm64 to the platforms that use ioremap
  ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
  ARM64 / ACPI: If we chose to boot from acpi then disable FDT
  ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
  ARM64 / ACPI: Enable ARM64 in Kconfig
  Documentation: ACPI for ARM64

Hanjun Guo (10):
  ACPI / table: Use pr_debug() instead of pr_info() for MADT table
    scanning
  ARM64 / ACPI: Introduce PCI stub functions for ACPI
  ACPI / table: Print GIC information when MADT is parsed
  ARM64 / ACPI: Parse MADT for SMP initialization
  ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  ACPI / processor: Make it possible to get CPU hardware ID via GICC
  ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
  clocksource / arch_timer: Parse GTDT to initialize arch timer
  XEN / ACPI: Make XEN ACPI depend on X86
  ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed

Mark Salter (2):
  ARM64: allow late use of early_ioremap
  ACPI: fix acpi_os_ioremap for arm64

Tomasz Nowicki (1):
  irqchip: Add GICv2 specific ACPI boot support

 Documentation/arm64/acpi_object_usage.txt | 593 ++++++++++++++++++++++++++++++
 Documentation/arm64/arm-acpi.txt          | 505 +++++++++++++++++++++++++
 Documentation/kernel-parameters.txt       |   3 +-
 arch/arm64/Kconfig                        |   3 +
 arch/arm64/include/asm/acenv.h            |  18 +
 arch/arm64/include/asm/acpi.h             |  99 +++++
 arch/arm64/include/asm/cpu_ops.h          |   1 +
 arch/arm64/include/asm/fixmap.h           |   3 +
 arch/arm64/include/asm/irq.h              |  13 +
 arch/arm64/include/asm/pci.h              |   6 +
 arch/arm64/include/asm/psci.h             |   3 +-
 arch/arm64/include/asm/smp.h              |   5 +-
 arch/arm64/kernel/Makefile                |   1 +
 arch/arm64/kernel/acpi.c                  | 392 ++++++++++++++++++++
 arch/arm64/kernel/cpu_ops.c               |   2 +-
 arch/arm64/kernel/pci.c                   |  25 ++
 arch/arm64/kernel/psci.c                  |  78 ++--
 arch/arm64/kernel/setup.c                 |  21 +-
 arch/arm64/kernel/smp.c                   |   2 +-
 arch/arm64/kernel/time.c                  |   7 +
 arch/ia64/Kconfig                         |   1 +
 arch/ia64/kernel/acpi.c                   |   2 +-
 arch/x86/Kconfig                          |   1 +
 arch/x86/kernel/acpi/boot.c               |   2 +-
 drivers/acpi/Kconfig                      |   7 +-
 drivers/acpi/Makefile                     |   2 +-
 drivers/acpi/acpi_processor.c             |   7 +-
 drivers/acpi/bus.c                        |   3 +
 drivers/acpi/internal.h                   |   4 +
 drivers/acpi/osl.c                        |   6 +-
 drivers/acpi/processor_core.c             |  60 ++-
 drivers/acpi/tables.c                     |  52 ++-
 drivers/clocksource/arm_arch_timer.c      | 132 +++++--
 drivers/irqchip/irq-gic.c                 | 102 +++++
 drivers/irqchip/irqchip.c                 |   3 +
 drivers/xen/Kconfig                       |   4 +
 drivers/xen/Makefile                      |   2 +-
 include/acpi/acpi_io.h                    |   4 +
 include/acpi/processor.h                  |   6 +-
 include/linux/acpi.h                      |   8 +-
 include/linux/acpi_irq.h                  |  10 +
 include/linux/clocksource.h               |   6 +
 include/linux/irqchip/arm-gic-acpi.h      |  31 ++
 43 files changed, 2129 insertions(+), 106 deletions(-)
 create mode 100644 Documentation/arm64/acpi_object_usage.txt
 create mode 100644 Documentation/arm64/arm-acpi.txt
 create mode 100644 arch/arm64/include/asm/acenv.h
 create mode 100644 arch/arm64/include/asm/acpi.h
 create mode 100644 arch/arm64/kernel/acpi.c
 create mode 100644 include/linux/acpi_irq.h
 create mode 100644 include/linux/irqchip/arm-gic-acpi.h

-- 
1.9.1

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

* [patch v11 01/23] ACPI / table: Use pr_debug() instead of pr_info() for MADT table scanning
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

For a normal 8 cpu sockets system, it will up to 240 cpu threads (Xeon E7
v2 family for now), and we need 240 entries for local apic or local x2apic
in MADT table, so it will be much verbose information printed with a slow
uart console when system booted, this will be even worse with large system
with 16/32 cpu sockets.

This patch just use pr_debug() instead of pr_info() for ioapic/iosapic,
local apic/x2apic/sapic structures when scanning the MADT table to remove
those verbose information, but leave other structures unchanged.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/tables.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 93b8152..f4e5b88 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -23,6 +23,8 @@
  *
  */
 
+/* Uncomment next line to get verbose printout */
+/* #define DEBUG */
 #define pr_fmt(fmt) "ACPI: " fmt
 
 #include <linux/init.h>
@@ -61,9 +63,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_local_apic *p =
 			    (struct acpi_madt_local_apic *)header;
-			pr_info("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
-				p->processor_id, p->id,
-				(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+			pr_debug("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
+				 p->processor_id, p->id,
+				 (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
 		}
 		break;
 
@@ -71,9 +73,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_local_x2apic *p =
 			    (struct acpi_madt_local_x2apic *)header;
-			pr_info("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
-				p->local_apic_id, p->uid,
-				(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+			pr_debug("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
+				 p->local_apic_id, p->uid,
+				 (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
 		}
 		break;
 
@@ -81,8 +83,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_io_apic *p =
 			    (struct acpi_madt_io_apic *)header;
-			pr_info("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
-				p->id, p->address, p->global_irq_base);
+			pr_debug("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
+				 p->id, p->address, p->global_irq_base);
 		}
 		break;
 
@@ -155,9 +157,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_io_sapic *p =
 			    (struct acpi_madt_io_sapic *)header;
-			pr_info("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
-				p->id, (void *)(unsigned long)p->address,
-				p->global_irq_base);
+			pr_debug("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
+				 p->id, (void *)(unsigned long)p->address,
+				 p->global_irq_base);
 		}
 		break;
 
@@ -165,9 +167,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_local_sapic *p =
 			    (struct acpi_madt_local_sapic *)header;
-			pr_info("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
-				p->processor_id, p->id, p->eid,
-				(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+			pr_debug("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
+				 p->processor_id, p->id, p->eid,
+				 (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
 		}
 		break;
 
-- 
1.9.1

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

* [patch v11 01/23] ACPI / table: Use pr_debug() instead of pr_info() for MADT table scanning
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

For a normal 8 cpu sockets system, it will up to 240 cpu threads (Xeon E7
v2 family for now), and we need 240 entries for local apic or local x2apic
in MADT table, so it will be much verbose information printed with a slow
uart console when system booted, this will be even worse with large system
with 16/32 cpu sockets.

This patch just use pr_debug() instead of pr_info() for ioapic/iosapic,
local apic/x2apic/sapic structures when scanning the MADT table to remove
those verbose information, but leave other structures unchanged.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/tables.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 93b8152..f4e5b88 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -23,6 +23,8 @@
  *
  */
 
+/* Uncomment next line to get verbose printout */
+/* #define DEBUG */
 #define pr_fmt(fmt) "ACPI: " fmt
 
 #include <linux/init.h>
@@ -61,9 +63,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_local_apic *p =
 			    (struct acpi_madt_local_apic *)header;
-			pr_info("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
-				p->processor_id, p->id,
-				(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+			pr_debug("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
+				 p->processor_id, p->id,
+				 (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
 		}
 		break;
 
@@ -71,9 +73,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_local_x2apic *p =
 			    (struct acpi_madt_local_x2apic *)header;
-			pr_info("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
-				p->local_apic_id, p->uid,
-				(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+			pr_debug("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
+				 p->local_apic_id, p->uid,
+				 (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
 		}
 		break;
 
@@ -81,8 +83,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_io_apic *p =
 			    (struct acpi_madt_io_apic *)header;
-			pr_info("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
-				p->id, p->address, p->global_irq_base);
+			pr_debug("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
+				 p->id, p->address, p->global_irq_base);
 		}
 		break;
 
@@ -155,9 +157,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_io_sapic *p =
 			    (struct acpi_madt_io_sapic *)header;
-			pr_info("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
-				p->id, (void *)(unsigned long)p->address,
-				p->global_irq_base);
+			pr_debug("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
+				 p->id, (void *)(unsigned long)p->address,
+				 p->global_irq_base);
 		}
 		break;
 
@@ -165,9 +167,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		{
 			struct acpi_madt_local_sapic *p =
 			    (struct acpi_madt_local_sapic *)header;
-			pr_info("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
-				p->processor_id, p->id, p->eid,
-				(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+			pr_debug("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
+				 p->processor_id, p->id, p->eid,
+				 (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
 		}
 		break;
 
-- 
1.9.1

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

* [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Hanjun Guo

From: Graeme Gregory <graeme.gregory@linaro.org>

Now with the base changes to the arm memory mapping it is safe
to convert to using ioremap to map in the tables after
acpi_gbl_permanent_mmap is set.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/osl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f9eeae8..39748bb 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -336,11 +336,11 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
 	return NULL;
 }
 
-#ifndef CONFIG_IA64
-#define should_use_kmap(pfn)   page_is_ram(pfn)
-#else
+#if defined(CONFIG_IA64) || defined(CONFIG_ARM64)
 /* ioremap will take care of cache attributes */
 #define should_use_kmap(pfn)   0
+#else
+#define should_use_kmap(pfn)   page_is_ram(pfn)
 #endif
 
 static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
-- 
1.9.1

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

* [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Graeme Gregory <graeme.gregory@linaro.org>

Now with the base changes to the arm memory mapping it is safe
to convert to using ioremap to map in the tables after
acpi_gbl_permanent_mmap is set.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/osl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f9eeae8..39748bb 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -336,11 +336,11 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
 	return NULL;
 }
 
-#ifndef CONFIG_IA64
-#define should_use_kmap(pfn)   page_is_ram(pfn)
-#else
+#if defined(CONFIG_IA64) || defined(CONFIG_ARM64)
 /* ioremap will take care of cache attributes */
 #define should_use_kmap(pfn)   0
+#else
+#define should_use_kmap(pfn)   page_is_ram(pfn)
 #endif
 
 static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
-- 
1.9.1

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

* [patch v11 03/23] ARM64: allow late use of early_ioremap
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Leif Lindholm, Ard Biesheuvel,
	Hanjun Guo

From: Mark Salter <msalter@redhat.com>

Commit 0e63ea48b4d8 (arm64/efi: add missing call to early_ioremap_reset())
added a missing call to early_ioremap_reset(). This triggers a BUG if code
tries using early_ioremap() after the early_ioremap_reset(). This is a
problem for some ACPI code which needs short-lived temporary mappings
after paging_init() but before acpi_early_init() in start_kernel(). This
patch adds definitions for the __late_set_fixmap() and __late_clear_fixmap()
which avoids the BUG by allowing later use of early_ioremap().

CC: Leif Lindholm <leif.lindholm@linaro.org>
CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/fixmap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h
index defa0ff9..f196e40 100644
--- a/arch/arm64/include/asm/fixmap.h
+++ b/arch/arm64/include/asm/fixmap.h
@@ -62,6 +62,9 @@ void __init early_fixmap_init(void);
 
 #define __early_set_fixmap __set_fixmap
 
+#define __late_set_fixmap __set_fixmap
+#define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
+
 extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
 
 #include <asm-generic/fixmap.h>
-- 
1.9.1

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

* [patch v11 03/23] ARM64: allow late use of early_ioremap
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mark Salter <msalter@redhat.com>

Commit 0e63ea48b4d8 (arm64/efi: add missing call to early_ioremap_reset())
added a missing call to early_ioremap_reset(). This triggers a BUG if code
tries using early_ioremap() after the early_ioremap_reset(). This is a
problem for some ACPI code which needs short-lived temporary mappings
after paging_init() but before acpi_early_init() in start_kernel(). This
patch adds definitions for the __late_set_fixmap() and __late_clear_fixmap()
which avoids the BUG by allowing later use of early_ioremap().

CC: Leif Lindholm <leif.lindholm@linaro.org>
CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/fixmap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h
index defa0ff9..f196e40 100644
--- a/arch/arm64/include/asm/fixmap.h
+++ b/arch/arm64/include/asm/fixmap.h
@@ -62,6 +62,9 @@ void __init early_fixmap_init(void);
 
 #define __early_set_fixmap __set_fixmap
 
+#define __late_set_fixmap __set_fixmap
+#define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
+
 extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
 
 #include <asm-generic/fixmap.h>
-- 
1.9.1

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

* [patch v11 04/23] ARM64 / ACPI: Get RSDP and ACPI boot-time tables
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Lorenzo Pieralisi,
	Tomasz Nowicki, Hanjun Guo

From: Al Stone <al.stone@linaro.org>

As we want to get ACPI tables to parse and then use the information
for system initialization, we should get the RSDP (Root System
Description Pointer) first, it then locates Extended Root Description
Table (XSDT) which contains all the 64-bit physical address that
pointer to other boot-time tables.

Introduce acpi.c and its related head file in this patch to provide
fundamental needs of extern variables and functions for ACPI core,
and then get boot-time tables as needed.
  - asm/acenv.h for arch specific ACPICA environments and
    implementation, It is needed unconditionally by ACPI core;
  - asm/acpi.h for arch specific variables and functions needed by
    ACPI driver core;
  - acpi.c for ARM64 related ACPI implementation for ACPI driver
    core;

acpi_boot_table_init() is introduced to get RSDP and boot-time tables,
it will be called in setup_arch() before paging_init(), so we should
use eary_memremap() mechanism here to get the RSDP and all the table
pointers.

FADT Major.Minor version was introduced in ACPI 5.1, it is the same
as ACPI version.

In ACPI 5.1, some major gaps are fixed for ARM, such as updates in
MADT table for GIC and SMP init, without those updates, we can not
get the MPIDR for SMP init, and GICv2/3 related init information, so
we can't boot arm64 ACPI properly with table versions predating 5.1.

If firmware provides ACPI tables with ACPI version less than 5.1,
OS has no way to retrieve the configuration data that is necessary
to init SMP boot protocol and the GIC properly, so disable ACPI if
we get an FADT table with version less that 5.1 when acpi_boot_table_init()
called.

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acenv.h |  18 ++++++++
 arch/arm64/include/asm/acpi.h  |  45 ++++++++++++++++++
 arch/arm64/kernel/Makefile     |   1 +
 arch/arm64/kernel/acpi.c       | 101 +++++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c      |   5 ++
 5 files changed, 170 insertions(+)
 create mode 100644 arch/arm64/include/asm/acenv.h
 create mode 100644 arch/arm64/include/asm/acpi.h
 create mode 100644 arch/arm64/kernel/acpi.c

diff --git a/arch/arm64/include/asm/acenv.h b/arch/arm64/include/asm/acenv.h
new file mode 100644
index 0000000..b49166f
--- /dev/null
+++ b/arch/arm64/include/asm/acenv.h
@@ -0,0 +1,18 @@
+/*
+ * ARM64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Linaro Ltd.
+ *   Author: Hanjun Guo <hanjun.guo@linaro.org>
+ *   Author: Graeme Gregory <graeme.gregory@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_ACENV_H
+#define _ASM_ACENV_H
+
+/* It is required unconditionally by ACPI core, update it when needed. */
+
+#endif /* _ASM_ACENV_H */
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
new file mode 100644
index 0000000..8b837ab
--- /dev/null
+++ b/arch/arm64/include/asm/acpi.h
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (C) 2013-2014, Linaro Ltd.
+ *	Author: Al Stone <al.stone@linaro.org>
+ *	Author: Graeme Gregory <graeme.gregory@linaro.org>
+ *	Author: Hanjun Guo <hanjun.guo@linaro.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation;
+ */
+
+#ifndef _ASM_ACPI_H
+#define _ASM_ACPI_H
+
+/* Basic configuration for ACPI */
+#ifdef	CONFIG_ACPI
+#define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
+extern int acpi_disabled;
+extern int acpi_noirq;
+extern int acpi_pci_disabled;
+
+static inline void disable_acpi(void)
+{
+	acpi_disabled = 1;
+	acpi_pci_disabled = 1;
+	acpi_noirq = 1;
+}
+
+/*
+ * It's used from ACPI core in kdump to boot UP system with SMP kernel,
+ * with this check the ACPI core will not override the CPU index
+ * obtained from GICC with 0 and not print some error message as well.
+ * Since MADT must provide at least one GICC structure for GIC
+ * initialization, CPU will be always available in MADT on ARM64.
+ */
+static inline bool acpi_has_cpu_in_madt(void)
+{
+	return true;
+}
+
+static inline void arch_fix_phys_package_id(int num, u32 slot) { }
+
+#endif /* CONFIG_ACPI */
+
+#endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 5ee07ee..fdc7877 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -35,6 +35,7 @@ arm64-obj-$(CONFIG_KGDB)		+= kgdb.o
 arm64-obj-$(CONFIG_EFI)			+= efi.o efi-stub.o efi-entry.o
 arm64-obj-$(CONFIG_PCI)			+= pci.o
 arm64-obj-$(CONFIG_ARMV8_DEPRECATED)	+= armv8_deprecated.o
+arm64-obj-$(CONFIG_ACPI)		+= acpi.o
 
 obj-y					+= $(arm64-obj-y) vdso/
 obj-m					+= $(arm64-obj-m)
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
new file mode 100644
index 0000000..7abac24
--- /dev/null
+++ b/arch/arm64/kernel/acpi.c
@@ -0,0 +1,101 @@
+/*
+ *  ARM64 Specific Low-Level ACPI Boot Support
+ *
+ *  Copyright (C) 2013-2014, Linaro Ltd.
+ *	Author: Al Stone <al.stone@linaro.org>
+ *	Author: Graeme Gregory <graeme.gregory@linaro.org>
+ *	Author: Hanjun Guo <hanjun.guo@linaro.org>
+ *	Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
+ *	Author: Naresh Bhat <naresh.bhat@linaro.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#define pr_fmt(fmt) "ACPI: " fmt
+
+#include <linux/acpi.h>
+#include <linux/bootmem.h>
+#include <linux/cpumask.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/memblock.h>
+#include <linux/smp.h>
+
+int acpi_noirq;			/* skip ACPI IRQ initialization */
+int acpi_disabled;
+EXPORT_SYMBOL(acpi_disabled);
+
+int acpi_pci_disabled;		/* skip ACPI PCI scan and IRQ initialization */
+EXPORT_SYMBOL(acpi_pci_disabled);
+
+/*
+ * __acpi_map_table() will be called before page_init(), so early_ioremap()
+ * or early_memremap() should be called here to for ACPI table mapping.
+ */
+char *__init __acpi_map_table(unsigned long phys, unsigned long size)
+{
+	if (!size)
+		return NULL;
+
+	return early_memremap(phys, size);
+}
+
+void __init __acpi_unmap_table(char *map, unsigned long size)
+{
+	if (!map || !size)
+		return;
+
+	early_memunmap(map, size);
+}
+
+static int __init acpi_parse_fadt(struct acpi_table_header *table)
+{
+	struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
+
+	/*
+	 * Revision in table header is the FADT Major revision, and there
+	 * is a minor revision of FADT which was introduced by ACPI 5.1,
+	 * we only deal with ACPI 5.1 or newer revision to get GIC and SMP
+	 * boot protocol configuration data, or we will disable ACPI.
+	 */
+	if (table->revision > 5 ||
+	    (table->revision == 5 && fadt->minor_revision >= 1))
+		return 0;
+
+	pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
+		table->revision, fadt->minor_revision);
+	disable_acpi();
+
+	return -EINVAL;
+}
+
+/*
+ * acpi_boot_table_init() called from setup_arch(), always.
+ *	1. find RSDP and get its address, and then find XSDT
+ *	2. extract all tables and checksums them all
+ *	3. check ACPI FADT revision
+ *
+ * We can parse ACPI boot-time tables such as MADT after
+ * this function is called.
+ */
+void __init acpi_boot_table_init(void)
+{
+	/* If acpi_disabled, bail out */
+	if (acpi_disabled)
+		return;
+
+	/* Initialize the ACPI boot-time table parser. */
+	if (acpi_table_init()) {
+		disable_acpi();
+		return;
+	}
+
+	if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)) {
+		/* disable ACPI if no FADT is found */
+		disable_acpi();
+		pr_err("Can't find FADT\n");
+	}
+}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8420f6..4f1a014 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi.h>
 #include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
@@ -46,6 +47,7 @@
 #include <linux/efi.h>
 #include <linux/personality.h>
 
+#include <asm/acpi.h>
 #include <asm/fixmap.h>
 #include <asm/cpu.h>
 #include <asm/cputype.h>
@@ -380,6 +382,9 @@ void __init setup_arch(char **cmdline_p)
 	efi_init();
 	arm64_memblock_init();
 
+	/* Parse the ACPI tables for possible boot-time configuration */
+	acpi_boot_table_init();
+
 	paging_init();
 	request_standard_resources();
 
-- 
1.9.1

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

* [patch v11 04/23] ARM64 / ACPI: Get RSDP and ACPI boot-time tables
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Al Stone <al.stone@linaro.org>

As we want to get ACPI tables to parse and then use the information
for system initialization, we should get the RSDP (Root System
Description Pointer) first, it then locates Extended Root Description
Table (XSDT) which contains all the 64-bit physical address that
pointer to other boot-time tables.

Introduce acpi.c and its related head file in this patch to provide
fundamental needs of extern variables and functions for ACPI core,
and then get boot-time tables as needed.
  - asm/acenv.h for arch specific ACPICA environments and
    implementation, It is needed unconditionally by ACPI core;
  - asm/acpi.h for arch specific variables and functions needed by
    ACPI driver core;
  - acpi.c for ARM64 related ACPI implementation for ACPI driver
    core;

acpi_boot_table_init() is introduced to get RSDP and boot-time tables,
it will be called in setup_arch() before paging_init(), so we should
use eary_memremap() mechanism here to get the RSDP and all the table
pointers.

FADT Major.Minor version was introduced in ACPI 5.1, it is the same
as ACPI version.

In ACPI 5.1, some major gaps are fixed for ARM, such as updates in
MADT table for GIC and SMP init, without those updates, we can not
get the MPIDR for SMP init, and GICv2/3 related init information, so
we can't boot arm64 ACPI properly with table versions predating 5.1.

If firmware provides ACPI tables with ACPI version less than 5.1,
OS has no way to retrieve the configuration data that is necessary
to init SMP boot protocol and the GIC properly, so disable ACPI if
we get an FADT table with version less that 5.1 when acpi_boot_table_init()
called.

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acenv.h |  18 ++++++++
 arch/arm64/include/asm/acpi.h  |  45 ++++++++++++++++++
 arch/arm64/kernel/Makefile     |   1 +
 arch/arm64/kernel/acpi.c       | 101 +++++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c      |   5 ++
 5 files changed, 170 insertions(+)
 create mode 100644 arch/arm64/include/asm/acenv.h
 create mode 100644 arch/arm64/include/asm/acpi.h
 create mode 100644 arch/arm64/kernel/acpi.c

diff --git a/arch/arm64/include/asm/acenv.h b/arch/arm64/include/asm/acenv.h
new file mode 100644
index 0000000..b49166f
--- /dev/null
+++ b/arch/arm64/include/asm/acenv.h
@@ -0,0 +1,18 @@
+/*
+ * ARM64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Linaro Ltd.
+ *   Author: Hanjun Guo <hanjun.guo@linaro.org>
+ *   Author: Graeme Gregory <graeme.gregory@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_ACENV_H
+#define _ASM_ACENV_H
+
+/* It is required unconditionally by ACPI core, update it when needed. */
+
+#endif /* _ASM_ACENV_H */
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
new file mode 100644
index 0000000..8b837ab
--- /dev/null
+++ b/arch/arm64/include/asm/acpi.h
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (C) 2013-2014, Linaro Ltd.
+ *	Author: Al Stone <al.stone@linaro.org>
+ *	Author: Graeme Gregory <graeme.gregory@linaro.org>
+ *	Author: Hanjun Guo <hanjun.guo@linaro.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation;
+ */
+
+#ifndef _ASM_ACPI_H
+#define _ASM_ACPI_H
+
+/* Basic configuration for ACPI */
+#ifdef	CONFIG_ACPI
+#define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
+extern int acpi_disabled;
+extern int acpi_noirq;
+extern int acpi_pci_disabled;
+
+static inline void disable_acpi(void)
+{
+	acpi_disabled = 1;
+	acpi_pci_disabled = 1;
+	acpi_noirq = 1;
+}
+
+/*
+ * It's used from ACPI core in kdump to boot UP system with SMP kernel,
+ * with this check the ACPI core will not override the CPU index
+ * obtained from GICC with 0 and not print some error message as well.
+ * Since MADT must provide at least one GICC structure for GIC
+ * initialization, CPU will be always available in MADT on ARM64.
+ */
+static inline bool acpi_has_cpu_in_madt(void)
+{
+	return true;
+}
+
+static inline void arch_fix_phys_package_id(int num, u32 slot) { }
+
+#endif /* CONFIG_ACPI */
+
+#endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 5ee07ee..fdc7877 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -35,6 +35,7 @@ arm64-obj-$(CONFIG_KGDB)		+= kgdb.o
 arm64-obj-$(CONFIG_EFI)			+= efi.o efi-stub.o efi-entry.o
 arm64-obj-$(CONFIG_PCI)			+= pci.o
 arm64-obj-$(CONFIG_ARMV8_DEPRECATED)	+= armv8_deprecated.o
+arm64-obj-$(CONFIG_ACPI)		+= acpi.o
 
 obj-y					+= $(arm64-obj-y) vdso/
 obj-m					+= $(arm64-obj-m)
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
new file mode 100644
index 0000000..7abac24
--- /dev/null
+++ b/arch/arm64/kernel/acpi.c
@@ -0,0 +1,101 @@
+/*
+ *  ARM64 Specific Low-Level ACPI Boot Support
+ *
+ *  Copyright (C) 2013-2014, Linaro Ltd.
+ *	Author: Al Stone <al.stone@linaro.org>
+ *	Author: Graeme Gregory <graeme.gregory@linaro.org>
+ *	Author: Hanjun Guo <hanjun.guo@linaro.org>
+ *	Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
+ *	Author: Naresh Bhat <naresh.bhat@linaro.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#define pr_fmt(fmt) "ACPI: " fmt
+
+#include <linux/acpi.h>
+#include <linux/bootmem.h>
+#include <linux/cpumask.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/memblock.h>
+#include <linux/smp.h>
+
+int acpi_noirq;			/* skip ACPI IRQ initialization */
+int acpi_disabled;
+EXPORT_SYMBOL(acpi_disabled);
+
+int acpi_pci_disabled;		/* skip ACPI PCI scan and IRQ initialization */
+EXPORT_SYMBOL(acpi_pci_disabled);
+
+/*
+ * __acpi_map_table() will be called before page_init(), so early_ioremap()
+ * or early_memremap() should be called here to for ACPI table mapping.
+ */
+char *__init __acpi_map_table(unsigned long phys, unsigned long size)
+{
+	if (!size)
+		return NULL;
+
+	return early_memremap(phys, size);
+}
+
+void __init __acpi_unmap_table(char *map, unsigned long size)
+{
+	if (!map || !size)
+		return;
+
+	early_memunmap(map, size);
+}
+
+static int __init acpi_parse_fadt(struct acpi_table_header *table)
+{
+	struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
+
+	/*
+	 * Revision in table header is the FADT Major revision, and there
+	 * is a minor revision of FADT which was introduced by ACPI 5.1,
+	 * we only deal with ACPI 5.1 or newer revision to get GIC and SMP
+	 * boot protocol configuration data, or we will disable ACPI.
+	 */
+	if (table->revision > 5 ||
+	    (table->revision == 5 && fadt->minor_revision >= 1))
+		return 0;
+
+	pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
+		table->revision, fadt->minor_revision);
+	disable_acpi();
+
+	return -EINVAL;
+}
+
+/*
+ * acpi_boot_table_init() called from setup_arch(), always.
+ *	1. find RSDP and get its address, and then find XSDT
+ *	2. extract all tables and checksums them all
+ *	3. check ACPI FADT revision
+ *
+ * We can parse ACPI boot-time tables such as MADT after
+ * this function is called.
+ */
+void __init acpi_boot_table_init(void)
+{
+	/* If acpi_disabled, bail out */
+	if (acpi_disabled)
+		return;
+
+	/* Initialize the ACPI boot-time table parser. */
+	if (acpi_table_init()) {
+		disable_acpi();
+		return;
+	}
+
+	if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)) {
+		/* disable ACPI if no FADT is found */
+		disable_acpi();
+		pr_err("Can't find FADT\n");
+	}
+}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8420f6..4f1a014 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi.h>
 #include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
@@ -46,6 +47,7 @@
 #include <linux/efi.h>
 #include <linux/personality.h>
 
+#include <asm/acpi.h>
 #include <asm/fixmap.h>
 #include <asm/cpu.h>
 #include <asm/cputype.h>
@@ -380,6 +382,9 @@ void __init setup_arch(char **cmdline_p)
 	efi_init();
 	arm64_memblock_init();
 
+	/* Parse the ACPI tables for possible boot-time configuration */
+	acpi_boot_table_init();
+
 	paging_init();
 	request_standard_resources();
 
-- 
1.9.1

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

* [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64
  2015-03-24 14:02 ` Hanjun Guo
  (?)
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, linux-acpi,
	Mark Brown, Hanjun Guo, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

From: Mark Salter <msalter@redhat.com>

The acpi_os_ioremap() function may be used to map normal RAM or IO
regions. The current implementation simply uses ioremap_cache(). This
will work for some architectures, but arm64 ioremap_cache() cannot be
used to map IO regions which don't support caching. So for arm64, use
ioremap() for non-RAM regions.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 13 +++++++++++++
 include/acpi/acpi_io.h        |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 8b837ab..40e0924 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -12,8 +12,21 @@
 #ifndef _ASM_ACPI_H
 #define _ASM_ACPI_H
 
+#include <linux/mm.h>
+
 /* Basic configuration for ACPI */
 #ifdef	CONFIG_ACPI
+/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
+static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
+					    acpi_size size)
+{
+	if (!page_is_ram(phys >> PAGE_SHIFT))
+		return ioremap(phys, size);
+
+	return ioremap_cache(phys, size);
+}
+#define acpi_os_ioremap acpi_os_ioremap
+
 #define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
 extern int acpi_disabled;
 extern int acpi_noirq;
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index 444671e..dd86c5f 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -3,11 +3,15 @@
 
 #include <linux/io.h>
 
+#include <asm/acpi.h>
+
+#ifndef acpi_os_ioremap
 static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
 					    acpi_size size)
 {
        return ioremap_cache(phys, size);
 }
+#endif
 
 void __iomem *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
-- 
1.9.1

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

* [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

From: Mark Salter <msalter@redhat.com>

The acpi_os_ioremap() function may be used to map normal RAM or IO
regions. The current implementation simply uses ioremap_cache(). This
will work for some architectures, but arm64 ioremap_cache() cannot be
used to map IO regions which don't support caching. So for arm64, use
ioremap() for non-RAM regions.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 13 +++++++++++++
 include/acpi/acpi_io.h        |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 8b837ab..40e0924 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -12,8 +12,21 @@
 #ifndef _ASM_ACPI_H
 #define _ASM_ACPI_H
 
+#include <linux/mm.h>
+
 /* Basic configuration for ACPI */
 #ifdef	CONFIG_ACPI
+/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
+static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
+					    acpi_size size)
+{
+	if (!page_is_ram(phys >> PAGE_SHIFT))
+		return ioremap(phys, size);
+
+	return ioremap_cache(phys, size);
+}
+#define acpi_os_ioremap acpi_os_ioremap
+
 #define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
 extern int acpi_disabled;
 extern int acpi_noirq;
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index 444671e..dd86c5f 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -3,11 +3,15 @@
 
 #include <linux/io.h>
 
+#include <asm/acpi.h>
+
+#ifndef acpi_os_ioremap
 static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
 					    acpi_size size)
 {
        return ioremap_cache(phys, size);
 }
+#endif
 
 void __iomem *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
-- 
1.9.1


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

* [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mark Salter <msalter@redhat.com>

The acpi_os_ioremap() function may be used to map normal RAM or IO
regions. The current implementation simply uses ioremap_cache(). This
will work for some architectures, but arm64 ioremap_cache() cannot be
used to map IO regions which don't support caching. So for arm64, use
ioremap() for non-RAM regions.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 13 +++++++++++++
 include/acpi/acpi_io.h        |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 8b837ab..40e0924 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -12,8 +12,21 @@
 #ifndef _ASM_ACPI_H
 #define _ASM_ACPI_H
 
+#include <linux/mm.h>
+
 /* Basic configuration for ACPI */
 #ifdef	CONFIG_ACPI
+/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
+static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
+					    acpi_size size)
+{
+	if (!page_is_ram(phys >> PAGE_SHIFT))
+		return ioremap(phys, size);
+
+	return ioremap_cache(phys, size);
+}
+#define acpi_os_ioremap acpi_os_ioremap
+
 #define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
 extern int acpi_disabled;
 extern int acpi_noirq;
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index 444671e..dd86c5f 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -3,11 +3,15 @@
 
 #include <linux/io.h>
 
+#include <asm/acpi.h>
+
+#ifndef acpi_os_ioremap
 static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
 					    acpi_size size)
 {
        return ioremap_cache(phys, size);
 }
+#endif
 
 void __iomem *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
-- 
1.9.1

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

* [patch v11 06/23] ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Tomasz Nowicki, Hanjun Guo

From: Graeme Gregory <graeme.gregory@linaro.org>

ACPI 5.1 does not currently support S states for ARM64 hardware but
ACPI code will call acpi_target_system_state() and acpi_sleep_init()
for device power management, so introduce
CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT and select it for x86 and
ia64 only to make sleep functions available, and also introduce stub
function to allow other drivers to function until S states are defined
for ARM64.

It will be no functional change for x86 and IA64.

Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/ia64/Kconfig       | 1 +
 arch/x86/Kconfig        | 1 +
 drivers/acpi/Kconfig    | 4 ++++
 drivers/acpi/Makefile   | 2 +-
 drivers/acpi/internal.h | 4 ++++
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 074e52b..cc3414f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -10,6 +10,7 @@ config IA64
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select PCI if (!IA64_HP_SIM)
 	select ACPI if (!IA64_HP_SIM)
+	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select HAVE_IDE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b7d31ca..c3ea9f9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -22,6 +22,7 @@ config X86_64
 ### Arch settings
 config X86
 	def_bool y
+	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
 	select ARCH_HAS_FAST_MULTIPLIER
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e6c3ddd..a726381 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -48,9 +48,13 @@ config ACPI_LEGACY_TABLES_LOOKUP
 config ARCH_MIGHT_HAVE_ACPI_PDC
 	bool
 
+config ACPI_SYSTEM_POWER_STATES_SUPPORT
+	bool
+
 config ACPI_SLEEP
 	bool
 	depends on SUSPEND || HIBERNATION
+	depends on ACPI_SYSTEM_POWER_STATES_SUPPORT
 	default y
 
 config ACPI_PROCFS_POWER
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 623b117..db153c6 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -23,7 +23,7 @@ acpi-y				+= nvs.o
 
 # Power management related files
 acpi-y				+= wakeup.o
-acpi-y				+= sleep.o
+acpi-$(CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT) += sleep.o
 acpi-y				+= device_pm.o
 acpi-$(CONFIG_ACPI_SLEEP)	+= proc.o
 
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 56b321a..ba4a61e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -161,7 +161,11 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return -ENXIO; }
+#endif
 
 #ifdef CONFIG_ACPI_SLEEP
 int acpi_sleep_proc_init(void);
-- 
1.9.1

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

* [patch v11 06/23] ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Graeme Gregory <graeme.gregory@linaro.org>

ACPI 5.1 does not currently support S states for ARM64 hardware but
ACPI code will call acpi_target_system_state() and acpi_sleep_init()
for device power management, so introduce
CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT and select it for x86 and
ia64 only to make sleep functions available, and also introduce stub
function to allow other drivers to function until S states are defined
for ARM64.

It will be no functional change for x86 and IA64.

Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/ia64/Kconfig       | 1 +
 arch/x86/Kconfig        | 1 +
 drivers/acpi/Kconfig    | 4 ++++
 drivers/acpi/Makefile   | 2 +-
 drivers/acpi/internal.h | 4 ++++
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 074e52b..cc3414f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -10,6 +10,7 @@ config IA64
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select PCI if (!IA64_HP_SIM)
 	select ACPI if (!IA64_HP_SIM)
+	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select HAVE_IDE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b7d31ca..c3ea9f9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -22,6 +22,7 @@ config X86_64
 ### Arch settings
 config X86
 	def_bool y
+	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
 	select ARCH_HAS_FAST_MULTIPLIER
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e6c3ddd..a726381 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -48,9 +48,13 @@ config ACPI_LEGACY_TABLES_LOOKUP
 config ARCH_MIGHT_HAVE_ACPI_PDC
 	bool
 
+config ACPI_SYSTEM_POWER_STATES_SUPPORT
+	bool
+
 config ACPI_SLEEP
 	bool
 	depends on SUSPEND || HIBERNATION
+	depends on ACPI_SYSTEM_POWER_STATES_SUPPORT
 	default y
 
 config ACPI_PROCFS_POWER
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 623b117..db153c6 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -23,7 +23,7 @@ acpi-y				+= nvs.o
 
 # Power management related files
 acpi-y				+= wakeup.o
-acpi-y				+= sleep.o
+acpi-$(CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT) += sleep.o
 acpi-y				+= device_pm.o
 acpi-$(CONFIG_ACPI_SLEEP)	+= proc.o
 
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 56b321a..ba4a61e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -161,7 +161,11 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return -ENXIO; }
+#endif
 
 #ifdef CONFIG_ACPI_SLEEP
 int acpi_sleep_proc_init(void);
-- 
1.9.1

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

* [patch v11 07/23] ARM64 / ACPI: Introduce PCI stub functions for ACPI
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo, Liviu Dudau

CONFIG_ACPI depends CONFIG_PCI on x86 and ia64, in ARM64 server
world we will have PCIe in most cases, but some of them may not,
make CONFIG_ACPI depend CONFIG_PCI on ARM64 will satisfy both.

With that case, we need some arch dependent PCI functions to
access the config space before the PCI root bridge is created, and
pci_acpi_scan_root() to create the PCI root bus. So introduce
some stub function here to make ACPI core compile and revisit
them later when implemented on ARM64.

CC: Liviu Dudau <Liviu.Dudau@arm.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/pci.h |  6 ++++++
 arch/arm64/kernel/pci.c      | 25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
index 872ba93..b008a72 100644
--- a/arch/arm64/include/asm/pci.h
+++ b/arch/arm64/include/asm/pci.h
@@ -27,6 +27,12 @@
 extern int isa_dma_bridge_buggy;
 
 #ifdef CONFIG_PCI
+static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
+{
+	/* no legacy IRQ on arm64 */
+	return -ENODEV;
+}
+
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return 1;
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 6f93c24..4095379 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -10,6 +10,7 @@
  *
  */
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -46,3 +47,27 @@ int pcibios_add_device(struct pci_dev *dev)
 
 	return 0;
 }
+
+/*
+ * raw_pci_read/write - Platform-specific PCI config space access.
+ */
+int raw_pci_read(unsigned int domain, unsigned int bus,
+		  unsigned int devfn, int reg, int len, u32 *val)
+{
+	return -ENXIO;
+}
+
+int raw_pci_write(unsigned int domain, unsigned int bus,
+		unsigned int devfn, int reg, int len, u32 val)
+{
+	return -ENXIO;
+}
+
+#ifdef CONFIG_ACPI
+/* Root bridge scanning */
+struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
+{
+	/* TODO: Should be revisited when implementing PCI on ACPI */
+	return NULL;
+}
+#endif
-- 
1.9.1

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

* [patch v11 07/23] ARM64 / ACPI: Introduce PCI stub functions for ACPI
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

CONFIG_ACPI depends CONFIG_PCI on x86 and ia64, in ARM64 server
world we will have PCIe in most cases, but some of them may not,
make CONFIG_ACPI depend CONFIG_PCI on ARM64 will satisfy both.

With that case, we need some arch dependent PCI functions to
access the config space before the PCI root bridge is created, and
pci_acpi_scan_root() to create the PCI root bus. So introduce
some stub function here to make ACPI core compile and revisit
them later when implemented on ARM64.

CC: Liviu Dudau <Liviu.Dudau@arm.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/pci.h |  6 ++++++
 arch/arm64/kernel/pci.c      | 25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
index 872ba93..b008a72 100644
--- a/arch/arm64/include/asm/pci.h
+++ b/arch/arm64/include/asm/pci.h
@@ -27,6 +27,12 @@
 extern int isa_dma_bridge_buggy;
 
 #ifdef CONFIG_PCI
+static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
+{
+	/* no legacy IRQ on arm64 */
+	return -ENODEV;
+}
+
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return 1;
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 6f93c24..4095379 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -10,6 +10,7 @@
  *
  */
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -46,3 +47,27 @@ int pcibios_add_device(struct pci_dev *dev)
 
 	return 0;
 }
+
+/*
+ * raw_pci_read/write - Platform-specific PCI config space access.
+ */
+int raw_pci_read(unsigned int domain, unsigned int bus,
+		  unsigned int devfn, int reg, int len, u32 *val)
+{
+	return -ENXIO;
+}
+
+int raw_pci_write(unsigned int domain, unsigned int bus,
+		unsigned int devfn, int reg, int len, u32 val)
+{
+	return -ENXIO;
+}
+
+#ifdef CONFIG_ACPI
+/* Root bridge scanning */
+struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
+{
+	/* TODO: Should be revisited when implementing PCI on ACPI */
+	return NULL;
+}
+#endif
-- 
1.9.1

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

* [patch v11 08/23] ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Hanjun Guo, Ard Biesheuvel

From: Al Stone <al.stone@linaro.org>

This implements the following policy to decide whether ACPI should
be used to boot the system:
- acpi=off: ACPI will not be used to boot the system, even if there is
  no alternative available (e.g., device tree is empty)
- acpi=force: only ACPI will be used to boot the system; if that fails,
  there will be no fallback to alternative methods (such as device tree)
- otherwise, ACPI will be used as a fallback if the device tree turns out
  to lack a platform description; the heuristic to decide this is whether
  /chosen is the only node present at depth 1

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Rafael J. Wysocki <rjw@rjwysocki.net>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Documentation/kernel-parameters.txt |  3 ++-
 arch/arm64/include/asm/acpi.h       |  7 +++++
 arch/arm64/kernel/acpi.c            | 52 +++++++++++++++++++++++++++++++++----
 3 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index bfcb1a6..d6c35a7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -165,7 +165,7 @@ multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30
 bytes respectively. Such letter suffixes can also be entirely omitted.
 
 
-	acpi=		[HW,ACPI,X86]
+	acpi=		[HW,ACPI,X86,ARM64]
 			Advanced Configuration and Power Interface
 			Format: { force | off | strict | noirq | rsdt }
 			force -- enable ACPI if default was off
@@ -175,6 +175,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 				strictly ACPI specification compliant.
 			rsdt -- prefer RSDT over (default) XSDT
 			copy_dsdt -- copy DSDT to memory
+			For ARM64, ONLY "acpi=off" or "acpi=force" are available
 
 			See also Documentation/power/runtime_pm.txt, pci=noacpi
 
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 40e0924..c5a9b97 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -39,6 +39,13 @@ static inline void disable_acpi(void)
 	acpi_noirq = 1;
 }
 
+static inline void enable_acpi(void)
+{
+	acpi_disabled = 0;
+	acpi_pci_disabled = 0;
+	acpi_noirq = 0;
+}
+
 /*
  * It's used from ACPI core in kdump to boot UP system with SMP kernel,
  * with this check the ACPI core will not override the CPU index
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 7abac24..2269e30 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -22,15 +22,49 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/memblock.h>
+#include <linux/of_fdt.h>
 #include <linux/smp.h>
 
-int acpi_noirq;			/* skip ACPI IRQ initialization */
-int acpi_disabled;
+int acpi_noirq = 1;		/* skip ACPI IRQ initialization */
+int acpi_disabled = 1;
 EXPORT_SYMBOL(acpi_disabled);
 
-int acpi_pci_disabled;		/* skip ACPI PCI scan and IRQ initialization */
+int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
+static bool param_acpi_off __initdata;
+static bool param_acpi_force __initdata;
+
+static int __init parse_acpi(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	/* "acpi=off" disables both ACPI table parsing and interpreter */
+	if (strcmp(arg, "off") == 0)
+		param_acpi_off = true;
+	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
+		param_acpi_force = true;
+	else
+		return -EINVAL;	/* Core will print when we return error */
+
+	return 0;
+}
+early_param("acpi", parse_acpi);
+
+static int __init dt_scan_depth1_nodes(unsigned long node,
+				       const char *uname, int depth,
+				       void *data)
+{
+	/*
+	 * Return 1 as soon as we encounter a node at depth 1 that is
+	 * not the /chosen node.
+	 */
+	if (depth == 1 && (strcmp(uname, "chosen") != 0))
+		return 1;
+	return 0;
+}
+
 /*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
@@ -83,10 +117,18 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
  */
 void __init acpi_boot_table_init(void)
 {
-	/* If acpi_disabled, bail out */
-	if (acpi_disabled)
+	/*
+	 * Enable ACPI instead of device tree unless
+	 * - ACPI has been disabled explicitly (acpi=off), or
+	 * - the device tree is not empty (it has more than just a /chosen node)
+	 *   and ACPI has not been force enabled (acpi=force)
+	 */
+	if (param_acpi_off ||
+	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
 		return;
 
+	enable_acpi();
+
 	/* Initialize the ACPI boot-time table parser. */
 	if (acpi_table_init()) {
 		disable_acpi();
-- 
1.9.1

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

* [patch v11 08/23] ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Al Stone <al.stone@linaro.org>

This implements the following policy to decide whether ACPI should
be used to boot the system:
- acpi=off: ACPI will not be used to boot the system, even if there is
  no alternative available (e.g., device tree is empty)
- acpi=force: only ACPI will be used to boot the system; if that fails,
  there will be no fallback to alternative methods (such as device tree)
- otherwise, ACPI will be used as a fallback if the device tree turns out
  to lack a platform description; the heuristic to decide this is whether
  /chosen is the only node present at depth 1

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Rafael J. Wysocki <rjw@rjwysocki.net>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Documentation/kernel-parameters.txt |  3 ++-
 arch/arm64/include/asm/acpi.h       |  7 +++++
 arch/arm64/kernel/acpi.c            | 52 +++++++++++++++++++++++++++++++++----
 3 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index bfcb1a6..d6c35a7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -165,7 +165,7 @@ multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30
 bytes respectively. Such letter suffixes can also be entirely omitted.
 
 
-	acpi=		[HW,ACPI,X86]
+	acpi=		[HW,ACPI,X86,ARM64]
 			Advanced Configuration and Power Interface
 			Format: { force | off | strict | noirq | rsdt }
 			force -- enable ACPI if default was off
@@ -175,6 +175,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 				strictly ACPI specification compliant.
 			rsdt -- prefer RSDT over (default) XSDT
 			copy_dsdt -- copy DSDT to memory
+			For ARM64, ONLY "acpi=off" or "acpi=force" are available
 
 			See also Documentation/power/runtime_pm.txt, pci=noacpi
 
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 40e0924..c5a9b97 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -39,6 +39,13 @@ static inline void disable_acpi(void)
 	acpi_noirq = 1;
 }
 
+static inline void enable_acpi(void)
+{
+	acpi_disabled = 0;
+	acpi_pci_disabled = 0;
+	acpi_noirq = 0;
+}
+
 /*
  * It's used from ACPI core in kdump to boot UP system with SMP kernel,
  * with this check the ACPI core will not override the CPU index
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 7abac24..2269e30 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -22,15 +22,49 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/memblock.h>
+#include <linux/of_fdt.h>
 #include <linux/smp.h>
 
-int acpi_noirq;			/* skip ACPI IRQ initialization */
-int acpi_disabled;
+int acpi_noirq = 1;		/* skip ACPI IRQ initialization */
+int acpi_disabled = 1;
 EXPORT_SYMBOL(acpi_disabled);
 
-int acpi_pci_disabled;		/* skip ACPI PCI scan and IRQ initialization */
+int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
+static bool param_acpi_off __initdata;
+static bool param_acpi_force __initdata;
+
+static int __init parse_acpi(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	/* "acpi=off" disables both ACPI table parsing and interpreter */
+	if (strcmp(arg, "off") == 0)
+		param_acpi_off = true;
+	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
+		param_acpi_force = true;
+	else
+		return -EINVAL;	/* Core will print when we return error */
+
+	return 0;
+}
+early_param("acpi", parse_acpi);
+
+static int __init dt_scan_depth1_nodes(unsigned long node,
+				       const char *uname, int depth,
+				       void *data)
+{
+	/*
+	 * Return 1 as soon as we encounter a node at depth 1 that is
+	 * not the /chosen node.
+	 */
+	if (depth == 1 && (strcmp(uname, "chosen") != 0))
+		return 1;
+	return 0;
+}
+
 /*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
@@ -83,10 +117,18 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
  */
 void __init acpi_boot_table_init(void)
 {
-	/* If acpi_disabled, bail out */
-	if (acpi_disabled)
+	/*
+	 * Enable ACPI instead of device tree unless
+	 * - ACPI has been disabled explicitly (acpi=off), or
+	 * - the device tree is not empty (it has more than just a /chosen node)
+	 *   and ACPI has not been force enabled (acpi=force)
+	 */
+	if (param_acpi_off ||
+	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
 		return;
 
+	enable_acpi();
+
 	/* Initialize the ACPI boot-time table parser. */
 	if (acpi_table_init()) {
 		disable_acpi();
-- 
1.9.1

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

* [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

From: Graeme Gregory <graeme.gregory@linaro.org>

If the early boot methods of acpi are happy that we have valid ACPI
tables and acpi=force has been passed, then do not unflat devicetree
effectively disabling further hardware probing from DT.

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 4f1a014..e8c7000 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_reset();
 
-	unflatten_device_tree();
+	if (acpi_disabled)
+		unflatten_device_tree();
 
 	psci_init();
 
-- 
1.9.1

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

* [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Graeme Gregory <graeme.gregory@linaro.org>

If the early boot methods of acpi are happy that we have valid ACPI
tables and acpi=force has been passed, then do not unflat devicetree
effectively disabling further hardware probing from DT.

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 4f1a014..e8c7000 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_reset();
 
-	unflatten_device_tree();
+	if (acpi_disabled)
+		unflatten_device_tree();
 
 	psci_init();
 
-- 
1.9.1

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

* [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Lorenzo Pieralisi, Tomasz Nowicki,
	Hanjun Guo

From: Graeme Gregory <graeme.gregory@linaro.org>

There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set,
the former signals to the OS that the firmware is PSCI compliant.
The latter selects the appropriate conduit for PSCI calls by
toggling between Hypervisor Calls (HVC) and Secure Monitor Calls
(SMC).

FADT table contains such information in ACPI 5.1, FADT table was
parsed in ACPI table init and copy to struct acpi_gbl_FADT, so
use the flags in struct acpi_gbl_FADT for PSCI init.

Since ACPI 5.1 doesn't support self defined PSCI function IDs,
which means that only PSCI 0.2+ is supported in ACPI.

CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 15 +++++++++
 arch/arm64/include/asm/psci.h |  3 +-
 arch/arm64/kernel/psci.c      | 78 ++++++++++++++++++++++++++++++-------------
 arch/arm64/kernel/setup.c     |  8 +++--
 4 files changed, 76 insertions(+), 28 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index c5a9b97..9ea650c 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -32,6 +32,18 @@ extern int acpi_disabled;
 extern int acpi_noirq;
 extern int acpi_pci_disabled;
 
+/* 1 to indicate PSCI 0.2+ is implemented */
+static inline bool acpi_psci_present(void)
+{
+	return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_COMPLIANT;
+}
+
+/* 1 to indicate HVC must be used instead of SMC as the PSCI conduit */
+static inline bool acpi_psci_use_hvc(void)
+{
+	return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
+}
+
 static inline void disable_acpi(void)
 {
 	acpi_disabled = 1;
@@ -60,6 +72,9 @@ static inline bool acpi_has_cpu_in_madt(void)
 
 static inline void arch_fix_phys_package_id(int num, u32 slot) { }
 
+#else
+static inline bool acpi_psci_present(void) { return false; }
+static inline bool acpi_psci_use_hvc(void) { return false; }
 #endif /* CONFIG_ACPI */
 
 #endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/include/asm/psci.h b/arch/arm64/include/asm/psci.h
index e5312ea..2454bc5 100644
--- a/arch/arm64/include/asm/psci.h
+++ b/arch/arm64/include/asm/psci.h
@@ -14,6 +14,7 @@
 #ifndef __ASM_PSCI_H
 #define __ASM_PSCI_H
 
-int psci_init(void);
+int psci_dt_init(void);
+int psci_acpi_init(void);
 
 #endif /* __ASM_PSCI_H */
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 9b8a70a..d3c52ce 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -15,6 +15,7 @@
 
 #define pr_fmt(fmt) "psci: " fmt
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/of.h>
 #include <linux/smp.h>
@@ -24,6 +25,7 @@
 #include <linux/slab.h>
 #include <uapi/linux/psci.h>
 
+#include <asm/acpi.h>
 #include <asm/compiler.h>
 #include <asm/cpu_ops.h>
 #include <asm/errno.h>
@@ -273,6 +275,33 @@ static void psci_sys_poweroff(void)
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
 }
 
+static void __init psci_0_2_set_functions(void)
+{
+	pr_info("Using standard PSCI v0.2 function IDs\n");
+	psci_function_id[PSCI_FN_CPU_SUSPEND] = PSCI_0_2_FN64_CPU_SUSPEND;
+	psci_ops.cpu_suspend = psci_cpu_suspend;
+
+	psci_function_id[PSCI_FN_CPU_OFF] = PSCI_0_2_FN_CPU_OFF;
+	psci_ops.cpu_off = psci_cpu_off;
+
+	psci_function_id[PSCI_FN_CPU_ON] = PSCI_0_2_FN64_CPU_ON;
+	psci_ops.cpu_on = psci_cpu_on;
+
+	psci_function_id[PSCI_FN_MIGRATE] = PSCI_0_2_FN64_MIGRATE;
+	psci_ops.migrate = psci_migrate;
+
+	psci_function_id[PSCI_FN_AFFINITY_INFO] = PSCI_0_2_FN64_AFFINITY_INFO;
+	psci_ops.affinity_info = psci_affinity_info;
+
+	psci_function_id[PSCI_FN_MIGRATE_INFO_TYPE] =
+		PSCI_0_2_FN_MIGRATE_INFO_TYPE;
+	psci_ops.migrate_info_type = psci_migrate_info_type;
+
+	arm_pm_restart = psci_sys_reset;
+
+	pm_power_off = psci_sys_poweroff;
+}
+
 /*
  * PSCI Function IDs for v0.2+ are well defined so use
  * standard values.
@@ -306,29 +335,7 @@ static int __init psci_0_2_init(struct device_node *np)
 		}
 	}
 
-	pr_info("Using standard PSCI v0.2 function IDs\n");
-	psci_function_id[PSCI_FN_CPU_SUSPEND] = PSCI_0_2_FN64_CPU_SUSPEND;
-	psci_ops.cpu_suspend = psci_cpu_suspend;
-
-	psci_function_id[PSCI_FN_CPU_OFF] = PSCI_0_2_FN_CPU_OFF;
-	psci_ops.cpu_off = psci_cpu_off;
-
-	psci_function_id[PSCI_FN_CPU_ON] = PSCI_0_2_FN64_CPU_ON;
-	psci_ops.cpu_on = psci_cpu_on;
-
-	psci_function_id[PSCI_FN_MIGRATE] = PSCI_0_2_FN64_MIGRATE;
-	psci_ops.migrate = psci_migrate;
-
-	psci_function_id[PSCI_FN_AFFINITY_INFO] = PSCI_0_2_FN64_AFFINITY_INFO;
-	psci_ops.affinity_info = psci_affinity_info;
-
-	psci_function_id[PSCI_FN_MIGRATE_INFO_TYPE] =
-		PSCI_0_2_FN_MIGRATE_INFO_TYPE;
-	psci_ops.migrate_info_type = psci_migrate_info_type;
-
-	arm_pm_restart = psci_sys_reset;
-
-	pm_power_off = psci_sys_poweroff;
+	psci_0_2_set_functions();
 
 out_put_node:
 	of_node_put(np);
@@ -381,7 +388,7 @@ static const struct of_device_id psci_of_match[] __initconst = {
 	{},
 };
 
-int __init psci_init(void)
+int __init psci_dt_init(void)
 {
 	struct device_node *np;
 	const struct of_device_id *matched_np;
@@ -396,6 +403,29 @@ int __init psci_init(void)
 	return init_fn(np);
 }
 
+/*
+ * We use PSCI 0.2+ when ACPI is deployed on ARM64 and it's
+ * explicitly clarified in SBBR
+ */
+int __init psci_acpi_init(void)
+{
+	if (!acpi_psci_present()) {
+		pr_info("is not implemented in ACPI.\n");
+		return -EOPNOTSUPP;
+	}
+
+	pr_info("probing for conduit method from ACPI.\n");
+
+	if (acpi_psci_use_hvc())
+		invoke_psci_fn = __invoke_psci_fn_hvc;
+	else
+		invoke_psci_fn = __invoke_psci_fn_smc;
+
+	psci_0_2_set_functions();
+
+	return 0;
+}
+
 #ifdef CONFIG_SMP
 
 static int __init cpu_psci_cpu_init(struct device_node *dn, unsigned int cpu)
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8c7000..97fa7f3 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -390,10 +390,12 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_reset();
 
-	if (acpi_disabled)
+	if (acpi_disabled) {
 		unflatten_device_tree();
-
-	psci_init();
+		psci_dt_init();
+	} else {
+		psci_acpi_init();
+	}
 
 	cpu_read_bootcpu_ops();
 #ifdef CONFIG_SMP
-- 
1.9.1

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

* [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Graeme Gregory <graeme.gregory@linaro.org>

There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set,
the former signals to the OS that the firmware is PSCI compliant.
The latter selects the appropriate conduit for PSCI calls by
toggling between Hypervisor Calls (HVC) and Secure Monitor Calls
(SMC).

FADT table contains such information in ACPI 5.1, FADT table was
parsed in ACPI table init and copy to struct acpi_gbl_FADT, so
use the flags in struct acpi_gbl_FADT for PSCI init.

Since ACPI 5.1 doesn't support self defined PSCI function IDs,
which means that only PSCI 0.2+ is supported in ACPI.

CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 15 +++++++++
 arch/arm64/include/asm/psci.h |  3 +-
 arch/arm64/kernel/psci.c      | 78 ++++++++++++++++++++++++++++++-------------
 arch/arm64/kernel/setup.c     |  8 +++--
 4 files changed, 76 insertions(+), 28 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index c5a9b97..9ea650c 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -32,6 +32,18 @@ extern int acpi_disabled;
 extern int acpi_noirq;
 extern int acpi_pci_disabled;
 
+/* 1 to indicate PSCI 0.2+ is implemented */
+static inline bool acpi_psci_present(void)
+{
+	return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_COMPLIANT;
+}
+
+/* 1 to indicate HVC must be used instead of SMC as the PSCI conduit */
+static inline bool acpi_psci_use_hvc(void)
+{
+	return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
+}
+
 static inline void disable_acpi(void)
 {
 	acpi_disabled = 1;
@@ -60,6 +72,9 @@ static inline bool acpi_has_cpu_in_madt(void)
 
 static inline void arch_fix_phys_package_id(int num, u32 slot) { }
 
+#else
+static inline bool acpi_psci_present(void) { return false; }
+static inline bool acpi_psci_use_hvc(void) { return false; }
 #endif /* CONFIG_ACPI */
 
 #endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/include/asm/psci.h b/arch/arm64/include/asm/psci.h
index e5312ea..2454bc5 100644
--- a/arch/arm64/include/asm/psci.h
+++ b/arch/arm64/include/asm/psci.h
@@ -14,6 +14,7 @@
 #ifndef __ASM_PSCI_H
 #define __ASM_PSCI_H
 
-int psci_init(void);
+int psci_dt_init(void);
+int psci_acpi_init(void);
 
 #endif /* __ASM_PSCI_H */
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 9b8a70a..d3c52ce 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -15,6 +15,7 @@
 
 #define pr_fmt(fmt) "psci: " fmt
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/of.h>
 #include <linux/smp.h>
@@ -24,6 +25,7 @@
 #include <linux/slab.h>
 #include <uapi/linux/psci.h>
 
+#include <asm/acpi.h>
 #include <asm/compiler.h>
 #include <asm/cpu_ops.h>
 #include <asm/errno.h>
@@ -273,6 +275,33 @@ static void psci_sys_poweroff(void)
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
 }
 
+static void __init psci_0_2_set_functions(void)
+{
+	pr_info("Using standard PSCI v0.2 function IDs\n");
+	psci_function_id[PSCI_FN_CPU_SUSPEND] = PSCI_0_2_FN64_CPU_SUSPEND;
+	psci_ops.cpu_suspend = psci_cpu_suspend;
+
+	psci_function_id[PSCI_FN_CPU_OFF] = PSCI_0_2_FN_CPU_OFF;
+	psci_ops.cpu_off = psci_cpu_off;
+
+	psci_function_id[PSCI_FN_CPU_ON] = PSCI_0_2_FN64_CPU_ON;
+	psci_ops.cpu_on = psci_cpu_on;
+
+	psci_function_id[PSCI_FN_MIGRATE] = PSCI_0_2_FN64_MIGRATE;
+	psci_ops.migrate = psci_migrate;
+
+	psci_function_id[PSCI_FN_AFFINITY_INFO] = PSCI_0_2_FN64_AFFINITY_INFO;
+	psci_ops.affinity_info = psci_affinity_info;
+
+	psci_function_id[PSCI_FN_MIGRATE_INFO_TYPE] =
+		PSCI_0_2_FN_MIGRATE_INFO_TYPE;
+	psci_ops.migrate_info_type = psci_migrate_info_type;
+
+	arm_pm_restart = psci_sys_reset;
+
+	pm_power_off = psci_sys_poweroff;
+}
+
 /*
  * PSCI Function IDs for v0.2+ are well defined so use
  * standard values.
@@ -306,29 +335,7 @@ static int __init psci_0_2_init(struct device_node *np)
 		}
 	}
 
-	pr_info("Using standard PSCI v0.2 function IDs\n");
-	psci_function_id[PSCI_FN_CPU_SUSPEND] = PSCI_0_2_FN64_CPU_SUSPEND;
-	psci_ops.cpu_suspend = psci_cpu_suspend;
-
-	psci_function_id[PSCI_FN_CPU_OFF] = PSCI_0_2_FN_CPU_OFF;
-	psci_ops.cpu_off = psci_cpu_off;
-
-	psci_function_id[PSCI_FN_CPU_ON] = PSCI_0_2_FN64_CPU_ON;
-	psci_ops.cpu_on = psci_cpu_on;
-
-	psci_function_id[PSCI_FN_MIGRATE] = PSCI_0_2_FN64_MIGRATE;
-	psci_ops.migrate = psci_migrate;
-
-	psci_function_id[PSCI_FN_AFFINITY_INFO] = PSCI_0_2_FN64_AFFINITY_INFO;
-	psci_ops.affinity_info = psci_affinity_info;
-
-	psci_function_id[PSCI_FN_MIGRATE_INFO_TYPE] =
-		PSCI_0_2_FN_MIGRATE_INFO_TYPE;
-	psci_ops.migrate_info_type = psci_migrate_info_type;
-
-	arm_pm_restart = psci_sys_reset;
-
-	pm_power_off = psci_sys_poweroff;
+	psci_0_2_set_functions();
 
 out_put_node:
 	of_node_put(np);
@@ -381,7 +388,7 @@ static const struct of_device_id psci_of_match[] __initconst = {
 	{},
 };
 
-int __init psci_init(void)
+int __init psci_dt_init(void)
 {
 	struct device_node *np;
 	const struct of_device_id *matched_np;
@@ -396,6 +403,29 @@ int __init psci_init(void)
 	return init_fn(np);
 }
 
+/*
+ * We use PSCI 0.2+ when ACPI is deployed on ARM64 and it's
+ * explicitly clarified in SBBR
+ */
+int __init psci_acpi_init(void)
+{
+	if (!acpi_psci_present()) {
+		pr_info("is not implemented in ACPI.\n");
+		return -EOPNOTSUPP;
+	}
+
+	pr_info("probing for conduit method from ACPI.\n");
+
+	if (acpi_psci_use_hvc())
+		invoke_psci_fn = __invoke_psci_fn_hvc;
+	else
+		invoke_psci_fn = __invoke_psci_fn_smc;
+
+	psci_0_2_set_functions();
+
+	return 0;
+}
+
 #ifdef CONFIG_SMP
 
 static int __init cpu_psci_cpu_init(struct device_node *dn, unsigned int cpu)
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e8c7000..97fa7f3 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -390,10 +390,12 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_reset();
 
-	if (acpi_disabled)
+	if (acpi_disabled) {
 		unflatten_device_tree();
-
-	psci_init();
+		psci_dt_init();
+	} else {
+		psci_acpi_init();
+	}
 
 	cpu_read_bootcpu_ops();
 #ifdef CONFIG_SMP
-- 
1.9.1

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

* [patch v11 11/23] ACPI / table: Print GIC information when MADT is parsed
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo, Tomasz Nowicki

When MADT is parsed, print GIC information as debug message:

ACPI: GICC (acpi_id[0x0000] address[00000000e112f000] MPIDR[0x0] enabled)
ACPI: GICC (acpi_id[0x0001] address[00000000e112f000] MPIDR[0x1] enabled)
...
ACPI: GICC (acpi_id[0x0201] address[00000000e112f000] MPIDR[0x201] enabled)

This debug information will be very helpful to bring up early systems to
see if acpi_id and MPIDR are matched or not as spec defined.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
---
 drivers/acpi/tables.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index f4e5b88..2e19189 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -185,6 +185,28 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		}
 		break;
 
+	case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
+		{
+			struct acpi_madt_generic_interrupt *p =
+				(struct acpi_madt_generic_interrupt *)header;
+			pr_debug("GICC (acpi_id[0x%04x] address[%llx] MPIDR[0x%llx] %s)\n",
+				 p->uid, p->base_address,
+				 p->arm_mpidr,
+				 (p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+
+		}
+		break;
+
+	case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
+		{
+			struct acpi_madt_generic_distributor *p =
+				(struct acpi_madt_generic_distributor *)header;
+			pr_debug("GIC Distributor (gic_id[0x%04x] address[%llx] gsi_base[%d])\n",
+				 p->gic_id, p->base_address,
+				 p->global_irq_base);
+		}
+		break;
+
 	default:
 		pr_warn("Found unsupported MADT entry (type = 0x%x)\n",
 			header->type);
-- 
1.9.1

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

* [patch v11 11/23] ACPI / table: Print GIC information when MADT is parsed
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

When MADT is parsed, print GIC information as debug message:

ACPI: GICC (acpi_id[0x0000] address[00000000e112f000] MPIDR[0x0] enabled)
ACPI: GICC (acpi_id[0x0001] address[00000000e112f000] MPIDR[0x1] enabled)
...
ACPI: GICC (acpi_id[0x0201] address[00000000e112f000] MPIDR[0x201] enabled)

This debug information will be very helpful to bring up early systems to
see if acpi_id and MPIDR are matched or not as spec defined.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
---
 drivers/acpi/tables.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index f4e5b88..2e19189 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -185,6 +185,28 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
 		}
 		break;
 
+	case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
+		{
+			struct acpi_madt_generic_interrupt *p =
+				(struct acpi_madt_generic_interrupt *)header;
+			pr_debug("GICC (acpi_id[0x%04x] address[%llx] MPIDR[0x%llx] %s)\n",
+				 p->uid, p->base_address,
+				 p->arm_mpidr,
+				 (p->flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
+
+		}
+		break;
+
+	case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
+		{
+			struct acpi_madt_generic_distributor *p =
+				(struct acpi_madt_generic_distributor *)header;
+			pr_debug("GIC Distributor (gic_id[0x%04x] address[%llx] gsi_base[%d])\n",
+				 p->gic_id, p->base_address,
+				 p->global_irq_base);
+		}
+		break;
+
 	default:
 		pr_warn("Found unsupported MADT entry (type = 0x%x)\n",
 			header->type);
-- 
1.9.1

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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo, Lorenzo Pieralisi,
	Tomasz Nowicki

MADT contains the information for MPIDR which is essential for
SMP initialization, parse the GIC cpu interface structures to
get the MPIDR value and map it to cpu_logical_map(), and add
enabled cpu with valid MPIDR into cpu_possible_map.

ACPI 5.1 only has two explicit methods to boot up SMP, PSCI and
Parking protocol, but the Parking protocol is only specified for
ARMv7 now, so make PSCI as the only way for the SMP boot protocol
before some updates for the ACPI spec or the Parking protocol spec.

Parking protocol patches for SMP boot will be sent to upstream when
the new version of Parking protocol is ready.

CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
---
 arch/arm64/include/asm/acpi.h    |   2 +
 arch/arm64/include/asm/cpu_ops.h |   1 +
 arch/arm64/include/asm/smp.h     |   5 +-
 arch/arm64/kernel/acpi.c         | 149 ++++++++++++++++++++++++++++++++++++++-
 arch/arm64/kernel/cpu_ops.c      |   2 +-
 arch/arm64/kernel/setup.c        |   7 +-
 arch/arm64/kernel/smp.c          |   2 +-
 7 files changed, 160 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 9ea650c..9719921 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -71,10 +71,12 @@ static inline bool acpi_has_cpu_in_madt(void)
 }
 
 static inline void arch_fix_phys_package_id(int num, u32 slot) { }
+void __init acpi_init_cpus(void);
 
 #else
 static inline bool acpi_psci_present(void) { return false; }
 static inline bool acpi_psci_use_hvc(void) { return false; }
+static inline void acpi_init_cpus(void) { }
 #endif /* CONFIG_ACPI */
 
 #endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index da301ee..5a31d67 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -66,5 +66,6 @@ struct cpu_operations {
 extern const struct cpu_operations *cpu_ops[NR_CPUS];
 int __init cpu_read_ops(struct device_node *dn, int cpu);
 void __init cpu_read_bootcpu_ops(void);
+const struct cpu_operations *cpu_get_ops(const char *name);
 
 #endif /* ifndef __ASM_CPU_OPS_H */
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 780f82c..bf22650 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -39,9 +39,10 @@ extern void show_ipi_list(struct seq_file *p, int prec);
 extern void handle_IPI(int ipinr, struct pt_regs *regs);
 
 /*
- * Setup the set of possible CPUs (via set_cpu_possible)
+ * Discover the set of possible CPUs and determine their
+ * SMP operations.
  */
-extern void smp_init_cpus(void);
+extern void of_smp_init_cpus(void);
 
 /*
  * Provide a function to raise an IPI cross call on CPUs in callmap.
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 2269e30..c9203c0 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -25,6 +25,10 @@
 #include <linux/of_fdt.h>
 #include <linux/smp.h>
 
+#include <asm/cputype.h>
+#include <asm/cpu_ops.h>
+#include <asm/smp_plat.h>
+
 int acpi_noirq = 1;		/* skip ACPI IRQ initialization */
 int acpi_disabled = 1;
 EXPORT_SYMBOL(acpi_disabled);
@@ -32,6 +36,12 @@ EXPORT_SYMBOL(acpi_disabled);
 int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
+/* Processors with enabled flag and sane MPIDR */
+static int enabled_cpus;
+
+/* Boot CPU is valid or not in MADT */
+static bool bootcpu_valid  __initdata;
+
 static bool param_acpi_off __initdata;
 static bool param_acpi_force __initdata;
 
@@ -85,6 +95,129 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
 	early_memunmap(map, size);
 }
 
+/**
+ * acpi_map_gic_cpu_interface - generates a logical cpu number
+ * and map to MPIDR represented by GICC structure
+ * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
+ * @enabled: this cpu is enabled or not
+ *
+ * Returns the logical cpu number which maps to MPIDR
+ */
+static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
+{
+	int i;
+
+	if (mpidr == INVALID_HWID) {
+		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
+		return -EINVAL;
+	}
+
+	total_cpus++;
+	if (!enabled)
+		return -EINVAL;
+
+	if (enabled_cpus >=  NR_CPUS) {
+		pr_warn("NR_CPUS limit of %d reached, Processor %d/0x%llx ignored.\n",
+			NR_CPUS, total_cpus, mpidr);
+		return -EINVAL;
+	}
+
+	/* Check if GICC structure of boot CPU is available in the MADT */
+	if (cpu_logical_map(0) == mpidr) {
+		if (bootcpu_valid) {
+			pr_err("Firmware bug, duplicate CPU MPIDR: 0x%llx in MADT\n",
+			       mpidr);
+			return -EINVAL;
+		}
+
+		bootcpu_valid = true;
+	}
+
+	/*
+	 * Duplicate MPIDRs are a recipe for disaster. Scan
+	 * all initialized entries and check for
+	 * duplicates. If any is found just ignore the CPU.
+	 */
+	for (i = 1; i < enabled_cpus; i++) {
+		if (cpu_logical_map(i) == mpidr) {
+			pr_err("Firmware bug, duplicate CPU MPIDR: 0x%llx in MADT\n",
+			       mpidr);
+			return -EINVAL;
+		}
+	}
+
+	if (!acpi_psci_present())
+		return -EOPNOTSUPP;
+
+	cpu_ops[enabled_cpus] = cpu_get_ops("psci");
+	/* CPU 0 was already initialized */
+	if (enabled_cpus) {
+		if (!cpu_ops[enabled_cpus])
+			return -EINVAL;
+
+		if (cpu_ops[enabled_cpus]->cpu_init(NULL, enabled_cpus))
+			return -EOPNOTSUPP;
+
+		/* map the logical cpu id to cpu MPIDR */
+		cpu_logical_map(enabled_cpus) = mpidr;
+	}
+
+	enabled_cpus++;
+	return enabled_cpus;
+}
+
+static int __init
+acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
+				const unsigned long end)
+{
+	struct acpi_madt_generic_interrupt *processor;
+
+	processor = (struct acpi_madt_generic_interrupt *)header;
+
+	if (BAD_MADT_ENTRY(processor, end))
+		return -EINVAL;
+
+	acpi_table_print_madt_entry(header);
+
+	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
+		processor->flags & ACPI_MADT_ENABLED);
+
+	return 0;
+}
+
+/* Parse GIC cpu interface entries in MADT for SMP init */
+void __init acpi_init_cpus(void)
+{
+	int count, i;
+
+	/*
+	 * do a partial walk of MADT to determine how many CPUs
+	 * we have including disabled CPUs, and get information
+	 * we need for SMP init
+	 */
+	count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
+			acpi_parse_gic_cpu_interface, 0);
+
+	if (!count) {
+		pr_err("No GIC CPU interface entries present\n");
+		return;
+	} else if (count < 0) {
+		pr_err("Error parsing GIC CPU interface entry\n");
+		return;
+	}
+
+	if (!bootcpu_valid) {
+		pr_err("MADT missing boot CPU MPIDR, not enabling secondaries\n");
+		return;
+	}
+
+	for (i = 0; i < enabled_cpus; i++)
+		set_cpu_possible(i, true);
+
+	/* Make boot-up look pretty */
+	pr_info("%d CPUs enabled, %d CPUs total\n", enabled_cpus, total_cpus);
+}
+
 static int __init acpi_parse_fadt(struct acpi_table_header *table)
 {
 	struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
@@ -96,8 +229,20 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 	 * boot protocol configuration data, or we will disable ACPI.
 	 */
 	if (table->revision > 5 ||
-	    (table->revision == 5 && fadt->minor_revision >= 1))
-		return 0;
+	    (table->revision == 5 && fadt->minor_revision >= 1)) {
+		/*
+		 * ACPI 5.1 only has two explicit methods to boot up SMP,
+		 * PSCI and Parking protocol, but the Parking protocol is
+		 * only specified for ARMv7 now, so make PSCI as the only
+		 * way for the SMP boot protocol before some updates for
+		 * the Parking protocol spec.
+		 */
+		if (acpi_psci_present())
+			return 0;
+
+		pr_warn("No PSCI support, will not bring up secondary CPUs\n");
+		return -EOPNOTSUPP;
+	}
 
 	pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
 		table->revision, fadt->minor_revision);
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index cce9524..fb8ff9b 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -35,7 +35,7 @@ static const struct cpu_operations *supported_cpu_ops[] __initconst = {
 	NULL,
 };
 
-static const struct cpu_operations * __init cpu_get_ops(const char *name)
+const struct cpu_operations * __init cpu_get_ops(const char *name)
 {
 	const struct cpu_operations **ops = supported_cpu_ops;
 
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 97fa7f3..b278311 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -393,13 +393,16 @@ void __init setup_arch(char **cmdline_p)
 	if (acpi_disabled) {
 		unflatten_device_tree();
 		psci_dt_init();
+		cpu_read_bootcpu_ops();
+#ifdef CONFIG_SMP
+		of_smp_init_cpus();
+#endif
 	} else {
 		psci_acpi_init();
+		acpi_init_cpus();
 	}
 
-	cpu_read_bootcpu_ops();
 #ifdef CONFIG_SMP
-	smp_init_cpus();
 	smp_build_mpidr_hash();
 #endif
 
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 328b8ce..52998b7 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -322,7 +322,7 @@ void __init smp_prepare_boot_cpu(void)
  * cpu logical map array containing MPIDR values related to logical
  * cpus. Assumes that cpu_logical_map(0) has already been initialized.
  */
-void __init smp_init_cpus(void)
+void __init of_smp_init_cpus(void)
 {
 	struct device_node *dn = NULL;
 	unsigned int i, cpu = 1;
-- 
1.9.1

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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

MADT contains the information for MPIDR which is essential for
SMP initialization, parse the GIC cpu interface structures to
get the MPIDR value and map it to cpu_logical_map(), and add
enabled cpu with valid MPIDR into cpu_possible_map.

ACPI 5.1 only has two explicit methods to boot up SMP, PSCI and
Parking protocol, but the Parking protocol is only specified for
ARMv7 now, so make PSCI as the only way for the SMP boot protocol
before some updates for the ACPI spec or the Parking protocol spec.

Parking protocol patches for SMP boot will be sent to upstream when
the new version of Parking protocol is ready.

CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
---
 arch/arm64/include/asm/acpi.h    |   2 +
 arch/arm64/include/asm/cpu_ops.h |   1 +
 arch/arm64/include/asm/smp.h     |   5 +-
 arch/arm64/kernel/acpi.c         | 149 ++++++++++++++++++++++++++++++++++++++-
 arch/arm64/kernel/cpu_ops.c      |   2 +-
 arch/arm64/kernel/setup.c        |   7 +-
 arch/arm64/kernel/smp.c          |   2 +-
 7 files changed, 160 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 9ea650c..9719921 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -71,10 +71,12 @@ static inline bool acpi_has_cpu_in_madt(void)
 }
 
 static inline void arch_fix_phys_package_id(int num, u32 slot) { }
+void __init acpi_init_cpus(void);
 
 #else
 static inline bool acpi_psci_present(void) { return false; }
 static inline bool acpi_psci_use_hvc(void) { return false; }
+static inline void acpi_init_cpus(void) { }
 #endif /* CONFIG_ACPI */
 
 #endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index da301ee..5a31d67 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -66,5 +66,6 @@ struct cpu_operations {
 extern const struct cpu_operations *cpu_ops[NR_CPUS];
 int __init cpu_read_ops(struct device_node *dn, int cpu);
 void __init cpu_read_bootcpu_ops(void);
+const struct cpu_operations *cpu_get_ops(const char *name);
 
 #endif /* ifndef __ASM_CPU_OPS_H */
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 780f82c..bf22650 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -39,9 +39,10 @@ extern void show_ipi_list(struct seq_file *p, int prec);
 extern void handle_IPI(int ipinr, struct pt_regs *regs);
 
 /*
- * Setup the set of possible CPUs (via set_cpu_possible)
+ * Discover the set of possible CPUs and determine their
+ * SMP operations.
  */
-extern void smp_init_cpus(void);
+extern void of_smp_init_cpus(void);
 
 /*
  * Provide a function to raise an IPI cross call on CPUs in callmap.
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 2269e30..c9203c0 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -25,6 +25,10 @@
 #include <linux/of_fdt.h>
 #include <linux/smp.h>
 
+#include <asm/cputype.h>
+#include <asm/cpu_ops.h>
+#include <asm/smp_plat.h>
+
 int acpi_noirq = 1;		/* skip ACPI IRQ initialization */
 int acpi_disabled = 1;
 EXPORT_SYMBOL(acpi_disabled);
@@ -32,6 +36,12 @@ EXPORT_SYMBOL(acpi_disabled);
 int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
+/* Processors with enabled flag and sane MPIDR */
+static int enabled_cpus;
+
+/* Boot CPU is valid or not in MADT */
+static bool bootcpu_valid  __initdata;
+
 static bool param_acpi_off __initdata;
 static bool param_acpi_force __initdata;
 
@@ -85,6 +95,129 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
 	early_memunmap(map, size);
 }
 
+/**
+ * acpi_map_gic_cpu_interface - generates a logical cpu number
+ * and map to MPIDR represented by GICC structure
+ * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
+ * @enabled: this cpu is enabled or not
+ *
+ * Returns the logical cpu number which maps to MPIDR
+ */
+static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
+{
+	int i;
+
+	if (mpidr == INVALID_HWID) {
+		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
+		return -EINVAL;
+	}
+
+	total_cpus++;
+	if (!enabled)
+		return -EINVAL;
+
+	if (enabled_cpus >=  NR_CPUS) {
+		pr_warn("NR_CPUS limit of %d reached, Processor %d/0x%llx ignored.\n",
+			NR_CPUS, total_cpus, mpidr);
+		return -EINVAL;
+	}
+
+	/* Check if GICC structure of boot CPU is available in the MADT */
+	if (cpu_logical_map(0) == mpidr) {
+		if (bootcpu_valid) {
+			pr_err("Firmware bug, duplicate CPU MPIDR: 0x%llx in MADT\n",
+			       mpidr);
+			return -EINVAL;
+		}
+
+		bootcpu_valid = true;
+	}
+
+	/*
+	 * Duplicate MPIDRs are a recipe for disaster. Scan
+	 * all initialized entries and check for
+	 * duplicates. If any is found just ignore the CPU.
+	 */
+	for (i = 1; i < enabled_cpus; i++) {
+		if (cpu_logical_map(i) == mpidr) {
+			pr_err("Firmware bug, duplicate CPU MPIDR: 0x%llx in MADT\n",
+			       mpidr);
+			return -EINVAL;
+		}
+	}
+
+	if (!acpi_psci_present())
+		return -EOPNOTSUPP;
+
+	cpu_ops[enabled_cpus] = cpu_get_ops("psci");
+	/* CPU 0 was already initialized */
+	if (enabled_cpus) {
+		if (!cpu_ops[enabled_cpus])
+			return -EINVAL;
+
+		if (cpu_ops[enabled_cpus]->cpu_init(NULL, enabled_cpus))
+			return -EOPNOTSUPP;
+
+		/* map the logical cpu id to cpu MPIDR */
+		cpu_logical_map(enabled_cpus) = mpidr;
+	}
+
+	enabled_cpus++;
+	return enabled_cpus;
+}
+
+static int __init
+acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
+				const unsigned long end)
+{
+	struct acpi_madt_generic_interrupt *processor;
+
+	processor = (struct acpi_madt_generic_interrupt *)header;
+
+	if (BAD_MADT_ENTRY(processor, end))
+		return -EINVAL;
+
+	acpi_table_print_madt_entry(header);
+
+	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
+		processor->flags & ACPI_MADT_ENABLED);
+
+	return 0;
+}
+
+/* Parse GIC cpu interface entries in MADT for SMP init */
+void __init acpi_init_cpus(void)
+{
+	int count, i;
+
+	/*
+	 * do a partial walk of MADT to determine how many CPUs
+	 * we have including disabled CPUs, and get information
+	 * we need for SMP init
+	 */
+	count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
+			acpi_parse_gic_cpu_interface, 0);
+
+	if (!count) {
+		pr_err("No GIC CPU interface entries present\n");
+		return;
+	} else if (count < 0) {
+		pr_err("Error parsing GIC CPU interface entry\n");
+		return;
+	}
+
+	if (!bootcpu_valid) {
+		pr_err("MADT missing boot CPU MPIDR, not enabling secondaries\n");
+		return;
+	}
+
+	for (i = 0; i < enabled_cpus; i++)
+		set_cpu_possible(i, true);
+
+	/* Make boot-up look pretty */
+	pr_info("%d CPUs enabled, %d CPUs total\n", enabled_cpus, total_cpus);
+}
+
 static int __init acpi_parse_fadt(struct acpi_table_header *table)
 {
 	struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
@@ -96,8 +229,20 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 	 * boot protocol configuration data, or we will disable ACPI.
 	 */
 	if (table->revision > 5 ||
-	    (table->revision == 5 && fadt->minor_revision >= 1))
-		return 0;
+	    (table->revision == 5 && fadt->minor_revision >= 1)) {
+		/*
+		 * ACPI 5.1 only has two explicit methods to boot up SMP,
+		 * PSCI and Parking protocol, but the Parking protocol is
+		 * only specified for ARMv7 now, so make PSCI as the only
+		 * way for the SMP boot protocol before some updates for
+		 * the Parking protocol spec.
+		 */
+		if (acpi_psci_present())
+			return 0;
+
+		pr_warn("No PSCI support, will not bring up secondary CPUs\n");
+		return -EOPNOTSUPP;
+	}
 
 	pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
 		table->revision, fadt->minor_revision);
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index cce9524..fb8ff9b 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -35,7 +35,7 @@ static const struct cpu_operations *supported_cpu_ops[] __initconst = {
 	NULL,
 };
 
-static const struct cpu_operations * __init cpu_get_ops(const char *name)
+const struct cpu_operations * __init cpu_get_ops(const char *name)
 {
 	const struct cpu_operations **ops = supported_cpu_ops;
 
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 97fa7f3..b278311 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -393,13 +393,16 @@ void __init setup_arch(char **cmdline_p)
 	if (acpi_disabled) {
 		unflatten_device_tree();
 		psci_dt_init();
+		cpu_read_bootcpu_ops();
+#ifdef CONFIG_SMP
+		of_smp_init_cpus();
+#endif
 	} else {
 		psci_acpi_init();
+		acpi_init_cpus();
 	}
 
-	cpu_read_bootcpu_ops();
 #ifdef CONFIG_SMP
-	smp_init_cpus();
 	smp_build_mpidr_hash();
 #endif
 
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 328b8ce..52998b7 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -322,7 +322,7 @@ void __init smp_prepare_boot_cpu(void)
  * cpu logical map array containing MPIDR values related to logical
  * cpus. Assumes that cpu_logical_map(0) has already been initialized.
  */
-void __init smp_init_cpus(void)
+void __init of_smp_init_cpus(void)
 {
 	struct device_node *dn = NULL;
 	unsigned int i, cpu = 1;
-- 
1.9.1

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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
but phys_id is used as int in acpi processor driver, so it will lead to
some inconsistence for the drivers.

Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
ids a generic CPU physical id type is required.

So introduce typedef u32 phys_cpuid_t in a common file, and introduce
a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
by other archs, this will solve the inconsistence in acpi processor driver,
and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
in the following patch.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[hj: reworked cpu physid map return codes]
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/ia64/kernel/acpi.c       |  2 +-
 arch/x86/kernel/acpi/boot.c   |  2 +-
 drivers/acpi/acpi_processor.c |  7 ++++---
 drivers/acpi/processor_core.c | 30 +++++++++++++++---------------
 include/acpi/processor.h      |  6 +++---
 include/linux/acpi.h          |  7 ++++++-
 6 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 2c44989..067ef44 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -887,7 +887,7 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
 }
 
 /* wrapper to silence section mismatch warning */
-int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
+int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
 {
 	return _acpi_map_lsapic(handle, physid, pcpu);
 }
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 803b684..dbe76a1 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -757,7 +757,7 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
 }
 
 /* wrapper to silence section mismatch warning */
-int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
+int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
 {
 	return _acpi_map_lsapic(handle, physid, pcpu);
 }
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 1020b1b..58f335c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 	acpi_status status;
 	int ret;
 
-	if (pr->phys_id == -1)
+	if (pr->phys_id == PHYS_CPUID_INVALID)
 		return -ENODEV;
 
 	status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
@@ -215,7 +215,8 @@ static int acpi_processor_get_info(struct acpi_device *device)
 	union acpi_object object = { 0 };
 	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
 	struct acpi_processor *pr = acpi_driver_data(device);
-	int phys_id, cpu_index, device_declaration = 0;
+	phys_cpuid_t phys_id;
+	int cpu_index, device_declaration = 0;
 	acpi_status status = AE_OK;
 	static int cpu0_initialized;
 	unsigned long long value;
@@ -263,7 +264,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
 	}
 
 	phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id);
-	if (phys_id < 0)
+	if (phys_id == PHYS_CPUID_INVALID)
 		acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n");
 	pr->phys_id = phys_id;
 
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 7962651..51cc299 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -32,7 +32,7 @@ static struct acpi_table_madt *get_madt_table(void)
 }
 
 static int map_lapic_id(struct acpi_subtable_header *entry,
-		 u32 acpi_id, int *apic_id)
+		 u32 acpi_id, phys_cpuid_t *apic_id)
 {
 	struct acpi_madt_local_apic *lapic =
 		container_of(entry, struct acpi_madt_local_apic, header);
@@ -48,7 +48,7 @@ static int map_lapic_id(struct acpi_subtable_header *entry,
 }
 
 static int map_x2apic_id(struct acpi_subtable_header *entry,
-			 int device_declaration, u32 acpi_id, int *apic_id)
+		int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id)
 {
 	struct acpi_madt_local_x2apic *apic =
 		container_of(entry, struct acpi_madt_local_x2apic, header);
@@ -65,7 +65,7 @@ static int map_x2apic_id(struct acpi_subtable_header *entry,
 }
 
 static int map_lsapic_id(struct acpi_subtable_header *entry,
-		int device_declaration, u32 acpi_id, int *apic_id)
+		int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id)
 {
 	struct acpi_madt_local_sapic *lsapic =
 		container_of(entry, struct acpi_madt_local_sapic, header);
@@ -83,10 +83,10 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
 	return 0;
 }
 
-static int map_madt_entry(int type, u32 acpi_id)
+static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
 {
 	unsigned long madt_end, entry;
-	int phys_id = -1;	/* CPU hardware ID */
+	phys_cpuid_t phys_id = PHYS_CPUID_INVALID;	/* CPU hardware ID */
 	struct acpi_table_madt *madt;
 
 	madt = get_madt_table();
@@ -117,12 +117,12 @@ static int map_madt_entry(int type, u32 acpi_id)
 	return phys_id;
 }
 
-static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
+static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 {
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
 	struct acpi_subtable_header *header;
-	int phys_id = -1;
+	phys_cpuid_t phys_id = PHYS_CPUID_INVALID;
 
 	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
 		goto exit;
@@ -149,27 +149,27 @@ exit:
 	return phys_id;
 }
 
-int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
+phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
 {
-	int phys_id;
+	phys_cpuid_t phys_id;
 
 	phys_id = map_mat_entry(handle, type, acpi_id);
-	if (phys_id == -1)
+	if (phys_id == PHYS_CPUID_INVALID)
 		phys_id = map_madt_entry(type, acpi_id);
 
 	return phys_id;
 }
 
-int acpi_map_cpuid(int phys_id, u32 acpi_id)
+int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id)
 {
 #ifdef CONFIG_SMP
 	int i;
 #endif
 
-	if (phys_id == -1) {
+	if (phys_id == PHYS_CPUID_INVALID) {
 		/*
 		 * On UP processor, there is no _MAT or MADT table.
-		 * So above phys_id is always set to -1.
+		 * So above phys_id is always set to PHYS_CPUID_INVALID.
 		 *
 		 * BIOS may define multiple CPU handles even for UP processor.
 		 * For example,
@@ -190,7 +190,7 @@ int acpi_map_cpuid(int phys_id, u32 acpi_id)
 		if (nr_cpu_ids <= 1 && acpi_id == 0)
 			return acpi_id;
 		else
-			return phys_id;
+			return -1;
 	}
 
 #ifdef CONFIG_SMP
@@ -208,7 +208,7 @@ int acpi_map_cpuid(int phys_id, u32 acpi_id)
 
 int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
 {
-	int phys_id;
+	phys_cpuid_t phys_id;
 
 	phys_id = acpi_get_phys_id(handle, type, acpi_id);
 
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index b95dc32..4188a4d 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -196,7 +196,7 @@ struct acpi_processor_flags {
 struct acpi_processor {
 	acpi_handle handle;
 	u32 acpi_id;
-	u32 phys_id;	/* CPU hardware ID such as APIC ID for x86 */
+	phys_cpuid_t phys_id;	/* CPU hardware ID such as APIC ID for x86 */
 	u32 id;		/* CPU logical ID allocated by OS */
 	u32 pblk;
 	int performance_platform_limit;
@@ -310,8 +310,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
 #endif				/* CONFIG_CPU_FREQ */
 
 /* in processor_core.c */
-int acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
-int acpi_map_cpuid(int phys_id, u32 acpi_id);
+phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
+int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
 int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
 
 /* in processor_pdc.c */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 24c7aa8..6ec33c5 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -146,9 +146,14 @@ void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
 int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
 void acpi_numa_arch_fixup(void);
 
+#ifndef PHYS_CPUID_INVALID
+typedef u32 phys_cpuid_t;
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
+#endif
+
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 /* Arch dependent functions for cpu hotplug support */
-int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu);
+int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu);
 int acpi_unmap_cpu(int cpu);
 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
 
-- 
1.9.1


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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
but phys_id is used as int in acpi processor driver, so it will lead to
some inconsistence for the drivers.

Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
ids a generic CPU physical id type is required.

So introduce typedef u32 phys_cpuid_t in a common file, and introduce
a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
by other archs, this will solve the inconsistence in acpi processor driver,
and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
in the following patch.

CC: Rafael J Wysocki <rjw@rjwysocki.net>
Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[hj: reworked cpu physid map return codes]
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/ia64/kernel/acpi.c       |  2 +-
 arch/x86/kernel/acpi/boot.c   |  2 +-
 drivers/acpi/acpi_processor.c |  7 ++++---
 drivers/acpi/processor_core.c | 30 +++++++++++++++---------------
 include/acpi/processor.h      |  6 +++---
 include/linux/acpi.h          |  7 ++++++-
 6 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 2c44989..067ef44 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -887,7 +887,7 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
 }
 
 /* wrapper to silence section mismatch warning */
-int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
+int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
 {
 	return _acpi_map_lsapic(handle, physid, pcpu);
 }
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 803b684..dbe76a1 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -757,7 +757,7 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
 }
 
 /* wrapper to silence section mismatch warning */
-int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
+int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
 {
 	return _acpi_map_lsapic(handle, physid, pcpu);
 }
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 1020b1b..58f335c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 	acpi_status status;
 	int ret;
 
-	if (pr->phys_id == -1)
+	if (pr->phys_id == PHYS_CPUID_INVALID)
 		return -ENODEV;
 
 	status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
@@ -215,7 +215,8 @@ static int acpi_processor_get_info(struct acpi_device *device)
 	union acpi_object object = { 0 };
 	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
 	struct acpi_processor *pr = acpi_driver_data(device);
-	int phys_id, cpu_index, device_declaration = 0;
+	phys_cpuid_t phys_id;
+	int cpu_index, device_declaration = 0;
 	acpi_status status = AE_OK;
 	static int cpu0_initialized;
 	unsigned long long value;
@@ -263,7 +264,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
 	}
 
 	phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id);
-	if (phys_id < 0)
+	if (phys_id == PHYS_CPUID_INVALID)
 		acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n");
 	pr->phys_id = phys_id;
 
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 7962651..51cc299 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -32,7 +32,7 @@ static struct acpi_table_madt *get_madt_table(void)
 }
 
 static int map_lapic_id(struct acpi_subtable_header *entry,
-		 u32 acpi_id, int *apic_id)
+		 u32 acpi_id, phys_cpuid_t *apic_id)
 {
 	struct acpi_madt_local_apic *lapic =
 		container_of(entry, struct acpi_madt_local_apic, header);
@@ -48,7 +48,7 @@ static int map_lapic_id(struct acpi_subtable_header *entry,
 }
 
 static int map_x2apic_id(struct acpi_subtable_header *entry,
-			 int device_declaration, u32 acpi_id, int *apic_id)
+		int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id)
 {
 	struct acpi_madt_local_x2apic *apic =
 		container_of(entry, struct acpi_madt_local_x2apic, header);
@@ -65,7 +65,7 @@ static int map_x2apic_id(struct acpi_subtable_header *entry,
 }
 
 static int map_lsapic_id(struct acpi_subtable_header *entry,
-		int device_declaration, u32 acpi_id, int *apic_id)
+		int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id)
 {
 	struct acpi_madt_local_sapic *lsapic =
 		container_of(entry, struct acpi_madt_local_sapic, header);
@@ -83,10 +83,10 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
 	return 0;
 }
 
-static int map_madt_entry(int type, u32 acpi_id)
+static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
 {
 	unsigned long madt_end, entry;
-	int phys_id = -1;	/* CPU hardware ID */
+	phys_cpuid_t phys_id = PHYS_CPUID_INVALID;	/* CPU hardware ID */
 	struct acpi_table_madt *madt;
 
 	madt = get_madt_table();
@@ -117,12 +117,12 @@ static int map_madt_entry(int type, u32 acpi_id)
 	return phys_id;
 }
 
-static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
+static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 {
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
 	struct acpi_subtable_header *header;
-	int phys_id = -1;
+	phys_cpuid_t phys_id = PHYS_CPUID_INVALID;
 
 	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
 		goto exit;
@@ -149,27 +149,27 @@ exit:
 	return phys_id;
 }
 
-int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
+phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
 {
-	int phys_id;
+	phys_cpuid_t phys_id;
 
 	phys_id = map_mat_entry(handle, type, acpi_id);
-	if (phys_id == -1)
+	if (phys_id == PHYS_CPUID_INVALID)
 		phys_id = map_madt_entry(type, acpi_id);
 
 	return phys_id;
 }
 
-int acpi_map_cpuid(int phys_id, u32 acpi_id)
+int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id)
 {
 #ifdef CONFIG_SMP
 	int i;
 #endif
 
-	if (phys_id == -1) {
+	if (phys_id == PHYS_CPUID_INVALID) {
 		/*
 		 * On UP processor, there is no _MAT or MADT table.
-		 * So above phys_id is always set to -1.
+		 * So above phys_id is always set to PHYS_CPUID_INVALID.
 		 *
 		 * BIOS may define multiple CPU handles even for UP processor.
 		 * For example,
@@ -190,7 +190,7 @@ int acpi_map_cpuid(int phys_id, u32 acpi_id)
 		if (nr_cpu_ids <= 1 && acpi_id == 0)
 			return acpi_id;
 		else
-			return phys_id;
+			return -1;
 	}
 
 #ifdef CONFIG_SMP
@@ -208,7 +208,7 @@ int acpi_map_cpuid(int phys_id, u32 acpi_id)
 
 int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
 {
-	int phys_id;
+	phys_cpuid_t phys_id;
 
 	phys_id = acpi_get_phys_id(handle, type, acpi_id);
 
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index b95dc32..4188a4d 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -196,7 +196,7 @@ struct acpi_processor_flags {
 struct acpi_processor {
 	acpi_handle handle;
 	u32 acpi_id;
-	u32 phys_id;	/* CPU hardware ID such as APIC ID for x86 */
+	phys_cpuid_t phys_id;	/* CPU hardware ID such as APIC ID for x86 */
 	u32 id;		/* CPU logical ID allocated by OS */
 	u32 pblk;
 	int performance_platform_limit;
@@ -310,8 +310,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
 #endif				/* CONFIG_CPU_FREQ */
 
 /* in processor_core.c */
-int acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
-int acpi_map_cpuid(int phys_id, u32 acpi_id);
+phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
+int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
 int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
 
 /* in processor_pdc.c */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 24c7aa8..6ec33c5 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -146,9 +146,14 @@ void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
 int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
 void acpi_numa_arch_fixup(void);
 
+#ifndef PHYS_CPUID_INVALID
+typedef u32 phys_cpuid_t;
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
+#endif
+
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 /* Arch dependent functions for cpu hotplug support */
-int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu);
+int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu);
 int acpi_unmap_cpu(int cpu);
 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
 
-- 
1.9.1

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

* [patch v11 14/23] ACPI / processor: Make it possible to get CPU hardware ID via GICC
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

Introduce a new function map_gicc_mpidr() to allow MPIDRs to be obtained
from the GICC Structure introduced by ACPI 5.1, since MPIDR for ARM64 is
64-bit, so typedef u64 for phys_cpuid_t.

The ARM architecture defines the MPIDR register as the CPU hardware
identifier. This patch adds the code infrastructure to retrieve the MPIDR
values from the ARM ACPI GICC structure in order to look-up the kernel CPU
hardware ids required by the ACPI core code to identify CPUs.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 12 ++++++++++++
 drivers/acpi/processor_core.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 9719921..eea0bc3 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -13,6 +13,8 @@
 #define _ASM_ACPI_H
 
 #include <linux/mm.h>
+#include <asm/cputype.h>
+#include <asm/smp_plat.h>
 
 /* Basic configuration for ACPI */
 #ifdef	CONFIG_ACPI
@@ -27,6 +29,9 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
 }
 #define acpi_os_ioremap acpi_os_ioremap
 
+typedef u64 phys_cpuid_t;
+#define PHYS_CPUID_INVALID INVALID_HWID
+
 #define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
 extern int acpi_disabled;
 extern int acpi_noirq;
@@ -59,6 +64,13 @@ static inline void enable_acpi(void)
 }
 
 /*
+ * The ACPI processor driver for ACPI core code needs this macro
+ * to find out this cpu was already mapped (mapping from CPU hardware
+ * ID to CPU logical ID) or not.
+ */
+#define cpu_physical_id(cpu) cpu_logical_map(cpu)
+
+/*
  * It's used from ACPI core in kdump to boot UP system with SMP kernel,
  * with this check the ACPI core will not override the CPU index
  * obtained from GICC with 0 and not print some error message as well.
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 51cc299..b1ec78b 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -83,6 +83,31 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
 	return 0;
 }
 
+/*
+ * Retrieve the ARM CPU physical identifier (MPIDR)
+ */
+static int map_gicc_mpidr(struct acpi_subtable_header *entry,
+		int device_declaration, u32 acpi_id, phys_cpuid_t *mpidr)
+{
+	struct acpi_madt_generic_interrupt *gicc =
+	    container_of(entry, struct acpi_madt_generic_interrupt, header);
+
+	if (!(gicc->flags & ACPI_MADT_ENABLED))
+		return -ENODEV;
+
+	/* device_declaration means Device object in DSDT, 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 && (gicc->uid == acpi_id)) {
+		*mpidr = gicc->arm_mpidr;
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
 {
 	unsigned long madt_end, entry;
@@ -111,6 +136,9 @@ static phys_cpuid_t 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, &phys_id))
 				break;
+		} else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
+			if (!map_gicc_mpidr(header, type, acpi_id, &phys_id))
+				break;
 		}
 		entry += header->length;
 	}
@@ -143,6 +171,8 @@ static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 		map_lsapic_id(header, type, acpi_id, &phys_id);
 	else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC)
 		map_x2apic_id(header, type, acpi_id, &phys_id);
+	else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT)
+		map_gicc_mpidr(header, type, acpi_id, &phys_id);
 
 exit:
 	kfree(buffer.pointer);
-- 
1.9.1

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

* [patch v11 14/23] ACPI / processor: Make it possible to get CPU hardware ID via GICC
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Introduce a new function map_gicc_mpidr() to allow MPIDRs to be obtained
from the GICC Structure introduced by ACPI 5.1, since MPIDR for ARM64 is
64-bit, so typedef u64 for phys_cpuid_t.

The ARM architecture defines the MPIDR register as the CPU hardware
identifier. This patch adds the code infrastructure to retrieve the MPIDR
values from the ARM ACPI GICC structure in order to look-up the kernel CPU
hardware ids required by the ACPI core code to identify CPUs.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 12 ++++++++++++
 drivers/acpi/processor_core.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 9719921..eea0bc3 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -13,6 +13,8 @@
 #define _ASM_ACPI_H
 
 #include <linux/mm.h>
+#include <asm/cputype.h>
+#include <asm/smp_plat.h>
 
 /* Basic configuration for ACPI */
 #ifdef	CONFIG_ACPI
@@ -27,6 +29,9 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
 }
 #define acpi_os_ioremap acpi_os_ioremap
 
+typedef u64 phys_cpuid_t;
+#define PHYS_CPUID_INVALID INVALID_HWID
+
 #define acpi_strict 1	/* No out-of-spec workarounds on ARM64 */
 extern int acpi_disabled;
 extern int acpi_noirq;
@@ -59,6 +64,13 @@ static inline void enable_acpi(void)
 }
 
 /*
+ * The ACPI processor driver for ACPI core code needs this macro
+ * to find out this cpu was already mapped (mapping from CPU hardware
+ * ID to CPU logical ID) or not.
+ */
+#define cpu_physical_id(cpu) cpu_logical_map(cpu)
+
+/*
  * It's used from ACPI core in kdump to boot UP system with SMP kernel,
  * with this check the ACPI core will not override the CPU index
  * obtained from GICC with 0 and not print some error message as well.
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 51cc299..b1ec78b 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -83,6 +83,31 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
 	return 0;
 }
 
+/*
+ * Retrieve the ARM CPU physical identifier (MPIDR)
+ */
+static int map_gicc_mpidr(struct acpi_subtable_header *entry,
+		int device_declaration, u32 acpi_id, phys_cpuid_t *mpidr)
+{
+	struct acpi_madt_generic_interrupt *gicc =
+	    container_of(entry, struct acpi_madt_generic_interrupt, header);
+
+	if (!(gicc->flags & ACPI_MADT_ENABLED))
+		return -ENODEV;
+
+	/* device_declaration means Device object in DSDT, 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 && (gicc->uid == acpi_id)) {
+		*mpidr = gicc->arm_mpidr;
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
 {
 	unsigned long madt_end, entry;
@@ -111,6 +136,9 @@ static phys_cpuid_t 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, &phys_id))
 				break;
+		} else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
+			if (!map_gicc_mpidr(header, type, acpi_id, &phys_id))
+				break;
 		}
 		entry += header->length;
 	}
@@ -143,6 +171,8 @@ static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 		map_lsapic_id(header, type, acpi_id, &phys_id);
 	else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC)
 		map_x2apic_id(header, type, acpi_id, &phys_id);
+	else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT)
+		map_gicc_mpidr(header, type, acpi_id, &phys_id);
 
 exit:
 	kfree(buffer.pointer);
-- 
1.9.1

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

* [patch v11 15/23] ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo

Introduce ACPI_IRQ_MODEL_GIC which is needed for ARM64 as GIC is
used, and then register device's gsi with the core IRQ subsystem.

acpi_register_gsi() is similar to DT based irq_of_parse_and_map(),
since gsi is unique in the system, so use hwirq number directly
for the mapping.

We are going to implement stacked domains when GICv2m, GICv3, ITS
support are added.

CC: Marc Zyngier <marc.zyngier@arm.com>
Originally-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/acpi.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/bus.c       |  3 ++
 include/linux/acpi.h     |  1 +
 3 files changed, 77 insertions(+)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index c9203c0..dec6f8a 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -76,6 +76,12 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
 }
 
 /*
+ * Since we're on ARM, the default interrupt routing model
+ * clearly has to be GIC.
+ */
+enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_GIC;
+
+/*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
  */
@@ -218,6 +224,73 @@ void __init acpi_init_cpus(void)
 	pr_info("%d CPUs enabled, %d CPUs total\n", enabled_cpus, total_cpus);
 }
 
+int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
+{
+	*irq = irq_find_mapping(NULL, gsi);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
+
+/*
+ * success: return IRQ number (>0)
+ * failure: return =< 0
+ */
+int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
+{
+	unsigned int irq;
+	unsigned int irq_type;
+
+	/*
+	 * ACPI have no bindings to indicate SPI or PPI, so we
+	 * use different mappings from DT in ACPI.
+	 *
+	 * For FDT
+	 * PPI interrupt: in the range [0, 15];
+	 * SPI interrupt: in the range [0, 987];
+	 *
+	 * For ACPI, GSI should be unique so using
+	 * the hwirq directly for the mapping:
+	 * PPI interrupt: in the range [16, 31];
+	 * SPI interrupt: in the range [32, 1019];
+	 */
+
+	if (trigger == ACPI_EDGE_SENSITIVE &&
+				polarity == ACPI_ACTIVE_LOW)
+		irq_type = IRQ_TYPE_EDGE_FALLING;
+	else if (trigger == ACPI_EDGE_SENSITIVE &&
+				polarity == ACPI_ACTIVE_HIGH)
+		irq_type = IRQ_TYPE_EDGE_RISING;
+	else if (trigger == ACPI_LEVEL_SENSITIVE &&
+				polarity == ACPI_ACTIVE_LOW)
+		irq_type = IRQ_TYPE_LEVEL_LOW;
+	else if (trigger == ACPI_LEVEL_SENSITIVE &&
+				polarity == ACPI_ACTIVE_HIGH)
+		irq_type = IRQ_TYPE_LEVEL_HIGH;
+	else
+		irq_type = IRQ_TYPE_NONE;
+
+	/*
+	 * Since only one GIC is supported in ACPI 5.0, we can
+	 * create mapping refer to the default domain
+	 */
+	irq = irq_create_mapping(NULL, gsi);
+	if (!irq)
+		return irq;
+
+	/* Set irq type if specified and different than the current one */
+	if (irq_type != IRQ_TYPE_NONE &&
+		irq_type != irq_get_trigger_type(irq))
+		irq_set_irq_type(irq, irq_type);
+	return irq;
+}
+EXPORT_SYMBOL_GPL(acpi_register_gsi);
+
+void acpi_unregister_gsi(u32 gsi)
+{
+}
+EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
+
 static int __init acpi_parse_fadt(struct acpi_table_header *table)
 {
 	struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 8b67bd0..c412fdb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -448,6 +448,9 @@ static int __init acpi_bus_init_irq(void)
 	case ACPI_IRQ_MODEL_IOSAPIC:
 		message = "IOSAPIC";
 		break;
+	case ACPI_IRQ_MODEL_GIC:
+		message = "GIC";
+		break;
 	case ACPI_IRQ_MODEL_PLATFORM:
 		message = "platform specific model";
 		break;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6ec33c5..de4e86f 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -73,6 +73,7 @@ enum acpi_irq_model_id {
 	ACPI_IRQ_MODEL_IOAPIC,
 	ACPI_IRQ_MODEL_IOSAPIC,
 	ACPI_IRQ_MODEL_PLATFORM,
+	ACPI_IRQ_MODEL_GIC,
 	ACPI_IRQ_MODEL_COUNT
 };
 
-- 
1.9.1

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

* [patch v11 15/23] ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Introduce ACPI_IRQ_MODEL_GIC which is needed for ARM64 as GIC is
used, and then register device's gsi with the core IRQ subsystem.

acpi_register_gsi() is similar to DT based irq_of_parse_and_map(),
since gsi is unique in the system, so use hwirq number directly
for the mapping.

We are going to implement stacked domains when GICv2m, GICv3, ITS
support are added.

CC: Marc Zyngier <marc.zyngier@arm.com>
Originally-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/acpi.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/bus.c       |  3 ++
 include/linux/acpi.h     |  1 +
 3 files changed, 77 insertions(+)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index c9203c0..dec6f8a 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -76,6 +76,12 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
 }
 
 /*
+ * Since we're on ARM, the default interrupt routing model
+ * clearly has to be GIC.
+ */
+enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_GIC;
+
+/*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
  */
@@ -218,6 +224,73 @@ void __init acpi_init_cpus(void)
 	pr_info("%d CPUs enabled, %d CPUs total\n", enabled_cpus, total_cpus);
 }
 
+int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
+{
+	*irq = irq_find_mapping(NULL, gsi);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
+
+/*
+ * success: return IRQ number (>0)
+ * failure: return =< 0
+ */
+int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
+{
+	unsigned int irq;
+	unsigned int irq_type;
+
+	/*
+	 * ACPI have no bindings to indicate SPI or PPI, so we
+	 * use different mappings from DT in ACPI.
+	 *
+	 * For FDT
+	 * PPI interrupt: in the range [0, 15];
+	 * SPI interrupt: in the range [0, 987];
+	 *
+	 * For ACPI, GSI should be unique so using
+	 * the hwirq directly for the mapping:
+	 * PPI interrupt: in the range [16, 31];
+	 * SPI interrupt: in the range [32, 1019];
+	 */
+
+	if (trigger == ACPI_EDGE_SENSITIVE &&
+				polarity == ACPI_ACTIVE_LOW)
+		irq_type = IRQ_TYPE_EDGE_FALLING;
+	else if (trigger == ACPI_EDGE_SENSITIVE &&
+				polarity == ACPI_ACTIVE_HIGH)
+		irq_type = IRQ_TYPE_EDGE_RISING;
+	else if (trigger == ACPI_LEVEL_SENSITIVE &&
+				polarity == ACPI_ACTIVE_LOW)
+		irq_type = IRQ_TYPE_LEVEL_LOW;
+	else if (trigger == ACPI_LEVEL_SENSITIVE &&
+				polarity == ACPI_ACTIVE_HIGH)
+		irq_type = IRQ_TYPE_LEVEL_HIGH;
+	else
+		irq_type = IRQ_TYPE_NONE;
+
+	/*
+	 * Since only one GIC is supported in ACPI 5.0, we can
+	 * create mapping refer to the default domain
+	 */
+	irq = irq_create_mapping(NULL, gsi);
+	if (!irq)
+		return irq;
+
+	/* Set irq type if specified and different than the current one */
+	if (irq_type != IRQ_TYPE_NONE &&
+		irq_type != irq_get_trigger_type(irq))
+		irq_set_irq_type(irq, irq_type);
+	return irq;
+}
+EXPORT_SYMBOL_GPL(acpi_register_gsi);
+
+void acpi_unregister_gsi(u32 gsi)
+{
+}
+EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
+
 static int __init acpi_parse_fadt(struct acpi_table_header *table)
 {
 	struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 8b67bd0..c412fdb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -448,6 +448,9 @@ static int __init acpi_bus_init_irq(void)
 	case ACPI_IRQ_MODEL_IOSAPIC:
 		message = "IOSAPIC";
 		break;
+	case ACPI_IRQ_MODEL_GIC:
+		message = "GIC";
+		break;
 	case ACPI_IRQ_MODEL_PLATFORM:
 		message = "platform specific model";
 		break;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6ec33c5..de4e86f 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -73,6 +73,7 @@ enum acpi_irq_model_id {
 	ACPI_IRQ_MODEL_IOAPIC,
 	ACPI_IRQ_MODEL_IOSAPIC,
 	ACPI_IRQ_MODEL_PLATFORM,
+	ACPI_IRQ_MODEL_GIC,
 	ACPI_IRQ_MODEL_COUNT
 };
 
-- 
1.9.1

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

* [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Tomasz Nowicki, Jason Cooper,
	Thomas Gleixner, Hanjun Guo

From: Tomasz Nowicki <tomasz.nowicki@linaro.org>

ACPI kernel uses MADT table for proper GIC initialization. It needs to
parse GIC related subtables, collect CPU interface and distributor
addresses and call driver initialization function (which is hardware
abstraction agnostic). In a similar way, FDT initialize GICv1/2.

NOTE: This commit allow to initialize GICv1/2 basic functionality.
While now simple GICv2 init call is used, any further GIC features
require generic infrastructure for proper ACPI irqchip initialization.
That mechanism and stacked irqdomains to support GICv2 MSI/virtualization
extension, GICv3/4 and its ITS are considered as next steps.

CC: Jason Cooper <jason@lakedaemon.net>
CC: Marc Zyngier <marc.zyngier@arm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h        |   2 +
 arch/arm64/include/asm/irq.h         |  13 +++++
 arch/arm64/kernel/acpi.c             |  25 +++++++++
 drivers/irqchip/irq-gic.c            | 102 +++++++++++++++++++++++++++++++++++
 drivers/irqchip/irqchip.c            |   3 ++
 include/linux/acpi_irq.h             |  10 ++++
 include/linux/irqchip/arm-gic-acpi.h |  31 +++++++++++
 7 files changed, 186 insertions(+)
 create mode 100644 include/linux/acpi_irq.h
 create mode 100644 include/linux/irqchip/arm-gic-acpi.h

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index eea0bc3..59c05d8 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -13,6 +13,8 @@
 #define _ASM_ACPI_H
 
 #include <linux/mm.h>
+#include <linux/irqchip/arm-gic-acpi.h>
+
 #include <asm/cputype.h>
 #include <asm/smp_plat.h>
 
diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h
index 94c5367..bbb251b 100644
--- a/arch/arm64/include/asm/irq.h
+++ b/arch/arm64/include/asm/irq.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_IRQ_H
 #define __ASM_IRQ_H
 
+#include <linux/irqchip/arm-gic-acpi.h>
+
 #include <asm-generic/irq.h>
 
 struct pt_regs;
@@ -8,4 +10,15 @@ struct pt_regs;
 extern void migrate_irqs(void);
 extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
 
+static inline void acpi_irq_init(void)
+{
+	/*
+	 * Hardcode ACPI IRQ chip initialization to GICv2 for now.
+	 * Proper irqchip infrastructure will be implemented along with
+	 * incoming  GICv2m|GICv3|ITS bits.
+	 */
+	acpi_gic_init();
+}
+#define acpi_irq_init acpi_irq_init
+
 #endif
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index dec6f8a..6468f88 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -359,3 +359,28 @@ void __init acpi_boot_table_init(void)
 		pr_err("Can't find FADT\n");
 	}
 }
+
+void __init acpi_gic_init(void)
+{
+	struct acpi_table_header *table;
+	acpi_status status;
+	acpi_size tbl_size;
+	int err;
+
+	if (acpi_disabled)
+		return;
+
+	status = acpi_get_table_with_size(ACPI_SIG_MADT, 0, &table, &tbl_size);
+	if (ACPI_FAILURE(status)) {
+		const char *msg = acpi_format_exception(status);
+
+		pr_err("Failed to get MADT table, %s\n", msg);
+		return;
+	}
+
+	err = gic_v2_acpi_init(table);
+	if (err)
+		pr_err("Failed to initialize GIC IRQ controller");
+
+	early_acpi_os_unmap_memory((char *)table, tbl_size);
+}
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 471e1cd..d15a36a 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -33,12 +33,14 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/acpi.h>
 #include <linux/irqdomain.h>
 #include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqchip/arm-gic.h>
+#include <linux/irqchip/arm-gic-acpi.h>
 
 #include <asm/cputype.h>
 #include <asm/irq.h>
@@ -1090,3 +1092,103 @@ IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init);
 IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init);
 
 #endif
+
+#ifdef CONFIG_ACPI
+static phys_addr_t dist_phy_base, cpu_phy_base __initdata;
+
+static int __init
+gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
+			const unsigned long end)
+{
+	struct acpi_madt_generic_interrupt *processor;
+	phys_addr_t gic_cpu_base;
+	static int cpu_base_assigned;
+
+	processor = (struct acpi_madt_generic_interrupt *)header;
+
+	if (BAD_MADT_ENTRY(processor, end))
+		return -EINVAL;
+
+	/*
+	 * There is no support for non-banked GICv1/2 register in ACPI spec.
+	 * All CPU interface addresses have to be the same.
+	 */
+	gic_cpu_base = processor->base_address;
+	if (cpu_base_assigned && gic_cpu_base != cpu_phy_base)
+		return -EINVAL;
+
+	cpu_phy_base = gic_cpu_base;
+	cpu_base_assigned = 1;
+	return 0;
+}
+
+static int __init
+gic_acpi_parse_madt_distributor(struct acpi_subtable_header *header,
+				const unsigned long end)
+{
+	struct acpi_madt_generic_distributor *dist;
+
+	dist = (struct acpi_madt_generic_distributor *)header;
+
+	if (BAD_MADT_ENTRY(dist, end))
+		return -EINVAL;
+
+	dist_phy_base = dist->base_address;
+	return 0;
+}
+
+int __init
+gic_v2_acpi_init(struct acpi_table_header *table)
+{
+	void __iomem *cpu_base, *dist_base;
+	int count;
+
+	/* Collect CPU base addresses */
+	count = acpi_parse_entries(ACPI_SIG_MADT,
+				   sizeof(struct acpi_table_madt),
+				   gic_acpi_parse_madt_cpu, table,
+				   ACPI_MADT_TYPE_GENERIC_INTERRUPT, 0);
+	if (count <= 0) {
+		pr_err("No valid GICC entries exist\n");
+		return -EINVAL;
+	}
+
+	/*
+	 * Find distributor base address. We expect one distributor entry since
+	 * ACPI 5.1 spec neither support multi-GIC instances nor GIC cascade.
+	 */
+	count = acpi_parse_entries(ACPI_SIG_MADT,
+				   sizeof(struct acpi_table_madt),
+				   gic_acpi_parse_madt_distributor, table,
+				   ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, 0);
+	if (count <= 0) {
+		pr_err("No valid GICD entries exist\n");
+		return -EINVAL;
+	} else if (count > 1) {
+		pr_err("More than one GICD entry detected\n");
+		return -EINVAL;
+	}
+
+	cpu_base = ioremap(cpu_phy_base, ACPI_GIC_CPU_IF_MEM_SIZE);
+	if (!cpu_base) {
+		pr_err("Unable to map GICC registers\n");
+		return -ENOMEM;
+	}
+
+	dist_base = ioremap(dist_phy_base, ACPI_GICV2_DIST_MEM_SIZE);
+	if (!dist_base) {
+		pr_err("Unable to map GICD registers\n");
+		iounmap(cpu_base);
+		return -ENOMEM;
+	}
+
+	/*
+	 * Initialize zero GIC instance (no multi-GIC support). Also, set GIC
+	 * as default IRQ domain to allow for GSI registration and GSI to IRQ
+	 * number translation (see acpi_register_gsi() and acpi_gsi_to_irq()).
+	 */
+	gic_init_bases(0, -1, dist_base, cpu_base, 0, NULL);
+	irq_set_default_host(gic_data[0].domain);
+	return 0;
+}
+#endif
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index 0fe2f71..afd1af3 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -8,6 +8,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/acpi_irq.h>
 #include <linux/init.h>
 #include <linux/of_irq.h>
 #include <linux/irqchip.h>
@@ -26,4 +27,6 @@ extern struct of_device_id __irqchip_of_table[];
 void __init irqchip_init(void)
 {
 	of_irq_init(__irqchip_of_table);
+
+	acpi_irq_init();
 }
diff --git a/include/linux/acpi_irq.h b/include/linux/acpi_irq.h
new file mode 100644
index 0000000..f10c872
--- /dev/null
+++ b/include/linux/acpi_irq.h
@@ -0,0 +1,10 @@
+#ifndef _LINUX_ACPI_IRQ_H
+#define _LINUX_ACPI_IRQ_H
+
+#include <linux/irq.h>
+
+#ifndef acpi_irq_init
+static inline void acpi_irq_init(void) { }
+#endif
+
+#endif /* _LINUX_ACPI_IRQ_H */
diff --git a/include/linux/irqchip/arm-gic-acpi.h b/include/linux/irqchip/arm-gic-acpi.h
new file mode 100644
index 0000000..de3419e
--- /dev/null
+++ b/include/linux/irqchip/arm-gic-acpi.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014, Linaro Ltd.
+ *	Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef ARM_GIC_ACPI_H_
+#define ARM_GIC_ACPI_H_
+
+#ifdef CONFIG_ACPI
+
+/*
+ * Hard code here, we can not get memory size from MADT (but FDT does),
+ * Actually no need to do that, because this size can be inferred
+ * from GIC spec.
+ */
+#define ACPI_GICV2_DIST_MEM_SIZE	(SZ_4K)
+#define ACPI_GIC_CPU_IF_MEM_SIZE	(SZ_8K)
+
+struct acpi_table_header;
+
+int gic_v2_acpi_init(struct acpi_table_header *table);
+void acpi_gic_init(void);
+#else
+static inline void acpi_gic_init(void) { }
+#endif
+
+#endif /* ARM_GIC_ACPI_H_ */
-- 
1.9.1

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

* [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tomasz Nowicki <tomasz.nowicki@linaro.org>

ACPI kernel uses MADT table for proper GIC initialization. It needs to
parse GIC related subtables, collect CPU interface and distributor
addresses and call driver initialization function (which is hardware
abstraction agnostic). In a similar way, FDT initialize GICv1/2.

NOTE: This commit allow to initialize GICv1/2 basic functionality.
While now simple GICv2 init call is used, any further GIC features
require generic infrastructure for proper ACPI irqchip initialization.
That mechanism and stacked irqdomains to support GICv2 MSI/virtualization
extension, GICv3/4 and its ITS are considered as next steps.

CC: Jason Cooper <jason@lakedaemon.net>
CC: Marc Zyngier <marc.zyngier@arm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h        |   2 +
 arch/arm64/include/asm/irq.h         |  13 +++++
 arch/arm64/kernel/acpi.c             |  25 +++++++++
 drivers/irqchip/irq-gic.c            | 102 +++++++++++++++++++++++++++++++++++
 drivers/irqchip/irqchip.c            |   3 ++
 include/linux/acpi_irq.h             |  10 ++++
 include/linux/irqchip/arm-gic-acpi.h |  31 +++++++++++
 7 files changed, 186 insertions(+)
 create mode 100644 include/linux/acpi_irq.h
 create mode 100644 include/linux/irqchip/arm-gic-acpi.h

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index eea0bc3..59c05d8 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -13,6 +13,8 @@
 #define _ASM_ACPI_H
 
 #include <linux/mm.h>
+#include <linux/irqchip/arm-gic-acpi.h>
+
 #include <asm/cputype.h>
 #include <asm/smp_plat.h>
 
diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h
index 94c5367..bbb251b 100644
--- a/arch/arm64/include/asm/irq.h
+++ b/arch/arm64/include/asm/irq.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_IRQ_H
 #define __ASM_IRQ_H
 
+#include <linux/irqchip/arm-gic-acpi.h>
+
 #include <asm-generic/irq.h>
 
 struct pt_regs;
@@ -8,4 +10,15 @@ struct pt_regs;
 extern void migrate_irqs(void);
 extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
 
+static inline void acpi_irq_init(void)
+{
+	/*
+	 * Hardcode ACPI IRQ chip initialization to GICv2 for now.
+	 * Proper irqchip infrastructure will be implemented along with
+	 * incoming  GICv2m|GICv3|ITS bits.
+	 */
+	acpi_gic_init();
+}
+#define acpi_irq_init acpi_irq_init
+
 #endif
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index dec6f8a..6468f88 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -359,3 +359,28 @@ void __init acpi_boot_table_init(void)
 		pr_err("Can't find FADT\n");
 	}
 }
+
+void __init acpi_gic_init(void)
+{
+	struct acpi_table_header *table;
+	acpi_status status;
+	acpi_size tbl_size;
+	int err;
+
+	if (acpi_disabled)
+		return;
+
+	status = acpi_get_table_with_size(ACPI_SIG_MADT, 0, &table, &tbl_size);
+	if (ACPI_FAILURE(status)) {
+		const char *msg = acpi_format_exception(status);
+
+		pr_err("Failed to get MADT table, %s\n", msg);
+		return;
+	}
+
+	err = gic_v2_acpi_init(table);
+	if (err)
+		pr_err("Failed to initialize GIC IRQ controller");
+
+	early_acpi_os_unmap_memory((char *)table, tbl_size);
+}
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 471e1cd..d15a36a 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -33,12 +33,14 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/acpi.h>
 #include <linux/irqdomain.h>
 #include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqchip/arm-gic.h>
+#include <linux/irqchip/arm-gic-acpi.h>
 
 #include <asm/cputype.h>
 #include <asm/irq.h>
@@ -1090,3 +1092,103 @@ IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init);
 IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init);
 
 #endif
+
+#ifdef CONFIG_ACPI
+static phys_addr_t dist_phy_base, cpu_phy_base __initdata;
+
+static int __init
+gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
+			const unsigned long end)
+{
+	struct acpi_madt_generic_interrupt *processor;
+	phys_addr_t gic_cpu_base;
+	static int cpu_base_assigned;
+
+	processor = (struct acpi_madt_generic_interrupt *)header;
+
+	if (BAD_MADT_ENTRY(processor, end))
+		return -EINVAL;
+
+	/*
+	 * There is no support for non-banked GICv1/2 register in ACPI spec.
+	 * All CPU interface addresses have to be the same.
+	 */
+	gic_cpu_base = processor->base_address;
+	if (cpu_base_assigned && gic_cpu_base != cpu_phy_base)
+		return -EINVAL;
+
+	cpu_phy_base = gic_cpu_base;
+	cpu_base_assigned = 1;
+	return 0;
+}
+
+static int __init
+gic_acpi_parse_madt_distributor(struct acpi_subtable_header *header,
+				const unsigned long end)
+{
+	struct acpi_madt_generic_distributor *dist;
+
+	dist = (struct acpi_madt_generic_distributor *)header;
+
+	if (BAD_MADT_ENTRY(dist, end))
+		return -EINVAL;
+
+	dist_phy_base = dist->base_address;
+	return 0;
+}
+
+int __init
+gic_v2_acpi_init(struct acpi_table_header *table)
+{
+	void __iomem *cpu_base, *dist_base;
+	int count;
+
+	/* Collect CPU base addresses */
+	count = acpi_parse_entries(ACPI_SIG_MADT,
+				   sizeof(struct acpi_table_madt),
+				   gic_acpi_parse_madt_cpu, table,
+				   ACPI_MADT_TYPE_GENERIC_INTERRUPT, 0);
+	if (count <= 0) {
+		pr_err("No valid GICC entries exist\n");
+		return -EINVAL;
+	}
+
+	/*
+	 * Find distributor base address. We expect one distributor entry since
+	 * ACPI 5.1 spec neither support multi-GIC instances nor GIC cascade.
+	 */
+	count = acpi_parse_entries(ACPI_SIG_MADT,
+				   sizeof(struct acpi_table_madt),
+				   gic_acpi_parse_madt_distributor, table,
+				   ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, 0);
+	if (count <= 0) {
+		pr_err("No valid GICD entries exist\n");
+		return -EINVAL;
+	} else if (count > 1) {
+		pr_err("More than one GICD entry detected\n");
+		return -EINVAL;
+	}
+
+	cpu_base = ioremap(cpu_phy_base, ACPI_GIC_CPU_IF_MEM_SIZE);
+	if (!cpu_base) {
+		pr_err("Unable to map GICC registers\n");
+		return -ENOMEM;
+	}
+
+	dist_base = ioremap(dist_phy_base, ACPI_GICV2_DIST_MEM_SIZE);
+	if (!dist_base) {
+		pr_err("Unable to map GICD registers\n");
+		iounmap(cpu_base);
+		return -ENOMEM;
+	}
+
+	/*
+	 * Initialize zero GIC instance (no multi-GIC support). Also, set GIC
+	 * as default IRQ domain to allow for GSI registration and GSI to IRQ
+	 * number translation (see acpi_register_gsi() and acpi_gsi_to_irq()).
+	 */
+	gic_init_bases(0, -1, dist_base, cpu_base, 0, NULL);
+	irq_set_default_host(gic_data[0].domain);
+	return 0;
+}
+#endif
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index 0fe2f71..afd1af3 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -8,6 +8,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/acpi_irq.h>
 #include <linux/init.h>
 #include <linux/of_irq.h>
 #include <linux/irqchip.h>
@@ -26,4 +27,6 @@ extern struct of_device_id __irqchip_of_table[];
 void __init irqchip_init(void)
 {
 	of_irq_init(__irqchip_of_table);
+
+	acpi_irq_init();
 }
diff --git a/include/linux/acpi_irq.h b/include/linux/acpi_irq.h
new file mode 100644
index 0000000..f10c872
--- /dev/null
+++ b/include/linux/acpi_irq.h
@@ -0,0 +1,10 @@
+#ifndef _LINUX_ACPI_IRQ_H
+#define _LINUX_ACPI_IRQ_H
+
+#include <linux/irq.h>
+
+#ifndef acpi_irq_init
+static inline void acpi_irq_init(void) { }
+#endif
+
+#endif /* _LINUX_ACPI_IRQ_H */
diff --git a/include/linux/irqchip/arm-gic-acpi.h b/include/linux/irqchip/arm-gic-acpi.h
new file mode 100644
index 0000000..de3419e
--- /dev/null
+++ b/include/linux/irqchip/arm-gic-acpi.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014, Linaro Ltd.
+ *	Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef ARM_GIC_ACPI_H_
+#define ARM_GIC_ACPI_H_
+
+#ifdef CONFIG_ACPI
+
+/*
+ * Hard code here, we can not get memory size from MADT (but FDT does),
+ * Actually no need to do that, because this size can be inferred
+ * from GIC spec.
+ */
+#define ACPI_GICV2_DIST_MEM_SIZE	(SZ_4K)
+#define ACPI_GIC_CPU_IF_MEM_SIZE	(SZ_8K)
+
+struct acpi_table_header;
+
+int gic_v2_acpi_init(struct acpi_table_header *table);
+void acpi_gic_init(void);
+#else
+static inline void acpi_gic_init(void) { }
+#endif
+
+#endif /* ARM_GIC_ACPI_H_ */
-- 
1.9.1

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

* [patch v11 17/23] clocksource / arch_timer: Parse GTDT to initialize arch timer
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo, Daniel Lezcano,
	Thomas Gleixner

Using the information presented by GTDT (Generic Timer Description Table)
to initialize the arch timer (not memory-mapped).

CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Thomas Gleixner <tglx@linutronix.de>
Originally-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/time.c             |   7 ++
 drivers/clocksource/arm_arch_timer.c | 132 ++++++++++++++++++++++++++++-------
 include/linux/clocksource.h          |   6 ++
 3 files changed, 118 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 1a7125c..42f9195 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -35,6 +35,7 @@
 #include <linux/delay.h>
 #include <linux/clocksource.h>
 #include <linux/clk-provider.h>
+#include <linux/acpi.h>
 
 #include <clocksource/arm_arch_timer.h>
 
@@ -72,6 +73,12 @@ void __init time_init(void)
 
 	tick_setup_hrtimer_broadcast();
 
+	/*
+	 * Since ACPI or FDT will only one be available in the system,
+	 * we can use acpi_generic_timer_init() here safely
+	 */
+	acpi_generic_timer_init();
+
 	arch_timer_rate = arch_timer_get_rate();
 	if (!arch_timer_rate)
 		panic("Unable to initialise architected timer.\n");
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index a3025e7..ea62fc7 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/sched_clock.h>
+#include <linux/acpi.h>
 
 #include <asm/arch_timer.h>
 #include <asm/virt.h>
@@ -371,8 +372,12 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
 	if (arch_timer_rate)
 		return;
 
-	/* Try to determine the frequency from the device tree or CNTFRQ */
-	if (of_property_read_u32(np, "clock-frequency", &arch_timer_rate)) {
+	/*
+	 * Try to determine the frequency from the device tree or CNTFRQ,
+	 * if ACPI is enabled, get the frequency from CNTFRQ ONLY.
+	 */
+	if (!acpi_disabled ||
+	    of_property_read_u32(np, "clock-frequency", &arch_timer_rate)) {
 		if (cntbase)
 			arch_timer_rate = readl_relaxed(cntbase + CNTFRQ);
 		else
@@ -691,28 +696,8 @@ static void __init arch_timer_common_init(void)
 	arch_timer_arch_init();
 }
 
-static void __init arch_timer_init(struct device_node *np)
+static void __init arch_timer_init(void)
 {
-	int i;
-
-	if (arch_timers_present & ARCH_CP15_TIMER) {
-		pr_warn("arch_timer: multiple nodes in dt, skipping\n");
-		return;
-	}
-
-	arch_timers_present |= ARCH_CP15_TIMER;
-	for (i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++)
-		arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
-	arch_timer_detect_rate(NULL, np);
-
-	/*
-	 * If we cannot rely on firmware initializing the timer registers then
-	 * we should use the physical timers instead.
-	 */
-	if (IS_ENABLED(CONFIG_ARM) &&
-	    of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
-			arch_timer_use_virtual = false;
-
 	/*
 	 * If HYP mode is available, we know that the physical timer
 	 * has been configured to be accessible from PL1. Use it, so
@@ -731,13 +716,39 @@ static void __init arch_timer_init(struct device_node *np)
 		}
 	}
 
-	arch_timer_c3stop = !of_property_read_bool(np, "always-on");
-
 	arch_timer_register();
 	arch_timer_common_init();
 }
-CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init);
-CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init);
+
+static void __init arch_timer_of_init(struct device_node *np)
+{
+	int i;
+
+	if (arch_timers_present & ARCH_CP15_TIMER) {
+		pr_warn("arch_timer: multiple nodes in dt, skipping\n");
+		return;
+	}
+
+	arch_timers_present |= ARCH_CP15_TIMER;
+	for (i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++)
+		arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
+
+	arch_timer_detect_rate(NULL, np);
+
+	arch_timer_c3stop = !of_property_read_bool(np, "always-on");
+
+	/*
+	 * If we cannot rely on firmware initializing the timer registers then
+	 * we should use the physical timers instead.
+	 */
+	if (IS_ENABLED(CONFIG_ARM) &&
+	    of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
+			arch_timer_use_virtual = false;
+
+	arch_timer_init();
+}
+CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_of_init);
+CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_of_init);
 
 static void __init arch_timer_mem_init(struct device_node *np)
 {
@@ -804,3 +815,70 @@ static void __init arch_timer_mem_init(struct device_node *np)
 }
 CLOCKSOURCE_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
 		       arch_timer_mem_init);
+
+#ifdef CONFIG_ACPI
+static int __init map_generic_timer_interrupt(u32 interrupt, u32 flags)
+{
+	int trigger, polarity;
+
+	if (!interrupt)
+		return 0;
+
+	trigger = (flags & ACPI_GTDT_INTERRUPT_MODE) ? ACPI_EDGE_SENSITIVE
+			: ACPI_LEVEL_SENSITIVE;
+
+	polarity = (flags & ACPI_GTDT_INTERRUPT_POLARITY) ? ACPI_ACTIVE_LOW
+			: ACPI_ACTIVE_HIGH;
+
+	return acpi_register_gsi(NULL, interrupt, trigger, polarity);
+}
+
+/* Initialize per-processor generic timer */
+static int __init arch_timer_acpi_init(struct acpi_table_header *table)
+{
+	struct acpi_table_gtdt *gtdt;
+
+	if (arch_timers_present & ARCH_CP15_TIMER) {
+		pr_warn("arch_timer: already initialized, skipping\n");
+		return -EINVAL;
+	}
+
+	gtdt = container_of(table, struct acpi_table_gtdt, header);
+
+	arch_timers_present |= ARCH_CP15_TIMER;
+
+	arch_timer_ppi[PHYS_SECURE_PPI] =
+		map_generic_timer_interrupt(gtdt->secure_el1_interrupt,
+		gtdt->secure_el1_flags);
+
+	arch_timer_ppi[PHYS_NONSECURE_PPI] =
+		map_generic_timer_interrupt(gtdt->non_secure_el1_interrupt,
+		gtdt->non_secure_el1_flags);
+
+	arch_timer_ppi[VIRT_PPI] =
+		map_generic_timer_interrupt(gtdt->virtual_timer_interrupt,
+		gtdt->virtual_timer_flags);
+
+	arch_timer_ppi[HYP_PPI] =
+		map_generic_timer_interrupt(gtdt->non_secure_el2_interrupt,
+		gtdt->non_secure_el2_flags);
+
+	/* Get the frequency from CNTFRQ */
+	arch_timer_detect_rate(NULL, NULL);
+
+	/* Always-on capability */
+	arch_timer_c3stop = !(gtdt->non_secure_el1_flags & ACPI_GTDT_ALWAYS_ON);
+
+	arch_timer_init();
+	return 0;
+}
+
+/* Initialize all the generic timers presented in GTDT */
+void __init acpi_generic_timer_init(void)
+{
+	if (acpi_disabled)
+		return;
+
+	acpi_table_parse(ACPI_SIG_GTDT, arch_timer_acpi_init);
+}
+#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 9c78d15..2b2e1f8 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -244,4 +244,10 @@ extern void clocksource_of_init(void);
 static inline void clocksource_of_init(void) {}
 #endif
 
+#ifdef CONFIG_ACPI
+void acpi_generic_timer_init(void);
+#else
+static inline void acpi_generic_timer_init(void) { }
+#endif
+
 #endif /* _LINUX_CLOCKSOURCE_H */
-- 
1.9.1


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

* [patch v11 17/23] clocksource / arch_timer: Parse GTDT to initialize arch timer
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Using the information presented by GTDT (Generic Timer Description Table)
to initialize the arch timer (not memory-mapped).

CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Thomas Gleixner <tglx@linutronix.de>
Originally-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/time.c             |   7 ++
 drivers/clocksource/arm_arch_timer.c | 132 ++++++++++++++++++++++++++++-------
 include/linux/clocksource.h          |   6 ++
 3 files changed, 118 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 1a7125c..42f9195 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -35,6 +35,7 @@
 #include <linux/delay.h>
 #include <linux/clocksource.h>
 #include <linux/clk-provider.h>
+#include <linux/acpi.h>
 
 #include <clocksource/arm_arch_timer.h>
 
@@ -72,6 +73,12 @@ void __init time_init(void)
 
 	tick_setup_hrtimer_broadcast();
 
+	/*
+	 * Since ACPI or FDT will only one be available in the system,
+	 * we can use acpi_generic_timer_init() here safely
+	 */
+	acpi_generic_timer_init();
+
 	arch_timer_rate = arch_timer_get_rate();
 	if (!arch_timer_rate)
 		panic("Unable to initialise architected timer.\n");
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index a3025e7..ea62fc7 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/sched_clock.h>
+#include <linux/acpi.h>
 
 #include <asm/arch_timer.h>
 #include <asm/virt.h>
@@ -371,8 +372,12 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
 	if (arch_timer_rate)
 		return;
 
-	/* Try to determine the frequency from the device tree or CNTFRQ */
-	if (of_property_read_u32(np, "clock-frequency", &arch_timer_rate)) {
+	/*
+	 * Try to determine the frequency from the device tree or CNTFRQ,
+	 * if ACPI is enabled, get the frequency from CNTFRQ ONLY.
+	 */
+	if (!acpi_disabled ||
+	    of_property_read_u32(np, "clock-frequency", &arch_timer_rate)) {
 		if (cntbase)
 			arch_timer_rate = readl_relaxed(cntbase + CNTFRQ);
 		else
@@ -691,28 +696,8 @@ static void __init arch_timer_common_init(void)
 	arch_timer_arch_init();
 }
 
-static void __init arch_timer_init(struct device_node *np)
+static void __init arch_timer_init(void)
 {
-	int i;
-
-	if (arch_timers_present & ARCH_CP15_TIMER) {
-		pr_warn("arch_timer: multiple nodes in dt, skipping\n");
-		return;
-	}
-
-	arch_timers_present |= ARCH_CP15_TIMER;
-	for (i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++)
-		arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
-	arch_timer_detect_rate(NULL, np);
-
-	/*
-	 * If we cannot rely on firmware initializing the timer registers then
-	 * we should use the physical timers instead.
-	 */
-	if (IS_ENABLED(CONFIG_ARM) &&
-	    of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
-			arch_timer_use_virtual = false;
-
 	/*
 	 * If HYP mode is available, we know that the physical timer
 	 * has been configured to be accessible from PL1. Use it, so
@@ -731,13 +716,39 @@ static void __init arch_timer_init(struct device_node *np)
 		}
 	}
 
-	arch_timer_c3stop = !of_property_read_bool(np, "always-on");
-
 	arch_timer_register();
 	arch_timer_common_init();
 }
-CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init);
-CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init);
+
+static void __init arch_timer_of_init(struct device_node *np)
+{
+	int i;
+
+	if (arch_timers_present & ARCH_CP15_TIMER) {
+		pr_warn("arch_timer: multiple nodes in dt, skipping\n");
+		return;
+	}
+
+	arch_timers_present |= ARCH_CP15_TIMER;
+	for (i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++)
+		arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
+
+	arch_timer_detect_rate(NULL, np);
+
+	arch_timer_c3stop = !of_property_read_bool(np, "always-on");
+
+	/*
+	 * If we cannot rely on firmware initializing the timer registers then
+	 * we should use the physical timers instead.
+	 */
+	if (IS_ENABLED(CONFIG_ARM) &&
+	    of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
+			arch_timer_use_virtual = false;
+
+	arch_timer_init();
+}
+CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_of_init);
+CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_of_init);
 
 static void __init arch_timer_mem_init(struct device_node *np)
 {
@@ -804,3 +815,70 @@ static void __init arch_timer_mem_init(struct device_node *np)
 }
 CLOCKSOURCE_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
 		       arch_timer_mem_init);
+
+#ifdef CONFIG_ACPI
+static int __init map_generic_timer_interrupt(u32 interrupt, u32 flags)
+{
+	int trigger, polarity;
+
+	if (!interrupt)
+		return 0;
+
+	trigger = (flags & ACPI_GTDT_INTERRUPT_MODE) ? ACPI_EDGE_SENSITIVE
+			: ACPI_LEVEL_SENSITIVE;
+
+	polarity = (flags & ACPI_GTDT_INTERRUPT_POLARITY) ? ACPI_ACTIVE_LOW
+			: ACPI_ACTIVE_HIGH;
+
+	return acpi_register_gsi(NULL, interrupt, trigger, polarity);
+}
+
+/* Initialize per-processor generic timer */
+static int __init arch_timer_acpi_init(struct acpi_table_header *table)
+{
+	struct acpi_table_gtdt *gtdt;
+
+	if (arch_timers_present & ARCH_CP15_TIMER) {
+		pr_warn("arch_timer: already initialized, skipping\n");
+		return -EINVAL;
+	}
+
+	gtdt = container_of(table, struct acpi_table_gtdt, header);
+
+	arch_timers_present |= ARCH_CP15_TIMER;
+
+	arch_timer_ppi[PHYS_SECURE_PPI] =
+		map_generic_timer_interrupt(gtdt->secure_el1_interrupt,
+		gtdt->secure_el1_flags);
+
+	arch_timer_ppi[PHYS_NONSECURE_PPI] =
+		map_generic_timer_interrupt(gtdt->non_secure_el1_interrupt,
+		gtdt->non_secure_el1_flags);
+
+	arch_timer_ppi[VIRT_PPI] =
+		map_generic_timer_interrupt(gtdt->virtual_timer_interrupt,
+		gtdt->virtual_timer_flags);
+
+	arch_timer_ppi[HYP_PPI] =
+		map_generic_timer_interrupt(gtdt->non_secure_el2_interrupt,
+		gtdt->non_secure_el2_flags);
+
+	/* Get the frequency from CNTFRQ */
+	arch_timer_detect_rate(NULL, NULL);
+
+	/* Always-on capability */
+	arch_timer_c3stop = !(gtdt->non_secure_el1_flags & ACPI_GTDT_ALWAYS_ON);
+
+	arch_timer_init();
+	return 0;
+}
+
+/* Initialize all the generic timers presented in GTDT */
+void __init acpi_generic_timer_init(void)
+{
+	if (acpi_disabled)
+		return;
+
+	acpi_table_parse(ACPI_SIG_GTDT, arch_timer_acpi_init);
+}
+#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 9c78d15..2b2e1f8 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -244,4 +244,10 @@ extern void clocksource_of_init(void);
 static inline void clocksource_of_init(void) {}
 #endif
 
+#ifdef CONFIG_ACPI
+void acpi_generic_timer_init(void);
+#else
+static inline void acpi_generic_timer_init(void) { }
+#endif
+
 #endif /* _LINUX_CLOCKSOURCE_H */
-- 
1.9.1

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

* [patch v11 18/23] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Hanjun Guo

From: Al Stone <al.stone@linaro.org>

ACPI reduced hardware mode is disabled by default, but ARM64
can only run properly in ACPI hardware reduced mode, so select
ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64.

If the firmware is not using hardware reduced ACPI mode, we
will disable ACPI to avoid nightmare such as accessing some
registers which are not available on ARM64.

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/Kconfig       | 1 +
 arch/arm64/kernel/acpi.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1b8e973..d00ab9a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,5 +1,6 @@
 config ARM64
 	def_bool y
+	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
 	select ARCH_BINFMT_ELF_RANDOMIZE_PIE
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 6468f88..5819ef7 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -303,6 +303,11 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 	 */
 	if (table->revision > 5 ||
 	    (table->revision == 5 && fadt->minor_revision >= 1)) {
+		if (!acpi_gbl_reduced_hardware) {
+			pr_err("Not hardware reduced ACPI mode, will not be supported\n");
+			goto disable_acpi;
+		}
+
 		/*
 		 * ACPI 5.1 only has two explicit methods to boot up SMP,
 		 * PSCI and Parking protocol, but the Parking protocol is
@@ -319,8 +324,9 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 
 	pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
 		table->revision, fadt->minor_revision);
-	disable_acpi();
 
+disable_acpi:
+	disable_acpi();
 	return -EINVAL;
 }
 
-- 
1.9.1

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

* [patch v11 18/23] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Al Stone <al.stone@linaro.org>

ACPI reduced hardware mode is disabled by default, but ARM64
can only run properly in ACPI hardware reduced mode, so select
ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64.

If the firmware is not using hardware reduced ACPI mode, we
will disable ACPI to avoid nightmare such as accessing some
registers which are not available on ARM64.

CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/Kconfig       | 1 +
 arch/arm64/kernel/acpi.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1b8e973..d00ab9a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,5 +1,6 @@
 config ARM64
 	def_bool y
+	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
 	select ARCH_BINFMT_ELF_RANDOMIZE_PIE
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 6468f88..5819ef7 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -303,6 +303,11 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 	 */
 	if (table->revision > 5 ||
 	    (table->revision == 5 && fadt->minor_revision >= 1)) {
+		if (!acpi_gbl_reduced_hardware) {
+			pr_err("Not hardware reduced ACPI mode, will not be supported\n");
+			goto disable_acpi;
+		}
+
 		/*
 		 * ACPI 5.1 only has two explicit methods to boot up SMP,
 		 * PSCI and Parking protocol, but the Parking protocol is
@@ -319,8 +324,9 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 
 	pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n",
 		table->revision, fadt->minor_revision);
-	disable_acpi();
 
+disable_acpi:
+	disable_acpi();
 	return -EINVAL;
 }
 
-- 
1.9.1

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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
  2015-03-24 14:02 ` Hanjun Guo
  (?)
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo,
	'Stefano Stabellini',
	Julien Grall, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	David Vrabel

When ACPI is enabled on ARM64, XEN ACPI will also compiled
into the kernel, but XEN ACPI is x86 dependent, so introduce
CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
functional on ARM64.

CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
CC: Julien Grall <julien.grall@linaro.org>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/xen/Kconfig  | 4 ++++
 drivers/xen/Makefile | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462..a31cd29 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -253,4 +253,8 @@ config XEN_EFI
 	def_bool y
 	depends on X86_64 && EFI
 
+config XEN_ACPI
+	def_bool y
+	depends on X86 && ACPI
+
 endmenu
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 2ccd359..f4622ab 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -13,7 +13,7 @@ CFLAGS_efi.o				+= -fshort-wchar
 
 dom0-$(CONFIG_PCI) += pci.o
 dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
-dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
+dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
 xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
 dom0-$(CONFIG_X86) += pcpu.o
 obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)
-- 
1.9.1

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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo,
	'Stefano Stabellini',
	Julien Grall, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	David Vrabel

When ACPI is enabled on ARM64, XEN ACPI will also compiled
into the kernel, but XEN ACPI is x86 dependent, so introduce
CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
functional on ARM64.

CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
CC: Julien Grall <julien.grall@linaro.org>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/xen/Kconfig  | 4 ++++
 drivers/xen/Makefile | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462..a31cd29 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -253,4 +253,8 @@ config XEN_EFI
 	def_bool y
 	depends on X86_64 && EFI
 
+config XEN_ACPI
+	def_bool y
+	depends on X86 && ACPI
+
 endmenu
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 2ccd359..f4622ab 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -13,7 +13,7 @@ CFLAGS_efi.o				+= -fshort-wchar
 
 dom0-$(CONFIG_PCI) += pci.o
 dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
-dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
+dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
 xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
 dom0-$(CONFIG_X86) += pcpu.o
 obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)
-- 
1.9.1


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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

When ACPI is enabled on ARM64, XEN ACPI will also compiled
into the kernel, but XEN ACPI is x86 dependent, so introduce
CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
functional on ARM64.

CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
CC: Julien Grall <julien.grall@linaro.org>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/xen/Kconfig  | 4 ++++
 drivers/xen/Makefile | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462..a31cd29 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -253,4 +253,8 @@ config XEN_EFI
 	def_bool y
 	depends on X86_64 && EFI
 
+config XEN_ACPI
+	def_bool y
+	depends on X86 && ACPI
+
 endmenu
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 2ccd359..f4622ab 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -13,7 +13,7 @@ CFLAGS_efi.o				+= -fshort-wchar
 
 dom0-$(CONFIG_PCI) += pci.o
 dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
-dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
+dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
 xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
 dom0-$(CONFIG_X86) += pcpu.o
 obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)
-- 
1.9.1

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

* [patch v11 20/23] ARM64 / ACPI: Enable ARM64 in Kconfig
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Hanjun Guo

From: Graeme Gregory <graeme.gregory@linaro.org>

Add Kconfigs to build ACPI on ARM64, and make ACPI available on ARM64.

acpi_idle driver is x86/IA64 dependent now, so make CONFIG_ACPI_PROCESSOR
depend on X86 || IA64, and implement it on ARM64 in the future.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/Kconfig   | 2 ++
 drivers/acpi/Kconfig | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d00ab9a..e5aa081 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -713,6 +713,8 @@ source "drivers/Kconfig"
 
 source "drivers/firmware/Kconfig"
 
+source "drivers/acpi/Kconfig"
+
 source "fs/Kconfig"
 
 source "arch/arm64/kvm/Kconfig"
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index a726381..a8f531e2 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -5,7 +5,7 @@
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"
 	depends on !IA64_HP_SIM
-	depends on IA64 || X86
+	depends on IA64 || X86 || (ARM64 && EXPERT)
 	depends on PCI
 	select PNP
 	default y
@@ -167,6 +167,7 @@ config ACPI_PROCESSOR
 	tristate "Processor"
 	select THERMAL
 	select CPU_IDLE
+	depends on X86 || IA64
 	default y
 	help
 	  This driver installs ACPI as the idle handler for Linux and uses
-- 
1.9.1

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

* [patch v11 20/23] ARM64 / ACPI: Enable ARM64 in Kconfig
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Graeme Gregory <graeme.gregory@linaro.org>

Add Kconfigs to build ACPI on ARM64, and make ACPI available on ARM64.

acpi_idle driver is x86/IA64 dependent now, so make CONFIG_ACPI_PROCESSOR
depend on X86 || IA64, and implement it on ARM64 in the future.

CC: Rafael J. Wysocki <rjw@rjwysocki.net>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Yijing Wang <wangyijing@huawei.com>
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Tested-by: Timur Tabi <timur@codeaurora.org>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Robert Richter <rrichter@cavium.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/Kconfig   | 2 ++
 drivers/acpi/Kconfig | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d00ab9a..e5aa081 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -713,6 +713,8 @@ source "drivers/Kconfig"
 
 source "drivers/firmware/Kconfig"
 
+source "drivers/acpi/Kconfig"
+
 source "fs/Kconfig"
 
 source "arch/arm64/kvm/Kconfig"
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index a726381..a8f531e2 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -5,7 +5,7 @@
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"
 	depends on !IA64_HP_SIM
-	depends on IA64 || X86
+	depends on IA64 || X86 || (ARM64 && EXPERT)
 	depends on PCI
 	select PNP
 	default y
@@ -167,6 +167,7 @@ config ACPI_PROCESSOR
 	tristate "Processor"
 	select THERMAL
 	select CPU_IDLE
+	depends on X86 || IA64
 	default y
 	help
 	  This driver installs ACPI as the idle handler for Linux and uses
-- 
1.9.1

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

* [patch v11 21/23] Documentation: ACPI for ARM64
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Hanjun Guo

From: Graeme Gregory <graeme.gregory@linaro.org>

Add documentation for the guidelines of how to use ACPI
on ARM64.

Reviewed-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Reviewed-by: Yi Li <phoenix.liyi@huawei.com>
Reviewed-by: Mark Langsdorf <mlangsdo@redhat.com>
Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 Documentation/arm64/arm-acpi.txt | 505 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 505 insertions(+)
 create mode 100644 Documentation/arm64/arm-acpi.txt

diff --git a/Documentation/arm64/arm-acpi.txt b/Documentation/arm64/arm-acpi.txt
new file mode 100644
index 0000000..7d6e636
--- /dev/null
+++ b/Documentation/arm64/arm-acpi.txt
@@ -0,0 +1,505 @@
+ACPI on ARMv8 Servers
+---------------------
+ACPI can be used for ARMv8 general purpose servers designed to follow
+the ARM SBSA (Server Base System Architecture) [0] and SBBR (Server
+Base Boot Requirements) [1] specifications.  Please note that the SBBR
+can be retrieved simply by visiting [1], but the SBSA is currently only
+available to those with an ARM login due to ARM IP licensing concerns.
+
+The ARMv8 kernel implements the reduced hardware model of ACPI version
+5.1 or later.  Links to the specification and all external documents
+it refers to are managed by the UEFI Forum.  The specification is
+available at http://www.uefi.org/specifications and documents referenced
+by the specification can be found via http://www.uefi.org/acpi.
+
+If an ARMv8 system does not meet the requirements of the SBSA and SBBR,
+or cannot be described using the mechanisms defined in the required ACPI
+specifications, then ACPI may not be a good fit for the hardware.
+
+While the documents mentioned above set out the requirements for building
+industry-standard ARMv8 servers, they also apply to more than one operating
+system.  The purpose of this document is to describe the interaction between
+ACPI and Linux only, on an ARMv8 system -- that is, what Linux expects of
+ACPI and what ACPI can expect of Linux.
+
+
+Why ACPI on ARM?
+----------------
+Before examining the details of the interface between ACPI and Linux, it is
+useful to understand why ACPI is being used.  Several technologies already
+exist in Linux for describing non-enumerable hardware, after all.  In this
+section we summarize a blog post [2] from Grant Likely that outlines the
+reasoning behind ACPI on ARMv8 servers.  Actually, we snitch a good portion
+of the summary text almost directly, to be honest.
+
+The short form of the rationale for ACPI on ARM is:
+
+-- ACPI’s bytecode (AML) allows the platform to encode hardware behavior,
+   while DT explicitly does not support this.  For hardware vendors, being
+   able to encode behavior is a key tool used in supporting operating
+   system releases on new hardware.
+
+-- ACPI’s OSPM defines a power management model that constrains what the
+   platform is allowed to do into a specific model, while still providing
+   flexibility in hardware design.
+
+-- In the enterprise server environment, ACPI has established bindings (such
+   as for RAS) which are currently used in production systems.  DT does not.
+   Such bindings could be defined in DT at some point, but doing so means ARM
+   and x86 would end up using completely different code paths in both firmware
+   and the kernel.
+
+-- Choosing a single interface to describe the abstraction between a platform
+   and an OS is important.  Hardware vendors would not be required to implement
+   both DT and ACPI if they want to support multiple operating systems.  And,
+   agreeing on a single interface instead of being fragmented into per OS
+   interfaces makes for better interoperability overall.
+
+-- The new ACPI governance process works well and Linux is now at the same
+   table as hardware vendors and other OS vendors.  In fact, there is no
+   longer any reason to feel that ACPI is only belongs to Windows or that
+   Linux is in any way secondary to Microsoft in this arena.  The move of
+   ACPI governance into the UEFI forum has significantly opened up the
+   specification development process, and currently, a large portion of the
+   changes being made to ACPI is being driven by Linux.
+
+Key to the use of ACPI is the support model.  For servers in general, the
+responsibility for hardware behaviour cannot solely be the domain of the
+kernel, but rather must be split between the platform and the kernel, in
+order to allow for orderly change over time.  ACPI frees the OS from needing
+to understand all the minute details of the hardware so that the OS doesn’t
+need to be ported to each and every device individually.  It allows the
+hardware vendors to take responsibility for power management behaviour without
+depending on an OS release cycle which is not under their control.
+
+ACPI is also important because hardware and OS vendors have already worked
+out the mechanisms for supporting a general purpose computing ecosystem.  The
+infrastructure is in place, the bindings are in place, and the processes are
+in place.  DT does exactly what Linux needs it to when working with vertically
+integrated devices, but there are no good processes for supporting what the
+server vendors need.  Linux could potentially get there with DT, but doing so
+really just duplicates something that already works.  ACPI already does what
+the hardware vendors need, Microsoft won’t collaborate on DT, and hardware
+vendors would still end up providing two completely separate firmware
+interfaces -- one for Linux and one for Windows.
+
+
+Kernel Compatibility
+--------------------
+One of the primary motivations for ACPI is standardization, and using that
+to provide backward compatibility for Linux kernels.  In the server market,
+software and hardware are often used for long periods.  ACPI allows the
+kernel and firmware to agree on a consistent abstraction that can be
+maintained over time, even as hardware or software change.  As long as the
+abstraction is supported, systems can be updated without necessarily having
+to replace the kernel.
+
+When a Linux driver or subsystem is first implemented using ACPI, it by
+definition ends up requiring a specific version of the ACPI specification
+-- it's baseline.  ACPI firmware must continue to work, even though it may
+not be optimal, with the earliest kernel version that first provides support
+for that baseline version of ACPI.  There may be a need for additional drivers,
+but adding new functionality (e.g., CPU power management) should not break
+older kernel versions.  Further, ACPI firmware must also work with the most
+recent version of the kernel.
+
+
+Relationship with Device Tree
+-----------------------------
+ACPI support in drivers and subsystems for ARMv8 should never be mutually
+exclusive with DT support at compile time.
+
+At boot time the kernel will only use one description method depending on
+parameters passed from the bootloader (including kernel bootargs).
+
+Regardless of whether DT or ACPI is used, the kernel must always be capable
+of booting with either scheme (in kernels with both schemes enabled at compile
+time).
+
+
+Booting using ACPI tables
+-------------------------
+The only defined method for passing ACPI tables to the kernel on ARMv8
+is via the UEFI system configuration table.  Just so it is explicit, this
+means that ACPI is only supported on platforms that boot via UEFI.
+
+When an ARMv8 system boots, it can either have DT information, ACPI tables,
+or in some very unusual cases, both.  If no command line parameters are used,
+the kernel will try to use DT for device enumeration; if there is no DT
+present, the kernel will try to use ACPI tables, but only if they are present.
+In neither is available, the kernel will not boot.  If acpi=force is used
+on the command line, the kernel will attempt to use ACPI tables first, but
+fall back to DT if there are no ACPI tables present.  The basic idea is that
+the kernel will not fail to boot unless it absolutely has no other choice.
+
+Processing of ACPI tables may be disabled by passing acpi=off on the kernel
+command line; this is the default behavior.
+
+In order for the kernel to load and use ACPI tables, the UEFI implementation
+MUST set the ACPI_20_TABLE_GUID to point to the RSDP table (the table with
+the ACPI signature "RSD PTR ").  If this pointer is incorrect and acpi=force
+is used, the kernel will disable ACPI and try to use DT to boot instead; the
+kernel has, in effect, determined that ACPI tables are not present at that
+point.
+
+If the pointer to the RSDP table is correct, the table will be mapped into
+the kernel by the ACPI core, using the address provided by UEFI.
+
+The ACPI core will then locate and map in all other ACPI tables provided by
+using the addresses in the RSDP table to find the XSDT (eXtended System
+Description Table).  The XSDT in turn provides the addresses to all other
+ACPI tables provided by the system firmware; the ACPI core will then traverse
+this table and map in the tables listed.
+
+The ACPI core will ignore any provided RSDT (Root System Description Table).
+RSDTs have been deprecated and are ignored on arm64 since they only allow
+for 32-bit addresses.
+
+Further, the ACPI core will only use the 64-bit address fields in the FADT
+(Fixed ACPI Description Table).  Any 32-bit address fields in the FADT will
+be ignored on arm64.
+
+Hardware reduced mode (see Section 4.1 of the ACPI 5.1 specification) will
+be enforced by the ACPI core on arm64.  Doing so allows the ACPI core to
+run less complex code since it no longer has to provide support for legacy
+hardware from other architectures.  Any fields that are not to be used for
+hardware reduced mode must be set to zero.
+
+For the ACPI core to operate properly, and in turn provide the information
+the kernel needs to configure devices, it expects to find the following
+tables (all section numbers refer to the ACPI 5.1 specfication):
+
+    -- RSDP (Root System Description Pointer), section 5.2.5
+
+    -- XSDT (eXtended System Description Table), section 5.2.8
+
+    -- FADT (Fixed ACPI Description Table), section 5.2.9
+
+    -- DSDT (Differentiated System Description Table), section
+       5.2.11.1
+
+    -- MADT (Multiple APIC Description Table), section 5.2.12
+
+    -- GTDT (Generic Timer Description Table), section 5.2.24
+
+    -- If PCI is supported, the MCFG (Memory mapped ConFiGuration
+       Table), section 5.2.6, specifically Table 5-31.
+
+If the above tables are not all present, the kernel may or may not be
+able to boot properly since it may not be able to configure all of the
+devices available.
+
+
+ACPI Detection
+--------------
+Drivers should determine their probe() type by checking for a null
+value for ACPI_HANDLE, or checking .of_node, or other information in
+the device structure.  This is detailed further in the "Driver
+Recommendations" section.
+
+In non-driver code, if the presence of ACPI needs to be detected at
+runtime, then check the value of acpi_disabled. If CONFIG_ACPI is not
+set, acpi_disabled will always be 1.
+
+
+Device Enumeration
+------------------
+Device descriptions in ACPI should use standard recognized ACPI interfaces.
+These may contain less information than is typically provided via a Device
+Tree description for the same device.  This is also one of the reasons that
+ACPI can be useful -- the driver takes into account that it may have less
+detailed information about the device and uses sensible defaults instead.
+If done properly in the driver, the hardware can change and improve over
+time without the driver having to change at all.
+
+Clocks provide an excellent example.  In DT, clocks need to be specified
+and the drivers need to take them into account.  In ACPI, the assumption
+is that UEFI will leave the device in a reasonable default state, including
+any clock settings.  If for some reason the driver needs to change a clock
+value, this can be done in an ACPI method; all the driver needs to do is
+invoke the method and not concern itself with what the method needs to do
+to change the clock.  Changing the hardware can then take place over time
+by changing what the ACPI method does, and not the driver.
+
+In DT, the parameters needed by the driver to set up clocks as in the example
+above are known as "bindings"; in ACPI, these are known as "Device Properties"
+and provided to a driver via the _DSD object.
+
+ACPI tables are described with a formal language called ASL, the ACPI
+Source Language (section 19 of the specification).  This means that there
+are always multiple ways to describe the same thing -- including device
+properties.  For example, device properties could use an ASL construct
+that looks like this: Name(KEY0, "value0").  An ACPI device driver would
+then retrieve the value of the property by evaluating the KEY0 object.
+However, using Name() this way has multiple problems: (1) ACPI limits
+names ("KEY0") to four characters unlike DT; (2) there is no industry
+wide registry that maintains a list of names, minimzing re-use; (3)
+there is also no registry for the definition of property values ("value0"),
+again making re-use difficult; and (4) how does one maintain backward
+compatibility as new hardware comes out?  The _DSD method was created
+to solve precisely these sorts of problems; Linux drivers should ALWAYS
+use the _DSD method for device properties and nothing else.
+
+The _DSM object (ACPI Section 9.14.1) could also be used for conveying
+device properties to a driver.  Linux drivers should only expect it to
+be used if _DSD cannot represent the data required, and there is no way
+to create a new UUID for the _DSD object.  Note that there is even less
+regulation of the use of _DSM than there is of _DSD.  Drivers that depend
+on the contents of _DSM objects will be more difficult to maintain over
+time because of this; as of this writing, the use of _DSM is the cause
+of quite a few firmware problems and is not recommended.
+
+Drivers should look for device properties in the _DSD object ONLY; the _DSD
+object is described in the ACPI specification section 6.2.5, but this only
+describes how to define the structure of an object returned via _DSD, and
+how specific data structures are defined by specific UUIDs.  Linux should
+only use the _DSD Device Properties UUID [5]:
+
+   -- UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301
+
+   -- http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
+
+The UEFI Forum provides a mechanism for registering device properties [4]
+so that they may be used across all operating systems supporting ACPI.
+Device properties that have not been registered with the UEFI Forum should
+not be used.
+
+Before creating new device properties, check to be sure that they have not
+been defined before and either registered in the Linux kernel documentation
+as DT bindings, or the UEFI Forum as device properties.  While we do not want
+to simply move all DT bindings into ACPI device properties, we can learn from
+what has been previously defined.
+
+If it is necessary to define a new device property, or if it makes sense to
+synthesize the definition of a binding so it can be used in any firmware,
+both DT bindings and ACPI device properties for device drivers have review
+processes.  Use them both.  When the driver itself is submitted for review
+to the Linux mailing lists, the device property definitions needed must be
+submitted at the same time.  A driver that supports ACPI and uses device
+properties will not be considered complete without their definitions.  Once
+the device property has been accepted by the Linux community, it must be
+registered with the UEFI Forum [4], which will review it again for consistency
+within the registry.  This may require iteration.  The UEFI Forum, though,
+will always be the canonical site for device property definitions.
+
+It may make sense to provide notice to the UEFI Forum that there is the
+intent to register a previously unused device property name as a means of
+reserving the name for later use.  Other operating system vendors will
+also be submitting registration requests and this may help smooth the
+process.
+
+Once registration and review have been completed, the kernel provides an
+interface for looking up device properties in a manner independent of
+whether DT or ACPI is being used.  This API should be used [6]; it can
+eliminate some duplication of code paths in driver probing functions and
+discourage divergence between DT bindings and ACPI device properties.
+
+
+Programmable Power Control Resources
+------------------------------------
+Programmable power control resources include such resources as voltage/current
+providers (regulators) and clock sources.
+
+With ACPI, the kernel clock and regulator framework is not expected to be used
+at all.
+
+The kernel assumes that power control of these resources is represented with
+Power Resource Objects (ACPI section 7.1).  The ACPI core will then handle
+correctly enabling and disabling resources as they are needed.  In order to
+get that to work, ACPI assumes each device has defined D-states and that these
+can be controlled through the optional ACPI methods _PS0, _PS1, _PS2, and _PS3;
+in ACPI, _PS0 is the method to invoke to turn a device full on, and _PS3 is for
+turning a device full off.
+
+There are two options for using those Power Resources.  They can:
+
+   -- be managed in a _PSx method which gets called on entry to power
+      state Dx.
+
+   -- be declared separately as power resources with their own _ON and _OFF
+      methods.  They are then tied back to D-states for a particular device
+      via _PRx which specifies which power resources a device needs to be on
+      while in Dx.  Kernel then tracks number of devices using a power resource
+      and calls _ON/_OFF as needed.
+
+The kernel ACPI code will also assume that the _PSx methods follow the normal
+ACPI rules for such methods:
+
+   -- If either _PS0 or _PS3 is implemented, then the other method must also
+      be implemented.
+
+   -- If a device requires usage or setup of a power resource when on, the ASL
+      should organize that it is allocated/enabled using the _PS0 method.
+
+   -- Resources allocated or enabled in the _PS0 method should be disabled
+      or de-allocated in the _PS3 method.
+
+   -- Firmware will leave the resources in a reasonable state before handing
+      over control to the kernel.
+
+Such code in _PSx methods will of course be very platform specific.  But,
+this allows the driver to abstract out the interface for operating the device
+and avoid having to read special non-standard values from ACPI tables. Further,
+abstracting the use of these resources allows the hardware to change over time
+without requiring updates to the driver.
+
+
+Clocks
+------
+ACPI makes the assumption that clocks are initialized by the firmware --
+UEFI, in this case -- to some working value before control is handed over
+to the kernel.  This has implications for devices such as UARTs, or SoC-driven
+LCD displays, for example.
+
+When the kernel boots, the clocks are assumed to be set to reasonable
+working values.  If for some reason the frequency needs to change -- e.g.,
+throttling for power management -- the device driver should expect that
+process to be abstracted out into some ACPI method that can be invoked
+(please see the ACPI specification for further recommendations on standard
+methods to be expected).  The only exceptions to this are CPU clocks where
+CPPC provides a much richer interface than ACPI methods.  If the clocks
+are not set, there is no direct way for Linux to control them.
+
+If an SoC vendor wants to provide fine-grained control of the system clocks,
+they could do so by providing ACPI methods that could be invoked by Linux
+drivers.  However, this is NOT recommended and Linux drivers should NOT use
+such methods, even if they are provided.  Such methods are not currently
+standardized in the ACPI specification, and using them could tie a kernel
+to a very specific SoC, or tie an SoC to a very specific version of the
+kernel, both of which we are trying to avoid.
+
+
+Driver Recommendations
+----------------------
+DO NOT remove any DT handling when adding ACPI support for a driver.  The
+same device may be used on many different systems.
+
+DO try to structure the driver so that it is data-driven.  That is, set up
+a struct containing internal per-device state based on defaults and whatever
+else must be discovered by the driver probe function.  Then, have the rest
+of the driver operate off of the contents of that struct.  Doing so should
+allow most divergence between ACPI and DT functionality to be kept local to
+the probe function instead of being scattered throughout the driver.  For
+example:
+
+static int device_probe_dt(struct platform_device *pdev)
+{
+	/* DT specific functionality */
+	...
+}
+
+static int device_probe_acpi(struct platform_device *pdev)
+{
+	/* ACPI specific functionality */
+	...
+}
+
+static int device_probe(struct platform_device *pdev)
+{
+	...
+	struct device_node node = pdev->dev.of_node;
+	...
+
+	if (node)
+		ret = device_probe_dt(pdev);
+	else if (ACPI_HANDLE(&pdev->dev))
+		ret = device_probe_acpi(pdev);
+	else
+		/* other initialization */
+		...
+	/* Continue with any generic probe operations */
+	...
+}
+
+DO keep the MODULE_DEVICE_TABLE entries together in the driver to make it
+clear the different names the driver is probed for, both from DT and from
+ACPI:
+
+static struct of_device_id virtio_mmio_match[] = {
+        { .compatible = "virtio,mmio", },
+        { }
+};
+MODULE_DEVICE_TABLE(of, virtio_mmio_match);
+
+static const struct acpi_device_id virtio_mmio_acpi_match[] = {
+        { "LNRO0005", },
+        { }
+};
+MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match);
+
+
+ASWG
+----
+The ACPI specification changes regularly.  During the year 2014, for instance,
+version 5.1 was released and version 6.0 substantially completed, with most of
+the changes being driven by ARM-specific requirements.  Proposed changes are
+presented and discussed in the ASWG (ACPI Specification Working Group) which
+is a part of the UEFI Forum.
+
+Participation in this group is open to all UEFI members.  Please see
+http://www.uefi.org/workinggroup for details on group membership.
+
+It is the intent of the ARMv8 ACPI kernel code to follow the ACPI specification
+as closely as possible, and to only implement functionality that complies with
+the released standards from UEFI ASWG.  As a practical matter, there will be
+vendors that provide bad ACPI tables or violate the standards in some way.
+If this is because of errors, quirks and fixups may be necessary, but will
+be avoided if possible.  If there are features missing from ACPI that preclude
+it from being used on a platform, ECRs (Engineering Change Requests) should be
+submitted to ASWG and go through the normal approval process; for those that
+are not UEFI members, many other members of the Linux community are and would
+likely be willing to assist in submitting ECRs.
+
+
+Linux Code
+----------
+Individual items specific to Linux on ARM, contained in the the Linux
+source code, are in the list that follows:
+
+ACPI_OS_NAME		This macro defines the string to be returned when
+			an ACPI method invokes the _OS method.  On ARM64
+			systems, this macro will be "Linux" by default.
+			The command line parameter acpi_os=<string>
+			can be used to set it to some other value.  The
+			default value for other architectures is "Microsoft
+			Windows NT", for example.
+
+ACPI Objects
+------------
+Detailed expectations for ACPI tables and object are listed in the file
+Documentation/arm64/acpi_object_usage.txt.
+
+
+References
+----------
+[0] http://silver.arm.com -- document ARM-DEN-0029, or newer
+    "Server Base System Architecture", version 2.3, dated 27 Mar 2014
+
+[1] http://infocenter.arm.com/help/topic/com.arm.doc.den0044a/Server_Base_Boot_Requirements.pdf
+    Document ARM-DEN-0044A, or newer: "Server Base Boot Requirements, System
+    Software on ARM Platforms", dated 16 Aug 2014
+
+[2] http://www.secretlab.ca/archives/151, 10 Jan 2015, Copyright (c) 2015,
+    Linaro Ltd., written by Grant Likely.  A copy of the verbatim text (apart
+    from formatting) is also in Documentation/arm64/why_use_acpi.txt.
+
+[3] AMD ACPI for Seattle platform documentation:
+    http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Seattle_ACPI_Guide.pdf
+
+[4] http://www.uefi.org/acpi -- please see the link for the "ACPI _DSD Device
+    Property Registry Instructions"
+
+[5] http://www.uefi.org/acpi -- please see the link for the "_DSD (Device
+    Specific Data) Implementation Guide"
+
+[6] Kernel code for the unified device property interface can be found in
+    include/linux/property.h and drivers/base/property.c.
+
+
+Authors
+-------
+Al Stone <al.stone@linaro.org>
+Graeme Gregory <graeme.gregory@linaro.org>
+Hanjun Guo <hanjun.guo@linaro.org>
+
+Grant Likely <grant.likely@linaro.org>, for the "Why ACPI on ARM?" section
-- 
1.9.1

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

* [patch v11 21/23] Documentation: ACPI for ARM64
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Graeme Gregory <graeme.gregory@linaro.org>

Add documentation for the guidelines of how to use ACPI
on ARM64.

Reviewed-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Reviewed-by: Yi Li <phoenix.liyi@huawei.com>
Reviewed-by: Mark Langsdorf <mlangsdo@redhat.com>
Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 Documentation/arm64/arm-acpi.txt | 505 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 505 insertions(+)
 create mode 100644 Documentation/arm64/arm-acpi.txt

diff --git a/Documentation/arm64/arm-acpi.txt b/Documentation/arm64/arm-acpi.txt
new file mode 100644
index 0000000..7d6e636
--- /dev/null
+++ b/Documentation/arm64/arm-acpi.txt
@@ -0,0 +1,505 @@
+ACPI on ARMv8 Servers
+---------------------
+ACPI can be used for ARMv8 general purpose servers designed to follow
+the ARM SBSA (Server Base System Architecture) [0] and SBBR (Server
+Base Boot Requirements) [1] specifications.  Please note that the SBBR
+can be retrieved simply by visiting [1], but the SBSA is currently only
+available to those with an ARM login due to ARM IP licensing concerns.
+
+The ARMv8 kernel implements the reduced hardware model of ACPI version
+5.1 or later.  Links to the specification and all external documents
+it refers to are managed by the UEFI Forum.  The specification is
+available at http://www.uefi.org/specifications and documents referenced
+by the specification can be found via http://www.uefi.org/acpi.
+
+If an ARMv8 system does not meet the requirements of the SBSA and SBBR,
+or cannot be described using the mechanisms defined in the required ACPI
+specifications, then ACPI may not be a good fit for the hardware.
+
+While the documents mentioned above set out the requirements for building
+industry-standard ARMv8 servers, they also apply to more than one operating
+system.  The purpose of this document is to describe the interaction between
+ACPI and Linux only, on an ARMv8 system -- that is, what Linux expects of
+ACPI and what ACPI can expect of Linux.
+
+
+Why ACPI on ARM?
+----------------
+Before examining the details of the interface between ACPI and Linux, it is
+useful to understand why ACPI is being used.  Several technologies already
+exist in Linux for describing non-enumerable hardware, after all.  In this
+section we summarize a blog post [2] from Grant Likely that outlines the
+reasoning behind ACPI on ARMv8 servers.  Actually, we snitch a good portion
+of the summary text almost directly, to be honest.
+
+The short form of the rationale for ACPI on ARM is:
+
+-- ACPI?s bytecode (AML) allows the platform to encode hardware behavior,
+   while DT explicitly does not support this.  For hardware vendors, being
+   able to encode behavior is a key tool used in supporting operating
+   system releases on new hardware.
+
+-- ACPI?s OSPM defines a power management model that constrains what the
+   platform is allowed to do into a specific model, while still providing
+   flexibility in hardware design.
+
+-- In the enterprise server environment, ACPI has established bindings (such
+   as for RAS) which are currently used in production systems.  DT does not.
+   Such bindings could be defined in DT at some point, but doing so means ARM
+   and x86 would end up using completely different code paths in both firmware
+   and the kernel.
+
+-- Choosing a single interface to describe the abstraction between a platform
+   and an OS is important.  Hardware vendors would not be required to implement
+   both DT and ACPI if they want to support multiple operating systems.  And,
+   agreeing on a single interface instead of being fragmented into per OS
+   interfaces makes for better interoperability overall.
+
+-- The new ACPI governance process works well and Linux is now at the same
+   table as hardware vendors and other OS vendors.  In fact, there is no
+   longer any reason to feel that ACPI is only belongs to Windows or that
+   Linux is in any way secondary to Microsoft in this arena.  The move of
+   ACPI governance into the UEFI forum has significantly opened up the
+   specification development process, and currently, a large portion of the
+   changes being made to ACPI is being driven by Linux.
+
+Key to the use of ACPI is the support model.  For servers in general, the
+responsibility for hardware behaviour cannot solely be the domain of the
+kernel, but rather must be split between the platform and the kernel, in
+order to allow for orderly change over time.  ACPI frees the OS from needing
+to understand all the minute details of the hardware so that the OS doesn?t
+need to be ported to each and every device individually.  It allows the
+hardware vendors to take responsibility for power management behaviour without
+depending on an OS release cycle which is not under their control.
+
+ACPI is also important because hardware and OS vendors have already worked
+out the mechanisms for supporting a general purpose computing ecosystem.  The
+infrastructure is in place, the bindings are in place, and the processes are
+in place.  DT does exactly what Linux needs it to when working with vertically
+integrated devices, but there are no good processes for supporting what the
+server vendors need.  Linux could potentially get there with DT, but doing so
+really just duplicates something that already works.  ACPI already does what
+the hardware vendors need, Microsoft won?t collaborate on DT, and hardware
+vendors would still end up providing two completely separate firmware
+interfaces -- one for Linux and one for Windows.
+
+
+Kernel Compatibility
+--------------------
+One of the primary motivations for ACPI is standardization, and using that
+to provide backward compatibility for Linux kernels.  In the server market,
+software and hardware are often used for long periods.  ACPI allows the
+kernel and firmware to agree on a consistent abstraction that can be
+maintained over time, even as hardware or software change.  As long as the
+abstraction is supported, systems can be updated without necessarily having
+to replace the kernel.
+
+When a Linux driver or subsystem is first implemented using ACPI, it by
+definition ends up requiring a specific version of the ACPI specification
+-- it's baseline.  ACPI firmware must continue to work, even though it may
+not be optimal, with the earliest kernel version that first provides support
+for that baseline version of ACPI.  There may be a need for additional drivers,
+but adding new functionality (e.g., CPU power management) should not break
+older kernel versions.  Further, ACPI firmware must also work with the most
+recent version of the kernel.
+
+
+Relationship with Device Tree
+-----------------------------
+ACPI support in drivers and subsystems for ARMv8 should never be mutually
+exclusive with DT support at compile time.
+
+At boot time the kernel will only use one description method depending on
+parameters passed from the bootloader (including kernel bootargs).
+
+Regardless of whether DT or ACPI is used, the kernel must always be capable
+of booting with either scheme (in kernels with both schemes enabled at compile
+time).
+
+
+Booting using ACPI tables
+-------------------------
+The only defined method for passing ACPI tables to the kernel on ARMv8
+is via the UEFI system configuration table.  Just so it is explicit, this
+means that ACPI is only supported on platforms that boot via UEFI.
+
+When an ARMv8 system boots, it can either have DT information, ACPI tables,
+or in some very unusual cases, both.  If no command line parameters are used,
+the kernel will try to use DT for device enumeration; if there is no DT
+present, the kernel will try to use ACPI tables, but only if they are present.
+In neither is available, the kernel will not boot.  If acpi=force is used
+on the command line, the kernel will attempt to use ACPI tables first, but
+fall back to DT if there are no ACPI tables present.  The basic idea is that
+the kernel will not fail to boot unless it absolutely has no other choice.
+
+Processing of ACPI tables may be disabled by passing acpi=off on the kernel
+command line; this is the default behavior.
+
+In order for the kernel to load and use ACPI tables, the UEFI implementation
+MUST set the ACPI_20_TABLE_GUID to point to the RSDP table (the table with
+the ACPI signature "RSD PTR ").  If this pointer is incorrect and acpi=force
+is used, the kernel will disable ACPI and try to use DT to boot instead; the
+kernel has, in effect, determined that ACPI tables are not present at that
+point.
+
+If the pointer to the RSDP table is correct, the table will be mapped into
+the kernel by the ACPI core, using the address provided by UEFI.
+
+The ACPI core will then locate and map in all other ACPI tables provided by
+using the addresses in the RSDP table to find the XSDT (eXtended System
+Description Table).  The XSDT in turn provides the addresses to all other
+ACPI tables provided by the system firmware; the ACPI core will then traverse
+this table and map in the tables listed.
+
+The ACPI core will ignore any provided RSDT (Root System Description Table).
+RSDTs have been deprecated and are ignored on arm64 since they only allow
+for 32-bit addresses.
+
+Further, the ACPI core will only use the 64-bit address fields in the FADT
+(Fixed ACPI Description Table).  Any 32-bit address fields in the FADT will
+be ignored on arm64.
+
+Hardware reduced mode (see Section 4.1 of the ACPI 5.1 specification) will
+be enforced by the ACPI core on arm64.  Doing so allows the ACPI core to
+run less complex code since it no longer has to provide support for legacy
+hardware from other architectures.  Any fields that are not to be used for
+hardware reduced mode must be set to zero.
+
+For the ACPI core to operate properly, and in turn provide the information
+the kernel needs to configure devices, it expects to find the following
+tables (all section numbers refer to the ACPI 5.1 specfication):
+
+    -- RSDP (Root System Description Pointer), section 5.2.5
+
+    -- XSDT (eXtended System Description Table), section 5.2.8
+
+    -- FADT (Fixed ACPI Description Table), section 5.2.9
+
+    -- DSDT (Differentiated System Description Table), section
+       5.2.11.1
+
+    -- MADT (Multiple APIC Description Table), section 5.2.12
+
+    -- GTDT (Generic Timer Description Table), section 5.2.24
+
+    -- If PCI is supported, the MCFG (Memory mapped ConFiGuration
+       Table), section 5.2.6, specifically Table 5-31.
+
+If the above tables are not all present, the kernel may or may not be
+able to boot properly since it may not be able to configure all of the
+devices available.
+
+
+ACPI Detection
+--------------
+Drivers should determine their probe() type by checking for a null
+value for ACPI_HANDLE, or checking .of_node, or other information in
+the device structure.  This is detailed further in the "Driver
+Recommendations" section.
+
+In non-driver code, if the presence of ACPI needs to be detected at
+runtime, then check the value of acpi_disabled. If CONFIG_ACPI is not
+set, acpi_disabled will always be 1.
+
+
+Device Enumeration
+------------------
+Device descriptions in ACPI should use standard recognized ACPI interfaces.
+These may contain less information than is typically provided via a Device
+Tree description for the same device.  This is also one of the reasons that
+ACPI can be useful -- the driver takes into account that it may have less
+detailed information about the device and uses sensible defaults instead.
+If done properly in the driver, the hardware can change and improve over
+time without the driver having to change at all.
+
+Clocks provide an excellent example.  In DT, clocks need to be specified
+and the drivers need to take them into account.  In ACPI, the assumption
+is that UEFI will leave the device in a reasonable default state, including
+any clock settings.  If for some reason the driver needs to change a clock
+value, this can be done in an ACPI method; all the driver needs to do is
+invoke the method and not concern itself with what the method needs to do
+to change the clock.  Changing the hardware can then take place over time
+by changing what the ACPI method does, and not the driver.
+
+In DT, the parameters needed by the driver to set up clocks as in the example
+above are known as "bindings"; in ACPI, these are known as "Device Properties"
+and provided to a driver via the _DSD object.
+
+ACPI tables are described with a formal language called ASL, the ACPI
+Source Language (section 19 of the specification).  This means that there
+are always multiple ways to describe the same thing -- including device
+properties.  For example, device properties could use an ASL construct
+that looks like this: Name(KEY0, "value0").  An ACPI device driver would
+then retrieve the value of the property by evaluating the KEY0 object.
+However, using Name() this way has multiple problems: (1) ACPI limits
+names ("KEY0") to four characters unlike DT; (2) there is no industry
+wide registry that maintains a list of names, minimzing re-use; (3)
+there is also no registry for the definition of property values ("value0"),
+again making re-use difficult; and (4) how does one maintain backward
+compatibility as new hardware comes out?  The _DSD method was created
+to solve precisely these sorts of problems; Linux drivers should ALWAYS
+use the _DSD method for device properties and nothing else.
+
+The _DSM object (ACPI Section 9.14.1) could also be used for conveying
+device properties to a driver.  Linux drivers should only expect it to
+be used if _DSD cannot represent the data required, and there is no way
+to create a new UUID for the _DSD object.  Note that there is even less
+regulation of the use of _DSM than there is of _DSD.  Drivers that depend
+on the contents of _DSM objects will be more difficult to maintain over
+time because of this; as of this writing, the use of _DSM is the cause
+of quite a few firmware problems and is not recommended.
+
+Drivers should look for device properties in the _DSD object ONLY; the _DSD
+object is described in the ACPI specification section 6.2.5, but this only
+describes how to define the structure of an object returned via _DSD, and
+how specific data structures are defined by specific UUIDs.  Linux should
+only use the _DSD Device Properties UUID [5]:
+
+   -- UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301
+
+   -- http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
+
+The UEFI Forum provides a mechanism for registering device properties [4]
+so that they may be used across all operating systems supporting ACPI.
+Device properties that have not been registered with the UEFI Forum should
+not be used.
+
+Before creating new device properties, check to be sure that they have not
+been defined before and either registered in the Linux kernel documentation
+as DT bindings, or the UEFI Forum as device properties.  While we do not want
+to simply move all DT bindings into ACPI device properties, we can learn from
+what has been previously defined.
+
+If it is necessary to define a new device property, or if it makes sense to
+synthesize the definition of a binding so it can be used in any firmware,
+both DT bindings and ACPI device properties for device drivers have review
+processes.  Use them both.  When the driver itself is submitted for review
+to the Linux mailing lists, the device property definitions needed must be
+submitted at the same time.  A driver that supports ACPI and uses device
+properties will not be considered complete without their definitions.  Once
+the device property has been accepted by the Linux community, it must be
+registered with the UEFI Forum [4], which will review it again for consistency
+within the registry.  This may require iteration.  The UEFI Forum, though,
+will always be the canonical site for device property definitions.
+
+It may make sense to provide notice to the UEFI Forum that there is the
+intent to register a previously unused device property name as a means of
+reserving the name for later use.  Other operating system vendors will
+also be submitting registration requests and this may help smooth the
+process.
+
+Once registration and review have been completed, the kernel provides an
+interface for looking up device properties in a manner independent of
+whether DT or ACPI is being used.  This API should be used [6]; it can
+eliminate some duplication of code paths in driver probing functions and
+discourage divergence between DT bindings and ACPI device properties.
+
+
+Programmable Power Control Resources
+------------------------------------
+Programmable power control resources include such resources as voltage/current
+providers (regulators) and clock sources.
+
+With ACPI, the kernel clock and regulator framework is not expected to be used
+at all.
+
+The kernel assumes that power control of these resources is represented with
+Power Resource Objects (ACPI section 7.1).  The ACPI core will then handle
+correctly enabling and disabling resources as they are needed.  In order to
+get that to work, ACPI assumes each device has defined D-states and that these
+can be controlled through the optional ACPI methods _PS0, _PS1, _PS2, and _PS3;
+in ACPI, _PS0 is the method to invoke to turn a device full on, and _PS3 is for
+turning a device full off.
+
+There are two options for using those Power Resources.  They can:
+
+   -- be managed in a _PSx method which gets called on entry to power
+      state Dx.
+
+   -- be declared separately as power resources with their own _ON and _OFF
+      methods.  They are then tied back to D-states for a particular device
+      via _PRx which specifies which power resources a device needs to be on
+      while in Dx.  Kernel then tracks number of devices using a power resource
+      and calls _ON/_OFF as needed.
+
+The kernel ACPI code will also assume that the _PSx methods follow the normal
+ACPI rules for such methods:
+
+   -- If either _PS0 or _PS3 is implemented, then the other method must also
+      be implemented.
+
+   -- If a device requires usage or setup of a power resource when on, the ASL
+      should organize that it is allocated/enabled using the _PS0 method.
+
+   -- Resources allocated or enabled in the _PS0 method should be disabled
+      or de-allocated in the _PS3 method.
+
+   -- Firmware will leave the resources in a reasonable state before handing
+      over control to the kernel.
+
+Such code in _PSx methods will of course be very platform specific.  But,
+this allows the driver to abstract out the interface for operating the device
+and avoid having to read special non-standard values from ACPI tables. Further,
+abstracting the use of these resources allows the hardware to change over time
+without requiring updates to the driver.
+
+
+Clocks
+------
+ACPI makes the assumption that clocks are initialized by the firmware --
+UEFI, in this case -- to some working value before control is handed over
+to the kernel.  This has implications for devices such as UARTs, or SoC-driven
+LCD displays, for example.
+
+When the kernel boots, the clocks are assumed to be set to reasonable
+working values.  If for some reason the frequency needs to change -- e.g.,
+throttling for power management -- the device driver should expect that
+process to be abstracted out into some ACPI method that can be invoked
+(please see the ACPI specification for further recommendations on standard
+methods to be expected).  The only exceptions to this are CPU clocks where
+CPPC provides a much richer interface than ACPI methods.  If the clocks
+are not set, there is no direct way for Linux to control them.
+
+If an SoC vendor wants to provide fine-grained control of the system clocks,
+they could do so by providing ACPI methods that could be invoked by Linux
+drivers.  However, this is NOT recommended and Linux drivers should NOT use
+such methods, even if they are provided.  Such methods are not currently
+standardized in the ACPI specification, and using them could tie a kernel
+to a very specific SoC, or tie an SoC to a very specific version of the
+kernel, both of which we are trying to avoid.
+
+
+Driver Recommendations
+----------------------
+DO NOT remove any DT handling when adding ACPI support for a driver.  The
+same device may be used on many different systems.
+
+DO try to structure the driver so that it is data-driven.  That is, set up
+a struct containing internal per-device state based on defaults and whatever
+else must be discovered by the driver probe function.  Then, have the rest
+of the driver operate off of the contents of that struct.  Doing so should
+allow most divergence between ACPI and DT functionality to be kept local to
+the probe function instead of being scattered throughout the driver.  For
+example:
+
+static int device_probe_dt(struct platform_device *pdev)
+{
+	/* DT specific functionality */
+	...
+}
+
+static int device_probe_acpi(struct platform_device *pdev)
+{
+	/* ACPI specific functionality */
+	...
+}
+
+static int device_probe(struct platform_device *pdev)
+{
+	...
+	struct device_node node = pdev->dev.of_node;
+	...
+
+	if (node)
+		ret = device_probe_dt(pdev);
+	else if (ACPI_HANDLE(&pdev->dev))
+		ret = device_probe_acpi(pdev);
+	else
+		/* other initialization */
+		...
+	/* Continue with any generic probe operations */
+	...
+}
+
+DO keep the MODULE_DEVICE_TABLE entries together in the driver to make it
+clear the different names the driver is probed for, both from DT and from
+ACPI:
+
+static struct of_device_id virtio_mmio_match[] = {
+        { .compatible = "virtio,mmio", },
+        { }
+};
+MODULE_DEVICE_TABLE(of, virtio_mmio_match);
+
+static const struct acpi_device_id virtio_mmio_acpi_match[] = {
+        { "LNRO0005", },
+        { }
+};
+MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match);
+
+
+ASWG
+----
+The ACPI specification changes regularly.  During the year 2014, for instance,
+version 5.1 was released and version 6.0 substantially completed, with most of
+the changes being driven by ARM-specific requirements.  Proposed changes are
+presented and discussed in the ASWG (ACPI Specification Working Group) which
+is a part of the UEFI Forum.
+
+Participation in this group is open to all UEFI members.  Please see
+http://www.uefi.org/workinggroup for details on group membership.
+
+It is the intent of the ARMv8 ACPI kernel code to follow the ACPI specification
+as closely as possible, and to only implement functionality that complies with
+the released standards from UEFI ASWG.  As a practical matter, there will be
+vendors that provide bad ACPI tables or violate the standards in some way.
+If this is because of errors, quirks and fixups may be necessary, but will
+be avoided if possible.  If there are features missing from ACPI that preclude
+it from being used on a platform, ECRs (Engineering Change Requests) should be
+submitted to ASWG and go through the normal approval process; for those that
+are not UEFI members, many other members of the Linux community are and would
+likely be willing to assist in submitting ECRs.
+
+
+Linux Code
+----------
+Individual items specific to Linux on ARM, contained in the the Linux
+source code, are in the list that follows:
+
+ACPI_OS_NAME		This macro defines the string to be returned when
+			an ACPI method invokes the _OS method.  On ARM64
+			systems, this macro will be "Linux" by default.
+			The command line parameter acpi_os=<string>
+			can be used to set it to some other value.  The
+			default value for other architectures is "Microsoft
+			Windows NT", for example.
+
+ACPI Objects
+------------
+Detailed expectations for ACPI tables and object are listed in the file
+Documentation/arm64/acpi_object_usage.txt.
+
+
+References
+----------
+[0] http://silver.arm.com -- document ARM-DEN-0029, or newer
+    "Server Base System Architecture", version 2.3, dated 27 Mar 2014
+
+[1] http://infocenter.arm.com/help/topic/com.arm.doc.den0044a/Server_Base_Boot_Requirements.pdf
+    Document ARM-DEN-0044A, or newer: "Server Base Boot Requirements, System
+    Software on ARM Platforms", dated 16 Aug 2014
+
+[2] http://www.secretlab.ca/archives/151, 10 Jan 2015, Copyright (c) 2015,
+    Linaro Ltd., written by Grant Likely.  A copy of the verbatim text (apart
+    from formatting) is also in Documentation/arm64/why_use_acpi.txt.
+
+[3] AMD ACPI for Seattle platform documentation:
+    http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Seattle_ACPI_Guide.pdf
+
+[4] http://www.uefi.org/acpi -- please see the link for the "ACPI _DSD Device
+    Property Registry Instructions"
+
+[5] http://www.uefi.org/acpi -- please see the link for the "_DSD (Device
+    Specific Data) Implementation Guide"
+
+[6] Kernel code for the unified device property interface can be found in
+    include/linux/property.h and drivers/base/property.c.
+
+
+Authors
+-------
+Al Stone <al.stone@linaro.org>
+Graeme Gregory <graeme.gregory@linaro.org>
+Hanjun Guo <hanjun.guo@linaro.org>
+
+Grant Likely <grant.likely@linaro.org>, for the "Why ACPI on ARM?" section
-- 
1.9.1

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

* [patch v11 22/23] ARM64 / ACPI: additions of ACPI documentation for arm64
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Al Stone, Suravee Suthikulpanit,
	Yi Li, Mark Langsdorf, Hanjun Guo

From: Al Stone <al.stone@linaro.org>

One more documentation file are also being added:

A section by section review of the ACPI spec (acpi_object_usage.txt)
to note recommendations and prohibitions on the use of the numerous
ACPI tables and objects.  This sets out the current expectations of
the firmware by Linux very explicitly (or as explicitly as I can, for
now).

CC: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
CC: Yi Li <phoenix.liyi@huawei.com>
CC: Mark Langsdorf <mlangsdo@redhat.com>
CC: Ashwin Chaugule <ashwinc@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 Documentation/arm64/acpi_object_usage.txt | 593 ++++++++++++++++++++++++++++++
 1 file changed, 593 insertions(+)
 create mode 100644 Documentation/arm64/acpi_object_usage.txt

diff --git a/Documentation/arm64/acpi_object_usage.txt b/Documentation/arm64/acpi_object_usage.txt
new file mode 100644
index 0000000..96e2273
--- /dev/null
+++ b/Documentation/arm64/acpi_object_usage.txt
@@ -0,0 +1,593 @@
+ACPI Tables
+-----------
+The expectations of individual ACPI tables are discussed in the list that
+follows.
+
+If a section number is used, it refers to a section number in the ACPI
+specification where the object is defined.  If "Signature Reserved" is used,
+the table signature (the first four bytes of the table) is the only portion
+of the table recognized by the specification, and the actual table is defined
+outside of the UEFI Forum (see Section 5.2.6 of the specification).
+
+For ACPI on arm64, tables also fall into the following categories:
+
+	-- Required: DSDT, FADT, GTDT, MADT, MCFG, RSDP, SPCR, XSDT
+
+	-- Recommended: BERT, EINJ, ERST, HEST, SSDT
+
+	-- Optional: BGRT, CPEP, CSRT, DRTM, ECDT, FACS, FPDT, MCHI, MPST,
+	   MSCT, RASF, SBST, SLIT, SPMI, SRAT, TCPA, TPM2, UEFI
+
+	-- Not supported: BOOT, DBG2, DBGP, DMAR, ETDT, HPET, IBFT, IVRS,
+	   LPIT, MSDM, RSDT, SLIC, WAET, WDAT, WDRT, WPBT
+
+
+Table	Usage for ARMv8 Linux
+-----	----------------------------------------------------------------
+BERT	Section 18.3 (signature == "BERT")
+	== Boot Error Record Table ==
+	Must be supplied if RAS support is provided by the platform.  It
+	is recommended this table be supplied.
+
+BOOT	Signature Reserved (signature == "BOOT")
+	== simple BOOT flag table ==
+	Microsoft only table, will not be supported.
+
+BGRT	Section 5.2.22 (signature == "BGRT")
+	== Boot Graphics Resource Table ==
+	Optional, not currently supported, with no real use-case for an
+	ARM server.
+
+CPEP	Section 5.2.18 (signature == "CPEP")
+	== Corrected Platform Error Polling table ==
+	Optional, not currently supported, and not recommended until such
+	time as ARM-compatible hardware is available, and the specification
+	suitably modified.
+
+CSRT	Signature Reserved (signature == "CSRT")
+	== Core System Resources Table ==
+	Optional, not currently supported.
+
+DBG2	Signature Reserved (signature == "DBG2")
+	== DeBuG port table 2 ==
+	Microsoft only table, will not be supported.
+
+DBGP	Signature Reserved (signature == "DBGP")
+	== DeBuG Port table ==
+	Microsoft only table, will not be supported.
+
+DSDT	Section 5.2.11.1 (signature == "DSDT")
+	== Differentiated System Description Table ==
+	A DSDT is required; see also SSDT.
+
+	ACPI tables contain only one DSDT but can contain one or more SSDTs,
+	which are optional.  Each SSDT can only add to the ACPI namespace,
+	but cannot modify or replace anything in the DSDT.
+
+DMAR	Signature Reserved (signature == "DMAR")
+	== DMA Remapping table ==
+	x86 only table, will not be supported.
+
+DRTM	Signature Reserved (signature == "DRTM")
+	== Dynamic Root of Trust for Measurement table ==
+	Optional, not currently supported.
+
+ECDT	Section 5.2.16 (signature == "ECDT")
+	== Embedded Controller Description Table ==
+	Optional, not currently supported, but could be used on ARM if and
+	only if one uses the GPE_BIT field to represent an IRQ number, since
+	there are no GPE blocks defined in hardware reduced mode.  This would
+	need to be modified in the ACPI specification.
+
+EINJ	Section 18.6 (signature == "EINJ")
+	== Error Injection table ==
+	This table is very useful for testing platform response to error
+	conditions; it allows one to inject an error into the system as
+	if it had actually occurred.  However, this table should not be
+	shipped with a production system; it should be dynamically loaded
+	and executed with the ACPICA tools only during testing.
+
+ERST	Section 18.5 (signature == "ERST")
+	== Error Record Serialization Table ==
+	On a platform supports RAS, this table must be supplied if it is not
+	UEFI-based; if it is UEFI-based, this table may be supplied. When this
+	table is not present, UEFI run time service will be utilized to save
+	and retrieve hardware error information to and from a persistent store.
+
+ETDT	Signature Reserved (signature == "ETDT")
+	== Event Timer Description Table ==
+	Obsolete table, will not be supported.
+
+FACS	Section 5.2.10 (signature == "FACS")
+	== Firmware ACPI Control Structure ==
+	It is unlikely that this table will be terribly useful.  If it is
+	provided, the Global Lock will NOT be used since it is not part of
+	the hardware reduced profile, and only 64-bit address fields will
+	be considered valid.
+
+FADT	Section 5.2.9 (signature == "FACP")
+	== Fixed ACPI Description Table ==
+	Required for arm64.
+
+	The HW_REDUCED_ACPI flag must be set.  All of the fields that are
+	to be ignored when HW_REDUCED_ACPI is set are expected to be set to
+	zero.
+
+	If an FACS table is provided, the X_FIRMWARE_CTRL field is to be
+	used, not FIRMWARE_CTRL.
+
+	If PSCI is used (as is recommended), make sure that ARM_BOOT_ARCH is
+	filled in properly -- that the PSCI_COMPLIANT flag is set and that
+	PSCI_USE_HVC is set or unset as needed (see table 5-37).
+
+	For the DSDT that is also required, the X_DSDT field is to be used,
+	not the DSDT field.
+
+FPDT	Section 5.2.23 (signature == "FPDT")
+	== Firmware Performance Data Table ==
+	Optional, not currently supported.
+
+GTDT	Section 5.2.24 (signature == "GTDT")
+	== Generic Timer Description Table ==
+	Required for arm64.
+
+HEST	Section 18.3.2 (signature == "HEST")
+	== Hardware Error Source Table ==
+	Until further error source types are defined, use only types 6 (AER
+	Root Port), 7 (AER Endpoint), 8 (AER Bridge), or 9 (Generic Hardware
+	Error Source).  Firmware first error handling is possible if and only
+	if Trusted Firmware is being used on arm64.
+
+	Must be supplied if RAS support is provided by the platform.  It
+	is recommended this table be supplied.
+
+HPET	Signature Reserved (signature == "HPET")
+	== High Precision Event timer Table ==
+	x86 only table, will not be supported.
+
+IBFT	Signature Reserved (signature == "IBFT")
+	== iSCSI Boot Firmware Table ==
+	Microsoft defined table, support TBD.
+
+IVRS	Signature Reserved (signature == "IVRS")
+	== I/O Virtualization Reporting Structure ==
+	x86_64 (AMD) only table, will not be supported.
+
+LPIT	Signature Reserved (signature == "LPIT")
+	== Low Power Idle Table ==
+	x86 only table as of ACPI 5.1; future versions have been adapted for
+	use with ARM and will be recommended in order to support ACPI power
+	management.
+
+MADT	Section 5.2.12 (signature == "APIC")
+	== Multiple APIC Description Table ==
+	Required for arm64.  Only the GIC interrupt controller structures
+	should be used (types 0xA - 0xE).
+
+MCFG	Signature Reserved (signature == "MCFG")
+	== Memory-mapped ConFiGuration space ==
+	If the platform supports PCI/PCIe, an MCFG table is required.
+
+MCHI	Signature Reserved (signature == "MCHI")
+	== Management Controller Host Interface table ==
+	Optional, not currently supported.
+
+MPST	Section 5.2.21 (signature == "MPST")
+	== Memory Power State Table ==
+	Optional, not currently supported.
+
+MSDM	Signature Reserved (signature == "MSDM")
+	== Microsoft Data Management table ==
+	Microsoft only table, will not be supported.
+
+MSCT	Section 5.2.19 (signature == "MSCT")
+	== Maximum System Characteristic Table ==
+	Optional, not currently supported.
+
+RASF	Section 5.2.20 (signature == "RASF")
+	== RAS Feature table ==
+	Optional, not currently supported.
+
+RSDP	Section 5.2.5 (signature == "RSD PTR")
+	== Root System Description PoinTeR ==
+	Required for arm64.
+
+RSDT	Section 5.2.7 (signature == "RSDT")
+	== Root System Description Table ==
+	Since this table can only provide 32-bit addresses, it is deprecated
+	on arm64, and will not be used.
+
+SBST	Section 5.2.14 (signature == "SBST")
+	== Smart Battery Subsystem Table ==
+	Optional, not currently supported.
+
+SLIC	Signature Reserved (signature == "SLIC")
+	== Software LIcensing table ==
+	Microsoft only table, will not be supported.
+
+SLIT	Section 5.2.17 (signature == "SLIT")
+	== System Locality distance Information Table ==
+	Optional in general, but required for NUMA systems.
+
+SPCR	Signature Reserved (signature == "SPCR")
+	== Serial Port Console Redirection table ==
+	Required for arm64.
+
+SPMI	Signature Reserved (signature == "SPMI")
+	== Server Platform Management Interface table ==
+	Optional, not currently supported.
+
+SRAT	Section 5.2.16 (signature == "SRAT")
+	== System Resource Affinity Table ==
+	Optional, but if used, only the GICC Affinity structures are read.
+	To support NUMA, this table is required.
+
+SSDT	Section 5.2.11.2 (signature == "SSDT")
+	== Secondary System Description Table ==
+	These tables are a continuation of the DSDT; these are recommended
+	for use with devices that can be added to a running system, but can
+	also serve the purpose of dividing up device descriptions into more
+	manageable pieces.
+
+	An SSDT can only ADD to the ACPI namespace.  It cannot modify or
+	replace existing device descriptions already in the namespace.
+
+	These tables are optional, however.  ACPI tables should contain only
+	one DSDT but can contain many SSDTs.
+
+TCPA	Signature Reserved (signature == "TCPA")
+	== Trusted Computing Platform Alliance table ==
+	Optional, not currently supported, and may need changes to fully
+	interoperate with arm64.
+
+TPM2	Signature Reserved (signature == "TPM2")
+	== Trusted Platform Module 2 table ==
+	Optional, not currently supported, and may need changes to fully
+	interoperate with arm64.
+
+UEFI	Signature Reserved (signature == "UEFI")
+	== UEFI ACPI data table ==
+	Optional, not currently supported.  No known use case for arm64,
+	at present.
+
+WAET	Signature Reserved (signature == "WAET")
+	== Windows ACPI Emulated devices Table ==
+	Microsoft only table, will not be supported.
+
+WDAT	Signature Reserved (signature == "WDAT")
+	== Watch Dog Action Table ==
+	Microsoft only table, will not be supported.
+
+WDRT	Signature Reserved (signature == "WDRT")
+	== Watch Dog Resource Table ==
+	Microsoft only table, will not be supported.
+
+WPBT	Signature Reserved (signature == "WPBT")
+	== Windows Platform Binary Table ==
+	Microsoft only table, will not be supported.
+
+XSDT	Section 5.2.8 (signature == "XSDT")
+	== eXtended System Description Table ==
+	Required for arm64.
+
+
+ACPI Objects
+------------
+The expectations on individual ACPI objects are discussed in the list that
+follows:
+
+Name	Section		Usage for ARMv8 Linux
+----	------------	-------------------------------------------------
+_ADR	6.1.1		Use as needed.
+
+_BBN	6.5.5		Use as needed; PCI-specific.
+
+_BDN	6.5.3		Optional; not likely to be used on arm64.
+
+_CCA	6.2.17		This method should be defined for all bus masters
+			on arm64.  While cache coherency is assumed, making
+			it explicit ensures the kernel will set up DMA as
+			it should.
+
+_CDM	6.2.1		Optional, to be used only for processor devices.
+
+_CID	6.1.2		Use as needed.
+
+_CLS	6.1.3		Use as needed.
+
+_CRS	6.2.2		Required on arm64.
+
+_DCK	6.5.2		Optional; not likely to be used on arm64.
+
+_DDN	6.1.4		This field can be used for a device name.  However,
+			it is meant for DOS device names (e.g., COM1), so be
+			careful of its use across OSes.
+
+_DEP	6.5.8		Use as needed.
+
+_DIS	6.2.3		Optional, for power management use.
+
+_DLM	5.7.5		Optional.
+
+_DMA	6.2.4		Optional.
+
+_DSD	6.2.5		To be used with caution.  If this object is used, try
+			to use it within the constraints already defined by the
+			Device Properties UUID.  Only in rare circumstances
+			should it be necessary to create a new _DSD UUID.
+
+			In either case, submit the _DSD definition along with
+			any driver patches for discussion, especially when
+			device properties are used.  A driver will not be
+			considered complete without a corresponding _DSD
+			description.  Once approved by kernel maintainers,
+			the UUID or device properties must then be registered
+			with the UEFI Forum; this may cause some iteration as
+			more than one OS will be registering entries.
+
+_DSM			Do not use this method.  It is not standardized, the
+			return values are not well documented, and it is
+			currently a frequent source of error.
+
+_DSW	7.2.1		Use as needed; power management specific.
+
+_EDL	6.3.1		Optional.
+
+_EJD	6.3.2		Optional.
+
+_EJx	6.3.3		Optional.
+
+_FIX	6.2.7		x86 specific, not used on arm64.
+
+\_GL	5.7.1		This object is not to be used in hardware reduced
+			mode, and therefore should not be used on arm64.
+
+_GLK	6.5.7		This object requires a global lock be defined; there
+			is no global lock on arm64 since it runs in hardware
+			reduced mode.  Hence, do not use this object on arm64.
+
+\_GPE	5.3.1		This namespace is for x86 use only.  Do not use it
+			on arm64.
+
+_GSB	6.2.7		Optional.
+
+_HID	6.1.5		Use as needed.  This is the primary object to use in
+			device probing, though _CID and _CLS may also be used.
+
+_HPP	6.2.8		Optional, PCI specific.
+
+_HPX	6.2.9		Optional, PCI specific.
+
+_HRV	6.1.6		Optional, use as needed to clarify device behavior; in
+			some cases, this may be easier to use than _DSD.
+
+_INI	6.5.1		Not required, but can be useful in setting up devices
+			when UEFI leaves them in a state that may not be what
+			the driver expects before it starts probing.
+
+_IRC	7.2.15		Use as needed; power management specific.
+
+_LCK	6.3.4		Optional.
+
+_MAT	6.2.10		Optional; see also the MADT.
+
+_MLS	6.1.7		Optional, but highly recommended for use in
+			internationalization.
+
+_OFF	7.1.2		It is recommended to define this method for any device
+			that can be turned on or off.
+
+_ON	7.1.3		It is recommended to define this method for any device
+			that can be turned on or off.
+
+\_OS	5.7.3		This method will return "Linux" by default (this is
+			the value of the macro ACPI_OS_NAME on Linux).  The
+			command line parameter acpi_os=<string> can be used
+			to set it to some other value.
+
+_OSC	6.2.11		This method can be a global method in ACPI (i.e.,
+			\_SB._OSC), or it may be associated with a specific
+			device (e.g., \_SB.DEV0._OSC), or both.  When used
+			as a global method, only capabilities published in
+			the ACPI specification are allowed.  When used as
+			a device-specific method, the process described for
+			using _DSD MUST be used to create an _OSC definition;
+			out-of-process use of _OSC is not allowed.  That is,
+			submit the device-specific _OSC usage description as
+			part of the kernel driver submission, get it approved
+			by the kernel community, then register it with the
+			UEFI Forum.
+
+\_OSI	5.7.2		Deprecated on ARM64.  Any invocation of this method
+			will print a warning on the console and return false.
+			That is, as far as ACPI firmware is concerned, _OSI
+			cannot be used to determine what sort of system is
+			being used or what functionality is provided.  The
+			_OSC method is to be used instead.
+
+_OST	6.3.5		Optional.
+
+_PDC	8.4.1		Deprecated, do not use on arm64.
+
+\_PIC	5.8.1		The method should not be used.  On arm64, the only
+			interrupt model available is GIC.
+
+_PLD	6.1.8		Optional.
+
+\_PR	5.3.1		This namespace is for x86 use only on legacy systems.
+			Do not use it on arm64.
+
+_PRS	6.2.12		Optional.
+
+_PRT	6.2.13		Required as part of the definition of all PCI root
+			devices.
+
+_PRW	7.2.13		Use as needed; power management specific.
+
+_PRx	7.2.8-11	Use as needed; power management specific.  If _PR0 is
+			defined, _PR3 must also be defined.
+
+_PSC	7.2.6		Use as needed; power management specific.
+
+_PSE	7.2.7		Use as needed; power management specific.
+
+_PSW	7.2.14		Use as needed; power management specific.
+
+_PSx	7.2.2-5		Use as needed; power management specific.  If _PS0 is
+			defined, _PS3 must also be defined.  If clocks or
+			regulators need adjusting to be consistent with power
+			usage, change them in these methods.
+
+\_PTS	7.3.1		Use as needed; power management specific.
+
+_PXM	6.2.14		Optional.
+
+_REG	6.5.4		Use as needed.
+
+\_REV	5.7.4		Always returns the latest version of ACPI supported.
+
+_RMV	6.3.6		Optional.
+
+\_SB	5.3.1		Required on arm64; all devices must be defined in this
+			namespace.
+
+_SEG	6.5.6		Use as needed; PCI-specific.
+
+\_SI	5.3.1,		Optional.
+	9.1
+
+_SLI	6.2.15		Optional; recommended when SLIT table is in use.
+
+_STA	6.3.7,		It is recommended to define this method for any device
+	7.1.4		that can be turned on or off.
+
+_SRS	6.2.16		Optional; see also _PRS.
+
+_STR	6.1.10		Recommended for conveying device names to end users;
+			this is preferred over using _DDN.
+
+_SUB	6.1.9		Use as needed; _HID or _CID are preferred.
+
+_SUN	6.1.11		Optional.
+
+\_Sx	7.3.2		Use as needed; power management specific.
+
+_SxD	7.2.16-19	Use as needed; power management specific.
+
+_SxW	7.2.20-24	Use as needed; power management specific.
+
+_SWS	7.3.3		Use as needed; power management specific; this may
+			require specification changes for use on arm64.
+
+\_TTS	7.3.4		Use as needed; power management specific.
+
+\_TZ	5.3.1		Optional.
+
+_UID	6.1.12		Recommended for distinguishing devices of the same
+			class; define it if at all possible.
+
+\_WAK	7.3.5		Use as needed; power management specific.
+
+
+ACPI Event Model
+----------------
+Do not use GPE block devices; these are not supported in the hardware reduced
+profile used by arm64.  Since there are no GPE blocks defined for use on ARM
+platforms, GPIO-signaled interrupts should be used for creating system events.
+
+
+ACPI Processor Control
+----------------------
+Section 8 of the ACPI specification is currently undergoing change that
+should be completed in the 6.0 version of the specification.  Processor
+performance control will be handled differently for arm64 at that point
+in time.  Processor aggregator devices (section 8.5) will not be used,
+for example, but another similar mechanism instead.
+
+While UEFI constrains what we can say until the release of 6.0, it is
+recommended that CPPC (8.4.5) be used as the primary model.  This will
+still be useful into the future.  C-states and P-states will still be
+provided, but most of the current design work appears to favor CPPC.
+
+Further, it is essential that the ARMv8 SoC provide a fully functional
+implementation of PSCI; this will be the only mechanism supported by ACPI
+to control CPU power state (including secondary CPU booting).
+
+More details will be provided on the release of the ACPI 6.0 specification.
+
+
+ACPI System Address Map Interfaces
+----------------------------------
+In Section 15 of the ACPI specification, several methods are mentioned as
+possible mechanisms for conveying memory resource information to the kernel.
+For arm64, we will only support UEFI for booting with ACPI, hence the UEFI
+GetMemoryMap() boot service is the only mechanism that will be used.
+
+
+ACPI Platform Error Interfaces (APEI)
+-------------------------------------
+The APEI tables supported are described above.
+
+APEI requires the equivalent of an SCI and an NMI on ARMv8.  The SCI is used
+to notify the OSPM of errors that have occurred but can be corrected and the
+system can continue correct operation, even if possibly degraded.  The NMI is
+used to indicate fatal errors that cannot be corrected, and require immediate
+attention.
+
+Since there is no direct equivalent of the x86 SCI or NMI, arm64 handles
+these slightly differently.  The SCI is handled as a normal GPIO-signaled
+interrupt; given that these are corrected (or correctable) errors being
+reported, this is sufficient.  The NMI is emulated as the highest priority
+GPIO-signaled interrupt possible.  This implies some caution must be used
+since there could be interrupts at higher privilege levels or even interrupts
+at the same priority as the emulated NMI.  In Linux, this should not be the
+case but one should be aware it could happen.
+
+
+ACPI Objects Not Supported on ARM64
+-----------------------------------
+While this may change in the future, there are several classes of objects
+that can be defined, but are not currently of general interest to ARM servers.
+
+These are not supported:
+
+	-- Section 9.2: ambient light sensor devices
+
+	-- Section 9.3: battery devices
+
+	-- Section 9.4: lids (e.g., laptop lids)
+
+	-- Section 9.8.2: IDE controllers
+
+	-- Section 9.9: floppy controllers
+
+	-- Section 9.10: GPE block devices
+
+	-- Section 9.15: PC/AT RTC/CMOS devices
+
+	-- Section 9.16: user presence detection devices
+
+	-- Section 9.17: I/O APIC devices; all GICs must be enumerable via MADT
+
+	-- Section 9.18: time and alarm devices (see 9.15)
+
+
+ACPI Objects Not Yet Implemented
+--------------------------------
+While these objects have x86 equivalents, and they do make some sense in ARM
+servers, there is either no hardware available at present, or in some cases
+there may not yet be a non-ARM implementation.  Hence, they are currently not
+implemented though that may change in the future.
+
+Not yet implemented are:
+
+	-- Section 10: power source and power meter devices
+
+	-- Section 11: thermal management
+
+	-- Section 12: embedded controllers interface
+
+	-- Section 13: SMBus interfaces
+
+	-- Section 17: NUMA support (prototypes have been submitted for
+	   review)
-- 
1.9.1

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

* [patch v11 22/23] ARM64 / ACPI: additions of ACPI documentation for arm64
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

From: Al Stone <al.stone@linaro.org>

One more documentation file are also being added:

A section by section review of the ACPI spec (acpi_object_usage.txt)
to note recommendations and prohibitions on the use of the numerous
ACPI tables and objects.  This sets out the current expectations of
the firmware by Linux very explicitly (or as explicitly as I can, for
now).

CC: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
CC: Yi Li <phoenix.liyi@huawei.com>
CC: Mark Langsdorf <mlangsdo@redhat.com>
CC: Ashwin Chaugule <ashwinc@codeaurora.org>
Acked-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 Documentation/arm64/acpi_object_usage.txt | 593 ++++++++++++++++++++++++++++++
 1 file changed, 593 insertions(+)
 create mode 100644 Documentation/arm64/acpi_object_usage.txt

diff --git a/Documentation/arm64/acpi_object_usage.txt b/Documentation/arm64/acpi_object_usage.txt
new file mode 100644
index 0000000..96e2273
--- /dev/null
+++ b/Documentation/arm64/acpi_object_usage.txt
@@ -0,0 +1,593 @@
+ACPI Tables
+-----------
+The expectations of individual ACPI tables are discussed in the list that
+follows.
+
+If a section number is used, it refers to a section number in the ACPI
+specification where the object is defined.  If "Signature Reserved" is used,
+the table signature (the first four bytes of the table) is the only portion
+of the table recognized by the specification, and the actual table is defined
+outside of the UEFI Forum (see Section 5.2.6 of the specification).
+
+For ACPI on arm64, tables also fall into the following categories:
+
+	-- Required: DSDT, FADT, GTDT, MADT, MCFG, RSDP, SPCR, XSDT
+
+	-- Recommended: BERT, EINJ, ERST, HEST, SSDT
+
+	-- Optional: BGRT, CPEP, CSRT, DRTM, ECDT, FACS, FPDT, MCHI, MPST,
+	   MSCT, RASF, SBST, SLIT, SPMI, SRAT, TCPA, TPM2, UEFI
+
+	-- Not supported: BOOT, DBG2, DBGP, DMAR, ETDT, HPET, IBFT, IVRS,
+	   LPIT, MSDM, RSDT, SLIC, WAET, WDAT, WDRT, WPBT
+
+
+Table	Usage for ARMv8 Linux
+-----	----------------------------------------------------------------
+BERT	Section 18.3 (signature == "BERT")
+	== Boot Error Record Table ==
+	Must be supplied if RAS support is provided by the platform.  It
+	is recommended this table be supplied.
+
+BOOT	Signature Reserved (signature == "BOOT")
+	== simple BOOT flag table ==
+	Microsoft only table, will not be supported.
+
+BGRT	Section 5.2.22 (signature == "BGRT")
+	== Boot Graphics Resource Table ==
+	Optional, not currently supported, with no real use-case for an
+	ARM server.
+
+CPEP	Section 5.2.18 (signature == "CPEP")
+	== Corrected Platform Error Polling table ==
+	Optional, not currently supported, and not recommended until such
+	time as ARM-compatible hardware is available, and the specification
+	suitably modified.
+
+CSRT	Signature Reserved (signature == "CSRT")
+	== Core System Resources Table ==
+	Optional, not currently supported.
+
+DBG2	Signature Reserved (signature == "DBG2")
+	== DeBuG port table 2 ==
+	Microsoft only table, will not be supported.
+
+DBGP	Signature Reserved (signature == "DBGP")
+	== DeBuG Port table ==
+	Microsoft only table, will not be supported.
+
+DSDT	Section 5.2.11.1 (signature == "DSDT")
+	== Differentiated System Description Table ==
+	A DSDT is required; see also SSDT.
+
+	ACPI tables contain only one DSDT but can contain one or more SSDTs,
+	which are optional.  Each SSDT can only add to the ACPI namespace,
+	but cannot modify or replace anything in the DSDT.
+
+DMAR	Signature Reserved (signature == "DMAR")
+	== DMA Remapping table ==
+	x86 only table, will not be supported.
+
+DRTM	Signature Reserved (signature == "DRTM")
+	== Dynamic Root of Trust for Measurement table ==
+	Optional, not currently supported.
+
+ECDT	Section 5.2.16 (signature == "ECDT")
+	== Embedded Controller Description Table ==
+	Optional, not currently supported, but could be used on ARM if and
+	only if one uses the GPE_BIT field to represent an IRQ number, since
+	there are no GPE blocks defined in hardware reduced mode.  This would
+	need to be modified in the ACPI specification.
+
+EINJ	Section 18.6 (signature == "EINJ")
+	== Error Injection table ==
+	This table is very useful for testing platform response to error
+	conditions; it allows one to inject an error into the system as
+	if it had actually occurred.  However, this table should not be
+	shipped with a production system; it should be dynamically loaded
+	and executed with the ACPICA tools only during testing.
+
+ERST	Section 18.5 (signature == "ERST")
+	== Error Record Serialization Table ==
+	On a platform supports RAS, this table must be supplied if it is not
+	UEFI-based; if it is UEFI-based, this table may be supplied. When this
+	table is not present, UEFI run time service will be utilized to save
+	and retrieve hardware error information to and from a persistent store.
+
+ETDT	Signature Reserved (signature == "ETDT")
+	== Event Timer Description Table ==
+	Obsolete table, will not be supported.
+
+FACS	Section 5.2.10 (signature == "FACS")
+	== Firmware ACPI Control Structure ==
+	It is unlikely that this table will be terribly useful.  If it is
+	provided, the Global Lock will NOT be used since it is not part of
+	the hardware reduced profile, and only 64-bit address fields will
+	be considered valid.
+
+FADT	Section 5.2.9 (signature == "FACP")
+	== Fixed ACPI Description Table ==
+	Required for arm64.
+
+	The HW_REDUCED_ACPI flag must be set.  All of the fields that are
+	to be ignored when HW_REDUCED_ACPI is set are expected to be set to
+	zero.
+
+	If an FACS table is provided, the X_FIRMWARE_CTRL field is to be
+	used, not FIRMWARE_CTRL.
+
+	If PSCI is used (as is recommended), make sure that ARM_BOOT_ARCH is
+	filled in properly -- that the PSCI_COMPLIANT flag is set and that
+	PSCI_USE_HVC is set or unset as needed (see table 5-37).
+
+	For the DSDT that is also required, the X_DSDT field is to be used,
+	not the DSDT field.
+
+FPDT	Section 5.2.23 (signature == "FPDT")
+	== Firmware Performance Data Table ==
+	Optional, not currently supported.
+
+GTDT	Section 5.2.24 (signature == "GTDT")
+	== Generic Timer Description Table ==
+	Required for arm64.
+
+HEST	Section 18.3.2 (signature == "HEST")
+	== Hardware Error Source Table ==
+	Until further error source types are defined, use only types 6 (AER
+	Root Port), 7 (AER Endpoint), 8 (AER Bridge), or 9 (Generic Hardware
+	Error Source).  Firmware first error handling is possible if and only
+	if Trusted Firmware is being used on arm64.
+
+	Must be supplied if RAS support is provided by the platform.  It
+	is recommended this table be supplied.
+
+HPET	Signature Reserved (signature == "HPET")
+	== High Precision Event timer Table ==
+	x86 only table, will not be supported.
+
+IBFT	Signature Reserved (signature == "IBFT")
+	== iSCSI Boot Firmware Table ==
+	Microsoft defined table, support TBD.
+
+IVRS	Signature Reserved (signature == "IVRS")
+	== I/O Virtualization Reporting Structure ==
+	x86_64 (AMD) only table, will not be supported.
+
+LPIT	Signature Reserved (signature == "LPIT")
+	== Low Power Idle Table ==
+	x86 only table as of ACPI 5.1; future versions have been adapted for
+	use with ARM and will be recommended in order to support ACPI power
+	management.
+
+MADT	Section 5.2.12 (signature == "APIC")
+	== Multiple APIC Description Table ==
+	Required for arm64.  Only the GIC interrupt controller structures
+	should be used (types 0xA - 0xE).
+
+MCFG	Signature Reserved (signature == "MCFG")
+	== Memory-mapped ConFiGuration space ==
+	If the platform supports PCI/PCIe, an MCFG table is required.
+
+MCHI	Signature Reserved (signature == "MCHI")
+	== Management Controller Host Interface table ==
+	Optional, not currently supported.
+
+MPST	Section 5.2.21 (signature == "MPST")
+	== Memory Power State Table ==
+	Optional, not currently supported.
+
+MSDM	Signature Reserved (signature == "MSDM")
+	== Microsoft Data Management table ==
+	Microsoft only table, will not be supported.
+
+MSCT	Section 5.2.19 (signature == "MSCT")
+	== Maximum System Characteristic Table ==
+	Optional, not currently supported.
+
+RASF	Section 5.2.20 (signature == "RASF")
+	== RAS Feature table ==
+	Optional, not currently supported.
+
+RSDP	Section 5.2.5 (signature == "RSD PTR")
+	== Root System Description PoinTeR ==
+	Required for arm64.
+
+RSDT	Section 5.2.7 (signature == "RSDT")
+	== Root System Description Table ==
+	Since this table can only provide 32-bit addresses, it is deprecated
+	on arm64, and will not be used.
+
+SBST	Section 5.2.14 (signature == "SBST")
+	== Smart Battery Subsystem Table ==
+	Optional, not currently supported.
+
+SLIC	Signature Reserved (signature == "SLIC")
+	== Software LIcensing table ==
+	Microsoft only table, will not be supported.
+
+SLIT	Section 5.2.17 (signature == "SLIT")
+	== System Locality distance Information Table ==
+	Optional in general, but required for NUMA systems.
+
+SPCR	Signature Reserved (signature == "SPCR")
+	== Serial Port Console Redirection table ==
+	Required for arm64.
+
+SPMI	Signature Reserved (signature == "SPMI")
+	== Server Platform Management Interface table ==
+	Optional, not currently supported.
+
+SRAT	Section 5.2.16 (signature == "SRAT")
+	== System Resource Affinity Table ==
+	Optional, but if used, only the GICC Affinity structures are read.
+	To support NUMA, this table is required.
+
+SSDT	Section 5.2.11.2 (signature == "SSDT")
+	== Secondary System Description Table ==
+	These tables are a continuation of the DSDT; these are recommended
+	for use with devices that can be added to a running system, but can
+	also serve the purpose of dividing up device descriptions into more
+	manageable pieces.
+
+	An SSDT can only ADD to the ACPI namespace.  It cannot modify or
+	replace existing device descriptions already in the namespace.
+
+	These tables are optional, however.  ACPI tables should contain only
+	one DSDT but can contain many SSDTs.
+
+TCPA	Signature Reserved (signature == "TCPA")
+	== Trusted Computing Platform Alliance table ==
+	Optional, not currently supported, and may need changes to fully
+	interoperate with arm64.
+
+TPM2	Signature Reserved (signature == "TPM2")
+	== Trusted Platform Module 2 table ==
+	Optional, not currently supported, and may need changes to fully
+	interoperate with arm64.
+
+UEFI	Signature Reserved (signature == "UEFI")
+	== UEFI ACPI data table ==
+	Optional, not currently supported.  No known use case for arm64,
+	at present.
+
+WAET	Signature Reserved (signature == "WAET")
+	== Windows ACPI Emulated devices Table ==
+	Microsoft only table, will not be supported.
+
+WDAT	Signature Reserved (signature == "WDAT")
+	== Watch Dog Action Table ==
+	Microsoft only table, will not be supported.
+
+WDRT	Signature Reserved (signature == "WDRT")
+	== Watch Dog Resource Table ==
+	Microsoft only table, will not be supported.
+
+WPBT	Signature Reserved (signature == "WPBT")
+	== Windows Platform Binary Table ==
+	Microsoft only table, will not be supported.
+
+XSDT	Section 5.2.8 (signature == "XSDT")
+	== eXtended System Description Table ==
+	Required for arm64.
+
+
+ACPI Objects
+------------
+The expectations on individual ACPI objects are discussed in the list that
+follows:
+
+Name	Section		Usage for ARMv8 Linux
+----	------------	-------------------------------------------------
+_ADR	6.1.1		Use as needed.
+
+_BBN	6.5.5		Use as needed; PCI-specific.
+
+_BDN	6.5.3		Optional; not likely to be used on arm64.
+
+_CCA	6.2.17		This method should be defined for all bus masters
+			on arm64.  While cache coherency is assumed, making
+			it explicit ensures the kernel will set up DMA as
+			it should.
+
+_CDM	6.2.1		Optional, to be used only for processor devices.
+
+_CID	6.1.2		Use as needed.
+
+_CLS	6.1.3		Use as needed.
+
+_CRS	6.2.2		Required on arm64.
+
+_DCK	6.5.2		Optional; not likely to be used on arm64.
+
+_DDN	6.1.4		This field can be used for a device name.  However,
+			it is meant for DOS device names (e.g., COM1), so be
+			careful of its use across OSes.
+
+_DEP	6.5.8		Use as needed.
+
+_DIS	6.2.3		Optional, for power management use.
+
+_DLM	5.7.5		Optional.
+
+_DMA	6.2.4		Optional.
+
+_DSD	6.2.5		To be used with caution.  If this object is used, try
+			to use it within the constraints already defined by the
+			Device Properties UUID.  Only in rare circumstances
+			should it be necessary to create a new _DSD UUID.
+
+			In either case, submit the _DSD definition along with
+			any driver patches for discussion, especially when
+			device properties are used.  A driver will not be
+			considered complete without a corresponding _DSD
+			description.  Once approved by kernel maintainers,
+			the UUID or device properties must then be registered
+			with the UEFI Forum; this may cause some iteration as
+			more than one OS will be registering entries.
+
+_DSM			Do not use this method.  It is not standardized, the
+			return values are not well documented, and it is
+			currently a frequent source of error.
+
+_DSW	7.2.1		Use as needed; power management specific.
+
+_EDL	6.3.1		Optional.
+
+_EJD	6.3.2		Optional.
+
+_EJx	6.3.3		Optional.
+
+_FIX	6.2.7		x86 specific, not used on arm64.
+
+\_GL	5.7.1		This object is not to be used in hardware reduced
+			mode, and therefore should not be used on arm64.
+
+_GLK	6.5.7		This object requires a global lock be defined; there
+			is no global lock on arm64 since it runs in hardware
+			reduced mode.  Hence, do not use this object on arm64.
+
+\_GPE	5.3.1		This namespace is for x86 use only.  Do not use it
+			on arm64.
+
+_GSB	6.2.7		Optional.
+
+_HID	6.1.5		Use as needed.  This is the primary object to use in
+			device probing, though _CID and _CLS may also be used.
+
+_HPP	6.2.8		Optional, PCI specific.
+
+_HPX	6.2.9		Optional, PCI specific.
+
+_HRV	6.1.6		Optional, use as needed to clarify device behavior; in
+			some cases, this may be easier to use than _DSD.
+
+_INI	6.5.1		Not required, but can be useful in setting up devices
+			when UEFI leaves them in a state that may not be what
+			the driver expects before it starts probing.
+
+_IRC	7.2.15		Use as needed; power management specific.
+
+_LCK	6.3.4		Optional.
+
+_MAT	6.2.10		Optional; see also the MADT.
+
+_MLS	6.1.7		Optional, but highly recommended for use in
+			internationalization.
+
+_OFF	7.1.2		It is recommended to define this method for any device
+			that can be turned on or off.
+
+_ON	7.1.3		It is recommended to define this method for any device
+			that can be turned on or off.
+
+\_OS	5.7.3		This method will return "Linux" by default (this is
+			the value of the macro ACPI_OS_NAME on Linux).  The
+			command line parameter acpi_os=<string> can be used
+			to set it to some other value.
+
+_OSC	6.2.11		This method can be a global method in ACPI (i.e.,
+			\_SB._OSC), or it may be associated with a specific
+			device (e.g., \_SB.DEV0._OSC), or both.  When used
+			as a global method, only capabilities published in
+			the ACPI specification are allowed.  When used as
+			a device-specific method, the process described for
+			using _DSD MUST be used to create an _OSC definition;
+			out-of-process use of _OSC is not allowed.  That is,
+			submit the device-specific _OSC usage description as
+			part of the kernel driver submission, get it approved
+			by the kernel community, then register it with the
+			UEFI Forum.
+
+\_OSI	5.7.2		Deprecated on ARM64.  Any invocation of this method
+			will print a warning on the console and return false.
+			That is, as far as ACPI firmware is concerned, _OSI
+			cannot be used to determine what sort of system is
+			being used or what functionality is provided.  The
+			_OSC method is to be used instead.
+
+_OST	6.3.5		Optional.
+
+_PDC	8.4.1		Deprecated, do not use on arm64.
+
+\_PIC	5.8.1		The method should not be used.  On arm64, the only
+			interrupt model available is GIC.
+
+_PLD	6.1.8		Optional.
+
+\_PR	5.3.1		This namespace is for x86 use only on legacy systems.
+			Do not use it on arm64.
+
+_PRS	6.2.12		Optional.
+
+_PRT	6.2.13		Required as part of the definition of all PCI root
+			devices.
+
+_PRW	7.2.13		Use as needed; power management specific.
+
+_PRx	7.2.8-11	Use as needed; power management specific.  If _PR0 is
+			defined, _PR3 must also be defined.
+
+_PSC	7.2.6		Use as needed; power management specific.
+
+_PSE	7.2.7		Use as needed; power management specific.
+
+_PSW	7.2.14		Use as needed; power management specific.
+
+_PSx	7.2.2-5		Use as needed; power management specific.  If _PS0 is
+			defined, _PS3 must also be defined.  If clocks or
+			regulators need adjusting to be consistent with power
+			usage, change them in these methods.
+
+\_PTS	7.3.1		Use as needed; power management specific.
+
+_PXM	6.2.14		Optional.
+
+_REG	6.5.4		Use as needed.
+
+\_REV	5.7.4		Always returns the latest version of ACPI supported.
+
+_RMV	6.3.6		Optional.
+
+\_SB	5.3.1		Required on arm64; all devices must be defined in this
+			namespace.
+
+_SEG	6.5.6		Use as needed; PCI-specific.
+
+\_SI	5.3.1,		Optional.
+	9.1
+
+_SLI	6.2.15		Optional; recommended when SLIT table is in use.
+
+_STA	6.3.7,		It is recommended to define this method for any device
+	7.1.4		that can be turned on or off.
+
+_SRS	6.2.16		Optional; see also _PRS.
+
+_STR	6.1.10		Recommended for conveying device names to end users;
+			this is preferred over using _DDN.
+
+_SUB	6.1.9		Use as needed; _HID or _CID are preferred.
+
+_SUN	6.1.11		Optional.
+
+\_Sx	7.3.2		Use as needed; power management specific.
+
+_SxD	7.2.16-19	Use as needed; power management specific.
+
+_SxW	7.2.20-24	Use as needed; power management specific.
+
+_SWS	7.3.3		Use as needed; power management specific; this may
+			require specification changes for use on arm64.
+
+\_TTS	7.3.4		Use as needed; power management specific.
+
+\_TZ	5.3.1		Optional.
+
+_UID	6.1.12		Recommended for distinguishing devices of the same
+			class; define it if at all possible.
+
+\_WAK	7.3.5		Use as needed; power management specific.
+
+
+ACPI Event Model
+----------------
+Do not use GPE block devices; these are not supported in the hardware reduced
+profile used by arm64.  Since there are no GPE blocks defined for use on ARM
+platforms, GPIO-signaled interrupts should be used for creating system events.
+
+
+ACPI Processor Control
+----------------------
+Section 8 of the ACPI specification is currently undergoing change that
+should be completed in the 6.0 version of the specification.  Processor
+performance control will be handled differently for arm64 at that point
+in time.  Processor aggregator devices (section 8.5) will not be used,
+for example, but another similar mechanism instead.
+
+While UEFI constrains what we can say until the release of 6.0, it is
+recommended that CPPC (8.4.5) be used as the primary model.  This will
+still be useful into the future.  C-states and P-states will still be
+provided, but most of the current design work appears to favor CPPC.
+
+Further, it is essential that the ARMv8 SoC provide a fully functional
+implementation of PSCI; this will be the only mechanism supported by ACPI
+to control CPU power state (including secondary CPU booting).
+
+More details will be provided on the release of the ACPI 6.0 specification.
+
+
+ACPI System Address Map Interfaces
+----------------------------------
+In Section 15 of the ACPI specification, several methods are mentioned as
+possible mechanisms for conveying memory resource information to the kernel.
+For arm64, we will only support UEFI for booting with ACPI, hence the UEFI
+GetMemoryMap() boot service is the only mechanism that will be used.
+
+
+ACPI Platform Error Interfaces (APEI)
+-------------------------------------
+The APEI tables supported are described above.
+
+APEI requires the equivalent of an SCI and an NMI on ARMv8.  The SCI is used
+to notify the OSPM of errors that have occurred but can be corrected and the
+system can continue correct operation, even if possibly degraded.  The NMI is
+used to indicate fatal errors that cannot be corrected, and require immediate
+attention.
+
+Since there is no direct equivalent of the x86 SCI or NMI, arm64 handles
+these slightly differently.  The SCI is handled as a normal GPIO-signaled
+interrupt; given that these are corrected (or correctable) errors being
+reported, this is sufficient.  The NMI is emulated as the highest priority
+GPIO-signaled interrupt possible.  This implies some caution must be used
+since there could be interrupts at higher privilege levels or even interrupts
+at the same priority as the emulated NMI.  In Linux, this should not be the
+case but one should be aware it could happen.
+
+
+ACPI Objects Not Supported on ARM64
+-----------------------------------
+While this may change in the future, there are several classes of objects
+that can be defined, but are not currently of general interest to ARM servers.
+
+These are not supported:
+
+	-- Section 9.2: ambient light sensor devices
+
+	-- Section 9.3: battery devices
+
+	-- Section 9.4: lids (e.g., laptop lids)
+
+	-- Section 9.8.2: IDE controllers
+
+	-- Section 9.9: floppy controllers
+
+	-- Section 9.10: GPE block devices
+
+	-- Section 9.15: PC/AT RTC/CMOS devices
+
+	-- Section 9.16: user presence detection devices
+
+	-- Section 9.17: I/O APIC devices; all GICs must be enumerable via MADT
+
+	-- Section 9.18: time and alarm devices (see 9.15)
+
+
+ACPI Objects Not Yet Implemented
+--------------------------------
+While these objects have x86 equivalents, and they do make some sense in ARM
+servers, there is either no hardware available at present, or in some cases
+there may not yet be a non-ARM implementation.  Hence, they are currently not
+implemented though that may change in the future.
+
+Not yet implemented are:
+
+	-- Section 10: power source and power meter devices
+
+	-- Section 11: thermal management
+
+	-- Section 12: embedded controllers interface
+
+	-- Section 13: SMBus interfaces
+
+	-- Section 17: NUMA support (prototypes have been submitted for
+	   review)
-- 
1.9.1

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

* [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 14:02   ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Hanjun Guo, Ard Biesheuvel

Since the policy is that once we pass acpi=force in the early
param, we will not unflatten device tree even if ACPI is disabled
in ACPI table init fails, so fix the code by comparinging both
acpi_disabled and param_acpi_force before the device tree is
unflattened.

CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 3 +++
 arch/arm64/kernel/acpi.c      | 2 +-
 arch/arm64/kernel/setup.c     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 59c05d8..e1a8965 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -38,6 +38,7 @@ typedef u64 phys_cpuid_t;
 extern int acpi_disabled;
 extern int acpi_noirq;
 extern int acpi_pci_disabled;
+extern bool param_acpi_force;
 
 /* 1 to indicate PSCI 0.2+ is implemented */
 static inline bool acpi_psci_present(void)
@@ -91,6 +92,8 @@ void __init acpi_init_cpus(void);
 static inline bool acpi_psci_present(void) { return false; }
 static inline bool acpi_psci_use_hvc(void) { return false; }
 static inline void acpi_init_cpus(void) { }
+
+#define param_acpi_force false
 #endif /* CONFIG_ACPI */
 
 #endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 5819ef7..fe9d8f0 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -43,7 +43,7 @@ static int enabled_cpus;
 static bool bootcpu_valid  __initdata;
 
 static bool param_acpi_off __initdata;
-static bool param_acpi_force __initdata;
+bool param_acpi_force __initdata;
 
 static int __init parse_acpi(char *arg)
 {
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index b278311..d60b1ad 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -390,7 +390,7 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_reset();
 
-	if (acpi_disabled) {
+	if (acpi_disabled  && !param_acpi_force) {
 		unflatten_device_tree();
 		psci_dt_init();
 		cpu_read_bootcpu_ops();
-- 
1.9.1

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

* [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
@ 2015-03-24 14:02   ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-24 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Since the policy is that once we pass acpi=force in the early
param, we will not unflatten device tree even if ACPI is disabled
in ACPI table init fails, so fix the code by comparinging both
acpi_disabled and param_acpi_force before the device tree is
unflattened.

CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/include/asm/acpi.h | 3 +++
 arch/arm64/kernel/acpi.c      | 2 +-
 arch/arm64/kernel/setup.c     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 59c05d8..e1a8965 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -38,6 +38,7 @@ typedef u64 phys_cpuid_t;
 extern int acpi_disabled;
 extern int acpi_noirq;
 extern int acpi_pci_disabled;
+extern bool param_acpi_force;
 
 /* 1 to indicate PSCI 0.2+ is implemented */
 static inline bool acpi_psci_present(void)
@@ -91,6 +92,8 @@ void __init acpi_init_cpus(void);
 static inline bool acpi_psci_present(void) { return false; }
 static inline bool acpi_psci_use_hvc(void) { return false; }
 static inline void acpi_init_cpus(void) { }
+
+#define param_acpi_force false
 #endif /* CONFIG_ACPI */
 
 #endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 5819ef7..fe9d8f0 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -43,7 +43,7 @@ static int enabled_cpus;
 static bool bootcpu_valid  __initdata;
 
 static bool param_acpi_off __initdata;
-static bool param_acpi_force __initdata;
+bool param_acpi_force __initdata;
 
 static int __init parse_acpi(char *arg)
 {
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index b278311..d60b1ad 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -390,7 +390,7 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_reset();
 
-	if (acpi_disabled) {
+	if (acpi_disabled  && !param_acpi_force) {
 		unflatten_device_tree();
 		psci_dt_init();
 		cpu_read_bootcpu_ops();
-- 
1.9.1

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-24 15:30     ` Boris Ostrovsky
  -1 siblings, 0 replies; 142+ messages in thread
From: Boris Ostrovsky @ 2015-03-24 15:30 UTC (permalink / raw)
  To: Hanjun Guo, Catalin Marinas, Rafael J. Wysocki, Will Deacon,
	Olof Johansson, Grant Likely
  Cc: Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, Julien Grall,
	Konrad Rzeszutek Wilk, linux-acpi, Mark Brown, David Vrabel,
	Suravee Suthikulpanit, Sudeep Holla, 'Stefano Stabellini',
	linux-arm-kernel

On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> When ACPI is enabled on ARM64, XEN ACPI will also compiled
> into the kernel, but XEN ACPI is x86 dependent, so introduce
> CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> functional on ARM64.
>
> CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> CC: Julien Grall <julien.grall@linaro.org>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>   drivers/xen/Kconfig  | 4 ++++
>   drivers/xen/Makefile | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> index b812462..a31cd29 100644
> --- a/drivers/xen/Kconfig
> +++ b/drivers/xen/Kconfig
> @@ -253,4 +253,8 @@ config XEN_EFI
>   	def_bool y
>   	depends on X86_64 && EFI
>   
> +config XEN_ACPI
> +	def_bool y
> +	depends on X86 && ACPI
> +


I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option. 
Otherwise, if it is set to 'n', we won't be able to build enlighten.c 
(xen_start_kernel() -> xen_acpi_sleep_register() refers to 
xen_acpi_notify_hypervisor_sleep()).

-boris

>   endmenu
> diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> index 2ccd359..f4622ab 100644
> --- a/drivers/xen/Makefile
> +++ b/drivers/xen/Makefile
> @@ -13,7 +13,7 @@ CFLAGS_efi.o				+= -fshort-wchar
>   
>   dom0-$(CONFIG_PCI) += pci.o
>   dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
> -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
> +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
>   xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
>   dom0-$(CONFIG_X86) += pcpu.o
>   obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-24 15:30     ` Boris Ostrovsky
  0 siblings, 0 replies; 142+ messages in thread
From: Boris Ostrovsky @ 2015-03-24 15:30 UTC (permalink / raw)
  To: Hanjun Guo, Catalin Marinas, Rafael J. Wysocki, Will Deacon,
	Olof Johansson, Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, 'Stefano Stabellini',
	Julien Grall, Konrad Rzeszutek Wilk, David Vrabel

On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> When ACPI is enabled on ARM64, XEN ACPI will also compiled
> into the kernel, but XEN ACPI is x86 dependent, so introduce
> CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> functional on ARM64.
>
> CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> CC: Julien Grall <julien.grall@linaro.org>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>   drivers/xen/Kconfig  | 4 ++++
>   drivers/xen/Makefile | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> index b812462..a31cd29 100644
> --- a/drivers/xen/Kconfig
> +++ b/drivers/xen/Kconfig
> @@ -253,4 +253,8 @@ config XEN_EFI
>   	def_bool y
>   	depends on X86_64 && EFI
>   
> +config XEN_ACPI
> +	def_bool y
> +	depends on X86 && ACPI
> +


I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option. 
Otherwise, if it is set to 'n', we won't be able to build enlighten.c 
(xen_start_kernel() -> xen_acpi_sleep_register() refers to 
xen_acpi_notify_hypervisor_sleep()).

-boris

>   endmenu
> diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> index 2ccd359..f4622ab 100644
> --- a/drivers/xen/Makefile
> +++ b/drivers/xen/Makefile
> @@ -13,7 +13,7 @@ CFLAGS_efi.o				+= -fshort-wchar
>   
>   dom0-$(CONFIG_PCI) += pci.o
>   dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
> -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
> +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
>   xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
>   dom0-$(CONFIG_X86) += pcpu.o
>   obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)


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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-24 15:30     ` Boris Ostrovsky
  0 siblings, 0 replies; 142+ messages in thread
From: Boris Ostrovsky @ 2015-03-24 15:30 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> When ACPI is enabled on ARM64, XEN ACPI will also compiled
> into the kernel, but XEN ACPI is x86 dependent, so introduce
> CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> functional on ARM64.
>
> CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> CC: Julien Grall <julien.grall@linaro.org>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>   drivers/xen/Kconfig  | 4 ++++
>   drivers/xen/Makefile | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> index b812462..a31cd29 100644
> --- a/drivers/xen/Kconfig
> +++ b/drivers/xen/Kconfig
> @@ -253,4 +253,8 @@ config XEN_EFI
>   	def_bool y
>   	depends on X86_64 && EFI
>   
> +config XEN_ACPI
> +	def_bool y
> +	depends on X86 && ACPI
> +


I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option. 
Otherwise, if it is set to 'n', we won't be able to build enlighten.c 
(xen_start_kernel() -> xen_acpi_sleep_register() refers to 
xen_acpi_notify_hypervisor_sleep()).

-boris

>   endmenu
> diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> index 2ccd359..f4622ab 100644
> --- a/drivers/xen/Makefile
> +++ b/drivers/xen/Makefile
> @@ -13,7 +13,7 @@ CFLAGS_efi.o				+= -fshort-wchar
>   
>   dom0-$(CONFIG_PCI) += pci.o
>   dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
> -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
> +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
>   xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
>   dom0-$(CONFIG_X86) += pcpu.o
>   obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
  2015-03-24 15:30     ` Boris Ostrovsky
  (?)
@ 2015-03-24 17:24       ` Stefano Stabellini
  -1 siblings, 0 replies; 142+ messages in thread
From: Stefano Stabellini @ 2015-03-24 17:24 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Hanjun Guo, Catalin Marinas, Rafael J. Wysocki, Will Deacon,
	Olof Johansson, Grant Likely, Lorenzo Pieralisi, Arnd Bergmann,
	Mark Rutland, Graeme Gregory, Sudeep Holla, Jon Masters,
	Marc Zyngier, Mark Brown, Robert Richter, Timur Tabi,
	Ashwin Chaugule, Suravee Suthikulpanit, Mark Salter, linux-acpi,
	linux-arm-kernel, linux-kernel, linaro-acpi, 'Stefano

On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > functional on ARM64.
> > 
> > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > CC: Julien Grall <julien.grall@linaro.org>
> > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > CC: David Vrabel <david.vrabel@citrix.com>
> > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > ---
> >   drivers/xen/Kconfig  | 4 ++++
> >   drivers/xen/Makefile | 2 +-
> >   2 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > index b812462..a31cd29 100644
> > --- a/drivers/xen/Kconfig
> > +++ b/drivers/xen/Kconfig
> > @@ -253,4 +253,8 @@ config XEN_EFI
> >   	def_bool y
> >   	depends on X86_64 && EFI
> >   +config XEN_ACPI
> > +	def_bool y
> > +	depends on X86 && ACPI
> > +
> 
> 
> I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> xen_acpi_notify_hypervisor_sleep()).
> 

I don't think that it is necessary: XEN_ACPI gets automatically enabled
anyway.


> >   endmenu
> > diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> > index 2ccd359..f4622ab 100644
> > --- a/drivers/xen/Makefile
> > +++ b/drivers/xen/Makefile
> > @@ -13,7 +13,7 @@ CFLAGS_efi.o				+=
> > -fshort-wchar
> >     dom0-$(CONFIG_PCI) += pci.o
> >   dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
> > -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
> > +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
> >   xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
> >   dom0-$(CONFIG_X86) += pcpu.o
> >   obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)
> 

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-24 17:24       ` Stefano Stabellini
  0 siblings, 0 replies; 142+ messages in thread
From: Stefano Stabellini @ 2015-03-24 17:24 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Hanjun Guo, Catalin Marinas, Rafael J. Wysocki, Will Deacon,
	Olof Johansson, Grant Likely, Lorenzo Pieralisi, Arnd Bergmann,
	Mark Rutland, Graeme Gregory, Sudeep Holla, Jon Masters,
	Marc Zyngier, Mark Brown, Robert Richter, Timur Tabi,
	Ashwin Chaugule, Suravee Suthikulpanit, Mark Salter, linux-acpi,
	linux-arm-kernel, linux-kernel, linaro-acpi,
	'Stefano Stabellini',
	Julien Grall, Konrad Rzeszutek Wilk, David Vrabel

On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > functional on ARM64.
> > 
> > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > CC: Julien Grall <julien.grall@linaro.org>
> > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > CC: David Vrabel <david.vrabel@citrix.com>
> > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > ---
> >   drivers/xen/Kconfig  | 4 ++++
> >   drivers/xen/Makefile | 2 +-
> >   2 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > index b812462..a31cd29 100644
> > --- a/drivers/xen/Kconfig
> > +++ b/drivers/xen/Kconfig
> > @@ -253,4 +253,8 @@ config XEN_EFI
> >   	def_bool y
> >   	depends on X86_64 && EFI
> >   +config XEN_ACPI
> > +	def_bool y
> > +	depends on X86 && ACPI
> > +
> 
> 
> I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> xen_acpi_notify_hypervisor_sleep()).
> 

I don't think that it is necessary: XEN_ACPI gets automatically enabled
anyway.


> >   endmenu
> > diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> > index 2ccd359..f4622ab 100644
> > --- a/drivers/xen/Makefile
> > +++ b/drivers/xen/Makefile
> > @@ -13,7 +13,7 @@ CFLAGS_efi.o				+=
> > -fshort-wchar
> >     dom0-$(CONFIG_PCI) += pci.o
> >   dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
> > -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
> > +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
> >   xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
> >   dom0-$(CONFIG_X86) += pcpu.o
> >   obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)
> 

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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-24 17:24       ` Stefano Stabellini
  0 siblings, 0 replies; 142+ messages in thread
From: Stefano Stabellini @ 2015-03-24 17:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > functional on ARM64.
> > 
> > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > CC: Julien Grall <julien.grall@linaro.org>
> > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > CC: David Vrabel <david.vrabel@citrix.com>
> > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > ---
> >   drivers/xen/Kconfig  | 4 ++++
> >   drivers/xen/Makefile | 2 +-
> >   2 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > index b812462..a31cd29 100644
> > --- a/drivers/xen/Kconfig
> > +++ b/drivers/xen/Kconfig
> > @@ -253,4 +253,8 @@ config XEN_EFI
> >   	def_bool y
> >   	depends on X86_64 && EFI
> >   +config XEN_ACPI
> > +	def_bool y
> > +	depends on X86 && ACPI
> > +
> 
> 
> I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> xen_acpi_notify_hypervisor_sleep()).
> 

I don't think that it is necessary: XEN_ACPI gets automatically enabled
anyway.


> >   endmenu
> > diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> > index 2ccd359..f4622ab 100644
> > --- a/drivers/xen/Makefile
> > +++ b/drivers/xen/Makefile
> > @@ -13,7 +13,7 @@ CFLAGS_efi.o				+=
> > -fshort-wchar
> >     dom0-$(CONFIG_PCI) += pci.o
> >   dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
> > -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
> > +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
> >   xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
> >   dom0-$(CONFIG_X86) += pcpu.o
> >   obj-$(CONFIG_XEN_DOM0)			+= $(dom0-y)
> 

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

* Re: [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-24 23:04   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 142+ messages in thread
From: Rafael J. Wysocki @ 2015-03-24 23:04 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Catalin Marinas, Will Deacon, Olof Johansson, Grant Likely,
	Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi

On Tuesday, March 24, 2015 10:02:33 PM Hanjun Guo wrote:
> Some fixes since last version:
> 
>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>    temporary solution.
>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
>    is passed", which will fix the problem that the device tree will
>    be unflattened even if acpi=force passed, that will not obey the
>    policy.
>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>    which will cause compile error on i386 with both DT and ACPI
>    enabled:
> 
>    All error/warnings:
> 
>     In file included from include/linux/acpi_irq.h:4:0,
>                      from drivers/irqchip/irqchip.c:11:
>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>             ^
>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
>     inside parameter list
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>                                                  ^
>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
>     definition or declaration, which is probably not what you want
>     ....
> 
>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>    and <linux/acpi_irq.h> will be put on the top of all head files,
>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>    <linux/irq.h>, it will include <linux/*.h> before include
>    <asm/irq.h>), this is the only update for this patch.
> 
> Lorenzo will send some cleanup patches on top of this one soon.
> 
> Thanks
> Hanjun
> 
> Al Stone (4):
>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>     ARM64
>   ARM64 / ACPI: additions of ACPI documentation for arm64
> 
> Graeme Gregory (6):
>   ACPI: add arm64 to the platforms that use ioremap
>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>   ARM64 / ACPI: Enable ARM64 in Kconfig
>   Documentation: ACPI for ARM64
> 
> Hanjun Guo (10):
>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>     scanning
>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>   ACPI / table: Print GIC information when MADT is parsed
>   ARM64 / ACPI: Parse MADT for SMP initialization
>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>   XEN / ACPI: Make XEN ACPI depend on X86
>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
> 
> Mark Salter (2):
>   ARM64: allow late use of early_ioremap
>   ACPI: fix acpi_os_ioremap for arm64
> 
> Tomasz Nowicki (1):
>   irqchip: Add GICv2 specific ACPI boot support

OK, so I don't think there's anything more I need to ACK in this series, so
it is now up to the maintainers of ARM64 and the other subsystems involved
to decide whether or not to apply it.

If you need to change any patches that I've already ACKed, please let me know,
but otherwise I'm not going to look at this series any more unless specifically
requested.


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

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

* [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-24 23:04   ` Rafael J. Wysocki
  0 siblings, 0 replies; 142+ messages in thread
From: Rafael J. Wysocki @ 2015-03-24 23:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday, March 24, 2015 10:02:33 PM Hanjun Guo wrote:
> Some fixes since last version:
> 
>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>    temporary solution.
>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
>    is passed", which will fix the problem that the device tree will
>    be unflattened even if acpi=force passed, that will not obey the
>    policy.
>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>    which will cause compile error on i386 with both DT and ACPI
>    enabled:
> 
>    All error/warnings:
> 
>     In file included from include/linux/acpi_irq.h:4:0,
>                      from drivers/irqchip/irqchip.c:11:
>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>             ^
>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
>     inside parameter list
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>                                                  ^
>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
>     definition or declaration, which is probably not what you want
>     ....
> 
>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>    and <linux/acpi_irq.h> will be put on the top of all head files,
>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>    <linux/irq.h>, it will include <linux/*.h> before include
>    <asm/irq.h>), this is the only update for this patch.
> 
> Lorenzo will send some cleanup patches on top of this one soon.
> 
> Thanks
> Hanjun
> 
> Al Stone (4):
>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>     ARM64
>   ARM64 / ACPI: additions of ACPI documentation for arm64
> 
> Graeme Gregory (6):
>   ACPI: add arm64 to the platforms that use ioremap
>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>   ARM64 / ACPI: Enable ARM64 in Kconfig
>   Documentation: ACPI for ARM64
> 
> Hanjun Guo (10):
>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>     scanning
>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>   ACPI / table: Print GIC information when MADT is parsed
>   ARM64 / ACPI: Parse MADT for SMP initialization
>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>   XEN / ACPI: Make XEN ACPI depend on X86
>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
> 
> Mark Salter (2):
>   ARM64: allow late use of early_ioremap
>   ACPI: fix acpi_os_ioremap for arm64
> 
> Tomasz Nowicki (1):
>   irqchip: Add GICv2 specific ACPI boot support

OK, so I don't think there's anything more I need to ACK in this series, so
it is now up to the maintainers of ARM64 and the other subsystems involved
to decide whether or not to apply it.

If you need to change any patches that I've already ACKed, please let me know,
but otherwise I'm not going to look at this series any more unless specifically
requested.


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

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

* Re: [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-25  3:53   ` Ming Lei
  -1 siblings, 0 replies; 142+ messages in thread
From: Ming Lei @ 2015-03-25  3:53 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	Grant Likely, Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi,
	Robert Richter, Arnd Bergmann, Graeme Gregory, linaro-acpi,
	Marc Zyngier, Jon Masters, Timur Tabi, Mark Salter,
	Linux Kernel Mailing List, Linux ACPI, Mark Brown,
	Suravee Suthikulpanit, Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02 PM, Hanjun Guo <hanjun.guo@linaro.org> wrote:
> Some fixes since last version:
>
>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>    temporary solution.
>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force
>    is passed", which will fix the problem that the device tree will
>    be unflattened even if acpi=force passed, that will not obey the
>    policy.
>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>    which will cause compile error on i386 with both DT and ACPI
>    enabled:
>
>    All error/warnings:
>
>     In file included from include/linux/acpi_irq.h:4:0,
>                      from drivers/irqchip/irqchip.c:11:
>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>             ^
>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared
>     inside parameter list
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>                                                  ^
>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this
>     definition or declaration, which is probably not what you want
>     ....
>
>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>    and <linux/acpi_irq.h> will be put on the top of all head files,
>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>    <linux/irq.h>, it will include <linux/*.h> before include
>    <asm/irq.h>), this is the only update for this patch.
>
> Lorenzo will send some cleanup patches on top of this one soon.
>
> Thanks
> Hanjun
>
> Al Stone (4):
>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>     ARM64
>   ARM64 / ACPI: additions of ACPI documentation for arm64
>
> Graeme Gregory (6):
>   ACPI: add arm64 to the platforms that use ioremap
>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>   ARM64 / ACPI: Enable ARM64 in Kconfig
>   Documentation: ACPI for ARM64
>
> Hanjun Guo (10):
>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>     scanning
>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>   ACPI / table: Print GIC information when MADT is parsed
>   ARM64 / ACPI: Parse MADT for SMP initialization
>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>   XEN / ACPI: Make XEN ACPI depend on X86
>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
>
> Mark Salter (2):
>   ARM64: allow late use of early_ioremap
>   ACPI: fix acpi_os_ioremap for arm64
>
> Tomasz Nowicki (1):
>   irqchip: Add GICv2 specific ACPI boot support


On APM mustang and qemu-system-aarch64 with 'acpi=force',

Tested-by: Ming Lei <ming.lei@canonical.com>


Thanks,

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

* [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-25  3:53   ` Ming Lei
  0 siblings, 0 replies; 142+ messages in thread
From: Ming Lei @ 2015-03-25  3:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02 PM, Hanjun Guo <hanjun.guo@linaro.org> wrote:
> Some fixes since last version:
>
>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>    temporary solution.
>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force
>    is passed", which will fix the problem that the device tree will
>    be unflattened even if acpi=force passed, that will not obey the
>    policy.
>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>    which will cause compile error on i386 with both DT and ACPI
>    enabled:
>
>    All error/warnings:
>
>     In file included from include/linux/acpi_irq.h:4:0,
>                      from drivers/irqchip/irqchip.c:11:
>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>             ^
>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared
>     inside parameter list
>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>                                                  ^
>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this
>     definition or declaration, which is probably not what you want
>     ....
>
>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>    and <linux/acpi_irq.h> will be put on the top of all head files,
>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>    <linux/irq.h>, it will include <linux/*.h> before include
>    <asm/irq.h>), this is the only update for this patch.
>
> Lorenzo will send some cleanup patches on top of this one soon.
>
> Thanks
> Hanjun
>
> Al Stone (4):
>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>     ARM64
>   ARM64 / ACPI: additions of ACPI documentation for arm64
>
> Graeme Gregory (6):
>   ACPI: add arm64 to the platforms that use ioremap
>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>   ARM64 / ACPI: Enable ARM64 in Kconfig
>   Documentation: ACPI for ARM64
>
> Hanjun Guo (10):
>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>     scanning
>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>   ACPI / table: Print GIC information when MADT is parsed
>   ARM64 / ACPI: Parse MADT for SMP initialization
>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>   XEN / ACPI: Make XEN ACPI depend on X86
>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
>
> Mark Salter (2):
>   ARM64: allow late use of early_ioremap
>   ACPI: fix acpi_os_ioremap for arm64
>
> Tomasz Nowicki (1):
>   irqchip: Add GICv2 specific ACPI boot support


On APM mustang and qemu-system-aarch64 with 'acpi=force',

Tested-by: Ming Lei <ming.lei@canonical.com>


Thanks,

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
  2015-03-24 17:24       ` Stefano Stabellini
  (?)
@ 2015-03-25 11:51         ` Will Deacon
  -1 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-25 11:51 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Boris Ostrovsky, hanjun.guo, Catalin Marinas, Rafael J. Wysocki,
	Olof Johansson, grant.likely, Lorenzo Pieralisi, Arnd Bergmann,
	Mark Rutland, graeme.gregory, Sudeep Holla, jcm, Marc Zyngier,
	Mark Brown, Robert Richter, Timur Tabi, Ashwin Chaugule,
	suravee.suthikulpanit, msalter, linux-acpi, linux-arm-kernel

Hi Stefano,

On Tue, Mar 24, 2015 at 05:24:53PM +0000, Stefano Stabellini wrote:
> On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> > On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > > functional on ARM64.
> > > 
> > > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > > CC: Julien Grall <julien.grall@linaro.org>
> > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > CC: David Vrabel <david.vrabel@citrix.com>
> > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > ---
> > >   drivers/xen/Kconfig  | 4 ++++
> > >   drivers/xen/Makefile | 2 +-
> > >   2 files changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > > index b812462..a31cd29 100644
> > > --- a/drivers/xen/Kconfig
> > > +++ b/drivers/xen/Kconfig
> > > @@ -253,4 +253,8 @@ config XEN_EFI
> > >   	def_bool y
> > >   	depends on X86_64 && EFI
> > >   +config XEN_ACPI
> > > +	def_bool y
> > > +	depends on X86 && ACPI
> > > +
> > 
> > 
> > I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> > Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> > (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> > xen_acpi_notify_hypervisor_sleep()).
> > 
> 
> I don't think that it is necessary: XEN_ACPI gets automatically enabled
> anyway.

In which case, can I have your Ack on this please?

Will

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-25 11:51         ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-25 11:51 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Boris Ostrovsky, hanjun.guo, Catalin Marinas, Rafael J. Wysocki,
	Olof Johansson, grant.likely, Lorenzo Pieralisi, Arnd Bergmann,
	Mark Rutland, graeme.gregory, Sudeep Holla, jcm, Marc Zyngier,
	Mark Brown, Robert Richter, Timur Tabi, Ashwin Chaugule,
	suravee.suthikulpanit, msalter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi, Julien Grall, Konrad Rzeszutek Wilk,
	David Vrabel

Hi Stefano,

On Tue, Mar 24, 2015 at 05:24:53PM +0000, Stefano Stabellini wrote:
> On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> > On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > > functional on ARM64.
> > > 
> > > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > > CC: Julien Grall <julien.grall@linaro.org>
> > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > CC: David Vrabel <david.vrabel@citrix.com>
> > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > ---
> > >   drivers/xen/Kconfig  | 4 ++++
> > >   drivers/xen/Makefile | 2 +-
> > >   2 files changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > > index b812462..a31cd29 100644
> > > --- a/drivers/xen/Kconfig
> > > +++ b/drivers/xen/Kconfig
> > > @@ -253,4 +253,8 @@ config XEN_EFI
> > >   	def_bool y
> > >   	depends on X86_64 && EFI
> > >   +config XEN_ACPI
> > > +	def_bool y
> > > +	depends on X86 && ACPI
> > > +
> > 
> > 
> > I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> > Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> > (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> > xen_acpi_notify_hypervisor_sleep()).
> > 
> 
> I don't think that it is necessary: XEN_ACPI gets automatically enabled
> anyway.

In which case, can I have your Ack on this please?

Will

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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-25 11:51         ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-25 11:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stefano,

On Tue, Mar 24, 2015 at 05:24:53PM +0000, Stefano Stabellini wrote:
> On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> > On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > > functional on ARM64.
> > > 
> > > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > > CC: Julien Grall <julien.grall@linaro.org>
> > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > CC: David Vrabel <david.vrabel@citrix.com>
> > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > ---
> > >   drivers/xen/Kconfig  | 4 ++++
> > >   drivers/xen/Makefile | 2 +-
> > >   2 files changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > > index b812462..a31cd29 100644
> > > --- a/drivers/xen/Kconfig
> > > +++ b/drivers/xen/Kconfig
> > > @@ -253,4 +253,8 @@ config XEN_EFI
> > >   	def_bool y
> > >   	depends on X86_64 && EFI
> > >   +config XEN_ACPI
> > > +	def_bool y
> > > +	depends on X86 && ACPI
> > > +
> > 
> > 
> > I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> > Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> > (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> > xen_acpi_notify_hypervisor_sleep()).
> > 
> 
> I don't think that it is necessary: XEN_ACPI gets automatically enabled
> anyway.

In which case, can I have your Ack on this please?

Will

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

* Re: [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
  2015-03-24 23:04   ` Rafael J. Wysocki
  (?)
@ 2015-03-25 12:55     ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-25 12:55 UTC (permalink / raw)
  To: Rafael J. Wysocki, Hanjun Guo
  Cc: Catalin Marinas, Will Deacon, Olof Johansson, Grant Likely,
	Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi

On 2015/3/25 7:04, Rafael J. Wysocki wrote:
> On Tuesday, March 24, 2015 10:02:33 PM Hanjun Guo wrote:
>> Some fixes since last version:
>>
>>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>>    temporary solution.
>>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
>>    is passed", which will fix the problem that the device tree will
>>    be unflattened even if acpi=force passed, that will not obey the
>>    policy.
>>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>>    which will cause compile error on i386 with both DT and ACPI
>>    enabled:
>>
>>    All error/warnings:
>>
>>     In file included from include/linux/acpi_irq.h:4:0,
>>                      from drivers/irqchip/irqchip.c:11:
>>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>>             ^
>>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
>>     inside parameter list
>>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>>                                                  ^
>>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
>>     definition or declaration, which is probably not what you want
>>     ....
>>
>>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>>    and <linux/acpi_irq.h> will be put on the top of all head files,
>>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>>    <linux/irq.h>, it will include <linux/*.h> before include
>>    <asm/irq.h>), this is the only update for this patch.
>>
>> Lorenzo will send some cleanup patches on top of this one soon.
>>
>> Thanks
>> Hanjun
>>
>> Al Stone (4):
>>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>>     ARM64
>>   ARM64 / ACPI: additions of ACPI documentation for arm64
>>
>> Graeme Gregory (6):
>>   ACPI: add arm64 to the platforms that use ioremap
>>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>>   ARM64 / ACPI: Enable ARM64 in Kconfig
>>   Documentation: ACPI for ARM64
>>
>> Hanjun Guo (10):
>>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>>     scanning
>>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>>   ACPI / table: Print GIC information when MADT is parsed
>>   ARM64 / ACPI: Parse MADT for SMP initialization
>>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>>   XEN / ACPI: Make XEN ACPI depend on X86
>>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
>>
>> Mark Salter (2):
>>   ARM64: allow late use of early_ioremap
>>   ACPI: fix acpi_os_ioremap for arm64
>>
>> Tomasz Nowicki (1):
>>   irqchip: Add GICv2 specific ACPI boot support
> OK, so I don't think there's anything more I need to ACK in this series, so
> it is now up to the maintainers of ARM64 and the other subsystems involved
> to decide whether or not to apply it.
>
> If you need to change any patches that I've already ACKed, please let me know,
> but otherwise I'm not going to look at this series any more unless specifically
> requested.

OK, thank you very much!

Hanjun


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

* Re: [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-25 12:55     ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-25 12:55 UTC (permalink / raw)
  To: Rafael J. Wysocki, Hanjun Guo
  Cc: Catalin Marinas, Will Deacon, Olof Johansson, Grant Likely,
	Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Timur Tabi, Ashwin Chaugule,
	Suravee Suthikulpanit, Mark Salter, linux-acpi, linux-arm-kernel,
	linux-kernel, linaro-acpi

On 2015/3/25 7:04, Rafael J. Wysocki wrote:
> On Tuesday, March 24, 2015 10:02:33 PM Hanjun Guo wrote:
>> Some fixes since last version:
>>
>>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>>    temporary solution.
>>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
>>    is passed", which will fix the problem that the device tree will
>>    be unflattened even if acpi=force passed, that will not obey the
>>    policy.
>>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>>    which will cause compile error on i386 with both DT and ACPI
>>    enabled:
>>
>>    All error/warnings:
>>
>>     In file included from include/linux/acpi_irq.h:4:0,
>>                      from drivers/irqchip/irqchip.c:11:
>>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>>             ^
>>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
>>     inside parameter list
>>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>>                                                  ^
>>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
>>     definition or declaration, which is probably not what you want
>>     ....
>>
>>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>>    and <linux/acpi_irq.h> will be put on the top of all head files,
>>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>>    <linux/irq.h>, it will include <linux/*.h> before include
>>    <asm/irq.h>), this is the only update for this patch.
>>
>> Lorenzo will send some cleanup patches on top of this one soon.
>>
>> Thanks
>> Hanjun
>>
>> Al Stone (4):
>>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>>     ARM64
>>   ARM64 / ACPI: additions of ACPI documentation for arm64
>>
>> Graeme Gregory (6):
>>   ACPI: add arm64 to the platforms that use ioremap
>>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>>   ARM64 / ACPI: Enable ARM64 in Kconfig
>>   Documentation: ACPI for ARM64
>>
>> Hanjun Guo (10):
>>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>>     scanning
>>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>>   ACPI / table: Print GIC information when MADT is parsed
>>   ARM64 / ACPI: Parse MADT for SMP initialization
>>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>>   XEN / ACPI: Make XEN ACPI depend on X86
>>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
>>
>> Mark Salter (2):
>>   ARM64: allow late use of early_ioremap
>>   ACPI: fix acpi_os_ioremap for arm64
>>
>> Tomasz Nowicki (1):
>>   irqchip: Add GICv2 specific ACPI boot support
> OK, so I don't think there's anything more I need to ACK in this series, so
> it is now up to the maintainers of ARM64 and the other subsystems involved
> to decide whether or not to apply it.
>
> If you need to change any patches that I've already ACKed, please let me know,
> but otherwise I'm not going to look at this series any more unless specifically
> requested.

OK, thank you very much!

Hanjun


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

* [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-25 12:55     ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-25 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/3/25 7:04, Rafael J. Wysocki wrote:
> On Tuesday, March 24, 2015 10:02:33 PM Hanjun Guo wrote:
>> Some fixes since last version:
>>
>>  - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>>    compile errors on XEN ACPI, Stefano and Julien are ok with this
>>    temporary solution.
>>  - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force 
>>    is passed", which will fix the problem that the device tree will
>>    be unflattened even if acpi=force passed, that will not obey the
>>    policy.
>>  - update patch "irqchip: Add GICv2 specific ACPI boot support",
>>    which will cause compile error on i386 with both DT and ACPI
>>    enabled:
>>
>>    All error/warnings:
>>
>>     In file included from include/linux/acpi_irq.h:4:0,
>>                      from drivers/irqchip/irqchip.c:11:
>>     arch/x86/include/asm/irq.h:35:8: error: unknown type name 'bool'
>>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>>             ^
>>     arch/x86/include/asm/irq.h:35:45: warning: 'struct pt_regs' declared 
>>     inside parameter list
>>      extern bool handle_irq(unsigned irq, struct pt_regs *regs);
>>                                                  ^
>>     arch/x86/include/asm/irq.h:35:45: warning: its scope is only this 
>>     definition or declaration, which is probably not what you want
>>     ....
>>
>>    That's because of I include the <asm/irq.h> in <linux/acpi_irq.h>,
>>    and <linux/acpi_irq.h> will be put on the top of all head files,
>>    so use <linux/irq.h> instead of <asm/irq.h> in acpi_irq.h (in
>>    <linux/irq.h>, it will include <linux/*.h> before include
>>    <asm/irq.h>), this is the only update for this patch.
>>
>> Lorenzo will send some cleanup patches on top of this one soon.
>>
>> Thanks
>> Hanjun
>>
>> Al Stone (4):
>>   ARM64 / ACPI: Get RSDP and ACPI boot-time tables
>>   ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
>>   ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on
>>     ARM64
>>   ARM64 / ACPI: additions of ACPI documentation for arm64
>>
>> Graeme Gregory (6):
>>   ACPI: add arm64 to the platforms that use ioremap
>>   ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
>>   ARM64 / ACPI: If we chose to boot from acpi then disable FDT
>>   ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
>>   ARM64 / ACPI: Enable ARM64 in Kconfig
>>   Documentation: ACPI for ARM64
>>
>> Hanjun Guo (10):
>>   ACPI / table: Use pr_debug() instead of pr_info() for MADT table
>>     scanning
>>   ARM64 / ACPI: Introduce PCI stub functions for ACPI
>>   ACPI / table: Print GIC information when MADT is parsed
>>   ARM64 / ACPI: Parse MADT for SMP initialization
>>   ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
>>   ACPI / processor: Make it possible to get CPU hardware ID via GICC
>>   ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
>>   clocksource / arch_timer: Parse GTDT to initialize arch timer
>>   XEN / ACPI: Make XEN ACPI depend on X86
>>   ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
>>
>> Mark Salter (2):
>>   ARM64: allow late use of early_ioremap
>>   ACPI: fix acpi_os_ioremap for arm64
>>
>> Tomasz Nowicki (1):
>>   irqchip: Add GICv2 specific ACPI boot support
> OK, so I don't think there's anything more I need to ACK in this series, so
> it is now up to the maintainers of ARM64 and the other subsystems involved
> to decide whether or not to apply it.
>
> If you need to change any patches that I've already ACKed, please let me know,
> but otherwise I'm not going to look at this series any more unless specifically
> requested.

OK, thank you very much!

Hanjun

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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
  2015-03-25 11:51         ` Will Deacon
  (?)
@ 2015-03-25 15:38           ` Stefano Stabellini
  -1 siblings, 0 replies; 142+ messages in thread
From: Stefano Stabellini @ 2015-03-25 15:38 UTC (permalink / raw)
  To: Will Deacon
  Cc: Stefano Stabellini, Boris Ostrovsky, hanjun.guo, Catalin Marinas,
	Rafael J. Wysocki, Olof Johansson, grant.likely,
	Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, graeme.gregory,
	Sudeep Holla, jcm, Marc Zyngier, Mark Brown, Robert Richter,
	Timur Tabi, Ashwin Chaugule, suravee.suthikulpanit, msalter,
	linux-acpi

On Wed, 25 Mar 2015, Will Deacon wrote:
> Hi Stefano,
> 
> On Tue, Mar 24, 2015 at 05:24:53PM +0000, Stefano Stabellini wrote:
> > On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> > > On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > > > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > > > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > > > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > > > functional on ARM64.
> > > > 
> > > > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > > > CC: Julien Grall <julien.grall@linaro.org>
> > > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > > CC: David Vrabel <david.vrabel@citrix.com>
> > > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > > ---
> > > >   drivers/xen/Kconfig  | 4 ++++
> > > >   drivers/xen/Makefile | 2 +-
> > > >   2 files changed, 5 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > > > index b812462..a31cd29 100644
> > > > --- a/drivers/xen/Kconfig
> > > > +++ b/drivers/xen/Kconfig
> > > > @@ -253,4 +253,8 @@ config XEN_EFI
> > > >   	def_bool y
> > > >   	depends on X86_64 && EFI
> > > >   +config XEN_ACPI
> > > > +	def_bool y
> > > > +	depends on X86 && ACPI
> > > > +
> > > 
> > > 
> > > I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> > > Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> > > (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> > > xen_acpi_notify_hypervisor_sleep()).
> > > 
> > 
> > I don't think that it is necessary: XEN_ACPI gets automatically enabled
> > anyway.
> 
> In which case, can I have your Ack on this please?

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


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

* Re: [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-25 15:38           ` Stefano Stabellini
  0 siblings, 0 replies; 142+ messages in thread
From: Stefano Stabellini @ 2015-03-25 15:38 UTC (permalink / raw)
  To: Will Deacon
  Cc: Stefano Stabellini, Boris Ostrovsky, hanjun.guo, Catalin Marinas,
	Rafael J. Wysocki, Olof Johansson, grant.likely,
	Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, graeme.gregory,
	Sudeep Holla, jcm, Marc Zyngier, Mark Brown, Robert Richter,
	Timur Tabi, Ashwin Chaugule, suravee.suthikulpanit, msalter,
	linux-acpi, linux-arm-kernel, linux-kernel, linaro-acpi,
	Julien Grall, Konrad Rzeszutek Wilk, David Vrabel

On Wed, 25 Mar 2015, Will Deacon wrote:
> Hi Stefano,
> 
> On Tue, Mar 24, 2015 at 05:24:53PM +0000, Stefano Stabellini wrote:
> > On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> > > On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > > > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > > > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > > > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > > > functional on ARM64.
> > > > 
> > > > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > > > CC: Julien Grall <julien.grall@linaro.org>
> > > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > > CC: David Vrabel <david.vrabel@citrix.com>
> > > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > > ---
> > > >   drivers/xen/Kconfig  | 4 ++++
> > > >   drivers/xen/Makefile | 2 +-
> > > >   2 files changed, 5 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > > > index b812462..a31cd29 100644
> > > > --- a/drivers/xen/Kconfig
> > > > +++ b/drivers/xen/Kconfig
> > > > @@ -253,4 +253,8 @@ config XEN_EFI
> > > >   	def_bool y
> > > >   	depends on X86_64 && EFI
> > > >   +config XEN_ACPI
> > > > +	def_bool y
> > > > +	depends on X86 && ACPI
> > > > +
> > > 
> > > 
> > > I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> > > Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> > > (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> > > xen_acpi_notify_hypervisor_sleep()).
> > > 
> > 
> > I don't think that it is necessary: XEN_ACPI gets automatically enabled
> > anyway.
> 
> In which case, can I have your Ack on this please?

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


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

* [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86
@ 2015-03-25 15:38           ` Stefano Stabellini
  0 siblings, 0 replies; 142+ messages in thread
From: Stefano Stabellini @ 2015-03-25 15:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 25 Mar 2015, Will Deacon wrote:
> Hi Stefano,
> 
> On Tue, Mar 24, 2015 at 05:24:53PM +0000, Stefano Stabellini wrote:
> > On Tue, 24 Mar 2015, Boris Ostrovsky wrote:
> > > On 03/24/2015 10:02 AM, Hanjun Guo wrote:
> > > > When ACPI is enabled on ARM64, XEN ACPI will also compiled
> > > > into the kernel, but XEN ACPI is x86 dependent, so introduce
> > > > CONFIG_XEN_ACPI to make it depend on x86 before XEN ACPI is
> > > > functional on ARM64.
> > > > 
> > > > CC: 'Stefano Stabellini' <stefano.stabellini@eu.citrix.com>
> > > > CC: Julien Grall <julien.grall@linaro.org>
> > > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > > CC: David Vrabel <david.vrabel@citrix.com>
> > > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > > ---
> > > >   drivers/xen/Kconfig  | 4 ++++
> > > >   drivers/xen/Makefile | 2 +-
> > > >   2 files changed, 5 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> > > > index b812462..a31cd29 100644
> > > > --- a/drivers/xen/Kconfig
> > > > +++ b/drivers/xen/Kconfig
> > > > @@ -253,4 +253,8 @@ config XEN_EFI
> > > >   	def_bool y
> > > >   	depends on X86_64 && EFI
> > > >   +config XEN_ACPI
> > > > +	def_bool y
> > > > +	depends on X86 && ACPI
> > > > +
> > > 
> > > 
> > > I think XEN_DOM0 (in arch/x86/xen/Kconfig) should select this option.
> > > Otherwise, if it is set to 'n', we won't be able to build enlighten.c
> > > (xen_start_kernel() -> xen_acpi_sleep_register() refers to
> > > xen_acpi_notify_hypervisor_sleep()).
> > > 
> > 
> > I don't think that it is necessary: XEN_ACPI gets automatically enabled
> > anyway.
> 
> In which case, can I have your Ack on this please?

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

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

* Re: [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 16:43     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:43 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, linaro-acpi, Will Deacon, Lorenzo Pieralisi,
	Al Stone, Timur Tabi, linux-acpi, Mark Salter, Grant Likely,
	Robert Richter, Arnd Bergmann, Marc Zyngier, Jon Masters,
	Mark Brown, linux-arm-kernel, Graeme Gregory, Ashwin Chaugule,
	Rafael J. Wysocki, linux-kernel, Suravee Suthikulpanit,
	Sudeep Holla, Olof Johansson

On Tue, Mar 24, 2015 at 10:02:35PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Now with the base changes to the arm memory mapping it is safe
> to convert to using ioremap to map in the tables after
> acpi_gbl_permanent_mmap is set.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Another long flight, so I'm adding some acks (unless Will merged these
patches already).

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap
@ 2015-03-25 16:43     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:43 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, Al Stone,
	linux-acpi, Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:35PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Now with the base changes to the arm memory mapping it is safe
> to convert to using ioremap to map in the tables after
> acpi_gbl_permanent_mmap is set.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Another long flight, so I'm adding some acks (unless Will merged these
patches already).

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap
@ 2015-03-25 16:43     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:35PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Now with the base changes to the arm memory mapping it is safe
> to convert to using ioremap to map in the tables after
> acpi_gbl_permanent_mmap is set.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Another long flight, so I'm adding some acks (unless Will merged these
patches already).

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 03/23] ARM64: allow late use of early_ioremap
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 16:43     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:43 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Leif Lindholm, Ard Biesheuvel, linux-acpi, Mark Brown,
	Suravee Suthikulpanit, Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:36PM +0800, Hanjun Guo wrote:
> From: Mark Salter <msalter@redhat.com>
> 
> Commit 0e63ea48b4d8 (arm64/efi: add missing call to early_ioremap_reset())
> added a missing call to early_ioremap_reset(). This triggers a BUG if code
> tries using early_ioremap() after the early_ioremap_reset(). This is a
> problem for some ACPI code which needs short-lived temporary mappings
> after paging_init() but before acpi_early_init() in start_kernel(). This
> patch adds definitions for the __late_set_fixmap() and __late_clear_fixmap()
> which avoids the BUG by allowing later use of early_ioremap().
> 
> CC: Leif Lindholm <leif.lindholm@linaro.org>
> CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* [patch v11 03/23] ARM64: allow late use of early_ioremap
@ 2015-03-25 16:43     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:36PM +0800, Hanjun Guo wrote:
> From: Mark Salter <msalter@redhat.com>
> 
> Commit 0e63ea48b4d8 (arm64/efi: add missing call to early_ioremap_reset())
> added a missing call to early_ioremap_reset(). This triggers a BUG if code
> tries using early_ioremap() after the early_ioremap_reset(). This is a
> problem for some ACPI code which needs short-lived temporary mappings
> after paging_init() but before acpi_early_init() in start_kernel(). This
> patch adds definitions for the __late_set_fixmap() and __late_clear_fixmap()
> which avoids the BUG by allowing later use of early_ioremap().
> 
> CC: Leif Lindholm <leif.lindholm@linaro.org>
> CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 04/23] ARM64 / ACPI: Get RSDP and ACPI boot-time tables
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 16:44     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:44 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Tomasz Nowicki, Al Stone, linux-acpi, Mark Brown,
	Suravee Suthikulpanit, Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:37PM +0800, Hanjun Guo wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> As we want to get ACPI tables to parse and then use the information
> for system initialization, we should get the RSDP (Root System
> Description Pointer) first, it then locates Extended Root Description
> Table (XSDT) which contains all the 64-bit physical address that
> pointer to other boot-time tables.
> 
> Introduce acpi.c and its related head file in this patch to provide
> fundamental needs of extern variables and functions for ACPI core,
> and then get boot-time tables as needed.
>   - asm/acenv.h for arch specific ACPICA environments and
>     implementation, It is needed unconditionally by ACPI core;
>   - asm/acpi.h for arch specific variables and functions needed by
>     ACPI driver core;
>   - acpi.c for ARM64 related ACPI implementation for ACPI driver
>     core;
> 
> acpi_boot_table_init() is introduced to get RSDP and boot-time tables,
> it will be called in setup_arch() before paging_init(), so we should
> use eary_memremap() mechanism here to get the RSDP and all the table
> pointers.
> 
> FADT Major.Minor version was introduced in ACPI 5.1, it is the same
> as ACPI version.
> 
> In ACPI 5.1, some major gaps are fixed for ARM, such as updates in
> MADT table for GIC and SMP init, without those updates, we can not
> get the MPIDR for SMP init, and GICv2/3 related init information, so
> we can't boot arm64 ACPI properly with table versions predating 5.1.
> 
> If firmware provides ACPI tables with ACPI version less than 5.1,
> OS has no way to retrieve the configuration data that is necessary
> to init SMP boot protocol and the GIC properly, so disable ACPI if
> we get an FADT table with version less that 5.1 when acpi_boot_table_init()
> called.
> 
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 04/23] ARM64 / ACPI: Get RSDP and ACPI boot-time tables
@ 2015-03-25 16:44     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:37PM +0800, Hanjun Guo wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> As we want to get ACPI tables to parse and then use the information
> for system initialization, we should get the RSDP (Root System
> Description Pointer) first, it then locates Extended Root Description
> Table (XSDT) which contains all the 64-bit physical address that
> pointer to other boot-time tables.
> 
> Introduce acpi.c and its related head file in this patch to provide
> fundamental needs of extern variables and functions for ACPI core,
> and then get boot-time tables as needed.
>   - asm/acenv.h for arch specific ACPICA environments and
>     implementation, It is needed unconditionally by ACPI core;
>   - asm/acpi.h for arch specific variables and functions needed by
>     ACPI driver core;
>   - acpi.c for ARM64 related ACPI implementation for ACPI driver
>     core;
> 
> acpi_boot_table_init() is introduced to get RSDP and boot-time tables,
> it will be called in setup_arch() before paging_init(), so we should
> use eary_memremap() mechanism here to get the RSDP and all the table
> pointers.
> 
> FADT Major.Minor version was introduced in ACPI 5.1, it is the same
> as ACPI version.
> 
> In ACPI 5.1, some major gaps are fixed for ARM, such as updates in
> MADT table for GIC and SMP init, without those updates, we can not
> get the MPIDR for SMP init, and GICv2/3 related init information, so
> we can't boot arm64 ACPI properly with table versions predating 5.1.
> 
> If firmware provides ACPI tables with ACPI version less than 5.1,
> OS has no way to retrieve the configuration data that is necessary
> to init SMP boot protocol and the GIC properly, so disable ACPI if
> we get an FADT table with version less that 5.1 when acpi_boot_table_init()
> called.
> 
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 16:50     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:50 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, Lorenzo Pieralisi, Robert Richter, Arnd Bergmann,
	Ashwin Chaugule, linaro-acpi, Marc Zyngier, Rafael J. Wysocki,
	Timur Tabi, Mark Salter, Will Deacon, linux-kernel, Sudeep Holla,
	Grant Likely, Mark Brown, Suravee Suthikulpanit, Jon Masters,
	Olof Johansson, Graeme Gregory, linux-acpi, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:38PM +0800, Hanjun Guo wrote:
> From: Mark Salter <msalter@redhat.com>
> 
> The acpi_os_ioremap() function may be used to map normal RAM or IO
> regions. The current implementation simply uses ioremap_cache(). This
> will work for some architectures, but arm64 ioremap_cache() cannot be
> used to map IO regions which don't support caching. So for arm64, use
> ioremap() for non-RAM regions.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64
@ 2015-03-25 16:50     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:50 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, linux-acpi,
	Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:38PM +0800, Hanjun Guo wrote:
> From: Mark Salter <msalter@redhat.com>
> 
> The acpi_os_ioremap() function may be used to map normal RAM or IO
> regions. The current implementation simply uses ioremap_cache(). This
> will work for some architectures, but arm64 ioremap_cache() cannot be
> used to map IO regions which don't support caching. So for arm64, use
> ioremap() for non-RAM regions.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64
@ 2015-03-25 16:50     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:38PM +0800, Hanjun Guo wrote:
> From: Mark Salter <msalter@redhat.com>
> 
> The acpi_os_ioremap() function may be used to map normal RAM or IO
> regions. The current implementation simply uses ioremap_cache(). This
> will work for some architectures, but arm64 ioremap_cache() cannot be
> used to map IO regions which don't support caching. So for arm64, use
> ioremap() for non-RAM regions.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 07/23] ARM64 / ACPI: Introduce PCI stub functions for ACPI
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 16:50     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:50 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, Liviu Dudau, linux-kernel,
	linux-acpi, Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:40PM +0800, Hanjun Guo wrote:
> CONFIG_ACPI depends CONFIG_PCI on x86 and ia64, in ARM64 server
> world we will have PCIe in most cases, but some of them may not,
> make CONFIG_ACPI depend CONFIG_PCI on ARM64 will satisfy both.
> 
> With that case, we need some arch dependent PCI functions to
> access the config space before the PCI root bridge is created, and
> pci_acpi_scan_root() to create the PCI root bus. So introduce
> some stub function here to make ACPI core compile and revisit
> them later when implemented on ARM64.
> 
> CC: Liviu Dudau <Liviu.Dudau@arm.com>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* [patch v11 07/23] ARM64 / ACPI: Introduce PCI stub functions for ACPI
@ 2015-03-25 16:50     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:40PM +0800, Hanjun Guo wrote:
> CONFIG_ACPI depends CONFIG_PCI on x86 and ia64, in ARM64 server
> world we will have PCIe in most cases, but some of them may not,
> make CONFIG_ACPI depend CONFIG_PCI on ARM64 will satisfy both.
> 
> With that case, we need some arch dependent PCI functions to
> access the config space before the PCI root bridge is created, and
> pci_acpi_scan_root() to create the PCI root bus. So introduce
> some stub function here to make ACPI core compile and revisit
> them later when implemented on ARM64.
> 
> CC: Liviu Dudau <Liviu.Dudau@arm.com>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 08/23] ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 16:57     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:57 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, Al Stone,
	Ard Biesheuvel, linux-acpi, Mark Brown, Suravee Suthikulpanit,
	Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:41PM +0800, Hanjun Guo wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> This implements the following policy to decide whether ACPI should
> be used to boot the system:
> - acpi=off: ACPI will not be used to boot the system, even if there is
>   no alternative available (e.g., device tree is empty)
> - acpi=force: only ACPI will be used to boot the system; if that fails,
>   there will be no fallback to alternative methods (such as device tree)
> - otherwise, ACPI will be used as a fallback if the device tree turns out
>   to lack a platform description; the heuristic to decide this is whether
>   /chosen is the only node present at depth 1
> 
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

But we should also merge Lorenzo's patch which gets read of the forced
param (on top of this series, I really think we should stop rebasing at
this point).

-- 
Catalin

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

* [patch v11 08/23] ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI
@ 2015-03-25 16:57     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:41PM +0800, Hanjun Guo wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> This implements the following policy to decide whether ACPI should
> be used to boot the system:
> - acpi=off: ACPI will not be used to boot the system, even if there is
>   no alternative available (e.g., device tree is empty)
> - acpi=force: only ACPI will be used to boot the system; if that fails,
>   there will be no fallback to alternative methods (such as device tree)
> - otherwise, ACPI will be used as a fallback if the device tree turns out
>   to lack a platform description; the heuristic to decide this is whether
>   /chosen is the only node present at depth 1
> 
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

But we should also merge Lorenzo's patch which gets read of the forced
param (on top of this series, I really think we should stop rebasing at
this point).

-- 
Catalin

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

* Re: [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 17:00     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:00 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, linux-acpi,
	Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:42PM +0800, Hanjun Guo wrote:
> If the early boot methods of acpi are happy that we have valid ACPI
> tables and acpi=force has been passed, then do not unflat devicetree
> effectively disabling further hardware probing from DT.
[...]
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
>  
>  	early_ioremap_reset();
>  
> -	unflatten_device_tree();
> +	if (acpi_disabled)
> +		unflatten_device_tree();

So if we have acpi=force but the acpi failed, do we have acpi_disabled
set? Or this requires Lorenzo's patch?

-- 
Catalin


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

* [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
@ 2015-03-25 17:00     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:42PM +0800, Hanjun Guo wrote:
> If the early boot methods of acpi are happy that we have valid ACPI
> tables and acpi=force has been passed, then do not unflat devicetree
> effectively disabling further hardware probing from DT.
[...]
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
>  
>  	early_ioremap_reset();
>  
> -	unflatten_device_tree();
> +	if (acpi_disabled)
> +		unflatten_device_tree();

So if we have acpi=force but the acpi failed, do we have acpi_disabled
set? Or this requires Lorenzo's patch?

-- 
Catalin

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

* Re: [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 17:01     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:01 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, linaro-acpi, Will Deacon, Lorenzo Pieralisi,
	Timur Tabi, linux-acpi, Mark Salter, Grant Likely,
	Robert Richter, Arnd Bergmann, Marc Zyngier, Jon Masters,
	Tomasz Nowicki, Mark Brown, linux-arm-kernel, Graeme Gregory,
	Ashwin Chaugule, Rafael J. Wysocki, linux-kernel,
	Suravee Suthikulpanit, Sudeep Holla, Olof Johansson

On Tue, Mar 24, 2015 at 10:02:43PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set,
> the former signals to the OS that the firmware is PSCI compliant.
> The latter selects the appropriate conduit for PSCI calls by
> toggling between Hypervisor Calls (HVC) and Secure Monitor Calls
> (SMC).
> 
> FADT table contains such information in ACPI 5.1, FADT table was
> parsed in ACPI table init and copy to struct acpi_gbl_FADT, so
> use the flags in struct acpi_gbl_FADT for PSCI init.
> 
> Since ACPI 5.1 doesn't support self defined PSCI function IDs,
> which means that only PSCI 0.2+ is supported in ACPI.
> 
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
@ 2015-03-25 17:01     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:01 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Tomasz Nowicki, linux-acpi, Mark Brown, Suravee Suthikulpanit,
	Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:43PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set,
> the former signals to the OS that the firmware is PSCI compliant.
> The latter selects the appropriate conduit for PSCI calls by
> toggling between Hypervisor Calls (HVC) and Secure Monitor Calls
> (SMC).
> 
> FADT table contains such information in ACPI 5.1, FADT table was
> parsed in ACPI table init and copy to struct acpi_gbl_FADT, so
> use the flags in struct acpi_gbl_FADT for PSCI init.
> 
> Since ACPI 5.1 doesn't support self defined PSCI function IDs,
> which means that only PSCI 0.2+ is supported in ACPI.
> 
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init
@ 2015-03-25 17:01     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:43PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set,
> the former signals to the OS that the firmware is PSCI compliant.
> The latter selects the appropriate conduit for PSCI calls by
> toggling between Hypervisor Calls (HVC) and Secure Monitor Calls
> (SMC).
> 
> FADT table contains such information in ACPI 5.1, FADT table was
> parsed in ACPI table init and copy to struct acpi_gbl_FADT, so
> use the flags in struct acpi_gbl_FADT for PSCI init.
> 
> Since ACPI 5.1 doesn't support self defined PSCI function IDs,
> which means that only PSCI 0.2+ is supported in ACPI.
> 
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Olof Johansson <olof@lixom.net>
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 17:17     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:17 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, linaro-acpi, Will Deacon, Lorenzo Pieralisi,
	Timur Tabi, linux-acpi, Mark Salter, Grant Likely,
	Robert Richter, Arnd Bergmann, Marc Zyngier, Jon Masters,
	Tomasz Nowicki, Mark Brown, linux-arm-kernel, Graeme Gregory,
	Ashwin Chaugule, Rafael J. Wysocki, linux-kernel,
	Suravee Suthikulpanit, Sudeep Holla, Olof Johansson

On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
> +/**
> + * acpi_map_gic_cpu_interface - generates a logical cpu number
> + * and map to MPIDR represented by GICC structure
> + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
> + * @enabled: this cpu is enabled or not
> + *
> + * Returns the logical cpu number which maps to MPIDR
> + */
> +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)

So here we have an u8 enabled.

> +static int __init
> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> +				const unsigned long end)
> +{
> +	struct acpi_madt_generic_interrupt *processor;
> +
> +	processor = (struct acpi_madt_generic_interrupt *)header;
> +
> +	if (BAD_MADT_ENTRY(processor, end))
> +		return -EINVAL;
> +
> +	acpi_table_print_madt_entry(header);
> +
> +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> +		processor->flags & ACPI_MADT_ENABLED);

and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
don't lose any information. So either make the enabled above a bool or
simply pass the flags with the check in acpi_map_gic_cpu_interface()
(personal preference for the latter).

Apart from this:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-25 17:17     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:17 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Tomasz Nowicki, linux-acpi, Mark Brown, Suravee Suthikulpanit,
	Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
> +/**
> + * acpi_map_gic_cpu_interface - generates a logical cpu number
> + * and map to MPIDR represented by GICC structure
> + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
> + * @enabled: this cpu is enabled or not
> + *
> + * Returns the logical cpu number which maps to MPIDR
> + */
> +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)

So here we have an u8 enabled.

> +static int __init
> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> +				const unsigned long end)
> +{
> +	struct acpi_madt_generic_interrupt *processor;
> +
> +	processor = (struct acpi_madt_generic_interrupt *)header;
> +
> +	if (BAD_MADT_ENTRY(processor, end))
> +		return -EINVAL;
> +
> +	acpi_table_print_madt_entry(header);
> +
> +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> +		processor->flags & ACPI_MADT_ENABLED);

and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
don't lose any information. So either make the enabled above a bool or
simply pass the flags with the check in acpi_map_gic_cpu_interface()
(personal preference for the latter).

Apart from this:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-25 17:17     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
> +/**
> + * acpi_map_gic_cpu_interface - generates a logical cpu number
> + * and map to MPIDR represented by GICC structure
> + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
> + * @enabled: this cpu is enabled or not
> + *
> + * Returns the logical cpu number which maps to MPIDR
> + */
> +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)

So here we have an u8 enabled.

> +static int __init
> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> +				const unsigned long end)
> +{
> +	struct acpi_madt_generic_interrupt *processor;
> +
> +	processor = (struct acpi_madt_generic_interrupt *)header;
> +
> +	if (BAD_MADT_ENTRY(processor, end))
> +		return -EINVAL;
> +
> +	acpi_table_print_madt_entry(header);
> +
> +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> +		processor->flags & ACPI_MADT_ENABLED);

and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
don't lose any information. So either make the enabled above a bool or
simply pass the flags with the check in acpi_map_gic_cpu_interface()
(personal preference for the latter).

Apart from this:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 17:21     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:21 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, Lorenzo Pieralisi, Robert Richter, Arnd Bergmann,
	Ashwin Chaugule, linaro-acpi, Marc Zyngier, Rafael J. Wysocki,
	Timur Tabi, Mark Salter, Will Deacon, linux-kernel, Sudeep Holla,
	Grant Likely, Mark Brown, Suravee Suthikulpanit, Jon Masters,
	Olof Johansson, Graeme Gregory, linux-acpi, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
> but phys_id is used as int in acpi processor driver, so it will lead to
> some inconsistence for the drivers.
> 
> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
> ids a generic CPU physical id type is required.
> 
> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
> by other archs, this will solve the inconsistence in acpi processor driver,
> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
> in the following patch.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> [hj: reworked cpu physid map return codes]
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

BTW, am I still the author of this patch? If yes, it's missing a From:
line.

> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>  	acpi_status status;
>  	int ret;
>  
> -	if (pr->phys_id == -1)
> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>  		return -ENODEV;

If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
the latter in the arm64 code (as a subsequent clean-up patch).

-- 
Catalin

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-25 17:21     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:21 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, linux-acpi,
	Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
> but phys_id is used as int in acpi processor driver, so it will lead to
> some inconsistence for the drivers.
> 
> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
> ids a generic CPU physical id type is required.
> 
> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
> by other archs, this will solve the inconsistence in acpi processor driver,
> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
> in the following patch.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> [hj: reworked cpu physid map return codes]
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

BTW, am I still the author of this patch? If yes, it's missing a From:
line.

> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>  	acpi_status status;
>  	int ret;
>  
> -	if (pr->phys_id == -1)
> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>  		return -ENODEV;

If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
the latter in the arm64 code (as a subsequent clean-up patch).

-- 
Catalin


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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-25 17:21     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
> but phys_id is used as int in acpi processor driver, so it will lead to
> some inconsistence for the drivers.
> 
> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
> ids a generic CPU physical id type is required.
> 
> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
> by other archs, this will solve the inconsistence in acpi processor driver,
> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
> in the following patch.
> 
> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> [hj: reworked cpu physid map return codes]
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

BTW, am I still the author of this patch? If yes, it's missing a From:
line.

> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>  	acpi_status status;
>  	int ret;
>  
> -	if (pr->phys_id == -1)
> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>  		return -ENODEV;

If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
the latter in the arm64 code (as a subsequent clean-up patch).

-- 
Catalin

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

* Re: [patch v11 14/23] ACPI / processor: Make it possible to get CPU hardware ID via GICC
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 17:25     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:25 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, linux-acpi,
	Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:47PM +0800, Hanjun Guo wrote:
> Introduce a new function map_gicc_mpidr() to allow MPIDRs to be obtained
> from the GICC Structure introduced by ACPI 5.1, since MPIDR for ARM64 is
> 64-bit, so typedef u64 for phys_cpuid_t.
> 
> The ARM architecture defines the MPIDR register as the CPU hardware
> identifier. This patch adds the code infrastructure to retrieve the MPIDR
> values from the ARM ACPI GICC structure in order to look-up the kernel CPU
> hardware ids required by the ACPI core code to identify CPUs.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  arch/arm64/include/asm/acpi.h | 12 ++++++++++++
>  drivers/acpi/processor_core.c | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 42 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
> index 9719921..eea0bc3 100644
> --- a/arch/arm64/include/asm/acpi.h
> +++ b/arch/arm64/include/asm/acpi.h
> @@ -13,6 +13,8 @@
>  #define _ASM_ACPI_H
>  
>  #include <linux/mm.h>
> +#include <asm/cputype.h>
> +#include <asm/smp_plat.h>
>  
>  /* Basic configuration for ACPI */
>  #ifdef	CONFIG_ACPI
> @@ -27,6 +29,9 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
>  }
>  #define acpi_os_ioremap acpi_os_ioremap
>  
> +typedef u64 phys_cpuid_t;
> +#define PHYS_CPUID_INVALID INVALID_HWID
> +

This should have been defined in the previous patch (though it defaults
to -1, so not too bad).

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* [patch v11 14/23] ACPI / processor: Make it possible to get CPU hardware ID via GICC
@ 2015-03-25 17:25     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:47PM +0800, Hanjun Guo wrote:
> Introduce a new function map_gicc_mpidr() to allow MPIDRs to be obtained
> from the GICC Structure introduced by ACPI 5.1, since MPIDR for ARM64 is
> 64-bit, so typedef u64 for phys_cpuid_t.
> 
> The ARM architecture defines the MPIDR register as the CPU hardware
> identifier. This patch adds the code infrastructure to retrieve the MPIDR
> values from the ARM ACPI GICC structure in order to look-up the kernel CPU
> hardware ids required by the ACPI core code to identify CPUs.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  arch/arm64/include/asm/acpi.h | 12 ++++++++++++
>  drivers/acpi/processor_core.c | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 42 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
> index 9719921..eea0bc3 100644
> --- a/arch/arm64/include/asm/acpi.h
> +++ b/arch/arm64/include/asm/acpi.h
> @@ -13,6 +13,8 @@
>  #define _ASM_ACPI_H
>  
>  #include <linux/mm.h>
> +#include <asm/cputype.h>
> +#include <asm/smp_plat.h>
>  
>  /* Basic configuration for ACPI */
>  #ifdef	CONFIG_ACPI
> @@ -27,6 +29,9 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
>  }
>  #define acpi_os_ioremap acpi_os_ioremap
>  
> +typedef u64 phys_cpuid_t;
> +#define PHYS_CPUID_INVALID INVALID_HWID
> +

This should have been defined in the previous patch (though it defaults
to -1, so not too bad).

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 17:27     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:27 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, linaro-acpi, Will Deacon, Lorenzo Pieralisi,
	Timur Tabi, linux-acpi, Mark Salter, Grant Likely,
	Robert Richter, Jason Cooper, Arnd Bergmann, Marc Zyngier,
	Jon Masters, Tomasz Nowicki, Mark Brown, Thomas Gleixner,
	linux-arm-kernel, Graeme Gregory, Ashwin Chaugule,
	Rafael J. Wysocki, linux-kernel, Suravee Suthikulpanit,
	Sudeep Holla, Olof Johansson

On Tue, Mar 24, 2015 at 10:02:49PM +0800, Hanjun Guo wrote:
> From: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> 
> ACPI kernel uses MADT table for proper GIC initialization. It needs to
> parse GIC related subtables, collect CPU interface and distributor
> addresses and call driver initialization function (which is hardware
> abstraction agnostic). In a similar way, FDT initialize GICv1/2.
> 
> NOTE: This commit allow to initialize GICv1/2 basic functionality.
> While now simple GICv2 init call is used, any further GIC features
> require generic infrastructure for proper ACPI irqchip initialization.
> That mechanism and stacked irqdomains to support GICv2 MSI/virtualization
> extension, GICv3/4 and its ITS are considered as next steps.
> 
> CC: Jason Cooper <jason@lakedaemon.net>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support
@ 2015-03-25 17:27     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:27 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Tomasz Nowicki, linux-acpi, Mark Brown, Suravee Suthikulpanit,
	Sudeep Holla, Thomas Gleixner, linux-arm-kernel, Jason Cooper

On Tue, Mar 24, 2015 at 10:02:49PM +0800, Hanjun Guo wrote:
> From: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> 
> ACPI kernel uses MADT table for proper GIC initialization. It needs to
> parse GIC related subtables, collect CPU interface and distributor
> addresses and call driver initialization function (which is hardware
> abstraction agnostic). In a similar way, FDT initialize GICv1/2.
> 
> NOTE: This commit allow to initialize GICv1/2 basic functionality.
> While now simple GICv2 init call is used, any further GIC features
> require generic infrastructure for proper ACPI irqchip initialization.
> That mechanism and stacked irqdomains to support GICv2 MSI/virtualization
> extension, GICv3/4 and its ITS are considered as next steps.
> 
> CC: Jason Cooper <jason@lakedaemon.net>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support
@ 2015-03-25 17:27     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:49PM +0800, Hanjun Guo wrote:
> From: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> 
> ACPI kernel uses MADT table for proper GIC initialization. It needs to
> parse GIC related subtables, collect CPU interface and distributor
> addresses and call driver initialization function (which is hardware
> abstraction agnostic). In a similar way, FDT initialize GICv1/2.
> 
> NOTE: This commit allow to initialize GICv1/2 basic functionality.
> While now simple GICv2 init call is used, any further GIC features
> require generic infrastructure for proper ACPI irqchip initialization.
> That mechanism and stacked irqdomains to support GICv2 MSI/virtualization
> extension, GICv3/4 and its ITS are considered as next steps.
> 
> CC: Jason Cooper <jason@lakedaemon.net>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 17/23] clocksource / arch_timer: Parse GTDT to initialize arch timer
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 17:28     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:28 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Daniel Lezcano, linux-acpi, Mark Brown, Suravee Suthikulpanit,
	Sudeep Holla, Thomas Gleixner, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:50PM +0800, Hanjun Guo wrote:
> Using the information presented by GTDT (Generic Timer Description Table)
> to initialize the arch timer (not memory-mapped).
> 
> CC: Daniel Lezcano <daniel.lezcano@linaro.org>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Originally-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* [patch v11 17/23] clocksource / arch_timer: Parse GTDT to initialize arch timer
@ 2015-03-25 17:28     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:50PM +0800, Hanjun Guo wrote:
> Using the information presented by GTDT (Generic Timer Description Table)
> to initialize the arch timer (not memory-mapped).
> 
> CC: Daniel Lezcano <daniel.lezcano@linaro.org>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Originally-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 18/23] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 17:29     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:29 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, Al Stone,
	linux-acpi, Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:51PM +0800, Hanjun Guo wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> ACPI reduced hardware mode is disabled by default, but ARM64
> can only run properly in ACPI hardware reduced mode, so select
> ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64.
> 
> If the firmware is not using hardware reduced ACPI mode, we
> will disable ACPI to avoid nightmare such as accessing some
> registers which are not available on ARM64.
> 
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 18/23] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64
@ 2015-03-25 17:29     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:51PM +0800, Hanjun Guo wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> ACPI reduced hardware mode is disabled by default, but ARM64
> can only run properly in ACPI hardware reduced mode, so select
> ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64.
> 
> If the firmware is not using hardware reduced ACPI mode, we
> will disable ACPI to avoid nightmare such as accessing some
> registers which are not available on ARM64.
> 
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 20/23] ARM64 / ACPI: Enable ARM64 in Kconfig
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 17:29     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:29 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, Al Stone,
	linux-acpi, Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:53PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Add Kconfigs to build ACPI on ARM64, and make ACPI available on ARM64.
> 
> acpi_idle driver is x86/IA64 dependent now, so make CONFIG_ACPI_PROCESSOR
> depend on X86 || IA64, and implement it on ARM64 in the future.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


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

* [patch v11 20/23] ARM64 / ACPI: Enable ARM64 in Kconfig
@ 2015-03-25 17:29     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:53PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Add Kconfigs to build ACPI on ARM64, and make ACPI available on ARM64.
> 
> acpi_idle driver is x86/IA64 dependent now, so make CONFIG_ACPI_PROCESSOR
> depend on X86 || IA64, and implement it on ARM64 in the future.
> 
> CC: Rafael J. Wysocki <rjw@rjwysocki.net>
> CC: Catalin Marinas <catalin.marinas@arm.com>
> CC: Will Deacon <will.deacon@arm.com>
> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Tested-by: Yijing Wang <wangyijing@huawei.com>
> Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
> Tested-by: Jon Masters <jcm@redhat.com>
> Tested-by: Timur Tabi <timur@codeaurora.org>
> Tested-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 21/23] Documentation: ACPI for ARM64
  2015-03-24 14:02   ` Hanjun Guo
@ 2015-03-25 17:30     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:30 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel, Al Stone,
	linux-acpi, Mark Brown, Suravee Suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:54PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Add documentation for the guidelines of how to use ACPI
> on ARM64.
> 
> Reviewed-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Reviewed-by: Yi Li <phoenix.liyi@huawei.com>
> Reviewed-by: Mark Langsdorf <mlangsdo@redhat.com>
> Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* [patch v11 21/23] Documentation: ACPI for ARM64
@ 2015-03-25 17:30     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:54PM +0800, Hanjun Guo wrote:
> From: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Add documentation for the guidelines of how to use ACPI
> on ARM64.
> 
> Reviewed-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Reviewed-by: Yi Li <phoenix.liyi@huawei.com>
> Reviewed-by: Mark Langsdorf <mlangsdo@redhat.com>
> Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org>
> Acked-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> Signed-off-by: Al Stone <al.stone@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
  2015-03-24 14:02   ` Hanjun Guo
  (?)
@ 2015-03-25 17:31     ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:31 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Mark Rutland, linaro-acpi, Will Deacon, Lorenzo Pieralisi,
	Timur Tabi, linux-acpi, Mark Salter, Grant Likely,
	Robert Richter, Arnd Bergmann, Marc Zyngier, Jon Masters,
	Mark Brown, linux-arm-kernel, Graeme Gregory, Ashwin Chaugule,
	Ard Biesheuvel, Rafael J. Wysocki, linux-kernel,
	Suravee Suthikulpanit, Sudeep Holla, Olof Johansson

On Tue, Mar 24, 2015 at 10:02:56PM +0800, Hanjun Guo wrote:
> Since the policy is that once we pass acpi=force in the early
> param, we will not unflatten device tree even if ACPI is disabled
> in ACPI table init fails, so fix the code by comparinging both
> acpi_disabled and param_acpi_force before the device tree is
> unflattened.
> 
> CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

but as I said, we should take Lorenzo's patch on top as well.

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

* Re: [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
@ 2015-03-25 17:31     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:31 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Will Deacon, Olof Johansson, Grant Likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Graeme Gregory, linaro-acpi, Marc Zyngier,
	Jon Masters, Timur Tabi, Mark Salter, linux-kernel,
	Ard Biesheuvel, linux-acpi, Mark Brown, Suravee Suthikulpanit,
	Sudeep Holla, linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:56PM +0800, Hanjun Guo wrote:
> Since the policy is that once we pass acpi=force in the early
> param, we will not unflatten device tree even if ACPI is disabled
> in ACPI table init fails, so fix the code by comparinging both
> acpi_disabled and param_acpi_force before the device tree is
> unflattened.
> 
> CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

but as I said, we should take Lorenzo's patch on top as well.


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

* [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
@ 2015-03-25 17:31     ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-25 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 24, 2015 at 10:02:56PM +0800, Hanjun Guo wrote:
> Since the policy is that once we pass acpi=force in the early
> param, we will not unflatten device tree even if ACPI is disabled
> in ACPI table init fails, so fix the code by comparinging both
> acpi_disabled and param_acpi_force before the device tree is
> unflattened.
> 
> CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

but as I said, we should take Lorenzo's patch on top as well.

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-25 17:21     ` Catalin Marinas
  (?)
@ 2015-03-26  3:49       ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26  3:49 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki
  Cc: Hanjun Guo, Mark Rutland, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Ashwin Chaugule, linaro-acpi, Marc Zyngier,
	Timur Tabi, Mark Salter, Will Deacon, linux-kernel, Sudeep Holla,
	Grant Likely, Mark Brown, Suravee Suthikulpanit, Jon Masters,
	Olof Johansson, Graeme Gregory, linux-acpi, linux-arm-kernel

On 2015/3/26 1:21, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
>> but phys_id is used as int in acpi processor driver, so it will lead to
>> some inconsistence for the drivers.
>>
>> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
>> ids a generic CPU physical id type is required.
>>
>> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
>> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
>> by other archs, this will solve the inconsistence in acpi processor driver,
>> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
>> in the following patch.
>>
>> CC: Rafael J Wysocki <rjw@rjwysocki.net>
>> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Reviewed-by: Grant Likely <grant.likely@linaro.org>
>> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
>> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>> [hj: reworked cpu physid map return codes]
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> BTW, am I still the author of this patch? If yes, it's missing a From:
> line.

Oops, you should be the author, can Will fix this in his tree?

>
>> --- a/drivers/acpi/acpi_processor.c
>> +++ b/drivers/acpi/acpi_processor.c
>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>  	acpi_status status;
>>  	int ret;
>>  
>> -	if (pr->phys_id == -1)
>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>  		return -ENODEV;
> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
> the latter in the arm64 code (as a subsequent clean-up patch).

OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.

Thanks
Hanjun
>



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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-26  3:49       ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26  3:49 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki
  Cc: Hanjun Guo, Mark Rutland, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Ashwin Chaugule, linaro-acpi, Marc Zyngier,
	Timur Tabi, Mark Salter, Will Deacon, linux-kernel, Sudeep Holla,
	Grant Likely, Mark Brown, Suravee Suthikulpanit, Jon Masters,
	Olof Johansson, Graeme Gregory, linux-acpi, linux-arm-kernel

On 2015/3/26 1:21, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
>> but phys_id is used as int in acpi processor driver, so it will lead to
>> some inconsistence for the drivers.
>>
>> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
>> ids a generic CPU physical id type is required.
>>
>> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
>> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
>> by other archs, this will solve the inconsistence in acpi processor driver,
>> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
>> in the following patch.
>>
>> CC: Rafael J Wysocki <rjw@rjwysocki.net>
>> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Reviewed-by: Grant Likely <grant.likely@linaro.org>
>> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
>> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>> [hj: reworked cpu physid map return codes]
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> BTW, am I still the author of this patch? If yes, it's missing a From:
> line.

Oops, you should be the author, can Will fix this in his tree?

>
>> --- a/drivers/acpi/acpi_processor.c
>> +++ b/drivers/acpi/acpi_processor.c
>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>  	acpi_status status;
>>  	int ret;
>>  
>> -	if (pr->phys_id == -1)
>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>  		return -ENODEV;
> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
> the latter in the arm64 code (as a subsequent clean-up patch).

OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.

Thanks
Hanjun
>



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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-26  3:49       ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26  3:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/3/26 1:21, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
>> but phys_id is used as int in acpi processor driver, so it will lead to
>> some inconsistence for the drivers.
>>
>> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
>> ids a generic CPU physical id type is required.
>>
>> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
>> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
>> by other archs, this will solve the inconsistence in acpi processor driver,
>> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
>> in the following patch.
>>
>> CC: Rafael J Wysocki <rjw@rjwysocki.net>
>> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Reviewed-by: Grant Likely <grant.likely@linaro.org>
>> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
>> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>> [hj: reworked cpu physid map return codes]
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> BTW, am I still the author of this patch? If yes, it's missing a From:
> line.

Oops, you should be the author, can Will fix this in his tree?

>
>> --- a/drivers/acpi/acpi_processor.c
>> +++ b/drivers/acpi/acpi_processor.c
>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>  	acpi_status status;
>>  	int ret;
>>  
>> -	if (pr->phys_id == -1)
>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>  		return -ENODEV;
> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
> the latter in the arm64 code (as a subsequent clean-up patch).

OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.

Thanks
Hanjun
>

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

* Re: [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
  2015-03-25 17:00     ` Catalin Marinas
  (?)
@ 2015-03-26 10:57       ` Lorenzo Pieralisi
  -1 siblings, 0 replies; 142+ messages in thread
From: Lorenzo Pieralisi @ 2015-03-26 10:57 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: hanjun.guo, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	grant.likely, Mark Rutland, Ashwin Chaugule, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, linux-acpi, Mark Brown,
	suravee.suthikulpanit, Sudeep Holla

On Wed, Mar 25, 2015 at 05:00:27PM +0000, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:42PM +0800, Hanjun Guo wrote:
> > If the early boot methods of acpi are happy that we have valid ACPI
> > tables and acpi=force has been passed, then do not unflat devicetree
> > effectively disabling further hardware probing from DT.
> [...]
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
> >  
> >  	early_ioremap_reset();
> >  
> > -	unflatten_device_tree();
> > +	if (acpi_disabled)
> > +		unflatten_device_tree();
> 
> So if we have acpi=force but the acpi failed, do we have acpi_disabled
> set? Or this requires Lorenzo's patch?

Hanjun did not squash with this patch a later patch in the series that
caters for that, I reverted it and added my change on top to make things
simpler, it is all done.

Lorenzo

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

* Re: [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
@ 2015-03-26 10:57       ` Lorenzo Pieralisi
  0 siblings, 0 replies; 142+ messages in thread
From: Lorenzo Pieralisi @ 2015-03-26 10:57 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: hanjun.guo, Rafael J. Wysocki, Will Deacon, Olof Johansson,
	grant.likely, Mark Rutland, Ashwin Chaugule, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, linux-acpi, Mark Brown,
	suravee.suthikulpanit, Sudeep Holla, linux-arm-kernel

On Wed, Mar 25, 2015 at 05:00:27PM +0000, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:42PM +0800, Hanjun Guo wrote:
> > If the early boot methods of acpi are happy that we have valid ACPI
> > tables and acpi=force has been passed, then do not unflat devicetree
> > effectively disabling further hardware probing from DT.
> [...]
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
> >  
> >  	early_ioremap_reset();
> >  
> > -	unflatten_device_tree();
> > +	if (acpi_disabled)
> > +		unflatten_device_tree();
> 
> So if we have acpi=force but the acpi failed, do we have acpi_disabled
> set? Or this requires Lorenzo's patch?

Hanjun did not squash with this patch a later patch in the series that
caters for that, I reverted it and added my change on top to make things
simpler, it is all done.

Lorenzo

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

* [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT
@ 2015-03-26 10:57       ` Lorenzo Pieralisi
  0 siblings, 0 replies; 142+ messages in thread
From: Lorenzo Pieralisi @ 2015-03-26 10:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 25, 2015 at 05:00:27PM +0000, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:42PM +0800, Hanjun Guo wrote:
> > If the early boot methods of acpi are happy that we have valid ACPI
> > tables and acpi=force has been passed, then do not unflat devicetree
> > effectively disabling further hardware probing from DT.
> [...]
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -390,7 +390,8 @@ void __init setup_arch(char **cmdline_p)
> >  
> >  	early_ioremap_reset();
> >  
> > -	unflatten_device_tree();
> > +	if (acpi_disabled)
> > +		unflatten_device_tree();
> 
> So if we have acpi=force but the acpi failed, do we have acpi_disabled
> set? Or this requires Lorenzo's patch?

Hanjun did not squash with this patch a later patch in the series that
caters for that, I reverted it and added my change on top to make things
simpler, it is all done.

Lorenzo

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-26  3:49       ` Hanjun Guo
  (?)
@ 2015-03-26 15:13         ` Will Deacon
  -1 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 15:13 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Catalin Marinas, Rafael J. Wysocki, hanjun.guo, Mark Rutland,
	Lorenzo Pieralisi, Robert Richter, Arnd Bergmann,
	Ashwin Chaugule, linaro-acpi, Marc Zyngier, Timur Tabi, msalter,
	linux-kernel, Sudeep Holla, grant.likely, Mark Brown,
	suravee.suthikulpanit, jcm, Olof Johansson, graeme.gregory

On Thu, Mar 26, 2015 at 03:49:33AM +0000, Hanjun Guo wrote:
> On 2015/3/26 1:21, Catalin Marinas wrote:
> > On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> >> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
> >> but phys_id is used as int in acpi processor driver, so it will lead to
> >> some inconsistence for the drivers.
> >>
> >> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
> >> ids a generic CPU physical id type is required.
> >>
> >> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
> >> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
> >> by other archs, this will solve the inconsistence in acpi processor driver,
> >> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
> >> in the following patch.
> >>
> >> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> >> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> >> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> >> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> >> [hj: reworked cpu physid map return codes]
> >> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > BTW, am I still the author of this patch? If yes, it's missing a From:
> > line.
> 
> Oops, you should be the author, can Will fix this in his tree?

Fixed.

Will

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-26 15:13         ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 15:13 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Catalin Marinas, Rafael J. Wysocki, hanjun.guo, Mark Rutland,
	Lorenzo Pieralisi, Robert Richter, Arnd Bergmann,
	Ashwin Chaugule, linaro-acpi, Marc Zyngier, Timur Tabi, msalter,
	linux-kernel, Sudeep Holla, grant.likely, Mark Brown,
	suravee.suthikulpanit, jcm, Olof Johansson, graeme.gregory,
	linux-acpi, linux-arm-kernel

On Thu, Mar 26, 2015 at 03:49:33AM +0000, Hanjun Guo wrote:
> On 2015/3/26 1:21, Catalin Marinas wrote:
> > On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> >> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
> >> but phys_id is used as int in acpi processor driver, so it will lead to
> >> some inconsistence for the drivers.
> >>
> >> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
> >> ids a generic CPU physical id type is required.
> >>
> >> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
> >> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
> >> by other archs, this will solve the inconsistence in acpi processor driver,
> >> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
> >> in the following patch.
> >>
> >> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> >> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> >> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> >> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> >> [hj: reworked cpu physid map return codes]
> >> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > BTW, am I still the author of this patch? If yes, it's missing a From:
> > line.
> 
> Oops, you should be the author, can Will fix this in his tree?

Fixed.

Will

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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-26 15:13         ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 26, 2015 at 03:49:33AM +0000, Hanjun Guo wrote:
> On 2015/3/26 1:21, Catalin Marinas wrote:
> > On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> >> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
> >> but phys_id is used as int in acpi processor driver, so it will lead to
> >> some inconsistence for the drivers.
> >>
> >> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
> >> ids a generic CPU physical id type is required.
> >>
> >> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
> >> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
> >> by other archs, this will solve the inconsistence in acpi processor driver,
> >> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
> >> in the following patch.
> >>
> >> CC: Rafael J Wysocki <rjw@rjwysocki.net>
> >> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> Reviewed-by: Grant Likely <grant.likely@linaro.org>
> >> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> >> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> >> [hj: reworked cpu physid map return codes]
> >> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > BTW, am I still the author of this patch? If yes, it's missing a From:
> > line.
> 
> Oops, you should be the author, can Will fix this in his tree?

Fixed.

Will

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
  2015-03-25 17:17     ` Catalin Marinas
  (?)
@ 2015-03-26 15:15       ` Will Deacon
  -1 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 15:15 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: hanjun.guo, Rafael J. Wysocki, Olof Johansson, grant.likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit@amd.com

On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
> > +/**
> > + * acpi_map_gic_cpu_interface - generates a logical cpu number
> > + * and map to MPIDR represented by GICC structure
> > + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
> > + * @enabled: this cpu is enabled or not
> > + *
> > + * Returns the logical cpu number which maps to MPIDR
> > + */
> > +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> 
> So here we have an u8 enabled.
> 
> > +static int __init
> > +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> > +				const unsigned long end)
> > +{
> > +	struct acpi_madt_generic_interrupt *processor;
> > +
> > +	processor = (struct acpi_madt_generic_interrupt *)header;
> > +
> > +	if (BAD_MADT_ENTRY(processor, end))
> > +		return -EINVAL;
> > +
> > +	acpi_table_print_madt_entry(header);
> > +
> > +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > +		processor->flags & ACPI_MADT_ENABLED);
> 
> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
> don't lose any information. So either make the enabled above a bool or
> simply pass the flags with the check in acpi_map_gic_cpu_interface()
> (personal preference for the latter).

I've applied the following patch on top of the series.

Will

--->8

commit 8ef320319592693f4a6286d80df210fd47b3e356
Author: Will Deacon <will.deacon@arm.com>
Date:   Thu Mar 26 15:09:20 2015 +0000

    ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
    
    acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
    passing a 32-bit value in the u8 enabled parameter and then subsequently
    ignoring its return value.
    
    Sort it out.
    
    Reported-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index cd60329da8c4..07649e413244 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
  *
  * Returns the logical cpu number which maps to MPIDR
  */
-static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
+static int __init
+acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 {
 	int i;
+	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
+	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
 
 	if (mpidr == INVALID_HWID) {
 		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
@@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
-
-	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
-		processor->flags & ACPI_MADT_ENABLED);
-
-	return 0;
+	return acpi_map_gic_cpu_interface(processor);
 }
 
 /* Parse GIC cpu interface entries in MADT for SMP init */

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 15:15       ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 15:15 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: hanjun.guo, Rafael J. Wysocki, Olof Johansson, grant.likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
> > +/**
> > + * acpi_map_gic_cpu_interface - generates a logical cpu number
> > + * and map to MPIDR represented by GICC structure
> > + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
> > + * @enabled: this cpu is enabled or not
> > + *
> > + * Returns the logical cpu number which maps to MPIDR
> > + */
> > +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> 
> So here we have an u8 enabled.
> 
> > +static int __init
> > +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> > +				const unsigned long end)
> > +{
> > +	struct acpi_madt_generic_interrupt *processor;
> > +
> > +	processor = (struct acpi_madt_generic_interrupt *)header;
> > +
> > +	if (BAD_MADT_ENTRY(processor, end))
> > +		return -EINVAL;
> > +
> > +	acpi_table_print_madt_entry(header);
> > +
> > +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > +		processor->flags & ACPI_MADT_ENABLED);
> 
> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
> don't lose any information. So either make the enabled above a bool or
> simply pass the flags with the check in acpi_map_gic_cpu_interface()
> (personal preference for the latter).

I've applied the following patch on top of the series.

Will

--->8

commit 8ef320319592693f4a6286d80df210fd47b3e356
Author: Will Deacon <will.deacon@arm.com>
Date:   Thu Mar 26 15:09:20 2015 +0000

    ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
    
    acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
    passing a 32-bit value in the u8 enabled parameter and then subsequently
    ignoring its return value.
    
    Sort it out.
    
    Reported-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index cd60329da8c4..07649e413244 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
  *
  * Returns the logical cpu number which maps to MPIDR
  */
-static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
+static int __init
+acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 {
 	int i;
+	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
+	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
 
 	if (mpidr == INVALID_HWID) {
 		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
@@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
-
-	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
-		processor->flags & ACPI_MADT_ENABLED);
-
-	return 0;
+	return acpi_map_gic_cpu_interface(processor);
 }
 
 /* Parse GIC cpu interface entries in MADT for SMP init */

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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 15:15       ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 15:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
> > +/**
> > + * acpi_map_gic_cpu_interface - generates a logical cpu number
> > + * and map to MPIDR represented by GICC structure
> > + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
> > + * @enabled: this cpu is enabled or not
> > + *
> > + * Returns the logical cpu number which maps to MPIDR
> > + */
> > +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> 
> So here we have an u8 enabled.
> 
> > +static int __init
> > +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> > +				const unsigned long end)
> > +{
> > +	struct acpi_madt_generic_interrupt *processor;
> > +
> > +	processor = (struct acpi_madt_generic_interrupt *)header;
> > +
> > +	if (BAD_MADT_ENTRY(processor, end))
> > +		return -EINVAL;
> > +
> > +	acpi_table_print_madt_entry(header);
> > +
> > +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > +		processor->flags & ACPI_MADT_ENABLED);
> 
> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
> don't lose any information. So either make the enabled above a bool or
> simply pass the flags with the check in acpi_map_gic_cpu_interface()
> (personal preference for the latter).

I've applied the following patch on top of the series.

Will

--->8

commit 8ef320319592693f4a6286d80df210fd47b3e356
Author: Will Deacon <will.deacon@arm.com>
Date:   Thu Mar 26 15:09:20 2015 +0000

    ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
    
    acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
    passing a 32-bit value in the u8 enabled parameter and then subsequently
    ignoring its return value.
    
    Sort it out.
    
    Reported-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index cd60329da8c4..07649e413244 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
  *
  * Returns the logical cpu number which maps to MPIDR
  */
-static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
+static int __init
+acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 {
 	int i;
+	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
+	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
 
 	if (mpidr == INVALID_HWID) {
 		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
@@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
-
-	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
-		processor->flags & ACPI_MADT_ENABLED);
-
-	return 0;
+	return acpi_map_gic_cpu_interface(processor);
 }
 
 /* Parse GIC cpu interface entries in MADT for SMP init */

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
  2015-03-26 15:15       ` Will Deacon
  (?)
@ 2015-03-26 19:48         ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26 19:48 UTC (permalink / raw)
  To: Will Deacon, Catalin Marinas
  Cc: Rafael J. Wysocki, Olof Johansson, grant.likely, Mark Rutland,
	Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit, Sudeep Holla

On 2015年03月26日 23:15, Will Deacon wrote:
> On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
>>> +/**
>>> + * acpi_map_gic_cpu_interface - generates a logical cpu number
>>> + * and map to MPIDR represented by GICC structure
>>> + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
>>> + * @enabled: this cpu is enabled or not
>>> + *
>>> + * Returns the logical cpu number which maps to MPIDR
>>> + */
>>> +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>
>> So here we have an u8 enabled.
>>
>>> +static int __init
>>> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>> +				const unsigned long end)
>>> +{
>>> +	struct acpi_madt_generic_interrupt *processor;
>>> +
>>> +	processor = (struct acpi_madt_generic_interrupt *)header;
>>> +
>>> +	if (BAD_MADT_ENTRY(processor, end))
>>> +		return -EINVAL;
>>> +
>>> +	acpi_table_print_madt_entry(header);
>>> +
>>> +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> +		processor->flags & ACPI_MADT_ENABLED);
>>
>> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
>> don't lose any information. So either make the enabled above a bool or
>> simply pass the flags with the check in acpi_map_gic_cpu_interface()
>> (personal preference for the latter).
>
> I've applied the following patch on top of the series.
>
> Will
>
> --->8
>
> commit 8ef320319592693f4a6286d80df210fd47b3e356
> Author: Will Deacon <will.deacon@arm.com>
> Date:   Thu Mar 26 15:09:20 2015 +0000
>
>      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
>
>      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
>      passing a 32-bit value in the u8 enabled parameter and then subsequently
>      ignoring its return value.
>
>      Sort it out.
>
>      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
>      Signed-off-by: Will Deacon <will.deacon@arm.com>
>
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index cd60329da8c4..07649e413244 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
>    *
>    * Returns the logical cpu number which maps to MPIDR
>    */
> -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> +static int __init
> +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)

How about just replace u8 with u32? This function has its purpose to
be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
ACPI handle, then pass it to the arch specific mapping function
to map the physcal cpu ID with logical cpu ID for the new added
CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
need to go back to that solution.

>   {
>   	int i;
> +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>
>   	if (mpidr == INVALID_HWID) {
>   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>   		return -EINVAL;
>
>   	acpi_table_print_madt_entry(header);
> -
> -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> -		processor->flags & ACPI_MADT_ENABLED);
> -
> -	return 0;
> +	return acpi_map_gic_cpu_interface(processor);

I don't think we need to return the error value here, in ACPI
core, it will stop the MADT scanning once it returned the error
value, but actually we can skip some disabled GICC (cpu) entries
and find all the enabled ones in MADT, for example,

cpu0 entry, with flag enabled
cpu1 entry, disabled  - if we return the error value, table scanning
                         will stop
cpu2 entry, enabled   - and this cpu will be ignored

Thanks
Hanjun

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 19:48         ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26 19:48 UTC (permalink / raw)
  To: Will Deacon, Catalin Marinas
  Cc: Rafael J. Wysocki, Olof Johansson, grant.likely, Mark Rutland,
	Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On 2015年03月26日 23:15, Will Deacon wrote:
> On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
>>> +/**
>>> + * acpi_map_gic_cpu_interface - generates a logical cpu number
>>> + * and map to MPIDR represented by GICC structure
>>> + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
>>> + * @enabled: this cpu is enabled or not
>>> + *
>>> + * Returns the logical cpu number which maps to MPIDR
>>> + */
>>> +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>
>> So here we have an u8 enabled.
>>
>>> +static int __init
>>> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>> +				const unsigned long end)
>>> +{
>>> +	struct acpi_madt_generic_interrupt *processor;
>>> +
>>> +	processor = (struct acpi_madt_generic_interrupt *)header;
>>> +
>>> +	if (BAD_MADT_ENTRY(processor, end))
>>> +		return -EINVAL;
>>> +
>>> +	acpi_table_print_madt_entry(header);
>>> +
>>> +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> +		processor->flags & ACPI_MADT_ENABLED);
>>
>> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
>> don't lose any information. So either make the enabled above a bool or
>> simply pass the flags with the check in acpi_map_gic_cpu_interface()
>> (personal preference for the latter).
>
> I've applied the following patch on top of the series.
>
> Will
>
> --->8
>
> commit 8ef320319592693f4a6286d80df210fd47b3e356
> Author: Will Deacon <will.deacon@arm.com>
> Date:   Thu Mar 26 15:09:20 2015 +0000
>
>      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
>
>      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
>      passing a 32-bit value in the u8 enabled parameter and then subsequently
>      ignoring its return value.
>
>      Sort it out.
>
>      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
>      Signed-off-by: Will Deacon <will.deacon@arm.com>
>
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index cd60329da8c4..07649e413244 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
>    *
>    * Returns the logical cpu number which maps to MPIDR
>    */
> -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> +static int __init
> +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)

How about just replace u8 with u32? This function has its purpose to
be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
ACPI handle, then pass it to the arch specific mapping function
to map the physcal cpu ID with logical cpu ID for the new added
CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
need to go back to that solution.

>   {
>   	int i;
> +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>
>   	if (mpidr == INVALID_HWID) {
>   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>   		return -EINVAL;
>
>   	acpi_table_print_madt_entry(header);
> -
> -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> -		processor->flags & ACPI_MADT_ENABLED);
> -
> -	return 0;
> +	return acpi_map_gic_cpu_interface(processor);

I don't think we need to return the error value here, in ACPI
core, it will stop the MADT scanning once it returned the error
value, but actually we can skip some disabled GICC (cpu) entries
and find all the enabled ones in MADT, for example,

cpu0 entry, with flag enabled
cpu1 entry, disabled  - if we return the error value, table scanning
                         will stop
cpu2 entry, enabled   - and this cpu will be ignored

Thanks
Hanjun

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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 19:48         ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26 19:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015?03?26? 23:15, Will Deacon wrote:
> On Wed, Mar 25, 2015 at 05:17:35PM +0000, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:45PM +0800, Hanjun Guo wrote:
>>> +/**
>>> + * acpi_map_gic_cpu_interface - generates a logical cpu number
>>> + * and map to MPIDR represented by GICC structure
>>> + * @mpidr: CPU's hardware id to register, MPIDR represented in MADT
>>> + * @enabled: this cpu is enabled or not
>>> + *
>>> + * Returns the logical cpu number which maps to MPIDR
>>> + */
>>> +static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>
>> So here we have an u8 enabled.
>>
>>> +static int __init
>>> +acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>> +				const unsigned long end)
>>> +{
>>> +	struct acpi_madt_generic_interrupt *processor;
>>> +
>>> +	processor = (struct acpi_madt_generic_interrupt *)header;
>>> +
>>> +	if (BAD_MADT_ENTRY(processor, end))
>>> +		return -EINVAL;
>>> +
>>> +	acpi_table_print_madt_entry(header);
>>> +
>>> +	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> +		processor->flags & ACPI_MADT_ENABLED);
>>
>> and here processor->flags is u32. Luckily, ACPI_MADT_ENABLED is 1 and we
>> don't lose any information. So either make the enabled above a bool or
>> simply pass the flags with the check in acpi_map_gic_cpu_interface()
>> (personal preference for the latter).
>
> I've applied the following patch on top of the series.
>
> Will
>
> --->8
>
> commit 8ef320319592693f4a6286d80df210fd47b3e356
> Author: Will Deacon <will.deacon@arm.com>
> Date:   Thu Mar 26 15:09:20 2015 +0000
>
>      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
>
>      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
>      passing a 32-bit value in the u8 enabled parameter and then subsequently
>      ignoring its return value.
>
>      Sort it out.
>
>      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
>      Signed-off-by: Will Deacon <will.deacon@arm.com>
>
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index cd60329da8c4..07649e413244 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
>    *
>    * Returns the logical cpu number which maps to MPIDR
>    */
> -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> +static int __init
> +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)

How about just replace u8 with u32? This function has its purpose to
be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
ACPI handle, then pass it to the arch specific mapping function
to map the physcal cpu ID with logical cpu ID for the new added
CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
need to go back to that solution.

>   {
>   	int i;
> +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>
>   	if (mpidr == INVALID_HWID) {
>   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>   		return -EINVAL;
>
>   	acpi_table_print_madt_entry(header);
> -
> -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> -		processor->flags & ACPI_MADT_ENABLED);
> -
> -	return 0;
> +	return acpi_map_gic_cpu_interface(processor);

I don't think we need to return the error value here, in ACPI
core, it will stop the MADT scanning once it returned the error
value, but actually we can skip some disabled GICC (cpu) entries
and find all the enabled ones in MADT, for example,

cpu0 entry, with flag enabled
cpu1 entry, disabled  - if we return the error value, table scanning
                         will stop
cpu2 entry, enabled   - and this cpu will be ignored

Thanks
Hanjun

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
  2015-03-26 19:48         ` Hanjun Guo
  (?)
@ 2015-03-26 21:12           ` Will Deacon
  -1 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 21:12 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Catalin Marinas, Rafael J. Wysocki, Olof Johansson, grant.likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit@amd.com

On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
> On 2015年03月26日 23:15, Will Deacon wrote:
> > commit 8ef320319592693f4a6286d80df210fd47b3e356
> > Author: Will Deacon <will.deacon@arm.com>
> > Date:   Thu Mar 26 15:09:20 2015 +0000
> >
> >      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
> >
> >      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
> >      passing a 32-bit value in the u8 enabled parameter and then subsequently
> >      ignoring its return value.
> >
> >      Sort it out.
> >
> >      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> >      Signed-off-by: Will Deacon <will.deacon@arm.com>
> >
> > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> > index cd60329da8c4..07649e413244 100644
> > --- a/arch/arm64/kernel/acpi.c
> > +++ b/arch/arm64/kernel/acpi.c
> > @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
> >    *
> >    * Returns the logical cpu number which maps to MPIDR
> >    */
> > -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> > +static int __init
> > +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
> 
> How about just replace u8 with u32? This function has its purpose to
> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
> ACPI handle, then pass it to the arch specific mapping function
> to map the physcal cpu ID with logical cpu ID for the new added
> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
> need to go back to that solution.

If/when that happens, we can change things then. Right now, this is a static
function with one caller. One step at a time, please.

> >   {
> >   	int i;
> > +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> > +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
> >
> >   	if (mpidr == INVALID_HWID) {
> >   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> > @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> >   		return -EINVAL;
> >
> >   	acpi_table_print_madt_entry(header);
> > -
> > -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > -		processor->flags & ACPI_MADT_ENABLED);
> > -
> > -	return 0;
> > +	return acpi_map_gic_cpu_interface(processor);
> 
> I don't think we need to return the error value here, in ACPI
> core, it will stop the MADT scanning once it returned the error
> value, but actually we can skip some disabled GICC (cpu) entries
> and find all the enabled ones in MADT, for example,
> 
> cpu0 entry, with flag enabled
> cpu1 entry, disabled  - if we return the error value, table scanning
>                          will stop
> cpu2 entry, enabled   - and this cpu will be ignored

Then send me a patch making acpi_map_gic_cpu_interface have a void return
type. Ignoring the return type is usually a good way to introduce subtle
bugs.

Will
--
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] 142+ messages in thread

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 21:12           ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 21:12 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Catalin Marinas, Rafael J. Wysocki, Olof Johansson, grant.likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
> On 2015年03月26日 23:15, Will Deacon wrote:
> > commit 8ef320319592693f4a6286d80df210fd47b3e356
> > Author: Will Deacon <will.deacon@arm.com>
> > Date:   Thu Mar 26 15:09:20 2015 +0000
> >
> >      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
> >
> >      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
> >      passing a 32-bit value in the u8 enabled parameter and then subsequently
> >      ignoring its return value.
> >
> >      Sort it out.
> >
> >      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> >      Signed-off-by: Will Deacon <will.deacon@arm.com>
> >
> > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> > index cd60329da8c4..07649e413244 100644
> > --- a/arch/arm64/kernel/acpi.c
> > +++ b/arch/arm64/kernel/acpi.c
> > @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
> >    *
> >    * Returns the logical cpu number which maps to MPIDR
> >    */
> > -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> > +static int __init
> > +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
> 
> How about just replace u8 with u32? This function has its purpose to
> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
> ACPI handle, then pass it to the arch specific mapping function
> to map the physcal cpu ID with logical cpu ID for the new added
> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
> need to go back to that solution.

If/when that happens, we can change things then. Right now, this is a static
function with one caller. One step at a time, please.

> >   {
> >   	int i;
> > +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> > +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
> >
> >   	if (mpidr == INVALID_HWID) {
> >   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> > @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> >   		return -EINVAL;
> >
> >   	acpi_table_print_madt_entry(header);
> > -
> > -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > -		processor->flags & ACPI_MADT_ENABLED);
> > -
> > -	return 0;
> > +	return acpi_map_gic_cpu_interface(processor);
> 
> I don't think we need to return the error value here, in ACPI
> core, it will stop the MADT scanning once it returned the error
> value, but actually we can skip some disabled GICC (cpu) entries
> and find all the enabled ones in MADT, for example,
> 
> cpu0 entry, with flag enabled
> cpu1 entry, disabled  - if we return the error value, table scanning
>                          will stop
> cpu2 entry, enabled   - and this cpu will be ignored

Then send me a patch making acpi_map_gic_cpu_interface have a void return
type. Ignoring the return type is usually a good way to introduce subtle
bugs.

Will

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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 21:12           ` Will Deacon
  0 siblings, 0 replies; 142+ messages in thread
From: Will Deacon @ 2015-03-26 21:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
> On 2015?03?26? 23:15, Will Deacon wrote:
> > commit 8ef320319592693f4a6286d80df210fd47b3e356
> > Author: Will Deacon <will.deacon@arm.com>
> > Date:   Thu Mar 26 15:09:20 2015 +0000
> >
> >      ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
> >
> >      acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
> >      passing a 32-bit value in the u8 enabled parameter and then subsequently
> >      ignoring its return value.
> >
> >      Sort it out.
> >
> >      Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> >      Signed-off-by: Will Deacon <will.deacon@arm.com>
> >
> > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> > index cd60329da8c4..07649e413244 100644
> > --- a/arch/arm64/kernel/acpi.c
> > +++ b/arch/arm64/kernel/acpi.c
> > @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
> >    *
> >    * Returns the logical cpu number which maps to MPIDR
> >    */
> > -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
> > +static int __init
> > +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
> 
> How about just replace u8 with u32? This function has its purpose to
> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
> ACPI handle, then pass it to the arch specific mapping function
> to map the physcal cpu ID with logical cpu ID for the new added
> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
> need to go back to that solution.

If/when that happens, we can change things then. Right now, this is a static
function with one caller. One step at a time, please.

> >   {
> >   	int i;
> > +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
> > +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
> >
> >   	if (mpidr == INVALID_HWID) {
> >   		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
> > @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
> >   		return -EINVAL;
> >
> >   	acpi_table_print_madt_entry(header);
> > -
> > -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
> > -		processor->flags & ACPI_MADT_ENABLED);
> > -
> > -	return 0;
> > +	return acpi_map_gic_cpu_interface(processor);
> 
> I don't think we need to return the error value here, in ACPI
> core, it will stop the MADT scanning once it returned the error
> value, but actually we can skip some disabled GICC (cpu) entries
> and find all the enabled ones in MADT, for example,
> 
> cpu0 entry, with flag enabled
> cpu1 entry, disabled  - if we return the error value, table scanning
>                          will stop
> cpu2 entry, enabled   - and this cpu will be ignored

Then send me a patch making acpi_map_gic_cpu_interface have a void return
type. Ignoring the return type is usually a good way to introduce subtle
bugs.

Will

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
  2015-03-26 21:12           ` Will Deacon
  (?)
@ 2015-03-26 23:01             ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26 23:01 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Rafael J. Wysocki, Olof Johansson, grant.likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit@amd.com

On 2015年03月27日 05:12, Will Deacon wrote:
> On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
>> On 2015年03月26日 23:15, Will Deacon wrote:
>>> commit 8ef320319592693f4a6286d80df210fd47b3e356
>>> Author: Will Deacon <will.deacon@arm.com>
>>> Date:   Thu Mar 26 15:09:20 2015 +0000
>>>
>>>       ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
>>>
>>>       acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
>>>       passing a 32-bit value in the u8 enabled parameter and then subsequently
>>>       ignoring its return value.
>>>
>>>       Sort it out.
>>>
>>>       Reported-by: Catalin Marinas <catalin.marinas@arm.com>
>>>       Signed-off-by: Will Deacon <will.deacon@arm.com>
>>>
>>> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
>>> index cd60329da8c4..07649e413244 100644
>>> --- a/arch/arm64/kernel/acpi.c
>>> +++ b/arch/arm64/kernel/acpi.c
>>> @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
>>>     *
>>>     * Returns the logical cpu number which maps to MPIDR
>>>     */
>>> -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>> +static int __init
>>> +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>>
>> How about just replace u8 with u32? This function has its purpose to
>> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
>> ACPI handle, then pass it to the arch specific mapping function
>> to map the physcal cpu ID with logical cpu ID for the new added
>> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
>> need to go back to that solution.
>
> If/when that happens, we can change things then. Right now, this is a static
> function with one caller. One step at a time, please.
>
>>>    {
>>>    	int i;
>>> +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
>>> +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>>>
>>>    	if (mpidr == INVALID_HWID) {
>>>    		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
>>> @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>>    		return -EINVAL;
>>>
>>>    	acpi_table_print_madt_entry(header);
>>> -
>>> -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> -		processor->flags & ACPI_MADT_ENABLED);
>>> -
>>> -	return 0;
>>> +	return acpi_map_gic_cpu_interface(processor);
>>
>> I don't think we need to return the error value here, in ACPI
>> core, it will stop the MADT scanning once it returned the error
>> value, but actually we can skip some disabled GICC (cpu) entries
>> and find all the enabled ones in MADT, for example,
>>
>> cpu0 entry, with flag enabled
>> cpu1 entry, disabled  - if we return the error value, table scanning
>>                           will stop
>> cpu2 entry, enabled   - and this cpu will be ignored
>
> Then send me a patch making acpi_map_gic_cpu_interface have a void return
> type. Ignoring the return type is usually a good way to introduce subtle
> bugs.

OK, I will, and I will cleanup the comments for this function too.

Need some sleep first...

Thanks
Hanjun

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

* Re: [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 23:01             ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26 23:01 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Rafael J. Wysocki, Olof Johansson, grant.likely,
	Mark Rutland, Ashwin Chaugule, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, graeme.gregory, linaro-acpi, Marc Zyngier, jcm,
	Timur Tabi, msalter, linux-kernel, Tomasz Nowicki, linux-acpi,
	Mark Brown, suravee.suthikulpanit, Sudeep Holla,
	linux-arm-kernel

On 2015年03月27日 05:12, Will Deacon wrote:
> On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
>> On 2015年03月26日 23:15, Will Deacon wrote:
>>> commit 8ef320319592693f4a6286d80df210fd47b3e356
>>> Author: Will Deacon <will.deacon@arm.com>
>>> Date:   Thu Mar 26 15:09:20 2015 +0000
>>>
>>>       ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
>>>
>>>       acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
>>>       passing a 32-bit value in the u8 enabled parameter and then subsequently
>>>       ignoring its return value.
>>>
>>>       Sort it out.
>>>
>>>       Reported-by: Catalin Marinas <catalin.marinas@arm.com>
>>>       Signed-off-by: Will Deacon <will.deacon@arm.com>
>>>
>>> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
>>> index cd60329da8c4..07649e413244 100644
>>> --- a/arch/arm64/kernel/acpi.c
>>> +++ b/arch/arm64/kernel/acpi.c
>>> @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
>>>     *
>>>     * Returns the logical cpu number which maps to MPIDR
>>>     */
>>> -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>> +static int __init
>>> +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>>
>> How about just replace u8 with u32? This function has its purpose to
>> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
>> ACPI handle, then pass it to the arch specific mapping function
>> to map the physcal cpu ID with logical cpu ID for the new added
>> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
>> need to go back to that solution.
>
> If/when that happens, we can change things then. Right now, this is a static
> function with one caller. One step at a time, please.
>
>>>    {
>>>    	int i;
>>> +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
>>> +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>>>
>>>    	if (mpidr == INVALID_HWID) {
>>>    		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
>>> @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>>    		return -EINVAL;
>>>
>>>    	acpi_table_print_madt_entry(header);
>>> -
>>> -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> -		processor->flags & ACPI_MADT_ENABLED);
>>> -
>>> -	return 0;
>>> +	return acpi_map_gic_cpu_interface(processor);
>>
>> I don't think we need to return the error value here, in ACPI
>> core, it will stop the MADT scanning once it returned the error
>> value, but actually we can skip some disabled GICC (cpu) entries
>> and find all the enabled ones in MADT, for example,
>>
>> cpu0 entry, with flag enabled
>> cpu1 entry, disabled  - if we return the error value, table scanning
>>                           will stop
>> cpu2 entry, enabled   - and this cpu will be ignored
>
> Then send me a patch making acpi_map_gic_cpu_interface have a void return
> type. Ignoring the return type is usually a good way to introduce subtle
> bugs.

OK, I will, and I will cleanup the comments for this function too.

Need some sleep first...

Thanks
Hanjun

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

* [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization
@ 2015-03-26 23:01             ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-26 23:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015?03?27? 05:12, Will Deacon wrote:
> On Thu, Mar 26, 2015 at 07:48:50PM +0000, Hanjun Guo wrote:
>> On 2015?03?26? 23:15, Will Deacon wrote:
>>> commit 8ef320319592693f4a6286d80df210fd47b3e356
>>> Author: Will Deacon <will.deacon@arm.com>
>>> Date:   Thu Mar 26 15:09:20 2015 +0000
>>>
>>>       ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
>>>
>>>       acpi_parse_gic_cpu_interface calls acpi_map_gic_cpu_interface by both
>>>       passing a 32-bit value in the u8 enabled parameter and then subsequently
>>>       ignoring its return value.
>>>
>>>       Sort it out.
>>>
>>>       Reported-by: Catalin Marinas <catalin.marinas@arm.com>
>>>       Signed-off-by: Will Deacon <will.deacon@arm.com>
>>>
>>> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
>>> index cd60329da8c4..07649e413244 100644
>>> --- a/arch/arm64/kernel/acpi.c
>>> +++ b/arch/arm64/kernel/acpi.c
>>> @@ -103,9 +103,12 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
>>>     *
>>>     * Returns the logical cpu number which maps to MPIDR
>>>     */
>>> -static int __init acpi_map_gic_cpu_interface(u64 mpidr, u8 enabled)
>>> +static int __init
>>> +acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
>>
>> How about just replace u8 with u32? This function has its purpose to
>> be lived, on x86/ia64, ACPI core will get the physcal cpu ID via
>> ACPI handle, then pass it to the arch specific mapping function
>> to map the physcal cpu ID with logical cpu ID for the new added
>> CPU, so when ACPI based CPU hot-plug is introduced on ARM64, we
>> need to go back to that solution.
>
> If/when that happens, we can change things then. Right now, this is a static
> function with one caller. One step at a time, please.
>
>>>    {
>>>    	int i;
>>> +	u64 mpidr = processor->arm_mpidr & MPIDR_HWID_BITMASK;
>>> +	bool enabled = !!(processor->flags & ACPI_MADT_ENABLED);
>>>
>>>    	if (mpidr == INVALID_HWID) {
>>>    		pr_info("Skip MADT cpu entry with invalid MPIDR\n");
>>> @@ -178,11 +181,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
>>>    		return -EINVAL;
>>>
>>>    	acpi_table_print_madt_entry(header);
>>> -
>>> -	acpi_map_gic_cpu_interface(processor->arm_mpidr & MPIDR_HWID_BITMASK,
>>> -		processor->flags & ACPI_MADT_ENABLED);
>>> -
>>> -	return 0;
>>> +	return acpi_map_gic_cpu_interface(processor);
>>
>> I don't think we need to return the error value here, in ACPI
>> core, it will stop the MADT scanning once it returned the error
>> value, but actually we can skip some disabled GICC (cpu) entries
>> and find all the enabled ones in MADT, for example,
>>
>> cpu0 entry, with flag enabled
>> cpu1 entry, disabled  - if we return the error value, table scanning
>>                           will stop
>> cpu2 entry, enabled   - and this cpu will be ignored
>
> Then send me a patch making acpi_map_gic_cpu_interface have a void return
> type. Ignoring the return type is usually a good way to introduce subtle
> bugs.

OK, I will, and I will cleanup the comments for this function too.

Need some sleep first...

Thanks
Hanjun

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-26  3:49       ` Hanjun Guo
  (?)
@ 2015-03-27 13:40         ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-27 13:40 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki
  Cc: Hanjun Guo, Mark Rutland, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Ashwin Chaugule, linaro-acpi, Marc Zyngier,
	Timur Tabi, Mark Salter, Will Deacon, linux-kernel, Sudeep Holla,
	Grant Likely, Mark Brown, Suravee Suthikulpanit, Jon Masters,
	Olof Johansson, Graeme Gregory, linux-acpi, linux-arm-kernel

On 2015年03月26日 11:49, Hanjun Guo wrote:
> On 2015/3/26 1:21, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>>> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
>>> but phys_id is used as int in acpi processor driver, so it will lead to
>>> some inconsistence for the drivers.
>>>
>>> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
>>> ids a generic CPU physical id type is required.
>>>
>>> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
>>> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
>>> by other archs, this will solve the inconsistence in acpi processor driver,
>>> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
>>> in the following patch.
>>>
>>> CC: Rafael J Wysocki <rjw@rjwysocki.net>
>>> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Reviewed-by: Grant Likely <grant.likely@linaro.org>
>>> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
>>> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>>> [hj: reworked cpu physid map return codes]
>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> BTW, am I still the author of this patch? If yes, it's missing a From:
>> line.
>
> Oops, you should be the author, can Will fix this in his tree?
>
>>
>>> --- a/drivers/acpi/acpi_processor.c
>>> +++ b/drivers/acpi/acpi_processor.c
>>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>>   	acpi_status status;
>>>   	int ret;
>>>
>>> -	if (pr->phys_id == -1)
>>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>>   		return -ENODEV;
>> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
>> the latter in the arm64 code (as a subsequent clean-up patch).
>
> OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
> to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
> which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.

I met difficulty to do so, because we use

+#ifndef PHYS_CPUID_INVALID
+typedef u32 phys_cpuid_t;
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
+#endif

in the common head file linux/acpi.h, we need macro
PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
for different arch, so if we want remove PHYS_CPUID_INVALID
for ARM64, we need to got back to typedef phys_cpuid_t for
each arch using ACPI. which means that

+typedef u32 phys_cpuid_t;  for ia64 and x86,

and
+typedef u64 phys_cpuid_t;  for arm64

and
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
in this linux/acpi.h for common use.

Rafael, would you mind doing so?

Thanks
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] 142+ messages in thread

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-27 13:40         ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-27 13:40 UTC (permalink / raw)
  To: Catalin Marinas, Rafael J. Wysocki
  Cc: Hanjun Guo, Mark Rutland, Lorenzo Pieralisi, Robert Richter,
	Arnd Bergmann, Ashwin Chaugule, linaro-acpi, Marc Zyngier,
	Timur Tabi, Mark Salter, Will Deacon, linux-kernel, Sudeep Holla,
	Grant Likely, Mark Brown, Suravee Suthikulpanit, Jon Masters,
	Olof Johansson, Graeme Gregory, linux-acpi, linux-arm-kernel

On 2015年03月26日 11:49, Hanjun Guo wrote:
> On 2015/3/26 1:21, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>>> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
>>> but phys_id is used as int in acpi processor driver, so it will lead to
>>> some inconsistence for the drivers.
>>>
>>> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
>>> ids a generic CPU physical id type is required.
>>>
>>> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
>>> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
>>> by other archs, this will solve the inconsistence in acpi processor driver,
>>> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
>>> in the following patch.
>>>
>>> CC: Rafael J Wysocki <rjw@rjwysocki.net>
>>> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Reviewed-by: Grant Likely <grant.likely@linaro.org>
>>> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
>>> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>>> [hj: reworked cpu physid map return codes]
>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> BTW, am I still the author of this patch? If yes, it's missing a From:
>> line.
>
> Oops, you should be the author, can Will fix this in his tree?
>
>>
>>> --- a/drivers/acpi/acpi_processor.c
>>> +++ b/drivers/acpi/acpi_processor.c
>>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>>   	acpi_status status;
>>>   	int ret;
>>>
>>> -	if (pr->phys_id == -1)
>>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>>   		return -ENODEV;
>> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
>> the latter in the arm64 code (as a subsequent clean-up patch).
>
> OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
> to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
> which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.

I met difficulty to do so, because we use

+#ifndef PHYS_CPUID_INVALID
+typedef u32 phys_cpuid_t;
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
+#endif

in the common head file linux/acpi.h, we need macro
PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
for different arch, so if we want remove PHYS_CPUID_INVALID
for ARM64, we need to got back to typedef phys_cpuid_t for
each arch using ACPI. which means that

+typedef u32 phys_cpuid_t;  for ia64 and x86,

and
+typedef u64 phys_cpuid_t;  for arm64

and
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
in this linux/acpi.h for common use.

Rafael, would you mind doing so?

Thanks
Hanjun


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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-27 13:40         ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-27 13:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015?03?26? 11:49, Hanjun Guo wrote:
> On 2015/3/26 1:21, Catalin Marinas wrote:
>> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>>> CPU hardware ID (phys_id) is defined as u32 in structure acpi_processor,
>>> but phys_id is used as int in acpi processor driver, so it will lead to
>>> some inconsistence for the drivers.
>>>
>>> Furthermore, to cater for ACPI arch ports that implement 64 bits CPU
>>> ids a generic CPU physical id type is required.
>>>
>>> So introduce typedef u32 phys_cpuid_t in a common file, and introduce
>>> a macro PHYS_CPUID_INVALID as (phys_cpuid_t)(-1) if it's not defined
>>> by other archs, this will solve the inconsistence in acpi processor driver,
>>> and will prepare for the ACPI on ARM64 for the 64 bit CPU hardware ID
>>> in the following patch.
>>>
>>> CC: Rafael J Wysocki <rjw@rjwysocki.net>
>>> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Reviewed-by: Grant Likely <grant.likely@linaro.org>
>>> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
>>> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>>> [hj: reworked cpu physid map return codes]
>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> BTW, am I still the author of this patch? If yes, it's missing a From:
>> line.
>
> Oops, you should be the author, can Will fix this in his tree?
>
>>
>>> --- a/drivers/acpi/acpi_processor.c
>>> +++ b/drivers/acpi/acpi_processor.c
>>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>>   	acpi_status status;
>>>   	int ret;
>>>
>>> -	if (pr->phys_id == -1)
>>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>>   		return -ENODEV;
>> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
>> the latter in the arm64 code (as a subsequent clean-up patch).
>
> OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
> to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
> which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.

I met difficulty to do so, because we use

+#ifndef PHYS_CPUID_INVALID
+typedef u32 phys_cpuid_t;
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
+#endif

in the common head file linux/acpi.h, we need macro
PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
for different arch, so if we want remove PHYS_CPUID_INVALID
for ARM64, we need to got back to typedef phys_cpuid_t for
each arch using ACPI. which means that

+typedef u32 phys_cpuid_t;  for ia64 and x86,

and
+typedef u64 phys_cpuid_t;  for arm64

and
+#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
in this linux/acpi.h for common use.

Rafael, would you mind doing so?

Thanks
Hanjun

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-27 13:40         ` Hanjun Guo
  (?)
@ 2015-03-30 13:58           ` Catalin Marinas
  -1 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-30 13:58 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Mark Rutland, Lorenzo Pieralisi,
	Robert Richter, Arnd Bergmann, Ashwin Chaugule, linaro-acpi,
	Marc Zyngier, Jon Masters, Timur Tabi, Mark Salter, Will Deacon,
	linux-kernel, Sudeep Holla, Olof Johansson, Mark Brown,
	Suravee Suthikulpanit, Hanjun Guo, Grant Likely, Graeme Gregory,
	linux-acpi, linux-arm-kernel

On Fri, Mar 27, 2015 at 09:40:26PM +0800, Hanjun Guo wrote:
> On 2015年03月26日 11:49, Hanjun Guo wrote:
> >On 2015/3/26 1:21, Catalin Marinas wrote:
> >>On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> >>>--- a/drivers/acpi/acpi_processor.c
> >>>+++ b/drivers/acpi/acpi_processor.c
> >>>@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
> >>>  	acpi_status status;
> >>>  	int ret;
> >>>
> >>>-	if (pr->phys_id == -1)
> >>>+	if (pr->phys_id == PHYS_CPUID_INVALID)
> >>>  		return -ENODEV;
> >>If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
> >>the latter in the arm64 code (as a subsequent clean-up patch).
> >
> >OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
> >to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
> >which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.
> 
> I met difficulty to do so, because we use
> 
> +#ifndef PHYS_CPUID_INVALID
> +typedef u32 phys_cpuid_t;
> +#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
> +#endif
> 
> in the common head file linux/acpi.h, we need macro
> PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
> for different arch, so if we want remove PHYS_CPUID_INVALID
> for ARM64, we need to got back to typedef phys_cpuid_t for
> each arch using ACPI. which means that

What I meant was removing INVALID_HWID from arm64 and always use the
PHYS_CPUID_INVALID but I think we should leave them as they are for now
since PHYS_CPUID_INVALID is defined in the asm/acpi.h file.

-- 
Catalin
--
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] 142+ messages in thread

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-30 13:58           ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-30 13:58 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Rafael J. Wysocki, Mark Rutland, Lorenzo Pieralisi,
	Robert Richter, Arnd Bergmann, Ashwin Chaugule, linaro-acpi,
	Marc Zyngier, Jon Masters, Timur Tabi, Mark Salter, Will Deacon,
	linux-kernel, Sudeep Holla, Olof Johansson, Mark Brown,
	Suravee Suthikulpanit, Hanjun Guo, Grant Likely, Graeme Gregory,
	linux-acpi, linux-arm-kernel

On Fri, Mar 27, 2015 at 09:40:26PM +0800, Hanjun Guo wrote:
> On 2015年03月26日 11:49, Hanjun Guo wrote:
> >On 2015/3/26 1:21, Catalin Marinas wrote:
> >>On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> >>>--- a/drivers/acpi/acpi_processor.c
> >>>+++ b/drivers/acpi/acpi_processor.c
> >>>@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
> >>>  	acpi_status status;
> >>>  	int ret;
> >>>
> >>>-	if (pr->phys_id == -1)
> >>>+	if (pr->phys_id == PHYS_CPUID_INVALID)
> >>>  		return -ENODEV;
> >>If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
> >>the latter in the arm64 code (as a subsequent clean-up patch).
> >
> >OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
> >to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
> >which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.
> 
> I met difficulty to do so, because we use
> 
> +#ifndef PHYS_CPUID_INVALID
> +typedef u32 phys_cpuid_t;
> +#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
> +#endif
> 
> in the common head file linux/acpi.h, we need macro
> PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
> for different arch, so if we want remove PHYS_CPUID_INVALID
> for ARM64, we need to got back to typedef phys_cpuid_t for
> each arch using ACPI. which means that

What I meant was removing INVALID_HWID from arm64 and always use the
PHYS_CPUID_INVALID but I think we should leave them as they are for now
since PHYS_CPUID_INVALID is defined in the asm/acpi.h file.

-- 
Catalin

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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-30 13:58           ` Catalin Marinas
  0 siblings, 0 replies; 142+ messages in thread
From: Catalin Marinas @ 2015-03-30 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 27, 2015 at 09:40:26PM +0800, Hanjun Guo wrote:
> On 2015?03?26? 11:49, Hanjun Guo wrote:
> >On 2015/3/26 1:21, Catalin Marinas wrote:
> >>On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
> >>>--- a/drivers/acpi/acpi_processor.c
> >>>+++ b/drivers/acpi/acpi_processor.c
> >>>@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
> >>>  	acpi_status status;
> >>>  	int ret;
> >>>
> >>>-	if (pr->phys_id == -1)
> >>>+	if (pr->phys_id == PHYS_CPUID_INVALID)
> >>>  		return -ENODEV;
> >>If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
> >>the latter in the arm64 code (as a subsequent clean-up patch).
> >
> >OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
> >to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
> >which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.
> 
> I met difficulty to do so, because we use
> 
> +#ifndef PHYS_CPUID_INVALID
> +typedef u32 phys_cpuid_t;
> +#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
> +#endif
> 
> in the common head file linux/acpi.h, we need macro
> PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
> for different arch, so if we want remove PHYS_CPUID_INVALID
> for ARM64, we need to got back to typedef phys_cpuid_t for
> each arch using ACPI. which means that

What I meant was removing INVALID_HWID from arm64 and always use the
PHYS_CPUID_INVALID but I think we should leave them as they are for now
since PHYS_CPUID_INVALID is defined in the asm/acpi.h file.

-- 
Catalin

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

* Re: [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
  2015-03-24 14:02 ` Hanjun Guo
@ 2015-03-30 16:49   ` Timur Tabi
  -1 siblings, 0 replies; 142+ messages in thread
From: Timur Tabi @ 2015-03-30 16:49 UTC (permalink / raw)
  To: Hanjun Guo, Catalin Marinas, Rafael J. Wysocki, Will Deacon,
	Olof Johansson, Grant Likely
  Cc: Lorenzo Pieralisi, Arnd Bergmann, Mark Rutland, Graeme Gregory,
	Sudeep Holla, Jon Masters, Marc Zyngier, Mark Brown,
	Robert Richter, Ashwin Chaugule, Suravee Suthikulpanit,
	Mark Salter, linux-acpi, linux-arm-kernel, linux-kernel,
	linaro-acpi

On 03/24/2015 09:02 AM, Hanjun Guo wrote:
> Some fixes since last version:
>
>   - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>     compile errors on XEN ACPI, Stefano and Julien are ok with this
>     temporary solution.
>   - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force
>     is passed", which will fix the problem that the device tree will
>     be unflattened even if acpi=force passed, that will not obey the
>     policy.
>   - update patch "irqchip: Add GICv2 specific ACPI boot support",
>     which will cause compile error on i386 with both DT and ACPI
>     enabled:

All 23 patches:

Tested-by: Timur Tabi <timur@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1
@ 2015-03-30 16:49   ` Timur Tabi
  0 siblings, 0 replies; 142+ messages in thread
From: Timur Tabi @ 2015-03-30 16:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/24/2015 09:02 AM, Hanjun Guo wrote:
> Some fixes since last version:
>
>   - Add a patch 19/23 for disabling ACPI for Xen on ARM64 for now to fix
>     compile errors on XEN ACPI, Stefano and Julien are ok with this
>     temporary solution.
>   - Add patch "ARM64 / ACPI: Don't unflatten device tree if acpi=force
>     is passed", which will fix the problem that the device tree will
>     be unflattened even if acpi=force passed, that will not obey the
>     policy.
>   - update patch "irqchip: Add GICv2 specific ACPI boot support",
>     which will cause compile error on i386 with both DT and ACPI
>     enabled:

All 23 patches:

Tested-by: Timur Tabi <timur@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  2015-03-30 13:58           ` Catalin Marinas
  (?)
@ 2015-03-31  1:49             ` Hanjun Guo
  -1 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-31  1:49 UTC (permalink / raw)
  To: Catalin Marinas, Hanjun Guo
  Cc: Rafael J. Wysocki, Mark Rutland, Lorenzo Pieralisi,
	Robert Richter, Arnd Bergmann, Ashwin Chaugule, linaro-acpi,
	Marc Zyngier, Jon Masters, Timur Tabi, Mark Salter, Will Deacon,
	linux-kernel, Sudeep Holla, Olof Johansson, Mark Brown,
	Suravee Suthikulpanit, Grant Likely, Graeme Gregory, linux-acpi,
	linux-arm-kernel

On 2015/3/30 21:58, Catalin Marinas wrote:
> On Fri, Mar 27, 2015 at 09:40:26PM +0800, Hanjun Guo wrote:
>> On 2015年03月26日 11:49, Hanjun Guo wrote:
>>> On 2015/3/26 1:21, Catalin Marinas wrote:
>>>> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>>>>> --- a/drivers/acpi/acpi_processor.c
>>>>> +++ b/drivers/acpi/acpi_processor.c
>>>>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>>>>  	acpi_status status;
>>>>>  	int ret;
>>>>>
>>>>> -	if (pr->phys_id == -1)
>>>>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>>>>  		return -ENODEV;
>>>> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
>>>> the latter in the arm64 code (as a subsequent clean-up patch).
>>> OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
>>> to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
>>> which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.
>> I met difficulty to do so, because we use
>>
>> +#ifndef PHYS_CPUID_INVALID
>> +typedef u32 phys_cpuid_t;
>> +#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
>> +#endif
>>
>> in the common head file linux/acpi.h, we need macro
>> PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
>> for different arch, so if we want remove PHYS_CPUID_INVALID
>> for ARM64, we need to got back to typedef phys_cpuid_t for
>> each arch using ACPI. which means that
> What I meant was removing INVALID_HWID from arm64 and always use the
> PHYS_CPUID_INVALID but I think we should leave them as they are for now
> since PHYS_CPUID_INVALID is defined in the asm/acpi.h file.

OK, thanks for the clarify.

Hanjun

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

* Re: [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-31  1:49             ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-31  1:49 UTC (permalink / raw)
  To: Catalin Marinas, Hanjun Guo
  Cc: Rafael J. Wysocki, Mark Rutland, Lorenzo Pieralisi,
	Robert Richter, Arnd Bergmann, Ashwin Chaugule, linaro-acpi,
	Marc Zyngier, Jon Masters, Timur Tabi, Mark Salter, Will Deacon,
	linux-kernel, Sudeep Holla, Olof Johansson, Mark Brown,
	Suravee Suthikulpanit, Grant Likely, Graeme Gregory, linux-acpi,
	linux-arm-kernel

On 2015/3/30 21:58, Catalin Marinas wrote:
> On Fri, Mar 27, 2015 at 09:40:26PM +0800, Hanjun Guo wrote:
>> On 2015年03月26日 11:49, Hanjun Guo wrote:
>>> On 2015/3/26 1:21, Catalin Marinas wrote:
>>>> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>>>>> --- a/drivers/acpi/acpi_processor.c
>>>>> +++ b/drivers/acpi/acpi_processor.c
>>>>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>>>>  	acpi_status status;
>>>>>  	int ret;
>>>>>
>>>>> -	if (pr->phys_id == -1)
>>>>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>>>>  		return -ENODEV;
>>>> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
>>>> the latter in the arm64 code (as a subsequent clean-up patch).
>>> OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
>>> to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
>>> which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.
>> I met difficulty to do so, because we use
>>
>> +#ifndef PHYS_CPUID_INVALID
>> +typedef u32 phys_cpuid_t;
>> +#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
>> +#endif
>>
>> in the common head file linux/acpi.h, we need macro
>> PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
>> for different arch, so if we want remove PHYS_CPUID_INVALID
>> for ARM64, we need to got back to typedef phys_cpuid_t for
>> each arch using ACPI. which means that
> What I meant was removing INVALID_HWID from arm64 and always use the
> PHYS_CPUID_INVALID but I think we should leave them as they are for now
> since PHYS_CPUID_INVALID is defined in the asm/acpi.h file.

OK, thanks for the clarify.

Hanjun


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

* [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
@ 2015-03-31  1:49             ` Hanjun Guo
  0 siblings, 0 replies; 142+ messages in thread
From: Hanjun Guo @ 2015-03-31  1:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/3/30 21:58, Catalin Marinas wrote:
> On Fri, Mar 27, 2015 at 09:40:26PM +0800, Hanjun Guo wrote:
>> On 2015?03?26? 11:49, Hanjun Guo wrote:
>>> On 2015/3/26 1:21, Catalin Marinas wrote:
>>>> On Tue, Mar 24, 2015 at 10:02:46PM +0800, Hanjun Guo wrote:
>>>>> --- a/drivers/acpi/acpi_processor.c
>>>>> +++ b/drivers/acpi/acpi_processor.c
>>>>> @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>>>>>  	acpi_status status;
>>>>>  	int ret;
>>>>>
>>>>> -	if (pr->phys_id == -1)
>>>>> +	if (pr->phys_id == PHYS_CPUID_INVALID)
>>>>>  		return -ENODEV;
>>>> If PHYS_CPUID_INVALID is the same as INVALID_HWID, we should get rid of
>>>> the latter in the arm64 code (as a subsequent clean-up patch).
>>> OK, I'm preparing a patch set to introduce invalid_phys_cpuid() and invalid_logical_cpuid()
>>> to remove the direct comparison of PHYS_CPUID_INVALID and -1 in ACPI processor drivers,
>>> which is suggested by Rafael, I will cleanup PHYS_CPUID_INVALID in this patch set.
>> I met difficulty to do so, because we use
>>
>> +#ifndef PHYS_CPUID_INVALID
>> +typedef u32 phys_cpuid_t;
>> +#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
>> +#endif
>>
>> in the common head file linux/acpi.h, we need macro
>> PHYS_CPUID_INVALID to identify if phys_cpuid_t is typedefed
>> for different arch, so if we want remove PHYS_CPUID_INVALID
>> for ARM64, we need to got back to typedef phys_cpuid_t for
>> each arch using ACPI. which means that
> What I meant was removing INVALID_HWID from arm64 and always use the
> PHYS_CPUID_INVALID but I think we should leave them as they are for now
> since PHYS_CPUID_INVALID is defined in the asm/acpi.h file.

OK, thanks for the clarify.

Hanjun

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

end of thread, other threads:[~2015-03-31  1:50 UTC | newest]

Thread overview: 142+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 14:02 [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1 Hanjun Guo
2015-03-24 14:02 ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 01/23] ACPI / table: Use pr_debug() instead of pr_info() for MADT table scanning Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 02/23] ACPI: add arm64 to the platforms that use ioremap Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 16:43   ` Catalin Marinas
2015-03-25 16:43     ` Catalin Marinas
2015-03-25 16:43     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 03/23] ARM64: allow late use of early_ioremap Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 16:43   ` Catalin Marinas
2015-03-25 16:43     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 04/23] ARM64 / ACPI: Get RSDP and ACPI boot-time tables Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 16:44   ` Catalin Marinas
2015-03-25 16:44     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 05/23] ACPI: fix acpi_os_ioremap for arm64 Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 16:50   ` Catalin Marinas
2015-03-25 16:50     ` Catalin Marinas
2015-03-25 16:50     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 06/23] ACPI / sleep: Introduce CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 07/23] ARM64 / ACPI: Introduce PCI stub functions for ACPI Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 16:50   ` Catalin Marinas
2015-03-25 16:50     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 08/23] ARM64 / ACPI: Introduce early_param "acpi=" to enable/disable ACPI Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 16:57   ` Catalin Marinas
2015-03-25 16:57     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 09/23] ARM64 / ACPI: If we chose to boot from acpi then disable FDT Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:00   ` Catalin Marinas
2015-03-25 17:00     ` Catalin Marinas
2015-03-26 10:57     ` Lorenzo Pieralisi
2015-03-26 10:57       ` Lorenzo Pieralisi
2015-03-26 10:57       ` Lorenzo Pieralisi
2015-03-24 14:02 ` [patch v11 10/23] ARM64 / ACPI: Get PSCI flags in FADT for PSCI init Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:01   ` Catalin Marinas
2015-03-25 17:01     ` Catalin Marinas
2015-03-25 17:01     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 11/23] ACPI / table: Print GIC information when MADT is parsed Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 12/23] ARM64 / ACPI: Parse MADT for SMP initialization Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:17   ` Catalin Marinas
2015-03-25 17:17     ` Catalin Marinas
2015-03-25 17:17     ` Catalin Marinas
2015-03-26 15:15     ` Will Deacon
2015-03-26 15:15       ` Will Deacon
2015-03-26 15:15       ` Will Deacon
2015-03-26 19:48       ` Hanjun Guo
2015-03-26 19:48         ` Hanjun Guo
2015-03-26 19:48         ` Hanjun Guo
2015-03-26 21:12         ` Will Deacon
2015-03-26 21:12           ` Will Deacon
2015-03-26 21:12           ` Will Deacon
2015-03-26 23:01           ` Hanjun Guo
2015-03-26 23:01             ` Hanjun Guo
2015-03-26 23:01             ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 13/23] ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:21   ` Catalin Marinas
2015-03-25 17:21     ` Catalin Marinas
2015-03-25 17:21     ` Catalin Marinas
2015-03-26  3:49     ` Hanjun Guo
2015-03-26  3:49       ` Hanjun Guo
2015-03-26  3:49       ` Hanjun Guo
2015-03-26 15:13       ` Will Deacon
2015-03-26 15:13         ` Will Deacon
2015-03-26 15:13         ` Will Deacon
2015-03-27 13:40       ` Hanjun Guo
2015-03-27 13:40         ` Hanjun Guo
2015-03-27 13:40         ` Hanjun Guo
2015-03-30 13:58         ` Catalin Marinas
2015-03-30 13:58           ` Catalin Marinas
2015-03-30 13:58           ` Catalin Marinas
2015-03-31  1:49           ` Hanjun Guo
2015-03-31  1:49             ` Hanjun Guo
2015-03-31  1:49             ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 14/23] ACPI / processor: Make it possible to get CPU hardware ID via GICC Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:25   ` Catalin Marinas
2015-03-25 17:25     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 15/23] ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 16/23] irqchip: Add GICv2 specific ACPI boot support Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:27   ` Catalin Marinas
2015-03-25 17:27     ` Catalin Marinas
2015-03-25 17:27     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 17/23] clocksource / arch_timer: Parse GTDT to initialize arch timer Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:28   ` Catalin Marinas
2015-03-25 17:28     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 18/23] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64 Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:29   ` Catalin Marinas
2015-03-25 17:29     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 19/23] XEN / ACPI: Make XEN ACPI depend on X86 Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 15:30   ` Boris Ostrovsky
2015-03-24 15:30     ` Boris Ostrovsky
2015-03-24 15:30     ` Boris Ostrovsky
2015-03-24 17:24     ` Stefano Stabellini
2015-03-24 17:24       ` Stefano Stabellini
2015-03-24 17:24       ` Stefano Stabellini
2015-03-25 11:51       ` Will Deacon
2015-03-25 11:51         ` Will Deacon
2015-03-25 11:51         ` Will Deacon
2015-03-25 15:38         ` Stefano Stabellini
2015-03-25 15:38           ` Stefano Stabellini
2015-03-25 15:38           ` Stefano Stabellini
2015-03-24 14:02 ` [patch v11 20/23] ARM64 / ACPI: Enable ARM64 in Kconfig Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:29   ` Catalin Marinas
2015-03-25 17:29     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 21/23] Documentation: ACPI for ARM64 Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:30   ` Catalin Marinas
2015-03-25 17:30     ` Catalin Marinas
2015-03-24 14:02 ` [patch v11 22/23] ARM64 / ACPI: additions of ACPI documentation for arm64 Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-24 14:02 ` [patch v11 23/23] ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed Hanjun Guo
2015-03-24 14:02   ` Hanjun Guo
2015-03-25 17:31   ` Catalin Marinas
2015-03-25 17:31     ` Catalin Marinas
2015-03-25 17:31     ` Catalin Marinas
2015-03-24 23:04 ` [patch v11 00/23] Introduce ACPI for ARM64 based on ACPI 5.1 Rafael J. Wysocki
2015-03-24 23:04   ` Rafael J. Wysocki
2015-03-25 12:55   ` Hanjun Guo
2015-03-25 12:55     ` Hanjun Guo
2015-03-25 12:55     ` Hanjun Guo
2015-03-25  3:53 ` Ming Lei
2015-03-25  3:53   ` Ming Lei
2015-03-30 16:49 ` Timur Tabi
2015-03-30 16:49   ` Timur Tabi

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.