diff mbox

xics_kvm: drop extra checking of kernel_xics_fd

Message ID 146908535036.20978.9694390851067824300.stgit@bahia.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Greg Kurz July 21, 2016, 7:15 a.m. UTC
We abort a few lines above if kernel_xics_fd == -1.

This is only code cleanup.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/intc/xics_kvm.c |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

Comments

David Gibson July 21, 2016, 12:59 p.m. UTC | #1
On Thu, Jul 21, 2016 at 09:15:50AM +0200, Greg Kurz wrote:
> We abort a few lines above if kernel_xics_fd == -1.
> 
> This is only code cleanup.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-2.8 (newly created).

> ---
>  hw/intc/xics_kvm.c |   20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
> index edbd62fd1bae..c9caefcf2b0b 100644
> --- a/hw/intc/xics_kvm.c
> +++ b/hw/intc/xics_kvm.c
> @@ -329,6 +329,7 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu)
>      CPUState *cs;
>      ICPState *ss;
>      KVMXICSState *xicskvm = XICS_SPAPR_KVM(xics);
> +    int ret;
>  
>      cs = CPU(cpu);
>      ss = &xics->ss[cs->cpu_index];
> @@ -347,19 +348,14 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu)
>          return;
>      }
>  
> -    if (xicskvm->kernel_xics_fd != -1) {
> -        int ret;
> -
> -        ret = kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0,
> -                                  xicskvm->kernel_xics_fd,
> -                                  kvm_arch_vcpu_id(cs));
> -        if (ret < 0) {
> -            error_report("Unable to connect CPU%ld to kernel XICS: %s",
> -                    kvm_arch_vcpu_id(cs), strerror(errno));
> -            exit(1);
> -        }
> -        ss->cap_irq_xics_enabled = true;
> +    ret = kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, xicskvm->kernel_xics_fd,
> +                              kvm_arch_vcpu_id(cs));
> +    if (ret < 0) {
> +        error_report("Unable to connect CPU%ld to kernel XICS: %s",
> +                     kvm_arch_vcpu_id(cs), strerror(errno));
> +        exit(1);
>      }
> +    ss->cap_irq_xics_enabled = true;
>  }
>  
>  static void xics_kvm_set_nr_irqs(XICSState *xics, uint32_t nr_irqs,
>
diff mbox

Patch

diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index edbd62fd1bae..c9caefcf2b0b 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -329,6 +329,7 @@  static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu)
     CPUState *cs;
     ICPState *ss;
     KVMXICSState *xicskvm = XICS_SPAPR_KVM(xics);
+    int ret;
 
     cs = CPU(cpu);
     ss = &xics->ss[cs->cpu_index];
@@ -347,19 +348,14 @@  static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu)
         return;
     }
 
-    if (xicskvm->kernel_xics_fd != -1) {
-        int ret;
-
-        ret = kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0,
-                                  xicskvm->kernel_xics_fd,
-                                  kvm_arch_vcpu_id(cs));
-        if (ret < 0) {
-            error_report("Unable to connect CPU%ld to kernel XICS: %s",
-                    kvm_arch_vcpu_id(cs), strerror(errno));
-            exit(1);
-        }
-        ss->cap_irq_xics_enabled = true;
+    ret = kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, xicskvm->kernel_xics_fd,
+                              kvm_arch_vcpu_id(cs));
+    if (ret < 0) {
+        error_report("Unable to connect CPU%ld to kernel XICS: %s",
+                     kvm_arch_vcpu_id(cs), strerror(errno));
+        exit(1);
     }
+    ss->cap_irq_xics_enabled = true;
 }
 
 static void xics_kvm_set_nr_irqs(XICSState *xics, uint32_t nr_irqs,