All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gregory Price <gregory.price@memverge.com>,
	<qemu-devel@nongnu.org>, "Ben Widawsky" <bwidawsk@kernel.org>,
	<linux-cxl@vger.kernel.org>,
	Huai-Cheng Kuo <hchkuo@avery-design.com.tw>,
	Chris Browy <cbrowy@avery-design.com>, <ira.weiny@intel.com>,
	<linuxarm@huawei.com>
Subject: Re: [PATCH v8 4/5] hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange
Date: Thu, 13 Oct 2022 18:21:44 +0100	[thread overview]
Message-ID: <20221013182144.00004466@huawei.com> (raw)
In-Reply-To: <20221013130840-mutt-send-email-mst@kernel.org>

On Thu, 13 Oct 2022 13:09:26 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Oct 13, 2022 at 12:26:58PM -0400, Gregory Price wrote:
> > Other than the nitpicks below, lgtm.  Not sure if you need a sign off
> > from me given the contributions:
> > 
> > Signed-off-by: Gregory Price <gregory.price@memverge.com>
> >   
> > > +/* If no cdat_table == NULL returns number of entries */
> > > +static int ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table,
> > > +                                         int dsmad_handle, MemoryRegion *mr)
> > > +{
> > > +    enum {
> > > +        DSMAS,
> > > +        DSLBIS0,
> > > +        DSLBIS1,
> > > +        DSLBIS2,
> > > +        DSLBIS3,
> > > +        DSEMTS,
> > > +        NUM_ENTRIES
> > > +    };  
> > // ...  
> > > +    if (!cdat_table) {
> > > +        return NUM_ENTRIES;
> > > +    }  
> > 
> > the only thing that i would recommend is making this enum global (maybe
> > renaming them CT3_CDAT_[ENTRY_NAME]) and using CT3_CDAT_NUM_ENTRIES
> > directly in the function that allocates the cdat buffer itself.  
> 
> 
> Yes I think I agree here.

Ok, seems a consensus against having this local.

I can do this for now and then revisit if / when things become more complex
and this becomes not global.  I guess a potential case of premature flexibility.

Jonathan

> 
> > I do
> > understand the want to keep the enum and the code creating the entries
> > co-located though, so i'm just nitpicking here i guess.
> > 
> > Generally I dislike the pattern of passing a NULL into a function to get
> > configuration data, and then calling that function again.  This function
> > wants to be named...
> > 
> > ct3_build_cdat_entries_for_mr_or_get_table_size_if_cdat_is_null(...)
> > 
> > to accurately describe what it does.  Just kinda feels like an extra
> > function call for no reason.
> > 
> > But either way, it works, this is just a nitpick on my side.
> >   
> > > +static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv)
> > > +{
> > > +    g_autofree CDATSubHeader **table = NULL;
> > > +    CXLType3Dev *ct3d = priv;
> > > +    MemoryRegion *volatile_mr;
> > > +    /* ... snip ... */
> > > +}  
> > 
> > s/volatile/nonvolatile  
> 


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gregory Price <gregory.price@memverge.com>,
	<qemu-devel@nongnu.org>, "Ben Widawsky" <bwidawsk@kernel.org>,
	<linux-cxl@vger.kernel.org>,
	Huai-Cheng Kuo <hchkuo@avery-design.com.tw>,
	Chris Browy <cbrowy@avery-design.com>, <ira.weiny@intel.com>,
	<linuxarm@huawei.com>
Subject: Re: [PATCH v8 4/5] hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange
Date: Thu, 13 Oct 2022 18:21:44 +0100	[thread overview]
Message-ID: <20221013182144.00004466@huawei.com> (raw)
In-Reply-To: <20221013130840-mutt-send-email-mst@kernel.org>

On Thu, 13 Oct 2022 13:09:26 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Oct 13, 2022 at 12:26:58PM -0400, Gregory Price wrote:
> > Other than the nitpicks below, lgtm.  Not sure if you need a sign off
> > from me given the contributions:
> > 
> > Signed-off-by: Gregory Price <gregory.price@memverge.com>
> >   
> > > +/* If no cdat_table == NULL returns number of entries */
> > > +static int ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table,
> > > +                                         int dsmad_handle, MemoryRegion *mr)
> > > +{
> > > +    enum {
> > > +        DSMAS,
> > > +        DSLBIS0,
> > > +        DSLBIS1,
> > > +        DSLBIS2,
> > > +        DSLBIS3,
> > > +        DSEMTS,
> > > +        NUM_ENTRIES
> > > +    };  
> > // ...  
> > > +    if (!cdat_table) {
> > > +        return NUM_ENTRIES;
> > > +    }  
> > 
> > the only thing that i would recommend is making this enum global (maybe
> > renaming them CT3_CDAT_[ENTRY_NAME]) and using CT3_CDAT_NUM_ENTRIES
> > directly in the function that allocates the cdat buffer itself.  
> 
> 
> Yes I think I agree here.

Ok, seems a consensus against having this local.

I can do this for now and then revisit if / when things become more complex
and this becomes not global.  I guess a potential case of premature flexibility.

Jonathan

> 
> > I do
> > understand the want to keep the enum and the code creating the entries
> > co-located though, so i'm just nitpicking here i guess.
> > 
> > Generally I dislike the pattern of passing a NULL into a function to get
> > configuration data, and then calling that function again.  This function
> > wants to be named...
> > 
> > ct3_build_cdat_entries_for_mr_or_get_table_size_if_cdat_is_null(...)
> > 
> > to accurately describe what it does.  Just kinda feels like an extra
> > function call for no reason.
> > 
> > But either way, it works, this is just a nitpick on my side.
> >   
> > > +static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv)
> > > +{
> > > +    g_autofree CDATSubHeader **table = NULL;
> > > +    CXLType3Dev *ct3d = priv;
> > > +    MemoryRegion *volatile_mr;
> > > +    /* ... snip ... */
> > > +}  
> > 
> > s/volatile/nonvolatile  
> 



  reply	other threads:[~2022-10-13 17:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 12:00 [PATCH v8 0/5] QEMU PCIe DOE for PCIe 4.0/5.0 and CXL 2 Jonathan Cameron
2022-10-13 12:00 ` Jonathan Cameron via
2022-10-13 12:00 ` [PATCH v8 1/5] hw/pci: PCIe Data Object Exchange emulation Jonathan Cameron
2022-10-13 12:00   ` Jonathan Cameron via
2022-10-13 12:00 ` [PATCH v8 2/5] hw/mem/cxl-type3: Add MSIX support Jonathan Cameron
2022-10-13 12:00   ` Jonathan Cameron via
2022-10-13 12:00 ` [PATCH v8 3/5] hw/cxl/cdat: CXL CDAT Data Object Exchange implementation Jonathan Cameron
2022-10-13 12:00   ` Jonathan Cameron via
2022-10-13 12:00 ` [PATCH v8 4/5] hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange Jonathan Cameron
2022-10-13 12:00   ` Jonathan Cameron via
2022-10-13 16:26   ` Gregory Price
2022-10-13 17:09     ` Michael S. Tsirkin
2022-10-13 17:21       ` Jonathan Cameron [this message]
2022-10-13 17:21         ` Jonathan Cameron via
2022-10-13 17:32         ` Gregory Price
2022-10-13 17:40           ` Jonathan Cameron
2022-10-13 17:40             ` Jonathan Cameron via
2022-10-13 17:13     ` Jonathan Cameron
2022-10-13 17:13       ` Jonathan Cameron via
2022-10-13 12:00 ` [PATCH v8 5/5] hw/pci-bridge/cxl-upstream: Add a CDAT table access DOE Jonathan Cameron
2022-10-13 12:00   ` Jonathan Cameron via

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=20221013182144.00004466@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=bwidawsk@kernel.org \
    --cc=cbrowy@avery-design.com \
    --cc=gregory.price@memverge.com \
    --cc=hchkuo@avery-design.com.tw \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mst@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.