Commit Graph

36 Commits

Author SHA1 Message Date
Anthony Liguori 8aca521512 Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging
* afaerber-or/qom-next-2: (22 commits)
  qom: Push error reporting to object_property_find()
  qdev: Remove qdev_prop_exists()
  qbus: Initialize in standard way
  qbus: Make child devices links
  qdev: Connect busses with their parent devices
  qdev: Convert busses to QEMU Object Model
  qdev: Move SysBus initialization to sysbus.c
  qdev: Use wrapper for qdev_get_path
  qdev: Remove qdev_prop_set_defaults
  qdev: Clean up global properties
  qdev: Move bus properties to abstract superclasses
  qdev: Move bus properties to a separate global
  qdev: Push "type" property up to Object
  arm_l2x0: Rename "type" property to "cache-type"
  m48t59: Rename "type" property to "model"
  qom: Assert that public types have a non-NULL parent field
  qom: Drop type_register_static_alias() macro
  qom: Make Object a type
  qom: Add class_base_init
  qom: Add object_child_foreach()
  ...
2012-06-18 10:35:16 -05:00
Anthony Liguori 0d936928ef qdev: Convert busses to QEMU Object Model
This is far less interesting than it sounds.  We simply add an Object to each
BusState and then register the types appropriately.  Most of the interesting
refactoring will follow in the next patches.

Since we're changing fundamental type names (BusInfo -> BusClass), it all needs
to convert at once.  Fortunately, not a lot of code is affected.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Made all new bus TypeInfos static const.]
[AF: Made qbus_free() call object_delete(), required {qom,glib}_allocated]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-18 15:14:38 +02:00
Markus Armbruster dfc65f1f78 Un-inline fdctrl_init_isa()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-06-15 14:03:42 +02:00
Hervé Poussineau a527b5452e isa: Add isa_bus_from_device() method
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
2012-04-28 20:51:54 +02:00
Anthony Liguori 39bffca203 qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion.  I did it in three steps and then
rebased it into a single step which avoids repeatedly touching every file in
the tree.

The first step was a sed-based addition of the parent type to the subclass
registration functions.

The second step was another sed-based removal of subclass registration functions
while also adding virtual functions from the base class into a class_init
function as appropriate.

Finally, a python script was used to convert the DeviceInfo structures and
qdev_register_subclass functions to TypeInfo structures, class_init functions,
and type_register_static calls.

We are almost fully converted to QOM after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-03 10:41:06 -06:00
Anthony Liguori 8f04ee0882 isa: pic: convert to QEMU Object Model
This converts two devices at once because PIC subclasses ISA and converting
subclasses independently is extremely hard.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Hervé Poussineau d1a1be180c isa: move ISABus structure definition to header file
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-20 15:44:30 -06:00
Hervé Poussineau 48a18b3c69 isa: give ISABus/ISADevice to isa_create(), isa_bus_irqs() and isa_get_irq() functions
NULL is a valid bus/device, so there is no change in behaviour.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-20 15:44:30 -06:00
Jan Kiszka b881fbe9f7 pc: Generalize ISA IRQs to GSIs
The ISA bus IRQ range is 0..15. What isa_irq_handler and IsaIrqState are
actually dealing with are the Global System Interrupts. Refactor the
code to clarify this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-16 11:10:48 +00:00
Richard Henderson 0d95952453 isa: Remove isa_init_ioport_range and isa_init_ioport
All users have been converted to either isa_register_ioport
or isa_register_old_portio_list.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:11 +02:00
Avi Kivity d750073472 isa: Add isa_register_portio_list()
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:09 +02:00
Richard Henderson ebf47c24b0 isa: Tidy support code for isabus_get_fw_dev_path
The only user of ISADevice.ioports is isabus_get_fw_dev_path, and it
only looks at the first entry of the array.  Which suggests that this
entire array+sort operation can be replaced by a simple minimum.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Richard Henderson 78e2059352 isa: add isa_register_ioport()
To replace isa_init_ioport and isa_init_ioport_range
as the ISA devices are converted to the memory api.

[avi: use memory_region_size()]

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson c2d0d01202 isa: Pass i/o address space to isa_bus_new
Not used yet, but at least we're provided with the correct region.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:35 +03:00
Avi Kivity c839adec88 isa: add isa_address_space()
A helper that returns the address space used by ISA devices.  Useful
for getting rid of isa_mem_base, multiple ISA buses, or ISA buses behind
bridges.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22 10:47:49 -05:00
Avi Kivity af956cadc3 isa-mmio: convert to memory API
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08 10:22:30 -05:00
Jan Kiszka ee951a37d8 isa-bus: Remove bogus IRQ sharing check
Nothing prevented IRQ sharing on the ISA bus in principle. Not all
boards supported this, neither each and every card nor driver and OS.
Still, there existed valid IRQ sharing scenarios, (at least) two of them
can also be found in QEMU: >2 PC UARTs and the PREP IDE buses.

So remove this artificial restriction from our ISA model.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-21 15:46:53 +01:00
Blue Swirl 86f4a9a5c7 isa: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:43:41 +00:00
Gleb Natapov dee41d58ef Keep track of ISA ports ISA device is using in qdev.
Store all io ports used by device in ISADevice structure.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 21:27:46 +00:00
Alexander Graf 968d683c04 isa_mmio: Always use little endian
This patch converts the ISA MMIO bridge code to always use little endian mmio.
All bswap code that existed was only there to convert from native cpu
endianness to little endian ISA devices.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Blue Swirl 4556bd8b25 Compile dma only once
Use a qemu_irq to request CPU exit.

7 compilations less for the full build.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-22 08:00:52 +00:00
Blue Swirl 84108e128e Compile isa_mmio only once
Push TARGET_WORDS_BIGENDIAN dependency to board level.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-21 19:47:09 +00:00
Anthony Liguori c227f0995e Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem.  Something
like this _must_ be presented on the list first so people can provide input
and cope with it.

This reverts commit 99a0949b72.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01 16:12:16 -05:00
malc 99a0949b72 Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <av1474@comtv.ru>
2009-10-01 22:45:02 +04:00
Gerd Hoffmann 924f6d72d3 qdev: add isa_create() function
Like isa_create_simple, but doesn't call qdev_init, so one can set
properties after creating and before initializing the device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 2e15e23b8a qdev: simplify isa irq assignments
isa-bus owns the isa irqs now, so it can hand them out directly.
There is no need for the separate isa_connect_irqs step, drop it.

Also hard-code isa interrupts which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 86c8615784 qdev: drop iobase properties from isa bus
Lot of ISA devices work at fixed addresses, so having iobase
as bus property doesn't make much sense.  Devices which can
have different iobases will get a device property.

Also simply hard-code stuff which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 81a322d4a1 qdev: add return value to init() callbacks.
Sorry folks, but it has to be.  One more of these invasive qdev patches.

We have a serious design bug in the qdev interface:  device init
callbacks can't signal failure because the init() callback has no
return value.  This patch fixes it.

We have already one case in-tree where this is needed:
Try -device virtio-blk-pci (without drive= specified) and watch qemu
segfault.  This patch fixes it.

With usb+scsi being converted to qdev we'll get more devices where the
init callback can fail for various reasons.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:43:28 -05:00
Gerd Hoffmann e8935eefe5 Move isa_connect_irq calls into isa_create_simple
Now with isa-bus maintaining the isa irqs we can move the
isa_connect_irq() calls into isa_create_simple().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:30:20 -05:00
Jes Sorensen 3a38d437ca Add isa_reserve_irq().
Introduce isa_reserve_irq() which marks an irq reserved and returns
the appropriate qemu_irq entry from the i8259 table.

isa_reserve_irq() is a temporary interface to be used to allocate ISA
IRQs for devices which have not yet been converted to qdev, and for
special cases which are not suited for qdev conversions, such as the
'ferr'.

This patch goes on top of Gerd Hoffmann's which makes isa-bus.c own
the ISA irq table.

[ added isa-bus.o to some targets to fix build failures  -- kraxel ]

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:30:20 -05:00
Gerd Hoffmann 2091ba23e8 isa bus irq changes and fixes.
Changes:

  (1) make isa-bus maintain isa irqs, complain when allocating
      already taken irqs.
  (2) note that (1) works only for isa devices converted to qdev
      already (floppy and ps2/kbd/mouse right now), so more work
      is needed to make this really useful.
  (3) split floppy init into isa and sysbus versions.
  (4) add sysbus->isa bridge & fix -M isapc breakage.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:30:11 -05:00
Gerd Hoffmann f915a11563 qdev/isa: add isa bus support to qdev.
Pretty simple and straigt forward.
IRQs modeled simliar to sysbus.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:
2009-08-10 13:05:28 -05:00
Isaku Yamahata 3299397760 split out ioport related stuffs from vl.c into ioport.c.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-09 16:06:38 -05:00
aliguori 492c30af25 Make DMA bottom-half driven (v2)
The current DMA routines are driven by a call in main_loop_wait() after every
select.

This patch converts the DMA code to be driven by a constantly rescheduled
bottom half.  The advantage of using a scheduled bottom half is that we can
stop scheduling the bottom half when there no DMA channels are runnable.  This
means we can potentially detect this case and sleep longer in the main loop.

The only two architectures implementing DMA_run() are cris and i386.  For cris,
I converted it to a simple repeating bottom half.  I've only compile tested
this as cris does not seem to work on a 64-bit host.  It should be functionally
identical to the previous implementation so I expect it to work.

For x86, I've made sure to only fire the DMA bottom half if there is a DMA
channel that is runnable.  The effect of this is that unless you're using sb16
or a floppy disk, the DMA bottom half never fires.

You probably should test this malc.  My own benchmarks actually show slight
improvement by it's possible the change in timing could affect your demos.

Since v1, I've changed the code to use a BH instead of a timer.  cris at least
seems to depend on faster than 10ms polling.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5573 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-31 17:25:56 +00:00
blueswir1 79383c9c08 Fix some warnings that would be generated by gcc -Wredundant-decls
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5115 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-30 09:51:20 +00:00
pbrook 87ecb68bdf Break up vl.h.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-17 17:14:51 +00:00