mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Ira Weiny <ira.weiny@intel.com>,
	"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>,
	Dan Williams <dan.j.williams@intel.com>,
	"Alison Schofield" <alison.schofield@intel.com>
Cc: "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	"Ira Weiny" <ira.weiny@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Huang, Ying" <ying.huang@intel.com>
Subject: Re: [PATCH] testing/cxl: Fix abused pci_bus_read_config_word() on platform device
Date: Mon, 21 Oct 2024 13:47:28 -0700	[thread overview]
Message-ID: <6716bde0a5337_3ee22944f@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <6716b7b18a1c4_b8f1f294aa@iweiny-mobl.notmuch>

Ira Weiny wrote:
[..]
> > --- a/drivers/cxl/core/cdat.c
> > +++ b/drivers/cxl/core/cdat.c
> > @@ -5,6 +5,7 @@
> >    #include <linux/fw_table.h>
> >    #include <linux/node.h>
> >    #include <linux/overflow.h>
> > +#include <linux/platform_device.h>
> >    #include "cxlpci.h"
> >    #include "cxlmem.h"
> >    #include "core.h"
> > @@ -641,9 +642,13 @@ static int cxl_endpoint_gather_bandwidth(struct cxl_region *cxlr,
> >           void *ptr;
> >           int rc;
> > 
> > +       if (dev_is_pci(cxlds->dev))
> 
> Did you mean...
> 
> 	if (!dev_is_pci(cxlds->dev))
> ???

Yes, skip non-PCI.

[..]
> Couldn't this be done on the endpoint call?  (Making it non-static?)
> 
> int __wrap_cxl_endpoint_gather_bandwidth(...
>                                          struct cxl_endpoint_decoder *cxled,
> 					...)
> {
>         struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
>         struct cxl_dev_state *cxlds = cxlmd->cxlds;
> 
> 	if (!dev_is_pci(cxlds->dev))
> 		return -ENODEV;
> 
> 	return cxl_endpoint_gather_bandwidth(...);
> }

No, cxl_endpoint_gather_bandwidth() is called internal to cxl_core,
there is no opportunity to optionally wrap it, only replace it.

In order for this path to be mocked the cxl_region driver would need to
be moved to a module and then
cxl_region_shared_upstream_bandwidth_update() could be unit tested.

  reply	other threads:[~2024-10-21 20:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  1:52 Li Zhijian
2024-10-16  6:02 ` Huang, Ying
2024-10-18  0:22 ` Alison Schofield
2024-10-18  1:20   ` Dan Williams
2024-10-21  3:35     ` Ira Weiny
2024-10-21  3:43     ` Zhijian Li (Fujitsu)
2024-10-21 20:21       ` Ira Weiny
2024-10-21 20:47         ` Dan Williams [this message]
2024-10-21 20:43       ` Dan Williams

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=6716bde0a5337_3ee22944f@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=vishal.l.verma@intel.com \
    --cc=ying.huang@intel.com \
    /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

all inboxes | Powered by JetHome®