[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8] Preserve the EFI System Resource Table for dom0
- To: Luca Fancellu <Luca.Fancellu@xxxxxxx>, Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Wed, 6 Jul 2022 10:44:46 +0000
- Accept-language: en-GB, en-US
- 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=8w44/UeYtiIwsz//ewK0Bds+3fKlFyIJoI0rfHEn9Qk=; b=FIIoLu9MLD+KZJA4ohglpJLa9bMMgh+giDpEtebzPWies03oirtI5iuVnbhOmrIyAU6UocTO0RC4OdhYk0aPLFS1tTd3fX5CUEaO9M5Fn3I0oGBXv7eF3FVP+dSzODgEFXcLTq8pOE1SyhxByxGMMFj9kIpL3syNq1dtrqvo1ASX7Qt/0szXLXwudFsOBnF4RyXYMkUEHSuE9D9DT7T1EMtV8XC+YKyIi8AefmLCyvJCK5Q/9KV1o4h1OecrGYglrstUdTdRkMI623GaVFI4bQfo/8p93tfm0FXljlnzjHzlQ8Uf4DbMpODY+5fDCqC2Owe6Ooe9Dg2utceMMaoi8g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IxJz41oMXAzLiIS68tJQ2SHv0Nh2sSw0uJPlid1SqiqYTJ4sPXVxfmwDg3wMYg6NkSK8vJcyfrkjbz6y/IbrI0t3biaOEScXtXR8c25q+a9rfe5rhiRVFFPIw5q+V35pXD9AhFNJzIIHs7QmdJf5xldrUW6E1WFc4BuINjOSfTTed3MMQOE882KI1CMZ4lTU3YndjNvCJE6Hr65T5H5N21RfZ4CAYR5nrM1ytZzKrAtkUU6OT1XqAAZ8bmEcaE956UcOuSjRtu1QGSBNCFTxLg8jN1sjbfjAgANf6wTAhu0n5xDFVjQeRh1RvsogF4bZWRXdntneVr9vEBUIc3ayfg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>
- Delivery-date: Wed, 06 Jul 2022 10:44:59 +0000
- Ironport-data: A9a23:8A+0LK8H/KeIQ37O8ONkDrUDqH+TJUtcMsCJ2f8bNWPcYEJGY0x3n GQfCm/Uaf2PZGHyctt/b4jioUkGu5DUyN9jGgs/r3s8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si+Fa+Sn9T8mvU2xbuKU5NTsY0idfic5DnZ74f5fs7Rh2NQw3oDnW1rlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnbOXYw1qOaPSofwAaQFcCSFbZIpHv4aSdBBTseTLp6HHW13F5qw0SWQJZ8gf8OsxBnxS/ /sFLjxLdgqEm++93LO8TK9rm9gnK87oeogYvxmMzxmAVapgHc+FHfuMuYcwMDQY36iiGd73Y cYDZCUpRxPHexBVYX8cCY4knffujX76G9FdgA3K+vZsvjeDpOB3+L7TYNOJUdq6fMd+n0bAi V3JuH/mIzhPYbRzzhLAqBpAnNTnuT7wUcQ8Hbuz+/punXWa3GlVAxoTPXO3rPy4ok+4RdNEK kYQ9zYurK4970iiRJ/2WBjQiG6JuFsQVsRdF8U+6RqR0ezE7gCBHG8GQzVdLts8u6ceRzYny 1uIlNPBHiF0vfueTnf13rWJqTK/PwAFIGlEYjULJTbp+PHmqYA3yxfQFNBqFffvisWvQW2oh TeXsCI5mrMfy9YR0Lm29kzGhDTqoYXVSgky5UPcWWfNAh5FWbNJrreAsTDzhcus5q7AJrVdl BDoQ/Sj0d0=
- Ironport-hdrordr: A9a23:StQ0z6FL+UpVoJVUpLqFS5HXdLJyesId70hD6qkvc3Fom52j/f xGws5x6fatskdrZJkh8erwW5Vp2RvnhNNICPoqTM2ftW7dySeVxeBZnMHfKljbdxEWmdQtsp uIH5IeNDS0NykDsS+Y2nj2Lz9D+qjgzEnAv463oBlQpENRGthdBmxCe2Sm+zhNNW177O0CZf +hD6R8xwaISDAyVICWF3MFV+/Mq5ngj5T9eyMLABYh9U2nkS6owKSSKWnY4j4uFxd0hZsy+2 nMlAL0oo+5teug9xPa32jPq7xLhdrazMdZDsDksLlUFtyssHfqWG1SYczGgNkHmpDq1L/sqq iKn/4UBbUw15oWRBDynfKi4Xi47N9k0Q6e9bbRuwqenSW+fkN1NyMJv/MmTvOSgXBQw+1Uwe ZF2XmUuIFQCg6FlCPh58LQXxUvjUasp2E++NRjxkC3fLFuH4O5l7Zvin99AdMFBmb3+YonGO 5hAIXV4+tXa0qTazTcsnN0yNKhU3wvFlPeK3Jy8fC9wnxThjR03kEYzMsQkjMJ8488UYBN46 DBPr5znL9DQ8cKZeZ2BfsHQ8GwFmvRKCi8eF66MBDiDuUKKnjNo5n47PE84/yrYoUByN8olJ HIQDpjxBoPkoLVeLizNbFwg2DwqT+GLEXQI+lllutEk6y5Qqb3OiueT11rm9e8opwkc7/mZ8 o=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYh/bGtXoG96D86Eiyr5Btw15f161xN36AgAADZIA=
- Thread-topic: [PATCH v8] Preserve the EFI System Resource Table for dom0
On 06/07/2022 11:32, Luca Fancellu wrote:
>> On 24 Jun 2022, at 19:17, Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
>> wrote:
>>
>> diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
>> index a25e1d29f1..f6f34aa816 100644
>> --- a/xen/common/efi/boot.c
>> +++ b/xen/common/efi/boot.c
>> @@ -567,6 +587,41 @@ static int __init efi_check_dt_boot(const
>> EFI_LOADED_IMAGE *loaded_image)
>> }
>> #endif
>>
>> +static UINTN __initdata esrt = EFI_INVALID_TABLE_ADDR;
>> +
>> +static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
>> +{
>> + size_t available_len, len;
>> + const UINTN physical_start = desc->PhysicalStart;
> Hi,
>
> From my tests on an arm64 machine so far I can tell that desc is NULL here,
> for this reason we have the problem.
>
> I’ll have a further look on the cause of this, but if you are faster than me
> you are
> welcome to give your opinion on that.
Given this observation, there's clearly ...
> @@ -1051,6 +1110,70 @@ static void __init
> efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop
> #define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \
> (EFI_PAGE_SHIFT + BITS_PER_LONG - 32))
>
> +static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
> +{
> + EFI_STATUS status;
> + UINTN info_size = 0, map_key, mdesc_size;
> + void *memory_map = NULL;
> + UINT32 ver;
> + unsigned int i;
> +
> + for ( ; ; ) {
> + status = efi_bs->GetMemoryMap(&info_size, memory_map, &map_key,
> + &mdesc_size, &ver);
> + if ( status == EFI_SUCCESS && memory_map != NULL )
> + break;
> + if ( status == EFI_BUFFER_TOO_SMALL || memory_map == NULL )
> + {
> + info_size += 8 * efi_mdesc_size;
> + if ( memory_map != NULL )
> + efi_bs->FreePool(memory_map);
> + memory_map = NULL;
> + status = efi_bs->AllocatePool(EfiLoaderData, info_size,
> &memory_map);
> + if ( status == EFI_SUCCESS )
> + continue;
> + PrintErr(L"Cannot allocate memory to relocate ESRT\r\n");
> + }
> + else
> + PrintErr(L"Cannot obtain memory map to relocate ESRT\r\n");
> + return;
> + }
> +
> + /* Try to obtain the ESRT. Errors are not fatal. */
> + for ( i = 0; i < info_size; i += efi_mdesc_size )
> + {
> + /*
> + * ESRT needs to be moved to memory of type EfiRuntimeServicesData
> + * so that the memory it is in will not be used for other purposes.
> + */
> + void *new_esrt = NULL;
> + size_t esrt_size = get_esrt_size(efi_memmap + i);
... a NULL pointer here. And the only way that could happen is if
efi_memmap is NULL.
Which perhaps isn't surprising because presumably ARM gets memory
information from the DT, not EFI?
~Andrew
|