Re: [RFC PATCH 1/1] cxl/feature: Using Full Data Transfer only when offset is 0

From: Davidlohr Bueso
Date: Mon Apr 14 2025 - 19:58:44 EST


On Wed, 09 Apr 2025, Li Ming wrote:

Per CXL r3.2 section 8.2.10.6.3 Set Feature(Opcode 0502h)

"If the Feature data is transferred in its entirely, the caller makes
one call to Set Feature with Action = Full Data Transfer. The Offset
field is not used and shall be ignored."

It implies if using Full Data Transfer, the received data should be
updated from offset 0 on device side.

Current driver implementation is if feature data size is less than mbox
payload - set feature header, driver will use Full Data Transfer even if
user provides an offset. Per above description, feature data will be
written from offset 0 rather than the offset value user provided, the
result will not be what user expects.

The changes is checking if the offset caller provides is equal to 0, if
yes, using Full Data Transfer, if not, using Initiate Data Transfer -
Finish Data Transfer.

After the changes, all Set Feature transfer scenarios are below:

1. data size + header is less than mbox payload and offset is 0
Full Data Transfer

2. data size + header is less than mbox payload and offset is not 0
Initiate Data Transfer(with all feature data) - Finish Data Transfer(with no feature data)

3. data size + header us greater than mbox payload with any value of offset
Initiate Data Transfer - Continue Data Transfer - Finish Data Transfer

Fixes: 14d502cc2718e ("cxl/mbox: Add SET_FEATURE mailbox command")
Signed-off-by: Li Ming <ming.li@xxxxxxxxxxxx>

Reviewed-by: Davidlohr Bueso <dave@xxxxxxxxxxxx>