mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
hw/cxl/device: Implement basic mailbox (8.2.8.4)
This is the beginning of implementing mailbox support for CXL 2.0 devices. The implementation recognizes when the doorbell is rung, handles the command/payload, clears the doorbell while returning error codes and data. Generally the mailbox mechanism is designed to permit communication between the host OS and the firmware running on the device. For our purposes, we emulate both the firmware, implemented primarily in cxl-mailbox-utils.c, and the hardware. No commands are implemented yet. 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-7-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
6364adacdf
commit
464e14ac43
5 changed files with 307 additions and 2 deletions
|
@ -14,4 +14,7 @@
|
|||
#include "cxl_component.h"
|
||||
#include "cxl_device.h"
|
||||
|
||||
#define CXL_COMPONENT_REG_BAR_IDX 0
|
||||
#define CXL_DEVICE_REG_BAR_IDX 2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -90,7 +90,21 @@ typedef struct cxl_device_state {
|
|||
};
|
||||
|
||||
/* mmio for the mailbox registers 8.2.8.4 */
|
||||
MemoryRegion mailbox;
|
||||
struct {
|
||||
MemoryRegion mailbox;
|
||||
uint16_t payload_size;
|
||||
union {
|
||||
uint8_t mbox_reg_state[CXL_MAILBOX_REGISTERS_LENGTH];
|
||||
uint16_t mbox_reg_state16[CXL_MAILBOX_REGISTERS_LENGTH / 2];
|
||||
uint32_t mbox_reg_state32[CXL_MAILBOX_REGISTERS_LENGTH / 4];
|
||||
uint64_t mbox_reg_state64[CXL_MAILBOX_REGISTERS_LENGTH / 8];
|
||||
};
|
||||
struct cel_log {
|
||||
uint16_t opcode;
|
||||
uint16_t effect;
|
||||
} cel_log[1 << 16];
|
||||
size_t cel_size;
|
||||
};
|
||||
|
||||
/* memory region for persistent memory, HDM */
|
||||
uint64_t pmem_size;
|
||||
|
@ -140,6 +154,9 @@ CXL_DEVICE_CAPABILITY_HEADER_REGISTER(DEVICE_STATUS, CXL_DEVICE_CAP_HDR1_OFFSET)
|
|||
CXL_DEVICE_CAPABILITY_HEADER_REGISTER(MAILBOX, CXL_DEVICE_CAP_HDR1_OFFSET + \
|
||||
CXL_DEVICE_CAP_REG_SIZE)
|
||||
|
||||
int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate);
|
||||
void cxl_process_mailbox(CXLDeviceState *cxl_dstate);
|
||||
|
||||
#define cxl_device_cap_init(dstate, reg, cap_id) \
|
||||
do { \
|
||||
uint32_t *cap_hdrs = dstate->caps_reg_state32; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue