(Resend it again, my previous reply didn't appear in the lore.kernel.org)
On 19/03/2025 07:45, Davidlohr Bueso wrote: > Add a new cxl_memdev_sanitize() to libcxl to support triggering memory > device sanitation, in either Sanitize and/or Secure Erase, per the > CXL 3.0 spec. > > This is analogous to 'ndctl sanitize-dimm'. > > Signed-off-by: Davidlohr Bueso <d...@stgolabs.net> > --- snip... > +static int action_sanitize_memdev(struct cxl_memdev *memdev, > + struct action_context *actx) > +{ > + int rc; > + > + if (param.secure_erase) > + rc = cxl_memdev_sanitize(memdev, "erase"); > + else > + rc = cxl_memdev_sanitize(memdev, "sanitize"); > + > + return rc; > +} > + cxl_memdev_sanitize could fail for some reasons(lack of hardware support, device busy etc) I'd like to log more details for the failure, something like: + if (rc) { + log_err(&ml, "one or more failures, last failure: %s\n", + strerror(-rc)); + } Otherwise, I tested it with QEMU and CXL_TEST, it worked Tested-by: Li Zhijian <lizhij...@fujitsu.com>