From patchwork Tue Nov 21 10:24:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 745693 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1793348wrt; Tue, 21 Nov 2023 02:26:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IF80ZapA7dWGtmxnXZvRdAop3p9x1JFNurfoc2ebFwLgcmSsvHrOzwyrq3XiJZoqItXMMEw X-Received: by 2002:a25:2083:0:b0:da0:95c0:d157 with SMTP id g125-20020a252083000000b00da095c0d157mr6722805ybg.51.1700562403589; Tue, 21 Nov 2023 02:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700562403; cv=none; d=google.com; s=arc-20160816; b=TDClAQFSzvUR03hDVkOy+5KlpnajJDXojXb6Sded6C8rfJxAYRdEqsE8jr5PYYNgjY p5qKjgn22S6+KkVRxX7y3+PKeGoeccN6iGZGGpp96SPMMU4cE7QageOluQgjL5IfD4Kh hCzcImp0AXJKtfbT675/GsoiToL6WDKQkqKZsyh5In3CIAnpg/TSeBiMCCDXFXObMb6y Hqz6j2jHNJeiMvff365r2O5Q5DhGvX0dQMBgtmX4sG1A6bGeDoIHg7uf0qPSXcbwTORv q5NZu4yrpZP90NVK2K2JeSXpBMZOvCjWoXA/kUSGCjoWnIwb+WfyWA7hNyw6aqkIkfWg qygA== 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=aWov8zdztLe0Jlc/lkRlL/DlbtZzkn3RPI3Q2gppqQQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=fDggR0DUc0c5dcFUlKStPCR0vLjTLpj9qPjjU776G5pAZ0JgOjJMrELXfOXH0BJRVw iObqeyoTkNjFVuQvSJJ5X6eLgzd69pqKTGcAKPLN8dR52k4bISyY+k9wEnmJgsFCkJ9u bnOV0mR9wCBkRY0qxfi/auNGeiTe+tWVBnZD50S4KU3ZA8EQmnqGL6ZJ88SwfV0IcOqG A74qVLYdS5OJnPweByWGJU1l32V8VNbryTn80o/iKGvbwlEmTdnE+t3jnc+pyhIRutBa 4TGgVIOJedOwe0E0qTOHWIT1dR0Z2hK+zF5xEQIU+jcuOuQ7mK3A1G+GB3yd+91r0D8I NUxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZysZ6Hr; 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 h17-20020a05620a13f100b0076cd9307ac1si8586909qkl.548.2023.11.21.02.26.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 02:26:43 -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=vZysZ6Hr; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5Nw2-0004It-AW; Tue, 21 Nov 2023 05:24:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5Nw0-0004Hs-UZ for qemu-devel@nongnu.org; Tue, 21 Nov 2023 05:24:48 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Nvy-0007EY-Ab for qemu-devel@nongnu.org; Tue, 21 Nov 2023 05:24:48 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-507b9408c61so7320261e87.0 for ; Tue, 21 Nov 2023 02:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700562284; x=1701167084; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=aWov8zdztLe0Jlc/lkRlL/DlbtZzkn3RPI3Q2gppqQQ=; b=vZysZ6HrwMn5/R4nwXCKDzQVbVLIsu3F3zzyP0Y1QUVWfMo5XP1sNMA+/US9/rMAVW pCOKRwpleOyT/0DSh0fKt3hyyhLIWFgd8oGqKjr923fBxT8r+rNNaXs+khduK1nAE2S0 Q+DTi8Ws8+w+GUlyoJqJL95kJKeTTiQTFM4MiwEKmhRRCj1KdnLPfhYVh/Lp1/mbchaG anjvLxCxfF7Hzv1ng1LaNxNuaLPwTmOfwkKuBL2Ey5LJkxMgGnNXwTMrIUD3tOHgSX0C GNLSz9ec8n82PjZSFftWaMS53HkKgMVtcdZ+cq7Y9FsiXDnwIQMTr1MYQaknrxzj/bsz b5+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700562284; x=1701167084; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aWov8zdztLe0Jlc/lkRlL/DlbtZzkn3RPI3Q2gppqQQ=; b=FdAdVWFRLrzKyKLLcIMkbIs7gGtOy5jeKAlyUi+WU5WaFKCRQeH6/jg3kKGDNdT2Qi cSUAJCfw9IW+Q9p2cLAiUlz8GlWKXn6vHEecoqgpP3CHyAW0w9wM5ImjqXupIJys29FZ kOVxWHqlyPtOmxMGvgggJrBbk+dEjuG5vBUqrAQnR8lUhdcr6f55mZAavqVFE/55vupG YwSfFaDbM2bVQMkkamXjx7omo4XYiwD63wHokz4ClG7ipRiGOlu6qh+JMiDKbHV2NEcL 7u2fb80gZVzVKCnDJtyxwvKtp2mpQ2IOHv3IJ9g0y6SfB35C3IZaG3leICP1IDp9x8Rl YXzw== X-Gm-Message-State: AOJu0YxWCkbN1tdhhm+Jzze2JqWuqfR1ycvsBlSWNbcISebllLccHOQI D5waAYS6mte3WRr8XCaUSpm1ez2WRgEwpgj6+RE= X-Received: by 2002:a19:6747:0:b0:508:12f5:f808 with SMTP id e7-20020a196747000000b0050812f5f808mr7156884lfj.57.1700562284445; Tue, 21 Nov 2023 02:24:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id n25-20020a05600c181900b00405442edc69sm20450835wmp.14.2023.11.21.02.24.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:24:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/8] hw/intc/arm_gicv3: ICC_PMR_EL1 high bits should be RAZ Date: Tue, 21 Nov 2023 10:24:35 +0000 Message-Id: <20231121102441.3872902-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121102441.3872902-1-peter.maydell@linaro.org> References: <20231121102441.3872902-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x136.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ben Dooks The ICC_PMR_ELx and ICV_PMR_ELx bit masks returned from ic{c,v}_fullprio_mask should technically also remove any bit above 7 as these are marked reserved (read 0) and should therefore should not be written as anything other than 0. This was noted during a run of a proprietary test system and discused on the mailing list [1] and initially thought not to be an issue due to RES0 being technically allowed to be written to and read back as long as the implementation does not use the RES0 bits. It is very possible that the values are used in comparison without masking, as pointed out by Peter in [2], if (cs->hppi.prio >= cs->icc_pmr_el1) may well do the wrong thing. Masking these values in ic{c,v}_fullprio_mask() should fix this and prevent any future problems with playing with the values. [1]: https://lists.nongnu.org/archive/html/qemu-arm/2023-11/msg00607.html [2]: https://lists.nongnu.org/archive/html/qemu-arm/2023-11/msg00737.html Signed-off-by: Ben Dooks Message-id: 20231116172818.792364-1-ben.dooks@codethink.co.uk Suggested-by: Peter Maydell Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_cpuif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index d07b13eb270..ab1a00508e6 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -146,7 +146,7 @@ static uint32_t icv_fullprio_mask(GICv3CPUState *cs) * with the group priority, whose mask depends on the value of VBPR * for the interrupt group.) */ - return ~0U << (8 - cs->vpribits); + return (~0U << (8 - cs->vpribits)) & 0xff; } static int ich_highest_active_virt_prio(GICv3CPUState *cs) @@ -803,7 +803,7 @@ static uint32_t icc_fullprio_mask(GICv3CPUState *cs) * with the group priority, whose mask depends on the value of BPR * for the interrupt group.) */ - return ~0U << (8 - cs->pribits); + return (~0U << (8 - cs->pribits)) & 0xff; } static inline int icc_min_bpr(GICv3CPUState *cs)