aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/platform/efi/efi.c31
-rw-r--r--drivers/firmware/efi/efi.c21
-rw-r--r--include/linux/efi.h3
3 files changed, 39 insertions, 16 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 7d627a02ed82..d9026538cfdb 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -210,6 +210,9 @@ int __init efi_memblock_x86_reserve_range(void)
210 struct efi_info *e = &boot_params.efi_info; 210 struct efi_info *e = &boot_params.efi_info;
211 unsigned long pmap; 211 unsigned long pmap;
212 212
213 if (efi_enabled(EFI_PARAVIRT))
214 return 0;
215
213#ifdef CONFIG_X86_32 216#ifdef CONFIG_X86_32
214 /* Can't handle data above 4GB at this time */ 217 /* Can't handle data above 4GB at this time */
215 if (e->efi_memmap_hi) { 218 if (e->efi_memmap_hi) {
@@ -422,14 +425,24 @@ static int __init efi_runtime_init(void)
422 * the runtime services table so that we can grab the physical 425 * the runtime services table so that we can grab the physical
423 * address of several of the EFI runtime functions, needed to 426 * address of several of the EFI runtime functions, needed to
424 * set the firmware into virtual mode. 427 * set the firmware into virtual mode.
428 *
429 * When EFI_PARAVIRT is in force then we could not map runtime
430 * service memory region because we do not have direct access to it.
431 * However, runtime services are available through proxy functions
432 * (e.g. in case of Xen dom0 EFI implementation they call special
433 * hypercall which executes relevant EFI functions) and that is why
434 * they are always enabled.
425 */ 435 */
426 if (efi_enabled(EFI_64BIT))
427 rv = efi_runtime_init64();
428 else
429 rv = efi_runtime_init32();
430 436
431 if (rv) 437 if (!efi_enabled(EFI_PARAVIRT)) {
432 return rv; 438 if (efi_enabled(EFI_64BIT))
439 rv = efi_runtime_init64();
440 else
441 rv = efi_runtime_init32();
442
443 if (rv)
444 return rv;
445 }
433 446
434 set_bit(EFI_RUNTIME_SERVICES, &efi.flags); 447 set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
435 448
@@ -438,6 +451,9 @@ static int __init efi_runtime_init(void)
438 451
439static int __init efi_memmap_init(void) 452static int __init efi_memmap_init(void)
440{ 453{
454 if (efi_enabled(EFI_PARAVIRT))
455 return 0;
456
441 /* Map the EFI memory map */ 457 /* Map the EFI memory map */
442 memmap.map = early_memremap((unsigned long)memmap.phys_map, 458 memmap.map = early_memremap((unsigned long)memmap.phys_map,
443 memmap.nr_map * memmap.desc_size); 459 memmap.nr_map * memmap.desc_size);
@@ -914,6 +930,9 @@ static void __init __efi_enter_virtual_mode(void)
914 930
915void __init efi_enter_virtual_mode(void) 931void __init efi_enter_virtual_mode(void)
916{ 932{
933 if (efi_enabled(EFI_PARAVIRT))
934 return;
935
917 if (efi_setup) 936 if (efi_setup)
918 kexec_enter_virtual_mode(); 937 kexec_enter_virtual_mode();
919 else 938 else
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 023937a63a48..ac88ec05eb70 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -104,16 +104,19 @@ static struct attribute *efi_subsys_attrs[] = {
104static umode_t efi_attr_is_visible(struct kobject *kobj, 104static umode_t efi_attr_is_visible(struct kobject *kobj,
105 struct attribute *attr, int n) 105 struct attribute *attr, int n)
106{ 106{
107 umode_t mode = attr->mode; 107 if (attr == &efi_attr_fw_vendor.attr) {
108 108 if (efi_enabled(EFI_PARAVIRT) ||
109 if (attr == &efi_attr_fw_vendor.attr) 109 efi.fw_vendor == EFI_INVALID_TABLE_ADDR)
110 return (efi.fw_vendor == EFI_INVALID_TABLE_ADDR) ? 0 : mode; 110 return 0;
111 else if (attr == &efi_attr_runtime.attr) 111 } else if (attr == &efi_attr_runtime.attr) {
112 return (efi.runtime == EFI_INVALID_TABLE_ADDR) ? 0 : mode; 112 if (efi.runtime == EFI_INVALID_TABLE_ADDR)
113 else if (attr == &efi_attr_config_table.attr) 113 return 0;
114 return (efi.config_table == EFI_INVALID_TABLE_ADDR) ? 0 : mode; 114 } else if (attr == &efi_attr_config_table.attr) {
115 if (efi.config_table == EFI_INVALID_TABLE_ADDR)
116 return 0;
117 }
115 118
116 return mode; 119 return attr->mode;
117} 120}
118 121
119static struct attribute_group efi_subsys_attr_group = { 122static struct attribute_group efi_subsys_attr_group = {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index bac0f93dc473..c7a29a26e900 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -922,7 +922,8 @@ extern int __init efi_setup_pcdp_console(char *);
922#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ 922#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
923#define EFI_MEMMAP 4 /* Can we use EFI memory map? */ 923#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
924#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 924#define EFI_64BIT 5 /* Is the firmware 64-bit? */
925#define EFI_ARCH_1 6 /* First arch-specific bit */ 925#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
926#define EFI_ARCH_1 7 /* First arch-specific bit */
926 927
927#ifdef CONFIG_EFI 928#ifdef CONFIG_EFI
928/* 929/*