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 DBB2CAC1082 for ; Tue, 5 Mar 2024 12:12:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=g4fBuJ6YOdBjP5IgBzlMYfDE/UAmuVsfPddydJ7aVpA=; 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:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1709640766; v=1; b=UUN1wFtzvf+663ibOrMvzq69qLcQSo9BR6SaeFZr0lHg/M3sb+ozH8+2SZA3YGEiitflLp2B mPUENNmO8H+9OS6bHKQST78CPPvgSDqmVjegx+M/ev4wl3FphPg7S09By7hY5KQfAQkPFfstrvX zczWSQQ/uQpohaSae/HfOBE4= X-Received: by 127.0.0.2 with SMTP id xZB2YY7687511xmIcG4ksh6d; Tue, 05 Mar 2024 04:12:46 -0800 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.21483.1709640764516568230 for ; Tue, 05 Mar 2024 04:12:45 -0800 X-Received: from loongson.cn (unknown [10.40.24.149]) by gateway (Coremail) with SMTP id _____8Bxnus3DOdl9sMUAA--.51279S3; Tue, 05 Mar 2024 20:12:39 +0800 (CST) X-Received: from [10.40.24.149] (unknown [10.40.24.149]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxDc81DOdlqI1OAA--.12196S3; Tue, 05 Mar 2024 20:12:37 +0800 (CST) Message-ID: <9f8ebffb-e724-404a-8aa5-73f5942b5e79@loongson.cn> Date: Tue, 5 Mar 2024 20:12:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v8 14/37] UefiCpuPkg: Add CpuMmuLib to UefiCpuPkg To: devel@edk2.groups.io, lersek@redhat.com, "Ni, Ray" Cc: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann , Baoqi Zhang , Dongyan Qian , Xianglai Li , Bibo Mao References: <20240126062715.3099433-1-lichao@loongson.cn> <20240126062919.3101691-1-lichao@loongson.cn> <856ebd67-d345-6e41-2e34-74b9bdd7ed7e@redhat.com> <2187d8cd-3578-4f3f-a158-2961571f851b@loongson.cn> <8e97514d-cd2f-881a-f1e4-ed1bdbd03320@redhat.com> <0dd107d1-4e12-45d7-ac27-a755272c55c2@loongson.cn> <5a32d905-fe40-9db0-de3f-3e90919e0bc3@redhat.com> <2410a5de-b801-4639-a662-49f0b4006990@loongson.cn> From: "Chao Li" In-Reply-To: X-CM-TRANSID: AQAAf8DxDc81DOdlqI1OAA--.12196S3 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQAHCGXm1+YCqQAJse X-Coremail-Antispam: 1Uk129KBj93XoWxur17Kw1kAryxCr4xXw4DWrX_yoW5WrW7pF 9xGF98Cr1vqa4FyrZ2yw45X3WF9rs2kFy5Jwn0kr92kwn0k3WI9FW8KrnrGFy7urnxJ3Wj qw4Ygw4UAFZ0g3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnRJUUUkCb4IE77IF4wAF F20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r 106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAF wI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv67 AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS0I0E0xvYzxvE52x0 82IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMcIj6xIIjxv20xvE14v26r1j6r18Mc Ij6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41l7480 Y4vEI4kI2Ix0rVAqx4xJMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMx CIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_JrI_JrWlx2IqxVCjr7xvwVAFwI0_ JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJV W8JbIYCTnIWIevJa73UjIFyTuYvjxUz4SrUUUUU 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 Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: uL69JcYQkHnhbqcMGLuHpqB9x7686176AA= Content-Type: multipart/alternative; boundary="------------qb7IGQy8va8oWaxmq9kemTSF" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=UUN1wFtz; 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 --------------qb7IGQy8va8oWaxmq9kemTSF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable OK, I'll give it a try. Thanks, Chao On 2024/3/5 20:09, Laszlo Ersek wrote: > On 3/5/24 12:50, Chao Li wrote: >> Hi Laszlo, >> >> OK, I see, let's me try. And I have another question: >> >> Where should the low-level library be placed? Under the >> UefiCpuPkg/Library and as the same folder as CpuMmuLib? > In my opinion: > > Under UefiCpuPkg/Library -- yes. > > In the same folder as CpuMmuLib -- no. Instances of different library > classes are never placed in the same folder. > > Laszlo > >> >> Thanks, >> Chao >> On 2024/3/5 17:26, Laszlo Ersek wrote: >>> Hello Chao, >>> >>> On 3/4/24 04:39, Chao Li wrote: >>>> Hi Laszlo, >>>> >>>> OK. >>>> >>>> When I discussed the CpuMmuLib API as a public API with Ray in the ear= ly >>>> days, the API recommended by Ray should be the patch 13 in this series= , >>>> which only contains set/get memory region attribute, but in the first >>>> version in this series, it contains more API, one is ConfigureMmu API, >>>> which is included in ARM and RISCV versions. This API provides a >>>> interface called in PEI or DXE stage, it will configures the MMU and >>>> enables it, such as creating the page tables, filling the static page >>>> tables, cofniguring the MMU registers, enbale MMU, etc. >>>> >>>> The paths for ARM and RISCV version APIs: >>>> >>>> ARM: ArmPkg/Include/Library/ArmMmuLib.h >>>> >>>> RISCV: UefiCpuPkg/Include/Library/BaseRiscVMmuLib.h >>> I have now re-read this subthread in its entirey, and I think I >>> understand what's up. >>> >>> What confused me recently was your expression "so should we open >>> configure API?" >>> >>> I think what you meant by "opening" was "publicly declaring". >>> >>> Anyway, here's my recommendation (consistently with what I said earlier >>> in this thread): >>> >>> - I think you need a new (lower-level) library class and instance for >>> exposing ConfigureMemoryManagementUnit(). >>> >>> Please see: (msgid >>> <2a91f2f0-df4c-e106-65cd-79be167224f2@redhat.com>). >>> >>> - I do not recommend trying to unify the new LoongArch library classes >>> (low level and high level) with "ArmMmuLib.h" or "BaseRiscVMmuLib.h". >>> >>> Each of "ArmMmuLib.h" and "BaseRiscVMmuLib.h" seems to declare both >>> low-level and high-level interfaces. For LoongArch, we apparently don't >>> want that; hence the idea to introduce two library classes for LoongArc= h >>> -- that may be considered an improved design. >>> >>> At the same time, I don't believe that this requires us to unify >>> "ArmMmuLib.h" and "BaseRiscVMmuLib.h" with the new, LoongArch-motivated >>> library class design. >>> >>> Laszlo > > >=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 (#116384): https://edk2.groups.io/g/devel/message/116384 Mute This Topic: https://groups.io/mt/103971653/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- --------------qb7IGQy8va8oWaxmq9kemTSF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

OK, I'll give it a try.


=
Thanks,
Chao
On 2024/3/5 20:09, Laszlo Ersek wrote:
On 3/5/24 12:50, Chao Li wrote=
:
Hi Laszlo,

OK, I see, let's me try. And I have another question:

Where should the low-level library be placed? Under the
UefiCpuPkg/Library and as the same folder as CpuMmuLib?
In my opinion:

Under UefiCpuPkg/Library -- yes.

In the same folder as CpuMmuLib -- no. Instances of different library
classes are never placed in the same folder.

Laszlo


Thanks,
Chao
On 2024/3/5 17:26, Laszlo Ersek wrote:
Hello Chao,

On 3/4/24 04:39, Chao Li wrote:
Hi Laszlo,

OK.

When I discussed the CpuMmuLib API as a public API with Ray in the early
days, the API recommended by Ray should be the patch 13 in this series,
which only contains set/get memory region attribute, but in the first
version in this series, it contains more API, one is ConfigureMmu API,
which is included in ARM and RISCV versions. This API provides a
interface called in PEI or DXE stage, it will configures the MMU and
enables it, such as creating the page tables, filling the static page
tables, cofniguring the MMU registers, enbale MMU, etc.

The paths for ARM and RISCV version APIs:

ARM: ArmPkg/Include/Library/ArmMmuLib.h

RISCV: UefiCpuPkg/Include/Library/BaseRiscVMmuLib.h
I have now re-read this su=
bthread in its entirey, and I think I
understand what's up.

What confused me recently was your expression "so should we open
configure API?"

I think what you meant by "opening" was "publicly declaring".

Anyway, here's my recommendation (consistently with what I said earlier
in this thread):

- I think you need a new (lower-level) library class and instance for
exposing ConfigureMemoryManagementUnit().

Please see: <https://edk2.groups.io/g/devel/message/11497=
2> (msgid
<2a91f2f0-df4c-e106-65cd-79be167224f2@redhat.com=
>).

- I do not recommend trying to unify the new LoongArch library classes
(low level and high level) with "ArmMmuLib.h" or "BaseRiscVMmuLib.h".

Each of "ArmMmuLib.h" and "BaseRiscVMmuLib.h" seems to declare both
low-level and high-level interfaces. For LoongArch, we apparently don't
want that; hence the idea to introduce two library classes for LoongArch
-- that may be considered an improved design.

At the same time, I don't believe that this requires us to unify
"ArmMmuLib.h" and "BaseRiscVMmuLib.h" with the new, LoongArch-motivated
library class design.

Laszlo




_._,_._,_

Groups.io Links:

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

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

_._,_._,_
--------------qb7IGQy8va8oWaxmq9kemTSF--