From nobody Tue Feb 10 10:07:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) client-ip=209.85.221.43; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f43.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632581547; cv=none; d=zohomail.com; s=zohoarc; b=Em6rCv8Y0SeZf7PskQJmAg/OQ/SRMRIFrPP8oibaUMBmL66HpVD/jOPs/fGJOVKlnkWi/TU1Z4U8VV2HbO/hWEBA40if5rpndYYYKun97TSp6M4V+d2qCpyvXbkgHXqFh40ys5HaU0klhu9W3wD03B5uqmiQlgTt6TIyDvKX75A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632581547; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cb3odcmCuQWoFCXt4iYOTDt5qWlPQnfLAh89ZyyxruA=; b=jbiv/1J5zYw/EA1OUorL+jJVFMcfWP1y6b1QtfWl1GFDTrQvcKXMQpTuKGcbS6Z10DgvsVyF6Qt8MrESvyme/zGC1Jq/wWjUMV8FX6Bt3/3Nlm1yRP4/oqt7SOJ8hTrlKTWkm0CEe3KCm+IwLK146ENcugjIB2aOqXlEFkmVBnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.zohomail.com with SMTPS id 1632581547850927.2711422021168; Sat, 25 Sep 2021 07:52:27 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id d6so36336875wrc.11 for ; Sat, 25 Sep 2021 07:52:27 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y9sm18217307wmj.36.2021.09.25.07.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 07:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cb3odcmCuQWoFCXt4iYOTDt5qWlPQnfLAh89ZyyxruA=; b=DE4w4ld7rRT7nzqPQAZUdpnJI44nhsZM71vrw8kOMxoZ8cl5cWTG7GT3dCZTJQI2Rc uTNuoWGJZ3rXMzIl8yN8R4ECnf7RjByaiQYYsgKXzCkdZ1IyO8sq5++hWSFJl2LmzSx5 oilHTxhb2G4xR2mZ/S+WIZQ1bSSwDMQ7yXdvdfkcyh3caUR8CQDGTzwiFNPlkHEr1YUt D2aUy3mCuVUAG9G6Ui02jmyeq8nqWmINtM29b33AgmjZz7kEEPAe+2wC3C0nmGDnaFvM uIWVu1rQ8A20JNKHZceqigRu++aqgfMAe5nlo8sl7upfZdYpCqHevl98gm+drF1dDk2U tE+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cb3odcmCuQWoFCXt4iYOTDt5qWlPQnfLAh89ZyyxruA=; b=0qGCjeA4bO7isZkOWIEP5RVUrGIHJ8hzh4hyX7FwgBNxDDmRfhhmoJRCoC19Ag36OD JcFFcEDCg9E3+25hDuiUOYma11sJdCDlmPwJsooC9nirDWS5Apmbx06faLnTGsOT6T81 mMeyVQE1CvpHdF6+bZJNz2Sal5QQTiyg1IjYmB4F7bWF2BL7SFQc7uhh3z8iOjwJ/6CS tY6USCs+XNaUvFUtv5N0c8HQkG6sdOUvpu/ZVk3J/1qoCCs6JqjpGfNeVHh51COzWBMV Kt7tLFhkfgvSjoNIb+cFVmb6SaCaogat7wYFAFDKS1r6XdLCG4OM6MhcrSrg1ei9Te+W CBhA== X-Gm-Message-State: AOAM533H3dwvJRHfImvOiADZyT/+X0dNzftqePzEw5edldvtSzkkT/O/ OTZgHUHMWNImh7rL0yDiOto= X-Google-Smtp-Source: ABdhPJy/iQ6OqFZmRhbqPntWlhkYLyd9pw0x7+xi5UREpf7hFJFp9o6UHhlQgrYBYEYq1EkI/VjBhQ== X-Received: by 2002:a5d:59ae:: with SMTP id p14mr17862480wrr.278.1632581546133; Sat, 25 Sep 2021 07:52:26 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini Subject: [PATCH v7 14/40] accel: Simplify cpu_has_work() Date: Sat, 25 Sep 2021 16:50:52 +0200 Message-Id: <20210925145118.1361230-15-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925145118.1361230-1-f4bug@amsat.org> References: <20210925145118.1361230-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632581548547100001 Now that all accelerators implement a has_work() handler, we can simplify cpu_has_work() by removing the non-NULL handler check. Add an assertion in cpus_register_accel() for future accelerators. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- softmmu/cpus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/softmmu/cpus.c b/softmmu/cpus.c index bb16a25bcef..bbb83d5982a 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -251,10 +251,7 @@ void cpu_interrupt(CPUState *cpu, int mask) =20 bool cpu_has_work(CPUState *cpu) { - if (cpus_accel->has_work && cpus_accel->has_work(cpu)) { - return true; - } - return false; + return cpus_accel->has_work(cpu); } =20 static int do_vm_stop(RunState state, bool send_stop) @@ -613,6 +610,7 @@ void cpus_register_accel(const AccelOpsClass *ops) =20 /* Mandatory non-NULL handlers */ assert(ops->create_vcpu_thread !=3D NULL); + assert(ops->has_work !=3D NULL); =20 cpus_accel =3D ops; } --=20 2.31.1