[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 06/42] hw/cxl/device: Implement basic mailbox (8.2.8.4)
From: |
Alex Bennée |
Subject: |
Re: [PATCH v4 06/42] hw/cxl/device: Implement basic mailbox (8.2.8.4) |
Date: |
Thu, 27 Jan 2022 11:31:16 +0000 |
User-agent: |
mu4e 1.7.6; emacs 28.0.91 |
Jonathan Cameron <Jonathan.Cameron@huawei.com> writes:
> From: Ben Widawsky <ben.widawsky@intel.com>
>
> 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.
>
<snip>
> +
> +#define define_mailbox_handler(name) \
> + static ret_code cmd_##name(struct cxl_cmd *cmd, \
> + CXLDeviceState *cxl_dstate, uint16_t *len)
> +#define declare_mailbox_handler(name) define_mailbox_handler(name)
> +
> +#define define_mailbox_handler_zeroed(name, size) \
> + uint16_t __zero##name = size; \
> + static ret_code cmd_##name(struct cxl_cmd *cmd, \
> + CXLDeviceState *cxl_dstate, uint16_t *len) \
> + { \
> + *len = __zero##name; \
> + memset(cmd->payload, 0, *len); \
> + return CXL_MBOX_SUCCESS; \
> + }
> +#define define_mailbox_handler_const(name, data) \
> + static ret_code cmd_##name(struct cxl_cmd *cmd, \
> + CXLDeviceState *cxl_dstate, uint16_t *len) \
> + { \
> + *len = sizeof(data); \
> + memcpy(cmd->payload, data, *len); \
> + return CXL_MBOX_SUCCESS; \
> + }
> +#define define_mailbox_handler_nop(name) \
> + static ret_code cmd_##name(struct cxl_cmd *cmd, \
> + CXLDeviceState *cxl_dstate, uint16_t *len) \
> + { \
> + return CXL_MBOX_SUCCESS; \
> + }
I missed these #define's - can you upcase them to make it clear they are
macros when used.
--
Alex Bennée
- [PATCH v4 04/42] hw/cxl/device: Introduce a CXL device (8.2.8), (continued)
- [PATCH v4 06/42] hw/cxl/device: Implement basic mailbox (8.2.8.4), Jonathan Cameron, 2022/01/24
- [PATCH v4 08/42] hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1), Jonathan Cameron, 2022/01/24
- [PATCH v4 07/42] hw/cxl/device: Add memory device utilities, Jonathan Cameron, 2022/01/24
- [PATCH v4 09/42] hw/cxl/device: Timestamp implementation (8.2.9.3), Jonathan Cameron, 2022/01/24
- [PATCH v4 10/42] hw/cxl/device: Add log commands (8.2.9.4) + CEL, Jonathan Cameron, 2022/01/24