[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/30] spapr: Abort if ppc_set_compat() fails for hot-plugged CPUs
From: |
David Gibson |
Subject: |
[PULL 18/30] spapr: Abort if ppc_set_compat() fails for hot-plugged CPUs |
Date: |
Mon, 14 Dec 2020 15:57:55 +1100 |
From: Greg Kurz <groug@kaod.org>
When a CPU is hot-plugged, we set its compat mode to match the boot
CPU, which was either set by machine reset or by CAS. This is currently
handled in the plug handler after the core got realized. Potential errors
of ppc_set_compat() are propagated to the hot-plug logic.
Handling errors this late in the hot-plug sequence is generally frown
upon. Ideally, we should do sanity checks in a pre-plug handler and pass
&error_abort to ppc_set_compat() in the plug handler.
We can filter out some error cases of ppc_set_compat() by calling
ppc_check_compat() at pre-plug. But ppc_set_compat() also sets the
compat register in KVM, and KVM doesn't provide any API that would
allow to check valid compat mode settings beforehand.
However, at this point we know that the compat mode was already
successfully set for the boot CPU. Since this all boils down to
setting a register with the very same value that was valid
for the boot CPU, it should definitely not fail for hot-plugged
CPUS.
Pass &error_abort to ppc_set_compat().
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <20201201113728.885700-3-groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/ppc/spapr.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 5fbae8adda..99139a692c 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3784,15 +3784,13 @@ static void spapr_core_plug(HotplugHandler
*hotplug_dev, DeviceState *dev,
/*
* Set compatibility mode to match the boot CPU, which was either set
- * by the machine reset code or by CAS.
+ * by the machine reset code or by CAS. This really shouldn't fail at
+ * this point.
*/
if (hotplugged) {
for (i = 0; i < cc->nr_threads; i++) {
- if (ppc_set_compat(core->threads[i],
- POWERPC_CPU(first_cpu)->compat_pvr,
- errp) < 0) {
- return;
- }
+ ppc_set_compat(core->threads[i],
POWERPC_CPU(first_cpu)->compat_pvr,
+ &error_abort);
}
}
--
2.29.2
- [PULL 09/30] ppc: Add a missing break for PPC6xx_INPUT_TBEN, (continued)
- [PULL 09/30] ppc: Add a missing break for PPC6xx_INPUT_TBEN, David Gibson, 2020/12/13
- [PULL 12/30] ppc/translate: Delay NaN checking after comparison, David Gibson, 2020/12/13
- [PULL 08/30] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings, David Gibson, 2020/12/13
- [PULL 04/30] spapr: Do NVDIMM/PC-DIMM device hotplug sanity checks at pre-plug only, David Gibson, 2020/12/13
- [PULL 06/30] spapr: Do PHB hoplug sanity check at pre-plug, David Gibson, 2020/12/13
- [PULL 10/30] ppc/translate: Fix unordered f64/f128 comparisons, David Gibson, 2020/12/13
- [PULL 11/30] ppc/translate: Turn the helper macros into functions, David Gibson, 2020/12/13
- [PULL 13/30] ppc/translate: Raise exceptions after setting the cc, David Gibson, 2020/12/13
- [PULL 18/30] spapr: Abort if ppc_set_compat() fails for hot-plugged CPUs,
David Gibson <=
- [PULL 15/30] hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier, David Gibson, 2020/12/13
- [PULL 14/30] ppc/translate: Rewrite gen_lxvdsx to use gvec primitives, David Gibson, 2020/12/13
- [PULL 19/30] spapr: Simplify error path of spapr_core_plug(), David Gibson, 2020/12/13
- [PULL 17/30] spapr: Fix pre-2.10 dummy ICP hack, David Gibson, 2020/12/13
- [PULL 20/30] spapr: spapr_drc_attach() cannot fail, David Gibson, 2020/12/13
- [PULL 23/30] MAINTAINERS: Add Greg Kurz as co-maintainer for ppc, David Gibson, 2020/12/13
- [PULL 16/30] xive: Add trace events, David Gibson, 2020/12/13
- [PULL 21/30] target/ppc: Remove "compat" property of server class POWER CPUs, David Gibson, 2020/12/13
- [PULL 24/30] ppc/e500: Free irqs array to avoid memleak, David Gibson, 2020/12/13
- [PULL 27/30] spapr: Pass sPAPR machine state down to spapr_pci_switch_vga(), David Gibson, 2020/12/13