From: Kevin Wolf <kwolf@redhat.com>
To: "Heitke, Kenneth" <kenneth.heitke@intel.com>
Cc: keith.busch@intel.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] nvme: add Get/Set Feature Timestamp support
Date: Mon, 20 May 2019 11:49:41 +0200 [thread overview]
Message-ID: <20190520094941.GB5699@localhost.localdomain> (raw)
In-Reply-To: <78248b8b-2684-409a-1e33-77b4c0907cd6@intel.com>
Am 18.05.2019 um 03:49 hat Heitke, Kenneth geschrieben:
>
>
> On 5/17/2019 12:24 AM, Klaus Birkelund wrote:
> > On Fri, May 17, 2019 at 07:35:04AM +0200, Klaus Birkelund wrote:
> > > Hi Kenneth,
> > >
> > > On Thu, May 16, 2019 at 05:24:47PM -0600, Heitke, Kenneth wrote:
> > > > Hi Klaus, thank you for you review. I have one comment inline
> > > >
> > > > On 5/14/2019 12:02 AM, Klaus Birkelund wrote:
> > > > > On Fri, Apr 05, 2019 at 03:41:17PM -0600, Kenneth Heitke wrote:
> > > > > > Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
> > > > > > ---
> > > > > > hw/block/nvme.c | 120 +++++++++++++++++++++++++++++++++++++++++-
> > > > > > hw/block/nvme.h | 3 ++
> > > > > > hw/block/trace-events | 2 +
> > > > > > include/block/nvme.h | 2 +
> > > > > > 4 files changed, 125 insertions(+), 2 deletions(-)
> > > > > >
> > > > > > diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> > > > > > index 7caf92532a..e775e89299 100644
> > > > > > --- a/hw/block/nvme.c
> > > > > > +++ b/hw/block/nvme.c
> > > > > > @@ -219,6 +219,30 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1,
> > > > > > return NVME_INVALID_FIELD | NVME_DNR;
> > > > > > }
> > > > > > +static uint16_t nvme_dma_write_prp(NvmeCtrl *n, uint8_t *ptr, uint32_t len,
> > > > > > + uint64_t prp1, uint64_t prp2)
> > > > > > +{
> > > > > > + QEMUSGList qsg;
> > > > > > + QEMUIOVector iov;
> > > > > > + uint16_t status = NVME_SUCCESS;
> > > > > > +
> > > > > > + if (nvme_map_prp(&qsg, &iov, prp1, prp2, len, n)) {
> > > > > > + return NVME_INVALID_FIELD | NVME_DNR;
> > > > > > + }
> > > > > > + if (qsg.nsg > 0) {
> > > > > > + if (dma_buf_write(ptr, len, &qsg)) {
> > > > > > + status = NVME_INVALID_FIELD | NVME_DNR;
> > > > > > + }
> > > > > > + qemu_sglist_destroy(&qsg);
> > > > > > + } else {
> > > > > > + if (qemu_iovec_from_buf(&iov, 0, ptr, len) != len) {
> > > > >
> > > > > This should be `qemu_iovec_to_buf`.
> > > > >
> > > >
> > > > This function is transferring data from the "host" to the device so I
> > > > believe I am using the correct function.
> > > >
> > >
> > > Exactly, but this means that you need to populate `ptr` with data
> > > described by the prps, hence dma_buf_*write* and qemu_iovec_*to*_buf. In
> > > this case `ptr` is set to the address of the uint64_t timestamp, and
> > > that is what we need to write to.
> > >
> >
> > I was going to argue with the fact that nvme_dma_read_prp uses
> > qemu_iovec_from_buf. But it uses _to_buf which as far as I can tell is
> > also wrong.
> >
>
> Okay, I'm onboard. You're correct. I'll update my patch and re-submit. I can
> also submit a patch to fix nvme_dma_read_prp() unless you or someone else
> wants to.
Maybe it would be time to extend tests/nvme-test.c a bit? So far it only
tests an error case, but it would be good to have tests for successful
use of the basic operations.
Kevin
next prev parent reply other threads:[~2019-05-20 9:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-05 21:41 [Qemu-devel] [PATCH] nvme: add Get/Set Feature Timestamp support Kenneth Heitke
2019-04-05 21:41 ` Kenneth Heitke
2019-04-09 13:19 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2019-04-09 13:19 ` Stefan Hajnoczi
2019-05-13 19:21 ` John Snow
2019-05-14 6:02 ` Klaus Birkelund
2019-05-16 23:24 ` Heitke, Kenneth
2019-05-17 5:35 ` Klaus Birkelund
2019-05-17 6:24 ` Klaus Birkelund
2019-05-17 17:08 ` Heitke, Kenneth
2019-05-18 1:49 ` Heitke, Kenneth
2019-05-18 7:30 ` Klaus Birkelund
2019-05-20 9:49 ` Kevin Wolf [this message]
2019-05-14 9:16 ` [Qemu-devel] " Philippe Mathieu-Daudé
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=20190520094941.GB5699@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=keith.busch@intel.com \
--cc=kenneth.heitke@intel.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).