Skip to contentSkip to conversation

HID: amd_sfh: Fix 32-bit DMA mask truncation on Renoir MP2

PATCH New WhiteDoor6767 1 participant 4 messages Nov 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 HID: amd_sfh: Fix 32-bit DMA mask truncation on Renoir MP2

From: Gururaj Naik <[email protected]>

AMD Renoir MP2 Sensor Fusion Hub uses a 32-bit DMA engine. In upstream kernels, calling dma_set_mask_and_coherent() with DMA_BIT_MASK(64) resulted in allocations above 4GB (e.g. 0x110ff9000). The Renoir MP2 hardware silently truncated the upper 32 bits and performed DMA to 0x10ff9000, corrupting active user/kernel memory and causing MCE hardware memory corruption faults and bad swap offset panics.

Restricting the DMA mask to DMA_BIT_MASK(32) ensures all DMA allocations remain in the 32-bit physical address space, restoring stability.

---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +1 -1
index 1234567..89abcdef 100644
@@ -298,7 +298,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *
 	pci_set_master(pdev);
 
-	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 	if (rc) {
 		dev_err(&pdev->dev, "failed to set DMA mask\n");
 		return rc;
Signature · 1 line
2.48.1
#1 lore raw

PATCH 2/4 HID: amd_sfh: Route HID reports using node_type in work handler

From: Gururaj Naik <[email protected]>

In amd_sfh_work(), incoming report requests are processed asynchronously. The work handler previously passed cli_data->report_type[current_index] to hid_input_report(). However, cli_data->report_type is uninitialized (0, corresponding to HID_INPUT_REPORT).

When hid-sensor-hub requested a feature report (HID_FEATURE_REPORT, size 15), it was mistakenly fed into hid_input_report() as HID_INPUT_REPORT. Because the accelerometer input report specifies 15 bytes of payload (plus 1 byte report ID), the HID core found only 14 bytes of payload in the feature report, emitted "Event data for report 1 was too short (15 vs 14)", and rejected the packet with -EINVAL, effectively dropping all motion reports.

Pass the actual node_type from the request node to hid_input_report() so feature and input reports are dispatched with their correct report types.

---
 drivers/hid/amd-sfh-hid/amd_sfh_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_client.c +2 -2
index 1234567..89abcdef 100644
@@ -95,7 +95,7 @@ void amd_sfh_work(struct work_struct *work)
 						    cli_data->feature_report[current_index]);
 		if (report_size)
 			hid_input_report(cli_data->hid_sensor_hubs[current_index],
-					 cli_data->report_type[current_index],
+					 node_type,
 					 cli_data->feature_report[current_index], report_size, 0);
 		else
 			pr_err("AMDSFH: Invalid report size\n");
@@ -104,7 +104,7 @@ void amd_sfh_work(struct work_struct *work)
 		report_size = mp2_ops->get_in_rep(current_index, sensor_index, report_id, in_data);
 		if (report_size)
 			hid_input_report(cli_data->hid_sensor_hubs[current_index],
-					 cli_data->report_type[current_index],
+					 node_type,
 					 in_data->input_report[current_index], report_size, 0);
 		else
 			pr_err("AMDSFH: Invalid report size\n");
Signature · 1 line
2.48.1
#2 lore raw

PATCH 3/4 HID: amd_sfh: Enable interrupts by default for Renoir hardware

In reply to WhiteDoor6767

From: Gururaj Naik <[email protected]>

Renoir MP2 firmware requires interrupts enabled to signal command completion and sensor status. When intr_disable is set to true, commands sent to the firmware time out with wait_response errors.

Default intr_disable to false matching Bugzilla #218104.

---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +1 -1
index 1234567..89abcdef 100644
@@ -23,7 +23,7 @@
 
-static bool intr_disable = true;
+static bool intr_disable = false;
 module_param(intr_disable, bool, 0644);
 MODULE_PARM_DESC(intr_disable, "disable interrupt");
Signature · 1 line
2.48.1
#3 lore raw

PATCH 4/4 HID: amd_sfh: Add DMI quirk for Dell Inspiron 7405 2-in-1

In reply to WhiteDoor6767

From: Gururaj Naik <[email protected]>

Add DMI matching for Dell Inspiron 7405 2n1 convertible laptop to ensure the MP2 sensor fusion hub is properly detected and initialized.

---
 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
index 1234567..89abcdef 100644
@@ -48,6 +48,13 @@ static const struct dmi_system_id dmi_nodev_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY x360 Convertible 15-ee0xxx"),
 		},
 	},
+	{
+		.ident = "Dell Inspiron 7405 2n1",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7405 2n1"),
+		},
+	},
 	{ }
 };
Signature · 1 line
2.48.1