From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: devel@edk2.groups.io, philmd@redhat.com,
Sami Mujawar <sami.mujawar@arm.com>
Cc: leif@nuviainc.com, lersek@redhat.com, Alexandru.Elisei@arm.com,
Andre.Przywara@arm.com, Matteo.Carlini@arm.com,
Laura.Moretta@arm.com, nd@arm.com
Subject: Re: [edk2-devel] [PATCH v3 06/15] ArmVirtPkg: Add Kvmtool NOR flash lib
Date: Thu, 25 Jun 2020 13:19:08 +0200 [thread overview]
Message-ID: <caa0cf09-77eb-7c50-2ed3-54a9cbc4e331@arm.com> (raw)
In-Reply-To: <b835511e-ae7e-483a-b7fc-aa1ee44af8a9@redhat.com>
On 6/25/20 10:45 AM, Philippe Mathieu-Daudé via groups.io wrote:
> Hi Sami,
>
> On 6/24/20 3:34 PM, Sami Mujawar wrote:
>> Kvmtool places the base address of the CFI flash in
>> the device tree it passes to UEFI. This library
>> parses the kvmtool device tree to read the CFI base
>> address and initialise the PCDs use by the NOR flash
>> driver and the variable storage.
>>
>> UEFI takes ownership of the CFI flash hardware, and
>> exposes its functionality through the UEFI Runtime
>> Variable Service. Therefore, disable the device tree
>> node for the CFI flash used for storing the UEFI
>> variables, to prevent the OS from attaching its device
>> driver as well.
>>
>> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
>> Acked-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>
>> Notes:
>> v3:
>> - ASSERT is sufficient to test Locating [Ard]
>> gFdtClientProtocolGuid as DEPEX ensures that this is
>> guaranteed to succeed.
>> - Removed additional error handling based on review [Sami]
>> feedback.
>> - Fix confusion caused by use of macro MAX_FLASH_BANKS. [Philippe]
>> - Renamed MAX_FLASH_BANKS to MAX_FLASH_DEVICES. [Sami]
>> - Use macro to define block size for flash. [Philippe]
>> - Defined macro KVMTOOL_NOR_BLOCK_SIZE and also configured [Sami]
>> to reflect the correct block size 64KB.
>> - Disable the DT flash node used for UEFI variable storage [Sami]
>> as UEFI takes ownership of the flash device.
>> Ref: https://edk2.groups.io/g/devel/topic/74200914#60341
>>
>> v2:
>> - Library to read CFI flash base address from DT and initialise [Sami]
>> PCDs used for NOR flash variables.
>>
>> ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c | 330 ++++++++++++++++++++
>> ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf | 49 +++
>> 2 files changed, 379 insertions(+)
>>
>> diff --git a/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c b/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..8e9dcf31691b4b12b9c7bac1ad4ba8d3a534a1d8
>> --- /dev/null
>> +++ b/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c
>> @@ -0,0 +1,330 @@
>> +/** @file
>> + An instance of the NorFlashPlatformLib for Kvmtool platform.
>> +
>> + Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
>> +
>> + SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> + **/
>> +
>> +#include <Library/BaseLib.h>
>> +#include <Library/DebugLib.h>
>> +#include <Library/NorFlashPlatformLib.h>
>> +#include <Library/UefiBootServicesTableLib.h>
>> +#include <Protocol/FdtClient.h>
>> +
>> +/** Macro defining the NOR block size configured in Kvmtool.
>> +*/
>> +#define KVMTOOL_NOR_BLOCK_SIZE SIZE_64KB
>> +
>> +/** Macro defining the maximum number of Flash devices.
>> +*/
>> +#define MAX_FLASH_DEVICES 4
>
> I am sorry but I am still confused...
>
> This is about the QEMU Virt machine, right?
>
> This machine was supposed to have 1 single flash, see QEMU commit
> f5fdcd6e58 ("hw/arm: Add 'virt' platform") from Nov 2013:
>
> /* Addresses and sizes of our components.
> * 0..128MB is space for a flash device so we can run bootrom code
> such as UEFI.
> ...
>
> Due to limitations in the QEMU cfi-flash model, instead of using
> a single flash device (with proper sector/bank protection), two
> devices were added in QEMU commit acf82361c6 ("hw/arm/virt: Provide
> flash devices for boot ROMs") Sep 2014:
>
> Add two flash devices to the virt board, so that it can be used for
> running guests which want a bootrom image such as UEFI. We provide
> two flash devices to make it more convenient to provide both a
> read-only UEFI image and a read-write place to store guest-set
> UEFI config variables. The '-bios' command line option is set up
> to provide an image for the first of the two flash devices.
>
> What do you declare maximum 4 devices?
>
Kvmtool != QEMU, so whatever QEMU does is irrelevant for this series.
next prev parent reply other threads:[~2020-06-25 11:19 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 13:34 [PATCH v3 00/15] Kvmtool guest firmware support for Arm Sami Mujawar
2020-06-24 13:34 ` [PATCH v3 01/15] PcAtChipsetPkg: Add MMIO Support to RTC driver Sami Mujawar
2020-06-25 11:24 ` Ard Biesheuvel
2020-06-29 2:36 ` [edk2-devel] " Guomin Jiang
2020-06-24 13:34 ` [PATCH v3 02/15] ArmVirtPkg: Add Kvmtool RTC Fdt Client Library Sami Mujawar
2020-06-25 11:31 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 03/15] ArmPlatformPkg: Dynamic flash variable base Sami Mujawar
2020-06-24 13:34 ` [PATCH v3 04/15] ArmVirtPkg: Add kvmtool platform driver Sami Mujawar
2020-06-25 11:35 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 05/15] ArmVirtPkg: kvmtool platform memory map Sami Mujawar
2020-06-24 13:34 ` [PATCH v3 06/15] ArmVirtPkg: Add Kvmtool NOR flash lib Sami Mujawar
2020-06-25 8:45 ` Philippe Mathieu-Daudé
2020-06-25 11:19 ` Ard Biesheuvel [this message]
2020-06-25 11:41 ` [edk2-devel] " Philippe Mathieu-Daudé
2020-06-25 11:38 ` Ard Biesheuvel
2020-06-25 17:33 ` Sami Mujawar
2020-06-24 13:34 ` [PATCH v3 07/15] ArmVirtPkg: Early serial port initialisation Sami Mujawar
2020-06-25 11:42 ` Ard Biesheuvel
2020-06-26 9:23 ` Julien Grall
2020-06-24 13:34 ` [PATCH v3 08/15] MdeModulePkg: Fix constructor invocation ordering Sami Mujawar
2020-06-25 13:51 ` Ard Biesheuvel
2020-06-26 13:22 ` Laszlo Ersek
2020-06-27 11:37 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 09/15] ArmVirtPkg: GUID Hob for 16550 UART base address Sami Mujawar
2020-06-25 13:52 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 10/15] ArmVirtPkg: 16550 UART Platform hook library Sami Mujawar
2020-06-25 13:56 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 11/15] ArmVirtPkg: Add Kvmtool Platform Pei Lib Sami Mujawar
2020-06-25 14:05 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 12/15] ArmVirtPkg: Support for kvmtool virtual platform Sami Mujawar
2020-06-25 14:08 ` Ard Biesheuvel
2020-06-26 13:26 ` Laszlo Ersek
2020-06-24 13:34 ` [PATCH v3 13/15] ArmVirtPkg: Package dependency for MC146818 RTC Sami Mujawar
2020-06-25 14:08 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 14/15] ArmVirtPkg: Add kvmtool to package dictionary Sami Mujawar
2020-06-25 14:09 ` Ard Biesheuvel
2020-06-24 13:34 ` [PATCH v3 15/15] Maintainer.txt: Add Kvmtool platform reviewer Sami Mujawar
2020-06-25 14:09 ` Ard Biesheuvel
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-list 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=caa0cf09-77eb-7c50-2ed3-54a9cbc4e331@arm.com \
--to=devel@edk2.groups.io \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox