[SRU Zesty][Patch] [QDF2400] pl011 E44 erratum patch needed for 2.0 firmware and 1.1 silicon

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SRU Zesty][Patch] [QDF2400] pl011 E44 erratum patch needed for 2.0 firmware and 1.1 silicon

Manoj Iyer
Please consider this bug fix to pl011 on QDF2400 server, this patch fixes
an incompatibity issue with firmware newer than v1.5 and v1.1 silicon.

A test kernel is available at
https://launchpad.net/~centriq-team/+archive/ubuntu/lp1709123/ and was
tested and reported to work by QTI.

Please review and commit this SRU for Zesty.

Regards
Manoj Iyer


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] tty: pl011: fix initialization order of QDF2400 E44

Manoj Iyer
From: Timur Tabi <[hidden email]>

The work-around for Qualcomm Technologies QDF2400 Erratum 44 hinges on a
global variable defined in the pl011 driver.  The ACPI SPCR parsing code
determines whether the work-around is needed, and if so, it changes the
console name from "pl011" to "qdf2400_e44".  The expectation is that
the pl011 driver will implement the work-around when it sees the console
name.  The global variable qdf2400_e44_present is set when that happens.

The problem is that work-around needs to be enabled when the pl011
driver probes, not when the console name is queried.  However, sbsa_probe()
is called before pl011_console_match().  The work-around appeared to work
previously because the default console on QDF2400 platforms was always
ttyAMA1.  The first time sbsa_probe() is called (for ttyAMA0),
qdf2400_e44_present is still false.  Then pl011_console_match() is called,
and it sets qdf2400_e44_present to true.  All subsequent calls to
sbsa_probe() enable the work-around.

The solution is to move the global variable into spcr.c and let the
pl011 driver query it during probe time.  This works because all QDF2400
platforms require SPCR, so parse_spcr() will always be called.
pl011_console_match still checks for the "qdf2400_e44" console name,
but it doesn't do anything else special.

BugLink: https://launchpad.net/bugs/1709123

Fixes: 5a0722b898f8 ("tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44")
Tested-by: Jeffrey Hugo <[hidden email]>
Signed-off-by: Timur Tabi <[hidden email]>
Signed-off-by: Greg Kroah-Hartman <[hidden email]>
(backported from linux-next commit 37ef38f3f83891a2f413fb872bae7d0f9bb95b27)
Signed-off-by: Manoj Iyer <[hidden email]>
---
 drivers/acpi/spcr.c             | 35 +++++++++++++++++++++++++++++++++--
 drivers/tty/serial/amba-pl011.c | 37 +++++++++++++++++++------------------
 include/linux/acpi.h            |  1 +
 3 files changed, 53 insertions(+), 20 deletions(-)

diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 2051a8ce9c85..4c4099f075c9 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -17,6 +17,16 @@
 #include <linux/serial_core.h>
 
 /*
+ * Erratum 44 for QDF2432v1 and QDF2400v1 SoCs describes the BUSY bit as
+ * occasionally getting stuck as 1. To avoid the potential for a hang, check
+ * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
+ * implementations, so only do so if an affected platform is detected in
+ * parse_spcr().
+ */
+bool qdf2400_e44_present;
+EXPORT_SYMBOL(qdf2400_e44_present);
+
+/*
  * Some Qualcomm Datacenter Technologies SoCs have a defective UART BUSY bit.
  * Detect them by examining the OEM fields in the SPCR header, similiar to PCI
  * quirk detection in pci_mcfg.c.
@@ -113,8 +123,29 @@ int __init parse_spcr(bool earlycon)
  goto done;
  }
 
- if (qdf2400_erratum_44_present(&table->header))
- uart = "qdf2400_e44";
+ /*
+ * If the E44 erratum is required, then we need to tell the pl011
+ * driver to implement the work-around.
+ *
+ * The global variable is used by the probe function when it
+ * creates the UARTs, whether or not they're used as a console.
+ *
+ * If the user specifies "traditional" earlycon, the qdf2400_e44
+ * console name matches the EARLYCON_DECLARE() statement, and
+ * SPCR is not used.  Parameter "earlycon" is false.
+ *
+ * If the user specifies "SPCR" earlycon, then we need to update
+ * the console name so that it also says "qdf2400_e44".  Parameter
+ * "earlycon" is true.
+ *
+ * For consistency, if we change the console name, then we do it
+ * for everyone, not just earlycon.
+ */
+ if (qdf2400_erratum_44_present(&table->header)) {
+ qdf2400_e44_present = true;
+ if (earlycon)
+ uart = "qdf2400_e44";
+ }
 
  snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype,
  table->serial_port.address, baud_rate);
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 0875f7d01fa5..a0eeea48a48a 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -142,15 +142,7 @@ static struct vendor_data vendor_sbsa = {
  .fixed_options = true,
 };
 
-/*
- * Erratum 44 for QDF2432v1 and QDF2400v1 SoCs describes the BUSY bit as
- * occasionally getting stuck as 1. To avoid the potential for a hang, check
- * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
- * implementations, so only do so if an affected platform is detected in
- * parse_spcr().
- */
-static bool qdf2400_e44_present = false;
-
+#ifdef CONFIG_ACPI_SPCR_TABLE
 static struct vendor_data vendor_qdt_qdf2400_e44 = {
  .reg_offset = pl011_std_offsets,
  .fr_busy = UART011_FR_TXFE,
@@ -165,6 +157,7 @@ static struct vendor_data vendor_qdt_qdf2400_e44 = {
  .always_enabled = true,
  .fixed_options = true,
 };
+#endif
 
 static u16 pl011_st_offsets[REG_ARRAY_SIZE] = {
  [REG_DR] = UART01x_DR,
@@ -2370,12 +2363,14 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
  resource_size_t addr;
  int i;
 
- if (strcmp(name, "qdf2400_e44") == 0) {
- pr_info_once("UART: Working around QDF2400 SoC erratum 44");
- qdf2400_e44_present = true;
- } else if (strcmp(name, "pl011") != 0) {
+ /*
+ * Systems affected by the Qualcomm Technologies QDF2400 E44 erratum
+ * have a distinct console name, so make sure we check for that.
+ * The actual implementation of the erratum occurs in the probe
+ * function.
+ */
+ if ((strcmp(name, "qdf2400_e44") != 0) && (strcmp(name, "pl011") != 0))
  return -ENODEV;
- }
 
  if (uart_parse_earlycon(options, &iotype, &addr, &options))
  return -ENODEV;
@@ -2729,11 +2724,17 @@ static int sbsa_uart_probe(struct platform_device *pdev)
  }
  uap->port.irq = ret;
 
- uap->reg_offset = vendor_sbsa.reg_offset;
- uap->vendor = qdf2400_e44_present ?
- &vendor_qdt_qdf2400_e44 : &vendor_sbsa;
+#ifdef CONFIG_ACPI_SPCR_TABLE
+ if (qdf2400_e44_present) {
+ dev_info(&pdev->dev, "working around QDF2400 SoC erratum 44\n");
+ uap->vendor = &vendor_qdt_qdf2400_e44;
+ } else
+#endif
+ uap->vendor = &vendor_sbsa;
+
+ uap->reg_offset = uap->vendor->reg_offset;
  uap->fifosize = 32;
- uap->port.iotype = vendor_sbsa.access_32b ? UPIO_MEM32 : UPIO_MEM;
+ uap->port.iotype = uap->vendor->access_32b ? UPIO_MEM32 : UPIO_MEM;
  uap->port.ops = &sbsa_uart_pops;
  uap->fixed_baud = baudrate;
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 120f333684eb..747978517601 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1155,6 +1155,7 @@ static inline bool acpi_has_watchdog(void) { return false; }
 #endif
 
 #ifdef CONFIG_ACPI_SPCR_TABLE
+extern bool qdf2400_e44_present;
 int parse_spcr(bool earlycon);
 #else
 static inline int parse_spcr(bool earlycon) { return 0; }
--
2.11.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK / APPLIED[artful]: [SRU Zesty][Patch] [QDF2400] pl011 E44 erratum patch needed for 2.0 firmware and 1.1 silicon

Seth Forshee
In reply to this post by Manoj Iyer
On Tue, Aug 08, 2017 at 12:44:17PM -0500, Manoj Iyer wrote:
> Please consider this bug fix to pl011 on QDF2400 server, this patch fixes
> an incompatibity issue with firmware newer than v1.5 and v1.1 silicon.
>
> A test kernel is available at
> https://launchpad.net/~centriq-team/+archive/ubuntu/lp1709123/ and was
> tested and reported to work by QTI.
>
> Please review and commit this SRU for Zesty.

Backport looks good, shouldn't affect any hardware beyond the target of
the fix.

Acked-by: Seth Forshee <[hidden email]>

Applied to artful/master-next, and cherry picked to unstable/master from
linux-next. Thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ACK / APPLIED[artful]: [SRU Zesty][Patch] [QDF2400] pl011 E44 erratum patch needed for 2.0 firmware and 1.1 silicon

Manoj Iyer
Seth,

This would percolate down to Xenial HWE at some point? Could you give me an ETA on when that might happen so that I can communicate it to those who might be affected by it ? 

On Fri, Aug 11, 2017 at 10:44 AM, Seth Forshee <[hidden email]> wrote:
On Tue, Aug 08, 2017 at 12:44:17PM -0500, Manoj Iyer wrote:
Please consider this bug fix to pl011 on QDF2400 server, this patch fixes an incompatibity issue with firmware newer than v1.5 and v1.1 silicon. A test kernel is available at https://launchpad.net/~centriq-team/+archive/ubuntu/lp1709123/ and was tested and reported to work by QTI. Please review and commit this SRU for Zesty.
Backport looks good, shouldn't affect any hardware beyond the target of the fix. Acked-by: Seth Forshee <[hidden email]> Applied to artful/master-next, and cherry picked to unstable/master from linux-next. Thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ACK / APPLIED[artful]: [SRU Zesty][Patch] [QDF2400] pl011 E44 erratum patch needed for 2.0 firmware and 1.1 silicon

Seth Forshee
On Fri, Aug 11, 2017 at 10:55:59AM -0500, Manoj Iyer wrote:
> Seth,
>
> This would percolate down to Xenial HWE at some point? Could you give me an
> ETA on when that might happen so that I can communicate it to those who
> might be affected by it ?

It's going to be quite some time before xenial hwe is based on artful.
You're probably more concerned about zesty (for which it needs another
ack before it can be applied). We're at the end of week 1 of the current
SRU cycle, so assuming things stay on schedule it would be about 5 weeks
before an hwe kernel with this fix would make it to xenial-updates.

>
> On Fri, Aug 11, 2017 at 10:44 AM, Seth Forshee <[hidden email]>
> wrote:
> > On Tue, Aug 08, 2017 at 12:44:17PM -0500, Manoj Iyer wrote:
> > >  Please consider this bug fix to pl011 on QDF2400 server, this patch
> > > fixes
> > >  an incompatibity issue with firmware newer than v1.5 and v1.1
> > > silicon.
> > >
> > >  A test kernel is available at
> > >  https://launchpad.net/~centriq-team/+archive/ubuntu/lp1709123/ and
> > > was
> > >  tested and reported to work by QTI.
> > >
> > >  Please review and commit this SRU for Zesty.
> >
> > Backport looks good, shouldn't affect any hardware beyond the target of
> > the fix.
> >
> > Acked-by: Seth Forshee <[hidden email]>
> >
> > Applied to artful/master-next, and cherry picked to unstable/master from
> > linux-next. Thanks!
> >

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK/cmnt: [SRU Zesty][Patch] [QDF2400] pl011 E44 erratum patch needed for 2.0 firmware and 1.1 silicon

Kleber Souza
In reply to this post by Manoj Iyer
On 08/08/17 19:44, Manoj Iyer wrote:

> Please consider this bug fix to pl011 on QDF2400 server, this patch fixes
> an incompatibity issue with firmware newer than v1.5 and v1.1 silicon.
>
> A test kernel is available at
> https://launchpad.net/~centriq-team/+archive/ubuntu/lp1709123/ and was
> tested and reported to work by QTI.
>
> Please review and commit this SRU for Zesty.
>
> Regards
> Manoj Iyer
>
>

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

Note: this commit is already in the upstream tree, so the 'linux-next'
part can be removed from the '(backported from ...)' line when applying.


Thanks,
Kleber

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Loading...