From patchwork Sat Jan 25 18:13: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: 13950482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9618BC0218F for ; Sat, 25 Jan 2025 18:14:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877006.1287210 (Exim 4.92) (envelope-from ) id 1tbkfJ-0004p0-2T; Sat, 25 Jan 2025 18:13:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877006.1287210; Sat, 25 Jan 2025 18:13:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfI-0004ot-W5; Sat, 25 Jan 2025 18:13:52 +0000 Received: by outflank-mailman (input) for mailman id 877006; Sat, 25 Jan 2025 18:13:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfI-0004aj-70 for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:13:52 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 213dc56b-db48-11ef-a0e5-8be0dac302b0; Sat, 25 Jan 2025 19:13:51 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4361f664af5so35550265e9.1 for ; Sat, 25 Jan 2025 10:13: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-38c2a1c4e49sm6227077f8f.98.2025.01.25.10.13.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:13:50 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 213dc56b-db48-11ef-a0e5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828831; x=1738433631; darn=lists.xenproject.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=/se+ZOUWHI4guWWCfgPKU8ovKC99g/6LRZidVGKe1oI=; b=LRHBJHLWm7gqxXEu8WXxnmKG3n89uc5bSbcx1rG8HfUc6m/wy+Ft0El7SI79t44d8F ufbHGqNRJpjbXQknnJxdIcVYRhT9A0C6Xv2fiC008I883D6kU/C1QphM2p3Nheq+37qv 6si0JLjwGaMxvkn3uLNFL89V5Hhu0GOPOiVfnSZmnBpnEhQo9DvsVRAPac6hcR2q0ffV KDtl+j6SdFlUo+Poims3zileJZz+qEJ0sRlM+lssJGPydgMyEmWYh52DxN5XaNkPCqu9 d7erUjS01Q7oHKvM/pw6UAp953sIESOQrgZFLu6C7Eb5AVlV4Bz/xQVCUtLs2xqgOKnZ Moyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828831; x=1738433631; 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=/se+ZOUWHI4guWWCfgPKU8ovKC99g/6LRZidVGKe1oI=; b=w5LUVltpk88pQrnwXjgZGp7K0QLrpPMuHNvXGvU7vV30YGUA/gkw0Puikji9Uu33Hq TOUOtZDldtvOEWG/sDkQvYZYyWlt4D1N4yndZT8y2rbW6hO1udNHZ7VJYfAj9Llv3P9I 2H4FhRaiVZmJaE2dZWHVffiAJcEDC4mtV6FRYNAC41bsvcZ4BY1l3bYVAT4g4z0dTKI4 TpHA59DebJKHNGj5UMKevlsBqDNVHOFgqVJ540fD14gBBTYbOPg/tMQwMLRTFtWSq0Bx RczUubyl5vxyRvRbdDnR1lImSR3E4qMNDg1dugDC2zjHLKXsZIXq5koo7exf2qW/f5VF wUSg== X-Forwarded-Encrypted: i=1; AJvYcCWeVBHglOY2vDriEwI6HPThPBPPUmd23oDTJDwjMiSypEnl4nUN7O0puTImnBy1lA4iPRvUgmVHo+4=@lists.xenproject.org X-Gm-Message-State: AOJu0YyQnDdqUCilr8H2rkEXjNtCQkra4ZE9zZ4vLSDBhppD0Bb9TKW3 JTjtvHlkU5Zl/JLEfQ60TZyWbBk14c6NEw9kVVsvWNMVkbbIs0Ta8euzYrIRc0w= X-Gm-Gg: ASbGncuDfjvoKXWCnCyMTXso0CLiZ2ryRZb3UHVxug2IRLAytSaSB0lxL5+3dB8vBOl dQKKlN4N1EdIFaOtAbOUcZL/a2NKukatDKVKJblVPcrkRrcMRD2z40wt8q7C4GuNlM8GSmN64x3 31vWZ4dePZXdZs4KTlQt+ZiWebVy8ekwxlxEidljJYosTHfsKAiO+sno+qWZmhS+flPdRtlgJh/ 7BzLkFNlycCqyr2nKOgRDhIu0jV0ip8+k/wSU7pKdSq5qYGiOkDwfYpC5eUzf/RnQcQH0MyemsY tcSwKUkaQ1wo8giigsDYgDp3OXRCbDCFLtLAkrKFD3LwTpQmbcoEvEWyOaIw X-Google-Smtp-Source: AGHT+IGP2iaXKLI15CkhKDP5NBlnFOMSHwCbGSNXKLvJxawalslRdLF5wYi0CoJhDHevjTYCGWh83g== X-Received: by 2002:a05:600c:3d86:b0:434:f9e1:5cf8 with SMTP id 5b1f17b1804b1-4389143c306mr335517805e9.31.1737828830945; Sat, 25 Jan 2025 10:13:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 1/9] hw/sysbus: Use sizeof(BusState) in main_system_bus_create() Date: Sat, 25 Jan 2025 19:13:35 +0100 Message-ID: <20250125181343.59151-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Rather than using the obscure system_bus_info.instance_size, directly use sizeof(BusState). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif --- hw/core/sysbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 9355849ff0a..f713bbfe04f 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -323,8 +323,8 @@ static void main_system_bus_create(void) * assign main_system_bus before qbus_init() * in order to make "if (bus != sysbus_get_default())" work */ - main_system_bus = g_malloc0(system_bus_info.instance_size); - qbus_init(main_system_bus, system_bus_info.instance_size, + main_system_bus = g_new0(BusState, 1); + qbus_init(main_system_bus, sizeof(BusState), TYPE_SYSTEM_BUS, NULL, "main-system-bus"); OBJECT(main_system_bus)->free = g_free; } From patchwork Sat Jan 25 18:13: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: 13950481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7CB8AC0218E for ; Sat, 25 Jan 2025 18:14:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877008.1287220 (Exim 4.92) (envelope-from ) id 1tbkfR-00058H-9L; Sat, 25 Jan 2025 18:14:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877008.1287220; Sat, 25 Jan 2025 18:14:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfR-00058A-6Q; Sat, 25 Jan 2025 18:14:01 +0000 Received: by outflank-mailman (input) for mailman id 877008; Sat, 25 Jan 2025 18:14:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfQ-000565-47 for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:00 +0000 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [2a00:1450:4864:20::32f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 247d6791-db48-11ef-99a4-01e77a169b0f; Sat, 25 Jan 2025 19:13:57 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4361c705434so22039945e9.3 for ; Sat, 25 Jan 2025 10:13:57 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4c75c0sm68201815e9.31.2025.01.25.10.13.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:13:55 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 247d6791-db48-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828836; x=1738433636; darn=lists.xenproject.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=+D9ecSNssEoyInsTWPhPYbcbkHeV5ELbKuxuFIHXnAU=; b=N7dRkc6p0L9U/te9/9bQ7dDkBTWvo2AePP0WNz86xrDKWDkyunA50kwama/VhS4KkM u9WtPAyGqenbpHdjXvnlBnVtApy0uj52w5ADLHweKFC0GEOx73qNLhDOYmnJquFloZZT 0cEHqAKgG1se7H9cKre4cfNvYhR/gqs7Jve88fUaXmMiNogaYOP2MV0wipdj0/cDQGSP 1HMeU009HUK+aLfLLk+KM+vhQgsBt9d03JgQ+ENpi8c24gO+fgo0su3Zr8hd54vBW4Pv bH3rjtASmfcb6JBfB//sxw5LxW/2OxQVcfYgNh55bW/cka3jKZ2TwGDkJi9D3yQzaFZY m0Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828836; x=1738433636; 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=+D9ecSNssEoyInsTWPhPYbcbkHeV5ELbKuxuFIHXnAU=; b=oPCf0BwFQWGunizws6vrDn9aainlr4T4VSyA4/TT2mgbvtVPwHhNR5HvOkl83FlK5u k19vX4rOFB5pcB5VNVGqwZtO2aevkOz81EGCmbvg0XWf6ZxeWqQkM/HcY3r2OIMO6TPn eyEGd9/D1hzvZZfr4Rz5w0P2nHvgoRXcxSOX1d/YeW6Xj/C5RI4uJRJPPGkfgedyZ/4g sdn99oFoBr1A5nOAUbO5FzKwBAdE3fhEnuku5sPfIdGwBHYhNvaFj9AljYhALXFzUilq pqkmbiCQRWwLn8/HfL6kH0LmvKt4orbAwYx9wuwh6hKeRWw0mNzUpButWxHk/gJDmqJj 8MEA== X-Forwarded-Encrypted: i=1; AJvYcCXSxE/Mz8yNvwXdbi2ldxhPQu9oOOwFm/SEnhHUTrycrOACRpt1Z/jvuax0sJZmllVFQ+SL4zCOYaA=@lists.xenproject.org X-Gm-Message-State: AOJu0YzLjl/b5jn3dcS1y/Xy+u/veYSdOazzIeqAXOV6bI9IHVZ9pN9G HRJfV6oScHb5ep8DPopsIHlA6ulZJcLy9uc+Idp11Sgu+PPXLGj+jzJJQ9wpna8= X-Gm-Gg: ASbGncswr2Mx1QAltd1rhMTqQv0oYuR+XlqUxw0jOcHtK8TPJmRTLIACY7CPciJtuui ETbsrWoneKVVzQ4hoiSFGbib+EYOGMK2tzqceIT6sx+Jd+Cc7sfEx9taONS7sysKEA8+exgiwV+ L0HBMnWZzxLF64Sqfay3UpPaB2NgR4QQ4z73hen587qMCaoJXGlJ0YJxNR9sxHgiMMRTheYHjX3 hni7oXSmJ5BMpmnsRl67VwdWxAW/ENlG7U/ZhQShDDopZq61/j0RWI7n8XweJFopvzOA+TrGhHR bAgfFXjQP8eDvDaepsfRx9Rq/ns8fxSaOdDCPTUTGhMzLfdZjXvDSUGVHp1o X-Google-Smtp-Source: AGHT+IH3gG9oDbH+Yt++6e9axdywvxazaykwi7sr/Zo0cY2/uHyHOw51lxlnycmePra8xEH0EQ/Sbw== X-Received: by 2002:a05:600c:3b94:b0:434:9934:575 with SMTP id 5b1f17b1804b1-438913e02f8mr395787785e9.16.1737828836350; Sat, 25 Jan 2025 10:13:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 2/9] hw/sysbus: Declare QOM types using DEFINE_TYPES() macro Date: Sat, 25 Jan 2025 19:13:36 +0100 Message-ID: <20250125181343.59151-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif Reviewed-by: Bernhard Beschow --- hw/core/sysbus.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index f713bbfe04f..306f98406c0 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -80,13 +80,6 @@ static void system_bus_class_init(ObjectClass *klass, void *data) k->get_fw_dev_path = sysbus_get_fw_dev_path; } -static const TypeInfo system_bus_info = { - .name = TYPE_SYSTEM_BUS, - .parent = TYPE_BUS, - .instance_size = sizeof(BusState), - .class_init = system_bus_class_init, -}; - /* Check whether an IRQ source exists */ bool sysbus_has_irq(SysBusDevice *dev, int n) { @@ -306,15 +299,6 @@ static void sysbus_device_class_init(ObjectClass *klass, void *data) k->user_creatable = false; } -static const TypeInfo sysbus_device_type_info = { - .name = TYPE_SYS_BUS_DEVICE, - .parent = TYPE_DEVICE, - .instance_size = sizeof(SysBusDevice), - .abstract = true, - .class_size = sizeof(SysBusDeviceClass), - .class_init = sysbus_device_class_init, -}; - static BusState *main_system_bus; static void main_system_bus_create(void) @@ -337,10 +321,21 @@ BusState *sysbus_get_default(void) return main_system_bus; } -static void sysbus_register_types(void) -{ - type_register_static(&system_bus_info); - type_register_static(&sysbus_device_type_info); -} +static const TypeInfo sysbus_types[] = { + { + .name = TYPE_SYSTEM_BUS, + .parent = TYPE_BUS, + .instance_size = sizeof(BusState), + .class_init = system_bus_class_init, + }, + { + .name = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DEVICE, + .instance_size = sizeof(SysBusDevice), + .abstract = true, + .class_size = sizeof(SysBusDeviceClass), + .class_init = sysbus_device_class_init, + }, +}; -type_init(sysbus_register_types) +DEFINE_TYPES(sysbus_types) From patchwork Sat Jan 25 18:13: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: 13950483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32D4AC0218C for ; Sat, 25 Jan 2025 18:14:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877009.1287230 (Exim 4.92) (envelope-from ) id 1tbkfU-0005R9-Ko; Sat, 25 Jan 2025 18:14:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877009.1287230; Sat, 25 Jan 2025 18:14:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfU-0005QM-HR; Sat, 25 Jan 2025 18:14:04 +0000 Received: by outflank-mailman (input) for mailman id 877009; Sat, 25 Jan 2025 18:14:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfT-000565-R0 for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:03 +0000 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [2a00:1450:4864:20::430]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 27a761a7-db48-11ef-99a4-01e77a169b0f; Sat, 25 Jan 2025 19:14:02 +0100 (CET) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-385ef8b64b3so2698316f8f.0 for ; Sat, 25 Jan 2025 10:14:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d865sm6249213f8f.38.2025.01.25.10.14.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:01 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 27a761a7-db48-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828842; x=1738433642; darn=lists.xenproject.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=60AuA1WDx9vhZn9WTP7sL5YOcyHTmPSWNTPXV1fPX/g=; b=IFlm2xVQAoQfvtsA1V7yF+n0t4VdAbrIGxxDsUiOutAcB2a3fkoTR3/WbpNST1hPEd TYwZybs9iRmfjhmz6C1PGkSJ3gXQGct1y2xMS4u7nWnYRHGb0cgiR0ufF8xtxNSAEKBb yCTahB+URGpRTBcAd7XKPBmJ2Z9M0jpQt1PoOCDA9m60ECHEeyeHQuDYZGOXkcAYpgtK YdDxCarS07jWcGnWUUOqyliOISqDNFDfuqkGRfeLrlXn49DU0I0nTRN3LfdMKMdjaj/C xjqFMrRd2x3XcVhqWBxT8b3+03sNUStBhMQ+YbDnHWwKD7Gn28ACAKlIe1kNVCemx7UK fZpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828842; x=1738433642; 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=60AuA1WDx9vhZn9WTP7sL5YOcyHTmPSWNTPXV1fPX/g=; b=W1yZX1ad7GKeDOq5rgSUBKvB7XXpm848/u9g3jzwSU/dJSxS2XV9XrLWKxJv0008lo dyexG4OzbSi75Zaf9Qjet1JVNoAQBSmqLzK00/Bx5wZTEYTqL+gPtCXGAbUMMv3C9yI3 Mrp6fGHZ9ZNGaLipxhqLcqctpNCuiQzVnx9U2zniYq1MwIeE43EB8iHfW6lqzIh1yr6c RN21q0imF4E51J7lxwwozm8V4DiUMM/9G0rrdHcyDQL5xKZHnRc0YveKPptOXNoMbI1w bW/z0+aG6/G76nK74LMgn9uaTtyvaTuqvyILQg/2/61wwlUEkIgLrRSn/fNhSa0IKNuN envg== X-Forwarded-Encrypted: i=1; AJvYcCUIdznIETPgwkhaAtsNyU4HV20D4VlGAXPSUnMx1AApuBYCgNGlDdhdGMpJ0FrM0MYh6STKYb9Q0vo=@lists.xenproject.org X-Gm-Message-State: AOJu0YxcThVnL+YTwdUM/BAnXlFSAq8r7auXsYqZ0Rn6u9Ix6w2Mcv7Y 40jsE0pL6PuxNt7XqnmsBLkGSBd30rNdcqyeZJ6omach0U/XJkoMqMwrzeMdtW0= X-Gm-Gg: ASbGnct70fWQrkdtZb8AVj7QVxogs/OSrLgcmeXzS9ShD1MZ71XF3KffTt56WhgzNca cI+DTfUjrKEwGmV9vIn7GnVw97C8SxiJYrqsWKvnjY2CVpf2zvm+NV8c3dvlSmvjPky4S0vtIAT igW9dWRCMRNb2egQlCWJJ+hY1lRA3C7m+AV2tZArhhB3ZvBHP7uun2H4B1nyCnbmLdn6qN0F3Ey fp1wWtmqsg6wX4uVxXBIRtQOq74Z4rhw+UZTJ4ZKXv40ywKI1iGb/KiB6592PL3vxCrH+cgCxsW 4h/g43hnW0aFNB+e7s/IGOComZK3mAgDTD2vEEqk83OpnAtTNcmOeQCyhUSg X-Google-Smtp-Source: AGHT+IFmsyFMtRiyUoQTMlDTj6UgcQ0Wyp8q7Re0IHss6ougDQh97Nwe8Gj2HZEyku0oDKVtn8rFyg== X-Received: by 2002:a05:6000:2c5:b0:37d:4647:154e with SMTP id ffacd0b85a97d-38bf5655bd3mr29759427f8f.9.1737828841654; Sat, 25 Jan 2025 10:14:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 3/9] hw/sysbus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:37 +0100 Message-ID: <20250125181343.59151-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Some TYPE_SYS_BUS_DEVICEs can be optionally dynamically plugged on the TYPE_PLATFORM_BUS_DEVICE. Rather than sometimes noting that with comment around the 'user_creatable = true' line in each DeviceRealize handler, introduce an abstract TYPE_DYNAMIC_SYS_BUS_DEVICE class. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif --- include/hw/sysbus.h | 2 ++ hw/core/sysbus.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index c9b1e0e90e3..81bbda10d37 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -19,6 +19,8 @@ DECLARE_INSTANCE_CHECKER(BusState, SYSTEM_BUS, OBJECT_DECLARE_TYPE(SysBusDevice, SysBusDeviceClass, SYS_BUS_DEVICE) +#define TYPE_DYNAMIC_SYS_BUS_DEVICE "dynamic-sysbus-device" + /** * SysBusDeviceClass: * diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 306f98406c0..e8d03fd28d9 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -321,6 +321,14 @@ BusState *sysbus_get_default(void) return main_system_bus; } +static void dynamic_sysbus_device_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *k = DEVICE_CLASS(klass); + + k->user_creatable = true; + k->hotpluggable = false; +} + static const TypeInfo sysbus_types[] = { { .name = TYPE_SYSTEM_BUS, @@ -336,6 +344,12 @@ static const TypeInfo sysbus_types[] = { .class_size = sizeof(SysBusDeviceClass), .class_init = sysbus_device_class_init, }, + { + .name = TYPE_DYNAMIC_SYS_BUS_DEVICE, + .parent = TYPE_SYS_BUS_DEVICE, + .class_init = dynamic_sysbus_device_class_init, + .abstract = true, + } }; DEFINE_TYPES(sysbus_types) From patchwork Sat Jan 25 18:13: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: 13950484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8652FC0218C for ; Sat, 25 Jan 2025 18:14:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877012.1287240 (Exim 4.92) (envelope-from ) id 1tbkfa-0005ri-TD; Sat, 25 Jan 2025 18:14:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877012.1287240; Sat, 25 Jan 2025 18:14:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfa-0005rb-Pt; Sat, 25 Jan 2025 18:14:10 +0000 Received: by outflank-mailman (input) for mailman id 877012; Sat, 25 Jan 2025 18:14:08 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfY-000565-Th for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:08 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2abdfab3-db48-11ef-99a4-01e77a169b0f; Sat, 25 Jan 2025 19:14:07 +0100 (CET) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43622267b2eso32316685e9.0 for ; Sat, 25 Jan 2025 10:14:07 -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-438bd4857c3sm68307685e9.10.2025.01.25.10.14.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:06 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2abdfab3-db48-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828847; x=1738433647; darn=lists.xenproject.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=dyOkRsNGVEWSIU/g0zj3C7+UfvVjzQgLwIYDoErjrzY=; b=E3O265wl8yaUU469AX64Lx2fHgrT11jgPvGuwnNbs2wApqv2zuUVgkd+ZrCcHWzbM9 nuyw1pl9S3/SGydU1n4FEQkHTZsiIn2G47jTsnv1ckFrstQHyVBvQMz97zeIBRnDcGGv fBNp9dx2OkOGMJej9nItABW5MVvQJ4hy1DsdkT6Lr+NUi5/PNLq7lrg4GvgL4o3gqqql yz6Fec8OtOElEzfzMHdqt3qWT9vYR4bAlQOWnV/ZZhiqOw09spIhL8HtdlwISu32SCXG 3VERGi0PMk8dIp/1dB5kCAZWYUeMeeMRw2WSpnmoXsj7PST+0dz58etulVZHCfR+5T7G jMHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828847; x=1738433647; 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=dyOkRsNGVEWSIU/g0zj3C7+UfvVjzQgLwIYDoErjrzY=; b=h4LxTu31Svs5wse0ClHatCNPvzJjf2/ylBctYZwijYPYY3si4YYbL/PtW30ZRntQ9W ZZAPR2QDHL/usRKB26UlzJ6r14gjghKAhe51BERYPhsdvpIb3Lra7T11YZ2A7tanyDjo wII+1DHMGwmmmK2bDtmKU/FC9j3hZF+9NRFf15b+5Kq4TpdRlPglJUp/plkDoDL3HJwM VSP2dvvSSDE8UamZsgltB9AKm3XWtZgU+cLR8gBXihaFzn1Y4/q0J+mrSOsNxv+q5ojt /T1m7XZtkYmJN8gVPPNn11bH2uyLUMncQlo1FgbF6A5CxUEYCV5J1pmfva4E0QpReDhy LqOA== X-Forwarded-Encrypted: i=1; AJvYcCWvH5oNEE6kesSQPUmc8gwMEAsOb0ByRbnRM4+OGHF4Q70glcTw4AkGFi0QuMbHa+2Ayl7JMF1jo68=@lists.xenproject.org X-Gm-Message-State: AOJu0YyHTLGjFrv+XELr7wZKoXqGUOHp68I0a5rBIKnvEHoHYGhUyCEU +Nt45C0J8dhzBteka9c/cZgoD2qNleD/7bai5ht/UCD44QyGjxsmkrV2QAnzYOk= X-Gm-Gg: ASbGncueZI9WCvpTZEWH6bRl7tPNeZ9YERv2TxwhJXJb5ljXkSZhViWAa5EdlLcDbbi X2A9rDoFdiXBNHg6XyCiWCU320hrUi4C18xlogxUB1py73TC4n77dZr//2SjFG1DT5+ecbUWNlR X7dZ4wbPapr0wqnJm7U6aMuO2CHeXMqYgK0JP2wizTYrPljzCUdAdWVfEyMN5JpmtppfKqO6YFC /qn4rEc5bTkv4LNnZveFzogViDkkPzJ07cR408jjI92vSRsS/ODiyGJojh4aFdKyC60985/21i3 M4Y6/uybwhirkxOTK5jMURmdG3vwxFv8rIMdqb5vW0Q4KuytN2ysErF+xaWm X-Google-Smtp-Source: AGHT+IEr2qoA1rRQRSxzBRg9AaVRyh1DsB0c2e066JVheh7W35FZo8o118MnJ47nSIRaQRkoz3MpFg== X-Received: by 2002:a05:600c:468d:b0:436:4708:9fb6 with SMTP id 5b1f17b1804b1-43891437546mr293523335e9.20.1737828846888; Sat, 25 Jan 2025 10:14:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 4/9] hw/vfio: Have VFIO_PLATFORM devices inherit from DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:38 +0100 Message-ID: <20250125181343.59151-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Do not explain why VFIO_PLATFORM devices are user_creatable, have them inherit TYPE_DYNAMIC_SYS_BUS_DEVICE, to explicit they can optionally be plugged on TYPE_PLATFORM_BUS_DEVICE. Signed-off-by: Philippe Mathieu-Daudé --- hw/vfio/amd-xgbe.c | 2 -- hw/vfio/calxeda-xgmac.c | 2 -- hw/vfio/platform.c | 4 +--- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/vfio/amd-xgbe.c b/hw/vfio/amd-xgbe.c index 96bd608b8dd..aaa96903db0 100644 --- a/hw/vfio/amd-xgbe.c +++ b/hw/vfio/amd-xgbe.c @@ -41,8 +41,6 @@ static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data) &vcxc->parent_realize); dc->desc = "VFIO AMD XGBE"; dc->vmsd = &vfio_platform_amd_xgbe_vmstate; - /* Supported by TYPE_VIRT_MACHINE */ - dc->user_creatable = true; } static const TypeInfo vfio_amd_xgbe_dev_info = { diff --git a/hw/vfio/calxeda-xgmac.c b/hw/vfio/calxeda-xgmac.c index 87c382e7361..b016d42b496 100644 --- a/hw/vfio/calxeda-xgmac.c +++ b/hw/vfio/calxeda-xgmac.c @@ -41,8 +41,6 @@ static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data) &vcxc->parent_realize); dc->desc = "VFIO Calxeda XGMAC"; dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate; - /* Supported by TYPE_VIRT_MACHINE */ - dc->user_creatable = true; } static const TypeInfo vfio_calxeda_xgmac_dev_info = { diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c index 1070a2113a1..f491f4dc954 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -672,13 +672,11 @@ static void vfio_platform_class_init(ObjectClass *klass, void *data) dc->desc = "VFIO-based platform device assignment"; sbc->connect_irq_notifier = vfio_start_irqfd_injection; set_bit(DEVICE_CATEGORY_MISC, dc->categories); - /* Supported by TYPE_VIRT_MACHINE */ - dc->user_creatable = true; } static const TypeInfo vfio_platform_dev_info = { .name = TYPE_VFIO_PLATFORM, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE, .instance_size = sizeof(VFIOPlatformDevice), .instance_init = vfio_platform_instance_init, .class_init = vfio_platform_class_init, From patchwork Sat Jan 25 18:13: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: 13950485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B098AC0218C for ; Sat, 25 Jan 2025 18:14:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877020.1287250 (Exim 4.92) (envelope-from ) id 1tbkfg-0006Lw-56; Sat, 25 Jan 2025 18:14:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877020.1287250; Sat, 25 Jan 2025 18:14:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfg-0006Lp-1N; Sat, 25 Jan 2025 18:14:16 +0000 Received: by outflank-mailman (input) for mailman id 877020; Sat, 25 Jan 2025 18:14:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfe-000565-7O for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:14 +0000 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [2a00:1450:4864:20::32f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2dee327a-db48-11ef-99a4-01e77a169b0f; Sat, 25 Jan 2025 19:14:12 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso22054715e9.2 for ; Sat, 25 Jan 2025 10:14: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 5b1f17b1804b1-438bd4900e2sm68626685e9.24.2025.01.25.10.14.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:11 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2dee327a-db48-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828852; x=1738433652; darn=lists.xenproject.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=oekQdNljsXmvRCfjRcF/YH736cTnRtLa3bqMS7/4HKc=; b=kRDrcwQdbzmSmB8bU63/J64wP26Ii1A8PtSXws8H9JIo5A+Y/78FjH9j+JubgXPtNs zR2HMWsUiWelfOg37tSwpTq1+NmkRHE2Aa4vZrhBv7+oIPdV+DjIgHDdz5f13ON2Ivby Iu7zN8+pMKkB7UBBf8rTdahQgG4NSHzJPMBQ8Uj4RUBWnD0D559g6/8XJ8BnzwnN9VVr BrXkH650taRllw+oCNYcB93pAlkPwXKdLU7xWTlRhDcZwgLLxj3TjCMzau937b34elur 6Ny1EzninbzZfj2tody8Fcsaa7dqjhiRO+H5y1tNnW7ToJfTpg6nsyvodLWaXVQNi8tF tpXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828852; x=1738433652; 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=oekQdNljsXmvRCfjRcF/YH736cTnRtLa3bqMS7/4HKc=; b=LWHgB5FrKztcwFEC7YVq+W4cIHTAmU6yRvouu/bfPHvIaM9H4TxBtdNlDY+mU31D7Z 81VhmErx7lwuGEVHi/7AzKZetG2bkfgThbPZv5c1Qwrid7KaHxk1vA503Fp2yUPKoQpH TJKN2lJl1pvSZxJdrWmiRpEenJF3I2P8gZZxWoDpSWF1PWWBz+PmSZh70zutB/od7FVL 2KHRsDvZJDTqNvnfSILVe7lG2q8qdOneH5RRS9CYsA4y3hrjg2xCGOFlW3UAY7qx4FUp SPr891So26CSsz4g6pYnEhOv5dSHad+DTmT/0AEUMiZ73VO4/3wJt2Vo7FDvSNYcvQhz ifLA== X-Forwarded-Encrypted: i=1; AJvYcCW45ZiWpwA3Tj2jdEks8XMIJbwnX81e8Wb1U7d5qdx8IjxgkzRJyJO7lAvDVtNlPeCASu2FwAqF2X4=@lists.xenproject.org X-Gm-Message-State: AOJu0Yw7yW/+0k9MTBUBgEdDwWNKiPjDig1PsfcOt49jKm9kCHzkETiq Bvt4HtN73NCgwfko0+Q07R16h/p6jxxCJbWks+UhFk8kfOJjuWykouy1IXUGLNk= X-Gm-Gg: ASbGncvVBzSDtkpzCtFxJ9Xc1DTYSXuolO0XGx5Oaa2cKzRugPjQVxsr9DhdXxEbtn5 d6e/l61r9HwJJMdPXGdmcZSkAtO/0s19GaudPXR4Vpni/m5s9SYhtafplmUGmXZDySkzJPjgEQW M+0EqZpkE6Hn8ji9xGL5Jh2ez3MHFt9KcTluwFEDI80KW5fhPedNYHE0aifqFBxWwBbV/EiT64S QhOhNVA1xqd5drkbFy53Nwj8EMqGUXenZwbFdtGn9SaB1ohTGBZQY2Tr6S4SKsPhWXpCiUKSij9 TkZnkAlJr1aEqcJ98CQ990/jJAUdq9F7IW01epA/7VqHooTLVK3M+7PIzeau X-Google-Smtp-Source: AGHT+IFcf5NC5w3OdMEeSdE+fJzRv8eMmKrsAaFn1q2W0Qs4+hxyDFiFEoLFYJSBxaKkISXGUJ3R0Q== X-Received: by 2002:a05:600c:1f19:b0:434:a1d3:a30f with SMTP id 5b1f17b1804b1-438b9cc072emr109914115e9.6.1737828852191; Sat, 25 Jan 2025 10:14:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 5/9] hw/display: Have RAMFB device inherit from DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:39 +0100 Message-ID: <20250125181343.59151-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Because the RAM FB device can be optionally plugged on the TYPE_PLATFORM_BUS_DEVICE, have it inherit TYPE_DYNAMIC_SYS_BUS_DEVICE. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif --- hw/display/ramfb-standalone.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c index 6c35028965d..1be106b57f2 100644 --- a/hw/display/ramfb-standalone.c +++ b/hw/display/ramfb-standalone.c @@ -72,13 +72,12 @@ static void ramfb_class_initfn(ObjectClass *klass, void *data) dc->vmsd = &ramfb_dev_vmstate; dc->realize = ramfb_realizefn; dc->desc = "ram framebuffer standalone device"; - dc->user_creatable = true; device_class_set_props(dc, ramfb_properties); } static const TypeInfo ramfb_info = { .name = TYPE_RAMFB_DEVICE, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE, .instance_size = sizeof(RAMFBStandaloneState), .class_init = ramfb_class_initfn, }; From patchwork Sat Jan 25 18:13: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: 13950486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E1E6C0218F for ; Sat, 25 Jan 2025 18:14:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877028.1287260 (Exim 4.92) (envelope-from ) id 1tbkfk-0006kx-Ds; Sat, 25 Jan 2025 18:14:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877028.1287260; Sat, 25 Jan 2025 18:14:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfk-0006ko-9d; Sat, 25 Jan 2025 18:14:20 +0000 Received: by outflank-mailman (input) for mailman id 877028; Sat, 25 Jan 2025 18:14:19 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfj-000565-OA for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:19 +0000 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [2a00:1450:4864:20::32c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 310dec10-db48-11ef-99a4-01e77a169b0f; Sat, 25 Jan 2025 19:14:18 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43621d27adeso20827385e9.2 for ; Sat, 25 Jan 2025 10:14: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 5b1f17b1804b1-438bd54c066sm67839795e9.29.2025.01.25.10.14.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:17 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 310dec10-db48-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828857; x=1738433657; darn=lists.xenproject.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=w1nS9BzjJB0tn/0Fa9F2b1T3lbd2oKgl5iwd0JMSerQ=; b=eFBesdrMiTebZm1ezPYRTAvmBhUY8ufXa/xDBnjmUG+JoObKcl5SVBTtErKJ6Q5OZd NKGc7poeu4rMJZYvL8b9ZACIV/3jYYv4DNcXxlbTjg8bc8XPE6gIunmzXmetxMIxin1c P/gUe/7om8FeRyQ/uJV05QG+27iaZCWqSOztVXUFrvMVsQpYMTb2T0YogbLL/n8FUbef YEPOD71TZ4TyFgRVcg7LS8e8coqPPFoc8l7fi62dhwRLswqE12kUWhh+DkkRWdgESv2a ZxslaYQqLy4aNcvb0z/t7vaib6/loY40lhhfhf88MFcjhDDK/eOM3RetiBMfkZtut4na 8WVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828857; x=1738433657; 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=w1nS9BzjJB0tn/0Fa9F2b1T3lbd2oKgl5iwd0JMSerQ=; b=nzR1nYkO0O5SN9fnno2gLb/ASD4Br/YOcBXpOz+Adki+lJiiOQ+okjdTF84S8xKb/X ouckhldsy/W3+Zbp7eIPKQMqj8OUqFX6Q/dUNMteB//synICe3wQ5WOstyFoAIRTnv3i D/Ke08WSShT6JP9ZbPOmtpapD4+ISTGHXDHllAZ1PgvopB40Xy2g6s0cAjjSdwxCLI62 MfjHYhg4/H4H5tumrIs30QecZGkK5vVhmVjwwkFKDMIsYg8ibyDKv/24GgIqb+qvhIJz 5g/7cQmRiMpvSPoWFfTYtjBoPkqFQaDdM4KTbtNcx7XDgxHwOE8jbqQHxQ+RsOzFliT+ eqUw== X-Forwarded-Encrypted: i=1; AJvYcCWWgYJjpyk+aRgpdi1x4VB6xsGZgxIg4HY8adbX84KhjQBWeof2GzfbatHzac9Uu8bZcNzfReTpGTs=@lists.xenproject.org X-Gm-Message-State: AOJu0YztDwgM9J/NJHY4gzonZej7jMEUG8NxNuWcqIqoh9BC0OtmhClC 3noXXPXuD8giH6AzzLn+zSxGdDJuKM9ESZdTUTeetho00IK6U2cq0m6sRgCwV9Q= X-Gm-Gg: ASbGncs58a7Og6w6sxS8HupobpRQUF3PzFdwcpC9Aep1uEAW4mtBHMMqLZFdYEl/8es JOcKbLGOvZD/l62m+AYDOjZJAElqb+Sk4erUhaPM1pgPzQmPAAq+kjPUFvyA6HykrEgjmT3e9+G S24+1fiSHqa6lGyMwbf1xARLS9Lwcgwkxc25lLyUIblzDPapZbfvcjAyYnEIeTe0KnqFYqCPkMS VO+DjvKJN6C00t5yyEGDf74Fo1YG2ps7v0pyjelDtBREDv5EU9RHfYT0F4W3VmpXtixFxGMGq+d jQfGVU0trR4857vR9lnx66a/dG8iex8/7dKYRw/RpI4s4lQvFGaJr9ecMc26 X-Google-Smtp-Source: AGHT+IE5XUCSuHVVDMagGbiF8o/U1zOarBMIVGYFxMB07VQ6SArrPMMpgZuB4UE+b0bVMHzNNBLvMA== X-Received: by 2002:a7b:cc8f:0:b0:438:a214:52f4 with SMTP id 5b1f17b1804b1-438a2145332mr233337725e9.25.1737828857490; Sat, 25 Jan 2025 10:14:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 6/9] hw/i386: Have X86_IOMMU devices inherit from DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:40 +0100 Message-ID: <20250125181343.59151-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Do not explain why _X86_IOMMU devices are user_creatable, have them inherit TYPE_DYNAMIC_SYS_BUS_DEVICE, to explicit they can optionally be plugged on TYPE_PLATFORM_BUS_DEVICE. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif --- hw/i386/amd_iommu.c | 2 -- hw/i386/intel_iommu.c | 2 -- hw/i386/x86-iommu.c | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 6b13ce894b1..e8e084c7cf8 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1687,8 +1687,6 @@ static void amdvi_sysbus_class_init(ObjectClass *klass, void *data) dc->hotpluggable = false; dc_class->realize = amdvi_sysbus_realize; dc_class->int_remap = amdvi_int_remap; - /* Supported by the pc-q35-* machine types */ - dc->user_creatable = true; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->desc = "AMD IOMMU (AMD-Vi) DMA Remapping device"; device_class_set_props(dc, amdvi_properties); diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index f366c223d0e..7fde0603bfe 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4871,8 +4871,6 @@ static void vtd_class_init(ObjectClass *klass, void *data) dc->hotpluggable = false; x86_class->realize = vtd_realize; x86_class->int_remap = vtd_int_remap; - /* Supported by the pc-q35-* machine types */ - dc->user_creatable = true; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->desc = "Intel IOMMU (VT-d) DMA Remapping device"; } diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c index fed34b2fcfa..5cdd165af0d 100644 --- a/hw/i386/x86-iommu.c +++ b/hw/i386/x86-iommu.c @@ -146,7 +146,7 @@ bool x86_iommu_ir_supported(X86IOMMUState *s) static const TypeInfo x86_iommu_info = { .name = TYPE_X86_IOMMU_DEVICE, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE, .instance_size = sizeof(X86IOMMUState), .class_init = x86_iommu_class_init, .class_size = sizeof(X86IOMMUClass), From patchwork Sat Jan 25 18:13: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: 13950487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6E08C0218C for ; Sat, 25 Jan 2025 18:14:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877038.1287270 (Exim 4.92) (envelope-from ) id 1tbkfr-0007NG-OA; Sat, 25 Jan 2025 18:14:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877038.1287270; Sat, 25 Jan 2025 18:14:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfr-0007Mw-JU; Sat, 25 Jan 2025 18:14:27 +0000 Received: by outflank-mailman (input) for mailman id 877038; Sat, 25 Jan 2025 18:14:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfq-0004aj-8j for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:26 +0000 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [2a00:1450:4864:20::330]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3583c3d5-db48-11ef-a0e5-8be0dac302b0; Sat, 25 Jan 2025 19:14:25 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4361815b96cso20866275e9.1 for ; Sat, 25 Jan 2025 10:14:25 -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-438bd4d29cesm69824895e9.35.2025.01.25.10.14.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:23 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3583c3d5-db48-11ef-a0e5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828865; x=1738433665; darn=lists.xenproject.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=J6WqpNLLgPHFQ99I41LLhDNBlDQghx4mWgl59MS9KjI=; b=PAiFrCXOUDqU7nzb8Yrw2aUD8pdEjbr5FIK8KmdIyHq59pvaV4KI5FpJ1ZL0dxv2BU LpBsvBlcdsjr98+ZExv+tiR0TlXPijW4kk7l8wQMVXNudH3elPXK+sqoKmZlF57SHrJ5 DPCXnvVr915yY9mSP0DCQaI+xzgdDARW4Q8VrjTwImcK0OmG9LoGnjMXQbye/Pm/MXKz G2dujPk2KmeZ6VFLKcS31ZsxUpuNGbepj+219vUShp03j3IABQWJ7qhJrqd0mW9NreNB Ul9RRjXZHy+CBRv61p5ZqgNZ8Yk5mFSA0v+JUWODjkznr2oQUSe6VLWk7s4e6gZ1wgQd EfYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828865; x=1738433665; 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=J6WqpNLLgPHFQ99I41LLhDNBlDQghx4mWgl59MS9KjI=; b=jnpcUvy8pzPJU+0yoInxRioXg4QGKDNnpnfRghSICSNGEm0BoL8nAb+3HpqLsnYKrv mtJc5niI1lXE2Ug41ZsUCvBUv1ci/Po3ZwccrOxmi7kq/8pjzt3yqVBivr6WucWuOeQN ddProj+5MoMGxX/ANq6TbcF9KTu1Qgj6X8OP5YmNIxtimgqJPq+cfpc+aG8V4xJybgpY S3o0M8GjKS3cVnOPEvIyh1EA6yM3+YNbOhOjCfBcmjzlYXutQBV9vuDEjbuW87b7FduN 2IjxyW0D1gHvC8pJi8zg8uIIlzKvlf9sG4AMfCU2Q6Vir6f3ktoTOZc0alOzZN4d4peR j3+g== X-Forwarded-Encrypted: i=1; AJvYcCW85B297nJktt6g6FDN/rAqH2MG+fxpp1po/QVvevQ7f+Uupj+5zv1vue6oTUdbpYbHJgsFe8bIia4=@lists.xenproject.org X-Gm-Message-State: AOJu0YwREfUbzw2qWbaVu8JCaaxKrspal/lY7atts09m9aR7PJKWWd/L HMKW94F6z35DzUdJtN4IPhAbmVWQVPaInmZraqWPQ8EWGBy6iR2B8ulP47UV3yg= X-Gm-Gg: ASbGncu8TsudT+gwo4irg0DrYW4NndNa7fANyZZjVpEBKPylGWT0zyVgffMnE3ub3Re eY0Wva02BEAIxFHWQwZv4vo1GV1YqFX7Tv07svmroFgmHP4wOk/A2G8WWvfIPFF1CeadlmCM3Qs 9LIFIYTwm03aX7VmlVOIqbDBiJwnKcZ08kKfAhEaVpFdv+FfM9nHdiSoDVu1bRtvcmTR56WX+mm r8N8RXasJOM5NyrCJyOT4OvLIuebqSflZ/3ZYM6pDtCRPR3yYs/byoW87IRyNEpEjo2peCtP+tU 3TLzjMjbniXdD9xzMbCdtwlb4dclGN/OJoJQma3WM8Fwnl1xfbzFaO6kJoWS X-Google-Smtp-Source: AGHT+IHtukcUsuBgToag1rm73vPOv6PLwBxDIv19SmO8jk0VeznszQ2sl5L6woNkrDfICXUGMJC2jg== X-Received: by 2002:a05:600c:1f86:b0:436:faeb:2a1b with SMTP id 5b1f17b1804b1-438913db2cfmr312879235e9.13.1737828864896; Sat, 25 Jan 2025 10:14:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 7/9] hw/net: Have eTSEC device inherit from DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:41 +0100 Message-ID: <20250125181343.59151-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Because the network eTSEC device can be optionally plugged on the TYPE_PLATFORM_BUS_DEVICE, have it inherit TYPE_DYNAMIC_SYS_BUS_DEVICE. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif Tested-by: Bernhard Beschow Acked-by: Bernhard Beschow --- hw/net/fsl_etsec/etsec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index 781b9003954..3ce4fa2662d 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -425,14 +425,12 @@ static void etsec_class_init(ObjectClass *klass, void *data) dc->realize = etsec_realize; device_class_set_legacy_reset(dc, etsec_reset); device_class_set_props(dc, etsec_properties); - /* Supported by ppce500 machine */ - dc->user_creatable = true; } static const TypeInfo etsec_types[] = { { .name = TYPE_ETSEC_COMMON, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE, .instance_size = sizeof(eTSEC), .class_init = etsec_class_init, .instance_init = etsec_instance_init, From patchwork Sat Jan 25 18:13: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: 13950498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1100DC0218C for ; Sat, 25 Jan 2025 18:20:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877067.1287280 (Exim 4.92) (envelope-from ) id 1tbklw-0001SG-JX; Sat, 25 Jan 2025 18:20:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877067.1287280; Sat, 25 Jan 2025 18:20:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbklw-0001S9-GN; Sat, 25 Jan 2025 18:20:44 +0000 Received: by outflank-mailman (input) for mailman id 877067; Sat, 25 Jan 2025 18:20:43 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkfw-0004aj-G7 for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:32 +0000 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [2a00:1450:4864:20::32c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3899b430-db48-11ef-a0e5-8be0dac302b0; Sat, 25 Jan 2025 19:14:30 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so20164085e9.1 for ; Sat, 25 Jan 2025 10:14:30 -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-38c2a176434sm6225313f8f.13.2025.01.25.10.14.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:29 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3899b430-db48-11ef-a0e5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828870; x=1738433670; darn=lists.xenproject.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=OjNRCKPy/l7f95vUUTcVvrIiqVVOepFXrbHeokjkTeQ=; b=R3aVdPAUhguLT5kpNme6AZC88RmfolhJpPq54ZQm0eqMCjpOAlhNXCXdS8G7uccpVb 4bWLW6rEgLB75skcTm0t5isdAwig+IxBo3pWxrqB19xc3QfiwJk5+p9TPMuzeHY2deUO EuZf6wtw/OoXBmsDKvzZUnDrZwc+oNDpxczCUebGzhA421uDkPjzYNtJuYeI5OybkwEH WwzbyjSGJlGHXkFNOFAt/vXxGd6XvefWbGQE5yzyNo7yFQmCKP73Kdp4TFxlj7aAn8Bg D3/61m2dgz8ztKU8rtoGAQws6qF8EgjEDedgOvBgF7ltnoJlHbwdibnp5vhdRWcrEaYi JvpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828870; x=1738433670; 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=OjNRCKPy/l7f95vUUTcVvrIiqVVOepFXrbHeokjkTeQ=; b=k9o9cwLbx/AyogCSTJkdqKmthAUYrESUqiYlApGuC7LCrMOqZXryOhfh1nvPkzudWk kwuWDwH9PK1spnOq2tlnVe17plgZF49c90j1oJjFP2N4LwNpwuBz7vfCIr7PNlXnbC7k JEbFN8uv66Q37RMBXnKYm25cdBHzkckfdRZE2b7mtwrgohbthay0X0qr/EeJbeL4Y3h7 o4q9RC0GfyV7xbuyx4VAwXQYDYxxdiVSP1XgdsnwOpColZOGmDNWt8bxv6nKBSD7qjUC 1RwS6W5N1q7DghUQ8ywimOdmnVb9woYK1ISu8hnPyt10dJIxKWQpyOhHgjrvMDop7uBM 75MQ== X-Forwarded-Encrypted: i=1; AJvYcCWXw9CAg1gbMnfAEEuNlPgA8h+9TtTynPKDyHCfqBDCKF2Z14oMGlc/Or36rEUWDdHQWkQ12fHHwu4=@lists.xenproject.org X-Gm-Message-State: AOJu0Yz9s42p1RXgEcA79qzmjk26Sf2b43FjvwHOEZBiz96IZWvVHlXg Zbf1mxrBUTFD5lZ5Zj3FY9pa52hFEbUPHkF7cwyFZSpXVttJVq3dmIyPdHXuGiM= X-Gm-Gg: ASbGnct7hZ1Cg8pnh0AcNwsIK+enJUZY8aFOnHKoaIn1wRSX9LPePf4l2FbeW33U9Z6 gbAGKbvqvWzgBh2aRD7T3tyZulglDgKmt73I6WmTsQTa+oAg2KXVOBPbaFcUHWTAkK5lM44mT2m O8HLGmAEaLh0M3zFDzPrKaQ4Qz7mrPWnkIs8Vu/EP+StuSPoJklGeStx6AD5CHYw0QvZiHIbH+T McMxSPj2vlE8OOeIR7GYvyA3BQZtBIS9iCloHdjgb4nk4LDb5KCTn9u/CUTPR9zmyt+xFDW4iCp RypO7Z1YJJl71f2I3yPkW2ZvjfqM2wakBBlKHuIUo5GA0NvIVqNdFTFl6Zfe X-Google-Smtp-Source: AGHT+IGsW1rE0tr04FeKYA2KGXlK/mvTNA5dlL64lnJuwONXDJIce4w6YtcdzlGTbIKmz0lEq52uwg== X-Received: by 2002:a5d:4d83:0:b0:385:f195:2a8 with SMTP id ffacd0b85a97d-38bf566cd2emr22422454f8f.30.1737828870120; Sat, 25 Jan 2025 10:14:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PATCH 8/9] hw/tpm: Have TPM TIS sysbus device inherit from DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:42 +0100 Message-ID: <20250125181343.59151-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Because the TPM TIS sysbus device can be optionally plugged on the TYPE_PLATFORM_BUS_DEVICE, have it inherit TYPE_DYNAMIC_SYS_BUS_DEVICE. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Clément Mathieu--Drif Reviewed-by: Stefan Berger --- hw/tpm/tpm_tis_sysbus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c index ee0bfe9538e..4f187690a28 100644 --- a/hw/tpm/tpm_tis_sysbus.c +++ b/hw/tpm/tpm_tis_sysbus.c @@ -133,7 +133,6 @@ static void tpm_tis_sysbus_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_tpm_tis_sysbus; tc->model = TPM_MODEL_TPM_TIS; dc->realize = tpm_tis_sysbus_realizefn; - dc->user_creatable = true; device_class_set_legacy_reset(dc, tpm_tis_sysbus_reset); tc->request_completed = tpm_tis_sysbus_request_completed; tc->get_version = tpm_tis_sysbus_get_tpm_version; @@ -142,7 +141,7 @@ static void tpm_tis_sysbus_class_init(ObjectClass *klass, void *data) static const TypeInfo tpm_tis_sysbus_info = { .name = TYPE_TPM_TIS_SYSBUS, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE, .instance_size = sizeof(TPMStateSysBus), .instance_init = tpm_tis_sysbus_initfn, .class_init = tpm_tis_sysbus_class_init, From patchwork Sat Jan 25 18:13: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: 13950499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2DC6C0218C for ; Sat, 25 Jan 2025 18:21:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.877076.1287290 (Exim 4.92) (envelope-from ) id 1tbkmT-00022S-Ri; Sat, 25 Jan 2025 18:21:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 877076.1287290; Sat, 25 Jan 2025 18:21:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkmT-00022L-No; Sat, 25 Jan 2025 18:21:17 +0000 Received: by outflank-mailman (input) for mailman id 877076; Sat, 25 Jan 2025 18:21:16 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tbkg1-000565-Dx for xen-devel@lists.xenproject.org; Sat, 25 Jan 2025 18:14:37 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3bb8d6d0-db48-11ef-99a4-01e77a169b0f; Sat, 25 Jan 2025 19:14:35 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-38634c35129so2839719f8f.3 for ; Sat, 25 Jan 2025 10:14:35 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a176490sm6041968f8f.1.2025.01.25.10.14.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 10:14:34 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3bb8d6d0-db48-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737828875; x=1738433675; darn=lists.xenproject.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=bl6x3NGb6owz3SHDZJmiiZ4r1za5TcxmylUs2G0w4SA=; b=MzxmPvjlGOARY7CzHWPsCrATcH3j5+MVdYyjAzrqoWQrOQR2+0+sSyci+/mBFkM3TP 2x51gqia362cVAj67XryFhVDi2wI068GQNkMlvmKkt3NwcRycy7OhoXSePGd5gw8E74K XPOjObItHTA15eEq7txG4Dfecu/gvEta2JTW+C01a176YD/cGPmfoNkHXKmAfJ4hiL96 JY6UikE1/1jPi2nGlHyx4o3VcQXquXjwcIjy93EPTaUrZYJVJ79FXhpjd4PiYdpfUqdv YYjuGjTxPglhJgwBGleHXJH+zr1osCT+Bz7Hw/Sf37Ju5w45N5FyJXh8VMD+RLZhgC5V 15wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737828875; x=1738433675; 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=bl6x3NGb6owz3SHDZJmiiZ4r1za5TcxmylUs2G0w4SA=; b=B99hmk03Pxiqrmkl9m8AUmc3LZwhAEHB0L7ys3RvRd+yJiWG46RLVJMB/alizXl5ul 0yst4MZpQ/+WUjLQRssus6IOkkvD8WPs1Vxwdo8AvDRdqkNMmidaUA3fTcFZ5YnjCfvX 3/5RIpgZylJmYuaEBWSIV0z64i1bmF5Yr1ygzEQfhJsR9eH75qKKBQLwQTaSORNGc4od DiYKECuwFnBo7YA2RwswG/nBGlnGDSqxbhikLLkaZ1gEX64dKzP/TqOMc/757GF1nsu1 TxyYrGd2l9QGJONZt4iLGIFvnj711mytaUd/jDatiQx2UAngPTQh/cZb90qA/XUZ/tWt zZJw== X-Forwarded-Encrypted: i=1; AJvYcCVcwVc0U05VG1jgOBSfTtBoDEMEkSRBXfORhoG9rcd9Sbn98zNVWJ0EJ3AdJUPuJbMe9Y8Y/UwG8fs=@lists.xenproject.org X-Gm-Message-State: AOJu0YypvZPtVKWOo48K+26ALr1Q13MNTCnnt2oQxrk5F2aHj2vtZLE2 DysmPpowsnSvkEG7lArnyfQxpypH/4ZKv2O5tGIIJa8gojwAq3YwTpSfR8XPTgo= X-Gm-Gg: ASbGncu1QnZ0bDz22a11rY8ZdgZnLsPRJugnhpcmK2NAbbDWArezTKTwbgRowPW+tFI IMdTkCqv+ytRQ1HuwvnTiysAGiDOBJFZqXnUJWxNHJdx/Y2pchRKe2VvOvOGnmpDTHYlOlk+UqG eteQldDsRkLAzrxlo8ULHHeArUFGxw/QvfZuj8NLGEGs4SUnPviccMxthJJ8G+B8y+8G6g7Jh00 mR3HTcnrdPgZ0le6v9wX6kpKVv2PJeMJZsWXYKoyaOPgStOOSWqwvzsGTZyf7GXxphA+JfaWQYU /82JlF0d8jedt2L4dXizZ2GZ6sZzUlbTdrdMEnRV9F7e2PA2Wmo6agBESXkT X-Google-Smtp-Source: AGHT+IH6Im9WAFP62p+c65YcO9soXGrjbd4TGzQetbCmkepXX8mf8yxKvYvU59Qz1V1TA9WTvs42GQ== X-Received: by 2002:adf:f504:0:b0:385:ecdf:a30a with SMTP id ffacd0b85a97d-38bf57ab510mr28008868f8f.33.1737828875399; Sat, 25 Jan 2025 10:14:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yi Liu , Markus Armbruster , Eduardo Habkost , Anthony PERARD , Gustavo Romero , Jason Wang , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , Alexander Graf , Richard Henderson , Stefan Berger , Bernhard Beschow , Stefano Stabellini , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Marcel Apfelbaum , Alex Williamson , Paul Durrant , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [RFC PATCH 9/9] hw/xen: Have legacy Xen backend inherit from DYNAMIC_SYS_BUS_DEVICE Date: Sat, 25 Jan 2025 19:13:43 +0100 Message-ID: <20250125181343.59151-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125181343.59151-1-philmd@linaro.org> References: <20250125181343.59151-1-philmd@linaro.org> MIME-Version: 1.0 Because the legacy Xen backend devices can optionally be plugged on the TYPE_PLATFORM_BUS_DEVICE, have it inherit TYPE_DYNAMIC_SYS_BUS_DEVICE. Remove the implicit TYPE_XENSYSDEV instance_size. Untested, but I'm surprised the legacy devices work because they had a broken instance size (QDev instead of Sysbus...), so accesses of XenLegacyDevice fields were overwritting sysbus ones. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/xen/xen_pvdev.h | 3 ++- hw/xen/xen-legacy-backend.c | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/hw/xen/xen_pvdev.h b/include/hw/xen/xen_pvdev.h index 0c984440476..48950dc2b57 100644 --- a/include/hw/xen/xen_pvdev.h +++ b/include/hw/xen/xen_pvdev.h @@ -32,7 +32,8 @@ struct XenDevOps { }; struct XenLegacyDevice { - DeviceState qdev; + SysBusDevice parent_obj; + const char *type; int dom; int dev; diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index 118c571b3a7..4d079e35d83 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -640,16 +640,14 @@ static void xendev_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); set_bit(DEVICE_CATEGORY_MISC, dc->categories); - /* xen-backend devices can be plugged/unplugged dynamically */ - dc->user_creatable = true; dc->bus_type = TYPE_XENSYSBUS; } static const TypeInfo xendev_type_info = { .name = TYPE_XENBACKEND, - .parent = TYPE_DEVICE, + .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE, .class_init = xendev_class_init, - .instance_size = sizeof(struct XenLegacyDevice), + .instance_size = sizeof(XenLegacyDevice), }; static void xen_sysbus_class_init(ObjectClass *klass, void *data) @@ -672,7 +670,6 @@ static const TypeInfo xensysbus_info = { static const TypeInfo xensysdev_info = { .name = TYPE_XENSYSDEV, .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(SysBusDevice), }; static void xenbe_register_types(void)