Re: [PATCH V8 07/10] cxl/mem: Read CDAT table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 14 Apr 2022 13:32:34 -0700
ira.weiny@xxxxxxxxx wrote:

> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 
> The OS will need CDAT data from CXL devices to properly set up
> interleave sets.  Currently this is supported by a through a DOE mailbox
> which supports CDAT.  But any cxl_mem object can provide this data later
> if need be, for example for testing.
> 
> Cache the CDAT data for later parsing.  Provide a sysfs binary attribute
> to allow dumping of the CDAT.
> 
> Binary dumping is modeled on /sys/firmware/ACPI/tables/
> 
> The ability to dump this table will be very useful for emulation of real
> devices once they become available as QEMU CXL type 3 device emulation will
> be able to load this file in.
> 
> This does not support table updates at runtime. It will always provide
> whatever was there when first cached. Handling of table updates can be
> implemented later.
> 
> Finally create a complete list of DOE defines within cdat.h for code
> wishing to decode the CDAT table.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Co-developed-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> 
I'd have left the introduction of callbacks until they were actually needed,
but meh. That's minor.

On trivial below.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

...


> +
> +static int read_cdat_data(struct cxl_dev_state *cxlds)
> +{
> +	struct device *dev = cxlds->dev;
> +	size_t cdat_length;
> +	int ret;
> +
> +	if (cxl_mem_cdat_get_length(cxlds, &cdat_length))
> +		return 0;
> +
> +	cxlds->cdat.table = devm_kzalloc(dev, cdat_length, GFP_KERNEL);
> +	if (!cxlds->cdat.table)
> +		return -ENOMEM;

Trivial but blank line here.

> +	cxlds->cdat.length = cdat_length;
> +	ret = cxl_mem_cdat_read_table(cxlds, &cxlds->cdat);
> +	if (ret) {
> +		devm_kfree(dev, cxlds->cdat.table);
> +		cxlds->cdat.table = NULL;
> +		cxlds->cdat.length = 0;
> +	}
> +	return ret;
> +}




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux