From patchwork Thu Feb 15 17:35:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 772921 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp953775wre; Thu, 15 Feb 2024 09:38:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWCDqRsg7yvC8bp/YrPwa7qUa01t8xOPdJBuc1jXYUHhyKgKqxiBR3Bl7Kwm5T/TQsQdvrh67zUFf8KakuyZwfa X-Google-Smtp-Source: AGHT+IE11OZ33Rr+m890aa/wvs2B6moy5xuKxLVC66nmDLgd9Qz/f1GL5J+eNbbAOwQkO9D4sB2L X-Received: by 2002:a0c:f58b:0:b0:68f:6be:9f94 with SMTP id k11-20020a0cf58b000000b0068f06be9f94mr2191597qvm.12.1708018681093; Thu, 15 Feb 2024 09:38:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708018681; cv=none; d=google.com; s=arc-20160816; b=TRGjakDeTxbsPY7+hefBnfQfIgQTbhcGR9aa/VPJZ1v5eWfTOwSG5PtdKNbjaGOmIR OQAMI4/LEsO6Q8trl6hqlGbW0GGaC+m9SU+DHB8JQd/737N7PTjPbTy5ZKa/tFQEuEC7 eRpTGe7/daPaiChywosW5iQLh/cIoNs0xOqr6EAQoBlsd5b0evwR52aIXslwcv+SspOI nxEZ64EbUc5BAU3Sy2fAPiE0NtZQc8/NdTnX1+1r+LOVqGoiu5bQmoS/IQCWYXSll5nA iIpRxkKnnIVvJneX2PDZqaypucAR3Q0ufCvZlZduu6py9mQDT9C6UaeRHrsijNUM7afE 0/BA== 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=a87RueZW0PDoF8ZbDKzC++JXSZcqUh/P88llxuBUZWg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=PPgk0HqBTUtYRDYKD5v7AHeAyKDeOdLtYAFmJq6oy7KkPCtBcQNrnVaMpO+ZZGsYpz 1D0ScIGTJoj0mdI1hxObS/qT8Qxu8fcJMUadm1nzZmlXPSyu0N+QbQ3FNo/N3suJ9DSF yzVtslN1tbE7FxOwp/w/Mj6OfoFTBRQLnk4Ec+Z52dk/q2hbOSk2ijRHMlaPhfF30CeQ 6Hd63lHovkPbu1UR4VOgANAW5vfZ7IIXrEzW68osYNlaErckkLZZ7AcM1Jkdl+4PbSch XDD/1q5kMJdGOLtH5sKw3JMdGlisewwkv4NoJmmYQfURkvx2pktwPiJVqlSQqPrwfgoR 8dvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ozuj3CX/"; 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 kj10-20020a056214528a00b0068f1df7ce4fsi1204887qvb.588.2024.02.15.09.38.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 09:38:01 -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="Ozuj3CX/"; 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 1rafew-0000XT-M3; Thu, 15 Feb 2024 12:36:30 -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 1rafeO-00082N-LT for qemu-devel@nongnu.org; Thu, 15 Feb 2024 12:35:56 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rafeI-0003zZ-Vv for qemu-devel@nongnu.org; Thu, 15 Feb 2024 12:35:56 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-411fc50e4e9so8887515e9.0 for ; Thu, 15 Feb 2024 09:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708018549; x=1708623349; 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=a87RueZW0PDoF8ZbDKzC++JXSZcqUh/P88llxuBUZWg=; b=Ozuj3CX/NQEyoDK4hhAPjRQjIZFNr0I9tHnbQOYCJ7xh0x9FmUqCwR0b/ji6bn09Zv TuX6bZ5dQOHGwnPjX8HIxawKDV5oxQ0tgrtfeTW++bNai31x5judqVeIxOdvaJrDL1vp Zmuqg8fUYHFJt7c5gyR+Wwjn0J2n7qUjjel3z5iXRKoVgu68y681VJWX+I8GVkM352h6 27CSUDcHGH913UeThciNOsU5P2D/Q2JQv0KqbGTeBlqB3E1Vnjh1p02zgATxHrNeb3J/ ZrwPkaT2lJwaHwjKVaC1GlC9ez6SfNxqrXjG9wf8gUs1Ocr8gQcWWkftQPMpu+GWgAdr onSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708018549; x=1708623349; 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=a87RueZW0PDoF8ZbDKzC++JXSZcqUh/P88llxuBUZWg=; b=N23GGUI8ci2qyTPW6GJdQClf9sEj/A2QkhK7gmSqTya17czGVQk6gXjOVGRBMwem2v tvVnmUoHeM0rxf4U/CjLuAPzWzUo+1TGdbEcLQlMugWkgRs2Qg0ydQniJ7BA+j2lcPua 3LtX57duMzcxGn0P1ljQDZkbrT7Pha5+Klw7KNJn5j9seXIDtOKhXtU85lttS6X6lRpq rXMqEJAlk8SB+EbBg3RKzXgWK/ar2Y27Dc5JQ6eh2i1WsybgyLejiS8IDoS0SmXO84Gk jf02VJUGuuQUCQfGjmyntDUn3Rja+v8X5OGjMDF2/gFU0ovo0X+flhtSTReHLi3TokKK VTkQ== X-Gm-Message-State: AOJu0Yy47C+hpP1PrOpBfAdxBiazdsTIetHOmGQiZh0pIxnpjvxa0LAS Gv//LfI/TPaF6x7cdumTWLP8J8JpCV3J12tTrm4WI58QFSCxEtl8jdzmbhiorx/UWCWRQ3Q3pIN Q X-Received: by 2002:a05:600c:198e:b0:412:adb:504b with SMTP id t14-20020a05600c198e00b004120adb504bmr2343067wmq.11.1708018549583; Thu, 15 Feb 2024 09:35:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q16-20020adfea10000000b0033cfa00e497sm2384129wrm.64.2024.02.15.09.35.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:35:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/35] target/arm: Use new CBAR encoding for all v8 CPUs, not all aarch64 CPUs Date: Thu, 15 Feb 2024 17:35:26 +0000 Message-Id: <20240215173538.2430599-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215173538.2430599-1-peter.maydell@linaro.org> References: <20240215173538.2430599-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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 We support two different encodings for the AArch32 IMPDEF CBAR register -- older cores like the Cortex A9, A7, A15 have this at 4, c15, c0, 0; newer cores like the Cortex A35, A53, A57 and A72 have it at 1 c15 c0 0. When we implemented this we picked which encoding to use based on whether the CPU set ARM_FEATURE_AARCH64. However this isn't right for three cases: * the qemu-system-arm 'max' CPU, which is supposed to be a variant on a Cortex-A57; it ought to use the same encoding the A57 does and which the AArch64 'max' exposes to AArch32 guest code * the Cortex-R52, which is AArch32-only but has the CBAR at the newer encoding (and where we incorrectly are not yet setting ARM_FEATURE_CBAR_RO anyway) * any possible future support for other v8 AArch32 only CPUs, or for supporting "boot the CPU into AArch32 mode" on our existing cores like the A57 etc Make the decision of the encoding be based on whether the CPU implements the ARM_FEATURE_V8 flag instead. This changes the behaviour only for the qemu-system-arm '-cpu max'. We don't expect anybody to be relying on the old behaviour because: * it's not what the real hardware Cortex-A57 does (and that's what our ID register claims we are) * we don't implement the memory-mapped GICv3 support which is the only thing that exists at the peripheral base address pointed to by the register Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240206132931.38376-2-peter.maydell@linaro.org --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 7c531ee9cff..90c4fb72ce4 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9528,7 +9528,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) * AArch64 cores we might need to add a specific feature flag * to indicate cores with "flavour 2" CBAR. */ - if (arm_feature(env, ARM_FEATURE_AARCH64)) { + if (arm_feature(env, ARM_FEATURE_V8)) { /* 32 bit view is [31:18] 0...0 [43:32]. */ uint32_t cbar32 = (extract64(cpu->reset_cbar, 18, 14) << 18) | extract64(cpu->reset_cbar, 32, 12);