From nobody Fri Dec 19 15:46:14 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 1488208140273516.7902532447793; Mon, 27 Feb 2017 07:09:00 -0800 (PST) Received: from localhost ([::1]:53471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMv4-00005N-To for importer@patchew.org; Mon, 27 Feb 2017 10:08:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMKp-0001rB-JN for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMKl-0007xj-LO for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:31 -0500 Received: from 20.mo6.mail-out.ovh.net ([178.32.124.17]:39657) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMKl-0007xS-F1 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:27 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 6BEA39BE0A for ; Mon, 27 Feb 2017 15:31:26 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player761.ha.ovh.net (Postfix) with ESMTPSA id D9CA54800A6; Mon, 27 Feb 2017 15:30:48 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:22 +0100 Message-Id: <1488205773-30436-16-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4043388044165680102 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.124.17 Subject: [Qemu-devel] [PATCH v4 15/26] 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: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= 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" 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 --- 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 2d08c4071d3f..86ddf470e546 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.7.4