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 4987574003D for ; Mon, 18 Mar 2024 15:21:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FBzFFWfoH8S4tucGUog6SUHiZT2ulsACyY6WRNzlu2E=; c=relaxed/simple; d=groups.io; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: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:Content-Disposition; s=20240206; t=1710775304; v=1; b=wBfoX9TUa+uCeg/xAcXKz1sZWX2e9783ibWU/SkfXqmkKXJa7NIFdPdOvNSX5f0mIxuiY81I VfT1gCbAy3ioaGgsHsl3GP56lJupSrWBoMkpkQ3Un1IUfUrU5643FjeOxQRAJcvUrxmHN+Aig5b w0jODEHiMvbZFsRXif34jpXGhGwbCRrAxA6D7XmogrrIvySr5WcK8eeZjAwwz8IaNWA36bCeGyH mz5t5SuL+wW7eMkhbeaZKVdKore9qViQfUUM4snVcMF8jRJUKaYdI7AJ3lpuU++LOQPveT24zkr M5KUVhAMla8g3HHIIWdHxEivbDsyjKKDukR50vnxBBN8g== X-Received: by 127.0.0.2 with SMTP id O7CRYY7687511xYxUaJxHFPq; Mon, 18 Mar 2024 08:21:44 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.47527.1710775303976759469 for ; Mon, 18 Mar 2024 08:21:44 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-acyy3eQPNpufa9LTXz5Juw-1; Mon, 18 Mar 2024 11:21:39 -0400 X-MC-Unique: acyy3eQPNpufa9LTXz5Juw-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 114501C00D03; Mon, 18 Mar 2024 15:21:39 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.254]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7065C492BD0; Mon, 18 Mar 2024 15:21:38 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 65B201800D54; Mon, 18 Mar 2024 16:21:33 +0100 (CET) Date: Mon, 18 Mar 2024 16:21:33 +0100 From: "Gerd Hoffmann" To: lixianglai Cc: devel@edk2.groups.io, lichao@loongson.cn, Ard Biesheuvel , Jiewen Yao , Jordan Justen , Bibo Mao , Dongyan Qian Subject: Re: [edk2-devel] [PATCH v1 20/26] OvmfPkg/LoongArchVirt: Add NorFlashQemuLib Message-ID: References: <20240311093631.1251466-1-lichao@loongson.cn> <20240311093919.1254515-1-lichao@loongson.cn> <7nqe7k3oi3cph7mhqc4t5ea7qair3u2i7dy6oli6wurovyaoqa@apkw6d7gneam> <51c896fa-60bb-127f-c346-dc69179d288f@loongson.cn> MIME-Version: 1.0 In-Reply-To: <51c896fa-60bb-127f-c346-dc69179d288f@loongson.cn> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 08:21:44 -0700 Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: WcveXxDF8Xf386zUhib09MBKx7686176AA= Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=wBfoX9TU; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=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 On Sat, Mar 16, 2024 at 06:19:00PM +0800, lixianglai wrote: > Hi Gerd: > > On Mon, Mar 11, 2024 at 02:39:24AM -0700, Chao Li wrote: > >> Add NorFlashQemuLib for LoongArch, it is referenced from ArmVirtPkg. > > What are the differences to the ArmVirtPkg version? > In this lib we have assigned the following three pcd variables: > PcdFlashNvStorageVariableBase > PcdFlashNvStorageFtwWorkingBase > PcdFlashNvStorageFtwSpareBase > Instead of hardcoding these three variables in the VarStore.fdf.inc file as arm does, > the benefit is that when the flash base address changes in the qemu implementation, > there is no need to re-adapt and compile UEFI. The flash memory layout (address + size) for the aarch64 virt machine has never changed. So while it sounds nice in theory to have that option it could very well be that this will never ever needed in practice. Having sayed that I'd also note that I think it should also be possible to switch the aarch64 builds to set the PCDs at runtime instead of compile time. > When I tried to implement the current patch scheme on aarch64, > I found that the FaultTolerantWriteDxe driver loaded earlier than VirtNorFlashDxe. > And It requires the PcdFlashNvStorageFtwWorkingSize and PcdFlashNvStorageFtwSpareSize variables for initialization, > However the initialization of these two variables is completed in VirtNorFlashDxe, > The fdf file specifies that VirtNorFlashDxe is loaded first and then FaultTolerantWriteDxe is loaded in loongarch64. > So this is going to be a problem if we want to apply the current solution to aarch64 or risc-v. There is a non-obvious twist: VirtNorFlashDxe registers the gEdkiiNvVarStoreFormattedGuid protocol. There is the EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf library, which only purpose is to add a dependency to gEdkiiNvVarStoreFormattedGuid to depex. NvVarStoreFormattedLib.inf is used this way ... MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { A [ ... ] NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf [ ... ] } ... to make sure VariableRuntimeDxe is scheduled after VirtNorFlashDxe. I think you can apply the same idea to FaultTolerantWriteDxe. > I can't tell the implementation scheme of the current lib and existing > lib implementation scheme which one is better, Could you give we some > advice? I'd suggest to merge your code as OvmfPkg/Library/FdtNorFlashQemuLib as it is not really loongarch-specific. If you want try switch aarch64 to use the same code that'll be great, but sorting that out later is also fine with me. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116842): https://edk2.groups.io/g/devel/message/116842 Mute This Topic: https://groups.io/mt/104859896/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-