From patchwork Wed Mar 30 16:38:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 64721 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2707384lbc; Wed, 30 Mar 2016 10:00:09 -0700 (PDT) X-Received: by 10.98.44.70 with SMTP id s67mr14824406pfs.59.1459357209773; Wed, 30 Mar 2016 10:00:09 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id kn6si7685446pab.36.2016.03.30.10.00.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 10:00:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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 linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1alJSD-0004t5-Oq; Wed, 30 Mar 2016 16:58:49 +0000 Received: from mail-wm0-f47.google.com ([74.125.82.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1alJ9Z-0008Il-Sp for linux-arm-kernel@lists.infradead.org; Wed, 30 Mar 2016 16:40:26 +0000 Received: by mail-wm0-f47.google.com with SMTP id r72so107243425wmg.0 for ; Wed, 30 Mar 2016 09:39:13 -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:in-reply-to:references; bh=R3w4bydXgZ3saJaIxC7t/knKXYoEqXaNjQPBQ4J22DM=; b=hWlZj1FhWsthTXJZ/ut8BMLNbnESUXBO57RNTPgC01IxIzBzzgMJPF8vVQCupkA6TC Q178aOYgKB8XVWT8HN/HK6VPk1gZhUWdX4mjlX5hNUiIlYFW3SSQcuiXGHklF0Q065Al ZG2LOc7UAOoeMYj/ETFxDOdQMuXVeCrqsU788= 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=R3w4bydXgZ3saJaIxC7t/knKXYoEqXaNjQPBQ4J22DM=; b=HcSZlOISgwBUdSCWjvKvQgFpxTNpX2ZutXHTcN6hkvIGMX5gHF5NLNqQz70Ndcd3xc Am/5DEVutuNl5bEQECDr3z0fUBiplBKYqpLdNXUp/MBgiA96wfQUOySOiD1cXaRG3afA mfIU2g65o2BiUYEW004Y54HWWPhFFOVTzQ8LK1xzWqYDhG1s3C9MZPg3ypEPRj8NgsBU nulGNBJ5v98B6MykR3w9P68UrkfM8zVDZMH5ObDDPejIqYmoOAOShjwDAjWnX1sf2OCg e0T+xEVPGn7k4g7+faY9dksvJDjgOf6AItpaAQrQvAo6yhQz+VbyiTspq9y/rss78DGc bcGw== X-Gm-Message-State: AD7BkJIzL/+oQFrVLbZJ2Jf4f/rjaIh9JLd6lr5z6RX5Qe0lyK7yQKoLunmeUI8N8RvyPvrU X-Received: by 10.28.3.138 with SMTP id 132mr11047416wmd.20.1459355951745; Wed, 30 Mar 2016 09:39:11 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id l124sm5233151wmf.11.2016.03.30.09.39.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 09:39:10 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt@codeblueprint.co.uk, mark.rutland@arm.com, linux@arm.linux.org.uk Subject: [PATCH v2 3/5] efi: add support for the EFI_MEMORY_ATTRIBUTES_TABLE config table Date: Wed, 30 Mar 2016 18:38:51 +0200 Message-Id: <1459355933-13529-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459355933-13529-1-git-send-email-ard.biesheuvel@linaro.org> References: <1459355933-13529-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160330_093935_074953_E78BBA51 X-CRM114-Status: GOOD ( 12.33 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.47 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.47 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , catalin.marinas@arm.com, will.deacon@arm.com, leif.lindholm@linaro.org, sai.praneeth.prakhya@intel.com, pjones@redhat.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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 --- drivers/firmware/efi/efi.c | 2 ++ include/linux/efi.h | 13 +++++++++++++ 2 files changed, 15 insertions(+) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 3a69ed5ecfcb..5683865baa92 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 1626474567ac..346d01ad7cca 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;