qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Klaus Jensen <its@irrelevant.dk>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
	Damien Le Moal <Damien.LeMoal@wdc.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
	Niklas Cassel <Niklas.Cassel@wdc.com>,
	Dmitry Fomichev <Dmitry.Fomichev@wdc.com>,
	Klaus Jensen <k.jensen@samsung.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Maxim Levitsky <mlevitsk@redhat.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	Keith Busch <kbusch@kernel.org>,
	Matias Bjorling <Matias.Bjorling@wdc.com>
Subject: Re: [PATCH v8 07/11] hw/block/nvme: Support Zoned Namespace Command Set
Date: Wed, 4 Nov 2020 08:21:45 +0100	[thread overview]
Message-ID: <20201104072145.GA166505@apples.localdomain> (raw)
In-Reply-To: <b8d2a80b-4f7f-56eb-39dd-1e40f73c5a9b@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1605 bytes --]

On Nov  3 21:37, Philippe Mathieu-Daudé wrote:
> On 11/3/20 8:48 PM, Dmitry Fomichev wrote:
> >> -----Original Message-----
> >> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> ...
> >>>  typedef struct QEMU_PACKED NvmeCqe {
> >>> -    uint32_t    result;
> >>> -    uint32_t    rsvd;
> >>> +    union {
> >>> +        uint64_t     result64;
> >>> +        uint32_t     result32;
> >>> +    };
> >>
> >> When using packed structure you want to define all fields to
> >> avoid alignment confusion (and I'm surprised the compiler doesn't
> >> complain...). So this would be:
> >>
> >>        union {
> >>            uint64_t     result64;
> >>            struct {
> >>                uint32_t    result32;
> >>                uint32_t    rsvd32;
> >>            };
> >>        };
> >>

I align (hehe...) towards this. The amount of bit-juggling we need for
commands justify the need for separate NvmeCmd's, but in this case I
think an NvmeCqeZA is just unnecessary clutter. If the result value is
complex, the approach used by AERs is better I think:

   typedef struct QEMU_PACKED NvmeAerResult {
       uint8_t event_type;
       uint8_t event_info;
       uint8_t log_page;
       uint8_t resv;
   } NvmeAerResult;

   NvmeAerResult *result = (NvmeAerResult *)&req->cqe.result32;

Since storing the Zone Append ALBA in the result64 isn't really a
complex operation, let's just assign it into that member directly.

(Addendum) That DW1 is command specific and no longer reserved is
defined by TP 4056 (Namespace Types) - not v1.4 or any of its revisions.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-11-04  7:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  2:32 [PATCH v8 00/11] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 01/11] hw/block/nvme: Add Commands Supported and Effects log Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 02/11] hw/block/nvme: Generate namespace UUIDs Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 03/11] hw/block/nvme: Separate read and write handlers Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 04/11] hw/block/nvme: Merge nvme_write_zeroes() with nvme_write() Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 05/11] hw/block/nvme: Add support for Namespace Types Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 06/11] hw/block/nvme: Support allocated CNS command variants Dmitry Fomichev
2020-11-04  7:48   ` Klaus Jensen
2020-10-30  2:32 ` [PATCH v8 07/11] hw/block/nvme: Support Zoned Namespace Command Set Dmitry Fomichev
2020-10-30  7:15   ` Philippe Mathieu-Daudé
2020-11-03 19:48     ` Dmitry Fomichev
2020-11-03 20:37       ` Philippe Mathieu-Daudé
2020-11-04  7:21         ` Klaus Jensen [this message]
2020-10-30 17:18   ` Niklas Cassel
2020-10-30  2:32 ` [PATCH v8 08/11] hw/block/nvme: Introduce max active and open zone limits Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 09/11] hw/block/nvme: Support Zone Descriptor Extensions Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 10/11] hw/block/nvme: Add injection of Offline/Read-Only zones Dmitry Fomichev
2020-10-30  2:32 ` [PATCH v8 11/11] hw/block/nvme: Document zoned parameters in usage text Dmitry Fomichev

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=20201104072145.GA166505@apples.localdomain \
    --to=its@irrelevant.dk \
    --cc=Alistair.Francis@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=Dmitry.Fomichev@wdc.com \
    --cc=Matias.Bjorling@wdc.com \
    --cc=Niklas.Cassel@wdc.com \
    --cc=fam@euphon.net \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=philmd@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).