From patchwork Mon Sep 19 23:17:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12981134 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 E0EEEC6FA82 for ; Mon, 19 Sep 2022 23:23:43 +0000 (UTC) Received: from localhost ([::1]:55160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oaQ75-0007NK-0O for qemu-devel@archiver.kernel.org; Mon, 19 Sep 2022 19:23:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaQ2a-0007Ty-Ne; Mon, 19 Sep 2022 19:19:05 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:37800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oaQ2Y-0001u7-W5; Mon, 19 Sep 2022 19:19:04 -0400 Received: by mail-ej1-x631.google.com with SMTP id a26so2211309ejc.4; Mon, 19 Sep 2022 16:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=18L1CetNQZRcWgrF+bLfFklTWcjPuzsdD8LCMjAGf1E=; b=V5XT6ePhglxVVnzO7wTKlIaCCViZpN/zYqMG+wnd7lcxvsQ6bFt9WuDSwUs61yQfOq pOOrLokv5qVrEanQf1jerp+JQbj02Jx+4/DTXLbk4VGzNoVT9LMVzK0PC7mepLvnFIDH zNU2Iq8+Tt8hwKBJJHRAekFsH64zOK5KDx2DOj+3xLFeQHbqLBayBI84MwLSLyDfmRzn Bn02SXOCet8dJvaSko0kLZJJa9dUhgUekK1verWyRQXlYweUX2DfajwnVTkn8xSB6xdY xhTzjewc6CjRhf/YtZTPMPm/29EOtiCPc87CrZipbkfmhngf1laAFdu+hBwMKfqzao83 81vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=18L1CetNQZRcWgrF+bLfFklTWcjPuzsdD8LCMjAGf1E=; b=adIMdmnjRPQggDogF9oiHCbhfmbYZOMyt8CiDcPywv60Ix1Rzwt4lYxc8mwXwtFJs2 8Wxyu5Xno2xIhTCkbEUqlBVukTo9G8Lm3CAn9gByt2AWepGQ/LT05+smLQHPVA7xdOjP qmRPiq+siMvMJRhJ5RjsHcQP3fsh+81eXLJWBf4Ie5tVtQuxzpKQWgDt1sB4QV7juHet aCLTNJ5swpX6jEiQr074vP2Q9N4ecaxRXX4LDSdWJI3nsWbaIhGeVAnj9LzAVNFGpmBp 2RhiCOrHwDyPW+cIuCP1l3Cnrol8qvJuKjk2Tqa04BL9sOv5aAqHMWhjnh/08eJ4XGhG I23A== X-Gm-Message-State: ACrzQf1NBbC/L3Q3ifMg/lwzn0xX2mFuskZ6wvt/vnl33mBDwfoAIoJ7 1Hi7n5VT0fEnZBKlbKZPK5xt2/aV9SWTFg== X-Google-Smtp-Source: AMsMyM4eJjU/NOUzNOFcRv5on/MypRLn/EbDnZquypCWBAyuQiQwWxxTAmP7wvB5d1YGt/EQ80NS8w== X-Received: by 2002:a17:907:2e0b:b0:77f:5fd8:8712 with SMTP id ig11-20020a1709072e0b00b0077f5fd88712mr13751388ejc.575.1663629539177; Mon, 19 Sep 2022 16:18:59 -0700 (PDT) Received: from localhost.localdomain (dynamic-078-054-077-055.78.54.pool.telefonica.de. [78.54.77.55]) by smtp.gmail.com with ESMTPSA id rn24-20020a170906d93800b00780f6071b5dsm4800926ejb.188.2022.09.19.16.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 16:18:58 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Magnus Damm , Aleksandar Rikalo , Bandan Das , Matthew Rosato , Daniel Henrique Barboza , Sergio Lopez , Alexey Kardashevskiy , Xiaojuan Yang , Cameron Esfahani , Michael Rolnik , Song Gao , Jagannathan Raman , Greg Kurz , Kamil Rytarowski , Peter Xu , Joel Stanley , Alistair Francis , "Dr. David Alan Gilbert" , Paolo Bonzini , haxm-team@intel.com, Roman Bolshakov , Markus Armbruster , Eric Auger , David Gibson , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , Christian Borntraeger , =?utf-8?q?C=C3=A9dric_Le?= =?utf-8?q?_Goater?= , Stefan Hajnoczi , qemu-block@nongnu.org, Eduardo Habkost , =?utf-8?q?Her?= =?utf-8?q?v=C3=A9_Poussineau?= , qemu-ppc@nongnu.org, Cornelia Huck , Palmer Dabbelt , Helge Deller , Stefano Stabellini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Stafford Horne , Paul Durrant , Havard Skinnemoen , Elena Ufimtseva , Alexander Graf , Thomas Huth , Alex Williamson , Wenchao Wang , Tony Krowiak , Marcel Apfelbaum , qemu-s390x@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland , Eric Farman , Reinoud Zandijk , Alexander Bulekov , Yanan Wang , "Edgar E. Iglesias" , Gerd Hoffmann , Tyrone Ting , xen-devel@lists.xenproject.org, Yoshinori Sato , John Snow , Richard Henderson , Darren Kenny , kvm@vger.kernel.org, Qiuhao Li , John G Johnson , Bin Meng , Sunil Muthuswamy , Max Filippov , qemu-arm@nongnu.org, Marcelo Tosatti , Peter Maydell , Anthony Perard , Andrew Jeffery , Artyom Tarasenko , Halil Pasic , "Maciej S. Szmigiero" , Jason Wang , David Hildenbrand , Laurent Vivier , Alistair Francis , Jason Herne , Bernhard Beschow Subject: [PATCH 7/9] hw/sysbus: Introduce dedicated struct SysBusState for TYPE_SYSTEM_BUS Date: Tue, 20 Sep 2022 01:17:18 +0200 Message-Id: <20220919231720.163121-8-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220919231720.163121-1-shentey@gmail.com> References: <20220919231720.163121-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" With this out of the way, in the next step, SysBusState gains attributes for its memory and address recouces. Signed-off-by: Bernhard Beschow --- hw/core/sysbus.c | 4 ++-- include/hw/boards.h | 3 ++- include/hw/misc/macio/macio.h | 2 +- include/hw/sysbus.h | 8 ++++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 16a9b4d7a0..1100f3ad6c 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -84,7 +84,7 @@ static void system_bus_class_init(ObjectClass *klass, void *data) static const TypeInfo system_bus_info = { .name = TYPE_SYSTEM_BUS, .parent = TYPE_BUS, - .instance_size = sizeof(BusState), + .instance_size = sizeof(SysBusState), .class_init = system_bus_class_init, }; @@ -343,7 +343,7 @@ BusState *sysbus_get_default(void) return NULL; } - return ¤t_machine->main_system_bus; + return ¤t_machine->main_system_bus.parent_obj; } static void sysbus_register_types(void) diff --git a/include/hw/boards.h b/include/hw/boards.h index 7af940102d..63a4f990ea 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -11,6 +11,7 @@ #include "qemu/module.h" #include "qom/object.h" #include "hw/core/cpu.h" +#include "hw/sysbus.h" #define TYPE_MACHINE_SUFFIX "-machine" @@ -346,7 +347,7 @@ struct MachineState { */ MemoryRegion *ram; DeviceMemoryState *device_memory; - BusState main_system_bus; + SysBusState main_system_bus; ram_addr_t ram_size; ram_addr_t maxram_size; diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 6c05f3bfd2..0944be587f 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -44,7 +44,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(MacIOBusState, MACIO_BUS) struct MacIOBusState { /*< private >*/ - BusState parent_obj; + SysBusState parent_obj; }; /* MacIO IDE */ diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 3564b7b6a2..5bb3b88501 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -11,9 +11,13 @@ #define QDEV_MAX_PIO 32 #define TYPE_SYSTEM_BUS "System" -DECLARE_INSTANCE_CHECKER(BusState, SYSTEM_BUS, - TYPE_SYSTEM_BUS) +OBJECT_DECLARE_SIMPLE_TYPE(SysBusState, SYSTEM_BUS) +struct SysBusState { + /*< private >*/ + BusState parent_obj; + /*< public >*/ +}; #define TYPE_SYS_BUS_DEVICE "sys-bus-device" OBJECT_DECLARE_TYPE(SysBusDevice, SysBusDeviceClass,