HID: amd_sfh: Fix MP2 DMA mask and add Dell Inspiron 7405 quirk
Subsystems (3)
v2 cover HID: amd_sfh: Fix MP2 DMA mask and add Dell Inspiron 7405 quirk
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.
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(-)
Signature · 1 line
2.56.0
PATCH v2 1/2 HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2
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.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +5 -2
@@ -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 *iif (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 )
Signature · 1 line
2.56.0
PATCH v2 2/2 HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1
In reply to Gururaj NaikOn 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.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +7 -0
@@ -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"), + }, + }, {} };
Signature · 1 line
2.56.0