Message ID | 164317464406.3438644.6609329492458460242.stgit@dwillia2-desk3.amr.corp.intel.com |
---|---|
State | Accepted |
Commit | 0909b4e5287bcda34f00da878ac1f37a0921d959 |
Headers | show |
Series | cxl/port: Robustness fixes for decoder enumeration | expand |
On Tue, 25 Jan 2022 21:24:04 -0800 Dan Williams <dan.j.williams@intel.com> wrote: > If the decoder is not presently active the target_list may not be > accurate. Perform a best effort mapping and assume that it will be fixed > up when the decoder is enabled. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Make sense. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/cxl/acpi.c | 2 +- > drivers/cxl/core/port.c | 5 ++++- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c > index df6691d0a6d0..f64d98bfcb3b 100644 > --- a/drivers/cxl/acpi.c > +++ b/drivers/cxl/acpi.c > @@ -15,7 +15,7 @@ > > static unsigned long cfmws_to_decoder_flags(int restrictions) > { > - unsigned long flags = 0; > + unsigned long flags = CXL_DECODER_F_ENABLE; > > if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_TYPE2) > flags |= CXL_DECODER_F_TYPE2; > diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c > index 224a4853a33e..e75e0d4fb894 100644 > --- a/drivers/cxl/core/port.c > +++ b/drivers/cxl/core/port.c > @@ -1263,8 +1263,11 @@ int cxl_decoder_add_locked(struct cxl_decoder *cxld, int *target_map) > port = to_cxl_port(cxld->dev.parent); > if (!is_endpoint_decoder(dev)) { > rc = decoder_populate_targets(cxld, port, target_map); > - if (rc) > + if (rc && (cxld->flags & CXL_DECODER_F_ENABLE)) { > + dev_err(&port->dev, > + "Failed to populate active decoder targets\n"); > return rc; > + } > } > > rc = dev_set_name(dev, "decoder%d.%d", port->id, cxld->id); >
diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index df6691d0a6d0..f64d98bfcb3b 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -15,7 +15,7 @@ static unsigned long cfmws_to_decoder_flags(int restrictions) { - unsigned long flags = 0; + unsigned long flags = CXL_DECODER_F_ENABLE; if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_TYPE2) flags |= CXL_DECODER_F_TYPE2; diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 224a4853a33e..e75e0d4fb894 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -1263,8 +1263,11 @@ int cxl_decoder_add_locked(struct cxl_decoder *cxld, int *target_map) port = to_cxl_port(cxld->dev.parent); if (!is_endpoint_decoder(dev)) { rc = decoder_populate_targets(cxld, port, target_map); - if (rc) + if (rc && (cxld->flags & CXL_DECODER_F_ENABLE)) { + dev_err(&port->dev, + "Failed to populate active decoder targets\n"); return rc; + } } rc = dev_set_name(dev, "decoder%d.%d", port->id, cxld->id);
If the decoder is not presently active the target_list may not be accurate. Perform a best effort mapping and assume that it will be fixed up when the decoder is enabled. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/cxl/acpi.c | 2 +- drivers/cxl/core/port.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)