All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: Override runtime supported mask from a EFI variable if present
@ 2022-11-09 17:27 ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2022-11-09 17:27 UTC (permalink / raw)
  To: linux-efi; +Cc: linux-arm-kernel, alexandru.elisei, Ard Biesheuvel

For debugging purposes, allow the runtime override mask to be set from a
EFI variable if one exists. For instance, the RT supported mask can be
set to 0xfffd to disable the SetTime() runtime service, and enable all
others:

  echo -ne "\x7\0\0\0\xfd\xff" \
    > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/efi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index a46df5d1d0942751..faed1ef78c044924 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
 		}
 	}
 
-	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
+		unsigned long size = sizeof(efi.runtime_supported_mask);
+
+		if (efi.get_variable(L"LinuxRtMaskOverride",
+				     &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
+				     &efi.runtime_supported_mask) == EFI_SUCCESS)
+			pr_info("Overriding runtime_supported_mask to 0x%x\n",
+				efi.runtime_supported_mask);
+	}
+
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
 		platform_device_register_simple("rtc-efi", 0, NULL, 0);
 
 	/* We register the efi directory at /sys/firmware/efi */
-- 
2.35.1


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

* [PATCH] efi: Override runtime supported mask from a EFI variable if present
@ 2022-11-09 17:27 ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2022-11-09 17:27 UTC (permalink / raw)
  To: linux-efi; +Cc: linux-arm-kernel, alexandru.elisei, Ard Biesheuvel

For debugging purposes, allow the runtime override mask to be set from a
EFI variable if one exists. For instance, the RT supported mask can be
set to 0xfffd to disable the SetTime() runtime service, and enable all
others:

  echo -ne "\x7\0\0\0\xfd\xff" \
    > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/efi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index a46df5d1d0942751..faed1ef78c044924 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
 		}
 	}
 
-	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
+		unsigned long size = sizeof(efi.runtime_supported_mask);
+
+		if (efi.get_variable(L"LinuxRtMaskOverride",
+				     &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
+				     &efi.runtime_supported_mask) == EFI_SUCCESS)
+			pr_info("Overriding runtime_supported_mask to 0x%x\n",
+				efi.runtime_supported_mask);
+	}
+
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
 		platform_device_register_simple("rtc-efi", 0, NULL, 0);
 
 	/* We register the efi directory at /sys/firmware/efi */
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] efi: Override runtime supported mask from a EFI variable if present
  2022-11-09 17:27 ` Ard Biesheuvel
@ 2022-11-10 14:37   ` Alexandru Elisei
  -1 siblings, 0 replies; 6+ messages in thread
From: Alexandru Elisei @ 2022-11-10 14:37 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, linux-arm-kernel

Hi,

On Wed, Nov 09, 2022 at 06:27:50PM +0100, Ard Biesheuvel wrote:
> For debugging purposes, allow the runtime override mask to be set from a
> EFI variable if one exists. For instance, the RT supported mask can be
> set to 0xfffd to disable the SetTime() runtime service, and enable all
> others:
> 
>   echo -ne "\x7\0\0\0\xfd\xff" \
>     > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9

I'm really sorry, I applied this patch, but I couldn't find the file
(LinuxRtMaskOverride*) under efivars, and couldn't find another way of
setting the variable.

Thanks,
Alex

> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  drivers/firmware/efi/efi.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index a46df5d1d0942751..faed1ef78c044924 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
>  		}
>  	}
>  
> -	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
> +	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
> +		unsigned long size = sizeof(efi.runtime_supported_mask);
> +
> +		if (efi.get_variable(L"LinuxRtMaskOverride",
> +				     &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
> +				     &efi.runtime_supported_mask) == EFI_SUCCESS)
> +			pr_info("Overriding runtime_supported_mask to 0x%x\n",
> +				efi.runtime_supported_mask);
> +	}
> +
> +	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
>  		platform_device_register_simple("rtc-efi", 0, NULL, 0);
>  
>  	/* We register the efi directory at /sys/firmware/efi */
> -- 
> 2.35.1
> 

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

* Re: [PATCH] efi: Override runtime supported mask from a EFI variable if present
@ 2022-11-10 14:37   ` Alexandru Elisei
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandru Elisei @ 2022-11-10 14:37 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, linux-arm-kernel

Hi,

On Wed, Nov 09, 2022 at 06:27:50PM +0100, Ard Biesheuvel wrote:
> For debugging purposes, allow the runtime override mask to be set from a
> EFI variable if one exists. For instance, the RT supported mask can be
> set to 0xfffd to disable the SetTime() runtime service, and enable all
> others:
> 
>   echo -ne "\x7\0\0\0\xfd\xff" \
>     > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9

I'm really sorry, I applied this patch, but I couldn't find the file
(LinuxRtMaskOverride*) under efivars, and couldn't find another way of
setting the variable.

Thanks,
Alex

> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  drivers/firmware/efi/efi.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index a46df5d1d0942751..faed1ef78c044924 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
>  		}
>  	}
>  
> -	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
> +	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
> +		unsigned long size = sizeof(efi.runtime_supported_mask);
> +
> +		if (efi.get_variable(L"LinuxRtMaskOverride",
> +				     &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
> +				     &efi.runtime_supported_mask) == EFI_SUCCESS)
> +			pr_info("Overriding runtime_supported_mask to 0x%x\n",
> +				efi.runtime_supported_mask);
> +	}
> +
> +	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
>  		platform_device_register_simple("rtc-efi", 0, NULL, 0);
>  
>  	/* We register the efi directory at /sys/firmware/efi */
> -- 
> 2.35.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] efi: Override runtime supported mask from a EFI variable if present
  2022-11-10 14:37   ` Alexandru Elisei
@ 2022-11-11  7:51     ` Ard Biesheuvel
  -1 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2022-11-11  7:51 UTC (permalink / raw)
  To: Alexandru Elisei; +Cc: linux-efi, linux-arm-kernel

On Thu, 10 Nov 2022 at 15:37, Alexandru Elisei <alexandru.elisei@arm.com> wrote:
>
> Hi,
>
> On Wed, Nov 09, 2022 at 06:27:50PM +0100, Ard Biesheuvel wrote:
> > For debugging purposes, allow the runtime override mask to be set from a
> > EFI variable if one exists. For instance, the RT supported mask can be
> > set to 0xfffd to disable the SetTime() runtime service, and enable all
> > others:
> >
> >   echo -ne "\x7\0\0\0\xfd\xff" \
> >     > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9
>
> I'm really sorry, I applied this patch, but I couldn't find the file
> (LinuxRtMaskOverride*) under efivars, and couldn't find another way of
> setting the variable.
>

The variable will be created by writing to the file.

But no worries, I think we have enough context now. I've queued up the
patch that checks the SMBIOS record for Altra machines.


> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> >  drivers/firmware/efi/efi.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> > index a46df5d1d0942751..faed1ef78c044924 100644
> > --- a/drivers/firmware/efi/efi.c
> > +++ b/drivers/firmware/efi/efi.c
> > @@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
> >               }
> >       }
> >
> > -     if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
> > +     if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
> > +             unsigned long size = sizeof(efi.runtime_supported_mask);
> > +
> > +             if (efi.get_variable(L"LinuxRtMaskOverride",
> > +                                  &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
> > +                                  &efi.runtime_supported_mask) == EFI_SUCCESS)
> > +                     pr_info("Overriding runtime_supported_mask to 0x%x\n",
> > +                             efi.runtime_supported_mask);
> > +     }
> > +
> > +     if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
> >               platform_device_register_simple("rtc-efi", 0, NULL, 0);
> >
> >       /* We register the efi directory at /sys/firmware/efi */
> > --
> > 2.35.1
> >

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

* Re: [PATCH] efi: Override runtime supported mask from a EFI variable if present
@ 2022-11-11  7:51     ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2022-11-11  7:51 UTC (permalink / raw)
  To: Alexandru Elisei; +Cc: linux-efi, linux-arm-kernel

On Thu, 10 Nov 2022 at 15:37, Alexandru Elisei <alexandru.elisei@arm.com> wrote:
>
> Hi,
>
> On Wed, Nov 09, 2022 at 06:27:50PM +0100, Ard Biesheuvel wrote:
> > For debugging purposes, allow the runtime override mask to be set from a
> > EFI variable if one exists. For instance, the RT supported mask can be
> > set to 0xfffd to disable the SetTime() runtime service, and enable all
> > others:
> >
> >   echo -ne "\x7\0\0\0\xfd\xff" \
> >     > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9
>
> I'm really sorry, I applied this patch, but I couldn't find the file
> (LinuxRtMaskOverride*) under efivars, and couldn't find another way of
> setting the variable.
>

The variable will be created by writing to the file.

But no worries, I think we have enough context now. I've queued up the
patch that checks the SMBIOS record for Altra machines.


> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> >  drivers/firmware/efi/efi.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> > index a46df5d1d0942751..faed1ef78c044924 100644
> > --- a/drivers/firmware/efi/efi.c
> > +++ b/drivers/firmware/efi/efi.c
> > @@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
> >               }
> >       }
> >
> > -     if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
> > +     if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
> > +             unsigned long size = sizeof(efi.runtime_supported_mask);
> > +
> > +             if (efi.get_variable(L"LinuxRtMaskOverride",
> > +                                  &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
> > +                                  &efi.runtime_supported_mask) == EFI_SUCCESS)
> > +                     pr_info("Overriding runtime_supported_mask to 0x%x\n",
> > +                             efi.runtime_supported_mask);
> > +     }
> > +
> > +     if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
> >               platform_device_register_simple("rtc-efi", 0, NULL, 0);
> >
> >       /* We register the efi directory at /sys/firmware/efi */
> > --
> > 2.35.1
> >

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-11-11  7:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 17:27 [PATCH] efi: Override runtime supported mask from a EFI variable if present Ard Biesheuvel
2022-11-09 17:27 ` Ard Biesheuvel
2022-11-10 14:37 ` Alexandru Elisei
2022-11-10 14:37   ` Alexandru Elisei
2022-11-11  7:51   ` Ard Biesheuvel
2022-11-11  7:51     ` Ard Biesheuvel

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.