While preparing to investigate
https://bugzilla.kernel.org/show_bug.cgi?id=212615, I read through the amd_sfh
driver and saw two (unrelated) bugs in the logic that sets the DMA mask.
Ultimately these are harmless, but they should probably get fixed.
FYI, this is my first time submitting a kernel patch. If I've done something
wrong in formatting this email, it is likely due to incompetence rather than
malice.
Dylan MacKenzie (2):
HID: amd_sfh: Set correct DMA mask
HID: amd_sfh: Continue if fallback DMA mask is accepted
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--
2.31.1
The AMDSFH driver uses coherent DMA allocations, but only sets the
streaming DMA mask. As a result, the kernel can't make use of the full
address space supported by the device.
Signed-off-by: Dylan MacKenzie <redacted>
---
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Currently, if a call to `set_dma_mask(DMA_BIT_MASK(64))` fails, the
driver calls `set_dma_mask(DMA_BIT_MASK(32))` and immediately returns
regardless of the result. If that second call were to succeed, the SFH
would not get initialized (defeating the whole purpose of falling back
to a 32-bit address space) but the driver would remain registered
(since `probe` returned 0).
Signed-off-by: Dylan MacKenzie <redacted>
---
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
While preparing to investigate
https://bugzilla.kernel.org/show_bug.cgi?id=212615, I read through the amd_sfh
driver and saw two (unrelated) bugs in the logic that sets the DMA mask.
Ultimately these are harmless, but they should probably get fixed.
FYI, this is my first time submitting a kernel patch. If I've done something
wrong in formatting this email, it is likely due to incompetence rather than
malice.
Dylan MacKenzie (2):
HID: amd_sfh: Set correct DMA mask
HID: amd_sfh: Continue if fallback DMA mask is accepted
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Nehal, Sandeep, could you please provide your Ack to this series? Thanks,
--
Jiri Kosina
SUSE Labs
While preparing to investigate
https://bugzilla.kernel.org/show_bug.cgi?id=212615, I read through the amd_sfh
driver and saw two (unrelated) bugs in the logic that sets the DMA mask.
Ultimately these are harmless, but they should probably get fixed.
FYI, this is my first time submitting a kernel patch. If I've done something
wrong in formatting this email, it is likely due to incompetence rather than
malice.
Dylan MacKenzie (2):
HID: amd_sfh: Set correct DMA mask
HID: amd_sfh: Continue if fallback DMA mask is accepted
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Nehal, Sandeep, could you please provide your Ack to this series? Thanks,
--
Jiri Kosina
SUSE Labs
Nehal, Sandeep, could you please provide your Ack to this series? Thanks,
I think, you can merge both of them together as it addresses a single problem.
can you please respin a v2 with the changes something like this?
privdata->mmio = pcim_iomap_table(pdev)[2];
pci_set_master(pdev);
- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+
+ rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
if (rc) {
- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
- return rc;
+ rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ if (rc) {
+ pci_err(pdev, "Failed to set DMA mask");
+ return rc;
}
}
Thanks,
Basavaraj