From nobody Sat May 4 12:25:43 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1550230913032977.5100604636518; Fri, 15 Feb 2019 03:41:53 -0800 (PST) Received: from localhost ([127.0.0.1]:37949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubsB-00050J-A2 for importer@patchew.org; Fri, 15 Feb 2019 06:41:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubqc-000471-Fw for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubqa-0005Pl-Gz for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:02 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41692 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubqY-0005J1-Hd for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:00 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXxjc009250 for ; Fri, 15 Feb 2019 06:39:55 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qnvc2s0ur-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:39:55 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:39:53 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:39:50 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBdnZ547251680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 11:39:49 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1F1D42047; Fri, 15 Feb 2019 11:39:49 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A67A542045; Fri, 15 Feb 2019 11:39:49 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:39:49 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 27342220295; Fri, 15 Feb 2019 12:39:49 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:39:48 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0008-0000-0000-000002C0D882 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0009-0000-0000-0000222CFED2 Message-Id: <155023078871.1011724.3083923389814185598.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 01/10] xics: Explicitely call KVM ICP methods from the common 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The pre_save(), post_load() and synchronize_state() methods of the ICPStateClass type are really KVM only things. Make that obvious by dropping the indirections and directly calling the KVM functions instead. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 24 +++++++++++------------- hw/intc/xics_kvm.c | 12 ++++-------- include/hw/ppc/xics.h | 9 +++++---- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 16e8ffa2aaf7..988b53abd17d 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -37,18 +37,18 @@ #include "qapi/visitor.h" #include "monitor/monitor.h" #include "hw/intc/intc.h" +#include "sysemu/kvm.h" =20 void icp_pic_print_info(ICPState *icp, Monitor *mon) { - ICPStateClass *icpc =3D ICP_GET_CLASS(icp); int cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; =20 if (!icp->output) { return; } =20 - if (icpc->synchronize_state) { - icpc->synchronize_state(icp); + if (kvm_irqchip_in_kernel()) { + icp_synchronize_state(icp); } =20 monitor_printf(mon, "CPU %d XIRR=3D%08x (%p) PP=3D%02x MFRR=3D%02x\n", @@ -252,25 +252,23 @@ static void icp_irq(ICSState *ics, int server, int nr= , uint8_t priority) } } =20 -static int icp_dispatch_pre_save(void *opaque) +static int icp_pre_save(void *opaque) { ICPState *icp =3D opaque; - ICPStateClass *info =3D ICP_GET_CLASS(icp); =20 - if (info->pre_save) { - info->pre_save(icp); + if (kvm_irqchip_in_kernel()) { + icp_get_kvm_state(icp); } =20 return 0; } =20 -static int icp_dispatch_post_load(void *opaque, int version_id) +static int icp_post_load(void *opaque, int version_id) { ICPState *icp =3D opaque; - ICPStateClass *info =3D ICP_GET_CLASS(icp); =20 - if (info->post_load) { - return info->post_load(icp, version_id); + if (kvm_irqchip_in_kernel()) { + return icp_set_kvm_state(icp); } =20 return 0; @@ -280,8 +278,8 @@ static const VMStateDescription vmstate_icp_server =3D { .name =3D "icp/server", .version_id =3D 1, .minimum_version_id =3D 1, - .pre_save =3D icp_dispatch_pre_save, - .post_load =3D icp_dispatch_post_load, + .pre_save =3D icp_pre_save, + .post_load =3D icp_post_load, .fields =3D (VMStateField[]) { /* Sanity check */ VMSTATE_UINT32(xirr, ICPState), diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index dff13300504c..7efa99b8b434 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -54,7 +54,7 @@ static QLIST_HEAD(, KVMEnabledICP) /* * ICP-KVM */ -static void icp_get_kvm_state(ICPState *icp) +void icp_get_kvm_state(ICPState *icp) { uint64_t state; int ret; @@ -83,14 +83,14 @@ static void do_icp_synchronize_state(CPUState *cpu, run= _on_cpu_data arg) icp_get_kvm_state(arg.host_ptr); } =20 -static void icp_synchronize_state(ICPState *icp) +void icp_synchronize_state(ICPState *icp) { if (icp->cs) { run_on_cpu(icp->cs, do_icp_synchronize_state, RUN_ON_CPU_HOST_PTR(= icp)); } } =20 -static int icp_set_kvm_state(ICPState *icp, int version_id) +int icp_set_kvm_state(ICPState *icp) { uint64_t state; int ret; @@ -121,7 +121,7 @@ static void icp_kvm_reset(DeviceState *dev) =20 icpc->parent_reset(dev); =20 - icp_set_kvm_state(ICP(dev), 1); + icp_set_kvm_state(ICP(dev)); } =20 static void icp_kvm_realize(DeviceState *dev, Error **errp) @@ -178,10 +178,6 @@ static void icp_kvm_class_init(ObjectClass *klass, voi= d *data) &icpc->parent_realize); device_class_set_parent_reset(dc, icp_kvm_reset, &icpc->parent_reset); - - icpc->pre_save =3D icp_get_kvm_state; - icpc->post_load =3D icp_set_kvm_state; - icpc->synchronize_state =3D icp_synchronize_state; } =20 static const TypeInfo icp_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index fad786e8b22d..3236ccec924c 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -66,10 +66,6 @@ struct ICPStateClass { =20 DeviceRealize parent_realize; DeviceReset parent_reset; - - void (*pre_save)(ICPState *icp); - int (*post_load)(ICPState *icp, int version_id); - void (*synchronize_state)(ICPState *icp); }; =20 struct ICPState { @@ -203,4 +199,9 @@ void icp_resend(ICPState *ss); Object *icp_create(Object *cpu, const char *type, XICSFabric *xi, Error **errp); =20 +/* KVM */ +void icp_get_kvm_state(ICPState *icp); +int icp_set_kvm_state(ICPState *icp); +void icp_synchronize_state(ICPState *icp); + #endif /* XICS_H */ From nobody Sat May 4 12:25:43 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; 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 1550230942119123.30856498417415; Fri, 15 Feb 2019 03:42:22 -0800 (PST) Received: from localhost ([127.0.0.1]:37953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubso-0005Vn-38 for importer@patchew.org; Fri, 15 Feb 2019 06:42:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubqm-0004Be-CL for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubqi-0005Yq-Lx for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:10 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36700) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubqg-0005RM-Hw for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:08 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXtUN076644 for ; Fri, 15 Feb 2019 06:40:01 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qntdh6xkb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:01 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:39:58 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:39:56 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBdtPN62980206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:39:55 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9296C52057; Fri, 15 Feb 2019 11:39:55 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7EB5052052; Fri, 15 Feb 2019 11:39:55 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 0B860220295; Fri, 15 Feb 2019 12:39:54 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:39:54 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0012-0000-0000-000002F61BD0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0013-0000-0000-0000212D9C95 Message-Id: <155023079461.1011724.12644984391500635645.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 02/10] xics: Handle KVM ICP reset from the common 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The KVM ICP reset handler simply writes the ICP state to KVM. This doesn't need the overkill parent_reset logic we have today. Call icp_set_kvm_state() from the base ICP reset function instead. Since there are no other users for ICPStateClass::parent_reset, and it isn't currently expected to change, drop it as well. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 12 ++++-------- hw/intc/xics_kvm.c | 11 ----------- include/hw/ppc/xics.h | 1 - 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 988b53abd17d..822d367e6388 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -289,7 +289,7 @@ static const VMStateDescription vmstate_icp_server =3D { }, }; =20 -static void icp_reset(DeviceState *dev) +static void icp_reset_handler(void *dev) { ICPState *icp =3D ICP(dev); =20 @@ -299,13 +299,10 @@ static void icp_reset(DeviceState *dev) =20 /* Make all outputs are deasserted */ qemu_set_irq(icp->output, 0); -} =20 -static void icp_reset_handler(void *dev) -{ - DeviceClass *dc =3D DEVICE_GET_CLASS(dev); - - dc->reset(dev); + if (kvm_irqchip_in_kernel()) { + icp_set_kvm_state(ICP(dev)); + } } =20 static void icp_realize(DeviceState *dev, Error **errp) @@ -370,7 +367,6 @@ static void icp_class_init(ObjectClass *klass, void *da= ta) =20 dc->realize =3D icp_realize; dc->unrealize =3D icp_unrealize; - dc->reset =3D icp_reset; } =20 static const TypeInfo icp_info =3D { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 7efa99b8b434..80321e9b75ab 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -115,15 +115,6 @@ int icp_set_kvm_state(ICPState *icp) return 0; } =20 -static void icp_kvm_reset(DeviceState *dev) -{ - ICPStateClass *icpc =3D ICP_GET_CLASS(dev); - - icpc->parent_reset(dev); - - icp_set_kvm_state(ICP(dev)); -} - static void icp_kvm_realize(DeviceState *dev, Error **errp) { ICPState *icp =3D ICP(dev); @@ -176,8 +167,6 @@ static void icp_kvm_class_init(ObjectClass *klass, void= *data) =20 device_class_set_parent_realize(dc, icp_kvm_realize, &icpc->parent_realize); - device_class_set_parent_reset(dc, icp_kvm_reset, - &icpc->parent_reset); } =20 static const TypeInfo icp_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 3236ccec924c..e33282a576d0 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -65,7 +65,6 @@ struct ICPStateClass { DeviceClass parent_class; =20 DeviceRealize parent_realize; - DeviceReset parent_reset; }; =20 struct ICPState { From nobody Sat May 4 12:25:43 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; 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 1550230924379264.75148793944186; Fri, 15 Feb 2019 03:42:04 -0800 (PST) Received: from localhost ([127.0.0.1]:37951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubsV-0005Iv-VV for importer@patchew.org; Fri, 15 Feb 2019 06:42:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubqm-0004Bj-Er for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubqk-0005aT-GX for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:12 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:32904 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubqi-0005WV-HE for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:08 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXvsm080785 for ; Fri, 15 Feb 2019 06:40:06 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qnt8tf3cb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:06 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:04 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:02 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBe1lf55443676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:40:01 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 818B4A4062; Fri, 15 Feb 2019 11:40:01 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E1E7A405F; Fri, 15 Feb 2019 11:40:01 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:01 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id E4900220295; Fri, 15 Feb 2019 12:40:00 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:00 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0008-0000-0000-000002C0D88A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0009-0000-0000-0000222CFED9 Message-Id: <155023080049.1011724.15423463482790260696.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=800 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 03/10] xics: Handle KVM ICP realize from the common 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The realization of KVM ICP currently follows the parent_realize logic, which is a bit overkill here. Also we want to get rid of the KVM ICP class. Explicitely call icp_kvm_realize() from the base ICP realize function. Note that ICPStateClass::parent_realize is retained because powernv needs it. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 8 ++++++++ hw/intc/xics_kvm.c | 10 +--------- include/hw/ppc/xics.h | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 822d367e6388..acd63ab5e0b9 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -349,6 +349,14 @@ static void icp_realize(DeviceState *dev, Error **errp) return; } =20 + if (kvm_irqchip_in_kernel()) { + icp_kvm_realize(dev, &err); + if (err) { + error_propagate(errp, err); + return; + } + } + qemu_register_reset(icp_reset_handler, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); } diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 80321e9b75ab..4eebced516b6 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -115,11 +115,9 @@ int icp_set_kvm_state(ICPState *icp) return 0; } =20 -static void icp_kvm_realize(DeviceState *dev, Error **errp) +void icp_kvm_realize(DeviceState *dev, Error **errp) { ICPState *icp =3D ICP(dev); - ICPStateClass *icpc =3D ICP_GET_CLASS(icp); - Error *local_err =3D NULL; CPUState *cs; KVMEnabledICP *enabled_icp; unsigned long vcpu_id; @@ -129,12 +127,6 @@ static void icp_kvm_realize(DeviceState *dev, Error **= errp) abort(); } =20 - icpc->parent_realize(dev, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - cs =3D icp->cs; vcpu_id =3D kvm_arch_vcpu_id(cs); =20 diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index e33282a576d0..ab61dc24010a 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -202,5 +202,6 @@ Object *icp_create(Object *cpu, const char *type, XICSF= abric *xi, void icp_get_kvm_state(ICPState *icp); int icp_set_kvm_state(ICPState *icp); void icp_synchronize_state(ICPState *icp); +void icp_kvm_realize(DeviceState *dev, Error **errp); =20 #endif /* XICS_H */ From nobody Sat May 4 12:25:43 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; 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 1550231280707515.4165428512102; Fri, 15 Feb 2019 03:48:00 -0800 (PST) Received: from localhost ([127.0.0.1]:38041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubyC-0001Zq-HU for importer@patchew.org; Fri, 15 Feb 2019 06:47:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubqr-0004Dp-9d for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubqq-0005hs-Dq for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40424) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubqo-0005dU-K7 for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:16 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBY0MC100727 for ; Fri, 15 Feb 2019 06:40:12 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qnt977ryt-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:12 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:10 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:08 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBe7Gr50724912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:40:07 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 668A1A405F; Fri, 15 Feb 2019 11:40:07 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53FD0A405B; Fri, 15 Feb 2019 11:40:07 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:07 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id C9891220295; Fri, 15 Feb 2019 12:40:06 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:06 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0016-0000-0000-00000256D5A4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0017-0000-0000-000032B10ACE Message-Id: <155023080638.1011724.792095453419098948.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 04/10] spapr/irq: Use the base ICP class for KVM 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The base ICP class knows how to interact with KVM. Adapt sPAPR to use it instead of the ICP KVM class. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/ppc/spapr_irq.c | 4 +--- include/hw/ppc/spapr.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 48d6b2daed6e..e6893df61e76 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -102,7 +102,6 @@ static void spapr_irq_init_xics(sPAPRMachineState *spap= r, int nr_irqs, if (kvm_enabled()) { if (machine_kernel_irqchip_allowed(machine) && !xics_kvm_init(spapr, &local_err)) { - spapr->icp_type =3D TYPE_KVM_ICP; spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, &local_err); } @@ -117,7 +116,6 @@ static void spapr_irq_init_xics(sPAPRMachineState *spap= r, int nr_irqs, =20 if (!spapr->ics) { xics_spapr_init(spapr); - spapr->icp_type =3D TYPE_ICP; spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs, &local_err); } @@ -199,7 +197,7 @@ static void spapr_irq_cpu_intc_create_xics(sPAPRMachine= State *spapr, Object *obj; sPAPRCPUState *spapr_cpu =3D spapr_cpu_state(cpu); =20 - obj =3D icp_create(OBJECT(cpu), spapr->icp_type, XICS_FABRIC(spapr), + obj =3D icp_create(OBJECT(cpu), TYPE_ICP, XICS_FABRIC(spapr), &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index cbd276ed2b6a..631fc5103b7b 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -178,7 +178,6 @@ struct sPAPRMachineState { /*< public >*/ char *kvm_type; =20 - const char *icp_type; int32_t irq_map_nr; unsigned long *irq_map; sPAPRXive *xive; From nobody Sat May 4 12:25:43 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; 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 1550231089288244.17250827329826; Fri, 15 Feb 2019 03:44:49 -0800 (PST) Received: from localhost ([127.0.0.1]:37981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubvB-0007dQ-8u for importer@patchew.org; Fri, 15 Feb 2019 06:44:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubqv-0004Hx-G3 for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubqu-0005m1-L6 for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:21 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54360 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubqu-0005lZ-9f for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:20 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXwla061459 for ; Fri, 15 Feb 2019 06:40:19 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qnv8j9eb1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:19 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:18 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:14 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBeDIA58916922 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 11:40:13 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4DEB74C04E; Fri, 15 Feb 2019 11:40:13 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A30A4C052; Fri, 15 Feb 2019 11:40:13 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:13 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id B08AB220295; Fri, 15 Feb 2019 12:40:12 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:12 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0008-0000-0000-000002C0D88F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0009-0000-0000-0000222CFEDF Message-Id: <155023081228.1011724.12474992370439652538.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 05/10] xics: Drop the KVM ICP class 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The KVM ICP class isn't used anymore. Drop it. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics_kvm.c | 18 ------------------ include/hw/ppc/xics.h | 3 --- 2 files changed, 21 deletions(-) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 4eebced516b6..fae4ac431f2f 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -152,23 +152,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp) QLIST_INSERT_HEAD(&kvm_enabled_icps, enabled_icp, node); } =20 -static void icp_kvm_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - ICPStateClass *icpc =3D ICP_CLASS(klass); - - device_class_set_parent_realize(dc, icp_kvm_realize, - &icpc->parent_realize); -} - -static const TypeInfo icp_kvm_info =3D { - .name =3D TYPE_KVM_ICP, - .parent =3D TYPE_ICP, - .instance_size =3D sizeof(ICPState), - .class_init =3D icp_kvm_class_init, - .class_size =3D sizeof(ICPStateClass), -}; - /* * ICS-KVM */ @@ -425,7 +408,6 @@ fail: static void xics_kvm_register_types(void) { type_register_static(&ics_kvm_info); - type_register_static(&icp_kvm_info); } =20 type_init(xics_kvm_register_types) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index ab61dc24010a..fae54e6f28ae 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -50,9 +50,6 @@ typedef struct XICSFabric XICSFabric; #define TYPE_ICP "icp" #define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) =20 -#define TYPE_KVM_ICP "icp-kvm" -#define KVM_ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_KVM_ICP) - #define TYPE_PNV_ICP "pnv-icp" #define PNV_ICP(obj) OBJECT_CHECK(PnvICPState, (obj), TYPE_PNV_ICP) =20 From nobody Sat May 4 12:25:43 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; 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 1550231281717501.51236586459004; Fri, 15 Feb 2019 03:48:01 -0800 (PST) Received: from localhost ([127.0.0.1]:38043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubyF-0001cD-F2 for importer@patchew.org; Fri, 15 Feb 2019 06:47:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubrQ-0004kj-04 for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubrM-0006Av-6m for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:50 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56836) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubrG-0005tw-Iy for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:46 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXvd0030896 for ; Fri, 15 Feb 2019 06:40:26 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qnt8sq7t4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:26 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:23 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:20 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBeJjh131540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:40:19 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A0F1A4060; Fri, 15 Feb 2019 11:40:19 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20B3EA4054; Fri, 15 Feb 2019 11:40:19 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:19 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 956CC220295; Fri, 15 Feb 2019 12:40:18 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:18 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0028-0000-0000-00000348F1FE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0029-0000-0000-00002407217C Message-Id: <155023081817.1011724.14078777320394028836.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=908 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 06/10] xics: Explicitely call KVM ICS methods from the common 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The pre_save(), post_load() and synchronize_state() methods of the ICSStateClass type are really KVM only things. Make that obvious by dropping the indirections and directly calling the KVM functions instead. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 23 ++++++++++------------- hw/intc/xics_kvm.c | 12 ++++-------- include/hw/ppc/xics.h | 7 ++++--- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index acd63ab5e0b9..ae5d5ea135b8 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -58,7 +58,6 @@ void icp_pic_print_info(ICPState *icp, Monitor *mon) =20 void ics_pic_print_info(ICSState *ics, Monitor *mon) { - ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(ics); uint32_t i; =20 monitor_printf(mon, "ICS %4x..%4x %p\n", @@ -68,8 +67,8 @@ void ics_pic_print_info(ICSState *ics, Monitor *mon) return; } =20 - if (icsc->synchronize_state) { - icsc->synchronize_state(ics); + if (kvm_irqchip_in_kernel()) { + ics_synchronize_state(ics); } =20 for (i =3D 0; i < ics->nr_irqs; i++) { @@ -647,25 +646,23 @@ static void ics_base_instance_init(Object *obj) ics->offset =3D XICS_IRQ_BASE; } =20 -static int ics_base_dispatch_pre_save(void *opaque) +static int ics_base_pre_save(void *opaque) { ICSState *ics =3D opaque; - ICSStateClass *info =3D ICS_BASE_GET_CLASS(ics); =20 - if (info->pre_save) { - info->pre_save(ics); + if (kvm_irqchip_in_kernel()) { + ics_get_kvm_state(ics); } =20 return 0; } =20 -static int ics_base_dispatch_post_load(void *opaque, int version_id) +static int ics_base_post_load(void *opaque, int version_id) { ICSState *ics =3D opaque; - ICSStateClass *info =3D ICS_BASE_GET_CLASS(ics); =20 - if (info->post_load) { - return info->post_load(ics, version_id); + if (kvm_irqchip_in_kernel()) { + return ics_set_kvm_state(ics); } =20 return 0; @@ -689,8 +686,8 @@ static const VMStateDescription vmstate_ics_base =3D { .name =3D "ics", .version_id =3D 1, .minimum_version_id =3D 1, - .pre_save =3D ics_base_dispatch_pre_save, - .post_load =3D ics_base_dispatch_post_load, + .pre_save =3D ics_base_pre_save, + .post_load =3D ics_base_post_load, .fields =3D (VMStateField[]) { /* Sanity check */ VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL), diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index fae4ac431f2f..642351e5790f 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -155,7 +155,7 @@ void icp_kvm_realize(DeviceState *dev, Error **errp) /* * ICS-KVM */ -static void ics_get_kvm_state(ICSState *ics) +void ics_get_kvm_state(ICSState *ics) { uint64_t state; int i; @@ -208,12 +208,12 @@ static void ics_get_kvm_state(ICSState *ics) } } =20 -static void ics_synchronize_state(ICSState *ics) +void ics_synchronize_state(ICSState *ics) { ics_get_kvm_state(ics); } =20 -static int ics_set_kvm_state(ICSState *ics, int version_id) +int ics_set_kvm_state(ICSState *ics) { uint64_t state; int i; @@ -286,7 +286,7 @@ static void ics_kvm_reset(DeviceState *dev) =20 icsc->parent_reset(dev); =20 - ics_set_kvm_state(ICS_KVM(dev), 1); + ics_set_kvm_state(ICS_KVM(dev)); } =20 static void ics_kvm_reset_handler(void *dev) @@ -318,10 +318,6 @@ static void ics_kvm_class_init(ObjectClass *klass, voi= d *data) &icsc->parent_realize); device_class_set_parent_reset(dc, ics_kvm_reset, &icsc->parent_reset); - - icsc->pre_save =3D ics_get_kvm_state; - icsc->post_load =3D ics_set_kvm_state; - icsc->synchronize_state =3D ics_synchronize_state; } =20 static const TypeInfo ics_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index fae54e6f28ae..06e87128f88e 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -109,12 +109,9 @@ struct ICSStateClass { DeviceRealize parent_realize; DeviceReset parent_reset; =20 - void (*pre_save)(ICSState *s); - int (*post_load)(ICSState *s, int version_id); void (*reject)(ICSState *s, uint32_t irq); void (*resend)(ICSState *s); void (*eoi)(ICSState *s, uint32_t irq); - void (*synchronize_state)(ICSState *s); }; =20 struct ICSState { @@ -201,4 +198,8 @@ int icp_set_kvm_state(ICPState *icp); void icp_synchronize_state(ICPState *icp); void icp_kvm_realize(DeviceState *dev, Error **errp); =20 +void ics_get_kvm_state(ICSState *ics); +int ics_set_kvm_state(ICSState *ics); +void ics_synchronize_state(ICSState *ics); + #endif /* XICS_H */ From nobody Sat May 4 12:25:43 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; 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 1550230976496646.1352441455374; Fri, 15 Feb 2019 03:42:56 -0800 (PST) Received: from localhost ([127.0.0.1]:37955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubtM-00060f-DP for importer@patchew.org; Fri, 15 Feb 2019 06:42:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubrU-0004nw-2o for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubrO-0006CX-11 for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:54 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubrG-0005y0-HF for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:46 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXwTL141185 for ; Fri, 15 Feb 2019 06:40:31 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qntpsee3k-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:30 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:28 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:26 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBePdh57016382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:40:25 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19794A4054; Fri, 15 Feb 2019 11:40:25 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06CE4A405B; Fri, 15 Feb 2019 11:40:25 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:24 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 7BF2E220295; Fri, 15 Feb 2019 12:40:24 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:24 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0020-0000-0000-000003172DD2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0021-0000-0000-00002168624B Message-Id: <155023082407.1011724.1983100830860273401.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 07/10] xics: Handle KVM ICS reset from the "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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The KVM ICS reset handler simply writes the ICS state to KVM. This doesn't need the overkill parent_reset logic we have today. Also we want to use the same ICS type for the KVM and non-KVM case with pseries. Call icp_set_kvm_state() from the "simple" ICS reset function. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 4 ++++ hw/intc/xics_kvm.c | 18 ------------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index ae5d5ea135b8..49401745c410 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -553,6 +553,10 @@ static void ics_simple_reset(DeviceState *dev) ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(dev); =20 icsc->parent_reset(dev); + + if (kvm_irqchip_in_kernel()) { + ics_set_kvm_state(ICS_BASE(dev)); + } } =20 static void ics_simple_reset_handler(void *dev) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 642351e5790f..e7b8d4c29ce6 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -280,20 +280,6 @@ void ics_kvm_set_irq(void *opaque, int srcno, int val) } } =20 -static void ics_kvm_reset(DeviceState *dev) -{ - ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(dev); - - icsc->parent_reset(dev); - - ics_set_kvm_state(ICS_KVM(dev)); -} - -static void ics_kvm_reset_handler(void *dev) -{ - ics_kvm_reset(dev); -} - static void ics_kvm_realize(DeviceState *dev, Error **errp) { ICSState *ics =3D ICS_KVM(dev); @@ -305,8 +291,6 @@ static void ics_kvm_realize(DeviceState *dev, Error **e= rrp) error_propagate(errp, local_err); return; } - - qemu_register_reset(ics_kvm_reset_handler, ics); } =20 static void ics_kvm_class_init(ObjectClass *klass, void *data) @@ -316,8 +300,6 @@ static void ics_kvm_class_init(ObjectClass *klass, void= *data) =20 device_class_set_parent_realize(dc, ics_kvm_realize, &icsc->parent_realize); - device_class_set_parent_reset(dc, ics_kvm_reset, - &icsc->parent_reset); } =20 static const TypeInfo ics_kvm_info =3D { From nobody Sat May 4 12:25:43 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; 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 15502313096101016.2894643650957; Fri, 15 Feb 2019 03:48:29 -0800 (PST) Received: from localhost ([127.0.0.1]:38045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubya-0001tm-Pu for importer@patchew.org; Fri, 15 Feb 2019 06:48:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubrX-0004sY-BU for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:41:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubrU-0006LA-Mo for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:59 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubrU-00062U-9C for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:56 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBY6gi078029 for ; Fri, 15 Feb 2019 06:40:37 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qntdh6ybb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:36 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:34 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:32 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBeVeg6095186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 11:40:31 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EDC0842045; Fri, 15 Feb 2019 11:40:30 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1AC042047; Fri, 15 Feb 2019 11:40:30 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:30 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 60E73220295; Fri, 15 Feb 2019 12:40:30 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:30 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0016-0000-0000-00000256D5AA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0017-0000-0000-000032B10AD4 Message-Id: <155023082996.1011724.16237920586343905010.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=718 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 08/10] 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 49401745c410..3009fa747277 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 e7b8d4c29ce6..f34eacda03e7 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 e6893df61e76..9f43b7b3bf16 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 06e87128f88e..61bd0fb9784f 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 */ From nobody Sat May 4 12:25:43 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; 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 1550231459274594.0602235338129; Fri, 15 Feb 2019 03:50:59 -0800 (PST) Received: from localhost ([127.0.0.1]:38101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guc1B-000474-98 for importer@patchew.org; Fri, 15 Feb 2019 06:50:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubrW-0004q9-NV for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:41:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubrU-0006Ke-GA for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:58 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49592 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubrU-000672-5n for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:56 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXvxW009041 for ; Fri, 15 Feb 2019 06:40:43 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qnvc2s1vb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:43 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:41 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:37 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBeaOL49676408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:40:37 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFF3AA405F; Fri, 15 Feb 2019 11:40:36 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD3A4A405B; Fri, 15 Feb 2019 11:40:36 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 11:40:36 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 48926220295; Fri, 15 Feb 2019 12:40:36 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:35 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0012-0000-0000-000002F61BE3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0013-0000-0000-0000212D9CA9 Message-Id: <155023083585.1011724.2868047424353921455.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=966 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 09/10] spapr/irq: Use the "simple" ICS class for KVM 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The "simple" ICS class knows how to interract with KVM. Adapt sPAPR to use it instead of the ICS KVM class. Signed-off-by: Greg Kurz --- hw/ppc/spapr_irq.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 9f43b7b3bf16..4aa8165307c7 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -67,13 +67,12 @@ void spapr_irq_msi_reset(sPAPRMachineState *spapr) */ =20 static ICSState *spapr_ics_create(sPAPRMachineState *spapr, - const char *type_ics, int nr_irqs, Error **errp) { Error *local_err =3D NULL; Object *obj; =20 - obj =3D object_new(type_ics); + obj =3D object_new(TYPE_ICS_SIMPLE); object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort); object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr), &error_abort); @@ -98,14 +97,14 @@ static void spapr_irq_init_xics(sPAPRMachineState *spap= r, int nr_irqs, { MachineState *machine =3D MACHINE(spapr); Error *local_err =3D NULL; + bool xics_kvm =3D false; =20 if (kvm_enabled()) { if (machine_kernel_irqchip_allowed(machine) && !xics_kvm_init(spapr, &local_err)) { - spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, - &local_err); + xics_kvm =3D true; } - if (machine_kernel_irqchip_required(machine) && !spapr->ics) { + if (machine_kernel_irqchip_required(machine) && !xics_kvm) { error_prepend(&local_err, "kernel_irqchip requested but unavailable: "); goto error; @@ -114,12 +113,12 @@ static void spapr_irq_init_xics(sPAPRMachineState *sp= apr, int nr_irqs, local_err =3D NULL; } =20 - if (!spapr->ics) { + if (!xics_kvm) { xics_spapr_init(spapr); - spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs, - &local_err); } =20 + spapr->ics =3D spapr_ics_create(spapr, nr_irqs, &local_err); + error: error_propagate(errp, local_err); } From nobody Sat May 4 12:25:43 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; 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 1550231105825493.96813637123; Fri, 15 Feb 2019 03:45:05 -0800 (PST) Received: from localhost ([127.0.0.1]:37984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubvR-0007qj-O8 for importer@patchew.org; Fri, 15 Feb 2019 06:45:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gubrW-0004pW-CU for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:41:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gubrU-0006KN-Ad for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:58 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40602 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gubrT-0006AJ-LI for qemu-devel@nongnu.org; Fri, 15 Feb 2019 06:40:56 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FBXvT4080813 for ; Fri, 15 Feb 2019 06:40:47 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qnt8tf4a5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Feb 2019 06:40:47 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 11:40:45 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 11:40:43 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1FBegXD61931548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Feb 2019 11:40:42 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC83452054; Fri, 15 Feb 2019 11:40:42 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id A971C52051; Fri, 15 Feb 2019 11:40:42 +0000 (GMT) Received: from bahia.lan (sig-9-145-62-36.uk.ibm.com [9.145.62.36]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 35D5E220295; Fri, 15 Feb 2019 12:40:42 +0100 (CET) From: Greg Kurz To: David Gibson Date: Fri, 15 Feb 2019 12:40:41 +0100 In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> References: <155023078266.1011724.5995737218088270486.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19021511-0008-0000-0000-000002C0D898 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021511-0009-0000-0000-0000222CFEE9 Message-Id: <155023084177.1011724.14693955932559990358.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-15_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150083 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 10/10] xics: Drop the KVM ICS class 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The KVM ICS class isn't used anymore. Drop it. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/xics_kvm.c | 40 ---------------------------------------- hw/ppc/spapr_irq.c | 2 +- include/hw/ppc/xics.h | 3 --- 3 files changed, 1 insertion(+), 44 deletions(-) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index f34eacda03e7..a00d0a7962e1 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -279,39 +279,6 @@ void ics_kvm_set_irq(ICSState *ics, int srcno, int val) } } =20 -static void ics_kvm_realize(DeviceState *dev, Error **errp) -{ - ICSState *ics =3D ICS_KVM(dev); - ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(ics); - Error *local_err =3D NULL; - - icsc->parent_realize(dev, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } -} - -static void ics_kvm_class_init(ObjectClass *klass, void *data) -{ - ICSStateClass *icsc =3D ICS_BASE_CLASS(klass); - DeviceClass *dc =3D DEVICE_CLASS(klass); - - device_class_set_parent_realize(dc, ics_kvm_realize, - &icsc->parent_realize); -} - -static const TypeInfo ics_kvm_info =3D { - .name =3D TYPE_ICS_KVM, - .parent =3D TYPE_ICS_BASE, - .instance_size =3D sizeof(ICSState), - .class_init =3D ics_kvm_class_init, -}; - -/* - * XICS-KVM - */ - static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, @@ -381,10 +348,3 @@ fail: kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); return -1; } - -static void xics_kvm_register_types(void) -{ - type_register_static(&ics_kvm_info); -} - -type_init(xics_kvm_register_types) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 4aa8165307c7..4297eed600f9 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -208,7 +208,7 @@ static void spapr_irq_cpu_intc_create_xics(sPAPRMachine= State *spapr, =20 static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_= id) { - if (!object_dynamic_cast(OBJECT(spapr->ics), TYPE_ICS_KVM)) { + if (!kvm_irqchip_in_kernel()) { CPUState *cs; CPU_FOREACH(cs) { PowerPCCPU *cpu =3D POWERPC_CPU(cs); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 61bd0fb9784f..d36bbe11ee2e 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -95,9 +95,6 @@ struct PnvICPState { #define TYPE_ICS_SIMPLE "ics" #define ICS_SIMPLE(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS_SIMPLE) =20 -#define TYPE_ICS_KVM "icskvm" -#define ICS_KVM(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS_KVM) - #define ICS_BASE_CLASS(klass) \ OBJECT_CLASS_CHECK(ICSStateClass, (klass), TYPE_ICS_BASE) #define ICS_BASE_GET_CLASS(obj) \