[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] xen/x86/pvh: use preset XSDT header for XSDT generation


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 16 May 2023 10:10:07 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MOXbb4jEGs6Ot+i5UNfNslHGgWyzA/n6EdKWvgtkWrs=; b=bs7EhvvedcKCOOxJj8H2APz6g4V3b01xv8C8kKiv11NXrPizb7a0RDFPLvkIcopSu4sPzF/cUbjk7QUAEWqDy6ENP2asxRcTr7BcLZPBybRfHZxGIp6m/b5nvtBMmYHITAjV//i8rnhA+BRAT6pvL17jzl/fLUKAoQQtashr7TEP22Lws6TaU34jarEKwz6JGn9lCcbXuqIg0ph9EcVDKgpZwJMqQJP00dSFastHUzNPy1paERIv38osq6n9mwuzKqMdYM1gWu1WgDFTihf0qauyRxjilj7sE5iBEwn420aReNOZowkReMF9SlSu9kTV1Z2s2h1cabVZhHkihAKxrg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZzKTJujN17HvN+LuTFlZPn/dt4wHa/cMMmtxTjZLj09PKxDP9XIUm2gAp8aZ4yXysgmZMvcqUmK8MFm8dnm1Kk8HJLB1HwL3ZhPlqCi0jGuuMJUDDUyU8owdAV7TCedtRA3/I3CAn9f1jdXbnMbtSGn3bvKpcjM4MGKqFlpizTVGLQWSEI8KAxE+t1FWJK167vDZhkDFzC6eTwTsgc/8UNweeIZY3DL7C+DQ9Uxr7bPRHuvsS4EVUNIWgmKaHAYec5xJkknidUqJWwqKdyND6rC9DQEG576our/ukJl61EUbKTnm+v6WDwl/B7MR6rHY6+lEku2ImxmFG590xZXmZQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, andrew.cooper3@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Xenia.Ragiadakou@xxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Delivery-date: Tue, 16 May 2023 08:10:36 +0000
  • Ironport-data: A9a23:bfG3VahGu5yc8Z+MLIVwVEFQX161gBEKZh0ujC45NGQN5FlHY01je htvWTjVMvjZMDT1c9pxOdu1/BsCvZfcz9NkSQNl+3s2RCob9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmYpHlUMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWj0N8klgZmP6sT4QaAzyB94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQiDwwyYiG9hdvtmp6wbftzj9wSdcbCadZ3VnFIlVk1DN4AaLWaG+DmwIEd2z09wMdTAfzZe swVLyJ1awjNaAFOPVFRD48imOCvhT/0dDgwRFC9/PJrpTSMilEhluG1bbI5efTTLSlRtlyfq W/cuXzwHzkRNcCFyCrD+XWp7gPKtXqjCdtDT+Tgp5aGhnWU3mEPKkwceWKg4va7rFDgBtxUe nI9r39GQa8asRbDosPGdwajvHeOsxoYWtxRO+438geAzuzT+QnxLmoOQyNFadcmnNQrXjFs3 ViM9/v5CDoqvLCLRHa18raPsSj0KSUTNXUFZyIPUU0C+daLiLE+iBPGCOxqH6+8gtT2HizYy jWG6iM5gt07ltIG2ay9+hbcnzumq5zNTwg0zgzSUiSu6QYRWWK+T4mh6Fye4fMeKo+cFwGFp CJdw5XY6/0SB5aQkiDLWP8KALyi+/eCNnvbnEJrGJ4isT+q/hZPYLxt3d23H28xWu5sRNMjS Ba7Vd95jHOLAEaXUA==
  • Ironport-hdrordr: A9a23:d0ka86/UkRuOZFtQSNluk+AuI+orL9Y04lQ7vn2ZKSY5TiVXra CTdZUgpHnJYVMqMk3I9uruBEDtex3hHNtOkOss1NSZLW7bUQmTXeJfBOLZqlWNJ8S9zJ856U 4JScND4bbLfDxHZKjBgTVRE7wbsaa6GKLDv5ah85+6JzsaGp2J7G1Ce3am+lUdfng+OXKgfq Dsm/auoVCbCAwqR/X+PFYpdc7ZqebGkZr3CCR2eyLOuGG1/EiVAKeRKWnj4isj
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, May 15, 2023 at 05:16:27PM -0700, Stefano Stabellini wrote:
> On Mon, 15 May 2023, Jan Beulich wrote:
> > On 15.05.2023 10:48, Roger Pau Monné wrote:
> > > On Fri, May 12, 2023 at 06:17:19PM -0700, Stefano Stabellini wrote:
> > >> From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> > >>
> > >> Xen always generates a XSDT table even if the firmware provided a RSDT
> > >> table. Instead of copying the XSDT header from the firmware table (that
> > >> might be missing), generate the XSDT header from a preset.
> > >>
> > >> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> > >> ---
> > >>  xen/arch/x86/hvm/dom0_build.c | 32 +++++++++-----------------------
> > >>  1 file changed, 9 insertions(+), 23 deletions(-)
> > >>
> > >> diff --git a/xen/arch/x86/hvm/dom0_build.c 
> > >> b/xen/arch/x86/hvm/dom0_build.c
> > >> index 307edc6a8c..5fde769863 100644
> > >> --- a/xen/arch/x86/hvm/dom0_build.c
> > >> +++ b/xen/arch/x86/hvm/dom0_build.c
> > >> @@ -963,13 +963,18 @@ static int __init pvh_setup_acpi_xsdt(struct 
> > >> domain *d, paddr_t madt_addr,
> > >>                                        paddr_t *addr)
> > >>  {
> > >>      struct acpi_table_xsdt *xsdt;
> > >> -    struct acpi_table_header *table;
> > >> -    struct acpi_table_rsdp *rsdp;
> > >>      const struct acpi_table_desc *tables = 
> > >> acpi_gbl_root_table_list.tables;
> > >>      unsigned long size = sizeof(*xsdt);
> > >>      unsigned int i, j, num_tables = 0;
> > >> -    paddr_t xsdt_paddr;
> > >>      int rc;
> > >> +    struct acpi_table_header header = {
> > >> +        .signature    = "XSDT",
> > >> +        .length       = sizeof(struct acpi_table_header),
> > >> +        .revision     = 0x1,
> > >> +        .oem_id       = "Xen",
> > >> +        .oem_table_id = "HVM",
> > > 
> > > I think this is wrong, as according to the spec the OEM Table ID must
> > > match the OEM Table ID in the FADT.
> > > 
> > > We likely want to copy the OEM ID and OEM Table ID from the RSDP, and
> > > possibly also the other OEM related fields.
> > > 
> > > Alternatively we might want to copy and use the RSDT on systems that
> > > lack an XSDT, or even just copy the header from the RSDT into Xen's
> > > crafted XSDT, since the format of the RSDP and the XSDT headers are
> > > exactly the same (the difference is in the size of the description
> > > headers that come after).
> > 
> > I guess I'd prefer that last variant.
> 
> I tried this approach (together with the second patch for necessity) and
> it worked.
> 
> diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
> index fd2cbf68bc..11d6d1bc23 100644
> --- a/xen/arch/x86/hvm/dom0_build.c
> +++ b/xen/arch/x86/hvm/dom0_build.c
> @@ -967,6 +967,10 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, 
> paddr_t madt_addr,
>          goto out;
>      }
>      xsdt_paddr = rsdp->xsdt_physical_address;
> +    if ( !xsdt_paddr )
> +    {
> +        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 be slightly more consistent, could you use:

/*
 * 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)
    sdt_paddr = rsdp->xsdt_physical_address;
else
    sdt_paddr = rsdp->rsdt_physical_address;

It was an oversight of mine to not check for the RSDP revision, as
RSDP < 2 will never have an XSDT.  Also add:

Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')

Thanks.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.