From patchwork Mon Apr 25 20:06:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 66631 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1236492qge; Mon, 25 Apr 2016 13:15:18 -0700 (PDT) X-Received: by 10.98.7.153 with SMTP id 25mr51895359pfh.38.1461615318677; Mon, 25 Apr 2016 13:15:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si8373911pfj.97.2016.04.25.13.15.18; Mon, 25 Apr 2016 13:15:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeblueprint-co-uk.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965113AbcDYUPG (ORCPT + 29 others); Mon, 25 Apr 2016 16:15:06 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35333 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964879AbcDYUHn (ORCPT ); Mon, 25 Apr 2016 16:07:43 -0400 Received: by mail-wm0-f49.google.com with SMTP id e201so98079654wme.0 for ; Mon, 25 Apr 2016 13:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eBFvX3n+0OH61MJpLe2OxTQAVc35/pLbxuT4vxCmnjw=; b=Qx9pFSS/4Ipokw78aSOq75Q5uyGf82t88yN9UW68TPsoVEqZrw73SOv0Glh3Qpv8Fc zhxkM9anTA1m8/W//O7pVUVL5zpQiCMDuxu9mpOot6Y/3qKCugaWBrrW76TJLXOiEsrM EzgsJ7cglwKYl+/KRwOz9eW+8Jq5z4dA2KawHrZSMopGXuFIWrf8w0CmeyH8NNFNYYh5 gqsZqwPccTKZRtC9LJbCyHdqiIidXZCadN5/8c+uZPw92K5uZlaewzgy1lhwCWxNiK8D GE+PKVYcCEJGWhvWAgNrIP6jSgb4bXxPajV1vUUWWfgM4e6Vg5b7MBOo5ZVeKSg7ggT1 156Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eBFvX3n+0OH61MJpLe2OxTQAVc35/pLbxuT4vxCmnjw=; b=lrmJTK3iozJC9HVIBPMw/cGgZYYaO5Y2359LnhOa10Sl4dBEODNw5fbcXWqBsjDTiq kjVKKfSQQ/IHjWCBz16MtfHa6ODMQpcY6PqHv5ucdUiCFoiKeoeIpttjBZNmsiGrt3wq ISeSGsLcqzd1yjrKVQJEOk/dWRUF6nBe46vAW9TTJLI1d9K/OH5A4nMIbbyEmQyDIizW zOStj9+4HMVVl84U4uSqKbQ6eIhh4+DL7Mvy3Jfk+CuGzniiddFtv5uMCuOgO1psgSGA cQZX47klkLpycUhW83jMzzQF/QwzH3TzP6iFkQ8lxVGiTiEC8KuUx945xkUIjG1L5x0/ gVDw== X-Gm-Message-State: AOPr4FWfOGxiaVz0fSgjpiZY5BjzAt3Ngj2m8Nc3OgHkVhm4Cd/bvofA7TP/UFTmv4I5qw== X-Received: by 10.194.92.237 with SMTP id cp13mr37142286wjb.168.1461614862059; Mon, 25 Apr 2016 13:07:42 -0700 (PDT) Received: from localhost (bcdc58e5.skybroadband.com. [188.220.88.229]) by smtp.gmail.com with ESMTPSA id u3sm20304939wmg.15.2016.04.25.13.07.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Apr 2016 13:07:41 -0700 (PDT) From: Matt Fleming To: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Matt Fleming , Catalin Marinas , Leif Lindholm , Mark Rutland , Peter Jones , Sai Praneeth Prakhya , Will Deacon Subject: [PATCH 14/40] efi/arm*: Take the Memory Attributes table into account Date: Mon, 25 Apr 2016 21:06:46 +0100 Message-Id: <1461614832-17633-15-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> References: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel Call into the generic memory attributes table support code at the appropriate times during the init sequence so that the UEFI Runtime Services region are mapped according to the strict permissions it specifies. Signed-off-by: Ard Biesheuvel Cc: Mark Rutland Cc: Catalin Marinas Cc: Will Deacon Cc: Leif Lindholm Cc: Peter Jones Cc: Sai Praneeth Prakhya Signed-off-by: Matt Fleming --- arch/arm64/include/asm/efi.h | 2 ++ drivers/firmware/efi/arm-init.c | 1 + drivers/firmware/efi/arm-runtime.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) -- 2.7.3 diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 8e88a696c9cb..4dafc89f373a 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -14,6 +14,8 @@ extern void efi_init(void); int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md); +#define efi_set_mapping_permissions efi_create_mapping + #define efi_call_virt(f, ...) \ ({ \ efi_##f##_t *__f; \ diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index a84dddb54c14..909d974d35d9 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -206,6 +206,7 @@ void __init efi_init(void) return; reserve_regions(); + efi_memattr_init(); early_memunmap(efi.memmap.map, params.mmap_size); if (IS_ENABLED(CONFIG_ARM)) { diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 19283deac375..17ccf0a8787a 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -77,9 +77,15 @@ static bool __init efi_virtmap_init(void) systab_found = true; } } - if (!systab_found) + if (!systab_found) { pr_err("No virtual mapping found for the UEFI System Table\n"); - return systab_found; + return false; + } + + if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions)) + return false; + + return true; } /*