From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2F90D2034D833 for ; Tue, 7 Nov 2017 05:25:15 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id z3so3857633wme.5 for ; Tue, 07 Nov 2017 05:29:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5FLM9oEtD58JmGnWyGYcSa/+e7Hwi+0VqXqoMZKbx/Q=; b=j2q/K86FCC6DuqiKBDPZzpmuq3QoGNLS7qidQfWUYfwtGcCN2eg8z9aBs71Ea5cXEn DkGw0K3Znhzjvx02xYpnI4P7US+DE3tCWI67WFhSAm5nQru9XrhJOUv6fWOs3xza0jdF jAxXK6j4dIyosrIOHlaf4Wkabyixd728Pa8fQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5FLM9oEtD58JmGnWyGYcSa/+e7Hwi+0VqXqoMZKbx/Q=; b=MwdWm8g+4gT+BvZIDlZucxqZtmm8a4mILuanpvfLhe3oKXWUDX2L+hzZ7gtuV+IM1Y X8T/DjRneLanaOki7TS7jG6oijOI3q7MEM6emgAaYqtHR+ZAIaazKUN5TazaUlpAFil0 xmrVbZ+h6s1M5qI6ZXPsGfESWFgmr/O21s50IVosjE+Bg2iQIOBgVHdbNOnxXiudrcMI mROcZk6FwCWLq33XjufnR6a4s5h48oKn7u+aG9rGgc2SjjWjvPFAgAVPWxGCS6EIRiao V9aZp9FwJr08N6GLCkyQ/B9sh7iL8R7MwS7bgPaYaMbAja77N9fpj74MdEXzto4iykt4 PxFA== X-Gm-Message-State: AJaThX5pxTuDqezdDli4EETXPPMlFoMhCFTBmMFkIM9veHQeKrKPaEwh NIk8FWYEvrpBGZeNVxyvO7hz8w== X-Google-Smtp-Source: ABhQp+QQuAGSKPTlaGHmRTalsE+XW0R7NAao5ZrR92pOUMoY/LrlBKaBMDeSPi8IzTKZTU1Fuy3e3A== X-Received: by 10.28.7.82 with SMTP id 79mr1394523wmh.4.1510061353860; Tue, 07 Nov 2017 05:29:13 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id y145sm1375391wmd.40.2017.11.07.05.29.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Nov 2017 05:29:12 -0800 (PST) Date: Tue, 7 Nov 2017 13:29:11 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: Heyi Guo , linaro-uefi , "edk2-devel@lists.01.org" , Peicong Li Message-ID: <20171107132911.al3ovu6wjah6sjfm@bivouac.eciton.net> References: <1510059411-6608-1-git-send-email-heyi.guo@linaro.org> <1510059411-6608-2-git-send-email-heyi.guo@linaro.org> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH] ArmPkg/ArmMmuLib: Add new attribute WRITE_BACK_NONSHAREABLE 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: Tue, 07 Nov 2017 13:25:16 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Nov 07, 2017 at 01:22:19PM +0000, Ard Biesheuvel wrote: > On 7 November 2017 at 12:56, Heyi Guo wrote: > > From: Peicong Li > > > > Flash region needs to be set as cacheable (write back) to increase > > performance, if PEI is still XIP on flash or DXE FV is decompressed > > from flash FV. However some ARM platforms do not support to set flash > > as inner shareable since flash is not normal DDR memory and it will > > not respond to cache snoop request, which will causes system hang > > after MMU is enabled. > > > > So we need a new ARM memory region attribute WRITE_BACK_NONSHAREABLE > > for flash region on these platforms specifically. This attribute will > > set the region as write back but not inner shared. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Peicong Li > > Signed-off-by: Heyi Guo > > Cc: Leif Lindholm > > Cc: Ard Biesheuvel > > Reviewed-by: Ard Biesheuvel Reviewed-by: Leif Lindholm > > --- > > ArmPkg/Include/Library/ArmLib.h | 7 +++++++ > > ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 4 ++++ > > 2 files changed, 11 insertions(+) > > > > diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h > > index 24ffe9f..38199be 100644 > > --- a/ArmPkg/Include/Library/ArmLib.h > > +++ b/ArmPkg/Include/Library/ArmLib.h > > @@ -41,6 +41,13 @@ typedef enum { > > ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_UNCACHED_UNBUFFERED, > > ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK, > > ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK, > > + // On some platforms, memory mapped flash region is designed as not supporting > > + // shareable attribute, so WRITE_BACK_NONSHAREABLE is added for such special > > + // need. > > + // Do NOT use below two attributes if you are not sure. > > + ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE, > > + ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHAREABLE, > > + > > ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH, > > ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_THROUGH, > > ARM_MEMORY_REGION_ATTRIBUTE_DEVICE, > > diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c > > index 8bd1c6f..4b62ecb 100644 > > --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c > > +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c > > @@ -35,6 +35,10 @@ ArmMemoryAttributeToPageAttribute ( > > ) > > { > > switch (Attributes) { > > + case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE: > > + case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHAREABLE: > > + return TT_ATTR_INDX_MEMORY_WRITE_BACK; > > + > > case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK: > > case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK: > > return TT_ATTR_INDX_MEMORY_WRITE_BACK | TT_SH_INNER_SHAREABLE; > > -- > > 2.7.2.windows.1 > >