linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure
@ 2020-03-12  1:13 Qiuxu Zhuo
  2020-03-14  3:23 ` Kees Cook
  2020-03-25 17:34 ` Ard Biesheuvel
  0 siblings, 2 replies; 4+ messages in thread
From: Qiuxu Zhuo @ 2020-03-12  1:13 UTC (permalink / raw)
  To: ardb, keescook; +Cc: tony.luck, matt, liming.gao, linux-efi, Qiuxu Zhuo

The 'nr_config_table' and 'config_table' (already in efi structure)
in efi structure provide a way for some driver(e.g. capsule-pstore
goes through the configuration table to extract crash capsules to
aid in debugging) to iterate over the EFI configuration table array.

Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 arch/x86/platform/efi/efi.c     | 1 +
 drivers/firmware/efi/arm-init.c | 4 +++-
 drivers/firmware/efi/efi.c      | 1 +
 include/linux/efi.h             | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index ae923ee8e2b4..2f3065905e8a 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -456,6 +456,7 @@ void __init efi_init(void)
 		return;
 
 	efi.config_table = (unsigned long)efi.systab->tables;
+	efi.nr_config_table = (unsigned long)efi.systab->nr_tables;
 	efi.fw_vendor	 = (unsigned long)efi.systab->fw_vendor;
 	efi.runtime	 = (unsigned long)efi.systab->runtime;
 
diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index d99f5b0c8a09..f2e2e1c1624b 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -143,8 +143,10 @@ static int __init uefi_init(void)
 					 sizeof(efi_config_table_t),
 					 arch_tables);
 
-	if (!retval)
+	if (!retval) {
 		efi.config_table = (unsigned long)efi.systab->tables;
+		efi.nr_config_table = (unsigned long)efi.systab->nr_tables;
+	}
 
 	early_memunmap(config_tables, table_size);
 out:
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 621220ab3d0e..1b599941bad3 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -46,6 +46,7 @@ struct efi __read_mostly efi = {
 	.fw_vendor		= EFI_INVALID_TABLE_ADDR,
 	.runtime		= EFI_INVALID_TABLE_ADDR,
 	.config_table		= EFI_INVALID_TABLE_ADDR,
+	.nr_config_table	= 0,
 	.esrt			= EFI_INVALID_TABLE_ADDR,
 	.properties_table	= EFI_INVALID_TABLE_ADDR,
 	.mem_attr_table		= EFI_INVALID_TABLE_ADDR,
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 7efd7072cca5..13b3fe069f1f 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -913,6 +913,7 @@ extern struct efi {
 	unsigned long fw_vendor;	/* fw_vendor */
 	unsigned long runtime;		/* runtime table */
 	unsigned long config_table;	/* config tables */
+	unsigned long nr_config_table; /* the number of config tables */
 	unsigned long esrt;		/* ESRT table */
 	unsigned long properties_table;	/* properties table */
 	unsigned long mem_attr_table;	/* memory attributes table */
-- 
2.17.1


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

* Re: [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure
  2020-03-12  1:13 [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure Qiuxu Zhuo
@ 2020-03-14  3:23 ` Kees Cook
  2020-03-15 13:20   ` Zhuo, Qiuxu
  2020-03-25 17:34 ` Ard Biesheuvel
  1 sibling, 1 reply; 4+ messages in thread
From: Kees Cook @ 2020-03-14  3:23 UTC (permalink / raw)
  To: Qiuxu Zhuo; +Cc: ardb, tony.luck, matt, liming.gao, linux-efi

On Thu, Mar 12, 2020 at 09:13:24AM +0800, Qiuxu Zhuo wrote:
> The 'nr_config_table' and 'config_table' (already in efi structure)
> in efi structure provide a way for some driver(e.g. capsule-pstore
> goes through the configuration table to extract crash capsules to
> aid in debugging) to iterate over the EFI configuration table array.
> 
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
> ---
>  arch/x86/platform/efi/efi.c     | 1 +
>  drivers/firmware/efi/arm-init.c | 4 +++-
>  drivers/firmware/efi/efi.c      | 1 +
>  include/linux/efi.h             | 1 +
>  4 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index ae923ee8e2b4..2f3065905e8a 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -456,6 +456,7 @@ void __init efi_init(void)
>  		return;
>  
>  	efi.config_table = (unsigned long)efi.systab->tables;
> +	efi.nr_config_table = (unsigned long)efi.systab->nr_tables;
>  	efi.fw_vendor	 = (unsigned long)efi.systab->fw_vendor;
>  	efi.runtime	 = (unsigned long)efi.systab->runtime;
>  
> diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
> index d99f5b0c8a09..f2e2e1c1624b 100644
> --- a/drivers/firmware/efi/arm-init.c
> +++ b/drivers/firmware/efi/arm-init.c
> @@ -143,8 +143,10 @@ static int __init uefi_init(void)
>  					 sizeof(efi_config_table_t),
>  					 arch_tables);
>  
> -	if (!retval)
> +	if (!retval) {
>  		efi.config_table = (unsigned long)efi.systab->tables;
> +		efi.nr_config_table = (unsigned long)efi.systab->nr_tables;
> +	}
>  
>  	early_memunmap(config_tables, table_size);
>  out:
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 621220ab3d0e..1b599941bad3 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -46,6 +46,7 @@ struct efi __read_mostly efi = {
>  	.fw_vendor		= EFI_INVALID_TABLE_ADDR,
>  	.runtime		= EFI_INVALID_TABLE_ADDR,
>  	.config_table		= EFI_INVALID_TABLE_ADDR,
> +	.nr_config_table	= 0,
>  	.esrt			= EFI_INVALID_TABLE_ADDR,
>  	.properties_table	= EFI_INVALID_TABLE_ADDR,
>  	.mem_attr_table		= EFI_INVALID_TABLE_ADDR,
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 7efd7072cca5..13b3fe069f1f 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -913,6 +913,7 @@ extern struct efi {
>  	unsigned long fw_vendor;	/* fw_vendor */
>  	unsigned long runtime;		/* runtime table */
>  	unsigned long config_table;	/* config tables */
> +	unsigned long nr_config_table; /* the number of config tables */

nit: please use a tab character before the comment to get correct
alignemnt.

>  	unsigned long esrt;		/* ESRT table */
>  	unsigned long properties_table;	/* properties table */
>  	unsigned long mem_attr_table;	/* memory attributes table */
> -- 
> 2.17.1
> 

-- 
Kees Cook

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

* RE: [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure
  2020-03-14  3:23 ` Kees Cook
@ 2020-03-15 13:20   ` Zhuo, Qiuxu
  0 siblings, 0 replies; 4+ messages in thread
From: Zhuo, Qiuxu @ 2020-03-15 13:20 UTC (permalink / raw)
  To: Kees Cook; +Cc: ardb, Luck, Tony, matt, Gao, Liming, linux-efi

> From: linux-efi-owner@vger.kernel.org <linux-efi-owner@vger.kernel.org> On  Behalf Of Kees Cook
>> ...
> >  	unsigned long runtime;		/* runtime table */
> >  	unsigned long config_table;	/* config tables */
> > +	unsigned long nr_config_table; /* the number of config tables */
> 
> nit: please use a tab character before the comment to get correct alignemnt.

OK. Will correct it. Thanks!

-Qiuxu

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

* Re: [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure
  2020-03-12  1:13 [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure Qiuxu Zhuo
  2020-03-14  3:23 ` Kees Cook
@ 2020-03-25 17:34 ` Ard Biesheuvel
  1 sibling, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2020-03-25 17:34 UTC (permalink / raw)
  To: Qiuxu Zhuo; +Cc: Kees Cook, Tony Luck, Matt Fleming, Gao, Liming, linux-efi

On Thu, 12 Mar 2020 at 02:12, Qiuxu Zhuo <qiuxu.zhuo@intel.com> wrote:
>
> The 'nr_config_table' and 'config_table' (already in efi structure)
> in efi structure provide a way for some driver(e.g. capsule-pstore
> goes through the configuration table to extract crash capsules to
> aid in debugging) to iterate over the EFI configuration table array.
>
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>

As indicated in my reply to your cover letter, I don't think we need
this patch. Please drop it.

> ---
>  arch/x86/platform/efi/efi.c     | 1 +
>  drivers/firmware/efi/arm-init.c | 4 +++-
>  drivers/firmware/efi/efi.c      | 1 +
>  include/linux/efi.h             | 1 +
>  4 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index ae923ee8e2b4..2f3065905e8a 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -456,6 +456,7 @@ void __init efi_init(void)
>                 return;
>
>         efi.config_table = (unsigned long)efi.systab->tables;
> +       efi.nr_config_table = (unsigned long)efi.systab->nr_tables;
>         efi.fw_vendor    = (unsigned long)efi.systab->fw_vendor;
>         efi.runtime      = (unsigned long)efi.systab->runtime;
>
> diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
> index d99f5b0c8a09..f2e2e1c1624b 100644
> --- a/drivers/firmware/efi/arm-init.c
> +++ b/drivers/firmware/efi/arm-init.c
> @@ -143,8 +143,10 @@ static int __init uefi_init(void)
>                                          sizeof(efi_config_table_t),
>                                          arch_tables);
>
> -       if (!retval)
> +       if (!retval) {
>                 efi.config_table = (unsigned long)efi.systab->tables;
> +               efi.nr_config_table = (unsigned long)efi.systab->nr_tables;
> +       }
>
>         early_memunmap(config_tables, table_size);
>  out:
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 621220ab3d0e..1b599941bad3 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -46,6 +46,7 @@ struct efi __read_mostly efi = {
>         .fw_vendor              = EFI_INVALID_TABLE_ADDR,
>         .runtime                = EFI_INVALID_TABLE_ADDR,
>         .config_table           = EFI_INVALID_TABLE_ADDR,
> +       .nr_config_table        = 0,
>         .esrt                   = EFI_INVALID_TABLE_ADDR,
>         .properties_table       = EFI_INVALID_TABLE_ADDR,
>         .mem_attr_table         = EFI_INVALID_TABLE_ADDR,
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 7efd7072cca5..13b3fe069f1f 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -913,6 +913,7 @@ extern struct efi {
>         unsigned long fw_vendor;        /* fw_vendor */
>         unsigned long runtime;          /* runtime table */
>         unsigned long config_table;     /* config tables */
> +       unsigned long nr_config_table; /* the number of config tables */
>         unsigned long esrt;             /* ESRT table */
>         unsigned long properties_table; /* properties table */
>         unsigned long mem_attr_table;   /* memory attributes table */
> --
> 2.17.1
>

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

end of thread, other threads:[~2020-03-25 17:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12  1:13 [PATCH v6 1/2] efi: Add 'nr_config_table' variable in efi structure Qiuxu Zhuo
2020-03-14  3:23 ` Kees Cook
2020-03-15 13:20   ` Zhuo, Qiuxu
2020-03-25 17:34 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).