Commit graph

8183 commits

Author SHA1 Message Date
Michael S. Tsirkin
ff3a8066e6 virtio-net: enable mrg buf header in tap on linux
Modern linux supports arbitrary header size,
which makes it possible to pass mrg buf header
to tap directly without iovec mangling.
Use this capability when it is there.

This removes the need to deal with it in
vhost-net as we do now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
6e371ab867 virtio-net: test peer header support at init time
There's no reason to query header support at random
times: at load or feature query.
Driver also might not query functions.
Cleaner to do it at device init.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
e043ebc6f9 virtio-net: minor code simplification
During packet filtering, we can now use host hdr len
to offset incoming buffer unconditionally.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
7b80d08efc virtio-net: simplify rx code
Remove code duplication using guest header length that we track.
Drop specific layout requirement for rx buffers: things work
using generic iovec functions in any case.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
14761f9cf7 virtio-net: switch tx to safe iov functions
Avoid mangling iovec manually: use safe iov_*
functions.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
c8d28e7e33 virtio-net: first s/g is always at start of buf
We know offset is 0, assert that.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
280598b7a5 virtio-net: refactor receive_hdr
Now that we know host hdr length, we don't need to
duplicate the logic in receive_hdr: caller can
figure out the offset itself.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
63c5872873 virtio-net: use safe iov operations for rx
Avoid magling iov manually: use safe iov operations
for processing packets incoming to guest.
This also removes the requirement for virtio header to
fit the first s/g entry exactly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
22cc84db6e virtio-net: avoid sg copy
Avoid tweaking iovec during receive. This removes
the need to copy the vector.
Note: we currently have an evil cast in work_around_broken_dhclient
and unfortunately this patch does not fix it - just
pushes the evil cast to another place.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:23 +02:00
Michael S. Tsirkin
e35e23f655 virtio-net: track host/guest header length
Tracking these in device state instead of
re-calculating on each packet. No functional
changes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 18:25:22 +02:00
Jason Baron
bc927e488c pcie: Convert PCIExpressHost to use the QOM.
Let's use PCIExpressHost with QOM.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:45 +02:00
Jason Baron
c702ddb8da pcie: pass pcie window size to pcie_host_mmcfg_update()
This allows q35 to pass/set the size of the pcie window in its update routine.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:45 +02:00
Jan Kiszka
f774856990 pci: Add class 0xc05 as 'SMBus'
[jbaron@redhat.com: add PCI_CLASS_SERIAL_SMBUS definition]
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Isaku Yamahata
91e5615984 pci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle
Introduce pci_swizzle_map_irq_fn() for interrupt pin swizzle which is
standardized. PCI bridge swizzle is common logic, by introducing
this function duplicated swizzle logic will be avoided later.

[jbaron@redhat.com: drop opaque argument]
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Isaku Yamahata
9e38f56183 pci_ids: add intel 82801BA pci-to-pci bridge id
Adds pci id constants which will be used by q35.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Isaku Yamahata
b56d701f1d pci: pci capability must be in PCI space
pci capability must be in PCI space.
It can't lay in PCIe extended config space.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Michael S. Tsirkin
e26631b746 pci: make each capability DWORD aligned
PCI spec (see e.g. 6.7 Capabilities List in spec rev 3.0)
requires that each capability is DWORD aligned.
Ensure this when allocating space by rounding size up to 4.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Michael S. Tsirkin
dc59944bc9 qemu: enable PV EOI for qemu 1.3
Enable KVM PV EOI by default. You can still disable it with
-kvm_pv_eoi cpu flag. To avoid breaking cross-version migration,
enable only for qemu 1.3 (or in the future, newer) machine type.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Alex Williamson
05c0621e64 pci: Return PCI_INTX_DISABLED when no bus INTx routing support
Rather than assert, simply return PCI_INTX_DISABLED when we don't
have a pci_route_irq_fn.  PIIX already returns DISABLED for an
invalid pin, so users already deal with this state.  Users of this
interface should only be acting on an ENABLED or INVERTED return
value (though we really have no support for INVERTED).  Also
complain loudly when we hit this so we don't forget it's missing.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-10-29 17:59:06 +02:00
Alex Williamson
2b199f9318 pci-assign: Use msi_get_message()
pci-assign only uses a subset of the flexibility msi_get_message()
provides, but it's still worthwhile to use it.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Alex Williamson
39b9bc626a msi: Add msi_get_message()
vfio-pci and pci-assign both do this on their own for setting up
direct MSI injection through KVM.  Provide a helper function for
this in MSI code.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Alex Williamson
4774d7b258 pci-assign: Use pci_intx_route_changed()
Replace open coded version

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Alex Williamson
d6e65d54f0 pci: Helper function for testing if an INTx route changed
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-10-29 17:59:06 +02:00
Alexander Graf
a178274efa PPC: pseries: Remove hack for PIO window
Now that all users of old_portio are gone, we can remove the hack
that enabled us to support them.

Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:56 +01:00
Alexander Graf
a1bc20dfbb PPC: e500: Map PIO space into core memory region
On PPC, we don't have PIO. So usually PIO space behind a PCI bridge is
accessible via MMIO. Do this mapping explicitly by mapping the PIO space
of our PCI bus into a memory region that lives in memory space.

Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:56 +01:00
Alexander Graf
626c7a171e xen_platform: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:56 +01:00
Alexander Graf
360d613e52 vmport: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
5ec3a23e6c serial: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
1bebb0ad17 rtl8139: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
d540bfe0e7 pckbd: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
93ef419282 pc port92: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
0da8c842b7 mc146818rtc: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
087bd055ac m48t59: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
0505bcdec8 i8254: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
f3726fd78d es1370: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:55 +01:00
Alexander Graf
df6db5b32a virtio-pci: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
Alexander Graf
d6a6d362aa ac97: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
David Gibson
74d042e5ce pseries: Implement qemu initiated shutdowns using EPOW events
At present, using 'system_powerdown' from the monitor or otherwise
instructing qemu to (cleanly) shut down a pseries guest will not work,
because we did not have a method of signalling the shutdown request to the
guest.

PAPR does include a usable mechanism for this, though it is rather more
involved than the equivalent on x86.  This involves sending an EPOW
(Environmental and POwer Warning) event through the PAPR event and error
logging mechanism, which also has a number of other functions.

This patch implements just enough of the event/error logging functionality
to be able to send a shutdown event to the guest.  At least with modern
guest kernels and a userspace that is up and running, this means that
system_powerdown from the qemu monitor should now work correctly on pseries
guests.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
David Gibson
1bfb37d1e0 target-ppc: Rework storage of VPA registration state
With PAPR guests, hypercalls allow registration of the Virtual Processor
Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow
for certain communication between the guest and hypervisor.  Currently, we
store the addresses of the three areas and the size of the dtl in
CPUPPCState.

The SLB shadow and DTL are variable sized, with the size being retrieved
from within the registered memory area at the hypercall time.  This size
can later be overwritten with other information, however, so we need to
save the size as of registration time.  We already do this for the DTL,
but not for the SLB shadow, so this patch fixes that.

In addition, we change the storage of the VPA information to use fixed
size integer types which will make life easier for syncing this data with
KVM, which we will need in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
David Gibson
c89d52997c pseries: Don't allow duplicate registration of hcalls or RTAS calls
Currently the pseries machine code allows a callback to be registered
for a hypercall number twice, as long as it's the same callback the second
time.  We don't test for duplicate registrations of RTAS callbacks at all
so it will effectively be last registratiojn wins.

This was originally done because it was awkward to ensure that the
registration happened exactly once, but the code has since been
restructured so that's no longer the case.

Duplicate registration of a hypercall or RTAS call could well suggest
a duplicate initialization which could cause other problems, so this patch
makes duplicate registrations a bug, to prevent the old behaviour from
hiding other bugs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
zhlcindy@gmail.com
094b287f0b Add USB option in machine options
When -usb option is used, global varible usb_enabled is set.
And all the plaform will create one USB controller according
to this variable. In fact, global varibles make code hard
to read.

So this patch is to remove global variable usb_enabled and
add USB option in machine options. All the plaforms will get
USB option value from machine options.

USB option of machine options will be set either by:
  * -usb
  * -machine type=pseries,usb=on

Both these ways can work now. They both set USB option in
machine options. In the future, the first way will be removed.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
Bharat Bhushan
59de4f98d1 e500: Fix serial initialization
it was wrongly using serial_hds[0] instead of serial_hds[1]

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-10-29 11:45:54 +01:00
Alexander Graf
5232fa59b1 PPC: Bamboo: Fix memory size DT property
Device tree properties need to be specified in big endian. Fix the
bamboo memory size property accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: qemu-stable@nongnu.org
2012-10-29 11:45:54 +01:00
Max Filippov
50cd721482 hw/xtensa_sim: get rid of intermediate xtensa_sim_init
Remove xtensa_sim_init that only explodes machine init args, rename
sim_init to xtensa_sim_init.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-10-27 15:04:00 +00:00
Max Filippov
d64ed08eec hw/xtensa_lx60: don't prematurely explode QEMUMachineInitArgs
Don't explode QEMUMachineInitArgs before passing it to lx_init.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-10-27 15:03:59 +00:00
Avi Kivity
a8170e5e97 Rename target_phys_addr_t to hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific).  Replace it with a finger-friendly,
standards conformant hwaddr.

Outstanding patchsets can be fixed up with the command

  git rebase -i --exec 'find -name "*.[ch]"
                        | xargs s/target_phys_addr_t/hwaddr/g' origin

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-23 08:58:25 -05:00
Anthony Liguori
50d2b4d93f Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging
* qemu-kvm/memory/urgent:
  memory: abort if a memory region is destroyed during a transaction
  i440fx: avoid destroying memory regions within a transaction
  memory: Make eventfd adhere to device endianness
2012-10-22 14:49:18 -05:00
Anthony Liguori
248bbe7493 Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20121017.0' into staging
* awilliam/tags/vfio-pci-for-qemu-20121017.0:
  vfio-pci: Mark non-migratable
  vfio-pci: Fix debug build
2012-10-22 14:48:23 -05:00
Gerd Hoffmann
da124e62de usb-serial: only expose device in guest when the chardev is open
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-22 13:26:42 -05:00
Gerd Hoffmann
70330fb3da usb-serial: don't magically zap chardev on umplug
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-22 13:26:42 -05:00