diff mbox series

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

Message ID 20240116185056.15000-7-eliasely@amazon.com (mailing list archive)
State New, archived
Headers show
Series [v2] x86/srat: vmap the pages for acpi_slit | expand

Commit Message

Elias El Yandouzi Jan. 16, 2024, 6:50 p.m. UTC
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 mbox series

Patch

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);
 }