From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 21/23] target/mips: Revert TARGET_PAGE_BITS_VARY
Date: Mon, 31 Mar 2025 21:48:19 +0200 [thread overview]
Message-ID: <20250331194822.77309-22-philmd@linaro.org> (raw)
In-Reply-To: <20250331194822.77309-1-philmd@linaro.org>
From: Richard Henderson <richard.henderson@linaro.org>
Revert ee3863b9d41 and a08d60bc6c2b. The logic behind changing
the system page size because of what the Loongson kernel "prefers"
is flawed.
In the Loongson-2E manual, section 5.5, it is clear that the cpu
supports a 4k page size (along with many others). Similarly for
the Loongson-3 series CPUs, the 4k page size is mentioned in the
section 7.7 (PageMask Register). Therefore we must continue to
support a 4k page size.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250328175526.368121-2-richard.henderson@linaro.org>
[PMD: Mention Loongson-3 series CPUs]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/mips/cpu-param.h | 5 -----
hw/mips/fuloong2e.c | 1 -
hw/mips/loongson3_virt.c | 1 -
target/mips/tcg/system/cp0_helper.c | 7 +------
target/mips/tcg/system/tlb_helper.c | 2 +-
5 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/target/mips/cpu-param.h b/target/mips/cpu-param.h
index 11b3ac0ac63..8fcb1b4f5f2 100644
--- a/target/mips/cpu-param.h
+++ b/target/mips/cpu-param.h
@@ -18,12 +18,7 @@
# define TARGET_VIRT_ADDR_SPACE_BITS 32
#endif
#endif
-#ifdef CONFIG_USER_ONLY
#define TARGET_PAGE_BITS 12
-#else
-#define TARGET_PAGE_BITS_VARY
-#define TARGET_PAGE_BITS_MIN 12
-#endif
#define TCG_GUEST_DEFAULT_MO (0)
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 646044e2749..2a8507b8b0a 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -334,7 +334,6 @@ static void mips_fuloong2e_machine_init(MachineClass *mc)
mc->default_cpu_type = MIPS_CPU_TYPE_NAME("Loongson-2E");
mc->default_ram_size = 256 * MiB;
mc->default_ram_id = "fuloong2e.ram";
- mc->minimum_page_bits = 14;
machine_add_audiodev_property(mc);
}
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index db1cc513147..1da20dccec4 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -677,7 +677,6 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data)
mc->max_cpus = LOONGSON_MAX_VCPUS;
mc->default_ram_id = "loongson3.highram";
mc->default_ram_size = 1600 * MiB;
- mc->minimum_page_bits = 14;
mc->default_nic = "virtio-net-pci";
}
diff --git a/target/mips/tcg/system/cp0_helper.c b/target/mips/tcg/system/cp0_helper.c
index 01a07a169f6..8c2114c58a6 100644
--- a/target/mips/tcg/system/cp0_helper.c
+++ b/target/mips/tcg/system/cp0_helper.c
@@ -877,18 +877,13 @@ void update_pagemask(CPUMIPSState *env, target_ulong arg1, int32_t *pagemask)
if ((mask >> maskbits) != 0) {
goto invalid;
}
- /* We don't support VTLB entry smaller than target page */
- if ((maskbits + TARGET_PAGE_BITS_MIN) < TARGET_PAGE_BITS) {
- goto invalid;
- }
env->CP0_PageMask = mask << CP0PM_MASK;
return;
invalid:
/* When invalid, set to default target page size. */
- mask = (~TARGET_PAGE_MASK >> TARGET_PAGE_BITS_MIN);
- env->CP0_PageMask = mask << CP0PM_MASK;
+ env->CP0_PageMask = 0;
}
void helper_mtc0_pagemask(CPUMIPSState *env, target_ulong arg1)
diff --git a/target/mips/tcg/system/tlb_helper.c b/target/mips/tcg/system/tlb_helper.c
index ca4d6b27bc9..123639fa18e 100644
--- a/target/mips/tcg/system/tlb_helper.c
+++ b/target/mips/tcg/system/tlb_helper.c
@@ -875,7 +875,7 @@ refill:
break;
}
}
- pw_pagemask = m >> TARGET_PAGE_BITS_MIN;
+ pw_pagemask = m >> TARGET_PAGE_BITS;
update_pagemask(env, pw_pagemask << CP0PM_MASK, &pw_pagemask);
pw_entryhi = (address & ~0x1fff) | (env->CP0_EntryHi & 0xFF);
{
--
2.47.1
next prev parent reply other threads:[~2025-03-31 19:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 19:47 [PULL 00/23] Misc HW fixes for 2025-03-31 Philippe Mathieu-Daudé
2025-03-31 19:47 ` [PULL 01/23] hw/arm/armv7m: Expose and access System Control Space as little endian Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 02/23] hw/arm/imx8mp-evk: Fix reference count of SoC object Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 03/23] hw/arm/fsl-imx8mp: Derive struct FslImx8mpState from TYPE_SYS_BUS_DEVICE Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 04/23] hw/arm/fsl-imx8mp: Remove unused define Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 05/23] hw/core/cpu: Use size_t for memory_rw_debug len argument Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 06/23] hw/block/m25p80: Categorize and add description Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 07/23] hw/display/dm163: Add description Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 08/23] hw/dma/i82374: Categorize and add description Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 09/23] hw/mips: Mark the "mipssim" machine as deprecated Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 10/23] hw/rtc/goldfish: keep time offset when resetting Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 11/23] hw/misc/pll: Do not expose as user-creatable Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 12/23] hw/nvram/xlnx-efuse: " Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 13/23] hw/scsi/lsi53c895a: fix memory leak in lsi_scsi_realize() Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 14/23] hw/sd/sdhci: free irq on exit Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 15/23] hw/char/bcm2835_aux: Fix incorrect interrupt ID when RX disabled Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 16/23] hw/ufs: free irq on exit Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 17/23] hw/pci-host/designware: Fix ATU_UPPER_TARGET register access Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 18/23] target/hppa: Remove duplicated CPU_RESOLVING_TYPE definition Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 19/23] target/avr: Fix buffer read in avr_print_insn Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 20/23] target/sparc: Log unimplemented ASI load/store accesses Philippe Mathieu-Daudé
2025-03-31 19:48 ` Philippe Mathieu-Daudé [this message]
2025-03-31 19:48 ` [PULL 22/23] target/mips: Require even maskbits in update_pagemask Philippe Mathieu-Daudé
2025-03-31 19:48 ` [PULL 23/23] target/mips: Simplify and fix update_pagemask Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250331194822.77309-22-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).