From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0BA8A1A1F52 for ; Thu, 8 Sep 2016 00:54:30 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8639AC04D29C; Thu, 8 Sep 2016 07:54:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-57.phx2.redhat.com [10.3.116.57]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u887sSZE016221; Thu, 8 Sep 2016 03:54:28 -0400 To: Ard Biesheuvel , edk2-devel@ml01.01.org, leif.lindholm@linaro.org References: <1473321027-31091-1-git-send-email-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: <5c99e1a8-f667-aaab-7214-df94816abd8e@redhat.com> Date: Thu, 8 Sep 2016 09:54:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1473321027-31091-1-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 08 Sep 2016 07:54:29 +0000 (UTC) Subject: Re: [PATCH] ArmVirtPkg: restrict mapping attributes of normal memory to EFI_MEMORY_WB X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2016 07:54:30 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 09/08/16 09:50, Ard Biesheuvel wrote: > In general, on an ARM system, mapping normal memory as device memory may > have unintended side effects, given that unaligned accesses or loads and > stores with special semantics (e.g., load/store exclusive) may fault or > may not work as expected. > > Under KVM, the situation is even worse, since the host may not expect the > guest to perform uncached accesses, and so writes to such an uncached > region may get lost completely. > > Since the only safe mapping type under KVM is EFI_MEMORY_WB, remove all > other memory type attributes. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > ArmVirtPkg/HighMemDxe/HighMemDxe.c | 3 +-- > ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 3 --- > 2 files changed, 1 insertion(+), 5 deletions(-) > > diff --git a/ArmVirtPkg/HighMemDxe/HighMemDxe.c b/ArmVirtPkg/HighMemDxe/HighMemDxe.c > index 7fd7e8e9a539..4d56e6236b54 100644 > --- a/ArmVirtPkg/HighMemDxe/HighMemDxe.c > +++ b/ArmVirtPkg/HighMemDxe/HighMemDxe.c > @@ -78,8 +78,7 @@ InitializeHighMemDxe ( > Status = gDS->AddMemorySpace ( > EfiGcdMemoryTypeSystemMemory, > CurBase, CurSize, > - EFI_MEMORY_WB | EFI_MEMORY_WC | > - EFI_MEMORY_WT | EFI_MEMORY_UC); > + EFI_MEMORY_WB); > > if (EFI_ERROR (Status)) { > DEBUG ((EFI_D_ERROR, > diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c > index 251e5314e61d..6f3e54b7afcb 100644 > --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c > +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c > @@ -68,9 +68,6 @@ MemoryPeim ( > ResourceAttributes = ( > EFI_RESOURCE_ATTRIBUTE_PRESENT | > EFI_RESOURCE_ATTRIBUTE_INITIALIZED | > - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | > - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | > - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | > EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | > EFI_RESOURCE_ATTRIBUTE_TESTED > ); > Reviewed-by: Laszlo Ersek Did you encounter any specific problem with these? Thanks Laszlo