]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop mips patch on request
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:39:55 +0000 (11:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:39:55 +0000 (11:39 +0100)
14 files changed:
queue-5.10/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-5.10/series
queue-5.15/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-5.15/series
queue-5.4/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-5.4/series
queue-6.1/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-6.1/series
queue-6.12/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-6.12/series
queue-6.17/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-6.17/series
queue-6.6/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch [deleted file]
queue-6.6/series

diff --git a/queue-5.10/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-5.10/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index 34190af..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -498,55 +499,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -592,6 +617,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index 1b8876be7550b8456fe30ef591aab8ceae178392..4a4b5a7211945d4d96372541b9f4a4122c4e2119 100644 (file)
@@ -215,7 +215,6 @@ isdn-misdn-hfcsusb-fix-memory-leak-in-hfcsusb_probe.patch
 hid-quirks-work-around-vid-pid-conflict-for-0x4c4a-0x4155.patch
 mtd-rawnand-cadence-fix-dma-device-null-pointer-dereference.patch
 exfat-check-return-value-of-sb_min_blocksize-in-exfat_read_boot_sector.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 be2net-pass-wrb_params-in-case-of-os2bmc.patch
 input-cros_ec_keyb-fix-an-invalid-memory-access.patch
 input-imx_sc_key-fix-memory-corruption-on-unload.patch
diff --git a/queue-5.15/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-5.15/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index 34190af..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -498,55 +499,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -592,6 +617,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index f1ef3a4b81993a47b3874e7d26a1cbab25e7c33d..6a6cd0cad83e063ede580ffac7949ae1e7052b66 100644 (file)
@@ -282,7 +282,6 @@ net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch
 hid-quirks-work-around-vid-pid-conflict-for-0x4c4a-0x4155.patch
 mtd-rawnand-cadence-fix-dma-device-null-pointer-dereference.patch
 exfat-check-return-value-of-sb_min_blocksize-in-exfat_read_boot_sector.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 be2net-pass-wrb_params-in-case-of-os2bmc.patch
 input-cros_ec_keyb-fix-an-invalid-memory-access.patch
 input-imx_sc_key-fix-memory-corruption-on-unload.patch
diff --git a/queue-5.4/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-5.4/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index e469bf7..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -497,55 +498,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -591,6 +616,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index e5a6de846c38648d2a1aafc21d6c1595f999852a..c497660889e9d592744bddcf6c75d6017d1b473b 100644 (file)
@@ -157,7 +157,6 @@ edac-altera-handle-ocram-ecc-enable-after-warm-reset.patch
 edac-altera-use-inttest-register-for-ethernet-and-usb-sbe-injection.patch
 isdn-misdn-hfcsusb-fix-memory-leak-in-hfcsusb_probe.patch
 hid-quirks-work-around-vid-pid-conflict-for-0x4c4a-0x4155.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 be2net-pass-wrb_params-in-case-of-os2bmc.patch
 input-cros_ec_keyb-fix-an-invalid-memory-access.patch
 scsi-sg-do-not-sleep-in-atomic-context.patch
diff --git a/queue-6.1/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-6.1/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index 34190af..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -498,55 +499,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -592,6 +617,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index d476c9d324ffd8ca4c205988126493b4cc618714..73f37f2d277ae238e70c587ce4288dc9964d3149 100644 (file)
@@ -432,7 +432,6 @@ mtd-rawnand-cadence-fix-dma-device-null-pointer-dereference.patch
 mtdchar-fix-integer-overflow-in-read-write-ioctls.patch
 exfat-check-return-value-of-sb_min_blocksize-in-exfat_read_boot_sector.patch
 mptcp-disallow-mptcp-subflows-from-sockmap.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 ata-libata-scsi-add-missing-scsi_device_put-in-ata_scsi_dev_rescan.patch
 be2net-pass-wrb_params-in-case-of-os2bmc.patch
 net-dsa-microchip-lan937x-fix-rgmii-delay-tuning.patch
diff --git a/queue-6.12/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-6.12/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index 7dff5ac..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -508,55 +509,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -602,6 +627,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index 5823d0b4981be54a9e7bd30bc0be0a54ac9561e2..84b854be94f0119eea16cef78bf85bfb7c434898 100644 (file)
@@ -14,7 +14,6 @@ exfat-check-return-value-of-sb_min_blocksize-in-exfat_read_boot_sector.patch
 mptcp-disallow-mptcp-subflows-from-sockmap.patch
 mptcp-fix-proto-fallback-detection-with-bpf.patch
 ata-libata-scsi-fix-system-suspend-for-a-security-locked-drive.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 smb-client-introduce-close_cached_dir_locked.patch
 ata-libata-scsi-add-missing-scsi_device_put-in-ata_scsi_dev_rescan.patch
 be2net-pass-wrb_params-in-case-of-os2bmc.patch
diff --git a/queue-6.17/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-6.17/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index 7dff5ac..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -508,55 +509,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -602,6 +627,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index 65c7cf553e79838733b3a56987af55bd27674f94..a5e5e784705cf90a8c550a1047b69bd4765e9db0 100644 (file)
@@ -23,7 +23,6 @@ mptcp-fix-proto-fallback-detection-with-bpf.patch
 lib-test_kho-check-if-kho-is-enabled.patch
 acpi-apei-einj-fix-einjv2-initialization-and-injection.patch
 ata-libata-scsi-fix-system-suspend-for-a-security-locked-drive.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 selinux-rename-task_security_struct-to-cred_security_struct.patch
 selinux-move-avdcache-to-per-task-security-struct.patch
 smb-client-introduce-close_cached_dir_locked.patch
diff --git a/queue-6.6/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch b/queue-6.6/mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
deleted file mode 100644 (file)
index 887151f..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9f048fa487409e364cf866c957cf0b0d782ca5a3 Mon Sep 17 00:00:00 2001
-From: "Maciej W. Rozycki" <macro@orcam.me.uk>
-Date: Thu, 13 Nov 2025 05:21:10 +0000
-Subject: MIPS: mm: Prevent a TLB shutdown on initial uniquification
-
-From: Maciej W. Rozycki <macro@orcam.me.uk>
-
-commit 9f048fa487409e364cf866c957cf0b0d782ca5a3 upstream.
-
-Depending on the particular CPU implementation a TLB shutdown may occur
-if multiple matching entries are detected upon the execution of a TLBP
-or the TLBWI/TLBWR instructions.  Given that we don't know what entries
-we have been handed we need to be very careful with the initial TLB
-setup and avoid all these instructions.
-
-Therefore read all the TLB entries one by one with the TLBR instruction,
-bypassing the content addressing logic, and truncate any large pages in
-place so as to avoid a case in the second step where an incoming entry
-for a large page at a lower address overlaps with a replacement entry
-chosen at another index.  Then preinitialize the TLB using addresses
-outside our usual unique range and avoiding clashes with any entries
-received, before making the usual call to local_flush_tlb_all().
-
-This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
-entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
-address).
-
-Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
-Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
-Cc: stable@vger.kernel.org
-Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
-Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/mips/mm/tlb-r4k.c |  102 ++++++++++++++++++++++++++++++-------------------
- 1 file changed, 64 insertions(+), 38 deletions(-)
-
---- a/arch/mips/mm/tlb-r4k.c
-+++ b/arch/mips/mm/tlb-r4k.c
-@@ -15,6 +15,7 @@
- #include <linux/mm.h>
- #include <linux/hugetlb.h>
- #include <linux/export.h>
-+#include <linux/sort.h>
- #include <asm/cpu.h>
- #include <asm/cpu-type.h>
-@@ -506,55 +507,79 @@ static int __init set_ntlb(char *str)
- __setup("ntlb=", set_ntlb);
--/* Initialise all TLB entries with unique values */
-+
-+/* Comparison function for EntryHi VPN fields.  */
-+static int r4k_vpn_cmp(const void *a, const void *b)
-+{
-+      long v = *(unsigned long *)a - *(unsigned long *)b;
-+      int s = sizeof(long) > sizeof(int) ? sizeof(long) * 8 - 1: 0;
-+      return s ? (v != 0) | v >> s : v;
-+}
-+
-+/*
-+ * Initialise all TLB entries with unique values that do not clash with
-+ * what we have been handed over and what we'll be using ourselves.
-+ */
- static void r4k_tlb_uniquify(void)
- {
--      int entry = num_wired_entries();
-+      unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
-+      int tlbsize = current_cpu_data.tlbsize;
-+      int start = num_wired_entries();
-+      unsigned long vpn_mask;
-+      int cnt, ent, idx, i;
-+
-+      vpn_mask = GENMASK(cpu_vmbits - 1, 13);
-+      vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
-       htw_stop();
--      write_c0_entrylo0(0);
--      write_c0_entrylo1(0);
--      while (entry < current_cpu_data.tlbsize) {
--              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
--              unsigned long asid = 0;
--              int idx;
-+      for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
-+              unsigned long vpn;
--              /* Skip wired MMID to make ginvt_mmid work */
--              if (cpu_has_mmid)
--                      asid = MMID_KERNEL_WIRED + 1;
-+              write_c0_index(i);
-+              mtc0_tlbr_hazard();
-+              tlb_read();
-+              tlb_read_hazard();
-+              vpn = read_c0_entryhi();
-+              vpn &= vpn_mask & PAGE_MASK;
-+              tlb_vpns[cnt] = vpn;
--              /* Check for match before using UNIQUE_ENTRYHI */
--              do {
--                      if (cpu_has_mmid) {
--                              write_c0_memorymapid(asid);
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
--                      } else {
--                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
--                      }
--                      mtc0_tlbw_hazard();
--                      tlb_probe();
--                      tlb_probe_hazard();
--                      idx = read_c0_index();
--                      /* No match or match is on current entry */
--                      if (idx < 0 || idx == entry)
--                              break;
--                      /*
--                       * If we hit a match, we need to try again with
--                       * a different ASID.
--                       */
--                      asid++;
--              } while (asid < asid_mask);
--
--              if (idx >= 0 && idx != entry)
--                      panic("Unable to uniquify TLB entry %d", idx);
--
--              write_c0_index(entry);
-+              /* Prevent any large pages from overlapping regular ones.  */
-+              write_c0_pagemask(read_c0_pagemask() & PM_DEFAULT_MASK);
-               mtc0_tlbw_hazard();
-               tlb_write_indexed();
--              entry++;
-+              tlbw_use_hazard();
-       }
-+      sort(tlb_vpns, cnt, sizeof(tlb_vpns[0]), r4k_vpn_cmp, NULL);
-+
-+      write_c0_pagemask(PM_DEFAULT_MASK);
-+      write_c0_entrylo0(0);
-+      write_c0_entrylo1(0);
-+
-+      idx = 0;
-+      ent = tlbsize;
-+      for (i = start; i < tlbsize; i++)
-+              while (1) {
-+                      unsigned long entryhi, vpn;
-+
-+                      entryhi = UNIQUE_ENTRYHI(ent);
-+                      vpn = entryhi & vpn_mask & PAGE_MASK;
-+
-+                      if (idx >= cnt || vpn < tlb_vpns[idx]) {
-+                              write_c0_entryhi(entryhi);
-+                              write_c0_index(i);
-+                              mtc0_tlbw_hazard();
-+                              tlb_write_indexed();
-+                              ent++;
-+                              break;
-+                      } else if (vpn == tlb_vpns[idx]) {
-+                              ent++;
-+                      } else {
-+                              idx++;
-+                      }
-+              }
-+
-       tlbw_use_hazard();
-       htw_start();
-       flush_micro_tlb();
-@@ -600,6 +625,7 @@ static void r4k_tlb_configure(void)
-       /* From this point on the ARC firmware is dead.  */
-       r4k_tlb_uniquify();
-+      local_flush_tlb_all();
-       /* Did I tell you that ARC SUCKS?  */
- }
index 1dfe27609ec605446e24b39243526b10cc499598..d30021bf59e1cdfcdc522e9787935075fc95d448 100644 (file)
@@ -7,7 +7,6 @@ exfat-check-return-value-of-sb_min_blocksize-in-exfat_read_boot_sector.patch
 mptcp-disallow-mptcp-subflows-from-sockmap.patch
 mptcp-fix-proto-fallback-detection-with-bpf.patch
 ata-libata-scsi-fix-system-suspend-for-a-security-locked-drive.patch
-mips-mm-prevent-a-tlb-shutdown-on-initial-uniquification.patch
 smb-client-introduce-close_cached_dir_locked.patch
 ata-libata-scsi-add-missing-scsi_device_put-in-ata_scsi_dev_rescan.patch
 be2net-pass-wrb_params-in-case-of-os2bmc.patch