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

Re: [PATCH v4] EFI: always map EfiRuntimeServices{Code,Data}


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 27 Jan 2022 13:25:34 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=DbcpEA0scycMrCPtp2utFKAS4NxXqQt9jVqs8C0Fg4M=; b=ebt/Rzzc7P28lUqfddU/24qWtH3I3ss7aclD6DdyOtEGIQ9RFi6U57IYXajpOYdZS2pjRDVteUnnrgFncb4P4q+G3oRFJH2nSfFBv80KB+Kw73oJ14YRCr4HUbgxBef9rZ0m2R1VdM/V/pQyM8I1igvCvnUtYuZtP1rMQ6VVZPGqZrTexs/5bSD/DC12I4MJww8COhGQuorsm9/wjy+DPgPn8Kszkl9lKbbqtK/4YL/YuRGyFupZxiEn+bcsk/XhFG8b/kajlyF4efewkCtyWrrjlX2IHedGHHRJMlmX8ddAGfGx+UkIoUuDHKP6VdmaVxN96ymT6GEOrKMH8+8yjQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BV6g/jPUY3c+ghbVAiqDMI2DMDPqCzYnU0udH6I4iUDyDtffKeMwQwbhzAEMoLCX9t6SLyDAv59YpH+3OV11JJA4rjpFCip6BTw6axMSHPnmqze0NkmCytw7G7k6IyzfYukBpR+HKUUsf9yjTq5QeKhVPaSTCcTiAU2TcXA2ZkKP6mJZoH6yYLuoS/TF4tjfxUOb3FoRs18Gy1G6VLCh4K/rK7EIKV8bREEfDQ9d8Z/mrwGaBEuoxQonP2tIq9Z/NxX3t4mF91l23aSiyvL/g4iv2s1dJAMjjhVFLCh+E2EWJj5hcjnyEF4Y1FL2Fiowhu6aV9pg9P/41TSY58TEQQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Sergey Temerkhanov <s.temerkhanov@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 27 Jan 2022 12:25:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.01.2022 11:45, Julien Grall wrote:
> On 12/01/2022 08:45, Jan Beulich wrote:
>> From: Sergey Temerkhanov <s.temerkhanov@xxxxxxxxx>
>>
>> This helps overcome problems observed with some UEFI implementations
> 
> Would it be possible to provide some details about the platform? This is 
> helpful to track why a workaround is present.

I cannot provide any details. I took over the patch after pinging
Sergey more than once, without any reaction. It was him to actually
run into the problem in the wild.

>> which don't set the Attributes field in memery descriptors properly.
> 
> typo: s/memery/memory/
> 
>>
>> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@xxxxxxxxx>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> v4: Drop EFI_MEMORY_CACHEABILITY_MASK. Fold with pre-existing if() (into
>>      switch()). Style.
>> ---
>> I guess "map_bs" would also want honoring in efi_exit_boot(), but that's
>> yet another patch then I suppose.
> 
> IIUC, we would need to invalidate the mapping when map_bs was used. Is 
> it correct? If so, then I agree this sounds separate to the issue you 
> are describing here.

No, the other way around: We'd also need to put in a valid virtual
address there for EfiBootServices{Code,Data}. I expect this wasn't
done when map_bs was introduced because iirc at that time the code
fragment in efi_exit_boot() was entirely dead, present merely for
documentation purposes.

>> --- a/xen/common/efi/boot.c
>> +++ b/xen/common/efi/boot.c
>> @@ -1094,7 +1094,13 @@ static void __init efi_exit_boot(EFI_HAN
>>       {
>>           EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i;
>>   
>> -        if ( desc->Attribute & EFI_MEMORY_RUNTIME )
>> +        /*
>> +         * Runtime services regions are always mapped here.
>> +         * Attributes may be adjusted in efi_init_memory().
>> +         */
>> +        if ( (desc->Attribute & EFI_MEMORY_RUNTIME) ||
>> +             desc->Type == EfiRuntimeServicesCode ||
>> +             desc->Type == EfiRuntimeServicesData )
> 
> My knowledge with the stub is limited. Would you be able to explain why 
> we need to map the runtime services even with !efi_enabled(EFI_RS)?

In principle we wouldn't need to, but the final setting of this bit
isn't known yet at this point - it'll be known only after parsing
the command line (see parse_efi_param()).

Jan




 


Rackspace

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