Commit 0317cd6d authored by Philip J Kelleher's avatar Philip J Kelleher Committed by Jens Axboe

rsxx: Kernel Panic caused by mapping Discards

This fixes a kernel panic injected by commit id
8d26750143341831bc312f61c5ed141eeb75b8d0 where discards
are getting mapped through the pci_map_page function call.

The driver will now start verifying that a dma is not a
discard before issuing a the pci_map_page function call.

Also, we are updating the driver version.
Signed-off-by: default avatarPhilip J Kelleher <pjk1939@linux.vnet.ibm.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c8afd0dc
...@@ -434,26 +434,29 @@ static void rsxx_issue_dmas(struct rsxx_dma_ctrl *ctrl) ...@@ -434,26 +434,29 @@ static void rsxx_issue_dmas(struct rsxx_dma_ctrl *ctrl)
continue; continue;
} }
if (dma->cmd == HW_CMD_BLK_WRITE) if (dma->cmd != HW_CMD_BLK_DISCARD) {
dir = PCI_DMA_TODEVICE; if (dma->cmd == HW_CMD_BLK_WRITE)
else dir = PCI_DMA_TODEVICE;
dir = PCI_DMA_FROMDEVICE; else
dir = PCI_DMA_FROMDEVICE;
/*
* The function pci_map_page is placed here because we can /*
* only, by design, issue up to 255 commands to the hardware * The function pci_map_page is placed here because we
* at one time per DMA channel. So the maximum amount of mapped * can only, by design, issue up to 255 commands to the
* memory would be 255 * 4 channels * 4096 Bytes which is less * hardware at one time per DMA channel. So the maximum
* than 2GB, the limit of a x8 Non-HWWD PCIe slot. This way the * amount of mapped memory would be 255 * 4 channels *
* pci_map_page function should never fail because of a * 4096 Bytes which is less than 2GB, the limit of a x8
* lack of mappable memory. * Non-HWWD PCIe slot. This way the pci_map_page
*/ * function should never fail because of a lack of
dma->dma_addr = pci_map_page(ctrl->card->dev, dma->page, * mappable memory.
dma->pg_off, dma->sub_page.cnt << 9, dir); */
if (pci_dma_mapping_error(ctrl->card->dev, dma->dma_addr)) { dma->dma_addr = pci_map_page(ctrl->card->dev, dma->page,
push_tracker(ctrl->trackers, tag); dma->pg_off, dma->sub_page.cnt << 9, dir);
rsxx_complete_dma(ctrl, dma, DMA_CANCELLED); if (pci_dma_mapping_error(ctrl->card->dev, dma->dma_addr)) {
continue; push_tracker(ctrl->trackers, tag);
rsxx_complete_dma(ctrl, dma, DMA_CANCELLED);
continue;
}
} }
set_tracker_dma(ctrl->trackers, tag, dma); set_tracker_dma(ctrl->trackers, tag, dma);
......
...@@ -52,7 +52,7 @@ struct proc_cmd; ...@@ -52,7 +52,7 @@ struct proc_cmd;
#define RS70_PCI_REV_SUPPORTED 4 #define RS70_PCI_REV_SUPPORTED 4
#define DRIVER_NAME "rsxx" #define DRIVER_NAME "rsxx"
#define DRIVER_VERSION "4.0" #define DRIVER_VERSION "4.0.1.2498"
/* Block size is 4096 */ /* Block size is 4096 */
#define RSXX_HW_BLK_SHIFT 12 #define RSXX_HW_BLK_SHIFT 12
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment