From patchwork Wed Feb 23 22:31:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 545222 X-Google-Smtp-Source: ABdhPJwDwk8XonBXZmEMHf4VX67D6mmlekPAntXC86vP8v+vNqWZKGcvIRJw1fK3xY/sEFylfv55 X-Received: by 2002:a05:620a:126a:b0:648:a948:d0c8 with SMTP id b10-20020a05620a126a00b00648a948d0c8mr1355595qkl.652.1645655982164; Wed, 23 Feb 2022 14:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645655982; cv=none; d=google.com; s=arc-20160816; b=DC5nNqmYiiS+PXQAyyhukKab6LOs/O/SUtiJLfXfjXy0pHlLaS7WHa4AzxmQxCCm7T 7cS6rUlybiOVApRT01noiUhuIjNAG15HymbzoOzZXJJqVY9tsHuZ98fE+sOfwt+r58vm +MXlUEmxQqOHs0EfbAMquVal25SUp0zohIJpsAsP7TbwXql99EXyk4AqUovab+T9062t Bj8dlNiPDCby7a0ouhh0lS2ghyZ04OJyyKr4Ya/1PdPOnRe1lHuT35juAamtnaWuqggV tkP4qKWnxek7fUOE8UgvSfDuAuI55kXM3SrO4dcT9VJiYwS0L56qXcH5oIDfvNHsXJFq Wyfg== 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=SuY5Wx9CJ/ffd+jHcROiKCdQSoDY4ZNyTsWjCoWFIgC5dk6jnioFBTx35x6TG69iqm tIiqcL5DgGzz/aHJZNHY7d+lt/PzLtNxtprHy0eW1Itjziv9310kgGVvIBqRU5wS+7HE BK0Dl7Ax3h0SydEseKQLurWGX950AKp3qYOHAbWCMh3lc7EI+YSaZAdsCk7wkoujNQvN yqhSIuZHe1Zp5KBCdbJhyquf49KxSj0aEhOrEUqe4J3S1FpuAsS8FcNQiyYJTD2rhtm+ zoB4groRJDrveupNetb/8JgK9GmKscU7GFE5x1f8ZGsWxiNAfABOkTmXSPnAlNenioQD lNYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gOBGPyjn; 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 i124si561053qke.348.2022.02.23.14.39.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Feb 2022 14:39: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=gOBGPyjn; 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]:49620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN0IP-0002uj-OA for patch@linaro.org; Wed, 23 Feb 2022 17:39:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN0Ap-0006gp-6k for qemu-devel@nongnu.org; Wed, 23 Feb 2022 17:31:51 -0500 Received: from [2607:f8b0:4864:20::42e] (port=35508 helo=mail-pf1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN0An-0001D4-2K for qemu-devel@nongnu.org; Wed, 23 Feb 2022 17:31:50 -0500 Received: by mail-pf1-x42e.google.com with SMTP id l19so217071pfu.2 for ; Wed, 23 Feb 2022 14:31:48 -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=gOBGPyjn86roSjbkFP/FeauGD6Wio1CL1j62VVkw5N+cd1nPvuU+a8gbscsbUsdlcp bpeaNJtqMh52Kvz0Vw2Swi/5geIG5SOfKnfn7xcvHkYUAyeZK3sc72N/0MYOj59FgN3C n0P3neo5bnMiobjkcQle4cgJ9d7WMCt0fwqnpLHAJi2yKrNg2aXfZCvdMq5KxUFBrku/ 6hIPZSOMA43MbhRSntvkJFN1i70RyftJoRZ8ALXnFBsgR4XeKJu1SJljuUgs5/Cb+C1k xD7eeGXz5Hst/U0vPQgo4jx8mD5ie3lZdmyh0DQzxtXzXdi8X2SAhNgbaez48KUX2Ufp 2lGQ== 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=FpvZIQ0fpfl8CK8Gs+ZRfpdZE8zx1kBVrwxDP98xwag5zt8iSQ7papS3X9REyPuqZE FYt3ehC0d40TNso7gQpOQjwrFVJg0TkvUefI5HYSsNBG9RQl3Q9dWlin9Wug+alGH9iE EJPYdozVotDFKLpzXm4kQVkeerNicEkvFdGMj2rR3qkDk2UFLsAGSs2fnAKgSGeU0ezY pTkL1ebAHCikrrbqjHFCbuAQQxJJpUJhbcL+hqkw7DuhLmBDTWCbOpUzMzRbtUyqf5RZ IuZnAWdsEajTCuRy8jNFOXjHi93TmxJ8ZdL+Xhnt1v2GLeVVgVH8f0kegGOCUsqVLFLQ luiQ== X-Gm-Message-State: AOAM531fBjPVRQ2zBIYKRdufck86yWErEn5jF7ir8zuUnCJQNijt1YGq 3D+sSDfciNuhfqIOUiHohIM0bJkzHkJcMQ== X-Received: by 2002:a63:e747:0:b0:372:c757:c569 with SMTP id j7-20020a63e747000000b00372c757c569mr1401082pgk.516.1645655507689; Wed, 23 Feb 2022 14:31:47 -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 f8sm533815pfv.100.2022.02.23.14.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 14:31:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 04/17] target/arm: Move arm_pamax out of line Date: Wed, 23 Feb 2022 12:31:24 -1000 Message-Id: <20220223223137.114264-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223223137.114264-1-richard.henderson@linaro.org> References: <20220223223137.114264-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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)) {