Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2892029pxb; Mon, 1 Nov 2021 04:05:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVNE8QivQQod/RVQNBabHhqpIxyEmU7ILWviApJ7Sbg7dYm3CiBkBfiNPmxowrV3v4jHHY X-Received: by 2002:a05:6402:26d6:: with SMTP id x22mr40279848edd.165.1635764736682; Mon, 01 Nov 2021 04:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635764736; cv=none; d=google.com; s=arc-20160816; b=AkLyAngc5U43byZqoPyy2TZpfkCnY/L9AAYZEKEZRi3fw3kL3tuR9hhaGKXBbmUTtK GCUjK9pIajOKe4kYdHYlAO7MkYO6DKU5fqTJzikF9N/T7afn9HzuW51xAWqwVR3mJdRq Eg3bICeuKtTJaqX/dyd11iAPHyirYQ9CzojkHZFPlts22ObwTG9wcBqla/DxGX5vbMOj 2kkV4M8eqir0QJTD5tv4ARqjL7eN8Bawd9ESNvcF9yV448/EMAO2YgxGg94Idql8tT2e AMHg5X7lP1Rnly1k4vw2yr3ovguAk9zeZrAOJe+5WpjMNIiB8gWQ1y/n/yMCTkfZ4WAl xc0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mFgYZXoQZ+6gdIxDTmKvQPQ+ylIWuIyq2v/9hqTUgls=; b=M9JC+HpGqZIdHqgyCITXeXYTDH02Ww50wj3ZHeXlIkaeaLHwnUgNNVMtgSYqyXkayK kGVY+7OMAArSIEJfT8XWokFVTkEtDORnpmiYqBLaUXjBAO9/BC4JNRAYnAzRWJhXwsli yLW/Vd23cu1S2aLF3KYMrPWN16+iUeWhK+oQyyXjPrmUEBwu/E+zywXDLSM2tKAK1NP5 0OeT3wtnQfYPZCub7BZ6TfiIitW3m1IiFvPmpmp3LrW61RXCw0AqiBVQ+aas7EJ9xnrs hR7Yq3JGhYcLKYV3buC6xpIj7R1SidZW4Z7nHmf8GGZ1078RTH8/A2jwvmMjwAZctiA6 41pQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 5si21281934ejj.698.2021.11.01.04.05.05; Mon, 01 Nov 2021 04:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232070AbhKALE0 (ORCPT + 99 others); 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-kernel@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