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 07873C32771 for ; Wed, 21 Sep 2022 09:48:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.409705.652718 (Exim 4.92) (envelope-from ) id 1oawKz-00058s-CL; Wed, 21 Sep 2022 09:48:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 409705.652718; Wed, 21 Sep 2022 09:48:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oawKz-00058l-9P; Wed, 21 Sep 2022 09:48:13 +0000 Received: by outflank-mailman (input) for mailman id 409705; Wed, 21 Sep 2022 09:48:12 +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 1oawKy-00058f-HO for xen-devel@lists.xenproject.org; Wed, 21 Sep 2022 09:48:12 +0000 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [2a00:1450:4864:20::631]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 806c61c3-3992-11ed-9647-05401a9f4f97; Wed, 21 Sep 2022 11:48:11 +0200 (CEST) Received: by mail-ej1-x631.google.com with SMTP id bj12so12242237ejb.13 for ; Wed, 21 Sep 2022 02:48:10 -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: 806c61c3-3992-11ed-9647-05401a9f4f97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=zW5HyKzeuivew/B/xuG63OBJVZKZHySm5uewagUHgYw=; b=W0gXS6y2bMRF3jyfGKbHAJ3obFmZsrPdd8F24LXKd+lkBoXU71tcZ/8Rd6CBiOG5Gt /llLewMKLhpE1fQNCYWyNUKAbaSFN2uQB2l18sr/X93nrdV3mtGgAIGRp/6TgVSMzN2Y /w1fEeXGFjYnXxT23gFPn8XnRZH5aeFDoxQz9+VomJlB3nS5DQBO+52ijYrE6giLDSG/ 2KCpT4rp+gLvUOj6dxkghXRdjweFaTc4KxK/v/ZnZUMuCbBq69W0kFT14iOV1Wlsqup3 dNnSUoA2MHtiNM8+w3c7h0S8ulkEzZsQykPZzRe2GSS6+09iGKn6Gbsk3SsmOBhLic69 qeyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=zW5HyKzeuivew/B/xuG63OBJVZKZHySm5uewagUHgYw=; b=V3HjzpNiMHUDlDKx+5iDfUJglBZiY3joTi104cmtyWG2HXOmzyUm+S18zQDGg5xh/N rr+LXKwsTsBzk69aiAu4SLWKaOP0OVuMMgW0M/nkpZQ8+GfZIQVm4Hg0rQHaTa+DI1Fn i5q97l1X8lInnfM/05i3/4Ic95cJbq2aUgicJmPhxQoUT1Z5XMKfVLxqtTRNaSpJoKUT XDl5OADidmrt0vYzFEILWZg4ndFFC9qro1vCyDSbq+6iqdekZyzbA3OpxaxboO3//pj6 lhbq7E7DQl5hKp3ZhL0Xh34+Srtm8/QdP+33ig3qw14q73DU2ECLrShYbSpvdCNW7Fk+ BrrA== X-Gm-Message-State: ACrzQf1NE+2WaNifki5Pm8eBOxKzLjggAA4AHe5h4NwgXi3vm0JeS9zx vufh70oDAhV9mQzu2e+UZZ+l/A7GSWNeCzcPNYGJ1Q== X-Google-Smtp-Source: AMsMyM7XaE+m0i9UnpDDtPcon9xvHdJdJV7wVRhpBOJ+d6OIshyTTEiMluysyBi3pDZh60CQuxd4pQfbk7wQRmhLbco= X-Received: by 2002:a17:907:2bd5:b0:76f:591c:466b with SMTP id gv21-20020a1709072bd500b0076f591c466bmr19468493ejc.504.1663753689736; Wed, 21 Sep 2022 02:48:09 -0700 (PDT) MIME-Version: 1.0 References: <20220919231720.163121-1-shentey@gmail.com> In-Reply-To: From: Peter Maydell Date: Wed, 21 Sep 2022 10:47:58 +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" Content-Transfer-Encoding: quoted-printable On Tue, 20 Sept 2022 at 23:50, Bernhard Beschow wrote: > > Am 20. September 2022 09:55:37 UTC schrieb Peter Maydell : > >On Tue, 20 Sept 2022 at 00:18, Bernhard Beschow wrot= e: > >> > >> In address-spaces.h it can be read that get_system_memory() and > >> get_system_io() are temporary interfaces which "should only be used te= mporarily > >> until a proper bus interface is available". This statement certainly e= xtends 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 attr= ibute 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. > > My intention was to allow exactly that: By turning sytem memory and syste= m IO into non-singletons, one could have many of them, thus allowing boards= to create arbitrary mappings of memory and IO. Since QEMU currently assume= s one set (memory and IO) of addresses, I for now instantiated the SysBus o= nce in the machine class to preserve behavior. You can already create arbitrary mappings of memory and IO (look at the virt board for an example). The existence of the legacy singleton system-memory and system-io doesn't prevent that, and stuffing the singletons into the MachineState doesn't do anything to change the code that is relying on the singletons. > >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. > > Again, having multiple SysBuses may solve that issue. We definitely don't want multiple sysbuses. thanks -- PMM