From nobody Thu Nov 14 07:02:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1689614319; cv=none; d=zohomail.com; s=zohoarc; b=gpbfJFet64MzXz1IgaG9YrIVBkuriftXsbO6wFN/+0+53QJze8+dx/5kQwAbzq+nvowDWiRXfp0oEC0fIGHcLVB0XCVg1tkDqDdWAWz41t+3IC14T/djLA7R3Fi1CBnJnOfkU6yv4G8PvBe+vbUgTVTSgQkSCCMb8YYJVQ5lJVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689614319; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=bgT4P/iBLik8Oj7+TM0oZddmRSINFVNF5lZ5mRyTgLU=; b=E/ZULdHOOxiQQQjAM05c7n5NTHxpsgXJ6cuZaxUpaTt6+yabAgLAvAepT5ZVgPsQpRIMzfO5O4H5+ZXgJW8MZ+hGh93WZgmcPUjpa8EBTAU97L4J7MZtkfrlw6mfjrH/IX1fSkiyMm0CZ/syuHBr1XmF+hKYtx3o3JAc8jJgbEI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168961431922328.090606879155416; Mon, 17 Jul 2023 10:18:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLRri-0007At-Gh; Mon, 17 Jul 2023 13:18:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qLRrY-00077W-9y for qemu-devel@nongnu.org; Mon, 17 Jul 2023 13:18:20 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qLRrW-00047U-1M for qemu-devel@nongnu.org; Mon, 17 Jul 2023 13:18:20 -0400 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4R4TGr5qxfz67k9Y; Tue, 18 Jul 2023 01:15:00 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 17 Jul 2023 18:18:15 +0100 To: , Dan Williams , CC: , Alison Schofield , Ira Weiny , Dave Jiang , Davidlohr Bueso , Viacheslav Dubeyko , Shesha Bhushan Sreenivasamurthy , Fan Ni , Michael Tsirkin , Jonathan Zhang , Klaus Jensen Subject: [RFC PATCH 03/17] cxl/mbox: Pull the payload out of struct cxl_cmd and make instances constant Date: Mon, 17 Jul 2023 18:16:32 +0100 Message-ID: <20230717171646.8972-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230717171646.8972-1-Jonathan.Cameron@huawei.com> References: <20230717171646.8972-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1689614320648100003 Content-Type: text/plain; charset="utf-8" Putting the pointer in the structure for command handling puts a single variable element inside an otherwise constant structure. Move it out as a directly passed variable and take the cxl_cmd structures constant. Signed-off-by: Jonathan Cameron --- include/hw/cxl/cxl_device.h | 6 +- hw/cxl/cxl-mailbox-utils.c | 106 +++++++++++++++++++++--------------- 2 files changed, 65 insertions(+), 47 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index 2c239fca47..f84f6813aa 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -135,14 +135,14 @@ typedef enum { } CXLRetCode; =20 struct cxl_cmd; -typedef CXLRetCode (*opcode_handler)(struct cxl_cmd *cmd, +typedef CXLRetCode (*opcode_handler)(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t = *len); struct cxl_cmd { const char *name; opcode_handler handler; ssize_t in; uint16_t effect; /* Reported in CEL */ - uint8_t *payload; }; =20 typedef struct CXLEvent { @@ -213,7 +213,7 @@ typedef struct cxl_device_state { uint64_t pmem_size; uint64_t vmem_size; =20 - struct cxl_cmd (*cxl_cmd_set)[256]; + const struct cxl_cmd (*cxl_cmd_set)[256]; CPMUState cpmu[CXL_NUM_CPMU_INSTANCES]; CXLEventLog event_logs[CXL_EVENT_TYPE_MAX]; } CXLDeviceState; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index c8feeffbeb..f0d94b9ae4 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -71,7 +71,8 @@ enum { }; =20 =20 -static CXLRetCode cmd_events_get_records(struct cxl_cmd *cmd, +static CXLRetCode cmd_events_get_records(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxlds, uint16_t *len) { @@ -83,9 +84,9 @@ static CXLRetCode cmd_events_get_records(struct cxl_cmd *= cmd, return CXL_MBOX_INVALID_INPUT; } =20 - log_type =3D *((uint8_t *)cmd->payload); + log_type =3D payload[0]; =20 - pl =3D (CXLGetEventPayload *)cmd->payload; + pl =3D (CXLGetEventPayload *)payload; memset(pl, 0, sizeof(*pl)); =20 max_recs =3D (cxlds->payload_size - CXL_EVENT_PAYLOAD_HDR_SIZE) / @@ -97,25 +98,27 @@ static CXLRetCode cmd_events_get_records(struct cxl_cmd= *cmd, return cxl_event_get_records(cxlds, pl, log_type, max_recs, len); } =20 -static CXLRetCode cmd_events_clear_records(struct cxl_cmd *cmd, +static CXLRetCode cmd_events_clear_records(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxlds, uint16_t *len) { CXLClearEventPayload *pl; =20 - pl =3D (CXLClearEventPayload *)cmd->payload; + pl =3D (CXLClearEventPayload *)payload; *len =3D 0; return cxl_event_clear_records(cxlds, pl); } =20 -static CXLRetCode cmd_events_get_interrupt_policy(struct cxl_cmd *cmd, +static CXLRetCode cmd_events_get_interrupt_policy(const struct cxl_cmd *cm= d, + uint8_t *payload, CXLDeviceState *cxlds, uint16_t *len) { CXLEventInterruptPolicy *policy; CXLEventLog *log; =20 - policy =3D (CXLEventInterruptPolicy *)cmd->payload; + policy =3D (CXLEventInterruptPolicy *)payload; memset(policy, 0, sizeof(*policy)); =20 log =3D &cxlds->event_logs[CXL_EVENT_TYPE_INFO]; @@ -148,7 +151,8 @@ static CXLRetCode cmd_events_get_interrupt_policy(struc= t cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static CXLRetCode cmd_events_set_interrupt_policy(struct cxl_cmd *cmd, +static CXLRetCode cmd_events_set_interrupt_policy(const struct cxl_cmd *cm= d, + uint8_t *payload, CXLDeviceState *cxlds, uint16_t *len) { @@ -159,7 +163,7 @@ static CXLRetCode cmd_events_set_interrupt_policy(struc= t cxl_cmd *cmd, return CXL_MBOX_INVALID_PAYLOAD_LENGTH; } =20 - policy =3D (CXLEventInterruptPolicy *)cmd->payload; + policy =3D (CXLEventInterruptPolicy *)payload; =20 log =3D &cxlds->event_logs[CXL_EVENT_TYPE_INFO]; log->irq_enabled =3D (policy->info_settings & CXL_EVENT_INT_MODE_MASK)= =3D=3D @@ -191,7 +195,8 @@ static CXLRetCode cmd_events_set_interrupt_policy(struc= t cxl_cmd *cmd, } =20 /* 8.2.9.2.1 */ -static CXLRetCode cmd_firmware_update_get_info(struct cxl_cmd *cmd, +static CXLRetCode cmd_firmware_update_get_info(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -212,7 +217,7 @@ static CXLRetCode cmd_firmware_update_get_info(struct c= xl_cmd *cmd, return CXL_MBOX_INTERNAL_ERROR; } =20 - fw_info =3D (void *)cmd->payload; + fw_info =3D (void *)payload; memset(fw_info, 0, sizeof(*fw_info)); =20 fw_info->slots_supported =3D 2; @@ -225,27 +230,29 @@ static CXLRetCode cmd_firmware_update_get_info(struct= cxl_cmd *cmd, } =20 /* 8.2.9.3.1 */ -static CXLRetCode cmd_timestamp_get(struct cxl_cmd *cmd, +static CXLRetCode cmd_timestamp_get(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { uint64_t final_time =3D cxl_device_get_timestamp(cxl_dstate); =20 - stq_le_p(cmd->payload, final_time); + stq_le_p(payload, final_time); *len =3D 8; =20 return CXL_MBOX_SUCCESS; } =20 /* 8.2.9.3.2 */ -static CXLRetCode cmd_timestamp_set(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_timestamp_set(const struct cxl_cmd *cmd, + uint8_t *payload, + CXLDeviceState *cxl_dstate, + uint16_t *len) { cxl_dstate->timestamp.set =3D true; cxl_dstate->timestamp.last_set =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUA= L); =20 - cxl_dstate->timestamp.host_set =3D le64_to_cpu(*(uint64_t *)cmd->paylo= ad); + cxl_dstate->timestamp.host_set =3D le64_to_cpu(*(uint64_t *)payload); =20 *len =3D 0; return CXL_MBOX_SUCCESS; @@ -258,7 +265,8 @@ static const QemuUUID cel_uuid =3D { }; =20 /* 8.2.9.4.1 */ -static CXLRetCode cmd_logs_get_supported(struct cxl_cmd *cmd, +static CXLRetCode cmd_logs_get_supported(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -269,7 +277,7 @@ static CXLRetCode cmd_logs_get_supported(struct cxl_cmd= *cmd, QemuUUID uuid; uint32_t size; } log_entries[1]; - } QEMU_PACKED *supported_logs =3D (void *)cmd->payload; + } QEMU_PACKED *supported_logs =3D (void *)payload; QEMU_BUILD_BUG_ON(sizeof(*supported_logs) !=3D 0x1c); =20 supported_logs->entries =3D 1; @@ -281,7 +289,8 @@ static CXLRetCode cmd_logs_get_supported(struct cxl_cmd= *cmd, } =20 /* 8.2.9.4.2 */ -static CXLRetCode cmd_logs_get_log(struct cxl_cmd *cmd, +static CXLRetCode cmd_logs_get_log(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -289,7 +298,9 @@ static CXLRetCode cmd_logs_get_log(struct cxl_cmd *cmd, QemuUUID uuid; uint32_t offset; uint32_t length; - } QEMU_PACKED QEMU_ALIGNED(16) *get_log =3D (void *)cmd->payload; + } QEMU_PACKED QEMU_ALIGNED(16) *get_log; + + get_log =3D (void *)payload; =20 /* * 8.2.9.4.2 @@ -315,14 +326,15 @@ static CXLRetCode cmd_logs_get_log(struct cxl_cmd *cm= d, /* Store off everything to local variables so we can wipe out the payl= oad */ *len =3D get_log->length; =20 - memmove(cmd->payload, cxl_dstate->cel_log + get_log->offset, + memmove(payload, cxl_dstate->cel_log + get_log->offset, get_log->length); =20 return CXL_MBOX_SUCCESS; } =20 /* 8.2.9.5.1.1 */ -static CXLRetCode cmd_identify_memory_device(struct cxl_cmd *cmd, +static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -352,7 +364,7 @@ static CXLRetCode cmd_identify_memory_device(struct cxl= _cmd *cmd, return CXL_MBOX_INTERNAL_ERROR; } =20 - id =3D (void *)cmd->payload; + id =3D (void *)payload; memset(id, 0, sizeof(*id)); =20 snprintf(id->fw_revision, 0x10, "BWFW VERSION %02d", 0); @@ -370,7 +382,8 @@ static CXLRetCode cmd_identify_memory_device(struct cxl= _cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static CXLRetCode cmd_ccls_get_partition_info(struct cxl_cmd *cmd, +static CXLRetCode cmd_ccls_get_partition_info(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -379,7 +392,7 @@ static CXLRetCode cmd_ccls_get_partition_info(struct cx= l_cmd *cmd, uint64_t active_pmem; uint64_t next_vmem; uint64_t next_pmem; - } QEMU_PACKED *part_info =3D (void *)cmd->payload; + } QEMU_PACKED *part_info =3D (void *)payload; QEMU_BUILD_BUG_ON(sizeof(*part_info) !=3D 0x20); =20 if ((!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER))= || @@ -400,7 +413,8 @@ static CXLRetCode cmd_ccls_get_partition_info(struct cx= l_cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static CXLRetCode cmd_ccls_get_lsa(struct cxl_cmd *cmd, +static CXLRetCode cmd_ccls_get_lsa(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -412,7 +426,7 @@ static CXLRetCode cmd_ccls_get_lsa(struct cxl_cmd *cmd, CXLType3Class *cvc =3D CXL_TYPE3_GET_CLASS(ct3d); uint32_t offset, length; =20 - get_lsa =3D (void *)cmd->payload; + get_lsa =3D (void *)payload; offset =3D get_lsa->offset; length =3D get_lsa->length; =20 @@ -425,7 +439,8 @@ static CXLRetCode cmd_ccls_get_lsa(struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static CXLRetCode cmd_ccls_set_lsa(struct cxl_cmd *cmd, +static CXLRetCode cmd_ccls_set_lsa(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -434,7 +449,7 @@ static CXLRetCode cmd_ccls_set_lsa(struct cxl_cmd *cmd, uint32_t rsvd; uint8_t data[]; } QEMU_PACKED; - struct set_lsa_pl *set_lsa_payload =3D (void *)cmd->payload; + struct set_lsa_pl *set_lsa_payload =3D (void *)payload; CXLType3Dev *ct3d =3D container_of(cxl_dstate, CXLType3Dev, cxl_dstate= ); CXLType3Class *cvc =3D CXL_TYPE3_GET_CLASS(ct3d); const size_t hdr_len =3D offsetof(struct set_lsa_pl, data); @@ -460,7 +475,8 @@ static CXLRetCode cmd_ccls_set_lsa(struct cxl_cmd *cmd, * make this stateful. We may want to allow longer poison lists to aid * testing that kernel functionality. */ -static CXLRetCode cmd_media_get_poison_list(struct cxl_cmd *cmd, +static CXLRetCode cmd_media_get_poison_list(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -482,8 +498,8 @@ static CXLRetCode cmd_media_get_poison_list(struct cxl_= cmd *cmd, } QEMU_PACKED records[]; } QEMU_PACKED; =20 - struct get_poison_list_pl *in =3D (void *)cmd->payload; - struct get_poison_list_out_pl *out =3D (void *)cmd->payload; + struct get_poison_list_pl *in =3D (void *)payload; + struct get_poison_list_out_pl *out =3D (void *)payload; CXLType3Dev *ct3d =3D container_of(cxl_dstate, CXLType3Dev, cxl_dstate= ); uint16_t record_count =3D 0, i =3D 0; uint64_t query_start, query_length; @@ -536,7 +552,8 @@ static CXLRetCode cmd_media_get_poison_list(struct cxl_= cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static CXLRetCode cmd_media_inject_poison(struct cxl_cmd *cmd, +static CXLRetCode cmd_media_inject_poison(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len_unused) { @@ -546,7 +563,7 @@ static CXLRetCode cmd_media_inject_poison(struct cxl_cm= d *cmd, struct inject_poison_pl { uint64_t dpa; }; - struct inject_poison_pl *in =3D (void *)cmd->payload; + struct inject_poison_pl *in =3D (void *)payload; uint64_t dpa =3D ldq_le_p(&in->dpa); CXLPoison *p; =20 @@ -575,7 +592,8 @@ static CXLRetCode cmd_media_inject_poison(struct cxl_cm= d *cmd, return CXL_MBOX_SUCCESS; } =20 -static CXLRetCode cmd_media_clear_poison(struct cxl_cmd *cmd, +static CXLRetCode cmd_media_clear_poison(const struct cxl_cmd *cmd, + uint8_t *payload, CXLDeviceState *cxl_dstate, uint16_t *len_unused) { @@ -589,7 +607,7 @@ static CXLRetCode cmd_media_clear_poison(struct cxl_cmd= *cmd, CXLPoison *ent; uint64_t dpa; =20 - struct clear_poison_pl *in =3D (void *)cmd->payload; + struct clear_poison_pl *in =3D (void *)payload; =20 dpa =3D ldq_le_p(&in->dpa); if (dpa + CXL_CACHE_LINE_SIZE > cxl_dstate->mem_size) { @@ -659,7 +677,7 @@ static CXLRetCode cmd_media_clear_poison(struct cxl_cmd= *cmd, #define IMMEDIATE_POLICY_CHANGE (1 << 3) #define IMMEDIATE_LOG_CHANGE (1 << 4) =20 -static struct cxl_cmd cxl_cmd_set[256][256] =3D { +static const struct cxl_cmd cxl_cmd_set[256][256] =3D { [EVENTS][GET_RECORDS] =3D { "EVENTS_GET_RECORDS", cmd_events_get_records, 1, 0 }, [EVENTS][CLEAR_RECORDS] =3D { "EVENTS_CLEAR_RECORDS", @@ -693,21 +711,21 @@ static struct cxl_cmd cxl_cmd_set[256][256] =3D { void cxl_process_mailbox(CXLDeviceState *cxl_dstate) { uint16_t ret =3D CXL_MBOX_SUCCESS; - struct cxl_cmd *cxl_cmd; - uint64_t status_reg; + const struct cxl_cmd *cxl_cmd; + uint64_t status_reg =3D 0; opcode_handler h; uint64_t command_reg =3D cxl_dstate->mbox_reg_state64[R_CXL_DEV_MAILBO= X_CMD]; =20 uint8_t set =3D FIELD_EX64(command_reg, CXL_DEV_MAILBOX_CMD, COMMAND_S= ET); uint8_t cmd =3D FIELD_EX64(command_reg, CXL_DEV_MAILBOX_CMD, COMMAND); uint16_t len =3D FIELD_EX64(command_reg, CXL_DEV_MAILBOX_CMD, LENGTH); + uint8_t *pl =3D cxl_dstate->mbox_reg_state + A_CXL_DEV_CMD_PAYLOAD; + cxl_cmd =3D &cxl_dstate->cxl_cmd_set[set][cmd]; h =3D cxl_cmd->handler; if (h) { if (len =3D=3D cxl_cmd->in || cxl_cmd->in =3D=3D ~0) { - cxl_cmd->payload =3D cxl_dstate->mbox_reg_state + - A_CXL_DEV_CMD_PAYLOAD; - ret =3D (*h)(cxl_cmd, cxl_dstate, &len); + ret =3D (*h)(cxl_cmd, pl, cxl_dstate, &len); assert(len <=3D cxl_dstate->payload_size); } else { ret =3D CXL_MBOX_INVALID_PAYLOAD_LENGTH; @@ -740,7 +758,7 @@ void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate) for (int set =3D 0; set < 256; set++) { for (int cmd =3D 0; cmd < 256; cmd++) { if (cxl_dstate->cxl_cmd_set[set][cmd].handler) { - struct cxl_cmd *c =3D &cxl_dstate->cxl_cmd_set[set][cmd]; + const struct cxl_cmd *c =3D &cxl_dstate->cxl_cmd_set[set][= cmd]; struct cel_log *log =3D &cxl_dstate->cel_log[cxl_dstate->cel_size]; =20 --=20 2.39.2