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 1973F941758 for ; Fri, 15 Mar 2024 10:21:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FH9Y4AaKKLI4PiHzqr092VMj5YjPgPmgaWv/gMsMnRg=; 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=1710498068; v=1; b=Qeu7wlLczH/ji6kpb+lvHp07GM7bopo5ryR0e395ZHqw0gxW/9g6Mm/UXnm1SdtCu95GRpXk NxP+w6EUQbSwaIPuNgFMY5jO9D2TefEIxZhnq0JNOZ4D4R71Aw5jhly7MX75Q5zZ+L9P/JcOfD3 R4lz5+fsDBeDmK5RGN7mZXHKZEThjcp1e5W2qLfkWnkInLDJoSK+SUNnUSKfRKhM7I5GlKSymLN yOnaeziQsoMDIhSOTBvMj64gRmD3fXVsINsQ4VgakY8Po3CQGe0MS/aNzU4UBbhB/UTbYcrUrY9 8CN8GaJsQ/JBxO+UPptdDxaFngstr//wSS7mNXLOmzGUA== X-Received: by 127.0.0.2 with SMTP id p0FYYY7687511xgu4pnl3Nu8; Fri, 15 Mar 2024 03:21:08 -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.web11.18431.1710498067645112876 for ; Fri, 15 Mar 2024 03:21:07 -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-467-CLvjwpgLN_eb8WSs-ZeFHw-1; Fri, 15 Mar 2024 06:21:03 -0400 X-MC-Unique: CLvjwpgLN_eb8WSs-ZeFHw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 38D631C54476; Fri, 15 Mar 2024 10:21:03 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F26FF2166AE5; Fri, 15 Mar 2024 10:21:02 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B86F41800DD4; Fri, 15 Mar 2024 11:21:01 +0100 (CET) Date: Fri, 15 Mar 2024 11:21:01 +0100 From: "Gerd Hoffmann" To: Chao Li Cc: devel@edk2.groups.io, Ray Ni , Rahul Kumar Subject: Re: [edk2-devel] [PATCH v1 09/26] UefiCpuPkg: Added a new PCD named PcdCpuMmuIsEnabled Message-ID: <7mz2gwc7dkto4zupsg2t5rqduqnbadt6fmhspidwlvtgtwk6js@5dnvjo7tmf6b> References: <20240311093631.1251466-1-lichao@loongson.cn> <20240311093817.1253752-1-lichao@loongson.cn> <3876d014-48b4-44d3-bf77-f41dc5d11b72@loongson.cn> MIME-Version: 1.0 In-Reply-To: <3876d014-48b4-44d3-bf77-f41dc5d11b72@loongson.cn> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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: Fri, 15 Mar 2024 03:21:07 -0700 Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: e8utKSxhOXa54iZtdVHZ3yW4x7686176AA= 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=Qeu7wlLc; 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 Hi, > > > + ## This dynamic PCD indicates whether CPU MMU is enabled. > > > + # TRUE - CPU MMU is enabled. > > > + # FASLE - CPU MMU have not enabled. > > > + gUefiCpuPkgTokenSpaceGuid.PcdCpuMmuIsEnabled|FALSE|BOOLEAN|0x60000023 > > Why create a PCD for this? Can't you simply read the control register > > to figure whenever paging is enabled or not? > This is a good question. When I designed the API of > SetMemoryRegionAttributes, it only contained 4 parameters, namely Start, > Size, Attribut and Mask(refer to ARM version), and the MmuInitLib needs call > this API to configure or initialize the MMU. SetMemoryRegionAttributes will > call a private function called UpdateRegionMapping, it needs to know if the > MMU is started to do different logic(such as wether should be invalidated > TLB when filling the tables for the first time, etc), therefore, there > create a new PCD to let it know this. BTW, ARM and RISC-V have the same > logic. Yes, UpdateRegionMapping needs to know this, no doubt. But do we need a PCD for this? Looks like a pointless indirection to me. Arm has a ArmMmuEnabled() functions which goes read the control registers directly. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116801): https://edk2.groups.io/g/devel/message/116801 Mute This Topic: https://groups.io/mt/104859880/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-