Message ID | 20230525231851.700750-1-sstabellini@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build | expand |
On 26.05.2023 01:18, Stefano Stabellini wrote: > --- a/xen/arch/x86/hvm/dom0_build.c > +++ b/xen/arch/x86/hvm/dom0_build.c > @@ -966,7 +966,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr, > rc = -EINVAL; > goto out; > } > - xsdt_paddr = rsdp->xsdt_physical_address; > + /* > + * Note the header is the same for both RSDT and XSDT, so it's fine to > + * copy the native RSDT header to the Xen crafted XSDT if no native > + * XSDT is available. > + */ > + if ( rsdp->revision > 1 && rsdp->xsdt_physical_address ) > + xsdt_paddr = rsdp->xsdt_physical_address; > + else > + xsdt_paddr = rsdp->rsdt_physical_address; > + > acpi_os_unmap_memory(rsdp, sizeof(*rsdp)); > table = acpi_os_map_memory(xsdt_paddr, sizeof(*table)); > if ( !table ) To continue context some: { printk("Unable to map XSDT\n"); rc = -EINVAL; goto out; } xsdt->header = *table; acpi_os_unmap_memory(table, sizeof(*table)); You're now pointing the guest's XSDT addr at a table that's really an RSDT. After copying, I think you want to adjust the table signature ('R' -> 'X'). Luckily a revision of 1 is valid for both tables. Jan
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index fd2cbf68bc..e1043e40d2 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -966,7 +966,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr, rc = -EINVAL; goto out; } - xsdt_paddr = rsdp->xsdt_physical_address; + /* + * Note the header is the same for both RSDT and XSDT, so it's fine to + * copy the native RSDT header to the Xen crafted XSDT if no native + * XSDT is available. + */ + if ( rsdp->revision > 1 && rsdp->xsdt_physical_address ) + xsdt_paddr = rsdp->xsdt_physical_address; + else + xsdt_paddr = rsdp->rsdt_physical_address; + acpi_os_unmap_memory(rsdp, sizeof(*rsdp)); table = acpi_os_map_memory(xsdt_paddr, sizeof(*table)); if ( !table )