Re: [PATCH v2 1/2] efi/x86: move UEFI Runtime Services wrappers to generic code

2014-07-01 Thread Matt Fleming
On Thu, 26 Jun, at 12:09:05PM, Ard Biesheuvel wrote:
 In order for other archs (such as arm64) to be able to reuse the virtual mode
 function call wrappers, move them to drivers/firmware/efi/runtime-wrappers.c.
 
 Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org

[...]

 @@ -54,6 +54,13 @@ config EFI_PARAMS_FROM_FDT
 the EFI runtime support gets system table address, memory
map address, and other parameters from the device tree.
  
 +config EFI_RUNTIME_WRAPPERS
 + bool
 + help
 +   Selected by the arch if it needs to wrap UEFI Runtime Services calls,
 +   in which case it needs to provide #definitions of efi_call_virt and
 +   __efi_call_virt in asm/efi.h
 +
  endmenu

Actually, could we drop this help text?

That may seem like a backwards step, but I have concerns that we'll fail
to keep this help text in sync with the code. Furthermore, by providing
help text that kinda says, casual users need the help text to
understand when to enable this feature. Clearly that's not what this
Kconfig symbol is for.

Most of the other guard Kconfig symbols don't provide this kind of text,
and I think there's good reason to follow suit.

What do you think?

-- 
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line unsubscribe linux-efi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] efi/x86: move UEFI Runtime Services wrappers to generic code

2014-07-01 Thread Ard Biesheuvel
On 1 July 2014 15:30, Matt Fleming m...@console-pimps.org wrote:
 On Thu, 26 Jun, at 12:09:05PM, Ard Biesheuvel wrote:
 In order for other archs (such as arm64) to be able to reuse the virtual mode
 function call wrappers, move them to drivers/firmware/efi/runtime-wrappers.c.

 Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org

 [...]

 @@ -54,6 +54,13 @@ config EFI_PARAMS_FROM_FDT
 the EFI runtime support gets system table address, memory
map address, and other parameters from the device tree.

 +config EFI_RUNTIME_WRAPPERS
 + bool
 + help
 +   Selected by the arch if it needs to wrap UEFI Runtime Services calls,
 +   in which case it needs to provide #definitions of efi_call_virt and
 +   __efi_call_virt in asm/efi.h
 +
  endmenu

 Actually, could we drop this help text?

 That may seem like a backwards step, but I have concerns that we'll fail
 to keep this help text in sync with the code. Furthermore, by providing
 help text that kinda says, casual users need the help text to
 understand when to enable this feature. Clearly that's not what this
 Kconfig symbol is for.

 Most of the other guard Kconfig symbols don't provide this kind of text,
 and I think there's good reason to follow suit.

 What do you think?


I agree, but I kind of followed the example of the Kconfig symbols in
the vicinity.
So sure, rip it out. Or would you like me to do a v(n+1)?

-- 
Ard.
--
To unsubscribe from this list: send the line unsubscribe linux-efi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] efi/x86: move UEFI Runtime Services wrappers to generic code

2014-07-01 Thread Matt Fleming
On Tue, 01 Jul, at 03:35:09PM, Ard Biesheuvel wrote:
 
 I agree, but I kind of followed the example of the Kconfig symbols in
 the vicinity.
 So sure, rip it out. Or would you like me to do a v(n+1)?

Thanks. Nah, no need for another version, I'ved fixed this up in 'next',
but please do check the commits to make sure nothing untoward has
occurred.

-- 
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line unsubscribe linux-efi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] efi/x86: move UEFI Runtime Services wrappers to generic code

2014-06-26 Thread Ard Biesheuvel
In order for other archs (such as arm64) to be able to reuse the virtual mode
function call wrappers, move them to drivers/firmware/efi/runtime-wrappers.c.

Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org
---
 arch/x86/Kconfig|   1 +
 arch/x86/platform/efi/efi.c | 144 +---
 drivers/firmware/efi/Kconfig|   7 ++
 drivers/firmware/efi/Makefile   |   1 +
 drivers/firmware/efi/runtime-wrappers.c | 161 
 include/linux/efi.h |   2 +
 6 files changed, 174 insertions(+), 142 deletions(-)
 create mode 100644 drivers/firmware/efi/runtime-wrappers.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a8f749ef0fdc..4c3f026aa5ce 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1522,6 +1522,7 @@ config EFI
bool EFI runtime service support
depends on ACPI
select UCS2_STRING
+   select EFI_RUNTIME_WRAPPERS
---help---
  This enables the kernel to use EFI runtime services that are
  available (such as the EFI variable services).
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 87fc96bcc13c..36d0835210c3 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -104,130 +104,6 @@ static int __init setup_storage_paranoia(char *arg)
 }
 early_param(efi_no_storage_paranoia, setup_storage_paranoia);
 
-static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
-{
-   unsigned long flags;
-   efi_status_t status;
-
-   spin_lock_irqsave(rtc_lock, flags);
-   status = efi_call_virt(get_time, tm, tc);
-   spin_unlock_irqrestore(rtc_lock, flags);
-   return status;
-}
-
-static efi_status_t virt_efi_set_time(efi_time_t *tm)
-{
-   unsigned long flags;
-   efi_status_t status;
-
-   spin_lock_irqsave(rtc_lock, flags);
-   status = efi_call_virt(set_time, tm);
-   spin_unlock_irqrestore(rtc_lock, flags);
-   return status;
-}
-
-static efi_status_t virt_efi_get_wakeup_time(efi_bool_t *enabled,
-efi_bool_t *pending,
-efi_time_t *tm)
-{
-   unsigned long flags;
-   efi_status_t status;
-
-   spin_lock_irqsave(rtc_lock, flags);
-   status = efi_call_virt(get_wakeup_time, enabled, pending, tm);
-   spin_unlock_irqrestore(rtc_lock, flags);
-   return status;
-}
-
-static efi_status_t virt_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t 
*tm)
-{
-   unsigned long flags;
-   efi_status_t status;
-
-   spin_lock_irqsave(rtc_lock, flags);
-   status = efi_call_virt(set_wakeup_time, enabled, tm);
-   spin_unlock_irqrestore(rtc_lock, flags);
-   return status;
-}
-
-static efi_status_t virt_efi_get_variable(efi_char16_t *name,
- efi_guid_t *vendor,
- u32 *attr,
- unsigned long *data_size,
- void *data)
-{
-   return efi_call_virt(get_variable,
-name, vendor, attr,
-data_size, data);
-}
-
-static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
-  efi_char16_t *name,
-  efi_guid_t *vendor)
-{
-   return efi_call_virt(get_next_variable,
-name_size, name, vendor);
-}
-
-static efi_status_t virt_efi_set_variable(efi_char16_t *name,
- efi_guid_t *vendor,
- u32 attr,
- unsigned long data_size,
- void *data)
-{
-   return efi_call_virt(set_variable,
-name, vendor, attr,
-data_size, data);
-}
-
-static efi_status_t virt_efi_query_variable_info(u32 attr,
-u64 *storage_space,
-u64 *remaining_space,
-u64 *max_variable_size)
-{
-   if (efi.runtime_version  EFI_2_00_SYSTEM_TABLE_REVISION)
-   return EFI_UNSUPPORTED;
-
-   return efi_call_virt(query_variable_info, attr, storage_space,
-remaining_space, max_variable_size);
-}
-
-static efi_status_t virt_efi_get_next_high_mono_count(u32 *count)
-{
-   return efi_call_virt(get_next_high_mono_count, count);
-}
-
-static void virt_efi_reset_system(int reset_type,
- efi_status_t status,
- unsigned long data_size,
- efi_char16_t *data)
-{
-   __efi_call_virt(reset_system, reset_type, status,
-