From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org 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 8E7022034D837 for ; Wed, 15 Nov 2017 05:47:36 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DC354900E; Wed, 15 Nov 2017 13:51:45 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-122-47.rdu2.redhat.com [10.10.122.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12E5288E18; Wed, 15 Nov 2017 13:51:43 +0000 (UTC) To: Ard Biesheuvel , edk2-devel@lists.01.org References: <20171114102205.30649-1-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: Date: Wed, 15 Nov 2017 14:51:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171114102205.30649-1-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 15 Nov 2017 13:51:45 +0000 (UTC) Subject: Re: [PATCH] ArmVirtPkg/ArmVirtQemu: use non-accelerated CopyMem for VariableRuntimeDxe X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Nov 2017 13:47:37 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/14/17 11:22, Ard Biesheuvel wrote: > The VariableRuntimeDxe driver may use CopyMem () on NOR flash regions, > assuming such regions always have full memory semantics. Given that > those regions cannot be mapped as ordinary memory on ARM (due to the > fact that the NOR flash requires device semantics while in write mode) > this prevents us from using BaseMemoryLibOptDxe in VariableRuntimeDxe, > since it may use unaligned accesses and/or DC ZVA instructions, both > of which are incompatible with mappings using device semantics. > > Note that there is no way we can work around this by changing the > mapping type between 'memory' and 'device' when switching from read to > write mode and back, because the runtime mapping is created by the OS, > and cannot be changed at will. > > So let's just switch to the unaccelerated version of BaseMemoryLib which > does not have the same problem. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > ArmVirtPkg/ArmVirtQemu.dsc | 2 ++ > ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc > index 8a60b61f2aa6..7b220d6e3c31 100644 > --- a/ArmVirtPkg/ArmVirtQemu.dsc > +++ b/ArmVirtPkg/ArmVirtQemu.dsc > @@ -261,6 +261,8 @@ [Components.common] > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { > > NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf > + # don't use unaligned CopyMem () on the UEFI varstore NOR flash region > + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf > } > !if $(SECURE_BOOT_ENABLE) == TRUE > MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { > diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc > index 9a31ec93ca06..7c032e1b07e0 100644 > --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc > +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc > @@ -252,6 +252,8 @@ [Components.common] > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { > > NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf > + # don't use unaligned CopyMem () on the UEFI varstore NOR flash region > + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf > } > !if $(SECURE_BOOT_ENABLE) == TRUE > MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { > Reviewed-by: Laszlo Ersek Given that we've never seen the symptom reported by Shannon, I must think Shannon is using some kind of new hardware. May I ask what hardware that is? Thanks, Laszlo