Message ID | 164298424120.3018233.15611905873808708542.stgit@dwillia2-desk3.amr.corp.intel.com |
---|---|
State | Accepted |
Commit | 83fbdbe4c18678eebe63fc49913f149a5afde057 |
Headers | show |
Series | CXL.mem Topology Discovery and Hotplug Support | expand |
On Sun, 23 Jan 2022 16:30:41 -0800 Dan Williams <dan.j.williams@intel.com> wrote: > In order to enable libkmod lookups for CXL device objects to their > corresponding module, add 'modalias' to the base attribute of CXL > devices. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Looks fine to me. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > Documentation/ABI/testing/sysfs-bus-cxl | 9 +++++++++ > drivers/cxl/core/port.c | 26 +++++++++++++++++--------- > 2 files changed, 26 insertions(+), 9 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl > index 0b6a2e6e8fbb..6d8cbf3355b5 100644 > --- a/Documentation/ABI/testing/sysfs-bus-cxl > +++ b/Documentation/ABI/testing/sysfs-bus-cxl > @@ -34,6 +34,15 @@ Description: > the same value communicated in the DEVTYPE environment variable > for uevents for devices on the "cxl" bus. > > +What: /sys/bus/cxl/devices/*/modalias > +Date: December, 2021 > +KernelVersion: v5.18 > +Contact: linux-cxl@vger.kernel.org > +Description: > + CXL device objects export the modalias attribute which mirrors > + the same value communicated in the MODALIAS environment variable > + for uevents for devices on the "cxl" bus. > + > What: /sys/bus/cxl/devices/portX/uport > Date: June, 2021 > KernelVersion: v5.14 > diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c > index 72633865b386..eede0bbe687a 100644 > --- a/drivers/cxl/core/port.c > +++ b/drivers/cxl/core/port.c > @@ -34,8 +34,25 @@ static ssize_t devtype_show(struct device *dev, struct device_attribute *attr, > } > static DEVICE_ATTR_RO(devtype); > > +static int cxl_device_id(struct device *dev) > +{ > + if (dev->type == &cxl_nvdimm_bridge_type) > + return CXL_DEVICE_NVDIMM_BRIDGE; > + if (dev->type == &cxl_nvdimm_type) > + return CXL_DEVICE_NVDIMM; > + return 0; > +} > + > +static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + return sysfs_emit(buf, CXL_MODALIAS_FMT "\n", cxl_device_id(dev)); > +} > +static DEVICE_ATTR_RO(modalias); > + > static struct attribute *cxl_base_attributes[] = { > &dev_attr_devtype.attr, > + &dev_attr_modalias.attr, > NULL, > }; > > @@ -845,15 +862,6 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv) > } > EXPORT_SYMBOL_NS_GPL(cxl_driver_unregister, CXL); > > -static int cxl_device_id(struct device *dev) > -{ > - if (dev->type == &cxl_nvdimm_bridge_type) > - return CXL_DEVICE_NVDIMM_BRIDGE; > - if (dev->type == &cxl_nvdimm_type) > - return CXL_DEVICE_NVDIMM; > - return 0; > -} > - > static int cxl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) > { > return add_uevent_var(env, "MODALIAS=" CXL_MODALIAS_FMT, >
On 22-01-23 16:30:41, Dan Williams wrote: > In order to enable libkmod lookups for CXL device objects to their > corresponding module, add 'modalias' to the base attribute of CXL > devices. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Ben Widawsky <ben.widawsky@intel.com> [snip]
diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl index 0b6a2e6e8fbb..6d8cbf3355b5 100644 --- a/Documentation/ABI/testing/sysfs-bus-cxl +++ b/Documentation/ABI/testing/sysfs-bus-cxl @@ -34,6 +34,15 @@ Description: the same value communicated in the DEVTYPE environment variable for uevents for devices on the "cxl" bus. +What: /sys/bus/cxl/devices/*/modalias +Date: December, 2021 +KernelVersion: v5.18 +Contact: linux-cxl@vger.kernel.org +Description: + CXL device objects export the modalias attribute which mirrors + the same value communicated in the MODALIAS environment variable + for uevents for devices on the "cxl" bus. + What: /sys/bus/cxl/devices/portX/uport Date: June, 2021 KernelVersion: v5.14 diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 72633865b386..eede0bbe687a 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -34,8 +34,25 @@ static ssize_t devtype_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_RO(devtype); +static int cxl_device_id(struct device *dev) +{ + if (dev->type == &cxl_nvdimm_bridge_type) + return CXL_DEVICE_NVDIMM_BRIDGE; + if (dev->type == &cxl_nvdimm_type) + return CXL_DEVICE_NVDIMM; + return 0; +} + +static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, CXL_MODALIAS_FMT "\n", cxl_device_id(dev)); +} +static DEVICE_ATTR_RO(modalias); + static struct attribute *cxl_base_attributes[] = { &dev_attr_devtype.attr, + &dev_attr_modalias.attr, NULL, }; @@ -845,15 +862,6 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv) } EXPORT_SYMBOL_NS_GPL(cxl_driver_unregister, CXL); -static int cxl_device_id(struct device *dev) -{ - if (dev->type == &cxl_nvdimm_bridge_type) - return CXL_DEVICE_NVDIMM_BRIDGE; - if (dev->type == &cxl_nvdimm_type) - return CXL_DEVICE_NVDIMM; - return 0; -} - static int cxl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { return add_uevent_var(env, "MODALIAS=" CXL_MODALIAS_FMT,
In order to enable libkmod lookups for CXL device objects to their corresponding module, add 'modalias' to the base attribute of CXL devices. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- Documentation/ABI/testing/sysfs-bus-cxl | 9 +++++++++ drivers/cxl/core/port.c | 26 +++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-)