From nobody Sat Dec 21 12:35:32 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 1550501548342977.0583009536206; Mon, 18 Feb 2019 06:52:28 -0800 (PST) Received: from localhost ([127.0.0.1]:59887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkHQ-0005wm-9w for importer@patchew.org; Mon, 18 Feb 2019 09:52:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxZ-0006Dl-Ur for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxQ-0002vd-Mh for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:48 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:52339) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxH-0002ie-4y; Mon, 18 Feb 2019 09:31:37 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rp5Yftz9sR0; Tue, 19 Feb 2019 01:31:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500266; bh=LbTy1eMIeOO/qernx6v/RfVXmRQyaJMc7uxBUd5JqcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQJYRUuIi8deOerXHd0/BGOLvO4GLb6fkheBi2Zay8u7R786G/PHR+OFbqPXvoOIC 0JXoOOEGrXmi2AxeAXJBJD1FU/nEf4cZvkNI0fCU9cZRoY9iJNMGdEXL//SLA4ivhJ hzHNBsgw9SUeYxuGUEi3/tmpDCQH9SBuXK71MM5I= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:25 +1100 Message-Id: <20190218143049.17142-20-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 19/43] 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: 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 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 Message-Id: <155023080049.1011724.15423463482790260696.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- 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 822d367e63..acd63ab5e0 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 80321e9b75..4eebced516 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 e33282a576..ab61dc2401 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 */ --=20 2.20.1