Commit Graph

76 Commits

Author SHA1 Message Date
Markus Armbruster 1f5f6638c0 Make first argument of monitor command pci_add work
Simply pass the PCI address through qemu_pci_hot_add_nic() to
pci_nic_init() and through qemu_pci_hot_add_storage() to pci_create().

Before, pci_device_hot_add() passed along the PCI bus to use, and
ignored any user-specified slot.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22 10:15:29 -05:00
Markus Armbruster 5607c38820 Support addr=... in option argument of -net nic
Make net_client_init() accept addr=, put the value into struct
NICinfo.  Use it in pci_nic_init(), and remove arguments bus and
devfn.

Don't support addr= in third argument of monitor command pci_add,
because that clashes with its first argument.  Admittedly unelegant.

Machines "malta" and "r2d" have a default NIC with a well-known PCI
address.  Deal with that the same way as the NIC model: make
pci_nic_init() take an optional default to be used when the user
doesn't specify one.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22 10:15:29 -05:00
Markus Armbruster 07b7d05377 Fix do_pci_register_device() to reject devfn already in use
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22 10:15:29 -05:00
Gleb Natapov 6eaa684746 Add pci_bus_reset() function.
To reset internal irq handling data structures.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Yaniv Kamay <ykamay@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22 10:10:50 -05:00
Avi Kivity 28c2c26495 Rename pci_register_io_region() to pci_register_bar()
This function is used to manage a PCI BAR, so make the more generic
pci_register_io_region() available to other uses.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:38 -05:00
Gerd Hoffmann 074f2fff79 qdev: move name+size into DeviceInfo (v2)
Rationale: move device information from code to data structures.

v2: Adapt the drivers missed in the first version.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-11 13:47:36 +01:00
Blue Swirl 8238467045 Remove unused and misnamed field and variable
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-09 17:25:00 +00:00
Paul Brook 02e2da45c4 Add common BusState
Implement and use a common device bus state.  The main side-effect is
that creating a bus and attaching it to a parent device are no longer
separate operations.  For legacy code we allow a NULL parent, but that
should go away eventually.

Also tweak creation code to veriry theat a device in on the right bus.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-23 00:13:41 +01:00
Paul Brook 53c25cea7d Separate virtio PCI code
Split the PCI host bindings from the VRing transport implementation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-18 18:26:33 +01:00
Paul Brook cf21e106cd Virtio-net qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14 22:35:07 +01:00
Paul Brook 9d07d7579b PCI network qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14 22:35:07 +01:00
Paul Brook 6b1b92d35b PCI qdev support
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14 22:35:07 +01:00
Isaku Yamahata 425c608c48 minor fix of pci_register_bus()
keep first_bus linked list correct.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-03 22:10:59 +03:00
Isaku Yamahata 6407f37373 use PCI_HEADER_TYPE.
use symbolic value instead of 0x0e and related value.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-03 19:03:00 +00:00
aliguori c2c5104b22 Make PCI config status register read-only
From the documentation I can find, this register is supposed to be read-only.

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


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7070 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-10 20:48:17 +00:00
aliguori 376253ece4 monitor: Rework API (Jan Kiszka)
Refactor the monitor API and prepare it for decoupled terminals:
term_print functions are renamed to monitor_* and all monitor services
gain a new parameter (mon) that will once refer to the monitor instance
the output is supposed to appear on. However, the argument remains
unused for now. All monitor command callbacks are also extended by a mon
parameter so that command handlers are able to pass an appropriate
reference to monitor output services.

For the case that monitor outputs so far happen without clearly
identifiable context, the global variable cur_mon is introduced that
shall once provide a pointer either to the current active monitor (while
processing commands) or to the default one. On the mid or long term,
those use case will be obsoleted so that this variable can be removed
again.

Due to the broad usage of the monitor interface, this patch mostly deals
with converting users of the monitor API. A few of them are already
extended to pass 'mon' from the command handler further down to internal
functions that invoke monitor_printf.

At this chance, monitor-related prototypes are moved from console.h to
a new monitor.h. The same is done for the readline API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-05 23:01:23 +00:00
aliguori 880345c484 Parse full PCI device addresses (Markus Armbruster)
This code parses full PCI device addresses.  It then rejects domains
other than zero, because these are not supported in QEMU.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6609 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11 15:21:48 +00:00
aliguori a4c20c6a54 qemu: warn if PCI region is not power of two (Marcelo Tosatti)
Otherwise the PCI size for such regions can be calculated erroneously.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6604 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11 15:21:16 +00:00
aliguori 5851e08cb8 qemu: add pci_unregister_device (Marcelo Tosatti)
Unregister the pci device, unassign its IO and memory regions, and free
associated data.

Add a callback so drivers can free device state.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6603 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11 15:21:10 +00:00
aliguori 72da420859 qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti)
Change the PCI network drivers init functions to return the PCIDev, to
inform which slot has been hot-plugged.

Also record PCIDevice structure on NICInfo to locate for release on
hot-removal.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6593 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11 15:19:52 +00:00
aliguori 3ae8061898 qemu: add pci helper functions (Marcelo Tosatti)
Add pci_find_bus/pci_find_device to be used by PCI hotplug.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6592 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11 15:19:46 +00:00
aliguori 487414f1cb hw: remove error handling from qemu_malloc() callers (Avi Kivity)
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6529 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05 22:06:05 +00:00
blueswir1 173a543b36 Add and use #defines for PCI device classes
This patch adds and uses #defines for PCI device classes and subclases,
using a new pci_config_set_class() function, similar to the recently
added pci_config_set_vendor_id() and pci_config_set_device_id().

Change since v1: fixed compilation of hw/sun4u.c

Signed-off-by: Stuart Brady <stuart.brady@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6491 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-01 19:26:20 +00:00
blueswir1 480b9f24d7 Add Simba device ID
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6465 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-27 19:15:31 +00:00
aliguori cb457d7679 Make pci_nic_init() use qemu_setup_nic_model() (Mark McLoughlin)
Add a table of PCI NIC models to pass to qemu_setup_nic_model().

While we're at it, also add a corresponding table of NIC init
functions.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6287 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-13 19:47:10 +00:00
aurel32 475dc65f6d PCI: Mask writes to RO bits in the command reg of PCI config space
The Command register in the PCI config space has some read-only bits.
Any writes to those bits should be masked out.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6092 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-18 22:43:40 +00:00
aurel32 8098ed414a PCI: Mask writes to RO bits in the status reg of PCI config space
The Status register in the PCI config space has some read-only bits.
Any writes to those bits should be masked out.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6091 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-18 22:43:33 +00:00
aliguori fbe78f4f55 virtio-net support
This adds virtio-net support.  This is based on the virtio-net driver 
that exists in kvm-userspace.  This also adds a new qemu_sendv_packet 
which virtio-net requires.

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



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6073 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-17 19:13:11 +00:00
aliguori d350d97d19 pci: add default pci subsystem id for all devices (Gerd Hoffman)
This sets a default PCI subsystem ID for all emulated PCI devices.  PCI
specs require this, so do it.

In many cases it is enougth to know the PCI ID to handle a device
correctly.  Sometimes a device driver must identify the exact piece of
hardware (via PCI Subsystem ID) though.

What does this patch to qemu devices:

Right now the emulated PCI devices have no PCI subsystem ID, only the
PCI ID.  The discussed patch sets a default PCI subsystem ID for all
emulated devices.  Which will make the qemu devices look pretty much
like in the laptop case: all PCI subsystem IDs will point to qemu by
default.

If a driver emulates a very specific piece of hardware where it has to
emulate more than just the PCI chip, it can overwrite the PCI subsystem
ID without problems.  The es1370 driver does that for example.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5986 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-11 21:15:42 +00:00
aliguori f65ed4c152 KVM: Coalesced MMIO support
MMIO exits are more expensive in KVM or Xen than in QEMU because they 
involve, at least, privilege transitions.  However, MMIO write 
operations can be effectively batched if those writes do not have side 
effects.

Good examples of this include VGA pixel operations when in a planar 
mode.  As it turns out, we can get a nice boost in other areas too.  
Laurent mentioned a 9.7% performance boost in iperf with the coalesced 
MMIO changes for the e1000 when he originally posted this work for KVM.

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



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5961 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-09 20:09:57 +00:00
blueswir1 09bc878a13 Make PCI class description tables const
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5400 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-02 18:33:50 +00:00
balrog 7c23b89203 E1000 NIC emulation (Nir Peleg, patch from Dor Laor).
Applied %s/^\([^I ]*\)^I/\1    /g on e1000.c and added e1000 to help message.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3949 c046a42c-6fe2-441c-8c8c-71466251a162
2008-02-03 02:20:18 +00:00
balrog 52fc1d83bc Save/load PCI-device, PCI-bus and PIIX3 irq-related state (patches by Uri Lublin.
Note that other PCI bridges are not fixed here.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3793 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-09 23:56:13 +00:00
pbrook 9596ebb701 Add statics and missing #includes for prototypes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3683 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-18 01:44:38 +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
ths 3b46e62427 find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-17 08:09:54 +00:00
ths 5fafdf24ef find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16 21:08:06 +00:00
blueswir1 c4a7060cf7 New option -net nic,model=? (Mark Glines)
Network documentation update (Mark Glines)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2880 c046a42c-6fe2-441c-8c8c-71466251a162
2007-05-27 19:41:17 +00:00
ths dcb5b19a4e Know about more PCI device classes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2663 c046a42c-6fe2-441c-8c8c-71466251a162
2007-04-14 12:24:46 +00:00
pbrook d537cf6c86 Unify IRQ handling.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2635 c046a42c-6fe2-441c-8c8c-71466251a162
2007-04-07 18:14:41 +00:00
ths 663e8e5164 Eepro100 emulation, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2584 c046a42c-6fe2-441c-8c8c-71466251a162
2007-04-02 12:35:34 +00:00
ths 451a42127f Fix typo in PCI bridge code.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2470 c046a42c-6fe2-441c-8c8c-71466251a162
2007-03-06 19:36:53 +00:00
ths abcebc7e80 Devfn number for network PCI cards, by Aurelien Jarno.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2314 c046a42c-6fe2-441c-8c8c-71466251a162
2007-01-10 16:17:21 +00:00
ths a2d4e44b48 Fix PCI config space overflow, by Herbert Xu.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2238 c046a42c-6fe2-441c-8c8c-71466251a162
2006-12-10 23:20:45 +00:00
pbrook 5e966ce6f4 PCI IRC routing fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2185 c046a42c-6fe2-441c-8c8c-71466251a162
2006-09-28 19:52:59 +00:00
pbrook 80b3ada7dd Implement sun4u PCI IRQ routing.
Allow multiple PCI busses and PCI-PCI bridges.
Fix bugs in Versatile PCI implementation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2166 c046a42c-6fe2-441c-8c8c-71466251a162
2006-09-24 17:01:44 +00:00
pbrook d2b5931756 PCI shared IRQ fix (original patch by andrzej zaborowski).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2165 c046a42c-6fe2-441c-8c8c-71466251a162
2006-09-24 00:16:34 +00:00
bellard 1941d19c65 PCI save/restore changes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2115 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-17 10:46:34 +00:00
pbrook 4ca9c76f36 Add SCSI controller class.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2106 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-10 01:03:35 +00:00
bellard e3c2613f91 pcnet nic support (Antony T Curtis)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2036 c046a42c-6fe2-441c-8c8c-71466251a162
2006-07-04 11:33:00 +00:00