From patchwork Fri Feb 2 05:49:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 769164 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp754754wrc; Thu, 1 Feb 2024 21:56:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFhaCEZzRuIunxcYItsYPlyEjfS6VzJ0Ffi2bCjq2y+3A33RzcGtPEaP1bhSmnZ2WwFrHk8 X-Received: by 2002:ac8:7c4d:0:b0:42b:f570:d9ae with SMTP id o13-20020ac87c4d000000b0042bf570d9aemr1373898qtv.9.1706853395456; Thu, 01 Feb 2024 21:56:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706853395; cv=none; d=google.com; s=arc-20160816; b=Xu7upU5VLn82mLZDRXW5tkF+/kZEQsfomk9XPJeGhtCsUxWyXK2RCoslhIi1K6/Rx/ Ug9lTtz3JxlFzaTgNQLpjaMV+3b27ZZvwLChPSUA+t1X2yDoBFSvrjTkTZeurHDqHNJc HDUOAZBu3dK/NPnDxGQLslJ7KXZua99VegOsJ2bJdTqscqmFnGapTVFDxBUKq4yI7q/I 9Bxji5yyeqzQhvYbCQPn81CVWWwUp0DUcZB34NRQejD+eZIrU8Jz59tixLZyh2Me91ct YdENFUNQ70jmsohGXv+DGnUK8ApPHTWUNkII36gW0XxMs8pmlIrqTWzoI4NkFsP88zb+ DV0g== 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=HgdbWgNLg8LLScF7lhaba0ocAypckeHfyh0foJfM/Y8=; fh=isbpPQC+bBSjKfH022Bmt022hnLX1qcxks9GacBxryQ=; b=V9HTDex0o6NJKrIoDmZPhP75DdtD4VU57WyPeuUcg7ut3r7VSU0obKhtIn6AoLrnDa cAv7sVEH1mjAr9uMHelqs5kVb4lQMjoHMzPrtGwYe3FKcgPCC8i000HqIYAq4rySgVkz iU5QTTGmOJ3DfTlzkdUtAuXd4t1D+MSTdZY6staVycxGq18tU2Rq61TJSs//EDJ3YuDJ 5VFtAAE8cveKmRTVZYrp/v7uvxhgLmVK30UYJQFZjc5/Y0JS8lDE/wPG5OYALwsxT686 65I6EqUIyZFNIobaQ6XOa7YsQ+ayio9D6/iZTc53+O7Ix/l9kWIvNpDFu8ItTQBAqrZo O1AQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bJ3sqXgC; 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 X-Forwarded-Encrypted: i=0; AJvYcCXPUHFiQIlzob01rk6Wda/wd/9Jim9F0NTNMkLY+bbA+Ogd2npNzxPS8N7QlMbmnsp/iUWRepIrGeVakjjSIpk3 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b4-20020ac87fc4000000b0042beac9dbc9si1266797qtk.6.2024.02.01.21.56.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2024 21:56:35 -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=bJ3sqXgC; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVmSe-0001Mg-3k; Fri, 02 Feb 2024 00:51:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVmSV-0001H8-JY for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:27 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmST-0001py-Ti for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:27 -0500 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5ca29c131ebso1526164a12.0 for ; Thu, 01 Feb 2024 21:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853084; x=1707457884; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HgdbWgNLg8LLScF7lhaba0ocAypckeHfyh0foJfM/Y8=; b=bJ3sqXgCTlhIb7qBQWo0yOacagKLRXFfEA/lOOnqOyJEpu1cItSgza003KVw4HPc4m vV/XaPTLirRGjf5yzzkUZ/kgt8xsbmlcYy/gnx4reiSooyy4FnjmNDSGx5vKTICtXqTD TqRROrCHTD3Krd+9YzQAc7gd2hlnJ3AIId1aec7A08Cowl14aDaOWy4xU2tCZjsAJ9Yu 3bSfr0OMGGz1PiU1pBs4fRX97mATIkbuU44ndNp1UfaNh3g9K56RS0w7cwd6RWl35MVI X7PkiXX53pDygh72ZC7SLPwM4LuIhuQ0bSkv7ZeY49+bJNhkaW2YFVw3CBQR2Ib846HB bwKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853084; x=1707457884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HgdbWgNLg8LLScF7lhaba0ocAypckeHfyh0foJfM/Y8=; b=RJmrEFiMVN1tbNxeZXiMe+c4E8xQH+WnYM71P22GSe2kTAwBH8mr2sX08ndT/0wO/p j74OKdMfQzE08lC3nBh7XwhpitwGRGnOZoA3Qgid99wrYmfV6n/tJBwK/HSuCBk1Mfc9 rfFkCy9JsDvNiHmZnWe1V2swwLC25Zon56oORhycQkC6cjcp5ME7U5aq3d45Nm6t1rP0 alJfpe4a4/qJ6CeufTKfbQAiw3B7xQhxbLreY/SlLoBXAea6191Zovqeas3IbtWYbnAd A7KpBEzX6UrqmrdymO/wgJk4DRDObQ1gtz0sgF/dy3Kzede123rF3oUx0rNhuVaJFGSS GxBQ== X-Gm-Message-State: AOJu0YzCVoNG6P2+4F4p/3nPY37wm2lVrYfZy+TnCWgQD4sd3UROLtHW Z0fCkq4t9w4Kv5dWRxp2AUJt+yACa+sDirw6bvO5mfIzsTtK0sjs2tXz0wtZKXxejfyAKnewfBI EHhU= X-Received: by 2002:a05:6a20:ce48:b0:19e:4e80:27f0 with SMTP id id8-20020a056a20ce4800b0019e4e8027f0mr685001pzb.37.1706853084256; Thu, 01 Feb 2024 21:51:24 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:51:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 20/57] target/ppc: Split out ppc_env_mmu_index Date: Fri, 2 Feb 2024 15:49:59 +1000 Message-Id: <20240202055036.684176-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202055036.684176-1-richard.henderson@linaro.org> References: <20240202055036.684176-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/ppc/cpu.h | 7 ++++++- target/ppc/cpu_init.c | 2 +- target/ppc/mem_helper.c | 10 +++++----- target/ppc/mmu_common.c | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index f8101ffa29..5f4f52aec5 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1624,7 +1624,7 @@ int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val); /* MMU modes definitions */ #define MMU_USER_IDX 0 -static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch) +static inline int ppc_env_mmu_index(CPUPPCState *env, bool ifetch) { #ifdef CONFIG_USER_ONLY return MMU_USER_IDX; @@ -1633,6 +1633,11 @@ static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch) #endif } +static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch) +{ + return ppc_env_mmu_index(env, ifetch); +} + /* Compatibility modes */ #if defined(TARGET_PPC64) bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23eb5522b6..86c8031765 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7457,7 +7457,7 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx " HF " "%08x iidx %d didx %d\n", env->msr, env->spr[SPR_HID0], env->hflags, - cpu_mmu_index(env, true), cpu_mmu_index(env, false)); + ppc_env_mmu_index(env, true), ppc_env_mmu_index(env, false)); #if !defined(CONFIG_USER_ONLY) if (env->tb_env) { qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64 diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index c7535481d6..ea7e8443a8 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -83,7 +83,7 @@ static void *probe_contiguous(CPUPPCState *env, target_ulong addr, uint32_t nb, void helper_lmw(CPUPPCState *env, target_ulong addr, uint32_t reg) { uintptr_t raddr = GETPC(); - int mmu_idx = cpu_mmu_index(env, false); + int mmu_idx = ppc_env_mmu_index(env, false); void *host = probe_contiguous(env, addr, (32 - reg) * 4, MMU_DATA_LOAD, mmu_idx, raddr); @@ -105,7 +105,7 @@ void helper_lmw(CPUPPCState *env, target_ulong addr, uint32_t reg) void helper_stmw(CPUPPCState *env, target_ulong addr, uint32_t reg) { uintptr_t raddr = GETPC(); - int mmu_idx = cpu_mmu_index(env, false); + int mmu_idx = ppc_env_mmu_index(env, false); void *host = probe_contiguous(env, addr, (32 - reg) * 4, MMU_DATA_STORE, mmu_idx, raddr); @@ -135,7 +135,7 @@ static void do_lsw(CPUPPCState *env, target_ulong addr, uint32_t nb, return; } - mmu_idx = cpu_mmu_index(env, false); + mmu_idx = ppc_env_mmu_index(env, false); host = probe_contiguous(env, addr, nb, MMU_DATA_LOAD, mmu_idx, raddr); if (likely(host)) { @@ -224,7 +224,7 @@ void helper_stsw(CPUPPCState *env, target_ulong addr, uint32_t nb, return; } - mmu_idx = cpu_mmu_index(env, false); + mmu_idx = ppc_env_mmu_index(env, false); host = probe_contiguous(env, addr, nb, MMU_DATA_STORE, mmu_idx, raddr); if (likely(host)) { @@ -276,7 +276,7 @@ static void dcbz_common(CPUPPCState *env, target_ulong addr, target_ulong mask, dcbz_size = env->dcache_line_size; uint32_t i; void *haddr; - int mmu_idx = epid ? PPC_TLB_EPID_STORE : cpu_mmu_index(env, false); + int mmu_idx = epid ? PPC_TLB_EPID_STORE : ppc_env_mmu_index(env, false); #if defined(TARGET_PPC64) /* Check for dcbz vs dcbzl on 970 */ diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 6ca5d12207..751403f1c8 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc/mmu_common.c @@ -1561,9 +1561,9 @@ hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) * mapped by code TLBs, so we also try a MMU_INST_FETCH. */ if (ppc_xlate(cpu, addr, MMU_DATA_LOAD, &raddr, &s, &p, - cpu_mmu_index(&cpu->env, false), false) || + ppc_env_mmu_index(&cpu->env, false), false) || ppc_xlate(cpu, addr, MMU_INST_FETCH, &raddr, &s, &p, - cpu_mmu_index(&cpu->env, true), false)) { + ppc_env_mmu_index(&cpu->env, true), false)) { return raddr & TARGET_PAGE_MASK; } return -1;