From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4AF5EC38142 for ; Fri, 27 Jan 2023 19:26:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2703985706; Fri, 27 Jan 2023 20:26:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="rCs+n7Vq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 97F7185711; Fri, 27 Jan 2023 20:26:08 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 22F96856F7 for ; Fri, 27 Jan 2023 20:26:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 47AF23F1E9 for ; Fri, 27 Jan 2023 19:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1674847564; bh=Y3MMrgV8VJVfTTHkriTi/XJd9Uh1UXcCjUHm8fZUu4A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rCs+n7VqQa8KZ7FbQMHkX0lKor7aBAtx/hg53ZDdVlO+I5Wfapz/CS6zShTcL0Z5r a9g059awOx7x3QCzGRIxcVE1DuzxSW86KJ0slC9mJA18sDAatd/jvZTpd88DdC3iKd ZVdXineLUQ0hhx6001rNi8MzvSms9R50cMT0whF0n/PDGGCMSWwiTeXfrxkvx2OXBU mWcICgSPuP3V7WhyBTFA4p+/+n8TSRi9rhc4jJrCli+OyhUO4JXEbgb5BeXkB9saO+ Y2N7A54ZCA5lQPLCb/ZM4e2YZEpfl1PMngvKOsi6OV/HZRjB/JUAPkvfTQ+upUWAps 8j7/Jqx2IHHhg== Received: by mail-wr1-f69.google.com with SMTP id q18-20020adff512000000b002bfc49c299dso955826wro.5 for ; Fri, 27 Jan 2023 11:26:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y3MMrgV8VJVfTTHkriTi/XJd9Uh1UXcCjUHm8fZUu4A=; b=Xkw/YZ29IrGciFtFx7yM55+dE4qUHk/Qr9Z5Z9ylGnWGrQLAkxOkwWetoiVIGIDpsu 0pNN3mXQCqSqJUEJaT7/aNS6KUbyktCxsaQr6yw9x3h13yuRQFDGtBpx16uMpwrGkGc5 KkUbpIpRoARZu8bNxjDbHMkvm8FBuzoQA8bZhgQgjEQa8C/MRs9RPVhwiJ4eGy8SKlfP x/hxtrp6RGDkiC3FYqH1BDxW82D8PJ5N4oaPrVGkNCRtW9RO5MMCwTSTyGEWuTZ32osI 4vLTjiHXhPNI2np3j/Txt/PLW6zsak5x/MYjfgyek2fnjEYFySA5UTtBOfPQLTBxF0/a tvhQ== X-Gm-Message-State: AFqh2kqeF9/bycVtGFfuXMQ6hKWXJJzEgOxIhkoFeTme+mOzs8mrM82Z EK/l2JBqtVaqcIFzP6kiOzUipvsxjXHX9fxWCX02N2Ef+W8ie+VRLdsOGwXADL5C4WxmvUNwAmy rTo7D9eUiR3dQgP5OzxzGimy2wekkTtI= X-Received: by 2002:a05:600c:6008:b0:3db:141c:1e09 with SMTP id az8-20020a05600c600800b003db141c1e09mr36202824wmb.23.1674847563970; Fri, 27 Jan 2023 11:26:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXsLn5QFOKawPlmLOruQ38XLqTXlKM5ZVeQBO5r+3QgsizQhN1IyUJYfwKkKfqZoZ4mn0CeZzQ== X-Received: by 2002:a05:600c:6008:b0:3db:141c:1e09 with SMTP id az8-20020a05600c600800b003db141c1e09mr36202810wmb.23.1674847563699; Fri, 27 Jan 2023 11:26:03 -0800 (PST) Received: from [172.25.0.170] (ip-088-152-145-137.um26.pools.vodafone-ip.de. [88.152.145.137]) by smtp.gmail.com with ESMTPSA id a18-20020a05600c069200b003db305bece4sm5078113wmn.45.2023.01.27.11.26.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Jan 2023 11:26:03 -0800 (PST) Message-ID: Date: Fri, 27 Jan 2023 20:26:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] efi: use 32-bit alignment for efi_guid_t Content-Language: en-US To: Masahisa Kojima Cc: Ilias Apalodimas , u-boot@lists.denx.de References: <20230127115128.5916-1-masahisa.kojima@linaro.org> From: Heinrich Schuchardt In-Reply-To: <20230127115128.5916-1-masahisa.kojima@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 1/27/23 12:51, Masahisa Kojima wrote: > Current U-Boot implements 64-bit boundary for efi_guid_t structure. > It follows the UEFI specification, page 21 of the UEFI Specification v2.10 > says about EFI_GUID: > 128-bit buffer containing a unique identifier value. Unless > otherwise specified, aligned on a 64-bit boundary. > > On the other hand, page 163 of the UEFI specification v2.10 and > EDK2 reference implementation both define EFI_GUID as > struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied > alignment is 32-bit not 64-bit like U-Boot efi_guid_t. > > Due to this alignment difference, EDK2 application "CapsuleApp.efi -P" > does not work as expected. > This calls EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo() > and dump the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure, > offsetof(EFI_FIRMWARE_IMAGE_DESCRIPTOR, ImageTypeId) is different, > 8 in U-Boot and 4 in EDK2(CapsuleApp.efi). > Here is the wrong EFI_GUID dump. > wrong dump : ImageTypeId - 00000000-7D83-058B-D550-474CA19560D8 > expected : ImageTypeId - 058B7D83-50D5-4C47-A195-60D86AD341C4 > > EFI_FIRMWARE_IMAGE_DESCRIPTOR structure is defined in UEFI specification: > typedef struct { > UINT8 ImageIndex; > EFI_GUID ImageTypeId; > UINT64 ImageId > > > } EFI_FIRMWARE_IMAGE_DESCRIPTOR; > > There was the relevant patch for linux kernel to use 32-bit alignment > for efi_guid_t [1]. > U-Boot should get aligned to EDK2 reference implementation and > linux kernel. > > Due to this alignment change, efi_hii_ref structure in include/efi_api.h > is affected, but it is not used in the current U-Boot code. > > [1] https://lore.kernel.org/all/20190202094119.13230-5-ard.biesheuvel@linaro.org/ > > Cc: Ilias Apalodimas > Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt > --- > include/efi.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/efi.h b/include/efi.h > index 42f4e58a91..914a12967f 100644 > --- a/include/efi.h > +++ b/include/efi.h > @@ -56,7 +56,7 @@ struct efi_device_path; > > typedef struct { > u8 b[16]; > -} efi_guid_t __attribute__((aligned(8))); > +} efi_guid_t __attribute__((aligned(4))); > > #define EFI_BITS_PER_LONG (sizeof(long) * 8) >