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 C04E5AC18A5 for ; Mon, 17 Jul 2023 16:59:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ajc6dAbmvBBBxXB35KMRTp739+thZE74tdBmNvNYbVc=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:Content-Transfer-Encoding; s=20140610; t=1689613183; v=1; b=dkOZw6dLQblemFBp/9EetjlxtNWEqeqHJt+sqjQAhirnGGUu+yWdcFQmuVplnbnIoAxUF0cO smo/HFuXei88z6RIANL0PQxLI4geqWtn5tmYWXua/2714CaKPsXh0h61FHbOOpe5j2j6SNK83Ku dq3QtThxb9L4MAUv8Uw9+rzE= X-Received: by 127.0.0.2 with SMTP id oZBdYY7687511xLZVFUxiZHu; Mon, 17 Jul 2023 09:59:43 -0700 X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx.groups.io with SMTP id smtpd.web11.187.1689613182485682535 for ; Mon, 17 Jul 2023 09:59:42 -0700 X-Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6686ef86110so3108679b3a.2 for ; Mon, 17 Jul 2023 09:59:42 -0700 (PDT) X-Gm-Message-State: phkHy0smS6CrmNkY6Kcz1YS5x7686176AA= X-Google-Smtp-Source: APBJJlGbp+2CQbP806H2ubo/EyWFEETJRqzGr0Yn3a3/GhdHpxHSOOF4/nhNRML1EfVWgpF5mv4moQ== X-Received: by 2002:a05:6a00:1694:b0:67a:c810:3cb0 with SMTP id k20-20020a056a00169400b0067ac8103cb0mr15645105pfc.3.1689613181791; Mon, 17 Jul 2023 09:59:41 -0700 (PDT) X-Received: from sunil-pc.Dlink ([106.51.190.25]) by smtp.gmail.com with ESMTPSA id r23-20020a62e417000000b00666912d8a52sm36042pfh.197.2023.07.17.09.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 09:59:41 -0700 (PDT) From: "Sunil V L" To: devel@edk2.groups.io Cc: Sunil V L , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Andrei Warkentin Subject: [edk2-devel] [PATCH 1/1] OvmfPkg/RiscVVirt: Check "no-map" and mark EfiReservedMemoryType Date: Mon, 17 Jul 2023 22:29:35 +0530 Message-Id: <20230717165935.3958769-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,sunilvl@ventanamicro.com Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=dkOZw6dL; 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 OpenSBI now marks PMP regions with "no-map" attribute. So, remove the workaround and add the ReservedMemory only when no-map is set so that it follows DT spec. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Andrei Warkentin Signed-off-by: Sunil V L --- OvmfPkg/RiscVVirt/Sec/Memory.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/OvmfPkg/RiscVVirt/Sec/Memory.c b/OvmfPkg/RiscVVirt/Sec/Memory.c index aad71ee5dcbb..164b33cd258f 100644 --- a/OvmfPkg/RiscVVirt/Sec/Memory.c +++ b/OvmfPkg/RiscVVirt/Sec/Memory.c @@ -141,22 +141,6 @@ GetNumCells ( /** Mark reserved memory ranges in the EFI memory map - The M-mode firmware ranges should not be used by the - EDK2/OS. These ranges are passed via device tree using reserved - memory nodes. Parse the DT and mark those ranges as of - type EfiReservedMemoryType. - - NOTE: Device Tree spec section 3.5.4 says reserved memory regions - without no-map property should be installed as EfiBootServicesData. - As per UEFI spec, memory of type EfiBootServicesData can be used - by the OS after ExitBootServices(). - This is not an issue for DT since OS can parse the DT also along - with EFI memory map and avoid using these ranges. But with ACPI, - there is no such mechanisms possible. - Since EDK2 needs to support both DT and ACPI, we are deviating - from the DT spec and marking all reserved memory ranges as - EfiReservedMemoryType itself irrespective of no-map. - @param FdtPointer Pointer to FDT **/ @@ -228,11 +212,19 @@ AddReservedMemoryMap ( Size )); - BuildMemoryAllocationHob ( - Addr, - Size, - EfiReservedMemoryType - ); + if (fdt_getprop (FdtPointer, SubNode, "no-map", &Len)) { + BuildMemoryAllocationHob ( + Addr, + Size, + EfiReservedMemoryType + ); + } else { + BuildMemoryAllocationHob ( + Addr, + Size, + EfiBootServicesData + ); + } } } } -- 2.39.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106969): https://edk2.groups.io/g/devel/message/106969 Mute This Topic: https://groups.io/mt/100198972/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-