From patchwork Sat Nov 25 15:16:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 841261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ykc9z1Hjnz9s7G for ; Sun, 26 Nov 2017 02:17:27 +1100 (AEDT) Received: from localhost ([::1]:53448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcCr-0005QZ-77 for incoming@patchwork.ozlabs.org; Sat, 25 Nov 2017 10:17:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcBz-0005P4-3z for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIcBw-00055Q-Fa for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38052) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIcBr-00054c-Kk; Sat, 25 Nov 2017 10:16:23 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48B1F37E72; Sat, 25 Nov 2017 15:16:22 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABFC75D9CB; Sat, 25 Nov 2017 15:16:18 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Sat, 25 Nov 2017 13:16:05 -0200 Message-Id: <20171125151610.20547-2-ehabkost@redhat.com> In-Reply-To: <20171125151610.20547-1-ehabkost@redhat.com> References: <20171125151610.20547-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 25 Nov 2017 15:16:22 +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 v2 1/6] machine: Replace has_dynamic_sysbus with list of allowed devices 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: jgross@suse.com, Peter Maydell , Thomas Huth , sstabellini@kernel.org, "Michael S. Tsirkin" , Alexander Graf , Anthony Perard , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Marcel Apfelbaum , xen-devel@lists.xenproject.org, Laszlo Ersek , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The existing has_dynamic_sysbus flag makes the machine accept every user-creatable sysbus device type on the command-line. Replace it with a list of allowed device types, so machines can easily accept some sysbus devices while rejecting others. To keep exactly the same behavior as before, the existing has_dynamic_sysbus=true assignments are replaced with a TYPE_SYS_BUS_DEVICE entry on the allowed list. Other patches will replace the TYPE_SYS_BUS_DEVICE entries with more specific lists of devices. Cc: Peter Maydell Cc: Marcel Apfelbaum Cc: "Michael S. Tsirkin" Cc: Alexander Graf Cc: David Gibson Cc: Stefano Stabellini Cc: Anthony Perard Cc: qemu-arm@nongnu.org Cc: qemu-ppc@nongnu.org Cc: xen-devel@lists.xenproject.org Signed-off-by: Eduardo Habkost Reviewed-by: Greg Kurz Reviewed-by: David Gibson Reviewed-by: Marcel Apfelbaum Reviewed-by: Marc-André Lureau --- Changes v1 -> v2: * Replace "dynamic sysbus whitelist" with "allowed sysbus devices" * Simply add TYPE_SYS_BUS_DEVICE to the list on existing has_dynamic_sysbus=true machines, and make machine-types more strict in separate patches --- include/hw/boards.h | 5 ++++- hw/arm/virt.c | 3 ++- hw/core/machine.c | 43 +++++++++++++++++++++++++++++-------------- hw/i386/pc_q35.c | 3 ++- hw/ppc/e500plat.c | 4 +++- hw/ppc/spapr.c | 3 ++- hw/xen/xen_backend.c | 7 ++++++- 7 files changed, 48 insertions(+), 20 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 156b16f7a6..041bc08971 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -76,6 +76,9 @@ void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, Error **errp); +void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); + + /** * CPUArchId: * @arch_id - architecture-dependent CPU ID of present or possible CPU @@ -179,7 +182,6 @@ struct MachineClass { no_floppy:1, no_cdrom:1, no_sdcard:1, - has_dynamic_sysbus:1, pci_allow_0_address:1, legacy_fw_cfg_order:1; int is_default; @@ -197,6 +199,7 @@ struct MachineClass { bool ignore_memory_transaction_failures; int numa_mem_align_shift; const char **valid_cpu_types; + strList *allowed_dynamic_sysbus_devices; bool auto_enable_numa_with_memhp; void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes, int nb_nodes, ram_addr_t size); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9e18b410d7..fa6dc15fcd 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1591,7 +1591,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) * configuration of the particular instance. */ mc->max_cpus = 255; - mc->has_dynamic_sysbus = true; + /*TODO: allow only sysbus devices that really work with this machine */ + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; mc->pci_allow_0_address = true; diff --git a/hw/core/machine.c b/hw/core/machine.c index 36c2fb069c..ab2ec292f3 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -335,29 +335,44 @@ static bool machine_get_enforce_config_section(Object *obj, Error **errp) return ms->enforce_config_section; } -static void error_on_sysbus_device(SysBusDevice *sbdev, void *opaque) +void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type) { - error_report("Option '-device %s' cannot be handled by this machine", - object_class_get_name(object_get_class(OBJECT(sbdev)))); - exit(1); + strList *item = g_new0(strList, 1); + + item->value = g_strdup(type); + item->next = mc->allowed_dynamic_sysbus_devices; + mc->allowed_dynamic_sysbus_devices = item; } -static void machine_init_notify(Notifier *notifier, void *data) +static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque) { - Object *machine = qdev_get_machine(); - ObjectClass *oc = object_get_class(machine); - MachineClass *mc = MACHINE_CLASS(oc); + MachineState *machine = opaque; + MachineClass *mc = MACHINE_GET_CLASS(machine); + bool allowed = false; + strList *wl; - if (mc->has_dynamic_sysbus) { - /* Our machine can handle dynamic sysbus devices, we're all good */ - return; + for (wl = mc->allowed_dynamic_sysbus_devices; + !allowed && wl; + wl = wl->next) { + allowed |= !!object_dynamic_cast(OBJECT(sbdev), wl->value); } + if (!allowed) { + error_report("Option '-device %s' cannot be handled by this machine", + object_class_get_name(object_get_class(OBJECT(sbdev)))); + exit(1); + } +} + +static void machine_init_notify(Notifier *notifier, void *data) +{ + MachineState *machine = MACHINE(qdev_get_machine()); + /* - * Loop through all dynamically created devices and check whether there - * are sysbus devices among them. If there are, error out. + * Loop through all dynamically created sysbus devices and check if they are + * all allowed. If a device is not allowed, error out. */ - foreach_dynamic_sysbus_device(error_on_sysbus_device, NULL); + foreach_dynamic_sysbus_device(validate_sysbus_device, machine); } HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index d6060043ac..d0b0e5b422 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -299,7 +299,8 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts = "firmware=bios-256k.bin"; m->default_display = "std"; m->no_floppy = 1; - m->has_dynamic_sysbus = true; + /*TODO: allow only sysbus devices that really work with this machine */ + machine_class_allow_dynamic_sysbus_dev(m, TYPE_SYS_BUS_DEVICE); m->max_cpus = 288; } diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index e59e80fb9e..438118c29b 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -15,6 +15,7 @@ #include "hw/boards.h" #include "sysemu/device_tree.h" #include "sysemu/kvm.h" +#include "hw/sysbus.h" #include "hw/pci/pci.h" #include "hw/ppc/openpic.h" #include "kvm_ppc.h" @@ -63,7 +64,8 @@ static void e500plat_machine_init(MachineClass *mc) mc->desc = "generic paravirt e500 platform"; mc->init = e500plat_init; mc->max_cpus = 32; - mc->has_dynamic_sysbus = true; + /*TODO: allow only sysbus devices that really work with this machine */ + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30"); } diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d682f013d4..82040cc5d1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3603,7 +3603,8 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) mc->default_boot_order = ""; mc->default_ram_size = 512 * M_BYTE; mc->kvm_type = spapr_kvm_type; - mc->has_dynamic_sysbus = true; + /*TODO: allow only sysbus devices that really work with this machine */ + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotplug_handler; hc->pre_plug = spapr_machine_device_pre_plug; diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 0f849a26d2..82380ea9ee 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -564,7 +564,12 @@ static void xen_set_dynamic_sysbus(void) ObjectClass *oc = object_get_class(machine); MachineClass *mc = MACHINE_CLASS(oc); - mc->has_dynamic_sysbus = true; + /* + * Emulate old mc->has_dynamic_sysbus=true assignment + * + *TODO: add only Xen devices to the list + */ + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); } int xen_be_register(const char *type, struct XenDevOps *ops) From patchwork Sat Nov 25 15:16:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 841263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ykcB83zPwz9s7G for ; Sun, 26 Nov 2017 02:17:36 +1100 (AEDT) Received: from localhost ([::1]:53450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcD0-0005ma-JK for incoming@patchwork.ozlabs.org; Sat, 25 Nov 2017 10:17:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcC2-0005QL-8s for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIcC1-00056U-AG for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44264) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIcBv-00055C-PM; Sat, 25 Nov 2017 10:16:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E56175F73C; Sat, 25 Nov 2017 15:16:26 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3CF460634; Sat, 25 Nov 2017 15:16:23 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Sat, 25 Nov 2017 13:16:06 -0200 Message-Id: <20171125151610.20547-3-ehabkost@redhat.com> In-Reply-To: <20171125151610.20547-1-ehabkost@redhat.com> References: <20171125151610.20547-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 25 Nov 2017 15:16:26 +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 v2 2/6] hw/arm/virt: Allow only supported dynamic sysbus devices 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: jgross@suse.com, Peter Maydell , Thomas Huth , sstabellini@kernel.org, qemu-arm@nongnu.org, Marcel Apfelbaum , Laszlo Ersek Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Replace the TYPE_SYS_BUS_DEVICE entry in the allowed sysbus device list with the two device types that are really supported by the virt machine: vfio-amd-xgbe and vfio-calxeda-xgmac. Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Eduardo Habkost --- Changes series v1 -> v2: * New patch added to series --- hw/arm/virt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index fa6dc15fcd..f267ef0ff5 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -34,6 +34,8 @@ #include "hw/arm/arm.h" #include "hw/arm/primecell.h" #include "hw/arm/virt.h" +#include "hw/vfio/vfio-calxeda-xgmac.h" +#include "hw/vfio/vfio-amd-xgbe.h" #include "hw/devices.h" #include "net/net.h" #include "sysemu/block-backend.h" @@ -1591,8 +1593,8 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) * configuration of the particular instance. */ mc->max_cpus = 255; - /*TODO: allow only sysbus devices that really work with this machine */ - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; mc->pci_allow_0_address = true; From patchwork Sat Nov 25 15:16:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 841262 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ykcB05QHmz9s7G for ; Sun, 26 Nov 2017 02:17:28 +1100 (AEDT) Received: from localhost ([::1]:53449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcCs-0005RM-OM for incoming@patchwork.ozlabs.org; Sat, 25 Nov 2017 10:17:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcC1-0005P9-4J for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIcC0-000564-6t for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIcC0-00055y-0e; Sat, 25 Nov 2017 10:16:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3219C85376; Sat, 25 Nov 2017 15:16:31 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id B49C1609A5; Sat, 25 Nov 2017 15:16:28 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Sat, 25 Nov 2017 13:16:07 -0200 Message-Id: <20171125151610.20547-4-ehabkost@redhat.com> In-Reply-To: <20171125151610.20547-1-ehabkost@redhat.com> References: <20171125151610.20547-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 25 Nov 2017 15:16:31 +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 v2 3/6] ppc: e500: Allow only supported dynamic sysbus devices 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: jgross@suse.com, Thomas Huth , sstabellini@kernel.org, Alexander Graf , qemu-ppc@nongnu.org, Marcel Apfelbaum , Laszlo Ersek , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" platform_bus_create_devtree() already rejects all dynamic sysbus devices except TYPE_ETSEC_COMMON, so register it as the only allowed dynamic sysbus device for the ppce500 machine-type. Cc: Alexander Graf Cc: David Gibson Cc: qemu-ppc@nongnu.org Signed-off-by: Eduardo Habkost Reviewed-by: Greg Kurz Acked-by: David Gibson --- Changes series v1 -> v2: * New patch added to series --- hw/ppc/e500plat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index 438118c29b..81d03e1038 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "e500.h" +#include "hw/net/fsl_etsec/etsec.h" #include "hw/boards.h" #include "sysemu/device_tree.h" #include "sysemu/kvm.h" @@ -64,8 +65,7 @@ static void e500plat_machine_init(MachineClass *mc) mc->desc = "generic paravirt e500 platform"; mc->init = e500plat_init; mc->max_cpus = 32; - /*TODO: allow only sysbus devices that really work with this machine */ - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON); mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30"); } From patchwork Sat Nov 25 15:16:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 841264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ykcF43Krkz9s7G for ; Sun, 26 Nov 2017 02:20:08 +1100 (AEDT) Received: from localhost ([::1]:53456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcFS-0008Cv-Ii for incoming@patchwork.ozlabs.org; Sat, 25 Nov 2017 10:20:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcC5-0005Sf-KY for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIcC4-00058F-Ck for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41774) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIcC4-00057x-6U; Sat, 25 Nov 2017 10:16:36 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A5B981DE9; Sat, 25 Nov 2017 15:16:35 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06B555D9CB; Sat, 25 Nov 2017 15:16:32 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Sat, 25 Nov 2017 13:16:08 -0200 Message-Id: <20171125151610.20547-5-ehabkost@redhat.com> In-Reply-To: <20171125151610.20547-1-ehabkost@redhat.com> References: <20171125151610.20547-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 25 Nov 2017 15:16:35 +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 v2 4/6] spapr: Allow only supported dynamic sysbus devices 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: jgross@suse.com, Thomas Huth , sstabellini@kernel.org, Alexander Graf , qemu-ppc@nongnu.org, Marcel Apfelbaum , Laszlo Ersek , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" TYPE_SPAPR_PCI_HOST_BRIDGE is the only dynamic sysbus device not rejected by ppc_spapr_reset(), so it can be the only entry on the allowed list. Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Eduardo Habkost Reviewed-by: Greg Kurz Acked-by: David Gibson --- Changes series v1 -> v2: * New patch added to series --- hw/ppc/spapr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 82040cc5d1..3c6d6f2cea 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3603,8 +3603,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) mc->default_boot_order = ""; mc->default_ram_size = 512 * M_BYTE; mc->kvm_type = spapr_kvm_type; - /*TODO: allow only sysbus devices that really work with this machine */ - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotplug_handler; hc->pre_plug = spapr_machine_device_pre_plug; From patchwork Sat Nov 25 15:16:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 841265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ykcFj10Xfz9s7G for ; Sun, 26 Nov 2017 02:20:41 +1100 (AEDT) Received: from localhost ([::1]:53466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcFz-0000Ii-8p for incoming@patchwork.ozlabs.org; Sat, 25 Nov 2017 10:20:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcC8-0005VN-RF for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIcC6-00058y-OS for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41664) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIcC6-00058r-IT for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:38 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2D8B883DC; Sat, 25 Nov 2017 15:16:37 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33BBC609A5; Sat, 25 Nov 2017 15:16:37 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Sat, 25 Nov 2017 13:16:09 -0200 Message-Id: <20171125151610.20547-6-ehabkost@redhat.com> In-Reply-To: <20171125151610.20547-1-ehabkost@redhat.com> References: <20171125151610.20547-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 25 Nov 2017 15:16:37 +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 v2 5/6] xen: Add only xen-sysdev to dynamic sysbus device list 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: jgross@suse.com, Thomas Huth , sstabellini@kernel.org, Anthony Perard , Marcel Apfelbaum , xen-devel@lists.xenproject.org, Laszlo Ersek Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There's no need to make the machine allow every possible sysbus device. We can now just add xen-sysdev to the allowed list. Cc: Stefano Stabellini Cc: Anthony Perard Cc: xen-devel@lists.xenproject.org Cc: Juergen Gross Signed-off-by: Eduardo Habkost Reviewed-by: Marc-André Lureau Acked-by: Anthony PERARD --- Changes series v1 -> v2: * New patch added to series --- hw/xen/xen_backend.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 82380ea9ee..7445b506ac 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -564,12 +564,7 @@ static void xen_set_dynamic_sysbus(void) ObjectClass *oc = object_get_class(machine); MachineClass *mc = MACHINE_CLASS(oc); - /* - * Emulate old mc->has_dynamic_sysbus=true assignment - * - *TODO: add only Xen devices to the list - */ - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_XENSYSDEV); } int xen_be_register(const char *type, struct XenDevOps *ops) From patchwork Sat Nov 25 15:16:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 841266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ykcHF3mWHz9s83 for ; Sun, 26 Nov 2017 02:22:01 +1100 (AEDT) Received: from localhost ([::1]:53474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcHH-0001An-KU for incoming@patchwork.ozlabs.org; Sat, 25 Nov 2017 10:21:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIcCD-0005jR-QF for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIcCC-0005A3-UA for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44388) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIcCC-00059q-NH for qemu-devel@nongnu.org; Sat, 25 Nov 2017 10:16:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0A535F73C; Sat, 25 Nov 2017 15:16:43 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C6D660CA1; Sat, 25 Nov 2017 15:16:39 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Sat, 25 Nov 2017 13:16:10 -0200 Message-Id: <20171125151610.20547-7-ehabkost@redhat.com> In-Reply-To: <20171125151610.20547-1-ehabkost@redhat.com> References: <20171125151610.20547-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 25 Nov 2017 15:16:43 +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 v2 6/6] q35: Allow only supported dynamic sysbus devices 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: jgross@suse.com, Thomas Huth , sstabellini@kernel.org, "Michael S. Tsirkin" , Marcel Apfelbaum , Marcel Apfelbaum , Laszlo Ersek Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The only user-creatable sysbus devices in qemu-system-x86_64 are amd-iommu, intel-iommu, and xen-backend. xen-backend is handled by xen_set_dynamic_sysbus(), so we only need to add amd-iommu and intel-iommu. Cc: "Michael S. Tsirkin" Cc: Marcel Apfelbaum Signed-off-by: Eduardo Habkost Reviewed-by: Marcel Apfelbaum --- Changes series v1 -> v2: * New patch added to series --- hw/i386/pc_q35.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index d0b0e5b422..db2bebb357 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -42,6 +42,8 @@ #include "exec/address-spaces.h" #include "hw/i386/pc.h" #include "hw/i386/ich9.h" +#include "hw/i386/amd_iommu.h" +#include "hw/i386/intel_iommu.h" #include "hw/smbios/smbios.h" #include "hw/ide/pci.h" #include "hw/ide/ahci.h" @@ -299,8 +301,8 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts = "firmware=bios-256k.bin"; m->default_display = "std"; m->no_floppy = 1; - /*TODO: allow only sysbus devices that really work with this machine */ - machine_class_allow_dynamic_sysbus_dev(m, TYPE_SYS_BUS_DEVICE); + machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); + machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); m->max_cpus = 288; }