From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443233; cv=none; d=zohomail.com; s=zohoarc; b=nRy5fP4bCxlncsbMmTOa3U2iilVcIwlLcLGuvzV3D02acJvf/S7L8hJgtNomSBNmiVc7lKCrIZUnN8/JcecZL3WQHgZWUTNLG1LT+qCuNdE2PawpR2zz9w6KnYT1BmHMV753s+mooQIx5LhmzRmW46sUbFC5JpTEA3IvVyg3vvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443233; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/Q9jLlzxL8Ky1CJr0jutwQaeChtyLfFwACEyWiRFh40=; b=h3fYJ4Ml5RgeOTqHLwoWkawU1Bb3RzcsPae/yPovRKWIAdGI/lJjFimROFREK+S76sZLIIDj7acLEIJZvvGUR94iGvcUWwv0GfSO1tfXtBcI5rK2lYqWasT/ywa6UsKWWzpwzsZXXPJ3E9IFfgx3w4U5DJQb3thNMtnrrmwTCQI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443233987780.3999672645706; Thu, 9 Jan 2025 09:20:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCQ-0002Ep-A3; Thu, 09 Jan 2025 12:20:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCN-0002EO-Hf for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:19:59 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCL-0000ab-Mg for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:19:59 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-43623f0c574so9707295e9.2 for ; Thu, 09 Jan 2025 09:19:57 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9e37d74sm26954385e9.29.2025.01.09.09.19.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:19:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443195; x=1737047995; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/Q9jLlzxL8Ky1CJr0jutwQaeChtyLfFwACEyWiRFh40=; b=irH9t4Co6pOxpFCOCF/IhakaPR1LEoAdPcdxmwaq/K/ucONvE2PLblkDO0Qj0cVN6q vkaVw5y/GLJWx34Tnl0gq1Syk8WSoyu3drxFxWsxpodAfddt5WbBNSZ+ng+yoZVpNOiI 7eRNOKMzjUa6CSbjPMOy+O2yHKauOIUlqrorzlSXjk0jrVG+6XUtnSXtULqKa6Qergew IbUEEjnBSI+/sEmv8KdnbQaGhRdrlnBMlpJmdRKJLm7+QRi3R02ccR0+C8zNHgbU00ht dSM3RlvQiFJnE6XzUVBAXTF6hPEVHzYE1vodYJreKvgGovN7NfiuNTZIGISHhXqTS1ZZ n4iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443195; x=1737047995; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Q9jLlzxL8Ky1CJr0jutwQaeChtyLfFwACEyWiRFh40=; b=qUI5EYpV5Ltc51rgMIJEeXd1M7aMP5nJFLZFowYB4FZVcF54jgk1zNMjqLWIKHYUfy 7JNOJVABKIU+1v/euCa9gXtZwKU9+MOQwZEsCpqJjGMrUFTyGmF1wwfUR/I49+qmwRLz mnkbBS5ttin+UGXmVr2m/Zp2idLoe2I4jScsIlLuClJ0FEMAt16XYsJ6yNQhTCET/i9H dFB3sJr86af2cDugyIpoAt1ldABC/ohVeGrfA8gv4uB+naijWzT6iyr7hEJGoG4PiJsA ZwTo96zTto578E06zT32K7AYjZ9vid6ghOaZ2jODwrxC/t6TLOisLPcdEknoj0JR9k1k +AyQ== X-Gm-Message-State: AOJu0YxBpgmeyDBPgFrEbnlo75I7WCOwwAaQe4oIiYDQvUpSWEF0G/rk 5ipEWtUwTDJAgcs6LGmZ+e9ZA8lm9GbNUPk0WJoYrea0az1OzzxJ0p33NjMYVYZT4b7ovBf94kK /hbU= X-Gm-Gg: ASbGncsdwsJIvfAkcJpANnHVy93SghIGY8JOewIvTuDnSrjIqgxZwQmnRgBYtkyUOW/ Xmp/S1sLUqfyXesruyRocfBaX2nBiIApyu6Lhw6morGFiOrDHz85+9Bzow05g56I5NezcF+9HVE KLXADgZCvk1TTnSxfq6PmGr3rHPsOePlBHkKdhs+QYt09QeAfIjtZZ/WGfMknINS1rpK4ZILers jw+OPxrfXPQ76uvPxKAFK6JdydoSOB8Htm+KUs3GIggjIrHcuF8tQWBeBk2LW8vwFtSbYWLlkzw GzaewqrnSYlZgyiG8A6N+Z8Gqx0qBZD8ci2R X-Google-Smtp-Source: AGHT+IFIhoeE0zWkqWg5VfuT8yphcMYFOvW9uduyHsvWaejxfY1gFpAWaTMQTsVTUzkR21X8pUkzEA== X-Received: by 2002:a05:600c:3505:b0:434:a7b6:10e9 with SMTP id 5b1f17b1804b1-436e26a9045mr74163005e9.17.1736443195346; Thu, 09 Jan 2025 09:19:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/11] hw/pci: Use -1 as the default value for rombar Date: Thu, 9 Jan 2025 18:19:38 +0100 Message-ID: <20250109171948.31092-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443234434116600 From: Akihiko Odaki vfio_pci_size_rom() distinguishes whether rombar is explicitly set to 1 by checking dev->opts, bypassing the QOM property infrastructure. Use -1 as the default value for rombar to tell if the user explicitly set it to 1. The property is also converted from unsigned to signed. -1 is signed so it is safe to give it a new meaning. The values in [2 ^ 31, 2 ^ 32) become invalid, but nobody should have typed these values by chance. Suggested-by: Markus Armbruster Signed-off-by: Akihiko Odaki Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20250104-reuse-v18-13-c349eafd8673@daynix.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c | 2 +- hw/vfio/pci.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index 8eaf0d58bb3..16ea7f4c19b 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -148,7 +148,7 @@ struct PCIDevice { uint32_t romsize; bool has_rom; MemoryRegion rom; - uint32_t rom_bar; + int32_t rom_bar; =20 /* INTx routing notifier */ PCIINTxRoutingNotifier intx_routing_notifier; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index b6c630c3236..78907527f2e 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -85,7 +85,7 @@ static const Property pci_props[] =3D { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, UINT32_MAX), - DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), + DEFINE_PROP_INT32("rombar", PCIDevice, rom_bar, -1), DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present, diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 17080b9dc0b..ab17a98ee5b 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1012,7 +1012,6 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev) { uint32_t orig, size =3D cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK); off_t offset =3D vdev->config_offset + PCI_ROM_ADDRESS; - DeviceState *dev =3D DEVICE(vdev); char *name; int fd =3D vdev->vbasedev.fd; =20 @@ -1046,12 +1045,12 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev) } =20 if (vfio_opt_rom_in_denylist(vdev)) { - if (dev->opts && qdict_haskey(dev->opts, "rombar")) { + if (vdev->pdev.rom_bar > 0) { warn_report("Device at %s is known to cause system instability" " issues during option rom execution", vdev->vbasedev.name); error_printf("Proceeding anyway since user specified" - " non zero value for rombar\n"); + " positive value for rombar\n"); } else { warn_report("Rom loading for device at %s has been disabled" " due to system instability issues", --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443223; cv=none; d=zohomail.com; s=zohoarc; b=LduM4U9gIJp+OR7r/rs26fxCKTiUJq4HGEA1622b56yzqrI12W3TYgqH3j3GGb+X1sSwOfh+R31RrdR6gYrJ5mJ/SSQ+OSNowlNJNrm8Wl+6UPfMhfhjSrWRJbdbe2X9oeM/SE8ioU5sn3j8ocwjUicMkaCZZ7p9xHTrooJ+S/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443223; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vk41Fdbmt4kvm6C2wIMyLOfMKTEmUCUG4l8SIJbTN28=; b=bzxmj5EJ9L3/AxZBC02KaHO1zA4tvZ/u49zkqXW5fHgjF2pF+MQ4aXf0KlZhC0m6uDDZ00l+55e1X1QABMx5c9jnTJWGXoJKIfgK8wu9O3E4MFG1b5+TYlZ3vm002nY5y7tpZMXVzDb5mYhzL27gkLXJXtKwIAdZGEWR+RQmArg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443223463887.3504463816217; Thu, 9 Jan 2025 09:20:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCU-0002Ib-VK; Thu, 09 Jan 2025 12:20:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCT-0002HS-FQ for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:05 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCR-0000bk-Dn for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:04 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-38a8b35e168so791731f8f.1 for ; Thu, 09 Jan 2025 09:20:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b81a4sm2372032f8f.68.2025.01.09.09.19.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:19:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443201; x=1737048001; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vk41Fdbmt4kvm6C2wIMyLOfMKTEmUCUG4l8SIJbTN28=; b=GF4TXF0yhS0GCLBjE+DDN3JgAAALPqQF+hdmuDOlNNbSw1wlT+q7LGoBuYTeTS0Yr7 OPVyMO8KM4yVm9BdyOLTlBzEZun8Dxu84DeQTh8Dn2KRIGBICpBKf7VpImkl1Tks/ka/ t2MKz5avUvrXrhjCEIRIfg188uT8Yr72JLw+52s0sHjq/K7DwiWA3tQzbNYoeSawp/bb nhiX+vOqK1+XA1PWnbvuJb7hcoxRcrwPuWsCgBa2epStZsQlvmRwUrPyLB3xSLe5GAjj 5Ahp5nj3Hnf++b7jLO/Lfr7GkpyD/94+06qCtVfzva4TApMRzJ6qqmzIVaz5/9HgQL96 McEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443201; x=1737048001; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vk41Fdbmt4kvm6C2wIMyLOfMKTEmUCUG4l8SIJbTN28=; b=qL7ObRLV+ayDnjXrD9JojDJC/ZKNeLBrxPbCBWU5mNaQc2yGaduxGQcYwaWiTAtmZx wmBAtmgEPucapHrUb0pu5rUaGbSIm/R8wJrh/M668XgNlc0dgB9GONbcesmiJaPI2vLQ l9Mr5cL/JW8U/HaxcrpKO8NXcQhy099vn1mbFthbemfNSc4mI7XHvD5zeSay4w4liHIO NQjj6L31Yy6xXw1vvqQ3JyG769jLDIWePmsXREWIgx3hMF+pvcnNrOJkqwtKFimZpFNe eMn6VzD6V4TfRG/AHmJ5054r3Vq/+6JEl9jghz76H0IfxPyOx3kBzhFTfdlfpOLkq1z3 m8SA== X-Gm-Message-State: AOJu0YxvpCoA4BOkTKMorPpH8m5BonaqX4lEMqHaJjVMRLddFlncO8l2 PvzB8rLxYUO+P3Ff2GMnkS+8omAaXUSmQwtfFeWe96EWKWd/lzFeAKNIl7nQCph5iMXvNtEgk96 HgsM= X-Gm-Gg: ASbGncv7cyDFW6/KK1mUVIYEJTxi40pMyDCIvSd81IhsnplIoIiY0aJKUsiehI85obM yumZDIydXix3c7hoNaM6j3+cg4JuxVoAACyyWO0Nq+2UdLN3qVeBA4mtl2m39Wi7TFveRH+0JPr K0eiwGZlBdj7xQ0bfypX+uQFDZzzFuwTLAtBqcGXDfV42JkIoxhy+J/gJtcNbuhl6efmiGf5CKz VjT/C5C9ROx+oH00UpxmxkWpoDtzkdfumSZMseCoq+JrcG1WJ0sG0VPVG4406QkN2JkCiZjyy1h KH4yyZU4ZJu8TJJ57297DJy+K/Fq8RSAYc+S X-Google-Smtp-Source: AGHT+IHAuzPivzlPebHg8AsqBSkDnohRC0UqTfTP5nzc3x3Lt8jf/Xmqp8L3y/oJw8hvTdNivN0syA== X-Received: by 2002:a05:6000:2a9:b0:38a:88bc:aea6 with SMTP id ffacd0b85a97d-38a8b0b816dmr3668256f8f.6.1736443200760; Thu, 09 Jan 2025 09:20:00 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster Subject: [PULL 02/11] qdev: Remove opts member Date: Thu, 9 Jan 2025 18:19:39 +0100 Message-ID: <20250109171948.31092-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443224688116600 From: Akihiko Odaki It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster Message-ID: <20250104-reuse-v18-14-c349eafd8673@daynix.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/qdev-core.h | 4 ---- hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e6ef80b7fd0..c4d3dc39064 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -248,10 +248,6 @@ struct DeviceState { * @pending_deleted_expires_ms: optional timeout for deletion events */ int64_t pending_deleted_expires_ms; - /** - * @opts: QDict of options for the device - */ - QDict *opts; /** * @hotplugged: was device added after PHASE_MACHINE_READY? */ diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 57c1d9df3a7..09c4489e3c4 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -691,7 +691,6 @@ static void device_finalize(Object *obj) dev->canonical_path =3D NULL; } =20 - qobject_unref(dev->opts); g_free(dev->id); } =20 diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index c844f538025..6a38b567876 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -631,6 +631,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *op= ts, char *id; DeviceState *dev =3D NULL; BusState *bus =3D NULL; + QDict *properties; =20 driver =3D qdict_get_try_str(opts, "driver"); if (!driver) { @@ -712,13 +713,14 @@ DeviceState *qdev_device_add_from_qdict(const QDict *= opts, } =20 /* set properties */ - dev->opts =3D qdict_clone_shallow(opts); - qdict_del(dev->opts, "driver"); - qdict_del(dev->opts, "bus"); - qdict_del(dev->opts, "id"); + properties =3D qdict_clone_shallow(opts); + qdict_del(properties, "driver"); + qdict_del(properties, "bus"); + qdict_del(properties, "id"); =20 - object_set_properties_from_keyval(&dev->parent_obj, dev->opts, from_js= on, + object_set_properties_from_keyval(&dev->parent_obj, properties, from_j= son, errp); + qobject_unref(properties); if (*errp) { goto err_del_dev; } --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443229; cv=none; d=zohomail.com; s=zohoarc; b=ZqH8LuRHNDwNbNCpP7GXcBUmIjrrD1huMEIRqhcTMVJ7WtXQrE/8vNr3tZB5sB9hwg4i3qh3awRH1fXhlLDxcWSXJiXkFof+JDFNaEn2NNxIEpBXS/KbxX00ZATaOLmwyDMwU9nY+z8a4O1sd/dKCuWAKzIITDudLGmOCmrdfko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443229; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=USByRXNnIcm1zr75pvlA/VQ1iSROrZwNJ1I9XsVsaz8=; b=oIDVVvRguOPUXV2Y2OQ1nbrZGdDrQH6g5A5hlIhLeGrYxEmcCO7YNvSVV+Fk3XG1z038p2SgIftmjFr25K6mMBz7Jn7Lx5Zke9sGjvUDDOmR3oMRvGhDEAkygbSyvUOZeEjBPPfgEaN/bcqZxAe5vLj4OgZB236oe03QtVZ0Vpk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443229067606.8927242476193; Thu, 9 Jan 2025 09:20:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCb-0002MQ-Dr; Thu, 09 Jan 2025 12:20:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCZ-0002LF-5p for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:11 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCW-0000e6-Oj for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:10 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-38a8b17d7a7so656598f8f.2 for ; Thu, 09 Jan 2025 09:20:08 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a9407fd62sm509369f8f.92.2025.01.09.09.20.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443206; x=1737048006; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=USByRXNnIcm1zr75pvlA/VQ1iSROrZwNJ1I9XsVsaz8=; b=BdJlwGWFoODLVfIRsUpCEsdwJG8DWP5ZCcVQhEconPBJEB5FTWJ2V0nSo7n9CU49u/ jrAj4EWDmoF4HgJlCCjVDOn5DKLFc6cWlJjOoi1GlgdQTrUzn65lPmA+IHefmBpLsRrq cy30zDmqPsj+mGDwf3v0JsecigpO45W+a4x92E92kS+qQxjtNwaGuczlWd7MrDZz9amP /n7hO0U7+VeadGM7LC7tH7lMYFuEihtUabdhsTDhP6uBjXX94yLJOKn1HcpOzWFrsVDh YqW69WuYw4hqHo8MTOVXwKHKX7vu8Rr0URZrfbPegnIrckU+iD7Ngk/zjAEpYYiZDuW8 V3Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443206; x=1737048006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=USByRXNnIcm1zr75pvlA/VQ1iSROrZwNJ1I9XsVsaz8=; b=xCcadH1boEaV0DMa9De6zppKpuSvw04N5x2JLgWT19JYVKmPqW/FKKnkV8dAgJKQbh duKn8bFp9b+nQ6nDqcIsJ7c6ldgjnug5c9iw3+8L9iXEuxUHCU2ppOdF7jXhJQYDM/dW dkPexwomH+/09V1JqStmQH31KoOa9t0R7NhR+8m5p0q278M+GMjP8k8xjmq7Ob2PkC28 pkQPQ+k7aamj20boo8xTeCt5wLsBz/0OgTL8ik8cogP2kCi3p6kYnLGOVi7gZ4PhLdmD /4mcwGQPJIr8aeYh2UJ8oCZ6ctWUrmjYCUfctrvFM+ZswucyaY9kty07S11o47weJT89 /B1Q== X-Gm-Message-State: AOJu0YwkXWHiCCWsRY/F5nIiaexgs5K3XTagmGKeiaK+/ht7Xxcex03d TB5mF3Id1N/Z6AFI6ahLkTLpzX2c1p+1JksXMwM7QCA+WSs8Fqu4zSEd8IOVfMGGlbeZv/Gd/nU V9pI= X-Gm-Gg: ASbGncvAzZ+vQFqJf563wKbTWl6g0cSv6va30gJ93p+OGfPpNcXVzpir7/P96980aOm Zl+y2sU08v7jHliHZ4SdsvOSxr/M3DSmDkgxURquH2Sl2uBy7We+smo2FQePSA+rnPB6Yu6Vqtb 8Zu5lU4UAmFy/FSBGd0e8Vlr69QXkGsqXLmLE5TAonbC6Vo3hxWSPFUva/DzRuIcZujrmV0s9hn b36yYu6sJKqG9gZiS1CIjJK1LrAszVmsjYBy5Qt56gC/1pwEsYwHrqhNWukMlEVPrnKTqA8kOQY TncOcWEg+C5Cjwjy8Qy0NzWpVjKR5C9+cnNa X-Google-Smtp-Source: AGHT+IF+v9r7ePdpxEeqC3PjtWfvZ/u00EgEEc1Xd8cESZ71xEWTIk8RRfI4BJeteX4idN2TmMn8yQ== X-Received: by 2002:adf:c08d:0:b0:38a:87cc:fb2c with SMTP id ffacd0b85a97d-38a87ccfc17mr4578783f8f.18.1736443205706; Thu, 09 Jan 2025 09:20:05 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , Richard Henderson Subject: [PULL 03/11] qdev: Implement qdev_create_fake_machine() for user emulation Date: Thu, 9 Jan 2025 18:19:40 +0100 Message-ID: <20250109171948.31092-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443230646116600 When a QDev instance is realized, qdev_get_machine() ends up called. In the next commit, qdev_get_machine() will require a "machine" container to be always present. To satisfy this QOM containers design, Implement qdev_create_fake_machine() which creates a fake "machine" container for user emulation. On system emulation, qemu_create_machine() is called from qemu_init(). For user emulation, since the TCG accelerator always calls tcg_init_machine(), we use it to hook our fake machine creation. Suggested-by: Peter Xu Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Peter Xu Reviewed-by: Richard Henderson Message-Id: <20250102211800.79235-2-philmd@linaro.org> --- include/hw/qdev-core.h | 10 ++++++++++ accel/tcg/tcg-all.c | 8 +++++++- hw/core/qdev-user.c | 19 +++++++++++++++++++ hw/core/meson.build | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 hw/core/qdev-user.c diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index c4d3dc39064..50cbbf81211 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -1023,6 +1023,16 @@ const char *qdev_fw_name(DeviceState *dev); void qdev_assert_realized_properly(void); Object *qdev_get_machine(void); =20 +/** + * qdev_create_fake_machine(): Create a fake machine container. + * + * .. note:: + * This function is a kludge for user emulation (USER_ONLY) + * because when thread (TYPE_CPU) are realized, qdev_realize() + * access a machine container. + */ +void qdev_create_fake_machine(void); + /** * qdev_get_human_name() - Return a human-readable name for a device * @dev: The device. Must be a valid and non-NULL pointer. diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c2565758876..95adaacee82 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -35,7 +35,9 @@ #include "qemu/atomic.h" #include "qapi/qapi-builtin-visit.h" #include "qemu/units.h" -#if !defined(CONFIG_USER_ONLY) +#if defined(CONFIG_USER_ONLY) +#include "hw/qdev-core.h" +#else #include "hw/boards.h" #endif #include "internal-common.h" @@ -124,6 +126,10 @@ static int tcg_init_machine(MachineState *ms) tcg_prologue_init(); #endif =20 +#ifdef CONFIG_USER_ONLY + qdev_create_fake_machine(); +#endif + return 0; } =20 diff --git a/hw/core/qdev-user.c b/hw/core/qdev-user.c new file mode 100644 index 00000000000..3d421d8f4e5 --- /dev/null +++ b/hw/core/qdev-user.c @@ -0,0 +1,19 @@ +/* + * QDev helpers specific to user emulation. + * + * Copyright 2025 Linaro, Ltd. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "qemu/osdep.h" +#include "qom/object.h" +#include "hw/qdev-core.h" + +void qdev_create_fake_machine(void) +{ + Object *fake_machine_obj; + + fake_machine_obj =3D object_property_add_new_container(object_get_root= (), + "machine"); + object_property_add_new_container(fake_machine_obj, "unattached"); +} diff --git a/hw/core/meson.build b/hw/core/meson.build index ce9dfa3f4bf..65a1698ed1f 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -46,3 +46,4 @@ system_ss.add(files( 'vm-change-state-handler.c', 'clock-vmstate.c', )) +user_ss.add(files('qdev-user.c')) --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443273; cv=none; d=zohomail.com; s=zohoarc; b=DEBnF/VcGlVtJ46EjJ/FYl1EakY10WfQAd5krUFChoOhE17676JhaguFPbdtH6ead9HYavazHlADwjictR8KE0d6qM9W66QphliEEPJp3p9Rgbkyv0m32R5bdBGMXa+c6pr6uPV1wgaqhdCWndsYm9Ji+p+9FGm3Ch5wf2gwSwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443273; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qz3bj6rw803M1uR6VsFauScvvIZVsKyPf1NJH8U1zkU=; b=EffLSwXXf38aUaEslTJ7GlplnAyGoBks1Ya1GpyWa+VmbGyMbAhn/GEpxgo6RVNzeu3HIIPFk8sBJt1ejQg7ipquM3ACtdqCkQ95niiGXagmlBmu3XT3t4xh2NfdxDYOLjtGW9XliyuJhx0o7hAM69N9yWObmcfvbQcdAinRkWI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443272914746.3757595469605; Thu, 9 Jan 2025 09:21:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCf-0002Oo-5w; Thu, 09 Jan 2025 12:20:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCd-0002Mh-SR for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:16 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCb-0000ef-Mo for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:15 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso12581535e9.0 for ; Thu, 09 Jan 2025 09:20:13 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37e375sm2295146f8f.22.2025.01.09.09.20.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443211; x=1737048011; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qz3bj6rw803M1uR6VsFauScvvIZVsKyPf1NJH8U1zkU=; b=sXVDktixxqNr4foVZKXSnJCiBqZ4xHs81ZNJvYCqr3QcWEJG/BZwHJxT48h/yDUaF1 5gAtyy7PYx0xw2GnjG4S4QEOInAJxAuB+lUEcG8Xi2hpqHu0+i2fqh6wUqsN8qEzlRoR 3WdLnA8mXYP1H6F65OiwTT6PvtUOQIgwFzNWS7vjmJ0Kk3aakH6i2ijvJFeK+GyNI3vg SkFJteVbQ3HFM6oiUmrhGfHH2KqY/1gGYdPz8UuJCDoJZc6WRmrhDXy4Mq+dj3ugikgd kI2/Ddq9R+BDy+WmNTCbu/ibqNIoHIs5RdwsVcwM/oqMlTdKmwUNXLA6qYf4v0pAl5CG qm1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443211; x=1737048011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qz3bj6rw803M1uR6VsFauScvvIZVsKyPf1NJH8U1zkU=; b=ON/3qop5xPEuytB4UOsYLiApTL9e+CtvDxamokYbnqvM7bDMaFhXfC0PPnqSyIOLFw OQS1mnbmFLuwtja7s6dL0Nf7sEZFS5VjfIV5m1u5vptaa9ahWC9WtBCnp7rQyGU8Qu0y 3HqQf77HBKAeMen2TlRng3iX5IxodQU0CzrZzdffr/zAnpizSypibBpYLBtRPDhnTg/G v/w0nkkjWRf0lQ0K1MJu1ZdQPkIKB3Xfh6rhulKkicsnUgxKS+1Rveym17Lby+FPMIz8 ZeWUBPj17SdsprYUf4nAD64pdK5EqmRQR4bIkiJUc4OJjHPlddKHAQWpM2n/Rsnh1R5J TxYw== X-Gm-Message-State: AOJu0Yw9EWE+yPPgz6Mfcvlo1ZE8gMBMJCza68aKNSKTGPOgiB7nhIF/ h7qYgixnyiykrmCYZawHGiyWAS4edq3lpooBAjCoRzFEjY/Julu9HimER9v0WA6VHv38zvWCwGA RHAA= X-Gm-Gg: ASbGnctjHQfVNnnOu5KyqAWbwsBOCXLJJmjBSLbI4BwG2TXbk0s7pD+uLmFvXjHNePU KLo7TGFuvTe07g+cUldMFQr8jJjYaRXqrGMJ4vPnxW1+TyEmjM18EtyYlZwLdKNVd1PQKL14B9I bxplmpdc0J3YGLLtD6+bnrb0na8dP9oyEvT+qJMdxIErHQGojlFiaZqYOZJd14AGqqOgZmY8LfS j9qXyIAWKDCemiRPzNY/KdzeFSKagGkzRgvoCSkAxNhrioauaB/a2dR0u6P+Gbt/rMpdRsnCUGk A8ddS7Z57+t0w2ZeBr/FMiUiMtZny8daRAQI X-Google-Smtp-Source: AGHT+IEXJMYOV1taRVFlCVKzS97GhTEvb0dXWNf7+KUvG8AX4EJQtCcmLDtCNJ1S0re1fipnieSg9w== X-Received: by 2002:a05:600c:3b02:b0:435:1a2:2633 with SMTP id 5b1f17b1804b1-436e26cf8a5mr32814435e9.15.1736443210960; Thu, 09 Jan 2025 09:20:10 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 04/11] qdev: Make qdev_get_machine() not use container_get() Date: Thu, 9 Jan 2025 18:19:41 +0100 Message-ID: <20250109171948.31092-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443274656116600 From: Peter Xu Currently, qdev_get_machine() has a slight misuse on container_get(), as the helper says "get a container" but in reality the goal is to get the machine object. It is still a "container" but not strictly. Note that it _may_ get a container (at "/machine") in our current unit test of test-qdev-global-props.c before all these changes, but it's probably unexpected and worked by accident. Switch to an explicit object_resolve_path_component(), with a side benefit that qdev_get_machine() can happen a lot, and we don't need to split the string ("/machine") every time. This also paves way for making the helper container_get() never try to return a non-container at all. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241121192202.4155849-9-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/core/qdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 09c4489e3c4..48bc9a7b9c7 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -817,7 +817,12 @@ Object *qdev_get_machine(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(object_get_root(), "/machine"); + dev =3D object_resolve_path_component(object_get_root(), "machine"= ); + /* + * Any call to this function before machine is created is treated + * as a programming error as of now. + */ + assert(dev); } =20 return dev; --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443241; cv=none; d=zohomail.com; s=zohoarc; b=JmP4gf8NLA/4eMKKPg8keq3ftDDgVBn+qSFWPVLlUOg4nqxd9Wes8lWfVpbkloaGB09/KGQ4516Fujpe564mL40TKYcIvsm3WxE9JkCh56anSzLsCzrxScKN1N9xzbf06oFkLX9FOYFGiMiYk5R5SbuxtCo4ZJltRVlanNYJf6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443241; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UYVoLWc90TjSnXBWQnMWyZY22lK6Lc4zmHvaduQQgBs=; b=KXSyK2cuaY7e7s1W2k7idDKpT57cl7l/kqxQpisU+zMPo6uasLCSK5GbFnC4wkKEHlD6/78i8nvVVDzEQPueZ7Plp/PRffPZDnJRoxdX0NRvX8xoj14071/UX3a/X2JNtGO4VglqmU6oHoex078HsG9GEFQYSP8vio0J+IUTgYw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443241842128.41036386828227; Thu, 9 Jan 2025 09:20:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCj-0002Qa-Lt; Thu, 09 Jan 2025 12:20:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCi-0002QB-0Z for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:20 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCg-0000f9-BI for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:19 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43635796b48so8101515e9.0 for ; Thu, 09 Jan 2025 09:20:17 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2e89fc3sm62157365e9.30.2025.01.09.09.20.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443216; x=1737048016; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UYVoLWc90TjSnXBWQnMWyZY22lK6Lc4zmHvaduQQgBs=; b=mWME27ASY++JmgXplutd9EMHhCPY/i/hwiqP6shlsbl8LbMCS1QrkBn4m7cHbXNszn s5x0rTv/ucoHlZqFEcO0bhPdToPcAm2YgcqzhbiFPRIbg3UHqxr+WGmgB1raAQcO9j83 QNP7zNa2O6ozVtSLpRlUMg2/GaKW6mkaJEnuMzAGP15qaRrq76qYh3tdGPf3MYqhV0HO SDH1senFfCPRzL1kZ3SS+J3QLEEv7FihTO58S54/l97R/AQDLzRInaY+1DGhKmV0rVyA n09QPe44nu6MM9xzII++DwujwNqZ6SH/AhdDp6IxlgrIbf59I++bJa7+kP5x8jnTs/bT P2oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443216; x=1737048016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UYVoLWc90TjSnXBWQnMWyZY22lK6Lc4zmHvaduQQgBs=; b=TqMWwrNA+tgmEX9VBVWho6ljZUu78zdlXGchU4T0EEad3VyTc2h9bwdJ9ZJ+fjm5Sd lj1hSh5FLvznJ4cyjbVwxP3vBsfhyDYsnC736jIVEQqsVI9GW8iuE3pSrwuYUgoGEn3s x/fGXAp8qCQ8mjSsy8NtW/PU6SGMfcr+WYqZKgPoFMZRFnwT+W4VKW+6TnMcaqh8lTKR mWcmFbhTfLE0lrq7RZLtXfIQ9avpYy4aBGdssZo/jwflKpbfby9xOJm3RWpSDS+BGNlL 8hb+dQhUacSZp+W+RUrnO79z6fIizhw11qEPNLtM90LcCmf4ulNL2la+ZpSqxjvpxbx7 ZtqQ== X-Gm-Message-State: AOJu0YzQe2Q3mTiwem5jVpgPZ+8RxKgdjp4R7HPuIYdxGal+HYwOJ4zm AVTll7B5kPmZQa1OuA1yeNG1uveUTYmaW/AkJPzIxm8E4VQRB5QDvzuv8Fj7NQnhU50AZ1LJBSl 4ueI= X-Gm-Gg: ASbGncseAMh4Kps/IIZYScI5da5krQC4SGf7byxRjCKu0fMVFacfoSoKhgxUDzgSkni MVAlkLjT1badd4NGCGJSkbNk82rAwaXI4yfFvueXVAtDCEt70SeW5QUvrAIHx557/8AGY2kT7jp p+JEVgLr4iicbPZcHThNKTaV0qd/OamwTP8Vkrru9NZxL70Cxo/ij0h4yJ715Aa3iOtpkvUdSC4 g1bALC/Uy95OTCRtTlb+e/S3fT832V7z7CMER04S/W3ZBew8rnF+eTUwPmCLTLFerfPt3cEiHwK m7pDL00Cx1OmrkrBE/BQmQWvir5kDFQh1bnr X-Google-Smtp-Source: AGHT+IGdgqoXPnGF2lcK+LAQfU3ZdfrA1Ka0Kkrj/L+eQjTDCQPl9L/bg5MPbz0F0/mQyfX9hEaJxA== X-Received: by 2002:a05:600c:1c9b:b0:434:ffb2:f9cf with SMTP id 5b1f17b1804b1-436e9d80fc4mr29197855e9.14.1736443215826; Thu, 09 Jan 2025 09:20:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 05/11] qdev: Add machine_get_container() Date: Thu, 9 Jan 2025 18:19:42 +0100 Message-ID: <20250109171948.31092-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443242394116600 From: Peter Xu Add a helper to fetch machine containers. Add some sanity check around. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Xu Message-ID: <20241121192202.4155849-10-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/qdev-core.h | 10 ++++++++++ hw/core/qdev.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 50cbbf81211..89575e74e27 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -1033,6 +1033,16 @@ Object *qdev_get_machine(void); */ void qdev_create_fake_machine(void); =20 +/** + * machine_get_container: + * @name: The name of container to lookup + * + * Get a container of the machine (QOM path "/machine/NAME"). + * + * Returns: the machine container object. + */ +Object *machine_get_container(const char *name); + /** * qdev_get_human_name() - Return a human-readable name for a device * @dev: The device. Must be a valid and non-NULL pointer. diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 48bc9a7b9c7..9abc4e8322f 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -828,6 +828,17 @@ Object *qdev_get_machine(void) return dev; } =20 +Object *machine_get_container(const char *name) +{ + Object *container, *machine; + + machine =3D qdev_get_machine(); + container =3D object_resolve_path_component(machine, name); + assert(object_dynamic_cast(container, TYPE_CONTAINER)); + + return container; +} + char *qdev_get_human_name(DeviceState *dev) { g_assert(dev !=3D NULL); --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443253; cv=none; d=zohomail.com; s=zohoarc; b=ZqM7ShnpR/zImrjAxkNiZiPPS5c/Wfhdtg5UDDuGQ6PFiTgERLP7hK8krHb8RdqRir8DssRI4JP4x736DzjXVOHKuH94CxNZk2Oc5QiPlreGMGJ+ehson0W4yh6uWl/uuKsOTcyL6TDM6gKrwk1lFKsKaMXwxY8b/P+dL/+QyZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443253; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EUzVGKeluHJTwIU2Bj0/kdJ+NUb+Ue/QhX3Ykfr1q8Q=; b=fIh0Sj3EalCKzdJw87NkfI6VrsKftFp1v7hNgXlWlfBaZi9QfDOhAhU2oK+gboC/6SMZ8tKpfgwomfLF4NHULXmOPazpXSLPAhb1hMhaFxheIWPblAhn5dghtd+qfd5I6fTSRCnmKokpBMC47H1XZ3BlL7JmyLaP8W1q5NpDPcI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443253692298.05252972118456; Thu, 9 Jan 2025 09:20:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCq-0002e2-5U; Thu, 09 Jan 2025 12:20:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCn-0002aB-Tw for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:26 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCl-0000qz-Sy for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:25 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso9691785e9.3 for ; Thu, 09 Jan 2025 09:20:23 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c1b2asm2272284f8f.89.2025.01.09.09.20.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443221; x=1737048021; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EUzVGKeluHJTwIU2Bj0/kdJ+NUb+Ue/QhX3Ykfr1q8Q=; b=ObO1+5a3632bwJPaPsV/KFWDbt8YCS/4gZgYwcFtIKEaQaYlo/KSjr7zqBPbg9yCTv 7o8yBEB44nf2mCN8LMjkaOeEkinqiDOJuGmbCYEmjSTWJQivnOcrmaWL2DFxW9dYE7Yg /C+hTkVal8ZbrvYZncj8Hwkf69kg9qcnsyBSZbbK7rPpPBXVpIqP4fu0igHXC12QBY4k zkzWqL5tpaAZDpHFKHSdcje2N78BHlUc1RVXYysYFWAwxIcEwNhmzcHfVNhOuWdsLuXI K1YrQni7Bk5SQ0sH5Ce5wkKhzYQSMuI4pqc5OG1L9CDbeRrwcm8kZRh4aPNLkU3iqKm7 Njlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443221; x=1737048021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EUzVGKeluHJTwIU2Bj0/kdJ+NUb+Ue/QhX3Ykfr1q8Q=; b=NL6FgoPib4KxZvvYQjk8imuS6YHyxxgejbFmSjHdXBDKoIlm5NQ3E8PorOl1pskBsq +K+ew30eTdKAEdZBFA90qUUCXwCZY1YIDqFCYQnk56xyTpIuOJUbNhN76RKfqIhs9dpJ +cuDf7DqV0GQNfUbsIlcuvrNmbYdboljhSQ10xR0J3WATu+5Br6+wtj6Sr+hcw7qIMxm cI09aAh4UMWHLH8bthBDWkKpm91+l7Xmag+QHFTdfD268JcRyYHF9UhlxDlV2Odxt6oA V7fRkou3QTifKUp9RcCFxUIf94Cjif64AmAvWvIi0mgM41bHwx54GI4JLlxLu7hungsp dKNg== X-Gm-Message-State: AOJu0YzrUpm+X8bZGyrLP8gau67464aUYilrehfZPTlIrZ4RmWUSVEQL IDLbq+ktBXQeaVwrA9FYT5wxRTXzmj6bA6D+8rLWeZg/XJZz6AoxBp4GmE/7miy/yTDO09Zdvb9 L1R0= X-Gm-Gg: ASbGncsSGf4JKf4c7+4abE9a9UmN/IUz7ON9KFlXIaY4nk5PvF9XPy6q35LJAOEInhD 2pLsXXC+TW0mUaJE/ycvc/UbA+uwvMX1opvUZKZeCOMTUp6JxVJz2sW7e0ovHp2dRT17v5Z1ICa IGqAPz5NJqwAbeoH47b3Bq8t6olc0JaAV4gYxwzyk4C5RPbcXoRiHw5qSclA6X3nccmKKGsXHsN j3oNpIGX6S45HVHVx8qhsdXENrxJMa8HviU8DUbpo55HgyhJF/q6lDu4yW2sd3o9dleXnT8m5r0 AyyBRmc/XP7MnuzI4xaShKK4Myd9qoza3+9b X-Google-Smtp-Source: AGHT+IGq17mk+DRbE/b7puYLM34oZnYM6v8TQ1zLKxxYmh+xXfaQreWcYNM48rSqtLiMLFue9EbP2g== X-Received: by 2002:a05:600c:a08b:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-436e26dda73mr60242025e9.24.1736443221145; Thu, 09 Jan 2025 09:20:21 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 06/11] qdev: Use machine_get_container() Date: Thu, 9 Jan 2025 18:19:43 +0100 Message-ID: <20250109171948.31092-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443254691116600 From: Peter Xu Use machine_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241121192202.4155849-11-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/core/gpio.c | 3 +-- hw/core/qdev.c | 3 +-- hw/core/sysbus.c | 4 ++-- hw/i386/pc.c | 4 ++-- system/ioport.c | 2 +- system/memory.c | 2 +- system/qdev-monitor.c | 6 +++--- system/vl.c | 3 +-- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/hw/core/gpio.c b/hw/core/gpio.c index 80d07a6ec99..6e32a8eec61 100644 --- a/hw/core/gpio.c +++ b/hw/core/gpio.c @@ -121,8 +121,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, cons= t char *name, int n, name ? name : "unnamed-gpio-out", n); if (input_pin && !OBJECT(input_pin)->parent) { /* We need a name for object_property_set_link to work */ - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), "non-qdev-gpio[*]", OBJECT(input_pin)); } object_property_set_link(OBJECT(dev), propname, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 9abc4e8322f..82bbdcb654e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -476,8 +476,7 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) if (!obj->parent) { gchar *name =3D g_strdup_printf("device[%d]", unattached_count= ++); =20 - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), name, obj); unattached_parent =3D true; g_free(name); diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index e64d99c8edf..9355849ff0a 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -65,9 +65,9 @@ void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *= func, void *opaque) }; =20 /* Loop through all sysbus devices that were spawned outside the machi= ne */ - container =3D container_get(qdev_get_machine(), "/peripheral"); + container =3D machine_get_container("peripheral"); find_sysbus_device(container, &find); - container =3D container_get(qdev_get_machine(), "/peripheral-anon"); + container =3D machine_get_container("peripheral-anon"); find_sysbus_device(container, &find); } =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 71118765884..9334b033f65 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -463,7 +463,7 @@ static int check_fdc(Object *obj, void *opaque) } =20 static const char * const fdc_container_path[] =3D { - "/unattached", "/peripheral", "/peripheral-anon" + "unattached", "peripheral", "peripheral-anon" }; =20 /* @@ -477,7 +477,7 @@ static ISADevice *pc_find_fdc0(void) CheckFdcState state =3D { 0 }; =20 for (i =3D 0; i < ARRAY_SIZE(fdc_container_path); i++) { - container =3D container_get(qdev_get_machine(), fdc_container_path= [i]); + container =3D machine_get_container(fdc_container_path[i]); object_child_foreach(container, check_fdc, &state); } =20 diff --git a/system/ioport.c b/system/ioport.c index fd551d0375e..55c2a752396 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -258,7 +258,7 @@ static void portio_list_add_1(PortioList *piolist, object_ref(&mrpio->mr); object_unparent(OBJECT(&mrpio->mr)); if (!piolist->owner) { - owner =3D container_get(qdev_get_machine(), "/unattached"); + owner =3D machine_get_container("unattached"); } else { owner =3D piolist->owner; } diff --git a/system/memory.c b/system/memory.c index 78e17e0efa8..b17b5538ffa 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1238,7 +1238,7 @@ static void memory_region_do_init(MemoryRegion *mr, char *name_array =3D g_strdup_printf("%s[*]", escaped_name); =20 if (!owner) { - owner =3D container_get(qdev_get_machine(), "/unattached"); + owner =3D machine_get_container("unattached"); } =20 object_property_add_child(owner, name_array, OBJECT(mr)); diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 6a38b567876..23043b1e0d5 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -348,7 +348,7 @@ static Object *qdev_get_peripheral(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(qdev_get_machine(), "/peripheral"); + dev =3D machine_get_container("peripheral"); } =20 return dev; @@ -359,7 +359,7 @@ static Object *qdev_get_peripheral_anon(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(qdev_get_machine(), "/peripheral-anon"); + dev =3D machine_get_container("peripheral-anon"); } =20 return dev; @@ -1100,7 +1100,7 @@ static GSList *qdev_build_hotpluggable_device_list(Ob= ject *peripheral) static void peripheral_device_del_completion(ReadLineState *rs, const char *str) { - Object *peripheral =3D container_get(qdev_get_machine(), "/peripheral"= ); + Object *peripheral =3D machine_get_container("peripheral"); GSList *list, *item; =20 list =3D qdev_build_hotpluggable_device_list(peripheral); diff --git a/system/vl.c b/system/vl.c index 3c5bd36d7d7..ed1623b26b9 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2137,8 +2137,7 @@ static void qemu_create_machine(QDict *qdict) object_property_add_child(object_get_root(), "machine", OBJECT(current_machine)); qemu_create_machine_containers(OBJECT(current_machine)); - object_property_add_child(container_get(OBJECT(current_machine), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), "sysbus", OBJECT(sysbus_get_default())); =20 if (machine_class->minimum_page_bits) { --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443261; cv=none; d=zohomail.com; s=zohoarc; b=QE8qqNKsZd/RoAi/Yw6UELiu8MYRoEisQXgEzTbhRtUuN/ZuvhVSezIiWYMbYlX3urD9w1xMlYuZBDRqV4aHOwhpk6GJOMSxbCKz3MB99Y6oXJaZXayjqz6cZaKiNEF73lF4XYOV0VdYbemae4IER+tdinU1TNi3/t7WFODapG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443261; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SAkpQ1iPeEc9FavMfrE5ZMAHDuM/hnnhJGDNmUL3hkk=; b=duJppB+nOEbnMyBy7Ks5KY8x1oKHdFKxEY5fnwXNMPbL2CSylz8DPFY2MX5yqDzpiNsj/8QX64Yw4e01xxtY6Kg7xm+OHnJRNm8yTAn/HyGjn6ZgqRleAnqX3h4rbg6sw3Jo5flOHhryT4kGo26HPhM2HsLoFF947d2numOpU8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443261766422.39624248529515; Thu, 9 Jan 2025 09:21:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwCv-0002s7-QC; Thu, 09 Jan 2025 12:20:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwCu-0002mI-2K for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:32 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCs-0000sH-E4 for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:31 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-385e3621518so683526f8f.1 for ; Thu, 09 Jan 2025 09:20:29 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38c596sm2348386f8f.51.2025.01.09.09.20.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443228; x=1737048028; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SAkpQ1iPeEc9FavMfrE5ZMAHDuM/hnnhJGDNmUL3hkk=; b=DPm4mPvaWVWDkwyQq4930Pw9asVYNlEi4obki63Z9hxpbnmfqvBgzfITufqDG2JUBP U6b6kaEiB1xrWqMTItg7kxEpAwvAC17H//yvOu7nt/lQmXrYBGKPtagLVexeiGoG1UaM LmsWNsTJpJvjc7vBvMzFmLlerFBIuIN0PlMD7zp7k/YEOXKynhM+J+UKkagHlwL/S2Or f+L+p2vAzbdn8GPmqorrM5pkVJ0JDtlNqF5kGKH3P73UUOgY25jbXs7AcOHI9JpJtBV9 qcW86ve5Nr/yL/zQpc+kvfp+VBL95IooDDtpHNQDnbdV07aajr4VV7bcv05MrR385zY5 leog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443228; x=1737048028; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SAkpQ1iPeEc9FavMfrE5ZMAHDuM/hnnhJGDNmUL3hkk=; b=e4Fi17x6X2ZybgK51ol//R9hxoR8cWohjMTYgHy9da2fstL07esxLMEo9RTd3rm8Hi w/5DQQW8m0ss2yKJg5gj6yDXlyGr7/NHoBnGnr0L1y9XCHEsQT3oNxZgMj06lXCoTt/0 W43JlruRA1OUrGwmd3OyYbw0LwGaGGuvPvTSS6muV4E4WxJqhYh0CEL8uIm1A+smoJUv EbXD2ToNp56TKtpG/ndTGjrHNHhZIRdwhgcEi36sJLp+XIx7DI+pz2iVN9DHMrJfUdCP PQ6AdHmSTeNiIFWwpvz+XuZ1SHfVi3yhcJ/oDR04reFtmaIp6zxa5wcdbjrHFPRlnKcc A+9w== X-Gm-Message-State: AOJu0Yxi+erCgTLpGHvBWfGyzHCiGn0FJ8z07Ws/pcc8hUF9KGvv6ygy j1jJ/aNwgcfFP1g0k9sgK9mnrDFKBzmVeHCesLKZ+qeW5VT2QOD9xrTIu9it+log7JiIMQTR1u5 g5YM= X-Gm-Gg: ASbGncu+vpoefmJWJOK5n9ybNi7iKoxdHSHs5Hfs8zXmJAv82uy2VzfueluIxay51M/ t8A8UYztk4oAYA4OR7EokkLmvUHmrnx3wGbvJA+hnOhdj85UhvavL5uLZ0wy39wyQnp9o8TnhBl NtCPNdyO/CCQOQ76gWZX4lzSoyYONzm7ClNFnz3t6pgNI9K7wmshT+rNDLSUCQnyjAfdo8ggv9t 0DCmILr6YEQHvcQTvaFBy/iTIpixmwwIovCW9s/kUTKm0ACM5wfFlQ81SqaBHWt1n8vToOFps0F cwwNhXNNtQYofvxdAztFNmzgAMctoGKtbq++ X-Google-Smtp-Source: AGHT+IGSuJk4lWB6tPRViHuFddmQsMG/6P2N4ccDhknJxFNY9hsZP3XnLPI1XgMQ8M82WoicmJ0TQw== X-Received: by 2002:a05:6000:1446:b0:385:fc97:9c76 with SMTP id ffacd0b85a97d-38a872f7fd9mr7017156f8f.3.1736443227979; Thu, 09 Jan 2025 09:20:27 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Richard Henderson Subject: [PULL 07/11] qom: Add object_get_container() Date: Thu, 9 Jan 2025 18:19:44 +0100 Message-ID: <20250109171948.31092-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443262505116600 From: Peter Xu Add a helper to fetch a root container (under object_get_root()). Sanity check on the type of the object. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Peter Xu Message-ID: <20241121192202.4155849-12-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/qom/object.h | 10 ++++++++++ qom/object.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 95d6e064d9b..bcf9910b42c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1510,6 +1510,16 @@ const char *object_property_get_type(Object *obj, co= nst char *name, */ Object *object_get_root(void); =20 +/** + * object_get_container: + * @name: the name of container to lookup + * + * Lookup a root level container. + * + * Returns: the container with @name. + */ +Object *object_get_container(const char *name); + =20 /** * object_get_objects_root: diff --git a/qom/object.c b/qom/object.c index b4c52d055d9..81c06906d30 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1751,6 +1751,16 @@ static Object *object_root_initialize(void) return root; } =20 +Object *object_get_container(const char *name) +{ + Object *container; + + container =3D object_resolve_path_component(object_get_root(), name); + assert(object_dynamic_cast(container, TYPE_CONTAINER)); + + return container; +} + Object *object_get_root(void) { static Object *root; --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443290; cv=none; d=zohomail.com; s=zohoarc; b=FwjNDAzuSaHE8Y+crFGCT20RC4Wic2W91NzTn+yHQQTlvmHcZDHxCg85HbaKaVRrY3VYFIEwjkUBXnNy8mAQg2gSrUtXwVuIO+1eHbYiXpF1APpSk+kHuuPwE4QcRZzCxsHv/2u6+ykRhXjXLIOo0P+HNnVJgHxywose6QoA+No= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443290; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Fu8Vu673xpGHSEU3TsRnxhPoaDJwCSLcIbc+aa/VbVk=; b=bCEhoanZjVuks8LXxttLXuwRxgrJn4r0xUFKts0XlCtnDrgyXlPPcz5/h1CgnS0W5hmsNnkr/T90Ly/VCZTFIJlW6m3Cr16AryGgjOjiYrdB9sxdF9mHy8jETJO/4cV2THCTuj8lh0B4KpxZq4F6qxRKV0S3BW5IA0IJ53SZ1rM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443290665206.28053976408864; Thu, 9 Jan 2025 09:21:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwD4-0003EJ-TU; Thu, 09 Jan 2025 12:20:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwD0-00030o-BH for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:38 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwCy-0000tc-7u for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:38 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-385deda28b3so754842f8f.0 for ; Thu, 09 Jan 2025 09:20:35 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2ddd013sm62334295e9.24.2025.01.09.09.20.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443233; x=1737048033; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fu8Vu673xpGHSEU3TsRnxhPoaDJwCSLcIbc+aa/VbVk=; b=vNTCrC03I1kA1P9lv4IKGfTW1cwJX+dqx6QGvOK7RoWWHk1JL393sBrGuL17NTOzv7 C9vyHzNRKzH/m/s/+5/UfFoNo8IkL6oLVCJAmZfot9jCXB/z5O1x2a078Q6WR0ZkCPVm IvSUGBeMWZ1d6e4gcP7uLJ6wipbMLU2aH0x1iDf3P1RtAqjNdt1VPleK+kEVAkBKbDiq PKxB5Sm2k5DqtsyxR6tRcRVaSzDHaRvdrbYgKzYwvo6616v1p5AkM9DCvmooO47mnTg4 teF4Q/XYf5bwNCGw4gQ0jWNz3/Vg7EOMh0QTl/No/JijpmvvcLZ3/eIVv8ZWXN9V8+WQ C47A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443233; x=1737048033; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fu8Vu673xpGHSEU3TsRnxhPoaDJwCSLcIbc+aa/VbVk=; b=UFGo2o++NflStOL+hA8BK8Zh10O7mnNG+LkJ2DS7+ypps+EkHEm+hmRQsQWy683mPi Ov5k6L03/7EML/2zVARBPXd2tnsBXyQ0cpS6b0iqG+QDm99Jn82PR2GRAjpW7135cW7A X2/yYqcnhXvyr+fIr10IRjP8LuBpWv8HhzBSWfrHe1/nCzEv0dvQiMmG5u+K/bHveJqZ YnDwodpo4jbIc3HhMxbeOBKYSXhPQJ8PcBZmqnpaG6SLxE7ry5n5Inf/DnvbogmsC77p jTQpgyjmacmxrK+fw+6taLlb6SxF/seIftj0AGRGaRLThytfPRMuas9eEcRqdPyAJ3Bs kOCg== X-Gm-Message-State: AOJu0YyMXfK6RDQZXgJVtsop319/Uy5tzEsPtQv0AR8uSbIumZu+ML8l L3rueVodKEzQt2esX4JmPAxsGHJamnsaEb9Oy2JhEIQDhPF43KEIz8JgWD2mUve4IpgpEJtb+M1 Whi8= X-Gm-Gg: ASbGncuECFNdUTGOgYTpTKK5aZFncA7fKX0BgdIYL0CD0SyeBx+R4u/aADzVxhQrmqK fMWSM0SNvTYDb3p1MckZCaEl1E4WcyBlKMZvy092ZKkLzIWA+RWomnbX+ziARZUjOg9LS9y667z TySd+/LsQWzlDD55EIOBfmyuj8AlI6qqMjZz5/jhDjLpg+B3dIEGDY0UL3riHLc0qLl3gpJzR1+ ObsXNezMYuiRk1lMiNQbFa5f7ay/A1ZU/NLZevssQlVHMJD0WUaF1LAfSNBuVKM5TDkfV7JeLOP EkshjKQOhRMNTaaCU2e1ofuPVgyfdU6bLOr5 X-Google-Smtp-Source: AGHT+IEGiXaB6FW/vO/gf2GWnn+Xd33BmrnC8hTxuJzXhqEDZikw+wRi/x0ZoPZF9rebXbAxYlxJLA== X-Received: by 2002:a05:6000:184e:b0:385:f64e:f163 with SMTP id ffacd0b85a97d-38a87312f41mr6302388f8f.32.1736443233646; Thu, 09 Jan 2025 09:20:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 08/11] qom: Use object_get_container() Date: Thu, 9 Jan 2025 18:19:45 +0100 Message-ID: <20250109171948.31092-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443292922116600 From: Peter Xu Use object_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241121192202.4155849-13-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- backends/cryptodev.c | 4 ++-- chardev/char.c | 2 +- qom/object.c | 2 +- scsi/pr-manager.c | 4 ++-- ui/console.c | 2 +- ui/dbus-chardev.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 1157a149d02..1187b08dacf 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -97,7 +97,7 @@ static int qmp_query_cryptodev_foreach(Object *obj, void = *data) QCryptodevInfoList *qmp_query_cryptodev(Error **errp) { QCryptodevInfoList *list =3D NULL; - Object *objs =3D container_get(object_get_root(), "/objects"); + Object *objs =3D object_get_container("objects"); =20 object_child_foreach(objs, qmp_query_cryptodev_foreach, &list); =20 @@ -557,7 +557,7 @@ static void cryptodev_backend_stats_cb(StatsResultList = **result, switch (target) { case STATS_TARGET_CRYPTODEV: { - Object *objs =3D container_get(object_get_root(), "/objects"); + Object *objs =3D object_get_container("objects"); StatsArgs stats_args; stats_args.result.stats =3D result; stats_args.names =3D names; diff --git a/chardev/char.c b/chardev/char.c index 44ff116fcda..7705da5ad02 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -48,7 +48,7 @@ =20 Object *get_chardevs_root(void) { - return container_get(object_get_root(), "/chardevs"); + return object_get_container("chardevs"); } =20 static void chr_be_event(Chardev *s, QEMUChrEvent event) diff --git a/qom/object.c b/qom/object.c index 81c06906d30..58897a79a76 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1774,7 +1774,7 @@ Object *object_get_root(void) =20 Object *object_get_objects_root(void) { - return container_get(object_get_root(), "/objects"); + return object_get_container("objects"); } =20 Object *object_get_internal_root(void) diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c index fb5fc297309..1977d99ce0d 100644 --- a/scsi/pr-manager.c +++ b/scsi/pr-manager.c @@ -21,7 +21,7 @@ #include "qemu/module.h" #include "qapi/qapi-commands-block.h" =20 -#define PR_MANAGER_PATH "/objects" +#define PR_MANAGER_PATH "objects" =20 typedef struct PRManagerData { PRManager *pr_mgr; @@ -135,7 +135,7 @@ PRManagerInfoList *qmp_query_pr_managers(Error **errp) { PRManagerInfoList *head =3D NULL; PRManagerInfoList **prev =3D &head; - Object *container =3D container_get(object_get_root(), PR_MANAGER_PATH= ); + Object *container =3D object_get_container(PR_MANAGER_PATH); =20 object_child_foreach(container, query_one_pr_manager, &prev); return head; diff --git a/ui/console.c b/ui/console.c index 5165f171257..914ed2cc76b 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1160,7 +1160,7 @@ DisplayState *init_displaystate(void) * all QemuConsoles are created and the order / numbering * doesn't change any more */ name =3D g_strdup_printf("console[%d]", con->index); - object_property_add_child(container_get(object_get_root(), "/backe= nd"), + object_property_add_child(object_get_container("backend"), name, OBJECT(con)); g_free(name); } diff --git a/ui/dbus-chardev.c b/ui/dbus-chardev.c index 1d3a7122a11..bf061cbc930 100644 --- a/ui/dbus-chardev.c +++ b/ui/dbus-chardev.c @@ -106,7 +106,7 @@ dbus_chardev_init(DBusDisplay *dpy) dpy->notifier.notify =3D dbus_display_on_notify; dbus_display_notifier_add(&dpy->notifier); =20 - object_child_foreach(container_get(object_get_root(), "/chardevs"), + object_child_foreach(object_get_container("chardevs"), dbus_display_chardev_foreach, dpy); } =20 --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443287; cv=none; d=zohomail.com; s=zohoarc; b=gpPF+c0t4dPadOoChqR9ss6BLIkaA96vV3pGLXcvYKJXe4ZgJXGJe+PvuLPB2UmszJIZ2upazRogqcUYRt9IsPftuPYItpISumHG5fNSci25v8djFcmRvk9IJN7CxBr8kFSzTGavMVTKqCIr5T0pP06iZpcoDIDXGc/sdWsF8lc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443287; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CEHoOzKyVxEglpmxh6lJRCjvFkinjqf0bKzuyMt1kmA=; b=FRtiXErTS0UWIoIlG6tECSoJ+LQLaiSB8Jmp4kkh+ApqSSGKWRBy6RMzs5ZyMSYT7HAVNrxyyhme9TWBptY0se77jlIB5+bJs22dJtHlPBQpG1/lOHCJkOanpJSmAmnU9VuejValyy4/UPlFw+Rlwf5rVmt2J3J8Xtyf5ZI9GnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443287849623.4083372366201; Thu, 9 Jan 2025 09:21:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwD8-0003fg-7Q; Thu, 09 Jan 2025 12:20:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwD6-0003Rt-4n for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:44 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwD4-0000uQ-Bw for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:43 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43626213fffso14877165e9.1 for ; Thu, 09 Jan 2025 09:20:41 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c1ce5sm2357604f8f.94.2025.01.09.09.20.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443240; x=1737048040; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CEHoOzKyVxEglpmxh6lJRCjvFkinjqf0bKzuyMt1kmA=; b=suOkAL8qdGUFwbkWItOVdvYESw6+/SWaDC8myny/fARJ3z9ycBtJ2kj9Ig9mgtIP42 Hn2ANHVt87uYBRUcGkZfCr4wLvgQXQ2dpocMP3mTAjq+aCFh1je6mfdn00fJnMYwyaAY VtNMq+AKK5B7smPQlHFCCU3Pj5KUNhKMqY2uomBm5LnMNB8VFKCphOHmiSA+GFrOvmKw v+YeJ5qi+1HMkiB7nY4tC1YVpwHLQoUFRLQjty+wNqzT8TW4K3KYsyQqn7sA2H81qKy9 Y67cuYGE+IWTLSAaVN+USu1LLoXj7mmiC/NQUKncs0ROWoF8nxnOopUYz07yz3a38alc n0Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443240; x=1737048040; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CEHoOzKyVxEglpmxh6lJRCjvFkinjqf0bKzuyMt1kmA=; b=k7mcmQ9aonfDCC2nTiou9ExqmPJrESne2yTMDGs9PSAoZFeJBiX8/J2sUrwQuxeSn3 nvAAyJxQ0QgJ+WGCM49+Ix/0c5l/w4uytEHYwdywMCfNbDZwWVSrVy6mSY+Tg6QOaoAc oecD9TfArKa/redUCSnX/IL2EWVmEykLa9cZyA4l6Am6SRmr6S41F4mkCr/I8iXKvCqr JMMYHDwJpScb8PI73z5Xvr89ndcP0wpGEYtLVPXAJY82ieH0kwGk7yFkyjXnvltP7Uky btMnoUtKG/CPmM9nymKJWFWQjreuZ4lcdzwcklw946HSepqrQKkJItqn9zFj9FqrKWfd o8sw== X-Gm-Message-State: AOJu0YzHzzvfralct4gJyrtBQEKgW5xJHhKoA+/iCaHlhoSE/nlZCo9h 51pITqhojPf+5Ns2rcZQsdf0AeLDO6ThFXca0/Es2vHQcMefEPAyIq1MjXAJfO/5Z2F0n3hY1LB SA7w= X-Gm-Gg: ASbGncu8vhaQ3YTcrwhpXJDvjvU8z79/SvACeWQoPu+wQJioJnEVp3Z9UvwrOkoBy3k 2r1xRCwlDIXp8GnBxhM1RpxKZLJR3/61NuTuNmW+hBDNPYiHPbiPBJ71Ta65SY2Kg3zwStNm5fW b98xjDNbzMHw2RY3nql2PH0pNEF6Rzv2CqYhyH/JBnoMaSQmBaSfgm8BEyCJD3gSQjUUw3Ui/gD BDpGdGyVgWZKXs/BCNHieha0mGb7EjdZfnhxe06xlHgTejXVtB+LmiFN84uw0YNoK+T5B69p2u/ gntzGiK+cvpm8M1d2S1wszcINuEtVXFAlCQr X-Google-Smtp-Source: AGHT+IEdDuYK6BPxWIjxcr4VZNIr5nl2I+Uhsa5UgRt7sCnz4aIdIjbtQDZb99ZB2RrqIIARZ8rmMQ== X-Received: by 2002:a05:6000:1fa5:b0:38a:88ac:ee69 with SMTP id ffacd0b85a97d-38a8b0d5bb4mr3396738f8f.13.1736443239590; Thu, 09 Jan 2025 09:20:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 09/11] qom: Remove container_get() Date: Thu, 9 Jan 2025 18:19:46 +0100 Message-ID: <20250109171948.31092-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443288741116600 From: Peter Xu Now there's no user of container_get(), remove it. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241121192202.4155849-14-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/qom/object.h | 11 ----------- qom/container.c | 23 ----------------------- 2 files changed, 34 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index bcf9910b42c..77935572894 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -2017,17 +2017,6 @@ int object_child_foreach(Object *obj, int (*fn)(Obje= ct *child, void *opaque), int object_child_foreach_recursive(Object *obj, int (*fn)(Object *child, void *opaque), void *opaque); -/** - * container_get: - * @root: root of the #path, e.g., object_get_root() - * @path: path to the container - * - * Return a container object whose path is @path. Create more containers - * along the path if necessary. - * - * Returns: the container object. - */ -Object *container_get(Object *root, const char *path); =20 /** * object_property_add_new_container: diff --git a/qom/container.c b/qom/container.c index 20ab74b0e8d..38a27ec1edd 100644 --- a/qom/container.c +++ b/qom/container.c @@ -34,27 +34,4 @@ Object *object_property_add_new_container(Object *obj, c= onst char *name) return child; } =20 -Object *container_get(Object *root, const char *path) -{ - Object *obj, *child; - char **parts; - int i; - - parts =3D g_strsplit(path, "/", 0); - assert(parts !=3D NULL && parts[0] !=3D NULL && !parts[0][0]); - obj =3D root; - - for (i =3D 1; parts[i] !=3D NULL; i++, obj =3D child) { - child =3D object_resolve_path_component(obj, parts[i]); - if (!child) { - child =3D object_property_add_new_container(obj, parts[i]); - } - } - - g_strfreev(parts); - - return obj; -} - - type_init(container_register_types) --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443296; cv=none; d=zohomail.com; s=zohoarc; b=A+G4gpb1zOnBytfz+8JRro1CIodFxxG7Cs5EDEtVWfGeWwDkYoHRYmI15YqOVDCXDNS99g0ORgjgShpQmSyBybLH8ngJgEr6B+WBj43A9gKaIeaXXr22jW+wfJWBEqE9+oFXURyENpHuqezAZAB+fpsei0MADUypcW4B08bVwOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443296; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bEpqXVU8Ur/P9HPMuqzJk8wNNbtEkgm3VtINnkR/R0k=; b=GqjygHrv5CYO5fTuhSV1CxnRDb3202hjN1YVzKg6geL6yGTpaeeIxQrarW/KmbqqTxr5WHv32Ck0Y6Z7QZWZNaRGJRbSRQlTUWq0BWyWS9HBuM67Wb68MDp2HE3wdRu1jJ8Y10500YP7qtuZE2vNKyXBxRpSDobL1d97G2hN6xs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443296156730.1986163832916; Thu, 9 Jan 2025 09:21:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwDD-0004Ml-FW; Thu, 09 Jan 2025 12:20:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwDB-0004CU-L1 for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:49 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwD9-0000vY-PP for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:49 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso9434545e9.0 for ; Thu, 09 Jan 2025 09:20:47 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9d8fb99sm27331315e9.3.2025.01.09.09.20.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443244; x=1737048044; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bEpqXVU8Ur/P9HPMuqzJk8wNNbtEkgm3VtINnkR/R0k=; b=SGgYfRvcDJz5NA85QIeegH2NGC9g0gQCpWSHQIOOc9HxyH+lLAB5QUtt6+NlvY0N41 NSn2hvB8mHUcguDoOTBv1KJE09C5s6YM9xIOQZLYH51brxcheWf1HBsKUUisZnbkQP8q 7p2LWn5PNaI1ORzeZkDyXSbOOFAiyDK5Pmzo0+Nk6esaP0vc5FX4JPT0EGosLkxnOMQa TjghTekRYGr8paMLMC10yao6rND12vzdvmacexHNeO26OIDBF6twapZFyv7VZXA3s7MH cr1ERlW4WZzX1aCpxhtOB8AD/lMtmaWVWFMKTgcLe1hf7xRT2p/OXwX1OHTabw+LybNJ QaXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443244; x=1737048044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bEpqXVU8Ur/P9HPMuqzJk8wNNbtEkgm3VtINnkR/R0k=; b=a0/qfn+jOW4lakdpEqJw2YAhhCFmQvSL8XWW2iARbjzq2cTgcAS1tYtDf2bVyMZmsP hDfyYTs/1bTeF7h9FdmLXczLTpR7x3+FFrpiSVuYz/hBdaHypq8M2V4WUho7azio7jmK iU8YWEMJZUchBYvcCtw85FYv1mGF4BQQynjJnCFpRfo7fDgRudUGZncIRc2OD+a9tgnp 9bos3vjybMdPQwst6oLBTvquCzz3QlD39DvVD2zUiCs68tPZ3YOjugPzcpp+Moz+owS2 ZGLC3TkKswprYqvLoBBg0JPtL63LKzkiD9vKw3rrbO+2kfP1qmZGQcUINRCr7IKD/U6x 3m9Q== X-Gm-Message-State: AOJu0Yyv9Xq7Y4Me2Km/1c94mugL+VHQ2ZwPhkZk+TCbVYLNqnlMJBDc iH6fxsYk9r9t95imQw1u+333w7XEU+z2MH73mRqK0t2tdoFAG81PVJi/TWOv/BHworL9PxYKLoq XOpI= X-Gm-Gg: ASbGncuBXP5DOHUihpsSac6Nq9Ih/2GxPqpv/Oi/M1NIXFftw7XJrpkhgxGvaJUJ64w OL7jGgcbIz7OaPe+TvjXFp/d87NJQxVgUb4A3R0hlnd7HC/p80fbSIjRUcVf2qxlaqkEcOIRiNo bLyvcjZrdJXIvbrgU8nSQ0Gs/ANzvXxmLzn0aP93xh4dUqG35LPlj4ngSAu4Qcqki5Qu+5Chd7s j7qFedp1HCyFS6Eyyj63fcZbwprKO1EfzwHspuO1W/ADPSnmjmDVZq7P8vfxxmzUgrCpp0ExHqh aHsMCBTsyxGSYgwGkgvtZliVticzb97d/C7D X-Google-Smtp-Source: AGHT+IHmmF2A+MA1ZCXsxdRGrsjDmUIhOzjDNv1N4dKcFmAOW946Kdq0v7C/tRY3Q6IHyRgJ95tm3g== X-Received: by 2002:a05:600c:310c:b0:434:f8a0:9dc5 with SMTP id 5b1f17b1804b1-436e26a8c21mr73170825e9.13.1736443244508; Thu, 09 Jan 2025 09:20:44 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/11] qom: remove unused InterfaceInfo::concrete_class field Date: Thu, 9 Jan 2025 18:19:47 +0100 Message-ID: <20250109171948.31092-11-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443296748116600 From: Paolo Bonzini The "concrete_class" field of InterfaceClass is only ever written, and as f= ar as I can tell is not particularly useful when debugging either; remove it. Signed-off-by: Paolo Bonzini Reviewed-by: Peter Maydell Message-ID: <20250107111308.21886-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/qom/object.h | 5 ++++- qom/object.c | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 77935572894..9192265db76 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -573,12 +573,15 @@ struct InterfaceInfo { * * The class for all interfaces. Subclasses of this class should only add * virtual methods. + * + * Note that most of the fields of ObjectClass are unused (all except + * "type", in fact). They are only present in InterfaceClass to allow + * @object_class_dynamic_cast to work with both regular classes and interf= aces. */ struct InterfaceClass { ObjectClass parent_class; /* private: */ - ObjectClass *concrete_class; Type interface_type; }; =20 diff --git a/qom/object.c b/qom/object.c index 58897a79a76..ec447f14a78 100644 --- a/qom/object.c +++ b/qom/object.c @@ -314,7 +314,6 @@ static void type_initialize_interface(TypeImpl *ti, Typ= eImpl *interface_type, g_free((char *)info.name); =20 new_iface =3D (InterfaceClass *)iface_impl->class; - new_iface->concrete_class =3D ti->class; new_iface->interface_type =3D interface_type; =20 ti->class->interfaces =3D g_slist_append(ti->class->interfaces, new_if= ace); --=20 2.47.1 From nobody Sun Apr 6 02:02:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736443290; cv=none; d=zohomail.com; s=zohoarc; b=ES/BRcHbHJXWYVjm0bwG4wjJUWhVAqGfUlkeyV7ran2TZLd2wtLSQ6cw/Ut2vmeCnGXyfWRry3NDhrhwIZN7TNEnqTFz3acQjJ/cpzVFXJXAteRZvU2rR8f8vOCj/thFHvBfPhGK0D/a4mTx99igFuG9aH3Rd/RvkA55RyW4ad8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736443290; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zevfD/0XJNMcMENJjO9t+oO6TupDgy91bB9ym/P30U4=; b=cngM0IWR/QZHqLhmBFXui5USnYi7TMKOYvF1Wp+tWTl2L5uOoMQeU0HjH1zN7a0anoP1NSdFxoMYw1mTfoP+6lgAGF6o+s/v1goJu8ezGGaYNcu6zVSl346XMSTdTLv747wZ5Oiu7XXMVgnFBDg6V5ID812tpyJ9YeALlLl3qn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736443290617419.97581246952416; Thu, 9 Jan 2025 09:21:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVwDK-0004w6-A2; Thu, 09 Jan 2025 12:20:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVwDI-0004ja-D8 for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:56 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVwDG-0000xI-Tf for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:20:56 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385e3621518so683872f8f.1 for ; Thu, 09 Jan 2025 09:20:54 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c1ce5sm2357948f8f.94.2025.01.09.09.20.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 09 Jan 2025 09:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736443252; x=1737048052; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zevfD/0XJNMcMENJjO9t+oO6TupDgy91bB9ym/P30U4=; b=ZTf98iy477k8jzEFvBXLN3MV+UnBq2QenqI/CCgHgjB9oet/iT9Y0kh84dGSg7ttK6 KNVh+JOm/D1SH2dETglvET+JNWwKIqj0Rh8G+zMSfTF5FqF+oO1aQoon2p99tuJtM8rj bSlcA5ixU4/LkYehxQdS7HVxJ1XfBpw+QraQHKtWV2FCQiAB04GGPmNLqjb7kWDDhEyY Cj4okrCBuWNLq9ycNPJKW2ZeOKnAT0NsQWwF2TKC6EEz5xnZpyZSozjMy+2IyH+MM5zg Bj5HV/qfUrz4M/Woav/UE/npGUd4FeQEGmbzzjkF8YAX5ZxV9RrWhKMdp4B7Y1zfblY9 iTlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736443252; x=1737048052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zevfD/0XJNMcMENJjO9t+oO6TupDgy91bB9ym/P30U4=; b=VviUvd3cAb19KIohllYPw6w+e8LboCuXxe7Ur4Zw5QKiJSwa0Yl9XefIQn1c6cGVB/ JvPrzKPxQcK7nt2/jWvsvX8FNPj3/6JbINY2BYF856NCmyUdzpcaPG+36lvZ8wzgjC6/ Xpki23B4nkXbZz0AM0Dcq9AYvG87THwwmEKpDf8/nXvQ1iXTNAFCSMh9HvmLmEZPDXeE 5ETbKpGwhn0R+bO7aaz7IADvMBiN6LLPpuvjdk5KODdSmoxO/X362p3y48CJ38y0D7P0 Ti6vRhFwaUlUhs3zyvIhZ++SG4NJIdnUYZhWzO7XvClLuaQsFW0dImd+NGypkFB087xJ eqDg== X-Gm-Message-State: AOJu0Yxd9RwgMX5GFVfMyhP91pQWIaRpUUeCX4c2NjDlH6nXchns0Sms 3l9Cmo9tYddB8c8CTZARlJtTUDLLS3H64P5X621FKEWCqjkY2OT8tF4QFZbtmZsSqLs719fEwiu I83E= X-Gm-Gg: ASbGncs5c/1VzULRXC2PlR+Y820FihuYDR8uVKvSDvHGD3uXf/hKz83p+m+8Ng8Bsa0 B1wx5lSmvfvEIpUaBssgHjilYuGA+PZ95VAVqvVCLAeIdrGKLggLyGOJcPlGFNuofSH8Q7C8BVa 9zBknwQBW2D2SVj0ii0ovo4tl3Qg0a0JHA11vuF1Bzz4J2TnW/E/qLH40VmsW4M4ijH51PVB0tz H8NUTC9iTyWvotvuOHzEI4twqCcArSEjfPhB4pYSHK+ViYIx3Jp+v0apd77/HE5ypryUqYOjWGq AprjPav0Fzq6A4oK7qzU65DuRVy44TuF1l5M X-Google-Smtp-Source: AGHT+IGOwgjY57/fBV6z4udumMChiJWSjeOvUVwTxZtl6edZ9ywQ1NPOzWvNDxvzb9O0XOV1ag4eNg== X-Received: by 2002:adf:a2c4:0:b0:385:faec:d94d with SMTP id ffacd0b85a97d-38a87355754mr6052475f8f.51.1736443252512; Thu, 09 Jan 2025 09:20:52 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , Richard Henderson Subject: [PULL 11/11] system: Inline machine_containers[] in qemu_create_machine_containers() Date: Thu, 9 Jan 2025 18:19:48 +0100 Message-ID: <20250109171948.31092-12-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109171948.31092-1-philmd@linaro.org> References: <20250109171948.31092-1-philmd@linaro.org> MIME-Version: 1.0 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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736443292729116600 Only qemu_create_machine_containers() uses the machine_containers[] array, restrict the scope to this single user. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Peter Xu Reviewed-by: Richard Henderson Message-Id: <20250102211800.79235-9-philmd@linaro.org> --- system/vl.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/system/vl.c b/system/vl.c index ed1623b26b9..be029c52ef8 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2113,18 +2113,16 @@ static void parse_memory_options(void) loc_pop(&loc); } =20 -static const char *const machine_containers[] =3D { - "unattached", - "peripheral", - "peripheral-anon" -}; - static void qemu_create_machine_containers(Object *machine) { - int i; + static const char *const containers[] =3D { + "unattached", + "peripheral", + "peripheral-anon", + }; =20 - for (i =3D 0; i < ARRAY_SIZE(machine_containers); i++) { - object_property_add_new_container(machine, machine_containers[i]); + for (unsigned i =3D 0; i < ARRAY_SIZE(containers); i++) { + object_property_add_new_container(machine, containers[i]); } } =20 --=20 2.47.1