From patchwork Tue Nov 7 12:56:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 118159 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3941666qgn; Tue, 7 Nov 2017 04:57:21 -0800 (PST) X-Google-Smtp-Source: ABhQp+SIylGyKjmFzFasA6GlN2KxrYZTANYObStl4N505jJ1TkOhpxAEdIlO/aAdBMeZY8ktu5Cq X-Received: by 10.99.0.214 with SMTP id 205mr2431643pga.283.1510059441332; Tue, 07 Nov 2017 04:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510059441; cv=none; d=google.com; s=arc-20160816; b=Mm+1fe2NFeZ/mXbTz/oBkSokdXaKvy9KU1qcckcSSs8N0bTNi6cGtUn4npSXVxRU3p oRqh05UmmuPOjARk45U0JXHDuqHU1bqyJYaI7mIOL/FNju1SJ7PW8SYZ9pE7fF4WvPWN SXR/0V/Ah4dD9Heo1/0zMPDJqTcuxh63huADDT9Wa5ClDHb2w4JVUvHzvn3uA0y5kQBD A/AFNaMLHmSehIz1ts3rlFJLsb7hVaXplFt2+OGzT+wa2nAIxd/txVjjWnKO0y3punZ1 A4oFKVKr6o61zvfzvNjLhm5zsyBLMWRMpWZHzolC0xmhNIJOjEb5ReGdmOzOgBPinRRm 1x8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=btHgzFcbYDMpy/TXbqs5UnmxZ17Y5AJByZyODWStCW4=; b=MLFN8xAivqB+bFGrnJGXb1qWeUP8Gr4fU+beO8T6ESPkPT3dMvVpLMyBY06a7ucYwi qRLt9nD24rKbiiNdwq+nti7GckWjM3yr7/BELo7SYdq298VVfEfsfcgONbbcRGa7Cr6P 7buhUwMTRooKi2DQdHBvUVhe0ypDtDktxsNkoY82ZzptUYJRgw5U+hpbm7J2G3d9GEpB GlVGMhDXp9IS963Exqsn1R0P7V8KibuJsFwOgKiOlre6dNaC65vGP5dobfdG2N1zGOJo wrHSK0pL8gR0XuXz9NeO+2cAjn51n3tQtys34KEdIhj1Qb+1cQMvYbT2wrXo36a37UYb 1nrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GZKPcNDW; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id i82si1314521pfa.243.2017.11.07.04.57.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 04:57:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GZKPcNDW; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 45DC72034D83B; Tue, 7 Nov 2017 04:53:21 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::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 6B0B52034D81F for ; Tue, 7 Nov 2017 04:53:20 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id n14so10265516pfh.8 for ; Tue, 07 Nov 2017 04:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jMLjzoyB3STdAP43jPlJEyrXUZGpLiAe1HH07HDbIHA=; b=GZKPcNDWoDZP0Yblv21wgp+dhN4zfH2cvLmWct7bnPexmJxixakqB1xGaZbAaZu1Cm k4NebWbycR4LeROU2JWh//gdDEz597lit+sD3GKezxjendILRiBH8SXiWPHw5cU9mgEL xTPIUVav1+Y5TllzxNOzegfqjHN0kh2ZLiTqM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jMLjzoyB3STdAP43jPlJEyrXUZGpLiAe1HH07HDbIHA=; b=DMgFPfcUgPWkNkK4ulwiRzwWxdienkGvo+U0AQkVwwGpZf/vPFDpuCXe5OzagPo/0t C7ZjcmBc+Vl+jRWRkU5Lci5JaCm30/2Zv1r6gxGRX6e37KIK2WL1idHOqcf13eAhq/VI GMXckP8Tt5gaz1MWKgn3atvdqT7uN6p4Zmjf0oO0/+xVbA5c+1BCoIQycjmLNi20TjuS qeFoN6rJq6il/cPHAhy2shM2SMpqmm4UrfPGMvwDJKYMs6hQ67G3NgRLZMsd7FacXQz5 UqHN8oDha7bS6+37RgQJ8YJtjBGAeEfabT2daRQ9Y5pN+qd32iEBWQj8gqSaBDHjBM6y Gblg== X-Gm-Message-State: AMCzsaWg9hEeNeLZKNAMq8muv5LmqCKnQfm0R8K6ryJm2Y4E72ytw+pt UN1GtzTLVVxvwXr+XoIAewgiXg== X-Received: by 10.101.97.81 with SMTP id o17mr18260017pgv.363.1510059439729; Tue, 07 Nov 2017 04:57:19 -0800 (PST) Received: from szxbz956.huaweiobz.com ([45.56.152.90]) by smtp.gmail.com with ESMTPSA id 66sm2700731pgh.31.2017.11.07.04.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Nov 2017 04:57:19 -0800 (PST) From: Heyi Guo To: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org Date: Tue, 7 Nov 2017 20:56:51 +0800 Message-Id: <1510059411-6608-2-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.2.windows.1 In-Reply-To: <1510059411-6608-1-git-send-email-heyi.guo@linaro.org> References: <1510059411-6608-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [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: , Cc: Heyi Guo , Peicong Li , leif.lindholm@linaro.org, ard.biesheuvel@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPkg/Include/Library/ArmLib.h | 7 +++++++ ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 4 ++++ 2 files changed, 11 insertions(+) -- 2.7.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Ard Biesheuvel Reviewed-by: Leif Lindholm 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;