From nobody Wed Apr 16 16:17:57 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1650623648; cv=none; d=zohomail.com; s=zohoarc; b=Ti+n1yTAWzaZy/145Wz4BNb6Yc7QjNDA+GJhJv+pzEtURb0mqBA0bSGjJTZKVO0sl8xp6um0yyprd3Lxox6chlK9fUHeiNlxPoMbOByp/FKqppLqBD0ckOpBQokKgZfkIzJrwFT8K6HjYlYajLIBYkohZqJfQ0u6z0npDxupeAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650623648; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5uD+m1v7OaY8Vt76UhAAZWA6827cTfQzBkx7Ps8s2No=; b=cUN/YF+BzigobEBIFR+wxUwBeDlA1mrcE5187SylUF5um62Xq5ZBMOUj3R3FHdOpwJHTmL5LgvxyebSsUXuIQ9wkQlHK0NFeGn7FEJbZw9nh451jG1+CtVEFul5tcPJMLEbJWCZSwQvjVc46Ul+G9pAdVcSf6+IGHfSy7cfuElU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650623648853472.6466931533989; Fri, 22 Apr 2022 03:34:08 -0700 (PDT) Received: from localhost ([::1]:41824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqc3-0000yk-CF for importer@patchew.org; Fri, 22 Apr 2022 06:34:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9f-0004Eg-6C for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:49 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:34763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9d-0002ah-F1 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:46 -0400 Received: by mail-wr1-x42e.google.com with SMTP id c10so10334541wrb.1 for ; Fri, 22 Apr 2022 03:04:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5uD+m1v7OaY8Vt76UhAAZWA6827cTfQzBkx7Ps8s2No=; b=J9ddXcVxdyYgoyQintDV4POXii7agiIKzE+ReamVH9m9COd3zGDyGBCbcptb6Vtzl1 696/BAFlN7Zi2ViRv9SfYdn9lHv3o0d+JdYectPdr9GIREVAbAxzei/VH2OLoYyEoTQE KaKlUUPvycfOZpBhyf6zdFU30XdJtTgD6bzd+MQc3ZidERPs3Att8SdGDqnxt0WqJMlt eEsxQxPu3fzfqKrgQmklKvJqL4V5hQ8DfGgAArs163d1b4HhaBvvARCcuuxcpr4remUH kQR5E4NasQ9VzBWtSscJSM6nYl1+aFNoN7Qa4eAC0P+l2xmTRQlJvQfyWZu79nZqnp/r LYSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5uD+m1v7OaY8Vt76UhAAZWA6827cTfQzBkx7Ps8s2No=; b=LmTwJ7UjTIj3zmGo2ITt+ytxYXq4t6gFbT4ZCekg7YgYi0dMxzxq9q5JVVqpaY4oeo UGZwNN31Wzvev2OZJxxxOXZBzG1eqz4XgQi4/7fs3pVYOcsAHy20G4tgPujoS3kp64B0 LI0350tJXZgbiHCJT/90dD4le8zZ3IH/kaWZCn5GNGw4BdFQr9i5ZM712qDjxn4jVpPn vPhOkf1yiO2g9fAecW0PyK5pgVVtjnjLsBkJcqTByQQFbPRWj2dhji9ExkKFsv22+o1m qjJcYAVl0lTYDn50NYhZKCOy6FYkQkK0nET8WZjAMklbQkCJKgdcyffHPFTAPIitlCA0 wxdw== X-Gm-Message-State: AOAM5327Pn4RA0ugiCLod7W8ovhbK/s7HwxfVLIKQ6wglGTkLbiIxLDj yozB7/BtGWrK93qYD3NaG6CpxlsxCV9STg== X-Google-Smtp-Source: ABdhPJz0x9i5HECqVF3/aPi7uLwlT6iE+pbn4SnPd5rCSLkLBxw3BsCWZOH5Tc31H6QvcTyZij7/sg== X-Received: by 2002:a5d:48ce:0:b0:20a:bb9b:62a3 with SMTP id p14-20020a5d48ce000000b0020abb9b62a3mr3050360wrs.307.1650621883994; Fri, 22 Apr 2022 03:04:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/61] hw/intc/arm_gicv3_its: Distinguish success and error cases of CMD_CONTINUE Date: Fri, 22 Apr 2022 11:03:41 +0100 Message-Id: <20220422100432.2288247-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1650623650399100001 Content-Type: text/plain; charset="utf-8" In the ItsCmdResult enum, we currently distinguish only CMD_STALL (failure, stall processing of the command queue) and CMD_CONTINUE (keep processing the queue), and we use the latter both for "there was a parameter error, go on to the next command" and "the command succeeded, go on to the next command". Sometimes we would like to distinguish those two cases, so add CMD_CONTINUE_OK to the enum to represent the success situation, and use it in the relevant places. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-11-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 880bc6f647c..179a9b032c2 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -78,11 +78,13 @@ typedef struct VTEntry { * and continue processing. * The process_* functions which handle individual ITS commands all * return an ItsCmdResult which tells process_cmdq() whether it should - * stall or keep going. + * stall, keep going because of an error, or keep going because the + * command was a success. */ typedef enum ItsCmdResult { CMD_STALL =3D 0, CMD_CONTINUE =3D 1, + CMD_CONTINUE_OK =3D 2, } ItsCmdResult; =20 /* True if the ITS supports the GICv4 virtual LPI feature */ @@ -400,9 +402,9 @@ static ItsCmdResult do_process_its_cmd(GICv3ITSState *s= , uint32_t devid, ITEntry ite =3D {}; /* remove mapping from interrupt translation table */ ite.valid =3D false; - return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STA= LL; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_= STALL; } - return CMD_CONTINUE; + return CMD_CONTINUE_OK; } =20 static ItsCmdResult process_its_cmd(GICv3ITSState *s, const uint64_t *cmdp= kt, @@ -495,7 +497,7 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, con= st uint64_t *cmdpkt, ite.icid =3D icid; ite.doorbell =3D INTID_SPURIOUS; ite.vpeid =3D 0; - return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STAL= L; } =20 static ItsCmdResult process_vmapti(GICv3ITSState *s, const uint64_t *cmdpk= t, @@ -574,7 +576,7 @@ static ItsCmdResult process_vmapti(GICv3ITSState *s, co= nst uint64_t *cmdpkt, ite.icid =3D 0; ite.doorbell =3D doorbell; ite.vpeid =3D vpeid; - return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STAL= L; } =20 /* @@ -635,7 +637,7 @@ static ItsCmdResult process_mapc(GICv3ITSState *s, cons= t uint64_t *cmdpkt) return CMD_CONTINUE; } =20 - return update_cte(s, icid, &cte) ? CMD_CONTINUE : CMD_STALL; + return update_cte(s, icid, &cte) ? CMD_CONTINUE_OK : CMD_STALL; } =20 /* @@ -696,7 +698,7 @@ static ItsCmdResult process_mapd(GICv3ITSState *s, cons= t uint64_t *cmdpkt) return CMD_CONTINUE; } =20 - return update_dte(s, devid, &dte) ? CMD_CONTINUE : CMD_STALL; + return update_dte(s, devid, &dte) ? CMD_CONTINUE_OK : CMD_STALL; } =20 static ItsCmdResult process_movall(GICv3ITSState *s, const uint64_t *cmdpk= t) @@ -725,13 +727,13 @@ static ItsCmdResult process_movall(GICv3ITSState *s, = const uint64_t *cmdpkt) =20 if (rd1 =3D=3D rd2) { /* Move to same target must succeed as a no-op */ - return CMD_CONTINUE; + return CMD_CONTINUE_OK; } =20 /* Move all pending LPIs from redistributor 1 to redistributor 2 */ gicv3_redist_movall_lpis(&s->gicv3->cpu[rd1], &s->gicv3->cpu[rd2]); =20 - return CMD_CONTINUE; + return CMD_CONTINUE_OK; } =20 static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) @@ -845,7 +847,7 @@ static ItsCmdResult process_movi(GICv3ITSState *s, cons= t uint64_t *cmdpkt) =20 /* Update the ICID field in the interrupt translation table entry */ old_ite.icid =3D new_icid; - return update_ite(s, eventid, &dte, &old_ite) ? CMD_CONTINUE : CMD_STA= LL; + return update_ite(s, eventid, &dte, &old_ite) ? CMD_CONTINUE_OK : CMD_= STALL; } =20 /* @@ -924,7 +926,7 @@ static ItsCmdResult process_vmapp(GICv3ITSState *s, con= st uint64_t *cmdpkt) return CMD_CONTINUE; } =20 - return update_vte(s, vpeid, &vte) ? CMD_CONTINUE : CMD_STALL; + return update_vte(s, vpeid, &vte) ? CMD_CONTINUE_OK : CMD_STALL; } =20 /* @@ -963,7 +965,7 @@ static void process_cmdq(GICv3ITSState *s) } =20 while (wr_offset !=3D rd_offset) { - ItsCmdResult result =3D CMD_CONTINUE; + ItsCmdResult result =3D CMD_CONTINUE_OK; void *hostmem; hwaddr buflen; uint64_t cmdpkt[GITS_CMDQ_ENTRY_WORDS]; @@ -1055,7 +1057,8 @@ static void process_cmdq(GICv3ITSState *s) trace_gicv3_its_cmd_unknown(cmd); break; } - if (result =3D=3D CMD_CONTINUE) { + if (result !=3D CMD_STALL) { + /* CMD_CONTINUE or CMD_CONTINUE_OK */ rd_offset++; rd_offset %=3D s->cq.num_entries; s->creadr =3D FIELD_DP64(s->creadr, GITS_CREADR, OFFSET, rd_of= fset); --=20 2.25.1