diff mbox series

[v2,1/1] use EFI_RT_PROPERTIES_TABLE, not variable

Message ID 20201015184841.4339-1-xypron.glpk@gmx.de
State Rejected
Headers show
Series [v2,1/1] use EFI_RT_PROPERTIES_TABLE, not variable | expand

Commit Message

Heinrich Schuchardt Oct. 15, 2020, 6:48 p.m. UTC
The UEFI 2.8 specification introduced the RuntimeServicesSupported EFI
variable. In the UEFI 2.8 specification (Errata A) this variable was
marked invalid and replaced by the EFI_RT_PROPERTIES_TABLE configuration
table.

If a RuntimeServicesSupported variable is not found, this does not indicate
that runtime services are not avaiable. As of v5.9 the efi_test driver of
the Linux kernel does not provide access to the EFI_RT_PROPERTIES_TABLE
configuration table. So lets assume that all services are implemented. If
they are not supported they will signal this by returning EFI_UNSUPPORTED.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2:
	correct subject line
---
 src/lib/src/fwts_uefi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--
2.28.0

Comments

Colin Ian King Oct. 15, 2020, 9:02 p.m. UTC | #1
On 15/10/2020 19:48, Heinrich Schuchardt wrote:
> The UEFI 2.8 specification introduced the RuntimeServicesSupported EFI
> variable. In the UEFI 2.8 specification (Errata A) this variable was
> marked invalid and replaced by the EFI_RT_PROPERTIES_TABLE configuration
> table.
> 
> If a RuntimeServicesSupported variable is not found, this does not indicate
> that runtime services are not avaiable. As of v5.9 the efi_test driver of
> the Linux kernel does not provide access to the EFI_RT_PROPERTIES_TABLE
> configuration table. So lets assume that all services are implemented. If
> they are not supported they will signal this by returning EFI_UNSUPPORTED.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> 	correct subject line
> ---
>  src/lib/src/fwts_uefi.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index 0fb6b799..aeddb153 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -543,6 +543,9 @@ bool fwts_uefi_efivars_iface_exist(void)
>   *  fwts_uefi_rt_support_status_get()
>   *	get the status of runtime service support and the value of
>   *	the RuntimeServicesSupported variable
> + *
> + *  This variable only exists in UEFI 2.8 but not in UEFI 2.8 (Errata A) ff.
> + *  TODO: evaluate the EFI_RT_PROPERTIES_TABLE configuration table.
>   */
>  void fwts_uefi_rt_support_status_get(int fd, bool *getvar_supported, uint32_t *var_rtsupported)
>  {
> @@ -569,11 +572,8 @@ void fwts_uefi_rt_support_status_get(int fd, bool *getvar_supported, uint32_t *v
> 
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable);
>  	if (ioret == -1) {
> -		if (status == EFI_NOT_FOUND) {
> -			*getvar_supported = true;
> -		} else {
> -			*getvar_supported = false;
> -		}
> +		*getvar_supported = true;
> +		*var_rtsupported = 0x3fff;
>  		return;
>  	}
> 
> --
> 2.28.0
> 

I think this looks OK, I'll tentatively ACK this, but I'd like Ivan or
Alex's input on this as they know this area better than me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu Oct. 19, 2020, 3:33 a.m. UTC | #2
Hi Heinrich,

The fwts_uefi_rt_support_status_get function is used to check/get the
RuntimeServicesSupported variable then do the separate tests for the
some UEFI runtime services(variable, time and misc) and compare to the
actual implementation of the firmware. This will not be used to check
the implementation of UEFI runtime services, FWTS UEFI tests  will
default do most of the runtime service tests, only the separate
RuntimeServicesSupported tests will follow the existence of
RuntimeServicesSupported.
Doing this will cause the RuntimeServicesSupported tests to be run and
get the false results.


Cheers,
Ivan



On 10/16/20 2:48 AM, Heinrich Schuchardt wrote:
> The UEFI 2.8 specification introduced the RuntimeServicesSupported EFI
> variable. In the UEFI 2.8 specification (Errata A) this variable was
> marked invalid and replaced by the EFI_RT_PROPERTIES_TABLE configuration
> table.
> 
> If a RuntimeServicesSupported variable is not found, this does not indicate
> that runtime services are not avaiable. As of v5.9 the efi_test driver of
> the Linux kernel does not provide access to the EFI_RT_PROPERTIES_TABLE
> configuration table. So lets assume that all services are implemented. If
> they are not supported they will signal this by returning EFI_UNSUPPORTED.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> 	correct subject line
> ---
>  src/lib/src/fwts_uefi.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index 0fb6b799..aeddb153 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -543,6 +543,9 @@ bool fwts_uefi_efivars_iface_exist(void)
>   *  fwts_uefi_rt_support_status_get()
>   *	get the status of runtime service support and the value of
>   *	the RuntimeServicesSupported variable
> + *
> + *  This variable only exists in UEFI 2.8 but not in UEFI 2.8 (Errata A) ff.
> + *  TODO: evaluate the EFI_RT_PROPERTIES_TABLE configuration table.
>   */
>  void fwts_uefi_rt_support_status_get(int fd, bool *getvar_supported, uint32_t *var_rtsupported)
>  {
> @@ -569,11 +572,8 @@ void fwts_uefi_rt_support_status_get(int fd, bool *getvar_supported, uint32_t *v
> 
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable);
>  	if (ioret == -1) {
> -		if (status == EFI_NOT_FOUND) {
> -			*getvar_supported = true;
> -		} else {
> -			*getvar_supported = false;
> -		}
> +		*getvar_supported = true;
> +		*var_rtsupported = 0x3fff;
>  		return;
>  	}
> 
> --
> 2.28.0
>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
index 0fb6b799..aeddb153 100644
--- a/src/lib/src/fwts_uefi.c
+++ b/src/lib/src/fwts_uefi.c
@@ -543,6 +543,9 @@  bool fwts_uefi_efivars_iface_exist(void)
  *  fwts_uefi_rt_support_status_get()
  *	get the status of runtime service support and the value of
  *	the RuntimeServicesSupported variable
+ *
+ *  This variable only exists in UEFI 2.8 but not in UEFI 2.8 (Errata A) ff.
+ *  TODO: evaluate the EFI_RT_PROPERTIES_TABLE configuration table.
  */
 void fwts_uefi_rt_support_status_get(int fd, bool *getvar_supported, uint32_t *var_rtsupported)
 {
@@ -569,11 +572,8 @@  void fwts_uefi_rt_support_status_get(int fd, bool *getvar_supported, uint32_t *v

 	ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable);
 	if (ioret == -1) {
-		if (status == EFI_NOT_FOUND) {
-			*getvar_supported = true;
-		} else {
-			*getvar_supported = false;
-		}
+		*getvar_supported = true;
+		*var_rtsupported = 0x3fff;
 		return;
 	}