From nobody Wed Apr 9 05:33:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1735830919; cv=none; d=zohomail.com; s=zohoarc; b=WxYfl917MrkKbfsbk6nGcynw0b/iFMplE6DNlvOmrTwEGKsTCf74f5PoPVzHSeuzHw2tgLkbbIod2KMdrXmrYKJtO1zemysv6RmwdmqDh+L2o5W0WMLDBamxqUbF/seLQVxsp97Qg3np7qxlwu5R2Aj+ajnBCPBY15yF2gh/PZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1735830919; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wb9ty/L7SGv5mOgc2yJsX8rO7EAR0vJUf8L2DSwFBvo=; b=M04WVfj5vYbxSPgd5V9ndQcACmgGwRhgzFDYDunLAegceijJii03knwVKQKqdJwFCa96KN922+DaHCXwX0HfKPwZHvUO7bt0fktPsGI8zKXq5lgigXc1wGhwVd9i1M7xNULly7s9qsVaM5zLTWI+JU3rzHT7VA4Bhp4T11jGLak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1735830919850806.5151331710706; Thu, 2 Jan 2025 07:15:19 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IFN0CvMaQUpuugfjNdtFSWX6942AsEu4HqagGu2hhuynCygg9bM5XEiibQ1pAAYIRi+5hPJew== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-block@nongnu.org, Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , Zhenwei Pi , Fam Zheng , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Peter Xu , Richard Henderson , Paolo Bonzini , "Gonglei (Arei)" , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1735830922099116600 From: Peter Xu Use machine_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241121192202.4155849-11-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/gpio.c | 3 +-- hw/core/qdev.c | 3 +-- hw/core/sysbus.c | 4 ++-- hw/i386/pc.c | 4 ++-- system/ioport.c | 2 +- system/memory.c | 2 +- system/qdev-monitor.c | 6 +++--- system/vl.c | 3 +-- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/hw/core/gpio.c b/hw/core/gpio.c index 80d07a6ec99..6e32a8eec61 100644 --- a/hw/core/gpio.c +++ b/hw/core/gpio.c @@ -121,8 +121,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, cons= t char *name, int n, name ? name : "unnamed-gpio-out", n); if (input_pin && !OBJECT(input_pin)->parent) { /* We need a name for object_property_set_link to work */ - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), "non-qdev-gpio[*]", OBJECT(input_pin)); } object_property_set_link(OBJECT(dev), propname, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 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 =3D g_strdup_printf("device[%d]", unattached_count= ++); =20 - object_property_add_child(container_get(qdev_get_machine(), - "/unattached"), + object_property_add_child(machine_get_container("unattached"), name, obj); unattached_parent =3D true; g_free(name); diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index e64d99c8edf..9355849ff0a 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -65,9 +65,9 @@ void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *= func, void *opaque) }; =20 /* Loop through all sysbus devices that were spawned outside the machi= ne */ - container =3D container_get(qdev_get_machine(), "/peripheral"); + container =3D machine_get_container("peripheral"); find_sysbus_device(container, &find); - container =3D container_get(qdev_get_machine(), "/peripheral-anon"); + container =3D machine_get_container("peripheral-anon"); find_sysbus_device(container, &find); } =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 71118765884..9334b033f65 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -463,7 +463,7 @@ static int check_fdc(Object *obj, void *opaque) } =20 static const char * const fdc_container_path[] =3D { - "/unattached", "/peripheral", "/peripheral-anon" + "unattached", "peripheral", "peripheral-anon" }; =20 /* @@ -477,7 +477,7 @@ static ISADevice *pc_find_fdc0(void) CheckFdcState state =3D { 0 }; =20 for (i =3D 0; i < ARRAY_SIZE(fdc_container_path); i++) { - container =3D container_get(qdev_get_machine(), fdc_container_path= [i]); + container =3D machine_get_container(fdc_container_path[i]); object_child_foreach(container, check_fdc, &state); } =20 diff --git a/system/ioport.c b/system/ioport.c index fd551d0375e..55c2a752396 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -258,7 +258,7 @@ static void portio_list_add_1(PortioList *piolist, object_ref(&mrpio->mr); object_unparent(OBJECT(&mrpio->mr)); if (!piolist->owner) { - owner =3D container_get(qdev_get_machine(), "/unattached"); + owner =3D machine_get_container("unattached"); } else { owner =3D piolist->owner; } diff --git a/system/memory.c b/system/memory.c index 78e17e0efa8..b17b5538ffa 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1238,7 +1238,7 @@ static void memory_region_do_init(MemoryRegion *mr, char *name_array =3D g_strdup_printf("%s[*]", escaped_name); =20 if (!owner) { - owner =3D container_get(qdev_get_machine(), "/unattached"); + owner =3D machine_get_container("unattached"); } =20 object_property_add_child(owner, name_array, OBJECT(mr)); diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 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; =20 if (dev =3D=3D NULL) { - dev =3D container_get(qdev_get_machine(), "/peripheral"); + dev =3D machine_get_container("peripheral"); } =20 return dev; @@ -359,7 +359,7 @@ static Object *qdev_get_peripheral_anon(void) static Object *dev; =20 if (dev =3D=3D NULL) { - dev =3D container_get(qdev_get_machine(), "/peripheral-anon"); + dev =3D machine_get_container("peripheral-anon"); } =20 return dev; @@ -1098,7 +1098,7 @@ static GSList *qdev_build_hotpluggable_device_list(Ob= ject *peripheral) static void peripheral_device_del_completion(ReadLineState *rs, const char *str) { - Object *peripheral =3D container_get(qdev_get_machine(), "/peripheral"= ); + Object *peripheral =3D machine_get_container("peripheral"); GSList *list, *item; =20 list =3D qdev_build_hotpluggable_device_list(peripheral); diff --git a/system/vl.c b/system/vl.c index 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())); =20 if (machine_class->minimum_page_bits) { --=20 2.47.1