[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c2a22672-b9dd-7aa4-b61e-ccb0faaa3b01@suse.com>
Date: Fri, 26 Aug 2022 09:53:29 +0200
From: Jan Beulich <jbeulich@...e.com>
To: Demi Marie Obenour <demi@...isiblethingslab.com>
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
xen-devel@...ts.xenproject.org, Ard Biesheuvel <ardb@...nel.org>,
Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>
Subject: Re: [PATCH] Add support for ESRT loading under Xen
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.
Jan
Powered by blists - more mailing lists