[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.18 05/18] target/mips: Revert TARGET_PAGE_BITS_VARY
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.18 05/18] target/mips: Revert TARGET_PAGE_BITS_VARY |
Date: |
Wed, 14 May 2025 15:56:11 +0300 |
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>
(cherry picked from commit fca2817fdcb00e65020c2dcfcb0b23b2a20ea3c4)
(Mjt: context fixes for 7.2.x)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 34befa5dd5..dbd26df00b 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -336,7 +336,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;
}
DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init)
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index b4f6bff1b8..dc94e21438 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -616,7 +616,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;
}
static const TypeInfo loongson3_machine_types[] = {
diff --git a/target/mips/cpu-param.h b/target/mips/cpu-param.h
index f4c76994ea..4d9f4297f1 100644
--- a/target/mips/cpu-param.h
+++ b/target/mips/cpu-param.h
@@ -23,12 +23,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 NB_MMU_MODES 4
#endif
diff --git a/target/mips/tcg/sysemu/cp0_helper.c
b/target/mips/tcg/sysemu/cp0_helper.c
index 5da1124589..f0459a85e6 100644
--- a/target/mips/tcg/sysemu/cp0_helper.c
+++ b/target/mips/tcg/sysemu/cp0_helper.c
@@ -900,18 +900,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/sysemu/tlb_helper.c
b/target/mips/tcg/sysemu/tlb_helper.c
index 9d16859c0a..f0a513365b 100644
--- a/target/mips/tcg/sysemu/tlb_helper.c
+++ b/target/mips/tcg/sysemu/tlb_helper.c
@@ -877,7 +877,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.39.5
- [Stable-7.2.18 00/18] Patch Round-up for stable 7.2.18, freeze on 2025-05-24, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 02/18] hw/rtc/goldfish: keep time offset when resetting, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 05/18] target/mips: Revert TARGET_PAGE_BITS_VARY,
Michael Tokarev <=
- [Stable-7.2.18 01/18] Makefile: "make dist" generates a .xz, not .bz2, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 04/18] target/avr: Fix buffer read in avr_print_insn, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 03/18] hw/pci-host/designware: Fix ATU_UPPER_TARGET register access, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 07/18] target/mips: Simplify and fix update_pagemask, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 10/18] smbios: Fix buffer overrun when using path= option, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 08/18] migration: fix SEEK_CUR offset calculation in qio_channel_block_seek, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 06/18] target/mips: Require even maskbits in update_pagemask, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 09/18] virtio-net: Fix num_buffers for version 1, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 11/18] plugins/loader: fix deadlock when resetting/uninstalling a plugin, Michael Tokarev, 2025/05/14
- [Stable-7.2.18 12/18] target/i386/hvf: fix lflags_to_rflags, Michael Tokarev, 2025/05/14