Linux CXL
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Michael Tsirkin <mst@redhat.com>,
	Ben Widawsky <bwidawsk@kernel.org>, <qemu-devel@nongnu.org>,
	<linux-cxl@vger.kernel.org>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH v2 8/8] hw/cxl/events: Add in inject general media event
Date: Wed, 11 Jan 2023 14:05:10 +0000	[thread overview]
Message-ID: <20230111140510.00007963@Huawei.com> (raw)
In-Reply-To: <20230110153853.00000945@huawei.com>


> > > From an interface cleanliness point of view I'd rather see
> > > all the optional fields as optional.  That's done by marking them
> > > with a * so
> > > '*channel': 'int16'
> > > 
> > > Then the signature of the related qmp_cxl_inject_gen_media_event
> > > gains a boolean has_channel parameter (before channel)
> > > 
> > > Those booleans can be used to set the flags etc.    
> > 
> > Ah!  Ok cool.  Yes this would make a lot more sense.  I did not realize QMP did
> > this optional thing.  That makes scripting this easier as well!
> > 
> > Did you put all this on a branch or not?  I did not see anything new at:
> > 
> > https://gitlab.com/jic23/qemu.git
> > 
> > I can definitely respin but it sounds like you were going to make some changes.  
> 
> I got side tracked and reworked a few more things. Hopefully in have a branch
> up in a day or two.

Now pushed out as https://gitlab.com/jic23/qemu/-/tree/cxl-2023-01-11

My plan is to send the first 8 patches to Michael targetting upstream which includes
your uuid related patches from the start of this series.  The changes to RAS error
injection since previous tree are substantial to support multiple header logging.

I've made a few tweaks to your other patches on that branch including the optional
parameters stuff and some reworks I mentioned in this thread.

Note there is a dirty hack on top of that tree to deal with a build issue on my arch-linux
test box that I foolishly upgraded this morning.  Might break things on other distros
(version issue with curl).

Jonathan

> 
> Jonathan
> 
> > 
> > Ira
> >   
> > > 
> > > Very lightly tested: 
> > > 
> > > diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
> > > index 4660a44ef8..cb9bb0b166 100644
> > > --- a/hw/mem/cxl_type3.c
> > > +++ b/hw/mem/cxl_type3.c
> > > @@ -1203,8 +1203,9 @@ void qmp_cxl_inject_gen_media_event(const char *path, uint8_t log,
> > >                                      uint8_t flags, uint64_t physaddr,
> > >                                      uint8_t descriptor, uint8_t type,
> > >                                      uint8_t transaction_type,
> > > -                                    int16_t channel, int16_t rank,
> > > -                                    int32_t device,
> > > +                                    bool has_channel, uint8_t channel,
> > > +                                    bool has_rank, uint8_t rank,
> > > +                                    bool has_device, uint32_t device,
> > >                                      const char *component_id,
> > >                                      Error **errp)
> > >  {
> > > @@ -1238,22 +1239,22 @@ void qmp_cxl_inject_gen_media_event(const char *path, uint8_t log,
> > >      gem.type = type;
> > >      gem.transaction_type = transaction_type;
> > > 
> > > -    if (0 <= channel && channel <= 0xFF) {
> > > +    if (has_channel) {
> > >          gem.channel = channel;
> > >          valid_flags |= CXL_GMER_VALID_CHANNEL;
> > >      }
> > > 
> > > -    if (0 <= rank && rank <= 0xFF) {
> > > +    if (has_rank) {
> > >          gem.rank = rank;
> > >          valid_flags |= CXL_GMER_VALID_RANK;
> > >      }
> > > 
> > > -    if (0 <= device && device <= 0xFFFFFF) {
> > > +    if (has_device) {
> > >          st24_le_p(gem.device, device);
> > >          valid_flags |= CXL_GMER_VALID_DEVICE;
> > >      }
> > > 
> > > -    if (component_id && strcmp(component_id, "")) {
> > > +    if (component_id) {
> > >         strncpy((char *)gem.component_id, component_id,
> > >                  sizeof(gem.component_id) - 1);
> > >          valid_flags |= CXL_GMER_VALID_COMPONENT;
> > > diff --git a/qapi/cxl.json b/qapi/cxl.json
> > > index 56e85a28d7..085f82e7da 100644
> > > --- a/qapi/cxl.json
> > > +++ b/qapi/cxl.json
> > > @@ -26,8 +26,8 @@
> > >    'data': { 'path': 'str', 'log': 'uint8', 'flags': 'uint8',
> > >              'physaddr': 'uint64', 'descriptor': 'uint8',
> > >              'type': 'uint8', 'transactiontype': 'uint8',
> > > -            'channel': 'int16', 'rank': 'int16',
> > > -            'device': 'int32', 'componentid': 'str'
> > > +            '*channel': 'uint8', '*rank': 'uint8',
> > > +            '*device': 'uint32', '*componentid': 'str'
> > >              }}
> > > 
> > >  ##
> > >     
> > > > +
> > > >  ##
> > > >  # @cxl-inject-poison:
> > > >  #
> > > >     
> > >     
> 
> 


  reply	other threads:[~2023-01-11 14:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22  4:24 [PATCH v2 0/8] QEMU CXL Provide mock CXL events and irq support Ira Weiny
2022-12-22  4:24 ` [PATCH v2 1/8] qemu/bswap: Add const_le64() Ira Weiny
2022-12-22  4:24 ` [PATCH v2 2/8] qemu/uuid: Add UUID static initializer Ira Weiny
2022-12-22  4:24 ` [PATCH v2 3/8] hw/cxl/mailbox: Use new UUID network order define for cel_uuid Ira Weiny
2023-01-03 16:30   ` Jonathan Cameron
2022-12-22  4:24 ` [PATCH v2 4/8] hw/cxl/events: Add event status register Ira Weiny
2023-01-03 16:36   ` Jonathan Cameron
2022-12-22  4:24 ` [PATCH v2 5/8] hw/cxl/events: Wire up get/clear event mailbox commands Ira Weiny
2023-01-04 18:07   ` Jonathan Cameron
2023-01-24 17:04   ` Jonathan Cameron
2022-12-22  4:24 ` [PATCH v2 6/8] hw/cxl/events: Add event interrupt support Ira Weiny
2022-12-22  4:24 ` [PATCH v2 7/8] bswap: Add the ability to store to an unaligned 24 bit field Ira Weiny
2023-01-03 17:14   ` Jonathan Cameron
2022-12-22  4:24 ` [PATCH v2 8/8] hw/cxl/events: Add in inject general media event Ira Weiny
2023-01-03 18:07   ` Jonathan Cameron
2023-01-09 19:15     ` Ira Weiny
2023-01-10 15:38       ` Jonathan Cameron
2023-01-11 14:05         ` Jonathan Cameron [this message]
2023-01-12 15:34   ` Jonathan Cameron

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=20230111140510.00007963@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=bwidawsk@kernel.org \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.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