From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <ajay.opensrc@micron.com>, <fan.ni@samsung.com>,
<john@jagalactic.com>, <emirakhur@micron.com>,
<ajayjoshi@micron.com>, <sthanneeru@micron.com>,
<ravis.opensrc@micron.com>, <arramesh@micron.com>,
<tmmulgund@micron.com>, <linux-cxl@vger.kernel.org>,
<qemu-devel@nongnu.org>
Subject: Re: [PATCH] hw/cxl: Support aborting background commands
Date: Tue, 22 Oct 2024 18:00:30 +0100 [thread overview]
Message-ID: <20241022180030.00004f68@Huawei.com> (raw)
In-Reply-To: <jdipjanthgt6atlksngodxjevfb5d43d5rshtxqxxwruszqa3e@vctljs77lg4e>
On Mon, 21 Oct 2024 20:23:46 -0700
Davidlohr Bueso <dave@stgolabs.net> wrote:
> On Tue, 27 Aug 2024, Jonathan Cameron wrote:\n
> >No comments inline and LGTM. I'll queue it on my tree and push
> >that out on gitlab sometime soonish.
>
> I don't see this picked up, which is a good thing atm. While testing
> the kernel side, I noticed the following is needed, will send a v2
> with it folded in.
Currently just on my cxl-2024-10-15 branch of gitlab.com/jic23/qemu.
I'll pick up your v2 and replace that.
>
> diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c
> index 1a9779ed8201..0d429b59aafc 100644
> --- a/hw/cxl/cxl-device-utils.c
> +++ b/hw/cxl/cxl-device-utils.c
> @@ -94,14 +94,15 @@ static uint64_t mailbox_reg_read(void *opaque, hwaddr offset, unsigned size)
> cxl_dstate->mbox_reg_state64[offset / size] = bg_status_reg;
> }
> if (offset == A_CXL_DEV_MAILBOX_STS) {
> + int bgop;
> uint64_t status_reg = cxl_dstate->mbox_reg_state64[offset / size];
>
> qemu_mutex_lock(&cci->bg.lock);
> - if (cci->bg.complete_pct == 100 || cci->bg.aborted) {
> - status_reg = FIELD_DP64(status_reg, CXL_DEV_MAILBOX_STS, BG_OP,
> - 0);
> - cxl_dstate->mbox_reg_state64[offset / size] = status_reg;
> - }
> + bgop = !(cci->bg.complete_pct == 100 || cci->bg.aborted);
> +
> + status_reg = FIELD_DP64(status_reg, CXL_DEV_MAILBOX_STS, BG_OP,
> + bgop);
> + cxl_dstate->mbox_reg_state64[offset / size] = status_reg;
> qemu_mutex_unlock(&cci->bg.lock);
> }
> return cxl_dstate->mbox_reg_state64[offset / size];
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index d5b084388288..760a8571fda6 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -2731,9 +2731,11 @@ static const struct cxl_cmd cxl_cmd_set[256][256] = {
> [FIRMWARE_UPDATE][GET_INFO] = { "FIRMWARE_UPDATE_GET_INFO",
> cmd_firmware_update_get_info, 0, 0 },
> [FIRMWARE_UPDATE][TRANSFER] = { "FIRMWARE_UPDATE_TRANSFER",
> - cmd_firmware_update_transfer, ~0, CXL_MBOX_BACKGROUND_OPERATION },
> + cmd_firmware_update_transfer, ~0,
> + CXL_MBOX_BACKGROUND_OPERATION | CXL_MBOX_BACKGROUND_OPERATION_ABORT },
> [FIRMWARE_UPDATE][ACTIVATE] = { "FIRMWARE_UPDATE_ACTIVATE",
> - cmd_firmware_update_activate, 2, CXL_MBOX_BACKGROUND_OPERATION },
> + cmd_firmware_update_activate, 2,
> + CXL_MBOX_BACKGROUND_OPERATION | CXL_MBOX_BACKGROUND_OPERATION_ABORT },
> [TIMESTAMP][GET] = { "TIMESTAMP_GET", cmd_timestamp_get, 0, 0 },
> [TIMESTAMP][SET] = { "TIMESTAMP_SET", cmd_timestamp_set,
> 8, CXL_MBOX_IMMEDIATE_POLICY_CHANGE },
>
> Thanks,
> Davidlohr
next prev parent reply other threads:[~2024-10-22 17:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240813221255.179200-1-dave@stgolabs.net>
2024-08-27 15:33 ` [PATCH] hw/cxl: Support aborting background commands Jonathan Cameron via
2024-10-22 3:23 ` Davidlohr Bueso
2024-10-22 17:00 ` Jonathan Cameron via [this message]
2025-02-03 15:07 ` Jonathan Cameron via
2025-02-05 4:47 ` Davidlohr Bueso
2025-02-05 17:24 ` 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=20241022180030.00004f68@Huawei.com \
--to=qemu-devel@nongnu.org \
--cc=Jonathan.Cameron@Huawei.com \
--cc=ajay.opensrc@micron.com \
--cc=ajayjoshi@micron.com \
--cc=arramesh@micron.com \
--cc=dave@stgolabs.net \
--cc=emirakhur@micron.com \
--cc=fan.ni@samsung.com \
--cc=john@jagalactic.com \
--cc=linux-cxl@vger.kernel.org \
--cc=ravis.opensrc@micron.com \
--cc=sthanneeru@micron.com \
--cc=tmmulgund@micron.com \
/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).