From patchwork Thu Jan 20 12:36:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 533571 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp20432imr; Thu, 20 Jan 2022 09:51:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwI2bFDgpqqb1QQxKkpzcDFcynjJ5Y8qWaXnYgUqUjrMSXIuCsYqKdhwwarAC24+1DnEqid X-Received: by 2002:a05:620a:294f:: with SMTP id n15mr8330473qkp.724.1642701117310; Thu, 20 Jan 2022 09:51:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642701117; cv=none; d=google.com; s=arc-20160816; b=0pS3FH+jTJFYs4hO8JA2yxd8UWeaB7YuzVUfXXxDjTz6z5fcT82CwPHI9J2W0qVOec KVE47EP86wVEJjsFVXZTXmqa4Pt87afKOUL2vs4pykEtgkbHmg0fhrWm0P7SwIpKpCm1 bn+eJHS+fySkPansQ+ps/DDEZvL4AYd1DjMiAIyPA4wBOEyaOVKfpyJjSCh8f1jbgBt2 xVdL2TlulWCtVL5b828c+Af7yrYRyRqyA8dsybBgkRk15KWVsJzC3mg6NtVr+hRiYWbt DQGm/T++9jbpDLxlQgokpEwJh5MP8gbI1HgkqZVqgFYCuoLNel8+tz6tHUrFPmhik8Vx 64SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=F6954rTHJ8xpie6E7k7U5LhBPA4KgY3cvkEkknSMetU=; b=YfvsV5FJZXNw+aRsH8wOlJ3jmm51FXlm1EtX8Y7ScQY/5IBV4q5kba5fYHNWwDZWPa 1jEnmdXdY2vReZzXCbuafCO66dpa3Nv9AiLNQ1ge6J2vV23GXF7KFgmllBUUkQZbzMxu pKV8WyYwQc/l5hXQxcABM32GQSafI4UjMBgMrfrorTawjgesocLcRefu3HGlK1Upp2EQ ncprL/V+9uM+I6Gae9WahcN/mf59nKsMkCjnOY0FkOP9/HKf9pDkzhMyg1QmTJ4MU/VK nA/PEvUbFOXeg7s+DQinTeJOuZdPDAfJB48oUFwziw5LnXnlYXULXNrhtdZtbecglmep b9DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GgBPbZdG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a189si47001ywf.569.2022.01.20.09.51.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jan 2022 09:51:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GgBPbZdG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAbbI-00014I-Hs for patch@linaro.org; Thu, 20 Jan 2022 12:51:56 -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) 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-Received: by 2002:a5d:61d2:: with SMTP id q18mr727613wrv.547.1642682224153; 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) 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 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::329 (failed) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée 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 = address_space_ldq_le(as, s->cq.base_addr + cq_offset, MEMTXATTRS_UNSPECIFIED, &res); if (res != MEMTX_OK) { - result = false; + s->creadr = 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 = (data & CMD_MASK); switch (cmd) {