Received: by 10.213.65.68 with SMTP id h4csp1548486imn; Wed, 4 Apr 2018 22:46:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ME+IGAj1pVobKkGO7V+cdj2e4nEpFqmNyewYjsbdG/cgEG6uFkiaBGdFrNOFYQmUOZxGv X-Received: by 10.99.97.203 with SMTP id v194mr13775843pgb.373.1522907173999; Wed, 04 Apr 2018 22:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522907173; cv=none; d=google.com; s=arc-20160816; b=IIiMqKwwSX348BLel0+fdM2feFJLwOjNk7zksemzL/W6OSoRgXgWZ6KKpJe6N3BZBt fLB7uRKQQQUwQxyC7JBbsG2sfVcbC4VXj0NsPjlYrPfPV1l6xGGYnPfEOT8IKzyW+SBl ZCUZFpiiVbV1b96fC6VjpEyMDdM1IfLXh9aA88Gg2xx0ntuQHZKL6LwXrpikWKEAdtKh 6/lMdC9mazGzlLwF6UTocvAgJL1pAtidPdc6r9VuT8vHU9hrmMYiEBlcL3GQKPitLJPT 8fqRo73ojJyMdOGKBjI2LU/LBMkAac+AoDeocxVaruruHQh0GOf78xIj+AMjSsUnTH8O clZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=u3Ht/7OLdPl4lKf672vGaoT2qmxkPiXuGGHN8MCHe/E=; b=MADyROenqrCK/gJhg6kbULphBJolJmM6KNo4/W03PpSLKGrehJsYY4QulRU3lFMXUF w9tqO0OlR5oK7QC4H7ppaPmRpw/MTU60gezeCgFZsoHG27HJipgCd+UX4XGm7oqnTBT4 tpih14SH4eXZCuvY03Ug+Y8fq+hESTz7WS090BxeEjZrLSk8K8lO/VEZBMXh9B1EglCA jD0rEZM6+Q7WwSbUJt+TvahWgyMiHlHcysRxJHB7gYUzFU7a9l3NSXWoUf4C+JzqkqLn U+owuCeUHJOT8p+1FiMUkjudeysDZ74VJa/o/jAJITpJtEZvFxhyv7PtxmobgS1dAJKM K2EA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si718907pgq.255.2018.04.04.22.45.24; Wed, 04 Apr 2018 22:46:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751862AbeDEFnx (ORCPT + 99 others); Thu, 5 Apr 2018 01:43:53 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:39135 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751743AbeDEFnw (ORCPT ); Thu, 5 Apr 2018 01:43:52 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id CB89C30000F20; Thu, 5 Apr 2018 07:43:49 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 8C10AFC83; Thu, 5 Apr 2018 07:43:49 +0200 (CEST) Date: Thu, 5 Apr 2018 07:43:49 +0200 From: Lukas Wunner To: Peter Jones , Hans de Goede Cc: "Luis R. Rodriguez" , Ard Biesheuvel , Greg Kroah-Hartman , Thomas Gleixner , Kalle Valo , Arend Van Spriel , Ingo Molnar , "H . Peter Anvin" , linux-kernel@vger.kernel.org, Dave Olsthoorn , x86@kernel.org, linux-efi@vger.kernel.org, Will Deacon , Andy Lutomirski , Matt Fleming , David Howells , Mimi Zohar , Josh Triplett , Matthew Garrett , One Thousand Gnomes , Linus Torvalds , dmitry.torokhov@gmail.com, mfuzzey@parkeon.com, keescook@chromium.org, nbroeking@me.com, bjorn.andersson@linaro.org, Torsten Duwe Subject: Re: [PATCH 2/2] efi: Add embedded peripheral firmware support Message-ID: <20180405054349.GA25653@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78ae4d18-8964-5748-a69f-0017d0dca5f7@redhat.com> <20180404171835.xvllgcqirl3b5gd5@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 04, 2018 at 01:18:36PM -0400, Peter Jones wrote: > > On Tue, Apr 03, 2018 at 08:07:11PM +0200, Lukas Wunner wrote: > > > * Add the EFI Firmware Volume Protocol to include/linux/efi.h: > > > https://www.intel.com/content/dam/doc/reference-guide/efi-firmware-file-volume-specification.pdf > > > > > > * Amend arch/x86/boot/compressed/eboot.c to read the files with the > > > GUIDs you're interested in into memory and pass the files to the > > > kernel as setup_data payloads. > > To be honest, I'm a bit skeptical about the firmware volume approach. > Tools like UEFITool[0] and uefi-firmware-parser[1] have existed for > years, still don't seem to reliably parse firmware images I see in the > wild, and have a fairly regular need for fixes. These are tools > maintained by smart people who are making a real effort, and it still > looks pretty hard to do a good job that applies across a lot of > platforms. > > So I'd rather use Hans's existing patches, at least for now, and if > someone is interested in hacking on making an efi firmware volume parser > for the kernel, switch them to that when such a thing is ready. Hello? As I've written in the above-quoted e-mail the kernel should read the files using EFI_FIRMWARE_VOLUME_PROTOCOL.ReadFile(). *Not* by parsing the firmware volume! Parsing the firmware volume is only necessary to find out the GUIDs of the files you're looking for. You only do that *once*. I habitually extract Apple's EFI Firmware Volumes and found the existing tools always did a sufficiently good job to get the information I need (such as UEFIExtract, which I've linked to, and which is part of the UEFITool suite, which you've linked to once more). On Wed, Apr 04, 2018 at 10:25:05PM +0200, Hans de Goede wrote: > Lukas, thank you for your suggestions on this, but I doubt that these > devices use the Firmware Volume stuff. If they're using EFI, they're using a Firmware Volume and you should be able to use the Firmware Volume Protocol to read files from it. If that protocol wasn't supported, the existing EFI drivers wouldn't be able to function as they couldn't load files from the volume. > What you are describing sounds like significantly more work then > the vendor just embedding the firmware as a char firmware[] in their > EFI mouse driver. In such cases, read the EFI mouse driver from the firmware volume and extract the firmware from the offset you've pre-determined. That's never going to change since the devices never receive updates, as you're saying. So basically you'll have a struct with GUID, offset, length, and the name under which the firmware is made available to Linux drivers. > That combined with Peter's worries about difficulties parsing the > Firmware Volume stuff, makes me believe that it is best to just > stick with my current approach as Peter suggests. I don't know why you insist on a hackish solution (your own words) even though a cleaner solution is suggested, but fortunately it's not for me to decide what goes in and what doesn't. ;-) Thanks, Lukas