Skip to content

Commit cf83f14

Browse files
ebblakeMarkus Armbruster
authored and
Markus Armbruster
committed
shutdown: Add source information to SHUTDOWN and RESET
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch. It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers. Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests. Signed-off-by: Eric Blake <[email protected]> Acked-by: David Gibson <[email protected]> [ppc parts] Reviewed-by: Mark Cave-Ayland <[email protected]> [SPARC part] Reviewed-by: Cornelia Huck <[email protected]> [s390x parts] Message-Id: <[email protected]> Reviewed-by: Markus Armbruster <[email protected]> Signed-off-by: Markus Armbruster <[email protected]>
1 parent 802f045 commit cf83f14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+98
-98
lines changed

hw/acpi/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,15 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
561561
uint16_t sus_typ = (val >> 10) & 7;
562562
switch(sus_typ) {
563563
case 0: /* soft power off */
564-
qemu_system_shutdown_request();
564+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
565565
break;
566566
case 1:
567567
qemu_system_suspend_request();
568568
break;
569569
default:
570570
if (sus_typ == ar->pm1.cnt.s4_val) { /* S4 request */
571571
qapi_event_send_suspend_disk(&error_abort);
572-
qemu_system_shutdown_request();
572+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
573573
}
574574
break;
575575
}

hw/arm/highbank.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ static void hb_regs_write(void *opaque, hwaddr offset,
108108

109109
if (offset == 0xf00) {
110110
if (value == 1 || value == 2) {
111-
qemu_system_reset_request();
111+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
112112
} else if (value == 3) {
113-
qemu_system_shutdown_request();
113+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
114114
}
115115
}
116116

hw/arm/integratorcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static void integratorcm_do_remap(IntegratorCMState *s)
158158
static void integratorcm_set_ctrl(IntegratorCMState *s, uint32_t value)
159159
{
160160
if (value & 8) {
161-
qemu_system_reset_request();
161+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
162162
}
163163
if ((s->cm_ctrl ^ value) & 1) {
164164
/* (value & 1) != 0 means the green "MISC LED" is lit.

hw/arm/musicpal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset,
898898

899899
case MP_BOARD_RESET:
900900
if (value == MP_BOARD_RESET_MAGIC) {
901-
qemu_system_reset_request();
901+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
902902
}
903903
break;
904904
}

hw/arm/omap1.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static void omap_wd_timer_write(void *opaque, hwaddr addr,
355355
/* XXX: on T|E hardware somehow this has no effect,
356356
* on Zire 71 it works as specified. */
357357
s->reset = 1;
358-
qemu_system_reset_request();
358+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
359359
}
360360
}
361361
s->last_wr = value & 0xff;
@@ -1545,8 +1545,10 @@ static inline void omap_clkm_idlect1_update(struct omap_mpu_state_s *s,
15451545
if (value & (1 << 11)) { /* SETARM_IDLE */
15461546
cpu_interrupt(CPU(s->cpu), CPU_INTERRUPT_HALT);
15471547
}
1548-
if (!(value & (1 << 10))) /* WKUP_MODE */
1549-
qemu_system_shutdown_request(); /* XXX: disable wakeup from IRQ */
1548+
if (!(value & (1 << 10))) { /* WKUP_MODE */
1549+
/* XXX: disable wakeup from IRQ */
1550+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
1551+
}
15501552

15511553
#define SET_CANIDLE(clock, bit) \
15521554
if (diff & (1 << bit)) { \
@@ -1693,7 +1695,7 @@ static void omap_clkm_write(void *opaque, hwaddr addr,
16931695
diff = s->clkm.arm_rstct1 ^ value;
16941696
s->clkm.arm_rstct1 = value & 0x0007;
16951697
if (value & 9) {
1696-
qemu_system_reset_request();
1698+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
16971699
s->clkm.cold_start = 0xa;
16981700
}
16991701
if (diff & ~value & 4) { /* DSP_RST */

hw/arm/omap2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ static void omap_prcm_write(void *opaque, hwaddr addr,
16101610
case 0x450: /* RM_RSTCTRL_WKUP */
16111611
/* TODO: reset */
16121612
if (value & 2)
1613-
qemu_system_reset_request();
1613+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
16141614
break;
16151615
case 0x454: /* RM_RSTTIME_WKUP */
16161616
s->rsttime_wkup = value & 0x1fff;

hw/arm/spitz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ static void spitz_lcd_hsync_handler(void *opaque, int line, int level)
848848
static void spitz_reset(void *opaque, int line, int level)
849849
{
850850
if (level) {
851-
qemu_system_reset_request();
851+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
852852
}
853853
}
854854

hw/arm/stellaris.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ static
11971197
void do_sys_reset(void *opaque, int n, int level)
11981198
{
11991199
if (level) {
1200-
qemu_system_reset_request();
1200+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
12011201
}
12021202
}
12031203

hw/arm/tosa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void tosa_out_switch(void *opaque, int line, int level)
9090
static void tosa_reset(void *opaque, int line, int level)
9191
{
9292
if (level) {
93-
qemu_system_reset_request();
93+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
9494
}
9595
}
9696

hw/i386/pc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ static void port92_write(void *opaque, hwaddr addr, uint64_t val,
519519
s->outport = val;
520520
qemu_set_irq(s->a20_out, (val >> 1) & 1);
521521
if ((val & 1) && !(oldval & 1)) {
522-
qemu_system_reset_request();
522+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
523523
}
524524
}
525525

hw/i386/xen/xen-hvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ void xen_shutdown_fatal_error(const char *fmt, ...)
13981398
va_end(ap);
13991399
fprintf(stderr, "Will destroy the domain.\n");
14001400
/* destroy the domain */
1401-
qemu_system_shutdown_request();
1401+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR);
14021402
}
14031403

14041404
void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)

hw/input/pckbd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void outport_write(KBDState *s, uint32_t val)
226226
s->outport = val;
227227
qemu_set_irq(s->a20_out, (val >> 1) & 1);
228228
if (!(val & 1)) {
229-
qemu_system_reset_request();
229+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
230230
}
231231
}
232232

@@ -301,7 +301,7 @@ static void kbd_write_command(void *opaque, hwaddr addr,
301301
s->outport &= ~KBD_OUT_A20;
302302
break;
303303
case KBD_CCMD_RESET:
304-
qemu_system_reset_request();
304+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
305305
break;
306306
case KBD_CCMD_NO_OP:
307307
/* ignore that */

hw/ipmi/ipmi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ static int ipmi_do_hw_op(IPMIInterface *s, enum ipmi_op op, int checkonly)
4444
if (checkonly) {
4545
return 0;
4646
}
47-
qemu_system_reset_request();
47+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
4848
return 0;
4949

5050
case IPMI_POWEROFF_CHASSIS:
5151
if (checkonly) {
5252
return 0;
5353
}
54-
qemu_system_shutdown_request();
54+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
5555
return 0;
5656

5757
case IPMI_SEND_NMI:

hw/isa/lpc_ich9.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ static void ich9_rst_cnt_write(void *opaque, hwaddr addr, uint64_t val,
606606
ICH9LPCState *lpc = opaque;
607607

608608
if (val & 4) {
609-
qemu_system_reset_request();
609+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
610610
return;
611611
}
612612
lpc->rst_cnt = val & 0xA; /* keep FULL_RST (bit 3) and SYS_RST (bit 1) */

hw/mips/boston.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static void boston_platreg_write(void *opaque, hwaddr addr,
232232
break;
233233
case PLAT_SOFTRST_CTL:
234234
if (val & PLAT_SOFTRST_CTL_SYSRESET) {
235-
qemu_system_reset_request();
235+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
236236
}
237237
break;
238238
default:

hw/mips/mips_malta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ static void malta_fpga_write(void *opaque, hwaddr addr,
470470
/* SOFTRES Register */
471471
case 0x00500:
472472
if (val == 0x42)
473-
qemu_system_reset_request ();
473+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
474474
break;
475475

476476
/* BRKRES Register */

hw/mips/mips_r4k.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ static void mips_qemu_write (void *opaque, hwaddr addr,
5353
uint64_t val, unsigned size)
5454
{
5555
if ((addr & 0xffff) == 0 && val == 42)
56-
qemu_system_reset_request ();
56+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
5757
else if ((addr & 0xffff) == 4 && val == 42)
58-
qemu_system_shutdown_request ();
58+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
5959
}
6060

6161
static uint64_t mips_qemu_read (void *opaque, hwaddr addr,

hw/misc/arm_sysctl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,13 @@ static bool vexpress_cfgctrl_write(arm_sysctl_state *s, unsigned int dcc,
351351
break;
352352
case SYS_CFG_SHUTDOWN:
353353
if (site == SYS_CFG_SITE_MB && device == 0) {
354-
qemu_system_shutdown_request();
354+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
355355
return true;
356356
}
357357
break;
358358
case SYS_CFG_REBOOT:
359359
if (site == SYS_CFG_SITE_MB && device == 0) {
360-
qemu_system_reset_request();
360+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
361361
return true;
362362
}
363363
break;
@@ -429,7 +429,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,
429429
if (s->lockval == LOCK_VALUE) {
430430
s->resetlevel = val;
431431
if (val & 0x100) {
432-
qemu_system_reset_request();
432+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
433433
}
434434
}
435435
break;
@@ -438,7 +438,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,
438438
if (s->lockval == LOCK_VALUE) {
439439
s->resetlevel = val;
440440
if (val & 0x04) {
441-
qemu_system_reset_request();
441+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
442442
}
443443
}
444444
break;

hw/misc/cbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static inline void retu_write(CBusRetu *s, int reg, uint16_t val)
356356

357357
case RETU_REG_WATCHDOG:
358358
if (val == 0 && (s->cc[0] & 2))
359-
qemu_system_shutdown_request();
359+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
360360
break;
361361

362362
case RETU_REG_TXCR:

hw/misc/macio/cuda.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ static bool cuda_cmd_powerdown(CUDAState *s,
612612
return false;
613613
}
614614

615-
qemu_system_shutdown_request();
615+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
616616
return true;
617617
}
618618

@@ -624,7 +624,7 @@ static bool cuda_cmd_reset_system(CUDAState *s,
624624
return false;
625625
}
626626

627-
qemu_system_reset_request();
627+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
628628
return true;
629629
}
630630

hw/misc/slavio_misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static void slavio_aux2_mem_writeb(void *opaque, hwaddr addr,
258258
val &= AUX2_PWROFF;
259259
s->aux2 = val;
260260
if (val & AUX2_PWROFF)
261-
qemu_system_shutdown_request();
261+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
262262
slavio_misc_update_irq(s);
263263
}
264264

@@ -338,7 +338,7 @@ static void slavio_sysctrl_mem_writel(void *opaque, hwaddr addr,
338338
case 0:
339339
if (val & SYS_RESET) {
340340
s->sysctrl = SYS_RESETSTAT;
341-
qemu_system_reset_request();
341+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
342342
}
343343
break;
344344
default:

hw/misc/zynq_slcr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static void zynq_slcr_write(void *opaque, hwaddr offset,
405405
switch (offset) {
406406
case PSS_RST_CTRL:
407407
if (val & R_PSS_RST_CTRL_SOFT_RST) {
408-
qemu_system_reset_request();
408+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
409409
}
410410
break;
411411
}

hw/pci-host/apb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ static void apb_config_writel (void *opaque, hwaddr addr,
482482
s->reset_control |= val & RESET_WMASK;
483483
if (val & SOFT_POR) {
484484
s->nr_resets = 0;
485-
qemu_system_reset_request();
485+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
486486
} else if (val & SOFT_XIR) {
487-
qemu_system_reset_request();
487+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
488488
}
489489
}
490490
break;

hw/pci-host/bonito.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static void bonito_writel(void *opaque, hwaddr addr,
269269
}
270270
s->regs[saddr] = val;
271271
if (reset) {
272-
qemu_system_reset_request();
272+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
273273
}
274274
break;
275275
case BONITO_INTENSET:

hw/pci-host/piix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len)
632632
PIIX3State *d = opaque;
633633

634634
if (val & 4) {
635-
qemu_system_reset_request();
635+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
636636
return;
637637
}
638638
d->rcr = val & 2; /* keep System Reset type only */

hw/ppc/e500.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,
774774
static void ppce500_power_off(void *opaque, int line, int on)
775775
{
776776
if (on) {
777-
qemu_system_shutdown_request();
777+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
778778
}
779779
}
780780

hw/ppc/mpc8544_guts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr,
9898
switch (addr) {
9999
case MPC8544_GUTS_ADDR_RSTCR:
100100
if (value & MPC8544_GUTS_RSTCR_RESET) {
101-
qemu_system_reset_request();
101+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
102102
}
103103
break;
104104
default:

hw/ppc/ppc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static void ppce500_set_irq(void *opaque, int pin, int level)
412412
if (level) {
413413
LOG_IRQ("%s: reset the PowerPC system\n",
414414
__func__);
415-
qemu_system_reset_request();
415+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
416416
}
417417
break;
418418
case PPCE500_INPUT_RESET_CORE:

hw/ppc/ppc405_uc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ void ppc40x_chip_reset(PowerPCCPU *cpu)
18071807
void ppc40x_system_reset(PowerPCCPU *cpu)
18081808
{
18091809
printf("Reset PowerPC system\n");
1810-
qemu_system_reset_request();
1810+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
18111811
}
18121812

18131813
void store_40x_dbcr0 (CPUPPCState *env, uint32_t val)

hw/ppc/spapr_hcall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
11621162
spapr_ovec_cleanup(ov5_updates);
11631163

11641164
if (spapr->cas_reboot) {
1165-
qemu_system_reset_request();
1165+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
11661166
} else {
11671167
/* If ppc_spapr_reset() did not set up a HPT but one is necessary
11681168
* (because the guest isn't going to use radix) then set it up here. */

hw/ppc/spapr_rtas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,
110110
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
111111
return;
112112
}
113-
qemu_system_shutdown_request();
113+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
114114
cpu_stop_current();
115115
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
116116
}
@@ -124,7 +124,7 @@ static void rtas_system_reboot(PowerPCCPU *cpu, sPAPRMachineState *spapr,
124124
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
125125
return;
126126
}
127-
qemu_system_reset_request();
127+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
128128
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
129129
}
130130

hw/s390x/ipl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ void s390_reipl_request(void)
396396
S390IPLState *ipl = get_ipl_device();
397397

398398
ipl->reipl_requested = true;
399-
qemu_system_reset_request();
399+
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
400400
}
401401

402402
void s390_ipl_prepare_cpu(S390CPU *cpu)

0 commit comments

Comments
 (0)