[PATCH v2 1/2] HID: amd_sfh: Limit DMA mask to 32 bits on pre-SFH1.1 MP2
From: Gururaj Naik
Date: Thu Nov 26 2026 - 23:47:32 EST
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@xxxxxxxxxxxxxxx
Signed-off-by: Gururaj Naik <gururajnaik166@xxxxxxxxx>
---
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