From nobody Tue Nov 26 20:21:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1705418071; cv=none; d=zohomail.com; s=zohoarc; b=hpDXDpt7bbv+6ok8rveiUNsdjKHj2WMooNtiB5WyEilr/xeKL8e76e7lW+aDXRNtQGILN8vQgmBIM55j16qqYPHQHdVuH9NHFtGG263yLebKuQi3mMHKstY7Ua+0G/WglyZSuMiL3+aKF89SQx9ucG2YzQN4odpYVImCzzCVqLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705418071; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=Lyk6QQmr4+f48XXsn9e/gGz8ajxtDEBuGo1mBRWlXr0=; b=EKaBpivze10oA3yzCZMb3nYDzm5Zmu/NfVvfS6DVTVGbifipS6AavboNKHXc5Ryobs/xp4nRMqes2JKl5qdl66RP7i5I6BEvDQus8miCv6DLOz0T+IVQOmQHlk77LSbLnknhk09+qVyyPKSB7OcfRd0Kh4uDZptJTR0QJGQGUsw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705418071238155.08766201984292; Tue, 16 Jan 2024 07:14:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPl7E-0006br-Az; Tue, 16 Jan 2024 10:12:36 -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 1rPl7C-0006ad-QH for qemu-devel@nongnu.org; Tue, 16 Jan 2024 10:12:34 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPl79-0005pG-IK for qemu-devel@nongnu.org; Tue, 16 Jan 2024 10:12:34 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-337b71a0240so558992f8f.0 for ; Tue, 16 Jan 2024 07:12:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id m14-20020adff38e000000b003379b549a00sm10091357wro.10.2024.01.16.07.12.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 07:12:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705417950; x=1706022750; 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=Lyk6QQmr4+f48XXsn9e/gGz8ajxtDEBuGo1mBRWlXr0=; b=jHlL0ADA9jMSCFpOT/EZDnQ82XI2MHM4XmY8rNoZJsNfpT4ZBQP6aU3P+ikBe9nIr3 DNP3xBVYPbgu56VvGf+lMvpwibf67F+aKDWREPJOnoAHHMb1wVzwHnKD53eQhPk8llIZ ZrNcAwXwxcrmVI8gqfeis2ZM+GrxsMHg19uKg/yiik73W9/Fb14DW5oJ+Ex5I3pRp/12 +ds4UP4VoBDe/bJGKexCoem2OWQhNYeUJjGd3V6sJiPebMCEdOdyOtcvhjh8R/eDtPfC MynyB+ScfH7U78r1tHDf4eSpW4CVSsR1RklaQOXIyCEPB2CR8dUipz95SmbEOs/Miy6R o4CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705417950; x=1706022750; 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=Lyk6QQmr4+f48XXsn9e/gGz8ajxtDEBuGo1mBRWlXr0=; b=UzH5bkkIIEfr0+TVt2dGGWXLgNBIlE12v7zVU44ig5RHiqhdKrgO/cqORCiudjh1Sj SQIPXHavQV47om6YigOlqUwDbsrkE19JSASKHVgKZf8uDtfKVNvX6FqbrUnEwf0YcFNI k1RuASRf8KixSJmoGfadlc5XhT3CdgnvzP+dEJCm2SMgvnDz/N895FR7GV9Nh45yZuqE VFFY1v+S5lRk+3xG+lFpr1wKf5IxIxfbVa1uUIIH+U1y86hbKoWGDmMQGWRiKjrUPqnA C4KSHS8Ls7dbiNQhD8SXhjeuy3aQE8t8CESDs0SVcomp3HLvo6DqB+nhN+8gCskmZSy4 LvDg== X-Gm-Message-State: AOJu0YyhzBbDeIKh557JHAJ0jB6IlIg1UjHZ9h4eMoAzw7RDDk5yExXh XqS9ru64y7iZQIKXXfqV4rkTar3hPEVoFLpZE453DhxlFC8= X-Google-Smtp-Source: AGHT+IHGBiGv8/WCIahKglytkKEuRbWCvhZFP6xPLsnnU9l8X2XKk2y4TjBD7oRSUKbKbdMzQVv8wg== X-Received: by 2002:a05:6000:1145:b0:336:7051:8400 with SMTP id d5-20020a056000114500b0033670518400mr4245059wrx.23.1705417950081; Tue, 16 Jan 2024 07:12:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/21] target/arm: arm_pamax() no longer needs to do feature propagation Date: Tue, 16 Jan 2024 15:12:09 +0000 Message-Id: <20240116151228.2430754-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240116151228.2430754-1-peter.maydell@linaro.org> References: <20240116151228.2430754-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1705418073039100011 Content-Type: text/plain; charset="utf-8" In arm_pamax(), we need to cope with the virt board calling this function on a CPU object which has been inited but not realize. We used to do propagation of feature-flag implications (such as "V7VE implies LPAE") at realize, so we have some code in arm_pamax() which manually checks for both V7VE and LPAE feature flags. In commit b8f7959f28c4f36 we moved the feature propagation for almost all features from realize to post-init. That means that now when the virt board calls arm_pamax(), the feature propagation has been done. So we can drop the manual propagation handling and check only for the feature we actually care about, which is ARM_FEATURE_LPAE. Retain the comment that the virt board is calling this function with a not completely realized CPU object, because that is a potential beartrap for later changes which is worth calling out. (Note that b8f7959f28c4f36 actually fixed a bug in the arm_pamax() handling: arm_pamax() was missing a check for ARM_FEATURE_V8, so it incorrectly thought that the qemu-system-arm 'max' CPU did not have LPAE and turned off 'highmem' support in the virt board. Following b8f7959f28c4f36 qemu-system-arm 'max' is treated the same as 'cortex-a15' and other v7 LPAE CPUs, because the generic feature propagation code does correctly propagate V8 -> V7VE -> LPAE.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240109143804.1118307-1-peter.maydell@linaro.org --- target/arm/ptw.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 2d4fa8dbcaf..5eb3577bcd5 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -95,7 +95,10 @@ static const uint8_t pamax_map[] =3D { [6] =3D 52, }; =20 -/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */ +/* + * The cpu-specific constant value of PAMax; also used by hw/arm/virt. + * Note that machvirt_init calls this on a CPU that is inited but not real= ized! + */ unsigned int arm_pamax(ARMCPU *cpu) { if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { @@ -110,13 +113,8 @@ unsigned int arm_pamax(ARMCPU *cpu) return pamax_map[parange]; } =20 - /* - * In machvirt_init, we call arm_pamax on a cpu that is not fully - * initialized, so we can't rely on the propagation done in realize. - */ - if (arm_feature(&cpu->env, ARM_FEATURE_LPAE) || - arm_feature(&cpu->env, ARM_FEATURE_V7VE)) { - /* v7 with LPAE */ + if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) { + /* v7 or v8 with LPAE */ return 40; } /* Anything else */ --=20 2.34.1