ACK: [PATCH v2 2/2] uefi: fix fwts_uefi_rt_support_status_get()

Alex Hung alex.hung at canonical.com
Wed Mar 10 19:26:18 UTC 2021


On 2021-03-09 11:23 p.m., ivanhu wrote:
> Revisit this patch, the linux kernel sets the
> RuntimeServicesSupported mask as all supported(0x3fff), when
> EFI_RT_PROPERTIES_TABLE is not gotten. It might need to modify the
> default value in kernel.
> 
> Ler's apply this patch and see if there are any side effects or false
> alarms for those firmware which hasn't suppored the
> EFI_RT_PROPERTIES_TABLE, and I'll send out fix patches accordingly.
> 
> 
> Acked-by: Ivan Hu <ivan.hu at canonical.com>

Acked-by: Alex Hung <alex.hung at canonical.com>

> 
> 
> On 1/8/21 7:06 PM, Heinrich Schuchardt wrote:
>> On 08.01.21 08:49, ivanhu wrote:
>>>
>>>
>>> On 1/8/21 3:44 PM, ivanhu wrote:
>>>>
>>>>
>>>> On 1/8/21 10:48 AM, ivanhu wrote:
>>>>>
>>>>>
>>>>> On 1/7/21 8:02 PM, Heinrich Schuchardt wrote:
>>>>>> On 07.01.21 08:34, Heinrich Schuchardt wrote:
>>>>>>> On 1/7/21 8:22 AM, ivanhu wrote:
>>>>>>>>
>>>>>>>> On 1/7/21 3:01 PM, Heinrich Schuchardt wrote:
>>>>>>>>> On 1/7/21 3:29 AM, ivanhu wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 1/6/21 3:59 PM, Heinrich Schuchardt wrote:
>>>>>>>>>>> On 06.01.21 07:23, ivanhu wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 12/29/20 2:57 AM, Heinrich Schuchardt wrote:
>>>>>>>>>>>>> The UEFI 2.8 Errata A specification has clarified that
>>>>>>>>>>>>> RuntimeServicesSupported is not a UEFI variable but a value in the
>>>>>>>>>>>>> EFI_RT_PROPERTIES_TABLE configuration table. Since Linux 5.11 the
>>>>>>>>>>>>> value can
>>>>>>>>>>>>> be retrieved via an IOCTL call.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Replace the code trying to read the non-existent
>>>>>>>>>>>>> RuntimeServicesSupported
>>>>>>>>>>>>> variable by the IOCTL call.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>>>>>>>>>>>>> ---
>>>>>>>>>>>>>    src/lib/include/fwts_uefi.h              |  4 +-
>>>>>>>>>>>>>    src/lib/src/fwts_uefi.c                  | 49 +++++-----------
>>>>>>>>>>>>>    src/uefi/uefirtmisc/uefirtmisc.c         | 27 ++++-----
>>>>>>>>>>>>>    src/uefi/uefirttime/uefirttime.c         | 72
>>>>>>>>>>>>> ++++++++++--------------
>>>>>>>>>>>>>    src/uefi/uefirtvariable/uefirtvariable.c | 72
>>>>>>>>>>>>> ++++++++++--------------
>>>>>>>>>>>>>    5 files changed, 87 insertions(+), 137 deletions(-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> diff --git a/src/lib/include/fwts_uefi.h
>>>>>>>>>>>>> b/src/lib/include/fwts_uefi.h
>>>>>>>>>>>>> index 36cd5824..24e2962e 100644
>>>>>>>>>>>>> --- a/src/lib/include/fwts_uefi.h
>>>>>>>>>>>>> +++ b/src/lib/include/fwts_uefi.h
>>>>>>>>>>>>> @@ -137,6 +137,8 @@ enum {
>>>>>>>>>>>>>    #define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES    0x1000
>>>>>>>>>>>>>    #define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO        0x2000
>>>>>>>>>>>>>
>>>>>>>>>>>>> +#define EFI_RT_SUPPORTED_ALL                0x3fff
>>>>>>>>>>>>> +
>>>>>>>>>>>>>    #define EFI_CERT_SHA256_GUID \
>>>>>>>>>>>>>    { 0xc1c41626, 0x504c, 0x4092, { 0xac, 0xa9, 0x41, 0xf9, 0x36,
>>>>>>>>>>>>> 0x93, 0x43, 0x28 }}
>>>>>>>>>>>>>
>>>>>>>>>>>>> @@ -680,7 +682,7 @@ char *fwts_uefi_attribute_info(uint32_t attr);
>>>>>>>>>>>>>
>>>>>>>>>>>>>    bool fwts_uefi_efivars_iface_exist(void);
>>>>>>>>>>>>>
>>>>>>>>>>>>> -void fwts_uefi_rt_support_status_get(int fd, bool
>>>>>>>>>>>>> *getvar_supported, uint32_t *var_rtsupported);
>>>>>>>>>>>>> +void fwts_uefi_rt_support_status_get(int fd, bool
>>>>>>>>>>>>> *have_rtsupported, uint32_t *var_rtsupported);
>>>>>>>>>>>>>
>>>>>>>>>>>>>    PRAGMA_POP
>>>>>>>>>>>>>
>>>>>>>>>>>>> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
>>>>>>>>>>>>> index 0fb6b799..131e187b 100644
>>>>>>>>>>>>> --- a/src/lib/src/fwts_uefi.c
>>>>>>>>>>>>> +++ b/src/lib/src/fwts_uefi.c
>>>>>>>>>>>>> @@ -541,45 +541,26 @@ 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
>>>>>>>>>>>>> + *    get the status of runtime service support.
>>>>>>>>>>>>> + *
>>>>>>>>>>>>> + *    Since UEFI 2.8 Errata A the EFI_RT_PROPERTIES_TABLE
>>>>>>>>>>>>> configuration table
>>>>>>>>>>>>> + *    can be used to indicate which UEFI runtime services are not
>>>>>>>>>>>>> implemented
>>>>>>>>>>>>> + *    via the bitmask RuntimeServicesSupported. If the table is
>>>>>>>>>>>>> not present,
>>>>>>>>>>>>> + *    all runtime services are to be considered available. Since
>>>>>>>>>>>>> Linux 5.11
>>>>>>>>>>>>> + *    this bitmask can be read via an IOCTL call. Before Linux
>>>>>>>>>>>>> 5.11 the value
>>>>>>>>>>>>> + *    cannot be determined.
>>>>>>>>>>>>>     */
>>>>>>>>>>>>> -void fwts_uefi_rt_support_status_get(int fd, bool
>>>>>>>>>>>>> *getvar_supported, uint32_t *var_rtsupported)
>>>>>>>>>>>>> +void fwts_uefi_rt_support_status_get(int fd, bool
>>>>>>>>>>>>> *have_rtsupported, uint32_t *var_rtsupported)
>>>>>>>>>>>>>    {
>>>>>>>>>>>>>        long ioret;
>>>>>>>>>>>>> -    struct efi_getvariable getvariable;
>>>>>>>>>>>>> -    uint64_t status = ~0ULL;
>>>>>>>>>>>>> -    uint8_t data[512];
>>>>>>>>>>>>> -    uint64_t getdatasize = sizeof(data);
>>>>>>>>>>>>> -    *var_rtsupported = 0xFFFF;
>>>>>>>>>>>>> -
>>>>>>>>>>>>> -    uint32_t attributes = FWTS_UEFI_VAR_NON_VOLATILE |
>>>>>>>>>>>>> -                FWTS_UEFI_VAR_BOOTSERVICE_ACCESS |
>>>>>>>>>>>>> -                FWTS_UEFI_VAR_RUNTIME_ACCESS;
>>>>>>>>>>>>> -    static uint16_t varname[] = {'R', 'u', 'n', 't', 'i', 'm',
>>>>>>>>>>>>> 'e', 'S', 'e',
>>>>>>>>>>>>> -                'r', 'v', 'i', 'c', 'e', 's', 'S', 'u', 'p',
>>>>>>>>>>>>> -                'p', 'o', 'r', 't', 'e', 'd', '\0'};
>>>>>>>>>>>>> -    EFI_GUID global_var_guid = EFI_GLOBAL_VARIABLE;
>>>>>>>>>>>>> -    getvariable.VariableName = varname;
>>>>>>>>>>>>> -    getvariable.VendorGuid = &global_var_guid;
>>>>>>>>>>>>> -    getvariable.Attributes = &attributes;
>>>>>>>>>>>>> -    getvariable.DataSize = &getdatasize;
>>>>>>>>>>>>> -    getvariable.Data = data;
>>>>>>>>>>>>> -    getvariable.status = &status;
>>>>>>>>>>>>> -
>>>>>>>>>>>>> -    ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable);
>>>>>>>>>>>>> +
>>>>>>>>>>>>> +    ioret = ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK,
>>>>>>>>>>>>> var_rtsupported);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>> -        if (status == EFI_NOT_FOUND) {
>>>>>>>>>>>>> -            *getvar_supported = true;
>>>>>>>>>>>>> -        } else {
>>>>>>>>>>>>> -            *getvar_supported = false;
>>>>>>>>>>>>> -        }
>>>>>>>>>>>>> -        return;
>>>>>>>>>>>>> +        *have_rtsupported = false;
>>>>>>>>>>>>> +        *var_rtsupported = EFI_RT_SUPPORTED_ALL;
>>>>>>>>>>>>> +    } else {
>>>>>>>>>>>>> +        *have_rtsupported = true;
>>>>>>>>>>>>>        }
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    *getvar_supported = true;
>>>>>>>>>>>>> -    *var_rtsupported = data[0] | data[1] << 8;
>>>>>>>>>>>>> -
>>>>>>>>>>>>>        return;
>>>>>>>>>>>>> -
>>>>>>>>>>>>>    }
>>>>>>>>>>>>> diff --git a/src/uefi/uefirtmisc/uefirtmisc.c
>>>>>>>>>>>>> b/src/uefi/uefirtmisc/uefirtmisc.c
>>>>>>>>>>>>> index a2dc6967..c0d3835a 100644
>>>>>>>>>>>>> --- a/src/uefi/uefirtmisc/uefirtmisc.c
>>>>>>>>>>>>> +++ b/src/uefi/uefirtmisc/uefirtmisc.c
>>>>>>>>>>>>> @@ -245,20 +245,18 @@ static int uefirtmisc_test4(fwts_framework
>>>>>>>>>>>>> *fw)
>>>>>>>>>>>>>    {
>>>>>>>>>>>>>        long ioret;
>>>>>>>>>>>>>        uint64_t status;
>>>>>>>>>>>>> -    bool getvar_supported;
>>>>>>>>>>>>> +    bool have_rtsupported;
>>>>>>>>>>>>>        uint32_t var_runtimeservicessupported;
>>>>>>>>>>>>>
>>>>>>>>>>>>>        struct efi_getnexthighmonotoniccount
>>>>>>>>>>>>> getnexthighmonotoniccount;
>>>>>>>>>>>>>        uint32_t highcount;
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    fwts_uefi_rt_support_status_get(fd, &getvar_supported,
>>>>>>>>>>>>> +    fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
>>>>>>>>>>>>>                &var_runtimeservicessupported);
>>>>>>>>>>>>> -    if (!getvar_supported || (var_runtimeservicessupported ==
>>>>>>>>>>>>> 0xFFFF)) {
>>>>>>>>>>>>> +    if (!have_rtsupported) {
>>>>>>>>>>>>>            fwts_skipped(fw, "Cannot get the
>>>>>>>>>>>>> RuntimeServicesSupported "
>>>>>>>>>>>>> -                "variable, maybe the runtime service "
>>>>>>>>>>>>> -                "GetVariable is not supported or "
>>>>>>>>>>>>> -                "RuntimeServicesSupported not provided by "
>>>>>>>>>>>>> -                "firmware.");
>>>>>>>>>>>>> +                 "mask from the kernel. This IOCTL was "
>>>>>>>>>>>>> +                 "introduced in Linux v5.11.");
>>>>>>>>>>>>
>>>>>>>>>>>> Not only kernel need to support this IOCTL, but Bios need to
>>>>>>>>>>>> support the
>>>>>>>>>>>> RuntimeServicesSupported from system config table. Please also add
>>>>>>>>>>>> some
>>>>>>>>>>>> description for the skip reasons that maybe from the Bios not support
>>>>>>>>>>>> RuntimeServicesSupported(UEFI 2.8a).
>>>>>>>>>>>
>>>>>>>>>>> Hello Ivan,
>>>>>>>>>>>
>>>>>>>>>>> thanks for reviewing.
>>>>>>>>>>>
>>>>>>>>>>> I do not understand what you mean by "but Bios need to support the
>>>>>>>>>>> RuntimeServicesSupported from system config table".
>>>>>>>>>>>
>>>>>>>>>>> UEFI firmware will only expose an EFI_RT_PROPERTIES_TABLE if a runtime
>>>>>>>>>>> service is *not* implemented. If EFI_RT_PROPERTIES_TABLE is not
>>>>>>>>>>> exposed,
>>>>>>>>>>> this signals all runtime services are implemented.
>>>>>>>>>>>
>>>>>>>>>>> For UEFI <= 2.7 EFI_RT_PROPERTIES_TABLE does not exist but the
>>>>>>>>>>> firmware
>>>>>>>>>>> is obliged to implement all runtime services.
>>>>>>>>>>
>>>>>>>>>> Is taht true?, as I know RuntimeServicesSupported was introduced
>>>>>>>>>> because
>>>>>>>>>> lots of ARM devices cannot implement all runtime services.
>>>>>>>>>
>>>>>>>>> Where is the contradiction?
>>>>>>>>>
>>>>>>>>> U-Boot's runtime services on these boards were never compliant to UEFI
>>>>>>>>> <= 2.7 and the FWTS should indicate this.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> The tests uefirttime_test38, uefirtmisc_test4 and uefirtvariable_test9
>>>>>>>>>> test the consistency between RuntimeServicesSupported and actually
>>>>>>>>>> implemented by firmware. So I prefer these tests are only checked for
>>>>>>>>>> the Firmware which supports UEFI 2.8a(RuntimeServicesSupported).
>>>>>>>>>
>>>>>>>>> Which UEFI specification that is being followed is shown in the EFI
>>>>>>>>> system table in the field FirmwareRevision. The current value is:
>>>>>>>>>
>>>>>>>>> #define EFI_2_80_SYSTEM_TABLE_REVISION ((2<<16) | (80))
>>>>>>>>>
>>>>>>>>> You cannot identify if is 2.8, 2.8A, or 2.8B.
>>>>>>>>
>>>>>>>> SInce RuntimeServicesSupported from EFI_RT_PROPERTIES_TABLE was
>>>>>>>> introduced after 2.8a,
>>>>>>>>
>>>>>>>> I think just simply skip the tests when RuntimeServicesSupported is not
>>>>>>>> found, instead of assuming all runtime services supported for those
>>>>>>>> firmware which actually not implemented RuntimeServicesSupported.
>>>>>>>>
>>>>>>>> Or we might get a lot of failed results returned and get confused on
>>>>>>>> those machines without RuntimeServicesSupported supported.
>>>>>>>>
>>>>>>>
>>>>>>> Firmware without EFI_RT_PROPERTIES_TABLE have to implement all UEFI
>>>>>>> runtime services.
>>>>>>>
>>>>>>> have_rtsupported tells you if the kernel implements the IOCTL and not if
>>>>>>> EFI_RT_PROPERTIES_TABLE exists in the firmware.
>>>>>>>
>>>>>>> It makes sense to skip these tests if the IOCTL is not implemented.
>>>>>>>
>>>>>>> I will adjust the patch accordingly.
>>>>>>
>>>>>> The patch as is already skips the tests if the IOCTl is not implemented.
>>>>>>
>>>>>> If the IOCTL is implemented, Linux will either return the value of
>>>>>> RuntimeServicesSupported from EFI_RT_PROPERTIES_TABLE or if
>>>>>> EFI_RT_PROPERTIES_TABLE does not exist, it will EFI_RT_SUPPORTED_ALL=0x3fff.
>>>>>
>>>>> This should be modified doing such assume, I'll revisit it when I get a
>>>>> machine which has the UEFI 2.8a included.
>>>>>
>>>>>>
>>>>>> In both cases it is correct to assume that for each bit set the runtime
>>>>>> service should not return EFI_UNSUPPORTED because either UEFI <= 2.7
>>>>>> does not allow it or the firmware put a wrong value into
>>>>>> EFI_RT_PROPERTIES_TABLE for UEFI >= 2.8.
>>>>>
>>>>> It just does make sence to use RuntimeServicesSupported(which introdued
>>>> ^donesn't
>>>
>>> sorry, typo,
>>> Let me rephase it,
>>> I think it doesn't make sense to use RuntimeServicesSupported to do the
>>> RuntimeServicesSupported consistency tests for those machines without
>>> RuntimeServicesSupported.
>>
>> The UEFI revision is exposed by the firmeware via the system table field
>> FirmwareRevision.
>>
>> You cannot differentiate betweeen UEFI 2.8 and UEFI 2.8 errata A. Both
>> use value EFI_2_80_SYSTEM_TABLE_REVISION = ((2<<16) | (80)).
>>
>> The Linux variable efi.runtime_version holds this value.
>>
>> The system log shows a line like
>> [  +0.000000] efi: EFI v2.80 by Das U-Boot
>> written by Linux function efi_systab_report_header() in
>> drivers/firmware/efi/efi.c indicating the UEFI revision.
>>
>> So these are the options to detect the UEFI revision in FWTS:
>>
>> * parse the system log
>> * add another IOCTL
>> * change the EFI_RUNTIME_GET_SUPPORTED_MASK IOCTL to consider
>>   the version
>>
>> Best regards
>>
>> Heinrich
>>
>>>
>>> Cheers,
>>> Ivan
>>>
>>>>> in 2.8a to test RuntimeServicesSupported consistency for those machines
>>>>> without RuntimeServicesSupported <2.8a.
>>>>>
>>>>> Cheers,
>>>>> Ivan
>>>>>
>>>>>>
>>>>>> Best regards
>>>>>>
>>>>>> Heinrich
>>>>>>>>>>>
>>>>>>>>>>> For UEFI >= 2.8A EFI_RT_PROPERTIES_TABLE is only required if any of
>>>>>>>>>>> the
>>>>>>>>>>> runtime services is *not* implemented.
>>>>>>>>>>>
>>>>>>>>>>> Linux will correctly consider all runtime services as available if
>>>>>>>>>>> EFI_RT_PROPERTIES_TABLE does not exist in the firmware.
>>>>>>>>>>>
>>>>>>>>>>> See drivers/firmware/efi/efi.c. Here runtime_supported_mask
>>>>>>>>>>> defaults to
>>>>>>>>>>> EFI_RT_SUPPORTED_ALL (0x3fff). Only if the firmware exposes an
>>>>>>>>>>> EFI_RT_PROPERTIES_TABLE Linux sets runtime_supported_mask to the
>>>>>>>>>>> actual
>>>>>>>>>>> value of RuntimeServicesSupported in function
>>>>>>>>>>> efi_config_parse_tables().
>>>>>>>>>>>
>>>>>>>>>>> The only reason for skipping here is a Linux version below 5.11.
>>>>>>>>>>>
>>>>>>>>>>> Best regards
>>>>>>>>>>>
>>>>>>>>>>> Heinrich
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>            return FWTS_SKIP;
>>>>>>>>>>>>>        }
>>>>>>>>>>>>>
>>>>>>>>>>>>> @@ -268,13 +266,12 @@ static int uefirtmisc_test4(fwts_framework
>>>>>>>>>>>>> *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT,
>>>>>>>>>>>>> &getnexthighmonotoniccount);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>>                        "UEFIRuntimeGetNextHighMonotonicCount",
>>>>>>>>>>>>>                        "Get the GetNextHighMonotonicCount runtime "
>>>>>>>>>>>>>                        "service supported via
>>>>>>>>>>>>> RuntimeServicesSupported "
>>>>>>>>>>>>> -                    "variable. But actually is not supported by "
>>>>>>>>>>>>> +                    "mask. But actually is not supported by "
>>>>>>>>>>>>>                        "firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetNextHighMonotonicCount
>>>>>>>>>>>>> runtime "
>>>>>>>>>>>>> @@ -285,8 +282,7 @@ static int uefirtmisc_test4(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetNextHighMonotonicCount
>>>>>>>>>>>>> runtime "
>>>>>>>>>>>>>                        "service supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>> @@ -294,7 +290,7 @@ static int uefirtmisc_test4(fwts_framework *fw)
>>>>>>>>>>>>>                        "UEFIRuntimeGetNextHighMonotonicCount",
>>>>>>>>>>>>>                        "Get the GetNextHighMonotonicCount runtime "
>>>>>>>>>>>>>                        "service unsupported via
>>>>>>>>>>>>> RuntimeServicesSupported "
>>>>>>>>>>>>> -                    "variable. But actually is supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>> +                    "mask. But actually is supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        } else {
>>>>>>>>>>>>> @@ -302,8 +298,7 @@ static int uefirtmisc_test4(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI GetNextHighMonotonicCount
>>>>>>>>>>>>> runtime "
>>>>>>>>>>>>>                    "service supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>> @@ -311,7 +306,7 @@ static int uefirtmisc_test4(fwts_framework *fw)
>>>>>>>>>>>>>                    "UEFIRuntimeGetNextHighMonotonicCount",
>>>>>>>>>>>>>                    "Get the GetNextHighMonotonicCount runtime "
>>>>>>>>>>>>>                    "service unsupported via
>>>>>>>>>>>>> RuntimeServicesSupported "
>>>>>>>>>>>>> -                "variable. But actually is supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>> +                "mask. But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>>
>>>>>>>>>>>>> diff --git a/src/uefi/uefirttime/uefirttime.c
>>>>>>>>>>>>> b/src/uefi/uefirttime/uefirttime.c
>>>>>>>>>>>>> index e0aa7071..3bbac718 100644
>>>>>>>>>>>>> --- a/src/uefi/uefirttime/uefirttime.c
>>>>>>>>>>>>> +++ b/src/uefi/uefirttime/uefirttime.c
>>>>>>>>>>>>> @@ -1142,7 +1142,7 @@ static int uefirttime_test37(fwts_framework
>>>>>>>>>>>>> *fw)
>>>>>>>>>>>>>    static int uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>    {
>>>>>>>>>>>>>        long ioret;
>>>>>>>>>>>>> -    bool getvar_supported;
>>>>>>>>>>>>> +    bool have_rtsupported;
>>>>>>>>>>>>>        uint32_t var_runtimeservicessupported;
>>>>>>>>>>>>>
>>>>>>>>>>>>>        struct efi_settime settime;
>>>>>>>>>>>>> @@ -1155,15 +1155,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>        EFI_TIME efi_time;
>>>>>>>>>>>>>        EFI_TIME_CAPABILITIES efi_time_cap;
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    fwts_uefi_rt_support_status_get(fd, &getvar_supported,
>>>>>>>>>>>>> +    fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
>>>>>>>>>>>>>                &var_runtimeservicessupported);
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    if (!getvar_supported || (var_runtimeservicessupported ==
>>>>>>>>>>>>> 0xFFFF)) {
>>>>>>>>>>>>> +    if (!have_rtsupported) {
>>>>>>>>>>>>>            fwts_skipped(fw, "Cannot get the
>>>>>>>>>>>>> RuntimeServicesSupported "
>>>>>>>>>>>>> -                "variable, maybe the runtime service "
>>>>>>>>>>>>> -                "GetVariable is not supported or "
>>>>>>>>>>>>> -                "RuntimeServicesSupported not provided by "
>>>>>>>>>>>>> -                "firmware.");
>>>>>>>>>>>>> +                 "mask from the kernel. This IOCTL was "
>>>>>>>>>>>>> +                 "introduced in Linux v5.11.");
>>>>>>>>>>>>
>>>>>>>>>>>> same here.
>>>>>>>>>>>>
>>>>>>>>>>>>>            return FWTS_SKIP;
>>>>>>>>>>>>>        }
>>>>>>>>>>>>>
>>>>>>>>>>>>> @@ -1173,11 +1171,10 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_TIME) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetTime",
>>>>>>>>>>>>>                        "Get the GetTime runtime service supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetTime runtime service "
>>>>>>>>>>>>> @@ -1188,14 +1185,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_TIME) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetTime runtime service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetTime",
>>>>>>>>>>>>>                        "Get the GetTime runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -1204,14 +1200,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_TIME)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_TIME) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI GetTime runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
>>>>>>>>>>>>>                    "Get the GetTime runtime service unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> @@ -1223,11 +1218,10 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_TIME) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetTime",
>>>>>>>>>>>>>                        "Get the SetTime runtime service supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI SetTime runtime service "
>>>>>>>>>>>>> @@ -1238,14 +1232,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_TIME) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI SetTime runtime service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetTime",
>>>>>>>>>>>>>                        "Get the SetTime runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -1254,14 +1247,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_TIME)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_TIME) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI SetTime runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime",
>>>>>>>>>>>>>                    "Get the SetTime runtime service unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> @@ -1274,11 +1266,10 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_WAKEUP_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_WAKEUP_TIME) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetWakeupTime",
>>>>>>>>>>>>>                        "Get the SetWakeupTime runtime service
>>>>>>>>>>>>> supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by firmware");
>>>>>>>>>>>>>
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>> @@ -1290,14 +1281,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_WAKEUP_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_WAKEUP_TIME) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI SetWakeupTime runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetWakeupTime",
>>>>>>>>>>>>>                        "Get the SetWakeupTime runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -1306,14 +1296,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_WAKEUP_TIME)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_WAKEUP_TIME) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI SetWakeupTime runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetWakeupTime",
>>>>>>>>>>>>>                    "Get the SetWakeupTime runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> @@ -1326,11 +1315,10 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, &getwakeuptime);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_WAKEUP_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_WAKEUP_TIME) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetWakeupTime",
>>>>>>>>>>>>>                        "Get the GetWakeupTime runtime service
>>>>>>>>>>>>> supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by firmware");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetWakeupTime runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>> @@ -1341,14 +1329,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_WAKEUP_TIME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_WAKEUP_TIME) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetWakeupTime runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetWakeupTime",
>>>>>>>>>>>>>                        "Get the GetWakeupTime runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -1357,14 +1344,13 @@ static int
>>>>>>>>>>>>> uefirttime_test38(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknow error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_WAKEUP_TIME)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_WAKEUP_TIME) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI GetWakeupTime runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetWakeupTime",
>>>>>>>>>>>>>                    "Get the GetWakeupTime runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c
>>>>>>>>>>>>> b/src/uefi/uefirtvariable/uefirtvariable.c
>>>>>>>>>>>>> index 713803dc..1fcde5e4 100644
>>>>>>>>>>>>> --- a/src/uefi/uefirtvariable/uefirtvariable.c
>>>>>>>>>>>>> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
>>>>>>>>>>>>> @@ -2020,7 +2020,7 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>    {
>>>>>>>>>>>>>        long ioret;
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    bool getvar_supported;
>>>>>>>>>>>>> +    bool have_rtsupported;
>>>>>>>>>>>>>        uint32_t var_runtimeservicessupported;
>>>>>>>>>>>>>
>>>>>>>>>>>>>        struct efi_getvariable getvariable;
>>>>>>>>>>>>> @@ -2041,15 +2041,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>        uint64_t getdatasize = sizeof(testdata);
>>>>>>>>>>>>>        uint32_t attr;
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    fwts_uefi_rt_support_status_get(fd, &getvar_supported,
>>>>>>>>>>>>> +    fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
>>>>>>>>>>>>>                &var_runtimeservicessupported);
>>>>>>>>>>>>>
>>>>>>>>>>>>> -    if (!getvar_supported || (var_runtimeservicessupported ==
>>>>>>>>>>>>> 0xFFFF)) {
>>>>>>>>>>>>> +    if (!have_rtsupported) {
>>>>>>>>>>>>>            fwts_skipped(fw, "Cannot get the
>>>>>>>>>>>>> RuntimeServicesSupported "
>>>>>>>>>>>>> -                "variable, maybe the runtime service "
>>>>>>>>>>>>> -                "GetVariable is not supported or "
>>>>>>>>>>>>> -                "RuntimeServicesSupported not provided by "
>>>>>>>>>>>>> -                "firmware.");
>>>>>>>>>>>>> +                 "mask from the kernel. This IOCTL was "
>>>>>>>>>>>>> +                 "introduced in Linux v5.11.");
>>>>>>>>>>>>
>>>>>>>>>>>> same here.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> Ivan
>>>>>>>>>>>>
>>>>>>>>>>>>>            return FWTS_SKIP;
>>>>>>>>>>>>>        }
>>>>>>>>>>>>>
>>>>>>>>>>>>> @@ -2063,11 +2061,10 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_VARIABLE)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_VARIABLE) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetVariable",
>>>>>>>>>>>>>                        "Get the Setvariable runtime service
>>>>>>>>>>>>> supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI SetVariable runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>> @@ -2078,14 +2075,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_VARIABLE) ||
>>>>>>>>>>>>> -                (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_VARIABLE) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI SetVariable runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetVariable",
>>>>>>>>>>>>>                        "Get the SetVariable runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -2094,14 +2090,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_VARIABLE) ||
>>>>>>>>>>>>> -            (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_SET_VARIABLE) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI SetVariable runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeSetVariable",
>>>>>>>>>>>>>                    "Get the SetVariable runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> @@ -2116,11 +2111,10 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_VARIABLE)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_VARIABLE) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetVariable",
>>>>>>>>>>>>>                        "Get the GetVariable runtime service
>>>>>>>>>>>>> supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetVariable runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>> @@ -2131,14 +2125,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_VARIABLE) ||
>>>>>>>>>>>>> -                (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_VARIABLE) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetVariable runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetVariable",
>>>>>>>>>>>>>                        "Get the GetVariable runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -2147,14 +2140,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_VARIABLE) ||
>>>>>>>>>>>>> -            (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_VARIABLE) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI GetVariable runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetVariable",
>>>>>>>>>>>>>                    "Get the GetVariable runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> @@ -2179,11 +2171,10 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME,
>>>>>>>>>>>>> &getnextvariablename);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetNextVarName",
>>>>>>>>>>>>>                        "Get the GetNextVarName runtime service
>>>>>>>>>>>>> supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetNextVarName runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>> @@ -2194,14 +2185,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI GetNextVarName runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetNextVarName",
>>>>>>>>>>>>>                        "Get the GetNextVarName runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -2210,14 +2200,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI GetNextVarName runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeGetNextVarName",
>>>>>>>>>>>>>                    "Get the GetNextVarName runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> @@ -2232,11 +2221,10 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>        ioret = ioctl(fd, EFI_RUNTIME_QUERY_VARIABLEINFO,
>>>>>>>>>>>>> &queryvariableinfo);
>>>>>>>>>>>>>        if (ioret == -1) {
>>>>>>>>>>>>>            if (status == EFI_UNSUPPORTED) {
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeQueryVarInfo",
>>>>>>>>>>>>>                        "Get the QueryVarInfo runtime service
>>>>>>>>>>>>> supported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is not supported by
>>>>>>>>>>>>> firmware.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI QueryVarInfo runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>> @@ -2247,14 +2235,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                    fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                    return FWTS_SKIP;
>>>>>>>>>>>>>                }
>>>>>>>>>>>>> -            if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)
>>>>>>>>>>>>> -                || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +            if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) {
>>>>>>>>>>>>>                    fwts_passed(fw, "UEFI QueryVarInfo runtime
>>>>>>>>>>>>> service "
>>>>>>>>>>>>>                        "supported status test passed.");
>>>>>>>>>>>>>                } else {
>>>>>>>>>>>>>                    fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeQueryVarInfo",
>>>>>>>>>>>>>                        "Get the QueryVarInfo runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                    "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                    "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                        "But actually is supported by firmware.");
>>>>>>>>>>>>>                }
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> @@ -2263,14 +2250,13 @@ static int
>>>>>>>>>>>>> uefirtvariable_test9(fwts_framework *fw)
>>>>>>>>>>>>>                fwts_skipped(fw, "Unknown error occurred, skip
>>>>>>>>>>>>> test.");
>>>>>>>>>>>>>                return FWTS_SKIP;
>>>>>>>>>>>>>            }
>>>>>>>>>>>>> -        if ((var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)
>>>>>>>>>>>>> -            || (var_runtimeservicessupported == 0)) {
>>>>>>>>>>>>> +        if (var_runtimeservicessupported &
>>>>>>>>>>>>> EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) {
>>>>>>>>>>>>>                fwts_passed(fw, "UEFI QueryVarInfo runtime service "
>>>>>>>>>>>>>                    "supported status test passed.");
>>>>>>>>>>>>>            } else {
>>>>>>>>>>>>>                fwts_failed(fw, LOG_LEVEL_HIGH,
>>>>>>>>>>>>> "UEFIRuntimeQueryVarInfo",
>>>>>>>>>>>>>                    "Get the QueryVarInfo runtime service
>>>>>>>>>>>>> unsupported "
>>>>>>>>>>>>> -                "via RuntimeServicesSupported variable. "
>>>>>>>>>>>>> +                "via RuntimeServicesSupported mask. "
>>>>>>>>>>>>>                    "But actually is supported by firmware.");
>>>>>>>>>>>>>            }
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> 2.29.2
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>
>>
> 


-- 
Cheers,
Alex Hung



More information about the fwts-devel mailing list