diff mbox

[v2,2/4] ppc: remove cannot_destroy_with_object_finalize_yet

Message ID 20170414083717.13641-3-lvivier@redhat.com
State New
Headers show

Commit Message

Laurent Vivier April 14, 2017, 8:37 a.m. UTC
This removes the assert(kvm_enabled()) from kvmppc_host_cpu_initfn()

This assert can never be triggered as the function is only registered
when KVM is available (see also 4c315c2
"qdev: Protect device-list-properties against broken devices").

So we can remove the cannot_destroy_with_object_finalize_yet from
kvmppc_host_cpu_class_init() without fear and beyond reproach.
(as it has already be done for i386 with 771a13e "i386: Unset
cannot_destroy_with_object_finalize_yet on "host" model" and
e435601 "target-i386: Remove assert(kvm_enabled()) from
host_x86_cpu_initfn()")

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 target/ppc/kvm.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

David Gibson April 18, 2017, 3:09 a.m. UTC | #1
On Fri, Apr 14, 2017 at 10:37:15AM +0200, Laurent Vivier wrote:
> This removes the assert(kvm_enabled()) from kvmppc_host_cpu_initfn()
> 
> This assert can never be triggered as the function is only registered
> when KVM is available (see also 4c315c2
> "qdev: Protect device-list-properties against broken devices").
> 
> So we can remove the cannot_destroy_with_object_finalize_yet from
> kvmppc_host_cpu_class_init() without fear and beyond reproach.
> (as it has already be done for i386 with 771a13e "i386: Unset
> cannot_destroy_with_object_finalize_yet on "host" model" and
> e435601 "target-i386: Remove assert(kvm_enabled()) from
> host_x86_cpu_initfn()")
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Applied to ppc-for-2.10 (fixing a contextual conflict on the way).


> ---
>  target/ppc/kvm.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 9f1f132..64017ac 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2245,14 +2245,8 @@ static void alter_insns(uint64_t *word, uint64_t flags, bool on)
>      }
>  }
>  
> -static void kvmppc_host_cpu_initfn(Object *obj)
> -{
> -    assert(kvm_enabled());
> -}
> -
>  static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
>  {
> -    DeviceClass *dc = DEVICE_CLASS(oc);
>      PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
>      uint32_t vmx = kvmppc_get_vmx();
>      uint32_t dfp = kvmppc_get_dfp();
> @@ -2279,9 +2273,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
>      if (icache_size != -1) {
>          pcc->l1_icache_size = icache_size;
>      }
> -
> -    /* Reason: kvmppc_host_cpu_initfn() dies when !kvm_enabled() */
> -    dc->cannot_destroy_with_object_finalize_yet = true;
>  }
>  
>  bool kvmppc_has_cap_epr(void)
> @@ -2333,7 +2324,6 @@ static int kvm_ppc_register_host_cpu_type(void)
>  {
>      TypeInfo type_info = {
>          .name = TYPE_HOST_POWERPC_CPU,
> -        .instance_init = kvmppc_host_cpu_initfn,
>          .class_init = kvmppc_host_cpu_class_init,
>      };
>      PowerPCCPUClass *pvr_pcc;
David Gibson April 21, 2017, 1:45 a.m. UTC | #2
On Tue, Apr 18, 2017 at 01:09:50PM +1000, David Gibson wrote:
> On Fri, Apr 14, 2017 at 10:37:15AM +0200, Laurent Vivier wrote:
> > This removes the assert(kvm_enabled()) from kvmppc_host_cpu_initfn()
> > 
> > This assert can never be triggered as the function is only registered
> > when KVM is available (see also 4c315c2
> > "qdev: Protect device-list-properties against broken devices").
> > 
> > So we can remove the cannot_destroy_with_object_finalize_yet from
> > kvmppc_host_cpu_class_init() without fear and beyond reproach.
> > (as it has already be done for i386 with 771a13e "i386: Unset
> > cannot_destroy_with_object_finalize_yet on "host" model" and
> > e435601 "target-i386: Remove assert(kvm_enabled()) from
> > host_x86_cpu_initfn()")
> > 
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> 
> Applied to ppc-for-2.10 (fixing a contextual conflict on the way).

Looks like this will go through Markus' tree instead, so:

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> 
> 
> > ---
> >  target/ppc/kvm.c | 10 ----------
> >  1 file changed, 10 deletions(-)
> > 
> > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> > index 9f1f132..64017ac 100644
> > --- a/target/ppc/kvm.c
> > +++ b/target/ppc/kvm.c
> > @@ -2245,14 +2245,8 @@ static void alter_insns(uint64_t *word, uint64_t flags, bool on)
> >      }
> >  }
> >  
> > -static void kvmppc_host_cpu_initfn(Object *obj)
> > -{
> > -    assert(kvm_enabled());
> > -}
> > -
> >  static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
> >  {
> > -    DeviceClass *dc = DEVICE_CLASS(oc);
> >      PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
> >      uint32_t vmx = kvmppc_get_vmx();
> >      uint32_t dfp = kvmppc_get_dfp();
> > @@ -2279,9 +2273,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
> >      if (icache_size != -1) {
> >          pcc->l1_icache_size = icache_size;
> >      }
> > -
> > -    /* Reason: kvmppc_host_cpu_initfn() dies when !kvm_enabled() */
> > -    dc->cannot_destroy_with_object_finalize_yet = true;
> >  }
> >  
> >  bool kvmppc_has_cap_epr(void)
> > @@ -2333,7 +2324,6 @@ static int kvm_ppc_register_host_cpu_type(void)
> >  {
> >      TypeInfo type_info = {
> >          .name = TYPE_HOST_POWERPC_CPU,
> > -        .instance_init = kvmppc_host_cpu_initfn,
> >          .class_init = kvmppc_host_cpu_class_init,
> >      };
> >      PowerPCCPUClass *pvr_pcc;
>
diff mbox

Patch

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 9f1f132..64017ac 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2245,14 +2245,8 @@  static void alter_insns(uint64_t *word, uint64_t flags, bool on)
     }
 }
 
-static void kvmppc_host_cpu_initfn(Object *obj)
-{
-    assert(kvm_enabled());
-}
-
 static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
 {
-    DeviceClass *dc = DEVICE_CLASS(oc);
     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
     uint32_t vmx = kvmppc_get_vmx();
     uint32_t dfp = kvmppc_get_dfp();
@@ -2279,9 +2273,6 @@  static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
     if (icache_size != -1) {
         pcc->l1_icache_size = icache_size;
     }
-
-    /* Reason: kvmppc_host_cpu_initfn() dies when !kvm_enabled() */
-    dc->cannot_destroy_with_object_finalize_yet = true;
 }
 
 bool kvmppc_has_cap_epr(void)
@@ -2333,7 +2324,6 @@  static int kvm_ppc_register_host_cpu_type(void)
 {
     TypeInfo type_info = {
         .name = TYPE_HOST_POWERPC_CPU,
-        .instance_init = kvmppc_host_cpu_initfn,
         .class_init = kvmppc_host_cpu_class_init,
     };
     PowerPCCPUClass *pvr_pcc;