Re: [Xen-devel] [PATCH v5 2/7] efi: Introduce EFI_NO_DIRECT flag

2014-06-16 Thread David Vrabel
On 13/06/14 18:00, Daniel Kiper wrote:
 Introduce EFI_NO_DIRECT flag.

EFI_PARAVIRT would be a clearer name I think.

 +#define EFI_NO_DIRECT6   /* Can we access EFI directly? 
 */

#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */

David
--
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 v5 7/7] arch/x86: Comment out efi_set_rtc_mmss()

2014-06-16 Thread Stefano Stabellini
On Fri, 13 Jun 2014, Daniel Kiper wrote:
 efi_set_rtc_mmss() is never used to set RTC due to bugs found
 on many EFI platforms. It is set directly by mach_set_rtc_mmss().
 
 Signed-off-by: Daniel Kiper daniel.ki...@oracle.com
 ---
  arch/x86/platform/efi/efi.c |6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
 index deb4f05..bd3e080 100644
 --- a/arch/x86/platform/efi/efi.c
 +++ b/arch/x86/platform/efi/efi.c
 @@ -244,6 +244,11 @@ static efi_status_t __init 
 phys_efi_set_virtual_address_map(
   return status;
  }
  
 +#if 0
 +/*
 + * efi_set_rtc_mmss() is never used to set RTC due to bugs found
 + * on many EFI platforms. It is set directly by mach_set_rtc_mmss().
 + */
  int efi_set_rtc_mmss(const struct timespec *now)
  {
   unsigned long nowtime = now-tv_sec;
 @@ -279,6 +284,7 @@ int efi_set_rtc_mmss(const struct timespec *now)
   }
   return 0;
  }
 +#endif

Commenting out code like that is not a good idea: it leaves
dead-rotting functions in the middle of your source file.

If the function is not used, just go ahead and remove it. We can use git
to get it back.
--
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: [Xen-devel] [PATCH v5 7/7] arch/x86: Comment out efi_set_rtc_mmss()

2014-06-16 Thread Juergen Gross

On 06/16/2014 01:43 PM, Stefano Stabellini wrote:

On Fri, 13 Jun 2014, Daniel Kiper wrote:

efi_set_rtc_mmss() is never used to set RTC due to bugs found
on many EFI platforms. It is set directly by mach_set_rtc_mmss().

Signed-off-by: Daniel Kiper daniel.ki...@oracle.com
---
  arch/x86/platform/efi/efi.c |6 ++
  1 file changed, 6 insertions(+)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index deb4f05..bd3e080 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -244,6 +244,11 @@ static efi_status_t __init 
phys_efi_set_virtual_address_map(
return status;
  }

+#if 0
+/*
+ * efi_set_rtc_mmss() is never used to set RTC due to bugs found
+ * on many EFI platforms. It is set directly by mach_set_rtc_mmss().
+ */
  int efi_set_rtc_mmss(const struct timespec *now)
  {
unsigned long nowtime = now-tv_sec;
@@ -279,6 +284,7 @@ int efi_set_rtc_mmss(const struct timespec *now)
}
return 0;
  }
+#endif


Commenting out code like that is not a good idea: it leaves
dead-rotting functions in the middle of your source file.

If the function is not used, just go ahead and remove it. We can use git
to get it back.


And shouldn't it be removed from include/linux/efi.h as well?

Juergen

--
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 v5 4/7] xen: Put EFI machinery in place

2014-06-16 Thread Stefano Stabellini
On Fri, 13 Jun 2014, Daniel Kiper wrote:
 This patch enables EFI usage under Xen dom0. Standard EFI Linux
 Kernel infrastructure cannot be used because it requires direct
 access to EFI data and code. However, in dom0 case it is not possible
 because above mentioned EFI stuff is fully owned and controlled
 by Xen hypervisor. In this case all calls from dom0 to EFI must
 be requested via special hypercall which in turn executes relevant
 EFI code in behalf of dom0.
 
 When dom0 kernel boots it checks for EFI availability on a machine.
 If it is detected then artificial EFI system table is filled.
 Native EFI callas are replaced by functions which mimics them
 by calling relevant hypercall. Later pointer to EFI system table
 is passed to standard EFI machinery and it continues EFI subsystem
 initialization taking into account that there is no direct access
 to EFI boot services, runtime, tables, structures, etc. After that
 system runs as usual.
 
 This patch is based on Jan Beulich and Tang Liang work.
 
 v5 - suggestions/fixes:
- improve macro usage readability
  (suggested by Andrew Cooper and David Vrabel),
- conditions cleanup
  (suggested by David Vrabel),
- use -fshort-wchar option
  (suggested by Jan Beulich),
- Kconfig rule cleanup
  (suggested by Jan Beulich),
- forward port fixes from SUSE kernel
  (suggested by Jan Beulich),
- improve commit message
  (suggested by David Vrabel).
 
 v4 - suggestions/fixes:
- just populate an efi_system_table_t object
  (suggested by Matt Fleming).
 
 Signed-off-by: Jan Beulich jbeul...@suse.com
 Signed-off-by: Tang Liang liang.t...@oracle.com
 Signed-off-by: Daniel Kiper daniel.ki...@oracle.com

Sorry for commenting on your patches so late in the review cycle.


  arch/x86/xen/enlighten.c |   24 +++
  drivers/xen/Kconfig  |4 +
  drivers/xen/Makefile |3 +
  drivers/xen/efi.c|  374 
 ++
  4 files changed, 405 insertions(+)
  create mode 100644 drivers/xen/efi.c
 
 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
 index f17b292..5dad11c 100644
 --- a/arch/x86/xen/enlighten.c
 +++ b/arch/x86/xen/enlighten.c
 @@ -32,6 +32,7 @@
  #include linux/gfp.h
  #include linux/memblock.h
  #include linux/edd.h
 +#include linux/efi.h
  
  #include xen/xen.h
  #include xen/events.h
 @@ -150,6 +151,15 @@ struct shared_info *HYPERVISOR_shared_info = 
 xen_dummy_shared_info;
   */
  static int have_vcpu_info_placement = 1;
  
 +#ifdef CONFIG_XEN_EFI
 +extern efi_system_table_t __init *xen_efi_probe(void);
 +#else
 +static efi_system_table_t __init *xen_efi_probe(void)
 +{
 + return NULL;
 +}
 +#endif
 +
  struct tls_descs {
   struct desc_struct desc[3];
  };
 @@ -1520,6 +1530,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
  {
   struct physdev_set_iopl set_iopl;
   int rc;
 + efi_system_table_t *efi_systab_xen;
  
   if (!xen_start_info)
   return;
 @@ -1715,6 +1726,19 @@ asmlinkage __visible void __init xen_start_kernel(void)
  
   xen_setup_runstate_info(0);
  
 + efi_systab_xen = xen_efi_probe();
 +
 + if (efi_systab_xen) {
 + strncpy((char *)boot_params.efi_info.efi_loader_signature, 
 Xen,
 + 
 sizeof(boot_params.efi_info.efi_loader_signature));
 + boot_params.efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
 + boot_params.efi_info.efi_systab_hi = 
 (__u32)(__pa(efi_systab_xen)  32);
 +
 + set_bit(EFI_BOOT, efi.flags);
 + set_bit(EFI_NO_DIRECT, efi.flags);
 + set_bit(EFI_64BIT, efi.flags);
 + }
 +
   /* Start the world */
  #ifdef CONFIG_X86_32
   i386_start_kernel();
 diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
 index 38fb36e..8bc0183 100644
 --- a/drivers/xen/Kconfig
 +++ b/drivers/xen/Kconfig
 @@ -240,4 +240,8 @@ config XEN_MCE_LOG
  config XEN_HAVE_PVMMU
 bool
  
 +config XEN_EFI
 + def_bool y
 + depends on X86_64  EFI
 +
  endmenu
 diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
 index 45e00af..84044b5 100644
 --- a/drivers/xen/Makefile
 +++ b/drivers/xen/Makefile
 @@ -9,6 +9,8 @@ obj-y += xenbus/
  nostackp := $(call cc-option, -fno-stack-protector)
  CFLAGS_features.o:= $(nostackp)
  
 +CFLAGS_efi.o += -fshort-wchar
 +
  dom0-$(CONFIG_PCI) += pci.o
  dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
  dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
 @@ -33,6 +35,7 @@ obj-$(CONFIG_XEN_STUB)  += xen-stub.o
  obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY)+= xen-acpi-memhotplug.o
  obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU)   += xen-acpi-cpuhotplug.o
  obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o
 +obj-$(CONFIG_XEN_EFI)+= efi.o
  xen-evtchn-y := evtchn.o
  xen-gntdev-y := gntdev.o
  xen-gntalloc-y  

Re: [PATCH v5 4/7] xen: Put EFI machinery in place

2014-06-16 Thread David Vrabel
On 13/06/14 18:00, Daniel Kiper wrote:
 
 v5 - suggestions/fixes:

Put after a --- marker.

 +static efi_char16_t vendor[100] __initdata;

Why 100?

David
--
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


[RFC PATCH 1/4] efi/x86: efistub: move shared dependencies to asm/efi.h

2014-06-16 Thread Ard Biesheuvel
This moves definitions depended upon both by code under arch/x86/boot and
under drivers/firmware/efi to asm/efi.h. This is in preparation of turning
the stub code under drivers/firmware/efi into a static library.

Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org
---
 arch/x86/boot/compressed/eboot.c |  5 +
 arch/x86/boot/compressed/eboot.h | 16 
 arch/x86/include/asm/efi.h   | 25 +
 3 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 0331d765c2bb..2fd5e2643623 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,10 +19,7 @@
 
 static efi_system_table_t *sys_table;
 
-static struct efi_config *efi_early;
-
-#define efi_call_early(f, ...) \
-   efi_early-call(efi_early-f, __VA_ARGS__);
+struct efi_config *efi_early;
 
 #define BOOT_SERVICES(bits)\
 static void setup_boot_services##bits(struct efi_config *c)\
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index c88c31ecad12..d487e727f1ec 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -103,20 +103,4 @@ struct efi_uga_draw_protocol {
void *blt;
 };
 
-struct efi_config {
-   u64 image_handle;
-   u64 table;
-   u64 allocate_pool;
-   u64 allocate_pages;
-   u64 get_memory_map;
-   u64 free_pool;
-   u64 free_pages;
-   u64 locate_handle;
-   u64 handle_protocol;
-   u64 exit_boot_services;
-   u64 text_output;
-   efi_status_t (*call)(unsigned long, ...);
-   bool is64;
-} __packed;
-
 #endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 1eb5f6433ad8..55059a50a01f 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -156,6 +156,31 @@ static inline efi_status_t 
efi_thunk_set_virtual_address_map(
return EFI_SUCCESS;
 }
 #endif /* CONFIG_EFI_MIXED */
+
+
+/* arch specific definitions used by the stub code */
+
+struct efi_config {
+   u64 image_handle;
+   u64 table;
+   u64 allocate_pool;
+   u64 allocate_pages;
+   u64 get_memory_map;
+   u64 free_pool;
+   u64 free_pages;
+   u64 locate_handle;
+   u64 handle_protocol;
+   u64 exit_boot_services;
+   u64 text_output;
+   efi_status_t (*call)(unsigned long, ...);
+   bool is64;
+} __packed;
+
+extern struct efi_config *efi_early;
+
+#define efi_call_early(f, ...) \
+   efi_early-call(efi_early-f, __VA_ARGS__);
+
 #else
 /*
  * IF EFI is not configured, have the EFI calls return -ENOSYS.
-- 
1.8.3.2

--
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


[RFC PATCH 3/4] efi: efistub: refactor stub components

2014-06-16 Thread Ard Biesheuvel
In order to move from the #include ../../../x.c anti-pattern used by
both the x86 and arm64 versions of the stub to a static library linked into
either the kernel proper (arm64) or a separate boot executable (x86), there
is some prepatory work required.

This patch does the following:
- move forward declarations of functions shared between the arch specific and
  the generic parts of the stub to include/linux/efi.h
- move forward declarations of functions shared between various .c files of the
  generic stub code to a new local header file called efistub.h
- add #includes to all .c files which were formerly relying on the #includor to
  include the correct header files
- remove all static modifiers from functions which will need to be externally
  visible once we move to a static library

Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org
---
 arch/arm64/kernel/efi-stub.c   | 29 -
 arch/x86/boot/compressed/eboot.c   | 13 +++---
 drivers/firmware/efi/arm-stub.c| 18 ++---
 drivers/firmware/efi/efi-stub-helper.c | 74 +-
 drivers/firmware/efi/efistub.h | 42 +++
 drivers/firmware/efi/fdt.c | 20 +
 include/linux/efi.h| 42 +++
 7 files changed, 157 insertions(+), 81 deletions(-)
 create mode 100644 drivers/firmware/efi/efistub.h

diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c
index 23cbde4324b1..e4999021b07d 100644
--- a/arch/arm64/kernel/efi-stub.c
+++ b/arch/arm64/kernel/efi-stub.c
@@ -11,36 +11,21 @@
  */
 #include linux/efi.h
 #include asm/efi.h
-#include linux/libfdt.h
 #include asm/sections.h
 
-static void efi_char16_printk(efi_system_table_t *sys_table_arg,
- efi_char16_t *str);
-
-static efi_status_t efi_open_volume(efi_system_table_t *sys_table,
-   void *__image, void **__fh);
-static efi_status_t efi_file_close(void *handle);
-
-static efi_status_t
-efi_file_read(void *handle, unsigned long *size, void *addr);
-
-static efi_status_t
-efi_file_size(efi_system_table_t *sys_table, void *__fh,
- efi_char16_t *filename_16, void **handle, u64 *file_sz);
-
 /* Include shared EFI stub code */
 #include ../../../drivers/firmware/efi/efi-stub-helper.c
 #include ../../../drivers/firmware/efi/fdt.c
 #include ../../../drivers/firmware/efi/arm-stub.c
 
 
-static efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
-   unsigned long *image_addr,
-   unsigned long *image_size,
-   unsigned long *reserve_addr,
-   unsigned long *reserve_size,
-   unsigned long dram_base,
-   efi_loaded_image_t *image)
+efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
+unsigned long *image_addr,
+unsigned long *image_size,
+unsigned long *reserve_addr,
+unsigned long *reserve_size,
+unsigned long dram_base,
+efi_loaded_image_t *image)
 {
efi_status_t status;
unsigned long kernel_size, kernel_memsize = 0;
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 2fd5e2643623..d338c134c659 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -45,8 +45,7 @@ static void setup_boot_services##bits(struct efi_config *c)   
\
 BOOT_SERVICES(32);
 BOOT_SERVICES(64);
 
-static void efi_printk(efi_system_table_t *, char *);
-static void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
+void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
 
 static efi_status_t
 __file_size32(void *__fh, efi_char16_t *filename_16,
@@ -153,7 +152,7 @@ grow:
 
return status;
 }
-static efi_status_t
+efi_status_t
 efi_file_size(efi_system_table_t *sys_table, void *__fh,
  efi_char16_t *filename_16, void **handle, u64 *file_sz)
 {
@@ -163,7 +162,7 @@ efi_file_size(efi_system_table_t *sys_table, void *__fh,
return __file_size32(__fh, filename_16, handle, file_sz);
 }
 
-static inline efi_status_t
+efi_status_t
 efi_file_read(void *handle, unsigned long *size, void *addr)
 {
unsigned long func;
@@ -181,7 +180,7 @@ efi_file_read(void *handle, unsigned long *size, void *addr)
}
 }
 
-static inline efi_status_t efi_file_close(void *handle)
+efi_status_t efi_file_close(void *handle)
 {
if (efi_early-is64) {
efi_file_handle_64_t *fh = handle;
@@ -246,7 +245,7 @@ static inline efi_status_t __open_volume64(void *__image, 
void **__fh)
return status;
 }
 
-static inline efi_status_t
+efi_status_t
 

Re: [RFC PATCH 4/4] efi: efistub: convert into static library

2014-06-16 Thread Ard Biesheuvel
On 16 June 2014 17:14, Ard Biesheuvel ard.biesheu...@linaro.org wrote:
 This patch changes both x86 and arm64 efistub implementations from #including
 shared .c files under drivers/firmware/efi to building the shared code as a
 static library.

 The x86 code uses a stub built into the boot executable which uncompresses the
 kernel at boot time. In this case, the library is linked into the 
 decompressor.

 In the arm64 case, the stub is part of the kernel proper so the library is
 linked into the kernel proper as well.

 Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org
 ---
  arch/arm64/Kconfig |   1 +
  arch/arm64/Makefile|   1 +
  arch/arm64/kernel/efi-stub.c   |   5 -
  arch/x86/boot/compressed/Makefile  |   3 +-
  arch/x86/boot/compressed/eboot.c   |   2 -
  drivers/firmware/efi/Kconfig   |   3 +
  drivers/firmware/efi/Makefile  |   2 +-
  drivers/firmware/efi/arm-stub.c| 284 ---
  drivers/firmware/efi/efi-stub-helper.c | 632 
 -
  drivers/firmware/efi/efistub.h |  42 --
  drivers/firmware/efi/fdt.c | 279 ---
  drivers/firmware/efi/libstub/Makefile  |   5 +
  drivers/firmware/efi/libstub/arm-stub.c| 284 +++
  drivers/firmware/efi/libstub/efi-stub-helper.c | 632 
 +
  drivers/firmware/efi/libstub/efistub.h |  42 ++
  drivers/firmware/efi/libstub/fdt.c | 279 +++
  16 files changed, 1250 insertions(+), 1246 deletions(-)
  delete mode 100644 drivers/firmware/efi/arm-stub.c
  delete mode 100644 drivers/firmware/efi/efi-stub-helper.c
  delete mode 100644 drivers/firmware/efi/efistub.h
  delete mode 100644 drivers/firmware/efi/fdt.c
  create mode 100644 drivers/firmware/efi/libstub/Makefile
  create mode 100644 drivers/firmware/efi/libstub/arm-stub.c
  create mode 100644 drivers/firmware/efi/libstub/efi-stub-helper.c
  create mode 100644 drivers/firmware/efi/libstub/efistub.h
  create mode 100644 drivers/firmware/efi/libstub/fdt.c


Oops, forgot to enable diff.renames ...

diffstat is actually

 arch/arm64/Kconfig   | 1 +
 arch/arm64/Makefile  | 1 +
 arch/arm64/kernel/efi-stub.c | 5 -
 arch/x86/boot/compressed/Makefile| 3 ++-
 arch/x86/boot/compressed/eboot.c | 2 --
 drivers/firmware/efi/Kconfig | 3 +++
 drivers/firmware/efi/Makefile| 2 +-
 drivers/firmware/efi/libstub/Makefile| 5 +
 drivers/firmware/efi/{ = libstub}/arm-stub.c| 0
 drivers/firmware/efi/{ = libstub}/efi-stub-helper.c | 0
 drivers/firmware/efi/{ = libstub}/efistub.h | 0
 drivers/firmware/efi/{ = libstub}/fdt.c | 0
 12 files changed, 13 insertions(+), 9 deletions(-)
 create mode 100644 drivers/firmware/efi/libstub/Makefile
 rename drivers/firmware/efi/{ = libstub}/arm-stub.c (100%)
 rename drivers/firmware/efi/{ = libstub}/efi-stub-helper.c (100%)
 rename drivers/firmware/efi/{ = libstub}/efistub.h (100%)
 rename drivers/firmware/efi/{ = libstub}/fdt.c (100%)

 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
 index 7295419165e1..1ba4b5eae886 100644
 --- a/arch/arm64/Kconfig
 +++ b/arch/arm64/Kconfig
 @@ -298,6 +298,7 @@ config EFI
 select LIBFDT
 select UCS2_STRING
 select EFI_PARAMS_FROM_FDT
 +   select EFI_ARMSTUB
 default y
 help
   This option provides support for runtime services provided
 diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
 index 8185a913c5ed..bb8f21a626c0 100644
 --- a/arch/arm64/Makefile
 +++ b/arch/arm64/Makefile
 @@ -48,6 +48,7 @@ core-$(CONFIG_XEN) += arch/arm64/xen/
  core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
  libs-y := arch/arm64/lib/ $(libs-y)
  libs-y += $(LIBGCC)
 +libs-$(CONFIG_EFI) += drivers/firmware/efi/libstub/

  # Default target when executing plain make
  KBUILD_IMAGE   := Image.gz
 diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c
 index e4999021b07d..12456a7d3fa2 100644
 --- a/arch/arm64/kernel/efi-stub.c
 +++ b/arch/arm64/kernel/efi-stub.c
 @@ -13,11 +13,6 @@
  #include asm/efi.h
  #include asm/sections.h

 -/* Include shared EFI stub code */
 -#include ../../../drivers/firmware/efi/efi-stub-helper.c
 -#include ../../../drivers/firmware/efi/fdt.c
 -#include ../../../drivers/firmware/efi/arm-stub.c
 -

  efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
  unsigned long *image_addr,
 diff --git a/arch/x86/boot/compressed/Makefile 
 b/arch/x86/boot/compressed/Makefile
 index 0fcd9133790c..7a801a310e37 100644
 --- a/arch/x86/boot/compressed/Makefile
 +++ b/arch/x86/boot/compressed/Makefile
 @@ -33,7 +33,8 @@ VMLINUX_OBJS = 

Re: [PATCH v5 4/7] xen: Put EFI machinery in place

2014-06-16 Thread Daniel Kiper
On Mon, Jun 16, 2014 at 12:55:35PM +0100, Stefano Stabellini wrote:
 On Fri, 13 Jun 2014, Daniel Kiper wrote:
  This patch enables EFI usage under Xen dom0. Standard EFI Linux
  Kernel infrastructure cannot be used because it requires direct
  access to EFI data and code. However, in dom0 case it is not possible
  because above mentioned EFI stuff is fully owned and controlled
  by Xen hypervisor. In this case all calls from dom0 to EFI must
  be requested via special hypercall which in turn executes relevant
  EFI code in behalf of dom0.
 
  When dom0 kernel boots it checks for EFI availability on a machine.
  If it is detected then artificial EFI system table is filled.
  Native EFI callas are replaced by functions which mimics them
  by calling relevant hypercall. Later pointer to EFI system table
  is passed to standard EFI machinery and it continues EFI subsystem
  initialization taking into account that there is no direct access
  to EFI boot services, runtime, tables, structures, etc. After that
  system runs as usual.
 
  This patch is based on Jan Beulich and Tang Liang work.
 
  v5 - suggestions/fixes:
 - improve macro usage readability
   (suggested by Andrew Cooper and David Vrabel),
 - conditions cleanup
   (suggested by David Vrabel),
 - use -fshort-wchar option
   (suggested by Jan Beulich),
 - Kconfig rule cleanup
   (suggested by Jan Beulich),
 - forward port fixes from SUSE kernel
   (suggested by Jan Beulich),
 - improve commit message
   (suggested by David Vrabel).
 
  v4 - suggestions/fixes:
 - just populate an efi_system_table_t object
   (suggested by Matt Fleming).
 
  Signed-off-by: Jan Beulich jbeul...@suse.com
  Signed-off-by: Tang Liang liang.t...@oracle.com
  Signed-off-by: Daniel Kiper daniel.ki...@oracle.com

 Sorry for commenting on your patches so late in the review cycle.

No problem.

[...]

  +efi_system_table_t __init *xen_efi_probe(void)
  +{
  +   struct xen_platform_op op = {
  +   .cmd = XENPF_firmware_info,
  +   .u.firmware_info = {
  +   .type = XEN_FW_EFI_INFO,
  +   .index = XEN_FW_EFI_CONFIG_TABLE
  +   }
  +   };
  +   union xenpf_efi_info *info = op.u.firmware_info.u.efi_info;
  +
  +   if (!xen_initial_domain() || HYPERVISOR_dom0_op(op)  0)
  +   return NULL;
  +
  +   /* Here we know that Xen runs on EFI platform. */
  +
  +   efi = efi_xen;
  +
  +   op.cmd = XENPF_firmware_info;
  +   op.u.firmware_info.type = XEN_FW_EFI_INFO;
  +   op.u.firmware_info.index = XEN_FW_EFI_VENDOR;
  +   info-vendor.bufsz = sizeof(vendor);
  +   set_xen_guest_handle(info-vendor.name, vendor);
  +
  +   if (HYPERVISOR_dom0_op(op) == 0) {
  +   efi_systab_xen.fw_vendor = __pa_symbol(vendor);
  +   efi_systab_xen.fw_revision = info-vendor.revision;
  +   } else
  +   efi_systab_xen.fw_vendor = __pa_symbol(LUNKNOWN);
  +
  +   op.cmd = XENPF_firmware_info;
  +   op.u.firmware_info.type = XEN_FW_EFI_INFO;
  +   op.u.firmware_info.index = XEN_FW_EFI_VERSION;
  +
  +   if (HYPERVISOR_dom0_op(op) == 0)
  +   efi_systab_xen.hdr.revision = info-version;
  +
  +   op.cmd = XENPF_firmware_info;
  +   op.u.firmware_info.type = XEN_FW_EFI_INFO;
  +   op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION;
  +
  +   if (HYPERVISOR_dom0_op(op) == 0)
  +   efi.runtime_version = info-version;
  +
  +   op.cmd = XENPF_firmware_info;
  +   op.u.firmware_info.type = XEN_FW_EFI_INFO;
  +   op.u.firmware_info.index = XEN_FW_EFI_CONFIG_TABLE;
  +
  +   if (HYPERVISOR_dom0_op(op)  0)
  +   BUG();

 Is it really worth of a BUG()? Can't we just print a warning and return
 NULL? We could still boot without EFI support.

Earlier the same hypercall function succeeded so if here it failed
it means that something is really broken. However, I will try remove
this call and get all data from earlier one. This way we avoid this
BUG() call.

Daniel
--
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: [Xen-devel] [PATCH v5 7/7] arch/x86: Comment out efi_set_rtc_mmss()

2014-06-16 Thread H. Peter Anvin
On 06/16/2014 04:54 AM, Juergen Gross wrote:
 
 And shouldn't it be removed from include/linux/efi.h as well?
 

Indeed.

-hpa


--
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 v5 4/7] xen: Put EFI machinery in place

2014-06-16 Thread Daniel Kiper
On Mon, Jun 16, 2014 at 01:00:29PM +0100, David Vrabel wrote:
 On 13/06/14 18:00, Daniel Kiper wrote:
 
  v5 - suggestions/fixes:

 Put after a --- marker.

Why?

You mean:

---

v5 - suggestions/fixes:
...

  +static efi_char16_t vendor[100] __initdata;

 Why 100?

Well... Quite arbitrary value. The same thing is used in
arch/x86/platform/efi/efi.c:efi_init(). Sadly UEFI sepec
says nothing about maximum vendor name length.

Daniel
--
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