acpi: reboot: log reset parameters
PATCH 1/1 acpi: reboot: log reset parameters
From: Denis Mukhin <[email protected]>
Xen does not provide much details for system reset debugging in case system reset happens via ACPI subsystem.
Log reset I/O address and reset value.
While here, fix the missing default case, guard it with ASSERT_UNREACHABLE() and drop full stops in the loglines.
---
CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/2716843348
--- xen/drivers/acpi/reboot.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
xen/drivers/acpi/reboot.c +15 -7
@@ -6,6 +6,7 @@ void acpi_reboot(void) {struct acpi_generic_address *rr;u8 reset_value; +pci_sbdf_t sbdf; rr = &acpi_gbl_FADT.reset_register;
@@ -21,17 +22,24 @@ void acpi_reboot(void)* on a device on bus 0. */ switch (rr->space_id) {case ACPI_ADR_SPACE_PCI_CONFIG : -printk ("Resetting with ACPI PCI RESET_REG.\n" ); + sbdf =PCI_SBDF (0 ,0 , rr->address >>32 , rr->address >>16 ); +printk ("Resetting with ACPI PCI %pp RESET_REG at 0x%" PRIx64" (0x%x)\n" , + &sbdf, rr->address &0xffu , reset_value);/* Write the value that resets us. */ -pci_conf_write8 (PCI_SBDF (0 ,0 , rr->address >>32 , - rr->address >>16 ), - (rr->address &255 ), - reset_value); +pci_conf_write8 (sbdf, rr->address &0xffu , reset_value);break ;case ACPI_ADR_SPACE_SYSTEM_MEMORY : -case ACPI_ADR_SPACE_SYSTEM_IO : -printk ("Resetting with ACPI MEMORY or I/O RESET_REG.\n" ); +printk ("Resetting with ACPI MEMORY at 0x%" PRIx64" (0x%x)\n" , + rr->address, reset_value);acpi_hw_low_level_write (8 , reset_value, rr);break ; +case ACPI_ADR_SPACE_SYSTEM_IO : +printk ("Resetting with I/O RESET_REG at 0x%" PRIx64" (0x%x)\n" , + rr->address, reset_value); +acpi_hw_low_level_write (8 , reset_value, rr); +break ; +default : +ASSERT_UNREACHABLE (); +break ; } }
Signature · 1 line
2.54.0
Quoted 9 lines · On 30.07.2026 02:18, [email protected] wrote:
From: Denis Mukhin <[email protected]>
Xen does not provide much details for system reset debugging in case system reset happens via ACPI subsystem.
Log reset I/O address and reset value.
While here, fix the missing default case, guard it with
ASSERT_UNREACHABLE()and drop full stops in the loglines.
On what basis (i.e. thanks to which earlier checks) would this assertion be legitimate to add? Besides being a wrong use of an assertion, it also breaks fallback to alternative reboot methods in case one doesn't work.
Quoted 11 lines
xen/drivers/acpi/reboot.c +1
-0@@ -6,6 +6,7 @@ void acpi_reboot(void) {struct acpi_generic_address *rr;u8 reset_value; +pci_sbdf_t sbdf; rr = &acpi_gbl_FADT.reset_register;
xen/drivers/acpi/reboot.c void acpi_reboot(void) · line 27
Quoted 7 lines
xen/drivers/acpi/reboot.c +3
-1@@ -21,17 +22,24 @@ void acpi_reboot(void)* on a device on bus 0. */ switch (rr->space_id) {case ACPI_ADR_SPACE_PCI_CONFIG : -printk ("Resetting with ACPI PCI RESET_REG.\n" ); + sbdf =PCI_SBDF (0 ,0 , rr->address >>32 , rr->address >>16 ); +printk ("Resetting with ACPI PCI %pp RESET_REG at 0x%" PRIx64" (0x%x)\n" , + &sbdf, rr->address &0xffu , reset_value);
As indicated on other occasions - %#x and alike please in favor of 0x%x.
I also see no reason for the 'u' suffix on the literal number. Plus if one was wanted, it would want to be 'U', to match the Misra-demanded 'L'.
Also - nit: Indentation.
Quoted 14 lines
xen/drivers/acpi/reboot.c +3
-6/* Write the value that resets us. */ -pci_conf_write8 (PCI_SBDF (0 ,0 , rr->address >>32 , - rr->address >>16 ), - (rr->address &255 ), - reset_value); +pci_conf_write8 (sbdf, rr->address &0xffu , reset_value);break ;case ACPI_ADR_SPACE_SYSTEM_MEMORY : -case ACPI_ADR_SPACE_SYSTEM_IO : -printk ("Resetting with ACPI MEMORY or I/O RESET_REG.\n" ); +printk ("Resetting with ACPI MEMORY at 0x%" PRIx64" (0x%x)\n" , + rr->address, reset_value);acpi_hw_low_level_write (8 , reset_value, rr);break ;
xen/drivers/acpi/reboot.c void acpi_reboot(void) · line 45
Quoted 10 lines
xen/drivers/acpi/reboot.c +8
-0+case ACPI_ADR_SPACE_SYSTEM_IO : +printk ("Resetting with I/O RESET_REG at 0x%" PRIx64" (0x%x)\n" , + rr->address, reset_value); +acpi_hw_low_level_write (8 , reset_value, rr); +break ; +default : +ASSERT_UNREACHABLE (); +break ; } }
As you're already touching the entire switch(), would you mind also inserting the missing blank lines between case blocks?
Jan
Quoted 36 lines · Jan Beulich
Quoted 9 lines · On 30.07.2026 02:18, [email protected] wrote:
From: Denis Mukhin <[email protected]>
Xen does not provide much details for system reset debugging in case system reset happens via ACPI subsystem.
Log reset I/O address and reset value.
While here, fix the missing default case, guard it with
ASSERT_UNREACHABLE()and drop full stops in the loglines.On what basis (i.e. thanks to which earlier checks) would this assertion be legitimate to add? Besides being a wrong use of an assertion, it also breaks fallback to alternative reboot methods in case one doesn't work.
Quoted 11 lines
xen/drivers/acpi/reboot.c +1
-0@@ -6,6 +6,7 @@ void acpi_reboot(void) {struct acpi_generic_address *rr;u8 reset_value; +pci_sbdf_t sbdf; rr = &acpi_gbl_FADT.reset_register;xen/drivers/acpi/reboot.c void acpi_reboot(void) · line 27
Quoted 7 lines
xen/drivers/acpi/reboot.c +3
-1@@ -21,17 +22,24 @@ void acpi_reboot(void)* on a device on bus 0. */ switch (rr->space_id) {case ACPI_ADR_SPACE_PCI_CONFIG : -printk ("Resetting with ACPI PCI RESET_REG.\n" ); + sbdf =PCI_SBDF (0 ,0 , rr->address >>32 , rr->address >>16 ); +printk ("Resetting with ACPI PCI %pp RESET_REG at 0x%" PRIx64" (0x%x)\n" , + &sbdf, rr->address &0xffu , reset_value);As indicated on other occasions - %#x and alike please in favor of 0x%x.
Quoted 4 lines
I also see no reason for the 'u' suffix on the literal number. Plus if one was wanted, it would want to be 'U', to match the Misra-demanded 'L'.
Also - nit: Indentation.
Thanks for taking a look!
This file uses tabs - I can convert to spaces, but in separate patch. What do you think?
Quoted 20 lines
Quoted 20 lines
xen/drivers/acpi/reboot.c +8
-6/* Write the value that resets us. */ -pci_conf_write8 (PCI_SBDF (0 ,0 , rr->address >>32 , - rr->address >>16 ), - (rr->address &255 ), - reset_value); +pci_conf_write8 (sbdf, rr->address &0xffu , reset_value);break ;case ACPI_ADR_SPACE_SYSTEM_MEMORY : -case ACPI_ADR_SPACE_SYSTEM_IO : -printk ("Resetting with ACPI MEMORY or I/O RESET_REG.\n" ); +printk ("Resetting with ACPI MEMORY at 0x%" PRIx64" (0x%x)\n" , + rr->address, reset_value);acpi_hw_low_level_write (8 , reset_value, rr);break ; +case ACPI_ADR_SPACE_SYSTEM_IO : +printk ("Resetting with I/O RESET_REG at 0x%" PRIx64" (0x%x)\n" , + rr->address, reset_value); +acpi_hw_low_level_write (8 , reset_value, rr); +break ;
Quoted 8 lines
xen/drivers/acpi/reboot.c void acpi_reboot(void) · line 45
Quoted 5 lines
xen/drivers/acpi/reboot.c +3
-0+default : +ASSERT_UNREACHABLE (); +break ; } }As you're already touching the entire
switch(), would you mind also inserting the missing blank lines between case blocks?
Yes, will do.
Quoted 3 lines
Jan
Quoted 23 lines · On 31.07.2026 06:42, [email protected] wrote:
Quoted 22 lines · Jan Beulich
Quoted 11 lines · On 30.07.2026 02:18, [email protected] wrote:
xen/drivers/acpi/reboot.c +1
-0@@ -6,6 +6,7 @@ void acpi_reboot(void) {struct acpi_generic_address *rr;u8 reset_value; +pci_sbdf_t sbdf; rr = &acpi_gbl_FADT.reset_register;xen/drivers/acpi/reboot.c void acpi_reboot(void) · line 27
Quoted 7 lines
xen/drivers/acpi/reboot.c +3
-1@@ -21,17 +22,24 @@ void acpi_reboot(void)* on a device on bus 0. */ switch (rr->space_id) {case ACPI_ADR_SPACE_PCI_CONFIG : -printk ("Resetting with ACPI PCI RESET_REG.\n" ); + sbdf =PCI_SBDF (0 ,0 , rr->address >>32 , rr->address >>16 ); +printk ("Resetting with ACPI PCI %pp RESET_REG at 0x%" PRIx64" (0x%x)\n" , + &sbdf, rr->address &0xffu , reset_value);As indicated on other occasions - %#x and alike please in favor of 0x%x.
Quoted 8 lines
Quoted 4 lines
I also see no reason for the 'u' suffix on the literal number. Plus if one was wanted, it would want to be 'U', to match the Misra-demanded 'L'.
Also - nit: Indentation.
Thanks for taking a look!
This file uses tabs - I can convert to spaces, but in separate patch.
That wasn't the point of my remark though. Merely switching to all-blanks indentation would be wrong. Converting altogether to Xen style would be an option. My remark was about you not using the necessary mix of tabs and blanks when the wrapped part of a statement want to align with the respective part on the earlier line. I.e. here two tabs followed by 7 blanks.
Jan