mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] HID: amd_sfh: Fix MP2 DMA mask and add Dell Inspiron 7405 quirk
@ 2026-11-27  4:47 Gururaj Naik
  2026-11-27  4:47 ` [PATCH v2 1/2] HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2 Gururaj Naik
  2026-11-27  4:47 ` [PATCH v2 2/2] HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1 Gururaj Naik
  0 siblings, 2 replies; 3+ messages in thread
From: Gururaj Naik @ 2026-11-27  4:47 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Basavaraj Natikar
  Cc: linux-input, linux-kernel

This two-patch series enables working sensors on the Dell Inspiron 7405
2-in-1 (AMD Ryzen 7 4700U Renoir, PCI ID 1022:15e4 rev 00, BIOS 1.20.0):

1. Restrict coherent/streaming DMA to 32 bits for pre-SFH1.1 MP2 devices
   (mp2_ver < MP2_VER_1_1), avoiding MCE hardware memory corruption faults
   when dmam_alloc_coherent() returns buffers above 4 GiB.
2. Add a dmi_sfh_table[] quirk for "Dell Inc." / "Inspiron 7405 2n1"
   calling mp2_disable_intr so MP2 firmware acknowledges sensor commands.

Both patches are based on hid.git for-next (commit 4a30b295fc34). They
were validated on Arch Linux kernel 7.2.9 using an out-of-tree build
with these two changes: all four advertised sensors (accel_3d, gyro_3d,
magn_3d, and op_idx) enable with DMA addresses below 4 GiB and stream
cleanly via IIO without MCE errors.

Changes in v2:
- Rebased onto hid.git for-next.
- Dropped the HID report routing fix, which is already queued in
  hid.git for-next via for-7.4/amd_sfh.
- Replaced the global intr_disable = false change with a targeted DMI
  quirk in dmi_sfh_table[].
- Scoped the 32-bit DMA mask restriction to pre-SFH1.1 MP2 devices so
  SFH 1.1 and newer remain unchanged.
- Added Fixes tags and corrected patch formatting.

Link: https://lore.kernel.org/linux-input/20261113213533.13139-1-gururajnaik166@gmail.com/ [v1]

Gururaj Naik (2):
  HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2
  HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1

 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2
  2026-11-27  4:47 [PATCH v2 0/2] HID: amd_sfh: Fix MP2 DMA mask and add Dell Inspiron 7405 quirk Gururaj Naik
@ 2026-11-27  4:47 ` Gururaj Naik
  2026-11-27  4:47 ` [PATCH v2 2/2] HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1 Gururaj Naik
  1 sibling, 0 replies; 3+ messages in thread
From: Gururaj Naik @ 2026-11-27  4:47 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Basavaraj Natikar
  Cc: linux-input, linux-kernel, stable

Commit c45d2b54cc73 ("HID: amd_sfh: Use dma_set_mask_and_coherent()")
switched from dma_set_mask() to dma_set_mask_and_coherent() with a
64-bit mask, allowing dmam_alloc_coherent() to return sensor DMA
buffers above 4 GiB.

On a Dell Inspiron 7405 2n1 (Ryzen 7 4700U Renoir, PCI ID 1022:15e4),
enabling sensors with a coherent DMA buffer above 4 GiB (e.g.
0x110ff9000) causes MCE hardware memory corruption faults in active
memory. Limiting the DMA mask to DMA_BIT_MASK(32) ensures buffers are
allocated below 4 GiB and eliminates the MCE faults.

Set the 32-bit DMA mask only for pre-SFH1.1 MP2 devices (mp2_ver <
MP2_VER_1_1), leaving 64-bit DMA unchanged for SFH 1.1 and newer.

Fixes: c45d2b54cc73 ("HID: amd_sfh: Use dma_set_mask_and_coherent()")
Cc: stable@vger.kernel.org
Signed-off-by: Gururaj Naik <gururajnaik166@gmail.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 1d129f30b48a..fafba3ec9ced 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -484,7 +484,11 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 
 	privdata->mmio = pcim_iomap_table(pdev)[2];
 	pci_set_master(pdev);
-	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+
+	privdata->mp2_ver = (enum amd_mp2_version)id->driver_data;
+	rc = dma_set_mask_and_coherent(&pdev->dev,
+				       privdata->mp2_ver >= MP2_VER_1_1 ?
+				       DMA_BIT_MASK(64) : DMA_BIT_MASK(32));
 	if (rc) {
 		dev_err(&pdev->dev, "failed to set DMA mask\n");
 		return rc;
@@ -498,7 +502,6 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	if (rc)
 		return rc;
 
-	privdata->mp2_ver = (enum amd_mp2_version)id->driver_data;
 	if (privdata->mp2_ver >= MP2_VER_1_1) {
 		privdata->sfh1_1_ops = &sfh1_1_ops;
 		if (boot_cpu_data.x86 >= 0x1A)
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1
  2026-11-27  4:47 [PATCH v2 0/2] HID: amd_sfh: Fix MP2 DMA mask and add Dell Inspiron 7405 quirk Gururaj Naik
  2026-11-27  4:47 ` [PATCH v2 1/2] HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2 Gururaj Naik
@ 2026-11-27  4:47 ` Gururaj Naik
  1 sibling, 0 replies; 3+ messages in thread
From: Gururaj Naik @ 2026-11-27  4:47 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Basavaraj Natikar
  Cc: linux-input, linux-kernel, stable

On the Dell Inspiron 7405 2-in-1 (Ryzen 7 4700U, BIOS 1.20.0), the MP2
firmware does not respond to sensor enable commands when intr_disable
is true, causing sensor discovery to fail with:

  pcie_mp2_amd 0000:03:00.7: Failed to discover, sensors not enabled is 0

This matches the behavior seen on the HP ProBook x360 435 G7 and ASUS
VivoBook Flip 14 models in dmi_sfh_table[]. Add a DMI entry for the Dell
Inspiron 7405 2n1 calling mp2_disable_intr so interrupts remain enabled
for MP2 commands, enabling the accelerometer, gyroscope, magnetometer,
and operating-mode sensors.

Fixes: b300667b33b2 ("HID: amd_sfh: Disable the interrupt for all command")
Cc: stable@vger.kernel.org
Signed-off-by: Gururaj Naik <gururajnaik166@gmail.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index fafba3ec9ced..aeeabc3be2b6 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -335,6 +335,13 @@ static const struct dmi_system_id dmi_sfh_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "VivoBook_ASUSLaptop TP420IA"),
 		},
 	},
+	{
+		.callback = mp2_disable_intr,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7405 2n1"),
+		},
+	},
 	{}
 };
 
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-27  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  4:47 [PATCH v2 0/2] HID: amd_sfh: Fix MP2 DMA mask and add Dell Inspiron 7405 quirk Gururaj Naik
2026-11-27  4:47 ` [PATCH v2 1/2] HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2 Gururaj Naik
2026-11-27  4:47 ` [PATCH v2 2/2] HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1 Gururaj Naik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®