Michael S. Tsirkin [Mon, 25 Oct 2010 05:46:47 +0000 (07:46 +0200)]
pcie: clean up hot plug notification
Simplify logic for hotplug notification, by tracking state of the
logical interrupt condition. We then simply use this variable to make
the interrupt decision, according to spec.
API is made cleaner as we no longer force users to pass in
old slot control value.
Includes fixes by Isaku Yamahata.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Michael S. Tsirkin [Mon, 25 Oct 2010 05:03:24 +0000 (07:03 +0200)]
pcie: simplify range check
Simplify code slighly by reversing the polarity
for the range check
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Blue Swirl [Sat, 18 Sep 2010 05:53:14 +0000 (05:53 +0000)]
Introduce range.h
Extract range functions from pci.h. These will be used by later patches
by non-PCI devices. Adjust current users.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit
bf1b00712375bea65f2254dea8281fa646eebbd5)
Isaku Yamahata [Wed, 20 Oct 2010 08:18:55 +0000 (17:18 +0900)]
x3130: pcie downstream port
Implement TI x3130 pcie downstream port switch.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 20 Oct 2010 08:18:54 +0000 (17:18 +0900)]
x3130: pcie upstream port
Implement TI x3130 pcie upstream port switch.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 20 Oct 2010 08:18:53 +0000 (17:18 +0900)]
ioh3420: pcie root port in X58 ioh
Implements pcie root port switch in intel X58 ioh
whose device id is 0x3420.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 20 Oct 2010 08:18:52 +0000 (17:18 +0900)]
pcie port: define struct PCIEPort/PCIESlot and helper functions
define struct PCIEPort which represents common part
of pci express port.(root, upstream and downstream.)
add a helper function for pcie port which can be used commonly by
root/upstream/downstream port.
define struct PCIESlot which represents common part of
pcie slot.(root and downstream.) and helper functions for it.
helper functions for chassis, slot -> PCIESlot conversion.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 20 Oct 2010 08:18:51 +0000 (17:18 +0900)]
pci/bridge: fix pci_bridge_reset()
The lower bits of base/limit registers is RO and shouldn't be zero
cleared on reset. This patch fixes it.
In fact, the default value of base/limit registers aren't specified
in the spec. And some bridges disable forwarding on reset instead of
zeroing base/limit registers.
So introduce one function to disable bridge forwarding so that
such bridges can use it. It will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 20 Oct 2010 08:18:50 +0000 (17:18 +0900)]
pcie: comment on hpev_intx
document hpev_intx.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 19 Oct 2010 09:06:34 +0000 (18:06 +0900)]
pcie: helper functions for pcie capability and extended capability
This patch implements helper functions for pci express capability
and pci express extended capability allocation.
NOTE: presence detection depends on pci_qdev_init() change.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 19 Oct 2010 09:06:33 +0000 (18:06 +0900)]
pcie: add pcie constants to pcie_regs.h
add pcie constants to pcie_regs.h.
Those constants should go to Linux pci_regs.h and then the file should
go away eventually.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 19 Oct 2010 09:06:32 +0000 (18:06 +0900)]
msi: implements msi
implements msi related functions.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 19 Oct 2010 09:06:30 +0000 (18:06 +0900)]
pci: use pci_word_test_and_clear_mask() in pci_device_reset()
use pci_clear_bit_word() in pci_device_reset() where appropriate.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 19 Oct 2010 09:06:29 +0000 (18:06 +0900)]
pci: introduce helper function to handle msi-x and msi.
this patch implements helper functions to handle msi-x and msi
uniformly.
They will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 19 Oct 2010 09:06:28 +0000 (18:06 +0900)]
pci: introduce helper functions to test-and-{clear, set} mask in configuration space
This patch introduces helper functions to test-and-{clear, set} mask in configuration
space. pci_{byte, word, long, quad}_test_and_{clear, set}_mask().
They will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 18 Oct 2010 03:17:42 +0000 (12:17 +0900)]
pci: make pci_del_capability() update for w1cmask
Clear w1cmask when deleting a pci capability.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 15 Sep 2010 05:38:26 +0000 (14:38 +0900)]
msix: clear not only INTA, but all INTx when MSI-X is enabled.
clear not only INTA, but all INTx when MSI-X is enabled.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Wed, 15 Sep 2010 05:38:15 +0000 (14:38 +0900)]
pci: implement RW1C register framework.
Implement RW1C register framework.
With this patch, it would be easy to implement
W1C(Write 1 to Clear) register by just setting w1cmask.
Later RW1C register will be used by pcie.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Thu, 9 Sep 2010 02:48:57 +0000 (11:48 +0900)]
pci: improve signature of pci_register_bar().
Make type uint8_t from int because PCIIORegion::type is uint8_t.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Isaku Yamahata [Thu, 9 Sep 2010 02:48:56 +0000 (11:48 +0900)]
pci: don't ignore invalid parameter for pci_register_bar().
Abort when invalid value for region_num is passed to pci_register_bar.
That is caller's bug. Abort instead of silently ignoring invalid value.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Thu, 9 Sep 2010 02:48:55 +0000 (11:48 +0900)]
pci: sorting out type confusion in pci_register_bar().
This patch sorts out invalid use of pcibus_t.
In pci_register_bar(), pcibus_t wmask is used. It should,
however, be uint64_t because it is used to set
pci configuration space value(PCIDevice::wmask)
by pci_set_quad() or pci_set_long().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 6 Sep 2010 07:46:20 +0000 (16:46 +0900)]
pci_ids.h: add vendor id of Texas Intesruments
add vendor id of Texas Intesruments.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 6 Sep 2010 07:46:19 +0000 (16:46 +0900)]
pci: make pci_parse_devfn() aware of func.
make pci_parse_devfn() aware of func. With func = NULL it behave as before.
This will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 6 Sep 2010 07:46:18 +0000 (16:46 +0900)]
pci: call hotplug callback even when not hotplug case for later use.
call hotplug callback even when not hotplug case for later use.
And move hotplug check into hotplug callback.
PCIE slot needs this for card presence detection.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 6 Sep 2010 07:46:17 +0000 (16:46 +0900)]
pci bridge: add helper function for ssvid capability.
helper function to add ssvid capability.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 6 Sep 2010 07:46:16 +0000 (16:46 +0900)]
pci: consolidate pci_add_capability_at_offset() into pci_add_capability().
By making pci_add_capability() the special case of
pci_add_capability_at_offset() of offset = 0,
consolidate pci_add_capability_at_offset() into pci_add_capability().
Cc: Stefan Weil <weil@mail.berlios.de>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 13 Jul 2010 04:01:42 +0000 (13:01 +0900)]
pci_bridge: introduce pci bridge library.
introduce pci bridge library.
convert apb bridge and dec p2p bridge to use new pci bridge library.
save/restore is supported as a side effect.
This is also preparation for pci express root/upstream/downstream port.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 13 Jul 2010 04:01:41 +0000 (13:01 +0900)]
pci_bridge: clean up: remove pci_{register, unregister}_secondary_bus()
Remove pci_{register, unregister}_secondary_bus() by open code.
They are old stype API and aren't used any more by others. So eliminate it.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 13 Jul 2010 04:01:40 +0000 (13:01 +0900)]
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
To avoid confusion of primary bus with secondary bus,
rename PCIBridge::bus to PCIBridge::sec_bus.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 13 Jul 2010 04:01:39 +0000 (13:01 +0900)]
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
Move pci bridge related code into pci_bridge.c from pci.c
for further enhancement. pci.c is big enough now, so split it out.
No code change but exporting some accesser functions.
In fact, few pci bridge functions stays in pci.c.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Mon, 12 Jul 2010 10:36:40 +0000 (19:36 +0900)]
pci: move out pci internal structures, PCIBus, PCIBridge, and pci_bus_info.
move out pci internal structures, PCIBus, PCIBridge and pci_bus_info into
private header file, pci_internals.h.
This is a preparation. Later pci bridge implementation will be
split out form pci.c into pci_bridge.c.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Fri, 16 Jul 2010 14:11:46 +0000 (17:11 +0300)]
vhost: fix miration during device start
We need to know ring layout to allocate log buffer.
So init rings first.
Also fixes a theoretical memory-leak-on-error.
https://bugzilla.redhat.com/show_bug.cgi?id=615228
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Michael S. Tsirkin [Mon, 12 Jul 2010 17:41:02 +0000 (20:41 +0300)]
e1000: secrc support
Add support for secrc field. Reportedly needed by old RHEL guests.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Mon, 12 Jul 2010 17:24:59 +0000 (20:24 +0300)]
e1000: fix access 4 bytes beyond buffer end
We do range check for size, and get size as buffer,
but copy size + 4 bytes (4 is for FCS).
Let's copy size bytes but put size + 4 in length.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Mon, 12 Jul 2010 12:13:02 +0000 (15:13 +0300)]
Merge branch 'master' into pci
Alexandre Courbot [Mon, 12 Jul 2010 05:05:32 +0000 (14:05 +0900)]
target-sh4: Add support for ldc & stc with sgr
Add support for the following missing priviledged intructions:
For SH4:
- stc sgr, Rn
- stc.l sgr, @-Rn
For SH4A:
- ldc Rm, sgr
- ldc.l @Rm+, sgr
Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Alexandre Courbot [Mon, 12 Jul 2010 05:05:31 +0000 (14:05 +0900)]
target-sh4: Split the LDST macro into 2 sub-macros
The LDST macro is used to generate ldc and stc instructions that work with a
specific register. However, the SGR register only supports stc up to SH4A,
which supports both stc and ldc. This patch creates two sub-macros named LD
and ST that handle generating ldc and stc instructions separately, and
redeclares LDST to use these sub-macro.
Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Michael S. Tsirkin [Tue, 6 Jul 2010 11:17:51 +0000 (14:17 +0300)]
pci: fix bridge update
bridge config write should trigger updates
on the secondary bus. never on the primary bus.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Tue, 22 Jun 2010 13:22:49 +0000 (16:22 +0300)]
virtio-net: correct packet length math
We were requesting too much when checking buffer
length: size already includes host header length.
Further, we should not exit if we get a packet that
is too long, since this might not be under control
of the guest. Just drop the packet.
Red Hat bz 591494
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 22 Jun 2010 02:55:35 +0000 (11:55 +0900)]
pci hotplug: make pci hotplug return value to caller
make pci hotplug callback return value to caller.
And when returning error, allocated resources are freed.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Thu, 17 Jun 2010 11:01:38 +0000 (14:01 +0300)]
vmware_vga: fix reset value for command register
Make init value for this register match the spec.
BAR address is 0 at init, so enabling it
only works by chance.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Thu, 17 Jun 2010 11:17:59 +0000 (14:17 +0300)]
rtl8139: address TODOs
Make rtl8139 spec compliant, fixing reset values
for command register.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Tue, 15 Jun 2010 03:48:36 +0000 (12:48 +0900)]
pci hotplug: make pci_device_hot_remove() static
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Thu, 17 Jun 2010 11:08:24 +0000 (14:08 +0300)]
pcnet: address TODOs
pcnet enables memory/io on init, which
does not make sense as BAR values are wrong.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Isaku Yamahata [Thu, 17 Jun 2010 06:15:45 +0000 (15:15 +0900)]
pci: fix pci_device_reset
Clear interrupt disable bit on reset, according to PCI spec.
Fix pci_device_reset() with 64bit BAR.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Alexander Graf [Wed, 30 Jun 2010 08:41:12 +0000 (10:41 +0200)]
AppleSMC device emulation
Intel Macs have a chip called the "AppleSMC" which they use to control
certain Apple specific parts of the hardware, like the keyboard background
light.
That chip is also used to store a key that Mac OS X uses to decrypt binaries.
This patch adds emulation for that chip, so we're getting one step further
to having Mac OS X run natively on Qemu.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Stefan Weil [Sun, 11 Jul 2010 16:34:28 +0000 (18:34 +0200)]
Documentation: Fix spelling bugs
rewuired -> required
ths -> this
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Hidetoshi Seto [Thu, 8 Jul 2010 05:26:18 +0000 (14:26 +0900)]
Makefile: Not every shell support {}
So interpret it by hand.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Hidetoshi Seto [Thu, 8 Jul 2010 05:26:00 +0000 (14:26 +0900)]
Makefile: add fsdev/*.{o,d} to clean
There were fsdev/qemu-fsdev.{o,d} not removed at "make clean".
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:33 +0000 (16:15 +0900)]
pci: set PCI multi-function bit appropriately.
Set PCI multi-function bit according to multifunction property.
PCI address, devfn ,is exported to users as addr property,
so users can populate pci function(PCIDevice in qemu)
at arbitrary devfn.
It means each function(PCIDevice) don't know whether pci device
(PCIDevice[8]) is multi function or not.
So this patch allows user to set multifunction bit via property
and checks whether multifunction bit is set correctly.
Cc: Juan Quintela <quintela@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:32 +0000 (16:15 +0900)]
pci_bridge: make pci bridge aware of pci multi function bit.
make pci bridge aware of pci multi function property and let pci generic
code to set the bit.
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:31 +0000 (16:15 +0900)]
pci: set multifunction property for normal device.
use pci_create_simple_multifunction() for normal device which sets
multifunction bit.
At the moment, only pc_piix.c and mips_malta.c uses multifunction
devices with piix3/4 pci-isa bridge.
And other boards don't populate those devices.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:30 +0000 (16:15 +0900)]
pci: introduce multifunction property.
introduce multifunction property.
Also introduce new convenient device creation function which
will be used later.
For bisectability this patch doesn't do anything, but sets the property
resulting in no functional changes.
Actual changes will be introduced by later patch.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:29 +0000 (16:15 +0900)]
qdev: implement qdev_prop_set_bit().
implement qdev_prop_set_bit().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:28 +0000 (16:15 +0900)]
pci: remove PCIDeviceInfo::header_type
replace PCIDeviceInfo::header_type with is_bridge
as suggested by Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:27 +0000 (16:15 +0900)]
pci: don't overwrite multi functio bit in pci header type.
Don't overwrite pci header type.
Otherwise, multi function bit which pci_init_header_type() sets
appropriately is lost.
Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero
which is already zero cleared.
how to test:
run qemu and issue info pci to see whether a device in question is
normal device, not pci-to-pci bridge.
This is handy because guest os isn't required.
tested changes:
The following files are covered by using following commands.
sparc64-softmmu
apb_pci.c, vga-pci.c, cmd646.c, ne2k_pci.c, sun4u.c
ppc-softmmu
grackle_pci.c, cmd646.c, ne2k_pci.c, vga-pci.c, macio.c
ppc-softmmu -M mac99
unin_pci.c(uni-north, uni-north-agp)
ppc64-softmmu
pci-ohci, ne2k_pci, vga-pci, unin_pci.c(u3-agp)
x86_64-softmmu
acpi_piix4.c, ide/piix.c, piix_pci.c
-vga vmware vmware_vga.c
-watchdog i6300esb wdt_i6300esb.c
-usb usb-uhci.c
-sound ac97 ac97.c
-nic model=rtl8139 rtl8139.c
-nic model=pcnet pcnet.c
-balloon virtio virtio-pci.c:
untested changes:
The following changes aren't tested.
prep_pci.c: ppc-softmmu -M prep should cover, but core dumped.
unin_pci.c(uni-north-pci): the caller is commented out.
openpic.c: the caller is commented out in ppc_prep.c
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:26 +0000 (16:15 +0900)]
pci: insert assert that auto-assigned-address function is single function device.
Auto-assigned-address pci function (passing devfn = -1) is always
single function.
This patch adds assert() to guarantee that auto-assigned-address function
is always single function device at function = 0.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Isaku Yamahata [Wed, 23 Jun 2010 07:15:25 +0000 (16:15 +0900)]
pci: use PCI_DEVFN() where appropriate.
Use PCI_DEVFN() and PCI_FUNC_MAX where appropriate.
This patch make it clear that func = 0.
test:
The following object files with/without this patch are stripped and compared.
They remains same.
arm-softmmu/versatile_pci.o
libhw32/ppce500_pci.o
libhw32/unin_pci.o
libhw64/ppce500_pci.o
libhw64/unin_pci.o
mips-softmmu/gt64xxx.o
mips64-softmmu/gt64xxx.o
mips64el-softmmu/gt64xxx.o
mipsel-softmmu/gt64xxx.o
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Yu Liu <yu.liu@freescale.com>
Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Aurelien Jarno [Fri, 18 Jun 2010 17:32:43 +0000 (19:32 +0200)]
target-mips: add loongson 2E & 2F integer instructions
This patch adds support for loongson 2E & 2F instructions. They are the
same instructions, but differ by the opcode encoding.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Blue Swirl [Wed, 7 Jul 2010 19:37:53 +0000 (19:37 +0000)]
Fix warning about uninitialized variable
With gcc 4.2.1-sjlj (mingw32-2) I get this warning:
/src/qemu/exec.c: In function 'qemu_ram_alloc':
/src/qemu/exec.c:2777: warning: 'offset' may be used uninitialized in this function
Fix by initializing the variable.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
MORITA Kazutaka [Wed, 7 Jul 2010 06:25:30 +0000 (15:25 +0900)]
sheepdog: fix compile error on systems without TCP_CORK
WIN32 is not only the system which doesn't have TCP_CORK (e.g. OS X).
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Anthony Liguori [Tue, 6 Jul 2010 15:48:01 +0000 (10:48 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging
Alex Williamson [Fri, 2 Jul 2010 17:13:29 +0000 (11:13 -0600)]
ramblocks: No more being lazy about duplicate names
Now that we have a working qemu_ram_free() and the primary runtime
user of it has been updated, don't be lenient about duplicate id strings.
We also shouldn't need to create them ondemand at the target.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:10:19 +0000 (11:10 -0600)]
pci: Free the space allocated for the option rom on removal
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 2 Jul 2010 17:13:17 +0000 (11:13 -0600)]
qemu_ram_free: Implement it
Now that we can support a ram_addr_t space with holes, we can implement
qemu_ram_free().
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:10:05 +0000 (11:10 -0600)]
savevm: Create a new continue flag to avoid resending block name
Allows us to compress the protocol a bit by setting a flag on the
offset which indicates we're still working within the same block
as last time. That way we can avoid sending the block name for
every page. Suggested by Anthony Liguori.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:57 +0000 (11:09 -0600)]
savevm: Use RAM blocks for basis of migration
We don't want to assume a contiguous address space, so migrate based
on RAM blocks instead of a fixed linear address map. This will allow
us to have holes in the ram_addr_t namespace, so we can implement
qemu_ram_free().
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:50 +0000 (11:09 -0600)]
savevm: Migrate RAM based on name/offset
Synchronize RAM blocks with the target and migrate using name/offset
pairs. This ensures both source and target have the same view of
RAM and that we get the right bits into the right slot.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:43 +0000 (11:09 -0600)]
ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path
With these two pieces in place, we can start naming ramblocks. When
the device is present and it lives on a bus that provides a device
path, we concatenate the path and the provided name. Otherwise we
just use name. The resulting id string must be unique. For now we
assume an allocation for the same name and size is a device that has
been removed and reinserted and return the same block. This will go
away once qemu_ram_free() is implemented.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:35 +0000 (11:09 -0600)]
qemu_ram_alloc: Add DeviceState and name parameters
These will be used to generate unique id strings for ramblocks. The name
field is required, the device pointer is optional as most callers don't
have a device. When there's no device or the device isn't a child of
a bus implementing BusInfo.get_dev_path, the name should be unique for
the platform.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:28 +0000 (11:09 -0600)]
virtio-net: Incorporate a DeviceState pointer and let savevm track instances
Stuff a pointer to the DeviceState into the VirtIONet structure so that
we can easily remove the vmstate entry later. Also, let vmstate track
the instance number (it should always be zero internally since the
device path should now be unique).
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:21 +0000 (11:09 -0600)]
eepro100: Add a dev field to eeprom new/free functions
This allows us to create a more meaningful savevm string.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:14 +0000 (11:09 -0600)]
savevm: Make use of DeviceState
For callers that pass a device we can traverse up the qdev tree and
make use of the BusInfo.get_dev_path information for creating unique
savevm id strings. This avoids needing to rely on the instance number,
which can cause problems with device initialization order and hotplug.
For compatibility, we also store away the old id string and instance
so we can accept migrations from VMs as we add new get_dev_path
implementations.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:09:07 +0000 (11:09 -0600)]
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceState
when registering a savevm. For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:08:59 +0000 (11:08 -0600)]
pci: Implement BusInfo.get_dev_path()
This works great for PCI since a <segment>:<bus>:<dev>.<fn> uniquely
describes a global address. No need to traverse up the qdev tree.
PCI segment support is a placeholder for compatibility once we
support multiple segments.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:08:52 +0000 (11:08 -0600)]
qdev: Add a get_dev_path() function to BusInfo
This function is meant to provide a stable device path for buses
which are able to implement it. If a bus has a globally unique
addresses scheme, one address level may be sufficient to provide
a path. Other buses may need to recursively traverse up the
qdev tree.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:08:45 +0000 (11:08 -0600)]
pc: Allocate all ram in a single qemu_ram_alloc()
This will benefit us when we migrate based on ramblock name since
we won't be bouncing between separate blocks.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alex Williamson [Fri, 25 Jun 2010 17:08:38 +0000 (11:08 -0600)]
Remove uses of ram.last_offset (aka last_ram_offset)
We currently need this either to allocate the next ram_addr_t for a
new block, or for total memory to be migrated. Both of which we can
calculate without need of this to keep us in a contiguous address space.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Gleb Natapov [Mon, 5 Jul 2010 08:36:34 +0000 (11:36 +0300)]
make rtc alatm work
Convert alarm time from BCD if needed before comparing with current
time.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Tue, 6 Jul 2010 08:58:03 +0000 (10:58 +0200)]
scsi: Fix SCSI bus reset
When the controller raises the SCSI reset line, we have to perform the
requested reset on all disks attached to the controller's bus. Moreover,
reset is edge triggered, so avoid repeating it if the line was already
high.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Tue, 6 Jul 2010 08:49:57 +0000 (10:49 +0200)]
Fix io-thread build breakage of
a88790a14f
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
MORITA Kazutaka [Sun, 20 Jun 2010 20:01:00 +0000 (05:01 +0900)]
block: add sheepdog driver for distributed storage support
Sheepdog is a distributed storage system for QEMU. It provides highly
available block level storage volumes to VMs like Amazon EBS. This
patch adds a qemu block driver for Sheepdog.
Sheepdog features are:
- No node in the cluster is special (no metadata node, no control
node, etc)
- Linear scalability in performance and capacity
- No single point of failure
- Autonomous management (zero configuration)
- Useful volume management support such as snapshot and cloning
- Thin provisioning
- Autonomous load balancing
The more details are available at the project site:
http://www.osrg.net/sheepdog/
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Mon, 28 Jun 2010 19:25:17 +0000 (21:25 +0200)]
ide: Reject invalid CHS geometry
drive_init() doesn't permit invalid CHS for if=ide, but that's
worthless: we get it via if=none and -device.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Mon, 28 Jun 2010 17:10:36 +0000 (19:10 +0200)]
ide: Reject readonly drives unless CD-ROM
drive_init() doesn't permit option readonly for if=ide, but that's
worthless: we get it via if=none and -device.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Mon, 28 Jun 2010 17:07:51 +0000 (19:07 +0200)]
ide: Make ide_init_drive() return success
It still always succeeds. The next commits will add failures.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Fri, 28 May 2010 11:32:45 +0000 (13:32 +0200)]
ide: Replace IDEState members is_cdrom, is_cf by drive_kind
The two aren't independent variables. Make that obvious.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Mon, 28 Jun 2010 06:36:53 +0000 (08:36 +0200)]
ide: Improve error messages
Use error_report(), because it points to the error location.
Reword "tried to assign twice" messages to make it clear that we're
complaining about the unit property.
Report invalid unit property instead of failing silently.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Thu, 27 May 2010 19:08:18 +0000 (21:08 +0200)]
scsi: Error locations for -drive if=scsi device initialization
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Thu, 27 May 2010 19:06:04 +0000 (21:06 +0200)]
error: New qemu_opts_loc_restore()
Needed for decent error locations when complaining about options
outside of qemu_opts_foreach(). That one sets the location
already.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Thu, 27 May 2010 18:02:28 +0000 (20:02 +0200)]
scsi: Reject unimplemented error actions
drive_init() doesn't permit rerror for if=scsi, but that's worthless:
we get it via if=none and -device.
Moreover, scsi-generic doesn't support werror. Since drive_init()
doesn't catch that, option werror was silently ignored even with
if=scsi.
Wart: unlike drive_init(), we don't reject the default action when
it's explicitly specified. That's because we can't distinguish "no
rerror option" from "rerror=report", or "no werror" from
"rerror=enospc". Left for another day.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Thu, 27 May 2010 19:23:08 +0000 (21:23 +0200)]
qdev: Don't hw_error() in qdev_init_nofail()
Some of the failures are internal errors, and hw_error() is okay then.
But the common way to fail is bad user input, e.g. -global
isa-fdc.driveA=foo where drive foo has an unsupported rerror value.
exit(1) instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Thu, 27 May 2010 18:06:12 +0000 (20:06 +0200)]
fdc: Reject unimplemented error actions
drive_init() doesn't permit them for if=floppy, but that's worthless:
we get them via if=none and -global.
This can make device initialization fail. Since all callers of
fdctrl_init_isa() ignore its value, change it to die instead of
returning failure. Without this, some callers would ignore the
failure, and others would crash.
Wart: unlike drive_init(), we don't reject the default action when
it's explicitly specified. That's because we can't distinguish "no
rerror option" from "rerror=report", or "no werror" from
"rerror=enospc". Left for another day.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Mon, 28 Jun 2010 08:25:20 +0000 (10:25 +0200)]
raw-posix: Fix test for host CD-ROM
raw_pread_aligned() retries up to two times if the block device backs
a virtual CD-ROM (a drive with media=cdrom and if=ide, scsi, xen or
none). This makes no sense. Whether retrying reads can correct read
errors can only depend on what we're reading, not on how the result
gets used. We need to check what whether we're reading from a
physical CD-ROM or floppy here.
I doubt retrying is useful even then. Left for another day.
Impact:
* Virtual CD-ROM backed by host_cdrom behaves the same.
* Virtual CD-ROM backed by file or host_device no longer retries.
* A drive backed by host_cdrom now retries even if it's not a virtual
CD-ROM.
* Any drive backed by host_floppy now retries.
While there, clean up gratuitous use of goto.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Mon, 28 Jun 2010 08:45:02 +0000 (10:45 +0200)]
block migration: Fix test for read-only drive
init_blk_migration_it() skips drives with type hint BDRV_TYPE_CDROM.
The intention is to skip read-only drives. However, BDRV_TYPE_CDROM
is only a hint. It is currently sufficent for read-only. But it's
not necessary, and it may not remain sufficient.
Use bdrv_is_read_only() instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Markus Armbruster [Fri, 25 Jun 2010 13:26:48 +0000 (15:26 +0200)]
blockdev: Clean up how readonly persists across virtual media change
Since commit
cb4e5f8e, monitor command change makes the new media
readonly iff the type hint is BDRV_TYPE_CDROM, i.e. the drive was
created with media=cdrom. The intention is to avoid changing a block
device's read-only-ness. However, BDRV_TYPE_CDROM is only a hint. It
is currently sufficent for read-only. But it's not necessary, and it
may not remain sufficient.
Use bdrv_is_read_only() instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
john cooper [Fri, 2 Jul 2010 17:44:25 +0000 (13:44 -0400)]
Add virtio disk identification support
This patch adds the final missing bits for support of
passing a serial/id string to a virtio-blk guest driver.
The guest-side component already exists in the virtio
driver, and has recently been reworked by Ryan to export
a /sys interface for retrieval of the id from guest userland.
Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 29 Jun 2010 10:37:54 +0000 (12:37 +0200)]
qcow2/vdi: Change check to distinguish error cases
This distinguishes between harmless leaks and real corruption. Hopefully users
better understand what qemu-img check wants to tell them.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 29 Jun 2010 09:43:13 +0000 (11:43 +0200)]
qemu-img check: Distinguish different kinds of errors
People think that their images are corrupted when in fact there are just some
leaked clusters. Differentiating several error cases should make the messages
more comprehensible.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Jes Sorensen [Tue, 6 Jul 2010 08:50:27 +0000 (10:50 +0200)]
Include sys/mman.h before qemu-options.h
The result of parsing qemu-options.def depends on whehter or not
MAP_POPULATE is defined, so make sure to include sys/mman.h before
including qemu-options.h.
Reported by Frank Arnold.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Tue, 6 Jul 2010 13:31:43 +0000 (08:31 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging