From patchwork Wed Dec 8 23:11:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 522228 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp152455imb; Wed, 8 Dec 2021 15:13:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvTho0hWJQiiLpsNYpqMIBk+Qe+H9xy93RsgpQ8QUicWlW0wWBofKfdZYi12rmzWMYa9mV X-Received: by 2002:ab0:7784:: with SMTP id x4mr12778555uar.143.1639005180874; Wed, 08 Dec 2021 15:13:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639005180; cv=none; d=google.com; s=arc-20160816; b=sLZNUg116vR69AvXZEDQ00gq+fA8gvVKuGG2qTsUNZgq22Tq4zNT3CUmpsYmRgwK9z 0j1Wvx7bkMywwoPD+l+BgItOYar7fMo1hOtLvTUphd80CIJp13wzZUGc2iAM3i0/8BqB pAnOK/q7WTrrsIQzpDGXm57QBdJgJ/H++4eJbIX4EkgANXmP5tC0WiS6CFYMlXNlO6sm ehbCFLWSdrYie1pwZC9GMPbmLFcNyJ+ZwCtyyEbJAUlJ5OEHhQue2QjeLWTszaJHFGTR 1IHovp0ouR++OeOqj8pPMINUaObbvPBkqNqIJa5Y/gm2GYVK8GIKifVfwEbDRu3mY6X3 doTQ== 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=Bg5qVk1ZQ88PRRWOggs3a3wuRuKCDpNLFKTwJvEK+Vk=; b=YPCDZUTKSqW3nFGFAHaqX6MGozsjK+QdnQCWlVhMRmJgGfuIr1booy04SjQaeMttTi swRfbnWbsWRI0+LcJKJTPNFmqcS/y9rMIGwEQEegQtDD9rvafTkRLc2wvhwiy4HeDGmv R5TC551skBplRljGyAqVhVaN+1+ZnQl+7OShc4qhZJsU6mHfWksph1eG1y/vskoWQj6J mmkmFxmVrrkFBgl2sEk6FlxQYjOzUWUUEV9wAX2zG0Wf2hxRB4pQECmYPQbYPLrExiSg HGODbXSdma/tlq2AYYnUk/MH6Z1D/IYElQxhFHtahxYhNeAeqonsWrjCRAiNDkBf9wBc kFqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TUCxmnVt; 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 x22si5919835vsk.99.2021.12.08.15.13.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Dec 2021 15:13:00 -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=TUCxmnVt; 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]:60928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mv67P-0005Ak-BL for patch@linaro.org; Wed, 08 Dec 2021 18:12:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mv66S-00058s-RH for qemu-devel@nongnu.org; Wed, 08 Dec 2021 18:12:00 -0500 Received: from [2607:f8b0:4864:20::62e] (port=42602 helo=mail-pl1-x62e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mv66Q-0004nC-RJ for qemu-devel@nongnu.org; Wed, 08 Dec 2021 18:12:00 -0500 Received: by mail-pl1-x62e.google.com with SMTP id u17so2557307plg.9 for ; Wed, 08 Dec 2021 15:11:58 -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=Bg5qVk1ZQ88PRRWOggs3a3wuRuKCDpNLFKTwJvEK+Vk=; b=TUCxmnVtTnJf++YlY/xAH9sToCVtf1EsMUZAx2FXAQXsTbzeew2Re6MjIGulNLS0w+ ky6UH23X/hOgPaJuPTj936B4YdOKgA34ohuE4A0lCv2xyZjTNgsE+hjYMTKPv/aNO1vh 5EmFEBtlx6Q/C66v8ydLIMOeYgn9ZhsIA8asGRb4xMwiyZ/yANjDHupqIpKsSCfyJAUp XQylnB+UWSCmSOm4Qiu8DvS/OCUnb9Zb03AVXPgaPGRGzGtisZTVzM5kRWl+tc1Ji5sy td5cjiAWJjLmvp0kL+IUeI2b6glhYkhEJn9NiiiFF7yhiieFm+23yXhRlN1SgcoSp4R2 Tq2g== 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=Bg5qVk1ZQ88PRRWOggs3a3wuRuKCDpNLFKTwJvEK+Vk=; b=RjbZlN27rGe4V0JKvym3F8KwHqintfP+mt7GAFqaqq1fPeNf/wplm5niumaNYQYLr0 YNUW7FT3ARhtEs7TRkjWWsOEzhgEs9i+PVMPIKIwWQC9ZzKPGbgfWnQ52szgEBa2KKYe ycNsqLWMcdIoOpOba3SL5bzHCX3ws01DlVefLLVdcE5qQ0nwKnZuUeA1+guE6Ev5jgop 1U6Yq3NLXJQLCk0vXmUionobMvEJDNlUwY9IFX7s8tkLY/uOCP78u8UL791FrtYbGjtO XY1Bw29KY0pZs/s8/ryYrA7c27cms1oIH1+KmcWIC4oKjxsE4YuL96SDcAzpCQnE9mMS u/+g== X-Gm-Message-State: AOAM533i3W3ABZNliam0d3Dx7XxBn0cBjO7uTEC/N7uy9kTzLfTXdiLE b0LcUOkKhgPnN6DGMMwsjq8E2Y+ZY1M/ww== X-Received: by 2002:a17:902:ba84:b0:142:5514:8dd7 with SMTP id k4-20020a170902ba8400b0014255148dd7mr63438969pls.87.1639005117597; Wed, 08 Dec 2021 15:11:57 -0800 (PST) Received: from localhost.localdomain (45-19-222-18.lightspeed.sntcca.sbcglobal.net. [45.19.222.18]) by smtp.gmail.com with ESMTPSA id k15sm3301062pgn.91.2021.12.08.15.11.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 15:11:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/6] target/arm: Move arm_pamax out of line Date: Wed, 8 Dec 2021 15:11:50 -0800 Message-Id: <20211208231154.392029-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211208231154.392029-1-richard.henderson@linaro.org> References: <20211208231154.392029-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée --- 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 89f7610ebc..27d2fcd26c 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 575723d62c..fab9ee70d8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11090,6 +11090,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)) {