[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 17/43] hw/cxl/device: Add a memory device (8.2.8.5)
From: |
Jonathan Cameron |
Subject: |
Re: [PATCH v6 17/43] hw/cxl/device: Add a memory device (8.2.8.5) |
Date: |
Fri, 11 Feb 2022 16:50:18 +0000 |
On Fri, 11 Feb 2022 12:07:21 +0000
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
> From: Ben Widawsky <ben.widawsky@intel.com>
>
> A CXL memory device (AKA Type 3) is a CXL component that contains some
> combination of volatile and persistent memory. It also implements the
> previously defined mailbox interface as well as the memory device
> firmware interface.
>
> Although the memory device is configured like a normal PCIe device, the
> memory traffic is on an entirely separate bus conceptually (using the
> same physical wires as PCIe, but different protocol).
>
> Once the CXL topology is fully configure and address decoders committed,
> the guest physical address for the memory device is part of a larger
> window which is owned by the platform. The creation of these windows
> is later in this series.
>
> The following example will create a 256M device in a 512M window:
> -object "memory-backend-file,id=cxl-mem1,share,mem-path=cxl-type3,size=512M"
> -device "cxl-type3,bus=rp0,memdev=cxl-mem1,id=cxl-pmem0"
>
> Note: Dropped PCDIMM info interfaces for now. They can be added if
> appropriate at a later date.
>
> Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
...
> +
> +static void cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)
> +{
> + MemoryRegion *mr;
> +
> + if (!ct3d->hostmem) {
> + error_setg(errp, "memdev property must be set");
> + return;
> + }
> +
> + mr = host_memory_backend_get_memory(ct3d->hostmem);
> + if (!mr) {
> + error_setg(errp, "memdev property must be set");
> + return;
> + }
> + memory_region_set_nonvolatile(mr, true);
> + memory_region_set_enabled(mr, true);
> + host_memory_backend_set_mapped(ct3d->hostmem, true);
> + ct3d->cxl_dstate.pmem_size = ct3d->hostmem->size;
> +}
> +
> +
> +static void ct3_realize(PCIDevice *pci_dev, Error **errp)
> +{
> + CXLType3Dev *ct3d = CT3(pci_dev);
> + CXLComponentState *cxl_cstate = &ct3d->cxl_cstate;
> + ComponentRegisters *regs = &cxl_cstate->crb;
> + MemoryRegion *mr = ®s->component_registers;
> + uint8_t *pci_conf = pci_dev->config;
> +
> + if (!ct3d->hostmem) {
Ben pointed out in reply to v5 that this is backwards.
I'll fix in v7. Clearly some of the cxl_setup_memory()
logic may also not be needed seeing as it wasn't running.
> + cxl_setup_memory(ct3d, errp);
> + }
> +
> + pci_config_set_prog_interface(pci_conf, 0x10);
> + pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_CXL);
> +
- [PATCH v6 08/43] hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1), (continued)
- [PATCH v6 08/43] hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1), Jonathan Cameron, 2022/02/11
- [PATCH v6 09/43] hw/cxl/device: Timestamp implementation (8.2.9.3), Jonathan Cameron, 2022/02/11
- [PATCH v6 10/43] hw/cxl/device: Add log commands (8.2.9.4) + CEL, Jonathan Cameron, 2022/02/11
- [PATCH v6 11/43] hw/pxb: Use a type for realizing expanders, Jonathan Cameron, 2022/02/11
- [PATCH v6 12/43] hw/pci/cxl: Create a CXL bus type, Jonathan Cameron, 2022/02/11
- [PATCH v6 13/43] cxl: Machine level control on whether CXL support is enabled, Jonathan Cameron, 2022/02/11
- [PATCH v6 14/43] hw/pxb: Allow creation of a CXL PXB (host bridge), Jonathan Cameron, 2022/02/11
- [PATCH v6 15/43] qtest/cxl: Introduce initial test for pxb-cxl only., Jonathan Cameron, 2022/02/11
- [PATCH v6 16/43] hw/cxl/rp: Add a root port, Jonathan Cameron, 2022/02/11
- [PATCH v6 17/43] hw/cxl/device: Add a memory device (8.2.8.5), Jonathan Cameron, 2022/02/11
- Re: [PATCH v6 17/43] hw/cxl/device: Add a memory device (8.2.8.5),
Jonathan Cameron <=
- [PATCH v6 18/43] qtests/cxl: Add initial root port and CXL type3 tests, Jonathan Cameron, 2022/02/11
- [PATCH v6 19/43] hw/cxl/device: Implement MMIO HDM decoding (8.2.5.12), Jonathan Cameron, 2022/02/11
- [PATCH v6 20/43] hw/cxl/device: Add some trivial commands, Jonathan Cameron, 2022/02/11
- [PATCH v6 21/43] hw/cxl/device: Plumb real Label Storage Area (LSA) sizing, Jonathan Cameron, 2022/02/11
- [PATCH v6 22/43] hw/cxl/device: Implement get/set Label Storage Area (LSA), Jonathan Cameron, 2022/02/11
- [PATCH v6 23/43] hw/cxl/component: Implement host bridge MMIO (8.2.5, table 142), Jonathan Cameron, 2022/02/11
- [PATCH v6 24/43] acpi/cxl: Add _OSC implementation (9.14.2), Jonathan Cameron, 2022/02/11
- [PATCH v6 25/43] acpi/cxl: Create the CEDT (9.14.1), Jonathan Cameron, 2022/02/11
- [PATCH v6 26/43] hw/cxl/component: Add utils for interleave parameter encoding/decoding, Jonathan Cameron, 2022/02/11
- [PATCH v6 27/43] hw/cxl/host: Add support for CXL Fixed Memory Windows., Jonathan Cameron, 2022/02/11