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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09BCBC433EF for ; Mon, 1 Nov 2021 11:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E78FA60FD9 for ; Mon, 1 Nov 2021 11:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232066AbhKALE0 (ORCPT ); Mon, 1 Nov 2021 07:04:26 -0400 Received: from mga06.intel.com ([134.134.136.31]:52788 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbhKALEZ (ORCPT ); Mon, 1 Nov 2021 07:04:25 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10154"; a="291831495" X-IronPort-AV: E=Sophos;i="5.87,199,1631602800"; d="scan'208";a="291831495" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 04:01:52 -0700 X-IronPort-AV: E=Sophos;i="5.87,199,1631602800"; d="scan'208";a="499991146" Received: from dekunli-mobl.ccr.corp.intel.com (HELO chenyu5-mobl1) ([10.249.173.35]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 04:01:48 -0700 Date: Mon, 1 Nov 2021 19:01:44 +0800 From: Chen Yu To: Andy Shevchenko Cc: linux-acpi@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Len Brown , Ashok Raj , Mike Rapoport , Aubrey Li , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: Re: [PATCH v7 1/4] efi: Introduce EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER and corresponding structures Message-ID: <20211101110144.GA28054@chenyu5-mobl1> References: <4898b5784e79b89bb25ce91384427b5ca3547b8f.1635317102.git.yu.c.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Wed, Oct 27, 2021 at 01:00:43PM +0300, Andy Shevchenko wrote: > On Wed, Oct 27, 2021 at 03:07:24PM +0800, Chen Yu wrote: > > Platform Firmware Runtime Update image starts with UEFI headers, and the > > headers are defined in UEFI specification, but some of them have not been > > defined in the kernel yet. > > > > For example, the header layout of a capsule file looks like this: > > > > EFI_CAPSULE_HEADER > > EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER > > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER > > EFI_FIRMWARE_IMAGE_AUTHENTICATION > > > > These structures would be used by the Platform Firmware Runtime Update > > driver to parse the format of capsule file to verify if the corresponding > > version number is valid. The EFI_CAPSULE_HEADER has been defined in the > > kernel, however the rest are not, thus introduce corresponding UEFI > > structures accordingly. Besides, EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER > > and EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER are required to be packed > > in the uefi specification. And Ard has pointed out that, the __packed > > attribute does indicate to the compiler that the entire thing can appear > > misaligned in memory. So if one follows the other in the capsule header, > > the __packed attribute may be appropriate to ensure that the second one > > is not accessed using misaligned loads and stores. > > ... > > > +/* EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER */ > > +struct efi_manage_capsule_image_header { > > + u32 ver; > > > + guid_t image_type_id; > > Shouldn't it be efi_guid_t ? > I see, will change it, also in other patches. thanks, Chenyu