mirror of https://github.com/xemu-project/xemu.git
hw/cxl/device: Plumb real Label Storage Area (LSA) sizing
This should introduce no change. Subsequent work will make use of this new class member. Signed-off-by: Ben Widawsky <ben.widawsky@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20220429144110.25167-21-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
092c6b11f2
commit
639daf8e93
|
@ -277,6 +277,8 @@ static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd,
|
||||||
} QEMU_PACKED *id;
|
} QEMU_PACKED *id;
|
||||||
QEMU_BUILD_BUG_ON(sizeof(*id) != 0x43);
|
QEMU_BUILD_BUG_ON(sizeof(*id) != 0x43);
|
||||||
|
|
||||||
|
CXLType3Dev *ct3d = container_of(cxl_dstate, CXLType3Dev, cxl_dstate);
|
||||||
|
CXLType3Class *cvc = CXL_TYPE3_GET_CLASS(ct3d);
|
||||||
uint64_t size = cxl_dstate->pmem_size;
|
uint64_t size = cxl_dstate->pmem_size;
|
||||||
|
|
||||||
if (!QEMU_IS_ALIGNED(size, 256 << 20)) {
|
if (!QEMU_IS_ALIGNED(size, 256 << 20)) {
|
||||||
|
@ -291,6 +293,7 @@ static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd,
|
||||||
|
|
||||||
id->total_capacity = size / (256 << 20);
|
id->total_capacity = size / (256 << 20);
|
||||||
id->persistent_capacity = size / (256 << 20);
|
id->persistent_capacity = size / (256 << 20);
|
||||||
|
id->lsa_size = cvc->get_lsa_size(ct3d);
|
||||||
|
|
||||||
*len = sizeof(*id);
|
*len = sizeof(*id);
|
||||||
return CXL_MBOX_SUCCESS;
|
return CXL_MBOX_SUCCESS;
|
||||||
|
|
|
@ -179,10 +179,16 @@ static Property ct3_props[] = {
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static uint64_t get_lsa_size(CXLType3Dev *ct3d)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void ct3_class_init(ObjectClass *oc, void *data)
|
static void ct3_class_init(ObjectClass *oc, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||||
PCIDeviceClass *pc = PCI_DEVICE_CLASS(oc);
|
PCIDeviceClass *pc = PCI_DEVICE_CLASS(oc);
|
||||||
|
CXLType3Class *cvc = CXL_TYPE3_CLASS(oc);
|
||||||
|
|
||||||
pc->realize = ct3_realize;
|
pc->realize = ct3_realize;
|
||||||
pc->exit = ct3_exit;
|
pc->exit = ct3_exit;
|
||||||
|
@ -195,11 +201,14 @@ static void ct3_class_init(ObjectClass *oc, void *data)
|
||||||
dc->desc = "CXL PMEM Device (Type 3)";
|
dc->desc = "CXL PMEM Device (Type 3)";
|
||||||
dc->reset = ct3d_reset;
|
dc->reset = ct3d_reset;
|
||||||
device_class_set_props(dc, ct3_props);
|
device_class_set_props(dc, ct3_props);
|
||||||
|
|
||||||
|
cvc->get_lsa_size = get_lsa_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo ct3d_info = {
|
static const TypeInfo ct3d_info = {
|
||||||
.name = TYPE_CXL_TYPE3,
|
.name = TYPE_CXL_TYPE3,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
|
.class_size = sizeof(struct CXLType3Class),
|
||||||
.class_init = ct3_class_init,
|
.class_init = ct3_class_init,
|
||||||
.instance_size = sizeof(CXLType3Dev),
|
.instance_size = sizeof(CXLType3Dev),
|
||||||
.interfaces = (InterfaceInfo[]) {
|
.interfaces = (InterfaceInfo[]) {
|
||||||
|
|
|
@ -236,6 +236,7 @@ struct CXLType3Dev {
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
HostMemoryBackend *hostmem;
|
HostMemoryBackend *hostmem;
|
||||||
|
HostMemoryBackend *lsa;
|
||||||
|
|
||||||
/* State */
|
/* State */
|
||||||
CXLComponentState cxl_cstate;
|
CXLComponentState cxl_cstate;
|
||||||
|
@ -243,6 +244,14 @@ struct CXLType3Dev {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TYPE_CXL_TYPE3 "cxl-type3"
|
#define TYPE_CXL_TYPE3 "cxl-type3"
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(CXLType3Dev, CXL_TYPE3)
|
OBJECT_DECLARE_TYPE(CXLType3Dev, CXLType3Class, CXL_TYPE3)
|
||||||
|
|
||||||
|
struct CXLType3Class {
|
||||||
|
/* Private */
|
||||||
|
PCIDeviceClass parent_class;
|
||||||
|
|
||||||
|
/* public */
|
||||||
|
uint64_t (*get_lsa_size)(CXLType3Dev *ct3d);
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue