1592
1593
void cxl_assign_event_header(CXLEventRecordHdr *hdr,
1594
const QemuUUID *uuid, uint32_t flags,
1595
- uint8_t length, uint64_t timestamp)
1595
+ uint8_t length, uint64_t timestamp,
1596
+ bool has_maint_op_class, uint8_t maint_op_class,
1597
+ bool has_maint_op_subclass,
1598
+ uint8_t maint_op_subclass,
1599
+ bool has_ld_id, uint16_t ld_id,
1600
+ bool has_head_id, uint8_t head_id)
1601
{
1597
- st24_le_p(&hdr->flags, flags);
1602
hdr->length = length;
1603
memcpy(&hdr->id, uuid, sizeof(hdr->id));
1604
stq_le_p(&hdr->timestamp, timestamp);
1605
+
1606
+ if (has_maint_op_class) {
1607
+ hdr->maint_op_class = maint_op_class;
1608
+ } else {
1609
+ hdr->maint_op_class = 0;
1610
+ }
1611
+
1612
+ if (has_maint_op_subclass) {
1613
+ flags |= CXL_EVENT_REC_FLAGS_MAINT_OP_SUBCLASS_VALID;
1614
+ hdr->maint_op_subclass = maint_op_subclass;
1615
+ }
1616
+
1617
+ if (has_ld_id) {
1618
+ flags |= CXL_EVENT_REC_FLAGS_LD_ID_VALID;
1619
+ stw_le_p(&hdr->ld_id, ld_id);
1620
+ }
1621
+
1622
+ if (has_head_id) {
1623
+ flags |= CXL_EVENT_REC_FLAGS_HEAD_ID_VALID;
1624
+ hdr->head_id = head_id;
1625
+ }
1626
+
1627
+ st24_le_p(&hdr->flags, flags);
1628
}
1629
1630
static const QemuUUID gen_media_uuid = {
1664
}
1665
/* Component ID is device specific. Define this as a string. */
1666
void qmp_cxl_inject_general_media_event(const char *path, CxlEventLog log,
1640
- uint8_t flags, uint64_t dpa,
1667
+ uint32_t flags, bool has_maint_op_class,
1668
+ uint8_t maint_op_class,
1669
+ bool has_maint_op_subclass,
1670
+ uint8_t maint_op_subclass,
1671
+ bool has_ld_id, uint16_t ld_id,
1672
+ bool has_head_id, uint8_t head_id,
1673
+ uint64_t dpa,
1674
uint8_t descriptor, uint8_t type,
1675
uint8_t transaction_type,
1676
bool has_channel, uint8_t channel,
1708
1709
memset(&gem, 0, sizeof(gem));
1710
cxl_assign_event_header(hdr, &gen_media_uuid, flags, sizeof(gem),
1678
- cxl_device_get_timestamp(&ct3d->cxl_dstate));
1711
+ cxl_device_get_timestamp(&ct3d->cxl_dstate),
1712
+ has_maint_op_class, maint_op_class,
1713
+ has_maint_op_subclass, maint_op_subclass,
1714
+ has_ld_id, ld_id, has_head_id, head_id);
1715
1716
stq_le_p(&gem.phys_addr, dpa);
1717
gem.descriptor = descriptor;
1755
#define CXL_DRAM_VALID_COLUMN BIT(6)
1756
#define CXL_DRAM_VALID_CORRECTION_MASK BIT(7)
1757
1722
-void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, uint8_t flags,
1758
+void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
1759
+ uint32_t flags,
1760
+ bool has_maint_op_class, uint8_t maint_op_class,
1761
+ bool has_maint_op_subclass,
1762
+ uint8_t maint_op_subclass,
1763
+ bool has_ld_id, uint16_t ld_id,
1764
+ bool has_head_id, uint8_t head_id,
1765
uint64_t dpa, uint8_t descriptor,
1766
uint8_t type, uint8_t transaction_type,
1767
bool has_channel, uint8_t channel,
1804
1805
memset(&dram, 0, sizeof(dram));
1806
cxl_assign_event_header(hdr, &dram_uuid, flags, sizeof(dram),
1765
- cxl_device_get_timestamp(&ct3d->cxl_dstate));
1807
+ cxl_device_get_timestamp(&ct3d->cxl_dstate),
1808
+ has_maint_op_class, maint_op_class,
1809
+ has_maint_op_subclass, maint_op_subclass,
1810
+ has_ld_id, ld_id, has_head_id, head_id);
1811
stq_le_p(&dram.phys_addr, dpa);
1812
dram.descriptor = descriptor;
1813
dram.type = type;
1867
}
1868
1869
void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
1825
- uint8_t flags, uint8_t type,
1870
+ uint32_t flags, bool has_maint_op_class,
1871
+ uint8_t maint_op_class,
1872
+ bool has_maint_op_subclass,
1873
+ uint8_t maint_op_subclass,
1874
+ bool has_ld_id, uint16_t ld_id,
1875
+ bool has_head_id, uint8_t head_id,
1876
+ uint8_t type,
1877
uint8_t health_status,
1878
uint8_t media_status,
1879
uint8_t additional_status,
1912
1913
memset(&module, 0, sizeof(module));
1914
cxl_assign_event_header(hdr, &memory_module_uuid, flags, sizeof(module),
1864
- cxl_device_get_timestamp(&ct3d->cxl_dstate));
1915
+ cxl_device_get_timestamp(&ct3d->cxl_dstate),
1916
+ has_maint_op_class, maint_op_class,
1917
+ has_maint_op_subclass, maint_op_subclass,
1918
+ has_ld_id, ld_id, has_head_id, head_id);
1919
1920
module.type = type;
1921
module.health_status = health_status;