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

Re: [PATCH] Add support for ESRT loading under Xen


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 6 Sep 2022 08:49:54 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=daJ/X+yeFCczqqO3r5A3SgYuveEeP1d45cY5MyHiEUk=; b=WmSs5B+2MLu0+CdyxT3RngV+FIor31W/JIjfotcLWAhlI1cwdDFUNqdBj1E6aSKCJnFNpLy/Zqe9HRsn/kyzVbDWOq3E1ETSEyJxCsTXkiLuZkp6FZwdMZDw1wp7s0LJR9IRm4koFbffUgHzlErx22a8+4ezMemHHnsAMTlcPxLIy/xn4jsSpevlV1qd1QtQljnCiHeENrUm08cxvRyyWH/V/QtuMPNnjPoNLsSM9Ya7D+8ZjglqaY12tSitVAMBorMs+k0FNVjOTTEpw73Ld0TJUIbPKjJsJN7KGI1OLbpaw1AIX1ZZcqiOBrRNRZ/NtHUzwbGgxyfeRS6bUfBOhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bxdsSNymekpT7hnaqzpdixTjHKlV2z4d5v+0xT0cYKo0xvHGVQGqY6u2QmUIZOGkk8lQwP15VQjgh6OH8qOmwm/IJqDWP2pLUDhBc5nqHps9zY6uhuEvPw8el26RI3cuE56BijjCDT2tE2x6NECSetZ6ArGSxKGPOUttIlsyZakdJCJZj5UbU1VRIfCokjXpZaau8jo3w3R2GIMsiHCxBFDSLw7pkRVDYL93ZrrPeiUoSPDOA1IPhqMNpr337mvFCBCp6DOONjLr8snjJlrv+TsGZRdiNSODedCheZb0OTihgzRrQ5sRB+XUHoDzha5KFkzlNl91r6mT0nGISKc62A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: linux-efi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Ard Biesheuvel <ardb@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
  • Delivery-date: Tue, 06 Sep 2022 06:49:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.08.2022 20:01, Demi Marie Obenour wrote:
> On Fri, Aug 26, 2022 at 09:53:29AM +0200, Jan Beulich wrote:
>> On 25.08.2022 23:52, Demi Marie Obenour wrote:
>>> @@ -40,6 +41,38 @@
>>>  
>>>  #define efi_data(op)       (op.u.efi_runtime_call)
>>>  
>>> +static_assert(XEN_PAGE_SHIFT == EFI_PAGE_SHIFT,
>>> +              "Mismatch between EFI_PAGE_SHIFT and XEN_PAGE_SHIFT");
>>> +
>>> +bool xen_efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *md)
>>> +{
>>> +   struct xen_platform_op op = {
>>> +           .cmd = XENPF_firmware_info,
>>> +           .u.firmware_info = {
>>> +                   .type = XEN_FW_EFI_INFO,
>>> +                   .index = XEN_FW_EFI_MEM_INFO,
>>> +                   .u.efi_info.mem.addr = phys_addr,
>>> +                   .u.efi_info.mem.size = ((u64)-1ULL) - phys_addr,
>>> +           }
>>> +   };
>>> +   union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info;
>>> +   int rc;
>>> +
>>> +   memset(md, 0, sizeof(*md)); /* initialize md even on failure */
>>> +   rc = HYPERVISOR_platform_op(&op);
>>> +   if (rc) {
>>> +           pr_warn("Could not obtain information on address %llu from Xen: 
>>> "
>>> +                   "error %d\n", phys_addr, rc);
>>> +           return false;
>>> +   }
>>> +
>>> +   md->attribute = info->mem.attr;
>>> +   md->type = info->mem.type;
>>> +   md->num_pages = info->mem.size >> XEN_PAGE_SHIFT;
>>> +   md->phys_addr = info->mem.addr;
>>
>> As indicated in reply to your patch changing XEN_FW_EFI_MEM_INFO in
>> the hypervisor: While this may fit the ESRT purpose, the address you
>> return here is not necessarily the start of the region, and hence
>> this function is not a general Xen replacement for the non-Xen
>> function. Therefore I think it also shouldn't give the impression of
>> doing so.
> 
> Is this just a matter of renaming the function?

Besides renaming the function perhaps it also shouldn't give the
impression of being generally usable. I would expect it to be a static
helper somewhere, or even be expanded inline.

>  Is it possible to
> implement the original function with the current hypervisor?

Yes, but doing so would be ugly: You'd need to "bisect" your way to
the start of the region.

As an aside (I think I did point this out before): Can you please
adjust the way your mail program sends mails? When I respond to your
mail (using Thunderbird), I find all the people previously on Cc on
the To: list, while your address is lost. As indicated I believe
this is a result of the Mail-Followup-To: tag your reply came with
(and I further think that TB's treatment of that tag is a reasonable
one, albeit perhaps there are other reasonable treatments as well; I
am not aware of this tag having any formally specified treatment).

Jan



 


Rackspace

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