From mboxrd@z Thu Jan 1 00:00:00 1970 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 4BCFCECAAD8 for ; Tue, 20 Sep 2022 09:56:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.409313.652303 (Exim 4.92) (envelope-from ) id 1oaZyq-0003qK-GO; Tue, 20 Sep 2022 09:55:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 409313.652303; Tue, 20 Sep 2022 09:55:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oaZyq-0003qD-DW; Tue, 20 Sep 2022 09:55:52 +0000 Received: by outflank-mailman (input) for mailman id 409313; Tue, 20 Sep 2022 09:55:51 +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 1oaZyo-0003oa-Tp for xen-devel@lists.xenproject.org; Tue, 20 Sep 2022 09:55:50 +0000 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [2a00:1450:4864:20::631]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 67dbd79b-38ca-11ed-bad8-01ff208a15ba; Tue, 20 Sep 2022 11:55:49 +0200 (CEST) Received: by mail-ej1-x631.google.com with SMTP id go34so4878528ejc.2 for ; Tue, 20 Sep 2022 02:55:49 -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: 67dbd79b-38ca-11ed-bad8-01ff208a15ba DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=MOHpKFoYlYyycfS9c46ICESvGULQBNymssneeKs799o=; b=quYFlnIJleuARwEhPjdTz1ToiR+OvGdDRZw0wCdlnOJ6MTQLsWsNk/r5mDr6XnAX31 Hwj1d7mMoZGkMAivnJ2J9OA8ZQ/aEG9aq2Y0P6e4Wu9l0ogP2si80dYknPFTqUq67bFn Xm8Wc5/TDj6+sKRKK3cwfKdSiiVQZAM+wkG1hTzjWA/gxyr377xjsFx1EDW7bYvLo1Xu bN5dAy2agecZU4e8CyZs4D9MTl7i4prTbe0AYlQ0hmgCrP2yZe58bj+hgNmk3fik2WQI YCH4MamgZK77XXUAxDmY6RQjMtha7B+/kchkih5CEdwvGX58X2okw2imIkQdZF7pfF6O s7qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=MOHpKFoYlYyycfS9c46ICESvGULQBNymssneeKs799o=; b=E9fudr2/ZGBneTJGlogOyzfjYyHvM/PbNaFXp4HPTQTVDxmX86lJndcuCruqDXazQO mAdHbEnji2FZucM78JteFp+d9y81dXwaKWhhA22xlhx4IEgoYs5VEspr1cZZ9asjG7LY 0oZ0zHLCGp3rGtYWabmtnU09r8b8otEqjbVVUpUL8F6DZ+/K7nYS2vQJmEcjqSbpOZIc NQjBVLan+1DvoUYlvAM8iFmIOySIntNIj8W554qtb1eBGmHiTHmRoW3QD7erVuLpF2ot gv+gRzy5q6BInZ94TlIzWOebt/KXDbhrgaOGUikyNjihzibmiD9yWQR6UTf+ArmlVz+i eZMQ== X-Gm-Message-State: ACrzQf3RVA9FT8HUdFmk7TjN6u9Qb0TNM1xoU44ToWY6COUrAq5qammS RKSmMO2zsK6vFyKMnz2vQvQFjfTAvtDDMUDfk7uDQQ== X-Google-Smtp-Source: AMsMyM4VRt9iN2Ys9FUPfBpfYY02peK2ICLg9+doecZ6zcnwoVeZC5tVrJoMYR6zFGBVnQfqk1brL6iSz7epg8D/0ao= X-Received: by 2002:a17:906:8a6b:b0:780:ab37:b63 with SMTP id hy11-20020a1709068a6b00b00780ab370b63mr14241916ejc.365.1663667749166; Tue, 20 Sep 2022 02:55:49 -0700 (PDT) MIME-Version: 1.0 References: <20220919231720.163121-1-shentey@gmail.com> In-Reply-To: <20220919231720.163121-1-shentey@gmail.com> From: Peter Maydell Date: Tue, 20 Sep 2022 10:55:37 +0100 Message-ID: Subject: Re: [PATCH 0/9] Deprecate sysbus_get_default() and get_system_memory() et. al To: Bernhard Beschow Cc: qemu-devel@nongnu.org, "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=C3=A9?= , Christian Borntraeger , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , Stefan Hajnoczi , qemu-block@nongnu.org, Eduardo Habkost , =?UTF-8?Q?Herv=C3=A9_Poussineau?= , qemu-ppc@nongnu.org, Cornelia Huck , Palmer Dabbelt , Helge Deller , Stefano Stabellini , =?UTF-8?Q?Philippe_Mathieu=2DDaud=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?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , 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 , Anthony Perard , Andrew Jeffery , Artyom Tarasenko , Halil Pasic , "Maciej S. Szmigiero" , Jason Wang , David Hildenbrand , Laurent Vivier , Alistair Francis , Jason Herne Content-Type: text/plain; charset="UTF-8" On Tue, 20 Sept 2022 at 00:18, Bernhard Beschow wrote: > > In address-spaces.h it can be read that get_system_memory() and > get_system_io() are temporary interfaces which "should only be used temporarily > until a proper bus interface is available". This statement certainly extends to > the address_space_memory and address_space_io singletons. This is a long standing "we never really completed a cleanup"... > This series attempts > to stop further proliferation of their use by turning TYPE_SYSTEM_BUS into an > object-oriented, "proper bus interface" inspired by PCIBus. > > While at it, also the main_system_bus singleton is turned into an attribute of > MachineState. Together, this resolves five singletons in total, making the > ownership relations much more obvious which helps comprehension. ...but I don't think this is the direction we want to go. Overall the reason that the "system memory" and "system IO" singletons are weird is that in theory they should not be necessary at all -- board code should create devices and map them into an entirely arbitrary MemoryRegion or set of MemoryRegions corresponding to address space(s) for the CPU and for DMA-capable devices. But we keep them around because (a) there is a ton of legacy code that assumes there's only one address space in the system and this is it (b) when modelling the kind of board where there really is only one address space, having the 'system memory' global makes the APIs for creating and connecting devices a lot simpler Retaining the whole-system singleton but shoving it into MachineState doesn't really change much, IMHO. More generally, sysbus is rather weird because it isn't really a bus. Every device in the system of TYPE_SYS_BUS_DEVICE is "on" the unique TYPE_SYSTEM_BUS bus, but that doesn't mean they're all in the same address space or that in real hardware they'd all be on the same bus. sysbus has essentially degraded into a hack for having devices get reset. I really really need to make some time to have another look at reset handling. If we get that right then I think it's probably possible to collapse the few things TYPE_SYS_BUS_DEVICE does that TYPE_DEVICE does not down into TYPE_DEVICE and get rid of sysbus altogether... thanks -- PMM