xen/arm: acpi: Bunch of fixes to use ACPI with SMP and PL011
v2 cover xen/arm: acpi: Bunch of fixes to use ACPI with SMP and PL011
Hello,
This patch series fixes secondary CPUs bring up and the use of the PL011 UART driver when Xen boots using ACPI.
For all the changes see in each patch.
Regards,
Julien Grall (5):
drivers/pl011: ACPI: The interrupt should always be high level
triggered
xen/arm: acpi: The boot CPU does not always match the first entry in
the MADT
xen/arm: acpi: Fix SMP support when booting with ACPI xen/arm: acpi: Remove uncessary check in acpi_map_gic_cpu_interface xen/arm: acpi: Print more error messages in acpi_map_gic_cpu_interface
xen/arch/arm/acpi/boot.c | 40 +++++++++++++++++++++++++++------------- xen/drivers/char/pl011.c | 2 +- 2 files changed, 28 insertions(+), 14 deletions(-)
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 1/5 drivers/pl011: ACPI: The interrupt should always be high level triggered
The SPCR does not specify if the interrupt is edge or level triggered. So the configuration needs to be hardcoded in the code.
Based on the PL011 TRM (see 2.2.8 in ARM DDI 0183G), the interrupt generated will be active high. Whilst the wording may be interpreted differently, the SBSA (section 4.3.2 in ARM-DEN-0029 v2.3) states the PL011 is implemented with a level triggered interrupt.
So the driver should configure the interrupt as high level triggered.
---
Changes in v2:
- Update the commit message
- Effictively configure the interrupt high level triggered
--- xen/drivers/char/pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/char/pl011.c +1 -1
@@ -327,7 +327,7 @@ static int __init pl011_acpi_uart_init(const void *data) }/* trigger/polarity information is not available in spcr */ -irq_set_type (spcr->interrupt,IRQ_TYPE_EDGE_BOTH ); +irq_set_type (spcr->interrupt,IRQ_TYPE_LEVEL_HIGH ); res =pl011_uart_init (spcr->interrupt, spcr->serial_port.address,PAGE_SIZE );
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [for-4.7 v2 1/5] drivers/pl011: ACPI: The interrupt should always be high level triggered
Quoted 11 lines · Julien Grall
The SPCR does not specify if the interrupt is edge or level triggered. So the configuration needs to be hardcoded in the code.
Based on the PL011 TRM (see 2.2.8 in ARM DDI 0183G), the interrupt generated will be active high. Whilst the wording may be interpreted differently, the SBSA (section 4.3.2 in ARM-DEN-0029 v2.3) states the PL011 is implemented with a level triggered interrupt.
So the driver should configure the interrupt as high level triggered.
Signed-off-by Julien Grall <[email protected]>
Shannon, Stefano,
Please reply whether you are OK with this patch. Thanks!
Quoted 30 lines
---
Changes in v2:
- Update the commit message
- Effictively configure the interrupt high level triggered--- xen/drivers/char/pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/char/pl011.c +1
-1@@ -327,7 +327,7 @@ static int __init pl011_acpi_uart_init(const void *data) }/* trigger/polarity information is not available in spcr */ -irq_set_type (spcr->interrupt,IRQ_TYPE_EDGE_BOTH ); +irq_set_type (spcr->interrupt,IRQ_TYPE_LEVEL_HIGH ); res =pl011_uart_init (spcr->interrupt, spcr->serial_port.address,PAGE_SIZE );Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Stefano Stabellini
Reviewed-byRe: [for-4.7 v2 1/5] drivers/pl011: ACPI: The interrupt should always be high level triggered
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · Julien Grall
The SPCR does not specify if the interrupt is edge or level triggered. So the configuration needs to be hardcoded in the code.
Based on the PL011 TRM (see 2.2.8 in ARM DDI 0183G), the interrupt generated will be active high. Whilst the wording may be interpreted differently, the SBSA (section 4.3.2 in ARM-DEN-0029 v2.3) states the PL011 is implemented with a level triggered interrupt.
Quoted 7 lines
Quoted 3 lines
So the driver should configure the interrupt as high level triggered.
Signed-off-by Julien Grall <[email protected]>Shannon, Stefano,
Please reply whether you are OK with this patch. Thanks!
Quoted 25 lines
Quoted 25 lines
---
Changes in v2:
- Update the commit message
- Effictively configure the interrupt high level triggered--- xen/drivers/char/pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/char/pl011.c +1
-1@@ -327,7 +327,7 @@ static int __init pl011_acpi_uart_init(const void *data) }/* trigger/polarity information is not available in spcr */ -irq_set_type (spcr->interrupt,IRQ_TYPE_EDGE_BOTH ); +irq_set_type (spcr->interrupt,IRQ_TYPE_LEVEL_HIGH ); res =pl011_uart_init (spcr->interrupt, spcr->serial_port.address,PAGE_SIZE );Signature · 1 line
1.9.1
Quoted 5 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Shannon Zhao
Reviewed-byRe: [for-4.7 v2 1/5] drivers/pl011: ACPI: The interrupt should always be high level triggered
In reply to Konrad Rzeszutek WilkQuoted 9 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · Julien Grall
The SPCR does not specify if the interrupt is edge or level triggered. So the configuration needs to be hardcoded in the code.
Based on the PL011 TRM (see 2.2.8 in ARM DDI 0183G), the interrupt generated will be active high. Whilst the wording may be interpreted differently, the SBSA (section 4.3.2 in ARM-DEN-0029 v2.3) states the PL011 is implemented with a level triggered interrupt.
Quoted 7 lines
Quoted 3 lines
So the driver should configure the interrupt as high level triggered.
Signed-off-by Julien Grall <[email protected]>Shannon, Stefano,
Please reply whether you are OK with this patch. Thanks!
Quoted 36 lines
Quoted 30 lines
---
Changes in v2:
- Update the commit message
- Effictively configure the interrupt high level triggered--- xen/drivers/char/pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/char/pl011.c +1
-1@@ -327,7 +327,7 @@ static int __init pl011_acpi_uart_init(const void *data) }/* trigger/polarity information is not available in spcr */ -irq_set_type (spcr->interrupt,IRQ_TYPE_EDGE_BOTH ); +irq_set_type (spcr->interrupt,IRQ_TYPE_LEVEL_HIGH ); res =pl011_uart_init (spcr->interrupt, spcr->serial_port.address,PAGE_SIZE );Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Signature · 7 lines
Shannon _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [for-4.7 v2 1/5] drivers/pl011: ACPI: The interrupt should always be high level triggered
Quoted 14 lines · Shannon Zhao
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 10 lines · Julien Grall
The SPCR does not specify if the interrupt is edge or level triggered. So the configuration needs to be hardcoded in the code.
Based on the PL011 TRM (see 2.2.8 in ARM DDI 0183G), the interrupt generated will be active high. Whilst the wording may be interpreted differently, the SBSA (section 4.3.2 in ARM-DEN-0029 v2.3) states the PL011 is implemented with a level triggered interrupt.
So the driver should configure the interrupt as high level triggered.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Julien Grall <[email protected]>Shannon, Stefano,
Please reply whether you are OK with this patch. Thanks!
Reviewed-by Shannon Zhao <[email protected]>
Thanks. applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 2/5 xen/arm: acpi: The boot CPU does not always match the first entry in the MADT
In reply to Julien GrallSince the ACPI 6.0 errata document [1], the first entry in the MADT does not have to correspond to the boot CPU.
Introduce a new variable to know if a MADT entry matching the boot CPU is found. Furthermore, it's not necessary to check if the MPIDR is duplicated for the boot CPU. So the rest of the function can be skipped.
[1] 1380 Unnecessary restrictions to FW vendors in ordering of GIC structures in MADT
---
Changes in v2:
- Modify the loop to start to 1 and not 0
--- xen/arch/arm/acpi/boot.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
xen/arch/arm/acpi/boot.c +11 -5
@@ -37,7 +37,8 @@#include <asm/setup.h> /* Processors with enabled flag and sane MPIDR */ -static unsigned int enabled_cpus; +static unsigned int enabled_cpus =1 ; +static bool __initdata bootcpu_valid;/* total number of cpus in this system */ static unsigned int __initdata total_cpus;
@@ -71,10 +72,15 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) }/* Check if GICC structure of boot CPU is available in the MADT */ -if ( (enabled_cpus ==0 ) && (cpu_logical_map (0 ) != mpidr) ) +if (cpu_logical_map (0 ) == mpidr ) { -printk ("Firmware bug, invalid CPU MPIDR for cpu0: 0x%" PRIx64" in MADT\n" , - mpidr); +if ( bootcpu_valid ) + { +printk ("Firmware bug, duplicate boot CPU MPIDR: 0x%" PRIx64" in MADT\n" , + mpidr); +return ; + } + bootcpu_valid = true;return ; }
@@ -83,7 +89,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)* all initialized entries and check for * duplicates. If any is found just ignore the CPU. */ -for ( i =0 ; i < enabled_cpus; i++ ) +for ( i =1 ; i < enabled_cpus; i++ ) {if (cpu_logical_map (i) == mpidr ) {
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Konrad Rzeszutek Wilk
AppliedRe: [for-4.7 v2 2/5] xen/arm: acpi: The boot CPU does not always match the first entry in the MADT
Quoted 11 lines · Julien Grall
Since the ACPI 6.0 errata document [1], the first entry in the MADT does not have to correspond to the boot CPU.
Introduce a new variable to know if a MADT entry matching the boot CPU is found. Furthermore, it's not necessary to check if the MPIDR is duplicated for the boot CPU. So the rest of the function can be skipped.
[1] 1380 Unnecessary restrictions to FW vendors in ordering of GIC structures in MADT
Signed-off-by Julien Grall <[email protected]>
Applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [for-4.7 v2 2/5] xen/arm: acpi: The boot CPU does not always match the first entry in the MADT
In reply to Julien GrallQuoted 11 lines · Julien Grall
Since the ACPI 6.0 errata document [1], the first entry in the MADT does not have to correspond to the boot CPU.
Introduce a new variable to know if a MADT entry matching the boot CPU is found. Furthermore, it's not necessary to check if the MPIDR is duplicated for the boot CPU. So the rest of the function can be skipped.
[1] 1380 Unnecessary restrictions to FW vendors in ordering of GIC structures in MADT
Signed-off-by Julien Grall <[email protected]>
Quoted 52 lines
---
Changes in v2:
- Modify the loop to start to 1 and not 0--- xen/arch/arm/acpi/boot.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)xen/arch/arm/acpi/boot.c +11
-5@@ -37,7 +37,8 @@#include <asm/setup.h> /* Processors with enabled flag and sane MPIDR */ -static unsigned int enabled_cpus; +static unsigned int enabled_cpus =1 ; +static bool __initdata bootcpu_valid;/* total number of cpus in this system */ static unsigned int __initdata total_cpus;@@ -71,10 +72,15 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) }/* Check if GICC structure of boot CPU is available in the MADT */ -if ( (enabled_cpus ==0 ) && (cpu_logical_map (0 ) != mpidr) ) +if (cpu_logical_map (0 ) == mpidr ) { -printk ("Firmware bug, invalid CPU MPIDR for cpu0: 0x%" PRIx64" in MADT\n" , - mpidr); +if ( bootcpu_valid ) + { +printk ("Firmware bug, duplicate boot CPU MPIDR: 0x%" PRIx64" in MADT\n" , + mpidr); +return ; + } + bootcpu_valid = true;return ; }@@ -83,7 +89,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)* all initialized entries and check for * duplicates. If any is found just ignore the CPU. */ -for ( i =0 ; i < enabled_cpus; i++ ) +for ( i =1 ; i < enabled_cpus; i++ ) {if (cpu_logical_map (i) == mpidr ) {Signature · 1 line
1.9.1
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 3/5 xen/arm: acpi: Fix SMP support when booting with ACPI
In reply to Julien GrallThe variable enabled_cpus is used to know the number of CPU enabled in the MADT.
Currently this variable is used to check the validity of the boot CPU. It will be considered invalid when "enabled_cpus > 1".
However, this condition also means that multiple CPUs are present on the system. So secondary will never be brought up.
The correct way to check the validity of the boot CPU is to use the variable bootcpu_valid.
---
Changes in v2:
- Add Stefano's and Shannon's reviewed-by
--- xen/arch/arm/acpi/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/acpi/boot.c +1 -1
@@ -149,7 +149,7 @@ void __init acpi_smp_init_cpus(void)return ; } -if ( enabled_cpus >1 ) +if ( !bootcpu_valid ) {printk ("MADT missing boot CPU MPIDR, not enabling secondaries\n" );return ;
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Konrad Rzeszutek Wilk
AppliedRe: [for-4.7 v2 3/5] xen/arm: acpi: Fix SMP support when booting with ACPI
Quoted 9 lines · Julien Grall
The variable
enabled_cpusis used to know the number of CPU enabled in the MADT.Currently this variable is used to check the validity of the boot CPU. It will be considered invalid when "
enabled_cpus> 1".However, this condition also means that multiple CPUs are present on the system. So secondary will never be brought up.
Quoted 6 lines
The correct way to check the validity of the boot CPU is to use the variable
bootcpu_valid.Signed-off-by Julien Grall <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Reviewed-by Shannon Zhao <[email protected]>
Applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 4/5 xen/arm: acpi: Remove uncessary check in acpi_map_gic_cpu_interface
In reply to Julien GrallThis part of the code will never be executed when the entry corresponds to the boot CPU.
Also print an error message rather when arch_cpu_init has failed.
---
Changes in v2:
- Add Stefano's and Shannon's reviewed-by
--- xen/arch/arm/acpi/boot.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
xen/arch/arm/acpi/boot.c +8 -7
@@ -51,6 +51,7 @@ static void __init acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) {int i; +int rc;u64 mpidr = processor->arm_mpidr &MPIDR_HWID_MASK ;bool_t enabled = !!(processor->flags &ACPI_MADT_ENABLED );
@@ -102,16 +103,16 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)if ( !acpi_psci_present () )return ; -/* CPU 0 was already initialized */ -if ( enabled_cpus ) +if ( (rc =arch_cpu_init (enabled_cpus,NULL )) <0 ) { -if (arch_cpu_init (enabled_cpus,NULL ) <0 ) -return ; - -/* map the logical cpu id to cpu MPIDR */ -cpu_logical_map (enabled_cpus) = mpidr; +printk ("cpu%d: init failed (0x%" PRIx64" MPIDR): %d\n" , + enabled_cpus, mpidr, rc); +return ; } +/* map the logical cpu id to cpu MPIDR */ +cpu_logical_map (enabled_cpus) = mpidr; + enabled_cpus++; }
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Konrad Rzeszutek Wilk
AppliedRe: [for-4.7 v2 4/5] xen/arm: acpi: Remove uncessary check in acpi_map_gic_cpu_interface
Quoted 8 lines · Julien Grall
This part of the code will never be executed when the entry corresponds to the boot CPU.
Also print an error message rather when
arch_cpu_inithas failed.Signed-off-by Julien Grall <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Reviewed-by Shannon Zhao <[email protected]>
Applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 5/5 xen/arm: acpi: Print more error messages in acpi_map_gic_cpu_interface
In reply to Julien GrallIt's helpful to spot any error without having to modify the hypervisor code.
---
Changes in v2:
- Add Stefano's and Shannon's reviewed-by
--- xen/arch/arm/acpi/boot.c | 7 +++++++ 1 file changed, 7 insertions(+)
xen/arch/arm/acpi/boot.c +7 -0
@@ -63,7 +63,10 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) total_cpus++;if ( !enabled ) + { +printk ("Skipping disabled CPU entry with 0x%" PRIx64" MPIDR\n" , mpidr);return ; + }if ( enabled_cpus >=NR_CPUS ) {
@@ -101,7 +104,11 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) }if ( !acpi_psci_present () ) + { +printk ("PSCI not present, skipping CPU MPIDR 0x%" PRIx64"\n" , + mpidr);return ; + }if ( (rc =arch_cpu_init (enabled_cpus,NULL )) <0 ) {
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Konrad Rzeszutek Wilk
AppliedRe: [for-4.7 v2 5/5] xen/arm: acpi: Print more error messages in acpi_map_gic_cpu_interface
Quoted 6 lines · Julien Grall
It's helpful to spot any error without having to modify the hypervisor code.
Signed-off-by Julien Grall <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Reviewed-by Shannon Zhao <[email protected]>
Applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 20 lines · Julien Grall
Hello,
This patch series fixes secondary CPUs bring up and the use of the PL011 UART driver when Xen boots using ACPI.
For all the changes see in each patch.
Regards,
Julien Grall (5):
drivers/pl011: ACPI: The interrupt should always be high level
triggered
xen/arm: acpi: The boot CPU does not always match the first entry in
the MADT
xen/arm: acpi: Fix SMP support when booting with ACPI xen/arm: acpi: Remove uncessary check inacpi_map_gic_cpu_interfacexen/arm: acpi: Print more error messages inacpi_map_gic_cpu_interface
Quoted 4 lines
xen/arch/arm/acpi/boot.c | 40 +++++++++++++++++++++++++++------------- xen/drivers/char/pl011.c | 2 +- 2 files changed, 28 insertions(+), 14 deletions(-)
Quoted 3 lines
Signature · 1 line
1.9.1
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel