* [PATCH -qemu] hw/cxl: Use runtime for bg cmd running semantics
@ 2025-06-17 21:48 Davidlohr Bueso
2025-06-23 14:05 ` Jonathan Cameron via
0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2025-06-17 21:48 UTC (permalink / raw)
To: Jonathan.Cameron, fan.ni
Cc: ravis.opensrc, ajay.opensrc, dave, qemu-devel, linux-cxl
The current check incorrectly misses the 0% case, which semantically
can either be not running or one that just started. The runtime
is a better way to check for 0%, 100% or aborted. This is currently
benign in the kernel equivalent without cancel support.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
Applies against 'cxl-2025-06-10' from jic23 tree.
hw/cxl/cxl-device-utils.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c
index e150d7445762..add0ab615976 100644
--- a/hw/cxl/cxl-device-utils.c
+++ b/hw/cxl/cxl-device-utils.c
@@ -95,13 +95,10 @@ static uint64_t mailbox_reg_read(void *opaque, hwaddr offset, unsigned size)
}
if (offset == A_CXL_DEV_MAILBOX_STS) {
uint64_t status_reg = cxl_dstate->mbox_reg_state64[offset / size];
- int bgop;
qemu_mutex_lock(&cci->bg.lock);
- bgop = !(cci->bg.complete_pct == 100 || cci->bg.aborted);
-
status_reg = FIELD_DP64(status_reg, CXL_DEV_MAILBOX_STS, BG_OP,
- bgop);
+ !!cci->bg.runtime);
cxl_dstate->mbox_reg_state64[offset / size] = status_reg;
qemu_mutex_unlock(&cci->bg.lock);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -qemu] hw/cxl: Use runtime for bg cmd running semantics
2025-06-17 21:48 [PATCH -qemu] hw/cxl: Use runtime for bg cmd running semantics Davidlohr Bueso
@ 2025-06-23 14:05 ` Jonathan Cameron via
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron via @ 2025-06-23 14:05 UTC (permalink / raw)
To: Davidlohr Bueso
Cc: fan.ni, ravis.opensrc, ajay.opensrc, qemu-devel, linux-cxl
On Tue, 17 Jun 2025 14:48:32 -0700
Davidlohr Bueso <dave@stgolabs.net> wrote:
> The current check incorrectly misses the 0% case, which semantically
> can either be not running or one that just started. The runtime
> is a better way to check for 0%, 100% or aborted. This is currently
> benign in the kernel equivalent without cancel support.
>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Looks good to me. I'll carry this on my local tree for now and combine
it with some other fixes to send to MST.
Probably push out a new cxl staging tree sometime in next few weeks.
> ---
>
> Applies against 'cxl-2025-06-10' from jic23 tree.
>
> hw/cxl/cxl-device-utils.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c
> index e150d7445762..add0ab615976 100644
> --- a/hw/cxl/cxl-device-utils.c
> +++ b/hw/cxl/cxl-device-utils.c
> @@ -95,13 +95,10 @@ static uint64_t mailbox_reg_read(void *opaque, hwaddr offset, unsigned size)
> }
> if (offset == A_CXL_DEV_MAILBOX_STS) {
> uint64_t status_reg = cxl_dstate->mbox_reg_state64[offset / size];
> - int bgop;
>
> qemu_mutex_lock(&cci->bg.lock);
> - bgop = !(cci->bg.complete_pct == 100 || cci->bg.aborted);
> -
> status_reg = FIELD_DP64(status_reg, CXL_DEV_MAILBOX_STS, BG_OP,
> - bgop);
> + !!cci->bg.runtime);
> cxl_dstate->mbox_reg_state64[offset / size] = status_reg;
> qemu_mutex_unlock(&cci->bg.lock);
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-23 14:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 21:48 [PATCH -qemu] hw/cxl: Use runtime for bg cmd running semantics Davidlohr Bueso
2025-06-23 14:05 ` Jonathan Cameron via
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).