From: Jens Axboe <axboe@kernel.dk>
To: Kieran Kunhya <kieran@kunhya.com>,
Andrew Morton <akpm@linux-foundation.org>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joe Perches <joe@perches.com>,
Mauro Carvalho Chehab <m.chehab@samsung.com>,
Antti Palosaari <crope@iki.fi>, Jingoo Han <jg1.han@samsung.com>,
Ramprasad Chinthekindi <rchinthekindi@stec-inc.com>,
Pekka Enberg <penberg@kernel.org>,
Minchan Kim <minchan@kernel.org>,
Fabian Frederick <fabf@skynet.be>,
Akhil Bhansali <abhansali@stec-inc.com>,
Jiri Kosina <jkosina@suse.cz>, Alan <gnomes@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3] block: Add support for Sony SxS cards
Date: Sat, 27 Sep 2014 20:31:03 -0600 [thread overview]
Message-ID: <542772E7.80902@kernel.dk> (raw)
In-Reply-To: <1411861415-16210-1-git-send-email-kieran@kunhya.com>
On 2014-09-27 17:43, Kieran Kunhya wrote:
> +static void sxs_memcpy_read(struct sxs_device *dev, unsigned long sector,
> + unsigned long nsect, char *buffer)
> +{
> + struct pci_dev *pdev = dev->pci_dev;
> + u32 status;
> + u32 data[4];
> + u16 *tmp;
> + u32 *tmp2;
> +
> + void *dma2;
> + dma_addr_t dma2_handle;
> + void *dma3;
> + dma_addr_t dma3_handle;
> +
> + sector >>= dev->sector_shift;
> + nsect >>= dev->sector_shift;
> +
> + /* Read */
> + dma2 = pci_alloc_consistent(pdev, 8192, &dma2_handle);
> + dma3 = pci_alloc_consistent(pdev, 8192, &dma3_handle);
> +
> + tmp = dma2;
> + tmp2 = dma3;
> + tmp2[0] = dma2_handle;
> + tmp2[2] = dma3_handle;
> +
> + dev_dbg_ratelimited(&pdev->dev, "CALL %lu %lu\n",
> + sector & 0xffffffff, nsect & 0xffffffff);
> +
> + reinit_completion(&dev->irq_response);
> + status = readl(dev->mmio+SXS_STATUS_REG);
> + data[0] = cpu_to_le32(0x00010028);
> + data[1] = cpu_to_le32(sector & 0xffffffff);
> + data[2] = 0x0;
> + data[3] = cpu_to_le32(nsect & 0xffffffff);
> + memcpy_toio(dev->mmio, data, sizeof(data));
> + writel(0xa0, dev->mmio+SXS_ENABLE_REG);
> + writel(0x80, dev->mmio+SXS_CONTROL_REG);
> +
> + if (!wait_for_completion_timeout(&dev->irq_response,
> + msecs_to_jiffies(5000))) {
> + dev_dbg(&pdev->dev, "No IRQ\n");
> + }
> +
> + reinit_completion(&dev->irq_response);
> + writel(dma3_handle, dev->mmio+SXS_MASTER_LINK_REG_L);
> + writel(0x0, dev->mmio+SXS_MASTER_LINK_REG_H);
> + writel(0x20, dev->mmio+SXS_CONTROL_REG);
> +
> + if (!wait_for_completion_timeout(&dev->irq_response,
> + msecs_to_jiffies(5000))) {
> + dev_dbg(&pdev->dev, "No IRQ\n");
> + }
> +
> + /* FIXME: Use DMA properly */
> + memcpy(buffer, dma2, dev->sector_size * nsect);
> +
> + dev_dbg_ratelimited(&pdev->dev, "boot-signature %x\n",
> + tmp[255]);
> +
> + writel(0, dev->mmio+SXS_ENABLE_REG);
> +
> + pci_free_consistent(pdev, 8192, dma3, dma3_handle);
> + pci_free_consistent(pdev, 8192, dma2, dma2_handle);
> +}
> +
> +static void sxs_request(struct request_queue *q, struct bio *bio)
> +{
> + struct bvec_iter iter;
> + struct bio_vec bvec;
> + char *buffer;
> + unsigned long flags;
> + struct sxs_device *dev = q->queuedata;
> + struct pci_dev *pdev = dev->pci_dev;
> + sector_t sector = bio->bi_iter.bi_sector;
> +
> + bio_for_each_segment(bvec, bio, iter) {
> + dev_dbg_ratelimited(&pdev->dev, "REQUEST %i %i %i\n",
> + bio_cur_bytes(bio), bio->bi_vcnt,
> + bvec.bv_len);
> + buffer = bvec_kmap_irq(&bvec, &flags);
> + sxs_memcpy_read(dev, sector, bio_cur_bytes(bio) >> 9,
> + buffer);
> + sector += bio_cur_bytes(bio) >> 9;
> + bvec_kunmap_irq(buffer, &flags);
> + }
> +
> + bio_endio(bio, 0);
So a few questions here... This device only does reads? And it seems to
be assuming that only reads end up in the request handler? How so?
Second question. IO never fails? There's no status checking and IO is
always ended successfully. This too seems odd.
Third, this wong work as-is, at least not of HIGHMEM is used. After the
bvec_kmap_irq(), irqs will be disabled. But your sxs_memcpy_read()
invokes schedule through the completion waits, that will instantly go bad.
--
Jens Axboe
next prev parent reply other threads:[~2014-09-28 2:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 9:53 [PATCH] Add support for Sony SxS cards Kieran Kunhya
2014-07-07 9:53 ` [PATCH] block: Add support for Sony SxS cards Signed-off-by: Kieran Kunhya <kieran@kunhya.com> Kieran Kunhya
2014-07-07 14:41 ` Randy Dunlap
2014-07-20 0:01 ` [PATCHv2] block: Add support for Sony SxS cards Kieran Kunhya
2014-09-27 23:43 ` [PATCHv3] " Kieran Kunhya
2014-09-28 2:31 ` Jens Axboe [this message]
[not found] ` <1411915159.78518.YahooMailNeo@web161504.mail.bf1.yahoo.com>
2014-09-28 16:35 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=542772E7.80902@kernel.dk \
--to=axboe@kernel.dk \
--cc=abhansali@stec-inc.com \
--cc=akpm@linux-foundation.org \
--cc=crope@iki.fi \
--cc=davem@davemloft.net \
--cc=fabf@skynet.be \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jg1.han@samsung.com \
--cc=jkosina@suse.cz \
--cc=joe@perches.com \
--cc=kieran@kunhya.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=minchan@kernel.org \
--cc=penberg@kernel.org \
--cc=rchinthekindi@stec-inc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox