Skip to content

Commit f80c9f6

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
efi/x86: Remove support for EFI time and counter services in mixed mode
Mixed mode calls at runtime are rather tricky with vmap'ed stacks, as we can no longer assume that data passed in by the callers of the EFI runtime wrapper routines is contiguous in physical memory. We need to fix this, but before we do, let's drop the implementations of routines that we know are never used on x86, i.e., the RTC related ones. Given that UEFI rev2.8 permits any runtime service to return EFI_UNSUPPORTED at runtime, let's return that instead. As get_next_high_mono_count() is never used at all, even on other architectures, let's make that return EFI_UNSUPPORTED too. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: [email protected] Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 63056e8 commit f80c9f6

File tree

1 file changed

+5
-76
lines changed

1 file changed

+5
-76
lines changed

arch/x86/platform/efi/efi_64.c

Lines changed: 5 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -568,85 +568,25 @@ efi_thunk_set_virtual_address_map(unsigned long memory_map_size,
568568

569569
static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc)
570570
{
571-
efi_status_t status;
572-
u32 phys_tm, phys_tc;
573-
unsigned long flags;
574-
575-
spin_lock(&rtc_lock);
576-
spin_lock_irqsave(&efi_runtime_lock, flags);
577-
578-
phys_tm = virt_to_phys_or_null(tm);
579-
phys_tc = virt_to_phys_or_null(tc);
580-
581-
status = efi_thunk(get_time, phys_tm, phys_tc);
582-
583-
spin_unlock_irqrestore(&efi_runtime_lock, flags);
584-
spin_unlock(&rtc_lock);
585-
586-
return status;
571+
return EFI_UNSUPPORTED;
587572
}
588573

589574
static efi_status_t efi_thunk_set_time(efi_time_t *tm)
590575
{
591-
efi_status_t status;
592-
u32 phys_tm;
593-
unsigned long flags;
594-
595-
spin_lock(&rtc_lock);
596-
spin_lock_irqsave(&efi_runtime_lock, flags);
597-
598-
phys_tm = virt_to_phys_or_null(tm);
599-
600-
status = efi_thunk(set_time, phys_tm);
601-
602-
spin_unlock_irqrestore(&efi_runtime_lock, flags);
603-
spin_unlock(&rtc_lock);
604-
605-
return status;
576+
return EFI_UNSUPPORTED;
606577
}
607578

608579
static efi_status_t
609580
efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
610581
efi_time_t *tm)
611582
{
612-
efi_status_t status;
613-
u32 phys_enabled, phys_pending, phys_tm;
614-
unsigned long flags;
615-
616-
spin_lock(&rtc_lock);
617-
spin_lock_irqsave(&efi_runtime_lock, flags);
618-
619-
phys_enabled = virt_to_phys_or_null(enabled);
620-
phys_pending = virt_to_phys_or_null(pending);
621-
phys_tm = virt_to_phys_or_null(tm);
622-
623-
status = efi_thunk(get_wakeup_time, phys_enabled,
624-
phys_pending, phys_tm);
625-
626-
spin_unlock_irqrestore(&efi_runtime_lock, flags);
627-
spin_unlock(&rtc_lock);
628-
629-
return status;
583+
return EFI_UNSUPPORTED;
630584
}
631585

632586
static efi_status_t
633587
efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
634588
{
635-
efi_status_t status;
636-
u32 phys_tm;
637-
unsigned long flags;
638-
639-
spin_lock(&rtc_lock);
640-
spin_lock_irqsave(&efi_runtime_lock, flags);
641-
642-
phys_tm = virt_to_phys_or_null(tm);
643-
644-
status = efi_thunk(set_wakeup_time, enabled, phys_tm);
645-
646-
spin_unlock_irqrestore(&efi_runtime_lock, flags);
647-
spin_unlock(&rtc_lock);
648-
649-
return status;
589+
return EFI_UNSUPPORTED;
650590
}
651591

652592
static unsigned long efi_name_size(efi_char16_t *name)
@@ -770,18 +710,7 @@ efi_thunk_get_next_variable(unsigned long *name_size,
770710
static efi_status_t
771711
efi_thunk_get_next_high_mono_count(u32 *count)
772712
{
773-
efi_status_t status;
774-
u32 phys_count;
775-
unsigned long flags;
776-
777-
spin_lock_irqsave(&efi_runtime_lock, flags);
778-
779-
phys_count = virt_to_phys_or_null(count);
780-
status = efi_thunk(get_next_high_mono_count, phys_count);
781-
782-
spin_unlock_irqrestore(&efi_runtime_lock, flags);
783-
784-
return status;
713+
return EFI_UNSUPPORTED;
785714
}
786715

787716
static void

0 commit comments

Comments
 (0)