From patchwork Tue Mar 7 08:42:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94956 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1788798qgd; Tue, 7 Mar 2017 00:42:17 -0800 (PST) X-Received: by 10.84.232.134 with SMTP id i6mr33564575plk.101.1488876137708; Tue, 07 Mar 2017 00:42:17 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id m15si21816499pgc.88.2017.03.07.00.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 00:42:17 -0800 (PST) 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; 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 B720380351; Tue, 7 Mar 2017 00:42:16 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 F1EB38034D for ; Tue, 7 Mar 2017 00:42:14 -0800 (PST) Received: by mail-wm0-x236.google.com with SMTP id t189so5253343wmt.1 for ; Tue, 07 Mar 2017 00:42:14 -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=cje1j3fVtIY964WsnfvY5lXgsIVu4bZSUZSLo5whQrY=; b=Q69hr5OlbpLOVAzIw4x1IbQu2HmeoSqM0vW9xCkfyHxgyf34ZOoxfPN9v1memdORe3 kHLtfH3er/LiSAhTlUzDCH3o8w4C4g9o5aXYcb/MZCyX145FxSsP39LqJ7hKAc/NH4+u YVGe3Gkyq04tLDrMHzoa3HB8a8QyUbWAjGsWA= 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=cje1j3fVtIY964WsnfvY5lXgsIVu4bZSUZSLo5whQrY=; b=kE5U0fD+Eh7PfmtXl/Az8lM52le2oKAtyxVDY4ImjlQxHM1vnV94Tg8hUDZupqc3Bn PyigaxRiZ0v8uT3WKR1V7Pls1g3L8eTP//CMMuafoo6AqhAO2OzNyXHjucuJSgCQoR4Y QRm6VEKYe+zEpVHSl5r3Xd/UuUrx/+Q9pHpxMKC8pz1xkmnjejIU6el37tDILV9htPX9 oapAe3uIpL8f/tlTdCGcYlySnjRinz66MI81GK9R5ruJaqqKBcsmhqxd3PJqRZxMlhq9 A7LXS/b3wiruz5BDP62AnxEtaOph9hhTCd1XPGzG/a6XfpgI1gJ2IjTfSJDMpBSowa0P kHvQ== X-Gm-Message-State: AMke39kT6d1qbL6VVLRWJki0w8BVUHZHZMLtGJ9T1guNA/8MW/m1XyY0ZXfN9Qb+hlAcKZTO X-Received: by 10.28.179.7 with SMTP id c7mr16751808wmf.128.1488876133333; Tue, 07 Mar 2017 00:42:13 -0800 (PST) Received: from ards-macbook-pro.c.hoisthospitality.com ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id u41sm30097838wrc.24.2017.03.07.00.42.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Mar 2017 00:42:12 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Tue, 7 Mar 2017 09:42:03 +0100 Message-Id: <1488876125-24396-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488876125-24396-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488876125-24396-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 2/4] ArmPkg/ArmMmuLib: remove VirtualMask arg from ArmSetMemoryAttributes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" We no longer make use of the ArmMmuLib 'feature' to create aliased memory ranges with mismatched attributes, and in fact, it was only wired up in the ARM version to begin with. So remove the VirtualMask argument from ArmSetMemoryAttributes()'s prototype, and remove the dead code that referred to it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c | 2 +- ArmPkg/Include/Library/ArmMmuLib.h | 3 +-- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 3 +-- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 21 ++++---------------- 4 files changed, 7 insertions(+), 22 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c b/ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c index d0a3fedd3aa7..8150486217cf 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c +++ b/ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c @@ -210,7 +210,7 @@ CpuSetMemoryAttributes ( if (EFI_ERROR (Status) || (RegionArmAttributes != ArmAttributes) || ((BaseAddress + Length) > (RegionBaseAddress + RegionLength))) { - return ArmSetMemoryAttributes (BaseAddress, Length, EfiAttributes, 0); + return ArmSetMemoryAttributes (BaseAddress, Length, EfiAttributes); } else { return EFI_SUCCESS; } diff --git a/ArmPkg/Include/Library/ArmMmuLib.h b/ArmPkg/Include/Library/ArmMmuLib.h index d3a302fa8125..fb7fd006417c 100644 --- a/ArmPkg/Include/Library/ArmMmuLib.h +++ b/ArmPkg/Include/Library/ArmMmuLib.h @@ -66,8 +66,7 @@ EFI_STATUS ArmSetMemoryAttributes ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, - IN UINT64 Attributes, - IN EFI_PHYSICAL_ADDRESS VirtualMask + IN UINT64 Attributes ); #endif diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c index 77f108971f3e..8bd1c6fad95f 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -450,8 +450,7 @@ EFI_STATUS ArmSetMemoryAttributes ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, - IN UINT64 Attributes, - IN EFI_PHYSICAL_ADDRESS VirtualMask + IN UINT64 Attributes ) { EFI_STATUS Status; diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index 8a472a1eb64b..351b6c03a42c 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -471,7 +471,6 @@ UpdatePageEntries ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, - IN EFI_PHYSICAL_ADDRESS VirtualMask, OUT BOOLEAN *FlushTlbs OPTIONAL ) { @@ -587,11 +586,6 @@ UpdatePageEntries ( // Mask in new attributes and/or permissions PageTableEntry |= EntryValue; - if (VirtualMask != 0) { - // Make this virtual address point at a physical page - PageTableEntry &= ~VirtualMask; - } - if (CurrentPageTableEntry != PageTableEntry) { Mva = (VOID *)(UINTN)((((UINTN)FirstLevelIdx) << TT_DESCRIPTOR_SECTION_BASE_SHIFT) + (PageTableIndex << TT_DESCRIPTOR_PAGE_BASE_SHIFT)); @@ -619,8 +613,7 @@ EFI_STATUS UpdateSectionEntries ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, - IN UINT64 Attributes, - IN EFI_PHYSICAL_ADDRESS VirtualMask + IN UINT64 Attributes ) { EFI_STATUS Status = EFI_SUCCESS; @@ -704,7 +697,6 @@ UpdateSectionEntries ( (FirstLevelIdx + i) << TT_DESCRIPTOR_SECTION_BASE_SHIFT, TT_DESCRIPTOR_SECTION_SIZE, Attributes, - VirtualMask, NULL); } else { // still a section entry @@ -714,9 +706,6 @@ UpdateSectionEntries ( // mask in new attributes and/or permissions Descriptor |= EntryValue; - if (VirtualMask != 0) { - Descriptor &= ~VirtualMask; - } if (CurrentDescriptor != Descriptor) { Mva = (VOID *)(UINTN)(((UINTN)FirstLevelTable) << TT_DESCRIPTOR_SECTION_BASE_SHIFT); @@ -743,8 +732,7 @@ EFI_STATUS ArmSetMemoryAttributes ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, - IN UINT64 Attributes, - IN EFI_PHYSICAL_ADDRESS VirtualMask + IN UINT64 Attributes ) { EFI_STATUS Status; @@ -766,8 +754,7 @@ ArmSetMemoryAttributes ( "SetMemoryAttributes(): MMU section 0x%lx length 0x%lx to %lx\n", BaseAddress, ChunkLength, Attributes)); - Status = UpdateSectionEntries (BaseAddress, ChunkLength, Attributes, - VirtualMask); + Status = UpdateSectionEntries (BaseAddress, ChunkLength, Attributes); FlushTlbs = TRUE; } else { @@ -787,7 +774,7 @@ ArmSetMemoryAttributes ( BaseAddress, ChunkLength, Attributes)); Status = UpdatePageEntries (BaseAddress, ChunkLength, Attributes, - VirtualMask, &FlushTlbs); + &FlushTlbs); } if (EFI_ERROR (Status)) {