From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8EB839410BE for ; Fri, 17 May 2024 07:33:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=zQ9QVHuj3GFinUaP1eTzT1sUoLNDSMTMo33GbtPNR40=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1715931211; v=1; b=VYE8pCV5ldxE2NG7YLuZYpsmNeq9Zth8bK08SbtpWXt2D+LH6ND+iFX6rRBXIjU8+wNYpO1i dQtkXIwdm1A4gu14Cd2TkeAmONR7yhn09kmONq2E+tMEVcGtrOyDLJfKjAmpfh9u4z71K4NRRpe CzmhjacRr84fq8/K+PyiGVqUbQDQL3t4vim8v38aw9lh5O23wkwQKbbgiq6SAJY0PI86j0+bwou tP7f6/SogBV5lvgwfFspe/sKqNK6ESJPynwvnKbLGAu+wGTEYCYg/8HEfkxF18GshZGSz2cNT0H vw8yoyOajwM8xvTreYNy3QVIH6oqlUEKnfgGnIog4c+JQ== X-Received: by 127.0.0.2 with SMTP id t8hUYY7687511xceKISHxHMQ; Fri, 17 May 2024 00:33:31 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.34576.1715931209361031887 for ; Fri, 17 May 2024 00:33:30 -0700 X-Received: from loongson.cn (unknown [10.40.24.149]) by gateway (Coremail) with SMTP id _____8BxXetCCEdm5N4NAA--.26401S3; Fri, 17 May 2024 15:33:22 +0800 (CST) X-Received: from [10.40.24.149] (unknown [10.40.24.149]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxKOQ+CEdm9R8kAA--.4643S3; Fri, 17 May 2024 15:33:18 +0800 (CST) Message-ID: <9be133e7-f2ef-42fd-878d-efd4521ee2f6@loongson.cn> Date: Fri, 17 May 2024 15:33:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v1 0/2] Add a new FdtNorFalshQemuLib and enable it in To: devel@edk2.groups.io, ardb@kernel.org Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Gerd Hoffmann , Jiewen Yao References: <20240517071729.188409-1-lichao@loongson.cn> From: "Chao Li" In-Reply-To: X-CM-TRANSID: AQAAf8AxKOQ+CEdm9R8kAA--.4643S3 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAACGZGxZUETQABsx X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 17 May 2024 00:33:30 -0700 Resent-From: lichao@loongson.cn Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 46ZagR9mjltrtbJIts21V6dzx7686176AA= Content-Type: multipart/alternative; boundary="------------mikkGlL82gqOev2hkqInNSXB" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=VYE8pCV5; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --------------mikkGlL82gqOev2hkqInNSXB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Ard, No, it's just that my email was bounced just now, the groupio didn't=20 receive my email when I send the first time, and I sent them again after=20 it unbounce. Thanks, Chao On 2024/5/17 15:21, Ard Biesheuvel wrote: > Hello Chao Li, > > You sent two series in quick succession. Is there any difference > between the two? > > > On Fri, 17 May 2024 at 09:17, Chao Li wrote: >> Patch1: Added a new library called FdtNorFlashQemuLib in OvmfPkg/Library >> which is non-hardcode dependency. >> Patch2: Enable the new library in ArmVirtQemu.dsc and >> ArmVirtQemuKernel.dsc. >> >> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D4770 >> >> I have verified on both of the two platforms: >> Prepare: >> install libvirt, virt-manager, qemu-systemaarch64. >> >> Step 1: >> Built the two platforms with ArmVirtQemu.dsc and >> ArmVirtQemuKernel.dsc, and then using the command create the pflash >> files: >> Build the two platforms firmware using ArmVirtQemu.dsc and >> ArmVirtQemuKernel.dsc, and then create the pflash files using following >> command: >> cat QEMU_EFI.fd /dev/zero | head -c 64m > ./QEMU_EFI-pflash.raw >> cat QEMU_VARS.fd /dev/zero | head -c 64m > ./vars-template-pflash.raw >> qemu-img convert -f raw -O qcow2 -o cluster_size=3D4096 -S 4096 QEMU_EFI= -pflash.raw QEMU_EFI-pflash.qcow2 >> qemu-img convert -f raw -O qcow2 -o cluster_size=3D4096 -S 4096 vars-tem= plate-pflash.raw vars-template-pflash.qcow2 >> >> Download a AARCH64 QCOW2 image. >> Copy them into /usr/share/edk2/aarch64/. >> >> Step 2: >> Verification the pflash working: >> ArmVirtQemu: >> Run the QEMU ARM virt machine using the following command: >> qemu-system-aarch64 \ >> -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/QEM= U_EFI-pflash.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":= true,"discard":"unmap"}' \ >> -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"= driver":"qcow2","file":"libvirt-pflash0-storage"}' \ >> -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/var= s-template-pflash.qcow2","node-name":"libvirt-pflash1-storage","auto-read-o= nly":true,"discard":"unmap"}' \ >> -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,= "driver":"qcow2","file":"libvirt-pflash1-storage"}' \ >> -machine virt,pflash0=3Dlibvirt-pflash0-format,pflash1=3Dlibvirt-pf= lash1-format,acpi=3Don \ >> -cpu cortex-a57 \ >> -m size=3D2097152k \ >> -serial stdio \ >> -net none \ >> -device ramfb \ >> -device nec-usb-xhci \ >> -device usb-mouse \ >> -device usb-kbd >> >> ArmVirtQemuKernel: >> Run the QEMU kernel ARM virt machine using the following command: >> qemu-system-aarch64 \ >> -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/var= s-template-pflash.raw","node-name":"libvirt-pflash1-storage","auto-read-onl= y":true,"discard":"unmap"}' \ >> -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,= "driver":"raw","file":"libvirt-pflash1-storage"}' \ >> -machine virt,usb=3Doff,dump-guest-core=3Doff,gic-version=3D3,pflas= h1=3Dlibvirt-pflash1-format \ >> -cpu cortex-a57 \ >> -m 4096 \ >> -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ >> -no-user-config \ >> -nodefaults \ >> -device virtio-gpu-pci \ >> -kernel /usr/share/edk2/aarch64/QEMU_EFI-pflash.raw \ >> -serial stdio \ >> -device nec-usb-xhci \ >> -device usb-mouse \ >> -device usb-kbd \ >> -hda /usr/share/edk2/aarch64/openEuler-22.03-LTS-SP3-aarch64.qcow2 = \ >> -monitor tcp::3333,server,nowait >> >> Step 3: >> After the virt-machines starts, enter "F2" to enter the setup UI, try to >> change the boot order or some ther variables stored in the flash, then >> enter "F10" to save the changes and reboot it. >> After restarting, enter "F2" to enter the setup UI and check whether the >> changes before the restart operation have been saved. >> >> >> Using the above three steps, both platforms will works fine. >> >> I have not created the PR in github yet, I will create it once the edk2 >> merge window reopens. >> >> Cc: Ard Biesheuvel >> Cc: Leif Lindholm >> Cc: Sami Mujawar >> Cc: Gerd Hoffmann >> Cc: Jiewen Yao >> >> Chao Li (2): >> OvmfPkg: Add no hardcode version of FtdNorFlashQemuLib >> ArmVirtPkg: Enable the non-hardcode version FtdNorFlashQemuLib >> >> ArmVirtPkg/ArmVirtQemu.dsc | 21 ++- >> ArmVirtPkg/ArmVirtQemuKernel.dsc | 20 ++- >> ArmVirtPkg/VarStore.fdf.inc | 5 +- >> .../FdtNorFlashQemuLib/FdtNorFlashQemuLib.c | 165 ++++++++++++++++++ >> .../FdtNorFlashQemuLib/FdtNorFlashQemuLib.inf | 46 +++++ >> 5 files changed, 249 insertions(+), 8 deletions(-) >> create mode 100644 OvmfPkg/Library/FdtNorFlashQemuLib/FdtNorFlashQemuL= ib.c >> create mode 100644 OvmfPkg/Library/FdtNorFlashQemuLib/FdtNorFlashQemuL= ib.inf >> >> -- >> 2.27.0 >> >> >> >> >> >> > >=20 > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118992): https://edk2.groups.io/g/devel/message/118992 Mute This Topic: https://groups.io/mt/106149594/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --------------mikkGlL82gqOev2hkqInNSXB Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Ard,

No, it's just that my email was bounced just now, the groupio didn't receive my email when I send the first time, and I sent them again after it unbounce.


=
Thanks,
Chao
On 2024/5/17 15:21, Ard Biesheuvel wrote:
Hello Chao Li,

You sent two series in quick succession. Is there any difference
between the two?


On Fri, 17 May 2024 at 09:17, Chao Li <lichao@loongson.cn> wrote:
Patch1: Added a new library called FdtNorFlashQemuLib in OvmfPkg/Library
which is non-hardcode dependency.
Patch2: Enable the new library in ArmVirtQemu.dsc and
ArmVirtQemuKernel.dsc.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=
=3D4770

I have verified on both of the two platforms:
Prepare:
install libvirt, virt-manager, qemu-systemaarch64.

Step 1:
Built the two platforms with ArmVirtQemu.dsc and
ArmVirtQemuKernel.dsc, and then using the command create the pflash
files:
Build the two platforms firmware using ArmVirtQemu.dsc and
ArmVirtQemuKernel.dsc, and then create the pflash files using following
command:
cat QEMU_EFI.fd  /dev/zero | head -c 64m > ./QEMU_EFI-pflash.raw
cat QEMU_VARS.fd  /dev/zero | head -c 64m > ./vars-template-pflash.raw
qemu-img convert -f raw -O qcow2 -o cluster_size=3D4096 -S 4096 QEMU_EFI-pf=
lash.raw  QEMU_EFI-pflash.qcow2
qemu-img convert -f raw -O qcow2 -o cluster_size=3D4096 -S 4096 vars-templa=
te-pflash.raw vars-template-pflash.qcow2

Download a AARCH64 QCOW2 image.
Copy them into /usr/share/edk2/aarch64/.

Step 2:
Verification the pflash working:
ArmVirtQemu:
Run the QEMU ARM virt machine using the following command:
qemu-system-aarch64 \
    -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/QEMU_EF=
I-pflash.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true=
,"discard":"unmap"}' \
    -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driv=
er":"qcow2","file":"libvirt-pflash0-storage"}' \
    -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/vars-te=
mplate-pflash.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only"=
:true,"discard":"unmap"}' \
    -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"dri=
ver":"qcow2","file":"libvirt-pflash1-storage"}' \
    -machine virt,pflash0=3Dlibvirt-pflash0-format,pflash1=3Dlibvirt-pflash=
1-format,acpi=3Don \
    -cpu cortex-a57 \
    -m size=3D2097152k \
    -serial stdio \
    -net none \
    -device ramfb \
    -device nec-usb-xhci \
    -device usb-mouse \
    -device usb-kbd

ArmVirtQemuKernel:
Run the QEMU kernel ARM virt machine using the following command:
qemu-system-aarch64 \
    -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/vars-te=
mplate-pflash.raw","node-name":"libvirt-pflash1-storage","auto-read-only":t=
rue,"discard":"unmap"}' \
    -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"dri=
ver":"raw","file":"libvirt-pflash1-storage"}' \
    -machine virt,usb=3Doff,dump-guest-core=3Doff,gic-version=3D3,pflash1=
=3Dlibvirt-pflash1-format \
    -cpu cortex-a57 \
    -m 4096 \
    -smp 1,sockets=3D1,cores=3D1,threads=3D1 \
    -no-user-config \
    -nodefaults \
    -device virtio-gpu-pci \
    -kernel /usr/share/edk2/aarch64/QEMU_EFI-pflash.raw \
    -serial stdio \
    -device nec-usb-xhci \
    -device usb-mouse \
    -device usb-kbd  \
    -hda /usr/share/edk2/aarch64/openEuler-22.03-LTS-SP3-aarch64.qcow2 \
    -monitor tcp::3333,server,nowait

Step 3:
After the virt-machines starts, enter "F2" to enter the setup UI, try to
change the boot order or some ther variables stored in the flash, then
enter "F10" to save the changes and reboot it.
After restarting, enter "F2" to enter the setup UI and check whether the
changes before the restart operation have been saved.


Using the above three steps, both platforms will works fine.

I have not created the PR in github yet, I will create it once the edk2
merge window reopens.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>

Chao Li (2):
  OvmfPkg: Add no hardcode version of FtdNorFlashQemuLib
  ArmVirtPkg: Enable the non-hardcode version FtdNorFlashQemuLib

 ArmVirtPkg/ArmVirtQemu.dsc                    |  21 ++-
 ArmVirtPkg/ArmVirtQemuKernel.dsc              |  20 ++-
 ArmVirtPkg/VarStore.fdf.inc                   |   5 +-
 .../FdtNorFlashQemuLib/FdtNorFlashQemuLib.c   | 165 ++++++++++++++++++
 .../FdtNorFlashQemuLib/FdtNorFlashQemuLib.inf |  46 +++++
 5 files changed, 249 insertions(+), 8 deletions(-)
 create mode 100644 OvmfPkg/Library/FdtNorFlashQemuLib/FdtNorFlashQemuLib.c
 create mode 100644 OvmfPkg/Library/FdtNorFlashQemuLib/FdtNorFlashQemuLib.i=
nf

--
2.27.0









_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#118992) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--------------mikkGlL82gqOev2hkqInNSXB--