From patchwork Thu Jan 11 11:04:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 761812 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2336766wrz; Thu, 11 Jan 2024 03:08:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTOJBVMzsOBRqBuxVirkl+EqQAbCbSNKutMZiSWQE0BsWjc4IyDyOAUBtgnACPmHQQm0Ke X-Received: by 2002:a05:6214:2aa5:b0:681:231d:eb73 with SMTP id js5-20020a0562142aa500b00681231deb73mr802660qvb.43.1704971330688; Thu, 11 Jan 2024 03:08:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704971330; cv=none; d=google.com; s=arc-20160816; b=KVTXVCAgvSGvZniU2GKMJibuAvYUyjp2MKn1A3quOaiXl0fjaU85Ww6ZYbvg2A5Q8O 6p90wMbR0rCoor7ytPNGPPpDxam7/9VrBmQ9lAL+GurLgy0T+NmX774UeU3oX0vZRlIJ S+ZErNCrFYT5TkqZ8bh4yTbDWx+lK/C/AmVLwxRa3XGSelvBjKWRbSqMgnzqeJb1W8n3 pnBBdVC3Ma9hzIe5d/Dd9Z4asaRJ/FeOWckxGJZyf0NKZ261JtGixSjP6MyuQlmMEglc 3wsIinjMsft8RfptpRcmfTohuz4emvvbwDoLHaKGXjcUIDj2hl9q57T8MiscNnuWZZLb UWjQ== 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=n1Q0rBlTI4KTEcEVYGkY0PBLOWaSrPIhGDZkzdWHU84=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=aLIEcybwABThxeZhw0RT3g6gKrPKMURKzoY63upex8j+WBLg+5mBnj0LF3UhnQ2XuD DlMJPaYIGtUH7zCNn+TF4UpVnKCIpS51PpAigpO0E3SFV7w9l4KKlZ6ZCjCZnn7h6+9o o8KNR+MgvYFFpgLwH0LMDscQovNV+4aUtt6rafLiMzL18nasolliSzI0lx/dx2niHEfl NiBVls2hposO2bkXcuaFC53xDzTmnpfxBO1QQtcmfXwioDy/LM+DxE7RO1+uXBvFIrXo l1TjiPiw7Sr7sZ3o/45+VJ3GwQDwgd2Pu3io+v4byREQiSoAOcQVqjbR6RaD1OMDIwkU vZKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lGTuMJfg; 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 j16-20020a0cf310000000b0067fd61f5a96si564257qvl.256.2024.01.11.03.08.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Jan 2024 03:08:50 -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=lGTuMJfg; 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 1rNsse-0001Yz-85; Thu, 11 Jan 2024 06:05:48 -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 1rNssC-0001Nz-IS for qemu-devel@nongnu.org; Thu, 11 Jan 2024 06:05:25 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNssA-0004Sa-TJ for qemu-devel@nongnu.org; Thu, 11 Jan 2024 06:05:20 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2cd7e429429so17883681fa.1 for ; Thu, 11 Jan 2024 03:05:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704971117; x=1705575917; 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=n1Q0rBlTI4KTEcEVYGkY0PBLOWaSrPIhGDZkzdWHU84=; b=lGTuMJfgedwizsAFf6wAW82Yt2d1uEa/UIBcP47QGKDH2esH1CwvE2zJ8o90tav3gL HpP0/v8Q5m3pnOHGw9aiSrAq9hR5DOCzBrUfSX9FeHrM278fwV+bMnKyn7RZTG4cHkrT Bs2UZpFNBEiMm/yHTMuG0map5xjwx9i1znQjpZ+mkA0VD6LH6VRnHMRtPh9OcZGtWN62 fT5VrnJgEF/16ioXOy2C2CmA9Sso6MMtBTHAoARJOICvWiC5xlWlvYT4FTYW+ipwlIi0 Qtm2VP1eWwN4/sOB/Pocb8nH8YOtLcR0rl4u33qT+NUtEa7rQLaJyEvyoi8Lfq7G/ZuX 9uGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704971117; x=1705575917; 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=n1Q0rBlTI4KTEcEVYGkY0PBLOWaSrPIhGDZkzdWHU84=; b=uCAiiyrzqF1oViQVFFlkXEd0GMExcIq8+gNQMkphf7BWqwtPkq+4q8l3ON/kyylJ56 7mLsLHIy2ehigDwwH13LcqjmmWVt5yQ7ZSo+TMRk3BtAskh5i0xB68nUOZ/tWGLi/tk4 Sh+cu85Ewwe4qSu1h9zkoJFJhE8evAYbFBznvweI9rHBu5jhdcLppbbhrV8Ja/LxXeyW ZikhEP7la+sEC04oQGc+m+msALbsOrVZkKllzmE5OelE1mFrPU/x/71ZoBSCDiT/egST CpkMoT8tlVBPxMtcpb57WQvA7xkh3tIOkjSVFPCRyYNZx+kQMrlXXoYXqO4tcW/cBf8T aKxg== X-Gm-Message-State: AOJu0Yz2uwwWqiNwaAZuo8ptsqsx1rpLULeJ7/knuqZWkZFK4sN49BnQ b3jduhC97F2JKKfWgaa9Juf+Lv9AE2wkshgQg+4T+IWjoCA= X-Received: by 2002:a2e:7a01:0:b0:2cc:2025:5bd5 with SMTP id v1-20020a2e7a01000000b002cc20255bd5mr290988ljc.51.1704971117059; Thu, 11 Jan 2024 03:05:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v30-20020adf8b5e000000b0033690139ea5sm951323wra.44.2024.01.11.03.05.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 03:05:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/41] target/arm: Don't honour PSTATE.PAN when HCR_EL2.{NV, NV1} == {1, 1} Date: Thu, 11 Jan 2024 11:04:48 +0000 Message-Id: <20240111110505.1563291-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240111110505.1563291-1-peter.maydell@linaro.org> References: <20240111110505.1563291-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22e.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 For FEAT_NV, when HCR_EL2.{NV,NV1} is {1,1} PAN is always disabled even when the PSTATE.PAN bit is set. Implement this by having arm_pan_enabled() return false in this situation. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Miguel Luis --- target/arm/helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 1db2effb1c0..24751e05b24 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -266,6 +266,9 @@ void init_cpreg_list(ARMCPU *cpu) static bool arm_pan_enabled(CPUARMState *env) { if (is_a64(env)) { + if ((arm_hcr_el2_eff(env) & (HCR_NV | HCR_NV1)) == (HCR_NV | HCR_NV1)) { + return false; + } return env->pstate & PSTATE_PAN; } else { return env->uncached_cpsr & CPSR_PAN;