From nobody Mon Feb 9 20:11:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635792235; cv=none; d=zohomail.com; s=zohoarc; b=YWoUCv44jw0OpYp6j5GNpVSVL6MAFhs/9I0u7K88+Pe5sjT8uABDjM307h/MkcYCcE8+kkXE9upVUivh5htEthwoKN0R+OgGQDFZZVf4SGi8raYf0K5QQILS9SI8TFMTlMPh7eThOL45sdl+BpbeaQCHQ+7SK22fAmq2iHNbXoE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635792235; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=F/4BMq7DrQu+zCZQqgn6KN2GFLHZ2AhJb11IE3m6BvI=; b=ZJRyq1YPp+/jPjQobNoLtDb135clWUcE4a5EQOWJBZpUWpowekgAB4TrGh8Ib/ydmZoBdtTD4LyhNiZwtY4JYRSuLsN0Kry38z/ScdZ5PR+ne/n3M+BCD1iO0uGTfD3VxVA8JvF+RhqVXDBXv8pmRFTSjTOyAZ6aLpYdtGMqd40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635792235775142.14791456098123; Mon, 1 Nov 2021 11:43:55 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-551-a4oUN7fJNziteRAsUaKtgw-1; Mon, 01 Nov 2021 14:43:51 -0400 Received: by mail-wm1-f70.google.com with SMTP id v5-20020a1cac05000000b0032ccf04ba2cso59879wme.2 for ; Mon, 01 Nov 2021 11:43:51 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id o2sm15128956wrg.1.2021.11.01.11.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 11:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635792234; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F/4BMq7DrQu+zCZQqgn6KN2GFLHZ2AhJb11IE3m6BvI=; b=MAbjKPaiFzChqtY4w4FCm639G13kOs+Fc8XXGyiM6zpBULTAxvsMpLuWrLZyGfnB25fqAr yzLvLhc7TOeGIEkY5qAnPmqVRxrnSbgwN6bwPImCU19KLhnuBZkvcIAuTAv8bSOBuCwtxh YKFex3vddUU+FkYGu8dvl2ABTAwU3ww= X-MC-Unique: a4oUN7fJNziteRAsUaKtgw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F/4BMq7DrQu+zCZQqgn6KN2GFLHZ2AhJb11IE3m6BvI=; b=fke0VjvQdMQGLB6v0WAgqyEcrOROH0vgo0FLtnKmPqJRVBaoSnZQE0AvGlv+BqTslz 4kcFhSpfiKlKvY8pDW7kyyh5OmTrcX+Jd8SSR7A0tBreNfzuTluR9qOOkm0xcKoe0NlV wnOP7wIRPz0y6ExxFHnBwNUo/wl69x+d8E9AhZIbIUjqT9CxrYONzubvqnFTeFo0+0D9 FSMVuNzqgRsCXZW1Ax8wyYnwdIV6Id4JBQsDfB8bTzip4Hcua/mI6t53OZL9L43etzrH 5FkAzRJCY2mHgv4f12loTXaQ1OEoDYZynpVqgQ6UAriomtmu2ePZBQ2/t37RDD0rPwuj WsbQ== X-Gm-Message-State: AOAM5337bVFCe+lw2KyTgYcjO+UczTH6fk0ts8TjB1SeaPE31BUSmEMf oHuocu9ZvkTmYT6CRrDpUvXA+GudhReUMe71intedl7w3EaXAMwA9D0IXFskWJraCmGGgJrCi37 /Sh62nZRnHHyhtA== X-Received: by 2002:a5d:58c5:: with SMTP id o5mr23112949wrf.15.1635792230463; Mon, 01 Nov 2021 11:43:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjHqzi3yr+pZ4o8shqMaGSGS9W7EXt8i+7Ju1NmeqJx1eY6jDwQrELoqkN+WOkPtZnlFVHbA== X-Received: by 2002:a5d:58c5:: with SMTP id o5mr23112931wrf.15.1635792230275; Mon, 01 Nov 2021 11:43:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Marcel Apfelbaum , Damien Hedde , Alistair Francis Subject: [PULL 10/10] machine: remove the done notifier for dynamic sysbus device type check Date: Mon, 1 Nov 2021 19:42:59 +0100 Message-Id: <20211101184259.2859090-11-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101184259.2859090-1-philmd@redhat.com> References: <20211101184259.2859090-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635792237022100002 From: Damien Hedde Now that we check sysbus device types during device creation, we can remove the check in the machine init done notifier. This was the only thing done by this notifier, so we remove the whole sysbus_notifier structure of the MachineState. Note: This notifier was checking all /peripheral and /peripheral-anon sysbus devices. Now we only check those added by -device cli option or device_add qmp command when handling the command/option. So if there are some devices added in one of these containers manually (eg in machine C code), these will not be checked anymore. This use case does not seem to appear apart from hw/xen/xen-legacy-backend.c (it uses qdev_set_id() and in this case, not for a sysbus device, so it's ok). Signed-off-by: Damien Hedde Acked-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Eduardo Habkost Message-Id: <20211029142258.484907-4-damien.hedde@greensocs.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/boards.h | 1 - hw/core/machine.c | 27 --------------------------- 2 files changed, 28 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 602993bd5ab..9c1c1901046 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -317,7 +317,6 @@ typedef struct CpuTopology { struct MachineState { /*< private >*/ Object parent_obj; - Notifier sysbus_notifier; =20 /*< public >*/ =20 diff --git a/hw/core/machine.c b/hw/core/machine.c index 7c4004ac5a0..e24e3e27dbe 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -572,18 +572,6 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, c= onst char *type) return allowed; } =20 -static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque) -{ - MachineState *machine =3D opaque; - MachineClass *mc =3D MACHINE_GET_CLASS(machine); - - if (!device_is_dynamic_sysbus(mc, DEVICE(sbdev))) { - error_report("Option '-device %s' cannot be handled by this machin= e", - object_class_get_name(object_get_class(OBJECT(sbdev))= )); - exit(1); - } -} - static char *machine_get_memdev(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -599,17 +587,6 @@ static void machine_set_memdev(Object *obj, const char= *value, Error **errp) ms->ram_memdev_id =3D g_strdup(value); } =20 -static void machine_init_notify(Notifier *notifier, void *data) -{ - MachineState *machine =3D MACHINE(qdev_get_machine()); - - /* - * Loop through all dynamically created sysbus devices and check if th= ey are - * all allowed. If a device is not allowed, error out. - */ - foreach_dynamic_sysbus_device(validate_sysbus_device, machine); -} - HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) { int i; @@ -949,10 +926,6 @@ static void machine_initfn(Object *obj) "Table (HMAT)"); } =20 - /* Register notifier when init is done for sysbus sanity checks */ - ms->sysbus_notifier.notify =3D machine_init_notify; - qemu_add_machine_init_done_notifier(&ms->sysbus_notifier); - /* default to mc->default_cpus */ ms->smp.cpus =3D mc->default_cpus; ms->smp.max_cpus =3D mc->default_cpus; --=20 2.31.1