qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Klaus Birkelund <klaus@birkelund.eu>
To: "Heitke, Kenneth" <kenneth.heitke@intel.com>
Cc: keith.busch@intel.com, kwolf@redhat.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: Fri, 17 May 2019 07:35:04 +0200	[thread overview]
Message-ID: <20190517053504.GA17341@apples.localdomain> (raw)
In-Reply-To: <1f607df5-b523-e517-c439-392725fd441b@intel.com>

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.


  reply	other threads:[~2019-05-17  5:36 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 [this message]
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
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=20190517053504.GA17341@apples.localdomain \
    --to=klaus@birkelund.eu \
    --cc=keith.busch@intel.com \
    --cc=kenneth.heitke@intel.com \
    --cc=kwolf@redhat.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).