Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp883092pxb; Wed, 27 Oct 2021 14:25:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwck0WtxR/ipSYmche/aSTTDE35IVHFz9plucv05efvNlqW4NGKlhlmgwiEg80VllfGkh48 X-Received: by 2002:a50:a6da:: with SMTP id f26mr449867edc.119.1635369902619; Wed, 27 Oct 2021 14:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369902; cv=none; d=google.com; s=arc-20160816; b=0FCyQ+DMbnm7gLv4SGyBrabwcD99B/FqGCctmpNsUeMOESpzfuBfmaZprTPZMxWxwd KDq4VZjmBxqhex34MXwl79t2AHmw58H2xljIOV3UvpaQ/SsjzYMcfg+IVvPRH7Sv7kUV TqtwzJIMnZt4jCpZ+x7lYAJnKApoISE6X6VcXpEWq6088E/tVcic55XovlPJY7NvwYlO qjF3P6Mf++ZHl/dpUuxYWBLWQnMYk9MBuRg6YFq7qG0xnPQMQ8pHVR4dTMpv/h6K8yaV u6gGbvoWO6SuC3wtPoeWyIzoAXCrx4fIbWZ2kemZxMSzzPLV5+jllFM8+cpEqDpfIyxA 6wFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=pJZ4Y1e/yJJbzkOgNaTecA+GdXP824xIxX0MXcV0hoI=; b=EwZBJSYGZwM5+xhroiyZJHNBqCI1fi552/kDgBxec6Wg1zRobw960yT9ZF/V+Ylz5y hHR6QRgLI//H6/wV3V9IBDueoIEzGijOBjPIsR6fVOIQ6cwXYTLXA9dLoHX/0tYXquhq vBCt/KfEdg6NEESOLGqVx67828ALY9EOMnejki5iu0dGQ72HRm82koDdguSVRGXMPWdc gAhnaXi5zOOPAyZWdh6P9/vdxsYNZGUoFyM1kzI8i6F7zD7xqNQPYE4R+ox0vzmWkYV0 Wq8E/7tubf3UTrxis9mbBSWF1uKxU6IClLKE1wpuLR3jCuMmRxLGr6nDenzS8RW7ei58 0DFg== 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 dp16si2008898ejc.458.2021.10.27.14.24.39; Wed, 27 Oct 2021 14:25:02 -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 S237111AbhJ0KDn (ORCPT + 97 others); Wed, 27 Oct 2021 06:03:43 -0400 Received: from mga03.intel.com ([134.134.136.65]:16201 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235237AbhJ0KDd (ORCPT ); Wed, 27 Oct 2021 06:03:33 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10149"; a="230073802" X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="230073802" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 03:01:08 -0700 X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="529573274" Received: from smile.fi.intel.com ([10.237.72.184]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 03:01:03 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mffjf-001Qor-Po; Wed, 27 Oct 2021 13:00:43 +0300 Date: Wed, 27 Oct 2021 13:00:43 +0300 From: Andy Shevchenko To: Chen Yu 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: 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: <4898b5784e79b89bb25ce91384427b5ca3547b8f.1635317102.git.yu.c.chen@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? > + u8 image_index; > + u8 reserved_bytes[3]; > + u32 image_size; > + u32 vendor_code_size; > + /* ver = 2. */ > + u64 hw_ins; > + /* ver = v3. */ > + u64 capsule_support; > +} __packed; ... > +/* WIN_CERTIFICATE_UEFI_GUID */ > +struct win_cert_uefi_guid { > + struct win_cert hdr; > + guid_t cert_type; Ditto. > + u8 cert_data[]; > +}; -- With Best Regards, Andy Shevchenko