[PATCH v2] x86/srat: vmap the pages for acpi_slit

Elias El Yandouzi posted 1 patch 3 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20240116185056.15000-7-eliasely@amazon.com
[PATCH v2] x86/srat: vmap the pages for acpi_slit
Posted by Elias El Yandouzi 3 months, 1 week ago
From: Hongyan Xia <hongyxia@amazon.com>

This avoids the assumption that boot pages are in the direct map.

Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Elias El Yandouzi <eliasely@amazon.com>

----

    There was a discussion with Jan regarding early failure vs
    disable NUMA. I am strongly in favor of the latter because
    it is more obvious that something went wrong.

    From my understanding, Jan seems to be in favor of turning off NUMA
    and then continue to boot. But then implied that a panic() would be
    fine.

    So I went with the panic() version. I am happy to rework it to another
    approach if there is a consensus.

    Changes in v2:
        * vmap_contig_pages() was renamed to vmap_contig()
        * Use a panic() rather than BUG_ON()

    Changes since Hongyan's version:
        * vmap_boot_pages() was renamed to vmap_contig_pages()

diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index 3f70338e6e..688f410287 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -135,7 +135,9 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
 		return;
 	}
 	mfn = alloc_boot_pages(PFN_UP(slit->header.length), 1);
-	acpi_slit = mfn_to_virt(mfn_x(mfn));
+	acpi_slit = vmap_contig(mfn, PFN_UP(slit->header.length));
+	if ( !acpi_slit )
+		panic("Unable to map the ACPI SLIT. Retry with numa=off");
 	memcpy(acpi_slit, slit, slit->header.length);
 }
 
-- 
2.40.1