Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ahci: Check and set 64-bit DMA mask for platform AHCI driver

The current platform AHCI driver does not set the dma_mask correctly
for 64-bit DMA capable AHCI controller. This patch checks the AHCI
capability bit and set the dma_mask and coherent_dma_mask accordingly.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Suman Tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Suravee Suthikulpanit and committed by
Tejun Heo
cc7a9e27 94463a9c

+13
+13
drivers/ata/libahci_platform.c
··· 364 364 ap->ops = &ata_dummy_port_ops; 365 365 } 366 366 367 + if (hpriv->cap & HOST_CAP_64) { 368 + rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); 369 + if (rc) { 370 + rc = dma_coerce_mask_and_coherent(dev, 371 + DMA_BIT_MASK(32)); 372 + if (rc) { 373 + dev_err(dev, "Failed to enable 64-bit DMA.\n"); 374 + return rc; 375 + } 376 + dev_warn(dev, "Enable 32-bit DMA instead of 64-bit.\n"); 377 + } 378 + } 379 + 367 380 rc = ahci_reset_controller(host); 368 381 if (rc) 369 382 return rc;