From patchwork Fri Jan 7 17:21:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 530478 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp564141imp; Fri, 7 Jan 2022 09:28:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6uUnjFEOqyc/aybOt8T+TYNqu2e59S2dKEzAe7y9jNduUtp8PwBIcW5sGC87h+R7dXAj4 X-Received: by 2002:a25:5546:: with SMTP id j67mr44644489ybb.676.1641576499407; Fri, 07 Jan 2022 09:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641576499; cv=none; d=google.com; s=arc-20160816; b=Awd0votsHM+7QEo+F13YgWMfouPqNfEACR4TC1aDr4eUfbQI9ocrKlIgiGsQmll6z0 kTTPpBLE6jibsa82N6MUtnZ4WaaFmYqip35Ihq44vloTuiGwI0arnek25Lj+2nN9ggh3 79o3UalzIRuTfh6tn+Ssq/EXWOCzyp1jS5Kz9pNQ/oxE7PqIxLMZtT7E3OYutjAwk1QG X7T8/1Drb/1cdQYHEIAhyVTCAjKJDme8XURX7AQN6eY6SzaX14SVOct0qe4vAL1mHSNE mcfIz5p4ex3ppaHTSApYj8LZuD/wJM9DtYdew/1nme3e2XlCqjGwehy6PIPTLouHwjje 7J5Q== 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=WhfaxipphljaQnFFNp/teaFMbHkOrGbHBKmTsnpAR9A=; b=ndG0IrKnI+jWVQTdiaWs5+b6GdDpHYQIvtKQqkfhx0zOm3uz9ZONS1nCI0ZLB9e5vt Yo9Sdx/E7TC+xfnfiXLuiNpQEKEEJX5FECdGkHJXodWrV9/DM5zefrYSySnYVs5eWl/M 4m6DhtdQLhf0lQJWPJLhsQ6YXJMOwt5Tb0IRDVPwqy6A0ZDxE41Vz9NT7SwBzgDZDM1k 9/T3Rm3Lni22A5gCGBpDiPJE4hOgVLAMOcAuXV42v1xsNqqn1t++1ACoCLb/pk+3umJs LjcAUyZHE/q+jSXNR237WRO7vcv2L2qssV9V+9q7SiMUWcJfTDUjpScWsp/ZON7hLT27 OBww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O5k6e+Zh; 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 x33si4567236ybd.55.2022.01.07.09.28.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 09:28:19 -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=O5k6e+Zh; 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]:49564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t2I-0003r8-Sm for patch@linaro.org; Fri, 07 Jan 2022 12:28:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw2-00055i-To for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:51 -0500 Received: from [2a00:1450:4864:20::330] (port=44639 helo=mail-wm1-x330.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw1-0007so-GN for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:50 -0500 Received: by mail-wm1-x330.google.com with SMTP id f189-20020a1c1fc6000000b00347ac5ccf6cso1248123wmf.3 for ; Fri, 07 Jan 2022 09:21:49 -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=WhfaxipphljaQnFFNp/teaFMbHkOrGbHBKmTsnpAR9A=; b=O5k6e+ZhI8o59lQNrXtW/0xGbzGn8TCz8UaW85rPlLKb6LJx7jdVu0BJCwGsGDpf4+ EhJ+pcqFtKkitlrDpk+BAPWhmM/lC6rRVeLoI5DMTyEDcJaXhCtK8X/HOGgrAKM1zB2P XLdW3lX20n/qelMvfZMZhpc/Djf4kArrWhTqTh4rDSYJdlcuN0z1yVEVf1DWc053dUB/ MtglYdRULQKI5qPhDd8M26JwJt3hSlo8QXYHfLvr+/98SWutn5lcLwzhTzBKqcAJOE6I niwn9qOejRAdLl2hJ3moQLZjZ1AvkhjV/n08EDDGavA2LQoMjewiHjqBhYSWNjp5ejOT wpkA== 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=WhfaxipphljaQnFFNp/teaFMbHkOrGbHBKmTsnpAR9A=; b=VulAei6qoTip/Kz0GjSr6+E/udxqysxsFeb6d+lQFhZL70rzSeLzswMiXk9o7uYebp BLLsoMFuZsByFrRySiY+1ppx6dQGiGPfcxro1H3Ul6J9y3CVg+AOyyHEp9y/oi6j573M b5Pj9PbYNkQHPHi7IYyWKv+VxwSfFlzQmXTjfUMCzD+5KOUhF/pjVkS0DTswdrrzLzho ker7nkdm3h2XO4X8UmrxFSJl0ViXB16t0yIefZzDkEqHWQvrh1TsCffFDWM9PFoJ5I/j mYx3FeqEv/MDaFFI2FVbpAuwqjC+GfPPkIxLN8iRHw4crrYD29RhZ5+1jw9+0rq9Lo67 F20A== X-Gm-Message-State: AOAM530Q6t63/tVra6f5N4hW4V6nKduHiZxUgH64Q27fRcXDf8UD1Fpf zUs1awqQRmm+8Pvh/8RHpW2tFdS3FzipDg== X-Received: by 2002:a1c:4b10:: with SMTP id y16mr11280698wma.185.1641576108290; Fri, 07 Jan 2022 09:21:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/19] hw/intc/arm_gicv3_its: Don't return early in extract_table_params() loop Date: Fri, 7 Jan 2022 17:21:29 +0000 Message-Id: <20220107172142.2651911-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::330 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: , 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: Alex Bennée Reviewed-by: Richard Henderson --- 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;