Message ID | 168592153599.1948938.3754212703217628741.stgit@dwillia2-xfh.jf.intel.com |
---|---|
State | Accepted |
Commit | 8c897b366cda9c7e5ebbb6e8e3da238ecec84535 |
Headers | show |
Series | cxl: Device memory setup | expand |
On Sun, 04 Jun 2023 16:32:16 -0700 Dan Williams <dan.j.williams@intel.com> wrote: > Switch-level (mid-level) decoders between the platform root and an > endpoint can dynamically switch modes between HDM-H and HDM-D[B] > depending on which region they target. Use the region type to fixup each > decoder that gets allocated to map the given region. > > Note that endpoint decoders are meant to determine the region type, so > warn if those ever need to be fixed up, but since it is possible to > continue do so. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/cxl/core/region.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index dca94c458b8f..c7170d92f47f 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -809,6 +809,18 @@ static int cxl_rr_alloc_decoder(struct cxl_port *port, struct cxl_region *cxlr, > return -EBUSY; > } > > + /* > + * Endpoints should already match the region type, but backstop that > + * assumption with an assertion. Switch-decoders change mapping-type > + * based on what is mapped when they are assigned to a region. > + */ > + dev_WARN_ONCE(&cxlr->dev, > + port == cxled_to_port(cxled) && > + cxld->target_type != cxlr->type, > + "%s:%s mismatch decoder type %d -> %d\n", > + dev_name(&cxled_to_memdev(cxled)->dev), > + dev_name(&cxld->dev), cxld->target_type, cxlr->type); > + cxld->target_type = cxlr->type; > cxl_rr->decoder = cxld; > return 0; > } >
On 6/4/23 16:32, Dan Williams wrote: > Switch-level (mid-level) decoders between the platform root and an > endpoint can dynamically switch modes between HDM-H and HDM-D[B] > depending on which region they target. Use the region type to fixup each > decoder that gets allocated to map the given region. > > Note that endpoint decoders are meant to determine the region type, so > warn if those ever need to be fixed up, but since it is possible to > continue do so. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/cxl/core/region.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index dca94c458b8f..c7170d92f47f 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -809,6 +809,18 @@ static int cxl_rr_alloc_decoder(struct cxl_port *port, struct cxl_region *cxlr, > return -EBUSY; > } > > + /* > + * Endpoints should already match the region type, but backstop that > + * assumption with an assertion. Switch-decoders change mapping-type > + * based on what is mapped when they are assigned to a region. > + */ > + dev_WARN_ONCE(&cxlr->dev, > + port == cxled_to_port(cxled) && > + cxld->target_type != cxlr->type, > + "%s:%s mismatch decoder type %d -> %d\n", > + dev_name(&cxled_to_memdev(cxled)->dev), > + dev_name(&cxld->dev), cxld->target_type, cxlr->type); > + cxld->target_type = cxlr->type; > cxl_rr->decoder = cxld; > return 0; > } >
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index dca94c458b8f..c7170d92f47f 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -809,6 +809,18 @@ static int cxl_rr_alloc_decoder(struct cxl_port *port, struct cxl_region *cxlr, return -EBUSY; } + /* + * Endpoints should already match the region type, but backstop that + * assumption with an assertion. Switch-decoders change mapping-type + * based on what is mapped when they are assigned to a region. + */ + dev_WARN_ONCE(&cxlr->dev, + port == cxled_to_port(cxled) && + cxld->target_type != cxlr->type, + "%s:%s mismatch decoder type %d -> %d\n", + dev_name(&cxled_to_memdev(cxled)->dev), + dev_name(&cxld->dev), cxld->target_type, cxlr->type); + cxld->target_type = cxlr->type; cxl_rr->decoder = cxld; return 0; }
Switch-level (mid-level) decoders between the platform root and an endpoint can dynamically switch modes between HDM-H and HDM-D[B] depending on which region they target. Use the region type to fixup each decoder that gets allocated to map the given region. Note that endpoint decoders are meant to determine the region type, so warn if those ever need to be fixed up, but since it is possible to continue do so. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/cxl/core/region.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)