[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: Wed, 17 May 2023 10:42:00 +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=VQ4G3CcfL9WU0zGwNpjDGixKrK8s8Ra5A7oUT7as/IQ=; b=CLi6A0lbmUIF8z0hwM2QYIp+skg5k0XG9FB0mwm4Uerj92Zn5fqau587ZNH/UGk31DCCEJmg4G+wJmxjP92zqyvd0VThkbkgXQ2hh6WEuKZ2cl+6NqyVOc1J8le9g1PnmH4aJtG6Bfu+7db1+7NmpCf5GNka7mhjNLuSBQl0yvPb+xCGm0NlOtiREWkw9aYqLaNDRlSH2QdQg/VwCJy2bDwVnILNKbyXRQycab0Xq5ndl3t2VJlBpEKXGxCuvNDwxbivZtVXdK/qA3RAug1Ui+O0kx0DLIX9FSNoVchY1PJjLeUe4Sldv9tI07DZdV44UZ4C2lWFdlEZv+MfJDSWRg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwwbQ4lBc6KkrnZhTMdRsN9HOalrEYjVMfz3vayyDKKJyL+Se7UZCsfLhH/EIdueVWqSN9j9Dc9JiGuGwlz42htio+RQjpskiMsAea+rsfrf1KCMhF539fOjPNPIVXMN1TZ/NB0Ri6w3AguziBGH5cMBeEyXXaQnj2zYdwEWxR3r4Q30fALiXKG5r0xIPsBkbbWMECQXXTUg7h0s+ZwTzTJYiUJt4EH7I19DeVOO6cN5CAc+/fuBfrCJTDlMxEZgJzOUaF2Ok2T26nUcrkQDd/ywtR/IoIf8n1k1CkWwai24sYIBbSInCsS3pvgRaLpN73EyN7rTeB6JGCm1BSuVOA==
  • 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: Wed, 17 May 2023 08:42:14 +0000
  • Ironport-data: A9a23:GAfmV66gKppA5s/ym7hZnwxRtNjGchMFZxGqfqrLsTDasY5as4F+v mIWD2GCa/rYMGP9f49zOdjkoB4Ov57Rx4cxGwNs+yE3Hi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+7ZwehBtC5gZlPa0S4weH/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m9 +QhAgETc06/huO2yZ67a+VwptU9BZy+VG8fkikIITDxK98DGMiGZpqQoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OkUooiOOF3Nn9I7RmQe1PmUmVv CTe9nnRCRAGLt2PjzGC9xpAg8eWxXKkA95DSOfQGvhCj3OMwUlNJUUsSUKqn8CguFzieolCN BlBksYphe1onKCxdfHmRAGxqnOAuh8aWvJTHvc85QXLzbDbiy6bDGUZSj9KaPQ9qdQ7Azct0 zehj97vQDBirrCRYXac7auP6yO/PzAPKm0PbjNCShEKi/HTrYcyh1T1R9liGaK8jdroMTj1z 3aBqy1Wr64PgMAC0aL95kzOiT+oopnPTyY84wmRVWWghj6Vf6agbo2srF3Et/BJKd/BSkHb5 SBf3c+D8OoJEJeB0jSXR/kAF62o4PDDNyDAhVloHN8q8DHFF2OfQL28KQpWfC9BWvvosxewC KMPkWu9PKNuAUY=
  • Ironport-hdrordr: A9a23:yJLq8ayGrN5zhHtXzaIzKrPxduskLtp133Aq2lEZdPWaSL3jqy ncpoVm6faSskdlZJhAo6HwBEDkexzhHPFOkO8s1NuZLXbbUS6TXf9fBMjZsnDd8k7Fh5lgPM VbAs9D4YbLfBJHZK/BiWHSebtNrrjmgcPY55a6vhNQpENRGtxdBmxCe36m+yNNNXJ77NYCZe Ohz/sCgzKhfHQRYICfBmMZNtKz6+HjpdbeehgBCAcg6A6SyR2VyJOSKWnr4j4uFwpVx7Es6G 7ElBG8wJ6CnbWU9j/wvlWjnKi/vrPau5J+Lf3Js9MSLDr0jAauecBcXIaPogwPhYiUmSIXeR 330mEd1txImjjsl3+O0FPQMt7boUYT10M=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, May 16, 2023 at 03:11:49PM -0700, Stefano Stabellini wrote:
> On Tue, 16 May 2023, Roger Pau Monné wrote:
> > On Tue, May 16, 2023 at 10:10:07AM +0200, Roger Pau Monné wrote:
> > > 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')
> > 
> > Just realized this will require some more work so that the guest
> > (dom0) provided RSDP is at least revision 2.  You will need to adjust
> > the field and recalculate the checksum if needed.
> 
> But we are always providing RSDP version 2 in pvh_setup_acpi, right?

Yes, as said in the reply to Jan, just ignore this.

Thanks, Roger.



 


Rackspace

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