From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C6AEA740038 for ; Tue, 19 Mar 2024 02:10:16 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=A/webUQdEJULxy1Tei+FIl2pQehXCdhvSRzqnSL/DJc=; 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:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1710814215; v=1; b=qFtLS5tqstSRWDS8oMSMuRdxESgjbg8TOeV0AekDWqp109A270y0FA3gHpAn4zOvKjXV92E1 Wdi43M/qkbAKWhz8Onsi8J0UYILkTbeSvpvlzfYfbAg4WbHD4jd8n0hthjgb/jSJTJT/w5tPwdD ggjsJHQYimu0ao6VTJ3t4pua1+YC/8V8JlV8+h3hGcjqJkm3PbWmhaFNkMnykWO6CVL7/MZrZJ7 eEkmgbTLP1eyFfJ03aZA/bfunQ3of/cNobyMtzQdA7PH62axiULdJ2HLSjeLeINVgbcFFJl+TpO /LIrX6FyAaUlUVn6tfyR61QTm09x4x+/pcdD+3gO3D0/g== X-Received: by 127.0.0.2 with SMTP id fkB0YY7687511xTJZxQ6A3j9; Mon, 18 Mar 2024 19:10:15 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.5604.1710814213901188512 for ; Mon, 18 Mar 2024 19:10:14 -0700 X-Received: from loongson.cn (unknown [10.40.24.149]) by gateway (Coremail) with SMTP id _____8BxyugE9PhlF5YaAA--.44113S3; Tue, 19 Mar 2024 10:10:12 +0800 (CST) X-Received: from [10.40.24.149] (unknown [10.40.24.149]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxHs8B9Phl+QVdAA--.47988S3; Tue, 19 Mar 2024 10:10:09 +0800 (CST) Message-ID: Date: Tue, 19 Mar 2024 10:10:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v1 21/26] OvmfPkg/LoongArchVirt: Add FdtQemuFwCfgLib To: devel@edk2.groups.io, kraxel@redhat.com, lixianglai Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Bibo Mao , Dongyan Qian References: <20240311093631.1251466-1-lichao@loongson.cn> <20240311093924.1254576-1-lichao@loongson.cn> <01d94c67-de3d-7709-84d4-ec97dc7a01ec@loongson.cn> <2teja7rxfli7fxvxlii54tbdaj2y6jz2qlvprf7pfpzzjyycrz@gp5axpziekwh> From: "Chao Li" In-Reply-To: <2teja7rxfli7fxvxlii54tbdaj2y6jz2qlvprf7pfpzzjyycrz@gp5axpziekwh> X-CM-TRANSID: AQAAf8AxHs8B9Phl+QVdAA--.47988S3 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQABCGX3+2cEaQABsq 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: Mon, 18 Mar 2024 19:10:14 -0700 Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Xn1qbPJFkcOwai7Rpuogyunhx7686176AA= Content-Type: multipart/alternative; boundary="------------VfxGDaPPtZmoGEfLi0bvvZRT" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=qFtLS5tq; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --------------VfxGDaPPtZmoGEfLi0bvvZRT Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Gerd, Thanks, Chao On 2024/3/18 23:28, Gerd Hoffmann wrote: > On Sat, Mar 16, 2024 at 10:17:00AM +0800, lixianglai wrote: >> Hi Gerd: >>> On Mon, Mar 11, 2024 at 02:39:31AM -0700, Chao Li wrote: >>>> This library for PEI phase, and obtains the QemuFwCfg base address by >>>> directly parsing the FDT, reads and writes the data in QemuFwCfg by >>>> operating on the QemuFwCfg base address. >>>> create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c >>>> create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf >>>> create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h >>>> create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c >>> Is there anything LoongArch-specific in there? >> No,The main function of this lib library is to obtain the fwcfg base address by parsing fdt in the pei stage, >>  and provide access to fwcfg through mmio mode, >>  the difference between it and the existing library is that the fwcfg base address is not hard-coded in the compilation stage, >>  and is accessed through mmio rather than io port. > That would be the case for risc-v and aarch64 too, although I think they > don't need fw_cfg right now (they get all info needed via fdt). > > I think we should add this as OvmfPkg/Library/FdtQemuFwCfgLib. Ok, I will commit this change under OvmfPkg/Library next time. Same to patch 20, I will try to adjust and verify in risc-v and aarch64 after merging this change. > >> Another point that needs to be explained is that because loongarch virtual machine runs on flash in pei phase, >> it cannot assign the pcd global variable, so we use Hob as the global variable to store the fwcfg base address. > I think the dynamic PCD database is stored in a HOB and you should be > able to set PCDs them even when running from (read-only) flash. Let's me try. > > take care, > Gerd > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116876): https://edk2.groups.io/g/devel/message/116876 Mute This Topic: https://groups.io/mt/104859897/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- --------------VfxGDaPPtZmoGEfLi0bvvZRT Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Gerd,


Thanks,
Chao
On 2024/3/18 23:28, Gerd Hoffmann wrote:
On Sat, Mar 16, 2024 at 10:17:00AM +0800, lixianglai wrote:
Hi Gerd:
On Mon, Mar 11, 2024 at 02:39:31AM -0700, Chao Li wrote:
This library for PEI phase, and obtains the QemuFwCfg base address by
directly parsing the FDT, reads and writes the data in QemuFwCfg by
operating on the QemuFwCfg base address.
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.c
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/FdtQemuFwCfgPeiLib.inf
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgLibInternal.h
 create mode 100644 OvmfPkg/LoongArchVirt/Library/FdtQemuFwCfgLib/QemuFwCfgPei.c
Is there anything LoongArch-specific in there?
No,The main function of this lib library is to obtain the fwcfg base address by parsing fdt in the pei stage,
 and provide access to fwcfg through mmio mode,
 the difference between it and the existing library is that the fwcfg base address is not hard-coded in the compilation stage,
 and is accessed through mmio rather than io port.
That would be the case for risc-v and aarch64 too, although I think they
don't need fw_cfg right now (they get all info needed via fdt).

I think we should add this as OvmfPkg/Library/FdtQemuFwCfgLib.
Ok, I will commit this change under OvmfPkg/Library next time. Same to patch 20, I will try to adjust and verify in risc-v and aarch64 after merging this change.

Another point that needs to be explained is that because loongarch virtual machine runs on flash in pei phase,
it cannot assign the pcd global variable, so we use Hob as the global variable to store the fwcfg base address.
I think the dynamic PCD database is stored in a HOB and you should be
able to set PCDs them even when running from (read-only) flash.
Let's me try.

take care,
  Gerd





_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#116876) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--------------VfxGDaPPtZmoGEfLi0bvvZRT--