From patchwork Sat Dec 11 19:11:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 523072 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4098902imb; Sat, 11 Dec 2021 11:18:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqnjgGiZ3S1hEWDqUngsYHID63qvLddzRWrYBXkJcHXSvtzhLQWvmbPGZA3pWO9biOaWE1 X-Received: by 2002:a05:620a:2487:: with SMTP id i7mr25687705qkn.234.1639250303875; Sat, 11 Dec 2021 11:18:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639250303; cv=none; d=google.com; s=arc-20160816; b=m/i+4ZBMmRaohSGs8U8HtB7u4MExPAGFnWnNnjqD46MmaChTkkT85HdoyecAxNACL+ urP4oZHEdPCxPpT6RBdXBvnUPizn9BwbcVImpF3nOWGjNpuGQQuG3LxPMSF0vQ8jifoV yOWWB1y1nsyyS7dK+q8r1HY0zOp8+llBEdruZaYaFZvo3JuR8qETX01I3jR/qFmEDTTN 5UMhwrAynmD1e5CyHp+NeRulm2RxjB8eR7FSH5pey4sjmQaaWI83hyy9/8lVrQd6PIsG /kMUU31ZLalnzl024DKWsSOVZNRPk6eZNw61gXwc3ks7tx/no9yByycyu5uvO42SgMqL pozg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=MLNR1fcnj1CQdExPgAQtQq8Gfk8TpYAkjXC++HyyPjA=; b=IL5SWxDwMgFloGjOwkJ04TjvOWS75m1NlWkZAT6/hRzNiNzZGf1OYkw1SNV4s5lpMj ceS0LFS1SFxCerJ+cMFPLR8PxT4ZN/Sd694dUbV5a16oSADFSI5bVw2fsVCzdO8eKABV lEeL2lAU9Oru/n7OGw2IB5xq9FzQg8UvRJmazUV8B8oCMrJmOAGAWPTD7TlaXpk38Jo3 hgzuZdSy/n12Bw8b0ZUGHTYmZZxRns+3Prs7wpZ3RiU/8nVlnM19KHHvLVJtrF8XfQXd mUFBN+H4IsPz8MMd1p59QkaMw02/haBTX1XDATkIY1h4QmkHT7Y9Gkoc5X+fFeipuEfl qsvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ED4MakYp; 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=fail (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 ey10si8393218qvb.500.2021.12.11.11.18.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Dec 2021 11:18:23 -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=fail header.i=@linaro.org header.s=google header.b=ED4MakYp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mw7t1-00046J-Bo for patch@linaro.org; Sat, 11 Dec 2021 14:18:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw7mc-0004vi-6C for qemu-devel@nongnu.org; Sat, 11 Dec 2021 14:11:46 -0500 Received: from [2a00:1450:4864:20::336] (port=56002 helo=mail-wm1-x336.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mw7ma-0006Cy-A4 for qemu-devel@nongnu.org; Sat, 11 Dec 2021 14:11:45 -0500 Received: by mail-wm1-x336.google.com with SMTP id p18so9147142wmq.5 for ; Sat, 11 Dec 2021 11:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MLNR1fcnj1CQdExPgAQtQq8Gfk8TpYAkjXC++HyyPjA=; b=ED4MakYpiiUS3jWg1EwVlyWsqDYIZdUo5+tHqJukoevqseWJudiFa0mOrTxFDBUxWg PAOGqRszQQ6Wbj6aIdBEwlYm6gKkZE86AK/pzbRsDAzFmyDuVQkpCxKN9ahpKllqZroX jFF6GPCv/E8edgQIJHx+jXo8L63SpJ7oy8SRoxgW/xYOcVNp4YMatp2EPN53z8gl0vrj 53t3TOtyLAOnvuOYb1fdaeM5mDjgJgNesgznO1A6zXxuNJOY7mZ75Yi/BzMfW4BgYQSw BkejFS9vkQL+RXfDXXp0Vx8zaGaGBsCMKUjrG2wRmouk2kP9WdO/dkwH885WGcU1o5le 4pkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MLNR1fcnj1CQdExPgAQtQq8Gfk8TpYAkjXC++HyyPjA=; b=QG13YbJssotEMQCSGobZ5RJ0yFUyjWVciqDeZWLcTUhA4JSXbESS8W7Zsr5G2BqlK1 1Sg8TtGgFvWRPWUDbBJTtxynDi4ebOZLfKqROvGJ9EBt3eLhv3Mhofw2lDPY4ZF/c0n7 SS18l4Vj4LUYwxBkdP4fhCDGMuiR0HYQIeBBPoUATCJtUJzUg0wTieXdQFYau86fqwk8 DTAiDuYjnfB4O+1j9LVcUy5tevok89uVCpwFkXCqE5LR6FgDlrRAmcI2NHlHsm/gSa84 YguGGw+xwqJYT7dsPLTHu2KWvy0pW+s5RWogdesESzz83qK2v20N0r3XT+VCBUdfNaMN L98g== X-Gm-Message-State: AOAM532/EVlxVSYQjHfFHx/pvPaoxkLjt+iMbPNsj8Wpy4yDiJudRp+v MVT97GoBFMciiAnvyh5c5GW+vw== X-Received: by 2002:a05:600c:2c4a:: with SMTP id r10mr26231909wmg.125.1639249902902; Sat, 11 Dec 2021 11:11:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id m20sm2205300wmq.11.2021.12.11.11.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Dec 2021 11:11:42 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 05/26] hw/intc/arm_gicv3_its: Don't return early in extract_table_params() loop Date: Sat, 11 Dec 2021 19:11:14 +0000 Message-Id: <20211211191135.1764649-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211211191135.1764649-1-peter.maydell@linaro.org> References: <20211211191135.1764649-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::336 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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, 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: , Cc: Shashi Mallela , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In extract_table_params() we process each GITS_BASER register. If the register's Valid bit is not set, this means there is no in-guest-memory table and so we should not try to interpret the other fields in the register. This was incorrectly coded as a 'return' rather than a 'break', so instead of looping round to process the next GITS_BASER we would stop entirely, treating any later tables as being not valid also. This has no real guest-visible effects because (since we don't have GITS_TYPER.HCC != 0) the guest must in any case set up all the GITS_BASER to point to valid tables, so this only happens in an odd misbehaving-guest corner case. Fix the check to 'break', so that we leave the case statement and loop back around to the next GITS_BASER. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- I suspect this was an accidental result from a refactoring at some point in the development of the ITS code. --- hw/intc/arm_gicv3_its.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index f321f10189e..c97b9982ae1 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -795,7 +795,7 @@ static void extract_table_params(GICv3ITSState *s) s->dt.valid = FIELD_EX64(value, GITS_BASER, VALID); if (!s->dt.valid) { - return; + break; } s->dt.page_sz = page_sz; @@ -826,7 +826,7 @@ static void extract_table_params(GICv3ITSState *s) * hence writes are discarded if ct.valid is 0 */ if (!s->ct.valid) { - return; + break; } s->ct.page_sz = page_sz;