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: 12981123 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 24EDBC6FA82 for ; Mon, 19 Sep 2022 23:19:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.409038.651929 (Exim 4.92) (envelope-from ) id 1oaQ2Y-0007Vu-AV; Mon, 19 Sep 2022 23:19:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 409038.651929; Mon, 19 Sep 2022 23:19:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oaQ2Y-0007Vb-5u; Mon, 19 Sep 2022 23:19:02 +0000 Received: by outflank-mailman (input) for mailman id 409038; Mon, 19 Sep 2022 23:19:00 +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 1oaQ2W-0004vz-Fd for xen-devel@lists.xenproject.org; Mon, 19 Sep 2022 23:19:00 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 70edeb49-3871-11ed-9647-05401a9f4f97; Tue, 20 Sep 2022 01:18:59 +0200 (CEST) Received: by mail-ej1-x632.google.com with SMTP id a26so2211283ejc.4 for ; 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) 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: 70edeb49-3871-11ed-9647-05401a9f4f97 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=NGfoZftkobjudmTRVVLMiBU9vuK86+dS5rRwsPzJWYKiClhOgPm3scHYcXX1QkEQnp vScdUxvnCLdeZwugvpYjZC2KPAZp0DFmyzJp0UHBesQPnP8BVfbwTyNuk4clzcerfy6R p2MC8dyPtmmFBW1TdjhovNKZqeT43yJDleAC+vu6jaZBi1tpRMcOQjXyZlOQctconp3R kXcyWq4Tv83oZQbZLM9cmuE3dCSNoQ8GdrwokaDTDUyZRWa4KY0PlpmTyDVz3CVNNguL qtGm13SeBUOMSodTsx/zyhJ4dCcfnRNE8nAimcmR1ZCZdXg8NLZ1hxhsQ9LAg7ClB5vj 17yA== X-Gm-Message-State: ACrzQf0uNO2logD2g/TxI3rq7OaNRtpPIwzgFJdSyxtMi9OpLxsRP2mf zFfigJtQL6axCI6I5mOlc1I= 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) 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 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,