qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 28/36] ppc/xics: introduce a icp_kvm_init() r


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH v5 28/36] ppc/xics: introduce a icp_kvm_init() routine
Date: Fri, 30 Nov 2018 09:43:49 +1100
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Nov 29, 2018 at 05:36:19PM +0100, Cédric Le Goater wrote:
> On 11/29/18 5:08 AM, David Gibson wrote:
> > On Fri, Nov 16, 2018 at 11:57:21AM +0100, Cédric Le Goater wrote:
> >> This routine gathers all the KVM initialization of the XICS KVM
> >> presenter. It will be useful when the initialization of the KVM XICS
> >> device is moved to a global routine.
> >>
> >> Signed-off-by: Cédric Le Goater <address@hidden>
> > 
> > I dislike calling things *_init() because it's not clear which of
> > qemu's many "init" hooks it belongs with.
> 
> we could use 'icp_kvm_connect' instead. Which was QEMU is doing, 
> connecting a QEMU model to a KVM one.

Works for me.

> 
> C.
> 
>  
> >> ---
> >>  hw/intc/xics_kvm.c | 29 +++++++++++++++++++----------
> >>  1 file changed, 19 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
> >> index e8fa9a53aeba..efad1b19d821 100644
> >> --- a/hw/intc/xics_kvm.c
> >> +++ b/hw/intc/xics_kvm.c
> >> @@ -123,11 +123,8 @@ static void icp_kvm_reset(DeviceState *dev)
> >>      icp_set_kvm_state(ICP(dev), 1);
> >>  }
> >>  
> >> -static void icp_kvm_realize(DeviceState *dev, Error **errp)
> >> +static void icp_kvm_init(ICPState *icp, Error **errp)
> >>  {
> >> -    ICPState *icp = ICP(dev);
> >> -    ICPStateClass *icpc = ICP_GET_CLASS(icp);
> >> -    Error *local_err = NULL;
> >>      CPUState *cs;
> >>      KVMEnabledICP *enabled_icp;
> >>      unsigned long vcpu_id;
> >> @@ -137,12 +134,6 @@ static void icp_kvm_realize(DeviceState *dev, Error 
> >> **errp)
> >>          abort();
> >>      }
> >>  
> >> -    icpc->parent_realize(dev, &local_err);
> >> -    if (local_err) {
> >> -        error_propagate(errp, local_err);
> >> -        return;
> >> -    }
> >> -
> >>      cs = icp->cs;
> >>      vcpu_id = kvm_arch_vcpu_id(cs);
> >>  
> >> @@ -168,6 +159,24 @@ static void icp_kvm_realize(DeviceState *dev, Error 
> >> **errp)
> >>      QLIST_INSERT_HEAD(&kvm_enabled_icps, enabled_icp, node);
> >>  }
> >>  
> >> +static void icp_kvm_realize(DeviceState *dev, Error **errp)
> >> +{
> >> +    ICPStateClass *icpc = ICP_GET_CLASS(dev);
> >> +    Error *local_err = NULL;
> >> +
> >> +    icpc->parent_realize(dev, &local_err);
> >> +    if (local_err) {
> >> +        error_propagate(errp, local_err);
> >> +        return;
> >> +    }
> >> +
> >> +    icp_kvm_init(ICP(dev), &local_err);
> >> +    if (local_err) {
> >> +        error_propagate(errp, local_err);
> >> +        return;
> >> +    }
> >> +}
> >> +
> >>  static void icp_kvm_class_init(ObjectClass *klass, void *data)
> >>  {
> >>      DeviceClass *dc = DEVICE_CLASS(klass);
> > 
> 

-- 
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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]