Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: jic23@kernel.org, alison.schofield@intel.com,
	ira.weiny@intel.com, djbw@kernel.org, dongjoo.seo1@samsung.com,
	anisa.su@samsung.com, linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2] cxl/mbox: Support Media Operation
Date: Wed, 29 Apr 2026 12:13:58 -0700	[thread overview]
Message-ID: <bec89bd5-c1b1-4fd4-8864-42beeaf88b62@intel.com> (raw)
In-Reply-To: <20260429190654.mhu6bh2ni2o5g7bp@offworld>



On 4/29/26 12:06 PM, Davidlohr Bueso wrote:
> On Tue, 28 Apr 2026, Dave Jiang wrote:
> 
>> On 4/28/26 1:04 PM, Davidlohr Bueso wrote:
>>> Add support for the Media Operation command (opcode 4402h) which
>>> enables targeted sanitize and zero operations on specific DPA ranges,
>>> as defined in CXL 4.0 Section 8.2.10.9.5.3.
>>>
>>> Operations are only allowed on DPA ranges that do not overlap any
>>> hardware-committed endpoint decoder to ensure not corrupting active
>>> mappings.
>>>
>>> Following the path that we currently impose for background cmds, where
>>> users are left with the responsibility of breaking up work sanely, this
>>> implementation imposes an arbitrary limit of 1Gb range to avoid hogging
>>> locks (ie: region/dpa cannot change while media op is on going) and resource
>>> monopolization such as mbox. As such, background commands are processed
>>> synchronously, with a 30s timeout, and currently, per spec, there is no
>>> optional abort it either, nor a way for the device to inform how long the
>>> op could take, ala Scan Media. The observation is that this differs in
>>> semantics regarding the sanitize case, which for whole-device continues
>>> to be handled asynchronously, as a special case.
>>>
>>> Run Discovery during probe to get the device's DPA range granularity
>>> and which operations are supported, and expose to sysfs accordingly:
>>>
>>>   o 'security/sanitize' is multiplexed to allow single ranged input.
>>
>> Maybe just introduce a new sysfs attrib instead of multiplexing?
>> security/sanitize_range
> 
> I am torn between the two options - I do like just a single file.
> But I also like that its own file eliminates that strange async/sync
> handling, which might be a more important factor to consider. If we did
> this, I would rename zero to zero_range as well, for consistency.

The sysfs kdoc [1] says single value is preferred and if not, multiple of the same value type as an array can be considered. We may be pushing the boundary of same value type with range and length. Either way, probably should split out so it's not multiplexing 'sanitize'.

[1] https://docs.kernel.org/filesystems/sysfs.html

DJ

> 
>>
>>>   o 'security/zero' is added, also with single ranged input.
>>>   o 'security/range_limit' is added so users can see the max range supported.
>>
>> media_op_range_limit?
> 
> Ok
>>
>> Can you split this into 3 patches: discover, sanitize_range enabling, and sanitize_zero?
> 
> Ok
>>
>> Would be great to get some cxl_test coverage on the new added ops.
> 
> Right, so far I have used qemu's support to test, I will add cxl_test coverage
> as a follow up to this work.
> 
> Thanks,
> Davidlohr


  reply	other threads:[~2026-04-29 19:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 20:04 [PATCH v2] cxl/mbox: Support Media Operation Davidlohr Bueso
2026-04-28 23:51 ` Dave Jiang
2026-04-29 19:06   ` Davidlohr Bueso
2026-04-29 19:13     ` Dave Jiang [this message]
2026-05-02 19:34   ` Davidlohr Bueso
2026-05-02 22:53     ` Dan Williams
2026-05-07 12:09       ` Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bec89bd5-c1b1-4fd4-8864-42beeaf88b62@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=anisa.su@samsung.com \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=dongjoo.seo1@samsung.com \
    --cc=ira.weiny@intel.com \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox