diff options
author | Philip J Kelleher <pjk1939@linux.vnet.ibm.com> | 2013-09-27 20:42:50 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-11-08 09:10:28 -0700 |
commit | 0317cd6de852a70e0374e7eb40a013072274386f (patch) | |
tree | 3d5fd9d4508b5308f72c6784e6efe2afb56584ef /drivers/block/rsxx/dma.c | |
parent | c8afd0dcbd14e2352258f2e2d359b36d0edd459f (diff) |
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: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rsxx/dma.c')
-rw-r--r-- | drivers/block/rsxx/dma.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index 34fd1018c8e..4103601ae67 100644 --- a/drivers/block/rsxx/dma.c +++ b/drivers/block/rsxx/dma.c @@ -434,26 +434,29 @@ static void rsxx_issue_dmas(struct rsxx_dma_ctrl *ctrl) continue; } - if (dma->cmd == HW_CMD_BLK_WRITE) - dir = PCI_DMA_TODEVICE; - 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 - * at one time per DMA channel. So the maximum amount of mapped - * memory would be 255 * 4 channels * 4096 Bytes which is less - * than 2GB, the limit of a x8 Non-HWWD PCIe slot. This way the - * pci_map_page function should never fail because of a - * lack of mappable memory. - */ - dma->dma_addr = pci_map_page(ctrl->card->dev, dma->page, - dma->pg_off, dma->sub_page.cnt << 9, dir); - if (pci_dma_mapping_error(ctrl->card->dev, dma->dma_addr)) { - push_tracker(ctrl->trackers, tag); - rsxx_complete_dma(ctrl, dma, DMA_CANCELLED); - continue; + if (dma->cmd != HW_CMD_BLK_DISCARD) { + if (dma->cmd == HW_CMD_BLK_WRITE) + dir = PCI_DMA_TODEVICE; + 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 at one time per DMA channel. So the maximum + * amount of mapped memory would be 255 * 4 channels * + * 4096 Bytes which is less than 2GB, the limit of a x8 + * Non-HWWD PCIe slot. This way the pci_map_page + * function should never fail because of a lack of + * mappable memory. + */ + dma->dma_addr = pci_map_page(ctrl->card->dev, dma->page, + dma->pg_off, dma->sub_page.cnt << 9, dir); + if (pci_dma_mapping_error(ctrl->card->dev, dma->dma_addr)) { + push_tracker(ctrl->trackers, tag); + rsxx_complete_dma(ctrl, dma, DMA_CANCELLED); + continue; + } } set_tracker_dma(ctrl->trackers, tag, dma); |