Skip to contentSkip to conversation

x86: make rsdp address accessible via boot params

PATCH Superseded Juergen Gross 3 participants 33 messages Dec 7, 2017 – Dec 8, 2017

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

v2 cover x86: make rsdp address accessible via boot params

In the non-EFI boot path the ACPI RSDP table is currently found via either EBDA or by searching through low memory for the RSDP magic. This requires the RSDP to be located in the first 1MB of physical memory. Xen PVH guests, however, get the RSDP address via the start of day information block.

In order to support an arbitrary RSDP address this patch series adds the physical address of the RSDP to the boot params structure filled by the boot loader. A kernel booted directly in PVH mode can save the RSDP address in the boot params, while a kernel booted in PVH mode via grub can rely on the RSDP address being specified by grub2 (which in turn got the address via the start of day information block from Xen).

Juergen Gross (3):
x86/boot: add acpi rsdp address to setup_header x86/acpi: take rsdp address for boot params if available x86/xen: supply rsdp address in boot params for pvh guests

 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 arch/x86/xen/enlighten_pvh.c          |  5 ++++-
 drivers/acpi/osl.c                    |  8 ++++++++
 5 files changed, 37 insertions(+), 2 deletions(-)
Signature · 1 line
2.12.3
author maintainer
#1 lore raw

PATCH v2 1/3 x86/boot: add acpi rsdp address to setup_header

Xen PVH guests receive the address of the RSDP table from Xen. In order to support booting a Xen PVH guest via grub2 using the standard x86 boot entry we need a way fro grub2 to pass the RSDP address to the kernel.

For this purpose expand the struct setup_header to hold the physical address of the RSDP address. Being zero means it isn't specified and has to be located the legacy way (searching through low memory or EBDA).

---
 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/x86/boot.txt +19 -0
index 5e9b826b5f62..a33c224797e4 100644
@@ -61,6 +61,13 @@ Protocol 2.12:	(Kernel 3.8) Added the xloadflags field and extension fields
 	 	to struct boot_params for loading bzImage and ramdisk
 		above 4G in 64bit.
 
+Protocol 2.13:	(Kernel 3.14) Support 32- and 64-bit flags being set in
+		xloadflags to support booting a 64 bit kernel from 32 bit
+		EFI
+
+Protocol 2.14	(Kernel 4.16) Added acpi_rsdp_addr holding the physical
+		address of the ACPI RSDP table.
+
 **** MEMORY LAYOUT
 
 The traditional memory map for the kernel loader, used for Image or
@@ -197,6 +204,7 @@ Offset	Proto	Name		Meaning
 0258/8	2.10+	pref_address	Preferred loading address
 0260/4	2.10+	init_size	Linear memory required during initialization
 0264/4	2.11+	handover_offset	Offset of handover entry point
+0268/8	2.14+	acpi_rsdp_addr	Physical address of RSDP table
 
 (1) For backwards compatibility, if the setup_sects field contains 0, the
     real value is 4.
@@ -744,6 +752,17 @@ Offset/size:	0x264/4
 
   See EFI HANDOVER PROTOCOL below for more details.
 
+Field name:	acpi_rsdp_addr
+Type:		write
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).
+
 
 **** THE IMAGE CHECKSUM
 
arch/x86/boot/header.S +5 -1
index 850b8762e889..e7184127f309 100644
@@ -300,7 +300,7 @@ _start:
 	# Part 2 of the header, from the old setup.S
 
 		.ascii	"HdrS"		# header signature
-		.word	0x020d		# header version number (>= 0x0105)
+		.word	0x020e		# header version number (>= 0x0105)
 					# or else old loadlin-1.5 will fail)
 		.globl realmode_swtch
 realmode_swtch:	.word	0, 0		# default_switch, SETUPSEG
@@ -558,6 +558,10 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR	# preferred load addr
 init_size:		.long INIT_SIZE		# kernel initialization size
 handover_offset:	.long 0			# Filled in by build.c
 
+acpi_rsdp_addr:		.quad 0			# 64-bit physical pointer to
+						# ACPI RSDP table, added with
+						# version 2.14
+
 # End of setup header #####################################################
 
 	.section ".entrytext", "ax"
arch/x86/include/uapi/asm/bootparam.h +1 -0
index afdd5ae0fcc4..5742e433e93e 100644
@@ -85,6 +85,7 @@ struct setup_header {
 	__u64	pref_address;
 	__u32	init_size;
 	__u32	handover_offset;
+	__u64	acpi_rsdp_addr;
 } __attribute__((packed));
 
 struct sys_desc_table {
Signature · 1 line
2.12.3
#2 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

Quoted 9 lines · Juergen Gross

Xen PVH guests receive the address of the RSDP table from Xen. In order to support booting a Xen PVH guest via grub2 using the standard x86 boot entry we need a way fro grub2 to pass the RSDP address to the kernel.

For this purpose expand the struct setup_header to hold the physical address of the RSDP address. Being zero means it isn't specified and has to be located the legacy way (searching through low memory or EBDA).

s/fro
/for

pedantry:

s/grub2
/Grub2

Quoted 13 lines
---
 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/x86/boot.txt +0 -0
index 5e9b826b5f62..a33c224797e4 100644

Documentation/x86/boot.txt Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields · line 66

Quoted 6 lines
Documentation/x86/boot.txt +3 -0
@@ -61,6 +61,13 @@ Protocol 2.12:	(Kernel 3.8) Added the xloadflags field and extension fields
 	 	to struct boot_params for loading bzImage and ramdisk
 		above 4G in 64bit.
 
+Protocol 2.13:	(Kernel 3.14) Support 32- and 64-bit flags being set in
+		xloadflags to support booting a 64 bit kernel from 32 bit
+		EFI

The changelog should I think declare that we add documentation for the 2.13 protocol iteration as well.

Also, please use a consistent spelling of '32-bit' and '64-bit' in the same sentence!

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 10 lines
Documentation/x86/boot.txt +10 -0
+Field name:	acpi_rsdp_addr
+Type:		write
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Quoted 16 lines

**** THE IMAGE CHECKSUM

arch/x86/boot/header.S +1 -1
index 850b8762e889..e7184127f309 100644
@@ -300,7 +300,7 @@ _start:
 	# Part 2 of the header, from the old setup.S
 
 		.ascii	"HdrS"		# header signature
-		.word	0x020d		# header version number (>= 0x0105)
+		.word	0x020e		# header version number (>= 0x0105)
 					# or else old loadlin-1.5 will fail)
 		.globl realmode_swtch
 realmode_swtch:	.word	0, 0		# default_switch, SETUPSEG

arch/x86/boot/header.S pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr · line 563

Quoted 6 lines
arch/x86/boot/header.S +3 -0
@@ -558,6 +558,10 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR	# preferred load addr
 init_size:		.long INIT_SIZE		# kernel initialization size
 handover_offset:	.long 0			# Filled in by build.c
 
+acpi_rsdp_addr:		.quad 0			# 64-bit physical pointer to
+						# ACPI RSDP table, added with
+						# version 2.14

s/pointer to ACPI RSDP table
/pointer to the ACPI RSDP table

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

Thanks,

Ingo

#3 lore raw

Re: [Xen-devel] [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 08.12.17 at 08:16, <[email protected]> wrote:

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

Iirc the main purpose of the change here is to allow booting PVH (guest or Dom0) with Grub2 in the middle. PVH, at least for the time being, is something that gets away without any firmware (and I'm pretty certain this is going to remain that way for Dom0). ACPI tables are being built by the tool stack (guest) or hypervisor (Dom0). Hence there simply isn't any EFI which could be used to propagate such information.

Jan

#4 lore raw

Re: [Xen-devel] [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

Quoted 11 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 08.12.17 at 08:16, <[email protected]> wrote:

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

Iirc the main purpose of the change here is to allow booting PVH (guest or Dom0) with Grub2 in the middle. PVH, at least for the time being, is something that gets away without any firmware (and I'm pretty certain this is going to remain that way for Dom0). ACPI tables are being built by the tool stack (guest) or hypervisor (Dom0). Hence there simply isn't any EFI which could be used to propagate such information.

Ok, that's fair enough. If hpa (or someone else) doesn't object to the boot protocol extension this approach looks good to me in principle.

Thanks,

Ingo

#5 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 08.12.17 at 08:16, <[email protected]> wrote:

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

Iirc the main purpose of the change here is to allow booting PVH (guest or Dom0) with Grub2 in the middle. PVH, at least for the time being, is something that gets away without any firmware (and I'm pretty certain this is going to remain that way for Dom0). ACPI tables are being built by the tool stack (guest) or hypervisor (Dom0). Hence there simply isn't any EFI which could be used to propagate such information.

Ok, that's fair enough. If hpa (or someone else) doesn't object to the boot protocol extension this approach looks good to me in principle.

Thanks,

Ingo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Ingo Molnar
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 08.12.17 at 08:16, <[email protected]> wrote:

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

Iirc the main purpose of the change here is to allow booting PVH (guest or Dom0) with Grub2 in the middle. PVH, at least for the time being, is something that gets away without any firmware (and I'm pretty certain this is going to remain that way for Dom0). ACPI tables are being built by the tool stack (guest) or hypervisor (Dom0). Hence there simply isn't any EFI which could be used to propagate such information.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#7 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Ingo Molnar
Quoted 13 lines · Ingo Molnar
Quoted 9 lines · Juergen Gross

Xen PVH guests receive the address of the RSDP table from Xen. In order to support booting a Xen PVH guest via grub2 using the standard x86 boot entry we need a way fro grub2 to pass the RSDP address to the kernel.

For this purpose expand the struct setup_header to hold the physical address of the RSDP address. Being zero means it isn't specified and has to be located the legacy way (searching through low memory or EBDA).

Quoted 7 lines

s/fro
/for

pedantry:

s/grub2
/Grub2

Okay.

Quoted 24 lines
Quoted 14 lines
---
 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/x86/boot.txt +0 -0
index 5e9b826b5f62..a33c224797e4 100644

Documentation/x86/boot.txt Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields · line 66

Quoted 6 lines
Documentation/x86/boot.txt +3 -0
@@ -61,6 +61,13 @@ Protocol 2.12:	(Kernel 3.8) Added the xloadflags field and extension fields
 	 	to struct boot_params for loading bzImage and ramdisk
 		above 4G in 64bit.
 
+Protocol 2.13:	(Kernel 3.14) Support 32- and 64-bit flags being set in
+		xloadflags to support booting a 64 bit kernel from 32 bit
+		EFI

The changelog should I think declare that we add documentation for the 2.13 protocol iteration as well.

Quoted 2 lines

Also, please use a consistent spelling of '32-bit' and '64-bit' in the same sentence!

Okay.

Quoted 14 lines

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 11 lines
Documentation/x86/boot.txt +10 -0
+Field name:	acpi_rsdp_addr
+Type:		write
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Sure, but this is valid for booting via EFI only.

Quoted 20 lines
Quoted 20 lines

**** THE IMAGE CHECKSUM

arch/x86/boot/header.S +1 -1
index 850b8762e889..e7184127f309 100644
@@ -300,7 +300,7 @@ _start:
 	# Part 2 of the header, from the old setup.S
 
 		.ascii	"HdrS"		# header signature
-		.word	0x020d		# header version number (>= 0x0105)
+		.word	0x020e		# header version number (>= 0x0105)
 					# or else old loadlin-1.5 will fail)
 		.globl realmode_swtch
 realmode_swtch:	.word	0, 0		# default_switch, SETUPSEG
@@ -558,6 +558,10 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR	# preferred load addr
 init_size:		.long INIT_SIZE		# kernel initialization size
 handover_offset:	.long 0			# Filled in by build.c
 
Quoted 6 lines

arch/x86/boot/header.S pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr · line 563

Quoted 3 lines
arch/x86/boot/header.S +3 -0
+acpi_rsdp_addr:		.quad 0			# 64-bit physical pointer to
+						# ACPI RSDP table, added with
+						# version 2.14

s/pointer to ACPI RSDP table
/pointer to the ACPI RSDP table

Okay.

Quoted 3 lines

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

I think Jan has answered this question quite well.

Juergen

#8 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

Quoted 12 lines · Juergen Gross
Quoted 11 lines

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 8 lines
Documentation/x86/boot.txt +8 -0
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Quoted 1 line

Sure, but this is valid for booting via EFI only.

Yeah, so what I tried to say is that the description as written is not fully correct and triggered my pedantry:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP (search in EBDA/low memory).

To make it correct we need to either write less:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP.

or write more and make it open ended so it doesn't have to be extended with every method of getting the RSDP that might be added in the future:

 +  A value of 0 indicates the kernel should fall back to the standard
 +  methods to locate the RSDP (search in EBDA/low memory, get it from
 +  EFI if present, etc.).

... or so?

Thanks,

Ingo

author maintainer
#9 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

Quoted 28 lines · Ingo Molnar
Quoted 12 lines · Juergen Gross
Quoted 11 lines

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 8 lines
Documentation/x86/boot.txt +8 -0
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Quoted 1 line

Sure, but this is valid for booting via EFI only.

Yeah, so what I tried to say is that the description as written is not fully correct and triggered my pedantry:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP (search in EBDA/low memory).

To make it correct we need to either write less:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP.

Quoted 8 lines

or write more and make it open ended so it doesn't have to be extended with every method of getting the RSDP that might be added in the future:

 +  A value of 0 indicates the kernel should fall back to the standard
 +  methods to locate the RSDP (search in EBDA/low memory, get it from
 +  EFI if present, etc.).

... or so?

Aah, okay. I got your remark wrong then.

I think I'll go with the shorter variant.

Juergen

author maintainer
#10 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Ingo Molnar
Quoted 28 lines · Ingo Molnar
Quoted 12 lines · Juergen Gross
Quoted 11 lines

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 8 lines
Documentation/x86/boot.txt +8 -0
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Quoted 1 line

Sure, but this is valid for booting via EFI only.

Yeah, so what I tried to say is that the description as written is not fully correct and triggered my pedantry:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP (search in EBDA/low memory).

To make it correct we need to either write less:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP.

Quoted 8 lines

or write more and make it open ended so it doesn't have to be extended with every method of getting the RSDP that might be added in the future:

 +  A value of 0 indicates the kernel should fall back to the standard
 +  methods to locate the RSDP (search in EBDA/low memory, get it from
 +  EFI if present, etc.).

... or so?

Aah, okay. I got your remark wrong then.

I think I'll go with the shorter variant.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Juergen Gross
Quoted 12 lines · Juergen Gross
Quoted 11 lines

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 8 lines
Documentation/x86/boot.txt +8 -0
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Quoted 1 line

Sure, but this is valid for booting via EFI only.

Yeah, so what I tried to say is that the description as written is not fully correct and triggered my pedantry:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP (search in EBDA/low memory).

To make it correct we need to either write less:

+ A value of 0 indicates the kernel should fall back to the standard
+ methods to locate the RSDP.

or write more and make it open ended so it doesn't have to be extended with every method of getting the RSDP that might be added in the future:

 +  A value of 0 indicates the kernel should fall back to the standard
 +  methods to locate the RSDP (search in EBDA/low memory, get it from
 +  EFI if present, etc.).

... or so?

Thanks,

Ingo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#12 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Ingo Molnar
Quoted 13 lines · Ingo Molnar
Quoted 9 lines · Juergen Gross

Xen PVH guests receive the address of the RSDP table from Xen. In order to support booting a Xen PVH guest via grub2 using the standard x86 boot entry we need a way fro grub2 to pass the RSDP address to the kernel.

For this purpose expand the struct setup_header to hold the physical address of the RSDP address. Being zero means it isn't specified and has to be located the legacy way (searching through low memory or EBDA).

Quoted 7 lines

s/fro
/for

pedantry:

s/grub2
/Grub2

Okay.

Quoted 24 lines
Quoted 14 lines
---
 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/x86/boot.txt +0 -0
index 5e9b826b5f62..a33c224797e4 100644

Documentation/x86/boot.txt Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields · line 66

Quoted 6 lines
Documentation/x86/boot.txt +3 -0
@@ -61,6 +61,13 @@ Protocol 2.12:	(Kernel 3.8) Added the xloadflags field and extension fields
 	 	to struct boot_params for loading bzImage and ramdisk
 		above 4G in 64bit.
 
+Protocol 2.13:	(Kernel 3.14) Support 32- and 64-bit flags being set in
+		xloadflags to support booting a 64 bit kernel from 32 bit
+		EFI

The changelog should I think declare that we add documentation for the 2.13 protocol iteration as well.

Quoted 2 lines

Also, please use a consistent spelling of '32-bit' and '64-bit' in the same sentence!

Okay.

Quoted 14 lines

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 11 lines
Documentation/x86/boot.txt +10 -0
+Field name:	acpi_rsdp_addr
+Type:		write
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Sure, but this is valid for booting via EFI only.

Quoted 20 lines
Quoted 20 lines

**** THE IMAGE CHECKSUM

arch/x86/boot/header.S +1 -1
index 850b8762e889..e7184127f309 100644
@@ -300,7 +300,7 @@ _start:
 	# Part 2 of the header, from the old setup.S
 
 		.ascii	"HdrS"		# header signature
-		.word	0x020d		# header version number (>= 0x0105)
+		.word	0x020e		# header version number (>= 0x0105)
 					# or else old loadlin-1.5 will fail)
 		.globl realmode_swtch
 realmode_swtch:	.word	0, 0		# default_switch, SETUPSEG
@@ -558,6 +558,10 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR	# preferred load addr
 init_size:		.long INIT_SIZE		# kernel initialization size
 handover_offset:	.long 0			# Filled in by build.c
 
Quoted 6 lines

arch/x86/boot/header.S pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr · line 563

Quoted 3 lines
arch/x86/boot/header.S +3 -0
+acpi_rsdp_addr:		.quad 0			# 64-bit physical pointer to
+						# ACPI RSDP table, added with
+						# version 2.14

s/pointer to ACPI RSDP table
/pointer to the ACPI RSDP table

Okay.

Quoted 3 lines

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

I think Jan has answered this question quite well.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH v2 1/3] x86/boot: add acpi rsdp address to setup_header

In reply to Juergen Gross
Quoted 9 lines · Juergen Gross

Xen PVH guests receive the address of the RSDP table from Xen. In order to support booting a Xen PVH guest via grub2 using the standard x86 boot entry we need a way fro grub2 to pass the RSDP address to the kernel.

For this purpose expand the struct setup_header to hold the physical address of the RSDP address. Being zero means it isn't specified and has to be located the legacy way (searching through low memory or EBDA).

s/fro
/for

pedantry:

s/grub2
/Grub2

Quoted 13 lines
---
 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/x86/boot.txt +0 -0
index 5e9b826b5f62..a33c224797e4 100644

Documentation/x86/boot.txt Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields · line 66

Quoted 6 lines
Documentation/x86/boot.txt +3 -0
@@ -61,6 +61,13 @@ Protocol 2.12:	(Kernel 3.8) Added the xloadflags field and extension fields
 	 	to struct boot_params for loading bzImage and ramdisk
 		above 4G in 64bit.
 
+Protocol 2.13:	(Kernel 3.14) Support 32- and 64-bit flags being set in
+		xloadflags to support booting a 64 bit kernel from 32 bit
+		EFI

The changelog should I think declare that we add documentation for the 2.13 protocol iteration as well.

Also, please use a consistent spelling of '32-bit' and '64-bit' in the same sentence!

Documentation/x86/boot.txt Offset/size: 0x264/4 · line 764

Quoted 10 lines
Documentation/x86/boot.txt +10 -0
+Field name:	acpi_rsdp_addr
+Type:		write
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).

That's not the only method used: the ACPI RSDP address can also be discovered via efi.rsdp20 and efi.rsdp, both of which appear to be 32-bit values.

Quoted 16 lines

**** THE IMAGE CHECKSUM

arch/x86/boot/header.S +1 -1
index 850b8762e889..e7184127f309 100644
@@ -300,7 +300,7 @@ _start:
 	# Part 2 of the header, from the old setup.S
 
 		.ascii	"HdrS"		# header signature
-		.word	0x020d		# header version number (>= 0x0105)
+		.word	0x020e		# header version number (>= 0x0105)
 					# or else old loadlin-1.5 will fail)
 		.globl realmode_swtch
 realmode_swtch:	.word	0, 0		# default_switch, SETUPSEG

arch/x86/boot/header.S pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr · line 563

Quoted 6 lines
arch/x86/boot/header.S +3 -0
@@ -558,6 +558,10 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR	# preferred load addr
 init_size:		.long INIT_SIZE		# kernel initialization size
 handover_offset:	.long 0			# Filled in by build.c
 
+acpi_rsdp_addr:		.quad 0			# 64-bit physical pointer to
+						# ACPI RSDP table, added with
+						# version 2.14

s/pointer to ACPI RSDP table
/pointer to the ACPI RSDP table

Also, a more fundamental question: why doesn't Xen use EFI to hand over hardware configuration details?

Thanks,

Ingo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#14 lore raw

PATCH v2 1/3 x86/boot: add acpi rsdp address to setup_header

In reply to Juergen Gross

Xen PVH guests receive the address of the RSDP table from Xen. In order to support booting a Xen PVH guest via grub2 using the standard x86 boot entry we need a way fro grub2 to pass the RSDP address to the kernel.

For this purpose expand the struct setup_header to hold the physical address of the RSDP address. Being zero means it isn't specified and has to be located the legacy way (searching through low memory or EBDA).

---
 Documentation/x86/boot.txt            | 19 +++++++++++++++++++
 arch/x86/boot/header.S                |  6 +++++-
 arch/x86/include/uapi/asm/bootparam.h |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/x86/boot.txt +19 -0
index 5e9b826b5f62..a33c224797e4 100644
@@ -61,6 +61,13 @@ Protocol 2.12:	(Kernel 3.8) Added the xloadflags field and extension fields
 	 	to struct boot_params for loading bzImage and ramdisk
 		above 4G in 64bit.
 
+Protocol 2.13:	(Kernel 3.14) Support 32- and 64-bit flags being set in
+		xloadflags to support booting a 64 bit kernel from 32 bit
+		EFI
+
+Protocol 2.14	(Kernel 4.16) Added acpi_rsdp_addr holding the physical
+		address of the ACPI RSDP table.
+
 **** MEMORY LAYOUT
 
 The traditional memory map for the kernel loader, used for Image or
@@ -197,6 +204,7 @@ Offset	Proto	Name		Meaning
 0258/8	2.10+	pref_address	Preferred loading address
 0260/4	2.10+	init_size	Linear memory required during initialization
 0264/4	2.11+	handover_offset	Offset of handover entry point
+0268/8	2.14+	acpi_rsdp_addr	Physical address of RSDP table
 
 (1) For backwards compatibility, if the setup_sects field contains 0, the
     real value is 4.
@@ -744,6 +752,17 @@ Offset/size:	0x264/4
 
   See EFI HANDOVER PROTOCOL below for more details.
 
+Field name:	acpi_rsdp_addr
+Type:		write
+Offset/size:	0x268/8
+Protocol:	2.14+
+
+  This field can be set by the boot loader to tell the kernel the
+  physical address of the ACPI RSDP table.
+
+  A value of 0 indicates the kernel should fall back to the standard
+  methods to locate the RSDP (search in EBDA/low memory).
+
 
 **** THE IMAGE CHECKSUM
 
arch/x86/boot/header.S +5 -1
index 850b8762e889..e7184127f309 100644
@@ -300,7 +300,7 @@ _start:
 	# Part 2 of the header, from the old setup.S
 
 		.ascii	"HdrS"		# header signature
-		.word	0x020d		# header version number (>= 0x0105)
+		.word	0x020e		# header version number (>= 0x0105)
 					# or else old loadlin-1.5 will fail)
 		.globl realmode_swtch
 realmode_swtch:	.word	0, 0		# default_switch, SETUPSEG
@@ -558,6 +558,10 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR	# preferred load addr
 init_size:		.long INIT_SIZE		# kernel initialization size
 handover_offset:	.long 0			# Filled in by build.c
 
+acpi_rsdp_addr:		.quad 0			# 64-bit physical pointer to
+						# ACPI RSDP table, added with
+						# version 2.14
+
 # End of setup header #####################################################
 
 	.section ".entrytext", "ax"
arch/x86/include/uapi/asm/bootparam.h +1 -0
index afdd5ae0fcc4..5742e433e93e 100644
@@ -85,6 +85,7 @@ struct setup_header {
 	__u64	pref_address;
 	__u32	init_size;
 	__u32	handover_offset;
+	__u64	acpi_rsdp_addr;
 } __attribute__((packed));
 
 struct sys_desc_table {
Signature · 7 lines
2.12.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author maintainer
#15 lore raw

PATCH v2 2/3 x86/acpi: take rsdp address for boot params if available

In reply to Juergen Gross

In case the rsdp address in struct boot_params is specified don't try to find the table by searching, but take the address directly as set by the boot loader.

---
 drivers/acpi/osl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/osl.c +8 -0
index 3bb46cb24a99..3b25e2ad7d75 100644
@@ -45,6 +45,10 @@
 #include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#ifdef CONFIG_X86
+#include <asm/setup.h>
+#endif
+
 #include "internal.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES
@@ -195,6 +199,10 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 	if (acpi_rsdp)
 		return acpi_rsdp;
 #endif
+#ifdef CONFIG_X86
+	if (boot_params.hdr.acpi_rsdp_addr)
+		return boot_params.hdr.acpi_rsdp_addr;
+#endif
 
 	if (efi_enabled(EFI_CONFIG_TABLES)) {
 		if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
Signature · 1 line
2.12.3
#16 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

Quoted 25 lines · Juergen Gross

In case the rsdp address in struct boot_params is specified don't try to find the table by searching, but take the address directly as set by the boot loader.

---
 drivers/acpi/osl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/osl.c +4 -0
index 3bb46cb24a99..3b25e2ad7d75 100644
@@ -45,6 +45,10 @@
 #include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#ifdef CONFIG_X86
+#include <asm/setup.h>
+#endif
+
 #include "internal.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES

drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 205

Quoted 7 lines
drivers/acpi/osl.c +4 -0
@@ -195,6 +199,10 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 	if (acpi_rsdp)
 		return acpi_rsdp;
 #endif
+#ifdef CONFIG_X86
+	if (boot_params.hdr.acpi_rsdp_addr)
+		return boot_params.hdr.acpi_rsdp_addr;
+#endif

Argh, that's typical short sighted hackery, layering violations and general eyesore combined into a single patch ...

Those #ifdefs are a disgrace, plus why should generic ACPI code include platform details like boot_params.hdr/acpi_rsdp_addr? It's also not very extensible to non-x86 - so someone will have to redo this work for ARM64 as well in the future
...

So how about doing it right:

1)

Add a __weak acpi_arch_get_root_pointer() __weak function to drivers/acpi/osl.c:

__weak acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return 0;
}

2)

use it in acpi_os_get_root_pointer():

	...
	pa = acpi_arch_get_root_pointer();
	if (pa)
		return pa;
	...

3)

Override the default variant in x86's acpi.c via something like:

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

5)

Add #include <asm/acpi.h> to drivers/acpi/osl.c.

That looks much cleaner, has no layering violations and is infinitely more extensible, right?

Thanks,

Ingo

author maintainer
#17 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

Quoted 81 lines · Ingo Molnar
Quoted 25 lines · Juergen Gross

In case the rsdp address in struct boot_params is specified don't try to find the table by searching, but take the address directly as set by the boot loader.

---
 drivers/acpi/osl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/osl.c +4 -0
index 3bb46cb24a99..3b25e2ad7d75 100644
@@ -45,6 +45,10 @@
 #include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#ifdef CONFIG_X86
+#include <asm/setup.h>
+#endif
+
 #include "internal.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES

drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 205

Quoted 7 lines
drivers/acpi/osl.c +4 -0
@@ -195,6 +199,10 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 	if (acpi_rsdp)
 		return acpi_rsdp;
 #endif
+#ifdef CONFIG_X86
+	if (boot_params.hdr.acpi_rsdp_addr)
+		return boot_params.hdr.acpi_rsdp_addr;
+#endif

Argh, that's typical short sighted hackery, layering violations and general eyesore combined into a single patch ...

Those #ifdefs are a disgrace, plus why should generic ACPI code include platform details like boot_params.hdr/acpi_rsdp_addr? It's also not very extensible to non-x86 - so someone will have to redo this work for ARM64 as well in the future
...

So how about doing it right:

1)

Add a __weak acpi_arch_get_root_pointer() __weak function to drivers/acpi/osl.c:

__weak acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return 0;
}

2)

use it in acpi_os_get_root_pointer():

	...
	pa = acpi_arch_get_root_pointer();
	if (pa)
		return pa;
	...

3)

Override the default variant in x86's acpi.c via something like:

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Quoted 7 lines

5)

Add #include <asm/acpi.h> to drivers/acpi/osl.c.

That looks much cleaner, has no layering violations and is infinitely more extensible, right?

Right.

Thanks for the very constructive comment.

Juergen

author maintainer
#18 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

In reply to Ingo Molnar
Quoted 81 lines · Ingo Molnar
Quoted 25 lines · Juergen Gross

In case the rsdp address in struct boot_params is specified don't try to find the table by searching, but take the address directly as set by the boot loader.

---
 drivers/acpi/osl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/osl.c +4 -0
index 3bb46cb24a99..3b25e2ad7d75 100644
@@ -45,6 +45,10 @@
 #include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#ifdef CONFIG_X86
+#include <asm/setup.h>
+#endif
+
 #include "internal.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES

drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 205

Quoted 7 lines
drivers/acpi/osl.c +4 -0
@@ -195,6 +199,10 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 	if (acpi_rsdp)
 		return acpi_rsdp;
 #endif
+#ifdef CONFIG_X86
+	if (boot_params.hdr.acpi_rsdp_addr)
+		return boot_params.hdr.acpi_rsdp_addr;
+#endif

Argh, that's typical short sighted hackery, layering violations and general eyesore combined into a single patch ...

Those #ifdefs are a disgrace, plus why should generic ACPI code include platform details like boot_params.hdr/acpi_rsdp_addr? It's also not very extensible to non-x86 - so someone will have to redo this work for ARM64 as well in the future
...

So how about doing it right:

1)

Add a __weak acpi_arch_get_root_pointer() __weak function to drivers/acpi/osl.c:

__weak acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return 0;
}

2)

use it in acpi_os_get_root_pointer():

	...
	pa = acpi_arch_get_root_pointer();
	if (pa)
		return pa;
	...

3)

Override the default variant in x86's acpi.c via something like:

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Quoted 7 lines

5)

Add #include <asm/acpi.h> to drivers/acpi/osl.c.

That looks much cleaner, has no layering violations and is infinitely more extensible, right?

Right.

Thanks for the very constructive comment.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#19 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

In reply to Ingo Molnar
Quoted 2 lines · Ingo Molnar

* Juergen Gross <[email protected]> wrote:

...

Quoted 10 lines

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Uuh, this leads to problems for files including <asm/acpi.h> directly:
acpi_physical_address won't be defined, and including <acpi/actypes.h> from arch/x86/include/asm/acpi.h will lead to:

#error unknown ACPI_MACHINE_WIDTH

This can only be avoided by including <linux/acpi.h> from <asm/acpi.h> which seems to be the wrong layering.

So I could:

a) modify the sources including <asm/acpi.h> to use <linux/acpi.h> instead
b) don't use acpi_physical_address but either u64 or unsigned long.
c) ?

What would be your preference?

Juergen

#20 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

Quoted 26 lines · Juergen Gross
Quoted 2 lines · Ingo Molnar

* Juergen Gross <[email protected]> wrote:

...

Quoted 10 lines

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Uuh, this leads to problems for files including <asm/acpi.h> directly:
acpi_physical_address won't be defined, and including <acpi/actypes.h> from arch/x86/include/asm/acpi.h will lead to:

#error unknown ACPI_MACHINE_WIDTH

This can only be avoided by including <linux/acpi.h> from <asm/acpi.h> which seems to be the wrong layering.

Quoted 8 lines

So I could:

a) modify the sources including <asm/acpi.h> to use <linux/acpi.h> instead
b) don't use acpi_physical_address but either u64 or unsigned long.
c) ?

What would be your preference?

Would it help if you put the prototype into linux/acpi.h perhaps? It's a generic facility in principle, even if only used by x86 at the moment.

Thanks,

Ingo

author maintainer
#21 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

Quoted 36 lines · Ingo Molnar
Quoted 33 lines · Juergen Gross
Quoted 2 lines · Ingo Molnar

* Juergen Gross <[email protected]> wrote:

...

Quoted 10 lines

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Uuh, this leads to problems for files including <asm/acpi.h> directly:
acpi_physical_address won't be defined, and including <acpi/actypes.h> from arch/x86/include/asm/acpi.h will lead to:

#error unknown ACPI_MACHINE_WIDTH

This can only be avoided by including <linux/acpi.h> from <asm/acpi.h> which seems to be the wrong layering.

So I could:

a) modify the sources including <asm/acpi.h> to use <linux/acpi.h> instead
b) don't use acpi_physical_address but either u64 or unsigned long.
c) ?

Quoted 4 lines
Quoted 1 line

What would be your preference?

Would it help if you put the prototype into linux/acpi.h perhaps? It's a generic facility in principle, even if only used by x86 at the moment.

Yes, that seems to work.

Thanks,

Juergen

author maintainer
#22 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

In reply to Ingo Molnar
Quoted 36 lines · Ingo Molnar
Quoted 33 lines · Juergen Gross
Quoted 2 lines · Ingo Molnar

* Juergen Gross <[email protected]> wrote:

...

Quoted 10 lines

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Uuh, this leads to problems for files including <asm/acpi.h> directly:
acpi_physical_address won't be defined, and including <acpi/actypes.h> from arch/x86/include/asm/acpi.h will lead to:

#error unknown ACPI_MACHINE_WIDTH

This can only be avoided by including <linux/acpi.h> from <asm/acpi.h> which seems to be the wrong layering.

So I could:

a) modify the sources including <asm/acpi.h> to use <linux/acpi.h> instead
b) don't use acpi_physical_address but either u64 or unsigned long.
c) ?

Quoted 4 lines
Quoted 1 line

What would be your preference?

Would it help if you put the prototype into linux/acpi.h perhaps? It's a generic facility in principle, even if only used by x86 at the moment.

Yes, that seems to work.

Thanks,

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#23 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

In reply to Juergen Gross
Quoted 26 lines · Juergen Gross
Quoted 2 lines · Ingo Molnar

* Juergen Gross <[email protected]> wrote:

...

Quoted 10 lines

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Uuh, this leads to problems for files including <asm/acpi.h> directly:
acpi_physical_address won't be defined, and including <acpi/actypes.h> from arch/x86/include/asm/acpi.h will lead to:

#error unknown ACPI_MACHINE_WIDTH

This can only be avoided by including <linux/acpi.h> from <asm/acpi.h> which seems to be the wrong layering.

Quoted 8 lines

So I could:

a) modify the sources including <asm/acpi.h> to use <linux/acpi.h> instead
b) don't use acpi_physical_address but either u64 or unsigned long.
c) ?

What would be your preference?

Would it help if you put the prototype into linux/acpi.h perhaps? It's a generic facility in principle, even if only used by x86 at the moment.

Thanks,

Ingo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#24 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

In reply to Ingo Molnar
Quoted 2 lines · Ingo Molnar

* Juergen Gross <[email protected]> wrote:

...

Quoted 10 lines

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

Uuh, this leads to problems for files including <asm/acpi.h> directly:
acpi_physical_address won't be defined, and including <acpi/actypes.h> from arch/x86/include/asm/acpi.h will lead to:

#error unknown ACPI_MACHINE_WIDTH

This can only be avoided by including <linux/acpi.h> from <asm/acpi.h> which seems to be the wrong layering.

So I could:

a) modify the sources including <asm/acpi.h> to use <linux/acpi.h> instead
b) don't use acpi_physical_address but either u64 or unsigned long.
c) ?

What would be your preference?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#25 lore raw

Re: [PATCH v2 2/3] x86/acpi: take rsdp address for boot params if available

In reply to Juergen Gross
Quoted 25 lines · Juergen Gross

In case the rsdp address in struct boot_params is specified don't try to find the table by searching, but take the address directly as set by the boot loader.

---
 drivers/acpi/osl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/osl.c +4 -0
index 3bb46cb24a99..3b25e2ad7d75 100644
@@ -45,6 +45,10 @@
 #include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#ifdef CONFIG_X86
+#include <asm/setup.h>
+#endif
+
 #include "internal.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES

drivers/acpi/osl.c acpi_physical_address __init acpi_os_get_root_pointer(void) · line 205

Quoted 7 lines
drivers/acpi/osl.c +4 -0
@@ -195,6 +199,10 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 	if (acpi_rsdp)
 		return acpi_rsdp;
 #endif
+#ifdef CONFIG_X86
+	if (boot_params.hdr.acpi_rsdp_addr)
+		return boot_params.hdr.acpi_rsdp_addr;
+#endif

Argh, that's typical short sighted hackery, layering violations and general eyesore combined into a single patch ...

Those #ifdefs are a disgrace, plus why should generic ACPI code include platform details like boot_params.hdr/acpi_rsdp_addr? It's also not very extensible to non-x86 - so someone will have to redo this work for ARM64 as well in the future
...

So how about doing it right:

1)

Add a __weak acpi_arch_get_root_pointer() __weak function to drivers/acpi/osl.c:

__weak acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return 0;
}

2)

use it in acpi_os_get_root_pointer():

	...
	pa = acpi_arch_get_root_pointer();
	if (pa)
		return pa;
	...

3)

Override the default variant in x86's acpi.c via something like:

acpi_physical_address acpi_arch_get_root_pointer(void)

{
	return boot_params.hdr.acpi_rsdp_addr;
}

4)

Add this to arch/x86/include/asm/acpi.h:

extern acpi_physical_address acpi_arch_get_root_pointer(void);

5)

Add #include <asm/acpi.h> to drivers/acpi/osl.c.

That looks much cleaner, has no layering violations and is infinitely more extensible, right?

Thanks,

Ingo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#26 lore raw

PATCH v2 2/3 x86/acpi: take rsdp address for boot params if available

In reply to Juergen Gross

In case the rsdp address in struct boot_params is specified don't try to find the table by searching, but take the address directly as set by the boot loader.

---
 drivers/acpi/osl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/osl.c +8 -0
index 3bb46cb24a99..3b25e2ad7d75 100644
@@ -45,6 +45,10 @@
 #include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#ifdef CONFIG_X86
+#include <asm/setup.h>
+#endif
+
 #include "internal.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES
@@ -195,6 +199,10 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 	if (acpi_rsdp)
 		return acpi_rsdp;
 #endif
+#ifdef CONFIG_X86
+	if (boot_params.hdr.acpi_rsdp_addr)
+		return boot_params.hdr.acpi_rsdp_addr;
+#endif
 
 	if (efi_enabled(EFI_CONFIG_TABLES)) {
 		if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
Signature · 7 lines
2.12.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author maintainer
#27 lore raw

PATCH v2 3/3 x86/xen: supply rsdp address in boot params for pvh guests

In reply to Juergen Gross

When booted via the special PVH entry save the RSDP address set in the boot information block in struct boot_params. This will enable Xen to locate the RSDP at an arbitrary address.

Set the boot loader version to 2.14 (0x020e) replacing the wrong 0x0212 which should have been 0x020c.

---
V2: set bootloader version to 2.14 (Roger Pau Monné)

---
 arch/x86/xen/enlighten_pvh.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +4 -1
index 436c4f003e17..036e3a5f284a 100644
@@ -68,9 +68,12 @@ static void __init init_pvh_bootparams(void)
 	 *
 	 * Version 2.12 supports Xen entry point but we will use default x86/PC
 	 * environment (i.e. hardware_subarch 0).
+	 * The RSDP address is available from version 2.14 on.
 	 */
-	pvh_bootparams.hdr.version = 0x212;
+	pvh_bootparams.hdr.version = 0x20e;
 	pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */
+
+	pvh_bootparams.hdr.acpi_rsdp_addr = pvh_start_info.rsdp_paddr;
 }
 
 /*
Signature · 1 line
2.12.3
#28 lore raw

Re: [PATCH v2 3/3] x86/xen: supply rsdp address in boot params for pvh guests

Quoted 19 lines · Juergen Gross

When booted via the special PVH entry save the RSDP address set in the boot information block in struct boot_params. This will enable Xen to locate the RSDP at an arbitrary address.

Set the boot loader version to 2.14 (0x020e) replacing the wrong 0x0212 which should have been 0x020c.

---
V2: set bootloader version to 2.14 (Roger Pau Monné)

---
 arch/x86/xen/enlighten_pvh.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +0 -0
index 436c4f003e17..036e3a5f284a 100644

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 73

Quoted 7 lines
arch/x86/xen/enlighten_pvh.c +2 -1
@@ -68,9 +68,12 @@ static void __init init_pvh_bootparams(void)
 	 *
 	 * Version 2.12 supports Xen entry point but we will use default x86/PC
 	 * environment (i.e. hardware_subarch 0).
+	 * The RSDP address is available from version 2.14 on.
 	 */
-	pvh_bootparams.hdr.version = 0x212;
+	pvh_bootparams.hdr.version = 0x20e;

While 0x212 was "obvious" to read but totally wrong, it would be less fragile and more readable if the version was generated as something like:

	pvh_bootparams.hdr.version = (2 << 8) | 14;

similar to how it's written in other cases:

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 74

Quoted 1 line
arch/x86/xen/enlighten_pvh.c +0 -0
 	pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */

Also, shouldn't the 0x212 fix be a separate patch, Cc: stable? The bug appears to have been introduced at around v4.12.

Thanks,

Ingo

author maintainer
#29 lore raw

Re: [PATCH v2 3/3] x86/xen: supply rsdp address in boot params for pvh guests

Quoted 33 lines · Ingo Molnar
Quoted 19 lines · Juergen Gross

When booted via the special PVH entry save the RSDP address set in the boot information block in struct boot_params. This will enable Xen to locate the RSDP at an arbitrary address.

Set the boot loader version to 2.14 (0x020e) replacing the wrong 0x0212 which should have been 0x020c.

---
V2: set bootloader version to 2.14 (Roger Pau Monné)

---
 arch/x86/xen/enlighten_pvh.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +0 -0
index 436c4f003e17..036e3a5f284a 100644

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 73

Quoted 7 lines
arch/x86/xen/enlighten_pvh.c +2 -1
@@ -68,9 +68,12 @@ static void __init init_pvh_bootparams(void)
 	 *
 	 * Version 2.12 supports Xen entry point but we will use default x86/PC
 	 * environment (i.e. hardware_subarch 0).
+	 * The RSDP address is available from version 2.14 on.
 	 */
-	pvh_bootparams.hdr.version = 0x212;
+	pvh_bootparams.hdr.version = 0x20e;

While 0x212 was "obvious" to read but totally wrong, it would be less fragile and more readable if the version was generated as something like:

Quoted 1 line
	pvh_bootparams.hdr.version = (2 << 8) | 14;

Sure, I can make that change.

Quoted 7 lines

similar to how it's written in other cases:

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 74

Quoted 1 line
arch/x86/xen/enlighten_pvh.c +0 -0
 	pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */

Also, shouldn't the 0x212 fix be a separate patch, Cc: stable? The bug appears to have been introduced at around v4.12.

While not really being very important, this seems to be cleaner, yes. After all this value is visible in sysfs, so it should be correct.

Juergen

author maintainer
#30 lore raw

Re: [PATCH v2 3/3] x86/xen: supply rsdp address in boot params for pvh guests

In reply to Ingo Molnar
Quoted 33 lines · Ingo Molnar
Quoted 19 lines · Juergen Gross

When booted via the special PVH entry save the RSDP address set in the boot information block in struct boot_params. This will enable Xen to locate the RSDP at an arbitrary address.

Set the boot loader version to 2.14 (0x020e) replacing the wrong 0x0212 which should have been 0x020c.

---
V2: set bootloader version to 2.14 (Roger Pau Monné)

---
 arch/x86/xen/enlighten_pvh.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +0 -0
index 436c4f003e17..036e3a5f284a 100644

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 73

Quoted 7 lines
arch/x86/xen/enlighten_pvh.c +2 -1
@@ -68,9 +68,12 @@ static void __init init_pvh_bootparams(void)
 	 *
 	 * Version 2.12 supports Xen entry point but we will use default x86/PC
 	 * environment (i.e. hardware_subarch 0).
+	 * The RSDP address is available from version 2.14 on.
 	 */
-	pvh_bootparams.hdr.version = 0x212;
+	pvh_bootparams.hdr.version = 0x20e;

While 0x212 was "obvious" to read but totally wrong, it would be less fragile and more readable if the version was generated as something like:

Quoted 1 line
	pvh_bootparams.hdr.version = (2 << 8) | 14;

Sure, I can make that change.

Quoted 7 lines

similar to how it's written in other cases:

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 74

Quoted 1 line
arch/x86/xen/enlighten_pvh.c +0 -0
 	pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */

Also, shouldn't the 0x212 fix be a separate patch, Cc: stable? The bug appears to have been introduced at around v4.12.

While not really being very important, this seems to be cleaner, yes. After all this value is visible in sysfs, so it should be correct.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#31 lore raw

Re: [PATCH v2 3/3] x86/xen: supply rsdp address in boot params for pvh guests

In reply to Juergen Gross
Quoted 19 lines · Juergen Gross

When booted via the special PVH entry save the RSDP address set in the boot information block in struct boot_params. This will enable Xen to locate the RSDP at an arbitrary address.

Set the boot loader version to 2.14 (0x020e) replacing the wrong 0x0212 which should have been 0x020c.

---
V2: set bootloader version to 2.14 (Roger Pau Monné)

---
 arch/x86/xen/enlighten_pvh.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +0 -0
index 436c4f003e17..036e3a5f284a 100644

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 73

Quoted 7 lines
arch/x86/xen/enlighten_pvh.c +2 -1
@@ -68,9 +68,12 @@ static void __init init_pvh_bootparams(void)
 	 *
 	 * Version 2.12 supports Xen entry point but we will use default x86/PC
 	 * environment (i.e. hardware_subarch 0).
+	 * The RSDP address is available from version 2.14 on.
 	 */
-	pvh_bootparams.hdr.version = 0x212;
+	pvh_bootparams.hdr.version = 0x20e;

While 0x212 was "obvious" to read but totally wrong, it would be less fragile and more readable if the version was generated as something like:

	pvh_bootparams.hdr.version = (2 << 8) | 14;

similar to how it's written in other cases:

arch/x86/xen/enlighten_pvh.c static void __init init_pvh_bootparams(void) · line 74

Quoted 1 line
arch/x86/xen/enlighten_pvh.c +0 -0
 	pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */

Also, shouldn't the 0x212 fix be a separate patch, Cc: stable? The bug appears to have been introduced at around v4.12.

Thanks,

Ingo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author maintainer
#32 lore raw

PATCH v2 3/3 x86/xen: supply rsdp address in boot params for pvh guests

In reply to Juergen Gross

When booted via the special PVH entry save the RSDP address set in the boot information block in struct boot_params. This will enable Xen to locate the RSDP at an arbitrary address.

Set the boot loader version to 2.14 (0x020e) replacing the wrong 0x0212 which should have been 0x020c.

---
V2: set bootloader version to 2.14 (Roger Pau Monné)

---
 arch/x86/xen/enlighten_pvh.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pvh.c +4 -1
index 436c4f003e17..036e3a5f284a 100644
@@ -68,9 +68,12 @@ static void __init init_pvh_bootparams(void)
 	 *
 	 * Version 2.12 supports Xen entry point but we will use default x86/PC
 	 * environment (i.e. hardware_subarch 0).
+	 * The RSDP address is available from version 2.14 on.
 	 */
-	pvh_bootparams.hdr.version = 0x212;
+	pvh_bootparams.hdr.version = 0x20e;
 	pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */
+
+	pvh_bootparams.hdr.acpi_rsdp_addr = pvh_start_info.rsdp_paddr;
 }
 
 /*
Signature · 7 lines
2.12.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel