Skip to contentSkip to conversation

efi/arm64: store Runtime Services revision

PATCH Superseded Semen Protsenko 4 participants 6 messages Aug 14, 2014 – Oct 13, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi/arm64: store Runtime Services revision

"efi" global data structure contains "runtime_version" field which must be assigned in order to use it later in Runtime Services virtual calls (virt_efi_* functions).

Before this patch "runtime_version" was unassigned (0), so each Runtime Service virtual call that checks revision would fail.

Runtime Services revision being passed in UEFI system table from UEFI to kernel (see efi_entry() function). In UEFI it's being stored at MdePkg/Include/Uefi/UefiSpec.h as EFI_RUNTIME_SERVICES_REVISION.

---
 arch/arm64/kernel/efi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/efi.c +2 -0
index e72f310..5dbb7bd 100644
@@ -463,6 +463,8 @@ static int __init arm64_enter_virtual_mode(void)
 	efi_native_runtime_setup();
 	set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 
+	efi.runtime_version = efi.systab->hdr.revision;
+
 	return 0;
 
 err_unmap:
Signature · 1 line
2.0.1
#1 lore raw

PATCH 1/1 efi/arm64: store Runtime Services revision

Quoted 11 lines · Semen Protsenko

"efi" global data structure contains "runtime_version" field which must be assigned in order to use it later in Runtime Services virtual calls (virt_efi_* functions).

Before this patch "runtime_version" was unassigned (0), so each Runtime Service virtual call that checks revision would fail.

Runtime Services revision being passed in UEFI system table from UEFI to kernel (see efi_entry() function). In UEFI it's being stored at MdePkg/Include/Uefi/UefiSpec.h as EFI_RUNTIME_SERVICES_REVISION.

Could you drop the last line with the Tianocore path? Tianocore is just one of the many UEFI implementations the kernel should be compatible with, so where it happens to store this value is not entirely relevant.

Quoted 1 line
Quoted 20 lines
---
 arch/arm64/kernel/efi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/efi.c +2 -1
index e72f310..5dbb7bd 100644
@@ -463,6 +463,8 @@ static int __init arm64_enter_virtual_mode(void)
        efi_native_runtime_setup();
        set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 
+       efi.runtime_version = efi.systab->hdr.revision;
+
        return 0;
 
 err_unmap:
--

2.0.1

#2 lore raw

PATCH 1/1 efi/arm64: store Runtime Services revision

In reply to Semen Protsenko
Quoted 21 lines · Semen Protsenko

"efi" global data structure contains "runtime_version" field which must be assigned in order to use it later in Runtime Services virtual calls (virt_efi_* functions).

Before this patch "runtime_version" was unassigned (0), so each Runtime Service virtual call that checks revision would fail.

Runtime Services revision being passed in UEFI system table from UEFI to kernel (see efi_entry() function). In UEFI it's being stored at MdePkg/Include/Uefi/UefiSpec.h as EFI_RUNTIME_SERVICES_REVISION.

---
 arch/arm64/kernel/efi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/efi.c +0 -0
index e72f310..5dbb7bd 100644

arch/arm64/kernel/efi.c static int __init arm64_enter_virtual_mode(void) · line 468

Quoted 6 lines
arch/arm64/kernel/efi.c +2 -0
@@ -463,6 +463,8 @@ static int __init arm64_enter_virtual_mode(void)
 	efi_native_runtime_setup();
 	set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 
+	efi.runtime_version = efi.systab->hdr.revision;
+
 	return 0;

I doubt it makes any difference, but can we assign this before we call efi_native_runtime_setup please?

Will

#3 lore raw

PATCH 1/1 efi/arm64: store Runtime Services revision

Quoted 3 lines · Will Deacon

I doubt it makes any difference, but can we assign this before we call efi_native_runtime_setup please?

This would have to be a follow up patch, v2 of this patch is already in Linus' tree as commit 6a7519e81321.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#4 lore raw

PATCH 1/1 efi/arm64: store Runtime Services revision

Quoted 7 lines · Matt Fleming
Quoted 3 lines · Will Deacon

I doubt it makes any difference, but can we assign this before we call efi_native_runtime_setup please?

This would have to be a follow up patch, v2 of this patch is already in Linus' tree as commit 6a7519e81321.

Ah, ok, I wouldn't worry about it then. I was just trawling the list for arm64 patches without me on CC in case I missed anything during the kernel summit.

Thanks for picking it up!

Will

#5 lore raw

PATCH 1/1 efi/arm64: store Runtime Services revision

In reply to Will Deacon
Quoted 1 line

I doubt it makes any difference

It really does. The whole reason I made this patch is that I was unable to call UpdateCapsule() runtime service, because when you try to call it, kernel code first tests if we have UEFI with certain Runtime Services revision. In this code (drivers/firmware/efi/runtime.c):

static efi_status_t virt_efi_update_capsule(efi_capsule_header_t **capsules,
unsigned long count, unsigned long sg_list)

{
        if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
                return EFI_UNSUPPORTED;

        return efi_call_virt(update_capsule, capsules, count, sg_list);
}

Condition is false, because efi.runtime_version == 0. The same stuff was happening about some other Runtime Services. So this patch just fixes this.

Quoted 1 line

but can we assign this before we call efi_native_runtime_setup please?

Yeah, it's quite late for this as patch is already upstreamed :) Anyway, if you could explain why it's essential -- I can make another patch moving this code to correct place.

Quoted 33 lines · Will Deacon
Quoted 21 lines · Semen Protsenko

"efi" global data structure contains "runtime_version" field which must be assigned in order to use it later in Runtime Services virtual calls (virt_efi_* functions).

Before this patch "runtime_version" was unassigned (0), so each Runtime Service virtual call that checks revision would fail.

Runtime Services revision being passed in UEFI system table from UEFI to kernel (see efi_entry() function). In UEFI it's being stored at MdePkg/Include/Uefi/UefiSpec.h as EFI_RUNTIME_SERVICES_REVISION.

---
 arch/arm64/kernel/efi.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/efi.c +0 -0
index e72f310..5dbb7bd 100644

arch/arm64/kernel/efi.c static int __init arm64_enter_virtual_mode(void) · line 468

Quoted 6 lines
arch/arm64/kernel/efi.c +2 -0
@@ -463,6 +463,8 @@ static int __init arm64_enter_virtual_mode(void)
      efi_native_runtime_setup();
      set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 
+     efi.runtime_version = efi.systab->hdr.revision;
+
      return 0;

I doubt it makes any difference, but can we assign this before we call efi_native_runtime_setup please?

Will