From nobody Thu Nov 6 19:09:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488344839269491.9551309445038; Tue, 28 Feb 2017 21:07:19 -0800 (PST) Received: from localhost ([::1]:38462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciwTt-00037T-Tu for importer@patchew.org; Wed, 01 Mar 2017 00:07:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciw7w-0008EZ-PC for qemu-devel@nongnu.org; Tue, 28 Feb 2017 23:44:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciw7s-0000EK-If for qemu-devel@nongnu.org; Tue, 28 Feb 2017 23:44:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:43293) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciw7s-0000BU-2h; Tue, 28 Feb 2017 23:44:32 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vY2sV1ndXz9sPL; Wed, 1 Mar 2017 15:44:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1488343454; bh=dx2GOBGRa4JAGtuVxWJ35QL9aPnupJz6ZEXWDWu7kH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRvb1RYBaa2EVSdpZ/3Q9fTV8chm8BOgKkBgWwNaQGhOJRyThSzHusWIlA8BWBlbA GBw+8hnTvHs8uzQnmtD8KzjCJz1THqcXMaI6NYevge/wOQLecELCeBqpsmODFyJvIZ rxTrlcqIN2Lc0WRqZb67xzsK06m77iTC75pbxMkg= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 1 Mar 2017 15:43:53 +1100 Message-Id: <20170301044405.1792-39-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170301044405.1792-1-david@gibson.dropbear.id.au> References: <20170301044405.1792-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 38/50] ppc/xics: move kernel_xics_fd out of KVMXICSState 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: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater The kernel ICP file descriptor is the only reason behind the KVMXICSState class and it's in the way of more cleanups. Let's make it a static for the moment and move forward. If this is problem, we could use an attribute under the sPAPR machine later on. Signed-off-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics_kvm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 2d08c40..86ddf47 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -40,6 +40,8 @@ =20 #include =20 +static int kernel_xics_fd =3D -1; + typedef struct KVMXICSState { XICSState parent_obj; =20 @@ -145,7 +147,6 @@ static const TypeInfo icp_kvm_info =3D { */ static void ics_get_kvm_state(ICSState *ics) { - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(ics->xics); uint64_t state; struct kvm_device_attr attr =3D { .flags =3D 0, @@ -160,7 +161,7 @@ static void ics_get_kvm_state(ICSState *ics) =20 attr.attr =3D i + ics->offset; =20 - ret =3D ioctl(xicskvm->kernel_xics_fd, KVM_GET_DEVICE_ATTR, &attr); + ret =3D ioctl(kernel_xics_fd, KVM_GET_DEVICE_ATTR, &attr); if (ret !=3D 0) { error_report("Unable to retrieve KVM interrupt controller stat= e" " for IRQ %d: %s", i + ics->offset, strerror(errno)); @@ -204,7 +205,6 @@ static void ics_get_kvm_state(ICSState *ics) =20 static int ics_set_kvm_state(ICSState *ics, int version_id) { - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(ics->xics); uint64_t state; struct kvm_device_attr attr =3D { .flags =3D 0, @@ -238,7 +238,7 @@ static int ics_set_kvm_state(ICSState *ics, int version= _id) } } =20 - ret =3D ioctl(xicskvm->kernel_xics_fd, KVM_SET_DEVICE_ATTR, &attr); + ret =3D ioctl(kernel_xics_fd, KVM_SET_DEVICE_ATTR, &attr); if (ret !=3D 0) { error_report("Unable to restore KVM interrupt controller state" " for IRQs %d: %s", i + ics->offset, strerror(errno)); @@ -328,14 +328,13 @@ static void xics_kvm_cpu_setup(XICSState *xics, Power= PCCPU *cpu) { CPUState *cs; ICPState *ss; - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(xics); int ret; =20 cs =3D CPU(cpu); ss =3D &xics->ss[cs->cpu_index]; =20 assert(cs->cpu_index < xics->nr_servers); - if (xicskvm->kernel_xics_fd =3D=3D -1) { + if (kernel_xics_fd =3D=3D -1) { abort(); } =20 @@ -348,7 +347,7 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerPC= CPU *cpu) return; } =20 - ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, xicskvm->kernel_x= ics_fd, + ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, kernel_xics_fd, kvm_arch_vcpu_id(cs)); if (ret < 0) { error_report("Unable to connect CPU%ld to kernel XICS: %s", @@ -369,7 +368,6 @@ static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineSta= te *spapr, =20 static void xics_kvm_realize(DeviceState *dev, Error **errp) { - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(dev); int rc; struct kvm_create_device xics_create_device =3D { .type =3D KVM_DEV_TYPE_XICS, @@ -418,7 +416,7 @@ static void xics_kvm_realize(DeviceState *dev, Error **= errp) goto fail; } =20 - xicskvm->kernel_xics_fd =3D xics_create_device.fd; + kernel_xics_fd =3D xics_create_device.fd; =20 kvm_kernel_irqchip =3D true; kvm_msi_via_irqfd_allowed =3D true; --=20 2.9.3