scsi: aacraid: Fix DMAR issues with iommu=pt
The driver changed the DMA consistent map after consistent memory was allocated, this invalidated the IOMMU identity mapping. The fix was to make sure that we set the DMA consistent mask setting once depending on the controller card. Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> Reviewed-by: Dave Carroll <david.carroll@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
c831a4a086
commit
8105d39d0e
|
@ -2071,20 +2071,15 @@ int aac_get_adapter_info(struct aac_dev* dev)
|
||||||
expose_physicals = 0;
|
expose_physicals = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dev->dac_support != 0) {
|
if (dev->dac_support) {
|
||||||
if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(64)) &&
|
if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(64))) {
|
||||||
!pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(64))) {
|
|
||||||
if (!dev->in_reset)
|
if (!dev->in_reset)
|
||||||
printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n",
|
dev_info(&dev->pdev->dev, "64 Bit DAC enabled\n");
|
||||||
dev->name, dev->id);
|
} else if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(32))) {
|
||||||
} else if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(32)) &&
|
dev_info(&dev->pdev->dev, "DMA mask set failed, 64 Bit DAC disabled\n");
|
||||||
!pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(32))) {
|
|
||||||
printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n",
|
|
||||||
dev->name, dev->id);
|
|
||||||
dev->dac_support = 0;
|
dev->dac_support = 0;
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_WARNING"%s%d: No suitable DMA available.\n",
|
dev_info(&dev->pdev->dev, "No suitable DMA available\n");
|
||||||
dev->name, dev->id);
|
|
||||||
rcode = -ENOMEM;
|
rcode = -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1513,6 +1513,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
|
||||||
struct scsi_cmnd *command_list;
|
struct scsi_cmnd *command_list;
|
||||||
int jafo = 0;
|
int jafo = 0;
|
||||||
int bled;
|
int bled;
|
||||||
|
u64 dmamask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
|
@ -1580,21 +1581,27 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
|
||||||
aac_free_irq(aac);
|
aac_free_irq(aac);
|
||||||
kfree(aac->fsa_dev);
|
kfree(aac->fsa_dev);
|
||||||
aac->fsa_dev = NULL;
|
aac->fsa_dev = NULL;
|
||||||
|
|
||||||
|
dmamask = DMA_BIT_MASK(32);
|
||||||
quirks = aac_get_driver_ident(index)->quirks;
|
quirks = aac_get_driver_ident(index)->quirks;
|
||||||
if (quirks & AAC_QUIRK_31BIT) {
|
if (quirks & AAC_QUIRK_31BIT)
|
||||||
if (((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(31)))) ||
|
retval = pci_set_dma_mask(aac->pdev, dmamask);
|
||||||
((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_BIT_MASK(31)))))
|
else if (!(quirks & AAC_QUIRK_SRC))
|
||||||
goto out;
|
retval = pci_set_dma_mask(aac->pdev, dmamask);
|
||||||
} else {
|
else
|
||||||
if (((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(32)))) ||
|
retval = pci_set_consistent_dma_mask(aac->pdev, dmamask);
|
||||||
((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_BIT_MASK(32)))))
|
|
||||||
goto out;
|
if (quirks & AAC_QUIRK_31BIT && !retval) {
|
||||||
|
dmamask = DMA_BIT_MASK(31);
|
||||||
|
retval = pci_set_consistent_dma_mask(aac->pdev, dmamask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (retval)
|
||||||
|
goto out;
|
||||||
|
|
||||||
if ((retval = (*(aac_get_driver_ident(index)->init))(aac)))
|
if ((retval = (*(aac_get_driver_ident(index)->init))(aac)))
|
||||||
goto out;
|
goto out;
|
||||||
if (quirks & AAC_QUIRK_31BIT)
|
|
||||||
if ((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(32))))
|
|
||||||
goto out;
|
|
||||||
if (jafo) {
|
if (jafo) {
|
||||||
aac->thread = kthread_run(aac_command_thread, aac, "%s",
|
aac->thread = kthread_run(aac_command_thread, aac, "%s",
|
||||||
aac->name);
|
aac->name);
|
||||||
|
|
|
@ -1403,6 +1403,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
int error = -ENODEV;
|
int error = -ENODEV;
|
||||||
int unique_id = 0;
|
int unique_id = 0;
|
||||||
u64 dmamask;
|
u64 dmamask;
|
||||||
|
int mask_bits = 0;
|
||||||
extern int aac_sync_mode;
|
extern int aac_sync_mode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1426,18 +1427,32 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
goto out;
|
goto out;
|
||||||
error = -ENODEV;
|
error = -ENODEV;
|
||||||
|
|
||||||
|
if (!(aac_drivers[index].quirks & AAC_QUIRK_SRC)) {
|
||||||
|
error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||||
|
if (error) {
|
||||||
|
dev_err(&pdev->dev, "PCI 32 BIT dma mask set failed");
|
||||||
|
goto out_disable_pdev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the quirk31 bit is set, the adapter needs adapter
|
* If the quirk31 bit is set, the adapter needs adapter
|
||||||
* to driver communication memory to be allocated below 2gig
|
* to driver communication memory to be allocated below 2gig
|
||||||
*/
|
*/
|
||||||
if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
|
if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) {
|
||||||
dmamask = DMA_BIT_MASK(31);
|
dmamask = DMA_BIT_MASK(31);
|
||||||
else
|
mask_bits = 31;
|
||||||
|
} else {
|
||||||
dmamask = DMA_BIT_MASK(32);
|
dmamask = DMA_BIT_MASK(32);
|
||||||
|
mask_bits = 32;
|
||||||
|
}
|
||||||
|
|
||||||
if (pci_set_dma_mask(pdev, dmamask) ||
|
error = pci_set_consistent_dma_mask(pdev, dmamask);
|
||||||
pci_set_consistent_dma_mask(pdev, dmamask))
|
if (error) {
|
||||||
|
dev_err(&pdev->dev, "PCI %d B consistent dma mask set failed\n"
|
||||||
|
, mask_bits);
|
||||||
goto out_disable_pdev;
|
goto out_disable_pdev;
|
||||||
|
}
|
||||||
|
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
|
||||||
|
@ -1501,15 +1516,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
goto out_deinit;
|
goto out_deinit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If we had set a smaller DMA mask earlier, set it to 4gig
|
|
||||||
* now since the adapter can dma data to at least a 4gig
|
|
||||||
* address space.
|
|
||||||
*/
|
|
||||||
if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
|
|
||||||
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
|
|
||||||
goto out_deinit;
|
|
||||||
|
|
||||||
aac->maximum_num_channels = aac_drivers[index].channels;
|
aac->maximum_num_channels = aac_drivers[index].channels;
|
||||||
error = aac_get_adapter_info(aac);
|
error = aac_get_adapter_info(aac);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
|
|
Loading…
Reference in New Issue