From patchwork Wed Mar 2 20:52:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 547534 Delivered-To: patch@linaro.org Received: by 2002:ac0:f585:0:0:0:0:0 with SMTP id s5csp41251imq; Wed, 2 Mar 2022 13:14:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzg59cC2sd6gaBiyHPKR/dybjU6211bWecBTcLyaL6uTFTKfQ2NFeG5o+NTBEVQo4Gia0AU X-Received: by 2002:a25:5187:0:b0:623:e9ba:ba13 with SMTP id f129-20020a255187000000b00623e9baba13mr30908975ybb.311.1646255665257; Wed, 02 Mar 2022 13:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646255665; cv=none; d=google.com; s=arc-20160816; b=NV6R7PwSUHCrV7Z31yAYKTmtoYZNmZ35XWnMVYBcWEKT48xdXzQyE7x6u8E0uHFotW EjnE6RK2jBKmlfAL6OwARrewkncKShW5t8L9BQgZSJlUwNTvEUa8CihbBNPIvqWFLmbO 6Jo9DdotiI4Y7aTWiAdhDoNI0RaQY93ga2E8pMBJLwUAiKj7DcdHqmf5nWSodE5aUXTM /5ZrExPmOf68rxIcWib/ZwFr23j86c0jWnHqFoeetakgfQLGUSAosI4pIdBTKf4LZ/1Q 0K3FAKs5mU8pVmMWVox2tSrsTYBIsiySaAd6agjkUkq2ZVF1XXxFOVDFiugQweS3RHQN brKA== 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=/jMvBmS05a6AvX2w8GLIu2n1iO4O8JPmoPPf/h/6b0c=; b=plMm6hNOg6o2OMru/jJ97FeK9xFPdrukxE0uGwOURNn++0AG8tN5jghXLxZXkIPkEa GAxTOFxceIV56h/Vf/Adr/ScXJ2Ln48ZZDVarLhbwRSMP0E6I0cXiD0KNNT+ZiA7BrlX i8hdyPmj2fZu5OFY+2qpjWXIddEBEG/e4+KXQ4psmeBcKksfYUp8CcTmiUZu6m3ZpbUi 6jn8lIDsaLECF4ZnhaBxXjQO3rcp5j6zo0STqCcAPk9YfJCBVdDffd8P9YyFolEyAIM3 6em+UHxCo+K2maC9cw4bJa8HZgcjWP3dEc/DpMaOm5ShDR5kuKW0cRJdICnc8zlwlTSj 1uAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cl5h83Nw; 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 i4-20020a056902128400b00627d746375fsi67614ybu.477.2022.03.02.13.14.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Mar 2022 13:14:25 -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=cl5h83Nw; 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]:56798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPWIi-0007CN-PS for patch@linaro.org; Wed, 02 Mar 2022 16:14:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPVxl-0005np-B0 for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:45 -0500 Received: from [2a00:1450:4864:20::334] (port=52064 helo=mail-wm1-x334.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPVxj-00088M-PF for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:45 -0500 Received: by mail-wm1-x334.google.com with SMTP id p4so1946112wmg.1 for ; Wed, 02 Mar 2022 12:52:43 -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=/jMvBmS05a6AvX2w8GLIu2n1iO4O8JPmoPPf/h/6b0c=; b=cl5h83Nw/XRAMZNOHItSybjWY8QdvGf/3GWofao76Z+NqLboxXdVP10J/51zwIZj17 OHZWjsSU2duOi+sKclrHCxPkLxPfa8I0FLEbGr69oBPkdQvwCOFnwrlpzWgo0H4npkfv cdrctQzpRLcDIsJyGZUu897cQvsfpAPgk9KMktpfnI3S/c5fI2G4w9QuYX12ikAND1rH YaKw4JWChMV6GoTpbuNyIlVj5rAq7d7av9IBQMAI8lfM/myVwT7pya9kd9di9TGUyC3T 497quhJXtJRQvMeKFi+PwF/xuizTAVtAuX7sn67g3hBYSNNf4rGF3f9Z4xar4EYF7mpp JO6A== 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=/jMvBmS05a6AvX2w8GLIu2n1iO4O8JPmoPPf/h/6b0c=; b=RolSrG8A512H/5GwRmiPwdtcDufJgcgtWixKcd8S1n+ZNmhhI5jRjjmbITrAY+FJeL /faTcc/NHAcmBOkLJhbjNz60o76i6FvEBPkFM3lqh+G4ESmX33x0rVqNlEng/y0unq8N 4k4ITkxsVzS7W2axUMivQ96Oy5vDwqQn/+HyZrWIyG0bQ2Mi479NgMXsA1VfdRURIwjR B6rq2z6KvXgGRFTOk+a6xP3W8IMzO1wH6AYuXlwClyYA2wK/KixAA8S75UY0FTh4I9id q2feOmmDlhrC2d0MNV1QQWPH3WrDjuSsMwmw3H/eynI2f3VXL9ZAK6HG/EArz/yeIi0c SCgA== X-Gm-Message-State: AOAM5309iNnXV3otANk0hYZWUBclLcQ0eAN3m4tgC/uESPDeSJuTDgxr QFeruGTz2bFvTHelGLwvlefgIysdy+bMhA== X-Received: by 2002:a05:600c:384c:b0:37b:c771:499c with SMTP id s12-20020a05600c384c00b0037bc771499cmr1280943wmr.141.1646254362394; Wed, 02 Mar 2022 12:52:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id x13-20020adfec0d000000b001e31279cc38sm90801wrn.11.2022.03.02.12.52.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 12:52:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/26] target/arm: Move arm_pamax out of line Date: Wed, 2 Mar 2022 20:52:15 +0000 Message-Id: <20220302205230.2122390-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220302205230.2122390-1-peter.maydell@linaro.org> References: <20220302205230.2122390-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::334 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" From: Richard Henderson We will shortly share parts of this function with other portions of address translation. Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-id: 20220301215958.157011-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/internals.h | 19 +------------------ target/arm/helper.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index ef6c25d8cb7..fefd1fb8d88 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -243,24 +243,7 @@ static inline void update_spsel(CPUARMState *env, uint32_t imm) * Returns the implementation defined bit-width of physical addresses. * The ARMv8 reference manuals refer to this as PAMax(). */ -static inline unsigned int arm_pamax(ARMCPU *cpu) -{ - static const unsigned int pamax_map[] = { - [0] = 32, - [1] = 36, - [2] = 40, - [3] = 42, - [4] = 44, - [5] = 48, - }; - unsigned int parange = - FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE); - - /* id_aa64mmfr0 is a read-only register so values outside of the - * supported mappings can be considered an implementation error. */ - assert(parange < ARRAY_SIZE(pamax_map)); - return pamax_map[parange]; -} +unsigned int arm_pamax(ARMCPU *cpu); /* Return true if extended addresses are enabled. * This is always the case if our translation regime is 64 bit, diff --git a/target/arm/helper.c b/target/arm/helper.c index dd4d95bda24..71e575f352e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11152,6 +11152,28 @@ static uint8_t convert_stage2_attrs(CPUARMState *env, uint8_t s2attrs) } #endif /* !CONFIG_USER_ONLY */ +/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */ +unsigned int arm_pamax(ARMCPU *cpu) +{ + static const unsigned int pamax_map[] = { + [0] = 32, + [1] = 36, + [2] = 40, + [3] = 42, + [4] = 44, + [5] = 48, + }; + unsigned int parange = + FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE); + + /* + * id_aa64mmfr0 is a read-only register so values outside of the + * supported mappings can be considered an implementation error. + */ + assert(parange < ARRAY_SIZE(pamax_map)); + return pamax_map[parange]; +} + static int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx) { if (regime_has_2_ranges(mmu_idx)) {