Re: [RFC PATCH v3 04/16] cxl/mem: Introduce a driver for CXL-2.0-Type-3 endpoints
From: Dan Williams <hidden>
Date: 2021-01-12 22:00:45
Also in:
linux-cxl, lkml
On Tue, Jan 12, 2021 at 11:03 AM Jonathan Cameron [off-list ref] wrote:
On Mon, 11 Jan 2021 14:51:08 -0800 Ben Widawsky [off-list ref] wrote:quoted
From: Dan Williams <redacted> The CXL.mem protocol allows a device to act as a provider of "System RAM" and/or "Persistent Memory" that is fully coherent as if the memory was attached to the typical CPU memory controller. With the CXL-2.0 specification a PCI endpoint can implement a "Type-3" device interface and give the operating system control over "Host Managed Device Memory". See section 2.3 Type 3 CXL Device. The memory range exported by the device may optionally be described by the platform firmware memory map, or by infrastructure like LIBNVDIMM to provision persistent memory capacity from one, or more, CXL.mem devices. A pre-requisite for Linux-managed memory-capacity provisioning is this cxl_mem driver that can speak the mailbox protocol defined in section 8.2.8.4 Mailbox Registers. For now just land the driver boiler-plate and fill it in with functionality in subsequent commits. Link: https://www.computeexpresslink.org/download-the-specification Signed-off-by: Dan Williams <redacted> Signed-off-by: Ben Widawsky <redacted>Just one passing comment inline.quoted
diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c new file mode 100644 index 000000000000..005404888942 --- /dev/null +++ b/drivers/cxl/mem.c@@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright(c) 2020 Intel Corporation. All rights reserved. */ +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/io.h> +#include "acpi.h" +#include "pci.h" + +static int cxl_mem_dvsec(struct pci_dev *pdev, int dvsec)Is it worth pulling this out to a utility library now as we are going to keep needing this for CXL devices? Arguably, with a vendor_id parameter it might make sense to have it as a utility function for pci rather than CXL alone.
Sure, cxl_mem_dvsec() can move to a central location, but I'd wait for the first incremental user to split it out.