From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.11104.1589459334878599984 for ; Thu, 14 May 2020 05:29:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b08zwveK; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589459334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o6UsEQzSQn+DlufUTIaJvjCaZEFizZylXG/mDi8ngwg=; b=b08zwveKhhHUQzGPu8AdTIk+cEvzGU+0EuXMzXQs3pBD1IL2x730PIl81Z1hwaC7Qk9v8u IYH7lu4j0gIPRRl9gfDOsneTtKmJ6ekAJ8hI9Wh0ACHjbmab4GLC/5T9cdTxZ7hiCwnRTr Lc9K2qZblUM5I0DMZrszw7NkplAmjZI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-Ic5QNCUFNEyxZidZePY3uQ-1; Thu, 14 May 2020 08:28:50 -0400 X-MC-Unique: Ic5QNCUFNEyxZidZePY3uQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91F4B100CCC4; Thu, 14 May 2020 12:28:48 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7870D6FDB2; Thu, 14 May 2020 12:28:46 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v1 10/11] ArmVirtPkg: Link NorFlashDxe with BaseMemoryLibMmio To: devel@edk2.groups.io, sami.mujawar@arm.com Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, Alexandru.Elisei@arm.com, Andre.Przywara@arm.com, Matteo.Carlini@arm.com, Laura.Moretta@arm.com, nd@arm.com References: <20200514084019.71368-1-sami.mujawar@arm.com> <20200514084019.71368-11-sami.mujawar@arm.com> From: "Laszlo Ersek" Message-ID: Date: Thu, 14 May 2020 14:28:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200514084019.71368-11-sami.mujawar@arm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 05/14/20 10:40, Sami Mujawar wrote: > NorFlashDxe must use aligned MMIO accesses to > read data from flash as this is device memory. > > The AlignedCopyMem() in NorFlashDxe was used to > copy the flash data which prevented unaligned > access to device memory. However, the compiler > could optimize the code to generate pre/post > indexed or LDP operations. This is a problem > for guest/virtual firmware as the hypervisor > code cannot get the syndrome information for > the trapped accesses. > > To address the such issues, BaseMemoryLibMmio > library has been introduced to perform aligned > MMIO accesses. > > The NorFlashDxe has been updated to use > CopyMem() instead of using AlignedCopyMem() > and therefore the NorFlashDxe must be linked > with BaseMemoryLibMmio. > > This patch updates the workspace files to link > NorFlashDxe with BaseMemoryLibMmio for the > following platforms: > - Arm Qemu > - Arm Qemu Kernel > > Signed-off-by: Sami Mujawar > --- > ArmVirtPkg/ArmVirtQemu.dsc | 8 ++++++-- > ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++-- > 2 files changed, 12 insertions(+), 4 deletions(-) Based on Ard's comment under "MdePkg: Base Memory Lib instance using MMIO" ("I don't think we need this library"), this patch would be unnecessary too. (This applies to the "BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf" resolutions in the previous patch as well, apparently.) Thanks Laszlo > > diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc > index 3f649c91d8d6a2e3f3e62f35aa40906e048a15c4..82b7d54c2031fed60dccff38353d3ec19cfdefd0 100644 > --- a/ArmVirtPkg/ArmVirtQemu.dsc > +++ b/ArmVirtPkg/ArmVirtQemu.dsc > @@ -1,5 +1,5 @@ > # > -# Copyright (c) 2011-2015, ARM Limited. All rights reserved. > +# Copyright (c) 2011-2020, ARM Limited. All rights reserved. > # Copyright (c) 2014, Linaro Limited. All rights reserved. > # Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. > # > @@ -384,7 +384,11 @@ [Components.common] > > NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf > } > - ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf > + ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf { > + > + BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf > + } > + > MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf > > # > diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc > index 2a6fd6bc06be1cc20d8c6f2bf00d88d593061edf..6cceb61e493c8c84f6564b120b0864ff817c3f31 100644 > --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc > +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc > @@ -1,5 +1,5 @@ > # > -# Copyright (c) 2011-2015, ARM Limited. All rights reserved. > +# Copyright (c) 2011-2020, ARM Limited. All rights reserved. > # Copyright (c) 2014, Linaro Limited. All rights reserved. > # Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. > # > @@ -323,7 +323,11 @@ [Components.common] > > NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf > } > - ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf > + ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf { > + > + BaseMemoryLib|MdePkg/Library/BaseMemoryLibMmio/BaseMemoryLibMmio.inf > + } > + > MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf > > # >