{ "summary": "Verify runtime and boot-param mechanisms to fix IRQ1 polarity on GM7RGxM before writing the enable-keyboard program", "agentCount": 4, "logs": [ "research lanes done: ok/ok/ok" ], "result": { "runtime": { "ioapic_set_type": "NO. In v7.1 arch/x86/kernel/apic/io_apic.c both irq_chips lack .irq_set_type: ioapic_chip (lines 1854-1866) and ioapic_ir_chip (lines 1868-1880, name \"IR-IO-APIC\" — the one live on this box per /proc/interrupts) implement only irq_startup/irq_mask/irq_unmask/irq_ack/irq_eoi/irq_set_affinity/irq_retrigger/irq_get_irqchip_state. Consequence: irq_set_irq_type(1, IRQ_TYPE_EDGE_RISING) -> __irq_set_trigger (kernel/irq/manage.c:925) hits `if (!chip || !chip->irq_set_type) { pr_debug(\"No set_type function for IRQ %d...\"); return 0; }` (lines 930-938) — it SILENTLY RETURNS 0 (success) without touching hardware and without even updating the irqd trigger flags (the flag-update code is only reached after chip->irq_set_type is called). irq_set_irq_type is EXPORT_SYMBOL (kernel/irq/chip.c:69) so a module CAN call it, but it is a guaranteed no-op trap here. Trigger/polarity for IOAPIC pins is consumed only at irqdomain-alloc time (mp_irqdomain_get_attr, io_apic.c:2820, reads ACPI via __acpi_get_override_irq — which is exactly where the Zen quirk poisons active_low=1) and baked into mp_chip_data.entry by mp_preconfigure_entry (io_apic.c:2845, called ONLY from mp_irqdomain_alloc); hardware is written at activate time by ioapic_configure_entry. request_irq trigger flags are also irrelevant: i8042 passes IRQF_SHARED with no IRQF_TRIGGER_* bits, so __setup_irq skips __irq_set_trigger entirely (manage.c:1717).", "ir_shared_bits": "YES — active_low (bit 13) and is_level (bit 15) remain hardware-interpreted under AMD IR, doubly confirmed. (a) Struct union, v7.1 arch/x86/include/asm/io_apic.h lines 58-88, verbatim:\n\nstruct IO_APIC_route_entry {\n\tunion {\n\t\tstruct {\n\t\t\tu64\tvector\t\t\t: 8,\n\t\t\t\tdelivery_mode\t\t: 3,\n\t\t\t\tdest_mode_logical\t: 1,\n\t\t\t\tdelivery_status\t\t: 1,\n\t\t\t\tactive_low\t\t: 1,\n\t\t\t\tirr\t\t\t: 1,\n\t\t\t\tis_level\t\t: 1,\n\t\t\t\tmasked\t\t\t: 1,\n\t\t\t\treserved_0\t\t: 15,\n\t\t\t\treserved_1\t\t: 17,\n\t\t\t\tvirt_destid_8_14\t: 7,\n\t\t\t\tdestid_0_7\t\t: 8;\n\t\t};\n\t\tstruct {\n\t\t\tu64\tir_shared_0\t\t: 8,\n\t\t\t\tir_zero\t\t\t: 3,\n\t\t\t\tir_index_15\t\t: 1,\n\t\t\t\tir_shared_1\t\t: 5,\n\t\t\t\tir_reserved_0\t\t: 31,\n\t\t\t\tir_format\t\t: 1,\n\t\t\t\tir_index_0_14\t\t: 15;\n\t\t};\n\t\tstruct {\n\t\t\tu64\tw1\t\t\t: 32,\n\t\t\t\tw2\t\t\t: 32;\n\t\t};\n\t};\n} __attribute__ ((packed));\n\nir_shared_1 spans bits 12-16 (delivery_status, active_low=13, irr, is_level=15, masked=16) — the 'shared' naming means these stay IOAPIC-hardware-interpreted even in the Intel DMAR remapped format; the DMAR index lives in bits 11 (ir_index_15) and 49-63. (b) More importantly, AMD IR does not use the remapped RTE format at all: drivers/iommu/amd/iommu.c fill_msi_msg (line 3695) sets msg->data = IRTE index and address_lo = 0 (dmar_format never set), and io_apic.c ioapic_setup_msg_from_msi (lines 1753-1784, comment at 1763-1764: \"DMAR/IR: 8bit subhandle; AMD/IR: 8bit IRTE index\") puts that index into entry->vector (bits 0-7) with ir_format=0. So under AMD-Vi the pin-1 RTE is in NORMAL format with the IRTE index carried in the vector field; clearing bit 13 of the low dword flips effective polarity and cannot corrupt any remap-index field. Caveat on doing that via raw MMIO: this machine has TWO IOAPICs (\"IOAPIC 0\" and \"IOAPIC 1\" in /proc/iomem), the index/data register pair at the IOAPIC base is shared mutable state guarded by the static (unexported) ioapic_lock, and CONFIG_STRICT_DEVMEM=y + CONFIG_IO_STRICT_DEVMEM=y block /dev/mem access from userspace — so raw poking is both racy and awkward; it is not needed.", "mp_chip_data": "v7.1 arch/x86/kernel/apic/io_apic.c lines 93-100, verbatim:\n\nstruct mp_chip_data {\n\tstruct list_head\t\tirq_2_pin;\n\tstruct IO_APIC_route_entry\tentry;\n\tbool\t\t\t\tis_level;\n\tbool\t\t\t\tactive_low;\n\tbool\t\t\t\tisa_irq;\n\tu32\t\t\t\tcount;\n};\n\nYES — a chip-data poke followed by i8042 unbind/rebind reprograms the RTE, including under AMD IR. Flow verified in v7.1: mp_irqdomain_alloc (io_apic.c:2859) -> mp_irqdomain_get_attr (2820, fills data->is_level/active_low from ACPI once, at boot) -> mp_preconfigure_entry (2845, bakes is_level/active_low/masked into data->entry; called ONLY at alloc) -> mp_irqdomain_activate (2935) -> ioapic_configure_entry (1786) which overlays ONLY routing fields (vector, delivery_mode, dest_mode_logical, ir_format, ir_index_0_14) from the parent-composed MSI msg onto data->entry, explicitly preserving is_level/active_low/masked (comment at 1749-1751), then writes every (apic,pin) in data->irq_2_pin via __ioapic_write_entry. So whatever is in data->entry.active_low at activate time goes to hardware. Triggering: i8042 unbind -> i8042_remove (i8042.c:1582) -> i8042_free_irqs -> free_irq(1) -> __free_irq last-action path -> irq_shutdown + irq_domain_deactivate_irq (manage.c __free_irq; deactivate confirmed present after synchronize_hardirq); rebind -> i8042_probe -> i8042_setup_kbd (i8042.c:1487) -> request_irq(1, ..., IRQF_SHARED) -> __setup_irq !shared path -> irq_activate (manage.c:1736) -> irq_domain_activate_irq -> hierarchy: AMD IR domain activates the IRTE with the freshly allocated vector (irte_ops->activate; irq_remapping_prepare_irte at iommu.c:3711 keeps the RTE-side is_level/active_low untouched — they never enter the IRTE), then mp_irqdomain_activate writes the RTE from poked chip data under ioapic_lock; irq_startup -> startup_ioapic_irq -> __unmask_ioapic -> io_apic_modify_irq (io_apic.c:376) rewrites the low dword w1 from data->entry AGAIN on unmask — a second guaranteed write path. Note: an affinity change does NOT rewrite the RTE under IR (amd_ir_set_affinity returns IRQ_SET_MASK_OK_DONE, iommu.c:4162, so ioapic_set_affinity at io_apic.c:1805 skips ioapic_configure_entry) — the deactivate/activate cycle is the only reliable trigger. Precedent inside the kernel itself: mp_check_pin_attr (io_apic.c:862-880) pokes data->entry.active_low = data->active_low at runtime for legacy IRQs. Exported symbols available to a GPL module: irq_get_irq_data EXPORT_SYMBOL_GPL (chip.c:142) with irq_get_chip_data() as a static-inline wrapper (include/linux/irq.h:831); irq_set_irq_type EXPORT_SYMBOL (chip.c:69, useless no-op here); enable_irq/disable_irq/disable_irq_nosync EXPORT_SYMBOL (manage.c:821/727/705); free_irq/request_threaded_irq EXPORT_SYMBOL (manage.c:2027/2204); irq_set_affinity EXPORT_SYMBOL_GPL (useless under IR as shown). NOT exported: irq_domain_activate_irq/irq_domain_deactivate_irq, mp_find_ioapic, mpc_ioapic_addr, ioapic_lock, x86 io_apic accessors — hence the unbind/rebind userspace trigger instead of an in-module reprogram call. Beware: disable_irq(1)+enable_irq(1) alone is NOT a reliable trigger — disable is lazy (IOAPIC chip has no .irq_disable, so no mask write happens), and unmask_irq() is a no-op unless the line was actually masked, so the w1 rewrite may never occur.", "recommended_approach": "chip_data_poke", "module_steps": [ "Wrapper step 1 (root): verify preconditions: grep '^ *1:' /proc/interrupts shows exactly one owner 'i8042' with chip 'IR-IO-APIC 1-edge' (confirmed live today: hwirq printed there IS the IOAPIC pin, so GSI1->pin1 is already confirmed; CONFIG_GENERIC_IRQ_DEBUGFS is not set on 7.1.8-arch1-3, so /sys/kernel/debug/irq does not exist and cannot be used). Optionally snapshot the IRQ1 count.", "Wrapper step 2: echo -n i8042 > /sys/bus/platform/drivers/i8042/unbind (i8042_remove: unregisters serio ports incl. serio0/atkbd, free_irq(1) -> irq_shutdown + irq_domain_deactivate_irq -> RTE masked; IRQ1 now has no action, nothing can race the poke). Note this also tears down the AUX port; on this laptop the touchpad is not PS/2 so it is a no-op, and it re-probes on rebind anyway.", "Wrapper step 3: insmod irq1fix.ko — module (GPL, built against the installed linux-headers 7.1.8-arch1-3 so vermagic enforces layout match) does, in init: (a) copy of struct mp_chip_data and struct irq_pin_list definitions verbatim from v7.1 io_apic.c compiled in; (b) d = irq_get_irq_data(1); fail -ENODEV if !d; (c) validate d->hwirq == 1 and d->chip and (strcmp(d->chip->name,\"IR-IO-APIC\")==0 || strcmp(d->chip->name,\"IO-APIC\")==0) — this proves chip_data really is a struct mp_chip_data and the pin is 1; (d) data = d->chip_data; validate the wrong-polarity signature before writing: data->isa_irq==true && data->count>=1 && data->is_level==false && data->active_low==true && data->entry.is_level==0 && data->entry.active_low==1; bail -ENODEV on any mismatch, print all fields either way; (e) optionally walk data->irq_2_pin and pr_info each (apic,pin) — expect a single (0,1) entry; (f) perform the poke: data->active_low = false; data->entry.active_low = 0; (do NOT touch entry.vector, is_level, or masked); (g) provide module param revert=1 that sets both back to active-low for a safe undo path. No exit-time work needed; the poke persists in chip data.", "Wrapper step 4: echo -n i8042 > /sys/bus/platform/drivers/i8042/bind (i8042_probe -> controller init -> request_irq(1) -> irq_activate -> AMD IR IRTE programmed with new vector -> mp_irqdomain_activate -> ioapic_configure_entry writes RTE with active_low=0 under ioapic_lock; irq_startup -> startup_ioapic_irq unmask rewrites w1 again; i8042_register_ports re-creates serio0; atkbd auto-binds and runs its FULL init with working IRQs: atkbd_probe 0xF2 GETID, atkbd_select_set, atkbd_activate 0xF4 — no manual serio drvctl needed).", "Wrapper step 5: verify functionally: sleep ~2s for kseriod, confirm a new inputN under /sys/bus/serio/devices/serio0/input exists, press a key (or run the existing ledecho test) and confirm the IRQ1 counter in /proc/interrupts increments once per event with no latency; rmmod irq1fix (optional — safe either way).", "Wrapper step 6 (persistence): the fix survives i8042 rebinds and S3 suspend/resume (syscore ioapic_suspend saves the fixed entries at suspend, ioapic_resume/restore_ioapic_entries restores them — io_apic.c:2313-2328; i8042 PM ops never free/re-request the IRQ) but NOT a reboot/kexec. Install the wrapper as a oneshot systemd service (After=systemd-udev-settle or simply at boot before display-manager) so every boot runs unbind -> insmod -> bind once.", "Revert path if the flip is wrong (keyboard still dead): unbind i8042, rmmod, insmod irq1fix.ko revert=1, bind — restores active-low exactly." ], "risks": [ "Struct-layout mismatch: mp_chip_data is private to io_apic.c and copied into the module; mitigated by vermagic (module must be built against the exact running kernel) plus the pre-poke field-signature validation (isa_irq/count/is_level/active_low/entry bits) that refuses to write on any mismatch.", "Race with kernel RTE writers: eliminated by ordering — the poke happens while i8042 is unbound, so IRQ1 has no action, is deactivated, and nothing calls io_apic_modify_irq/ioapic_configure_entry on it; under AMD IR even affinity changes never rewrite the RTE (amd_ir_set_affinity returns IRQ_SET_MASK_OK_DONE). Poking while i8042 is still bound would be a (small) bitfield-RMW race against mask/unmask writes of w1 and is deliberately avoided.", "Wrong-pin / wrong-IOAPIC hazard: zero in the recommended path — the write goes through the kernel's own data->irq_2_pin list; the module validates hwirq==1 and chip name. Raw MMIO instead would be genuinely hazardous: two IOAPICs on this box, the shared index/data register pair races with any concurrent kernel IOAPIC access unless the static (unexported) ioapic_lock is held, and STRICT_DEVMEM+IO_STRICT_DEVMEM block the userspace variant entirely.", "IR index corruption: none — under AMD IR the IRTE index lives in the RTE vector field (bits 0-7), which the module never touches; active_low/is_level are never encoded into the IRTE (irq_remapping_prepare_irte only handles vector/dest), and the rebind recomposes the RTE from the IRTE msi_entry anyway.", "IRQF_SHARED edge case: if some other driver ever shared IRQ1, i8042's free_irq would not be the last action, the domain would never deactivate, and the rebind would not rewrite the RTE. Confirmed not the case live (/proc/interrupts shows i8042 as sole owner); wrapper step 1 re-checks each boot.", "Suspend/resume does NOT revert the fix (entries are saved at suspend time with the fix already in hardware and restored verbatim on resume); kexec/reboot DOES revert it (restore_boot_irq_mode), hence the boot-time systemd unit.", "One spurious IRQ1 edge may fire at the polarity flip/unmask moment; harmless — edge-triggered, i8042_interrupt reads status and returns IRQ_NONE.", "Hypothesis risk: if the EC genuinely signals active-low (i.e. the DSDT is right and the DMI-table precedent for sibling boards does not apply), the keyboard stays dead but nothing is damaged; revert=1 restores the original state exactly. The sibling-board DMI entries (GMxRGxx/GM7RG7N/GMxBGxx) and the one-IRQ-per-SETLEDS-arriving-late signature make active-high overwhelmingly likely.", "Do not use irq_set_irq_type(): it returns 0 (success) while doing absolutely nothing on this chip — a silent-failure trap for any future refactor of the module.", "AUX/touchpad: i8042 unbind briefly tears down the AUX port too; PS/2 mice/touchpads (none on this machine) would disappear for the duration and re-probe on rebind." ], "reprobe_method": "i8042 platform unbind/rebind is the required method in the recommended flow — not as a serio formality but because the free_irq/request_irq cycle it causes is the ONLY module-accessible trigger that makes the kernel rewrite the RTE from the poked chip data (irq_domain_activate_irq is not exported; affinity changes skip the RTE write under IR; disable_irq/enable_irq is unreliable because lazy disable means unmask_irq may be a no-op). The rebind then makes any serio-level action redundant: i8042_probe -> i8042_register_ports re-creates serio0 from scratch and atkbd auto-binds, running the complete init chain (atkbd_connect -> atkbd_probe with 0xF2 GETID / SETLEDS fallback -> atkbd_select_set -> atkbd_activate 0xF4) with working interrupts. For completeness: if the RTE were fixed some other way without touching i8042 (e.g. an in-module raw write), then yes, `echo -n rescan > /sys/bus/serio/devices/serio0/drvctl` alone would suffice — drvctl_store 'rescan' (serio.c:365-368) does serio_disconnect_port + serio_find_driver, i.e. a full atkbd disconnect/connect that redoes the failed probe/enable sequence; 'reconnect' (atkbd_reconnect -> atkbd_probe + atkbd_activate) would also work. atkbd is currently bound to serio0 (readlink shows atkbd, input3 registered) in a zombie state from the timed-out boot probe, and rescan handles that state correctly. But with the chip-data approach, skip drvctl entirely — the i8042 rebind does it all.", "sources_checked": [ "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/x86/kernel/apic/io_apic.c?h=v7.1 (saved: /tmp/claude-1000/-home-daemon-sec/15d1485c-6af0-4b74-accc-e8f5c72f432a/scratchpad/ksrc/arch_x86_kernel_apic_io_apic.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/x86/include/asm/io_apic.h?h=v7.1 (arch_x86_include_asm_io_apic.h)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/kernel/irq/manage.c?h=v7.1 (kernel_irq_manage.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/kernel/irq/chip.c?h=v7.1 (kernel_irq_chip.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/kernel/irq/irqdomain.c?h=v7.1 (kernel_irq_irqdomain.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/linux/irq.h?h=v7.1 (include_linux_irq.h)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/iommu/amd/iommu.c?h=v7.1 (drivers_iommu_amd_iommu.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/input/serio/serio.c?h=v7.1 (drivers_input_serio_serio.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/input/serio/i8042.c?h=v7.1 (drivers_input_serio_i8042.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/input/keyboard/atkbd.c?h=v7.1 (drivers_input_keyboard_atkbd.c)", "Live target machine (7.1.8-arch1-3): /proc/interrupts (IRQ1 = IR-IO-APIC 1-edge i8042, sole owner, count 4), /proc/config.gz (CONFIG_GENERIC_IRQ_DEBUGFS not set, CONFIG_STRICT_DEVMEM=y, CONFIG_IO_STRICT_DEVMEM=y), /proc/iomem (IOAPIC 0 + IOAPIC 1 present), /sys/bus/platform/drivers/i8042/ (bind+unbind attrs present, device 'i8042' bound), /sys/bus/serio/devices/serio0 (atkbd bound, input3, err_count 0)" ] }, "presets": { "gm7rgxm_in_v71": "ABSENT. Verified against tag v7.1 (fetched from git.kernel.org plain URL, saved at /tmp/claude-1000/-home-daemon-sec/15d1485c-6af0-4b74-accc-e8f5c72f432a/scratchpad/resource_v7.1.c, 1174 lines). v7.1 drivers/acpi/resource.c contains exactly two DMI quirk tables: irq1_level_low_skip_override[] (line 394: MEDION, ASUS, LG, JVC9100 boards — no TongFang) and irq1_edge_low_force_override[] (line 549). \"GM7RGxM\" appears in neither (grep over the whole file: zero hits). Sibling TongFang entries present in irq1_edge_low_force_override[] (verbatim):\n\t{\n\t\t/* TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD */\n\t\t.matches = {\n\t\t\tDMI_MATCH(DMI_BOARD_NAME, \"GMxRGxx\"),\n\t\t},\n\t},\n\t{\n\t\t.matches = {\n\t\t\tDMI_MATCH(DMI_SYS_VENDOR, \"Eluktronics Inc.\"),\n\t\t\tDMI_MATCH(DMI_BOARD_NAME, \"MECH-17\"),\n\t\t},\n\t}, /* = GM7RG7N; note this v7.1 entry carries no comment line */\n\t{\n\t\t/* XMG APEX 17 (M23) */\n\t\t.matches = {\n\t\t\tDMI_MATCH(DMI_BOARD_NAME, \"GMxBGxx\"),\n\t\t},\n\t},\n\t{\n\t\t/* TongFang GM6BGEQ / PCSpecialist Elimina Pro 16 M, RTX 3050 */\n\t\t.matches = {\n\t\t\tDMI_MATCH(DMI_BOARD_NAME, \"GM6BGEQ\"),\n\t\t},\n\t},\n\t{\n\t\t/*\n\t\t * TongFang GM5HG0A in case of the SKIKK Vanaheim relabel the\n\t\t * board-name is changed, so check OEM strings instead. Note\n\t\t * OEM string matches are always exact matches.\n\t\t * https://bugzilla.kernel.org/show_bug.cgi?id=219614\n\t\t */\n\t\t.matches = {\n\t\t\tDMI_EXACT_MATCH(DMI_OEM_STRING, \"GM5HG0A\"),\n\t\t},\n\t},\nKey DMI observation: PCSpecialist relabels (GM6BGEQ/GM6BG0Q = \"PCSpecialist Elimina Pro 16 M\") are matched by DMI_BOARD_NAME alone — PCSpecialist keeps the TongFang board name in DMI_BOARD_NAME, so a board-name-only match is the correct style for the Valeon II 17 / GM7RGxM.", "cmdline_knob_exists": "NONE. Evidence: (1) grep of v7.1 drivers/acpi/resource.c for __setup/module_param returns zero hits — the file defines no parameters at all; the DMI tables and the CONFIG_X86 Zen heuristic are the only inputs to acpi_dev_irq_override(). (2) Documentation/admin-guide/kernel-parameters.txt at v7.1 has no \"irq_override\"/\"irq1\" parameter; the only ACPI-IRQ params are acpi_irq_balance/nobalance/isa/pci (PIC-mode IRQ balancing bookkeeping only, no trigger/polarity effect in IOAPIC mode) and acpi_sci= (SCI only). (3) The only non-DMI escape hatch inside acpi_dev_irq_override() is `if (acpi_int_src_ovr[gsi]) return true;` — acpi_int_src_ovr[] is populated exclusively from firmware MADT INT_SRC_OVR entries (arch/x86/kernel/acpi/boot.c), settable only by BIOS or by an initrd ACPI table upgrade (CONFIG_ACPI_TABLE_UPGRADE replacing the MADT — a build artifact, not a cmdline knob). Zen skip logic vs 6.x: NOT reverted by 7.1, but refined relative to the original 6.0 commit 9946e39fe8d0 (which skipped the override for ALL IRQs on all Zen): v7.1 carries the 6.5-era shape — skip narrowed to GSI 1 and 12 only, MADT INT_SRC_OVR entries honored, everything else uses the override unconditionally. No FADT-based condition, no further loosening, and still no user-settable override. Conclusion: for this bug the mainline-sanctioned mechanisms are exactly (a) a DMI entry (the patch below) or (b) firmware providing an IRQ1 INT_SRC_OVR; the only stock-kernel cmdline that changes the outcome is pnpacpi=off (indirect — see verdicts).", "acpi_dev_irq_override_v71": "v7.1 drivers/acpi/resource.c lines 704-759, verbatim (struct + dispatch table + function):\n\nstruct irq_override_cmp {\n\tconst struct dmi_system_id *system;\n\tunsigned char irq;\n\tunsigned char triggering;\n\tunsigned char polarity;\n\tunsigned char shareable;\n\tbool override;\n};\n\nstatic const struct irq_override_cmp override_table[] = {\n\t{ irq1_level_low_skip_override, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },\n\t{ irq1_level_low_skip_override, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 1, false },\n\t{ irq1_level_low_skip_override, 11, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 1, false },\n\t{ irq1_edge_low_force_override, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },\n};\n\nstatic bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,\n\t\t\t\t u8 shareable)\n{\n\tint i;\n\n\tfor (i = 0; i < ARRAY_SIZE(override_table); i++) {\n\t\tconst struct irq_override_cmp *entry = &override_table[i];\n\n\t\tif (entry->irq == gsi &&\n\t\t entry->triggering == triggering &&\n\t\t entry->polarity == polarity &&\n\t\t entry->shareable == shareable &&\n\t\t dmi_check_system(entry->system))\n\t\t\treturn entry->override;\n\t}\n\n#ifdef CONFIG_X86\n\t/*\n\t * Always use the MADT override info, except for the i8042 PS/2 ctrl\n\t * IRQs (1 and 12). For these the DSDT IRQ settings should sometimes\n\t * be used otherwise PS/2 keyboards / mice will not work.\n\t */\n\tif (gsi != 1 && gsi != 12)\n\t\treturn true;\n\n\t/* If the override comes from an INT_SRC_OVR MADT entry, honor it. */\n\tif (acpi_int_src_ovr[gsi])\n\t\treturn true;\n\n\t/*\n\t * IRQ override isn't needed on modern AMD Zen systems and\n\t * this override breaks active low IRQs on AMD Ryzen 6000 and\n\t * newer systems. Skip it.\n\t */\n\tif (boot_cpu_has(X86_FEATURE_ZEN))\n\t\treturn false;\n#endif\n\n\treturn true;\n}\n\nChanges vs 6.x: identical in structure to 6.5+/6.6-LTS. Deltas vs earlier 6.x: (1) vs 6.0 (9946e39fe8d0) the Zen skip is narrowed from all-IRQs to GSI 1/12 only and the acpi_int_src_ovr[] MADT honor check is new (both landed in 6.5); (2) override_table gained the IRQ 10 and 11 level-low shareable rows (reusing irq1_level_low_skip_override) that early 6.x lacked; (3) DMI table membership has grown (GM7XG0M, GM5RG1E0009COM/GM5RGEE0016COM, GXxHRXx, GMxHGxx, GM5HG0A OEM-string entry, MACHENIKE L16P, Lunnen, MAIBENBEN, N6506M/N6506CU, X1404VAP/X1504VAP/X1704VAP, 16T90SP, JVC9100 etc.). GM7RGxM was never added. Note for the DMI-table path: the match also requires shareable == 1 (the irq1_edge_low_force_override row is {.., 1, EDGE, ACTIVE_LOW, 1, true}), i.e. the DSDT must declare IRQ1 Edge/ActiveLow/Shared — same requirement the sibling boards satisfy.", "rsparser_calls_register_gsi": "YES — but indirectly in v7.1; the function named pnpacpi_parse_allocated_irqresource() no longer exists. In v7.1 drivers/pnp/pnpacpi/rsparser.c the allocated-resource walker is pnpacpi_allocated_resource() (line ~163), which calls acpi_dev_resource_interrupt(res, i, r) — the shared helper in drivers/acpi/resource.c — then pnpacpi_add_irqresource(). acpi_dev_resource_interrupt() calls acpi_dev_get_irqresource() with check_override=true for legacy IRQ()/IRQNoFlags() descriptors (the PS2K case), and acpi_dev_get_irqresource() does: (a) consult acpi_dev_irq_override() — which on this Zen board with no DMI entry returns false, so the MADT/ISA edge-high override is NOT applied and the DSDT's Edge/ActiveLow survives — then (b) `irq = acpi_register_gsi(NULL, gsi, triggering, polarity);` (resource.c line 800). Timing: drivers/pnp/pnpacpi/core.c pnpacpi_init is an fs_initcall; pnpacpi_add_device() calls pnpacpi_parse_allocated_resource(dev) whenever dev->active (core.c line 258) — i.e. at boot during PNP *enumeration*, before and regardless of any driver (i8042 or otherwise) binding. The IOAPIC pin actually gets flipped because of arch/x86/kernel/apic/io_apic.c mp_check_pin_attr() (v7.1 line 862): \"setup_IO_APIC_irqs() programs all legacy IRQs with default trigger and polarity attributes. So allow the first user to reprogram the pin\" — for irq < nr_legacy_irqs() with data->count == 1 it rewrites data->entry.is_level/active_low from the caller's info. The pnpacpi enumeration IS that first user for IRQ1, so pin 1 goes from ISA default edge/active-high to edge/active-low at fs_initcall time. This is the complete causal chain for the bug and the pivot for judging the workarounds: only something that prevents this acpi_register_gsi(1, EDGE, LOW) call (or corrects its inputs) fixes the pin.", "workaround_verdicts": [ { "param": "pnpacpi=off", "fixes_this_bug": "likely", "mechanism": "core.c line 302: pnpacpi_init() returns before acpi_get_devices(), so no PNP device is created for PS2K and pnpacpi_parse_allocated_resource -> acpi_dev_resource_interrupt -> acpi_register_gsi(1, EDGE, ACTIVE_LOW) never executes. mp_check_pin_attr()'s first-user reprogram never fires, so IOAPIC pin 1 keeps the setup_IO_APIC_irqs() ISA legacy default: edge-triggered, active-high — exactly what the Uniwill EC drives (per the LED-echo signature). i8042 then prints 'PNP: No PS/2 controller found. Probing ports directly.' and probes legacy 0x60/0x64 with IRQ1/12 defaults, which succeeds when x86_platform.legacy.i8042 == X86_LEGACY_I8042_EXPECTED_PRESENT (FADT 8042 boot flag) — near-certain here since the keyboard works in BIOS setup. 'Likely' rather than 'yes' only because the FADT 8042 flag on this exact firmware is unverified.", "side_effects": "System-wide loss of ACPI-PNP enumeration: PNP0C01/PNP0C02 motherboard resources are not reserved by the pnp 'system' driver, so PCI resource allocation can theoretically place BARs over hidden chipset registers; 8250_pnp serial devices are not discovered (none expected on this laptop); rtc_cmos falls back to legacy platform addresses (normally fine); i8042 loses PNP-provided port/IRQ data and probes blind. Touchpad is I2C-HID on TongFang barebones, so no PS/2 AUX regression expected. Broad hammer, but mostly benign on this machine; still inferior to the DMI patch." }, { "param": "i8042.nopnp", "fixes_this_bug": "no", "mechanism": "Only makes the i8042 driver skip registering its own PNP drivers (i8042-acpipnpio.h) and probe legacy ports directly. The damage happens earlier and elsewhere: pnpacpi CORE enumerates PS2K at fs_initcall and, because dev->active, parses _CRS and calls acpi_register_gsi(1, EDGE, LOW) during pnpacpi_add_device (core.c line 258) — no driver binding involved. Pin 1 is already misprogrammed edge/active-low before i8042 even loads; nopnp changes nothing about the trigger.", "side_effects": "i8042 uses hardcoded legacy ports/IRQs and may misdetect the AUX port; loses PNP-supplied resource info. Harmless to add but ineffective for this bug." }, { "param": "i8042.dumbkbd", "fixes_this_bug": "no", "mechanism": "Pretends the controller can only READ from the keyboard: suppresses commands (SETLEDS, typematic rate, scancode-set selection) sent to the device. Zero interaction with IOAPIC/GSI programming; the wrong-edge pin persists and make/break bytes still arrive one event late or get lost. Would additionally break the LED-echo diagnostic used to prove the EC alive.", "side_effects": "No LED control, no typematic config, possible wrong scancode set. Pure symptom masking for controllers that choke on commands — not this failure mode." }, { "param": "i8042.reset", "fixes_this_bug": "no", "mechanism": "Forces a controller self-test/reset at init, suspend and resume. Touches only the 8042 controller state machine; never reads or writes IRQ trigger/polarity. The IOAPIC pin remains edge/active-low.", "side_effects": "Some laptops hang or lose the keyboard on the forced reset; otherwise benign. Irrelevant to this bug." }, { "param": "i8042.probe_defer / atkbd deferred init", "fixes_this_bug": "no", "mechanism": "Retries port probing later via deferred probe to dodge early-boot EC slowness. The misprogrammed pin is persistent state set at fs_initcall by pnpacpi; probing later re-encounters the identical wrong-edge condition. atkbd's probe may even 'succeed' (writes get through; it is the interrupt edge that is wrong), matching the observed dead-but-enumerated keyboard.", "side_effects": "Slower input bring-up. No mechanism on IRQ trigger; not applicable." } ], "ranked_presets": [ "1. pnpacpi=off — the only stock-v7.1 cmdline that fixes the root cause: it prevents the boot-time acpi_register_gsi(1, EDGE, ACTIVE_LOW) call entirely, so IOAPIC pin 1 keeps the ISA edge/active-high default the EC needs; side effects (no PNP motherboard-resource reservation, no 8250_pnp) are real but mostly benign on this laptop.", "2. pnpacpi=off i8042.nopnp — same fix; nopnp is strictly redundant once pnpacpi is off (there are no PNP devices for i8042 to find) but harmless, and makes the direct-probe intent explicit in logs.", "3. i8042.nopnp alone — ruled OUT for this bug: pnpacpi core registers the GSI edge/low at fs_initcall regardless of what i8042 does; listed only so nobody wastes a reboot on it.", "4. i8042.dumbkbd / i8042.reset / i8042.probe_defer — no IRQ-trigger mechanism whatsoever; symptom-masking knobs for unrelated controller quirks; dumbkbd would also break the ledecho diagnostic. Do not use.", "(Real fix remains the one-line DMI patch below, or a BIOS/EC update that adds an IRQ1 INT_SRC_OVR MADT entry — both make the kernel apply Edge/ActiveHigh natively with zero side effects.)" ], "patch_diff": "--- a/drivers/acpi/resource.c\n+++ b/drivers/acpi/resource.c\n@@ -591,6 +591,12 @@\n \t\t},\n \t},\n \t{\n+\t\t/* TongFang GM7RGxM / PCSpecialist Valeon II 17 */\n+\t\t.matches = {\n+\t\t\tDMI_MATCH(DMI_BOARD_NAME, \"GM7RGxM\"),\n+\t\t},\n+\t},\n+\t{\n \t\t/* TongFang GM6XGxX/TUXEDO Stellaris 16 Gen5 AMD */\n \t\t.matches = {\n \t\t\tDMI_MATCH(DMI_BOARD_NAME, \"GM6XGxX\"),\n\n(Verified: applies cleanly with `patch -p1` against tag v7.1; inserts directly after the Eluktronics MECH-17 (=GM7RG7N) entry at line 587-592 of drivers/acpi/resource.c. Indentation is tabs, matching kernel style. Board-name-only match mirrors the other PCSpecialist-sold TongFang entries (GM6BGEQ/GM6BG0Q), which rely on DMI_BOARD_NAME alone because PCSpecialist preserves the TongFang board name. Ready-to-apply copy saved at /tmp/claude-1000/-home-daemon-sec/15d1485c-6af0-4b74-accc-e8f5c72f432a/scratchpad/gm7rgxm.patch. Reminder: the override_table row requires the DSDT to declare IRQ1 Edge/ActiveLow/Shared — confirm shareable flag in this machine's DSDT _CRS for PS2K when testing.)", "sources_checked": [ "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/acpi/resource.c?h=v7.1 (saved: /tmp/claude-1000/-home-daemon-sec/15d1485c-6af0-4b74-accc-e8f5c72f432a/scratchpad/resource_v7.1.c, 1174 lines)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/pnp/pnpacpi/rsparser.c?h=v7.1 (saved: .../scratchpad/rsparser_v7.1.c, 948 lines)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/pnp/pnpacpi/core.c?h=v7.1 (saved: .../scratchpad/core_v7.1.c)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/x86/kernel/apic/io_apic.c?h=v7.1 (saved: .../scratchpad/io_apic_v7.1.c; mp_check_pin_attr at line 862)", "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/admin-guide/kernel-parameters.txt?h=v7.1 (saved: .../scratchpad/kernel-parameters_v7.1.txt; pnpacpi= at line 5379, i8042.* at 2183-2195)", "Patch validation: patch -p1 dry-run+apply against .../scratchpad/ptest/drivers/acpi/resource.c (clean apply, hunk at line 593)" ] }, "prior": { "generic_fix_status": "NO generic user-facing fix or cmdline knob exists as of v7.1. Timeline: (a) commit 9946e39fe8d0 (v6.0) skips the MADT ISA IRQ override on all X86_FEATURE_ZEN CPUs for GSI 1/12; (b) Mario Limonciello's \"ACPI: resource: Remove Zen specific match and quirks\" (a9c4a912b7dc) was merged as 6.5 material in June 2023 — it would have fixed this machine by restoring the override everywhere — but was REVERTED by Hans de Goede before 6.5 final (revert also backported to 6.4.y stable) after a flood of keyboard regressions on machines that rely on the skip; (c) the generic mechanism that DID land in 6.5 and survives in v7.1 (verified in downloaded drivers/acpi/resource.c?h=v7.1, line 746) is the acpi_int_src_ovr[] check: a firmware-supplied MADT Interrupt Source Override entry for GSI1 is honored even on Zen — firmware-controlled, useless without a BIOS update; (d) verified v7.1 Documentation/admin-guide/kernel-parameters.txt contains NO acpi.irq_override/irq1 parameter (only pnpacpi= and the unrelated acpi_skip_timer_override), and v7.1 resource.c has no module_param/__setup. Nothing else generic landed between 6.5 and 7.1 — only per-board DMI-table growth (Eluktronics MECH-17 Jan 2025, MACHENIKE 16P mid-2025 with AUTOSEL backports to 6.1/6.12, MECHREVO typo fix Apr 2025, GM5HG0A OEM-string match Dec 2024). The escape hatches on an unlisted board are exactly three: DMI/OEM-string table entry (needs kernel rebuild), MADT INT_SRC_OVR from firmware (needs BIOS update), or fixing the DSDT IRQ descriptor (initrd table upgrade — viable, see dsdt_override_viability).", "gm7rgxm_patch_status": "NEVER submitted or discussed upstream. patchwork.kernel.org API (verified working — returns 8 hits for 'irq1_edge_low_force_override' including the mainlined MECH-17, Infinity, GM5HG0A, MAIBENBEN patches) returns 0 patches for 'GM7RG' and 'GM7RGxM' across all projects; general web/LKML-archive searches for GM7RGxM find zero kernel-related hits; downloaded v7.1 resource.c confirms no GM7RGxM/GM7RG entry (closest kin in table: Eluktronics 'MECH-17' matched by DMI_SYS_VENDOR 'Eluktronics Inc.' + DMI_BOARD_NAME 'MECH-17', i.e. reseller-relabeled DMI, submitted by Gannon Kolding 2025-01-27; and OEM-string exact-match precedent for rebrands: DMI_EXACT_MATCH(DMI_OEM_STRING, 'GM5HG0A') citing bugzilla 219614). Brands shipping the GM7RG family: GM7RGxM = PCSpecialist Valeon II 17 / Valeon LI 17; sibling GM7RG7N = Eluktronics MECH-17, XMG (NEO 17 Ryzen, per XMG GM7RG7N service manuals), Infinity N7-6R7R7TiN-899 (Australian). Real-user evidence of unfixed GM7RGxM machines: EndeavourOS forum t/36675 'Internal laptop keyboard not responding' is a PCSpecialist Valeon II 17 with exactly this dead-keyboard symptom, tried clevo-xsm-wmi (failed), thread ended UNRESOLVED. A submission for this board would be novel and should follow the MECH-17/GM5HG0A precedent (match the PCSpecialist-relabeled DMI strings AND/OR DMI_OEM_STRING 'GM7RGxM' to cover all rebrands).", "user_workaround_reports": [ "Arch BBS 291569 | Lunnen Ground 16 (TongFang-family, Ryzen 7 5800U, boards now mainlined as Lunnen LL6FA/LLL5DAW) | pnpacpi=off | WORKED — 'appended pnpacpi=off and the keyboard worked like a charm', discovered by user Eddie_Foss, independently confirmed by lulzette on another Lunnen; thread advises also disabling Fast Boot / 'PnP OS installed' in BIOS", "Arch BBS 291569 | same machines (Lunnen/Seryub Ryzen 5700U/Casper) | i8042.nopnp, i8042.nomux, i8042.noaux | FAILED — keyboard stayed frozen (nopnp only stops i8042's own PnP lookup; PnP ACPI still programs the wrong IRQ1 trigger)", "Arch BBS 291569 | same machines | i8042.dumbkbd=1 | PARTIAL/UNUSABLE — keys register but ~1 s key-release delay and ~18x key-repeat echo (the wrong-trigger late-IRQ signature, same as this laptop's LED-echo test)", "Arch BBS 291569 | Lunnen Ground 16 (user raorn) | DSDT edit: 'IRQ (Edge, ActiveLow, Shared)' -> 'Interrupt (ResourceConsumer, Edge, ActiveHigh, Shared)' + OEM-revision bump, loaded via dracut acpi_override early-cpio (CONFIG_ACPI_TABLE_UPGRADE) | WORKED — 'fixes the problem'; exactly this bug, exactly the initrd-override mechanism", "Arch BBS 291569 | one other user | 'acpi_override module' attempt | FAILED for them (likely misapplied — no OEM-revision bump/wrong archive placement; raorn's correctly-done override on the same thread worked)", "lef.li/post/32170 | Infinity E15-5A165-BM (TongFang GM5RG1E0009COM, Ryzen 5 6600H) | kernel 5.10 LTS downgrade | PARTIAL — keyboard worked but amdgpu/DRM broke", "lef.li/post/32170 | same Infinity machine | custom kernel rebuild adding DMI quirk to resource.c (NixOS boot.kernelPatches) | WORKED — became the mainlined 'ACPI: resource: Add Infinity laptops to irq1_edge_low_force_override' patch in 6.8", "Bugzilla 219614 (via mail-archive acpi-bugzilla msg51696) | SKIKK Vanaheim 15 (TongFang GM5HG0A relabel, Ryzen 7 8845HS) | kernel rebuild forcing acpi_dev_irq_override() to return true | WORKED — dmesg 'ACPI: IRQ 1 override to edge, high(!)'; led to the DMI_OEM_STRING mainline fix", "EndeavourOS forum t/36675 | PCSpecialist Valeon II 17 (this exact model, GM7RGxM) | clevo-xsm-wmi 1.1-3 package | FAILED; no cmdline params tried on record; thread unresolved", "NOTE: no pnpacpi=off report exists on a GM7RG* board specifically — the successes are on sibling-family Zen boards with the identical root cause; mechanism (PNP0303 _CRS never parsed, IRQ1 keeps IO-APIC edge/high default, i8042 falls back to hardcoded IRQ1) is board-independent, side effect is loss of all PnP-ACPI-enumerated resources" ], "runtime_tools": "NONE FOUND. No existing out-of-tree module or userspace tool that retargets IRQ1 trigger/polarity at runtime for this bug family. Searched GitHub/GitLab/LKML/forums: hits are all unrelated — tuxedo-keyboard/tuxedo-drivers (RGB backlight), acpi-call-dkms (EC ACPI calls), tongfang-control (fan/backlight), an rr-debugger Zen perf-counter gist, and NixOS boot.kernelPatches recipes (rebuild-time, not runtime). TUXEDO/XMG ship downstream kernels with the DMI patches (Werner Sembach is a frequent submitter) rather than any runtime fixer. Implication: the planned candidate mechanism (2) — a small out-of-tree module that calls irq_set_irq_type(1, IRQ_TYPE_EDGE_RISING)-equivalent on the IO-APIC/IR domain then unbind/rebind of the i8042 platform device or serio drvctl rescan — would be novel work with no prior art to crib from; note AMD-Vi interrupt remapping is active on this boot (IR-IO-APIC), so the trigger change must go through the irqdomain hierarchy (irq_set_irq_type on the mapped Linux IRQ), not raw IO-APIC RTE pokes. Also no sysfs/debugfs interface exists in v7.1 for changing an IRQ's trigger from userspace.", "dsdt_override_viability": "VIABLE and is the documented no-rebuild path; resource.c itself is built-in (obj-y core ACPI) so there is NO way to test a resource.c change without rebuilding the kernel image — the initrd ACPI table upgrade sidesteps that entirely. Mechanics (verified against v7.1 sources saved in scratchpad): CONFIG_ACPI_TABLE_UPGRADE=y in Arch's linux package; per Documentation/admin-guide/acpi/initrd_table_override.rst (v7.1) the fixed DSDT goes in an UNCOMPRESSED cpio at kernel/firmware/acpi/dsdt.aml which must be FIRST in the initrd concatenation, and a same-signature table (DSDT) replaces the platform one only if OEMID+OEM-Table-ID match and OEM Revision is HIGHER — so bump the revision in the DefinitionBlock line, exactly as the successful Lunnen report did. Arch/mkinitcpio: mkinitcpio ships a native 'acpi_override' HOOK (Arch Wiki DSDT page, fetched) — drop dsdt.aml in /etc/initcpio/acpi_override/, add acpi_override to HOOKS in mkinitcpio.conf, regenerate — it packs the early uncompressed cpio at the head of the single initramfs image, no bootloader changes needed; this composes cleanly with Limine UKI because the combined image becomes the UKI .initrd section and the kernel's early-cpio scanner finds the uncompressed archive at its head (same mechanism ucode uses). Success report for EXACTLY this bug via table override: user raorn (Arch BBS 291569, Lunnen Ground 16) changed the keyboard descriptor 'IRQ (Edge, ActiveLow, Shared)' to 'Interrupt (ResourceConsumer, Edge, ActiveHigh, Shared)', bumped OEM revision, loaded via dracut's acpi_override — 'fixes the problem' (dracut, but identical kernel mechanism to the mkinitcpio hook). Caveats: (1) blocked under kernel lockdown — security_locked_down(LOCKDOWN_ACPI_TABLES) in v7.1 drivers/acpi/tables.c line 489 — so Secure Boot lockdown must be off; (2) must be redone after every BIOS update; (3) one thread participant failed with a misapplied override, so verify via dmesg 'ACPI: Table Upgrade' lines and /sys/firmware/acpi/tables/DSDT checksum after boot. NOTE the subtlety in raorn's edit: he did not just flip ActiveLow->ActiveHigh in the legacy IRQ() macro (which cannot express ActiveHigh with Edge in some iasl versions) but switched to an extended Interrupt() descriptor — and because v7.1 resource.c only applies check_override to legacy IRQ()/IRQNoFlags() descriptors (extended IRQ descriptors are taken from _CRS directly), the Interrupt(...Edge, ActiveHigh...) form both fixes the trigger AND bypasses the Zen skip logic entirely.", "sources_checked": [ "patchwork.kernel.org REST API (queries: GM7RG=0 hits, GM7RGxM=0 hits, irq1_edge_low_force_override=8 hits incl. states/dates — API verified functional)", "patchew.org/linux/20230601221151.670-1-mario.limonciello@amd.com (Remove Zen specific match and quirks v3 — merged 6.5 material)", "lore.kernel.org and bugzilla.kernel.org — BLOCKED by Anubis anti-bot (both direct fetch and browser-UA curl); used mirrors instead", "www.mail-archive.com/acpi-bugzilla@lists.sourceforge.net/msg51696.html (bugzilla 219614, GM5HG0A/SKIKK Vanaheim)", "lkml.iu.edu/hypermail/linux/kernel/2501.3/02371.html (Eluktronics MECH-17 GM7RG7N patch, Gannon Kolding, 2025-01-27)", "spinics.net + lists.linaro.org stable-backport listings (Infinity laptops 6.7 backport, MACHENIKE 16P AUTOSEL 6.1/6.12, revert of Zen-quirk removal in 6.4.y)", "git.kernel.org plain v7.1: drivers/acpi/resource.c (full DMI tables enumerated, GM7RGxM absent, acpi_int_src_ovr path present, no cmdline knob), drivers/acpi/tables.c (LOCKDOWN_ACPI_TABLES gate line 489), Documentation/admin-guide/kernel-parameters.txt (no irq-override param), Documentation/admin-guide/acpi/initrd_table_override.rst — all saved under /tmp/claude-1000/-home-daemon-sec/15d1485c-6af0-4b74-accc-e8f5c72f432a/scratchpad/", "bbs.archlinux.org/viewtopic.php?id=291569 (pnpacpi=off successes, i8042.* failures, raorn DSDT-override success)", "forum.endeavouros.com/t/internal-laptop-keyboard-not-responding/36675 (PCSpecialist Valeon II 17, unresolved)", "lef.li/post/32170 (Infinity E15-5A165-BM GM5RG1E0009COM workaround history -> 6.8 mainline patch)", "wiki.archlinux.org/title/DSDT (fetched via curl default UA past Anubis; mkinitcpio acpi_override hook documentation)", "WebSearch sweeps: irq1_edge_low_force_override + GM7RGxM/Valeon/PCSpecialist, acpi.irq_override knob, pnpacpi=off + i8042.nopnp user reports, out-of-tree runtime IRQ modules, nixos-hardware tongfang patches" ] }, "critique": { "module_go_nogo": "GO_WITH_CONDITIONS", "module_conditions": [ "Ship the module as an opt-in secondary path; the pnpacpi=off Limine drop-in is the primary fix. First module run must be attended (user at the machine with the external USB keyboard and 'inkbd boot revert' ready); only after one verified success may the boot-time systemd unit be enabled.", "Wrapper must guarantee the i8042 rebind unconditionally (shell trap/finally): after 'echo -n i8042 > .../unbind', the '.../bind' write must execute even if insmod fails, errors, or is interrupted. Module -ENODEV (signature mismatch = already-fixed or unknown layout) is a benign no-op: log, rebind, exit 0.", "Module validation order is safety-critical: validate the scalar field signature (d->hwirq==1, chip name IO-APIC/IR-IO-APIC, isa_irq==true, count>=1, is_level==false, active_low==true, entry.is_level==0, entry.active_low==1) BEFORE touching irq_2_pin; then walk the pin list as a MANDATORY bounded check (expect exactly 1 entry with pin==1, cap iterations, sanity-check pointers) — chip-name+hwirq alone is ambiguous on this machine (live IRQ 44 is another 'IR-IO-APIC' irq_data with hwirq 1 on the second IOAPIC). Refuse to write on any mismatch; a failed validation must never have dereferenced unvalidated list pointers.", "revert=1 must invert the expected signature (expect active_low==false / entry.active_low==0 before writing active-low back); the forward-path signature check as specified would refuse the revert.", "Forbidden mechanisms stay forbidden: irq_set_irq_type() (verified silent no-op — neither ioapic chip has .irq_set_type and __irq_set_trigger returns 0 without touching irqd flags), disable_irq/enable_irq as a rewrite trigger (lazy disable → unmask may never write), and raw IOAPIC MMIO (two IOAPICs, unexported ioapic_lock, STRICT_DEVMEM+IO_STRICT_DEVMEM=y confirmed live).", "Module must be MODULE_LICENSE(\"GPL\") (irq_get_irq_data is EXPORT_SYMBOL_GPL), built against the exact running linux-headers (vermagic enforced; CONFIG_RANDSTRUCT_NONE=y and CONFIG_MODULE_SIG_FORCE unset confirmed live, so an unsigned local build loads and the copied struct layout is not randomized).", "Boot persistence unit: skip entirely (exit 0) when /proc/cmdline contains pnpacpi=off or the module reports already-fixed; on vermagic/build mismatch after a kernel update, log and exit 0 (never fail boot, never leave i8042 unbound); rebuild via DKMS or a pacman hook; order After=sysinit with /sys/bus/platform/drivers/i8042 present, Before=display-manager.", "Success criterion is functional, not enumerative: new input device under serio0 AND IRQ1 count incrementing once per keypress with no one-window latency (inkbd ledecho) — the input3 device registering proves nothing (this boot's zombie atkbd registered despite failed 0xF5/0xF4). Expect and ignore one spurious IRQ1 edge at the polarity flip." ], "best_default_preset": "pnpacpi=off", "corrections": [ "Fix the existing inkbd preset ladder: 'tongfang' (i8042.nopnp=1 i8042.nomux=1 i8042.reset=1 i8042.noloop=1) is currently ranked first but cannot fix this bug — verified: pnpacpi core parses PS2K _CRS at fs_initcall (core.c:257-258 dev->active path) and calls acpi_register_gsi(1, EDGE, ACTIVE_LOW) (resource.c:800) before i8042 loads; i8042.nopnp only changes i8042's own lookup. Make pnpacpi=off the first (default) preset; demote tongfang to a non-fix diagnostic; demote 'dumb' — sibling-board reports (Arch BBS 291569) show ~1 s key-release delay and ~18x repeat (unusable), and it breaks the ledecho diagnostic.", "enable-keyboard must add a root pre-flight before installing the pnpacpi=off drop-in: read FACP iapc_boot_arch (offset 109, bit 1 = 8042 present). If clear, i8042 will refuse direct probing under pnpacpi=off ('PNP: No PS/2 controller found') and the keyboard stays dead — warn and still allow, since worst case is bounded (boot fine, external USB keyboard unaffected, revert available). This flag could not be verified from the unprivileged critic session.", "Install the cmdline as a dedicated Limine drop-in (e.g. /etc/limine-entry-tool.d/keyboard-fix.conf with KERNEL_CMDLINE[default]+=\" pnpacpi=off\") + limine-update, mirroring the existing omarchy-defaults.conf mechanism; ENABLE_LIMINE_FALLBACK=yes is already set — keep it, and keep 'inkbd boot revert' working against the new file.", "Before any local DMI-patch testing or upstream submission, dump the DSDT (root; inkbd diag already does this) and confirm the PS2K _CRS uses a legacy IRQ() descriptor with Edge/ActiveLow/Shared: the override_table row {irq1_edge_low_force_override, 1, EDGE, ACTIVE_LOW, 1, true} requires shareable==1, and only legacy IRQ()/IRQNoFlags() descriptors get check_override=true (extended Interrupt() descriptors bypass the override machinery entirely — verified resource.c:845 vs :857). The saved gm7rgxm.patch itself is correct and dry-run-applies cleanly against pristine v7.1 (md5-verified re-fetch); DMI_BOARD_NAME=GM7RGxM confirmed live.", "pnpacpi=off side-effect analysis is confirmed benign for this machine and should be documented in the program's output: the I2C touchpad (AMDI0010) is ACPI-platform enumerated, not PNP, so unaffected; AUX is already PNP-disabled this boot ('PS/2 appears to have AUX port disabled'); rtc_cmos falls back to the x86 legacy platform device so the resume/rtc-alarm drop-ins keep working; residual risk is only unreserved PNP0C01/0C02 motherboard resources.", "Module wrapper step 2's AUX/touchpad caveat can be strengthened to 'no-op': this machine has no PS/2 AUX port at all (journal-verified), so unbind tears down only the KBD port.", "The module's step (e) pin-list walk must be promoted from 'optional pr_info' to a mandatory validation gate (see conditions) — the live system proves hwirq==1 + chip-name 'IR-IO-APIC' is satisfiable by a different interrupt (IRQ 44, snd_hda_intel, pin 1 of IOAPIC 1).", "Minor errata that do not change conclusions: preset lane's 'verbatim' sibling-entry quote reorders the actual table (GMxBGxx at line 559 precedes GMxRGxx at 563; RP-15 and GM6XGxX sit between MECH-17 and GM6BGEQ) — the patch context is nonetheless correct; runtime lane's IRQ1 'count 4' is boot-specific (now 5); both irrelevant to implementation." ], "unresolved_gaps": [ "FADT IAPC_BOOT_ARCH 8042 flag unread (FACP is root-only; sudo -n unavailable in this session) — the pnpacpi=off fallback probe ('Probing ports directly') depends on it; keyboard-works-in-BIOS makes it near-certain but it must be read by the root-running program before the reboot.", "DSDT PS2K IRQ descriptor's Shared flag unread (root-only) — required (shareable==1) for the irq1_edge_low_force_override row to match; affects only the DMI-patch/upstream path, not pnpacpi=off or the chip-data module.", "Arch kernel 7.1.8-arch1-3 assumed identical to mainline v7.1 in io_apic.c/resource.c/i8042.c — only mainline was checked (Arch patches were not diffed); mitigated by vermagic plus the module's refuse-on-mismatch validation, and for i8042 by the live-verified bind/unbind sysfs attrs.", "The active-high hypothesis itself (EC signals rising-edge) rests on sibling-board precedent plus the one-IRQ-per-SETLEDS-one-window-late signature, not direct measurement; if wrong, the keyboard stays dead after the flip — bounded by the module's revert=1 path and boot-preset revert.", "No pnpacpi=off success report exists for a GM7RG* board specifically (successes are on sibling-family Zen TongFang boards with the identical root cause); the EndeavourOS thread for this exact model tried neither pnpacpi=off nor any IRQ-relevant workaround.", "Whether IRQ 12 chip data is similarly poisoned was not checked (irrelevant now — no PS/2 AUX — but a future BIOS enabling AUX would re-raise it)." ] } }, "workflowProgress": [ { "type": "workflow_phase", "index": 1, "title": "Research" }, { "type": "workflow_phase", "index": 2, "title": "Critique" }, { "type": "workflow_agent", "index": 1, "label": "runtime-fix", "phaseIndex": 1, "phaseTitle": "Research", "agentId": "aa0f7b9fa6e0fd9a9", "model": "claude-fable-5", "state": "done", "startedAt": 1787536327018, "queuedAt": 1787536325441, "attempt": 1, "lastToolName": "StructuredOutput", "lastToolSummary": "NO. In v7.1 arch/x86/kernel/apic/io_apic.c both irq_chips l…", "promptPreview": "CONTEXT (established facts, do not re-derive):\n- Laptop: PCSpecialist Valeon II 17 = TongFang GM7RGxM barebone, Uniwill EC, Ryzen 9 6900HX (Zen 3+),\n Arch Linux, kernel 7.1.8-arch1-3 (matching linux-headers installed). Limine UKI boot, cmdline\n drop-ins in /etc/limine-entry-tool.d/ applied via limine-update.\n- Internal PS/2 keyboard (EC-emulated, i8042/atkbd) is dead in Linux, WORKS in BIOS setu…", "lastProgressAt": 1787536906024, "tokens": 98260, "toolCalls": 31, "durationMs": 579005, "resultPreview": "{\"ioapic_set_type\":\"NO. In v7.1 arch/x86/kernel/apic/io_apic.c both irq_chips lack .irq_set_type: ioapic_chip (lines 1854-1866) and ioapic_ir_chip (lines 1868-1880, name \\\"IR-IO-APIC\\\" — the one live on this box per /proc/interrupts) implement only irq_startup/irq_mask/irq_unmask/irq_ack/irq_eoi/irq_set_affinity/irq_retrigger/irq_get_irqchip_state. Consequence: irq_set_irq_type(1, IRQ_TYPE_EDGE_RI…" }, { "type": "workflow_agent", "index": 2, "label": "boot-params", "phaseIndex": 1, "phaseTitle": "Research", "agentId": "a13863a5e5bd2e874", "model": "claude-fable-5", "state": "done", "startedAt": 1787536327471, "queuedAt": 1787536325442, "attempt": 1, "lastToolName": "StructuredOutput", "lastToolSummary": "ABSENT. Verified against tag v7.1 (fetched from git.kernel.…", "promptPreview": "CONTEXT (established facts, do not re-derive):\n- Laptop: PCSpecialist Valeon II 17 = TongFang GM7RGxM barebone, Uniwill EC, Ryzen 9 6900HX (Zen 3+),\n Arch Linux, kernel 7.1.8-arch1-3 (matching linux-headers installed). Limine UKI boot, cmdline\n drop-ins in /etc/limine-entry-tool.d/ applied via limine-update.\n- Internal PS/2 keyboard (EC-emulated, i8042/atkbd) is dead in Linux, WORKS in BIOS setu…", "lastProgressAt": 1787536699395, "tokens": 65726, "toolCalls": 22, "durationMs": 371923, "resultPreview": "{\"gm7rgxm_in_v71\":\"ABSENT. Verified against tag v7.1 (fetched from git.kernel.org plain URL, saved at /tmp/claude-1000/-home-daemon-sec/15d1485c-6af0-4b74-accc-e8f5c72f432a/scratchpad/resource_v7.1.c, 1174 lines). v7.1 drivers/acpi/resource.c contains exactly two DMI quirk tables: irq1_level_low_skip_override[] (line 394: MEDION, ASUS, LG, JVC9100 boards — no TongFang) and irq1_edge_low_force_over…" }, { "type": "workflow_agent", "index": 3, "label": "prior-art", "phaseIndex": 1, "phaseTitle": "Research", "agentId": "a4ae92848e4b7faff", "model": "claude-fable-5", "state": "done", "startedAt": 1787536327252, "queuedAt": 1787536325442, "attempt": 1, "lastToolName": "StructuredOutput", "lastToolSummary": "NO generic user-facing fix or cmdline knob exists as of v7.…", "promptPreview": "CONTEXT (established facts, do not re-derive):\n- Laptop: PCSpecialist Valeon II 17 = TongFang GM7RGxM barebone, Uniwill EC, Ryzen 9 6900HX (Zen 3+),\n Arch Linux, kernel 7.1.8-arch1-3 (matching linux-headers installed). Limine UKI boot, cmdline\n drop-ins in /etc/limine-entry-tool.d/ applied via limine-update.\n- Internal PS/2 keyboard (EC-emulated, i8042/atkbd) is dead in Linux, WORKS in BIOS setu…", "lastProgressAt": 1787537068782, "tokens": 83689, "toolCalls": 44, "durationMs": 741529, "resultPreview": "{\"generic_fix_status\":\"NO generic user-facing fix or cmdline knob exists as of v7.1. Timeline: (a) commit 9946e39fe8d0 (v6.0) skips the MADT ISA IRQ override on all X86_FEATURE_ZEN CPUs for GSI 1/12; (b) Mario Limonciello's \\\"ACPI: resource: Remove Zen specific match and quirks\\\" (a9c4a912b7dc) was merged as 6.5 material in June 2023 — it would have fixed this machine by restoring the override eve…" }, { "type": "workflow_agent", "index": 4, "label": "critic", "phaseIndex": 2, "phaseTitle": "Critique", "agentId": "a399b81f705c28b69", "model": "claude-fable-5", "state": "done", "startedAt": 1787537072611, "queuedAt": 1787537070491, "attempt": 1, "lastToolName": "StructuredOutput", "lastToolSummary": "GO_WITH_CONDITIONS", "promptPreview": "CONTEXT (established facts, do not re-derive):\n- Laptop: PCSpecialist Valeon II 17 = TongFang GM7RGxM barebone, Uniwill EC, Ryzen 9 6900HX (Zen 3+),\n Arch Linux, kernel 7.1.8-arch1-3 (matching linux-headers installed). Limine UKI boot, cmdline\n drop-ins in /etc/limine-entry-tool.d/ applied via limine-update.\n- Internal PS/2 keyboard (EC-emulated, i8042/atkbd) is dead in Linux, WORKS in BIOS setu…", "lastProgressAt": 1787537735164, "tokens": 114920, "toolCalls": 27, "durationMs": 662553, "resultPreview": "{\"module_go_nogo\":\"GO_WITH_CONDITIONS\",\"module_conditions\":[\"Ship the module as an opt-in secondary path; the pnpacpi=off Limine drop-in is the primary fix. First module run must be attended (user at the machine with the external USB keyboard and 'inkbd boot revert' ready); only after one verified success may the boot-time systemd unit be enabled.\",\"Wrapper must guarantee the i8042 rebind uncondit…" } ], "totalTokens": 362595, "totalToolCalls": 124 }