public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 1/6] efi_loader: runtime: make SetVirtualAddressMap configurable
Date: Mon, 17 Jun 2019 10:05:31 +0900	[thread overview]
Message-ID: <20190617010530.GA6610@linaro.org> (raw)
In-Reply-To: <5ab5256d-8608-6b91-6a34-e8f4dfe2b6c1@gmx.de>

On Sat, Jun 15, 2019 at 09:46:02PM +0200, Heinrich Schuchardt wrote:
> On 6/5/19 6:21 AM, AKASHI Takahiro wrote:
> >OS does not always need to call SetVirtualAddressMap.
> >(Ard confirmed this on arm64 linux.)
> >So let this API configurable. If disabled, it will return EFI_UNSUPPORTED
> >as UEFI specification requires.
> 
> Currently we do not support this scenario. Alex's patch should go in first.
> 
> >
> >Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >---
> >  lib/efi_loader/Kconfig       | 7 +++++++
> >  lib/efi_loader/efi_runtime.c | 8 ++++++++
> >  2 files changed, 15 insertions(+)
> >
> >diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> >index 8bf4b1754d06..bb9c7582b14d 100644
> >--- a/lib/efi_loader/Kconfig
> >+++ b/lib/efi_loader/Kconfig
> >@@ -44,6 +44,13 @@ config EFI_SET_TIME
> >  	  Provide the SetTime() runtime service at boottime. This service
> >  	  can be used by an EFI application to adjust the real time clock.
> >
> >+config EFI_RUNTIME_SET_VIRTUAL_ADDRESS_MAP
> >+	bool "runtime service: SetVirtualAddressMap"
> >+	default n
> >+	help
> >+	  Enable SetVirtualAddressMap runtime service. This API will be
> >+	  called by OS just before it enters into virtual address mode.
> >+
> >  config EFI_DEVICE_PATH_TO_TEXT
> >  	bool "Device path to text protocol"
> >  	default y
> >diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
> >index 9c50955c9bd0..60442cb21d37 100644
> >--- a/lib/efi_loader/efi_runtime.c
> >+++ b/lib/efi_loader/efi_runtime.c
> >@@ -374,10 +374,12 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = {
> >  		/* do_reset is gone */
> >  		.ptr = &efi_runtime_services.reset_system,
> >  		.patchto = efi_reset_system,
> >+#ifdef CONFIG_RUNTIME_SET_VIRTUAL_ADDRESS_MAP
> >  	}, {
> >  		/* invalidate_*cache_all are gone */
> >  		.ptr = &efi_runtime_services.set_virtual_address_map,
> >  		.patchto = &efi_unimplemented,
> >+#endif
> >  	}, {
> >  		/* RTC accessors are gone */
> >  		.ptr = &efi_runtime_services.get_time,
> >@@ -512,6 +514,7 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
> >          invalidate_icache_all();
> >  }
> >
> >+#ifdef CONFIG_RUNTIME_SET_VIRTUAL_ADDRESS_MAP
> >  /**
> >   * efi_set_virtual_address_map() - change from physical to virtual mapping
> >   *
> >@@ -619,6 +622,7 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
> >
> >  	return EFI_EXIT(EFI_INVALID_PARAMETER);
> >  }
> >+#endif /* CONFIG_RUNTIME_SET_VIRTUAL_ADDRESS_MAP */
> >
> >  /**
> >   * efi_add_runtime_mmio() - add memory-mapped IO region
> >@@ -796,7 +800,11 @@ struct efi_runtime_services __efi_runtime_data efi_runtime_services = {
> >  	.set_time = &efi_set_time_boottime,
> >  	.get_wakeup_time = (void *)&efi_unimplemented,
> >  	.set_wakeup_time = (void *)&efi_unimplemented,
> >+#ifdef CONFIG_RUNTIME_SET_VIRTUAL_ADDRESS_MAP
> >  	.set_virtual_address_map = &efi_set_virtual_address_map,
> >+#else
> >+	.set_virtual_address_map = (void *)&efi_unimplemented,
> 
> Depending on the ABI it is not save to use a function with another set
> of parameters.

I don't think it's a good practice, but there already are
a couple of precedents:
        get_wakeup_time
        set_wakeup_time
        get_next_high_mono_count, and
        convert_pointer

-Takahiro Akashi

> Best regards
> 
> Heinrich
> 
> >+#endif
> >  	.convert_pointer = (void *)&efi_invalid_parameter,
> >  	.get_variable = efi_get_variable,
> >  	.get_next_variable_name = efi_get_next_variable_name,
> >
> 

  parent reply	other threads:[~2019-06-17  1:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05  4:21 [U-Boot] [RFC 0/6] efi_loader: support runtime variable access via cache AKASHI Takahiro
2019-06-05  4:21 ` [U-Boot] [RFC 1/6] efi_loader: runtime: make SetVirtualAddressMap configurable AKASHI Takahiro
2019-06-15 19:46   ` Heinrich Schuchardt
2019-06-15 21:14     ` Mark Kettenis
2019-06-16 21:52       ` Heinrich Schuchardt
2019-06-18 18:11         ` Mark Kettenis
2019-06-17  1:05     ` AKASHI Takahiro [this message]
2019-06-05  4:21 ` [U-Boot] [RFC 2/6] efi: add RuntimeServicesSupported variable AKASHI Takahiro
2019-06-13  5:56   ` Heinrich Schuchardt
2019-06-13  7:06     ` AKASHI Takahiro
2019-06-13  9:17       ` Heinrich Schuchardt
2019-06-13  9:21         ` Heinrich Schuchardt
2019-06-05  4:21 ` [U-Boot] [RFC 3/6] efi_loader: support convert_pointer at runtime AKASHI Takahiro
2019-06-15 19:41   ` Heinrich Schuchardt
2019-06-17  1:15     ` AKASHI Takahiro
2019-06-17  5:41       ` Heinrich Schuchardt
2019-07-13  6:16         ` Heinrich Schuchardt
2019-06-05  4:21 ` [U-Boot] [RFC 4/6] efi_loader: Patch non-runtime code out at ExitBootServices already AKASHI Takahiro
2019-06-05  4:21 ` [U-Boot] [RFC 5/6] cmd: efidebug: add "boot exit" sub-command AKASHI Takahiro
2019-06-05  4:21 ` [U-Boot] [RFC 6/6] efi_loader: variable: support runtime variable access via cache AKASHI Takahiro
2019-06-15 19:01   ` Heinrich Schuchardt
2019-06-17  1:51     ` AKASHI Takahiro
2019-06-17 19:52       ` Heinrich Schuchardt
2019-06-18  1:19         ` AKASHI Takahiro
2019-06-18  2:25           ` AKASHI Takahiro
2019-06-18 10:34           ` Ilias Apalodimas
2019-06-18 20:45             ` Heinrich Schuchardt
2019-06-19  1:25               ` AKASHI Takahiro
2019-06-19  5:13                 ` Ilias Apalodimas
2019-06-19  6:24                   ` Heinrich Schuchardt
2019-06-19  7:07                     ` AKASHI Takahiro
2019-06-05 10:34 ` [U-Boot] [RFC 0/6] efi_loader: " Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190617010530.GA6610@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox