Skip to contentSkip to conversation

x86, kexec_file_load: make it work with efi=noruntime or efi=oldmap

PATCH Superseded Kairui Song 4 participants 5 messages Jan 9, 2019 – Jan 16, 2019

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 x86, kexec_file_load: make it work with efi=noruntime or efi=oldmap

When efi=noruntime or efi=oldmap is used, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and won't boot. Previously we are expecting the user to set the acpi_rsdp=<addr> on kernel command line for second kernel as there was no way to pass RSDP address to second kernel.

After commit e6e094e053af ('x86/acpi, x86/boot: Take RSDP address from boot params if available'), now it's possible to set a acpi_rsdp_addr parameter in the boot_params passed to second kernel, this commit make use of it, detect and set the RSDP address when it's required for second kernel to boot.

Tested with an EFI enabled KVM VM with efi=noruntime.

---
 arch/x86/kernel/kexec-bzimage64.c | 21 +++++++++++++++++++++
 drivers/acpi/acpica/tbxfroot.c    |  3 +--
 include/acpi/acpixf.h             |  2 +-
 3 files changed, 23 insertions(+), 3 deletions(-)
arch/x86/kernel/kexec-bzimage64.c +21 -0
index 53917a3ebf94..0a90dcbd041f 100644
@@ -20,6 +20,7 @@
 #include <linux/mm.h>
 #include <linux/efi.h>
 #include <linux/verification.h>
+#include <linux/acpi.h>
 
 #include <asm/bootparam.h>
 #include <asm/setup.h>
@@ -255,8 +256,28 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
 	/* Setup EFI state */
 	setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz,
 			efi_setup_data_offset);
+
+#ifdef CONFIG_ACPI
+	/* Setup ACPI RSDP pointer in case EFI is not available in second kernel */
+	if (!acpi_disabled && (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_OLD_MEMMAP))) {
+		/* Copied from acpi_os_get_root_pointer accordingly */
+		params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr;
+		if (!params->acpi_rsdp_addr) {
+			if (efi_enabled(EFI_CONFIG_TABLES)) {
+				if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
+					params->acpi_rsdp_addr = efi.acpi20;
+				else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
+					params->acpi_rsdp_addr = efi.acpi;
+			} else if (IS_ENABLED(CONFIG_ACPI_LEGACY_TABLES_LOOKUP)) {
+				acpi_find_root_pointer(&params->acpi_rsdp_addr);
+			}
+		}
+		if (!params->acpi_rsdp_addr)
+			pr_warn("RSDP is not available for second kernel\n");
+	}
 #endif
 
+#endif
 	/* Setup EDD info */
 	memcpy(params->eddbuf, boot_params.eddbuf,
 				EDDMAXNR * sizeof(struct edd_info));
drivers/acpi/acpica/tbxfroot.c +1 -2
index 483d0ce5180a..dac1e34a931c 100644
@@ -108,8 +108,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
  *
  ******************************************************************************/
 
-acpi_status ACPI_INIT_FUNCTION
-acpi_find_root_pointer(acpi_physical_address *table_address)
+acpi_status acpi_find_root_pointer(acpi_physical_address *table_address)
 {
 	u8 *table_ptr;
 	u8 *mem_rover;
include/acpi/acpixf.h +1 -1
index 7aa38b648564..869d75ecaf7d 100644
@@ -474,7 +474,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
 			    acpi_reallocate_root_table(void))
 
-ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 			    acpi_find_root_pointer(acpi_physical_address
 						   *rsdp_address))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
Signature · 1 line
2.20.1
#1 lore raw

CCing more people

Quoted 93 lines · Kairui Song

When efi=noruntime or efi=oldmap is used, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and won't boot. Previously we are expecting the user to set the acpi_rsdp=<addr> on kernel command line for second kernel as there was no way to pass RSDP address to second kernel.

After commit e6e094e053af ('x86/acpi, x86/boot: Take RSDP address from boot params if available'), now it's possible to set a acpi_rsdp_addr parameter in the boot_params passed to second kernel, this commit make use of it, detect and set the RSDP address when it's required for second kernel to boot.

Tested with an EFI enabled KVM VM with efi=noruntime.

---
 arch/x86/kernel/kexec-bzimage64.c | 21 +++++++++++++++++++++
 drivers/acpi/acpica/tbxfroot.c    |  3 +--
 include/acpi/acpixf.h             |  2 +-
 3 files changed, 23 insertions(+), 3 deletions(-)
arch/x86/kernel/kexec-bzimage64.c +21 -0
index 53917a3ebf94..0a90dcbd041f 100644
@@ -20,6 +20,7 @@
 #include <linux/mm.h>
 #include <linux/efi.h>
 #include <linux/verification.h>
+#include <linux/acpi.h>
 
 #include <asm/bootparam.h>
 #include <asm/setup.h>
@@ -255,8 +256,28 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
        /* Setup EFI state */
        setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz,
                        efi_setup_data_offset);
+
+#ifdef CONFIG_ACPI
+       /* Setup ACPI RSDP pointer in case EFI is not available in second kernel */
+       if (!acpi_disabled && (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_OLD_MEMMAP))) {
+               /* Copied from acpi_os_get_root_pointer accordingly */
+               params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr;
+               if (!params->acpi_rsdp_addr) {
+                       if (efi_enabled(EFI_CONFIG_TABLES)) {
+                               if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
+                                       params->acpi_rsdp_addr = efi.acpi20;
+                               else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
+                                       params->acpi_rsdp_addr = efi.acpi;
+                       } else if (IS_ENABLED(CONFIG_ACPI_LEGACY_TABLES_LOOKUP)) {
+                               acpi_find_root_pointer(&params->acpi_rsdp_addr);
+                       }
+               }
+               if (!params->acpi_rsdp_addr)
+                       pr_warn("RSDP is not available for second kernel\n");
+       }
 #endif
 
+#endif
        /* Setup EDD info */
        memcpy(params->eddbuf, boot_params.eddbuf,
                                EDDMAXNR * sizeof(struct edd_info));
drivers/acpi/acpica/tbxfroot.c +1 -2
index 483d0ce5180a..dac1e34a931c 100644
@@ -108,8 +108,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
  *
  ******************************************************************************/
 
-acpi_status ACPI_INIT_FUNCTION
-acpi_find_root_pointer(acpi_physical_address *table_address)
+acpi_status acpi_find_root_pointer(acpi_physical_address *table_address)
 {
        u8 *table_ptr;
        u8 *mem_rover;
include/acpi/acpixf.h +1 -2
index 7aa38b648564..869d75ecaf7d 100644
@@ -474,7 +474,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
                            acpi_reallocate_root_table(void))
 
-ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                            acpi_find_root_pointer(acpi_physical_address
                                                   *rsdp_address))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
--
Quoted 2 lines

2.20.1

--
Best Regards,
Kairui Song

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
In reply to Kairui Song
Quoted 94 lines · Kairui Song

When efi=noruntime or efi=oldmap is used, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and won't boot. Previously we are expecting the user to set the acpi_rsdp=<addr> on kernel command line for second kernel as there was no way to pass RSDP address to second kernel.

After commit e6e094e053af ('x86/acpi, x86/boot: Take RSDP address from boot params if available'), now it's possible to set a acpi_rsdp_addr parameter in the boot_params passed to second kernel, this commit make use of it, detect and set the RSDP address when it's required for second kernel to boot.

Tested with an EFI enabled KVM VM with efi=noruntime.

---
 arch/x86/kernel/kexec-bzimage64.c | 21 +++++++++++++++++++++
 drivers/acpi/acpica/tbxfroot.c    |  3 +--
 include/acpi/acpixf.h             |  2 +-
 3 files changed, 23 insertions(+), 3 deletions(-)
arch/x86/kernel/kexec-bzimage64.c +21 -0
index 53917a3ebf94..0a90dcbd041f 100644
@@ -20,6 +20,7 @@
 #include <linux/mm.h>
 #include <linux/efi.h>
 #include <linux/verification.h>
+#include <linux/acpi.h>
 
 #include <asm/bootparam.h>
 #include <asm/setup.h>
@@ -255,8 +256,28 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
 	/* Setup EFI state */
 	setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz,
 			efi_setup_data_offset);
+
+#ifdef CONFIG_ACPI
+	/* Setup ACPI RSDP pointer in case EFI is not available in second kernel */
+	if (!acpi_disabled && (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_OLD_MEMMAP))) {
+		/* Copied from acpi_os_get_root_pointer accordingly */
+		params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr;
+		if (!params->acpi_rsdp_addr) {
+			if (efi_enabled(EFI_CONFIG_TABLES)) {
+				if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
+					params->acpi_rsdp_addr = efi.acpi20;
+				else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
+					params->acpi_rsdp_addr = efi.acpi;
+			} else if (IS_ENABLED(CONFIG_ACPI_LEGACY_TABLES_LOOKUP)) {
+				acpi_find_root_pointer(&params->acpi_rsdp_addr);
+			}
+		}
+		if (!params->acpi_rsdp_addr)
+			pr_warn("RSDP is not available for second kernel\n");
+	}
 #endif
 
+#endif
 	/* Setup EDD info */
 	memcpy(params->eddbuf, boot_params.eddbuf,
 				EDDMAXNR * sizeof(struct edd_info));
drivers/acpi/acpica/tbxfroot.c +1 -2
index 483d0ce5180a..dac1e34a931c 100644
@@ -108,8 +108,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
  *
  ******************************************************************************/
 
-acpi_status ACPI_INIT_FUNCTION
-acpi_find_root_pointer(acpi_physical_address *table_address)
+acpi_status acpi_find_root_pointer(acpi_physical_address *table_address)
 {
 	u8 *table_ptr;
 	u8 *mem_rover;
include/acpi/acpixf.h +1 -1
index 7aa38b648564..869d75ecaf7d 100644
@@ -474,7 +474,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
 			    acpi_reallocate_root_table(void))
 
-ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 			    acpi_find_root_pointer(acpi_physical_address
 						   *rsdp_address))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
Signature · 1 line
2.20.1

Kairui, thanks for the patches, did a test, it works for me.

Seems the two patches are not in a thread, can you resend them together?

Dave

#3 lore raw
Quoted 124 lines

-----Original Message-----
From: Dave Young [mailto:[email protected]]
Sent: Tuesday, January 15, 2019 12:42 AM
To: Kairui Song <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Moore, Robert <[email protected]>; Schmauss, Erik <[email protected]>; Wysocki, Rafael J <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=oldmap

Quoted 5 lines · Kairui Song

When efi=noruntime or efi=oldmap is used, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and won't boot. Previously we are expecting the user to set the acpi_rsdp=<addr> on kernel command line for second kernel as

there

Quoted 3 lines

was no way to pass RSDP address to second kernel.

After commit e6e094e053af ('x86/acpi, x86/boot: Take RSDP address

from

Quoted 2 lines

boot params if available'), now it's possible to set a acpi_rsdp_addr parameter in the boot_params passed to second kernel, this commit

make

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage

Quoted 27 lines

use of it, detect and set the RSDP address when it's required for second kernel to boot.

Tested with an EFI enabled KVM VM with efi=noruntime.

---
 arch/x86/kernel/kexec-bzimage64.c | 21 +++++++++++++++++++++
 drivers/acpi/acpica/tbxfroot.c    |  3 +--
 include/acpi/acpixf.h             |  2 +-
 3 files changed, 23 insertions(+), 3 deletions(-)
arch/x86/kernel/kexec-bzimage64.c +1 -0
index 53917a3ebf94..0a90dcbd041f 100644
@@ -20,6 +20,7 @@
 #include <linux/mm.h>
 #include <linux/efi.h>
 #include <linux/verification.h>
+#include <linux/acpi.h>
 
 #include <asm/bootparam.h>
 #include <asm/setup.h>
@@ -255,8 +256,28 @@ setup_boot_parameters(struct kimage

*image, struct boot_params *params,

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 257

Quoted 2 lines
arch/x86/kernel/kexec-bzimage64.c +0 -0
 	/* Setup EFI state */
 	setup_efi_state(params, params_load_addr, efi_map_offset,

efi_map_sz,

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 4 lines
arch/x86/kernel/kexec-bzimage64.c +3 -0
 			efi_setup_data_offset);
+
+#ifdef CONFIG_ACPI
+	/* Setup ACPI RSDP pointer in case EFI is not available in

second kernel */

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 262

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+	if (!acpi_disabled && (!efi_enabled(EFI_RUNTIME_SERVICES)

|| efi_enabled(EFI_OLD_MEMMAP))) {

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 263

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+		/* Copied from acpi_os_get_root_pointer accordingly

*/

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 264

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+		params->acpi_rsdp_addr =

boot_params.acpi_rsdp_addr;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 3 lines
arch/x86/kernel/kexec-bzimage64.c +3 -0
+		if (!params->acpi_rsdp_addr) {
+			if (efi_enabled(EFI_CONFIG_TABLES)) {
+				if (efi.acpi20 !=

EFI_INVALID_TABLE_ADDR)

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 268

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+					params->acpi_rsdp_addr =

efi.acpi20;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 269

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+				else if (efi.acpi !=

EFI_INVALID_TABLE_ADDR)

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 270

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+					params->acpi_rsdp_addr =

efi.acpi;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 271

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+			} else if

(IS_ENABLED(CONFIG_ACPI_LEGACY_TABLES_LOOKUP)) {

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 6 lines
arch/x86/kernel/kexec-bzimage64.c +5 -0
+				acpi_find_root_pointer(&params-
 acpi_rsdp_addr);
+			}
+		}
+		if (!params->acpi_rsdp_addr)
+			pr_warn("RSDP is not available for second

kernel\n");

Quoted 7 lines
arch/x86/kernel/kexec-bzimage64.c +2 -0
+	}
 #endif
 
+#endif
 	/* Setup EDD info */
 	memcpy(params->eddbuf, boot_params.eddbuf,

EDDMAXNR * sizeof(struct edd_info));

diff --git

drivers/acpi/acpica/tbxfroot.c acpi_status acpi_tb_validate_rsdp(struct

Quoted 5 lines

a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index 483d0ce5180a..dac1e34a931c 100644

drivers/acpi/acpica/tbxfroot.c +0 -0
@@ -108,8 +108,7 @@ acpi_status acpi_tb_validate_rsdp(struct

acpi_table_rsdp *rsdp)

drivers/acpi/acpica/tbxfroot.c acpi_status acpi_tb_validate_rsdp(struct · line 110

Quoted 3 lines
drivers/acpi/acpica/tbxfroot.c +0 -0
  *
 
 

******************************************************
****************

include/acpi/acpixf.h

Quoted 14 lines
drivers/acpi/acpica/tbxfroot.c +2 -2
 ********/
 
-acpi_status ACPI_INIT_FUNCTION
-acpi_find_root_pointer(acpi_physical_address *table_address)
+acpi_status acpi_find_root_pointer(acpi_physical_address
+*table_address)
 {
 	u8 *table_ptr;
 	u8 *mem_rover;
include/acpi/acpixf.h index renamed from include/acpi/acpixf.h +0 -0

7aa38b648564..869d75ecaf7d 100644

include/acpi/acpixf.h +0 -0
@@ -474,7 +474,7 @@

ACPI_EXTERNAL_RETURN_STATUS(acpi_status

Quoted 7 lines
Quoted 1 line

ACPI_INIT_FUNCTION

ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION

include/acpi/acpixf.h ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION

Quoted 3 lines
include/acpi/acpixf.h +0 -1
 			    acpi_reallocate_root_table(void))
 
-ACPI_EXTERNAL_RETURN_STATUS(acpi_status

ACPI_INIT_FUNCTION

Quoted 1 line

+ACPI_EXTERNAL_RETURN_STATUS(acpi_status

@JK

Do you see any issues with this? Does free BSD use ACPI_INIT_FUNCTION?

Quoted 14 lines
Quoted 1 line

acpi_find_root_pointer(acpi_physical_address

Quoted 5 lines

*rsdp_address))
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
--
2.20.1

Kairui, thanks for the patches, did a test, it works for me.

Seems the two patches are not in a thread, can you resend them together?

Dave

#4 lore raw
Quoted 126 lines · Erik
Quoted 126 lines

-----Original Message-----
From: Dave Young [mailto:[email protected]]
Sent: Tuesday, January 15, 2019 12:42 AM
To: Kairui Song <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Moore, Robert <[email protected]>; Schmauss, Erik <[email protected]>; Wysocki, Rafael J <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=oldmap

Quoted 5 lines · Kairui Song

When efi=noruntime or efi=oldmap is used, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and won't boot. Previously we are expecting the user to set the acpi_rsdp=<addr> on kernel command line for second kernel as

there

Quoted 3 lines

was no way to pass RSDP address to second kernel.

After commit e6e094e053af ('x86/acpi, x86/boot: Take RSDP address

from

Quoted 2 lines

boot params if available'), now it's possible to set a acpi_rsdp_addr parameter in the boot_params passed to second kernel, this commit

make

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage

Quoted 27 lines

use of it, detect and set the RSDP address when it's required for second kernel to boot.

Tested with an EFI enabled KVM VM with efi=noruntime.

---
 arch/x86/kernel/kexec-bzimage64.c | 21 +++++++++++++++++++++
 drivers/acpi/acpica/tbxfroot.c    |  3 +--
 include/acpi/acpixf.h             |  2 +-
 3 files changed, 23 insertions(+), 3 deletions(-)
arch/x86/kernel/kexec-bzimage64.c +1 -0
index 53917a3ebf94..0a90dcbd041f 100644
@@ -20,6 +20,7 @@
 #include <linux/mm.h>
 #include <linux/efi.h>
 #include <linux/verification.h>
+#include <linux/acpi.h>
 
 #include <asm/bootparam.h>
 #include <asm/setup.h>
@@ -255,8 +256,28 @@ setup_boot_parameters(struct kimage

*image, struct boot_params *params,

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 257

Quoted 2 lines
arch/x86/kernel/kexec-bzimage64.c +0 -0
 	/* Setup EFI state */
 	setup_efi_state(params, params_load_addr, efi_map_offset,

efi_map_sz,

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 4 lines
arch/x86/kernel/kexec-bzimage64.c +3 -0
 			efi_setup_data_offset);
+
+#ifdef CONFIG_ACPI
+	/* Setup ACPI RSDP pointer in case EFI is not available in

second kernel */

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 262

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+	if (!acpi_disabled && (!efi_enabled(EFI_RUNTIME_SERVICES)

|| efi_enabled(EFI_OLD_MEMMAP))) {

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 263

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+		/* Copied from acpi_os_get_root_pointer accordingly

*/

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 264

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+		params->acpi_rsdp_addr =

boot_params.acpi_rsdp_addr;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 3 lines
arch/x86/kernel/kexec-bzimage64.c +3 -0
+		if (!params->acpi_rsdp_addr) {
+			if (efi_enabled(EFI_CONFIG_TABLES)) {
+				if (efi.acpi20 !=

EFI_INVALID_TABLE_ADDR)

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 268

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+					params->acpi_rsdp_addr =

efi.acpi20;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 269

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+				else if (efi.acpi !=

EFI_INVALID_TABLE_ADDR)

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 270

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+					params->acpi_rsdp_addr =

efi.acpi;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage · line 271

Quoted 1 line
arch/x86/kernel/kexec-bzimage64.c +1 -0
+			} else if

(IS_ENABLED(CONFIG_ACPI_LEGACY_TABLES_LOOKUP)) {

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 6 lines
arch/x86/kernel/kexec-bzimage64.c +5 -0
+				acpi_find_root_pointer(&params-
 acpi_rsdp_addr);
+			}
+		}
+		if (!params->acpi_rsdp_addr)
+			pr_warn("RSDP is not available for second

kernel\n");

Quoted 7 lines
arch/x86/kernel/kexec-bzimage64.c +2 -0
+	}
 #endif
 
+#endif
 	/* Setup EDD info */
 	memcpy(params->eddbuf, boot_params.eddbuf,

EDDMAXNR * sizeof(struct edd_info));

diff --git

drivers/acpi/acpica/tbxfroot.c acpi_status acpi_tb_validate_rsdp(struct

Quoted 5 lines

a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index 483d0ce5180a..dac1e34a931c 100644

drivers/acpi/acpica/tbxfroot.c +0 -0
@@ -108,8 +108,7 @@ acpi_status acpi_tb_validate_rsdp(struct

acpi_table_rsdp *rsdp)

drivers/acpi/acpica/tbxfroot.c acpi_status acpi_tb_validate_rsdp(struct · line 110

Quoted 3 lines
drivers/acpi/acpica/tbxfroot.c +0 -0
  *
 
 

******************************************************
****************

include/acpi/acpixf.h

Quoted 14 lines
drivers/acpi/acpica/tbxfroot.c +2 -2
 ********/
 
-acpi_status ACPI_INIT_FUNCTION
-acpi_find_root_pointer(acpi_physical_address *table_address)
+acpi_status acpi_find_root_pointer(acpi_physical_address
+*table_address)
 {
 	u8 *table_ptr;
 	u8 *mem_rover;
include/acpi/acpixf.h index renamed from include/acpi/acpixf.h +0 -0

7aa38b648564..869d75ecaf7d 100644

include/acpi/acpixf.h +0 -0
@@ -474,7 +474,7 @@

ACPI_EXTERNAL_RETURN_STATUS(acpi_status

Quoted 1 line

ACPI_INIT_FUNCTION

ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION

Quoted 2 lines

acpi_reallocate_root_table(void))

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

-ACPI_EXTERNAL_RETURN_STATUS(acpi_status

ACPI_INIT_FUNCTION

Quoted 1 line

+ACPI_EXTERNAL_RETURN_STATUS(acpi_status

@JK

Do you see any issues with this? Does free BSD use ACPI_INIT_FUNCTION?

No, FreeBSD doesn't use ACPI_INIT_FUNCTION.

Jung-uk Kim

Quoted 11 lines
Quoted 11 lines

acpi_find_root_pointer(acpi_physical_address

Quoted 5 lines

*rsdp_address))
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
--
2.20.1

Kairui, thanks for the patches, did a test, it works for me.

Seems the two patches are not in a thread, can you resend them together?