From nobody Thu Apr 25 05:27:11 2024 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 1487683135002362.9364066105461; Tue, 21 Feb 2017 05:18:55 -0800 (PST) Received: from localhost ([::1]:44522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgALE-00061b-84 for importer@patchew.org; Tue, 21 Feb 2017 08:18:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cg9ou-0000YZ-Pv for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:45:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cg9os-00031U-Po for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:45:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56412) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cg9oo-00030B-3D; Tue, 21 Feb 2017 07:45:22 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9239481F07; Tue, 21 Feb 2017 12:45:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LCjIJb018001; Tue, 21 Feb 2017 07:45:18 -0500 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 21 Feb 2017 13:45:08 +0100 Message-Id: <1487681108-14452-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 21 Feb 2017 12:45:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3] hw/arm/virt: Add a user option to disallow ITS instantiation 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: drjones@redhat.com, vijay.kilari@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In 2.9 ITS will block save/restore and migration use cases. As such, let's introduce a user option that allows to turn its instantiation off, along with GICv3. With the "its" option turned false, migration will be possible, obviously at the expense of MSI support (with GICv3). Signed-off-by: Eric Auger --- v2 -> v3: - replace no-its by its. Don't check both state and class field as suggested by Peter. v1 -> v2: - fix omitted comma in object_property_set_description With this patch the option also is added in virt 2.8. I don't know if it is acceptable. --- hw/arm/virt.c | 31 +++++++++++++++++++++++++++++-- include/hw/arm/virt.h | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f3440f2..ceb2b8e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -535,7 +535,6 @@ static void create_v2m(VirtMachineState *vms, qemu_irq = *pic) static void create_gic(VirtMachineState *vms, qemu_irq *pic) { /* We create a standalone GIC */ - VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); DeviceState *gicdev; SysBusDevice *gicbusdev; const char *gictype; @@ -605,7 +604,7 @@ static void create_gic(VirtMachineState *vms, qemu_irq = *pic) =20 fdt_add_gic_node(vms); =20 - if (type =3D=3D 3 && !vmc->no_its) { + if (type =3D=3D 3 && vms->its) { create_its(vms, gicdev); } else if (type =3D=3D 2) { create_v2m(vms, pic); @@ -1480,6 +1479,20 @@ static void virt_set_highmem(Object *obj, bool value= , Error **errp) vms->highmem =3D value; } =20 +static bool virt_get_its(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + return vms->its; +} + +static void virt_set_its(Object *obj, bool value, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + vms->its =3D value; +} + static char *virt_get_gic_version(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); @@ -1540,6 +1553,7 @@ type_init(machvirt_machine_init); static void virt_2_9_instance_init(Object *obj) { VirtMachineState *vms =3D VIRT_MACHINE(obj); + VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); =20 /* EL3 is disabled by default on virt: this makes us consistent * between KVM and TCG for this board, and it also allows us to @@ -1579,6 +1593,19 @@ static void virt_2_9_instance_init(Object *obj) "Set GIC version. " "Valid values are 2, 3 and host", NULL= ); =20 + if (vmc->no_its) { + vms->its =3D false; + } else { + /* Default allows ITS instantiation */ + vms->its =3D true; + object_property_add_bool(obj, "its", virt_get_its, + virt_set_its, NULL); + object_property_set_description(obj, "its", + "Set on/off to enable/disable " + "ITS instantiation", + NULL); + } + vms->memmap =3D a15memmap; vms->irqmap =3D a15irqmap; } diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 58ce74e..33b0ff3 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -93,6 +93,7 @@ typedef struct { FWCfgState *fw_cfg; bool secure; bool highmem; + bool its; bool virt; int32_t gic_version; struct arm_boot_info bootinfo; --=20 2.5.5