From patchwork Sat Jun 4 04:05:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 578742 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp2142449max; Fri, 3 Jun 2022 21:30:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaK9jNY+McQE9otGNz4aFDetGiIA+VT3D2GOeF/tLWt7UOG6D5OhZNVjX6nvBnwakxVFIr X-Received: by 2002:ad4:4e04:0:b0:467:d601:dc9c with SMTP id dl4-20020ad44e04000000b00467d601dc9cmr7171025qvb.21.1654317020953; Fri, 03 Jun 2022 21:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654317020; cv=none; d=google.com; s=arc-20160816; b=WAGlyWNzJrunCijorY1+cJh4NUA6GInJ1rfOjT/h4SDdIZU/Ev3VDi2QuobxOhySSB KyLbHjOPjOOP3rSfg6YcazzlY8EEvZtLlCf8jfguIOjjvF879cxc8GBn42wgODvVzC6p 4RLi6dWu3PiXKXDugYGekggBzp2qHGgiBKJzeXxuIqaSekdLTyV1nChKZPJupoSH+rj9 sJUihbowpOAiu1CdvDqSEo2EgPL0lFKdvns9N1vUfyChdwmHz4aQD06X2LdLl1h8EHaB +/hw/THExqmY1g6AH3qau1koJghhJhEbb3NZuhbyNhR5gcPYNLd3alydpJTMnvAlR7xj fvNw== 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:cc:to :from:dkim-signature; bh=qkd0B4g6jM3nkL28VlmdmN6+46UTMQek41TjlfeZ+tg=; b=l8AB/Qf5c2jc/shZYGcU4ZBHs7ZNVQKlcPjoWAp3wjLE5nxanqoMCIDtk6Q7gJkKdl W5w8kZBqqTaePy0u9ecyNd/ymggfnQpcf59TXPOjmDbeAMD5p8G7UqRURfbKXQVVqnAw VMnYzPp+GIKYGIohCJhvNmjgbWPuOT8suy+6Qi7T9FR5b3DTZbnMF8FUluK/Q7EnVAb3 b5afXlU0OyFyjncUjlhDWqUZ5ub7XTBSw0UBYIHH84Qf1v9R3ABFc+swQ50vczvw3mZG c17RfeXCMgm8p7J0RFDYp6fAbVu9O+zL3n2PMLkGSBrvQE2COm4fjaWF1N4toEE/MBIX vEjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKfnAh48; 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 p24-20020a05620a057800b006a6a4a861b8si1513418qkp.590.2022.06.03.21.30.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Jun 2022 21:30:20 -0700 (PDT) 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=QKfnAh48; 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]:60036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxLQa-0005iG-EN for patch@linaro.org; Sat, 04 Jun 2022 00:30:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxL3V-0008BF-0u for qemu-devel@nongnu.org; Sat, 04 Jun 2022 00:06:29 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:50691) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxL3S-0008V4-Hc for qemu-devel@nongnu.org; Sat, 04 Jun 2022 00:06:28 -0400 Received: by mail-pj1-x1036.google.com with SMTP id e24so8741524pjt.0 for ; Fri, 03 Jun 2022 21:06:26 -0700 (PDT) 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=qkd0B4g6jM3nkL28VlmdmN6+46UTMQek41TjlfeZ+tg=; b=QKfnAh48w/6pL2qxSb4QBEVbra2oS9p4L4Ckt3nlLJ9YZC+50zh/86TlIow5GGanHY ORV87jwPPI/XavX/yPqLgto6PIbHKp4T0yTPqReRyBhRqYAaO3q1ojmRb5YMKSFUIuBf jgT01XeGP8FOaJFIWXaY178Qmxgk8AAn/Xs6VsAMxKH+nKqdoHIscYvq1HLIp4CQL4q2 R8J8NF1ijCno+XeK4QQDWzDEIFTeOmFTlaLCmcQo15k1F/IwaQKL19XoNMklWK5/XlcB qpGaN0dZ638ZdD9rR7WV3tivf/CDNVLVo8CgOC2kJqS0M6qo0vu15dhbZieLzQTKkpg1 dPCw== 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=qkd0B4g6jM3nkL28VlmdmN6+46UTMQek41TjlfeZ+tg=; b=AByWfONLYwWnkHN6otY33b80uxX0O5u51CQVU5C9+fgF3FDIUOh0gIOj6COx4A3A6e eCMJpE61NAMptrP6sNyl0AvlHW1ZtdiCsb3yDaAxuC79mM6KrUhbAroQkT76jc99L6Ul QyC2YYu8rkm/JMq/veD4L+o/phqLC5iCHYFhnEvZVhLPiafr5yE5Qd82oV/YASSPaDgf G1pPlLD3x9PWUIEE/QF29whcOoH/SaJZsmDmrEpwXo7DCjChGTiEMMCJpelXt63lKQl+ lV4ounpK54HHUZvS38ePFQnHysCKZodtfdgb2T66AoW3Nvc/6hm4Y5p/W6ca+iDePcvb lPPw== X-Gm-Message-State: AOAM533cRCD3F90OXWM/eZB5YC+1Jy8QjE/cXDoXfmLtUoTy6dbeux87 L4hG0RNKTzfByBqa24LNscLtvJnyoglR5A== X-Received: by 2002:a17:902:a507:b0:162:2a77:7363 with SMTP id s7-20020a170902a50700b001622a777363mr13336670plq.115.1654315585767; Fri, 03 Jun 2022 21:06:25 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:3286:cc26:3d5e:3f94]) by smtp.gmail.com with ESMTPSA id a37-20020a631a65000000b003c14af50626sm6093779pgm.62.2022.06.03.21.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 21:06:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 18/28] target/arm: Move arm_pamax, pamax_map into ptw.c Date: Fri, 3 Jun 2022 21:05:57 -0700 Message-Id: <20220604040607.269301-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220604040607.269301-1-richard.henderson@linaro.org> References: <20220604040607.269301-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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" Signed-off-by: Richard Henderson --- target/arm/ptw.h | 2 -- target/arm/helper.c | 25 ------------------------- target/arm/ptw.c | 25 +++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/target/arm/ptw.h b/target/arm/ptw.h index 28b8cb9fb8..fba650d01c 100644 --- a/target/arm/ptw.h +++ b/target/arm/ptw.h @@ -11,8 +11,6 @@ #ifndef CONFIG_USER_ONLY -extern const uint8_t pamax_map[7]; - bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx); bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx); uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx, int ttbrn); diff --git a/target/arm/helper.c b/target/arm/helper.c index 4ed2093acf..001d632cd1 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10778,31 +10778,6 @@ bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, } #endif /* !CONFIG_USER_ONLY */ -/* This mapping is common between ID_AA64MMFR0.PARANGE and TCR_ELx.{I}PS. */ -const uint8_t pamax_map[] = { - [0] = 32, - [1] = 36, - [2] = 40, - [3] = 42, - [4] = 44, - [5] = 48, - [6] = 52, -}; - -/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */ -unsigned int arm_pamax(ARMCPU *cpu) -{ - 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]; -} - int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx) { if (regime_has_2_ranges(mmu_idx)) { diff --git a/target/arm/ptw.c b/target/arm/ptw.c index e4b860d2ae..d754273fa1 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -23,6 +23,31 @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) __attribute__((nonnull)); +/* This mapping is common between ID_AA64MMFR0.PARANGE and TCR_ELx.{I}PS. */ +static const uint8_t pamax_map[] = { + [0] = 32, + [1] = 36, + [2] = 40, + [3] = 42, + [4] = 44, + [5] = 48, + [6] = 52, +}; + +/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */ +unsigned int arm_pamax(ARMCPU *cpu) +{ + 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 bool regime_translation_big_endian(CPUARMState *env, ARMMMUIdx mmu_idx) { return (regime_sctlr(env, mmu_idx) & SCTLR_EE) != 0;