From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Hans de Goede <hdegoede@redhat.com>,
"Luis R. Rodriguez" <mcgrof@kernel.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Kalle Valo <kvalo@codeaurora.org>,
Arend Van Spriel <arend.vanspriel@broadcom.com>,
Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, Peter Jones <pjones@redhat.com>,
Dave Olsthoorn <dave@bewaar.me>,
x86@kernel.org, linux-efi@vger.kernel.org,
Will Deacon <will.deacon@arm.com>,
Andy Lutomirski <luto@kernel.org>,
Matt Fleming <matt@codeblueprint.co.uk>,
David Howells <dhowells@redhat.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Josh Triplett <josh@joshtriplett.org>,
Matthew Garrett <mjg59@srcf.ucam.or>
Subject: Re: [PATCH 2/2] efi: Add embedded peripheral firmware support
Date: Tue, 3 Apr 2018 18:58:48 +0000 [thread overview]
Message-ID: <20180403185848.GD30543@wotan.suse.de> (raw)
In-Reply-To: <20180403180711.GA7957@wunner.de>
On Tue, Apr 03, 2018 at 08:07:11PM +0200, Lukas Wunner wrote:
> On Tue, Apr 03, 2018 at 10:33:25AM +0200, Hans de Goede wrote:
> > I asked Peter Jones for suggestions how to extract this during boot and
> > he suggested seeing if there was a copy of the firmware in the
> > EFI_BOOT_SERVICES_CODE memory segment, which it turns out there is.
> >
> > My patch to add support for this contains a table of device-model (dmi
> > strings), firmware header (first 64 bits), length and crc32 and then if
> > we boot on a device-model which is in the table the code scans the
> > EFI_BOOT_SERVICES_CODE for the prefix, if found checks the crc and
> > caches the firmware for later use by request-firmware.
> >
> > So I just do a brute-force search for the firmware, this really is hack,
> > nothing standard about it I'm afraid. But it works on 4 different x86
> > tablets I have and makes the touchscreen work OOTB on them, so I believe
> > it is a worthwhile hack to have.
>
> The EFI Firmware Volume contains a kind of filesystem with files
> identified by GUIDs. Those files include EFI drivers, ACPI tables,
> DMI data and so on. It is actually quite common for vendors to
> also include device firmware on the Firmware Volume. Apple is doing
> this to ship firmware updates e.g. for the GMUX controller found on
> dual GPU MacBook Pros. If they want to update the controller's
> firmware, they include it in a BIOS update, and an EFI driver checks
> on boot if the firmware update for the controller is necessary and
> if so, flashes it.
>
> The firmware files you're looking for are almost certainly included
> on the Firmware Volume as individual files.
What Hans implemented seems to have been for a specific x86 hack, best if we
confirm if indeed they are present on the Firmware Volume.
> Rather than scraping
> the EFI memory for firmware, I think it would be cleaner and more
> elegant if you just retrieve the files you're interested in from
> the Firmware Volume.
>
> We're doing something similar with Apple EFI properties, see
> 58c5475aba67 and c9cc3aaa0281.
>
> Basically what you need to do to implement this approach is:
>
> * Determine the GUIDs used by vendors for the files you're interested
> in. Either dump the Firmware Volume or take an EFI update as
> shipped by the vendor, then feed it to UEFIExtract:
> https://github.com/LongSoft/UEFITool
>
> * 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.
>
> * Once the kernel has booted, make the files you've retrieved
> available to device drivers as firmware blobs.
Happen to know if devices using Firmware Volumes also sign their firmware
and if hw checks the firmware at load time?
Luis
> The end result is mostly the same as what you're doing here,
> and you'll also have a similar array of structs, but instead
> of hardcoding 8-byte signatures of firmware files, you'll be
> using GUIDs. I envision lots of interesting use cases for
> a generic Firmware Volume file retrieval mechanism. What you
> need to keep in mind though is that this approach only works
> if the kernel is booted via the EFI stub.
>
> Thanks,
>
> Lukas
>
--
Do not panic
WARNING: multiple messages have this Message-ID (diff)
From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Hans de Goede <hdegoede@redhat.com>,
"Luis R. Rodriguez" <mcgrof@kernel.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Kalle Valo <kvalo@codeaurora.org>,
Arend Van Spriel <arend.vanspriel@broadcom.com>,
Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, Peter Jones <pjones@redhat.com>,
Dave Olsthoorn <dave@bewaar.me>,
x86@kernel.org, linux-efi@vger.kernel.org,
Will Deacon <will.deacon@arm.com>,
Andy Lutomirski <luto@kernel.org>,
Matt Fleming <matt@codeblueprint.co.uk>,
David Howells <dhowells@redhat.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Josh Triplett <josh@joshtriplett.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>,
dmitry.torokhov@gmail.com, mfuzzey@parkeon.com,
keescook@chromium.org, nbroeking@me.com,
bjorn.andersson@linaro.org, Torsten Duwe <duwe@suse.de>
Subject: Re: [PATCH 2/2] efi: Add embedded peripheral firmware support
Date: Tue, 3 Apr 2018 18:58:48 +0000 [thread overview]
Message-ID: <20180403185848.GD30543@wotan.suse.de> (raw)
In-Reply-To: <20180403180711.GA7957@wunner.de>
On Tue, Apr 03, 2018 at 08:07:11PM +0200, Lukas Wunner wrote:
> On Tue, Apr 03, 2018 at 10:33:25AM +0200, Hans de Goede wrote:
> > I asked Peter Jones for suggestions how to extract this during boot and
> > he suggested seeing if there was a copy of the firmware in the
> > EFI_BOOT_SERVICES_CODE memory segment, which it turns out there is.
> >
> > My patch to add support for this contains a table of device-model (dmi
> > strings), firmware header (first 64 bits), length and crc32 and then if
> > we boot on a device-model which is in the table the code scans the
> > EFI_BOOT_SERVICES_CODE for the prefix, if found checks the crc and
> > caches the firmware for later use by request-firmware.
> >
> > So I just do a brute-force search for the firmware, this really is hack,
> > nothing standard about it I'm afraid. But it works on 4 different x86
> > tablets I have and makes the touchscreen work OOTB on them, so I believe
> > it is a worthwhile hack to have.
>
> The EFI Firmware Volume contains a kind of filesystem with files
> identified by GUIDs. Those files include EFI drivers, ACPI tables,
> DMI data and so on. It is actually quite common for vendors to
> also include device firmware on the Firmware Volume. Apple is doing
> this to ship firmware updates e.g. for the GMUX controller found on
> dual GPU MacBook Pros. If they want to update the controller's
> firmware, they include it in a BIOS update, and an EFI driver checks
> on boot if the firmware update for the controller is necessary and
> if so, flashes it.
>
> The firmware files you're looking for are almost certainly included
> on the Firmware Volume as individual files.
What Hans implemented seems to have been for a specific x86 hack, best if we
confirm if indeed they are present on the Firmware Volume.
> Rather than scraping
> the EFI memory for firmware, I think it would be cleaner and more
> elegant if you just retrieve the files you're interested in from
> the Firmware Volume.
>
> We're doing something similar with Apple EFI properties, see
> 58c5475aba67 and c9cc3aaa0281.
>
> Basically what you need to do to implement this approach is:
>
> * Determine the GUIDs used by vendors for the files you're interested
> in. Either dump the Firmware Volume or take an EFI update as
> shipped by the vendor, then feed it to UEFIExtract:
> https://github.com/LongSoft/UEFITool
>
> * 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.
>
> * Once the kernel has booted, make the files you've retrieved
> available to device drivers as firmware blobs.
Happen to know if devices using Firmware Volumes also sign their firmware
and if hw checks the firmware at load time?
Luis
> The end result is mostly the same as what you're doing here,
> and you'll also have a similar array of structs, but instead
> of hardcoding 8-byte signatures of firmware files, you'll be
> using GUIDs. I envision lots of interesting use cases for
> a generic Firmware Volume file retrieval mechanism. What you
> need to keep in mind though is that this approach only works
> if the kernel is booted via the EFI stub.
>
> Thanks,
>
> Lukas
>
--
Do not panic
next prev parent reply other threads:[~2018-04-03 18:58 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 12:19 [PATCH 1/2] efi: Export boot-services code and data as debugfs-blobs Hans de Goede
2018-03-31 12:19 ` [PATCH 2/2] efi: Add embedded peripheral firmware support Hans de Goede
2018-04-01 0:19 ` kbuild test robot
2018-04-01 0:19 ` kbuild test robot
2018-04-01 0:22 ` kbuild test robot
2018-04-01 0:22 ` kbuild test robot
2018-04-02 23:23 ` Luis R. Rodriguez
2018-04-03 8:33 ` Hans de Goede
2018-04-03 18:07 ` Lukas Wunner
2018-04-03 18:58 ` Luis R. Rodriguez [this message]
2018-04-03 18:58 ` Luis R. Rodriguez
2018-04-04 17:18 ` Peter Jones
2018-04-04 17:18 ` Peter Jones
2018-04-04 20:25 ` Hans de Goede
2018-04-04 20:25 ` Hans de Goede
2018-04-05 0:28 ` Ard Biesheuvel
2018-04-05 0:28 ` Ard Biesheuvel
2018-04-05 5:43 ` Lukas Wunner
2018-04-05 5:43 ` Lukas Wunner
2018-04-06 14:08 ` Luis R. Rodriguez
2018-04-06 14:08 ` Luis R. Rodriguez
2018-04-06 14:14 ` Ard Biesheuvel
2018-04-06 14:14 ` Ard Biesheuvel
2018-04-06 14:28 ` Ard Biesheuvel
2018-04-06 14:28 ` Ard Biesheuvel
2018-04-07 9:51 ` Lukas Wunner
2018-04-07 9:51 ` Lukas Wunner
2018-04-07 11:13 ` Hans de Goede
2018-04-07 11:13 ` Hans de Goede
2018-04-06 14:16 ` Peter Jones
2018-04-06 14:16 ` Peter Jones
2018-04-03 18:47 ` Luis R. Rodriguez
2018-04-05 13:54 ` Hans de Goede
2018-04-03 19:53 ` Peter Jones
2018-04-05 11:51 ` Hans de Goede
2018-03-31 14:10 ` [PATCH 1/2] efi: Export boot-services code and data as debugfs-blobs Greg Kroah-Hartman
2018-03-31 16:57 ` Hans de Goede
2018-04-01 0:12 ` kbuild test robot
2018-04-01 0:12 ` kbuild test robot
2018-04-01 0:12 ` [RFC PATCH] efi: debugfs_blob[] can be static kbuild test robot
2018-04-01 0:12 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180403185848.GD30543@wotan.suse.de \
--to=mcgrof@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=arend.vanspriel@broadcom.com \
--cc=dave@bewaar.me \
--cc=dhowells@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=kvalo@codeaurora.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=luto@kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@redhat.com \
--cc=mjg59@srcf.ucam.or \
--cc=pjones@redhat.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.