From nobody Thu Apr 10 04:50:35 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=1642701279; cv=none; d=zohomail.com; s=zohoarc; b=UAudTeeAWA4zNQuqXhxuRHf9A0DArAoHdJfD9Z4NtiUI7I45XOOALVGqup8d0ezdKxeupBE//hVxK50k1HLAK+20O9DgfZ3XudAcMcQ1lQGjVwIj2ZamaYznRkCSwjsBsyrLLmy9xqrFOv4v/k0jXaMignXZDRFLCQ4ttV9VPeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642701279; h=Content-Type: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=F6954rTHJ8xpie6E7k7U5LhBPA4KgY3cvkEkknSMetU=; b=W3Kb/OmXeeUP6+cP6bmovSAymHF/CvRVfJDMuZzWM73bmGTkVQc9b/vtA749KtW30jA6BBi3x0IRfov64D4RADlr/IEi3QNuDHp0aPWeRU1g6NJlDRZ8FzrHo5ezpK22hWVZXgvQScdu56MYdlHyuUgt5Dbcl47cmXYOLcbMrgA= 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 164270127965397.44103184178539; Thu, 20 Jan 2022 09:54:39 -0800 (PST) Received: from localhost ([::1]:53696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAbdu-0003xP-KM for importer@patchew.org; Thu, 20 Jan 2022 12:54:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAWgi-0004JG-M0 for qemu-devel@nongnu.org; Thu, 20 Jan 2022 07:37:14 -0500 Received: from [2a00:1450:4864:20::329] (port=41713 helo=mail-wm1-x329.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAWgb-0003J4-B1 for qemu-devel@nongnu.org; Thu, 20 Jan 2022 07:37:06 -0500 Received: by mail-wm1-x329.google.com with SMTP id q141-20020a1ca793000000b00347b48dfb53so13507346wme.0 for ; Thu, 20 Jan 2022 04:37:04 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t8sm7993324wmq.43.2022.01.20.04.37.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 04:37:03 -0800 (PST) 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=F6954rTHJ8xpie6E7k7U5LhBPA4KgY3cvkEkknSMetU=; b=GgBPbZdGL1w9MjoqFg3tFWq1+g31k8qyzsoEmbwy/+9RZP9/euo02si9zP6amuAadJ aLX722JxbAmAugQ36GzmfMlqMt8muDwzkj6oao8pl1cRStnwLcBJDyuj44jdkHLQdpnZ QhQRZLvmXsBtzV2hTqXIJNQHn5P6v2ote0N1JTpJ9BAixGL7HbYSL2wL/AdxktgfhQgg alfq33GrLBqGRRr75PBl5REb3sV0SZz3WyS64bcwm8SbNJsgxiE0/VYOp3I07hFs9kfq BsHsMC8X9xEC5EwQIOjWUNqx96hTP0wDM1X2BVncY6CsPcjHKoymyn9CR9Ie8IG8yxVA 0krA== 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=F6954rTHJ8xpie6E7k7U5LhBPA4KgY3cvkEkknSMetU=; b=7GDaYtI96VfjErROEAzergTNbK8t8NBSJOVT8wg14I8DiSdQKDChYh9CbyrlrC+LXK ktD6zmSaIS2O0Gl/BjtQQPPtFOBmeAUrRDDJMbPDR3E8mBI+8hx1tIOGAsRC33q+kebP b0Q0eE/pYxMaed8IhG03NFKc22B3JLQHvVes+gHUvXhdBIQGBQ9O2ypRRaPaOymHeJ0I 9BKFWlj3u/ZOEl0WaNkP3pY8TuwOIPwzdswAhUbi2xjXoQtWlMdp13exFLSUAiVmWTzT zPboS9YzaJH4UoHCr5stV2G0NInT1hMVxfQ3E6icW5Hm266Tf9PtBF58fr2GVydwRqGO xLfA== X-Gm-Message-State: AOAM533FIGBjorQQSQAWI0KGSG6r8KHqP1P+YOcCvsEqWXrGeavnCCuT L+XpYSKmmVmc/LpEfyRtltpD1dmCoEMUjQ== X-Google-Smtp-Source: ABdhPJw+d50eJneoDZX2BmHSiISvyhnCJwqa+IC3Io0EVCcJxIztEfg/O24CXiVw38fGSf5IhWQwUQ== X-Received: by 2002:a5d:61d2:: with SMTP id q18mr727613wrv.547.1642682224153; Thu, 20 Jan 2022 04:37:04 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/38] hw/intc/arm_gicv3_its: Don't use data if reading command failed Date: Thu, 20 Jan 2022 12:36:20 +0000 Message-Id: <20220120123630.267975-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220120123630.267975-1-peter.maydell@linaro.org> References: <20220120123630.267975-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::329 (failed) 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::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: 1642701281734100001 In process_cmdq(), we read 64 bits of the command packet, which contain the command identifier, which we then switch() on to dispatch to an appropriate sub-function. However, if address_space_ldq_le() reports a memory transaction failure, we still read the command identifier out of the data and switch() on it. Restructure the code so that we stop immediately (stalling the command queue) in this case. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-id: 20220111171048.3545974-5-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index a6c2299a091..c1f76682d04 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -672,8 +672,13 @@ static void process_cmdq(GICv3ITSState *s) data =3D address_space_ldq_le(as, s->cq.base_addr + cq_offset, MEMTXATTRS_UNSPECIFIED, &res); if (res !=3D MEMTX_OK) { - result =3D false; + s->creadr =3D FIELD_DP64(s->creadr, GITS_CREADR, STALLED, 1); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: could not read command at 0x%" PRIx64 "\n", + __func__, s->cq.base_addr + cq_offset); + break; } + cmd =3D (data & CMD_MASK); =20 switch (cmd) { --=20 2.25.1