qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: fan <nifan.cxl@gmail.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: qemu-devel@nongnu.org, linux-cxl@vger.kernel.org,
	"Fan Ni" <fan.ni@samsung.com>, "Michael Tsirkin" <mst@redhat.com>,
	"Davidlohr Bueso" <dave@stgolabs.net>,
	linuxarm@huawei.com, "Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH 4/5] hw/cxl: Update mailbox status registers.
Date: Wed, 24 Jan 2024 10:57:00 -0800	[thread overview]
Message-ID: <ZbFdfOiWTkTggRSp@debian> (raw)
In-Reply-To: <20240124134814.8717-5-Jonathan.Cameron@huawei.com>

On Wed, Jan 24, 2024 at 01:48:13PM +0000, Jonathan Cameron wrote:
> Whilst the reported version was 1 so there should be no changes,
> a couple of fields (where the value 0 was valid) were not
> defined. Make those explicit and update references to be based
> on CXL r3.1.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-by: Fan Ni <fan.ni@samsung.com>

> ---
>  include/hw/cxl/cxl_device.h | 17 ++++++++++-------
>  hw/cxl/cxl-device-utils.c   |  6 +++++-
>  2 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
> index 31d2afcd3d..9f51c586d7 100644
> --- a/include/hw/cxl/cxl_device.h
> +++ b/include/hw/cxl/cxl_device.h
> @@ -189,7 +189,7 @@ typedef struct cxl_device_state {
>          };
>      };
>  
> -    /* mmio for the mailbox registers 8.2.8.4 */
> +    /* CXL r3.1 Section 8.2.8.4: Mailbox Registers */
>      struct {
>          MemoryRegion mailbox;
>          uint16_t payload_size;
> @@ -310,39 +310,42 @@ void cxl_initialize_t3_ld_cci(CXLCCI *cci, DeviceState *d,
>  REG64(CXL_DEV_EVENT_STATUS, 0)
>      FIELD(CXL_DEV_EVENT_STATUS, EVENT_STATUS, 0, 32)
>  
> -/* CXL 2.0 8.2.8.4.3 Mailbox Capabilities Register */
> +#define CXL_DEV_MAILBOX_VERSION 1
> +/* CXL r3.1 Section 8.2.8.4.3: Mailbox Capabilities Register */
>  REG32(CXL_DEV_MAILBOX_CAP, 0)
>      FIELD(CXL_DEV_MAILBOX_CAP, PAYLOAD_SIZE, 0, 5)
>      FIELD(CXL_DEV_MAILBOX_CAP, INT_CAP, 5, 1)
>      FIELD(CXL_DEV_MAILBOX_CAP, BG_INT_CAP, 6, 1)
>      FIELD(CXL_DEV_MAILBOX_CAP, MSI_N, 7, 4)
> +    FIELD(CXL_DEV_MAILBOX_CAP, MBOX_READY_TIME, 11, 8)
> +    FIELD(CXL_DEV_MAILBOX_CAP, TYPE, 19, 4)
>  
> -/* CXL 2.0 8.2.8.4.4 Mailbox Control Register */
> +/* CXL r3.1 Section 8.2.8.4.4: Mailbox Control Register */
>  REG32(CXL_DEV_MAILBOX_CTRL, 4)
>      FIELD(CXL_DEV_MAILBOX_CTRL, DOORBELL, 0, 1)
>      FIELD(CXL_DEV_MAILBOX_CTRL, INT_EN, 1, 1)
>      FIELD(CXL_DEV_MAILBOX_CTRL, BG_INT_EN, 2, 1)
>  
> -/* CXL 2.0 8.2.8.4.5 Command Register */
> +/* CXL r3.1 Section 8.2.8.4.5: Command Register */
>  REG64(CXL_DEV_MAILBOX_CMD, 8)
>      FIELD(CXL_DEV_MAILBOX_CMD, COMMAND, 0, 8)
>      FIELD(CXL_DEV_MAILBOX_CMD, COMMAND_SET, 8, 8)
>      FIELD(CXL_DEV_MAILBOX_CMD, LENGTH, 16, 20)
>  
> -/* CXL 2.0 8.2.8.4.6 Mailbox Status Register */
> +/* CXL r3.1 Section 8.2.8.4.6: Mailbox Status Register */
>  REG64(CXL_DEV_MAILBOX_STS, 0x10)
>      FIELD(CXL_DEV_MAILBOX_STS, BG_OP, 0, 1)
>      FIELD(CXL_DEV_MAILBOX_STS, ERRNO, 32, 16)
>      FIELD(CXL_DEV_MAILBOX_STS, VENDOR_ERRNO, 48, 16)
>  
> -/* CXL 2.0 8.2.8.4.7 Background Command Status Register */
> +/* CXL r3.1 Section 8.2.8.4.7: Background Command Status Register */
>  REG64(CXL_DEV_BG_CMD_STS, 0x18)
>      FIELD(CXL_DEV_BG_CMD_STS, OP, 0, 16)
>      FIELD(CXL_DEV_BG_CMD_STS, PERCENTAGE_COMP, 16, 7)
>      FIELD(CXL_DEV_BG_CMD_STS, RET_CODE, 32, 16)
>      FIELD(CXL_DEV_BG_CMD_STS, VENDOR_RET_CODE, 48, 16)
>  
> -/* CXL 2.0 8.2.8.4.8 Command Payload Registers */
> +/* CXL r3.1 Section 8.2.8.4.8: Command Payload Registers */
>  REG32(CXL_DEV_CMD_PAYLOAD, 0x20)
>  
>  REG64(CXL_MEM_DEV_STS, 0)
> diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c
> index 40b619ffd9..9df8738f86 100644
> --- a/hw/cxl/cxl-device-utils.c
> +++ b/hw/cxl/cxl-device-utils.c
> @@ -366,6 +366,10 @@ static void mailbox_reg_init_common(CXLDeviceState *cxl_dstate)
>      ARRAY_FIELD_DP32(cxl_dstate->mbox_reg_state32, CXL_DEV_MAILBOX_CAP,
>                       MSI_N, msi_n);
>      cxl_dstate->mbox_msi_n = msi_n;
> +    ARRAY_FIELD_DP32(cxl_dstate->mbox_reg_state32, CXL_DEV_MAILBOX_CAP,
> +                     MBOX_READY_TIME, 0); /* Not reported */
> +    ARRAY_FIELD_DP32(cxl_dstate->mbox_reg_state32, CXL_DEV_MAILBOX_CAP,
> +                     TYPE, 0); /* Inferred from class code */
>  }
>  
>  static void memdev_reg_init_common(CXLDeviceState *cxl_dstate)
> @@ -392,7 +396,7 @@ void cxl_device_register_init_t3(CXLType3Dev *ct3d)
>      cxl_device_cap_init(cxl_dstate, DEVICE_STATUS, 1, 2);
>      device_reg_init_common(cxl_dstate);
>  
> -    cxl_device_cap_init(cxl_dstate, MAILBOX, 2, 1);
> +    cxl_device_cap_init(cxl_dstate, MAILBOX, 2, CXL_DEV_MAILBOX_VERSION);
>      mailbox_reg_init_common(cxl_dstate);
>  
>      cxl_device_cap_init(cxl_dstate, MEMORY_DEVICE, 0x4000, 1);
> -- 
> 2.39.2
> 


  reply	other threads:[~2024-01-24 18:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 13:48 [PATCH 0/5 qemu] hw/cxl: Update CXL emulation to reflect and reference r3.1 Jonathan Cameron via
2024-01-24 13:48 ` [PATCH 1/5] hw/cxl: Update HDM Decoder capability to version 3 Jonathan Cameron via
2024-01-24 18:08   ` fan
2024-01-24 13:48 ` [PATCH 2/5] hw/cxl: Update link register definitions Jonathan Cameron via
2024-01-24 18:20   ` fan
2024-01-24 13:48 ` [PATCH 3/5] hw/cxl: Update RAS Capability Definitions for version 3 Jonathan Cameron via
2024-01-24 18:26   ` fan
2024-01-24 13:48 ` [PATCH 4/5] hw/cxl: Update mailbox status registers Jonathan Cameron via
2024-01-24 18:57   ` fan [this message]
2024-01-24 13:48 ` [PATCH 5/5] hw/cxl: Standardize all references on CXL r3.1 and minor updates Jonathan Cameron via
2024-01-24 20:58   ` fan
2024-01-26 11:43     ` Jonathan Cameron via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZbFdfOiWTkTggRSp@debian \
    --to=nifan.cxl@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).