* Re: question about block layer and dma alignment issue. [not found] ` <543027BD.5090009@kernel.dk> @ 2014-10-07 9:37 ` Oleksij Rempel 2014-10-07 15:25 ` Jens Axboe 0 siblings, 1 reply; 4+ messages in thread From: Oleksij Rempel @ 2014-10-07 9:37 UTC (permalink / raw) To: Jens Axboe, ulf.hansson@linaro.org >> Ulf Hansson, linux-mmc@vger.kernel.org >> linux-mmc [-- Attachment #1: Type: text/plain, Size: 1806 bytes --] Am 04.10.2014 um 19:00 schrieb Jens Axboe: > On 2014-10-04 00:59, Oleksij Rempel wrote: >> Hello Jens, >> >> i hope it is OK to ask you directly, i didn't found better way to do >> this. >> I'm writing MMC driver based on reverse engineering for au6601 mmc >> controller. This driver uses MMC API, and last one trying to use BLK API >> as directly as possible. So far so gut, but i have a problem by using SG >> requests with DMA without conversation. This controller accepts only >> addresses with this mask 0xffff.f000 - also page aligned. >> Till now i tried different QUEUE_FLAG_ flags and blk_queue settings, but >> i never had absolute aligned quarantine. >> Please tell me if i do some thing wrong or go in the wrong direction. > > Unless you can accept a 4kb hardware block size (and I'm assuming you > cannot, since you need to support 512b file systems?), then you'd have > to bounce the requests that don't align properly. You can fix some of > them by setting blk_queue_dma_alignment(q, 4095). I needed to include MMC list with Ulf Hansson at the beginning, so here we are. Hi Ulf, here is the list of drivers which do care about dma alignment . Some of them use bounce_buffer, some will use PIO instead of DMA, for not aligned requests: dw_mmc.c: dw_mci_pre_dma_transfer wbsd.c usdhi6rol0.c tmio_mmc_dma.c sunxi-mmc.c sdhci.c pxamci.c mvsdio.c au6601.c(not upstream jet) The problem of all this driver is that each of them use own solution. I think this code can be moved to some common place. For example, it can be done in drivers/mmc/card/queue.c and enabled by mmc_host_dma_alignment variable. Or provide a mmc_sg_align() function, which should be called explicatively by driver. Which option is preferable? -- Regards, Oleksij [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 213 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: question about block layer and dma alignment issue. 2014-10-07 9:37 ` question about block layer and dma alignment issue Oleksij Rempel @ 2014-10-07 15:25 ` Jens Axboe 2014-10-08 6:50 ` Oleksij Rempel 0 siblings, 1 reply; 4+ messages in thread From: Jens Axboe @ 2014-10-07 15:25 UTC (permalink / raw) To: Oleksij Rempel, ulf.hansson@linaro.org >> Ulf Hansson, linux-mmc@vger.kernel.org >> linux-mmc On 10/07/2014 03:37 AM, Oleksij Rempel wrote: > Am 04.10.2014 um 19:00 schrieb Jens Axboe: >> On 2014-10-04 00:59, Oleksij Rempel wrote: >>> Hello Jens, >>> >>> i hope it is OK to ask you directly, i didn't found better way to do >>> this. >>> I'm writing MMC driver based on reverse engineering for au6601 mmc >>> controller. This driver uses MMC API, and last one trying to use BLK API >>> as directly as possible. So far so gut, but i have a problem by using SG >>> requests with DMA without conversation. This controller accepts only >>> addresses with this mask 0xffff.f000 - also page aligned. >>> Till now i tried different QUEUE_FLAG_ flags and blk_queue settings, but >>> i never had absolute aligned quarantine. >>> Please tell me if i do some thing wrong or go in the wrong direction. >> >> Unless you can accept a 4kb hardware block size (and I'm assuming you >> cannot, since you need to support 512b file systems?), then you'd have >> to bounce the requests that don't align properly. You can fix some of >> them by setting blk_queue_dma_alignment(q, 4095). > > I needed to include MMC list with Ulf Hansson at the beginning, so here > we are. > > Hi Ulf, > > here is the list of drivers which do care about dma alignment . Some of > them use bounce_buffer, some will use PIO instead of DMA, for not > aligned requests: > > dw_mmc.c: dw_mci_pre_dma_transfer > wbsd.c > usdhi6rol0.c > tmio_mmc_dma.c > sunxi-mmc.c > sdhci.c > pxamci.c > mvsdio.c > au6601.c(not upstream jet) > > The problem of all this driver is that each of them use own solution. I > think this code can be moved to some common place. For example, it can > be done in drivers/mmc/card/queue.c and enabled by > mmc_host_dma_alignment variable. Or provide a mmc_sg_align() function, > which should be called explicatively by driver. > > Which option is preferable? I would roll a block version that they all can use, you can look at block/bounce.c for inspiration. That file deals with bouncing higher pages to lower memory, so it's not exactly what you want. But the metod of allocating a new bio that meets criteria and copying data over, that is the same that you need. -- Jens Axboe ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: question about block layer and dma alignment issue. 2014-10-07 15:25 ` Jens Axboe @ 2014-10-08 6:50 ` Oleksij Rempel 2014-10-16 14:31 ` Adrian Hunter 0 siblings, 1 reply; 4+ messages in thread From: Oleksij Rempel @ 2014-10-08 6:50 UTC (permalink / raw) To: Jens Axboe, ulf.hansson@linaro.org >> Ulf Hansson, linux-mmc@vger.kernel.org >> linux-mmc [-- Attachment #1: Type: text/plain, Size: 2432 bytes --] Am 07.10.2014 um 17:25 schrieb Jens Axboe: > On 10/07/2014 03:37 AM, Oleksij Rempel wrote: >> Am 04.10.2014 um 19:00 schrieb Jens Axboe: >>> On 2014-10-04 00:59, Oleksij Rempel wrote: >>>> Hello Jens, >>>> >>>> i hope it is OK to ask you directly, i didn't found better way to do >>>> this. >>>> I'm writing MMC driver based on reverse engineering for au6601 mmc >>>> controller. This driver uses MMC API, and last one trying to use BLK API >>>> as directly as possible. So far so gut, but i have a problem by using SG >>>> requests with DMA without conversation. This controller accepts only >>>> addresses with this mask 0xffff.f000 - also page aligned. >>>> Till now i tried different QUEUE_FLAG_ flags and blk_queue settings, but >>>> i never had absolute aligned quarantine. >>>> Please tell me if i do some thing wrong or go in the wrong direction. >>> >>> Unless you can accept a 4kb hardware block size (and I'm assuming you >>> cannot, since you need to support 512b file systems?), then you'd have >>> to bounce the requests that don't align properly. You can fix some of >>> them by setting blk_queue_dma_alignment(q, 4095). >> >> I needed to include MMC list with Ulf Hansson at the beginning, so here >> we are. >> >> Hi Ulf, >> >> here is the list of drivers which do care about dma alignment . Some of >> them use bounce_buffer, some will use PIO instead of DMA, for not >> aligned requests: >> >> dw_mmc.c: dw_mci_pre_dma_transfer >> wbsd.c >> usdhi6rol0.c >> tmio_mmc_dma.c >> sunxi-mmc.c >> sdhci.c >> pxamci.c >> mvsdio.c >> au6601.c(not upstream jet) >> >> The problem of all this driver is that each of them use own solution. I >> think this code can be moved to some common place. For example, it can >> be done in drivers/mmc/card/queue.c and enabled by >> mmc_host_dma_alignment variable. Or provide a mmc_sg_align() function, >> which should be called explicatively by driver. >> >> Which option is preferable? > > I would roll a block version that they all can use, you can look at > block/bounce.c for inspiration. That file deals with bouncing higher > pages to lower memory, so it's not exactly what you want. But the metod > of allocating a new bio that meets criteria and copying data over, that > is the same that you need. Ok, i will need to setup testing board for this kind of work. It will take some time. -- Regards, Oleksij [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 213 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: question about block layer and dma alignment issue. 2014-10-08 6:50 ` Oleksij Rempel @ 2014-10-16 14:31 ` Adrian Hunter 0 siblings, 0 replies; 4+ messages in thread From: Adrian Hunter @ 2014-10-16 14:31 UTC (permalink / raw) To: Oleksij Rempel, Jens Axboe, ulf.hansson@linaro.org >> Ulf Hansson, linux-mmc@vger.kernel.org >> linux-mmc On 8/10/2014 9:50 a.m., Oleksij Rempel wrote: > Am 07.10.2014 um 17:25 schrieb Jens Axboe: >> On 10/07/2014 03:37 AM, Oleksij Rempel wrote: >>> Am 04.10.2014 um 19:00 schrieb Jens Axboe: >>>> On 2014-10-04 00:59, Oleksij Rempel wrote: >>>>> Hello Jens, >>>>> >>>>> i hope it is OK to ask you directly, i didn't found better way to do >>>>> this. >>>>> I'm writing MMC driver based on reverse engineering for au6601 mmc >>>>> controller. This driver uses MMC API, and last one trying to use BLK API >>>>> as directly as possible. So far so gut, but i have a problem by using SG >>>>> requests with DMA without conversation. This controller accepts only >>>>> addresses with this mask 0xffff.f000 - also page aligned. >>>>> Till now i tried different QUEUE_FLAG_ flags and blk_queue settings, but >>>>> i never had absolute aligned quarantine. >>>>> Please tell me if i do some thing wrong or go in the wrong direction. >>>> Unless you can accept a 4kb hardware block size (and I'm assuming you >>>> cannot, since you need to support 512b file systems?), then you'd have >>>> to bounce the requests that don't align properly. You can fix some of >>>> them by setting blk_queue_dma_alignment(q, 4095). >>> I needed to include MMC list with Ulf Hansson at the beginning, so here >>> we are. >>> >>> Hi Ulf, >>> >>> here is the list of drivers which do care about dma alignment . Some of >>> them use bounce_buffer, some will use PIO instead of DMA, for not >>> aligned requests: >>> >>> dw_mmc.c: dw_mci_pre_dma_transfer >>> wbsd.c >>> usdhi6rol0.c >>> tmio_mmc_dma.c >>> sunxi-mmc.c >>> sdhci.c >>> pxamci.c >>> mvsdio.c >>> au6601.c(not upstream jet) >>> >>> The problem of all this driver is that each of them use own solution. I >>> think this code can be moved to some common place. For example, it can >>> be done in drivers/mmc/card/queue.c and enabled by >>> mmc_host_dma_alignment variable. Or provide a mmc_sg_align() function, >>> which should be called explicatively by driver. >>> >>> Which option is preferable? >> I would roll a block version that they all can use, you can look at >> block/bounce.c for inspiration. That file deals with bouncing higher >> pages to lower memory, so it's not exactly what you want. But the metod >> of allocating a new bio that meets criteria and copying data over, that >> is the same that you need. Not all cards are block devices e.g. SDIO wifi. And there is also mmc_test. > Ok, > > i will need to setup testing board for this kind of work. It will take > some time. > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-16 14:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <542F9AD9.7020104@rempel-privat.de>
[not found] ` <543027BD.5090009@kernel.dk>
2014-10-07 9:37 ` question about block layer and dma alignment issue Oleksij Rempel
2014-10-07 15:25 ` Jens Axboe
2014-10-08 6:50 ` Oleksij Rempel
2014-10-16 14:31 ` Adrian Hunter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox