Bug 217726

Summary: 6.5 - 6.4.7 Regression : ASUS UM5302TA Keyboard don't work
Product: ACPI Reporter: Guilhem Lettron (guilhem)
Component: Config-InterruptsAssignee: acpi_config-interrupts
Status: RESOLVED CODE_FIX    
Severity: normal CC: bagasdotme, dedaniahenil, fabien, git, hegel666, jernej.skrabec, jwrdegoede, liewegutter, mario.limonciello, pitogo.adones, vishalrao
Priority: P3    
Hardware: AMD   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg on 6.4.5
dmesg on 6.4.7
acpidump

Description Guilhem Lettron 2023-07-29 13:54:27 UTC
On a kernel 6.4.5 and less, the keyboard is working fine.

Beginning with 6.5 rc1 and 6.4.7 any key don't respond.

[    0.668850] input: ASUE140D:00 04F3:31B9 Keyboard as /devices/platform/AMDI0010:01/i2c-1/i2c-ASUE140D:00/0018:04F3:31B9.0001/input/input5
...
[    1.930328] input: ASUE140D:00 04F3:31B9 Keyboard as /devices/platform/AMDI0010:01/i2c-1/i2c-ASUE140D:00/0018:04F3:31B9.0001/input/input13
Comment 1 Bagas Sanjaya 2023-07-30 02:19:36 UTC
(In reply to Guilhem Lettron from comment #0)
> On a kernel 6.4.5 and less, the keyboard is working fine.
> 
> Beginning with 6.5 rc1 and 6.4.7 any key don't respond.
> 
> [    0.668850] input: ASUE140D:00 04F3:31B9 Keyboard as
> /devices/platform/AMDI0010:01/i2c-1/i2c-ASUE140D:00/0018:04F3:31B9.0001/
> input/input5
> ...
> [    1.930328] input: ASUE140D:00 04F3:31B9 Keyboard as
> /devices/platform/AMDI0010:01/i2c-1/i2c-ASUE140D:00/0018:04F3:31B9.0001/
> input/input13

Can you bisect between v6.4.5 and v6.4.7 to find the culprit?
Comment 2 Mario Limonciello (AMD) 2023-07-30 17:55:47 UTC
I'd like a few things to further triage this issue.

1) A dmesg from 6.4.5
2) A dmesg from 6.4.7
3) Attempt reverting 9946e39fe8d0 ("ACPI: resource: skip IRQ override on AMD Zen platforms") to see if it helps.
4) An acpidump
5) If reverting 9946e39fe8d0 does NOT help, then please bisect 6.4.5 to 6.4.7.
Comment 3 Guilhem Lettron 2023-07-31 07:34:41 UTC
Created attachment 304738 [details]
dmesg on 6.4.5
Comment 4 Guilhem Lettron 2023-07-31 07:35:17 UTC
Created attachment 304739 [details]
dmesg on 6.4.7
Comment 5 Guilhem Lettron 2023-07-31 07:35:52 UTC
Created attachment 304740 [details]
acpidump
Comment 6 henil 2023-07-31 14:19:10 UTC
see: https://bugzilla.kernel.org/show_bug.cgi?id=217718

the fix for this was reverted
Comment 7 henil 2023-07-31 14:23:40 UTC
(In reply to henil from comment #6)
> see: https://bugzilla.kernel.org/show_bug.cgi?id=217718
> 
> the fix for this was reverted

i meant to link https://bugzilla.kernel.org/show_bug.cgi?id=217718#c0
Comment 8 Mario Limonciello (AMD) 2023-07-31 20:12:14 UTC
> [    0.287015] ACPI: IRQ 1 override to edge, high(!)

Yup, so 6.4.7 is showing it's overriding now to edge/high which is causing breakage for you.  You should be able to revert the patch and get success for now.

There is a discussion on the mailing list about the logic is wrong here because it seems like no matter which way we go it's a pile of quirks.
Comment 9 Marcin Bachry 2023-08-04 10:07:25 UTC
I have the same ASUS laptop and I confirm that reverting a9c4a912b7dc7ff922d4b9261160c001558f9755  (ACPI: resource: Remove "Zen" specific match and quirks) from stable v6.4.7 branch fixes the issue.
Comment 10 Hans de Goede 2023-08-06 15:18:08 UTC
I have submitted a revert of a9c4a912b7dc ("ACPI: resource: Remove "Zen" specific match and quirks") upstream now, because I believe that that is the best way to fix the regressions caused by this (until we figure out a better way to deal with the kbd interrupt trigger-type issues):

https://lore.kernel.org/linux-acpi/20230806151453.10690-1-hdegoede@redhat.com/
Comment 11 Papar Baluga 2023-08-06 19:20:34 UTC
Thanks @Hans de Goede. Been following this thread for possible fix. To anyone using Arch Linux, my temporary fix was to install and use linux-lts kernel:


sudo pacman -S linut-lts linux-lts-headers;
sudo grub-mkconfig -o /boot/grub/grub.cfg
Comment 12 Mario Limonciello (AMD) 2023-08-07 05:00:24 UTC
Can you see if this works?

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 1dd8d5aebf678..b74d7d8cc8630 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -19,7 +19,7 @@
 #include <linux/dmi.h>
 
 #ifdef CONFIG_X86
-#define valid_IRQ(i) (((i) != 0) && ((i) != 2))
+#define valid_IRQ(i) ((i) > 2)
 static inline bool acpi_iospace_resource_valid(struct resource *res)
 {
        /* On X86 IO space is limited to the [0 - 64K] IO port range */
Comment 13 Marcin Bachry 2023-08-07 09:02:11 UTC
This patch doesn't work, unfortunately.
Comment 14 Mario Limonciello (AMD) 2023-08-07 11:29:27 UTC
> This patch doesn't work, unfortunately.

Can you please further describe?  Did your keyboard, mouse or both stop working from a9c4a912b7dc7ff922d4b9261160c001558f9755?

This patch skips creating an IO resource to program to the IOAPIC; but only for the keyboard.  I expect the hardware programmed value would be maintained instead.

So if a9c4a912b7dc7ff922d4b9261160c001558f9755 broke both keyboard and mouse for you this should only "help" keyboard.
Comment 15 Mario Limonciello (AMD) 2023-08-07 11:49:10 UTC
And you can see if this patch works for both keyboard and mouse instead.

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index b74d7d8cc8630..6fc8ac1c9e84b 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -19,7 +19,7 @@
 #include <linux/dmi.h>
 
 #ifdef CONFIG_X86
-#define valid_IRQ(i) (((i) != 0) && ((i) != 2))
+#define valid_IRQ(i) (((i) > 2) && && ((i) != 12))
 static inline bool acpi_iospace_resource_valid(struct resource *res)
 {
        /* On X86 IO space is limited to the [0 - 64K] IO port range */
Comment 16 Marcin Bachry 2023-08-07 12:00:55 UTC
> Can you please further describe?  Did your keyboard, mouse or both stop
> working from a9c4a912b7dc7ff922d4b9261160c001558f9755?

Only keyboard. The laptop's touchpad is working fine.

The test results are this:

* vanilla v6.4.7 branch: keyboard not working, touchpad ok

* vanilla v6.4.7 with https://bugzilla.kernel.org/show_bug.cgi?id=217726#c12 patch: keyboard not working, touchpad ok

* vanilla v6.4.7 with https://bugzilla.kernel.org/show_bug.cgi?id=217726#c15 patch (modified to fix "&& &&" syntax error): keyboard not working, touchpad ok

* vanilla v6.4.7 with a9c4a912b7dc7ff922d4b9261160c001558f9755 reverted: both keyboard and touchpad working

I can check other patches, if you have more ideas.
Comment 17 Mario Limonciello (AMD) 2023-08-07 14:28:47 UTC
Thanks.  Hans is proposing a revert of the patch, if I come up with anything else I'll let you know.
Comment 18 liewegutter 2023-08-20 10:48:46 UTC
linux 6.4.11 contains a fix for this bug, and after updating to 6.4.11 on Arco linux on my UM5302TA, the keyboard is working fine again. Thanks, Hans and Mario!

Link to commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.4.11&id=d9dbddc664610ec9ef2ca13518c22960effccec3
Comment 19 Marcin Bachry 2023-08-20 11:55:01 UTC
6.4.11 works fine for me too. Thanks for the hard work, Hans and Mario!
Comment 20 Papar Baluga 2023-08-21 01:28:39 UTC
6.4.11 works for me as well. Thanks for fixing this.
Comment 21 Hans de Goede 2023-08-21 07:43:21 UTC
Thanks everyone for reporting the issue as well as for reporting that the issue is fixed now.

Since this is fixed now I'm going to close this bug.