From patchwork Tue Mar 1 21:59:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 547267 Delivered-To: patch@linaro.org Received: by 2002:ac0:9f50:0:0:0:0:0 with SMTP id l16csp4068518imf; Tue, 1 Mar 2022 14:09:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+ufZQkXjxOl8ZXCo982P5hpBv3QpuyXn+74nPHtO9NE3+WK5APsJIccnamTqS0Y4UXro4 X-Received: by 2002:a81:5545:0:b0:2db:effc:f88a with SMTP id j66-20020a815545000000b002dbeffcf88amr3753608ywb.370.1646172582214; Tue, 01 Mar 2022 14:09:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646172582; cv=none; d=google.com; s=arc-20160816; b=z8R6FRV+ibnjMN5VXFWhTdy1IrBjVCsjk+7AK9uj5Sb4+VrqaP3ivg2CmiilcYP6a/ aPwjpRIPQBB2g8lQ6pMsPyV/+4Gp7s+wPQHbvdD4vL995cKv+IWHPx+X1rxN5cQHQuMW L1S2WsKuKlTKJkjgdSoyzzLXK32LDTVAHMX6BwRbjAu/Z3QRAEogTuLea3fIQoenZV2m yIJ+bbeDlkBgxBz+pVzrkqHXquT1NF4j0EIhBprYvd04FA44h1hrYoJFs7DWctB3CG6R kRcJbsFjyEaMFOQLV6SDPM3OPbNGNHaGk2ZcduAQpPgdioy28WvZJtP00N0DMZ6l+zcm 1NJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=+DAMlpqsE9DmBwY1s+cP0r+gi8rLuchADVNtgdDMW7U=; b=CKn1BTe3qlTndA/kxhHmOSVcCoVZTqj9oknt9xOToZQpRdpMynJw5NZh81uQqLgnVT gTcHZeuhnIdZH+wbf1VCNYg7UtV0Zprq5vXllnKaQ1nKI4nRjhT19OnMdJTrSYdH65dK NwAgkRPT3s8CNA9IxkayQAGfh6S4D2FeVSBhOo9PbqWucExx5BSrSX27oIdjHsAQxN7J eHCvo26dAaabP6Z+AAgF88lsVkpA/+P8ihedUlTNWKHwu9quXkGGk/4vEc5ZvoAqmI/f 4u19ni39YJKCW04FAkhoEi7HVObCeBEcY1oIgqDORb3/cDQgD7pa55VMtsrYrPRGFXyR JVdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mq2ltQuv; 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=fail (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 d5-20020a251d05000000b00619b32d8102si12985874ybd.591.2022.03.01.14.09.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Mar 2022 14:09:42 -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=fail header.i=@linaro.org header.s=google header.b=mq2ltQuv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPAgd-0005o7-UA for patch@linaro.org; Tue, 01 Mar 2022 17:09:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPAXX-0001Fv-9A for qemu-devel@nongnu.org; Tue, 01 Mar 2022 17:00:15 -0500 Received: from [2607:f8b0:4864:20::434] (port=43728 helo=mail-pf1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPAXT-0004wg-Qu for qemu-devel@nongnu.org; Tue, 01 Mar 2022 17:00:15 -0500 Received: by mail-pf1-x434.google.com with SMTP id d187so46239pfa.10 for ; Tue, 01 Mar 2022 14:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+DAMlpqsE9DmBwY1s+cP0r+gi8rLuchADVNtgdDMW7U=; b=mq2ltQuvsaGII0nw21LCdZQ9vRhu+28qEW5tjEtWd8kZKUrGy9SKf9m7hDdbGyU/py WVbzzG7efFmDHTqilAKCt5F773MS4MiGulnOX/29f8woFmOx8WsUT6MGpFrYeLSlR1yM I0qYQtmfcy6GY4X8U1yKCXzS2o38Jy03HBkzo5/xkI1qXqYAXmDRZK29hEcQ8iWEOzuR bus8SOvOtG25OzocVXY/94RKHNZZWNsjWDCZyhEK3rTGmwi/pfBOsDLVCUKoxr3rqtFe bgbHU027H9GdDmx65hLDgqAo8bITJedZYib/G4aO3sBKT1VOUZRH1S67tc5E4vdQBBNx 1bRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+DAMlpqsE9DmBwY1s+cP0r+gi8rLuchADVNtgdDMW7U=; b=xIZ3iHKiUdsW7gSCsBmHHBmaS9SHOkBwE2DCfQTL2tFA4RgngLMpcp9wNtirYN3UzI PJrLZEjRazRAmFohlf7c3Jvyf9rxmdNerkLwtu6n7IK+Tqcbg/Qkg7yQxA8Hg9loX0vR aZp78AObCGOygcLHd+ZNmzKP+Lf4FgaV3PTLvnGfHme+1SwQVYhUTIakrvnWqN0dvTtp /HT5oU+SXrCwobQ/JuXlOC10Mnc0lTdAivgMbu1dWhx9Zi+yQCgYXG5a7KXNQXRqfuSA QXB1w9fXaIwdZ+C0S2UBfmx9EVy1dvRPkONrcj7jPkdt6vNlzW3pr4p4ouzqsATi11Dy 9NMA== X-Gm-Message-State: AOAM531OQrlX6QRkJg2+AxG7nFnSeqsmbTs+I9Qnq8xywZK8CSwAi9+/ ubm1EO6xTUUx1pf1nyGY/o6VBljXpoYnGQ== X-Received: by 2002:a65:4d0c:0:b0:379:3df:eac8 with SMTP id i12-20020a654d0c000000b0037903dfeac8mr1793340pgt.166.1646172009529; Tue, 01 Mar 2022 14:00:09 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id m4-20020a17090a7f8400b001bef3fc3938sm284392pjl.49.2022.03.01.14.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 14:00:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 04/18] target/arm: Move arm_pamax out of line Date: Tue, 1 Mar 2022 11:59:44 -1000 Message-Id: <20220301215958.157011-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220301215958.157011-1-richard.henderson@linaro.org> References: <20220301215958.157011-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::434 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 ef6c25d8cb..fefd1fb8d8 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 dd4d95bda2..71e575f352 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)) {