diff mbox series

[RESEND,v3,1/1] i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630

Message ID 20190905192412.23116-1-lee.jones@linaro.org (mailing list archive)
State Accepted
Commit 127068abe85bf3dee50df51cb039a5a987a4a666
Headers show
Series [RESEND,v3,1/1] i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630 | expand

Commit Message

Lee Jones Sept. 5, 2019, 7:24 p.m. UTC
We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
a rather horrific bug.  When I2C HID devices are being scanned for at
boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
When it does, the laptop reboots and the user never sees the OS.

Attempts are being made to debug the reason for the spontaneous reboot.
No luck so far, hence the requirement for this hot-fix.  This workaround
will be removed once we have a viable fix.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/i2c/busses/i2c-qcom-geni.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Wolfram Sang Sept. 5, 2019, 8:22 p.m. UTC | #1
On Thu, Sep 05, 2019 at 08:24:12PM +0100, Lee Jones wrote:
> We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
> a rather horrific bug.  When I2C HID devices are being scanned for at
> boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
> When it does, the laptop reboots and the user never sees the OS.
> 
> Attempts are being made to debug the reason for the spontaneous reboot.
> No luck so far, hence the requirement for this hot-fix.  This workaround
> will be removed once we have a viable fix.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Perfect now. Applied to for-current, thanks!
Stephen Boyd Sept. 6, 2019, 5:33 a.m. UTC | #2
Quoting Lee Jones (2019-09-05 12:24:12)
> We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
> a rather horrific bug.  When I2C HID devices are being scanned for at
> boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
> When it does, the laptop reboots and the user never sees the OS.
> 
> Attempts are being made to debug the reason for the spontaneous reboot.
> No luck so far, hence the requirement for this hot-fix.  This workaround
> will be removed once we have a viable fix.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/i2c/busses/i2c-qcom-geni.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index a89bfce5388e..17abf60c94ae 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -355,11 +355,13 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>  {
>         dma_addr_t rx_dma;
>         unsigned long time_left;
> -       void *dma_buf;
> +       void *dma_buf = NULL;
>         struct geni_se *se = &gi2c->se;
>         size_t len = msg->len;
>  
> -       dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
> +       if (!of_machine_is_compatible("lenovo,yoga-c630"))

This compatible isn't in the 5.3 rc series nor is it in linux-next yet.
Is this "hot-fix" for the next merge window? Or is this compatible
string being generated by firmware somewhere and thus isn't part of the
kernel?

> +               dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
> +
>         if (dma_buf)
>                 geni_se_select_mode(se, GENI_SE_DMA);
>         else
Lee Jones Sept. 6, 2019, 6:14 a.m. UTC | #3
On Thu, 05 Sep 2019, Stephen Boyd wrote:

> Quoting Lee Jones (2019-09-05 12:24:12)
> > We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
> > a rather horrific bug.  When I2C HID devices are being scanned for at
> > boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
> > When it does, the laptop reboots and the user never sees the OS.
> > 
> > Attempts are being made to debug the reason for the spontaneous reboot.
> > No luck so far, hence the requirement for this hot-fix.  This workaround
> > will be removed once we have a viable fix.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/i2c/busses/i2c-qcom-geni.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> > index a89bfce5388e..17abf60c94ae 100644
> > --- a/drivers/i2c/busses/i2c-qcom-geni.c
> > +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> > @@ -355,11 +355,13 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
> >  {
> >         dma_addr_t rx_dma;
> >         unsigned long time_left;
> > -       void *dma_buf;
> > +       void *dma_buf = NULL;
> >         struct geni_se *se = &gi2c->se;
> >         size_t len = msg->len;
> >  
> > -       dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
> > +       if (!of_machine_is_compatible("lenovo,yoga-c630"))
> 
> This compatible isn't in the 5.3 rc series nor is it in linux-next yet.
> Is this "hot-fix" for the next merge window? Or is this compatible
> string being generated by firmware somewhere and thus isn't part of the
> kernel?

It's on the list and will be in all of the distro v5.3 release kernels.

https://lkml.org/lkml/2019/9/5/695

> > +               dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
> > +
> >         if (dma_buf)
> >                 geni_se_select_mode(se, GENI_SE_DMA);
> >         else
Wolfram Sang Sept. 6, 2019, 6:50 a.m. UTC | #4
> > This compatible isn't in the 5.3 rc series nor is it in linux-next yet.
> > Is this "hot-fix" for the next merge window? Or is this compatible
> > string being generated by firmware somewhere and thus isn't part of the
> > kernel?
> 
> It's on the list and will be in all of the distro v5.3 release kernels.
> 
> https://lkml.org/lkml/2019/9/5/695

And why don't the distro kernels simply pick up this patch, too?
Lee Jones Sept. 6, 2019, 7:56 a.m. UTC | #5
On Fri, 06 Sep 2019, Wolfram Sang wrote:
> > > This compatible isn't in the 5.3 rc series nor is it in linux-next yet.
> > > Is this "hot-fix" for the next merge window? Or is this compatible
> > > string being generated by firmware somewhere and thus isn't part of the
> > > kernel?
> > 
> > It's on the list and will be in all of the distro v5.3 release kernels.
> > 
> > https://lkml.org/lkml/2019/9/5/695
> 
> And why don't the distro kernels simply pick up this patch, too?

I could send it to them and find out.  They are on kernel-freeze now,
on the lead-up to the release date (next month), but I think they're
still taking bug fixes.
Wolfram Sang Sept. 6, 2019, 10:23 a.m. UTC | #6
On Fri, Sep 06, 2019 at 08:56:00AM +0100, Lee Jones wrote:
> On Fri, 06 Sep 2019, Wolfram Sang wrote:
> > > > This compatible isn't in the 5.3 rc series nor is it in linux-next yet.
> > > > Is this "hot-fix" for the next merge window? Or is this compatible
> > > > string being generated by firmware somewhere and thus isn't part of the
> > > > kernel?
> > > 
> > > It's on the list and will be in all of the distro v5.3 release kernels.
> > > 
> > > https://lkml.org/lkml/2019/9/5/695
> > 
> > And why don't the distro kernels simply pick up this patch, too?
> 
> I could send it to them and find out.  They are on kernel-freeze now,
> on the lead-up to the release date (next month), but I think they're
> still taking bug fixes.

Please do.
Lee Jones Sept. 6, 2019, 10:54 a.m. UTC | #7
On Fri, 06 Sep 2019, Wolfram Sang wrote:

> On Fri, Sep 06, 2019 at 08:56:00AM +0100, Lee Jones wrote:
> > On Fri, 06 Sep 2019, Wolfram Sang wrote:
> > > > > This compatible isn't in the 5.3 rc series nor is it in linux-next yet.
> > > > > Is this "hot-fix" for the next merge window? Or is this compatible
> > > > > string being generated by firmware somewhere and thus isn't part of the
> > > > > kernel?
> > > > 
> > > > It's on the list and will be in all of the distro v5.3 release kernels.
> > > > 
> > > > https://lkml.org/lkml/2019/9/5/695
> > > 
> > > And why don't the distro kernels simply pick up this patch, too?
> > 
> > I could send it to them and find out.  They are on kernel-freeze now,
> > on the lead-up to the release date (next month), but I think they're
> > still taking bug fixes.
> 
> Please do.

Submitted.

Does this mean you plan to have this merged for v5.4?
Wolfram Sang Sept. 6, 2019, 6:31 p.m. UTC | #8
> Does this mean you plan to have this merged for v5.4?

Only if the machine DTS is expected to land in 5.4. But Stephen said it
is not in liunx-next yet?
Rob Clark Sept. 7, 2019, 5:56 p.m. UTC | #9
On Sat, Sep 7, 2019 at 9:17 AM Wolfram Sang <wsa@the-dreams.de> wrote:
>
>
> > Does this mean you plan to have this merged for v5.4?
>
> Only if the machine DTS is expected to land in 5.4. But Stephen said it
> is not in liunx-next yet?
>

It appears to be in arm-soc for-next:

https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/log/?h=for-next

BR,
-R
Wolfram Sang Sept. 13, 2019, 2:28 p.m. UTC | #10
On Sat, Sep 07, 2019 at 10:56:34AM -0700, Rob Clark wrote:
> On Sat, Sep 7, 2019 at 9:17 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> >
> >
> > > Does this mean you plan to have this merged for v5.4?
> >
> > Only if the machine DTS is expected to land in 5.4. But Stephen said it
> > is not in liunx-next yet?
> >
> 
> It appears to be in arm-soc for-next:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/log/?h=for-next

Still not in linux-next. Please ping me or resend this patch once it
hits linux-next.
Bjorn Andersson Sept. 13, 2019, 4:13 p.m. UTC | #11
On Fri 13 Sep 07:28 PDT 2019, Wolfram Sang wrote:

> On Sat, Sep 07, 2019 at 10:56:34AM -0700, Rob Clark wrote:
> > On Sat, Sep 7, 2019 at 9:17 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> > >
> > >
> > > > Does this mean you plan to have this merged for v5.4?
> > >
> > > Only if the machine DTS is expected to land in 5.4. But Stephen said it
> > > is not in liunx-next yet?
> > >
> > 
> > It appears to be in arm-soc for-next:
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/log/?h=for-next
> 
> Still not in linux-next. Please ping me or resend this patch once it
> hits linux-next.
> 

It seems linux-next is now pulling from the soc.git, rather than
arm-soc.git, but Arnd is still pushing patches to arm-soc.git.

Arnd says that the patch will be in v5.4 and I merged Arnd's tree and
gave it a spin here and this patch makes it boot. So please merge this
patch for v5.4 as well.

Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Thanks,
Bjorn
Wolfram Sang Sept. 13, 2019, 4:17 p.m. UTC | #12
> It seems linux-next is now pulling from the soc.git, rather than
> arm-soc.git, but Arnd is still pushing patches to arm-soc.git.

Can you ask them to fix this?

> Arnd says that the patch will be in v5.4 and I merged Arnd's tree and
> gave it a spin here and this patch makes it boot. So please merge this
> patch for v5.4 as well.

No worries, this is clearly a bugfix. So it will easily go in with the
same release as the DTS file.

> Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Thanks!
Lee Jones Sept. 14, 2019, 8:57 a.m. UTC | #13
On Fri, 13 Sep 2019, Wolfram Sang wrote:

> 
> > It seems linux-next is now pulling from the soc.git, rather than
> > arm-soc.git, but Arnd is still pushing patches to arm-soc.git.
> 
> Can you ask them to fix this?

Linux next is on vacation for month.

The last tag was next-20190904.

> > Arnd says that the patch will be in v5.4 and I merged Arnd's tree and
> > gave it a spin here and this patch makes it boot. So please merge this
> > patch for v5.4 as well.
> 
> No worries, this is clearly a bugfix. So it will easily go in with the
> same release as the DTS file.

Thanks.  The DTS commit will go in for v5.4.
Arnd Bergmann Sept. 14, 2019, 7:13 p.m. UTC | #14
On Fri, Sep 13, 2019 at 6:13 PM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Fri 13 Sep 07:28 PDT 2019, Wolfram Sang wrote:
>
> > On Sat, Sep 07, 2019 at 10:56:34AM -0700, Rob Clark wrote:
> > > On Sat, Sep 7, 2019 at 9:17 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> > > >
> > > >
> > > > > Does this mean you plan to have this merged for v5.4?
> > > >
> > > > Only if the machine DTS is expected to land in 5.4. But Stephen said it
> > > > is not in liunx-next yet?
> > > >
> > >
> > > It appears to be in arm-soc for-next:
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/log/?h=for-next
> >
> > Still not in linux-next. Please ping me or resend this patch once it
> > hits linux-next.
> >
>
> It seems linux-next is now pulling from the soc.git, rather than
> arm-soc.git, but Arnd is still pushing patches to arm-soc.git.

I'm still pushing identical contents to both, but plan to remove the old
tree after the merge window.

      Arnd
Lee Jones Sept. 25, 2019, 3:38 p.m. UTC | #15
On Fri, 13 Sep 2019, Wolfram Sang wrote:

> 
> > It seems linux-next is now pulling from the soc.git, rather than
> > arm-soc.git, but Arnd is still pushing patches to arm-soc.git.
> 
> Can you ask them to fix this?
> 
> > Arnd says that the patch will be in v5.4 and I merged Arnd's tree and
> > gave it a spin here and this patch makes it boot. So please merge this
> > patch for v5.4 as well.
> 
> No worries, this is clearly a bugfix. So it will easily go in with the
> same release as the DTS file.

DTS file now upstream (44acee207844).
Lee Jones Sept. 27, 2019, 9:17 p.m. UTC | #16
On Fri, 13 Sep 2019, Wolfram Sang wrote:

> 
> > It seems linux-next is now pulling from the soc.git, rather than
> > arm-soc.git, but Arnd is still pushing patches to arm-soc.git.
> 
> Can you ask them to fix this?
> 
> > Arnd says that the patch will be in v5.4 and I merged Arnd's tree and
> > gave it a spin here and this patch makes it boot. So please merge this
> > patch for v5.4 as well.
> 
> No worries, this is clearly a bugfix. So it will easily go in with the
> same release as the DTS file.

Still not in Mainline.  Is the plan to send this through the -rcs?
Wolfram Sang Sept. 28, 2019, 5:48 p.m. UTC | #17
On Thu, Sep 05, 2019 at 08:24:12PM +0100, Lee Jones wrote:
> We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
> a rather horrific bug.  When I2C HID devices are being scanned for at
> boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
> When it does, the laptop reboots and the user never sees the OS.
> 
> Attempts are being made to debug the reason for the spontaneous reboot.
> No luck so far, hence the requirement for this hot-fix.  This workaround
> will be removed once we have a viable fix.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Applied to for-current, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index a89bfce5388e..17abf60c94ae 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -355,11 +355,13 @@  static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
 {
 	dma_addr_t rx_dma;
 	unsigned long time_left;
-	void *dma_buf;
+	void *dma_buf = NULL;
 	struct geni_se *se = &gi2c->se;
 	size_t len = msg->len;
 
-	dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
+	if (!of_machine_is_compatible("lenovo,yoga-c630"))
+		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
+
 	if (dma_buf)
 		geni_se_select_mode(se, GENI_SE_DMA);
 	else
@@ -394,11 +396,13 @@  static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
 {
 	dma_addr_t tx_dma;
 	unsigned long time_left;
-	void *dma_buf;
+	void *dma_buf = NULL;
 	struct geni_se *se = &gi2c->se;
 	size_t len = msg->len;
 
-	dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
+	if (!of_machine_is_compatible("lenovo,yoga-c630"))
+		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
+
 	if (dma_buf)
 		geni_se_select_mode(se, GENI_SE_DMA);
 	else