MMC host:

- renesas_sdhi: fix kernel panic
  - tmio: fix swiotlb buffer is full
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZ9vhhAAoJEP4mhCVzWIwp9zAQAKeBpohfcBWTHMlZDX5mOBQW
 kyYIkWwszFyEHO74akBDZ8twsYIt1NDttRc95pXz/kEEfe5AOn0e5TBt/GCsYToy
 eVn9joQS0SCmwzTuSi44faJmLkHGAD76Ssrh06x6hM3JGR8kT4s25wODrW/Xl81Q
 JHNk4mkdLxXBYuahlftoW0U/d+ZAHmqlvf4jzUsOZtFZ9dyjEEUi3aKINbUOKlDf
 cdBT/Rg4ozGqS7seI650r2EDx/VkvfjnBn/QqAZu84WLGa6gseU/A+tTJGFdA83W
 GhabNmrid98/O+AAgBLlXBFc94mAwjUTUtgKmLOjLAsvCaDv0i1StL5Umdv1nuVo
 r2RSnM6qYzhXiD+mU/erQUSNPhFJRhoJ7yu+CsLlnGKeBcbQX+p/nkZPx29vTlcl
 t3LIbxUQJrWBNldqmDoe8QOzPfhxmFVh3LyfcQ1V/f3CFPXY4SgAwd5Nr+E0vLON
 Jp/PLtvIEVNjkO04KgExKHM2m5haZW1roX/3ZDUvifRtZ0UuUoO8/EB/v+K4cXCP
 mtMN+9n6BtDMAfqlPlsi4EjqrQmdK732erjSTLdSpKCTVIj/cNp8+LCJWUfj/xzX
 tfj+zalVe0tvBBwTZO0lE2C5MEWUG9JpPf7ntn6ZyrN1Wxv6mSrWsBiP3gtAgSka
 mn75GI9U+iIJKfIr7XYT
 =/InS
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v4.14-rc4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
 "A couple of MMC host fixes intended for v4.14-rc8:

   - renesas_sdhi: fix kernel panic
   - tmio: fix swiotlb buffer is full"

* tag 'mmc-v4.14-rc4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: renesas_sdhi: fix kernel panic in _internal_dmac.c
  mmc: tmio: fix swiotlb buffer is full
This commit is contained in:
Linus Torvalds 2017-10-30 09:41:54 -07:00
commit daea3daaf9
2 changed files with 23 additions and 7 deletions

View file

@ -146,11 +146,8 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
WARN_ON(host->sg_len > 1);
/* This DMAC cannot handle if buffer is not 8-bytes alignment */
if (!IS_ALIGNED(sg->offset, 8)) {
host->force_pio = true;
renesas_sdhi_internal_dmac_enable_dma(host, false);
return;
}
if (!IS_ALIGNED(sg->offset, 8))
goto force_pio;
if (data->flags & MMC_DATA_READ) {
dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
@ -163,8 +160,8 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
}
ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, dir);
if (ret < 0)
return;
if (ret == 0)
goto force_pio;
renesas_sdhi_internal_dmac_enable_dma(host, true);
@ -176,6 +173,12 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
dtran_mode);
renesas_sdhi_internal_dmac_dm_write(host, DM_DTRAN_ADDR,
sg->dma_address);
return;
force_pio:
host->force_pio = true;
renesas_sdhi_internal_dmac_enable_dma(host, false);
}
static void renesas_sdhi_internal_dmac_issue_tasklet_fn(unsigned long arg)

View file

@ -47,6 +47,7 @@
#include <linux/mmc/sdio.h>
#include <linux/scatterlist.h>
#include <linux/spinlock.h>
#include <linux/swiotlb.h>
#include <linux/workqueue.h>
#include "tmio_mmc.h"
@ -1215,6 +1216,18 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
mmc->max_blk_count = pdata->max_blk_count ? :
(PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs;
mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
/*
* Since swiotlb has memory size limitation, this will calculate
* the maximum size locally (because we don't have any APIs for it now)
* and check the current max_req_size. And then, this will update
* the max_req_size if needed as a workaround.
*/
if (swiotlb_max_segment()) {
unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
if (mmc->max_req_size > max_size)
mmc->max_req_size = max_size;
}
mmc->max_seg_size = mmc->max_req_size;
_host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||