From patchwork Thu Jan 2 15:12:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854653 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7821421wrq; Thu, 2 Jan 2025 07:13:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV33j2UFgYL5kls0oyRTuVY8ZpAy5DPJ25V0kT5zXOJni2aN68s9PKdNHcN9ZjV9/aiGVEa/A==@linaro.org X-Google-Smtp-Source: AGHT+IF78dtVIt7ndCYFeaj9Nb1XQ95lYyLDS//jDqvT6QGtIQ9Z1gzAwsKzwBazjRFyJrXo/myZ X-Received: by 2002:a05:6102:440b:b0:4b2:49ff:e470 with SMTP id ada2fe7eead31-4b2cc449353mr30120005137.21.1735830809490; Thu, 02 Jan 2025 07:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830809; cv=none; d=google.com; s=arc-20240605; b=RCGM4H4Yp3M4jwPGg4b8MXramfiPF2iT46CZE4ZRb2gnsV5z+Evn0SDjzZTjlqELg1 POrzovHgC0kQH9jjTU8EykjY8fV6cymiGNVfRa3brDVWrh8QbD2RGyTkWk4le8UWdL1I CiJwGT2K7K8ETnt3I6EdVqRsBmf1tcu9uk/V6TImqn0K2xQE6K8rS6CQoTK/VC8rHB8s gdR3dfonuoWYOBdh3TXiouuSyNtlku5F4nltROtlbFY04gzdIxqC1xu9pjN0pq+oSPqL mBjq4GQlLM1RPq/IrkitO9pO8YVHWC4ddqcLOqtSREVnnLZI33xxbTFhtNxtVZJcByRU qJXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jzeo4aQg6DouqNm9ntCEUK8qegBuD5L5E5v2+2/k5ko=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=XVzVK/V80pSg773tRfB2V68OxOTGqN9wyPYqpt3g4F+v+Q6wyHV1gBnddU8xzuiF/V mvT4pj0TTVDNtI22VpfphfKNJV8t0NHw3X0G0wDyJODfiGVB6MrHMPR3mB0yque/B3Ep 4AO00TNjS6ZguBtx7a5UtVYtbl0DI0T+Iqsa452CxK65CqAymtao13/MUOw4voltBCVR LgEJ+eeTM53yRhllcNSggqa8C+2VdSZt2GhamPfyriM7IJAvORRc4MN3TxYwEe2fTyU1 LxuwoKl+ojMOV0XFnLfOQY97wDiujiecs7ocif0zksV7MN+1bZLUXDpwoCtlceybNHPN xRZg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xq9KCM/l"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4b2bfb75228si8259414137.434.2025.01.02.07.13.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:13:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xq9KCM/l"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMsd-0007U9-Hb; Thu, 02 Jan 2025 10:13:05 -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 1tTMsY-0007Tl-VN for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:12:55 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMsX-0006UV-Dt for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:12:54 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-385df53e559so8988499f8f.3 for ; Thu, 02 Jan 2025 07:12:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830771; x=1736435571; 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=jzeo4aQg6DouqNm9ntCEUK8qegBuD5L5E5v2+2/k5ko=; b=Xq9KCM/lMMO8ea9iHnb35tjtVrBWw9SQeoSY45N/eb/Mu6cpeXb3bxIuIE6a4a72Qd pVwP+nrq3lYro0zeowBAX8SdJKaaVwE7nPOCBhYoFX92wr3+NJnk+8DZZvDmpmD6aAxP Wid9XX63cftl0Dy+dA4B4dqZbtBR1R5jQejwDxV00en0H5rjSUbe4yEQ1rt8OPiNaS1Z iS+uL3nEiysZ6QGi+z4pCvtZtGWAXILFOpkqOlGXiiwABj473LTZjbGyQkPQ+9Sk4UY2 6ziQ3uzEOeJbhEE8hIGPznvht3OazG+Rjrcp8VxsUWUtOHXL4Kg4F7jhRScNZY5083Bb 2yZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830771; x=1736435571; 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=jzeo4aQg6DouqNm9ntCEUK8qegBuD5L5E5v2+2/k5ko=; b=iAZWoZFL7PloeXJjmQhzn57mNWIaCAyYV7plxDh6EOxtDPhZre3vLtJn+cE0DRbiA1 r8nKgmagICup8k1vMIGKs/oTYBv6QmDXoXut3tEv52KF7dxv+AfDQoTjrK6Oy0C5xU6A A9b8+ZirYAF2APstP24Q4uQ9Wx4wrOQom3d+HM3AcB9aupgA0v17V7ou7o6cbtKbefx4 bijgRVB2H/8smqxaXcg3Eko8RRJ39/63NDOIpcV/GxZqCHzkACmJ1l1WPHe7t50zW7rx 6Te+1YrACmvD1wWfB1BPtff0Zh63Zja2qVy0Z8oEXbVUOQ8vOFbAhes1PncSE7/s4Ro5 rSUQ== X-Gm-Message-State: AOJu0YyQ4bkW56ci5vYNSmdK1ehHqOgYwYGKz8IhgPlu7GJeGIH/Jt/6 rdc6k8UNHcduqbHoQtORweILrSgESIdYTEUW3YGW8+BQqGZRIl19aXb91486WTbYSbJH5RgoTBl iwTOpZw== X-Gm-Gg: ASbGncvClFgX/wlmF7C6b9C5lOsvPUqlxxgLVvjAPiFnqRvgdy5Kc4vb/mYm2JKu1vs TjqbEmdy5IL7sk0uDuzUgBylV9zx27pQrxSaye9Y8sRQRTi/Gg0d7a2hWB0H3tKPF3tWqnE4iie 4Ghdo/gEvFQdGAY073sxAhle/2hPOpBnPE1HT1HsRM/HKomMTNRDg1/S6QrXwnIvSW6QAnSBTb5 0osi/cJK7ck4VZRLpDg4css678cBEz/XRkRjtUwJVzV50kY8KT+4n4bkkqvcKghCif5ltpTTKUe 3T21ImyzPe/dcQtgkSKOCEXTyunaZeQ= X-Received: by 2002:a5d:5e09:0:b0:385:ddd2:6ab7 with SMTP id ffacd0b85a97d-38a2240874bmr42102687f8f.52.1735830771342; Thu, 02 Jan 2025 07:12:51 -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-38a1c8acafesm38227583f8f.98.2025.01.02.07.12.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:12:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 01/10] qdev: Expose qemu_create_machine() Date: Thu, 2 Jan 2025 16:12:35 +0100 Message-ID: <20250102151244.59357-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We need to create a 'fake' machine container for the QOM API. We already have the system implementation for qemu_create_machine(). Expose its prototype to be able to add the user implementation. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/qdev-core.h | 2 ++ system/vl.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e6ef80b7fd0..bf8a0ee6486 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -1106,6 +1106,8 @@ void device_listener_unregister(DeviceListener *listener); */ bool qdev_should_hide_device(const QDict *opts, bool from_json, Error **errp); +void qemu_create_machine(QDict *qdict); + typedef enum MachineInitPhase { /* current_machine is NULL. */ PHASE_NO_MACHINE, diff --git a/system/vl.c b/system/vl.c index 0843b7ab49b..33fbb9f32f3 100644 --- a/system/vl.c +++ b/system/vl.c @@ -28,6 +28,7 @@ #include "qemu/units.h" #include "exec/cpu-common.h" #include "exec/page-vary.h" +#include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "qapi/compat-policy.h" #include "qapi/error.h" @@ -2128,7 +2129,7 @@ static void qemu_create_machine_containers(Object *machine) } } -static void qemu_create_machine(QDict *qdict) +void qemu_create_machine(QDict *qdict) { MachineClass *machine_class = select_machine(qdict, &error_fatal); object_set_machine_compat_props(machine_class->compat_props); From patchwork Thu Jan 2 15:12:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854662 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7823631wrq; Thu, 2 Jan 2025 07:17:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWgQvAWSk7miiL+na85kiF662TKjS7j4OOOhQbaO4aJVCzCxAU09fhuvdMFhISPI3cw5UWBzQ==@linaro.org X-Google-Smtp-Source: AGHT+IFC8PkxdmZvHcTXPp6lQAoZ3dTjLlziqcLB7zK4GoeRr+9XH4lj+YJmEkrI7GmBxg4ZixJB X-Received: by 2002:a05:6902:849:b0:e39:8882:9ca with SMTP id 3f1490d57ef6-e538c239ademr37488327276.13.1735831050724; Thu, 02 Jan 2025 07:17:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735831050; cv=none; d=google.com; s=arc-20240605; b=K2y9lK+KSYKaveA1N0/3vH8DUpLpB5kOZc4C1HdxEzBGvi2/OC56ecOLyGnECKLYpk 4k3I++rZvS27nt92+/AhdIwoq8w5EigRHshlSTC0NLyduWXfPejYgRn+iNgjY5zyMz30 zAx66rmJOqcZBCcvqnx+75N3mfMjJ/w7VIx569CcMUXPOy5wuwcXdgYa6YGjmKNMzmBB hEfocml0VQzEihPum7WJsDh+iaXo8oUxrPvvxv4X2hUkHTS6Jy3lMibLIFtu/A/3xoJ5 X483Uu2Oyvh8TKbbMn6NxaactrxCYEHxDyB7tJoujUOuRtvDw+tXZq5SQcfJt+qnPWkk Z4Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SedjiUgYQYU6AzbLGFtcjZEu6+G941iL/2CKfBNylU4=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=KDdGRDOI2FY5slS2B7ea/bJsgHrKbrA+uh1ytmbLrsivY8ZjcqVhZTZ0x8K9TfapoH aUlGeKAODhoDaM5ZzFyYAvfAJF5x0bAGpmgX2MhxAua7RHFAk1rYtzrNE+WNb9YdkIO9 AFQ3GybJJwX8z+LJbF4MFyU3kDHx9uCSXa79zQ6zUxdA4WKo8h1i63Z1cRF780A0xMEf fR04OvlB92PomX1FIiJqdQGbwdE1732i5gwVUydaJ3qXWCWhhw7VnKDxyfkgRFz+vQ1h 2ZjSyjBK7wyTYkvbqhwNCEm+XTuL5IM9OJwrFrMDlI/viFAPnNNr+VG5E0NYMxPTxRzp aHSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QYuWcKjU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 3f1490d57ef6-e537d1ae161si15817852276.599.2025.01.02.07.17.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:17:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QYuWcKjU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMsx-0007YE-IL; Thu, 02 Jan 2025 10:13:19 -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 1tTMsk-0007Us-6n for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:08 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMsc-0006VG-0o for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:01 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso121002215e9.2 for ; Thu, 02 Jan 2025 07:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830776; x=1736435576; 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=SedjiUgYQYU6AzbLGFtcjZEu6+G941iL/2CKfBNylU4=; b=QYuWcKjUgvQsnL9CYxPmVP4sBXfViWf56rCj/EdVf1xtxV6eCW9AN1mcK8MCJQ+gAR 0xrIpvy74gJC6AdwVEO4ghxHXaHPU4UQgI2K1HItDx7YrWbGlJnFYAAC6pOvGfkav9qh Cl2fdeX8E3dpY39OXtYEtI39fm0yN3OUdkeTPaYoQxd9fT+niL97METHZHbBQFvrqpJs ShQTe9CCmOmMvIHJx1IJcHobYRBPcyVR5FarOO5v9R+8QwTTjFCh/LYRuCJPs+f8zMFA kQc7Sdv5zi9IilqIUn7d2o5EA2TTBdBpa2duM3c8rpicTVg64fyA5XhLDVZyOoY6HAKy rjjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830776; x=1736435576; 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=SedjiUgYQYU6AzbLGFtcjZEu6+G941iL/2CKfBNylU4=; b=bxk5eOvPsbD1+FKaF3gtlJoJpMUOG1PFXJBbBkq8sNsqYPRdDbEZ+JXikhmW4LU0E6 91iViuHRIatonDpeeGaR3JoyjX8r3Z/pEiUCmzVNcT4mEQopTAbuqSXG6dZPZc8o+hOW Mrmk2iTpph4Gx6Dy+71DTE8g5xNNugKucaShSDvCrhNpkfdFM/H0zjY1RkVHe1j8yAPW JFbwkM9tH4784o7/IZ0V70mSJmYidJbSkQo34zLiKTxin/HNReDfsNa7kItffEfRqn6E O9wMVc/rntTeL6CUTEYsiKaf6j3Ug7B/cobclp9a179rKAG8kKKXA5b1QEuMWAm0NOt6 OeOQ== X-Gm-Message-State: AOJu0Yzl79cLWXRFeTSQSq/rhXgVqJnsM+6mQanzyDKGC1VnhwUTlVOs V+X6OdH60rdMulE4UyqCcfmG/egBUozThRP2fLSB9fEuuyAvxQFtKg+5f9I984WBopzokGoZsoT bSDg7ig== X-Gm-Gg: ASbGncurs+0rKslHeOiHCTo1r/79neJzqINxSOaXLwR9EvdY0MkC2f1piwHr2kZ03qm rPMfi98nHhNBdCoefegWOhcADlHE/gXOUQuu6iZ6QwTgRhvmJq5oLsZvdmOAsYSEDChcKKShu8K 3MpdIZIesRJ/6isvnYgCJWz+H9xlGog8DJGPFALMwbrUQoHx9rTKTPpQdaivXuEvyJhyZCC3H0R +P98DMLX8bjQ77FnZgHfvTQKavk4S7lF3WesScjkWIOeb39fAk+aP3TsSlMm4lnh9RqpEcWfBN2 hJB25Nfq21ROL25y9+w+Nu+BBTGC0QE= X-Received: by 2002:a05:600c:4748:b0:434:f804:a9b0 with SMTP id 5b1f17b1804b1-43668b78818mr372590985e9.29.1735830776258; Thu, 02 Jan 2025 07:12:56 -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-4366127c4d7sm454232475e9.34.2025.01.02.07.12.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:12:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 02/10] qdev: Implement qemu_create_machine() for user emulation Date: Thu, 2 Jan 2025 16:12:36 +0100 Message-ID: <20250102151244.59357-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org To satisfy QOM containers design, implement qemu_create_machine() for user emulation, creating a 'fake' machine. Suggested-by: Peter Xu Signed-off-by: Philippe Mathieu-Daudé --- hw/core/qdev-user-stubs.c | 11 +++++++++++ hw/core/meson.build | 1 + 2 files changed, 12 insertions(+) create mode 100644 hw/core/qdev-user-stubs.c diff --git a/hw/core/qdev-user-stubs.c b/hw/core/qdev-user-stubs.c new file mode 100644 index 00000000000..9d481a61dbf --- /dev/null +++ b/hw/core/qdev-user-stubs.c @@ -0,0 +1,11 @@ +#include "qemu/osdep.h" +#include "hw/qdev-core.h" + +void qemu_create_machine(QDict *qdict) +{ + Object *fake_machine_obj; + + fake_machine_obj = 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..0f020fed1df 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-stubs.c')) From patchwork Thu Jan 2 15:12:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854654 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822009wrq; Thu, 2 Jan 2025 07:14:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU35LN5ElchuFdutOmUn8YMPZrh7kFuREXkVphXQexUpFwOzqPIPupqNHw5m7x7hvuKBQCMow==@linaro.org X-Google-Smtp-Source: AGHT+IHPFP7Y646opnWYFjVCCrbPmB9X/UVvXWWk1Mb10/nUJBVYyR6awB2F6GMv526t0BbiRbgQ X-Received: by 2002:a05:620a:2699:b0:7b6:ea67:72d7 with SMTP id af79cd13be357-7b9aa91e356mr7567872785a.1.1735830882999; Thu, 02 Jan 2025 07:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830882; cv=none; d=google.com; s=arc-20240605; b=lUTjd1yP88eyqjj4PRQvu8YVswcNCMZ2EiwEKyb/GfZAP2XRg6tkLEJvPh7IITV1XK GUusQ//zCZCNjpcKE0UdQ4sl+jinl/yhDK9JtWDzZa08d889+pccRM9+xbIvY6C6ffIz W9LB4lUdQZoZeI77EqQ/54fpUoZvE9YbhTKbRnnaFZ5YWjNsklJFtKW6hqxGbMNPuv1U Fuw+71c4qDMkhMjl/xgSvPlI4YoabKL0AM2m550HKDnxBCfzw3BQwg9Kd+HdL/0mRTTA D5VVTKwm3mqcMr9HlbrylQH53A+P9y6NeqTbl/Jra9kzi2IE5cN4QKBBoQgsR381kszb iSpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WJKhnsw6sz3wiF8lOKV7uw4NqCWo3JxX8CcFZUizL7g=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=XqWlT+MGssuk08/wnElDWb1BmZjCnqHALn9iReivF8DNnORf4trVuJOYpozqpljzhN 1TF88OSXZp0QVEjH0a4ReN8NRFGcUbr5z6XQszu2ac5jqm2cLPhYAsO0dElwXDP0XBE9 rPwmBSGo1w28M9VpZkZbtFq73Qom3roPOCCELno+igdNks32XylqrdfMZPet+srjTfIg JbRPUo5zR9SxvaduRxPX6w4y+N9qJ+fvqP91p57AU/+74DTPyNcpWadBgxQd9hViUgSo uXQDlKxXzKWdx8dwV6IKCymfu0BqbzW6GSNMBWqcNNxQXTJVGPRV7SZoSOtv3hiB0yLc ngmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NbYniyuB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3ebd7487si328712101cf.572.2025.01.02.07.14.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:14:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NbYniyuB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMsx-0007YG-JS; Thu, 02 Jan 2025 10:13:19 -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 1tTMsn-0007Vc-0c for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:11 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMsj-0006Vo-0y for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:07 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43635796b48so69502665e9.0 for ; Thu, 02 Jan 2025 07:13:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830781; x=1736435581; 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=WJKhnsw6sz3wiF8lOKV7uw4NqCWo3JxX8CcFZUizL7g=; b=NbYniyuBq9FrWTpjvs576Yj9/lC+HRCsUB1V2Xzd1H3PPFLz091CUAfC4ryXNz4ItN ulOoh8QhBEmXXCXa949PWktdiXyGBX5d/0JssP3xB/cByLRbHvgshSorkKCzxtkflOCN nYgPztLe9cGBouP19BwX+pUrkJKJCWKBdW7/Z8UEN/iSS4K9PYeffiX0ytnDMCFcCPyx RgzdtTZvO5DAea+MwhHVIW8JfIuW/nM83dU3vxnfsn5M8i4pVpwzyImU3kBq8koOqak2 PklxtWjQYLD+qxkZz0UpPlOwBUILilD63gCqBWJsEHoAZPABsWDVvtOnrS4xvUQFPpMw npSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830781; x=1736435581; 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=WJKhnsw6sz3wiF8lOKV7uw4NqCWo3JxX8CcFZUizL7g=; b=O5mnZHOIs4A2+AbTB9ZeOGwRIvZb5yJGtrnCEfomX/RWxaAyW9J0+nNdkb+/1shWCC QDU0gJd6QaEV60OqodSzmiIxiOmx4AyAnT8QwbzHIkQB2qSnsWs4Zoj3krPnynGgB9vM NAMP6rhDkpU2+SFMaeK0EMiWPpkvNI5fW7LCThMXKmZ0Wu2+HfMozE8enxW+olYdxYzV hmJyGs6LV/mN/5/2dKtVUJuqHlfDuNO+07H91gdoZ24UBDVvQR2z0ZBGTS9AAZb+pIEE 3bf/ADIswIcwMtcVbFbYKvFw621o+HeUawiy1Jm6rMBUfydjlfF26COzhmunw4ZmJrqY jFWQ== X-Gm-Message-State: AOJu0Yy+rUPY3aK6fY1gDFmCnRtRRyAhfPPt+6vHtszQAkG1OdnKin1l Oa+ryr9Jsyyo61v5Nmh01v6h7YvMwYIw9hhKWlXQrxgvUFwvuPqeyuIXLYhRJCPJWEQ06Oy3iLI XlgaG3g== X-Gm-Gg: ASbGncttO37CMF2sagIULDDuXmQbsyBDsy+HCBPQfhFsXnI5MEsrFsQhJeT7yFPnCCU KFDs0BBYxUFY6JGJ0WymEGHqwNy95fAj2FwYQnKx8ic92/Ljc03z+PgkG9J0DO0jcG9j9pBQ7iL UnwajyiYqIAjHkOFL61UlUOYoJy74hbJkeP43USPe+pzDdM1VgUurgdoL3eyIkuNK3t4R6VrKOU P7RigwKLgkOUzqHeNh2JaDWyENQRiy0ldHj1VNUJ6myBT8hJEModCw7KBjRKZV0ZluRwx+6p11X 6dW53Z2iJFOkQ6iK/BF0l0LqgB1Xs7Y= X-Received: by 2002:a05:600c:1c20:b0:436:76bf:51cc with SMTP id 5b1f17b1804b1-43676bf5382mr337631465e9.12.1735830781091; Thu, 02 Jan 2025 07:13:01 -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-4364a376846sm459330385e9.0.2025.01.02.07.13.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 03/10] qdev: Call qemu_create_machine() on user emulation Date: Thu, 2 Jan 2025 16:12:37 +0100 Message-ID: <20250102151244.59357-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org For system emulation, qemu_create_machine() is called from qemu_init(). TCG accelerator always calls tcg_init_machine(). Use it to call qemu_create_machine() on user emulation. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-all.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c2565758876..e18b0c03f71 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 +#ifdef CONFIG_USER_ONLY + qemu_create_machine(NULL); +#endif + return 0; } From patchwork Thu Jan 2 15:12:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854656 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822110wrq; Thu, 2 Jan 2025 07:14:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU73k6ldfr39KNkP301omJuXv7xkspBDl4SbOV/oBgWOa3Lq5zpNvc308X8jGucAImvBm6/GA==@linaro.org X-Google-Smtp-Source: AGHT+IFS9JZjhF8I0i040NUFl49yOCo1tQDdO9thDTsRfwIIiRgRtdp4ZCiKGNuiFlnRDFkkUQbo X-Received: by 2002:a05:620a:1a9e:b0:7a9:d14f:2374 with SMTP id af79cd13be357-7b9ba7eacb9mr7624724085a.44.1735830894074; Thu, 02 Jan 2025 07:14:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830894; cv=none; d=google.com; s=arc-20240605; b=QEoVbm0LHgtYc67kchBBPrIszy3U21SrpCgH4VoXy7fbW46/uPGWBHuwfB8H1JshEn LQ+/a5zIr0Z1e9OMBldBrQGJuofyJcc1Ocoqmn+WYm/Z0zOzTJI9fDuB3DIRJxtKCGyw NEw5fl/kwEZPo7JCnRHNfjfq9JOhOvRsjk1py+TJD002NdI00myGwvToZrJ1lWF7tZb+ e8rDXo5yO+zYZ+zaMB3lPqCb+7WWCRqd2t58fxXLL2RE8QUoumaWrE6uvF1FFpBB/rFB UHVFWaqbpbA1CktpRWi1sl3ZeC/oxdJ+s3kq2ooWCsxgLeyL2OXYipmNLuGCOffwFU5V HKSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yFrtobX5dEs1+8eScAKkWEL068+5vqZlHD9HfY3Xigw=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=Fhqc1qmNXt9/VqIyB6ku1Rs2JBen3sn/f5FmIBdYhDg1HxDJkS8SIgI2UNtCqQX/pj +le+EnHf0CMHwjXxHoUdM4rjzTLmXMtmxvZJCCzHnmrLrfwkclVRgqHvpgZt7cvIMlNA hT73zahNOaJ3nsXpSb2zj2UqZQJwVwMFU0wOKJjbRhLQyH+vuiLMF819rFtrZHxxXft7 7a9CPnaZtiy4O3UEngz175F19JNla04j+SBsQoVah5p7m7uB2MMSyXRYLMnVK+uPJ2s8 qMZAepXinPfYOmD4IsuzG2Bo7NzUHY5Ik9FcJZ3lXAWhDT8ceT11LvosMkcxaDF2ONMR cw5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PetL/AN5"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3eb99231si371210831cf.274.2025.01.02.07.14.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:14:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PetL/AN5"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMt3-0007Zr-2C; Thu, 02 Jan 2025 10:13:26 -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 1tTMsr-0007W5-7Y for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:16 -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 1tTMsm-0006WX-Ot for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:10 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-436202dd730so82200315e9.2 for ; Thu, 02 Jan 2025 07:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830786; x=1736435586; 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=yFrtobX5dEs1+8eScAKkWEL068+5vqZlHD9HfY3Xigw=; b=PetL/AN5Bt3ZQ2hWaDxfJUVCc4KTERzx7mPTyVc32cwDjKFWdAEaooDPeiGgEGB+Ai fWpFyaCKO/03ijk+dvKTArUg/stnWnPdLrqKaReumPSlZpozxI7ERjHnKQdP/y9Cz6bi Bb+Y6LjIMKabcDCY/H2LeVip8uTpV3JXL52U/q5FZFYAg7RvKlttHb7ydavE1fkyEViM UhbliJYQt1MB4kSfKJlfEVtrvgMcRk2VUYjlmUeOSZW8Z1fToToRXmbNvK6FEmiIxrKi qak6+BsnYea0eCzxIVsEdTCwkCMNT7dgprxirdiuU8SODJbQQCNo+LexMtFBhAK674wm YyUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830786; x=1736435586; 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=yFrtobX5dEs1+8eScAKkWEL068+5vqZlHD9HfY3Xigw=; b=pY7PcHocwA/OfufrE9fQ+5uY6zEW6M/ZLx5kcUROu6cuH9aX6fZLR1IlMYQD6R5Dv3 nksFMCpHgwai8pYbNqi8pmORSrJNu251e/s/bgBx35s7pG6Kw/NybiICR9cxxvCuE3UB E6q0pbNnj3c8A33u4/LSjxHftTBv/+NP6GsjaMrD6ZQc/i5rb3Z5b/DDT9CvSKaqD2nP IT7kqlq+kxyeDKWkLklWCVhkeqHTjo++ci5B7saoE0H4lFn947/unfKoJ5RC0MiHi/F7 NBwcJXe73EHNC8c7rObrMFcyGNgzwp0pJDjRwjgstaYT6wZeTAPzduBsEg94qnb8dh34 C9Pg== X-Gm-Message-State: AOJu0YzisMX1bOQaAfNLPvoBOH+Ngvqs3zPBsLVxgzwGS1SfqvUvJA1f qh5Oi26giWdvHUnImlSG/yar/C3BwqR/DG6liCQ8xE627HdWSSxbW9Gh53N3RJ+t9mYuclR+ALj 8nE+GRA== X-Gm-Gg: ASbGncujTQaAM1SewAj6XdVezxHJ1WRC4G/wARp6LBzoE6XYlO8XlKOId+WRvlbbNuW wLKAvBk2o5pvgAi1kL8HKzyTM+VRDiDHYCaoJQ5KZVFUSKMShZkq19hKEZF/MbKlgRAjId7eQoK JlR4jJlY+eKhtJQEMI/7fhTgrVtlst0T6orWm0/sDWRIv2MUhNCd13H/RX7wJnLbT6k/qz7QDPp MEwitbmXtCj0geVsdC1ugGs0Bx901QyyWHKidAnHLT5x9fQmKlD7pP1lD7zg8XBwRds2Q34uxxH JAv/HE6RzFXoGkFqmLUS2/lltS24oFU= X-Received: by 2002:a05:600c:4710:b0:434:9e1d:7626 with SMTP id 5b1f17b1804b1-43668b5dff4mr340379215e9.25.1735830786184; Thu, 02 Jan 2025 07:13:06 -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-43656b3b1f6sm494669595e9.31.2025.01.02.07.13.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 04/10] qdev: Make qdev_get_machine() not use container_get() Date: Thu, 2 Jan 2025 16:12:38 +0100 Message-ID: <20250102151244.59357-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Message-ID: <20241121192202.4155849-9-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- 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 57c1d9df3a7..bc5b60212a7 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -818,7 +818,12 @@ Object *qdev_get_machine(void) static Object *dev; if (dev == NULL) { - dev = container_get(object_get_root(), "/machine"); + dev = 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); } return dev; From patchwork Thu Jan 2 15:12:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854661 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822359wrq; Thu, 2 Jan 2025 07:15:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWgEev83uieE73To9hbSRrYb9t4XXNWtxZu1FrRP627FGuUWElJ7npDMzJcL/ykfIw0c5utQg==@linaro.org X-Google-Smtp-Source: AGHT+IHbdv/3s7U1upExUsV2naEMVSTe8GbUnzRQycDhThuoVZ94HoFX2ZYdN64GkUe5lm9fQ6KH X-Received: by 2002:ac8:5f87:0:b0:465:2fba:71b5 with SMTP id d75a77b69052e-46a4b13d908mr816968901cf.13.1735830922264; Thu, 02 Jan 2025 07:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830922; cv=none; d=google.com; s=arc-20240605; b=aHTEjGRSGHwogBIXOtlJ+w8E5cmTa+u96Rw/NYe5ftdboH0KbokvXSord1YElV91ZS unP8h784hG/AJVy3wbbrVuxThOHZS33Kn7QMlRwWPfWm65dn5E6ge2EGhQH1dJqFEhR8 wTLikk+TIyCOKNwsfxh4ctQxyru7ArrDuS2q//daQRYRqd8lwEbvl2E1p+mU/PH6/UQB SneG90jK8U03WJOmz8xLuqe6kGwUuUywADgLDbblAoKPPN68TuAhbnWZrLCK/MtonHVP 729yw/cJSuWv/BsspfmetXnIn6lAPoSBw41sRSLO37u3ZKVS+tRySBS229TIBrddwEC7 32Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Iv6ecKkSpnKeosCOJXavZ4qKTQvySBvi2gGLMbLWDu4=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=Ce5jfFnwIZlvNGKmvDpuA9MZfY3nhV0H8IT59ukm0GLPSJfAwIWrQsLRVMjtBx6vS8 bm6ZIhSWABqqA3rJMkuVTOwdjYUj/4ZDq8NJ0AGxv/1hplkMjEuzJc+4dOEfG/VAJ2pC Y/HcrNVxrm4M7wCkMZlgtvSNI6mH1i8sPREKRhziBlfeXm6OzPykqDeczFWo19yWpMhG XuJfkJ87tenh4XDigpwtfuKyH3jdxD7ZeSWm9siYzG7ISgqquISN/azr+MXffEpiW5AZ O7ccJ6MrOJlvtnQfw8PcZASnfYWkQonvSOtI0hCivaRSBZ7bLtTZm6KOGuEdx8UmHIj1 cLfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGatA4SK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3eb9881bsi375899091cf.338.2025.01.02.07.15.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:15:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGatA4SK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMsx-0007YF-Iw; Thu, 02 Jan 2025 10:13:19 -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 1tTMsu-0007Wg-87 for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:16 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMss-0006Xn-Km for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:15 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4361815b96cso75437525e9.1 for ; Thu, 02 Jan 2025 07:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830792; x=1736435592; 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=Iv6ecKkSpnKeosCOJXavZ4qKTQvySBvi2gGLMbLWDu4=; b=IGatA4SK4UFD1m3ScgBNDMXscrUvzQCOuDG5wQ6WssnKiTSnKO8zSiS+aWCCfyqqwX HrPDspB5XixWt7zEhAc/VQrgmWQweYZPgMFkXcpBTOmSk+5cG/hXJTqNEy+YW8f4fuOf 5xkhZBlbmqT6+uGN6NtSitlVYZLQriHBT8BvpJoVQmcwTa2yBCt4nqIcfnreaeMC4uQ3 38L5rC6VxJLDe5EOdEsO1TPdU0GZ82Qj1h1mBD2UhGDfE+6qN/TBD4WnKsftcI8r7Q9S 3GiTvN9+QJTPWfHEeQTIvUdix95v3swyWJ+V+O519LX9kIO/1+vdKHhSURzOuPRSQmO4 /0ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830792; x=1736435592; 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=Iv6ecKkSpnKeosCOJXavZ4qKTQvySBvi2gGLMbLWDu4=; b=a3QOlLvpfWSdH+wIZ9BLP4isjmuJ9Qb8Cy4Kj/GPN6UqbmI8gwX+7/WIPvqGs/pbTh YHow9x0VP08i4ktAbyxRUtw7ciqKZ6wqbBM3ZH3uoX+WmMkhFZKaI6la9qmSPcbtvt5O Uwfe1po9nwx6rDjV7v2DHUN5sXaz9bIb7xzX3tKWbg/2TsWDiquS8Fd/6BGalE7t2jiV eut3uhMwUHvUkFJ9LDpeOLn8npQlTKiFvuuWRUU1VOH5WOE4tDsUoKoc5H4267kks/Cp 0uWNlm41qlWB8vvqUIdNWbZYgwT3d81zbV0t+1cxzC3+57awUugWjDMZgN75QWyV8Acy x0wA== X-Gm-Message-State: AOJu0YyfW+jWoWiZghs1dnpX+l6fSia6eYjUGSiBRWWhEUadJ6lnhSTn fRF9ynUNbQY58OgVcMEgx4AehABdCrDpSAKEs8zaTucEIxWXZI6XIQXXb++jWpLU1kpELjQknx8 Gtgrrew== X-Gm-Gg: ASbGnctinmpKqJn8eJHlPb9N60TMNQYsy7ufAbQzvhcX4JIjttvjenckMo0DMZ+skHW /a3/GM27zU7GydH/KrZnYhLD4mMUmI7C9cTY6njbWtkgtZyC06ZYc6ca52jDUm8fVL6zo2gwh3n tx+uteTm88evrx6nDLiXzAMphL7tmZh2WipB45rqSCnPrz5UZLd4GSipoQu0EKDTRQwUfLGj1JS 8NvMizXxJUOlHP4xMPEc05qwE28j26DIaY5SHXjQOUHNnLHZqVOC8vBU3xnmXtb91E1W4gvvC2n AnHNcr9B/R394Hvylyh9WCF1ySDf40c= X-Received: by 2002:a05:600c:1f85:b0:434:f2f4:4c07 with SMTP id 5b1f17b1804b1-436686464d9mr427504785e9.15.1735830792360; Thu, 02 Jan 2025 07:13:12 -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-38a1c89e219sm38820123f8f.84.2025.01.02.07.13.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 05/10] qdev: Add machine_get_container() Date: Thu, 2 Jan 2025 16:12:39 +0100 Message-ID: <20250102151244.59357-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Xu Add a helper to fetch machine containers. Add some sanity check around. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Xu Message-ID: <20241121192202.4155849-10-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- 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 bf8a0ee6486..bb4b085c9ce 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -1027,6 +1027,16 @@ const char *qdev_fw_name(DeviceState *dev); void qdev_assert_realized_properly(void); Object *qdev_get_machine(void); +/** + * 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 bc5b60212a7..9973e029ffa 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -829,6 +829,17 @@ Object *qdev_get_machine(void) return dev; } +Object *machine_get_container(const char *name) +{ + Object *container, *machine; + + machine = qdev_get_machine(); + container = 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 != NULL); From patchwork Thu Jan 2 15:12:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854660 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822341wrq; Thu, 2 Jan 2025 07:15:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUDBRkJNSpmJTvZk7JNw8VMbsQ2eMTfx5G6sSKjBMNDdJTzloSW9YVFVhQk0i3BtFXrU/IJoA==@linaro.org X-Google-Smtp-Source: AGHT+IH0RY6cnR+HtVqnTLeIDx2mCJaWJx0lpRKmcUjVzcMGfk9OnB8EI8sXS6lql+eYA/2PITm6 X-Received: by 2002:a05:622a:5c6:b0:467:68a3:4c44 with SMTP id d75a77b69052e-46a4a972791mr880179111cf.39.1735830919587; Thu, 02 Jan 2025 07:15:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830919; cv=none; d=google.com; s=arc-20240605; b=RGgr8mhyT5BD9Xm1ezYwh1uiLHYjNTd+qmMhlkOK1p45at0lzSRkK5PvZjwZ9pEgf7 jWdvtEZcxtsvrjkTy90ZOUqtGGIxAnJQf9p9fxotDvgd/Qrwu24lP+FJbzrLl7Si2Js4 BgCDjJPaMG2InwdXTuD0U8z/rC8OfT311mNkA/hPhTu9Nzot/qtPVKmnneRPcLc+RqIb MPYOM2IutHA7rtan2dYIXBdQ9x8ImNaMsGdnds8u5a1MGC95gqmmRQIwGrr+mF5MSJvZ NslGKCKbyOvtXB3Aa+6J5k0SdTjiC8ooWvcCKDsSkJ8EegcpAMip3qQQVdnse7x0/nt0 2Y5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wb9ty/L7SGv5mOgc2yJsX8rO7EAR0vJUf8L2DSwFBvo=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=BYXz7IK1RqebdEpFB9VeJU/53QLKIPSdo1TKINe6CcQPQ5yEX+T6Z6mqoz/tvJBRii Fi2JhikEAU2VO4pIHcyjusa+42My0MEVtLQvFmCl4FCRrdRzSWDQbr/y6V73bnmLSH13 fl8e/A6wigDya+AQfWS7hhKP8D+ExJT3VfpFWGphygkXmJM9Vrd6E6I8XLHZOhgwt6e3 1y18QU4Yb33zvm5+wO5EmpV7uDie+O2/kz7B+uiByJac6z/0cpxHW0soeS3++jI091l1 BjDzBFPvs5hTrojCEm8vwFqJiv9Y3yC4R0yFdayvxPy5OelTBKC6D0Wxgf24nGn0Y+N8 Okyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=shQx5dL1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3e680e58si336768331cf.50.2025.01.02.07.15.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:15:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=shQx5dL1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMt5-0007aF-9R; Thu, 02 Jan 2025 10:13:27 -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 1tTMsy-0007YS-MU for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:20 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMsw-0006Yp-Vc for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:20 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-38789e5b6a7so5786103f8f.1 for ; Thu, 02 Jan 2025 07:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830797; x=1736435597; 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=wb9ty/L7SGv5mOgc2yJsX8rO7EAR0vJUf8L2DSwFBvo=; b=shQx5dL1DN0FYhvhk+JgiVBaOfKzKnHC2pwAE2ybf3MctUdOcrWEXn1//qOuz3YJ45 7g/glhxJgCZRLDHJ6iqxXc7/6lwpjvobD5Ke5hUgyDsyWDLHr7JHo8Zb7L0bDxuYnwT/ 3Ks2BpE2K9ui4EGJzslORuqZsRqj+3TTA1L8O1cBV7LiwPAid0xHo/edskxGS4geSPhl 6429JZOqj7HQl3fnuRJ4DCqkN6Z1BQnTzEpUIYsIqSVNtUtGsIRLaS7MVB0jleZcXltM SwpC1qoN9p4080O5GjO3FH5jR0ZbU5DdtVaFxe3zXwHx1fblI1yw4HgH9pj57edH1Xyt FB8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830797; x=1736435597; 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=wb9ty/L7SGv5mOgc2yJsX8rO7EAR0vJUf8L2DSwFBvo=; b=pnegA0/pSnZnPCTnWNJzyP6QnQEp2fitm6dOws09Nj94rVEindwmEfYj9217DR7Nsy FgBHtm5lMiGurf7ziNvLu8Q31JqJbF7bzH1wLgFXBjLEVnlmRi9pQykHJJcghYjlFQix mF7SUoKh8w6BRoHetx7I4OKvtcyTmicnCPRcmF6x6zOsfe8Vb5I2JuYzofdooPqUHyi/ 0GDMrcdyLfZyNXRDhGxofaAD22yYZ8lNO+fFOQdET93hMoifBn5oF4IixIaMXLUyKsUd VfNJ39A88yMHt2ePRWhVWlPzv8s3WTsWO5Kc4TdCpR/fou4wA7wn3ZBy9SjoBN1ddAbr sSRA== X-Gm-Message-State: AOJu0YwbK/q/qXmR2djXGgf2TIXGbQGBJTZOPATQY6Pygb5wta2ho4Zd CiDtaV2vldY1k3GOXVE1pIAdvhV4nuovYR6kWaIOm25G03udoM6Hv1jCIOPWmLDqmp6o9IpVgnk HI+/xFw== X-Gm-Gg: ASbGncsH9ILq6UyJLJfXfAowfOb6m/EQFikUv4c12RHN6mb9ZVd84ygVtGeaWyNEGrb OGgbApOz+xmHhTKMP/SLq2lbpZu0Np7N0EmLb3P1fcwtHn8ex4k6WnJC8KNPqjXYrqzn7TM/kSx HnHXlKI8YcKSnj0eF7BBUx7BPuu9slTtpZKW5FpwDWrslF0ldQatz9+L+NE5RXdaIOAf0ix61ev KoGCGzu0/E3D0kOwsYRxw05frs89RB77CriZBxSxqEW5CYRdQGp83iUeCODby6E5JCfGdHdA1Zx E5VuHqUPXUbL89hu0VhykLFaf21X2Z0= X-Received: by 2002:a5d:598e:0:b0:38a:5557:7685 with SMTP id ffacd0b85a97d-38a55577991mr12688507f8f.5.1735830797221; Thu, 02 Jan 2025 07:13: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 ffacd0b85a97d-38a1c89e1a1sm37911207f8f.69.2025.01.02.07.13.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 06/10] qdev: Use machine_get_container() Date: Thu, 2 Jan 2025 16:12:40 +0100 Message-ID: <20250102151244.59357-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Xu Use machine_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241121192202.4155849-11-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- 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, const 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 9973e029ffa..cfdb7beca24 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 = g_strdup_printf("device[%d]", unattached_count++); - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), name, obj); unattached_parent = 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) }; /* Loop through all sysbus devices that were spawned outside the machine */ - container = container_get(qdev_get_machine(), "/peripheral"); + container = machine_get_container("peripheral"); find_sysbus_device(container, &find); - container = container_get(qdev_get_machine(), "/peripheral-anon"); + container = machine_get_container("peripheral-anon"); find_sysbus_device(container, &find); } 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) } static const char * const fdc_container_path[] = { - "/unattached", "/peripheral", "/peripheral-anon" + "unattached", "peripheral", "peripheral-anon" }; /* @@ -477,7 +477,7 @@ static ISADevice *pc_find_fdc0(void) CheckFdcState state = { 0 }; for (i = 0; i < ARRAY_SIZE(fdc_container_path); i++) { - container = container_get(qdev_get_machine(), fdc_container_path[i]); + container = machine_get_container(fdc_container_path[i]); object_child_foreach(container, check_fdc, &state); } 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 = container_get(qdev_get_machine(), "/unattached"); + owner = machine_get_container("unattached"); } else { owner = 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 = g_strdup_printf("%s[*]", escaped_name); if (!owner) { - owner = container_get(qdev_get_machine(), "/unattached"); + owner = machine_get_container("unattached"); } object_property_add_child(owner, name_array, OBJECT(mr)); diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index c844f538025..7f4a1f5083b 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -348,7 +348,7 @@ static Object *qdev_get_peripheral(void) static Object *dev; if (dev == NULL) { - dev = container_get(qdev_get_machine(), "/peripheral"); + dev = machine_get_container("peripheral"); } return dev; @@ -359,7 +359,7 @@ static Object *qdev_get_peripheral_anon(void) static Object *dev; if (dev == NULL) { - dev = container_get(qdev_get_machine(), "/peripheral-anon"); + dev = machine_get_container("peripheral-anon"); } return dev; @@ -1098,7 +1098,7 @@ static GSList *qdev_build_hotpluggable_device_list(Object *peripheral) static void peripheral_device_del_completion(ReadLineState *rs, const char *str) { - Object *peripheral = container_get(qdev_get_machine(), "/peripheral"); + Object *peripheral = machine_get_container("peripheral"); GSList *list, *item; list = qdev_build_hotpluggable_device_list(peripheral); diff --git a/system/vl.c b/system/vl.c index 33fbb9f32f3..933ad83a935 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2138,8 +2138,7 @@ 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())); if (machine_class->minimum_page_bits) { From patchwork Thu Jan 2 15:12:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854655 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822085wrq; Thu, 2 Jan 2025 07:14:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUIDQCMJh7k5bFb2FMFKDNIWxZXgCoY0Ks3rCTwwfo5SrIgOCC+ZGXTjJ2u7BDTc8ilanssJA==@linaro.org X-Google-Smtp-Source: AGHT+IHK4FvdLPN87DF2Z+/VwhRrbFPlCs4ZJVHk30+xh0HdC70gmdC6p7vWD0YmcHpSUindvo2A X-Received: by 2002:a05:6214:3c9f:b0:6d8:a9a6:83ef with SMTP id 6a1803df08f44-6dd23618bb2mr826816526d6.20.1735830891524; Thu, 02 Jan 2025 07:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830891; cv=none; d=google.com; s=arc-20240605; b=F3uPqv+Q3EjGaqamsd3T5HldVv3wRCnoU9vVtNAXQj2UegLejvFYGHx5onnwhI48lZ o3gbbi1Y4jay3MoVZNACyF1mUnR9It534snglHqLTevHsQL1ae6BJxogtPfUIzitJakE 4o+OTUxWuPz2C0hEwYXDbFrZ0rmfc+Y7XWxDd8yokk7fu9mUEU74IioOo3W6ctzmT7wj Niuj0iEkqQJdxxDxWgMfKgQJqDlz+aRLBhNz+zEN8gOZq91b5D8+f0xkKjtNGs0GTOs6 r/8pgpe6xrw9Q5xdXOr56P7hbQk8gM80Cm+AdEm+K5xz3MMLDS4N03hH+6irM5bBmO2F 4kwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mOzPkO5TmCycPZ/aaTUQEr16ldzePeyfEU/CMbdVIug=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=XNRKE0yjY7yA+EOTThVKR3zr5FZfjCMRtN0kQ/IBfBmj717piJiUJIX9rEEtXoDlRX yIhC8bY/2i0+bFRTxvkHHBsv1gykaf9BvOG9PmpLEzFfcmnVR4j9nJzyxnfCi70+n6O+ axPT27rowYae81ZqGT+Yr0N3FMkePHk2LCBDwPM5lDoq7EtpZ+u2j1MECvscQIr0q87+ Eb4Cl6a9B7irTeGTv5fMAAXeMbhD6IE149HZ+k9NwAcpwrbXjgh2NVKvphWrCFSllHK5 LcOEAzp5GfmsOvPRTJUlwFk5qrpTgoPO5GujBupNdOyTI/DvJRywa5QpGBPsOcswPWYs 46JA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SsK/aAoE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dd1824f132si371298886d6.295.2025.01.02.07.14.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:14:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SsK/aAoE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMt8-0007e3-4Q; Thu, 02 Jan 2025 10:13:32 -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 1tTMt3-0007Zt-8h for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:26 -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 1tTMt1-0006Ze-RJ for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:25 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so114287145e9.1 for ; Thu, 02 Jan 2025 07:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830802; x=1736435602; 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=mOzPkO5TmCycPZ/aaTUQEr16ldzePeyfEU/CMbdVIug=; b=SsK/aAoEEiUkSZB/b4u2s7wDXRx5D75mrVFZEaHTh2pE75Hq77DPt1nLSI40rxPmC8 4pl+swDT5NDXpLuDEvQhY24po1TngoIhHPOz936E1p18dFJYXrRlGWyuBQl0fCa+BfoH Vbog02EU5Y9iwpdXgxOu2q0Rril4+5clIJ3B6x5YnAO1Gyqm1yeC3ZjKct7DR4MjgFiT yp+nEEl0wIvSiX7rI86/u1525YkmkUV6KZ9DoLUr113es4NyRP6T2GFJM7BuQcppg0tl /tnoxzh6jvrfboEBh7E5FaRHAJC79nNfRqAvH+UcAapHxZ5nvWxUR6D3BiN0NxCOtdZ8 70Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830802; x=1736435602; 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=mOzPkO5TmCycPZ/aaTUQEr16ldzePeyfEU/CMbdVIug=; b=Usdo2+gYV+Tbhb4XFnNZ2w5XMTN0aGCB21xuq564ktZGvCvMmuCEEFTm9Cfk/IWk1t n1qe4FmB4r1278uKoR7S3tMmrqp/UuC7z6EH+BI8rytrBaS05urzcJCrZ7UwE8qjyi83 Gamx+3+dKd4L0syDXb4EJJLMzXsPhryfk2HUNAedIPPDMDslhb8ut5YcsUpdlvGZvPQL xB3HXn+Uq8hLbJTthAKZQ4T7dHJDvXjeX0zZhi2jTF1mVDL0GpAwlXJJqk841RKObpxJ ntokpzqYt77w56bZ1kyvlwGVgQI/kz1t4+VNo/oH1mhFyoIp1ZpgDcvu53NrU0N/GBWk YDLg== X-Gm-Message-State: AOJu0YwVvyGOIky1iYESK9n/ybvaddMZJkgk1jqGJ/UU9uJgTc9YwvgV 2PnoRugs8HhPDAowtYH1GG84HBfXl5bJkz9gDQiEprB9gWzsR/qvxIaKcKNPGmtXmclc1nfKm6h cMBmqmQ== X-Gm-Gg: ASbGncvoAN2BGDGe2wArvCB9JvIiSp3O/wZA36TtieP0FS3NZNH3+1415seqU5z8SPQ upbeC2uxVipTLeQSiH9Bs0BsjSgFQfmrECN6W68sUzvL/llJkli5qhUK4D048ODIM1xbIxK3VzE wUjb9AjwGQgQd/GhB0hWUXu24gfIV0ANe880dl8BI+/rj8rAJkDhX6qbmEm7kL9ohBzfBtxL08J o6+dMKWF4c/5jXZI1ezgjodGUqWTq6BjlC6YL87bzhDwEsO9DicjYXvz+EJPu+grfY6oQItDA9n fjAjDDbnIcx8OSGOuMKpkY5tpK+3+Q4= X-Received: by 2002:a05:6000:4b0b:b0:386:37f5:99e7 with SMTP id ffacd0b85a97d-38a22201897mr41198827f8f.33.1735830802090; Thu, 02 Jan 2025 07:13:22 -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-38a1c89e357sm39397475f8f.72.2025.01.02.07.13.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 07/10] qom: Add object_get_container() Date: Thu, 2 Jan 2025 16:12:41 +0100 Message-ID: <20250102151244.59357-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel P. Berrangé Signed-off-by: Peter Xu Message-ID: <20241121192202.4155849-12-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- 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, const char *name, */ Object *object_get_root(void); +/** + * 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); + /** * 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; } +Object *object_get_container(const char *name) +{ + Object *container; + + container = 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; From patchwork Thu Jan 2 15:12:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854657 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822328wrq; Thu, 2 Jan 2025 07:15:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXhVH3jNHk/lgxVNsGAVeFNaFOTnuvgRFHQ8FTL8vDYsTTcfdnlTyDs5pP1crcHrhCe4/OV3w==@linaro.org X-Google-Smtp-Source: AGHT+IFal7gnQzn1N6SupBHlcuasYPEJ19ax0A3RYMWntcgCI97Z+qfaj63oDvVwwGMHZDHjuDMU X-Received: by 2002:a05:620a:29d3:b0:7b1:4a2a:9ae0 with SMTP id af79cd13be357-7b9aa934631mr8085613585a.9.1735830918705; Thu, 02 Jan 2025 07:15:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830918; cv=none; d=google.com; s=arc-20240605; b=AAzSQjFCBCcka4bDz/oHgOfYD3B0T7mZKpJrMjpSSn4ffFY6HZ4WoMfIfY1dQafoE6 w7g9Gd8sqDRCE4nNVlmxNq9NgTXnlGO+VCZyitq3SC3Lnt8Ljb0pJVSJHv8Kehm0RrDi dIrtjQjw5praoXa4gJjzXau4R3MJdndUaO6jcjYPgujZIyq6T1zU1tfbBdBRvPu5cdfu OclUENYNexYX+Xln7xyTl1JZ+7fY9GWIEqQ4tgg+6Q6HFDXwHCJeIZMSZquD5N+C79Aj JP4uZydX+Oc3wR7FXXwahGqT3NSlrBijEE33A9ekOlgZQvs7yXGUSqAMD2pVsDmMiF2H 97cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4ko8bxyqNd4qTqbyGca0rSHQuh29/RSksetMq0xif/o=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=hcUbfH8i2X6nxp7jADaLIRSSopZc4V0BBjg2fc7nbD7+deSAdellXdeB4Ue+nfD7vc QT8PT4bcYzXiT8f8pYkT9MSsDp6XKKXnwTfvXDom+FyuuCvoh+z6onYHWX4uyrAQoCK6 v+K64EPynjfXJeREj4l9eH7QuBRLnAL0k//recoHar6EOuJruHFSuxPd3FrF+GIhT8Zp 93HLGJ7a3YrTz+ZcE3+/gbOTj5PiwZO39TfSEx9AdLh934fFdIY91vkL8Jlu69IEaQ/+ zCE5ZvQGKb7DU2eox7p/Dd5TCzIeXmidCKi4cPdOhDgH0eqzqZUrmaVFyFloikv4lhfP KHyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYKHu2Wx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac2d0db1si3548018885a.204.2025.01.02.07.15.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:15:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYKHu2Wx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMtJ-0007oK-77; Thu, 02 Jan 2025 10:13:41 -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 1tTMtC-0007fi-36 for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:34 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMt8-0006ae-2J for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:33 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-38633b5dbcfso11058474f8f.2 for ; Thu, 02 Jan 2025 07:13:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830808; x=1736435608; 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=4ko8bxyqNd4qTqbyGca0rSHQuh29/RSksetMq0xif/o=; b=EYKHu2WxyvQERoJCzsYT0RM3yejwYlDs2KSJtcwpbEJ3ESvXME5vUXBT2IOfAKyvZx EKw4h5aZQei74DREPtk/okV2D+IOikJKV9CfAeIr4ealghlukWnooss1uFsOtpIlaekd ciswDD0NvkntWeOvDI6pXXeMK1ljjwozUL7HL3yQ9ktZipdYoEXS8772rwBOo6TGOlJY J+mniYdfs7MLVhXNMAg4BDBZ4me6wL5ZcMxZyg1GnA7eDeE/7t/+6Npf1ABuBy0TG+Wf OxndqBJQ78T1h35YATkAPySglxf3T+PPMTRMKql5mjSVMS8pVwYgyswj0OZyibkjsvWt YIFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830808; x=1736435608; 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=4ko8bxyqNd4qTqbyGca0rSHQuh29/RSksetMq0xif/o=; b=NajY4iKO1Hv8iRDOfRdhcEIPMAnIMI+y9scUkhyLsCZ+UI5VdNOWoctfhvhuzH3AkW kNNVPl8BTNx0CxhB+ng/0k/F0+5st4X09RxWXk2AYYbg7aL46rJ4oh47FXucU3QVGPtW Wt1We4+GQe+AtQOzGrB/XfrAupLKXzXDHnWWKuuzx3LHAKRsD1sEt1+FjIkESKx1pH4V GX6O3sCgJr75ceLO4AVYgw39ca8TcNf1EO5FxpOcSfvoP5DgM/abZRKy55Mu27RscohR FslqI8K6br0JBFSmXu80kxM6FaxuhVVDJRBvxcMhinth748tPmjreFBWpyxpyq63SEX/ ah6g== X-Gm-Message-State: AOJu0YwLz3xPdBckAE0LHoat01wepETvg+3MULg6OGijXndmwjvpCvjP TLw/R9CXCCEWGXU8C+i+KIoTgBC5FF6D8TJ1rC2fLf25mXN0AzvEW7XRUiKDWHkekwNvae6qWcT 9IsrNjA== X-Gm-Gg: ASbGncvVGmBdWC7hKfqrMj5/gbDuWssaGIBTe5td8c55pJe1Vm3dPsT+yfIJuxgyy9p 5XpEOK3Ds4240heVE4B2OXURrsWsRMOGIzAuWvfls5d0X558oKGwFOuAEZEAWIreKVCDtGbTU+d RR1lBp4xrjT76ueiInudNfGEgU+t9jWP9dVgpa/hUCajsTlakJ8gmw7etqYn3NqXJxKQDeTFkS6 TqAyUQrhp6ZOTUovdoMbYgzgrVkyc8Tz4d9IremACxG8Z+iRjRLdHERpVtmh2LTuLlwzYSZ+wRE rz/Q7EDZpXHUa1E79c6GFgCRbPq/VA8= X-Received: by 2002:a05:6000:18a9:b0:386:3835:9fff with SMTP id ffacd0b85a97d-38a22406d43mr41647964f8f.59.1735830807887; Thu, 02 Jan 2025 07:13:27 -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-4365c08afcbsm464912745e9.21.2025.01.02.07.13.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 08/10] qom: Use object_get_container() Date: Thu, 2 Jan 2025 16:12:42 +0100 Message-ID: <20250102151244.59357-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Xu Use object_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241121192202.4155849-13-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- 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 = NULL; - Object *objs = container_get(object_get_root(), "/objects"); + Object *objs = object_get_container("objects"); object_child_foreach(objs, qmp_query_cryptodev_foreach, &list); @@ -557,7 +557,7 @@ static void cryptodev_backend_stats_cb(StatsResultList **result, switch (target) { case STATS_TARGET_CRYPTODEV: { - Object *objs = container_get(object_get_root(), "/objects"); + Object *objs = object_get_container("objects"); StatsArgs stats_args; stats_args.result.stats = result; stats_args.names = 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 @@ Object *get_chardevs_root(void) { - return container_get(object_get_root(), "/chardevs"); + return object_get_container("chardevs"); } 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) Object *object_get_objects_root(void) { - return container_get(object_get_root(), "/objects"); + return object_get_container("objects"); } 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" -#define PR_MANAGER_PATH "/objects" +#define PR_MANAGER_PATH "objects" typedef struct PRManagerData { PRManager *pr_mgr; @@ -135,7 +135,7 @@ PRManagerInfoList *qmp_query_pr_managers(Error **errp) { PRManagerInfoList *head = NULL; PRManagerInfoList **prev = &head; - Object *container = container_get(object_get_root(), PR_MANAGER_PATH); + Object *container = object_get_container(PR_MANAGER_PATH); 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 = g_strdup_printf("console[%d]", con->index); - object_property_add_child(container_get(object_get_root(), "/backend"), + 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 = dbus_display_on_notify; dbus_display_notifier_add(&dpy->notifier); - object_child_foreach(container_get(object_get_root(), "/chardevs"), + object_child_foreach(object_get_container("chardevs"), dbus_display_chardev_foreach, dpy); } From patchwork Thu Jan 2 15:12:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854659 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822339wrq; Thu, 2 Jan 2025 07:15:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWmymollahS2f5UrybLOU5SSSa1rk5gL8Qa+OLEIJNeG5kMuSR78W2NBNa4Z2AGuSU/IgoK0w==@linaro.org X-Google-Smtp-Source: AGHT+IGe1qmD48sIsGoTaguwdJuZ4UUwu/GiuXCoAppZ7aosu0/kOiM4m/2KpJK2/ez6oP0sOES7 X-Received: by 2002:a05:620a:319e:b0:7a9:bd5b:eb61 with SMTP id af79cd13be357-7b9ba79acd1mr7490048485a.27.1735830919473; Thu, 02 Jan 2025 07:15:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830919; cv=none; d=google.com; s=arc-20240605; b=ZZTDaGkrnALNphWb4Nqiseo3OfooMZ389HJIhO40IMhWjo3kzb3SBBnh+hdL5dxXTu 0fdaGQAVcHfBgwDnNYOAJQg7euVozx4MyhkUbc0K1REpOrTCmbejoe54SwfWfgxw7HjT es63HvvJRyX315Ih+5iK5JLrV1b1dHHAbo8xqXr+lgZiP4rhKJa0cTpu7yoWsBKN8ugm 3ZRDOkkFc21Hlj/ScX06Qli/51TQ95sGXsk1SDohmnXCi1HVFIB/y/VBp/8OvAlvVLfl m6/UdQ2dG81kdOQbmCYhVVBVXNdZZa3Y33kMg3f6Usj1YxdycPU0yZzpVNfYgZ57bqz3 fb5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X072cNLxlYU70g0aPAnHdJmyEbpQKTIAoLkN1KVyvsY=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=JDDE4VXe5IZ53ywYpq4HvMcmH8Xq4Sa0oJcoZRhAo1C3CcQa54vmyGECcE5JPGWLbe 7QBACs7GtiMpqnanoqeQ/vUHFUQGmGE1mY7XMOtaprla+n/FyA9WlMaUCa7edrvTW/Qs epw6bMHSryRSVlGcmBVCJBPH24ddX2Cj8cR6xL9jl/jxqSKxmLlKL1OFT2HSw149eBdA QN/GQS4lJ0Oobul/R7Pu7oI4Elv3OCtzKh/1IuFX1+NbNo0tsVzOJcB7O1GA1APqfZbO 9j6H5WeroBmVfRzo+r6+Hr4eVK6mzSu39QNA10iiSdsYaAbx3/4sdqJMpIUG7d+LoLi8 bj2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EFO5XO44; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac2ce225si3492949485a.148.2025.01.02.07.15.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:15:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EFO5XO44; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMtJ-0007oJ-6n; Thu, 02 Jan 2025 10:13:41 -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 1tTMtF-0007lb-Uz for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:37 -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 1tTMtD-0006bt-Id for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:37 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso75383545e9.3 for ; Thu, 02 Jan 2025 07:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830813; x=1736435613; 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=X072cNLxlYU70g0aPAnHdJmyEbpQKTIAoLkN1KVyvsY=; b=EFO5XO44gR26r4cYHKY0KNr+vrDhzfNlxI9NMB9xhXJgYSCeOzGJ0z+LVHehVUHabw eNrhr+SHefysIzTlfWgsXLR+kctg0X4+pc453eTh8LFjd6iRKhd7YLyd4LYSj7c9nKmt jJKALFu/0o5Z4l1pFY6JA3LJSMOW3R7s0SWmRZoNt52bexWcfRdPItX2y+F+2jh0bfLH 6dXzr/knHMaKJURMO2iUT/wpOMaHOUnQSZWRQcRoQUZohKZIYSXa3RDZ0ArlI1YuBx0n q52larNPa2CGbLx2h+p4FonbLzTpwq7Dk1lytoWinoYw1DPgLcC8dUq6jsRLLOipPtCa 1uqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830813; x=1736435613; 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=X072cNLxlYU70g0aPAnHdJmyEbpQKTIAoLkN1KVyvsY=; b=f91IHZ+t7NWuXZE32x08kObrRyITrXiUHyiWfaJI5FS+lbeZUrfPuNgAtNZY447to+ Dsc7z8yk4CpzzPZsoE2pOCYxBSkufdwsUYB2hmW1bi+/NQxAMAYchbQm41ZmF/mxhclq blm4776GLgK80gk/F5424JDISWMNQ+jsqk2+GZUGg/cz5gR8qoH3tg3qCxPwbaZjqnGz geV4Gm7Ha8D3jFu0wWj7ltfj6k9AQYd3ofRAoNixJpAEqy7ovLkp9NrobC1ve49uX0Ck hSCSwflHmQf4QgucPWhfTKzyKiDE4kEd81r1NoBVBgHgxM45Kaz/JT8SCEVy+4zvv3Yv 5v9g== X-Gm-Message-State: AOJu0YyhWWL321gBx1JckmXD3c8uqLv9Q1dpg7Q27tV7ysxAviiJZWNq 8u4ujsyhCdTuPRSZxhGOjuL8KYVH6LJraxyLC/FtinsuQg1uGyj9Y4AlHDNF90/8scbV3vSJ4Bw ljlU7Mw== X-Gm-Gg: ASbGncv3zz5TX17FmMasFk619XalIXcIa+OFK6aGSIi6CLPqD+yVXtNy4U0C7XkVO/F mogUmezLHHyr9LaMf5DUvSXbPrgjF5fNeJ2dO2qeikNnaj4KwhQAeJukmiKDnjVyd+RlppzH7sX bRoYptd7BcDHc4dQuyyShkd7/UFoT/5PkK058YT4+VG1xnFGUOHsv+Gh190r3ORajzILfOcgh3Y JIYuKkT/zcEJtaSC3pFv4/N0jgErqDl6q4F51zSxJiQr29rZ1cSUM7PP1eRG8qeUb22/u5GMbOJ VcM0oRoyZYRh041O2vdPL396blUZGBw= X-Received: by 2002:a05:600c:138d:b0:434:a4fe:cd71 with SMTP id 5b1f17b1804b1-436686439e6mr414647125e9.12.1735830813541; Thu, 02 Jan 2025 07:13:33 -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-38a1c8acb17sm37848716f8f.97.2025.01.02.07.13.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 09/10] qom: Remove container_get() Date: Thu, 2 Jan 2025 16:12:43 +0100 Message-ID: <20250102151244.59357-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Xu Now there's no user of container_get(), remove it. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241121192202.4155849-14-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- 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)(Object *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); /** * 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, const char *name) return child; } -Object *container_get(Object *root, const char *path) -{ - Object *obj, *child; - char **parts; - int i; - - parts = g_strsplit(path, "/", 0); - assert(parts != NULL && parts[0] != NULL && !parts[0][0]); - obj = root; - - for (i = 1; parts[i] != NULL; i++, obj = child) { - child = object_resolve_path_component(obj, parts[i]); - if (!child) { - child = object_property_add_new_container(obj, parts[i]); - } - } - - g_strfreev(parts); - - return obj; -} - - type_init(container_register_types) From patchwork Thu Jan 2 15:12:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854658 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7822335wrq; Thu, 2 Jan 2025 07:15:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU79xpjJLZMFSNer8lPVWr8LAMTRO3pOfMCH7dTQPGvHDBigbZ1gKMLAZIOo/Y7zMUy/s5x9g==@linaro.org X-Google-Smtp-Source: AGHT+IHlNElF4PALFaB1u1vlGWb0poyPrLkzj01HfhzWaKid+TrwkPc/BW9FU7sTocxIFYQtls/0 X-Received: by 2002:a05:620a:2608:b0:7b6:da21:751c with SMTP id af79cd13be357-7b9ba6fd997mr6486546385a.11.1735830919129; Thu, 02 Jan 2025 07:15:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735830919; cv=none; d=google.com; s=arc-20240605; b=K+kuIQpd2HIJvR+Gle4EYairNRfKHDVwgiAcCDskAPETmmVsZq0gPMT69lPYjYboyA QlZSOpWBg2/gZr7pyfCYUV0r+DaT2faVEd/Kfw2ioUYg6YTdJLK8a1+FIyI2yZdrxQ4a rG2SRt3LyNdQejkVFreJ5DEVONpgr/EOpAQALF0e5pVnmJTPmrCkqmzVSOtWNANnF++g pWNCUfCaXgWo5tN+dYC1i7OypReC1ppw1LxJS0/JUhsdjPVj1JGCndtDakOhNNmP7Uig pa7qHZhpC8ATofK547i1OwBvIld9xJClLOO4oTL0LhxZvmBjKZ5M1G89eNYJ63LU3+l4 lL+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W41W/Tl402O4BPcR7bbkn9vt12o0/ypJh/X89Ny0z9A=; fh=PTspa9wvhkaR6hEChXR5orGauuRbRK309fOYTYlWOh4=; b=Y3xPNfcUshGiLszqnfxVI7aq42rOVJ2JMlS7vYDp/NGVI9Ls4cvNEnkj32etyL579f ae5G1mdLNSAoVTW1TvNjZbgXikpkB5jD+J4mUT0K5iDwbqDLwwLlIt0ReTvRqw0Qd7yj x5P8d6QxcYJpwB4ioSscdjrwp5kPnh+iRUQ5F54XaIdFNFgOkybZRwEayj03AD+TpRdE yt+v8CBtOL6se2dwTyqs/ONbRQRv+cmnDmSD+pQY5/jG/Z4M0cnDjDGuJ9cLAHd/cM3I nQOcysuEob34cxJIlYjaA3ziYklxvRsV3Ng4xr4s3BX8+ahjf0AVXrk/D3dsu4D/5jbb n2aw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uXV7posb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac478d17si3246433485a.221.2025.01.02.07.15.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 07:15:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uXV7posb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTMtN-0007pe-Bi; Thu, 02 Jan 2025 10:13:45 -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 1tTMtK-0007oZ-Mj for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:42 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTMtI-0006dn-JZ for qemu-devel@nongnu.org; Thu, 02 Jan 2025 10:13:42 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3862d16b4f5so7129239f8f.0 for ; Thu, 02 Jan 2025 07:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735830818; x=1736435618; 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=W41W/Tl402O4BPcR7bbkn9vt12o0/ypJh/X89Ny0z9A=; b=uXV7posbXSM7jD0jdFdmG0DPGzUUIeFdHx/6s4BwfoWyNz14s7TubHd5MEhawbYvYd 2YANSNCmSTK/NMJiY4uKpDr4oUgDqHCxVkUdcZY5cKSi/lr37AFpLA7+/9d3R5SabOY1 LaWo1eN1C/o6MdrBET4qOsU2D7GS7LtOvH0opwY2080vf/4LA65SgsHfVQ8PmnyCXpOh 1QTJR9kvrYCMm5aZajd8W2zI9A0jAUE+4h8Necy/TQOVdlXUZAW8ySCoc+ouRZGp7Zti 0UTD6EDTdBWYXwVDfmA1+9aUfqP6Tt0veLNGXrHIAxzi8BKGBCgywHsWDsBEVaGzEp5R N4Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735830818; x=1736435618; 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=W41W/Tl402O4BPcR7bbkn9vt12o0/ypJh/X89Ny0z9A=; b=Mh2sCdPdul1cRuWAIUARis9YdRd05ITi8QuJHjeXeRgkoeu+ocWZ1bgoo1OPja8p1a RMZaay8y/z9s18q7Le/O2y8SYQqLo2TQ+UzSEIzPpe+VYfWHxThPnFD4BLPYTbjzeQRb OMBg6Sd9CiSoYalDoZGC3W8lvPEVeY0aXS35oIbwQ5ea0aUFh7XboQZBx2yPESB/NMSS iKbP7BfngWY0dPaXvBD7pGPN5t3X8iZVZbF+m8PRRtS++iop5cSM+DexHknylp6Agb2O g9jJoxmYvogJBdssvNPLK+lQX28OH3BABvOPEk4OWOwq1N9WTDdT6bcAL5p4kJFUKPwq 3i0w== X-Gm-Message-State: AOJu0Yy1nIUdze3uOWC8xnku8hk5P92ToSL1LSTN+IPqEewIYsJUAmnq YZmgVnxyoSqwzUc3aAOl3Xcu3m6jRYwCCokLS8xJ/ocaEd09S8I95e154kMw6aWZOLkCJaJwoa0 nkim/ig== X-Gm-Gg: ASbGnctUWG8ZaMu8u0NHQjGoto8ki8woVkfM0vGckdbmdRvQyEV/gFvkwL5bCiQFHmD X3N3vVMp5H//dKzziaxoL1HpbW/sm7u5ej9LXuc7kSPf4cDJnjSUz7E/CFDJoyzdM210Xq/PvoH 40xZ/7BJjuV3PTdC5oWhuSiyuVdVILZBXZGda0zswMx91MO1q9WJplZLFxKOs7Eto/+kb9Qvis7 770JF9arjwFUlLY4C4AYqCcdx+aJBGCPHRqCQtkIFltEzm8ORQJz070jeeL+c9nJvJw/20H1x9D Hi58Iv5p2m5d2zxHvEZL9fU3u8Yg2kA= X-Received: by 2002:a05:6000:178d:b0:386:37f8:451c with SMTP id ffacd0b85a97d-38a1a1f74e2mr38158314f8f.1.1735830818553; Thu, 02 Jan 2025 07:13:38 -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-38a1c829235sm37735173f8f.15.2025.01.02.07.13.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Jan 2025 07:13:38 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 10/10] qdev: Inline machine_containers[] in qemu_create_machine_containers() Date: Thu, 2 Jan 2025 16:12:44 +0100 Message-ID: <20250102151244.59357-11-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250102151244.59357-1-philmd@linaro.org> References: <20250102151244.59357-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Only qemu_create_machine_containers() uses the machine_containers[] array, restrict the scope to this single user. Signed-off-by: Philippe Mathieu-Daudé --- system/vl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/system/vl.c b/system/vl.c index 933ad83a935..58e68b98d87 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2114,17 +2114,15 @@ static void parse_memory_options(void) loc_pop(&loc); } -static const char *const machine_containers[] = { - "unattached", - "peripheral", - "peripheral-anon" -}; - static void qemu_create_machine_containers(Object *machine) { - int i; + static const char *const machine_containers[] = { + "unattached", + "peripheral", + "peripheral-anon" + }; - for (i = 0; i < ARRAY_SIZE(machine_containers); i++) { + for (unsigned i = 0; i < ARRAY_SIZE(machine_containers); i++) { object_property_add_new_container(machine, machine_containers[i]); } }