[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6716bde0a5337_3ee22944f@dwillia2-xfh.jf.intel.com.notmuch>
Date: Mon, 21 Oct 2024 13:47:28 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Ira Weiny <ira.weiny@...el.com>, "Zhijian Li (Fujitsu)"
<lizhijian@...itsu.com>, Dan Williams <dan.j.williams@...el.com>, "Alison
Schofield" <alison.schofield@...el.com>
CC: "linux-cxl@...r.kernel.org" <linux-cxl@...r.kernel.org>, Davidlohr Bueso
<dave@...olabs.net>, Jonathan Cameron <jonathan.cameron@...wei.com>, "Dave
Jiang" <dave.jiang@...el.com>, Vishal Verma <vishal.l.verma@...el.com>, "Ira
Weiny" <ira.weiny@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "Huang, Ying" <ying.huang@...el.com>
Subject: Re: [PATCH] testing/cxl: Fix abused pci_bus_read_config_word() on
platform device
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.
Powered by blists - more mailing lists