linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/4] ACPI: parse the SPCR table
@ 2016-05-20 13:03 Aleksey Makarov
  2016-05-20 13:03 ` [PATCH v8 1/4] of/serial: move earlycon early_param handling to serial Aleksey Makarov
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Aleksey Makarov @ 2016-05-20 13:03 UTC (permalink / raw)
  To: linux-arm-kernel

'ARM Server Base Boot Requirements' [1] mentions SPCR (Serial Port Console
Redirection Table) [2] as a mandatory ACPI table that specifies the
configuration of serial console.

Move "earlycon" early_param handling to earlycon.c to parse this option once

Parse SPCR table, setup earlycon and register specified console.

Enable parsing this table on 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() 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.

Implement console_match() for pl011.

Based on the work by Leif Lindholm [3]
Thanks to Peter Hurley for explaining how this should work.

Should be applied to next-20160520
Tested on QEMU and ThunderX.
SPCR support is included in QEMU's ARM64 mach-virt since 2.4 release.

v8:
- rebase to next-20160520
- remove the patch "ACPICA: Headers: Add new constants for the DBG2 ACPI table"
  as it have got to linux-next
- add Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Reviewed-by:
  Peter Hurley <peter@hurleysoftware.com> (but see below)
- fix the patch "serial: pl011: add console matching function".  The patch by
  Christopher Covington [4] specifies that SBSA uart does 32-bit access to
  registers and this breaks the match function.  In this series the function
  was changed to match when SPCR specifies both mmio32 and mmio access.
  I removed Acked-by: Greg from this patch because of these changes.

v7:
https://lkml.kernel.org/g/1459431629-27934-1-git-send-email-aleksey.makarov at linaro.org
- add Acked-by: Rob Herring for "of/serial: move earlycon early_param handling
  to serial"
- call DT earlycon initialization from the arch ACPI code, not from parse_spcr()
  (Rafael J. Wysocki)
- fix a few minor issues (Rafael J. Wysocki)

v6:
https://lkml.kernel.org/g/1458823925-19560-1-git-send-email-aleksey.makarov at linaro.org
- add documentation for parse_spcr() functioin (Yury Norov)
- don't initialize err variable (Yury Norov)
- add __initdata for the earlycon_init_is_deferred flag variable
- rename the function exported in "of/serial: move earlycon early_param handling
  to serial" to avoid clash with the function from arch/microblaze/kernel/prom.c
- defer initialization of DT earlycon until DT/ACPI decision is made
  (Rob Herring, Peter Hurley)
- use snprintf instead of sprintf (Andy Shevchenko)
- drop patch that adds EARLYCON_DECLARE for pl011 as EARLYCON_DECLARE is
  equivalent to OF_EARLYCON_DECLARE for 4.6+ (Peter Hurley).  This means that
  SPCR earlycon will not work on the kernels before 4.6

v5:
https://lkml.kernel.org/g/1458643595-14719-1-git-send-email-aleksey.makarov at linaro.org
- drop patch "serial: pl011: use ACPI SPCR to setup 32-bit access" because
  it is ugly. Also because Christopher Covington came with a better solution [4]
- remove error message when the table is not provided by ACPI (Andy Shevchenko)
- rewrite spcr.c following the suggestions by Peter Hurley
- add console_match() for pl011 in a separate patch
- add EARLYCON_DECLARE for pl011 in a separate patch
- add patch "of/serial: move earlycon early_param handling to serial" from
  the GDB2 series

v4:
https://lkml.kernel.org/g/1456747355-15692-1-git-send-email-aleksey.makarov at linaro.org
- drop patch "ACPI: change __init to __ref for early_acpi_os_unmap_memory()"
  ACPI developers work on a new API and asked not to do that.
  Instead, use acpi_get_table_with_size()/early_acpi_os_unmap_memory() once
  and cache the result. (Lv Zheng)
- fix some style issues (Yury Norov)

v3:
https://lkml.kernel.org/g/1455559532-8305-1-git-send-email-aleksey.makarov at linaro.org

Greg Kroah-Hartman did not like v2 so I have rewritten this patchset:

- drop acpi_match() member of struct console
- drop implementations of this member for pl011 and 8250
- drop the patch that renames some vars in printk.c as it is not needed anymore
- drop patch that introduces system wide acpi_table_parse2().
  Instead introduce a custom acpi_table_parse_spcr() in spcr.c

Instead of introducing a new match_acpi() member of struct console,
this patchset introduces a new function acpi_console_check().
This function is called when a new uart is registered at serial_core.c
the same way OF code checks for console.  If the registered uart is the
console specified by SPCR table, this function calls add_preferred_console()

The restrictions of this approach are:

- only serial consoles can be set up
- only consoles specified by the memory/io address can be set up
  (SPCR can specify devices by PCI id/PCI address)

v2:
https://lkml.kernel.org/g/1455299022-11641-1-git-send-email-aleksey.makarov at linaro.org
- don't use SPCR if user specified console in command line
- fix initialization order of newcon->index = 0
- rename some variables at printk.c (Joe Perches, Peter Hurley)
- enable ACPI_SPCR_TABLE in a separate patch (Andy Shevchenko)
- remove the retry loop for console registering (Peter Hurley).
  Instead, obtain SPCR with acpi_get_table().  That works after
  call to acpi_early_init() i. e. in any *_initcall()
- describe design decision behind introducing acpi_match() (Peter Hurley)
- fix compilation for x86 + ACPI (Graeme Gregory)
- introduce DBG2 constants in a separate patch (Andy Shevchenko)
- fix a typo in DBG2 constants (Andy Shevchenko)
- add ACPI_DBG2_ARM_SBSA_32BIT constant (Christopher Covington)
- add support for ACPI_DBG2_ARM_SBSA_* consoles (Christopher Covington)
- add documentation for functions
- add a patch that uses SPCR to find if SBSA serial driver should use 32-bit
  accessor functions (Christopher Covington)
- change __init to __ref for early_acpi_os_unmap_memory() in a separate patch
- introduce acpi_table_parse2() in a separate patch
- fix fetching the SPCR table early (Mark Salter)
- add a patch from Mark Salter that introduces support for matching 8250-based
  consoles

v1:
https://lkml.kernel.org/g/1453722324-22407-1-git-send-email-aleksey.makarov at linaro.org

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
[2] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx
[3] https://lkml.kernel.org/g/1441716217-23786-1-git-send-email-leif.lindholm at linaro.org
[4] https://lkml.kernel.org/g/1457415800-8799-1-git-send-email-cov at codeaurora.org

Aleksey Makarov (3):
  ACPI: parse SPCR and enable matching console
  ARM64: ACPI: enable ACPI_SPCR_TABLE
  serial: pl011: add console matching function

Leif Lindholm (1):
  of/serial: move earlycon early_param handling to serial

 arch/arm64/Kconfig              |   1 +
 arch/arm64/kernel/acpi.c        |  11 +++-
 drivers/acpi/Kconfig            |   3 ++
 drivers/acpi/Makefile           |   1 +
 drivers/acpi/spcr.c             | 111 ++++++++++++++++++++++++++++++++++++++++
 drivers/of/fdt.c                |  11 +---
 drivers/tty/serial/amba-pl011.c |  56 ++++++++++++++++++++
 drivers/tty/serial/earlycon.c   |  19 ++++++-
 include/linux/acpi.h            |   6 +++
 include/linux/of_fdt.h          |   2 +
 include/linux/serial_core.h     |   6 +++
 11 files changed, 214 insertions(+), 13 deletions(-)
 create mode 100644 drivers/acpi/spcr.c

-- 
2.8.2

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH v8 0/4] ACPI: parse the SPCR table
@ 2016-06-15  1:22 Itaru Kitayama
  2016-06-15 13:25 ` Aleksey Makarov
  0 siblings, 1 reply; 21+ messages in thread
From: Itaru Kitayama @ 2016-06-15  1:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Aleksey,

I've wondering whether your V8 patch set should support !4K-page kernels.
So far I've seen that on Mustang, 4K-page kernel boots fine, but 64K-page
kernel always ends up with a panic.

[    0.000000] cma: Reserved 512 MiB at 0x00000040e0000000
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000043FA859014 000024 (v02 APM   )
[    0.000000] ACPI: XSDT 0x00000043FA8580E8 00007C (v01 APM XGENE    
00000003      01000013)
[    0.000000] ACPI: FACP 0x00000043FA850000 00010C (v05 APM XGENE    
00000003 INTL 20140724)
[    0.000000] ACPI: DSDT 0x00000043FA851000 003A00 (v05 APM APM88xxx 
00000001 INTL 20140724)
[    0.000000] ACPI: DBG2 0x00000043FA855000 0000AA (v00 APMC0D XGENEDBG 
00000000 INTL 20140724)
[    0.000000] ACPI: GTDT 0x00000043FA84E000 0000E0 (v02 APM XGENE    
00000001 INTL 20140724)
[    0.000000] ACPI: MCFG 0x00000043FA84D000 00003C (v01 APM XGENE    
00000002 INTL 20140724)
[    0.000000] ACPI: SPCR 0x00000043FA84C000 000050 (v02 APMC0D XGENESPC 
00000000 INTL 20140724)
[    0.000000] ACPI: SSDT 0x00000043FA84B000 00002D (v02 APM XGENE    
00000001 INTL 20140724)
[    0.000000] ACPI: BERT 0x00000043FA84A000 000030 (v01 APM XGENE    
00000002 INTL 20140724)
[    0.000000] ACPI: HEST 0x00000043FA849000 0002A8 (v01 APM XGENE    
00000002 INTL 20140724)
[    0.000000] ACPI: APIC 0x00000043FA848000 0002A4 (v03 APM XGENE    
00000003      01000013)
[    0.000000] ACPI: SSDT 0x00000043FA847000 000063 (v02 REDHAT MACADDRS 
00000001      01000013)
[    0.000000] ACPI: SSDT 0x00000043FA846000 000032 (v02 REDHAT UARTCLKS 
00000001      01000013)
[    0.000000] ACPI: SPCR: console: uart,mmio,0x1c020000,115200
[    0.000000] memblock_reserve: [0x000043ffff0000-0x000043ffffffff] 
flags 0x0 memblock_alloc_range_nid+0x64/0x78
[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at arch/arm64/mm/mmu.c:480!
[    0.000000] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0-rc1-dev+ #28
[    0.000000] Hardware name: APM X-Gene Mustang board (DT)
[    0.000000] task: ffff000008e18980 ti: ffff000008df0000 task.ti: 
ffff000008df0000
[    0.000000] PC is at map_kernel_segment+0x44/0xb0
[    0.000000] LR is at paging_init+0x84/0x5b0
[    0.000000] pc : [<ffff000008b350e0>] lr : [<ffff000008b351d0>] 
pstate: 600002c5
[    0.000000] sp : ffff000008df3e60
[    0.000000] x29: ffff000008df3e60 x28: 0000004000d3001c
[    0.000000] x27: 00000040009b2074 x26: 0000004001bd0000
[    0.000000] x25: ffff7fdffe5e0000 x24: 00000043ffff0000
[    0.000000] x23: 0000000000000000 x22: 000000000078b000
[    0.000000] x21: 0000004000235000 x20: ffff000008b30000
[    0.000000] x19: ffff000008f01300 x18: 0000000000000006
[    0.000000] x17: ffff00000993a638 x16: 0000000000000004
[    0.000000] x15: ffff00000992e03d x14: 2030783020736761
[    0.000000] x13: 6c66205d66666666 x12: 6666666633343030
[    0.000000] x11: 303078302d303030 x10: 3066666666333430
[    0.000000] x9 : 0000000000000000 x8 : ffff7fdffe620000
[    0.000000] x7 : 0000000000000000 x6 : 000000000000003f
[    0.000000] x5 : 0000000000005000 x4 : ffff000008f01300
[    0.000000] x3 : 00c8000000000713 x2 : ffff0000087c0000
[    0.000000] x1 : ffff000008035000 x0 : ffff7fdffe5e0000
[    0.000000]
[    0.000000] Process swapper (pid: 0, stack limit = 0xffff000008df0020)
[    0.000000] Stack: (0xffff000008df3e60 to 0xffff000008df4000)
[    0.000000] 3e60: ffff000008df3ea0 ffff000008b351d0 ffff000008f01300 
ffff000008b30000
[    0.000000] 3e80: ffff000008035000 ffff0000087c0000 0000000000000000 
ffff000008b55480
[    0.000000] 3ea0: ffff000008df3f20 ffff000008b32708 ffff000008035000 
ffff000008e30cd8
[    0.000000] 3ec0: ffff7fdffe800000 ffff000008e10000 0000000000000000 
0000004000200000
[    0.000000] 3ee0: 0000004001ba0000 0000004001bd0000 00000040009b2074 
0000004000d3001c
[    0.000000] 3f00: ffff7fdffe800000 0000004000200000 ffff7fdffe620000 
000000000000010c
[    0.000000] 3f20: ffff000008df3fa0 ffff000008b30848 ffff000008b7d588 
ffff000008f00000
[    0.000000] 3f40: ffff000008f00000 ffff000008e10000 0000000000000000 
0000004000200000
[    0.000000] 3f60: 0000004001ba0000 0000004001bd0000 0000000000000001 
000000401fe00000
[    0.000000] 3f80: ffffffffffffffff 0000000000000000 0000000000000080 
fefefefefefefefe
[    0.000000] 3fa0: 0000000000000000 ffff000008b301bc 00000043f7f1f408 
0000000000000e12
[    0.000000] 3fc0: 000000401fe00000 0000000030d00800 0000000000000000 
0000004000200000
[    0.000000] 3fe0: 0000000000000000 ffff000008b7d588 0000000000000000 
0000000000000000
[    0.000000] Call trace:
[    0.000000] Exception stack(0xffff000008df3ca0 to 0xffff000008df3dc0)
[    0.000000] 3ca0: ffff000008f01300 ffff000008b30000 ffff000008df3e60 
ffff000008b350e0
[    0.000000] 3cc0: 0000004001ba0000 0000004001bd0000 00000040009b2074 
0000004000d3001c
[    0.000000] 3ce0: 0000000000000030 0000000000000000 000000000993045a 
00000000000002c0
[    0.000000] 3d00: ffff000008df3e00 ffff000008df3e00 ffff000008df3dc0 
00000000ffffffc8
[    0.000000] 3d20: ffff000008df3d50 ffff00000811b3d8 ffff000008df3e00 
ffff000008df3e00
[    0.000000] 3d40: ffff7fdffe5e0000 ffff000008035000 ffff0000087c0000 
00c8000000000713
[    0.000000] 3d60: ffff000008f01300 0000000000005000 000000000000003f 
0000000000000000
[    0.000000] 3d80: ffff7fdffe620000 0000000000000000 3066666666333430 
303078302d303030
[    0.000000] 3da0: 6666666633343030 6c66205d66666666 2030783020736761 
ffff00000992e03d
[    0.000000] [<ffff000008b350e0>] map_kernel_segment+0x44/0xb0
[    0.000000] [<ffff000008b351d0>] paging_init+0x84/0x5b0
[    0.000000] [<ffff000008b32708>] setup_arch+0x198/0x534
[    0.000000] [<ffff000008b30848>] start_kernel+0x70/0x388
[    0.000000] [<ffff000008b301bc>] __primary_switched+0x30/0x74
[    0.000000] Code: cb150035 92403ea5 cb010056 b4000045 (d4210000)
[    0.000000] ---[ end trace cb88537fdc8fa200 ]---
[    0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[    0.000000] ---[ end Kernel panic - not syncing: Attempted to kill 
the idle task!

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

end of thread, other threads:[~2016-08-03  8:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-20 13:03 [PATCH v8 0/4] ACPI: parse the SPCR table Aleksey Makarov
2016-05-20 13:03 ` [PATCH v8 1/4] of/serial: move earlycon early_param handling to serial Aleksey Makarov
2016-05-20 13:03 ` [PATCH v8 2/4] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-05-20 20:42   ` Rafael J. Wysocki
2016-05-20 13:03 ` [PATCH v8 3/4] ARM64: ACPI: enable ACPI_SPCR_TABLE Aleksey Makarov
2016-05-20 13:03 ` [PATCH v8 4/4] serial: pl011: add console matching function Aleksey Makarov
2016-06-02 18:02   ` Aleksey Makarov
2016-06-20 12:26     ` Aleksey Makarov
2016-06-20 15:19       ` Russell King - ARM Linux
2016-08-03  8:33         ` Graeme Gregory
2016-06-22 10:35   ` Aleksey Makarov
2016-06-22 12:18   ` Yury Norov
2016-06-22 14:08     ` Peter Hurley
2016-06-22 20:45       ` Yury Norov
2016-07-11 14:40         ` Matthias Brugger
2016-07-11 15:50           ` Matthias Brugger
2016-05-27 13:41 ` [PATCH v8 0/4] ACPI: parse the SPCR table Aleksey Makarov
2016-06-17 23:24 ` Timur Tabi
2016-06-20 16:04 ` Aleksey Makarov
  -- strict thread matches above, loose matches on Subject: below --
2016-06-15  1:22 Itaru Kitayama
2016-06-15 13:25 ` Aleksey Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).