From: Sasha Levin Date: Sun, 6 Oct 2024 08:06:52 +0000 (-0400) Subject: Drop xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch X-Git-Tag: v6.6.55~137 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b9d5b6ec38e09dae67c9b2ec78fe8d6964e84f60;p=thirdparty%2Fkernel%2Fstable-queue.git Drop xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/series b/queue-4.19/series index 8ad3f86ddc0..0c953e96c37 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -61,7 +61,6 @@ drm-msm-a5xx-fix-races-in-preemption-evaluation-stag.patch ipmi-docs-don-t-advertise-deprecated-sysfs-entries.patch drm-msm-fix-s-null-argument-error.patch xen-use-correct-end-address-of-kernel-for-conflict-c.patch -xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch xen-swiotlb-simplify-range_straddles_page_boundary.patch xen-swiotlb-add-alignment-check-for-dma-buffers.patch selftests-bpf-fix-error-compiling-test_lru_map.c.patch diff --git a/queue-4.19/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch b/queue-4.19/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch deleted file mode 100644 index 86ffe86eef7..00000000000 --- a/queue-4.19/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 96e05f7863867acad3a2f1a9fde01f59cb56b9e4 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 6 Aug 2024 10:24:41 +0200 -Subject: xen: move max_pfn in xen_memory_setup() out of function scope -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Juergen Gross - -[ Upstream commit 43dc2a0f479b9cd30f6674986d7a40517e999d31 ] - -Instead of having max_pfn as a local variable of xen_memory_setup(), -make it a static variable in setup.c instead. This avoids having to -pass it to subfunctions, which will be needed in more cases in future. - -Rename it to ini_nr_pages, as the value denotes the currently usable -number of memory pages as passed from the hypervisor at boot time. - -Signed-off-by: Juergen Gross -Tested-by: Marek Marczykowski-Górecki -Reviewed-by: Jan Beulich -Signed-off-by: Juergen Gross -Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory") -Signed-off-by: Sasha Levin ---- - arch/x86/xen/setup.c | 52 ++++++++++++++++++++++---------------------- - 1 file changed, 26 insertions(+), 26 deletions(-) - -diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c -index 2fd89830b1ffb..64824e922c6ca 100644 ---- a/arch/x86/xen/setup.c -+++ b/arch/x86/xen/setup.c -@@ -44,6 +44,9 @@ unsigned long xen_released_pages; - /* E820 map used during setting up memory. */ - static struct e820_table xen_e820_table __initdata; - -+/* Number of initially usable memory pages. */ -+static unsigned long ini_nr_pages __initdata; -+ - /* - * Buffer used to remap identity mapped pages. We only need the virtual space. - * The physical page behind this address is remapped as needed to different -@@ -251,7 +254,7 @@ static int __init xen_free_mfn(unsigned long mfn) - * as a fallback if the remapping fails. - */ - static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, -- unsigned long end_pfn, unsigned long nr_pages) -+ unsigned long end_pfn) - { - unsigned long pfn, end; - int ret; -@@ -259,7 +262,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, - WARN_ON(start_pfn > end_pfn); - - /* Release pages first. */ -- end = min(end_pfn, nr_pages); -+ end = min(end_pfn, ini_nr_pages); - for (pfn = start_pfn; pfn < end; pfn++) { - unsigned long mfn = pfn_to_mfn(pfn); - -@@ -384,15 +387,14 @@ static void __init xen_do_set_identity_and_remap_chunk( - * to Xen and not remapped. - */ - static unsigned long __init xen_set_identity_and_remap_chunk( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -- unsigned long remap_pfn) -+ unsigned long start_pfn, unsigned long end_pfn, unsigned long remap_pfn) - { - unsigned long pfn; - unsigned long i = 0; - unsigned long n = end_pfn - start_pfn; - - if (remap_pfn == 0) -- remap_pfn = nr_pages; -+ remap_pfn = ini_nr_pages; - - while (i < n) { - unsigned long cur_pfn = start_pfn + i; -@@ -401,19 +403,19 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - unsigned long remap_range_size; - - /* Do not remap pages beyond the current allocation */ -- if (cur_pfn >= nr_pages) { -+ if (cur_pfn >= ini_nr_pages) { - /* Identity map remaining pages */ - set_phys_range_identity(cur_pfn, cur_pfn + size); - break; - } -- if (cur_pfn + size > nr_pages) -- size = nr_pages - cur_pfn; -+ if (cur_pfn + size > ini_nr_pages) -+ size = ini_nr_pages - cur_pfn; - - remap_range_size = xen_find_pfn_range(&remap_pfn); - if (!remap_range_size) { - pr_warning("Unable to find available pfn range, not remapping identity pages\n"); - xen_set_identity_and_release_chunk(cur_pfn, -- cur_pfn + left, nr_pages); -+ cur_pfn + left); - break; - } - /* Adjust size to fit in current e820 RAM region */ -@@ -440,18 +442,18 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - } - - static unsigned long __init xen_count_remap_pages( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -+ unsigned long start_pfn, unsigned long end_pfn, - unsigned long remap_pages) - { -- if (start_pfn >= nr_pages) -+ if (start_pfn >= ini_nr_pages) - return remap_pages; - -- return remap_pages + min(end_pfn, nr_pages) - start_pfn; -+ return remap_pages + min(end_pfn, ini_nr_pages) - start_pfn; - } - --static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, -+static unsigned long __init xen_foreach_remap_area( - unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, -- unsigned long nr_pages, unsigned long last_val)) -+ unsigned long last_val)) - { - phys_addr_t start = 0; - unsigned long ret_val = 0; -@@ -479,8 +481,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, - end_pfn = PFN_UP(entry->addr); - - if (start_pfn < end_pfn) -- ret_val = func(start_pfn, end_pfn, nr_pages, -- ret_val); -+ ret_val = func(start_pfn, end_pfn, ret_val); - start = end; - } - } -@@ -747,7 +748,7 @@ static void __init xen_reserve_xen_mfnlist(void) - **/ - char * __init xen_memory_setup(void) - { -- unsigned long max_pfn, pfn_s, n_pfns; -+ unsigned long pfn_s, n_pfns; - phys_addr_t mem_end, addr, size, chunk_size; - u32 type; - int rc; -@@ -759,9 +760,8 @@ char * __init xen_memory_setup(void) - int op; - - xen_parse_512gb(); -- max_pfn = xen_get_pages_limit(); -- max_pfn = min(max_pfn, xen_start_info->nr_pages); -- mem_end = PFN_PHYS(max_pfn); -+ ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages); -+ mem_end = PFN_PHYS(ini_nr_pages); - - memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries); - set_xen_guest_handle(memmap.buffer, xen_e820_table.entries); -@@ -801,10 +801,10 @@ char * __init xen_memory_setup(void) - max_pages = xen_get_max_pages(); - - /* How many extra pages do we need due to remapping? */ -- max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); -+ max_pages += xen_foreach_remap_area(xen_count_remap_pages); - -- if (max_pages > max_pfn) -- extra_pages += max_pages - max_pfn; -+ if (max_pages > ini_nr_pages) -+ extra_pages += max_pages - ini_nr_pages; - - /* - * Clamp the amount of extra memory to a EXTRA_MEM_RATIO -@@ -820,8 +820,8 @@ char * __init xen_memory_setup(void) - * the initial memory is also very large with respect to - * lowmem, but we won't try to deal with that here. - */ -- maxmem_pages = EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)); -- extra_pages = min3(maxmem_pages, extra_pages, max_pages - max_pfn); -+ maxmem_pages = EXTRA_MEM_RATIO * min(ini_nr_pages, PFN_DOWN(MAXMEM)); -+ extra_pages = min3(maxmem_pages, extra_pages, max_pages - ini_nr_pages); - i = 0; - addr = xen_e820_table.entries[0].addr; - size = xen_e820_table.entries[0].size; -@@ -923,7 +923,7 @@ char * __init xen_memory_setup(void) - * Set identity map on non-RAM pages and prepare remapping the - * underlying RAM. - */ -- xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); -+ xen_foreach_remap_area(xen_set_identity_and_remap_chunk); - - pr_info("Released %ld page(s)\n", xen_released_pages); - --- -2.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index cdb1ddc1dc6..a8f1a04126b 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -131,7 +131,6 @@ ipmi-docs-don-t-advertise-deprecated-sysfs-entries.patch drm-msm-fix-s-null-argument-error.patch drivers-drm-exynos_drm_gsc-fix-wrong-assignment-in-g.patch xen-use-correct-end-address-of-kernel-for-conflict-c.patch -xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch xen-swiotlb-add-alignment-check-for-dma-buffers.patch tpm-clean-up-tpm-space-after-command-failure.patch selftests-bpf-fix-compile-error-from-rlim_t-in-sk_st.patch diff --git a/queue-5.10/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch b/queue-5.10/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch deleted file mode 100644 index 1bad0ca59f2..00000000000 --- a/queue-5.10/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 73d5b414cdd10b0c10bf263da78b921b4ed8801c Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 6 Aug 2024 10:24:41 +0200 -Subject: xen: move max_pfn in xen_memory_setup() out of function scope -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Juergen Gross - -[ Upstream commit 43dc2a0f479b9cd30f6674986d7a40517e999d31 ] - -Instead of having max_pfn as a local variable of xen_memory_setup(), -make it a static variable in setup.c instead. This avoids having to -pass it to subfunctions, which will be needed in more cases in future. - -Rename it to ini_nr_pages, as the value denotes the currently usable -number of memory pages as passed from the hypervisor at boot time. - -Signed-off-by: Juergen Gross -Tested-by: Marek Marczykowski-Górecki -Reviewed-by: Jan Beulich -Signed-off-by: Juergen Gross -Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory") -Signed-off-by: Sasha Levin ---- - arch/x86/xen/setup.c | 52 ++++++++++++++++++++++---------------------- - 1 file changed, 26 insertions(+), 26 deletions(-) - -diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c -index 7fb9c9e368158..ffe2b3918cbb2 100644 ---- a/arch/x86/xen/setup.c -+++ b/arch/x86/xen/setup.c -@@ -45,6 +45,9 @@ unsigned long xen_released_pages; - /* E820 map used during setting up memory. */ - static struct e820_table xen_e820_table __initdata; - -+/* Number of initially usable memory pages. */ -+static unsigned long ini_nr_pages __initdata; -+ - /* - * Buffer used to remap identity mapped pages. We only need the virtual space. - * The physical page behind this address is remapped as needed to different -@@ -252,7 +255,7 @@ static int __init xen_free_mfn(unsigned long mfn) - * as a fallback if the remapping fails. - */ - static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, -- unsigned long end_pfn, unsigned long nr_pages) -+ unsigned long end_pfn) - { - unsigned long pfn, end; - int ret; -@@ -260,7 +263,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, - WARN_ON(start_pfn > end_pfn); - - /* Release pages first. */ -- end = min(end_pfn, nr_pages); -+ end = min(end_pfn, ini_nr_pages); - for (pfn = start_pfn; pfn < end; pfn++) { - unsigned long mfn = pfn_to_mfn(pfn); - -@@ -385,15 +388,14 @@ static void __init xen_do_set_identity_and_remap_chunk( - * to Xen and not remapped. - */ - static unsigned long __init xen_set_identity_and_remap_chunk( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -- unsigned long remap_pfn) -+ unsigned long start_pfn, unsigned long end_pfn, unsigned long remap_pfn) - { - unsigned long pfn; - unsigned long i = 0; - unsigned long n = end_pfn - start_pfn; - - if (remap_pfn == 0) -- remap_pfn = nr_pages; -+ remap_pfn = ini_nr_pages; - - while (i < n) { - unsigned long cur_pfn = start_pfn + i; -@@ -402,19 +404,19 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - unsigned long remap_range_size; - - /* Do not remap pages beyond the current allocation */ -- if (cur_pfn >= nr_pages) { -+ if (cur_pfn >= ini_nr_pages) { - /* Identity map remaining pages */ - set_phys_range_identity(cur_pfn, cur_pfn + size); - break; - } -- if (cur_pfn + size > nr_pages) -- size = nr_pages - cur_pfn; -+ if (cur_pfn + size > ini_nr_pages) -+ size = ini_nr_pages - cur_pfn; - - remap_range_size = xen_find_pfn_range(&remap_pfn); - if (!remap_range_size) { - pr_warn("Unable to find available pfn range, not remapping identity pages\n"); - xen_set_identity_and_release_chunk(cur_pfn, -- cur_pfn + left, nr_pages); -+ cur_pfn + left); - break; - } - /* Adjust size to fit in current e820 RAM region */ -@@ -441,18 +443,18 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - } - - static unsigned long __init xen_count_remap_pages( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -+ unsigned long start_pfn, unsigned long end_pfn, - unsigned long remap_pages) - { -- if (start_pfn >= nr_pages) -+ if (start_pfn >= ini_nr_pages) - return remap_pages; - -- return remap_pages + min(end_pfn, nr_pages) - start_pfn; -+ return remap_pages + min(end_pfn, ini_nr_pages) - start_pfn; - } - --static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, -+static unsigned long __init xen_foreach_remap_area( - unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, -- unsigned long nr_pages, unsigned long last_val)) -+ unsigned long last_val)) - { - phys_addr_t start = 0; - unsigned long ret_val = 0; -@@ -480,8 +482,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, - end_pfn = PFN_UP(entry->addr); - - if (start_pfn < end_pfn) -- ret_val = func(start_pfn, end_pfn, nr_pages, -- ret_val); -+ ret_val = func(start_pfn, end_pfn, ret_val); - start = end; - } - } -@@ -744,7 +745,7 @@ static void __init xen_reserve_xen_mfnlist(void) - **/ - char * __init xen_memory_setup(void) - { -- unsigned long max_pfn, pfn_s, n_pfns; -+ unsigned long pfn_s, n_pfns; - phys_addr_t mem_end, addr, size, chunk_size; - u32 type; - int rc; -@@ -756,9 +757,8 @@ char * __init xen_memory_setup(void) - int op; - - xen_parse_512gb(); -- max_pfn = xen_get_pages_limit(); -- max_pfn = min(max_pfn, xen_start_info->nr_pages); -- mem_end = PFN_PHYS(max_pfn); -+ ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages); -+ mem_end = PFN_PHYS(ini_nr_pages); - - memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries); - set_xen_guest_handle(memmap.buffer, xen_e820_table.entries); -@@ -802,10 +802,10 @@ char * __init xen_memory_setup(void) - max_pages = xen_get_max_pages(); - - /* How many extra pages do we need due to remapping? */ -- max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); -+ max_pages += xen_foreach_remap_area(xen_count_remap_pages); - -- if (max_pages > max_pfn) -- extra_pages += max_pages - max_pfn; -+ if (max_pages > ini_nr_pages) -+ extra_pages += max_pages - ini_nr_pages; - - /* - * Clamp the amount of extra memory to a EXTRA_MEM_RATIO -@@ -814,8 +814,8 @@ char * __init xen_memory_setup(void) - * Make sure we have no memory above max_pages, as this area - * isn't handled by the p2m management. - */ -- maxmem_pages = EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)); -- extra_pages = min3(maxmem_pages, extra_pages, max_pages - max_pfn); -+ maxmem_pages = EXTRA_MEM_RATIO * min(ini_nr_pages, PFN_DOWN(MAXMEM)); -+ extra_pages = min3(maxmem_pages, extra_pages, max_pages - ini_nr_pages); - i = 0; - addr = xen_e820_table.entries[0].addr; - size = xen_e820_table.entries[0].size; -@@ -917,7 +917,7 @@ char * __init xen_memory_setup(void) - * Set identity map on non-RAM pages and prepare remapping the - * underlying RAM. - */ -- xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); -+ xen_foreach_remap_area(xen_set_identity_and_remap_chunk); - - pr_info("Released %ld page(s)\n", xen_released_pages); - --- -2.43.0 - diff --git a/queue-5.15/series b/queue-5.15/series index 6075da2beef..9d4dbaaa989 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -172,7 +172,6 @@ ipmi-docs-don-t-advertise-deprecated-sysfs-entries.patch drm-msm-fix-s-null-argument-error.patch drivers-drm-exynos_drm_gsc-fix-wrong-assignment-in-g.patch xen-use-correct-end-address-of-kernel-for-conflict-c.patch -xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch xen-swiotlb-add-alignment-check-for-dma-buffers.patch tpm-clean-up-tpm-space-after-command-failure.patch selftests-bpf-fix-compile-error-from-rlim_t-in-sk_st.patch diff --git a/queue-5.15/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch b/queue-5.15/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch deleted file mode 100644 index 29a308578bd..00000000000 --- a/queue-5.15/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 3def24c7def35fae03ff7a9f1a26b0fc11fe91e5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 6 Aug 2024 10:24:41 +0200 -Subject: xen: move max_pfn in xen_memory_setup() out of function scope -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Juergen Gross - -[ Upstream commit 43dc2a0f479b9cd30f6674986d7a40517e999d31 ] - -Instead of having max_pfn as a local variable of xen_memory_setup(), -make it a static variable in setup.c instead. This avoids having to -pass it to subfunctions, which will be needed in more cases in future. - -Rename it to ini_nr_pages, as the value denotes the currently usable -number of memory pages as passed from the hypervisor at boot time. - -Signed-off-by: Juergen Gross -Tested-by: Marek Marczykowski-Górecki -Reviewed-by: Jan Beulich -Signed-off-by: Juergen Gross -Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory") -Signed-off-by: Sasha Levin ---- - arch/x86/xen/setup.c | 52 ++++++++++++++++++++++---------------------- - 1 file changed, 26 insertions(+), 26 deletions(-) - -diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c -index 7fb9c9e368158..ffe2b3918cbb2 100644 ---- a/arch/x86/xen/setup.c -+++ b/arch/x86/xen/setup.c -@@ -45,6 +45,9 @@ unsigned long xen_released_pages; - /* E820 map used during setting up memory. */ - static struct e820_table xen_e820_table __initdata; - -+/* Number of initially usable memory pages. */ -+static unsigned long ini_nr_pages __initdata; -+ - /* - * Buffer used to remap identity mapped pages. We only need the virtual space. - * The physical page behind this address is remapped as needed to different -@@ -252,7 +255,7 @@ static int __init xen_free_mfn(unsigned long mfn) - * as a fallback if the remapping fails. - */ - static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, -- unsigned long end_pfn, unsigned long nr_pages) -+ unsigned long end_pfn) - { - unsigned long pfn, end; - int ret; -@@ -260,7 +263,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, - WARN_ON(start_pfn > end_pfn); - - /* Release pages first. */ -- end = min(end_pfn, nr_pages); -+ end = min(end_pfn, ini_nr_pages); - for (pfn = start_pfn; pfn < end; pfn++) { - unsigned long mfn = pfn_to_mfn(pfn); - -@@ -385,15 +388,14 @@ static void __init xen_do_set_identity_and_remap_chunk( - * to Xen and not remapped. - */ - static unsigned long __init xen_set_identity_and_remap_chunk( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -- unsigned long remap_pfn) -+ unsigned long start_pfn, unsigned long end_pfn, unsigned long remap_pfn) - { - unsigned long pfn; - unsigned long i = 0; - unsigned long n = end_pfn - start_pfn; - - if (remap_pfn == 0) -- remap_pfn = nr_pages; -+ remap_pfn = ini_nr_pages; - - while (i < n) { - unsigned long cur_pfn = start_pfn + i; -@@ -402,19 +404,19 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - unsigned long remap_range_size; - - /* Do not remap pages beyond the current allocation */ -- if (cur_pfn >= nr_pages) { -+ if (cur_pfn >= ini_nr_pages) { - /* Identity map remaining pages */ - set_phys_range_identity(cur_pfn, cur_pfn + size); - break; - } -- if (cur_pfn + size > nr_pages) -- size = nr_pages - cur_pfn; -+ if (cur_pfn + size > ini_nr_pages) -+ size = ini_nr_pages - cur_pfn; - - remap_range_size = xen_find_pfn_range(&remap_pfn); - if (!remap_range_size) { - pr_warn("Unable to find available pfn range, not remapping identity pages\n"); - xen_set_identity_and_release_chunk(cur_pfn, -- cur_pfn + left, nr_pages); -+ cur_pfn + left); - break; - } - /* Adjust size to fit in current e820 RAM region */ -@@ -441,18 +443,18 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - } - - static unsigned long __init xen_count_remap_pages( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -+ unsigned long start_pfn, unsigned long end_pfn, - unsigned long remap_pages) - { -- if (start_pfn >= nr_pages) -+ if (start_pfn >= ini_nr_pages) - return remap_pages; - -- return remap_pages + min(end_pfn, nr_pages) - start_pfn; -+ return remap_pages + min(end_pfn, ini_nr_pages) - start_pfn; - } - --static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, -+static unsigned long __init xen_foreach_remap_area( - unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, -- unsigned long nr_pages, unsigned long last_val)) -+ unsigned long last_val)) - { - phys_addr_t start = 0; - unsigned long ret_val = 0; -@@ -480,8 +482,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, - end_pfn = PFN_UP(entry->addr); - - if (start_pfn < end_pfn) -- ret_val = func(start_pfn, end_pfn, nr_pages, -- ret_val); -+ ret_val = func(start_pfn, end_pfn, ret_val); - start = end; - } - } -@@ -744,7 +745,7 @@ static void __init xen_reserve_xen_mfnlist(void) - **/ - char * __init xen_memory_setup(void) - { -- unsigned long max_pfn, pfn_s, n_pfns; -+ unsigned long pfn_s, n_pfns; - phys_addr_t mem_end, addr, size, chunk_size; - u32 type; - int rc; -@@ -756,9 +757,8 @@ char * __init xen_memory_setup(void) - int op; - - xen_parse_512gb(); -- max_pfn = xen_get_pages_limit(); -- max_pfn = min(max_pfn, xen_start_info->nr_pages); -- mem_end = PFN_PHYS(max_pfn); -+ ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages); -+ mem_end = PFN_PHYS(ini_nr_pages); - - memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries); - set_xen_guest_handle(memmap.buffer, xen_e820_table.entries); -@@ -802,10 +802,10 @@ char * __init xen_memory_setup(void) - max_pages = xen_get_max_pages(); - - /* How many extra pages do we need due to remapping? */ -- max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); -+ max_pages += xen_foreach_remap_area(xen_count_remap_pages); - -- if (max_pages > max_pfn) -- extra_pages += max_pages - max_pfn; -+ if (max_pages > ini_nr_pages) -+ extra_pages += max_pages - ini_nr_pages; - - /* - * Clamp the amount of extra memory to a EXTRA_MEM_RATIO -@@ -814,8 +814,8 @@ char * __init xen_memory_setup(void) - * Make sure we have no memory above max_pages, as this area - * isn't handled by the p2m management. - */ -- maxmem_pages = EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)); -- extra_pages = min3(maxmem_pages, extra_pages, max_pages - max_pfn); -+ maxmem_pages = EXTRA_MEM_RATIO * min(ini_nr_pages, PFN_DOWN(MAXMEM)); -+ extra_pages = min3(maxmem_pages, extra_pages, max_pages - ini_nr_pages); - i = 0; - addr = xen_e820_table.entries[0].addr; - size = xen_e820_table.entries[0].size; -@@ -917,7 +917,7 @@ char * __init xen_memory_setup(void) - * Set identity map on non-RAM pages and prepare remapping the - * underlying RAM. - */ -- xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); -+ xen_foreach_remap_area(xen_set_identity_and_remap_chunk); - - pr_info("Released %ld page(s)\n", xen_released_pages); - --- -2.43.0 - diff --git a/queue-5.4/series b/queue-5.4/series index 7c8fa270c82..037f51c20d7 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -83,7 +83,6 @@ ipmi-docs-don-t-advertise-deprecated-sysfs-entries.patch drm-msm-fix-s-null-argument-error.patch drivers-drm-exynos_drm_gsc-fix-wrong-assignment-in-g.patch xen-use-correct-end-address-of-kernel-for-conflict-c.patch -xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch xen-swiotlb-add-alignment-check-for-dma-buffers.patch tpm-clean-up-tpm-space-after-command-failure.patch selftests-bpf-fix-compile-error-from-rlim_t-in-sk_st.patch diff --git a/queue-5.4/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch b/queue-5.4/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch deleted file mode 100644 index f4a42ae19ad..00000000000 --- a/queue-5.4/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch +++ /dev/null @@ -1,195 +0,0 @@ -From b01599fcf0d6790c680afb5b64b305062f65224e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 6 Aug 2024 10:24:41 +0200 -Subject: xen: move max_pfn in xen_memory_setup() out of function scope -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Juergen Gross - -[ Upstream commit 43dc2a0f479b9cd30f6674986d7a40517e999d31 ] - -Instead of having max_pfn as a local variable of xen_memory_setup(), -make it a static variable in setup.c instead. This avoids having to -pass it to subfunctions, which will be needed in more cases in future. - -Rename it to ini_nr_pages, as the value denotes the currently usable -number of memory pages as passed from the hypervisor at boot time. - -Signed-off-by: Juergen Gross -Tested-by: Marek Marczykowski-Górecki -Reviewed-by: Jan Beulich -Signed-off-by: Juergen Gross -Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory") -Signed-off-by: Sasha Levin ---- - arch/x86/xen/setup.c | 52 ++++++++++++++++++++++---------------------- - 1 file changed, 26 insertions(+), 26 deletions(-) - -diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c -index 32ac3deb193b9..f77c268f8f019 100644 ---- a/arch/x86/xen/setup.c -+++ b/arch/x86/xen/setup.c -@@ -45,6 +45,9 @@ unsigned long xen_released_pages; - /* E820 map used during setting up memory. */ - static struct e820_table xen_e820_table __initdata; - -+/* Number of initially usable memory pages. */ -+static unsigned long ini_nr_pages __initdata; -+ - /* - * Buffer used to remap identity mapped pages. We only need the virtual space. - * The physical page behind this address is remapped as needed to different -@@ -252,7 +255,7 @@ static int __init xen_free_mfn(unsigned long mfn) - * as a fallback if the remapping fails. - */ - static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, -- unsigned long end_pfn, unsigned long nr_pages) -+ unsigned long end_pfn) - { - unsigned long pfn, end; - int ret; -@@ -260,7 +263,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, - WARN_ON(start_pfn > end_pfn); - - /* Release pages first. */ -- end = min(end_pfn, nr_pages); -+ end = min(end_pfn, ini_nr_pages); - for (pfn = start_pfn; pfn < end; pfn++) { - unsigned long mfn = pfn_to_mfn(pfn); - -@@ -385,15 +388,14 @@ static void __init xen_do_set_identity_and_remap_chunk( - * to Xen and not remapped. - */ - static unsigned long __init xen_set_identity_and_remap_chunk( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -- unsigned long remap_pfn) -+ unsigned long start_pfn, unsigned long end_pfn, unsigned long remap_pfn) - { - unsigned long pfn; - unsigned long i = 0; - unsigned long n = end_pfn - start_pfn; - - if (remap_pfn == 0) -- remap_pfn = nr_pages; -+ remap_pfn = ini_nr_pages; - - while (i < n) { - unsigned long cur_pfn = start_pfn + i; -@@ -402,19 +404,19 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - unsigned long remap_range_size; - - /* Do not remap pages beyond the current allocation */ -- if (cur_pfn >= nr_pages) { -+ if (cur_pfn >= ini_nr_pages) { - /* Identity map remaining pages */ - set_phys_range_identity(cur_pfn, cur_pfn + size); - break; - } -- if (cur_pfn + size > nr_pages) -- size = nr_pages - cur_pfn; -+ if (cur_pfn + size > ini_nr_pages) -+ size = ini_nr_pages - cur_pfn; - - remap_range_size = xen_find_pfn_range(&remap_pfn); - if (!remap_range_size) { - pr_warning("Unable to find available pfn range, not remapping identity pages\n"); - xen_set_identity_and_release_chunk(cur_pfn, -- cur_pfn + left, nr_pages); -+ cur_pfn + left); - break; - } - /* Adjust size to fit in current e820 RAM region */ -@@ -441,18 +443,18 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - } - - static unsigned long __init xen_count_remap_pages( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -+ unsigned long start_pfn, unsigned long end_pfn, - unsigned long remap_pages) - { -- if (start_pfn >= nr_pages) -+ if (start_pfn >= ini_nr_pages) - return remap_pages; - -- return remap_pages + min(end_pfn, nr_pages) - start_pfn; -+ return remap_pages + min(end_pfn, ini_nr_pages) - start_pfn; - } - --static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, -+static unsigned long __init xen_foreach_remap_area( - unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, -- unsigned long nr_pages, unsigned long last_val)) -+ unsigned long last_val)) - { - phys_addr_t start = 0; - unsigned long ret_val = 0; -@@ -480,8 +482,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, - end_pfn = PFN_UP(entry->addr); - - if (start_pfn < end_pfn) -- ret_val = func(start_pfn, end_pfn, nr_pages, -- ret_val); -+ ret_val = func(start_pfn, end_pfn, ret_val); - start = end; - } - } -@@ -756,7 +757,7 @@ static void __init xen_reserve_xen_mfnlist(void) - **/ - char * __init xen_memory_setup(void) - { -- unsigned long max_pfn, pfn_s, n_pfns; -+ unsigned long pfn_s, n_pfns; - phys_addr_t mem_end, addr, size, chunk_size; - u32 type; - int rc; -@@ -768,9 +769,8 @@ char * __init xen_memory_setup(void) - int op; - - xen_parse_512gb(); -- max_pfn = xen_get_pages_limit(); -- max_pfn = min(max_pfn, xen_start_info->nr_pages); -- mem_end = PFN_PHYS(max_pfn); -+ ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages); -+ mem_end = PFN_PHYS(ini_nr_pages); - - memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries); - set_xen_guest_handle(memmap.buffer, xen_e820_table.entries); -@@ -814,10 +814,10 @@ char * __init xen_memory_setup(void) - max_pages = xen_get_max_pages(); - - /* How many extra pages do we need due to remapping? */ -- max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); -+ max_pages += xen_foreach_remap_area(xen_count_remap_pages); - -- if (max_pages > max_pfn) -- extra_pages += max_pages - max_pfn; -+ if (max_pages > ini_nr_pages) -+ extra_pages += max_pages - ini_nr_pages; - - /* - * Clamp the amount of extra memory to a EXTRA_MEM_RATIO -@@ -833,8 +833,8 @@ char * __init xen_memory_setup(void) - * the initial memory is also very large with respect to - * lowmem, but we won't try to deal with that here. - */ -- maxmem_pages = EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)); -- extra_pages = min3(maxmem_pages, extra_pages, max_pages - max_pfn); -+ maxmem_pages = EXTRA_MEM_RATIO * min(ini_nr_pages, PFN_DOWN(MAXMEM)); -+ extra_pages = min3(maxmem_pages, extra_pages, max_pages - ini_nr_pages); - i = 0; - addr = xen_e820_table.entries[0].addr; - size = xen_e820_table.entries[0].size; -@@ -936,7 +936,7 @@ char * __init xen_memory_setup(void) - * Set identity map on non-RAM pages and prepare remapping the - * underlying RAM. - */ -- xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); -+ xen_foreach_remap_area(xen_set_identity_and_remap_chunk); - - pr_info("Released %ld page(s)\n", xen_released_pages); - --- -2.43.0 - diff --git a/queue-6.1/series b/queue-6.1/series index c762eaf143d..4f5bba46811 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -132,7 +132,6 @@ drivers-drm-exynos_drm_gsc-fix-wrong-assignment-in-g.patch xen-use-correct-end-address-of-kernel-for-conflict-c.patch hid-wacom-support-sequence-numbers-smaller-than-16-b.patch hid-wacom-do-not-warn-about-dropped-packets-for-firs.patch -xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch xen-swiotlb-add-alignment-check-for-dma-buffers.patch xen-swiotlb-fix-allocated-size.patch tpm-clean-up-tpm-space-after-command-failure.patch diff --git a/queue-6.1/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch b/queue-6.1/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch deleted file mode 100644 index 953b72092e9..00000000000 --- a/queue-6.1/xen-move-max_pfn-in-xen_memory_setup-out-of-function.patch +++ /dev/null @@ -1,195 +0,0 @@ -From bd83746529b2e5643edb183620b3e154f1cb17fe Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 6 Aug 2024 10:24:41 +0200 -Subject: xen: move max_pfn in xen_memory_setup() out of function scope -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Juergen Gross - -[ Upstream commit 43dc2a0f479b9cd30f6674986d7a40517e999d31 ] - -Instead of having max_pfn as a local variable of xen_memory_setup(), -make it a static variable in setup.c instead. This avoids having to -pass it to subfunctions, which will be needed in more cases in future. - -Rename it to ini_nr_pages, as the value denotes the currently usable -number of memory pages as passed from the hypervisor at boot time. - -Signed-off-by: Juergen Gross -Tested-by: Marek Marczykowski-Górecki -Reviewed-by: Jan Beulich -Signed-off-by: Juergen Gross -Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory") -Signed-off-by: Sasha Levin ---- - arch/x86/xen/setup.c | 52 ++++++++++++++++++++++---------------------- - 1 file changed, 26 insertions(+), 26 deletions(-) - -diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c -index 96fb245d901b3..af18bd7e0700d 100644 ---- a/arch/x86/xen/setup.c -+++ b/arch/x86/xen/setup.c -@@ -46,6 +46,9 @@ unsigned long xen_released_pages; - /* E820 map used during setting up memory. */ - static struct e820_table xen_e820_table __initdata; - -+/* Number of initially usable memory pages. */ -+static unsigned long ini_nr_pages __initdata; -+ - /* - * Buffer used to remap identity mapped pages. We only need the virtual space. - * The physical page behind this address is remapped as needed to different -@@ -253,7 +256,7 @@ static int __init xen_free_mfn(unsigned long mfn) - * as a fallback if the remapping fails. - */ - static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, -- unsigned long end_pfn, unsigned long nr_pages) -+ unsigned long end_pfn) - { - unsigned long pfn, end; - int ret; -@@ -261,7 +264,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, - WARN_ON(start_pfn > end_pfn); - - /* Release pages first. */ -- end = min(end_pfn, nr_pages); -+ end = min(end_pfn, ini_nr_pages); - for (pfn = start_pfn; pfn < end; pfn++) { - unsigned long mfn = pfn_to_mfn(pfn); - -@@ -382,15 +385,14 @@ static void __init xen_do_set_identity_and_remap_chunk( - * to Xen and not remapped. - */ - static unsigned long __init xen_set_identity_and_remap_chunk( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -- unsigned long remap_pfn) -+ unsigned long start_pfn, unsigned long end_pfn, unsigned long remap_pfn) - { - unsigned long pfn; - unsigned long i = 0; - unsigned long n = end_pfn - start_pfn; - - if (remap_pfn == 0) -- remap_pfn = nr_pages; -+ remap_pfn = ini_nr_pages; - - while (i < n) { - unsigned long cur_pfn = start_pfn + i; -@@ -399,19 +401,19 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - unsigned long remap_range_size; - - /* Do not remap pages beyond the current allocation */ -- if (cur_pfn >= nr_pages) { -+ if (cur_pfn >= ini_nr_pages) { - /* Identity map remaining pages */ - set_phys_range_identity(cur_pfn, cur_pfn + size); - break; - } -- if (cur_pfn + size > nr_pages) -- size = nr_pages - cur_pfn; -+ if (cur_pfn + size > ini_nr_pages) -+ size = ini_nr_pages - cur_pfn; - - remap_range_size = xen_find_pfn_range(&remap_pfn); - if (!remap_range_size) { - pr_warn("Unable to find available pfn range, not remapping identity pages\n"); - xen_set_identity_and_release_chunk(cur_pfn, -- cur_pfn + left, nr_pages); -+ cur_pfn + left); - break; - } - /* Adjust size to fit in current e820 RAM region */ -@@ -438,18 +440,18 @@ static unsigned long __init xen_set_identity_and_remap_chunk( - } - - static unsigned long __init xen_count_remap_pages( -- unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, -+ unsigned long start_pfn, unsigned long end_pfn, - unsigned long remap_pages) - { -- if (start_pfn >= nr_pages) -+ if (start_pfn >= ini_nr_pages) - return remap_pages; - -- return remap_pages + min(end_pfn, nr_pages) - start_pfn; -+ return remap_pages + min(end_pfn, ini_nr_pages) - start_pfn; - } - --static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, -+static unsigned long __init xen_foreach_remap_area( - unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, -- unsigned long nr_pages, unsigned long last_val)) -+ unsigned long last_val)) - { - phys_addr_t start = 0; - unsigned long ret_val = 0; -@@ -477,8 +479,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, - end_pfn = PFN_UP(entry->addr); - - if (start_pfn < end_pfn) -- ret_val = func(start_pfn, end_pfn, nr_pages, -- ret_val); -+ ret_val = func(start_pfn, end_pfn, ret_val); - start = end; - } - } -@@ -741,7 +742,7 @@ static void __init xen_reserve_xen_mfnlist(void) - **/ - char * __init xen_memory_setup(void) - { -- unsigned long max_pfn, pfn_s, n_pfns; -+ unsigned long pfn_s, n_pfns; - phys_addr_t mem_end, addr, size, chunk_size; - u32 type; - int rc; -@@ -753,9 +754,8 @@ char * __init xen_memory_setup(void) - int op; - - xen_parse_512gb(); -- max_pfn = xen_get_pages_limit(); -- max_pfn = min(max_pfn, xen_start_info->nr_pages); -- mem_end = PFN_PHYS(max_pfn); -+ ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages); -+ mem_end = PFN_PHYS(ini_nr_pages); - - memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries); - set_xen_guest_handle(memmap.buffer, xen_e820_table.entries); -@@ -799,10 +799,10 @@ char * __init xen_memory_setup(void) - max_pages = xen_get_max_pages(); - - /* How many extra pages do we need due to remapping? */ -- max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); -+ max_pages += xen_foreach_remap_area(xen_count_remap_pages); - -- if (max_pages > max_pfn) -- extra_pages += max_pages - max_pfn; -+ if (max_pages > ini_nr_pages) -+ extra_pages += max_pages - ini_nr_pages; - - /* - * Clamp the amount of extra memory to a EXTRA_MEM_RATIO -@@ -811,8 +811,8 @@ char * __init xen_memory_setup(void) - * Make sure we have no memory above max_pages, as this area - * isn't handled by the p2m management. - */ -- maxmem_pages = EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)); -- extra_pages = min3(maxmem_pages, extra_pages, max_pages - max_pfn); -+ maxmem_pages = EXTRA_MEM_RATIO * min(ini_nr_pages, PFN_DOWN(MAXMEM)); -+ extra_pages = min3(maxmem_pages, extra_pages, max_pages - ini_nr_pages); - i = 0; - addr = xen_e820_table.entries[0].addr; - size = xen_e820_table.entries[0].size; -@@ -914,7 +914,7 @@ char * __init xen_memory_setup(void) - * Set identity map on non-RAM pages and prepare remapping the - * underlying RAM. - */ -- xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); -+ xen_foreach_remap_area(xen_set_identity_and_remap_chunk); - - pr_info("Released %ld page(s)\n", xen_released_pages); - --- -2.43.0 -