From patchwork Fri Feb 2 05:49:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 769145 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp753909wrc; Thu, 1 Feb 2024 21:53:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHi7Rp5ItnHCT+tlYg7Squii+sf8JqPYGyYLzt7ZeK6ZAHnpx5Wl7WtgR+/xMH5zpzpW6Ve X-Received: by 2002:a67:ee0d:0:b0:46c:fb45:a56b with SMTP id f13-20020a67ee0d000000b0046cfb45a56bmr2728908vsp.8.1706853193007; Thu, 01 Feb 2024 21:53:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706853192; cv=none; d=google.com; s=arc-20160816; b=F6uZvZhCbXkVoYlDzbFfbmkHgDfXDFmZ7LwCYWxbiqwwvqJhFEWdhU+4XNvYlj6z4e 1vz1yP00WjFC7iBQPKOc/4lCe8Yw1EWibpzfykJvgNwl4wRuJ7mf34jXrT5yveZjvImf 3OhOkeusVKSZxdccBb2q270SZ22jFp3PjKUs71zd4eLwZlQUkEJwndGWgCcFtvL+Lsxc ZI9iLO5FILofhjW67DnBf7hgcFo+LlhMP6vtdvZpESV9jVuRgAdVOqcl0jL/YkaVm2cZ PQhjFpMy9lko41W8DCv8m3EPEtEAYGKY/EXi5gHp1eAGpYOmqhPypCtE1esS3ETcsgZ7 6pCg== 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=XatY8fnmW3a/bWiIkdzT21/U2K0JQklTZ8UirY2XMgg=; fh=k7I9pQDIhK1uv3+acxuF/6dlZAfa2u565GYx3WPWddM=; b=WIN6wd+ltts3znwWo3O30GEEZ++xYiUItMAZUYhLWavv3OjQqpwhky1ljbSP6vrDy1 WLTLCwf9jao003vsF4uIYm2grLI8zNrEK6CJ/XimfN0f/qI08BDfXJyJ4I56zuGxY7ZY ae+/vg7R3KSsQzEY9swTUwJ3VeNcnxBmzKE3yDS7gxeTuoscisfLM4gbe7QLMWhql0jb R09XvN4Lv9lEu3rjIaEhRxW4VUmkGs5SyyR/8LlHOMVrD2OfhxarajC4RWFkWmcUzt/b C417Tz1aNfxUAzjccr4OIv2lbE+zL4s1XpfXLaPI/RlOxky3ZwwzgMCR15PjC5IRtTdw Q0iw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TVrFwDb2; 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; AJvYcCWxy9kAl5BLjoYYYJHuWJZp7H3tlbGuT8d0DV38ZbD1brHFsWSeLYQH62EJXb5CBO4CM2GSX8OY/W595sU8OJeW Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id db14-20020a056214170e00b0068c6e79ddf9si1258636qvb.237.2024.02.01.21.53.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2024 21:53:12 -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=TVrFwDb2; 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 1rVmSf-0001Nh-AL; Fri, 02 Feb 2024 00:51:37 -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 1rVmSQ-0001Fq-0q for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:22 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmSL-0001mw-Va for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:20 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6de28744a46so1327741b3a.3 for ; Thu, 01 Feb 2024 21:51:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853076; x=1707457876; 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=XatY8fnmW3a/bWiIkdzT21/U2K0JQklTZ8UirY2XMgg=; b=TVrFwDb2s7u8//jGf0L6WxxnRjM+WkUmOvEukaKVkZvfurjOFH/qigj/AA8u099iiP cduCQ01b+Iv1nxp6s+sIg/Z+1Hcg76zqhTZi5rKRILgSGZLM/3OgLX62XU/dECxx0VlT 9ON/aXBsImOyrLTQ206yHMLTGETLo2KorkuN76OQHboUtKSlwpvzP1hKgdgcZBqkZkTZ efRrnh0O51FuL9O0ZhzZ0oYgNjX7+38LO9W+pxqcwq6HAtbiaWMzKE2NGdTIRn10SyVD lZvXNFyXHFlhduzb9/OS/MlcGQJRwUiCojig2T8yr5OdPuKoZlrLWN/soVLI6hzITWnz TUxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853076; x=1707457876; 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=XatY8fnmW3a/bWiIkdzT21/U2K0JQklTZ8UirY2XMgg=; b=em6sAER4XACDArv5Yy+YwFvGNnBqjwFYRAznAEHCFAkuXjsL3UKqEpyclqDFSZoRkA Voyo0MsnuHqdzPsk5q9QQ4wJ5enGEwuftwloMhfXd1N/wPMxu7GJVNtEF8LO+8h15JDI v5WyX/AdKSWZ9tkDF9FZSv9kJymEVYImCKhIAGV6P6kivZwExzeiqswNjlEQHh0PQe5M OkZSxjbScgiw3zwR0J08dTwnpepmvyiJTwQYunFPN7Lz8mwZPa68oD4CWUIQFY53e/DH 7DtOnrqwiig+1RS6CkNb9nzVd3UY5FSPD2SH7aYxl6fwkzBZ7ITugvmbCJYxV9A50Hhw 8c5g== X-Gm-Message-State: AOJu0YxUXwEnbLony1wNVvhe4LZyjiH3dE7JUPXqFCjtiH64Qa/jvMSq bcbCYd7nFn/dTC5oVhUQ7M/z0Xfjrg8k2S8kxxWcrjbaifvUmHehPH5kAtTD64qSufr1ZVVghVv AAmE= X-Received: by 2002:a05:6a00:451a:b0:6df:c424:7949 with SMTP id cw26-20020a056a00451a00b006dfc4247949mr9822810pfb.26.1706853076079; Thu, 01 Feb 2024 21:51:16 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:51:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 16/57] target/mips: Split out mips_env_mmu_index Date: Fri, 2 Feb 2024 15:49:55 +1000 Message-Id: <20240202055036.684176-18-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::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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/mips/cpu.h | 7 ++++++- target/mips/sysemu/physaddr.c | 2 +- target/mips/tcg/msa_helper.c | 10 +++++----- target/mips/tcg/sysemu/cp0_helper.c | 2 +- target/mips/tcg/sysemu/special_helper.c | 2 +- target/mips/tcg/sysemu/tlb_helper.c | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 3ba8dccd2d..4c15e76781 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1255,11 +1255,16 @@ static inline int hflags_mmu_index(uint32_t hflags) } } -static inline int cpu_mmu_index(CPUMIPSState *env, bool ifetch) +static inline int mips_env_mmu_index(CPUMIPSState *env) { return hflags_mmu_index(env->hflags); } +static inline int cpu_mmu_index(CPUMIPSState *env, bool ifetch) +{ + return mips_env_mmu_index(env); +} + #include "exec/cpu-all.h" /* Exceptions */ diff --git a/target/mips/sysemu/physaddr.c b/target/mips/sysemu/physaddr.c index 05990aa5bb..13c8bc8f47 100644 --- a/target/mips/sysemu/physaddr.c +++ b/target/mips/sysemu/physaddr.c @@ -236,7 +236,7 @@ hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) int prot; if (get_physical_address(env, &phys_addr, &prot, addr, MMU_DATA_LOAD, - cpu_mmu_index(env, false)) != 0) { + mips_env_mmu_index(env)) != 0) { return -1; } return phys_addr; diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c index 7a8dbada5d..d2181763e7 100644 --- a/target/mips/tcg/msa_helper.c +++ b/target/mips/tcg/msa_helper.c @@ -8214,7 +8214,7 @@ void helper_msa_ffint_u_df(CPUMIPSState *env, uint32_t df, uint32_t wd, #if !defined(CONFIG_USER_ONLY) #define MEMOP_IDX(DF) \ MemOpIdx oi = make_memop_idx(MO_TE | DF | MO_UNALN, \ - cpu_mmu_index(env, false)); + mips_env_mmu_index(env)); #else #define MEMOP_IDX(DF) #endif @@ -8323,7 +8323,7 @@ void helper_msa_st_b(CPUMIPSState *env, uint32_t wd, target_ulong addr) { wr_t *pwd = &(env->active_fpu.fpr[wd].wr); - int mmu_idx = cpu_mmu_index(env, false); + int mmu_idx = mips_env_mmu_index(env); uintptr_t ra = GETPC(); ensure_writable_pages(env, addr, mmu_idx, ra); @@ -8337,7 +8337,7 @@ void helper_msa_st_h(CPUMIPSState *env, uint32_t wd, target_ulong addr) { wr_t *pwd = &(env->active_fpu.fpr[wd].wr); - int mmu_idx = cpu_mmu_index(env, false); + int mmu_idx = mips_env_mmu_index(env); uintptr_t ra = GETPC(); uint64_t d0, d1; @@ -8358,7 +8358,7 @@ void helper_msa_st_w(CPUMIPSState *env, uint32_t wd, target_ulong addr) { wr_t *pwd = &(env->active_fpu.fpr[wd].wr); - int mmu_idx = cpu_mmu_index(env, false); + int mmu_idx = mips_env_mmu_index(env); uintptr_t ra = GETPC(); uint64_t d0, d1; @@ -8379,7 +8379,7 @@ void helper_msa_st_d(CPUMIPSState *env, uint32_t wd, target_ulong addr) { wr_t *pwd = &(env->active_fpu.fpr[wd].wr); - int mmu_idx = cpu_mmu_index(env, false); + int mmu_idx = mips_env_mmu_index(env); uintptr_t ra = GETPC(); ensure_writable_pages(env, addr, mmu_idx, GETPC()); diff --git a/target/mips/tcg/sysemu/cp0_helper.c b/target/mips/tcg/sysemu/cp0_helper.c index cc545aed9c..62f6fb4bf6 100644 --- a/target/mips/tcg/sysemu/cp0_helper.c +++ b/target/mips/tcg/sysemu/cp0_helper.c @@ -1202,7 +1202,7 @@ void helper_mtc0_status(CPUMIPSState *env, target_ulong arg1) old, old & env->CP0_Cause & CP0Ca_IP_mask, val, val & env->CP0_Cause & CP0Ca_IP_mask, env->CP0_Cause); - switch (cpu_mmu_index(env, false)) { + switch (mips_env_mmu_index(env)) { case 3: qemu_log(", ERL\n"); break; diff --git a/target/mips/tcg/sysemu/special_helper.c b/target/mips/tcg/sysemu/special_helper.c index 93276f789d..518d3fbc34 100644 --- a/target/mips/tcg/sysemu/special_helper.c +++ b/target/mips/tcg/sysemu/special_helper.c @@ -68,7 +68,7 @@ static void debug_post_eret(CPUMIPSState *env) if (env->hflags & MIPS_HFLAG_DM) { qemu_log(" DEPC " TARGET_FMT_lx, env->CP0_DEPC); } - switch (cpu_mmu_index(env, false)) { + switch (mips_env_mmu_index(env)) { case 3: qemu_log(", ERL\n"); break; diff --git a/target/mips/tcg/sysemu/tlb_helper.c b/target/mips/tcg/sysemu/tlb_helper.c index b715449114..cdae42ffdd 100644 --- a/target/mips/tcg/sysemu/tlb_helper.c +++ b/target/mips/tcg/sysemu/tlb_helper.c @@ -973,7 +973,7 @@ hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address, /* data access */ ret = get_physical_address(env, &physical, &prot, address, access_type, - cpu_mmu_index(env, false)); + mips_env_mmu_index(env)); if (ret == TLBRET_MATCH) { return physical; }