From nobody Sat Dec 21 12:44:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502106019873.515813663443; Mon, 18 Feb 2019 07:01:46 -0800 (PST) Received: from localhost ([127.0.0.1]:60048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkQQ-0005Qc-Gg for importer@patchew.org; Mon, 18 Feb 2019 10:01:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxv-0006bK-3S for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003Ax-3B for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:15 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:41991) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-000317-4U; Mon, 18 Feb 2019 09:32:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rx36Z0z9sPW; Tue, 19 Feb 2019 01:31:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500273; bh=yUzVlCUqBvM0ym7fyXMIW9cf/u1sbVfrlxtrBZHbe2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3OYcG1hf++a6bR+xG3GhqRTcmHpzVq/t+MfOzS1JsaKUL3RlpgilqjTXLCgxgEnx 7liTznFClM2VJgw5B2ukwL3E4mPaHB0xWcQde2FmpW70DWjv4fR56+XlN7Z76qBXtM IaCPmUSWVHKi7K8se+ABqWouWUPK4XbU2vGJqBMY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:30 +1100 Message-Id: <20190218143049.17142-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 24/43] xics: Handle KVM interrupt presentation from "simple" ICS code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz We want to use the "simple" ICS type in both KVM and non-KVM setups. Teach the "simple" ICS how to present interrupts to KVM and adapt sPAPR accordingly. Signed-off-by: Greg Kurz Message-Id: <155023082996.1011724.16237920586343905010.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/intc/xics.c | 5 +++++ hw/intc/xics_kvm.c | 3 +-- hw/ppc/spapr_irq.c | 7 +------ include/hw/ppc/xics.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 49401745c4..3009fa7472 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -466,6 +466,11 @@ void ics_simple_set_irq(void *opaque, int srcno, int v= al) { ICSState *ics =3D (ICSState *)opaque; =20 + if (kvm_irqchip_in_kernel()) { + ics_kvm_set_irq(ics, srcno, val); + return; + } + if (ics->irqs[srcno].flags & XICS_FLAGS_IRQ_LSI) { ics_simple_set_irq_lsi(ics, srcno, val); } else { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index e7b8d4c29c..f34eacda03 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -259,9 +259,8 @@ int ics_set_kvm_state(ICSState *ics) return 0; } =20 -void ics_kvm_set_irq(void *opaque, int srcno, int val) +void ics_kvm_set_irq(ICSState *ics, int srcno, int val) { - ICSState *ics =3D opaque; struct kvm_irq_level args; int rc; =20 diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index e6893df61e..9f43b7b3bf 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -222,13 +222,8 @@ static int spapr_irq_post_load_xics(sPAPRMachineState = *spapr, int version_id) static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val) { sPAPRMachineState *spapr =3D opaque; - MachineState *machine =3D MACHINE(opaque); =20 - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { - ics_kvm_set_irq(spapr->ics, srcno, val); - } else { - ics_simple_set_irq(spapr->ics, srcno, val); - } + ics_simple_set_irq(spapr->ics, srcno, val); } =20 static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 06e87128f8..61bd0fb978 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -180,7 +180,6 @@ void icp_eoi(ICPState *icp, uint32_t xirr); void ics_simple_write_xive(ICSState *ics, int nr, int server, uint8_t priority, uint8_t saved_priority); void ics_simple_set_irq(void *opaque, int srcno, int val); -void ics_kvm_set_irq(void *opaque, int srcno, int val); =20 void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); void icp_pic_print_info(ICPState *icp, Monitor *mon); @@ -201,5 +200,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp); void ics_get_kvm_state(ICSState *ics); int ics_set_kvm_state(ICSState *ics); void ics_synchronize_state(ICSState *ics); +void ics_kvm_set_irq(ICSState *ics, int srcno, int val); =20 #endif /* XICS_H */ --=20 2.20.1