mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
hw/cxl: Add clear poison mailbox command support.
Current implementation is very simple so many of the corner cases do not exist (e.g. fragmenting larger poison list entries) Reviewed-by: Fan Ni <fan.ni@samsung.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20230526170010.574-5-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
ff04b207a0
commit
6bda41a69b
3 changed files with 120 additions and 0 deletions
|
@ -947,6 +947,42 @@ static void set_lsa(CXLType3Dev *ct3d, const void *buf, uint64_t size,
|
|||
*/
|
||||
}
|
||||
|
||||
static bool set_cacheline(CXLType3Dev *ct3d, uint64_t dpa_offset, uint8_t *data)
|
||||
{
|
||||
MemoryRegion *vmr = NULL, *pmr = NULL;
|
||||
AddressSpace *as;
|
||||
|
||||
if (ct3d->hostvmem) {
|
||||
vmr = host_memory_backend_get_memory(ct3d->hostvmem);
|
||||
}
|
||||
if (ct3d->hostpmem) {
|
||||
pmr = host_memory_backend_get_memory(ct3d->hostpmem);
|
||||
}
|
||||
|
||||
if (!vmr && !pmr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dpa_offset + CXL_CACHE_LINE_SIZE > ct3d->cxl_dstate.mem_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vmr) {
|
||||
if (dpa_offset < memory_region_size(vmr)) {
|
||||
as = &ct3d->hostvmem_as;
|
||||
} else {
|
||||
as = &ct3d->hostpmem_as;
|
||||
dpa_offset -= memory_region_size(vmr);
|
||||
}
|
||||
} else {
|
||||
as = &ct3d->hostpmem_as;
|
||||
}
|
||||
|
||||
address_space_write(as, dpa_offset, MEMTXATTRS_UNSPECIFIED, &data,
|
||||
CXL_CACHE_LINE_SIZE);
|
||||
return true;
|
||||
}
|
||||
|
||||
void cxl_set_poison_list_overflowed(CXLType3Dev *ct3d)
|
||||
{
|
||||
ct3d->poison_list_overflowed = true;
|
||||
|
@ -1168,6 +1204,7 @@ static void ct3_class_init(ObjectClass *oc, void *data)
|
|||
cvc->get_lsa_size = get_lsa_size;
|
||||
cvc->get_lsa = get_lsa;
|
||||
cvc->set_lsa = set_lsa;
|
||||
cvc->set_cacheline = set_cacheline;
|
||||
}
|
||||
|
||||
static const TypeInfo ct3d_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue