Re: [PATCH v7 4/8] cxl: Add HDM-DB region creation

Davidlohr Bueso <[email protected]> Wed, 5 Aug 2026 12:10:35 -0700
Newsgroups org.kernel.vger.linux-cxl
Message-ID <20260805191035.z7ayr7koxbomgq2h@offworld>
Hi Alison, thanks for having a look at the series.

On Tue, 04 Aug 2026, Alison Schofield wrote:

>On Tue, Jul 28, 2026 at 07:41:32AM -0700, Davidlohr Bueso wrote:
>> A region inherits its coherency from the chosen root decoder: HDM-DB
>> if the root has CXL_DECODER_F_BI, otherwise HDM-H.
>>
>> Surface the topology through read-only sysfs:
>>
>>   - decoderX.Y/cap_bi (root): CFMWS BI restriction.
>>   - decoderX.Y/bi (endpoint): '1' when configured for HDM-DB.
>
>Hi Davidlohr,
>
>$ grep What Documentation/ABI/testing/sysfs-bus-cxl
>shows that we have a precedent for spelling things out in the
>sysfs attribute names. Even long things like interleave_granularity
>and extended_linear_cache_size. Suggest doing same for these.

Sure, I can rename to backinv or back_invalidate.

>one bit below..
>
>
>> @@ -2108,10 +2106,31 @@ static int cxl_region_attach(struct cxl_region *cxlr,
>>		return -ENXIO;
>>	}
>>
>> -	if (cxled->cxld.target_type != cxlr->type) {
>> -		dev_dbg(&cxlr->dev, "%s:%s type mismatch: %d vs %d\n",
>> -			dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
>> -			cxled->cxld.target_type, cxlr->type);
>
>The new checks below seem to ignore CXL_HDM_DECODER_COHERENCY_UNKNOWN.
>Does the existing type check need to stay for UNKNOWNS?

This is a good point; I will be more explicit about the UNKNOWN handling
in the changelog. But we don't want it as a type match perse as unknown
could still allow for configurable settings (CXL_HDM_DECODER_COHERENCY_BOTH)
but its just not announcing it - albeit that would be pretty funky hw.

cxled_default_type() gives a type 3 decoder HOSTONLYMEM unless the HDM
reports device-coherent only, so the check would refuse every unknown
from HDM-DB regions.

Thanks,
Davidlohr

>> +	/*
>> +	 * Verify the device and HDM are capable of the region's flavor before
>> +	 * proceeding. The endpoint decoder's target_type is then inherited
>> +	 * from cxlr->type later in cxl_rr_assign_decoder().
>> +	 */
>> +	if (cxlr->type == CXL_DECODER_DEVMEM &&
>> +	    cxl_root_decoder_is_bi(cxlrd) && !cxlds->bi) {
>> +		dev_err(&cxlr->dev, "%s:%s BI not enabled on device\n",
>> +			dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev));
>> +		return -ENXIO;
>> +	}
>> +
>> +	cxlhdm = dev_get_drvdata(&ep_port->dev);
>> +	if (!cxlhdm)
>> +		return -ENXIO;
>> +	if (cxlr->type == CXL_DECODER_HOSTONLYMEM &&
>> +	    cxlhdm->supported_coherency == CXL_HDM_DECODER_COHERENCY_DEV) {
>> +		dev_warn(&cxlr->dev, "%s:%s HDM is device-coherent only\n",
>> +			 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev));
>> +		return -ENXIO;
>> +	}
>> +	if (cxlr->type == CXL_DECODER_DEVMEM &&
>> +	    cxlhdm->supported_coherency == CXL_HDM_DECODER_COHERENCY_HOST) {
>> +		dev_warn(&cxlr->dev, "%s:%s HDM is host-only coherent\n",
>> +			 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev));
>>		return -ENXIO;
>>	}
>
>snip to end