* [PATCH] x86: improve "PCI reset register" rebooting
@ 2015-03-13 10:41 Jan Beulich
2015-03-13 11:40 ` Andrew Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2015-03-13 10:41 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Keir Fraser
[-- Attachment #1: Type: text/plain, Size: 2703 bytes --]
The way this method works allows for honoring "warm" reboot requested
by the user and additionally has a way to power-cycle the machine.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1117,7 +1117,7 @@ The following resources are available:
* `rmid_max` indicates the max value for rmid.
### reboot
-> `= t[riple] | k[bd] | a[cpi] | p[ci] | e[fi] | n[o] [, [w]arm | [c]old]`
+> `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
> Default: `0`
@@ -1137,6 +1137,8 @@ Specify the host reboot method.
`pci` instructs Xen to reboot the host using PCI reset register (port CF9).
+`Power` instructs Xen to power-cycle the host using PCI reset register (port CF9).
+
'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
default it will use that method first).
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -33,6 +33,7 @@ enum reboot_type {
BOOT_KBD = 'k',
BOOT_ACPI = 'a',
BOOT_CF9 = 'p',
+ BOOT_CF9_PWR = 'P',
BOOT_EFI = 'e',
};
@@ -47,6 +48,7 @@ static int reboot_mode;
* kbd Use the keyboard controller. cold reset (default)
* acpi Use the RESET_REG in the FADT
* pci Use the so-called "PCI reset register", CF9
+ * Power Like 'pci' but for a full power-cyle reset
* efi Use the EFI reboot (if running under EFI)
*/
static enum reboot_type reboot_type = BOOT_INVALID;
@@ -68,8 +70,9 @@ static void __init set_reboot_type(char
case 'a':
case 'e':
case 'k':
- case 't':
+ case 'P':
case 'p':
+ case 't':
reboot_type = *str;
break;
}
@@ -571,11 +574,18 @@ void machine_restart(unsigned int delay_
reboot_type = BOOT_KBD;
break;
case BOOT_CF9:
+ case BOOT_CF9_PWR:
{
- u8 cf9 = inb(0xcf9) & ~6;
- outb(cf9|2, 0xcf9); /* Request hard reset */
+ u8 cf9 = inb(0xcf9) & ~0x0e;
+
+ /* Request warm, hard, or power-cycle reset. */
+ if ( reboot_type == BOOT_CF9_PWR )
+ cf9 |= 0x0a;
+ else if ( reboot_mode == 0 )
+ cf9 |= 0x02;
+ outb(cf9, 0xcf9);
udelay(50);
- outb(cf9|6, 0xcf9); /* Actually do the reset */
+ outb(cf9 | 0x04, 0xcf9); /* Actually do the reset. */
udelay(50);
}
reboot_type = BOOT_ACPI;
[-- Attachment #2: x86-CF9-reset.patch --]
[-- Type: text/plain, Size: 2744 bytes --]
x86: improve "PCI reset register" rebooting
The way this method works allows for honoring "warm" reboot requested
by the user and additionally has a way to power-cycle the machine.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1117,7 +1117,7 @@ The following resources are available:
* `rmid_max` indicates the max value for rmid.
### reboot
-> `= t[riple] | k[bd] | a[cpi] | p[ci] | e[fi] | n[o] [, [w]arm | [c]old]`
+> `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
> Default: `0`
@@ -1137,6 +1137,8 @@ Specify the host reboot method.
`pci` instructs Xen to reboot the host using PCI reset register (port CF9).
+`Power` instructs Xen to power-cycle the host using PCI reset register (port CF9).
+
'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
default it will use that method first).
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -33,6 +33,7 @@ enum reboot_type {
BOOT_KBD = 'k',
BOOT_ACPI = 'a',
BOOT_CF9 = 'p',
+ BOOT_CF9_PWR = 'P',
BOOT_EFI = 'e',
};
@@ -47,6 +48,7 @@ static int reboot_mode;
* kbd Use the keyboard controller. cold reset (default)
* acpi Use the RESET_REG in the FADT
* pci Use the so-called "PCI reset register", CF9
+ * Power Like 'pci' but for a full power-cyle reset
* efi Use the EFI reboot (if running under EFI)
*/
static enum reboot_type reboot_type = BOOT_INVALID;
@@ -68,8 +70,9 @@ static void __init set_reboot_type(char
case 'a':
case 'e':
case 'k':
- case 't':
+ case 'P':
case 'p':
+ case 't':
reboot_type = *str;
break;
}
@@ -571,11 +574,18 @@ void machine_restart(unsigned int delay_
reboot_type = BOOT_KBD;
break;
case BOOT_CF9:
+ case BOOT_CF9_PWR:
{
- u8 cf9 = inb(0xcf9) & ~6;
- outb(cf9|2, 0xcf9); /* Request hard reset */
+ u8 cf9 = inb(0xcf9) & ~0x0e;
+
+ /* Request warm, hard, or power-cycle reset. */
+ if ( reboot_type == BOOT_CF9_PWR )
+ cf9 |= 0x0a;
+ else if ( reboot_mode == 0 )
+ cf9 |= 0x02;
+ outb(cf9, 0xcf9);
udelay(50);
- outb(cf9|6, 0xcf9); /* Actually do the reset */
+ outb(cf9 | 0x04, 0xcf9); /* Actually do the reset. */
udelay(50);
}
reboot_type = BOOT_ACPI;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: improve "PCI reset register" rebooting
2015-03-13 10:41 [PATCH] x86: improve "PCI reset register" rebooting Jan Beulich
@ 2015-03-13 11:40 ` Andrew Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2015-03-13 11:40 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Keir Fraser
On 13/03/15 10:41, Jan Beulich wrote:
> The way this method works allows for honoring "warm" reboot requested
> by the user and additionally has a way to power-cycle the machine.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/docs/misc/xen-command-line.markdown
> +++ b/docs/misc/xen-command-line.markdown
> @@ -1117,7 +1117,7 @@ The following resources are available:
> * `rmid_max` indicates the max value for rmid.
>
> ### reboot
> -> `= t[riple] | k[bd] | a[cpi] | p[ci] | e[fi] | n[o] [, [w]arm | [c]old]`
> +> `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
>
> > Default: `0`
>
> @@ -1137,6 +1137,8 @@ Specify the host reboot method.
>
> `pci` instructs Xen to reboot the host using PCI reset register (port CF9).
>
> +`Power` instructs Xen to power-cycle the host using PCI reset register (port CF9).
> +
> 'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
> default it will use that method first).
>
> --- a/xen/arch/x86/shutdown.c
> +++ b/xen/arch/x86/shutdown.c
> @@ -33,6 +33,7 @@ enum reboot_type {
> BOOT_KBD = 'k',
> BOOT_ACPI = 'a',
> BOOT_CF9 = 'p',
> + BOOT_CF9_PWR = 'P',
> BOOT_EFI = 'e',
> };
>
> @@ -47,6 +48,7 @@ static int reboot_mode;
> * kbd Use the keyboard controller. cold reset (default)
> * acpi Use the RESET_REG in the FADT
> * pci Use the so-called "PCI reset register", CF9
> + * Power Like 'pci' but for a full power-cyle reset
> * efi Use the EFI reboot (if running under EFI)
> */
> static enum reboot_type reboot_type = BOOT_INVALID;
> @@ -68,8 +70,9 @@ static void __init set_reboot_type(char
> case 'a':
> case 'e':
> case 'k':
> - case 't':
> + case 'P':
> case 'p':
> + case 't':
> reboot_type = *str;
> break;
> }
> @@ -571,11 +574,18 @@ void machine_restart(unsigned int delay_
> reboot_type = BOOT_KBD;
> break;
> case BOOT_CF9:
> + case BOOT_CF9_PWR:
> {
> - u8 cf9 = inb(0xcf9) & ~6;
> - outb(cf9|2, 0xcf9); /* Request hard reset */
> + u8 cf9 = inb(0xcf9) & ~0x0e;
> +
> + /* Request warm, hard, or power-cycle reset. */
> + if ( reboot_type == BOOT_CF9_PWR )
> + cf9 |= 0x0a;
> + else if ( reboot_mode == 0 )
> + cf9 |= 0x02;
> + outb(cf9, 0xcf9);
> udelay(50);
> - outb(cf9|6, 0xcf9); /* Actually do the reset */
> + outb(cf9 | 0x04, 0xcf9); /* Actually do the reset. */
I would be nice to have some named constants (FULL_RST, RST_CPU and
SYS_RST is what the ICH10 manual uses), but the logic here does appear
correct.
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> udelay(50);
> }
> reboot_type = BOOT_ACPI;
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-13 11:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13 10:41 [PATCH] x86: improve "PCI reset register" rebooting Jan Beulich
2015-03-13 11:40 ` Andrew Cooper
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.