All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: add support for EFI_MEMORY_RO attribute introduced by UEFIv2.5
@ 2015-06-24 10:42 Ard Biesheuvel
       [not found] ` <1435142544-10014-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2015-06-24 10:42 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA, matt.fleming-ral2JQCrhuEAvxtiuMwx3w
  Cc: lersek-H+wXaHxf7aLQT0dZR+AlfA, Ard Biesheuvel

The UEFI spec v2.5 introduces a new memory attribute EFI_MEMORY_RO,
which is now the preferred attribute to convey that the nature of
the contents of such a region allows it to be mapped read-only
(i.e., it contains .text and .rodata only). The specification of
the existing EFI_MEMORY_WP attribute has been updated to align
more closely with its common use as a cacheability attribute rather
than a permission attribute.

Add the #define and add the attribute to the memory map dumping
routine.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/firmware/efi/efi.c | 8 +++++---
 include/linux/efi.h        | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 03a6b313568c..7c4c2202b663 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -502,16 +502,18 @@ char * __init efi_md_typeattr_format(char *buf, size_t size,
 
 	attr = md->attribute;
 	if (attr & ~(EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT |
-		     EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_WP |
-		     EFI_MEMORY_RP | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME))
+		     EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_RO |
+		     EFI_MEMORY_WP | EFI_MEMORY_RP | EFI_MEMORY_XP |
+		     EFI_MEMORY_RUNTIME))
 		snprintf(pos, size, "|attr=0x%016llx]",
 			 (unsigned long long)attr);
 	else
-		snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
+		snprintf(pos, size, "|%3s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
 			 attr & EFI_MEMORY_RUNTIME ? "RUN" : "",
 			 attr & EFI_MEMORY_XP      ? "XP"  : "",
 			 attr & EFI_MEMORY_RP      ? "RP"  : "",
 			 attr & EFI_MEMORY_WP      ? "WP"  : "",
+			 attr & EFI_MEMORY_RO      ? "RO"  : "",
 			 attr & EFI_MEMORY_UCE     ? "UCE" : "",
 			 attr & EFI_MEMORY_WB      ? "WB"  : "",
 			 attr & EFI_MEMORY_WT      ? "WT"  : "",
diff --git a/include/linux/efi.h b/include/linux/efi.h
index af5be0368dec..407e1e6ef29e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -96,6 +96,7 @@ typedef	struct {
 #define EFI_MEMORY_WP		((u64)0x0000000000001000ULL)	/* write-protect */
 #define EFI_MEMORY_RP		((u64)0x0000000000002000ULL)	/* read-protect */
 #define EFI_MEMORY_XP		((u64)0x0000000000004000ULL)	/* execute-protect */
+#define EFI_MEMORY_RO		((u64)0x0000000000020000ULL)	/* read-only */
 #define EFI_MEMORY_RUNTIME	((u64)0x8000000000000000ULL)	/* range requires runtime mapping */
 #define EFI_MEMORY_DESCRIPTOR_VERSION	1
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi: add support for EFI_MEMORY_RO attribute introduced by UEFIv2.5
       [not found] ` <1435142544-10014-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2015-06-24 11:47   ` Laszlo Ersek
  2015-06-28 14:35   ` Matt Fleming
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2015-06-24 11:47 UTC (permalink / raw)
  To: Ard Biesheuvel, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w

On 06/24/15 12:42, Ard Biesheuvel wrote:
> The UEFI spec v2.5 introduces a new memory attribute EFI_MEMORY_RO,
> which is now the preferred attribute to convey that the nature of
> the contents of such a region allows it to be mapped read-only
> (i.e., it contains .text and .rodata only). The specification of
> the existing EFI_MEMORY_WP attribute has been updated to align
> more closely with its common use as a cacheability attribute rather
> than a permission attribute.
> 
> Add the #define and add the attribute to the memory map dumping
> routine.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/firmware/efi/efi.c | 8 +++++---
>  include/linux/efi.h        | 1 +
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 03a6b313568c..7c4c2202b663 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -502,16 +502,18 @@ char * __init efi_md_typeattr_format(char *buf, size_t size,
>  
>  	attr = md->attribute;
>  	if (attr & ~(EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT |
> -		     EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_WP |
> -		     EFI_MEMORY_RP | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME))
> +		     EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_RO |
> +		     EFI_MEMORY_WP | EFI_MEMORY_RP | EFI_MEMORY_XP |
> +		     EFI_MEMORY_RUNTIME))
>  		snprintf(pos, size, "|attr=0x%016llx]",
>  			 (unsigned long long)attr);
>  	else
> -		snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
> +		snprintf(pos, size, "|%3s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
>  			 attr & EFI_MEMORY_RUNTIME ? "RUN" : "",
>  			 attr & EFI_MEMORY_XP      ? "XP"  : "",
>  			 attr & EFI_MEMORY_RP      ? "RP"  : "",
>  			 attr & EFI_MEMORY_WP      ? "WP"  : "",
> +			 attr & EFI_MEMORY_RO      ? "RO"  : "",
>  			 attr & EFI_MEMORY_UCE     ? "UCE" : "",
>  			 attr & EFI_MEMORY_WB      ? "WB"  : "",
>  			 attr & EFI_MEMORY_WT      ? "WT"  : "",
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index af5be0368dec..407e1e6ef29e 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -96,6 +96,7 @@ typedef	struct {
>  #define EFI_MEMORY_WP		((u64)0x0000000000001000ULL)	/* write-protect */
>  #define EFI_MEMORY_RP		((u64)0x0000000000002000ULL)	/* read-protect */
>  #define EFI_MEMORY_XP		((u64)0x0000000000004000ULL)	/* execute-protect */
> +#define EFI_MEMORY_RO		((u64)0x0000000000020000ULL)	/* read-only */
>  #define EFI_MEMORY_RUNTIME	((u64)0x8000000000000000ULL)	/* range requires runtime mapping */
>  #define EFI_MEMORY_DESCRIPTOR_VERSION	1
>  
> 

Reviewed-by: Laszlo Ersek <lersek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi: add support for EFI_MEMORY_RO attribute introduced by UEFIv2.5
       [not found] ` <1435142544-10014-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2015-06-24 11:47   ` Laszlo Ersek
@ 2015-06-28 14:35   ` Matt Fleming
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Fleming @ 2015-06-28 14:35 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	lersek-H+wXaHxf7aLQT0dZR+AlfA

On Wed, 24 Jun, at 12:42:24PM, Ard Biesheuvel wrote:
> The UEFI spec v2.5 introduces a new memory attribute EFI_MEMORY_RO,
> which is now the preferred attribute to convey that the nature of
> the contents of such a region allows it to be mapped read-only
> (i.e., it contains .text and .rodata only). The specification of
> the existing EFI_MEMORY_WP attribute has been updated to align
> more closely with its common use as a cacheability attribute rather
> than a permission attribute.
> 
> Add the #define and add the attribute to the memory map dumping
> routine.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/firmware/efi/efi.c | 8 +++++---
>  include/linux/efi.h        | 1 +
>  2 files changed, 6 insertions(+), 3 deletions(-)

Thanks Ard, applied.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-28 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 10:42 [PATCH] efi: add support for EFI_MEMORY_RO attribute introduced by UEFIv2.5 Ard Biesheuvel
     [not found] ` <1435142544-10014-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-06-24 11:47   ` Laszlo Ersek
2015-06-28 14:35   ` Matt Fleming

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.