From nobody Sat Nov 15 13:20:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1595166277; cv=none; d=zohomail.com; s=zohoarc; b=HGueJb7W05oymZRQXU7txuWCaOFXuojGr4RgZEmoxcprmniwd5FUvidmH1i8/h8Kjd7u1/2bDENk4TmnzC8kcO09u4chxjGg4QsEDtI+neUCMCjHc58ct8bJd4bu7bVP9D1oRkLInqG2W6QAQTOICZ+9bllmPYHKsq/FPSmni/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595166277; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=LfW1+jmNf0jIYfs79jX6XnjBmyw2e7b92E+y4Bebo/A=; b=hdzQPdS5m/nlxJWMXw67Da6/hbxSfMQJtvyHiStqgnUZLSYHb8HEIZWeSiR2hoEV7Fx6/IxRUDJ0m0BeI9T9F8dVQ3t/uZzGmoYk+tz1zHDALu7HkhxLnPonEawFb8fWsnbIWVnEeeR7qEO0IZyc/CarsRZsBHgmuBOWMcKg/gU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595166277097345.0099677137363; Sun, 19 Jul 2020 06:44:37 -0700 (PDT) Received: from localhost ([::1]:60910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jx9cJ-00073t-3f for importer@patchew.org; Sun, 19 Jul 2020 09:44:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jx9bM-0006bJ-DU for qemu-devel@nongnu.org; Sun, 19 Jul 2020 09:43:36 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jx9bK-0007gp-Vk for qemu-devel@nongnu.org; Sun, 19 Jul 2020 09:43:36 -0400 Received: by mail-wr1-x441.google.com with SMTP id f7so15370322wrw.1 for ; Sun, 19 Jul 2020 06:43:34 -0700 (PDT) Received: from localhost.localdomain (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id w2sm25596104wrs.77.2020.07.19.06.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2020 06:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LfW1+jmNf0jIYfs79jX6XnjBmyw2e7b92E+y4Bebo/A=; b=j6JNAPn0d0q0mWltH+mjts6BGnbZkeJRg+Ep4TOWkWoRfLBFnmMeV6f6KschPRkW/V 1JfrwbFemoFNHlgkl2zrPcNt8tHw8ZDT/yWqBOd5gF0A/gpaUpglq/XZ7/Pgm0I92lBL VgkfrciwkktdJHpeFglw6udP1k/J19TwN00Qzi6yQrya65RX7Oeey8IlA7lH2scDUljG 04ssi4Kc/XKm2ZFAqKXAzEV4EeVJ9KFutc27wmctNZBiWJxvsrYC3PB5JaEmEA1KAA4d Ur8Hp60IKZ6z8WOXFSDk6gP8mGT9T+jtvhwAYZVycRlh0Bz9HiDJECXlJaz1j6duKFcm FSIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=LfW1+jmNf0jIYfs79jX6XnjBmyw2e7b92E+y4Bebo/A=; b=FjcptdV3n7qN7eLXQT79ogz9FxeZuRr9HUkFI2PcVmkogOcsH9lssJEYp7AnDtSJov JLkcevQbubPKmyjio+P8tMHSV6at4ui1nZtdFgVVJ6Is7cT5LuSW8a6GJ8Zn8fO3PIYO chXM1w3mzlAscsZrwxvPbk/F4gYvwJipTLnqV6XIhhBcxlszjgpgTcgrhjRbipAXFh88 HnPAx9BNGdB+YAB0vWuvRvjufjBaUstClFf9MYgiuOYKeCNn9QAhawyJVRkRxd916NtN qGa7ttI8VIscvBUtBG6lU+Yrg9SFZOXf5LkAKaBosbhjeER78VdxOMSugbMpkZIHf7Ve UASw== X-Gm-Message-State: AOAM533MUQ7hSq6Vy71PrXCEGUU/NaPZQU1URhrVHyfblyuQ1pVlz9US DctySAjRAWxvxDL/eEhZeVCZV+PBHW0= X-Google-Smtp-Source: ABdhPJyUK9y6Q+06QHhCsonGFYX/Swo2jIw4BsdAwXWdMkebSXgn+/0MMci7SGcZe1P5ly9rCtXEKQ== X-Received: by 2002:adf:e647:: with SMTP id b7mr19453675wrn.170.1595166212743; Sun, 19 Jul 2020 06:43:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1] qdev: Allow to create hotplug device before plugging it to a bus Date: Sun, 19 Jul 2020 15:43:29 +0200 Message-Id: <20200719134329.21613-1-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Markus Armbruster , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Commit 510ef98dca made qdev_realize() support bus-less devices, asserting either the device is bus-less or the device is created on a bus. Commit 464a22c757 used qdev_realize() instead of object_property_set_bool(). Since qdev_realize() now checks for a bus, it is not possible to create hotplug devices unattached to any bus anymore. Fix by only asserting if the device is not hotpluggable. Fixes: 464a22c757 "qdev: Use qdev_realize() in qdev_device_add()" Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/qdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 01796823b4..6c5540ecdc 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -393,7 +393,9 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Erro= r **errp) if (bus) { qdev_set_parent_bus(dev, bus); } else { - assert(!DEVICE_GET_CLASS(dev)->bus_type); + DeviceClass *dc =3D DEVICE_GET_CLASS(dev); + + assert(dc->hotpluggable || !dc->bus_type); } =20 return object_property_set_bool(OBJECT(dev), "realized", true, errp); --=20 2.21.3