qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [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

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).