Skip to content

Commit 81435f5

Browse files
fyin1acrnsi
authored andcommitted
vm reset: refine platform reset
We did following to do platform reset: 1. Try ACPI reset first if it's available 2. Then try 0xcf9 reset method 3. if 2 fails, try keyboard reset method This introduces some timing concern which needs be handled carefully. We change it by following: assume the platforms which ACRN could be run on must support either ACPI reset or 0xcf9 reset. And simplify platform reset operation a little bit: If ACPI reset register is generated try ACPI reset else try 0xcf9 reset method Tracked-On: #3609 Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
1 parent cd40980 commit 81435f5

File tree

1 file changed

+10
-14
lines changed
  • hypervisor/arch/x86

1 file changed

+10
-14
lines changed

hypervisor/arch/x86/pm.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ void reset_host(void)
208208
/* TODO: gracefully shut down all guests before doing host reset. */
209209

210210
/*
211+
* Assumption:
212+
* The platform we are running must support at least one of reset method:
213+
* - ACPI reset
214+
* - 0xcf9 reset
215+
*
211216
* UEFI more likely sets the reset value as 0x6 (not 0xe) for 0xcf9 port.
212217
* This asserts PLTRST# to reset devices on the platform, but not the
213218
* SLP_S3#/4#/5# signals, which power down the systems. This might not be
@@ -217,22 +222,13 @@ void reset_host(void)
217222
(gas->bit_width == 8U) && (gas->bit_offset == 0U) &&
218223
(gas->address != 0U) && (gas->address != 0xcf9U)) {
219224
pio_write8(host_reset_reg.val, (uint16_t)host_reset_reg.reg.address);
225+
} else {
226+
/* making sure bit 2 (RST_CPU) is '0', when the reset command is issued. */
227+
pio_write8(0x2U, 0xcf9U);
228+
udelay(50U);
229+
pio_write8(0xeU, 0xcf9U);
220230
}
221231

222-
/*
223-
* Fall back
224-
* making sure bit 2 (RST_CPU) is '0', when the reset command is issued.
225-
*/
226-
pio_write8(0x2U, 0xcf9U);
227-
pio_write8(0xeU, 0xcf9U);
228-
229-
/*
230-
* Fall back
231-
* keyboard controller might cause the INIT# being asserted,
232-
* and not power cycle the system.
233-
*/
234-
pio_write8(0xfeU, 0x64U);
235-
236232
pr_fatal("%s(): can't reset host.", __func__);
237233
while (1) {
238234
asm_pause();

0 commit comments

Comments
 (0)