Skip to content

Commit

Permalink
hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1)
Browse files Browse the repository at this point in the history
Using the previously implemented stubbed helpers, it is now possible to
easily add the missing, required commands to the implementation.

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220429144110.25167-9-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Ben Widawsky authored and mstsirkin committed May 13, 2022
1 parent ce3b4e5 commit 57c02b3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion hw/cxl/cxl-mailbox-utils.c
Expand Up @@ -38,6 +38,14 @@
* a register interface that already deals with it.
*/

enum {
EVENTS = 0x01,
#define GET_RECORDS 0x0
#define CLEAR_RECORDS 0x1
#define GET_INTERRUPT_POLICY 0x2
#define SET_INTERRUPT_POLICY 0x3
};

/* 8.2.8.4.5.1 Command Return Codes */
typedef enum {
CXL_MBOX_SUCCESS = 0x0,
Expand Down Expand Up @@ -93,9 +101,26 @@ 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 QemuUUID cel_uuid;

static struct cxl_cmd cxl_cmd_set[256][256] = {};
#define IMMEDIATE_CONFIG_CHANGE (1 << 1)
#define IMMEDIATE_LOG_CHANGE (1 << 4)

static struct cxl_cmd cxl_cmd_set[256][256] = {
[EVENTS][GET_RECORDS] = { "EVENTS_GET_RECORDS",
cmd_events_get_records, 1, 0 },
[EVENTS][CLEAR_RECORDS] = { "EVENTS_CLEAR_RECORDS",
cmd_events_clear_records, ~0, IMMEDIATE_LOG_CHANGE },
[EVENTS][GET_INTERRUPT_POLICY] = { "EVENTS_GET_INTERRUPT_POLICY",
cmd_events_get_interrupt_policy, 0, 0 },
[EVENTS][SET_INTERRUPT_POLICY] = { "EVENTS_SET_INTERRUPT_POLICY",
cmd_events_set_interrupt_policy, 4, IMMEDIATE_CONFIG_CHANGE },
};

void cxl_process_mailbox(CXLDeviceState *cxl_dstate)
{
Expand Down

0 comments on commit 57c02b3

Please sign in to comment.