[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.0 7/9] spapr: Do PHB hoplug sanity check at pre-plug
From: |
David Gibson |
Subject: |
Re: [PATCH for-6.0 7/9] spapr: Do PHB hoplug sanity check at pre-plug |
Date: |
Mon, 23 Nov 2020 16:26:12 +1100 |
On Sat, Nov 21, 2020 at 12:42:06AM +0100, Greg Kurz wrote:
> We currently detect that a PHB index is already in use at plug time.
> But this can be decteted at pre-plug in order to error out earlier.
>
> This allows to pass &error_abort to spapr_drc_attach() and to end
> up with a plug handler that doesn't need to report errors anymore.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Applied to ppc-for-6.0, thanks.
> ---
> hw/ppc/spapr.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 81bac59887ab..bded059d59c8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -3872,6 +3872,7 @@ static bool spapr_phb_pre_plug(HotplugHandler
> *hotplug_dev, DeviceState *dev,
> SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(dev);
> SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
> const unsigned windows_supported = spapr_phb_windows_supported(sphb);
> + SpaprDrc *drc;
>
> if (dev->hotplugged && !smc->dr_phb_enabled) {
> error_setg(errp, "PHB hotplug not supported for this machine");
> @@ -3883,6 +3884,12 @@ static bool spapr_phb_pre_plug(HotplugHandler
> *hotplug_dev, DeviceState *dev,
> return false;
> }
>
> + drc = spapr_drc_by_id(TYPE_SPAPR_DRC_PHB, sphb->index);
> + if (drc && drc->dev) {
> + error_setg(errp, "PHB %d already attached", sphb->index);
> + return false;
> + }
> +
> /*
> * This will check that sphb->index doesn't exceed the maximum number of
> * PHBs for the current machine type.
> @@ -3896,8 +3903,7 @@ static bool spapr_phb_pre_plug(HotplugHandler
> *hotplug_dev, DeviceState *dev,
> errp);
> }
>
> -static void spapr_phb_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
> - Error **errp)
> +static void spapr_phb_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
> {
> SpaprMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
> SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
> @@ -3913,9 +3919,8 @@ static void spapr_phb_plug(HotplugHandler *hotplug_dev,
> DeviceState *dev,
> /* hotplug hooks should check it's enabled before getting this far */
> assert(drc);
>
> - if (!spapr_drc_attach(drc, dev, errp)) {
> - return;
> - }
> + /* spapr_phb_pre_plug() already checked the DRC is attachable */
> + spapr_drc_attach(drc, dev, &error_abort);
>
> if (hotplugged) {
> spapr_hotplug_req_add_by_index(drc);
> @@ -3983,7 +3988,7 @@ static void spapr_machine_device_plug(HotplugHandler
> *hotplug_dev,
> } else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
> spapr_core_plug(hotplug_dev, dev);
> } else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_PCI_HOST_BRIDGE))
> {
> - spapr_phb_plug(hotplug_dev, dev, errp);
> + spapr_phb_plug(hotplug_dev, dev);
> } else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_TPM_PROXY)) {
> spapr_tpm_proxy_plug(hotplug_dev, dev, errp);
> }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- Re: [PATCH for-6.0 2/9] spapr: Do NVDIMM/PC-DIMM device hotplug sanity checks at pre-plug only, (continued)
- [PATCH for-6.0 7/9] spapr: Do PHB hoplug sanity check at pre-plug, Greg Kurz, 2020/11/20
- Re: [PATCH for-6.0 7/9] spapr: Do PHB hoplug sanity check at pre-plug,
David Gibson <=
- [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), Greg Kurz, 2020/11/20
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), David Gibson, 2020/11/23
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), Greg Kurz, 2020/11/23
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), David Gibson, 2020/11/24
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), Greg Kurz, 2020/11/25
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), David Gibson, 2020/11/25
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), Greg Kurz, 2020/11/26
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), Igor Mammedov, 2020/11/26
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), Igor Mammedov, 2020/11/26
- Re: [PATCH for-6.0 4/9] spapr: Set compat mode in spapr_reset_vcpu(), David Gibson, 2020/11/27