|
@@ -30,6 +30,14 @@
|
|
|
#include "hw/cxl/cxl.h"
|
|
|
#include "hw/pci/msix.h"
|
|
|
|
|
|
+/* type3 device private */
|
|
|
+enum CXL_T3_MSIX_VECTOR {
|
|
|
+ CXL_T3_MSIX_PCIE_DOE_TABLE_ACCESS = 0,
|
|
|
+ CXL_T3_MSIX_EVENT_START = 2,
|
|
|
+ CXL_T3_MSIX_MBOX = CXL_T3_MSIX_EVENT_START + CXL_EVENT_TYPE_MAX,
|
|
|
+ CXL_T3_MSIX_VECTOR_NR
|
|
|
+};
|
|
|
+
|
|
|
#define DWORD_BYTE 4
|
|
|
#define CXL_CAPACITY_MULTIPLIER (256 * MiB)
|
|
|
|
|
@@ -843,7 +851,6 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
|
|
|
ComponentRegisters *regs = &cxl_cstate->crb;
|
|
|
MemoryRegion *mr = ®s->component_registers;
|
|
|
uint8_t *pci_conf = pci_dev->config;
|
|
|
- unsigned short msix_num = 10;
|
|
|
int i, rc;
|
|
|
uint16_t count;
|
|
|
|
|
@@ -884,16 +891,17 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
|
|
|
&ct3d->cxl_dstate.device_registers);
|
|
|
|
|
|
/* MSI(-X) Initialization */
|
|
|
- rc = msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL);
|
|
|
+ rc = msix_init_exclusive_bar(pci_dev, CXL_T3_MSIX_VECTOR_NR, 4, NULL);
|
|
|
if (rc) {
|
|
|
goto err_address_space_free;
|
|
|
}
|
|
|
- for (i = 0; i < msix_num; i++) {
|
|
|
+ for (i = 0; i < CXL_T3_MSIX_VECTOR_NR; i++) {
|
|
|
msix_vector_use(pci_dev, i);
|
|
|
}
|
|
|
|
|
|
/* DOE Initialization */
|
|
|
- pcie_doe_init(pci_dev, &ct3d->doe_cdat, 0x190, doe_cdat_prot, true, 0);
|
|
|
+ pcie_doe_init(pci_dev, &ct3d->doe_cdat, 0x190, doe_cdat_prot, true,
|
|
|
+ CXL_T3_MSIX_PCIE_DOE_TABLE_ACCESS);
|
|
|
|
|
|
cxl_cstate->cdat.build_cdat_table = ct3_build_cdat_table;
|
|
|
cxl_cstate->cdat.free_cdat_table = ct3_free_cdat_table;
|
|
@@ -908,7 +916,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
|
|
|
if (rc) {
|
|
|
goto err_release_cdat;
|
|
|
}
|
|
|
- cxl_event_init(&ct3d->cxl_dstate, 2);
|
|
|
+ cxl_event_init(&ct3d->cxl_dstate, CXL_T3_MSIX_EVENT_START);
|
|
|
|
|
|
/* Set default value for patrol scrub attributes */
|
|
|
ct3d->patrol_scrub_attrs.scrub_cycle_cap =
|
|
@@ -1202,7 +1210,7 @@ static void ct3d_reset(DeviceState *dev)
|
|
|
|
|
|
pcie_cap_fill_link_ep_usp(PCI_DEVICE(dev), ct3d->width, ct3d->speed);
|
|
|
cxl_component_register_init_common(reg_state, write_msk, CXL2_TYPE3_DEVICE);
|
|
|
- cxl_device_register_init_t3(ct3d);
|
|
|
+ cxl_device_register_init_t3(ct3d, CXL_T3_MSIX_MBOX);
|
|
|
|
|
|
/*
|
|
|
* Bring up an endpoint to target with MCTP over VDM.
|