From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (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 4799021D046D5 for ; Tue, 7 Nov 2017 17:52:50 -0800 (PST) Received: by mail-pg0-x244.google.com with SMTP id a192so854346pge.9 for ; Tue, 07 Nov 2017 17:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Xn7AGqjTvmWydyg4uyTkbI36luJo915nYRNux3SfqcA=; b=hVDTwZ3RDjxrGvhPBUH6qjofLQRxVWMw3i49mv/PXlzSTTtHRJTA5qzVp78ZJEe5GQ uGSCm39Ujqhq6sDmh4o8hI2hlAg+X9IkHE/4qniQeLS9QYLcMJu0c6qPQNnY5C3ZmBJR cdEC8AYPaayjKeeqsD4EX2oMr+ypXAWQSZedw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Xn7AGqjTvmWydyg4uyTkbI36luJo915nYRNux3SfqcA=; b=QDC3xUUj1nif2vLciC/2hYbTwi/gpvaH46YG2/Nan3HLdmoOYNyvqThPD6WMtBUtfY rcXX6lDNliUfji+UOevkwnhj1yZjJwfWe5qu+fPkzhHkXiMLhjQmgIP/cCr1BfV0sv6f KMzv6c0Rw5W6P9/8TFc7D4iHpTzpJEdID2F3w97CHA1a4nK/cETyaNRxwbSPgnHPdUmD QwTks0sE6HU6tb/PyefRs9BTWmkK7LCVBTO0HtBeKqVJVkZ+nl4kO9nAxHjDyMj4J9qc ZRw6IqGhCxG+1S468bDE5dtLOBnKUZAI5I60heJz0So/zpETXasTdDcRjAYZzd1k2EWH zpnQ== X-Gm-Message-State: AJaThX4fXNp0ky3rOWuD3ceN5pM0I5DuWcP0lAASBXvwdxuVz7KTLfah MYIkRKTCmoN61rASAyF4ZLt7lA== X-Google-Smtp-Source: ABhQp+QBrPw3qTmaPl9xdTkvvMme1PPOwwal5luTccHabFuDEnK5ekJQwRAmn+Z+MbOShGGkk3SwCg== X-Received: by 10.98.163.84 with SMTP id s81mr733009pfe.64.1510106209966; Tue, 07 Nov 2017 17:56:49 -0800 (PST) Received: from [10.189.19.158] ([45.56.152.90]) by smtp.gmail.com with ESMTPSA id r18sm5042761pfi.59.2017.11.07.17.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 17:56:49 -0800 (PST) To: Ard Biesheuvel , Leif Lindholm Cc: linaro-uefi , "edk2-devel@lists.01.org" , Peicong Li References: <1510059411-6608-1-git-send-email-heyi.guo@linaro.org> <1510059411-6608-2-git-send-email-heyi.guo@linaro.org> <20171107132911.al3ovu6wjah6sjfm@bivouac.eciton.net> From: Heyi Guo Message-ID: Date: Wed, 8 Nov 2017 09:56:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: 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: Wed, 08 Nov 2017 01:52:50 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Thanks, Heyi 在 11/7/2017 9:30 PM, Ard Biesheuvel 写道: > On 7 November 2017 at 13:29, Leif Lindholm wrote: >> 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 >> > Pushed as 829633e3a82d. Thanks! > >>>> --- >>>> 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 >>>>