Received: by 10.192.165.148 with SMTP id m20csp385401imm; Thu, 3 May 2018 22:56:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoo+VSkdRgI9cJg3OaJvjJ2jOddadMNqNNZL2Qu+bXcNy6V3md5lvMb7QiSyHfyGoZSBqT2 X-Received: by 2002:a65:4acd:: with SMTP id c13-v6mr11549164pgu.32.1525413362946; Thu, 03 May 2018 22:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525413362; cv=none; d=google.com; s=arc-20160816; b=o44qkycr0kMXbYpdyCiMaxqIxtODEBe6BmDPGn+/We5/PHGX7hnOTI/n8IThdjTsPT +LUt5PDH13FX2QLvQpgXANK7wRJr5PPRLoZSVGalcu7H5wUSiv4PfDvcM9lHh+UKp0di uwEe1tBBYrffI6o4lRis5Rdy2KvsFMnHAXfoUqoFTrmdLaT1in3v5UbwwK14MrappiJJ v5ZPg6KUWOvYkExJ38AmfUdAD+AVHekVii/jTdWaJNbjbGME8GNYuQ2E9qbpnvMOdVfo jiAgeO6UWVgemZPbRt1APoQdFS6YnTdAHgN2MqnNPMcV/ULr8aWg+zByXXNKLmBjSU/r +bsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=HIrmFW9ku3etRKOJwHe5zRB/bP3STB0V98hhCrc/S/g=; b=MJ4ffv9wDZa5pt96fbHQGqY1CRm1sghowB4T+b4X3LgNlv4s2I5YOP5WiqdXrdk182 IJm/Qya0zXzB8sbRNIQ6NRklYZoLlhK2ngMMG5qbCCNXV6+l8xd6UEMeABHH6d9/4R6l Xv+5XrvZ6xqnP+3r4CwHcAxwUS2x1VDqTwenY0HNcZ40bEyXiOEaAhklX+XwbeqwxrvW agFQFp3r0BHwX6oquixo5R9pOafjuKjUk1NC8e2ucWeOn6Zri3xfgmjROLemj7zZarY3 /U75g0YSLOAcXhe6Mhs7AuitwKUTYz7c58ccWJ0plTCKO7Ke8qW71SSbMamMyxC3I+Fb TCEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B3FpCclm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si15825694pfa.181.2018.05.03.22.55.48; Thu, 03 May 2018 22:56:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B3FpCclm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbeEDFyb (ORCPT + 99 others); Fri, 4 May 2018 01:54:31 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:33707 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbeEDFya (ORCPT ); Fri, 4 May 2018 01:54:30 -0400 Received: by mail-io0-f193.google.com with SMTP id e78-v6so24405234iod.0 for ; Thu, 03 May 2018 22:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HIrmFW9ku3etRKOJwHe5zRB/bP3STB0V98hhCrc/S/g=; b=B3FpCclmyGlS/jmozSuDjjqCbEFSEuZZbVeAcNsv4ZxyQTy7+2h9X6WTCXni23AI3c j7ECysmty55mS+QgcX99qinmzGwVhBc+jIVIdaRq995UEHdru1PvAKt31wwRwISBn1Ro X8Xhiu9WcWMorkazLeCFsmB619UXSw2VTjze4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HIrmFW9ku3etRKOJwHe5zRB/bP3STB0V98hhCrc/S/g=; b=Jq5jc9dBhmPKpafyklDLKO3oZGHR1yaTo8qmAXuX48AAqfN59xWs+9YSTXpl6Xkp83 WPk32uuPdvDvBHAOT1uwQRD+hvdzH8qU9NsuSrwk9ifhYEge8GfkuZXgedIJm7xkB4/X +gmYZqFxAVBdf8R/QCE/jBnhTu6HywBjIJg6EOnv5BIcvRA8EbR1PefGgruJhSJQScZs Vbx1CuBE1aENVhwf4vTjoKDxHHnDBQJe/Zzr/sLxy6UjsRv8ZIP5ovdrOZmJkrmqTL4n OHrdtuLJ9/c9YmrCW2/PnCswy9Fip9PgR/Z5rlcvxjwxdAUZg1WbouSZUC3AJSEeUZ69 J7aw== X-Gm-Message-State: ALQs6tCruuyWOQW6aPUogSzQ18Pzh6nOWm+IzcbIvkkg94nZEFMSKp+v BycKUtczHDF65cI9zzdBgP8Pv8nY43tcKkMUNCyeBA== X-Received: by 2002:a6b:545:: with SMTP id 66-v6mr27776150iof.173.1525413269384; Thu, 03 May 2018 22:54:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.187.134 with HTTP; Thu, 3 May 2018 22:54:28 -0700 (PDT) In-Reply-To: <20180503232920.GF27853@wotan.suse.de> References: <20180429093558.5411-1-hdegoede@redhat.com> <20180429093558.5411-3-hdegoede@redhat.com> <20180503232920.GF27853@wotan.suse.de> From: Ard Biesheuvel Date: Fri, 4 May 2018 07:54:28 +0200 Message-ID: Subject: Re: [PATCH v5 2/5] efi: Add embedded peripheral firmware support To: "Luis R. Rodriguez" Cc: Hans de Goede , Greg Kroah-Hartman , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Jones , Dave Olsthoorn , Will Deacon , andresx7@gmail.com, Andy Lutomirski , Matt Fleming , David Howells , Mimi Zohar , Josh Triplett , Dmitry Torokhov , Martin Fuzzey , Kalle Valo , Arend Van Spriel , Linus Torvalds , Nicolas Broeking , Bjorn Andersson , Torsten Duwe , Kees Cook , "the arch/x86 maintainers" , linux-efi@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4 May 2018 at 01:29, Luis R. Rodriguez wrote: > On Sun, Apr 29, 2018 at 11:35:55AM +0200, Hans de Goede wrote: [...] >> diff --git a/Documentation/driver-api/firmware/request_firmware.rst b/Documentation/driver-api/firmware/request_firmware.rst >> index c8bddbdcfd10..560dfed76e38 100644 >> --- a/Documentation/driver-api/firmware/request_firmware.rst >> +++ b/Documentation/driver-api/firmware/request_firmware.rst >> @@ -73,3 +73,69 @@ If something went wrong firmware_request() returns non-zero and fw_entry >> is set to NULL. Once your driver is done with processing the firmware it >> can call call firmware_release(fw_entry) to release the firmware image >> and any related resource. >> + >> +EFI embedded firmware support >> +============================= > > This is a new fallback mechanism, please see: > > Documentation/driver-api/firmware/fallback-mechanisms.rst > > Refer to the section "Types of fallback mechanisms", augument the list there > and then move the section "Firmware sysfs loading facility" to a new file, and > then add a new file for your own. > >> + >> +On some devices the system's EFI code / ROM may contain an embedded copy >> +of firmware for some of the system's integrated peripheral devices and >> +the peripheral's Linux device-driver needs to access this firmware. > > You in no way indicate this is a just an invented scheme, a custom solution and > nothing standard. I realize Ard criticized that the EFI Firmware Volume Protocol > is not part of the UEFI spec -- however it is a bit more widely used right? > Why can't Linux support it instead? > Most implementations of UEFI are based on PI, and so it is likely that the protocols are available. However, the PI spec does not cover firmware blobs, and so it is undefined whether such blobs are self contained (i.e., in separate files in the firmware volume), statically linked into the driver or maybe even encrypted or otherwise encapsulated, and the actual loadable image only lives in memory. Hans's case is the second one, i.e., the firmware is at an arbitrary offset in the driver image. Using the FV protocol in this case would result in a mix of both approaches: look up the driver file by GUID [which could change btw between different versions of the system firmware, although this is unlikely] and then still use the prefix/crc based approach to sift through the image itself. But my main objection is simply that from the UEFI forum point of view, there is a clear distinction between the OS visible interfaces in the UEFI spec and the internal interfaces in the PI spec (which for instance are not subject to the same rules when it comes to backward compatibility), and so I think we should not depend on PI at all. This is all the more important considering that we are trying to encourage the creation of other implementations of UEFI that are not based on PI (e.g., uboot for arm64 implements the required UEFI interfaces for booting the kernel via GRUB), and adding dependencies on PI protocols makes that a moving target. So in my view, we either take a ad-hoc approach which works for the few platforms we expect to support, in which case Hans's approach is sufficient, or we architect it properly, in which case we shouldn't depend on PI because it does not belong in a properly architected OS<->firmware exchange. -- Ard.