From patchwork Wed Jun 20 19:10:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 139395 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1151136lji; Wed, 20 Jun 2018 12:10:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIry9kWdhOdstajD78ZazXgg22wkpJE46T0I2uzEp9CplGve4p2d+WzylLpQpovt7vHqI3B X-Received: by 2002:a62:c918:: with SMTP id k24-v6mr24088867pfg.160.1529521813458; Wed, 20 Jun 2018 12:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529521813; cv=none; d=google.com; s=arc-20160816; b=Wp7TEKZ4e+0Aw3uZ5dH+82FNc+6buDIxad5FiwJWLAwa1GDFji0246QuKZAIyrd7FT hzro6ca15Uc0tnLytPash8/EAbZp9v1QjJMJVZfppITf9faw129AE2kBe5fozjWNAGqi vHtw3Q5zsy0paRGTmqekZtGOvqgur/7DiXk7KsCVYi5Z+m/PrRKtEQqzUEw++EqONhCJ 0fcIV7/Fa1CVwNKwg3e5Pkx5b7Qm2tQlYHnjoFh4wLZcQ6jsh9gtA30ukmz4jTQw6ZNL ibjjH9P0mBBMKGUO7Lx/1b6AcTGCC3ja/9y1Pw3BMZFWsv1OWQp/n63Gy46fSrGFcggT PQgg== 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:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=vKS8IzJc7Z5UTMcXwhcuobla3ikXeNUkGxz2T1HtAgY=; b=D4m2xoQvyI3eKp/xXKxm/1RPF2eYDl6XJT+FmPCi7k3Xt3g/rfon0AQKgUkmKg4W0o s42rVVA0fiiR71KnD1UWX/2/AjKsHS1on4mj/2XeJn2AbN4U/vqD37P8H0X5ylzq3ip7 L6CbTgzqsnGYUfCxzu3DbFiLUO7GuXlqHXeA516sjUNZ8nr0HNlMSO6e6uk6DBgXOG+X GCisS6A33I2H8c8YPWgUX7J7Wc5Kta9Jb5XH96Ts54XxY+6ykDf8rEg5GoI8KrbyHa1c 7enmy1w1ofI7v4aMY8J+jbnhb9wDr9YHr4nCEoE/5Pxk3DfLaFRA8SFjaBvecyYgj+iT GPHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="hS/Jo7tA"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id q130-v6si2456952pgq.526.2018.06.20.12.10.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 12:10:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="hS/Jo7tA"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 E29FF211B7F89; Wed, 20 Jun 2018 12:10:12 -0700 (PDT) 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=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::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 CF7D5211B7F87 for ; Wed, 20 Jun 2018 12:10:11 -0700 (PDT) Received: by mail-wr0-x244.google.com with SMTP id e18-v6so603327wrs.5 for ; Wed, 20 Jun 2018 12:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WFqLdwDHGo2toHSk8nPGdc94GfiC17thluwp99ptQls=; b=hS/Jo7tAylq72U6jyUGBoTFCYwlN9O9G+51uecxcxTAIo0cJ62qKrR7B5TofvOsOo9 8RYAP5LFfru1UsxXNDkqCmeBe3q4QNs3YeRAVHcr8N0STh+YcUjoxGakxF+7CDNsovEU SsS/AcT1+SzXCEE/Z4ZF4GKV5pdSzPIhfc8bo= 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; bh=WFqLdwDHGo2toHSk8nPGdc94GfiC17thluwp99ptQls=; b=HCrhDFXrqi9RdJ0RPnDAMLkvhdmd+/InQtT6DXqgcgV/28QlcDh4Y/E9kUE48HA1Nx psd6xaYM7e09rKYcIVB1Ig/px20hi9/3ydT86HJU3i4RmQYsh+TxQM6WchiiRXx3S2o3 YiOhesZzumswhbZcHKut17sUhVOk8hhFPQF8bFd2i8HPzCUYg/oC77WhZi1AohWcbzoP fGVXAscQKu4pvy0JQvo7eMPcjXmA+VOywyWj5oUqjK8qt2VbGz65CYRRNISOsqFURC2o g8vjkijwZ41ygE1f7viLYip84g3y8ppdgx06Z0LjEbgIqKW5ysnHVgat0Zz0b//pl2t+ tkmQ== X-Gm-Message-State: APt69E0qKPBCak2ha/XfhhLXpCO1QDHsj0DccgRVwsMDRwzX+BLwSk/M ko+iIdMGLFoqVQ8/ZUTPMhabs0dp43w= X-Received: by 2002:adf:b587:: with SMTP id c7-v6mr18927141wre.141.1529521810009; Wed, 20 Jun 2018 12:10:10 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:dd7d:ecd4:eee5:21f4]) by smtp.gmail.com with ESMTPSA id b190-v6sm5217781wma.24.2018.06.20.12.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 12:10:09 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 20 Jun 2018 21:10:07 +0200 Message-Id: <20180620191007.1250-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [edk2] [PATCH] ArmPkg/ArmMmuLib ARM: remove cache maintenance of block mapping contents X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Peculiarly enough, the current page table manipulation code takes it upon itself to write back and invalidate the memory contents covered by section mappings when their memory attributes change. It is not generally the case that data must be written back when such a change occurs, even when switching from cacheable to non-cacheable attributes, and in some cases, it is actually causing problems. (The cache maintenance is also performed on the PCIe MMIO regions as they get mapped by the PCI bus driver, and under virtualization, each cache maintenance operation on an emulated MMIO region triggers a round trip to the host and back) So let's just drop this code. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index 9bf4ba03fd5b..d1bca4c601b8 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -718,12 +718,6 @@ UpdateSectionEntries ( if (CurrentDescriptor != Descriptor) { Mva = (VOID *)(UINTN)(((UINTN)FirstLevelIdx + i) << TT_DESCRIPTOR_SECTION_BASE_SHIFT); - // Clean/invalidate the cache for this section, but only - // if we are modifying the memory type attributes - if (((CurrentDescriptor ^ Descriptor) & TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK) != 0) { - WriteBackInvalidateDataCacheRange (Mva, SIZE_1MB); - } - // Only need to update if we are changing the descriptor FirstLevelTable[FirstLevelIdx + i] = Descriptor; ArmUpdateTranslationTableEntry ((VOID *)&FirstLevelTable[FirstLevelIdx + i], Mva);