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 <d...@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


Reply via email to