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

Re: [PATCH] xen/efi: Reduce ifdefary in efi_exit_boot()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 9 Apr 2026 12:11:39 +0100
  • 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=arcselector10001; 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=BiipYdtRRIov76lc0RcSjdBxjLPWFDfXDd8Q6YFP5Ro=; b=NcMCLtWTo2NwpebOHFOnvWZcD2tI0eSqv9MlVvkbfsvqD2ecO2WPqCGqm5kQrauOE3mi4fMPO5jduCti/nNHoFJShpId/c5fL5vMjA6negZhZTpukEqyO3faBm3ddWCG7kHXcUZaE3tJ+/zoF/OYnuLIyyRZ1dj8QLKBIDIGT00Rjukqc/R5Yc9+HRC/K2zvaD5NwPFn6M8cGN9M0uEmCfb5cb3y9HytMF8O/4It11LJMtnGzFTwAWrE0EsTX9VKhGDtD1l3IyZqNHO8ws2CnxOGcvDDXOl/BOZmpWaItJ4K2r1+8kJbx89osBMHyZS1zQSvVlItGSFna7Ocs6WoBQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IA1xXkjatspSI/IC8D8JiskPVw1cfoVMuRY568NHywgtH4QCyxY1aMAhoZIAnEHuWvwCftH/vqvqlvsnQwkzlGiEPzILgfnaKgB1cqtC8SVuuqX+m+4OKbnRf61kZKdF/W2zom40X6etu4MYSnv0mPhhHtvvlzmi5VWoC3DJXAyQV8zfdo2tynH1V8IRoc5aJXLCrPbf2VtHgWE23zQ0sywSBCsTvjlEZshpEDrN1xcNDS5KI1LTMdcqmcsdxywz1fbD2dHnuzfUxOJVVrMndqAgFy71cO+Lqvl39/hPozLvTYZdNco2mJuY/Amyju3lkGBUhUE0UU1rXp7O/gj7TQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, "Daniel P . Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 09 Apr 2026 11:11:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09/04/2026 12:01 pm, Jan Beulich wrote:
> On 09.04.2026 12:38, Andrew Cooper wrote:
>> Use IS_ENABLED() rather than #ifdef to give the compiler visibility into the
>> block, which in turn removes the #ifdef from the varaible block.
> Just to mention, if it was just / mainly ...
>
>> --- a/xen/common/efi/boot.c
>> +++ b/xen/common/efi/boot.c
>> @@ -1335,9 +1335,7 @@ static void __init efi_exit_boot(EFI_HANDLE 
>> ImageHandle, EFI_SYSTEM_TABLE *Syste
>>      EFI_STATUS status;
>>      UINTN info_size = 0, map_key;
>>      bool retry;
>> -#ifdef CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP
>>      unsigned int i;
>> -#endif
> ... this to be got rid of, we could as well use ...
>
>> @@ -1371,31 +1369,32 @@ static void __init efi_exit_boot(EFI_HANDLE 
>> ImageHandle, EFI_SYSTEM_TABLE *Syste
>>      if ( EFI_ERROR(status) )
>>          PrintErrMesg(L"Cannot exit boot services", status);
>>  
>> -#ifdef CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP
>> -    for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
>     for ( unsigned int i = 0; i < efi_memmap_size; i += efi_mdesc_size )
>
> now. But yes, the typo aspect you mention can be avoided altogether by what
> you change things to.

I originally had this change in the patch, but it interferes with diff
showing (just) an indentation change.

I'm not fussed either way.

>
>> +    if ( IS_ENABLED(CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP) )
>>      {
>> -        EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i;
>> +        for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
>> +        {
>> +            EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i;
>>  
>> -        /*
>> -         * 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 )
>> -            desc->VirtualStart = desc->PhysicalStart;
>> -        else
>> -            desc->VirtualStart = INVALID_VIRTUAL_ADDRESS;
>> -    }
>> -    status = efi_rs->SetVirtualAddressMap(efi_memmap_size, efi_mdesc_size,
>> -                                          mdesc_ver, efi_memmap);
>> -    if ( status != EFI_SUCCESS )
>> -    {
>> -        printk(XENLOG_ERR "EFI: SetVirtualAddressMap() failed (%#lx), 
>> disabling runtime services\n",
>> -               status);
>> -        __clear_bit(EFI_RS, &efi_flags);
>> +            /*
>> +             * 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 )
>> +                desc->VirtualStart = desc->PhysicalStart;
>> +            else
>> +                desc->VirtualStart = INVALID_VIRTUAL_ADDRESS;
>> +        }
>> +        status = efi_rs->SetVirtualAddressMap(efi_memmap_size, 
>> efi_mdesc_size,
>> +                                              mdesc_ver, efi_memmap);
>> +        if ( status != EFI_SUCCESS )
>> +        {
>> +            printk(XENLOG_ERR "EFI: SetVirtualAddressMap() failed (%#lx), 
>> disabling runtime services\n",
>> +                   status);
> Could I talk you into switching to
>
>             printk(XENLOG_ERR
>                    "EFI: SetVirtualAddressMap() failed (%#lx), disabling 
> runtime services\n",
>                    status);
>
> to make the line at least a little less long?

Ok, but I'm not going to resend just for that.

~Andrew



 


Rackspace

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