cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-ppc-Don-t-use-CPUPPCState-irq_input_state-with-moder.patch

ddf19c
From f2f57c1ed926384e074d2048cdbdc30ee2f426eb Mon Sep 17 00:00:00 2001
ddf19c
From: David Gibson <dgibson@redhat.com>
ddf19c
Date: Tue, 21 Jan 2020 05:16:13 +0000
ddf19c
Subject: [PATCH 03/15] ppc: Don't use CPUPPCState::irq_input_state with modern
ddf19c
 Book3s CPU models
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: David Gibson <dgibson@redhat.com>
ddf19c
Message-id: <20200121051613.388295-4-dgibson@redhat.com>
ddf19c
Patchwork-id: 93431
ddf19c
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 3/3] ppc: Don't use CPUPPCState::irq_input_state with modern Book3s CPU models
ddf19c
Bugzilla: 1776638
ddf19c
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ddf19c
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ddf19c
ddf19c
From: Greg Kurz <groug@kaod.org>
ddf19c
ddf19c
The power7_set_irq() and power9_set_irq() functions set this but it is
ddf19c
never used actually. Modern Book3s compatible CPUs are only supported
ddf19c
by the pnv and spapr machines. They have an interrupt controller, XICS
ddf19c
for POWER7/8 and XIVE for POWER9, whose models don't require to track
ddf19c
IRQ input states at the CPU level.
ddf19c
ddf19c
Drop these lines to avoid confusion.
ddf19c
ddf19c
Signed-off-by: Greg Kurz <groug@kaod.org>
ddf19c
Message-Id: <157548862861.3650476.16622818876928044450.stgit@bahia.lan>
ddf19c
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ddf19c
(cherry picked from commit c1ad0b892ce20cf2b5e619c79e8a0c4c66b235dc)
ddf19c
ddf19c
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1776638
ddf19c
ddf19c
Signed-off-by: David Gibson <dgibson@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 hw/ppc/ppc.c     | 16 ++--------------
ddf19c
 target/ppc/cpu.h |  4 +++-
ddf19c
 2 files changed, 5 insertions(+), 15 deletions(-)
ddf19c
ddf19c
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
ddf19c
index d554b64..730a41f 100644
ddf19c
--- a/hw/ppc/ppc.c
ddf19c
+++ b/hw/ppc/ppc.c
ddf19c
@@ -275,10 +275,9 @@ void ppc970_irq_init(PowerPCCPU *cpu)
ddf19c
 static void power7_set_irq(void *opaque, int pin, int level)
ddf19c
 {
ddf19c
     PowerPCCPU *cpu = opaque;
ddf19c
-    CPUPPCState *env = &cpu->env;
ddf19c
 
ddf19c
     LOG_IRQ("%s: env %p pin %d level %d\n", __func__,
ddf19c
-                env, pin, level);
ddf19c
+            &cpu->env, pin, level);
ddf19c
 
ddf19c
     switch (pin) {
ddf19c
     case POWER7_INPUT_INT:
ddf19c
@@ -292,11 +291,6 @@ static void power7_set_irq(void *opaque, int pin, int level)
ddf19c
         LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin);
ddf19c
         return;
ddf19c
     }
ddf19c
-    if (level) {
ddf19c
-        env->irq_input_state |= 1 << pin;
ddf19c
-    } else {
ddf19c
-        env->irq_input_state &= ~(1 << pin);
ddf19c
-    }
ddf19c
 }
ddf19c
 
ddf19c
 void ppcPOWER7_irq_init(PowerPCCPU *cpu)
ddf19c
@@ -311,10 +305,9 @@ void ppcPOWER7_irq_init(PowerPCCPU *cpu)
ddf19c
 static void power9_set_irq(void *opaque, int pin, int level)
ddf19c
 {
ddf19c
     PowerPCCPU *cpu = opaque;
ddf19c
-    CPUPPCState *env = &cpu->env;
ddf19c
 
ddf19c
     LOG_IRQ("%s: env %p pin %d level %d\n", __func__,
ddf19c
-                env, pin, level);
ddf19c
+            &cpu->env, pin, level);
ddf19c
 
ddf19c
     switch (pin) {
ddf19c
     case POWER9_INPUT_INT:
ddf19c
@@ -334,11 +327,6 @@ static void power9_set_irq(void *opaque, int pin, int level)
ddf19c
         LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin);
ddf19c
         return;
ddf19c
     }
ddf19c
-    if (level) {
ddf19c
-        env->irq_input_state |= 1 << pin;
ddf19c
-    } else {
ddf19c
-        env->irq_input_state &= ~(1 << pin);
ddf19c
-    }
ddf19c
 }
ddf19c
 
ddf19c
 void ppcPOWER9_irq_init(PowerPCCPU *cpu)
ddf19c
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
ddf19c
index 5c53801..8887f76 100644
ddf19c
--- a/target/ppc/cpu.h
ddf19c
+++ b/target/ppc/cpu.h
ddf19c
@@ -1090,7 +1090,9 @@ struct CPUPPCState {
ddf19c
 #if !defined(CONFIG_USER_ONLY)
ddf19c
     /*
ddf19c
      * This is the IRQ controller, which is implementation dependent
ddf19c
-     * and only relevant when emulating a complete machine.
ddf19c
+     * and only relevant when emulating a complete machine. Note that
ddf19c
+     * this isn't used by recent Book3s compatible CPUs (POWER7 and
ddf19c
+     * newer).
ddf19c
      */
ddf19c
     uint32_t irq_input_state;
ddf19c
     void **irq_inputs;
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c