Received: from eggs.gnu.org ([2001:4830:134:3::10]:33156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRj2p-0006N6-7u for qemu-devel@nongnu.org; Wed, 10 Sep 2014 10:38:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRj2h-0002Gb-3n for qemu-devel@nongnu.org; Wed, 10 Sep 2014 10:38:51 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52510 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRj2g-0002GP-Px for qemu-devel@nongnu.org; Wed, 10 Sep 2014 10:38:43 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) From: Alexander Graf In-Reply-To: <54105D9D.7090902@redhat.com> Date: Wed, 10 Sep 2014 16:38:40 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <4A01412F-F133-4E5D-ADE2-58E9A7462C49@suse.de> References: <1410249273-6063-1-git-send-email-eric.auger@linaro.org> <1410249273-6063-2-git-send-email-eric.auger@linaro.org> <540EDCF9.7070609@redhat.com> <540F1BF2.4080505@linaro.org> <540F23F6.8080407@redhat.com> <54101A61.1080503@suse.de> <54101D5F.6060602@redhat.com> <54102068.6000807@suse.de> <54102258.4040503@redhat.com> <5410235E.7090704@suse.de> <5410574D.309@linaro.org> <54105D9D.7090902@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 1/6] hw/misc/dyn_sysbus_binding: helpers for sysbus device dynamic binding List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: "joel.schopp@amd.com" , "alex.williamson@redhat.com" , "kim.phillips@freescale.com" , "eric.auger@st.com" , "peter.maydell@linaro.org" , Eric Auger , "marc.zyngier@arm.com" , "manish.jaggi@caviumnetworks.com" , "patches@linaro.org" , "will.deacon@arm.com" , "a.rigo@virtualopensystems.com" , "qemu-devel@nongnu.org" , "Bharat.Bhushan@freescale.com" , "stuart.yoder@freescale.com" , "kvmarm@lists.cs.columbia.edu" , "a.motakis@virtualopensystems.com" , "afaerber@suse.de" , "christoffer.dall@linaro.org" > Am 10.09.2014 um 16:18 schrieb Paolo Bonzini : >=20 > Il 10/09/2014 15:51, Eric Auger ha scritto: >>> On 09/10/2014 12:09 PM, Alexander Graf wrote: >>>=20 >>>=20 >>>> On 10.09.14 12:05, Paolo Bonzini wrote: >>>> Il 10/09/2014 11:56, Alexander Graf ha scritto: >>>>>=20 >>>>>=20 >>>>>> On 10.09.14 11:43, Paolo Bonzini wrote: >>>>>> Il 10/09/2014 11:31, Alexander Graf ha scritto: >>>>>>>>> Yeah, please do the registration in sysbus.c, not in virt.c. Ther= e is >>>>>>>>> no reason to make the platform_bus_init_notify+DynSysbusNotifier >>>>>>>>> interface public. The code in sysbus.c can fill in the fields. >>>>>>> Sysbus !=3D Platform bus. Sysbus is an in-QEMU representation of a >>>>>>> pseudo-bus that we put all devices onto that we consider unsorted. >>>>>>>=20 >>>>>>> Platform bus is a machine representation of an actual bus that devic= es >>>>>>> are attached to. These devices usually are sysbus devices. >>>>>>=20 >>>>>> Is there any difference between the two? >>>>>>=20 >>>>>> Take a machine that has two chips, a SoC that does everything except >>>>>> USB, and a USB controller chip. >>>>>>=20 >>>>>> Strictly speaking the USB controller chip would be on a "platform bus= ", >>>>>> but we would likely put it on sysbus. >>>>>>=20 >>>>>> Why should it matter whether the devices are static or dynamic, for t= he >>>>>> sake of calling something the "system" or the "platform" bus? I woul= d >>>>>> say that QEMU calls "sysbus" the platform bus. >>>>>>=20 >>>>>> Some devices (e.g. the local APIC in x86, or the in-core timers and G= IC >>>>>> in ARM) should probably not be in sysbus at all, and should attach >>>>>> directly to the CPU address space. But that is a quirk in the modeli= ng >>>>>> of those devices, it shouldn't mean that sysbus is not a "platform" b= us. >>>>>=20 >>>>> On e500 for example, we have a predefined CCSR region. That is a machi= ne >>>>> defined "platform bus". The offsets inside that region are strictly >>>>> defined by the spec. >>>>>=20 >>>>> Now take the serial ports. We have space for 2 serial ports inside of >>>>> that CCSR region. We can spawn these 2 ports in the machine file based= >>>>> on -serial, but if you want to spawn them with -device, how do you tel= l >>>>> the machine whether they should go into the "big bucket platform bus" o= r >>>>> the "CCSR platform bus"? >>>>=20 >>>> Two possibilities: >>>>=20 >>>> 1) you would use two instances of sysbus (one default, one created by >>>> the board) and specify ",bus=3Dccsr" on the command line when you want t= o >>>> add the device to the CCSR region. >>>>=20 >>>> The two would work exactly the same way, only with different algorithms= >>>> for resource allocation. >>>>=20 >>>> 2) similar to ISA, you would create a new ccsr-bus device and a new >>>> ccsr-serial device, and use -device ccsr-serial,index=3D[0|1],chardev=3D= foo >>>> to specify which of the two serial ports this is for. Most of the fdt >>>> magic could be shared by the sysbus and CCSR cases. >>>>=20 >>>> I think I prefer (2)... >>>=20 >>> Fair enough. >>>=20 >>> As far as moving "platform bus" logic into sysbus, I'd really like to >>> hold back and see what this whole thing ends up getting used for first. >>>=20 >>> So for now, I'd definitely prefer to keep "platform bus" logic and >>> "sysbus" logic separate. If we realize that every user only ever uses >>> the dynamic sysbus creation in conjunction with our "platform bus" >>> implementation, we can merge them. >>=20 >> Hi Paolo, Alex, >>=20 >> I understand I keep the code in a separate module from sysbus.c. Is that >> the shared conclusion? >=20 > I don't think so, but maybe I misunderstood what Alex wrote. I still think it shouldn't be inside the sysbus files. You can use sysbus de= vices without a platform bus. Alex >=20 > Paolo >=20