Message ID | 95d2f7ac1884801148a07f791ba0f03af7770d7e.1677704994.git.alison.schofield@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | cxl: CXL Inject & Clear Poison | expand |
On Wed, 1 Mar 2023 13:36:33 -0800 alison.schofield@intel.com wrote: > From: Alison Schofield <alison.schofield@intel.com> > > Inject and clear poison are commands intended for debug environments, > and can cause data corruption if issued without validation. They are > kernel exclusive commands not available to userspace through ioctls, > but could be submitted via the raw mode ioctl. > > Add inject and clear poison to the cxl_disabled_raw_commands[] list. > Attempts by userspace to issue either command via the RAW ioctl fail > with -EPERM. > > Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/cxl/core/mbox.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > index 77fc811bdfed..4b5e65edbc71 100644 > --- a/drivers/cxl/core/mbox.c > +++ b/drivers/cxl/core/mbox.c > @@ -89,6 +89,10 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = { > * > * CXL_MBOX_OP_[GET_]SCAN_MEDIA: The kernel provides a native error list that > * is kept up to date with patrol notifications and error management. > + * > + * CXL_MBOX_OP_[INJECT|CLEAR]_POISON: The kernel provides a sysfs interface > + * to these commands that ensures data protection of mapped resources. > + * See: Documentation/ABI/testing/sysfs-bus-cxl > */ > static u16 cxl_disabled_raw_commands[] = { > CXL_MBOX_OP_ACTIVATE_FW, > @@ -97,6 +101,8 @@ static u16 cxl_disabled_raw_commands[] = { > CXL_MBOX_OP_SET_SHUTDOWN_STATE, > CXL_MBOX_OP_SCAN_MEDIA, > CXL_MBOX_OP_GET_SCAN_MEDIA, > + CXL_MBOX_OP_INJECT_POISON, > + CXL_MBOX_OP_CLEAR_POISON, > }; > > /*
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index 77fc811bdfed..4b5e65edbc71 100644 --- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -89,6 +89,10 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = { * * CXL_MBOX_OP_[GET_]SCAN_MEDIA: The kernel provides a native error list that * is kept up to date with patrol notifications and error management. + * + * CXL_MBOX_OP_[INJECT|CLEAR]_POISON: The kernel provides a sysfs interface + * to these commands that ensures data protection of mapped resources. + * See: Documentation/ABI/testing/sysfs-bus-cxl */ static u16 cxl_disabled_raw_commands[] = { CXL_MBOX_OP_ACTIVATE_FW, @@ -97,6 +101,8 @@ static u16 cxl_disabled_raw_commands[] = { CXL_MBOX_OP_SET_SHUTDOWN_STATE, CXL_MBOX_OP_SCAN_MEDIA, CXL_MBOX_OP_GET_SCAN_MEDIA, + CXL_MBOX_OP_INJECT_POISON, + CXL_MBOX_OP_CLEAR_POISON, }; /*