<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 12/3/20 2:48 PM, Heinrich Schuchardt
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:5c5ed9f7-616d-877c-6bc2-a2deef89b532@gmx.de">On 12/3/20
2:20 AM, ivanhu wrote:
<br>
<blockquote type="cite">
<br>
<br>
On 12/2/20 7:38 PM, Heinrich Schuchardt wrote:
<br>
<blockquote type="cite">On 11/30/20 11:38 AM, ivanhu wrote:
<br>
<blockquote type="cite">
<br>
<br>
On 11/30/20 5:17 PM, Heinrich Schuchardt wrote:
<br>
<blockquote type="cite">On 11/30/20 9:16 AM, ivanhu wrote:
<br>
<blockquote type="cite">Hi Heinrich,
<br>
<br>
Thanks for the patch.
<br>
It looks good to me, but I noticed that the
runtime_supported_mask was
<br>
introduced after 5.7-rc1.
<br>
Maybe we should add the kernel version checking for the
old kernels.
<br>
</blockquote>
<br>
This is a kernel patch. Why should we check the kernel
version in the
<br>
kernel code?
<br>
<br>
As patches may be back-ported we should not make any
assumptions in fwts
<br>
based on the kernel version. If the ioctl() call fails
with errno =
<br>
ENOTTY, we know that the kernel does not implement the
ioctl call and we
<br>
have to assume that all runtime services are available.
<br>
</blockquote>
<br>
Sounds good to me,
<br>
Acked-by: Ivan Hu <a class="moz-txt-link-rfc2396E" href="mailto:ivan.hu@canonical.com"><ivan.hu@canonical.com></a>
<br>
<br>
And I will replace the reading RuntimeServicesSupported efi
variable by
<br>
using efi_test in fwts RuntimeServicesSupported tests.
<br>
<br>
FWTS will still test those Unsupported Runtime services to
check if it
<br>
returns EFI_UNSUPPORTED correctly.
<br>
Is that could solve your problem?
<br>
If I remember correctly, the problem from you is not to test
those
<br>
marked Unsupported Runtime services. But from the Spec. 8.1
Runtime
<br>
Services Rules and Restrictions,
<br>
</blockquote>
<br>
The problem I reported was that it is impossible to test UEFI
runtime
<br>
services on U-Boot because FWTS tries to read the non-existent
<br>
RuntimeServicesSupported UEFI variable and mistakenly assumes
that if
<br>
the variable does not exist none of the runtime services is
implemented.
<br>
</blockquote>
<br>
Could you provide the result log for me to check?
<br>
</blockquote>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/U-Boot-EFI/u-boot-fwts-results/blob/master/fwts_20_11_fails.txt">https://github.com/U-Boot-EFI/u-boot-fwts-results/blob/master/fwts_20_11_fails.txt</a>
<br>
</blockquote>
<p>From the result log, they all skip from <span style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">"Cannot open EFI test driver. Aborted." </span>which
seems fail on open the /dev/efi_test, not related to the
RuntimeServicesSupported.</p>
<p>I also tested with my X86 machine which hasn't supported the
RuntimeServicesSupported variable as well, it won't meet the
issue.</p>
<p>FWTS currently will run all the UEFI tests and try to get
RuntimeServicesSupported for testing in some runtime services
support test, such as,<br>
</p>
<p>Test 36 of 36: Test UEFI RT time services supported status.<br>
SKIPPED: Test 36, Cannot get the RuntimeServicesSupported
variable, maybe the<br>
runtime service GetVariable is not supported or
RuntimeServicesSupported not<br>
provided by firmware.</p>
<p><br>
</p>
<p>Cheers,<br>
</p>
<p>Ivan<br>
</p>
<blockquote type="cite"
cite="mid:5c5ed9f7-616d-877c-6bc2-a2deef89b532@gmx.de">
<br>
is the results log from FWTS 20.11.
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/U-Boot-EFI/u-boot-fwts-results/blob/master/results-2020-10-31.txt">https://github.com/U-Boot-EFI/u-boot-fwts-results/blob/master/results-2020-10-31.txt</a>
<br>
<br>
is the results log from a FWTS built from this branch:
<br>
<a class="moz-txt-link-freetext" href="https://github.com/xypron/fwts/commits/bugfixes">https://github.com/xypron/fwts/commits/bugfixes</a>
<br>
<br>
Best regards
<br>
<br>
Heinrich
<br>
<br>
<blockquote type="cite">
<br>
Ivan
<br>
<blockquote type="cite">
<br>
The correct thing to do in FWTS is:
<br>
<br>
* read RuntimeServicesSupported via the ioctl
<br>
* if the ioctl fails assume that all runtime services
<br>
are implemented
<br>
* if the ioctl fails with errno != ENOTTY write an error
message
<br>
* for each runtime service marked as not supported
<br>
check that it returns EFI_UNSUPPORTED
<br>
* for each service marked as supported
<br>
check that it works correctly
<br>
<br>
Best regards
<br>
<br>
Heinrich
<br>
<br>
<blockquote type="cite">"
<br>
Note that this is merely a hint to the OS, which it is free
to ignore,
<br>
and so the platform is still required to provide callable
<br>
implementations of unsupported runtime services that simply
return
<br>
EFI_UNSUPPORTED.
<br>
"
<br>
<br>
Cheers,
<br>
Ivan
<br>
<blockquote type="cite">
<br>
Best regards
<br>
<br>
Heinrich
<br>
<br>
<blockquote type="cite">
<br>
Cheers,
<br>
Ivan
<br>
<br>
On 11/28/20 3:20 AM, Heinrich Schuchardt wrote:
<br>
<blockquote type="cite">Since the UEFI 2.8A
specification the UEFI enabled firmware provides a
<br>
configuration table EFI_RT_PROPERTIES_TABLE which
indicates which
<br>
runtime
<br>
services are enabled. The EFI stub reads this table
and saves the
<br>
value of
<br>
the field RuntimeServicesSupported internally.
<br>
<br>
The Firmware Test Suite requires the value to
determine if UEFI
<br>
runtime
<br>
services are correctly implemented.
<br>
<br>
With this patch an IOCTL call is provided to read the
value of the
<br>
field
<br>
RuntimeServicesSupported, e.g.
<br>
<br>
#define EFI_RUNTIME_GET_SUPPORTED_MASK \
<br>
_IOR('p', 0x0C, unsigned int)
<br>
unsigned int mask;
<br>
fd = open("/dev/efi_test", O_RDWR);
<br>
ret = ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK,
&mask);
<br>
<br>
Signed-off-by: Heinrich Schuchardt
<a class="moz-txt-link-rfc2396E" href="mailto:xypron.glpk@gmx.de"><xypron.glpk@gmx.de></a>
<br>
---
<br>
drivers/firmware/efi/test/efi_test.c | 16
++++++++++++++++
<br>
drivers/firmware/efi/test/efi_test.h | 3 +++
<br>
2 files changed, 19 insertions(+)
<br>
<br>
diff --git a/drivers/firmware/efi/test/efi_test.c
<br>
b/drivers/firmware/efi/test/efi_test.c
<br>
index ddf9eae396fe..47d67bb0a516 100644
<br>
--- a/drivers/firmware/efi/test/efi_test.c
<br>
+++ b/drivers/firmware/efi/test/efi_test.c
<br>
@@ -663,6 +663,19 @@ static long
<br>
efi_runtime_query_capsulecaps(unsigned long arg)
<br>
return rv;
<br>
}
<br>
<br>
+static long efi_runtime_get_supported_mask(unsigned
long arg)
<br>
+{
<br>
+ unsigned int __user *supported_mask;
<br>
+ int rv = 0;
<br>
+
<br>
+ supported_mask = (unsigned int *)arg;
<br>
+
<br>
+ if (put_user(efi.runtime_supported_mask,
supported_mask))
<br>
+ rv = -EFAULT;
<br>
+
<br>
+ return rv;
<br>
+}
<br>
+
<br>
static long efi_test_ioctl(struct file *file,
unsigned int cmd,
<br>
unsigned long arg)
<br>
{
<br>
@@ -699,6 +712,9 @@ static long efi_test_ioctl(struct
file *file,
<br>
unsigned int cmd,
<br>
<br>
case EFI_RUNTIME_RESET_SYSTEM:
<br>
return efi_runtime_reset_system(arg);
<br>
+
<br>
+ case EFI_RUNTIME_GET_SUPPORTED_MASK:
<br>
+ return efi_runtime_get_supported_mask(arg);
<br>
}
<br>
<br>
return -ENOTTY;
<br>
diff --git a/drivers/firmware/efi/test/efi_test.h
<br>
b/drivers/firmware/efi/test/efi_test.h
<br>
index f2446aa1c2e3..117349e57993 100644
<br>
--- a/drivers/firmware/efi/test/efi_test.h
<br>
+++ b/drivers/firmware/efi/test/efi_test.h
<br>
@@ -118,4 +118,7 @@ struct efi_resetsystem {
<br>
#define EFI_RUNTIME_RESET_SYSTEM \
<br>
_IOW('p', 0x0B, struct efi_resetsystem)
<br>
<br>
+#define EFI_RUNTIME_GET_SUPPORTED_MASK \
<br>
+ _IOR('p', 0x0C, unsigned int)
<br>
+
<br>
#endif /* _DRIVERS_FIRMWARE_EFI_TEST_H_ */
<br>
--
<br>
2.29.2
<br>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</body>
</html>