Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1316544 > unrolled thread

[PATCH 0/3] ACPI: parse the SPCR table

Started byAleksey Makarov <aleksey.makarov@linaro.org>
First post2016-01-25 12:50 +0100
Last post2016-01-27 14:50 +0100
Articles 16 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] ACPI: parse the SPCR table Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 12:50 +0100
    [PATCH 1/3] printk: make preferred_console local static bool Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 12:50 +0100
      Re: [PATCH 1/3] printk: make preferred_console local static bool Joe Perches <joe@perches.com> - 2016-01-25 13:50 +0100
        Re: [PATCH 1/3] printk: make preferred_console local static bool Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 14:00 +0100
          Re: [PATCH 1/3] printk: make preferred_console local static bool Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 14:30 +0100
            Re: [PATCH 1/3] printk: make preferred_console local static bool Peter Hurley <peter@hurleysoftware.com> - 2016-01-25 17:20 +0100
          Re: [PATCH 1/3] printk: make preferred_console local static bool Joe Perches <joe@perches.com> - 2016-01-25 14:30 +0100
      Re: [PATCH 1/3] printk: make preferred_console local static bool Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-01-25 15:30 +0100
        Re: [PATCH 1/3] printk: make preferred_console local static bool Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 16:00 +0100
    [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 12:50 +0100
      Re: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-01-25 15:30 +0100
        Re: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-25 16:10 +0100
      Re: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-01-25 15:30 +0100
    Re: [PATCH 0/3] ACPI: parse the SPCR table Peter Hurley <peter@hurleysoftware.com> - 2016-01-25 17:20 +0100
      Re: [PATCH 0/3] ACPI: parse the SPCR table Aleksey Makarov <aleksey.makarov@linaro.org> - 2016-01-27 13:30 +0100
        Re: [PATCH 0/3] ACPI: parse the SPCR table One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-01-27 14:50 +0100

#1316544 — [PATCH 0/3] ACPI: parse the SPCR table

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 12:50 +0100
Subject[PATCH 0/3] ACPI: parse the SPCR table
Message-ID<qUNOG-3ga-17@gated-at.bofh.it>
This patchset is based on the patchset by Leif Lindholm [1]

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

Licensing concerns have prevented implementing it in the past, but as of
10 August 2015, these tables have both been released also under 
OWF 1.0 [4].

SPCR support is included in QEMU's ARM mach-virt since 2.4 release.

Parse the SPCR table and check if any registered console match
the description.  If it does, enable that console.

To implement that, introduce a new member
int (*acpi_match)(struct console *, struct acpi_table_spcr *);
of struct console.  It allows drivers to check if they provide
a matching console device.

Also add an implementation of this member function to the pl011 driver
and fix a minor issue in kernel/printk/printk.c

[1] https://lkml.kernel.org/g/1441716217-23786-1-git-send-email-leif.lindholm@linaro.org
[2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
[3] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx
[4] http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0

Aleksey Makarov (3):
  printk: make preferred_console local static bool
  ACPI: parse SPCR and enable matching console
  serial: pl011: add acpi_match for amba-pl011.c

 arch/arm64/Kconfig              |  1 +
 drivers/acpi/Kconfig            |  3 ++
 drivers/acpi/Makefile           |  1 +
 drivers/acpi/spcr.c             | 85 +++++++++++++++++++++++++++++++++++++
 drivers/tty/serial/amba-pl011.c | 14 ++++++
 include/acpi/actbl2.h           |  4 ++
 include/linux/console.h         | 12 ++++++
 kernel/printk/printk.c          | 94 +++++++++++++++++++++++++++++++----------
 8 files changed, 191 insertions(+), 23 deletions(-)
 create mode 100644 drivers/acpi/spcr.c

-- 
2.7.0

[toc] | [next] | [standalone]


#1316547 — [PATCH 1/3] printk: make preferred_console local static bool

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 12:50 +0100
Subject[PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUNOH-3ga-43@gated-at.bofh.it>
In reply to#1316544
The variable preferred_console is used only inside register_console()
and it's semantics is boolean.  Make it clear.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 kernel/printk/printk.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 2ce8826..37e531f 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -143,7 +143,6 @@ static struct console *exclusive_console;
 static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
 
 static int selected_console = -1;
-static int preferred_console = -1;
 int console_set_on_cmdline;
 EXPORT_SYMBOL(console_set_on_cmdline);
 
@@ -2456,6 +2455,7 @@ void register_console(struct console *newcon)
 	unsigned long flags;
 	struct console *bcon = NULL;
 	struct console_cmdline *c;
+	static bool preferred_console;
 
 	if (console_drivers)
 		for_each_console(bcon)
@@ -2482,15 +2482,15 @@ void register_console(struct console *newcon)
 	if (console_drivers && console_drivers->flags & CON_BOOT)
 		bcon = console_drivers;
 
-	if (preferred_console < 0 || bcon || !console_drivers)
-		preferred_console = selected_console;
+	if (!preferred_console || bcon || !console_drivers)
+		preferred_console = selected_console >= 0;
 
 	/*
 	 *	See if we want to use this console driver. If we
 	 *	didn't select a console we take the first one
 	 *	that registers here.
 	 */
-	if (preferred_console < 0) {
+	if (!preferred_console) {
 		if (newcon->index < 0)
 			newcon->index = 0;
 		if (newcon->setup == NULL ||
@@ -2498,7 +2498,7 @@ void register_console(struct console *newcon)
 			newcon->flags |= CON_ENABLED;
 			if (newcon->device) {
 				newcon->flags |= CON_CONSDEV;
-				preferred_console = 0;
+				preferred_console = true;
 			}
 		}
 	}
@@ -2533,7 +2533,7 @@ void register_console(struct console *newcon)
 		newcon->flags |= CON_ENABLED;
 		if (i == selected_console) {
 			newcon->flags |= CON_CONSDEV;
-			preferred_console = selected_console;
+			preferred_console = true;
 		}
 		break;
 	}
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1316643 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromJoe Perches <joe@perches.com>
Date2016-01-25 13:50 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUOKK-3WU-1@gated-at.bofh.it>
In reply to#1316547
On Mon, 2016-01-25 at 17:45 +0600, Aleksey Makarov wrote:
> The variable preferred_console is used only inside register_console()
> and it's semantics is boolean.  Make it clear.

This loses the index of the preferred console.
I'm not sure this is better.

[toc] | [prev] | [next] | [standalone]


#1316673 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 14:00 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUOUr-40h-35@gated-at.bofh.it>
In reply to#1316643

On 25.01.2016 18:45, Joe Perches wrote:
> On Mon, 2016-01-25 at 17:45 +0600, Aleksey Makarov wrote:
>> The variable preferred_console is used only inside register_console()
>> and it's semantics is boolean.  Make it clear.
>
> This loses the index of the preferred console.
> I'm not sure this is better.

That index is not used anywhere.  I believe the patch makes things clear.

Also, it indexes the array console_cmdline.  With introduction of the 
ACPI-selected console it does not have any sense and I would have to 
change it anyway.

Thank you
Aleksey Makarov

[toc] | [prev] | [next] | [standalone]


#1316701 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 14:30 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUPns-4s7-5@gated-at.bofh.it>
In reply to#1316673

On 25.01.2016 19:23, Joe Perches wrote:
> On Mon, 2016-01-25 at 18:51 +0600, Aleksey Makarov wrote:
>>
>> On 25.01.2016 18:45, Joe Perches wrote:
>>> On Mon, 2016-01-25 at 17:45 +0600, Aleksey Makarov wrote:
>>>> The variable preferred_console is used only inside register_console()
>>>> and it's semantics is boolean.  Make it clear.
>>>
>>> This loses the index of the preferred console.
>>> I'm not sure this is better.
>>
>> That index is not used anywhere.  I believe the patch makes things clear.
>
> Well, with this change the name and its use
> is a bit misleading.  Maybe changing it to
> something like use_selected_console is better.

Thank you. I will fix this in the next version.

[toc] | [prev] | [next] | [standalone]


#1316940 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromPeter Hurley <peter@hurleysoftware.com>
Date2016-01-25 17:20 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUS1X-6yn-7@gated-at.bofh.it>
In reply to#1316701
On 01/25/2016 05:28 AM, Aleksey Makarov wrote:
> 
> 
> On 25.01.2016 19:23, Joe Perches wrote:
>> On Mon, 2016-01-25 at 18:51 +0600, Aleksey Makarov wrote:
>>>
>>> On 25.01.2016 18:45, Joe Perches wrote:
>>>> On Mon, 2016-01-25 at 17:45 +0600, Aleksey Makarov wrote:
>>>>> The variable preferred_console is used only inside register_console()
>>>>> and it's semantics is boolean.  Make it clear.
>>>>
>>>> This loses the index of the preferred console.
>>>> I'm not sure this is better.
>>>
>>> That index is not used anywhere.  I believe the patch makes things clear.
>>
>> Well, with this change the name and its use
>> is a bit misleading.  Maybe changing it to
>> something like use_selected_console is better.
> 
> Thank you. I will fix this in the next version.

Ideally, the transform should be

 preferred_console => has_preferred
 selected_console => preferred_console

This would match the actual use of add_preferred_console()

Regards,
Peter Hurley

[toc] | [prev] | [next] | [standalone]


#1316702 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromJoe Perches <joe@perches.com>
Date2016-01-25 14:30 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUPns-4s7-7@gated-at.bofh.it>
In reply to#1316673
On Mon, 2016-01-25 at 18:51 +0600, Aleksey Makarov wrote:
> 
> On 25.01.2016 18:45, Joe Perches wrote:
> > On Mon, 2016-01-25 at 17:45 +0600, Aleksey Makarov wrote:
> > > The variable preferred_console is used only inside register_console()
> > > and it's semantics is boolean.  Make it clear.
> > 
> > This loses the index of the preferred console.
> > I'm not sure this is better.
> 
> That index is not used anywhere.  I believe the patch makes things clear.

Well, with this change the name and its use
is a bit misleading.  Maybe changing it to
something like use_selected_console is better.

[toc] | [prev] | [next] | [standalone]


#1316749 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2016-01-25 15:30 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUQjw-5hx-7@gated-at.bofh.it>
In reply to#1316547
On Mon, Jan 25, 2016 at 1:45 PM, Aleksey Makarov
<aleksey.makarov@linaro.org> wrote:
> The variable preferred_console is used only inside register_console()
> and it's semantics is boolean.  Make it clear.

However the patch looks okay it brings imbalance to understanding how
exactly the preferred console is chosen.
Even in case of restricted usage I would leave things as is for now.

>
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>  kernel/printk/printk.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 2ce8826..37e531f 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -143,7 +143,6 @@ static struct console *exclusive_console;
>  static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
>
>  static int selected_console = -1;
> -static int preferred_console = -1;
>  int console_set_on_cmdline;
>  EXPORT_SYMBOL(console_set_on_cmdline);
>
> @@ -2456,6 +2455,7 @@ void register_console(struct console *newcon)
>         unsigned long flags;
>         struct console *bcon = NULL;
>         struct console_cmdline *c;
> +       static bool preferred_console;
>
>         if (console_drivers)
>                 for_each_console(bcon)
> @@ -2482,15 +2482,15 @@ void register_console(struct console *newcon)
>         if (console_drivers && console_drivers->flags & CON_BOOT)
>                 bcon = console_drivers;
>
> -       if (preferred_console < 0 || bcon || !console_drivers)
> -               preferred_console = selected_console;
> +       if (!preferred_console || bcon || !console_drivers)
> +               preferred_console = selected_console >= 0;
>
>         /*
>          *      See if we want to use this console driver. If we
>          *      didn't select a console we take the first one
>          *      that registers here.
>          */
> -       if (preferred_console < 0) {
> +       if (!preferred_console) {
>                 if (newcon->index < 0)
>                         newcon->index = 0;
>                 if (newcon->setup == NULL ||
> @@ -2498,7 +2498,7 @@ void register_console(struct console *newcon)
>                         newcon->flags |= CON_ENABLED;
>                         if (newcon->device) {
>                                 newcon->flags |= CON_CONSDEV;
> -                               preferred_console = 0;
> +                               preferred_console = true;
>                         }
>                 }
>         }
> @@ -2533,7 +2533,7 @@ void register_console(struct console *newcon)
>                 newcon->flags |= CON_ENABLED;
>                 if (i == selected_console) {
>                         newcon->flags |= CON_CONSDEV;
> -                       preferred_console = selected_console;
> +                       preferred_console = true;
>                 }
>                 break;
>         }
> --
> 2.7.0
>



-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1316786 — Re: [PATCH 1/3] printk: make preferred_console local static bool

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 16:00 +0100
SubjectRe: [PATCH 1/3] printk: make preferred_console local static bool
Message-ID<qUQMz-5vw-27@gated-at.bofh.it>
In reply to#1316749

On 25.01.2016 20:24, Andy Shevchenko wrote:
> On Mon, Jan 25, 2016 at 1:45 PM, Aleksey Makarov
> <aleksey.makarov@linaro.org> wrote:
>> The variable preferred_console is used only inside register_console()
>> and it's semantics is boolean.  Make it clear.
>
> However the patch looks okay it brings imbalance to understanding how
> exactly the preferred console is chosen.

On the contrary, I would say it makes things more clear.

Also please consider this patch preparatory for the further changes.
See my replies to Joe Perches.

[toc] | [prev] | [next] | [standalone]


#1316548 — [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 12:50 +0100
Subject[PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c
Message-ID<qUNOH-3ga-49@gated-at.bofh.it>
In reply to#1316544
Add an implementation of acpi_match() to the pl011 driver.
It allows to check if the console matches one specified with
ACPI SPCR table.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 14 ++++++++++++++
 include/acpi/actbl2.h           |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 899a771..3f4aa1b 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2189,12 +2189,26 @@ static int __init pl011_console_setup(struct console *co, char *options)
 	return uart_set_options(&uap->port, co, baud, parity, bits, flow);
 }
 
+static int __init pl011_console_acpi_match(struct console *co,
+					   struct acpi_table_spcr *spcr)
+{
+	struct uart_amba_port *uap = amba_ports[co->index];
+
+	if (spcr->interface_type == ACPI_DBG2_ARM_PL011 &&
+	    spcr->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY &&
+	    spcr->serial_port.address == (u64)uap->port.mapbase)
+		return 0;
+
+	return -ENODEV;
+}
+
 static struct uart_driver amba_reg;
 static struct console amba_console = {
 	.name		= "ttyAMA",
 	.write		= pl011_console_write,
 	.device		= uart_console_device,
 	.setup		= pl011_console_setup,
+	.acpi_match	= pl011_console_acpi_match,
 	.flags		= CON_PRINTBUFFER,
 	.index		= -1,
 	.data		= &amba_reg,
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 6e28f54..ce4cb37 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -371,6 +371,10 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000e
+#define ACPI_DBG2_ARM_DCC           0x000f
+#define ACPI_DBG2_DCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1316751 — Re: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2016-01-25 15:30 +0100
SubjectRe: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c
Message-ID<qUQjw-5hx-11@gated-at.bofh.it>
In reply to#1316548
On Mon, Jan 25, 2016 at 4:21 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Jan 25, 2016 at 1:45 PM, Aleksey Makarov
> <aleksey.makarov@linaro.org> wrote:
>> Add an implementation of acpi_match() to the pl011 driver.
>> It allows to check if the console matches one specified with
>> ACPI SPCR table.
>
> I don't know Rafael's opinion on this, but I would split it to extend
> ACPI header first with reference to newest revision of Microsoft
> document.


>> --- a/include/acpi/actbl2.h
>> +++ b/include/acpi/actbl2.h
>> @@ -371,6 +371,10 @@ struct acpi_dbg2_device {
>>
>>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>>  #define ACPI_DBG2_16550_SUBSET      0x0001
>> +#define ACPI_DBG2_ARM_PL011         0x0003
>> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000e
>> +#define ACPI_DBG2_ARM_DCC           0x000f
>> +#define ACPI_DBG2_DCM2835           0x0010

^^^ Exactly because of such typos. Should be BCM


-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1316796 — Re: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-25 16:10 +0100
SubjectRe: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c
Message-ID<qUQWd-5Ow-15@gated-at.bofh.it>
In reply to#1316751

On 25.01.2016 20:22, Andy Shevchenko wrote:
> On Mon, Jan 25, 2016 at 4:21 PM, Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>> On Mon, Jan 25, 2016 at 1:45 PM, Aleksey Makarov
>> <aleksey.makarov@linaro.org> wrote:
>>> Add an implementation of acpi_match() to the pl011 driver.
>>> It allows to check if the console matches one specified with
>>> ACPI SPCR table.
>>
>> I don't know Rafael's opinion on this, but I would split it to extend
>> ACPI header first with reference to newest revision of Microsoft
>> document.

This makes sense.

>>> --- a/include/acpi/actbl2.h
>>> +++ b/include/acpi/actbl2.h
>>> @@ -371,6 +371,10 @@ struct acpi_dbg2_device {
>>>
>>>   #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>>>   #define ACPI_DBG2_16550_SUBSET      0x0001
>>> +#define ACPI_DBG2_ARM_PL011         0x0003
>>> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000e
>>> +#define ACPI_DBG2_ARM_DCC           0x000f
>>> +#define ACPI_DBG2_DCM2835           0x0010
>
> ^^^ Exactly because of such typos. Should be BCM

I will fix this, thank you.

[toc] | [prev] | [next] | [standalone]


#1316759 — Re: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2016-01-25 15:30 +0100
SubjectRe: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c
Message-ID<qUQjw-5hx-13@gated-at.bofh.it>
In reply to#1316548
On Mon, Jan 25, 2016 at 1:45 PM, Aleksey Makarov
<aleksey.makarov@linaro.org> wrote:
> Add an implementation of acpi_match() to the pl011 driver.
> It allows to check if the console matches one specified with
> ACPI SPCR table.

I don't know Rafael's opinion on this, but I would split it to extend
ACPI header first with reference to newest revision of Microsoft
document.

>
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>  drivers/tty/serial/amba-pl011.c | 14 ++++++++++++++
>  include/acpi/actbl2.h           |  4 ++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 899a771..3f4aa1b 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2189,12 +2189,26 @@ static int __init pl011_console_setup(struct console *co, char *options)
>         return uart_set_options(&uap->port, co, baud, parity, bits, flow);
>  }
>
> +static int __init pl011_console_acpi_match(struct console *co,
> +                                          struct acpi_table_spcr *spcr)
> +{
> +       struct uart_amba_port *uap = amba_ports[co->index];
> +
> +       if (spcr->interface_type == ACPI_DBG2_ARM_PL011 &&
> +           spcr->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY &&
> +           spcr->serial_port.address == (u64)uap->port.mapbase)
> +               return 0;
> +
> +       return -ENODEV;
> +}
> +
>  static struct uart_driver amba_reg;
>  static struct console amba_console = {
>         .name           = "ttyAMA",
>         .write          = pl011_console_write,
>         .device         = uart_console_device,
>         .setup          = pl011_console_setup,
> +       .acpi_match     = pl011_console_acpi_match,
>         .flags          = CON_PRINTBUFFER,
>         .index          = -1,
>         .data           = &amba_reg,
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> index 6e28f54..ce4cb37 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -371,6 +371,10 @@ struct acpi_dbg2_device {
>
>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>  #define ACPI_DBG2_16550_SUBSET      0x0001
> +#define ACPI_DBG2_ARM_PL011         0x0003
> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000e
> +#define ACPI_DBG2_ARM_DCC           0x000f
> +#define ACPI_DBG2_DCM2835           0x0010
>
>  #define ACPI_DBG2_1394_STANDARD     0x0000
>
> --
> 2.7.0
>



-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1316949

FromPeter Hurley <peter@hurleysoftware.com>
Date2016-01-25 17:20 +0100
Message-ID<qUS1Z-6yn-41@gated-at.bofh.it>
In reply to#1316544
On 01/25/2016 03:45 AM, Aleksey Makarov wrote:
> This patchset is based on the patchset by Leif Lindholm [1]
> 
> 'ARM Server Base Boot Requirements' [2] mention SPCR 
> (Serial Port Console Redirection Table) [3] as a mandatory
> ACPI table that specifies the configuration of serial console.
> 
> Licensing concerns have prevented implementing it in the past, but as of
> 10 August 2015, these tables have both been released also under 
> OWF 1.0 [4].

This license has a patent retaliation provision, which makes it
incompatible with GPLv2.

*If the license applies to this code*, then this patch set does not
meet the criteria for submission.

Regards,
Peter Hurley


> SPCR support is included in QEMU's ARM mach-virt since 2.4 release.
> 
> Parse the SPCR table and check if any registered console match
> the description.  If it does, enable that console.
> 
> To implement that, introduce a new member
> int (*acpi_match)(struct console *, struct acpi_table_spcr *);
> of struct console.  It allows drivers to check if they provide
> a matching console device.
> 
> Also add an implementation of this member function to the pl011 driver
> and fix a minor issue in kernel/printk/printk.c
> 
> [1] https://lkml.kernel.org/g/1441716217-23786-1-git-send-email-leif.lindholm@linaro.org
> [2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
> [3] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx
> [4] http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0
> 
> Aleksey Makarov (3):
>   printk: make preferred_console local static bool
>   ACPI: parse SPCR and enable matching console
>   serial: pl011: add acpi_match for amba-pl011.c
> 
>  arch/arm64/Kconfig              |  1 +
>  drivers/acpi/Kconfig            |  3 ++
>  drivers/acpi/Makefile           |  1 +
>  drivers/acpi/spcr.c             | 85 +++++++++++++++++++++++++++++++++++++
>  drivers/tty/serial/amba-pl011.c | 14 ++++++
>  include/acpi/actbl2.h           |  4 ++
>  include/linux/console.h         | 12 ++++++
>  kernel/printk/printk.c          | 94 +++++++++++++++++++++++++++++++----------
>  8 files changed, 191 insertions(+), 23 deletions(-)
>  create mode 100644 drivers/acpi/spcr.c
> 

[toc] | [prev] | [next] | [standalone]


#1318914

FromAleksey Makarov <aleksey.makarov@linaro.org>
Date2016-01-27 13:30 +0100
Message-ID<qVxot-3nT-5@gated-at.bofh.it>
In reply to#1316949

On 01/25/2016 07:11 PM, Peter Hurley wrote:
> On 01/25/2016 03:45 AM, Aleksey Makarov wrote:
>> This patchset is based on the patchset by Leif Lindholm [1]
>>
>> 'ARM Server Base Boot Requirements' [2] mention SPCR 
>> (Serial Port Console Redirection Table) [3] as a mandatory
>> ACPI table that specifies the configuration of serial console.
>>
>> Licensing concerns have prevented implementing it in the past, but as of
>> 10 August 2015, these tables have both been released also under 
>> OWF 1.0 [4].
> 
> This license has a patent retaliation provision, which makes it
> incompatible with GPLv2.
> 
> *If the license applies to this code*, then this patch set does not
> meet the criteria for submission.

The license applies not to this code but to the document describing the tables.

Here is an excerpt from it:

  Patent Notice:
  Microsoft is making certain patent rights available for implementations of this specification under two options:
  1)  Microsoft’s Community Promise, available at
  http://www.microsoft.com/openspecifications/en/us/programs/community-promise/default.aspx; or
  2)  The Open Web Foundation Final Specification Agreement Version 1.0 ("OWF 1.0")
  as of October 1, 2012, available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. 

I believe that it means that the patch set meets the criteria for submission.  Am I right?

Thank you
Aleksey Makarov

[toc] | [prev] | [next] | [standalone]


#1318968

FromOne Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Date2016-01-27 14:50 +0100
Message-ID<qVyDV-4eI-17@gated-at.bofh.it>
In reply to#1318914
On Wed, 27 Jan 2016 15:17:52 +0300
Aleksey Makarov <aleksey.makarov@linaro.org> wrote:

> On 01/25/2016 07:11 PM, Peter Hurley wrote:
> > On 01/25/2016 03:45 AM, Aleksey Makarov wrote:  
> >> This patchset is based on the patchset by Leif Lindholm [1]
> >>
> >> 'ARM Server Base Boot Requirements' [2] mention SPCR 
> >> (Serial Port Console Redirection Table) [3] as a mandatory
> >> ACPI table that specifies the configuration of serial console.
> >>
> >> Licensing concerns have prevented implementing it in the past, but as of
> >> 10 August 2015, these tables have both been released also under 
> >> OWF 1.0 [4].  
> > 
> > This license has a patent retaliation provision, which makes it
> > incompatible with GPLv2.
> > 
> > *If the license applies to this code*, then this patch set does not
> > meet the criteria for submission.  
> 
> The license applies not to this code but to the document describing the tables.
> 
> Here is an excerpt from it:
> 
>   Patent Notice:
>   Microsoft is making certain patent rights available for implementations of this specification under two options:
>   1)  Microsoft’s Community Promise, available at
>   http://www.microsoft.com/openspecifications/en/us/programs/community-promise/default.aspx; or
>   2)  The Open Web Foundation Final Specification Agreement Version 1.0 ("OWF 1.0")
>   as of October 1, 2012, available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. 
> 
> I believe that it means that the patch set meets the criteria for submission.  Am I right?

This is not a forum for legal advice. I would suggest that Linaro
discusses it privately with the Linux Foundation and Linus and does so
under attorney-client privilege. The Linux Foundation does have some
reasons to exist.

Alan

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web