Skip to contentSkip to conversation

i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630

PATCH RESEND Applied Lee Jones 6 participants 18 messages Sep 5, 2019 – Sep 28, 2019

Subsystems (3)
lore
Share & tools
lore

Lee Jones

author
#0 lore raw

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

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.

---
 drivers/i2c/busses/i2c-qcom-geni.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +8 -4
index a89bfce5388e..17abf60c94ae 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Lee Jones

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.

Perfect now. Applied to for-current, thanks!

#2 lore raw
In reply to Lee Jones

Quoting Lee Jones (2019-09-05 12:24:12)

Quoted 19 lines

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.

---
 drivers/i2c/busses/i2c-qcom-geni.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
index a89bfce5388e..17abf60c94ae 100644

drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · line 362

Quoted 10 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -2
@@ -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?

Quoted 5 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -0
+               dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
+
        if (dma_buf)
                geni_se_select_mode(se, GENI_SE_DMA);
        else
author
#3 lore raw
Quoted 28 lines · Stephen Boyd

Quoting Lee Jones (2019-09-05 12:24:12)

Quoted 27 lines

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.

---
 drivers/i2c/busses/i2c-qcom-geni.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +1 -1
index a89bfce5388e..17abf60c94ae 100644
@@ -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;
 
Quoted 7 lines

drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · line 362

Quoted 2 lines
drivers/i2c/busses/i2c-qcom-geni.c +1 -1
-       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

Quoted 5 lines
Quoted 5 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -0
+               dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
+
        if (dma_buf)
                geni_se_select_mode(se, GENI_SE_DMA);
        else
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
Quoted 9 lines
Quoted 5 lines

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?

author
#5 lore raw
Quoted 10 lines · Wolfram Sang
Quoted 8 lines
Quoted 4 lines

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.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#6 lore raw
Quoted 8 lines · Lee Jones
Quoted 7 lines · Wolfram Sang
Quoted 7 lines
Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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.

author
#7 lore raw
Quoted 11 lines · Wolfram Sang
Quoted 10 lines · Lee Jones
Quoted 9 lines · Wolfram Sang
Quoted 8 lines
Quoted 4 lines

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

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

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?

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#8 lore raw
Quoted 2 lines

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?

#10 lore raw
Quoted 5 lines · Rob Clark
Quoted 4 lines · Wolfram Sang
Quoted 3 lines

Does this mean you plan to have this merged for v5.4?

Quoted 7 lines
Quoted 3 lines

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.

Tested-by
#11 lore raw
Quoted 10 lines · Wolfram Sang
Quoted 9 lines · Rob Clark
Quoted 7 lines · Wolfram Sang
Quoted 3 lines

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?

Quoted 7 lines
Quoted 3 lines

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.

Thanks,
Bjorn

#12 lore raw
Quoted 3 lines

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?

Quoted 3 lines

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.

Quoted 1 line

Thanks!

author
#13 lore raw
Quoted 5 lines · Wolfram Sang
Quoted 3 lines

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.

Quoted 6 lines
Quoted 3 lines

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.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#14 lore raw
In reply to Wolfram Sang
Quoted 4 lines · Wolfram Sang
Quoted 3 lines

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.

Quoted 8 lines

Can you ask them to fix this?

Quoted 3 lines

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).

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#15 lore raw
In reply to Wolfram Sang
Quoted 4 lines · Wolfram Sang
Quoted 3 lines

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.

Quoted 8 lines

Can you ask them to fix this?

Quoted 3 lines

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?

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#16 lore raw
In reply to Bjorn Andersson
Quoted 15 lines · Bjorn Andersson
Quoted 12 lines · Wolfram Sang
Quoted 11 lines · Rob Clark
Quoted 7 lines · Wolfram Sang
Quoted 3 lines

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:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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

Applied
#17 lore raw
In reply to Lee Jones
Quoted 10 lines · Lee Jones

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.

Applied to for-current, thanks!