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::242; helo=mail-wm0-x242.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 6CAB52034D80E for ; Tue, 7 Nov 2017 03:19:31 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id z3so3046984wme.5 for ; Tue, 07 Nov 2017 03:23:30 -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=JEZ0TSa3nQGR6JmNZXjkRiMK6Ujp7NSzLdubt4ExoHc=; b=kER9ejiMZgnlMr5TQKy3Yx5YSOLS+MLq168tkmOzY1jpLpBgQhLv0kAM7QbjkQiABn GPy3sr8OU8eK7tFagRToI66zexAabgXMrRXV/IcR0sJ4r32BX3KZshWxUU4xK8nsveE4 Ca9XezvbQFgJnTcSutHqdkV8uHJ5K/PFxYX9s= 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=JEZ0TSa3nQGR6JmNZXjkRiMK6Ujp7NSzLdubt4ExoHc=; b=B4+NX39EBwBgjjKYcMesa5K+w5t1gHtQVYm/sv5G6X4KJ6hQyL4zoBiQ5tDIBfFMZk ygfYo8TwttDcy0dgZgkiGa7BkX/DYGs6BTdhloDZx+OyzG6MHMJnV8DxNhfvVt+kGHE/ Ivx6t8iS9i95nTP+3h/I+wsIL6hBiUFOF5rAI24B8aAKgZPNzLVGXe9iPcG6ttUywmRJ dYHFTuGn98jlkUGzVMI0IKgGsD5jcc3r/b5lxVGfpz1QS6Z4XA7L8muJUiAOCWpVolSB v8eUNnL6CnTI3DCxKMkotR2OPv1ibcxBZbc/tdJkwHlsKdJ2X6FQQ1FUIbKopafynsbc fgRA== X-Gm-Message-State: AJaThX5zwrb76kImZ4L1NlsXdDp6TFYUfPYz4O7WLznXH1qoedFGjR32 mh30OV369zfubj91fZo7WvUg2Q== X-Google-Smtp-Source: ABhQp+Szr326amh4y9b8/o0yeeAX1XX9BQ48fgIt/kZYhD7b3AXRPO4aJ3DdMlVUmKVr20xwliyKzg== X-Received: by 10.28.69.8 with SMTP id s8mr987419wma.65.1510053809413; Tue, 07 Nov 2017 03:23:29 -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 x75sm1678557wme.29.2017.11.07.03.23.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Nov 2017 03:23:28 -0800 (PST) Date: Tue, 7 Nov 2017 11:23:26 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: Heyi Guo , linaro-uefi , "edk2-devel@lists.01.org" , Peicong Li Message-ID: <20171107112326.atof7lwtgxn5s7nv@bivouac.eciton.net> References: <1510052748-5564-1-git-send-email-heyi.guo@linaro.org> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [RFC] ArmPkg/ArmMmuLib: Add new attribute WRITE_BACK_NONSHARE 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 11:19:31 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Nov 07, 2017 at 11:08:39AM +0000, Ard Biesheuvel wrote: > On 7 November 2017 at 11:05, 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_NONSHARE 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 > > --- > > ArmPkg/Include/Library/ArmLib.h | 2 ++ > > ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 4 ++++ > > 2 files changed, 6 insertions(+) > > > > diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h > > index 24ffe9f..e43e375 100644 > > --- a/ArmPkg/Include/Library/ArmLib.h > > +++ b/ArmPkg/Include/Library/ArmLib.h > > @@ -39,6 +39,8 @@ > > typedef enum { > > ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED = 0, > > ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_UNCACHED_UNBUFFERED, > > + ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHARE, > > + ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHARE, > > ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK, > > ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK, > > ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH, > > diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c > > index 8bd1c6f..cc10143 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_NONSHARE: > > + case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHARE: > > + 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 > > > > I'd prefer the name > ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE but other than > that, this looks sensible to me. Leif? And the same for NONSECURE, yes. With that modification, this sounds like something absolutely required in this situation. Does this scenario have any further implications for runtime use? / Leif