qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: "Liu >> \"Liu, Jinsong\"" <jinsong.liu@intel.com>,
	Avi Kivity <avi@redhat.com>, qemu-devel <qemu-devel@nongnu.org>,
	Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH v2 0/7] APIC/IOAPIC cleanup
Date: Thu, 19 Aug 2010 16:51:25 -0500	[thread overview]
Message-ID: <4C6DA75D.40303@codemonkey.ws> (raw)
In-Reply-To: <AANLkTin4m9v07ut=wad_Mh-BKhBfO0jMP9xCikV9eeTH@mail.gmail.com>

On 08/19/2010 04:21 PM, Blue Swirl wrote:
>> Should CPUs appear in the QEMU device tree?
>>      
> They have several properties that should be user visible.
>    

Sure, but that's an argument for having some of the qdev features (like 
variant properties) be consumable outside of qdev.

>> requirement to sit on a bus.  A UART16650A does not sit on bus.  It sits on
>> a card and is wired to the ISA bus or is sometimes wired directly to pins on
>> a CPU on a SoC.
>>      
> Or all buses should be unified, so all devices could be wired into any board.
>    

But that defeats the notion of having bus level interfaces.  You really 
want the virtio PCI layer to only use PCI functions and specifically to 
interact with PCI concepts that don't exist in other busses (like IO 
regions and config space).  However, you also want the ability to 
interact with a virtio device through a well defined interface that 
isn't PCI specific.

The only way to do this right now is having a bus with a single device.  
I've been working on the serial device, and what this requires is having 
an ISASerialDevice which is-a ISADevice.  The ISASerialDevice has-a 
SerialBus and the SerialBus contain a single SerialDevice which is-a 
DeviceState.

But the ISASerialDevice has to assume that the SerialBus contains only a 
single child because it needs to connect the GPIO out from the 
SerialDevice to the ISA irq that's assigned.

It would be a whole lot simpler to break the "all devices sit on busses" 
assumption that we have today and simply have the ISASerialDevice has-a 
SerialDevice with no additional layers of bus indirection.

> IIRC I tried also that approach when I worked on this patch set but
> there were some problems. Maybe with header file conflicts, or
> qemu_irq was not available to CPU code.
>    

Okay, I'll queue it up for a future day.

>> Because not all devices on the sysbus can be hot added so if you made the
>> bus hotpluggable, it would basically defeat the point of even marking a bus
>> as not supporting hot plug.
>>
>> IOW, the whole bus is either hot pluggable or not.  You cannot just say that
>> device X can be hotplugged but nothing else.
>>      
> Perhaps the hotplugging system in QEMU needs some rethinking instead.
> Many real devices are not hot pluggable.
>    

That's probably fair.  I don't think hot plugging should exist at the 
qdev level.  Hot plugging is a very bus specific concept with very bus 
specific restrictions.  For instance, with PCI, you can only plug at 
slot granularities whereas today, we don't really model multi-function 
devices as anything more than a set of unrelated devices.  So there's 
really no way you could conceptually hot plug a multi-function virtio 
adapter although you can pretty trivially create one statically.

>>>> I think the options are to allow non-bus devices (like the APIC) or make
>>>> the
>>>> APIC a special case that's part of the CPU emulation.
>>>>
>>>>          
>>> No. There could also be a new hotpluggable bus type, CPUBus, one
>>> instance between each CPU and APIC. Or SysBusWithHotPlug. But I don't
>>> see how that would be different from SysBus.
>>>
>>>        
>> Neither approach maps well to real hardware.  An x86 CPU cannot exist
>> without a local APIC and a local APIC cannot exist without an x86 CPU.  The
>> two are fundamentally tied together.
>>      
> What about 486? Or 82489?
>    

Don't confuse the local APIC with the PIC or the I/O APIC.

The local APIC has always existed in the CPU core.  There is also an I/O 
APIC which exists outside of the CPU core.  The local APIC was 
introduced with SMP support.

The PIC and IO APIC totally make sense to be modelled as qdev.

>>   It's like modelling a TLB as a
>> separate device.
>>      
> That has surely happened in ancient times.
>    

Yes, but the programming model was different.

Look at the PIC compared to the lapic.  The PIC is programmed via pio at 
a fixed location.  There is only one PIC and it interacts with the 
system just like all other devices.  IOW, there is no reference to CPUState.

When you look at the local APIC (apic.c) however, you see that it's the 
only device in the tree that actually interacts with a CPUState.  The 
notion of cpu_get_current_apic() is a good example of the tricks needed 
to make this work.

The local APIC is a cpu feature, not a device.

Regards,

Anthony Liguori

  reply	other threads:[~2010-08-19 21:51 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-12 21:14 [Qemu-devel] [PATCH v2 0/7] APIC/IOAPIC cleanup Blue Swirl
2010-06-13 16:56 ` [Qemu-devel] " Jan Kiszka
2010-06-13 17:03   ` Andreas Färber
2010-06-13 17:53     ` Blue Swirl
2010-06-13 18:17       ` Andreas Färber
2010-06-13 17:49   ` Blue Swirl
2010-08-19 19:33 ` [Qemu-devel] " Anthony Liguori
2010-08-19 20:09   ` Blue Swirl
2010-08-19 20:49     ` Anthony Liguori
2010-08-19 21:21       ` Blue Swirl
2010-08-19 21:51         ` Anthony Liguori [this message]
2010-08-19 22:52           ` malc
2010-08-20  1:01             ` Anthony Liguori
2010-08-20 10:00               ` malc
2010-08-20  8:42           ` [Qemu-devel] " Paolo Bonzini
2010-08-20 17:01           ` [Qemu-devel] " Markus Armbruster
2010-08-20 18:38             ` Anthony Liguori
2010-08-22 20:28               ` Avi Kivity
2010-08-22 21:02                 ` Anthony Liguori
2010-08-23  5:46                   ` Avi Kivity
2010-08-23 13:23                     ` Anthony Liguori
2010-08-23 13:42                       ` Avi Kivity
2010-08-23 13:48                         ` Anthony Liguori
2010-08-23 14:00                           ` Avi Kivity
2010-08-23 14:26                             ` Anthony Liguori
2010-08-23 14:32                               ` Avi Kivity
2010-08-23 14:47                                 ` Anthony Liguori
2010-08-23 15:10                                   ` Markus Armbruster
2010-08-23 16:05                                     ` Anthony Liguori
2010-08-23 17:36                                       ` Markus Armbruster
2010-08-23 17:47                                         ` Anthony Liguori
2010-08-23 18:24                                       ` [Qemu-devel] " Jan Kiszka
2010-08-23 18:29                                         ` Anthony Liguori
2010-08-23 15:14                                   ` [Qemu-devel] " Avi Kivity
2010-08-23 16:02                                     ` Anthony Liguori
2010-08-24  9:51                                       ` Avi Kivity
2010-08-20 19:26           ` Blue Swirl
2010-08-20 10:35       ` [Qemu-devel] " Jan Kiszka
2010-08-22  9:37       ` [Qemu-devel] " Avi Kivity
2010-08-22 18:52         ` Anthony Liguori
2010-08-22 19:44           ` Avi Kivity
2010-08-22 20:03             ` Anthony Liguori
2010-08-22 20:33               ` Avi Kivity
2010-08-22 21:06                 ` Anthony Liguori
2010-08-23  5:49                   ` Avi Kivity
2010-08-23  9:09                     ` [Qemu-devel] " Jan Kiszka
2010-08-23  9:25                       ` Avi Kivity
2010-08-23 10:11                         ` Alexander Graf
2010-08-23 10:15                           ` Avi Kivity
2010-08-23 10:18                             ` Alexander Graf
2010-08-23 10:25                               ` Avi Kivity
2010-08-22 21:07             ` [Qemu-devel] " Anthony Liguori
2010-08-23  5:48               ` Avi Kivity
2010-08-22  9:13   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C6DA75D.40303@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=jinsong.liu@intel.com \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).