From patchwork Mon Apr 25 20:06:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 66630 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1236404qge; Mon, 25 Apr 2016 13:15:07 -0700 (PDT) X-Received: by 10.66.221.167 with SMTP id qf7mr51377005pac.94.1461615307574; Mon, 25 Apr 2016 13:15:07 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si8668152pat.170.2016.04.25.13.15.07; Mon, 25 Apr 2016 13:15:07 -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 S965077AbcDYUPE (ORCPT + 29 others); Mon, 25 Apr 2016 16:15:04 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37851 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933468AbcDYUHo (ORCPT ); Mon, 25 Apr 2016 16:07:44 -0400 Received: by mail-wm0-f49.google.com with SMTP id n3so145586192wmn.0 for ; Mon, 25 Apr 2016 13:07:43 -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=C4MQTCS4SuspS8Dd90FgfweIKWpS9LoRegNvmopgqQM=; b=jZIiCi1SxqPWq904Os1N5ArNRRxvgn5wkKoR0CzI6BZVdLD+D3B2wu9BwXgANhtcAR O6dF415aQZ45YWX4k/hINKvZLnyF7zRdiXG3km/ZpZGT51YKtYvHTK/rvHQ904XrbfTG lH1QO0SPbsWZSXfSTM2d1qzRfMfmPernS3yaQjYrs/jjkvmGHWFSfDgQNlEDi6Nbr0jj +l/2RKlNQl8bOQRwhjVPfaIuhlG6FcLSYlYSDQPp3qHMXlmvGyGy0FW/oBUo/9eHTP96 KQDaqh8aU5toAZTtDBQJ2KvGJ3s0NBByTtoKaIpIlYJX9jWC/44zK/TYdTQRXZKRYqbb bgtQ== 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=C4MQTCS4SuspS8Dd90FgfweIKWpS9LoRegNvmopgqQM=; b=I6l8xykiFUvz79DxpKZX3UaGAq2Y66R2sr+R5WxX4ZOOH/zsx4f1kydV31npIjHWHc mJ7zakGMo/f1DTpKQrBU9ensMfkUu5neqcWv/HAMI/EgzlHVoQhSF/YLWW/QPqgHZVbN l/6k87v+kyJykzaTXdEYOGXlWxTyPNjhY3oGT/qIxUnkfxWmy0EXO3RA2+R0TNQYMmGQ dEb/mqE2o/89sPulcNfo+5gIL1EifQOk0AyDOcs5V+n6JmOlQuZ+8CXZ3ta/x7IUdb6J TXP5QgJOtx9szjYzFEa0DH4c96AscI4mQOyXZVPqBXqFGRHthz8eF6pDt4oKdLTh1EII UzfA== X-Gm-Message-State: AOPr4FXvCmdS1Tpca3Fu6fGM/4+WBa+237v91+YyJuWpQNTjHjp12p4IYYr0unS5rxQjuQ== X-Received: by 10.194.216.33 with SMTP id on1mr19400898wjc.120.1461614858145; Mon, 25 Apr 2016 13:07:38 -0700 (PDT) Received: from localhost (bcdc58e5.skybroadband.com. [188.220.88.229]) by smtp.gmail.com with ESMTPSA id ip10sm15100103wjb.33.2016.04.25.13.07.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Apr 2016 13:07:37 -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 12/40] efi: Add support for the EFI_MEMORY_ATTRIBUTES_TABLE config table Date: Mon, 25 Apr 2016 21:06:44 +0100 Message-Id: <1461614832-17633-13-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 This declares the GUID and struct typedef for the new memory attributes table which contains the permissions that can be used to apply stricter permissions to UEFI Runtime Services memory regions. 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 --- drivers/firmware/efi/efi.c | 2 ++ include/linux/efi.h | 13 +++++++++++++ 2 files changed, 15 insertions(+) -- 2.7.3 diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index f7d36c6cc1ad..583e647912a5 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -43,6 +43,7 @@ struct efi __read_mostly efi = { .config_table = EFI_INVALID_TABLE_ADDR, .esrt = EFI_INVALID_TABLE_ADDR, .properties_table = EFI_INVALID_TABLE_ADDR, + .mem_attr_table = EFI_INVALID_TABLE_ADDR, }; EXPORT_SYMBOL(efi); @@ -338,6 +339,7 @@ static __initdata efi_config_table_type_t common_tables[] = { {UGA_IO_PROTOCOL_GUID, "UGA", &efi.uga}, {EFI_SYSTEM_RESOURCE_TABLE_GUID, "ESRT", &efi.esrt}, {EFI_PROPERTIES_TABLE_GUID, "PROP", &efi.properties_table}, + {EFI_MEMORY_ATTRIBUTES_TABLE_GUID, "MEMATTR", &efi.mem_attr_table}, {NULL_GUID, NULL, NULL}, }; diff --git a/include/linux/efi.h b/include/linux/efi.h index c2c0da49876e..81af5feba1f7 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -623,6 +623,10 @@ void efi_native_runtime_setup(void); EFI_GUID(0x3152bca5, 0xeade, 0x433d, \ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44) +#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID \ + EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, \ + 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20) + typedef struct { efi_guid_t guid; u64 table; @@ -847,6 +851,14 @@ typedef struct { #define EFI_INVALID_TABLE_ADDR (~0UL) +typedef struct { + u32 version; + u32 num_entries; + u32 desc_size; + u32 reserved; + efi_memory_desc_t entry[0]; +} efi_memory_attributes_table_t; + /* * All runtime access to EFI goes through this structure: */ @@ -868,6 +880,7 @@ extern struct efi { unsigned long config_table; /* config tables */ unsigned long esrt; /* ESRT table */ unsigned long properties_table; /* properties table */ + unsigned long mem_attr_table; /* memory attributes table */ efi_get_time_t *get_time; efi_set_time_t *set_time; efi_get_wakeup_time_t *get_wakeup_time;