diff mbox

[v10,3/4] ARM64: ACPI: enable ACPI_SPCR_TABLE

Message ID 20160905123617.18775-4-aleksey.makarov@linaro.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Aleksey Makarov Sept. 5, 2016, 12:36 p.m. UTC
SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64

Earlycon should be set up as early as possible.  ACPI boot tables are
mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
is called from setup_arch() and that's where we parse SPCR.
So it has to be opted-in per-arch.

When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
deferred until the DT/ACPI decision is done.  Initialize DT earlycon
if ACPI is disabled.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Tested-by: Christopher Covington <cov@codeaurora.org>
---
 arch/arm64/Kconfig       |  1 +
 arch/arm64/kernel/acpi.c | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Aleksey Makarov Sept. 7, 2016, 9:30 a.m. UTC | #1
On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> 
> Earlycon should be set up as early as possible.  ACPI boot tables are
> mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> is called from setup_arch() and that's where we parse SPCR.
> So it has to be opted-in per-arch.
> 
> When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> if ACPI is disabled.

Hi Will, Catalin,

Can you review this patch and consider ACKing it please?

Thank you
Aleksey Makarov

> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Tested-by: Christopher Covington <cov@codeaurora.org>
> ---
>  arch/arm64/Kconfig       |  1 +
>  arch/arm64/kernel/acpi.c | 11 ++++++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index bc3f00f..11a2d36 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -4,6 +4,7 @@ config ARM64
>  	select ACPI_GENERIC_GSI if ACPI
>  	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
>  	select ACPI_MCFG if ACPI
> +	select ACPI_SPCR_TABLE if ACPI
>  	select ARCH_HAS_DEVMEM_IS_ALLOWED
>  	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
>  	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index 3e4f1a4..252a6d9 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -24,6 +24,7 @@
>  #include <linux/memblock.h>
>  #include <linux/of_fdt.h>
>  #include <linux/smp.h>
> +#include <linux/serial_core.h>
>  
>  #include <asm/cputype.h>
>  #include <asm/cpu_ops.h>
> @@ -206,7 +207,7 @@ void __init acpi_boot_table_init(void)
>  	if (param_acpi_off ||
>  	    (!param_acpi_on && !param_acpi_force &&
>  	     of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
> -		return;
> +		goto done;
>  
>  	/*
>  	 * ACPI is disabled at this point. Enable it in order to parse
> @@ -226,6 +227,14 @@ void __init acpi_boot_table_init(void)
>  		if (!param_acpi_force)
>  			disable_acpi();
>  	}
> +
> +done:
> +	if (acpi_disabled) {
> +		if (earlycon_init_is_deferred)
> +			early_init_dt_scan_chosen_stdout();
> +	} else {
> +		parse_spcr(earlycon_init_is_deferred);
> +	}
>  }
>  
>  #ifdef CONFIG_ACPI_APEI
> 
--
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
Will Deacon Sept. 8, 2016, 11:16 a.m. UTC | #2
On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> 
> On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> > SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> > 
> > Earlycon should be set up as early as possible.  ACPI boot tables are
> > mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> > is called from setup_arch() and that's where we parse SPCR.
> > So it has to be opted-in per-arch.
> > 
> > When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> > deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> > if ACPI is disabled.
> 
> Hi Will, Catalin,
> 
> Can you review this patch and consider ACKing it please?

Hanjun, Al, Mark, Graeme -- any comments on this?

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
Graeme Gregory Sept. 8, 2016, 1:25 p.m. UTC | #3
On Thu, Sep 08, 2016 at 12:16:55PM +0100, Will Deacon wrote:
> On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> > 
> > On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> > > SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> > > 
> > > Earlycon should be set up as early as possible.  ACPI boot tables are
> > > mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> > > is called from setup_arch() and that's where we parse SPCR.
> > > So it has to be opted-in per-arch.
> > > 
> > > When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> > > deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> > > if ACPI is disabled.
> > 
> > Hi Will, Catalin,
> > 
> > Can you review this patch and consider ACKing it please?
> 
> Hanjun, Al, Mark, Graeme -- any comments on this?
> 
We have been using this series internally for a long while for boards
with SBSA UART. So IMO it is good to go. We have worked with some OEMs
to fix firmware bugs discovered with this patch series so it should work
with machines in the wild.

Graeme

--
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
Hanjun Guo Sept. 8, 2016, 1:35 p.m. UTC | #4
On 2016/9/8 19:16, Will Deacon wrote:
> On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
>>
>> On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
>>> SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
>>>
>>> Earlycon should be set up as early as possible.  ACPI boot tables are
>>> mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
>>> is called from setup_arch() and that's where we parse SPCR.
>>> So it has to be opted-in per-arch.
>>>
>>> When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
>>> deferred until the DT/ACPI decision is done.  Initialize DT earlycon
>>> if ACPI is disabled.
>>
>> Hi Will, Catalin,
>>
>> Can you review this patch and consider ACKing it please?
>
> Hanjun, Al, Mark, Graeme -- any comments on this?

We tested this patch on D02, although d02 is 8250 based
uart, but this patch is the core part, which makes sense
to me,

Acked-by: Hanjun Guo <hanjun.guo@linaro.org>

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
Mark Salter Sept. 8, 2016, 4:34 p.m. UTC | #5
On Thu, 2016-09-08 at 12:16 +0100, Will Deacon wrote:
> On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> > 
> > 
> > On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> > > 
> > > SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> > > 
> > > Earlycon should be set up as early as possible.  ACPI boot tables are
> > > mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> > > is called from setup_arch() and that's where we parse SPCR.
> > > So it has to be opted-in per-arch.
> > > 
> > > When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> > > deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> > > if ACPI is disabled.
> > Hi Will, Catalin,
> > 
> > Can you review this patch and consider ACKing it please?
> Hanjun, Al, Mark, Graeme -- any comments on this?
> 
> Will

I think there is a problem still with systems using 32-bit access to 8250
UARTs (i.e. Mustang) but that will need a DBG2 table spec change and
followup patch to resolve.

--
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
Graeme Gregory Sept. 9, 2016, 8:36 a.m. UTC | #6
On Thu, Sep 08, 2016 at 12:34:16PM -0400, Mark Salter wrote:
> On Thu, 2016-09-08 at 12:16 +0100, Will Deacon wrote:
> > On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> > > 
> > > 
> > > On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> > > > 
> > > > SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> > > > 
> > > > Earlycon should be set up as early as possible.  ACPI boot tables are
> > > > mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> > > > is called from setup_arch() and that's where we parse SPCR.
> > > > So it has to be opted-in per-arch.
> > > > 
> > > > When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> > > > deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> > > > if ACPI is disabled.
> > > Hi Will, Catalin,
> > > 
> > > Can you review this patch and consider ACKing it please?
> > Hanjun, Al, Mark, Graeme -- any comments on this?
> > 
> > Will
> 
> I think there is a problem still with systems using 32-bit access to 8250
> UARTs (i.e. Mustang) but that will need a DBG2 table spec change and
> followup patch to resolve.
> 

We went over this with the HPE firmware people. The General Address
Structure has Register Bit Width and Access Size fields. If set
correctly then 8250 UART works.

AFAIK Moonshot firmware has this fix, I have no access to Mustang
firmware to verify on that platform.

Graeme

--
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
Hanjun Guo Sept. 9, 2016, 9:28 a.m. UTC | #7
On 2016/9/9 0:34, Mark Salter wrote:
> On Thu, 2016-09-08 at 12:16 +0100, Will Deacon wrote:
>> On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
>>>
>>>
>>> On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
>>>>
>>>> SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
>>>>
>>>> Earlycon should be set up as early as possible.  ACPI boot tables are
>>>> mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
>>>> is called from setup_arch() and that's where we parse SPCR.
>>>> So it has to be opted-in per-arch.
>>>>
>>>> When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
>>>> deferred until the DT/ACPI decision is done.  Initialize DT earlycon
>>>> if ACPI is disabled.
>>> Hi Will, Catalin,
>>>
>>> Can you review this patch and consider ACKing it please?
>> Hanjun, Al, Mark, Graeme -- any comments on this?
>>
>> Will
>
> I think there is a problem still with systems using 32-bit access to 8250
> UARTs (i.e. Mustang) but that will need a DBG2 table spec change and
> followup patch to resolve.

Hmm, I think you mean we can add patches later with the spec updated,
and this patch works with SBSA pl011 can go for now?

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
Will Deacon Sept. 9, 2016, 9:29 a.m. UTC | #8
On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> 
> On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> > SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> > 
> > Earlycon should be set up as early as possible.  ACPI boot tables are
> > mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> > is called from setup_arch() and that's where we parse SPCR.
> > So it has to be opted-in per-arch.
> > 
> > When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> > deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> > if ACPI is disabled.
> 
> Hi Will, Catalin,
> 
> Can you review this patch and consider ACKing it please?

Since the ACPI folks seem happy with the series, then:

Acked-by: Will Deacon <will.deacon@arm.com>

for this patch.

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
Aleksey Makarov Sept. 9, 2016, 3:07 p.m. UTC | #9
On 09/09/2016 12:29 PM, Will Deacon wrote:
> On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
>>
>> On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
>>> SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
>>>
>>> Earlycon should be set up as early as possible.  ACPI boot tables are
>>> mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
>>> is called from setup_arch() and that's where we parse SPCR.
>>> So it has to be opted-in per-arch.
>>>
>>> When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
>>> deferred until the DT/ACPI decision is done.  Initialize DT earlycon
>>> if ACPI is disabled.
>>
>> Hi Will, Catalin,
>>
>> Can you review this patch and consider ACKing it please?
> 
> Since the ACPI folks seem happy with the series, then:
> 
> Acked-by: Will Deacon <will.deacon@arm.com>
> 
> for this patch.

Thank you.  Can you pull the series?  Should I ask Rafael?

> 
> 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
Will Deacon Sept. 9, 2016, 3:17 p.m. UTC | #10
On Fri, Sep 09, 2016 at 06:07:04PM +0300, Aleksey Makarov wrote:
> On 09/09/2016 12:29 PM, Will Deacon wrote:
> > On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> >>
> >> On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> >>> SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> >>>
> >>> Earlycon should be set up as early as possible.  ACPI boot tables are
> >>> mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> >>> is called from setup_arch() and that's where we parse SPCR.
> >>> So it has to be opted-in per-arch.
> >>>
> >>> When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> >>> deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> >>> if ACPI is disabled.
> >>
> >> Hi Will, Catalin,
> >>
> >> Can you review this patch and consider ACKing it please?
> > 
> > Since the ACPI folks seem happy with the series, then:
> > 
> > Acked-by: Will Deacon <will.deacon@arm.com>
> > 
> > for this patch.
> 
> Thank you.  Can you pull the series?  Should I ask Rafael?

The series should go via Rafael, since the bulk of the changes are
outside of arch/arm64.

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
Mark Salter Sept. 13, 2016, 6:45 p.m. UTC | #11
On Fri, 2016-09-09 at 17:28 +0800, Hanjun Guo wrote:
> On 2016/9/9 0:34, Mark Salter wrote:
> > 
> > On Thu, 2016-09-08 at 12:16 +0100, Will Deacon wrote:
> > > 
> > > On Wed, Sep 07, 2016 at 12:30:19PM +0300, Aleksey Makarov wrote:
> > > > 
> > > > 
> > > > 
> > > > On 09/05/2016 03:36 PM, Aleksey Makarov wrote:
> > > > > 
> > > > > 
> > > > > SBBR mentions SPCR as a mandatory ACPI table.  So enable it for ARM64
> > > > > 
> > > > > Earlycon should be set up as early as possible.  ACPI boot tables are
> > > > > mapped in arch/arm64/kernel/acpi.c:acpi_boot_table_init() that
> > > > > is called from setup_arch() and that's where we parse SPCR.
> > > > > So it has to be opted-in per-arch.
> > > > > 
> > > > > When ACPI_SPCR_TABLE is defined initialization of DT earlycon is
> > > > > deferred until the DT/ACPI decision is done.  Initialize DT earlycon
> > > > > if ACPI is disabled.
> > > > Hi Will, Catalin,
> > > > 
> > > > Can you review this patch and consider ACKing it please?
> > > Hanjun, Al, Mark, Graeme -- any comments on this?
> > > 
> > > Will
> > I think there is a problem still with systems using 32-bit access to 8250
> > UARTs (i.e. Mustang) but that will need a DBG2 table spec change and
> > followup patch to resolve.
> Hmm, I think you mean we can add patches later with the spec updated,
> and this patch works with SBSA pl011 can go for now?

Yes, I think this series is fine for now.

> 
> 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
diff mbox

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index bc3f00f..11a2d36 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -4,6 +4,7 @@  config ARM64
 	select ACPI_GENERIC_GSI if ACPI
 	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
 	select ACPI_MCFG if ACPI
+	select ACPI_SPCR_TABLE if ACPI
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 3e4f1a4..252a6d9 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -24,6 +24,7 @@ 
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
 #include <linux/smp.h>
+#include <linux/serial_core.h>
 
 #include <asm/cputype.h>
 #include <asm/cpu_ops.h>
@@ -206,7 +207,7 @@  void __init acpi_boot_table_init(void)
 	if (param_acpi_off ||
 	    (!param_acpi_on && !param_acpi_force &&
 	     of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
-		return;
+		goto done;
 
 	/*
 	 * ACPI is disabled at this point. Enable it in order to parse
@@ -226,6 +227,14 @@  void __init acpi_boot_table_init(void)
 		if (!param_acpi_force)
 			disable_acpi();
 	}
+
+done:
+	if (acpi_disabled) {
+		if (earlycon_init_is_deferred)
+			early_init_dt_scan_chosen_stdout();
+	} else {
+		parse_spcr(earlycon_init_is_deferred);
+	}
 }
 
 #ifdef CONFIG_ACPI_APEI