mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hw/cxl/events: Wire up get/clear event mailbox commands
CXL testing is benefited from an artificial event log injection mechanism. Add an event log infrastructure to insert, get, and clear events from the various logs available on a device. Replace the stubbed out CXL Get/Clear Event mailbox commands with commands that operate on the new infrastructure. Signed-off-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Fan Ni <fan.ni@samsung.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20230530133603.16934-4-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
2f6b8c8f42
commit
22d7e3be07
6 changed files with 337 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/cxl/cxl.h"
|
||||
#include "hw/cxl/cxl_events.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/log.h"
|
||||
|
@ -95,11 +96,46 @@ struct cxl_cmd {
|
|||
return CXL_MBOX_SUCCESS; \
|
||||
}
|
||||
|
||||
DEFINE_MAILBOX_HANDLER_ZEROED(events_get_records, 0x20);
|
||||
DEFINE_MAILBOX_HANDLER_NOP(events_clear_records);
|
||||
DEFINE_MAILBOX_HANDLER_ZEROED(events_get_interrupt_policy, 4);
|
||||
DEFINE_MAILBOX_HANDLER_NOP(events_set_interrupt_policy);
|
||||
|
||||
static CXLRetCode cmd_events_get_records(struct cxl_cmd *cmd,
|
||||
CXLDeviceState *cxlds,
|
||||
uint16_t *len)
|
||||
{
|
||||
CXLGetEventPayload *pl;
|
||||
uint8_t log_type;
|
||||
int max_recs;
|
||||
|
||||
if (cmd->in < sizeof(log_type)) {
|
||||
return CXL_MBOX_INVALID_INPUT;
|
||||
}
|
||||
|
||||
log_type = *((uint8_t *)cmd->payload);
|
||||
|
||||
pl = (CXLGetEventPayload *)cmd->payload;
|
||||
memset(pl, 0, sizeof(*pl));
|
||||
|
||||
max_recs = (cxlds->payload_size - CXL_EVENT_PAYLOAD_HDR_SIZE) /
|
||||
CXL_EVENT_RECORD_SIZE;
|
||||
if (max_recs > 0xFFFF) {
|
||||
max_recs = 0xFFFF;
|
||||
}
|
||||
|
||||
return cxl_event_get_records(cxlds, pl, log_type, max_recs, len);
|
||||
}
|
||||
|
||||
static CXLRetCode cmd_events_clear_records(struct cxl_cmd *cmd,
|
||||
CXLDeviceState *cxlds,
|
||||
uint16_t *len)
|
||||
{
|
||||
CXLClearEventPayload *pl;
|
||||
|
||||
pl = (CXLClearEventPayload *)cmd->payload;
|
||||
*len = 0;
|
||||
return cxl_event_clear_records(cxlds, pl);
|
||||
}
|
||||
|
||||
/* 8.2.9.2.1 */
|
||||
static CXLRetCode cmd_firmware_update_get_info(struct cxl_cmd *cmd,
|
||||
CXLDeviceState *cxl_dstate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue