Compare commits

...

659 Commits

Author SHA1 Message Date
Cole Robinson 646ce0f5b5 Rebase to qemu-5.2.0-rc4
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-12-03 10:35:07 -05:00
Cole Robinson 4b48a789ef Add missing patch
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-24 12:50:53 -05:00
Cole Robinson 108c22f518 Fix running 9p tests in copr
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-24 11:48:57 -05:00
Paolo Bonzini f0d2afbe43 Remove --python=... to force use of system meson 2020-11-19 18:12:44 +01:00
Daniel P. Berrangé fd795fc4d0 Cull changelog entries older than 2 years
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-19 14:10:11 +00:00
Daniel P. Berrangé 9d15b88230 Wildcard ignore the archive files
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-19 14:09:40 +00:00
Daniel P. Berrangé e837494495 Re-enable systemtap tracing
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-19 11:36:57 +00:00
Cole Robinson 5ff8af4aaa Rebase to qemu-5.2.0-rc2
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-18 08:44:48 -05:00
Daniel P. Berrangé 0b61e57fbe Disable static user mode build on RHEL
The ELN stream builds Fedora packages in a psuedo-RHEL build root and
does not ship all the things that Fedora expects to be present. In
particular glib2-static is missing in ELN build roots, so we need to
disable the user mode static build.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-13 11:26:40 +00:00
Adam Williamson 3f5e1104a8 common: also obsolete -core packages of removed systems
We need to obsolete {lm32,moxie,unicore32}-core as well.
2020-11-11 10:42:07 -08:00
Cole Robinson 5bc1125531 Rebase to qemu-5.2.0-rc1
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-11 09:01:43 -05:00
Cole Robinson 28222ce611 Rebase to 5.2.0-rc0
* Drop deprecated targets: moxie, unicore32, lm32, tilegx, ppc64abi32
* Use qemu-pr-helper units from qemu contrib/
* Drop ivshmem-tools package, upstream doesn't install it anymore
* New spice device modules

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-08 18:53:38 -05:00
Daniel P. Berrangé 581fcfe335 Remove conditionals for skipping/ignoring tests
The conditionals for completely skipping testing, or ignoring all test
failures are much too big a hammer. They are resulting in seriously
broken QEMU binaries making their way into the rawhide repos.

When failures happen the smallest possible number of individual tests
need to be disabled/skipped, but *only* if failure is confined to the
test suite. If there are problems affecting functionality in QEMU
itself, the build should not be forced through, instead QEMU must be
fixed before a build is made.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-05 14:17:23 +00:00
Daniel P. Berrangé 9fb824102c Don't disable all tests, selectively disable only broken ones
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-05 14:16:45 +00:00
Daniel P. Berrangé 357c686a3e Disable LTO again because it is massively broken
The tests were not actually passing, the spec file had been set to
ignore all test failures, and as a result we were shipping completely
fubar builds.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-05 14:15:59 +00:00
Daniel P. Berrangé 65b2a489f4 Re-enable LTO since it now passes tests
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-26 15:48:06 +00:00
Daniel P. Berrangé 744e70f72e Clean up build requires lines
Drop podlators since QEMU no longer uses POD for man pages.

Drop all version numbers, since we can assume Fedora has new enough
packages.

Make comments a little more consistent.

Drop rados2-devel  as it is implied by rbd-devel

Use rbd-devel instead of rbd1-devel due to rename

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-22 11:36:46 +01:00
Cole Robinson cd21b7f45d spec: drop BuildRequires: iasl
From Igor Mammedov:

    QEMU doesn't need iasl for building since 2.6,
    where we switched to generating acpi tables
    using internal aml_foo() API and stopped using
    precompiled templates.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-28 13:47:47 -04:00
Cole Robinson efaa1cda68 Packaging work to build on epel8
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-23 19:03:13 -04:00
Cole Robinson 748c8c3268 spec: Only require virglrenderer on fedora
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 10:24:28 -04:00
Daniel P. Berrangé d9af2bbdff Make QEMU sanity check a build blocker
If it ever breaks, it can be skipped by setting the %qemu_sanity_check
variable to 0.

This ensures it does not bit-rot again in future and actually adds some
value to the build.

It has to be skipped for ARM for now due to inability to select the
machine type.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 13:58:19 +01:00
Daniel P. Berrangé f2839fea71 Provide explicit kernel path to QEMU sanity check
In a mock build root the kernel probably won't exist in /boot and the
QEMU sanity check script won't search /lib/modules. So we must find the
vmlinuz file and pass it explicitly.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 11:10:19 +01:00
Daniel P. Berrangé af50bf7b78 Check whether emulator works before doing sanity check
If the emulator binary can't run, then the sanity check is never going
to work either.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 11:09:53 +01:00
Daniel P. Berrangé 13e7c30edf Fix conditionals for enabling QEMU sanity check
One part of the spec file checked %{kernel_arches} while the other
checked %{hostqemu}. In fact both conditions need to be valid in
order to be able to run the sanity check. Introduce an explicit
%{qemu_sanity_check} variable to express this rule.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 11:09:34 +01:00
Daniel P. Berrangé 4e321e2f5c Re-enable kernel BR for qemu sanity check
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 11:09:09 +01:00
Daniel P. Berrangé 458e07e8d7 Fix host qemu binary path for aarch64
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 11:08:48 +01:00
Daniel P. Berrangé 3c0f9e810a Drop references to obsolete arches
s390, ppc, ppc64 and mips64 are no longer valid Fedora primary
or alternative architectures.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-04 11:08:06 +01:00
Daniel P. Berrangé dc03f389d3 Add btrfs ioctls to linux-user (rhbz #1872918)
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-03 11:04:29 +01:00
Cole Robinson 3927dda118 spec: Fix test conditionals
And update the comment explaining why things are still disabled

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-31 15:01:17 -04:00
Tom Stellard 3fa99d6aac Add BuildRequires: gcc
https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B#BuildRequires_and_Requires
2020-08-18 14:21:58 +00:00
Cole Robinson 9b60ebfd67 Disable dtrace generation to fix use of modules (bz 1869339)
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-17 18:22:02 -04:00
Cole Robinson 2b132a41aa spec: qxl module syntax fixes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-12 05:44:18 -04:00
Cole Robinson a840dd697e Conditionalize qxl subpackage on whether spice is available
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-12 05:38:40 -04:00
Cole Robinson 884b734123 spec: Temporarily disable kernel dep due to f34 breakage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-12 05:32:45 -04:00
Cole Robinson b35e952c0c Drop grubby dep
Rawhide grubby deps are currently broken. And I'm not sure if
this is even still required for qemu-sanity-check, so let's see

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-11 19:34:44 -04:00
Cole Robinson 25b0302679 qemu-5.1.0-1
Update to version 5.1.0
2020-08-11 19:01:17 -04:00
Cole Robinson a90ffcbc2c qemu-5.1.0-0.3.rc3
Update to version 5.1.0-rc3
2020-08-07 09:54:37 -04:00
Merlin Mathesius e84a93a247 Use new %{kernel_arches} macro to determine when a full kernel is available
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2020-08-06 12:09:47 -05:00
Cole Robinson d20fa70a4e Pull in new device modules by default
Like we do for all other modularized components

Reported by Mark Mielke

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-05 10:53:01 -04:00
Cole Robinson c9c298d7a8 Fix AVX typo
Reported by Mark Mielke

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-05 10:50:48 -04:00
Cole Robinson f4bee9e135 Rebase to qemu-5.1.0-rc2
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-04 17:50:59 -04:00
Daniel P. Berrangé 7ffd7f7fdf Remove obsolete fedora conditionals (PR#9)
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-31 10:52:10 +01:00
Richard W.M. Jones bdc5a0bca1 Disable LTO as it caused many strange assert failures. 2020-07-30 10:01:26 +01:00
Richard W.M. Jones 4269c70e28 Backport Dan's upstream patch to fix insecure cert in test suite. 2020-07-29 13:32:58 +01:00
Kevin Fenzi 0133142152 Rebuild for new xen 2020-07-27 20:14:53 -07:00
Cole Robinson 3da886a924 qemu-5.0.0-2
Fix iouring hang (bz #1823751)
2020-05-13 13:34:26 -04:00
Cole Robinson 8c45437b3a Re-enable test suite failure reporting
A scratch-build succeeded for me now

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-05-09 11:48:40 -04:00
Cole Robinson 9f833efd2d qemu-5.0.0-1
Update to version 5.0.0
2020-05-06 09:27:16 -04:00
Cole Robinson fa1d6ea0cd Update to qemu 5.0.0 rc3
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-04-16 05:23:57 -04:00
Cole Robinson 7e9fe41b78 spec: Temporarily disable tests, iotest 161 failing on i686
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-04-09 13:16:07 -04:00
Cole Robinson 76b4bc9d96 spec: Add 'hostname' dep for test suite
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-04-09 06:30:48 -04:00
Cole Robinson 9f8e48750c Update to qemu 5.0.0 rc2
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-04-09 05:47:16 -04:00
Adam Williamson e2b4e80d3c Rebuild for new brltty
Also add missing %changelog entry for 5.0.0 bump
2020-04-07 17:30:05 -07:00
Cole Robinson e1b832b513 Add -rx emulator, install all new files
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-03-25 16:22:54 -04:00
Cole Robinson 17655806bf liburing isn't available on %{arm}
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-03-25 14:14:43 -04:00
Cole Robinson dd41f1a7ca spec: Disable liburing, it's breaking the test suite
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-03-25 13:25:36 -04:00
Cole Robinson 8833af8dcd Update to qemu-5.0.0-rc0
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-03-24 20:47:08 -04:00
Fabiano Fidêncio 492d6c1fff qemu-4.2.0-7.fc33
Fix segfault with SR-IOV hot-{plug,unplug} (bz #1814017)

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-03-17 11:12:56 +01:00
Cole Robinson 377bb253e3 qemu-4.2.0-6.fc33
Rebuild for libiscsi soname bump
2020-02-25 14:47:44 -05:00
Cole Robinson 023288b71a qemu-4.2.0-5.fc32
Fix ppc shutdown issue (bz #1784961)
2020-02-15 21:11:36 -05:00
Cole Robinson 1d442bb612 qemu-4.2.0-4.fc32
virtio-fs support from upstream
2020-01-28 10:36:21 -05:00
Richard W.M. Jones b98348b411 Add miscellaneous fixes for RISC-V (RHBZ#1794902). 2020-01-25 10:43:21 +00:00
Mohan Boddu ba6f50c7d7 Rebuild for xen 4.13
Signed-off-by: Mohan Boddu <mboddu@bhujji.com>
2019-12-19 10:55:04 -05:00
Cole Robinson 57a3231073 Update to qemu-4.2.0 GA
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-12-13 09:32:23 -05:00
Cole Robinson 46ea403d2f Update to qemu-4.2.0 rc5
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-12-10 16:50:49 -05:00
Daniel P. Berrangé e6e2c63c09 Disable rdma on arm 32-bit (rhbz #1778517)
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-12-02 11:35:47 +00:00
Cole Robinson 1d0e437ac8 Re-enable test suite
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 13:09:58 -05:00
Cole Robinson 6732563c65 Update to qemu-4.2.0 rc2
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 13:06:13 -05:00
Cole Robinson 46eefb217c Disable tests, they are consistently failing on ppc64le
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-15 13:26:03 -05:00
Cole Robinson ff9bb15b16 Fix last commit
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-15 09:43:16 -05:00
Cole Robinson 993f4157b6 Make spice-app subpackage conditional on with_spice
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-15 09:39:29 -05:00
Cole Robinson 41cffcfad7 Add new bios-microvm.bin rom
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-13 19:57:10 -05:00
Cole Robinson b4072bd645 Fix the test suite
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-13 16:33:52 -05:00
Cole Robinson fddfbd9637 spec: Fix spice_app variable naming
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-13 12:38:02 -05:00
Thierry Vignaud 16769836d7 qemu: actually pull new ui_spice_add subpkg
--00000000000065190005973c323b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi
The newly added spice_add subpkg is not required despite creating the
proper macro
This fixes it.
See you

--=20
Thierry Vignaud -- EMEA ENG OpenStack Management
tvignaud@redhat.com
irc: tvignaud

<div dir="ltr"><div>Hi</div><div>The newly added spice_add subpkg is not required despite creating the proper macro<br></div><div>This fixes it.</div><div>See you<br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thierry Vignaud -- EMEA ENG OpenStack Management<br></div><div><a href="mailto:tvignaud@redhat.com" target="_blank">tvignaud@redhat.com</a><br></div>irc: tvignaud<br></div></div></div></div>

From c610e43d411389e36462607d38c95a85264f2881 Mon Sep 17 00:00:00 2001
From: Thierry Vignaud <thierry.vignaud@gmail.com>
Date: Wed, 13 Nov 2019 16:39:25 +0100
Subject: [PATCH] actually pull new ui_spice_add subpkg
2019-11-13 12:37:31 -05:00
Cole Robinson 0038f84388 Update to qemu 4.2.0 rc1
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 17:39:50 -05:00
Cole Robinson 8e6758e973 qemu-4.1.0-6.fc32
Fix compressed qcow2 'qemu-img check' errors (bz #1768541)
2019-11-11 09:33:46 -05:00
Cole Robinson fe24ece8af Use --enable-tcg for static builds, apparently it's required
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-24 14:04:01 -04:00
Cole Robinson f4c127bbc1 qemu-4.1.0-5.fc32
Workaround for qcow2 triggered XFS corruption (bz #1763519)
2019-10-24 11:34:55 -04:00
Cole Robinson 918c70b1aa spec: Disable any -tcg usage for -user builds
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-18 10:54:16 -04:00
Cole Robinson 964eff6ae8 Fix tests on kernel 5.3+
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-18 10:51:02 -04:00
Cole Robinson 481596d7a6 qemu-4.1.0-4.fc32
Rebuild for new virglrenderer
2019-10-03 13:43:23 -04:00
Leigh Scott c36918674f Rebuild for new libnfs version 2019-09-11 11:33:43 +01:00
Cole Robinson 9db63cb5df qemu-4.1.0-2.fc32
gluster 4K block size fixes (bz #1737256)
2019-09-04 10:37:55 -04:00
Cole Robinson 5084436959 spec: Remove sanity check dep on ix86 too
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-19 17:14:57 -04:00
Cole Robinson 70269497f2 Add sources
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-19 15:29:11 -04:00
Cole Robinson 2a7146a2ca Update to qemu-4.1.0 GA
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-19 15:19:33 -04:00
Cole Robinson 70b6670bdf kernel isn't available on ix86 anymore, adjust the dep 2019-07-25 10:23:11 -04:00
Cole Robinson 28828da2e3 spec: Handle new files in 4.1.0-rc2 2019-07-25 08:57:58 -04:00
Cole Robinson e4599b5e27 Update to qemu-4.1.0-rc2 2019-07-24 14:25:25 -04:00
Cole Robinson bd59499379 spec: Use libxattr for qemu-user-static builds
https://bugzilla.redhat.com/show_bug.cgi?id=1731756
2019-07-23 15:18:31 -04:00
Cole Robinson 6acd45ea32 Update to qemu-4.1.0-rc1 2019-07-17 18:45:07 -04:00
Cole Robinson e0a72f8f2d Add patch fixing docs build 2019-07-12 13:04:17 -04:00
Cole Robinson 160bf4b4d5 Update to qemu-4.1.0-rc0 2019-07-11 21:11:36 -04:00
Kevin Fenzi 8e85e5e9aa Rebuild for new brltty. 2019-06-28 13:47:44 -07:00
Cole Robinson 419868beaf spec: Some cleanups + improvements
* Add run_configure_disable_everything
* Use it for static builds
* Add some comments
* Misc style cleanups
2019-06-24 19:49:43 -04:00
Cole Robinson e5504b6ad4 Only use slirp on fedora > 30, to fix virt-preview builds 2019-06-21 08:18:53 -04:00
Cole Robinson 40fbd86194 Fix spec conditional 2019-06-20 17:36:29 -04:00
Cole Robinson 8a7ac9c97e qemu-4.0.0-4.fc31
CVE-2019-12155: qxl: null pointer dereference while releasing spice resources (bz #1712727, bz #1712670)
qemu-4.0.0-2.fc31 ppc64le: rpm hash calculation buggy (bz #1715017)
Fix rawhide build (bz #1718926)
Link against libslirp (bz #1712980)
Add vgabios-ramfb.bin and vgabios-bochs-display.bin (bz #1721445)
2019-06-20 17:31:11 -04:00
David Abdurachmanov 29c3523ef3 Add vgabios-ramfb.bin and vgabios-bochs-display.bin
These are now available in Rawhide starting seabios 1.12.1.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-06-20 16:54:55 -04:00
Cole Robinson 17efd80578 Link against libslirp 2019-06-20 16:30:27 -04:00
Daniel P. Berrangé 70ef327d5f Define md-clear CPUID bit
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-14 19:04:29 +01:00
Daniel P. Berrangé af6274808b Cull changelog entries prior to 2017
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-14 19:04:29 +01:00
Cole Robinson c67ebc8192 Update to qemu-4.0.0 GA 2019-04-24 17:18:50 -04:00
Cole Robinson cdc7e4ca72 Add missing sources 2019-04-16 21:59:06 -04:00
Cole Robinson e14a8ce4ef qemu-4.0.0-0.7.rc3.fc31
Don't block migration with nested VMX (bz #1697997)
Update to qemu-4.0.0-rc3
2019-04-16 21:48:03 -04:00
Richard W.M. Jones 09f7c02959 Rebuild against xen 4.12.
DEBUG util.py:554:  BUILDSTDERR:   - conflicting requests
DEBUG util.py:554:  BUILDSTDERR:   - nothing provides libxenctrl.so.4.11()(64bit) needed by qemu-system-x86-core-2:4.0.0-0.5.rc2.fc31.x86_64
DEBUG util.py:554:  BUILDSTDERR:   - nothing provides libxenguest.so.4.11()(64bit) needed by qemu-system-x86-core-2:4.0.0-0.5.rc2.fc31.x86_64
2019-04-06 16:28:04 +01:00
Cole Robinson 4266c9b33e Update to 4.0.0-rc2 2019-04-03 09:46:28 -04:00
Cole Robinson c9654a07d8 Update to 4.0.0-rc1 2019-03-27 17:28:12 -04:00
Adam Williamson fd86380c5b Add changelog entry 2019-03-25 11:49:20 -07:00
Adam Williamson 1515438fd3 Backport danpb's proposed fix for RHBZ #1692323 (3D crasher)
This is a Fedora 30 Beta blocker, so we need it fixed ASAP; I'm
doing it (for Rawhide and F30) as none of the qemu maintainers
seems to be around on IRC.
2019-03-25 11:21:01 -07:00
Cole Robinson e3d6ad24ae spec: Only run pathfix on the one file that needs it
It's really noisy recursing through the sourcedir otherwise
2019-03-22 19:19:03 -04:00
Thierry Vignaud 9687314304 fix macro expansion in comment 2019-03-22 19:18:55 -04:00
Cole Robinson 7da5fc303e spec: Use consitent have_X macro pattern 2019-03-22 19:18:37 -04:00
Cole Robinson f3518876c6 Fix python paths for qemu-trace-stap 2019-03-21 06:37:24 -04:00
Cole Robinson d3ff788791 Update to qemu 4.0.0-rc0 2019-03-20 17:39:56 -04:00
Daniel P. Berrangé 941a4c0548 Fix typo curl -> curses
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-20 16:55:02 +00:00
Daniel P. Berrangé e1923c9eb5 Use conditional compilation to disable glusterfs
Instead of commenting out parts of the spec introduce conditionals
that allow glusterfs to be disabled in a single place.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-20 16:42:05 +00:00
Daniel P. Berrangé a60ad61787 Make qemu-common obsolete RBD module when disabled
If RBD module build is disabled, we need to obsolete it to ensure a
clean upgrade from previous builds. This is done by adding an Obsoletes
from the qemu-common sub-RPM.

This fixes the upgrade path on i686 (rhbz #1688117)

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-20 16:41:29 +00:00
Daniel P. Berrangé f1fa58e582 Refactor global module requires to facilitate conditional builds
The global list of module requires is not amenable to conditional
builds, requiring the entire set of requires to be duplicated.
Refactor it so that individual pieces can be disabled.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-20 16:41:29 +00:00
Daniel P. Berrangé e24cbbb32e Fix compat with latest glibc which has gettid func
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-20 16:22:51 +00:00
Cole Robinson de10d8e08e Temporarily disable glusterfs (bz #1684298) 2019-03-03 17:42:14 -05:00
Cole Robinson 2679bc30fc Rebuild for brltty soname bump 2019-02-28 17:00:40 -05:00
Fedora Release Engineering 8e22bbd1e0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-02 10:30:22 +00:00
Richard W.M. Jones f1ea04bd67 Revert "Add a temporary patch to fix capstone header location."
This has now been fixed in capstone, see
https://github.com/aquynh/capstone/issues/1339

This reverts commit e0155fb5be.
2019-01-12 07:39:39 +00:00
Richard W.M. Jones e0155fb5be Add a temporary patch to fix capstone header location. 2019-01-11 09:43:39 +00:00
Richard W.M. Jones 8433925433 Rebuild for unannounced libcapstone soname bump from 3 to 4. 2019-01-11 09:16:11 +00:00
Adam Williamson 61ad1f41fd Restore patch to drop phantom 86 key from en-us keymap (bz #1658676)
The exact bug this was initially added to workaround was fixed
in 2.12, so @crobinso dropped the patch. However, the phantom
key turns out to still cause problems in another case, so until
that is fixed, we need to put this back. See
https://bugzilla.redhat.com/show_bug.cgi?id=1658676 for full
details on the outstanding bug.
2018-12-18 10:35:22 -08:00
Cole Robinson 5704646898 Rebase to qemu-3.1.0 GA 2018-12-11 18:41:59 -05:00
Daniel P. Berrangé a4b3db7151 Disable RBD on 32-bit arches
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-10 18:40:38 +00:00
Cole Robinson 0af132aa98 BR libpmem is only available on x86_64 2018-11-16 11:01:12 -05:00
Cole Robinson 007776f3e4 Rebase to qemu-3.1.0-rc1 2018-11-15 19:50:28 -05:00
Cole Robinson e4323bc8b2 Remove unused patches 2018-10-03 11:13:53 -04:00
Cole Robinson a6f68877d0 Rebase to qemu-3.0.0 GA 2018-08-15 10:19:27 -04:00
Cole Robinson 91efacc572 Fix build after ksm removal 2018-08-13 18:31:29 -04:00
Cole Robinson 748bb2f566 Drop ksm package, moved to ksmtuned srpm 2018-08-13 17:07:28 -04:00
Cole Robinson c90305980d Drop ksm package, moved to ksmtuned srpm 2018-08-13 17:06:42 -04:00
Daniel P. Berrangé 13b2fd93a9 Add missing requires on ssh block module accidentally lost
The rebase to 2.12 accidentally lost the %{name}-block-ssh
module dep.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-08-01 14:29:02 +01:00
Cole Robinson e4ec8b672d Another attempt to remove 50-kvm-sysctl 2018-08-01 05:54:39 -04:00
Cole Robinson 5bdb061bca Fix s390x file removal
Only install modprobe kvm.conf on x86 (bz #1517989)
2018-07-31 18:39:03 -04:00
Cole Robinson d4c4507533 Rebase to qemu-3.0.0-rc3
Drop now unneeded s390x conf (bz #1609706)
2018-07-31 16:36:31 -04:00
Peter Robinson b12f5aef3a Rebuild for Xen 4.11 2018-07-13 11:36:41 +01:00
Daniel P. Berrangé b91dae7a8f New CPU features for speculative store bypass (CVE-2018-3639)
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-06-18 13:45:14 +01:00
Cole Robinson 330481bc1c Fix qxl memslot_get_virt crashes (bz #1565354) 2018-06-05 14:28:06 -04:00
Cole Robinson 97eed6b145 Update to qemu-2.12.0 GA 2018-04-30 12:19:47 -04:00
Richard W.M. Jones 6dab4a0cbd Update to qemu-2.12.0-rc3
- Remove upstream patch.
- Fixes issues with partition / LV minimum alignment (RHBZ#1565714).
2018-04-16 12:17:57 +01:00
Cole Robinson 7b9b67b1ec Update to qemu-2.12.0-rc2
Drop upstreamed riscv patch
2018-04-05 14:25:31 -04:00
Cole Robinson 0d2d5cc76d Update to qemu-2.12.0-rc1 2018-03-28 11:01:32 -04:00
Cole Robinson 80404b03be Drop target whitelists; enable user tilegx, xtensa*
qemu configure will give us all targets if we don't specify a
whitelist, so drop the target lists to simplify the spec. This
also makes it clear that we were missing some linux-user targets,
so enable them
2018-03-26 17:12:19 -04:00
Cole Robinson a28cfa8216 spec: Convert to using qemu-binfmt-conf.sh script
The binfmt masks are slightly different but I think they are
functionally equivalent. The script handles arch collision
automatically which lets us drop a lot of the %ifarch stuff
2018-03-25 11:53:02 -04:00
Cole Robinson e9e03fcd1c Add changelog 2018-03-23 19:40:00 -04:00
Cole Robinson 6269069f27 Fix audio/ui module dependencies 2018-03-23 19:28:10 -04:00
Cole Robinson 3930e8ff37 spec: Clean up outdated arch deps
- rdma-core, xen, spice, numactl are available in more places
- drop presumably obsolete aarch64 ld flag droppage
- centralize arch dep checks in one place
2018-03-23 16:41:49 -04:00
Cole Robinson 3758f8a137 Some spec cleanups
- Sort system-* in alphabetical order
- Remove a bunch of whitespace
- Remove repeated QEMU line in %description
2018-03-22 12:09:38 -04:00
Cole Robinson e13261f947 Fix hppa firmware packaging
Accidentally added it to aarch64
2018-03-22 11:07:41 -04:00
Cole Robinson 3c6a0ca337 Rebase to qemu-2.12.0-rc0
- Add hppa and riscv32/64 targets
- Add audio and ui modules
2018-03-22 09:13:01 -04:00
Daniel P. Berrangé 55054b88c9 Re-enable normal Fedora hardening macros
We previously disabled the hardened build macros because they broke
static linking. This is now resolved, so we can use them as is, which in
turn ensures ksmctl gets linked correctly.

While doing this it is not neccessary to pass -pie in ldflags, as we are
already giving the --enable-pie configure option. This lets us move
setting  of linker/compiler flags into the common run_configure
function, rather than duplicating them for static & dynamic builds

Finally, even though QEMU sets _FORTIFY_SOURCE itself, there's no reason
to strip it from the RPM provided build flags - it is harmless for it to
appear twice on compiler args. This ensures ksmctl.c gets fortified.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-19 18:36:49 +00:00
Cole Robinson 6b1a7d80a5 git rm kvm.modules
Was dropped from the spec in 2015

Reported-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2018-03-13 09:33:13 -04:00
Cole Robinson a7e2480deb Rebase to qemu 2.11.1 bugfix release 2018-02-28 17:11:13 -05:00
Daniel P. Berrangé 29249a79a8 Avoid breakage in tests due to stricter crypto policies
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-28 18:54:48 +00:00
Daniel P. Berrangé 52904050aa Explicitly use python2 binary
The /usr/bin/python binary has started spewing text to stderr, even when
not connected to a tty, which breaks QEMU test suite.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-28 18:02:52 +00:00
Daniel P. Berrangé 603dd9e50a Bump release for new build
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-27 16:31:19 +00:00
Daniel P. Berrangé 28d4d1f5e7 Non-deterministic python hash iterator sort ordering
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-27 16:30:20 +00:00
Daniel P. Berrangé 34056732a5 Honour CC/LD flags from RPM global settings.
https://bugzilla.redhat.com/show_bug.cgi?id=1549657

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-27 15:33:06 +00:00
Daniel P. Berrangé 1d16c17085 Fix License: tag to better reflect reality
There are multiple problems with the license tag

  - A bunch of QEMU code is GPLv2-only, not GPLv2-or-later
  - Fedora licensing guidelines say that if "GPLv2" is
    listed, it is redundant to list "GPLv2+" / "LGPLv2+",
    since those licenses are forced to be equiv to "GPLv2"
    in the combined work
  - QEMU also includes code / files under MIT and CC-BY
    license

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-27 15:14:09 +00:00
Fedora Release Engineering 8253c01b09 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 12:10:24 +00:00
Daniel P. Berrange ec520ba35e Fix date in changelog
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-12-22 10:38:58 +00:00
Daniel P. Berrange 167a6b72c2 Re-enable rbd on arm/ppc arches (rhbz #1528378)
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-12-21 16:29:06 +00:00
Adam Williamson f81be8f026 Fix problem with typing some characters via VNC (LP#1738283)
Note: this is kinda a temporary fix, but I don't want to wait
for a 'real' fix from upstream as I want to build os-autoinst
for Rawhide and this bug prevents its test suite working right.
2017-12-20 16:51:21 -08:00
Cole Robinson f95699bf90 Rebuild for xen 4.10 2017-12-20 07:05:41 -05:00
Cole Robinson 90a3c96cff Rebase to 2.11.0 GA 2017-12-18 14:37:02 -05:00
Cole Robinson a76e086590 Rebase to 2.11.0-rc3 2017-12-04 11:54:22 -05:00
Paolo Bonzini e978b4fe84 fix /var/log/qga-fsfreeze-hook.log 2017-11-29 00:39:08 +01:00
Paolo Bonzini bfe7b8124e fix compilation, upgrade qemu-ga packaging based on RHEL 7 2017-11-28 18:07:46 +01:00
Cole Robinson 700f126a07 Update to qemu-2.11.0-rc1 2017-11-20 06:41:22 -05:00
Cole Robinson 2a2b49f85b spec: Drop deprecated Group: tag 2017-11-19 18:56:06 -05:00
Cole Robinson 59eb7ad892 Fix ppc64 KVM failure (bz #1501936)
CVE-2017-15038: 9p: information disclosure when reading extended attributes (bz #1499111)
CVE-2017-15268: potential memory exhaustion via websock connection to VNC (bz #1496882)
2017-10-19 12:59:57 -04:00
Paolo Bonzini b0a7742ccd fix multipath qemu-pr-helper
Update patch 1014 for new libmultipath/libmpathpersist API
Force build to fail if multipath is not available
2017-10-18 09:03:01 +02:00
Daniel P. Berrange 8699737f6d Fix inverted check for ignoring test suite failures
An inverted conditional meant that test suite failures were previously
being ignored on all architectures by default, instead of only on the
blacklisted arches (currently none)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-10-12 09:37:20 +01:00
Daniel P. Berrange ac5e33cbfe Remove iasl dep on big endian arches
iasl is still broken for QEMU usage on big endian

https://bugzilla.redhat.com/show_bug.cgi?id=1332449

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-10-12 09:37:20 +01:00
Daniel P. Berrange a8c6008b7d Add patches from git master to fix TLS test suite with new GNUTLS
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-10-12 09:26:40 +01:00
Daniel P. Berrange 9acefb8589 Rebuild for libiscsi changed soname again
The previous rebuild was sent to builders before the build root had
updated to pull in the new libiscsi, so it just built with the old
libiscsi again.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-10-09 10:29:00 +01:00
Paolo Bonzini 4b7bd99c46 Rebuild with new libiscsi for iSER support 2017-10-03 17:36:43 +02:00
Paolo Bonzini fd8ba3896b Stop using tcmalloc, glibc got faster 2017-09-28 15:14:19 +02:00
Paolo Bonzini 0fb2b27d3a Backport persistent reservation manager in preparation for SELinux work 2017-09-22 16:47:53 +02:00
Paolo Bonzini 0945e0bba3 fix previous commit 2017-09-22 10:59:02 +02:00
Nathaniel McCallum 98b428ff80 Fix endianness of e_type in the ppc64le binfmt 2017-09-18 16:27:33 -04:00
Cole Robinson 0b42e7fc18 Rebase to 2.10.0 GA 2017-09-07 16:08:24 -04:00
Nathaniel McCallum 3b6c813012 Fix incorrect byte order in e_machine field in ppc64le binfmt (#1486379) 2017-08-29 12:59:07 -04:00
Cole Robinson 45cb87a59c Fix changelog 2017-08-25 18:14:00 -04:00
Cole Robinson 5264c6a895 Rebase to 2.10.0-rc4 2017-08-25 18:13:05 -04:00
Adam Williamson c2f33c885f Don't build against rdma on 32-bit ARM (#1484155) 2017-08-22 17:39:41 -07:00
Cole Robinson c333713fea Add sources 2017-08-16 17:46:28 -04:00
Cole Robinson 14cfc78b3c Rebase to 2.10.0-rc3 2017-08-16 17:38:41 -04:00
Cole Robinson 0323a03914 Remove /dev/kvm udev rules, systemd now provides them (bz #1431876) 2017-08-03 17:33:01 -04:00
Cole Robinson 1a4355e536 Rebase to 2.10.0-rc1 2017-08-03 10:14:19 -04:00
Florian Weimer 26c1ceeaa3 Rebuild with fixed binutils for ppc64le (#1475636) 2017-07-30 15:53:03 +02:00
Daniel P. Berrange 6e16c07206 Re-enable ceph on i386 as build is now fixed (rhbz #1474773)
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-26 11:42:02 +01:00
Daniel P. Berrange a3b9d99ab2 Disabled RBD on i386, arm, ppc64 (rhbz #1474743)
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-26 11:40:17 +01:00
Daniel P. Berrange a949744f38 Replace obsolete ceph-devel dep with librbd1-devel/librados2-devel
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-25 09:44:33 +01:00
Daniel P. Berrange 20b2275a19 Rebuild for changed rbd soname
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-25 09:35:08 +01:00
Nathaniel McCallum 22c2909bc1 Restrict user-static to user-static builds 2017-07-20 11:51:59 -04:00
Nathaniel McCallum f73c470a02 Cleanup binfmt deps/scripts; add binfmt for ppc64le 2017-07-20 10:42:28 -04:00
Daniel P. Berrange 1e96c68c3d Fixes for compat with Xen 4.9
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-19 12:26:23 +01:00
Nathaniel McCallum cf6afbb855 Fix invalid ucontext_t references 2017-07-18 21:27:57 -04:00
Daniel P. Berrange 895ba8da7d Rebuild for changed Xen sonames
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-18 15:28:08 +01:00
Cole Robinson 335584f502 CVE-2017-8112: vmw_pvscsi: infinite loop in pvscsi_log2 (bz #1445622)
CVE-2017-8309: audio: host memory lekage via capture buffer (bz #1446520)
CVE-2017-8379: input: host memory lekage via keyboard events (bz #1446560)
CVE-2017-8380: scsi: megasas: out-of-bounds read in megasas_mmio_write (bz #1446578)
CVE-2017-7493: 9pfs: guest privilege escalation in virtfs mapped-file mode (bz #1451711)
CVE-2017-9503: megasas: null pointer dereference while processing megasas command (bz #1459478)
CVE-2017-10806: usb-redirect: stack buffer overflow in debug logging (bz #1468497)
CVE-2017-9524: nbd: segfault due to client non-negotiation (bz #1460172)
CVE-2017-10664: qemu-nbd: server breaks with SIGPIPE upon client abort (bz #1466192)
2017-07-13 16:21:40 -04:00
Richard W.M. Jones 5eae33f189 Bump release and rebuild to try to fix _ZdlPvm symbol (see RHBZ#1452813). 2017-05-22 09:56:26 +01:00
Cole Robinson faa9df96ad Fix fedpkg verrel 2017-04-25 16:17:05 -04:00
Cole Robinson 33f79e5eb1 Rebase to qemu-2.9.0 GA 2017-04-25 16:03:50 -04:00
Cole Robinson 514d6bc543 Rebase to qemu-2.9.0-rc4
Fix ipxe rom links for aarch64
2017-04-13 19:28:05 -04:00
Richard W.M. Jones 5dd6a73c80 Backport upstream fix for assertion when copy-on-read=true (RHBZ#1439922). 2017-04-08 09:39:38 +01:00
Cole Robinson 74c0a82292 Rebase to qemu-2.9.0-rc3 2017-04-04 18:27:53 -04:00
Cole Robinson 0db3257f1a Rebase to qemu-2.9.0-rc2
Add Obsoletes for or32-or1k rename (bz 1435016)
2017-03-29 13:54:10 -04:00
Cole Robinson 996634350a spec: Pull in vga and pxe roms for ppc64 (bz 1431403) 2017-03-29 13:03:29 -04:00
Cole Robinson 1db5811d26 Rebase to qemu-2.9.0-rc1 2017-03-21 18:42:44 -04:00
Cole Robinson 1c7073d8dd Rebase to qemu-2.9.0-rc0 2017-03-15 14:03:33 -04:00
Daniel P. Berrange 6a041ef569 Drop texi2html BR, since QEMU switched to using makeinfo back in 2010
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-02-20 17:49:12 +00:00
Fedora Release Engineering c1f9c0e4d7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-11 11:12:06 +00:00
Cole Robinson 8b317f0917 Rebase to qemu-2.8.0 GA 2016-12-20 16:17:18 -05:00
Cole Robinson 50bb158a7a Rebase to qemu-2.8.0-rc3 2016-12-12 16:04:42 -05:00
Daniel P. Berrange 8288677cfa Rebuild for libxen* soname changes
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-12-08 14:17:33 +00:00
Cole Robinson 9074eea4bb Add rc2 sources 2016-12-05 12:04:20 -05:00
Cole Robinson 17a6dacdca Remove --disable-xfsctl option, no longer explicitly required
It was added at one point to work around temporarily broken
xfsprogs-devel
2016-12-05 11:57:27 -05:00
Cole Robinson 84eeb10ee8 spec: Share common configure options between static/standard builds 2016-12-05 11:57:27 -05:00
Cole Robinson 151958b44b Rebase to qemu-2.8.0-rc2 2016-12-05 11:57:27 -05:00
Cole Robinson 3bbbcdcb07 Kill changelog entries prior to 2015 2016-12-05 10:45:56 -05:00
Cole Robinson 6f55752c5f Depend on vte291, not vte3
vte3 is stuck at a certain version, vte291 is actually where new vte
versions are packaged. Yes, that's confusing.
2016-12-05 10:45:56 -05:00
Paolo Bonzini b68b5fed43 Do not build aarch64 with -fPIC anymore (rhbz 1232499)
This seems to be unnecessary now (tested with kvm-unit-tests on aarch64
F25).
2016-11-28 15:47:34 +01:00
Nathaniel McCallum 0583426e3d Clean up binfmt.d configuration files
In particular, I performed the following changes:

1. Add the (missing) aarch64 configuration.

2. Mask out e_ident[EI_OSABI]. A single OS can have multiple values
   here. We just pass them all to qemu. I personally ran into this issue
   (where filtering was too strict) on ppc64.

3. Mask out e_ident[EI_ABIVERSION]. On Linux, this value is ignored.

4. Mask out e_ident[EI_PAD]. The current check insists they are zero
   when they are, in fact, undefined.

5. Don't mask any bits for e_ident[EI_VERSION]. We want an exact match
   on this since there has only ever been one version. However, alpha, i386
   and i486 were masking out the least significant bit.

6. Don't mask any bits for e_ident[EI_DATA]. You can't mask out bits for
   endianness because it controls the byte order of later bytes in the
   binfmt match (starting at offset 0x10). So you can never have a rule
   which works with bits masked out on this field. However, alpha, i386 and
   i486 were masking out the least significant bit.
2016-11-15 10:33:03 -05:00
Richard W.M. Jones 820948cb49 Fix qemu-sanity-check. 2016-11-14 14:37:49 +00:00
Richard W.M. Jones ecbe006bda Create subpackages for modularized qemu block drivers (RHBZ#1393688). 2016-11-14 14:37:15 +00:00
Cole Robinson 8a588691e2 Fix PPC64 build with memlock file (bz #1387601) 2016-10-25 10:18:57 -04:00
Bastien Nocera b8878c0ca6 Add "F" flag to static user emulators' binfmt, to make them
available in containers (#1384615)
- Also fixes the path of those emulators in the binfmt configurations
2016-10-19 19:19:36 +02:00
Cole Robinson cf816402f7 Fix nested PPC 'Unknown MMU model' error (bz #1374749)
Fix flickering display with boxes + wayland VM (bz #1266484)
Add ppc64 kvm memlock file (bz #1293024)
2016-10-19 13:17:38 -04:00
Cole Robinson d19693d908 Add ppc64 kvm memlock file (bz 1293024) 2016-10-19 12:23:45 -04:00
Cole Robinson 8dd6b5e9c8 spec: Use power64 macro consistently 2016-10-19 12:17:47 -04:00
Cole Robinson 3a13ddd514 CVE-2016-7155: pvscsi: OOB read and infinite loop (bz #1373463)
CVE-2016-7156: pvscsi: infinite loop when building SG list (bz #1373480)
CVE-2016-7156: pvscsi: infinite loop when processing IO requests (bz #1373480)
CVE-2016-7170: vmware_vga: OOB stack memory access (bz #1374709)
CVE-2016-7157: mptsas: invalid memory access (bz #1373505)
CVE-2016-7466: usb: xhci memory leakage during device unplug (bz #1377838)
CVE-2016-7423: scsi: mptsas: OOB access (bz #1376777)
CVE-2016-7422: virtio: null pointer dereference (bz #1376756)
CVE-2016-7908: net: Infinite loop in mcf_fec_do_tx (bz #1381193)
CVE-2016-8576: usb: xHCI: infinite loop vulnerability (bz #1382322)
CVE-2016-7995: usb: hcd-ehci: memory leak (bz #1382669)
2016-10-15 22:24:48 -04:00
Hans de Goede a2729a240b Fix interrupt endpoints not working with network/spice USB redirection
on guest with an emulated xhci controller (rhbz#1382331)
2016-10-10 10:50:30 +02:00
Michal Toman 504e25420b Fix build on MIPS 2016-09-21 09:29:36 +01:00
Cole Robinson 57dbb7a5be Don't depend on edk2 roms where they aren't available (bz 1373576) 2016-09-08 15:56:28 -04:00
Cole Robinson 435be3635e Rebase to qemu 2.7.0 GA 2016-09-08 15:52:09 -04:00
Cole Robinson 94ddf1cc6a Rebase to qemu 2.7.0-rc3 2016-08-19 09:20:37 -04:00
Daniel P. Berrange d52607ebe6 Also disable static builds on ppc64 due to glibc fubarness 2016-08-17 09:47:57 +01:00
Cole Robinson 4ff778e7b3 Add new sources 2016-08-08 20:07:27 -04:00
Cole Robinson ef34be9e72 Rebase to qemu 2.7.0-rc2
* kvm_stat was moved to the kernel tree
* trace-events renamed to trace-events-all
* several new pxe roms added
2016-08-08 20:05:39 -04:00
Richard W.M. Jones 84e6ecadd9 Rebuild to attempt to fix '2:qemu-system-xtensa-2.6.0-5.fc25.x86_64 requires libxenctrl.so.4.6()(64bit)' 2016-07-23 16:37:42 +01:00
Daniel P. Berrange 51223f941f Ignore build logs, src RPMs and x84_64 RPM output dir too
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-07-15 14:39:08 +01:00
Daniel P. Berrange d0bc223280 Add skip for s390x as well as s390 2016-07-15 14:28:04 +01:00
Daniel P. Berrange 9868109a5e Disable qemu-user-static on s390 too 2016-07-14 11:20:48 +01:00
Daniel P. Berrange ecee1eccfe Add explicit BR on alsa-lib-devel
Previously we'd get alsa-lib-devel pulled in by accident due to
dep from another package. Latest rawhide doesn't get this so we
must add the dep explicitly in QEMU.
2016-07-13 15:08:58 +01:00
Daniel P. Berrange a8a5dc38f8 Cat config.log when configure fails during build
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-07-13 15:08:17 +01:00
Daniel P. Berrange 9e71574671 Use precise version in obsoletes line
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-07-13 13:49:06 +01:00
Daniel P. Berrange 0835325a86 Introduce qemu-user-static sub-RPM
The i686 build of this is temp disabled due to fubar
glibc-static on i686

The hardended build macro is disabled due to fubar
rpm macros for static linking while hardened, but
the equivalent hardening is turned on manually.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-07-13 13:42:21 +01:00
Cole Robinson cf91b1dfd9 CVE-2016-4002: net: buffer overflow in MIPSnet (bz #1326083)
CVE-2016-4952 scsi: pvscsi: out-of-bounds access issue
CVE-2016-4964: scsi: mptsas infinite loop (bz #1339157)
CVE-2016-5106: scsi: megasas: out-of-bounds write (bz #1339581)
CVE-2016-5105: scsi: megasas: stack information leakage (bz #1339585)
CVE-2016-5107: scsi: megasas: out-of-bounds read (bz #1339573)
CVE-2016-4454: display: vmsvga: out-of-bounds read (bz #1340740)
CVE-2016-4453: display: vmsvga: infinite loop (bz #1340744)
CVE-2016-5126: block: iscsi: buffer overflow (bz #1340925)
CVE-2016-5238: scsi: esp: OOB write (bz #1341932)
CVE-2016-5338: scsi: esp: OOB r/w access (bz #1343325)
CVE-2016-5337: scsi: megasas: information leakage (bz #1343910)
Fix crash with -nodefaults -sdl (bz #1340931)
Add deps on edk2-ovmf and edk2-aarch64
2016-06-22 09:40:57 -04:00
Cole Robinson f9730dab94 Add deps on fedora edk2-ovmf and edk2-aarch64 2016-06-22 08:22:36 -04:00
Cole Robinson f0208c9e42 CVE-2016-4020: memory leak in kvmvapic.c (bz #1326904)
CVE-2016-4439: scsi: esb: OOB write #1 (bz #1337503)
CVE-2016-4441: scsi: esb: OOB write #2 (bz #1337506)
Fix regression installing windows 7 with qxl/vga (bz #1339267)
Fix crash with aarch64 gic-version=host and accel=tcg (bz #1339977)
2016-05-26 11:32:16 -04:00
Cole Robinson f8dc431e37 Explicitly error if spice GL setup fails
Fix monitor resizing with virgl (bz #1337564)
Fix libvirt noise when introspecting qemu-kvm without hw virt
2016-05-20 16:36:01 -04:00
Cole Robinson c3911a29b3 qemu-kvm: Don't try to init KVM during libvirt introspection
If it's disabled on the host, libvirt logs a ton of errors to
syslog.
2016-05-19 18:15:26 -04:00
Cole Robinson 837eb7efa2 qemu: Clean up BuildRequires
Drop outdated:
    nss-devel (old libcacard)
    rsync (no longer used)
    which (no longer used)
    pciutils-devel (no longer used)

Add libcap-ng-devel for extra qemu-bridge-helper restrictions
Document all BuildRequires
Separate buildsystem bits vs feature bits
2016-05-15 14:52:29 -04:00
Cole Robinson e200903264 Rebase to v2.6.0 GA 2016-05-13 14:18:07 -04:00
Cole Robinson 35faab4c45 Fix gtk UI crash when switching to monitor (bz #1333424)
Fix sdl2 UI lockup lockup when switching to monitor
Rebased to qemu-2.6.0-rc5
2016-05-09 13:36:06 -04:00
Cole Robinson bc7ce050b0 Rebased to version 2.6.0-rc4
Fix test suite on big endian hosts (bz 1330174)
2016-05-02 16:08:20 -04:00
Cole Robinson b455e4b103 Rebuild to pick up spice GL support 2016-04-25 09:01:59 -04:00
Cole Robinson b0b55fdca8 Rebased to version 2.6.0-rc3
Fix s390 sysctl file install (bz 1327870)
Adjust spice gl version check to expect F24 backported version
2016-04-22 08:03:02 -04:00
Cole Robinson 6138a983a3 - Rebased to version 2.6.0-rc2
- Fix GL deps (bz 1325966)
- Ship sysctl file to fix s390x kvm (bz 1290589)
- Fix FTBFS on s390 (bz 1326247)
2016-04-14 18:48:51 -04:00
Cole Robinson c752245c96 Ship sysctl file to fix s390x kvm (bz 1290589) 2016-04-14 18:46:31 -04:00
Cole Robinson fa6cd1dad5 Fix GL deps (bz 1325966) 2016-04-14 18:34:08 -04:00
Cole Robinson a503b12a16 Add sources 2016-04-07 13:03:15 -04:00
Cole Robinson 4097206ab3 Rebased to version 2.6.0-rc1 2016-04-07 13:00:29 -04:00
Cole Robinson 54cb1301c6 CVE-2016-2857: net: out of bounds read (bz #1309564)
CVE-2016-2392: usb: null pointer dereference (bz #1307115)
2016-03-17 13:45:47 -04:00
Peter Robinson ae11374147 Rebuild for tcmalloc ifunc issues on non x86 arches (see rhbz 1312462) 2016-03-09 15:12:12 +00:00
Paolo Bonzini 43821749cc Disable xfsctl, fallocate works fine in newer kernels (bz #1305512) 2016-03-01 13:14:39 +01:00
Peter Robinson 73731f9ecd All Fedora arches have libseccomp support (ARMv7, aarch64, Power64, s390(x)) 2016-03-01 11:46:16 +00:00
Cole Robinson 7d975d9810 CVE-2015-8619: Fix sendkey out of bounds (bz #1292757)
CVE-2016-1981: infinite loop in e1000 (bz #1299995)
Fix Out-of-bounds read in usb-ehci (bz #1300234, bz #1299455)
CVE-2016-2197: ahci: null pointer dereference (bz #1302952)
Fix gdbstub for VSX registers for ppc64 (bz #1304377)
Fix qemu-img vmdk images to work with VMware (bz #1299185)
2016-02-15 17:05:41 -05:00
Fedora Release Engineering 95a588650f - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-04 21:38:06 +00:00
Cole Robinson b24b7f1644 CVE-2015-8567: net: vmxnet3: host memory leakage (bz #1289818)
CVE-2016-1922: i386: avoid null pointer dereference (bz #1292766)
CVE-2015-8613: buffer overflow in megasas_ctrl_get_info (bz #1284008)
CVE-2015-8701: Buffer overflow in tx_consume in rocker.c (bz #1293720)
CVE-2015-8743: ne2000: OOB memory access in ioport r/w functions (bz #1294787)
CVE-2016-1568: Use-after-free vulnerability in ahci (bz #1297023)
Fix modules.d/kvm.conf example syntax (bz #1298823)
2016-01-20 20:17:04 -05:00
Cole Robinson 78f4db5d1d Fix virtio 9p thread pool usage
CVE-2015-8558: DoS by infinite loop in ehci_advance_state (bz #1291309)
Re-add dist tag
2016-01-09 12:35:08 -05:00
Cole Robinson 2a77992272 spec: Re-add dist tag 2016-01-09 11:18:17 -05:00
Cole Robinson e8a6e4f833 Replace %define usage with %global 2016-01-09 11:16:52 -05:00
Paolo Bonzini 205399c1ee add missing file 2016-01-07 21:13:32 +01:00
Paolo Bonzini c9396159e8 oops, it is now 2016 2016-01-07 21:07:39 +01:00
Paolo Bonzini 15489f4108 fix previous commit 2016-01-07 21:04:45 +01:00
Paolo Bonzini 0d5e9f6618 add 0001-virtio-9p-use-accessor-to-get-thread-pool.patch 2016-01-07 20:57:53 +01:00
Paolo Bonzini dda6c386a5 add /etc/modprobe.d/kvm.conf 2016-01-07 20:57:53 +01:00
Cole Robinson 6176f1d7e2 Reabsed to version 2.5.0 2015-12-23 17:49:55 -05:00
Cole Robinson 89aacd5f7a Rebased to version 2.5.0-rc3 2015-12-08 10:29:09 -05:00
Cole Robinson 6baf84acf1 Rebased to version 2.5.0-rc2 2015-11-30 18:00:49 -05:00
Cole Robinson 191c302918 qemu 2.5.0 rc1 2015-11-20 22:24:11 -05:00
Cole Robinson 7bf1a680e6 Drop needless ksm dep on qemu-common 2015-11-20 21:04:54 -05:00
Cole Robinson 48e07c5c6e spec: code movement for clarity
- Order packages consistently across sections
- Group all %post sections
2015-11-18 10:28:10 -05:00
Cole Robinson 88b3793f29 2.5.0 rc0 wip 2015-11-18 10:20:33 -05:00
Cole Robinson 4f68392c26 Rebased to version 2.4.1 2015-11-04 15:48:36 -05:00
Cole Robinson 86d7b9f29b Rebuild for xen 4.6 2015-10-11 16:08:44 -04:00
Cole Robinson b448bfad34 Rebased to version 2.4.0.1
CVE-2015-7295: virtio-net possible remote DoS (bz #1264393)
drive-mirror: Fix coroutine reentrance (bz #1266936)
2015-10-08 13:38:49 -04:00
Cole Robinson 1ae1f09f33 spec: Fix builddep on libepoxy 2015-09-29 17:09:48 -04:00
Cole Robinson cf8819083b CVE-2015-6815: net: e1000: infinite loop issue (bz #1260225)
CVE-2015-6855: ide: divide by zero issue (bz #1261793)
CVE-2015-5278: Infinite loop in ne2000_receive() (bz #1263284)
CVE-2015-5279: Heap overflow vulnerability in ne2000_receive() (bz #1263287)
2015-09-21 18:01:46 -04:00
Richard W.M. Jones c5e57685f9 Fix emulation of various instructions, required by libm in F22 ppc64 guests. 2015-09-20 10:23:16 +01:00
Cole Robinson 8211390ac8 CVE-2015-5255: heap memory corruption in vnc_refresh_server_surface (bz #1255899) 2015-08-31 20:18:31 -04:00
Cole Robinson 74717053dc Rebased to version 2.4.0
Support for virtio-gpu, 2D only
Support for virtio-based keyboard/mouse/tablet emulation
x86 support for memory hot-unplug
ACPI v5.1 table support for 'virt' board
2015-08-11 18:08:40 -04:00
Cole Robinson d5417f465c Drop perl-Storable requires, texinfo rawhide is fixed now 2015-08-10 10:31:45 -04:00
Cole Robinson 6ac2a80eae Add temporary dep on perl-Storable
see https://bugzilla.redhat.com/show_bug.cgi?id=1251766 for more info
2015-08-09 15:07:58 -04:00
Cole Robinson 6214bfdcf3 Add sources 2015-08-09 13:13:43 -04:00
Cole Robinson 4c6dc5b3d6 CVE-2015-3209: pcnet: multi-tmd buffer overflow in the tx path (bz #1230536)
CVE-2015-3214: i8254: out-of-bounds memory access (bz #1243728)
CVE-2015-5158: scsi stack buffer overflow (bz #1246025)
CVE-2015-5154: ide: atapi: heap overflow during I/O buffer memory access (bz #1247141)
CVE-2015-5165: rtl8139 uninitialized heap memory information leakage to guest (bz #1249755)
CVE-2015-5166: BlockBackend object use after free issue (bz #1249758)
CVE-2015-5745: buffer overflow in virtio-serial (bz #1251160)
2015-08-09 13:08:31 -04:00
Cole Robinson de4550957e Rebased to v2.4.0-rc0 2015-07-14 17:12:37 -04:00
Richard W.M. Jones 61ce511be4 Bump and rebuild. 2015-07-03 19:23:12 +01:00
Richard W.M. Jones 74ab99f1a6 Revert "Enable -fPIC and -fPIE on every architecture (rhbz 1232499)."
This reverts commit 77b7d81b2b.

See https://bugzilla.redhat.com/show_bug.cgi?id=1232499#36
2015-07-03 19:20:51 +01:00
Richard W.M. Jones 77b7d81b2b Enable -fPIC and -fPIE on every architecture (rhbz 1232499). 2015-07-03 18:45:22 +01:00
Daniel P. Berrange bcb37b2ec0 Fix conditional in previous commit 2015-07-03 17:22:51 +01:00
Daniel P. Berrange d4803feead Use explicit --(enable,disable)-spice args (rhbz #1239102) 2015-07-03 15:02:57 +01:00
Peter Robinson 1ec8e52bb2 Build aarch64 with -fPIC (rhbz 1232499) 2015-07-02 16:32:23 +01:00
Peter Robinson 806ecbe49c Disable stack protection for AArch64. F23's GCC thinks that it is available but F23's glibc does not support it. 2015-07-01 11:26:59 +01:00
Paolo Bonzini 749c3c43c3 Rebuild for libiscsi soname bump 2015-06-26 11:10:12 +02:00
Paolo Bonzini 260c0ac680 Re-enable tcmalloc on arm 2015-06-19 12:03:04 +02:00
Dennis Gilmore 6626651b28 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-18 21:39:31 +00:00
Dan Horák 94a40ce774 - gperftools not available on s390(x) 2015-06-10 22:28:01 +02:00
Cole Robinson 6fc6504bd8 CVE-2015-4037: insecure temporary file use in /net/slirp.c (bz #1222894) 2015-06-05 19:55:57 -04:00
Cole Robinson d43799b0b3 spec: Drop now unused kvm_target and kvm_archs globals 2015-06-05 18:21:57 -04:00
Daniel P. Berrange 7bf3158612 Fix conditional enablement of tcmalloc
Opps, cant have comments in the middle of multi-line continuations.
2015-06-01 14:43:36 +01:00
Daniel P. Berrange aa972b9106 Disable broken tcmalloc on arm and re-enable tests 2015-06-01 14:12:15 +01:00
Cole Robinson 198e142c7d Disable _all_ tests on arm, since they are all currently hanging 2015-05-21 14:07:03 -04:00
Cole Robinson 31085aa400 Temporarily disable hanging test on arm 2015-05-20 16:51:14 -04:00
Cole Robinson 7c5a423647 Remove %autopatch macro from changelog 2015-05-13 23:15:28 -04:00
Cole Robinson 18eddd1631 Backport upstream 2.4 patch to link with tcmalloc, enable it
CVE-2015-3456: (VENOM) fdc: out-of-bounds fifo buffer memory access (bz #1221152)
2015-05-13 18:39:05 -04:00
Paolo Bonzini af53ec630c Backport upstream 2.4 patch to link with tcmalloc, enable it 2015-05-13 15:33:19 +02:00
poma 343c57952d Fix ksm.service (bz 1218814) 2015-05-06 12:52:09 -04:00
Dan Horák 5059f25c8e - Require libseccomp only when built with it 2015-05-05 17:03:52 +02:00
Cole Robinson 41aca9586f Rebased to version 2.3.0 GA
Another attempt at fixing default /dev/kvm permissions (bz 950436)
2015-04-27 13:33:41 -04:00
Cole Robinson b26fb5a551 qemu: Drop kvm.modules
Looked into this because recent packaging changes broke kvm.modules
installation, see https://bugzilla.redhat.com/show_bug.cgi?id=1212328

But nowadays this isn't even required I don't think. According to
comments here:

https://bugzilla.redhat.com/show_bug.cgi?id=963198

The reason for shipping it is missing devname:kvm for ppc and s390 kvm
modules. But those have been in upstream kernel.git since late 2013,
so it should be safe to drop entirely.
2015-04-16 09:11:00 -04:00
Cole Robinson 9b9ad7bb74 Rebased to version 2.3.0-rc3 2015-04-14 14:51:42 -04:00
Cole Robinson c61e67e86b Rebased to version 2.3.0-rc2
Don't install ksm services as executable (bz #1192720)
Skip hanging tests on s390 (bz #1206057)
CVE-2015-1779 vnc: insufficient resource limiting in VNC websockets decoder
(bz #1205051, bz #1199572)
2015-04-03 10:21:46 -04:00
Cole Robinson c2770435bf Big specfile cleanup
- Drop all the crazy kvmonly and separate_kvm bits
- Drop outdates conditionals
- Drop old style things like defattr and RPM_BUILD_ROOT
- Readability improvements
2015-03-27 17:08:26 -04:00
Cole Robinson 355b03ef5c Rebased to version 2.3.0-rc1 2015-03-25 08:48:20 -04:00
Cole Robinson 6a451ba509 Remove unused patches 2015-03-22 12:17:06 -04:00
Cole Robinson 8055ee2da9 Rebase to qemu-2.3.0-rc0 2015-03-22 11:06:24 -04:00
Richard W.M. Jones 5a454effcf Revert "- Enable seccomp on ARM (thanks: Peter Robinson)."
This reverts commit 76a74e853f.

The upstream (qemu) configure script hard-codes x86 & x86-64,
so you cannot enable seccomp on arm yet.
2015-02-17 15:07:06 +00:00
Richard W.M. Jones 76a74e853f - Enable seccomp on ARM (thanks: Peter Robinson). 2015-02-17 13:37:05 +00:00
Richard W.M. Jones 6c3741c276 - Add -fPIC flag to build to avoid
'relocation R_X86_64_PC32 against undefined symbol' errors.
- Add a hopefully temporary hack so that -fPIC is used to build
  NSS files in libcacard.
2015-02-17 13:35:59 +00:00
Richard W.M. Jones 391fb81c16 Add UEFI support for aarch64. 2015-02-04 15:54:41 +00:00
Daniel P. Berrange f287dc5662 Re-enable SPICE after previous build fixes circular dep 2015-02-03 14:05:24 +00:00
Daniel P. Berrange fc57f44566 Stop libcacard linking against the entire world 2015-02-03 11:36:06 +00:00
Daniel P. Berrange cad2bcb6a1 Temporarily disable SPICE to break circular build-dep on libcacard 2015-02-03 10:57:50 +00:00
Daniel P. Berrange 0716c2e68a Rebuild for changed xen soname 2015-02-03 09:25:11 +00:00
Daniel P. Berrange 10fa62ffc3 Set pkgversion when running configure 2015-01-28 13:25:27 +00:00
Cole Robinson c88cc7e403 Rebased to version 2.2.0 2014-12-09 16:25:38 -05:00
Cole Robinson bd7b20725b Add sources 2014-11-30 17:45:14 -05:00
Cole Robinson 1be48f0df6 Update to qemu-2.2.0-rc3 2014-11-30 17:19:56 -05:00
Cole Robinson 259393612c Update to qemu-2.2.0-rc1 2014-11-15 20:39:24 -05:00
Cole Robinson 725f84b743 CVE-2014-7815 vnc: insufficient bits_per_pixel from the client sanitization (bz #1157647, bz #1157641)
CVE-2014-3689 vmware_vga: insufficient parameter validation in rectangle functions (bz #1153038, bz #1153035)
2014-10-29 15:58:32 -04:00
Daniel P. Berrange 145f8dccfa Fix dep on numactl-devel to be build time not install time
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-10-24 16:38:01 +01:00
Cole Robinson fbbbab2c57 Fix PPC virtio regression (bz #1144490) 2014-10-06 12:32:22 -04:00
Dan Horák 215b584050 fix typo 2014-09-30 16:48:14 +02:00
Dan Horák 3a39bf78f1 add ppc64le to KVM arches 2014-09-30 16:46:25 +02:00
Cole Robinson 6c2b2d8a11 Fix date in changelog 2014-09-26 12:51:48 -04:00
Richard W.M. Jones 6ce0be8333 Add Requires seabios >= 1.7.5, otherwise Windows virtio booting does not work. 2014-09-26 16:56:20 +01:00
Cole Robinson 46f3a5c276 Rebased to version 2.1.2
CVE-2014-3640 qemu: slirp: NULL pointer (bz #1144821, bz #1144818)
2014-09-26 10:26:35 -04:00
Cole Robinson e84b901375 Fix crash on migration/snapshot (bz #1144490) 2014-09-21 12:42:19 -04:00
Ruben Kerkhof 2f5a0ef6e6 qemu: Fix building without usbredir
The comparison checks if have_usbredir is defined, which it always is.
Check if it's defined and set to 1 instead.
2014-09-15 10:51:00 +01:00
Cole Robinson 723d95470d Rebased to version 2.1.1
CVE-2014-5388: out of bounds memory access (bz #1132962, bz #1132956)
CVE-2014-3615 crash when guest sets high resolution (bz #1139121, bz #1139115)
2014-09-11 15:58:04 -04:00
Richard W.M. Jones 87bbaebdd6 Remember to update Release field this time. 2014-09-03 11:28:38 +01:00
Richard W.M. Jones f2a088a4af Add upstream patches to:
* Fix crash in curl driver.
  * Add curl timeout option.
  * Add curl cookie option.

- Add upstream commit hashes to patches.
2014-09-03 11:27:07 +01:00
Alexey Kardashevskiy d92cc55200 ppc64: Enable HV and PR KVM
Unlike other platforms, PPC64 supports 2 types of KVM:
1. PR KVM emulated in user space - works on every PPC64 platform, even on
old POWERMAC; does not require hypervisor-enabled host CPU (POWER5+ and
newer); does not require OPAL;

2. HV KVM - this requires hypervisor-enabled CPU and OPAL - i.e. recent
POWER7/8 CPUs running as a "powernv" platform only.

So PPC64 KVM is split into 3 kernel modules - kvm_pr, kvm_hv and kvm,
the latter contains bits of code common for both types of KVM.

Recent QEMU supports a "kvm-type" machine option and can instantiate
the requested type of KVM.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2014-08-27 10:57:47 +01:00
Richard W.M. Jones e144c654aa Forgot to update Release field ... 2014-08-20 22:35:42 +01:00
Richard W.M. Jones 4ced99fb02 Add patch for aarch64 which uncompresses -kernel parameter (in arm.next). 2014-08-20 22:28:16 +01:00
Dan Horák 592e6889a5 - Don't fail build due failing tests on s390 (#1100971) 2014-08-19 08:36:38 +02:00
Peter Robinson bc6fc976b4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-17 22:22:32 +00:00
Richard W.M. Jones a6c45000fe Drop optimization flags when compiling on aarch64 (see RHBZ#1126199). 2014-08-03 14:17:35 +01:00
Richard W.M. Jones bcd9d80d1a Update to qemu 2.1.0 final released version. 2014-08-03 13:27:19 +01:00
Cole Robinson cc110b43ed Update to qemu-2.1.0-rc3 2014-07-25 15:02:38 -04:00
Cole Robinson 3561d33ea5 Update to qemu 2.1.0-rc2 2014-07-16 13:05:09 -04:00
Peter Robinson d35cbd0d7e Build qemu-system-aarch64 on all arches, Run check on ARM arches, just don't fail the build ATM 2014-07-15 17:46:17 +01:00
Cole Robinson 4773d3c9c6 Add sources 2014-07-09 12:06:16 -04:00
Cole Robinson b440863c6b Update to qemu-2.1.0-rc1
Enable SDL2 frontend, it's improved recently
Fix drive-mirror segfaults if source size is not cluster-aligned (bz #1114791)
Fix crash with virtio-blk hotunplug (bz #1117181)
2014-07-09 11:53:36 -04:00
Cole Robinson ad339ad339 Update to qemu 2.1-rc0 2014-07-04 15:08:59 -04:00
Cole Robinson 0410ae29c0 Don't use libtool on dtrace, fixes rawhide build (bz #1106968) 2014-06-15 17:58:34 -04:00
Dennis Gilmore 200da9cdce - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-07 20:00:11 -05:00
Cole Robinson 12cd546161 QCOW1 validation CVEs: CVE-2014-0222, CVE-2014-0223 (bz #1097232, bz #1097238, bz #1097222, bz #1097216)
CVE-2014-3461: Issues in USB post load checks (bz #1097260, bz #1096821)
2014-05-31 20:49:56 -04:00
Dan Horák 660494c491 - Disable tests on s390 (#1100971) 2014-05-24 19:47:47 +02:00
Cole Robinson 70114f9e56 Migration CVEs: CVE-2014-0182 etc. 2014-05-11 19:07:44 -04:00
Peter Robinson 5461c5246c Fix aarch64 build by adding aarch64 to kvm_archs 2014-04-30 22:17:24 +01:00
Cole Robinson 762d9e1463 Re-enable test suite on arm, works with a scratch build now 2014-04-26 13:46:26 -04:00
Cole Robinson 21cd6fac34 Don't use SDL2 API support, it's incomplete
Build qemu-system-aarch64 only on aarch64 for now
2014-04-21 20:35:15 -04:00
Cole Robinson 269942c0fd Update to 2.0.0 GA 2014-04-17 12:25:50 -04:00
Cole Robinson f03d6d0588 Sigh, fix %setup 2014-04-15 12:33:04 -04:00
Cole Robinson 7ce01f8f81 Add sources 2014-04-15 12:11:31 -04:00
Cole Robinson 17908043da Update to qemu 2.0-rc3
Fix crash when restoring from snapshot (bz #1085632)
2014-04-15 11:37:22 -04:00
Cole Robinson 75f0c8715a Change gtk quit accelerator to ctrl+shift+q (bz #1062393)
Fix mouse with spice
Enable xen support for xen 4.4
2014-03-24 13:20:43 -04:00
Cole Robinson 1560ff70e8 spec: Disable check on arm just to get the build out 2014-03-24 13:16:27 -04:00
Cole Robinson 3400e70a32 Enable xen support for xen 4.4 2014-03-24 09:15:34 -04:00
Cole Robinson ac843bf3ce Update to qemu 2.0 rc0 2014-03-18 14:25:31 -04:00
Richard W.M. Jones 755ac92dbf Better to quote the argument to test. 2014-02-18 17:10:08 +00:00
Richard W.M. Jones 5b4ee6cf96 Run qemu-sanity-check on x86 and armv7 too. The results are still only advisory. 2014-02-18 11:42:46 -05:00
Richard W.M. Jones aa1e9b6b3f Disable make check on aarch64. 2014-01-13 10:12:15 +00:00
Cole Robinson e65bbe3b55 spec: Fix some --without conditionals (bz 1048476) 2014-01-06 12:35:34 -05:00
Ville Skyttä c4896d008b Add libcacard ldconfig %post* scriptlets. 2013-12-21 20:30:28 +02:00
Cole Robinson c4025101e7 Add kill() to seccomp whitelist, fix AC97 with -sandbox on (bz #1043521)
Changing streaming mode default to off for spice (bz #1038336)
Fix guest scsi verify command (bz #1001617)
2013-12-18 12:11:24 -05:00
Cole Robinson cba9c935f9 Update qemu-img patch to latest available upstream version 2013-12-04 18:14:53 -05:00
Cole Robinson cf5f9d239e Clarify chrpath comment 2013-12-04 18:13:23 -05:00
Cole Robinson 46c39e954f Actually missing files 2013-12-03 06:55:15 -05:00
Cole Robinson bacd9b0468 Fix qemu-img create with NBD backing file (bz #1034433)
Rebase to qemu-1.7 GA
New monitor command blockdev-add for full featured block device hotplug.
Performance and functionality improvements for USB 3.0.
Many VFIO improvements
ACPI tables can be generated by QEMU and can be used by firmware directly.
Support creating and writing .vhdx images.
qemu-img map: dump detailed image file metadata
2013-12-03 06:36:52 -05:00
Richard W.M. Jones dd16baaeb5 Run chrpath on binaries, so qemu can be built using rpmbuild. 2013-11-29 13:36:26 +00:00
Cole Robinson 45bdef1ab0 Update to qemu-1.7.0-rc1 2013-11-21 16:20:05 -05:00
Cole Robinson 4b57421a2c Fix drive discard options via libvirt (bz #1029953)
Fix process exit with -sandbox on (bz #1027421)
2013-11-17 17:32:44 -05:00
Cole Robinson acbc4a5d3a Reduce CPU usage when audio is playing (bz #1017644)
Base on qemu 1.6.1 tarball
ksmtuned: Fix matching qemu w/o set_process_name (bz #1012604)
ksmtuned: Fix committed_memory when no qemu running (bz #1012610)
Make sure bridge helper is setuid (bz #1017660)
2013-11-05 19:42:39 -05:00
Cole Robinson 0c698d13b9 Fix migration from qemu <= 1.5 2013-10-09 13:38:07 -04:00
Cole Robinson 2983660f65 Rebase to pending 1.6.1 stable
CVE-2013-4377: Fix crash when unplugging virtio devices (bz #1012633, bz #1012641)
Fix 'new snapshot' slowness after the first snap (bz #988436)
Fix 9pfs xattrs on kernel 3.11 (bz #1013676)
CVE-2013-4344: buffer overflow in scsi_target_emulate_report_luns (bz #1015274, bz #1007330)
2013-10-06 14:33:55 -04:00
Cole Robinson 840b28a1f8 Fix -vga qxl with -display vnc (bz #948717)
Fix USB crash when installing reactos (bz #1005495)
Don't ship x86 kvm wrapper on arm (bz #1005581)
2013-09-24 10:17:48 -04:00
Dan Horák 52cf04624c - Enable TCG interpreter for s390 as the native backend supports 64-bit only
- Don't require RDMA on s390(x)
2013-09-12 19:09:51 +02:00
Cole Robinson 9e0a86718c Fix qmp capabilities calls on i686 (bz #1003162)
Fix crash with -M isapc -cpu Haswell (bz #986790)
Fix crash in lsi_soft_reset (bz #1000947)
Fix initial /dev/kvm permissions (bz #993491)
2013-09-03 14:49:39 -04:00
Cole Robinson 81ec822962 Only dependy on qemu-sanity-check where it's currently available 2013-08-29 12:26:19 -04:00
Richard W.M. Jones 54891983e0 Enable qemu-sanity-check, however do not fail the build if it fails. 2013-08-28 15:22:29 +01:00
Cole Robinson 89d8790801 Only build against libssh2 on F20+ to fix virt-preview 2013-08-28 08:36:13 -04:00
Richard W.M. Jones bfefcc20b8 Require newer libssh2 to fix missing libssh2_sftp_fsync (bz #999161) 2013-08-21 09:48:54 +01:00
Cole Robinson f950cd7985 Require newer ceph-libs to fix symbol error (bz #995883) 2013-08-20 14:13:58 -04:00
Richard W.M. Jones 64e123aeee Try to rebuild since previous i686 build was broken (RHBZ#998722).
- In build, qemu -help just to check the binary is not broken.
2013-08-20 12:34:22 +01:00
Cole Robinson 76dcac38f6 Rebased to version 1.6.0
Support for live migration over RDMA
TCG target for aarch64.
Support for auto-convergence in live migration ("CPU stunning")
The XHCI (USB 3.0) controller supports live migration.
New device "nvme" provides a PCI device that implements the NVMe
standard.
ACPI hotplug of devices behind a PCI bridge is supported
2013-08-16 14:20:08 -04:00
Dennis Gilmore 54ffecd5cf re-enable spice support 2013-08-04 08:02:10 -05:00
Dennis Gilmore 2ed53bed7d try another way to disable spice 2013-08-03 08:12:44 -05:00
Dennis Gilmore 558d4c194e build without spice support to build against new libiscsi
- spice requires parts of qemu
2013-08-02 21:47:40 -05:00
Paolo Bonzini 1c81baa208 Rebuild for libiscsi soname bump 2013-08-02 17:38:43 +02:00
Cole Robinson 67ad330b45 Rebased to version 1.5.2
Fix mouse display with spice and latest libvirt (bz #981094)
2013-07-29 14:24:38 -04:00
Cole Robinson b6a83a54d0 Update to work with seabios 1.7.3 2013-07-09 10:33:08 -04:00
Cole Robinson bc2c95de5f Remove BuildRequires: check-devel, not needed for a while 2013-07-01 11:21:43 -04:00
Cole Robinson 8a0cce2bab Rebased to version 1.5.1 2013-06-28 20:11:02 -04:00
Cole Robinson 81a3da8be9 Don't install conflicting binfmt handler on arm (bz #974804)
Use upstream patch for libfdt build fix
2013-06-19 10:35:19 -04:00
Peter Robinson 09747c8a31 Put ARM kvm bits in right sub package 2013-06-15 17:41:18 +01:00
Cole Robinson 562b652dea Fix build with both new and old fdt 2013-06-13 14:57:15 -04:00
Cole Robinson 05409c7381 Fix build with rawhide libfdt 2013-06-12 12:37:46 -04:00
Cole Robinson 77dc39eae6 Add forgotten patch 2013-06-11 17:12:46 -04:00
Cole Robinson e1f7cc577f Fix rtl8139 + windows 7 + large transfers (bz #970240) 2013-06-11 16:56:15 -04:00
Peter Robinson 441340007b build qemu-kvm on ARMv7 2013-06-01 23:30:46 +01:00
Dan Horák f81e73803f - Install the qemu-kvm.1 man page only on arches with kvm 2013-05-27 14:30:37 +02:00
Cole Robinson 979ec18948 Alias qemu-system-* man page to qemu.1 (bz #907746)
Drop execute bit on service files (bz #963917)
Conditionalize KSM service on host virt support (bz #963681)
Split out KSM package, make it not pulled in by default
2013-05-25 14:54:03 -04:00
Cole Robinson b9a8d04040 Add BuildRequires: gettext 2013-05-21 14:51:10 -04:00
Cole Robinson 7fae7fbaf1 Update to qemu 1.5
KVM for ARM support
A native GTK+ UI with internationalization support
Experimental VFIO support for VGA passthrough
Support for VMware PVSCSI and VMXNET3 device emulation
CPU hot-add support
2013-05-21 14:26:12 -04:00
Paolo Bonzini d8d9ba50c6 Drop loading of vhost-net module (bz #963198)
It is loaded via udev these days.
2013-05-16 11:58:11 +02:00
Cole Robinson cc240d482d Add forgotten patch 2013-05-15 17:06:02 -04:00
Cole Robinson af14887e96 Fix crash with usbredir (bz #962826)
Drop unneeded kvm.modules on x86 (bz #963198)
Make ksmtuned handle set_progname usage (bz #955230)
Enable gluster support
2013-05-15 17:00:49 -04:00
Cole Robinson 1c306606ca Rebased to version 1.4.1
qemu stable release 1.4.1 (bz 952599)
CVE-2013-1922: qemu-nbd block format auto-detection vulnerability (bz
952574, bz 923219)
2013-04-20 20:10:19 -04:00
Richard W.M. Jones 0194f981be Rebuild to attempt to fix broken dep on libbrlapi.so.0.5 2013-04-04 22:29:51 +01:00
Cole Robinson b049f1674f binfmt fixes and improvements 2013-04-03 21:06:24 -04:00
Hans de Goede 44aa5d78d7 Fix USB-tablet not working with some Linux guests (bz #929068) 2013-04-03 12:17:47 +02:00
Cole Robinson 49c3b9cb0c Fix dep on seavgabios-bin 2013-04-02 09:20:11 -04:00
Cole Robinson d1a627e27f Fixes for iscsi dep
Fix TCG ld/st optimization (lp 1127369)
Fix possible crash with VNC and qxl (bz #919777)
Fix kvm module permissions after first install (bz #907215)
Switch to seavgabios by default
2013-04-01 20:47:11 -04:00
Richard W.M. Jones 32fdc73a1f Fix TCG ld/st optimization. https://bugs.launchpad.net/bugs/1127369 2013-03-31 21:05:33 +01:00
Paolo Bonzini 933c1850b6 backport xfsprogs and usbredir flags from el6 2013-03-14 16:57:11 +01:00
Paolo Bonzini 6b31a2a39a do not package libcacard in the separate_kvm case 2013-03-14 16:57:06 +01:00
Paolo Bonzini 30823602b7 Use pkg-config to search for libiscsi 2013-03-11 18:12:05 +01:00
Paolo Bonzini 625ba4a454 Added libiscsi-devel BuildRequires 2013-03-11 17:25:17 +01:00
Cole Robinson c0e5414d6e Fix test ordering with latest glib 2013-03-01 13:05:58 -05:00
Cole Robinson 55b1cb43bd Handful of packaging fixes
- Drop old patches
- Fix SLOF dep after latest rawhide build
- Fix qemu-kvm wrapper script
- Fix doc generation with texinfo 5
2013-02-20 12:18:15 -05:00
Cole Robinson 96a5f8d770 Rebased to version 1.4.0
block: dataplane for virtio, potentially large performance improvment
migration: threaded live migration
usb-tablet: usb 2.0 support, significantly lowering CPU usage
usb: improved support for pass-through of USB serial devices
virtio-net: added support supports multiqueue operation
2013-02-19 20:14:18 -05:00
Michael Schwendt 475c910487 add BR perl-podlators for pod2man (F19 development) 2013-02-02 21:02:48 +01:00
Michael Schwendt b58f704893 fix "bogus date" entries in %changelog to fix rebuild 2013-02-02 20:04:37 +01:00
Alon Levy 2c0fbb0128 revert the last change but bump version to avoid going back in time 2013-02-01 16:24:28 +01:00
Alon Levy 6be650bd29 qemu now provides libcacard, advertise with Provides & Obsoletes 2013-01-29 12:51:17 +02:00
Richard W.M. Jones 0fdf09c7f4 Bump and rebuild for updated libseccomp. 2013-01-28 19:46:36 +00:00
Alon Levy 9e8e016378 Fix missing error_set symbol in libcacard.so (bz #891552)
Signed-off-by: Alon Levy <alevy@redhat.com>
2013-01-22 17:36:14 +02:00
Adam Tkac 83b95606fe Rebuild due to "jpeg8-ABI" feature drop
Signed-off-by: Adam Tkac <atkac@redhat.com>
2013-01-21 16:36:56 +01:00
Cole Robinson 6986e10cf3 Fix migration from qemu-kvm
Fix the test suite on i686
Use systemd macros in specfile (bz #850285)
2013-01-16 09:37:23 -05:00
Hans de Goede 4e26a3bcc1 Fix 0110-usb-redir-Add-flow-control-support.patch being mangled on rebase
to 1.3.0, breaking usbredir support
2013-01-15 11:56:09 +01:00
Cole Robinson 911f928556 Disable tests, currently failing on i686 (and then hanging koji)
GTESTER check-qtest-i386
**
ERROR:tests/rtc-test.c:209:set_year_20xx: assertion failed (cmos_read(RTC_HOURS) == 0x02): (25 == 2)
GTester: last random seed: R02S3c33904d728a7716fb49ee76edbb6e40
2012-12-08 10:35:36 -05:00
Cole Robinson 22d63f488d Switch base tarball from qemu-kvm to qemu
qemu 1.3 release
Option to use linux VFIO driver to assign PCI devices
Many USB3 improvements
New paravirtualized hardware random number generator device.
Support for Glusterfs volumes with "gluster://" -drive URI
Block job commands for live block commit and storage migration
2012-12-07 13:18:14 -05:00
Cole Robinson 7e50c47580 qemu spec temp 2012-12-06 17:42:50 -05:00
Cole Robinson 8a456cc8a4 remove all patches 2012-12-06 17:05:45 -05:00
Alon Levy c8a79ad751 add libcacard, -25
Conflicts:
	qemu.spec
2012-12-03 19:36:09 +02:00
Paolo Bonzini 7ebab2ca78 Merge branch 'f18' 2012-11-22 12:20:08 +01:00
Paolo Bonzini 2daa1c5706 Move vscclient to qemu-common, qemu-nbd to qemu-img 2012-11-22 12:18:34 +01:00
Paolo Bonzini 254dd04afb join history for f18 and master 2012-11-22 12:07:01 +01:00
Alon Levy cc85c43370 Virtio-serial fixes
1. Post migration inject interrupt to a running vm to workaround
a bug in kvm irqchip emulation (pending upstream acceptance)
2. Redo fedora only fix for #725965 (replay guest open after migration)
based on the above fix.
2012-11-20 11:05:19 -05:00
Eduardo Habkost 0fe1b70a59 replacing tarball with the one from kvm.sourceforge.net
File from http://sourceforge.net/projects/kvm/files/qemu-kvm/1.2.0/

SHA1:ce0d1c5067414f2eeaf34c5f2976e64634f34cc8

Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
2012-11-19 16:15:42 -02:00
Alon Levy d195bae2d0 Virtio-serial fixes
1. Post migration inject interrupt to a running vm to workaround
a bug in kvm irqchip emulation (pending upstream acceptance)
2. Redo fedora only fix for #725965 (replay guest open after migration)
based on the above fix.
2012-11-19 13:46:12 +02:00
Paolo Bonzini bd903e8207 Allow building a package that is able to coexist with RHEL's KVM package
Backport of commit 683d072d47 from el6
branch.
2012-11-16 13:42:05 +01:00
Paolo Bonzini 156e0fb737 Fix previous commit 2012-11-16 10:08:47 +01:00
Paolo Bonzini 31bb198284 Backport commit 38f419f (configure: Fix CONFIG_QEMU_HELPERDIR generation, 2012-10-17) 2012-11-16 09:11:22 +01:00
Paolo Bonzini 773d5bd0fe fixes for -netdev bridge
- Install qemu-bridge-helper as suid root
- Distribute a sample /etc/qemu/bridge.conf file
2012-11-15 17:58:12 +01:00
Hans de Goede 64c339471e Sync spice patches with upstream, minor bugfixes and set the qxl pci
device revision to 4 by default, so that guests know they can use
  the new features
2012-11-01 11:46:02 +01:00
Cole Robinson 771708e988 Fix loading arm initrd if kernel is very large (bz #862766)
Don't use reserved word 'function' in systemtap files (bz #871286)
Drop assertion that was triggering when pausing guests w/ qxl (bz #870972)
2012-10-30 20:56:59 -04:00
Cole Robinson 5544c1b492 Pull patches queued for qemu 1.2.1 2012-10-28 14:05:07 -04:00
Paolo Bonzini ae1cd7de6a bump release to 16 2012-10-19 11:47:08 +02:00
Paolo Bonzini 31c6335e4b add s390x KVM support 2012-10-19 11:47:08 +02:00
Paolo Bonzini c32efea44f add system targets that require pre-built firmware 2012-10-19 11:47:08 +02:00
Paolo Bonzini 40e61a7815 add more system targets that do not require any firmware 2012-10-19 11:47:08 +02:00
Paolo Bonzini b7a1ff8921 add missing linux-user targets 2012-10-19 11:47:08 +02:00
Paolo Bonzini a8e3fc5c28 fix previous commit
When doing a kvmonly build, "make install" failed to find files that were
deleted by the "make clean".  Only do "make clean" in non-kvmonly builds that
do need a qemu-kvm binary (which basically means Fedora x86).
2012-10-19 11:45:55 +02:00
Dan Horák e5989dca67 fix build on non-kvm arches like s390(x) 2012-10-18 17:27:22 +02:00
Paolo Bonzini 861e5caceb bump release number 2012-10-17 12:02:42 +02:00
Paolo Bonzini cede367975 Change SLOF Requires for the new version number 2012-10-17 12:01:14 +02:00
Paolo Bonzini 2803fc8daa restructure conditionals for bug 859314 2012-10-12 00:03:30 +02:00
Paolo Bonzini 74cc437ed3 bump release to 12 2012-09-28 17:46:20 +02:00
Paolo Bonzini 8cc727f1fa Call udevadm on post, fixing bug 860658
* Fri Sep 28 2012 Paolo Bonzini <pbonzini@redhat.com> - 2:1.2.0-12
- Call udevadm on post, fixing bug 860658
2012-09-28 17:44:46 +02:00
Hans de Goede ca70dc3e47 Rebuild against latest spice-server and spice-protocol
- Fix non-seamless migration failing with vms with usb-redir devices,
  to allow boxes to load such vms from disk
2012-09-28 12:23:45 +02:00
Hans de Goede 5ba1a77e21 Sync Spice patchsets with upstream (rhbz#860238)
- Fix building with usbredir >= 0.5.2
2012-09-25 21:47:24 +02:00
Hans de Goede 93b7e385db Sync USB and Spice patchsets with upstream 2012-09-20 22:04:51 +02:00
Cole Robinson a7058a8d2f Re-enable %check, works fine for me with 2 scratch builds 2012-09-19 07:07:53 -04:00
Richard W.M. Jones f933b63504 Include dist tag too ... 2012-09-16 22:00:43 +01:00
Richard W.M. Jones a7d1ff8071 Use SLOF = 0-0.1.git<date> (ie. n-v-r). The version is literally "0". 2012-09-16 21:08:21 +01:00
Richard W.M. Jones 9ab3f1d107 Apparently need to include dist tag in the dependency too. 2012-09-16 19:55:19 +01:00
Richard W.M. Jones a6d8d36a6d Further fix for RHBZ#855252. 2012-09-16 18:55:24 +01:00
Paolo Bonzini 1fbcf81188 add versioned dependency from qemu-system-ppc to SLOF (BZ#855252) 2012-09-14 12:47:22 +02:00
Paolo Bonzini 06561ef59b join (again) f17 and f18 histories 2012-09-14 12:47:15 +02:00
Paolo Bonzini 1305d5e81b join (again) f16 and f17 histories 2012-09-14 12:46:08 +02:00
Paolo Bonzini e224718dc0 join (again) f15 and f16 histories 2012-09-14 12:44:54 +02:00
Richard W.M. Jones 6ae593a9b4 Merge ../master into f18 2012-09-12 20:00:07 +01:00
Richard W.M. Jones dbb388cc95 Fix RHBZ#853408 which causes libguestfs failure. 2012-09-12 19:48:55 +01:00
Hans de Goede af1c587229 Merge remote-tracking branch 'origin/master' into f18 2012-09-08 16:42:09 +02:00
Hans de Goede 3e10261f1d Fix dates in changelog
To be picked up with a future build.
2012-09-08 16:41:14 +02:00
Hans de Goede fd902e46ea Merge remote-tracking branch 'origin/master' into f18 2012-09-08 16:08:33 +02:00
Hans de Goede 393f81befe Fix crash on (seamless) migration
- Sync usbredir live migration patches with upstream
2012-09-08 16:06:35 +02:00
Hans de Goede c0a9abc299 Merge remote-tracking branch 'origin/master' into f18 2012-09-07 17:30:40 +02:00
Hans de Goede c8dfc65f53 New upstream release 1.2.0 final
- Add support for Spice seamless migration
- Add support for Spice dynamic monitors
- Add support for usb-redir live migration
2012-09-07 17:20:05 +02:00
Adam Jackson 308e2405ce Merge branch 'master' into f18 2012-09-04 15:57:22 -04:00
Adam Jackson 9acdac90af Flip Requires: ceph >= foo to Conflicts: ceph < foo, so we pull in only the
libraries which we need and not the rest of ceph which we don't.
2012-09-04 15:57:07 -04:00
Cole Robinson 021e58e0d3 Merge branch 'master' into f18 2012-08-28 11:18:31 -04:00
Cole Robinson bd56df9b7a Update to qemu-kvm 1.2.0-rc1 2012-08-28 11:16:35 -04:00
Eduardo Habkost a580d5ae6d x86only: remove unpackaged non-x86 bios files
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-08-24 16:06:45 -03:00
Eduardo Habkost a383819763 x86only: remove unpackaged non-x86 bios files
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-08-24 16:06:28 -03:00
Eduardo Habkost 68195c49fc x86only: build no-kvm-by-default {x86_64,i386}-softmmu binaries, too
This fixes two issues at the same time:
 - The qemu-system-x86_64 binary was not being built in the
   second configure+make run
 - The second configure+make run was not generating the qemu-img and
   qemu-io binaries because it didn't include any -softtmu target

Those issues appeared only if x86only option was enabled, as the default
$buildarch definition already included x86_64-softmmu and i386-softmmu.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-08-24 15:13:09 -03:00
Eduardo Habkost d7a2863e19 x86only: build no-kvm-by-default {x86_64,i386}-softmmu binaries, too
This fixes two issues at the same time:
 - The qemu-system-x86_64 binary was not being built in the
   second configure+make run
 - The second configure+make run was not generating the qemu-img and
   qemu-io binaries because it didn't include any -softtmu target

Those issues appeared only if x86only option was enabled, as the default
$buildarch definition already included x86_64-softmmu and i386-softmmu.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-08-24 15:08:27 -03:00
Richard W.M. Jones 93c32ff4aa Backport Bonzini's vhost-net fix (RHBZ#848400). 2012-08-20 11:49:50 +01:00
Eduardo Habkost a90c98ade8 enable x86only build option on RHEL builds
Resolves: bz#821913

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-08-14 12:48:47 -03:00
Cole Robinson b5b3696547 Bump release number, previous build forgot but the dist bump helped us out 2012-08-14 10:27:45 -04:00
Cole Robinson 17b55bc021 Bump spec with latest changes 2012-08-14 09:11:37 -04:00
Cole Robinson c5cd364aca Build KVM for all targets 2012-08-14 08:54:17 -04:00
Cole Robinson 57c57a19f5 Revive sparc and ppc 2012-08-13 10:48:00 -04:00
Cole Robinson 71430da381 Various spec file cleanups
- Reduce duplication between the two ./configure calls
- Remove some old comments
- Document what roms we are deleting and why
- Document what targets we aren't building

Should all be a no-op
2012-08-13 08:58:27 -04:00
Cole Robinson eb68249eeb Uploaded wrong source file :( 2012-08-06 20:01:51 -04:00
Cole Robinson 891cc0fdb7 One more time with the source changes 2012-08-06 19:23:00 -04:00
Cole Robinson ff015c192d Actually add source changes 2012-08-06 19:16:42 -04:00
Cole Robinson b6dd5ac167 Rebase to upstream qemu-kvm checkout in time for F18 feature freeze 2012-08-06 19:15:48 -04:00
Cole Robinson cd9d161514 CVE-2012-2652: Possible symlink attacks with -snapshot (bz 825697, bz 824919)
Fix systemtap tapsets (bz 831763)
Fix qmp response race caused by spice server bug (bz 744015)
Fix text mode screendumps (bz 819155)
Don't renable ksm on update (bz 815156)
Fix RPM install error on non-virt machines (bz 660629)
Obsolete openbios to fix upgrade dependency issues (bz 694802)
2012-07-29 21:15:19 -04:00
Cole Robinson 8e54b56c40 Fix systemtap backport 2012-07-29 21:14:20 -04:00
Cole Robinson 8452a89533 Fix systemtap tapsets (bz 831763)
Fix VNC audio tunnelling (bz 840653)
CVE-2012-2652: Possible symlink attacks with -snapshot (bz 825697, bz 824919)
Don't renable ksm on update (bz 815156)
Bump usbredir dep (bz 812097)
Fix RPM install error on non-virt machines (bz 660629)
Obsolete openbios to fix upgrade dependency issues (bz 694802)
2012-07-29 20:57:27 -04:00
Cole Robinson 5439f9b0ec Fix systemtap tapsets (bz 831763)
Fix VNC audio tunnelling (bz 840653)
Don't renable ksm on update (bz 815156)
Bump usbredir dep (bz 812097)
Fix RPM install error on non-virt machines (bz 660629)
Obsolete openbios to fix upgrade dependency issues (bz 694802)
2012-07-29 20:13:45 -04:00
Dennis Gilmore 207a244702 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-21 07:52:23 -05:00
Cole Robinson d2798f56e7 Fix fedora guest hang with virtio console (bz 837925) 2012-07-18 18:05:00 -04:00
Cole Robinson 9e4ae06b20 Fix fedora guest hang with virtio console (bz 837925) 2012-07-18 18:01:46 -04:00
Daniel P. Berrange 5da8fbc4fb Fix default machine type patch to apply correctly
The previous commit added a new patch  0001-qemu-kvm-Fix-default-machine-options.patch
but then mistakenly applied the old patch 0001-qemu-kvm-Add-missing-default-machine-options.patch
as Patch5 (having previously disabled it as Patch1). The new patch
did not actually apply cleanly anyway, since it was diff'd against
master, not stable-1.1
2012-07-16 15:22:47 +01:00
Richard W.M. Jones a1f6edcc3a Back out patch 1 which conflicts with Dan's patch.
Note: I confirmed this change is correct with Dan Berrange.
2012-07-10 11:20:58 +01:00
Richard W.M. Jones 91a090265a Add patch to fix default machine options. This fixes libvirt
detection of qemu.
2012-07-10 10:58:42 +01:00
Hans de Goede ad66101689 Fix qemu crashing (on an assert) whenever USB-2.0 isoc transfers are used 2012-07-06 12:12:49 +02:00
Richard W.M. Jones 0552ca5eb7 Use upstream patch to fix build failure in msi/virtio-pci (thanks Hans de Goede). 2012-07-05 16:03:54 +01:00
Richard W.M. Jones 852ee389bc Build and include virtfs-proxy-helper + man page (thanks Hans de Goede). 2012-07-05 14:45:27 +01:00
Richard W.M. Jones d979973623 Patch to fix siginfo sent upstream. Include this patch. 2012-07-05 14:36:03 +01:00
Richard W.M. Jones 5c9ec95e32 Revert "Cherry pick patch from upstream which fixes build system,"
This reverts commit 79efbf73df.

Sorry, this broke the build.
2012-07-05 14:12:43 +01:00
Richard W.M. Jones 79efbf73df Cherry pick patch from upstream which fixes build system,
and remove hack.
2012-07-05 13:56:56 +01:00
Richard W.M. Jones 46f7a97f71 Further fixes to try to get a Koji build.
Add a hack to use siginfo_t instead of siginfo with glibc from
Rawhide.  This patch is highly UNlikely to be correct.  It only
affects linux-user which approximately no one cares about.

Disable 'make check' since it hangs intermittently.

Add kvmvapic.bin (replaces vapic.bin).

Add cpus-x86_64.conf.  qemu now creates /etc/qemu/target-x86_64.conf
as an empty file.

Add qemu-icon.bmp.

Add qemu-bridge-helper.
2012-07-05 11:28:55 +01:00
Richard W.M. Jones 4a5845b98b Try to get Koji build working.
- Add patch to fix build system (thanks Hans de Goede).
- Remove vapic.bin (BIOS file no longer being created).
2012-07-05 10:48:44 +01:00
Hans de Goede 329b588089 Upgrade to qemu-kvm-1.1.0
- WIP build fails, investigating
- New upstream release 1.1.0
- Drop about a 100 spice + USB patches, which are all upstream
2012-07-05 11:24:44 +02:00
Cole Robinson 2dedc013fc CVE-2011-1750 virtio-blk: heap buffer overflow (bz 698906, bz 698911)
CVE-2011-2527 set groups properly for -runas (bz 720773, bz 720784)
CVE-2012-0029 e1000 buffer overflow (bz 783984, bz 772075)
virtio-blk: refuse SG_IO requests with scsi=off (bz 770135)
2012-05-29 10:25:50 -04:00
Cole Robinson 20c0da0067 CVE-2012-0029 e1000 buffer overflow (bz 783984, bz 772075)
virtio-blk: refuse SG_IO requests with scsi=off (bz 826042)
2012-05-29 09:47:40 -04:00
Eduardo Habkost 188256aae3 add ceph dependency only if %{with rbd} is set
We can't depend on ceph if we aren't building with ceph-devel on the buildroot.

Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
2012-05-07 14:21:41 -03:00
Paolo Bonzini 45f96fecc4 Fix install failure due to set -e (rhbz #815272)
Shows up only on ARM for some reason.
2012-04-23 11:31:29 +02:00
Paolo Bonzini 34104a5fe7 Fix kvm.modules to exit successfully on non-KVM capable systems
Resolves rhbz #814932.
2012-04-23 10:10:29 +02:00
Hans de Goede 56753ff081 Add a couple of backported QXL/Spice bugfixes
- Add spice volume control patches
2012-04-19 17:28:17 +02:00
Paolo Bonzini c7f7fc0b56 Merge branch 'f17'
Conflicts:
	qemu.spec
2012-04-06 14:18:49 +02:00
Paolo Bonzini 07beaa0b7a join f17 and rawhide histories 2012-04-06 14:17:42 +02:00
Paolo Bonzini 78e14dee0d bump release to 12 2012-04-06 14:16:24 +02:00
Paolo Bonzini a96ffe838d update qemu.binfmt from upstream 2012-04-06 14:15:33 +02:00
Paolo Bonzini ffa1ccd156 re-enable PPC and SPARC usermode 2012-04-06 14:15:33 +02:00
Paolo Bonzini 4548120aef join f16 and f17 histories 2012-04-06 14:15:14 +02:00
Paolo Bonzini 18e520ad7a join f15 and f16 histories 2012-04-06 09:30:17 +02:00
Hans de Goede 18956f263a Some more USB bugfixes from upstream 2012-04-02 14:11:35 +02:00
Hans de Goede 0fa3e51f4b Some more USB bugfixes from upstream 2012-04-02 14:09:43 +02:00
Eduardo Habkost 4b1ec2e2e4 bump release, add changelog
Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
2012-03-29 12:42:58 -03:00
Eduardo Habkost 49427c5345 Fix Fedora build arch list
Oops, I set exclusive_x86_64 by default. It was supposed to be
_disabled_ by default.

Also, define the --with x86only option, disabling it by default.

Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
2012-03-29 12:38:59 -03:00
Eduardo Habkost 34ccbbead5 bump release, add changelog entry
Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
2012-03-28 17:13:18 -03:00
Eduardo Habkost 5a3baf68a8 use --with variables for build-time settings
This keeps the Fedora and RHEL defaults as-is, but makes the spec code
clearer.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-03-28 17:05:43 -03:00
Daniel P. Berrange 5c86ae917c Fix build of x86_only RPMs 2012-03-28 20:18:43 +01:00
Daniel P. Berrange 4b952370af Switch to use iPXE for netboot ROMs 2012-03-28 20:18:31 +01:00
Daniel P. Berrange 2ee6c28339 Fix build of x86_only RPMs 2012-03-28 19:47:19 +01:00
Daniel P. Berrange e907ae40c4 Switch to use iPXE for netboot ROMs 2012-03-28 19:47:01 +01:00
Eduardo Habkost 4b637e1a59 add --disable-fdt on all configure command-lines
The previous --disable-fdt patch was incomplete. Fixing it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-03-26 11:34:10 -03:00
Eduardo Habkost 1127b2e918 use --disable-fdt on RHEL
RHEL doesn't have libfdt.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-03-26 11:21:58 -03:00
Eduardo Habkost 075dd061a6 Disable RBD support on RHEL builds
RHEL bug: bz#786927

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-03-23 16:33:17 -03:00
Eduardo Habkost 84395157f9 set ExclusiveArch: x86_64 to build it only on x86_64
RHEL bug: bz#786911

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2012-03-23 16:33:14 -03:00
Daniel P. Berrange 52a7a6ecbd Fix readonly 9p filesystems by removing O_NOATIME flag 2012-03-22 16:17:37 +00:00
Daniel P. Berrange 84237cca87 Fix readonly 9p filesystems by removing O_NOATIME flag 2012-03-22 15:52:26 +00:00
Daniel P. Berrange 3bd490d2d0 Move udev rules to /lib/udev/rules.d (rhbz #748207) 2012-03-19 11:25:15 +00:00
Daniel P. Berrange fbe43c5562 Move udev rules to /lib/udev/rules.d (rhbz #748207) 2012-03-19 11:03:03 +00:00
Hans de Goede ed047fd061 Merge remote-tracking branch 'origin/master' into f17
Conflicts:
	qemu.spec
2012-03-12 16:37:34 +01:00
Hans de Goede 1b1995dd67 Add a whole bunch of USB bugfixes from upstream 2012-03-12 16:33:46 +01:00
Daniel P. Berrange eaebe4482c Add many more missing BRs for misc QEMU features & enable test suite 2012-02-14 10:51:14 -06:00
Daniel P. Berrange e458971726 Add many more missing BRs for misc QEMU features & enable test suite 2012-02-13 13:29:32 +00:00
Justin M. Forbes e7a45f871f boot speedup optimization with kvm.modules BZ#785291 2012-02-09 14:35:05 -06:00
Justin M. Forbes 261b9ddbcd merge commit 2012-02-07 16:18:35 -06:00
Justin M. Forbes 357a44f060 Add support for virtio-scsi 2012-02-07 16:15:59 -06:00
Richard W.M. Jones 5ba935aeca Require updated ceph for latest librbd with rbd_flush symbol. 2012-02-05 21:06:01 +00:00
Justin M. Forbes 828c7cadf2 remove unnecessary virio-net from kvm.modules 2012-01-31 14:33:31 -06:00
Justin M. Forbes f7e102ac55 remove unnecessary virio-net from kvm.modules 2012-01-31 14:30:58 -06:00
Justin M. Forbes 6f9d9cf506 Fux usb passthrough, floppy support 2012-01-30 14:05:37 -06:00
Justin M. Forbes 9890a7aa2a Add vhost-net to kvm.modules 2012-01-27 13:39:05 -06:00
Justin M. Forbes abd594bf31 Add vhost-net to kvm.modules 2012-01-27 13:37:44 -06:00
Justin M. Forbes 4d9bbd115e Add vPMU support and fix for CVE-2012-0029. 2012-01-24 16:25:49 -06:00
Justin M. Forbes ff620283c7 remove palcode-clipper 2012-01-13 13:59:26 -06:00
Justin M. Forbes d4cdad5451 Add USB redirect patches 2012-01-13 13:46:23 -06:00
Justin M. Forbes 27c3309077 Add patches from 1.0.1 queue finish 2012-01-11 15:28:54 -06:00
Justin M. Forbes 45e84a0f42 Add patches from 1.0.1 queue 2012-01-11 15:27:49 -06:00
Justin M. Forbes 45e28a1ee3 Enable fedora-13 machine type (to be removed in F17) 2011-11-18 15:10:31 -06:00
Justin M. Forbes f30960ada5 Enable spice for i686 users as well 2011-11-15 14:27:38 -06:00
Justin M. Forbes d5ae0255c0 Fix POSTIN scriplet failure (#748281) 2011-11-03 21:30:07 -05:00
Justin M. Forbes 2bea147667 Fix POSTIN scriplet failure (#748281) 2011-11-03 15:53:07 -05:00
Justin M. Forbes 603dd6670b - Require seabios-bin >= 0.6.0-2 (#741992)
- Replace init scripts with systemd units (#741920)
- Update to 0.15.1 stable upstream
- Enable full relro and PIE (rhbz #738812)
2011-10-21 16:29:08 -05:00
Justin M. Forbes 2a5d7215d6 - Require seabios-bin >= 0.6.0-2 (#741992)
- Replace init scripts with systemd units (#741920)
- Update to 0.15.1 stable upstream
- Enable full relro and PIE (rhbz #738812)
2011-10-21 15:32:18 -05:00
Daniel P. Berrange 307d8081ac Add BR on ceph-devel to enable RBD block device 2011-10-12 17:13:24 +01:00
Daniel P. Berrange 25a35cc7fb Add BR on ceph-devel to enable RBD block device 2011-10-12 16:08:53 +01:00
Daniel P. Berrange 1ad1f9a1d1 Fix packaging of the QEMU guest agent
The binary 'qemu-ga' is not a userspace emulator, it is the
QEMU guest agent. Since this typically needs to be installed
in the guest put it in a sub-RPM.

A systemd service is used to start the agent. A udev rule is
used to automatically start the systemd service, if the
corresponding virtio-serial port is present
2011-10-05 17:33:58 +01:00
Daniel P. Berrange f057293300 Fix packaging of the QEMU guest agent
The binary 'qemu-ga' is not a userspace emulator, it is the
QEMU guest agent. Since this typically needs to be installed
in the guest put it in a sub-RPM.

A systemd service is used to start the agent. A udev rule is
used to automatically start the systemd service, if the
corresponding virtio-serial port is present
2011-10-05 16:00:36 +01:00
Richard W.M. Jones a2bc394c0a - Add BR libattr-devel. This caused the -fstype option to be disabled.
https://www.redhat.com/archives/libvir-list/2011-June/thread.html#01017
2011-09-21 15:56:33 +01:00
Daniel P. Berrange cb9bff32fe Fix typo in BR 2011-09-13 12:32:43 +01:00
Daniel P. Berrange 7d651b69de Enable build with curl (rhbz #737006) 2011-09-13 12:32:37 +01:00
Daniel P. Berrange 292d6df61c Enable DTrace tracing backend for SystemTAP (rhbz #737763) 2011-09-13 12:32:30 +01:00
Daniel P. Berrange 4a7239aade Fix typo in BR 2011-09-13 11:48:08 +01:00
Daniel P. Berrange a9305073c7 Enable build with curl (rhbz #737006) 2011-09-13 11:29:25 +01:00
Daniel P. Berrange 7b1d66018c Enable DTrace tracing backend for SystemTAP (rhbz #737763) 2011-09-13 11:24:38 +01:00
Justin M. Forbes 8b8e0f3039 Merge branch 'master' into f16 2011-08-19 12:05:05 -05:00
Hans de Goede eb1968bffe Add missing BuildRequires: usbredir-devel, so that the usbredir code
actually gets build
2011-08-18 16:37:51 -07:00
Richard W.M. Jones 4111552b44 Force newer spice-protocol.
Otherwise qemu build breaks with many errors like:

/home/rjones/d/fedora/qemu/master/qemu-kvm-0.15.0/hw/qxl.c:131:26: error: 'QXL_INTERRUPT_ERROR' undeclared (first use in this function)
/home/rjones/d/fedora/qemu/master/qemu-kvm-0.15.0/hw/qxl.c:131:26: note: each undeclared identifier is reported only once for each function it appears in
/home/rjones/d/fedora/qemu/master/qemu-kvm-0.15.0/hw/qxl.c: In function 'io_port_to_string':
/home/rjones/d/fedora/qemu/master/qemu-kvm-0.15.0/hw/qxl.c:495:10: error: 'QXL_IO_UPDATE_AREA_ASYNC' undeclared (first use in this function)

We also force newer spice-server-devel for good measure.
2011-08-18 16:43:49 +01:00
Richard W.M. Jones 6ba4785b4a - Add upstream qemu patch 'Allow to leave type on default in -machine'
(2645c6dcaf6ea2a51a3b6dfa407dd203004e4d11).
2011-08-18 16:39:31 +01:00
Richard W.M. Jones 1528fef34a Remove patch qemu-kvm-default-accelerator.patch
This patch is now upstream and is no longer being
applied by the spec file.
2011-08-18 16:35:04 +01:00
Justin M. Forbes 20374e9503 Merge branch 'master' into f16 2011-08-14 14:40:53 -05:00
Justin M. Forbes fc5c27b497 Update to 0.15.0 final 2011-08-14 14:24:40 -05:00
Justin M. Forbes 58c34c6ec3 Merge branch 'master' into f16
Conflicts:
	qemu.spec
2011-08-04 15:00:28 -05:00
Justin M. Forbes b51ebd0cd2 Merge branch 'master' of ssh://pkgs.fedoraproject.org/qemu
Conflicts:
	qemu.spec
2011-08-04 14:10:38 -05:00
Justin M. Forbes 13f703fb9a Update to 0.15.0-rc1 2011-08-04 14:07:48 -05:00
Daniel P. Berrange 1e4ec795ab Fix default accelerator for non-KVM builds (rhbz #724814) 2011-08-04 15:16:50 +01:00
Daniel P. Berrange db8fd942f7 Fix default accelerator for non-KVM builds (rhbz #724814) 2011-08-04 15:16:04 +01:00
Justin M. Forbes 5e10b14df0 Update to 0.15.0-rc0 2011-07-28 12:10:09 -05:00
Hans de Goede 3f1f2961c6 Add support usb redirection over the network, see:
http://fedoraproject.org/wiki/Features/UsbNetworkRedirection
Restore chardev flow control patches
2011-07-19 11:49:04 +02:00
Justin M. Forbes 0c846be9ae Update to git snapshot 525e3df as we prepare for 0.15.0 release 2011-07-18 14:26:30 -05:00
Richard W.M. Jones 2af28c1745 - Add BR libattr-devel. This caused the -fstype option to be disabled.
https://www.redhat.com/archives/libvir-list/2011-June/thread.html#01017
2011-06-22 12:48:48 +01:00
Hans de Goede 7a6484a3d9 Fix a bug in the spice flow control patches which breaks the tcp chardev 2011-05-02 18:26:59 +02:00
Justin M. Forbes 6c5f3fbce9 Disable qemu-ppc and qemu-sparc packages (#679179) 2011-03-29 16:55:04 -05:00
Justin M. Forbes 252f3af86e Spice fixes for flow control 2011-03-28 13:54:26 -05:00
Dan Horák c65e6f2b3d be more careful when removing the -g flag on s390 2011-03-22 13:08:23 +01:00
Justin M. Forbes 67f4e9ba09 Fix thinko on adding the most recent patches. 2011-03-18 08:47:47 -05:00
Justin M. Forbes da929861c3 fix vhost migration issues, and qxl locking for spice 2011-03-16 15:31:55 -05:00
Justin M. Forbes bc9e714751 Re-enable cris and sparc 2011-03-02 11:09:57 -06:00
Justin M. Forbes a0e5e9b322 Update to 0.14.0 release 2011-02-24 11:27:19 -06:00
Justin M. Forbes eccd73a543 add source tarball 2011-02-11 11:26:42 -06:00
Justin M. Forbes bcdf016c02 Merge branch 'master' of ssh://pkgs.fedoraproject.org/qemu
Conflicts:
	qemu.spec
2011-02-11 11:20:07 -06:00
Justin M. Forbes 6473047323 Update to newer git snapshot 2011-02-11 11:17:48 -06:00
Dennis Gilmore 839ed04f82 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild 2011-02-08 22:42:00 -06:00
Justin M. Forbes 6a630c531a Update to 0.14.0 git snapshot 3593e6b 2011-02-08 17:35:06 -06:00
Daniel P. Berrange 35d458d0e9 Fix handling of qemu config files from previous commit
The /etc/qemu directory is potentially used by any of the QEMU
sub RPMs, so needs to be in qemu-common.

The qemu-system-x86  sub-RPM should always include target-x86_64.conf
regardless host arch, since it can be used by both the TCG and KVM
binaries.
2010-11-03 17:20:53 +00:00
Dan Horák 34f76713e8 - Remove kvm config file on non-x86 arches (part of #639471)
- Own the /etc/qemu directory
2010-11-03 15:34:21 +01:00
Justin M. Forbes 345fdd95da Fix typo from S390 changes 2010-10-19 00:31:20 -05:00
Justin M. Forbes ffada97a59 Merge branch 'f14/master' of ssh://pkgs.fedoraproject.org/qemu into f14
Conflicts:
	qemu.spec
2010-10-18 23:10:48 -05:00
Justin M. Forbes 35db8c0471 Fix typo in S390 changes 2010-10-18 23:08:13 -05:00
Justin M. Forbes 502ffeebf7 - Update to 0.13.0 release final
- Fixes for vhost
- Fix mouse in certain guests (#636887)
- Fix issues with WinXP guest install (#579348)
- Resolve build issues with S390 (#639471)
- Fix Windows XP on Raw Devices (#631591)
2010-10-18 23:05:18 -05:00
Jesse Keating 3f0f147a21 - Rebuilt for gcc bug 634757 2010-10-05 20:30:12 -07:00
Justin M. Forbes 2b6f88d8cb Fix qxl pci id, and grab ksm updates. 2010-09-21 16:52:25 -05:00
Justin M. Forbes a81953e710 Updates from upstream to support spice 0.6.0 2010-09-14 14:26:08 -05:00
Justin M. Forbes dbbd2b2c03 Fix requires and add links to newer vgabios 2010-08-10 10:28:21 -05:00
Justin M. Forbes 0516054896 Disable spice on 32bit, the server is 64bit only 2010-08-10 09:19:37 -05:00
Justin M. Forbes 990c3a7c7c Updates from upstream towards 0.13 stable, fix deps 2010-08-10 08:23:48 -05:00
Fedora Release Engineering d4b89ffe4a dist-git conversion 2010-07-29 10:59:19 +00:00
Justin M. Forbes 14af2bd8b2 Add texinfo buildreq for man pages 2010-07-28 06:25:29 +00:00
Justin M. Forbes afaf04c121 Update to upstream qemu-kvm-0.13 snapshot 2010-07-28 04:50:43 +00:00
79 changed files with 2001 additions and 9484 deletions

View File

@ -1,3 +0,0 @@
qemu-kvm-0.12.1.2.tar.gz
qemu-kvm-0.12.2.tar.gz
qemu-kvm-0.12.3.tar.gz

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/.build*.log
/x86_64/
/*.src.rpm
/qemu-*.tar.xz

View File

@ -1,43 +0,0 @@
From af483cb870ad81dce8e10215e0add284fcc38da4 Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:09:45 +0200
Subject: [PATCH] msix: migration fix
Be careful to match mask/unmask callbacks from msix.
Fixes crash during migration.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/msix.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 3fcf3a1..fafaf09 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -614,9 +614,19 @@ int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque)
if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
return 0;
- if (dev->msix_mask_notifier)
- r = dev->msix_mask_notifier(dev, vector, opaque,
- msix_is_masked(dev, vector));
+ if (dev->msix_mask_notifier && !msix_is_masked(dev, vector)) {
+ /* Mask previous notifier if any */
+ if (dev->msix_mask_notifier_opaque[vector]) {
+ r = dev->msix_mask_notifier(dev, vector,
+ dev->msix_mask_notifier_opaque[vector],
+ 1);
+ assert(r >= 0);
+ }
+ /* Unmask new notifier, assumed to be masked at start */
+ if (opaque) {
+ r = dev->msix_mask_notifier(dev, vector, opaque, 0);
+ }
+ }
if (r >= 0)
dev->msix_mask_notifier_opaque[vector] = opaque;
return r;
--
1.6.6.1

View File

@ -1,28 +0,0 @@
From c96adfe57a5a7ceed488fd6f198a762dd84c1d9c Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:09:48 +0200
Subject: [PATCH] vhost: logging thinko fix
Fix logging: set it to requested value.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vhost.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index e5c1ead..3c54596 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -310,7 +310,7 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
{
uint64_t features = dev->acked_features;
int r;
- if (dev->log_enabled) {
+ if (enable_log) {
features |= 0x1 << VHOST_F_LOG_ALL;
}
r = ioctl(dev->control, VHOST_SET_FEATURES, &features);
--
1.6.6.1

View File

@ -1,72 +0,0 @@
From 575c00a2880177295a116d43132566143af69a0b Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:09:51 +0200
Subject: [PATCH] vhost: move vhost_set_vq_addr
Move function in file: we'll add another
call site in the following patch.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vhost.c | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 3c54596..54386e1 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -306,6 +306,25 @@ static void vhost_client_set_memory(CPUPhysMemoryClient *client,
}
}
+static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
+ struct vhost_virtqueue *vq,
+ unsigned idx, bool enable_log)
+{
+ struct vhost_vring_addr addr = {
+ .index = idx,
+ .desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
+ .avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
+ .used_user_addr = (u_int64_t)(unsigned long)vq->used,
+ .log_guest_addr = vq->used_phys,
+ .flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
+ };
+ int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
+ if (r < 0) {
+ return -errno;
+ }
+ return 0;
+}
+
static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
{
uint64_t features = dev->acked_features;
@@ -350,25 +369,6 @@ static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
return 0;
}
-static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
- struct vhost_virtqueue *vq,
- unsigned idx, bool enable_log)
-{
- struct vhost_vring_addr addr = {
- .index = idx,
- .desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
- .avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
- .used_user_addr = (u_int64_t)(unsigned long)vq->used,
- .log_guest_addr = vq->used_phys,
- .flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
- };
- int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
- if (r < 0) {
- return -errno;
- }
- return 0;
-}
-
static int vhost_virtqueue_init(struct vhost_dev *dev,
struct VirtIODevice *vdev,
struct vhost_virtqueue *vq,
--
1.6.6.1

View File

@ -1,70 +0,0 @@
From ac48d782f3b91b2e9962ded5f8a55bd3929a82a5 Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:09:54 +0200
Subject: [PATCH] vhost: used addr migration fix
Enable used buffer logging when migration starts.
Fixed 'id XX is not a head' message after migration.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vhost.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 54386e1..48034ba 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -325,7 +325,7 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
return 0;
}
-static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
+static int vhost_dev_set_features(struct vhost_dev *dev, bool enable_log)
{
uint64_t features = dev->acked_features;
int r;
@@ -336,6 +336,31 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
return r < 0 ? -errno : 0;
}
+static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
+{
+ int r, t, i;
+ r = vhost_dev_set_features(dev, enable_log);
+ if (r < 0)
+ goto err_features;
+ for (i = 0; i < dev->nvqs; ++i) {
+ r = vhost_virtqueue_set_addr(dev, dev->vqs + i, i,
+ enable_log);
+ if (r < 0)
+ goto err_vq;
+ }
+ return 0;
+err_vq:
+ for (; i >= 0; --i) {
+ t = vhost_virtqueue_set_addr(dev, dev->vqs + i, i,
+ dev->log_enabled);
+ assert(t >= 0);
+ }
+ t = vhost_dev_set_features(dev, dev->log_enabled);
+ assert(t >= 0);
+err_features:
+ return r;
+}
+
static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
int enable)
{
@@ -544,7 +569,7 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
{
int i, r;
- r = vhost_dev_set_log(hdev, hdev->log_enabled);
+ r = vhost_dev_set_features(hdev, hdev->log_enabled);
if (r < 0)
goto fail;
r = ioctl(hdev->control, VHOST_SET_MEM_TABLE, hdev->mem);
--
1.6.6.1

View File

@ -1,37 +0,0 @@
From 91c827f000a94908b043b5de68eb0cd4fb6ff83d Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:09:58 +0200
Subject: [PATCH] vhost: fix used logging size math
Must include used header as well, not only ring
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vhost.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 48034ba..7391bd1 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -62,7 +62,8 @@ static int vhost_client_sync_dirty_bitmap(struct CPUPhysMemoryClient *client,
}
for (i = 0; i < dev->nvqs; ++i) {
struct vhost_virtqueue *vq = dev->vqs + i;
- unsigned size = sizeof(struct vring_used_elem) * vq->num;
+ unsigned size = offsetof(struct vring_used, ring) +
+ sizeof(struct vring_used_elem) * vq->num;
vhost_dev_sync_region(dev, start_addr, end_addr, vq->used_phys,
range_get_last(vq->used_phys, size));
}
@@ -230,6 +231,7 @@ static uint64_t vhost_get_log_size(struct vhost_dev *dev)
for (i = 0; i < dev->nvqs; ++i) {
struct vhost_virtqueue *vq = dev->vqs + i;
uint64_t last = vq->used_phys +
+ offsetof(struct vring_used, ring) +
sizeof(struct vring_used_elem) * vq->num - 1;
log_size = MAX(log_size, last / VHOST_LOG_CHUNK + 1);
}
--
1.6.6.1

View File

@ -1,26 +0,0 @@
From b4654f7911adb1352c2c47c76f650e8419a20b91 Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:10:01 +0200
Subject: [PATCH] vhost: logging mistake enable, not disable log
Correctly pass log enable value from memory client to vhost device.
---
hw/vhost.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 7391bd1..019afc2 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -387,7 +387,7 @@ static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
dev->log_size = 0;
} else {
vhost_dev_log_resize(dev, vhost_get_log_size(dev));
- r = vhost_dev_set_log(dev, false);
+ r = vhost_dev_set_log(dev, true);
if (r < 0) {
return r;
}
--
1.6.6.1

View File

@ -1,38 +0,0 @@
From d42430f94c77a653da486e6f96f6695818f3e81b Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:10:04 +0200
Subject: [PATCH] vhost: fix log base
LOG_BASE ioctl gets a pointer to a 64 bit value, not
a pointer cast to 64 bit value.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vhost.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 019afc2..b63eafa 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -241,14 +241,15 @@ static uint64_t vhost_get_log_size(struct vhost_dev *dev)
static inline void vhost_dev_log_resize(struct vhost_dev* dev, uint64_t size)
{
vhost_log_chunk_t *log;
+ uint64_t log_base;
int r;
if (size) {
log = qemu_mallocz(size * sizeof *log);
} else {
log = NULL;
}
- r = ioctl(dev->control, VHOST_SET_LOG_BASE,
- (uint64_t)(unsigned long)log);
+ log_base = (uint64_t)(unsigned long)log;
+ r = ioctl(dev->control, VHOST_SET_LOG_BASE, &log_base);
assert(r >= 0);
vhost_client_sync_dirty_bitmap(&dev->client, 0,
(target_phys_addr_t)~0x0ull);
--
1.6.6.1

View File

@ -1,62 +0,0 @@
From 9aa404a57823c9fbf2bf2e0189d31a2b0d8bf3b9 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Thu, 25 Feb 2010 18:41:13 +0530
Subject: [PATCH] pc: Add a Fedora-13 machine type that contains backports from upstream
We have a few features backported from the upstream 0.13 machine type
in the repo here.
Add a 'fedora-13' machine type and use that by default so that users can
fall back to a released upstream machine type if desired.
The fedora-13 machine type has the new multiport-supported virtio-serial
and vhost-net patches as of now not present in the 0.12 machine type.
This is based on upstream commit
d76fa62dba54a156ca0f5e79eb33756c9015e02c
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/pc.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 56be728..26c65c1 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1327,11 +1327,9 @@ void cmos_set_s3_resume(void)
static QEMUMachine pc_machine = {
.name = "pc-0.12",
- .alias = "pc",
.desc = "Standard PC",
.init = pc_init_pci,
.max_cpus = 255,
- .is_default = 1,
};
static QEMUMachine pc_machine_v0_11 = {
@@ -1416,3 +1414,20 @@ static void pc_machine_init(void)
}
machine_init(pc_machine_init);
+
+/* Fedora machine types */
+static QEMUMachine pc_machine_f13 = {
+ .name = "fedora-13",
+ .alias = "pc",
+ .desc = "Standard PC",
+ .init = pc_init_pci,
+ .max_cpus = 255,
+ .is_default = 1,
+};
+
+static void fedora_machine_init(void)
+{
+ qemu_register_machine(&pc_machine_f13);
+}
+
+machine_init(fedora_machine_init);
--
1.6.6.1

View File

@ -1,72 +0,0 @@
From f32e21e2828cf7a8aba2fb27945dc46ca2debe09 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Thu, 25 Feb 2010 18:41:14 +0530
Subject: [PATCH] pc: Add backward compatibility options for virtio-serial
virtio-serial-pci can support multiple ports in the current F-13
version that will become upstream version 0.13. Add compatibility options
for the 0.12, 0.11 and 0.10 pc machine types.
Based on upstream commit 8bfbde6d35c82cc376681289dae2de5e18a087a4
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/pc.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 26c65c1..90bbfe8 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1330,6 +1330,18 @@ static QEMUMachine pc_machine = {
.desc = "Standard PC",
.init = pc_init_pci,
.max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ {
+ .driver = "virtio-serial-pci",
+ .property = "max_nr_ports",
+ .value = stringify(1),
+ },{
+ .driver = "virtio-serial-pci",
+ .property = "vectors",
+ .value = stringify(0),
+ },
+ { /* end of list */ }
+ }
};
static QEMUMachine pc_machine_v0_11 = {
@@ -1351,6 +1363,14 @@ static QEMUMachine pc_machine_v0_11 = {
.property = "ver",
.value = "0.11",
},{
+ .driver = "virtio-serial-pci",
+ .property = "max_nr_ports",
+ .value = stringify(1),
+ },{
+ .driver = "virtio-serial-pci",
+ .property = "vectors",
+ .value = stringify(0),
+ },{
.driver = "PCI",
.property = "rombar",
.value = stringify(0),
@@ -1374,6 +1394,14 @@ static QEMUMachine pc_machine_v0_10 = {
.property = "class",
.value = stringify(PCI_CLASS_DISPLAY_OTHER),
},{
+ .driver = "virtio-serial-pci",
+ .property = "max_nr_ports",
+ .value = stringify(1),
+ },{
+ .driver = "virtio-serial-pci",
+ .property = "vectors",
+ .value = stringify(0),
+ },{
.driver = "virtio-net-pci",
.property = "vectors",
.value = stringify(0),
--
1.6.6.1

View File

@ -1,39 +0,0 @@
From e3b132568eef8491decbe30639a9814bdd2d82c0 Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Thu, 25 Feb 2010 18:41:15 +0530
Subject: [PATCH] virtio-serial: don't set MULTIPORT for 1 port dev
Since commit 98b19252cf1bd97c54bc4613f3537c5ec0aae263, all
serial devices declare MULTIPORT feature.
To allow 0.12 compatibility, we should clear this when
max_nr_ports is 1.
Upsream commit: ee4d45be0d791eb8bb0f767cd0f17ea8f697281b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-serial-bus.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index ab456ea..d0e0219 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -335,8 +335,10 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq)
static uint32_t get_features(VirtIODevice *vdev, uint32_t features)
{
- features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT);
-
+ VirtIOSerial *vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
+ if (vser->bus->max_nr_ports > 1) {
+ features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT);
+ }
return features;
}
--
1.6.6.1

View File

@ -1,44 +0,0 @@
From 8a881734bccddf707a42ba2effff699b824d3c8f Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Thu, 25 Feb 2010 18:41:16 +0530
Subject: [PATCH] virtio-serial: pci: Allow MSI to be disabled
Michael noted we don't allow disabling of MSI for the virtio-serial-pci
device. Fix that.
Upstream commit: 7b665b668aa92bf0bba696f085dff87539d95529
Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-pci.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 9a02682..636c8c3 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -598,8 +598,8 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
if (!vdev) {
return -1;
}
- vdev->nvectors = proxy->nvectors ? proxy->nvectors
- : proxy->max_virtserial_ports + 1;
+ vdev->nvectors = proxy->nvectors == -1 ? proxy->max_virtserial_ports + 1
+ : proxy->nvectors;
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_CONSOLE,
@@ -683,7 +683,7 @@ static PCIDeviceInfo virtio_info[] = {
.init = virtio_serial_init_pci,
.exit = virtio_exit_pci,
.qdev.props = (Property[]) {
- DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 0),
+ DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, -1),
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
--
1.6.6.1

View File

@ -1,100 +0,0 @@
From a0591dc91ad795ffb47476b37730e46977a6be36 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 9 Mar 2010 23:58:50 +0100
Subject: [PATCH] migration: Clear fd also in error cases
Not clearing the fd and closing the file makes qemu spin using 100%CPU
after incoming migration error.
See for instance bug:
https://bugzilla.redhat.com/show_bug.cgi?id=518032
Signed-off-by: Juan Quintela <quintela@trasno.org>
---
migration-exec.c | 3 +--
migration-fd.c | 3 +--
migration-tcp.c | 5 ++---
migration-unix.c | 5 ++---
4 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/migration-exec.c b/migration-exec.c
index 87f645b..e57a55d 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -120,12 +120,11 @@ static void exec_accept_incoming_migration(void *opaque)
}
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the fd */
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
if (autostart)
vm_start();
err:
+ qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
qemu_fclose(f);
}
diff --git a/migration-fd.c b/migration-fd.c
index ef7edbc..7325d13 100644
--- a/migration-fd.c
+++ b/migration-fd.c
@@ -113,12 +113,11 @@ static void fd_accept_incoming_migration(void *opaque)
}
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the fd */
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
if (autostart)
vm_start();
err:
+ qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
qemu_fclose(f);
}
diff --git a/migration-tcp.c b/migration-tcp.c
index 2cfa8cb..c328e73 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -170,15 +170,14 @@ static void tcp_accept_incoming_migration(void *opaque)
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the server socket */
- qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
- close(s);
if (autostart)
vm_start();
out_fopen:
qemu_fclose(f);
out:
+ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
+ close(s);
close(c);
}
diff --git a/migration-unix.c b/migration-unix.c
index a141dbb..9685c4b 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -176,13 +176,12 @@ static void unix_accept_incoming_migration(void *opaque)
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the server socket */
- qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
- close(s);
out_fopen:
qemu_fclose(f);
out:
+ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
+ close(s);
close(c);
}
--
1.6.6.1

View File

@ -1,61 +0,0 @@
From 361f29d46ce4a310818e88adaef0912573847295 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Thu, 14 Jan 2010 16:19:40 +0000
Subject: [PATCH] raw-posix: Detect CDROM via ioctl on linux
Current CDROM detection is hardcoded based on source file name.
Make this smarter on linux by attempting a CDROM specific ioctl.
This makes '-cdrom /dev/sr0' succeed with no media present.
v2:
Give ioctl check higher priority than filename check.
v3:
Actually initialize 'prio' variable.
Check for ioctl success rather than absence of specific failure.
v4:
Explicitly mention that change is linux specific.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
block/raw-posix.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index c204cf9..1c777a1 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1142,9 +1142,25 @@ static int cdrom_open(BlockDriverState *bs, const char *filename, int flags)
static int cdrom_probe_device(const char *filename)
{
+ int fd, ret;
+ int prio = 0;
+
if (strstart(filename, "/dev/cd", NULL))
- return 100;
- return 0;
+ prio = 50;
+
+ fd = open(filename, O_RDONLY | O_NONBLOCK);
+ if (fd < 0) {
+ goto out;
+ }
+
+ /* Attempt to detect via a CDROM specific ioctl */
+ ret = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
+ if (ret >= 0)
+ prio = 100;
+
+ close(fd);
+out:
+ return prio;
}
static int cdrom_is_inserted(BlockDriverState *bs)
--
1.6.6.1

View File

@ -1,33 +0,0 @@
From afba60f63354fc6376e30dd51cadeda7170bcf4b Mon Sep 17 00:00:00 2001
From: Christian Krause <chkr@plauener.de>
Date: Sun, 24 Jan 2010 16:34:52 +0000
Subject: [PATCH] usb-linux: increase buffer for USB control requests
The WLAN USB stick ZyXEL NWD271N (0586:3417) uses very large
usb control transfers of more than 2048 bytes which won't fit
into the buffer of the ctrl_struct. This results in an error message
"husb: ctrl buffer too small" and a non-working device.
Increasing the buffer size to 8192 seems to be a safe choice.
Signed-off-by: Christian Krause <chkr@plauener.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
usb-linux.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 5619b30..e6cd432 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -113,7 +113,7 @@ struct ctrl_struct {
uint16_t offset;
uint8_t state;
struct usb_ctrlrequest req;
- uint8_t buffer[2048];
+ uint8_t buffer[8192];
};
struct USBAutoFilter {
--
1.6.6.1

View File

@ -1,936 +0,0 @@
From 8fe39316da28bdff610da708148f87b21e7ba045 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Tue, 6 Apr 2010 23:36:50 +0530
Subject: [PATCH] virtio-console patches
Hey Justin,
Attached are the kernel and qemu patches for the new abi. Rusty is ok
with the kernel patches and Juan and Gerd are ok with the userspace
ones.
The kernel one is big because of some code movement.
The qemu one is big because of code being moved and some fixes being
applied to make the host less vulnerable to malicious guests.
There's also a patch at
http://lkml.org/lkml/2010/4/6/110
that we should apply (affects the virt-console-fix-race.patch in the
repo).
Please let me know if you need any more information!
Thanks,
Amit
Content-Disposition: attachment; filename=",qemu-virtio-serial-rollup-2.patch"
---
Makefile.hw | 1 +
hw/iov.c | 70 ++++++++++
hw/iov.h | 19 +++
hw/virtio-balloon.c | 31 +----
hw/virtio-console.c | 11 +-
hw/virtio-net.c | 20 +---
hw/virtio-serial-bus.c | 332 ++++++++++++++++++++++++++++++++++++------------
hw/virtio-serial.h | 34 ++++--
8 files changed, 372 insertions(+), 146 deletions(-)
create mode 100644 hw/iov.c
create mode 100644 hw/iov.h
diff --git a/Makefile.hw b/Makefile.hw
index 43ca541..079c5d2 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -13,6 +13,7 @@ QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
obj-y =
obj-y += loader.o
+obj-y += iov.o
obj-y += virtio.o virtio-console.o
obj-y += fw_cfg.o
obj-y += watchdog.o
diff --git a/hw/iov.c b/hw/iov.c
new file mode 100644
index 0000000..588cd04
--- /dev/null
+++ b/hw/iov.c
@@ -0,0 +1,70 @@
+/*
+ * Helpers for getting linearized buffers from iov / filling buffers into iovs
+ *
+ * Copyright IBM, Corp. 2007, 2008
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * Author(s):
+ * Anthony Liguori <aliguori@us.ibm.com>
+ * Amit Shah <amit.shah@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "iov.h"
+
+size_t iov_from_buf(struct iovec *iov, unsigned int iovcnt,
+ const void *buf, size_t size)
+{
+ size_t offset;
+ unsigned int i;
+
+ offset = 0;
+ for (i = 0; offset < size && i < iovcnt; i++) {
+ size_t len;
+
+ len = MIN(iov[i].iov_len, size - offset);
+
+ memcpy(iov[i].iov_base, buf + offset, len);
+ offset += len;
+ }
+ return offset;
+}
+
+size_t iov_to_buf(const struct iovec *iov, const unsigned int iovcnt,
+ void *buf, size_t offset, size_t size)
+{
+ uint8_t *ptr;
+ size_t iov_off, buf_off;
+ unsigned int i;
+
+ ptr = buf;
+ iov_off = 0;
+ buf_off = 0;
+ for (i = 0; i < iovcnt && size; i++) {
+ if (offset < (iov_off + iov[i].iov_len)) {
+ size_t len = MIN((iov_off + iov[i].iov_len) - offset , size);
+
+ memcpy(ptr + buf_off, iov[i].iov_base + (offset - iov_off), len);
+
+ buf_off += len;
+ offset += len;
+ size -= len;
+ }
+ iov_off += iov[i].iov_len;
+ }
+ return buf_off;
+}
+
+size_t iov_size(const struct iovec *iov, const unsigned int iovcnt)
+{
+ size_t len;
+ unsigned int i;
+
+ len = 0;
+ for (i = 0; i < iovcnt; i++) {
+ len += iov[i].iov_len;
+ }
+ return len;
+}
diff --git a/hw/iov.h b/hw/iov.h
new file mode 100644
index 0000000..60a8547
--- /dev/null
+++ b/hw/iov.h
@@ -0,0 +1,19 @@
+/*
+ * Helpers for getting linearized buffers from iov / filling buffers into iovs
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * Author(s):
+ * Amit Shah <amit.shah@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "qemu-common.h"
+
+size_t iov_from_buf(struct iovec *iov, unsigned int iovcnt,
+ const void *buf, size_t size);
+size_t iov_to_buf(const struct iovec *iov, const unsigned int iovcnt,
+ void *buf, size_t offset, size_t size);
+size_t iov_size(const struct iovec *iov, const unsigned int iovcnt);
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index 242c6c8..10e2647 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -11,6 +11,7 @@
*
*/
+#include "iov.h"
#include "qemu-common.h"
#include "virtio.h"
#include "pc.h"
@@ -47,33 +48,6 @@ static void balloon_page(void *addr, int deflate)
#endif
}
-/* FIXME: once we do a virtio refactoring, this will get subsumed into common
- * code */
-static size_t memcpy_from_iovector(void *data, size_t offset, size_t size,
- struct iovec *iov, int iovlen)
-{
- int i;
- uint8_t *ptr = data;
- size_t iov_off = 0;
- size_t data_off = 0;
-
- for (i = 0; i < iovlen && size; i++) {
- if (offset < (iov_off + iov[i].iov_len)) {
- size_t len = MIN((iov_off + iov[i].iov_len) - offset , size);
-
- memcpy(ptr + data_off, iov[i].iov_base + (offset - iov_off), len);
-
- data_off += len;
- offset += len;
- size -= len;
- }
-
- iov_off += iov[i].iov_len;
- }
-
- return data_off;
-}
-
static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOBalloon *s = to_virtio_balloon(vdev);
@@ -83,8 +57,7 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
size_t offset = 0;
uint32_t pfn;
- while (memcpy_from_iovector(&pfn, offset, 4,
- elem.out_sg, elem.out_num) == 4) {
+ while (iov_to_buf(elem.out_sg, elem.out_num, &pfn, offset, 4) == 4) {
ram_addr_t pa;
ram_addr_t addr;
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index bd44ec6..caea11f 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -1,7 +1,7 @@
/*
* Virtio Console and Generic Serial Port Devices
*
- * Copyright Red Hat, Inc. 2009
+ * Copyright Red Hat, Inc. 2009, 2010
*
* Authors:
* Amit Shah <amit.shah@redhat.com>
@@ -20,14 +20,11 @@ typedef struct VirtConsole {
/* Callback function that's called when the guest sends us data */
-static size_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
+static void flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
{
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
- ssize_t ret;
- ret = qemu_chr_write(vcon->chr, buf, len);
-
- return ret < 0 ? 0 : ret;
+ qemu_chr_write(vcon->chr, buf, len);
}
/* Readiness of the guest to accept data on a port */
@@ -99,6 +96,7 @@ static VirtIOSerialPortInfo virtconsole_info = {
.exit = virtconsole_exitfn,
.qdev.props = (Property[]) {
DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1),
+ DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
DEFINE_PROP_STRING("name", VirtConsole, port.name),
DEFINE_PROP_END_OF_LIST(),
@@ -133,6 +131,7 @@ static VirtIOSerialPortInfo virtserialport_info = {
.init = virtserialport_initfn,
.exit = virtconsole_exitfn,
.qdev.props = (Property[]) {
+ DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
DEFINE_PROP_STRING("name", VirtConsole, port.name),
DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index f8e228f..320e99f 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -11,6 +11,7 @@
*
*/
+#include "iov.h"
#include "virtio.h"
#include "net.h"
#include "net/checksum.h"
@@ -436,21 +437,6 @@ static void work_around_broken_dhclient(struct virtio_net_hdr *hdr,
}
}
-static int iov_fill(struct iovec *iov, int iovcnt, const void *buf, int count)
-{
- int offset, i;
-
- offset = i = 0;
- while (offset < count && i < iovcnt) {
- int len = MIN(iov[i].iov_len, count - offset);
- memcpy(iov[i].iov_base, buf + offset, len);
- offset += len;
- i++;
- }
-
- return offset;
-}
-
static int receive_header(VirtIONet *n, struct iovec *iov, int iovcnt,
const void *buf, size_t size, size_t hdr_len)
{
@@ -586,8 +572,8 @@ static ssize_t virtio_net_receive(VLANClientState *nc, const uint8_t *buf, size_
}
/* copy in packet. ugh */
- len = iov_fill(sg, elem.in_num,
- buf + offset, size - offset);
+ len = iov_from_buf(sg, elem.in_num,
+ buf + offset, size - offset);
total += len;
/* signal other side */
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index d0e0219..6245f6e 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -1,7 +1,7 @@
/*
* A bus for connecting virtio serial and console ports
*
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009, 2010 Red Hat, Inc.
*
* Author(s):
* Amit Shah <amit.shah@redhat.com>
@@ -15,6 +15,7 @@
* the COPYING file in the top-level directory.
*/
+#include "iov.h"
#include "monitor.h"
#include "qemu-queue.h"
#include "sysbus.h"
@@ -41,6 +42,10 @@ struct VirtIOSerial {
VirtIOSerialBus *bus;
QTAILQ_HEAD(, VirtIOSerialPort) ports;
+
+ /* bitmap for identifying active ports */
+ uint32_t *ports_map;
+
struct virtio_console_config config;
};
@@ -48,6 +53,10 @@ static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id)
{
VirtIOSerialPort *port;
+ if (id == VIRTIO_CONSOLE_BAD_ID) {
+ return NULL;
+ }
+
QTAILQ_FOREACH(port, &vser->ports, next) {
if (port->id == id)
return port;
@@ -76,30 +85,25 @@ static size_t write_to_port(VirtIOSerialPort *port,
{
VirtQueueElement elem;
VirtQueue *vq;
- size_t offset = 0;
- size_t len = 0;
+ size_t offset;
vq = port->ivq;
if (!virtio_queue_ready(vq)) {
return 0;
}
- if (!size) {
- return 0;
- }
+ offset = 0;
while (offset < size) {
- int i;
+ size_t len;
if (!virtqueue_pop(vq, &elem)) {
break;
}
- for (i = 0; offset < size && i < elem.in_num; i++) {
- len = MIN(elem.in_sg[i].iov_len, size - offset);
+ len = iov_from_buf(elem.in_sg, elem.in_num,
+ buf + offset, size - offset);
+ offset += len;
- memcpy(elem.in_sg[i].iov_base, buf + offset, len);
- offset += len;
- }
virtqueue_push(vq, &elem, len);
}
@@ -107,6 +111,29 @@ static size_t write_to_port(VirtIOSerialPort *port,
return offset;
}
+static void flush_queued_data(VirtIOSerialPort *port, bool discard)
+{
+ VirtQueue *vq;
+ VirtQueueElement elem;
+
+ vq = port->ovq;
+ while (virtqueue_pop(vq, &elem)) {
+ uint8_t *buf;
+ size_t ret, buf_size;
+
+ if (!discard) {
+ buf_size = iov_size(elem.out_sg, elem.out_num);
+ buf = qemu_malloc(buf_size);
+ ret = iov_to_buf(elem.out_sg, elem.out_num, buf, 0, buf_size);
+
+ port->info->have_data(port, buf, ret);
+ qemu_free(buf);
+ }
+ virtqueue_push(vq, &elem, 0);
+ }
+ virtio_notify(&port->vser->vdev, vq);
+}
+
static size_t send_control_msg(VirtIOSerialPort *port, void *buf, size_t len)
{
VirtQueueElement elem;
@@ -158,6 +185,13 @@ int virtio_serial_open(VirtIOSerialPort *port)
int virtio_serial_close(VirtIOSerialPort *port)
{
port->host_connected = false;
+ /*
+ * If there's any data the guest sent which the app didn't
+ * consume, discard it and reset the throttling flag.
+ */
+ flush_queued_data(port, true);
+ port->throttled = false;
+
send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
return 0;
@@ -199,8 +233,23 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port)
return 0;
}
+void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle)
+{
+ if (!port) {
+ return;
+ }
+
+ if (throttle) {
+ port->throttled = true;
+ return;
+ }
+
+ port->throttled = false;
+ flush_queued_data(port, false);
+}
+
/* Guest wants to notify us of some event */
-static void handle_control_message(VirtIOSerial *vser, void *buf)
+static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
{
struct VirtIOSerialPort *port;
struct virtio_console_control cpkt, *gcpkt;
@@ -208,15 +257,41 @@ static void handle_control_message(VirtIOSerial *vser, void *buf)
size_t buffer_len;
gcpkt = buf;
- port = find_port_by_id(vser, ldl_p(&gcpkt->id));
- if (!port)
+
+ if (len < sizeof(cpkt)) {
+ /* The guest sent an invalid control packet */
return;
+ }
cpkt.event = lduw_p(&gcpkt->event);
cpkt.value = lduw_p(&gcpkt->value);
+ port = find_port_by_id(vser, ldl_p(&gcpkt->id));
+ if (!port && cpkt.event != VIRTIO_CONSOLE_DEVICE_READY)
+ return;
+
switch(cpkt.event) {
+ case VIRTIO_CONSOLE_DEVICE_READY:
+ if (!cpkt.value) {
+ qemu_error("virtio-serial-bus: Guest failure in adding device %s\n",
+ vser->bus->qbus.name);
+ break;
+ }
+ /*
+ * The device is up, we can now tell the device about all the
+ * ports we have here.
+ */
+ QTAILQ_FOREACH(port, &vser->ports, next) {
+ send_control_event(port, VIRTIO_CONSOLE_PORT_ADD, 1);
+ }
+ break;
+
case VIRTIO_CONSOLE_PORT_READY:
+ if (!cpkt.value) {
+ qemu_error("virtio-serial-bus: Guest failure in adding port %u for device %s\n",
+ port->id, vser->bus->qbus.name);
+ break;
+ }
/*
* Now that we know the guest asked for the port name, we're
* sure the guest has initialised whatever state is necessary
@@ -281,12 +356,35 @@ static void control_out(VirtIODevice *vdev, VirtQueue *vq)
{
VirtQueueElement elem;
VirtIOSerial *vser;
+ uint8_t *buf;
+ size_t len;
vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
+ len = 0;
+ buf = NULL;
while (virtqueue_pop(vq, &elem)) {
- handle_control_message(vser, elem.out_sg[0].iov_base);
- virtqueue_push(vq, &elem, elem.out_sg[0].iov_len);
+ size_t cur_len, copied;
+
+ cur_len = iov_size(elem.out_sg, elem.out_num);
+ /*
+ * Allocate a new buf only if we didn't have one previously or
+ * if the size of the buf differs
+ */
+ if (cur_len > len) {
+ if (len) {
+ qemu_free(buf);
+ }
+ buf = qemu_malloc(cur_len);
+ len = cur_len;
+ }
+ copied = iov_to_buf(elem.out_sg, elem.out_num, buf, 0, len);
+
+ handle_control_message(vser, buf, copied);
+ virtqueue_push(vq, &elem, 0);
+ }
+ if (len) {
+ qemu_free(buf);
}
virtio_notify(vdev, vq);
}
@@ -295,38 +393,22 @@ static void control_out(VirtIODevice *vdev, VirtQueue *vq)
static void handle_output(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOSerial *vser;
- VirtQueueElement elem;
+ VirtIOSerialPort *port;
+ bool discard;
vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
+ port = find_port_by_vq(vser, vq);
- while (virtqueue_pop(vq, &elem)) {
- VirtIOSerialPort *port;
- size_t ret;
-
- port = find_port_by_vq(vser, vq);
- if (!port) {
- ret = 0;
- goto next_buf;
- }
-
- /*
- * A port may not have any handler registered for consuming the
- * data that the guest sends or it may not have a chardev associated
- * with it. Just ignore the data in that case.
- */
- if (!port->info->have_data) {
- ret = 0;
- goto next_buf;
- }
-
- /* The guest always sends only one sg */
- ret = port->info->have_data(port, elem.out_sg[0].iov_base,
- elem.out_sg[0].iov_len);
+ discard = false;
+ if (!port || !port->host_connected || !port->info->have_data) {
+ discard = true;
+ }
- next_buf:
- virtqueue_push(vq, &elem, ret);
+ if (!discard && port->throttled) {
+ return;
}
- virtio_notify(vdev, vq);
+
+ flush_queued_data(port, discard);
}
static void handle_input(VirtIODevice *vdev, VirtQueue *vq)
@@ -335,7 +417,10 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq)
static uint32_t get_features(VirtIODevice *vdev, uint32_t features)
{
- VirtIOSerial *vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
+ VirtIOSerial *vser;
+
+ vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
+
if (vser->bus->max_nr_ports > 1) {
features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT);
}
@@ -370,14 +455,20 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
/* The config space */
qemu_put_be16s(f, &s->config.cols);
qemu_put_be16s(f, &s->config.rows);
- qemu_put_be32s(f, &s->config.nr_ports);
- /* Items in struct VirtIOSerial */
+ qemu_put_be32s(f, &s->config.max_nr_ports);
+
+ /* The ports map */
+
+ qemu_put_buffer(f, (uint8_t *)s->ports_map,
+ sizeof(uint32_t) * (s->config.max_nr_ports + 31) / 32);
+
+ /* Ports */
- /* Do this because we might have hot-unplugged some ports */
nr_active_ports = 0;
- QTAILQ_FOREACH(port, &s->ports, next)
+ QTAILQ_FOREACH(port, &s->ports, next) {
nr_active_ports++;
+ }
qemu_put_be32s(f, &nr_active_ports);
@@ -385,13 +476,9 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
* Items in struct VirtIOSerialPort.
*/
QTAILQ_FOREACH(port, &s->ports, next) {
- /*
- * We put the port number because we may not have an active
- * port at id 0 that's reserved for a console port, or in case
- * of ports that might have gotten unplugged
- */
qemu_put_be32s(f, &port->id);
qemu_put_byte(f, port->guest_connected);
+ qemu_put_byte(f, port->host_connected);
}
}
@@ -399,7 +486,8 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOSerial *s = opaque;
VirtIOSerialPort *port;
- uint32_t nr_active_ports;
+ size_t ports_map_size;
+ uint32_t max_nr_ports, nr_active_ports, *ports_map;
unsigned int i;
if (version_id > 2) {
@@ -416,22 +504,50 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
/* The config space */
qemu_get_be16s(f, &s->config.cols);
qemu_get_be16s(f, &s->config.rows);
- s->config.nr_ports = qemu_get_be32(f);
- /* Items in struct VirtIOSerial */
+ qemu_get_be32s(f, &max_nr_ports);
+ if (max_nr_ports > s->config.max_nr_ports) {
+ /* Source could have had more ports than us. Fail migration. */
+ return -EINVAL;
+ }
+
+ ports_map_size = sizeof(uint32_t) * (max_nr_ports + 31) / 32;
+ ports_map = qemu_malloc(ports_map_size);
+ qemu_get_buffer(f, (uint8_t *)ports_map, ports_map_size);
+
+ for (i = 0; i < (max_nr_ports + 31) / 32; i++) {
+ if (ports_map[i] != s->ports_map[i]) {
+ /*
+ * Ports active on source and destination don't
+ * match. Fail migration.
+ */
+ qemu_free(ports_map);
+ return -EINVAL;
+ }
+ }
+ qemu_free(ports_map);
qemu_get_be32s(f, &nr_active_ports);
/* Items in struct VirtIOSerialPort */
for (i = 0; i < nr_active_ports; i++) {
uint32_t id;
+ bool host_connected;
id = qemu_get_be32(f);
port = find_port_by_id(s, id);
port->guest_connected = qemu_get_byte(f);
+ host_connected = qemu_get_byte(f);
+ if (host_connected != port->host_connected) {
+ /*
+ * We have to let the guest know of the host connection
+ * status change
+ */
+ send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
+ port->host_connected);
+ }
}
-
return 0;
}
@@ -466,6 +582,54 @@ static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
indent, "", port->host_connected);
}
+/* This function is only used if a port id is not provided by the user */
+static uint32_t find_free_port_id(VirtIOSerial *vser)
+{
+ unsigned int i;
+
+ for (i = 0; i < (vser->config.max_nr_ports + 31) / 32; i++) {
+ uint32_t map, bit;
+
+ map = vser->ports_map[i];
+ bit = ffs(~map);
+ if (bit) {
+ return (bit - 1) + i * 32;
+ }
+ }
+ return VIRTIO_CONSOLE_BAD_ID;
+}
+
+static void mark_port_added(VirtIOSerial *vser, uint32_t port_id)
+{
+ unsigned int i;
+
+ i = port_id / 32;
+ vser->ports_map[i] |= 1U << (port_id % 32);
+}
+
+static void add_port(VirtIOSerial *vser, uint32_t port_id)
+{
+ mark_port_added(vser, port_id);
+
+ send_control_event(find_port_by_id(vser, port_id),
+ VIRTIO_CONSOLE_PORT_ADD, 1);
+}
+
+static void remove_port(VirtIOSerial *vser, uint32_t port_id)
+{
+ VirtIOSerialPort *port;
+ unsigned int i;
+
+ i = port_id / 32;
+ vser->ports_map[i] &= ~(1U << (port_id % 32));
+
+ port = find_port_by_id(vser, port_id);
+ /* Flush out any unconsumed buffers first */
+ flush_queued_data(port, true);
+
+ send_control_event(port, VIRTIO_CONSOLE_PORT_REMOVE, 1);
+}
+
static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
{
VirtIOSerialDevice *dev = DO_UPCAST(VirtIOSerialDevice, qdev, qdev);
@@ -484,19 +648,36 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
*/
plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0);
- if (port->vser->config.nr_ports == bus->max_nr_ports && !plugging_port0) {
- qemu_error("virtio-serial-bus: Maximum device limit reached\n");
+ if (find_port_by_id(port->vser, port->id)) {
+ qemu_error("virtio-serial-bus: A port already exists at id %u\n",
+ port->id);
return -1;
}
- dev->info = info;
+ if (port->id == VIRTIO_CONSOLE_BAD_ID) {
+ if (plugging_port0) {
+ port->id = 0;
+ } else {
+ port->id = find_free_port_id(port->vser);
+ if (port->id == VIRTIO_CONSOLE_BAD_ID) {
+ qemu_error("virtio-serial-bus: Maximum port limit for this device reached\n");
+ return -1;
+ }
+ }
+ }
+
+ if (port->id >= port->vser->config.max_nr_ports) {
+ qemu_error("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n",
+ port->vser->config.max_nr_ports - 1);
+ return -1;
+ }
+
+ dev->info = info;
ret = info->init(dev);
if (ret) {
return ret;
}
- port->id = plugging_port0 ? 0 : port->vser->config.nr_ports++;
-
if (!use_multiport(port->vser)) {
/*
* Allow writes to guest in this case; we have no way of
@@ -509,6 +690,8 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
port->ivq = port->vser->ivqs[port->id];
port->ovq = port->vser->ovqs[port->id];
+ add_port(port->vser, port->id);
+
/* Send an update to the guest about this new port added */
virtio_notify_config(&port->vser->vdev);
@@ -521,26 +704,8 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
VirtIOSerial *vser = port->vser;
- send_control_event(port, VIRTIO_CONSOLE_PORT_REMOVE, 1);
+ remove_port(port->vser, port->id);
- /*
- * Don't decrement nr_ports here; thus we keep a linearly
- * increasing port id. Not utilising an id again saves us a couple
- * of complications:
- *
- * - Not having to bother about sending the port id to the guest
- * kernel on hotplug or on addition of new ports; the guest can
- * also linearly increment the port number. This is preferable
- * because the config space won't have the need to store a
- * ports_map.
- *
- * - Extra state to be stored for all the "holes" that got created
- * so that we keep filling in the ids from the least available
- * index.
- *
- * When such a functionality is desired, a control message to add
- * a port can be introduced.
- */
QTAILQ_REMOVE(&vser->ports, port, next);
if (port->info->exit)
@@ -600,11 +765,12 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports)
}
vser->config.max_nr_ports = max_nr_ports;
+ vser->ports_map = qemu_mallocz((max_nr_ports + 31) / 32);
/*
* Reserve location 0 for a console port for backward compat
* (old kernel, new qemu)
*/
- vser->config.nr_ports = 1;
+ mark_port_added(vser, 0);
vser->vdev.get_features = get_features;
vser->vdev.get_config = get_config;
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index f297b00..a93b545 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -2,7 +2,7 @@
* Virtio Serial / Console Support
*
* Copyright IBM, Corp. 2008
- * Copyright Red Hat, Inc. 2009
+ * Copyright Red Hat, Inc. 2009, 2010
*
* Authors:
* Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
@@ -27,6 +27,8 @@
/* Features supported */
#define VIRTIO_CONSOLE_F_MULTIPORT 1
+#define VIRTIO_CONSOLE_BAD_ID (~(uint32_t)0)
+
struct virtio_console_config {
/*
* These two fields are used by VIRTIO_CONSOLE_F_SIZE which
@@ -36,7 +38,6 @@ struct virtio_console_config {
uint16_t rows;
uint32_t max_nr_ports;
- uint32_t nr_ports;
} __attribute__((packed));
struct virtio_console_control {
@@ -46,12 +47,14 @@ struct virtio_console_control {
};
/* Some events for the internal messages (control packets) */
-#define VIRTIO_CONSOLE_PORT_READY 0
-#define VIRTIO_CONSOLE_CONSOLE_PORT 1
-#define VIRTIO_CONSOLE_RESIZE 2
-#define VIRTIO_CONSOLE_PORT_OPEN 3
-#define VIRTIO_CONSOLE_PORT_NAME 4
-#define VIRTIO_CONSOLE_PORT_REMOVE 5
+#define VIRTIO_CONSOLE_DEVICE_READY 0
+#define VIRTIO_CONSOLE_PORT_ADD 1
+#define VIRTIO_CONSOLE_PORT_REMOVE 2
+#define VIRTIO_CONSOLE_PORT_READY 3
+#define VIRTIO_CONSOLE_CONSOLE_PORT 4
+#define VIRTIO_CONSOLE_RESIZE 5
+#define VIRTIO_CONSOLE_PORT_OPEN 6
+#define VIRTIO_CONSOLE_PORT_NAME 7
/* == In-qemu interface == */
@@ -107,6 +110,8 @@ struct VirtIOSerialPort {
bool guest_connected;
/* Is this device open for IO on the host? */
bool host_connected;
+ /* Do apps not want to receive data? */
+ bool throttled;
};
struct VirtIOSerialPortInfo {
@@ -133,10 +138,10 @@ struct VirtIOSerialPortInfo {
/*
* Guest wrote some data to the port. This data is handed over to
- * the app via this callback. The app should return the number of
- * bytes it successfully consumed.
+ * the app via this callback. The app is supposed to consume all
+ * the data that is presented to it.
*/
- size_t (*have_data)(VirtIOSerialPort *port, const uint8_t *buf, size_t len);
+ void (*have_data)(VirtIOSerialPort *port, const uint8_t *buf, size_t len);
};
/* Interface to the virtio-serial bus */
@@ -170,4 +175,11 @@ ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf,
*/
size_t virtio_serial_guest_ready(VirtIOSerialPort *port);
+/*
+ * Flow control: Ports can signal to the virtio-serial core to stop
+ * sending data or re-start sending data, depending on the 'throttle'
+ * value here.
+ */
+void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle);
+
#endif
--
1.6.6.1

View File

@ -1,43 +0,0 @@
From 30397a024f57f14800975bbb4312be54cc75202b Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Tue, 6 Apr 2010 19:38:51 -0300
Subject: [PATCH] net: remove NICInfo.bootable field
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
It is just set by net_set_boot_mask() and never used. The logic for rom loading
changed a lot since this field was introduced. It is not needed anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
net.c | 1 -
net.h | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net.c b/net.c
index de7d626..5cebb1a 100644
--- a/net.c
+++ b/net.c
@@ -1204,7 +1204,6 @@ void net_set_boot_mask(int net_boot_mask)
for (i = 0; i < nb_nics; i++) {
if (net_boot_mask & (1 << i)) {
- nd_table[i].bootable = 1;
net_boot_mask &= ~(1 << i);
}
}
diff --git a/net.h b/net.h
index 33a1eaf..5b6e814 100644
--- a/net.h
+++ b/net.h
@@ -135,7 +135,6 @@ struct NICInfo {
VLANState *vlan;
VLANClientState *netdev;
int used;
- int bootable;
int nvectors;
};
--
1.6.6.1

View File

@ -1,100 +0,0 @@
From 905a4bcaf9d4ed3662b901a2820b6e6ca80dc285 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Tue, 6 Apr 2010 19:38:52 -0300
Subject: [PATCH] net: remove broken net_set_boot_mask() boot device validation
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
There are many problems with net_set_boot_mask():
1) It is broken when using the device model instead of "-net nic". Example:
$ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n
Cannot boot from non-existent NIC
$
2) The mask was previously used to set which boot ROMs were supposed to be
loaded, but this was changed long time ago. Now all ROM images are loaded,
and SeaBIOS takes care of jumping to the right boot entry point depending on
the boot settings.
3) Interpretation and validation of the boot parameter letters is done on
the machine type code. Examples: PC accepts only a,b,c,d,n as valid boot
device letters. mac99 accepts only a,b,c,d,e,f.
As a side-effect of this change, qemu-kvm won't abort anymore if using "-boot n"
on a machine with no network devices. Checking if the requested boot device is
valid is now a task for the BIOS or the machine-type code.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
net.c | 19 -------------------
net.h | 1 -
vl.c | 5 +----
3 files changed, 1 insertions(+), 24 deletions(-)
diff --git a/net.c b/net.c
index 5cebb1a..71c0f08 100644
--- a/net.c
+++ b/net.c
@@ -1195,25 +1195,6 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
qemu_del_vlan_client(vc);
}
-void net_set_boot_mask(int net_boot_mask)
-{
- int i;
-
- /* Only the first four NICs may be bootable */
- net_boot_mask = net_boot_mask & 0xF;
-
- for (i = 0; i < nb_nics; i++) {
- if (net_boot_mask & (1 << i)) {
- net_boot_mask &= ~(1 << i);
- }
- }
-
- if (net_boot_mask) {
- fprintf(stderr, "Cannot boot from non-existent NIC\n");
- exit(1);
- }
-}
-
void do_info_network(Monitor *mon)
{
VLANState *vlan;
diff --git a/net.h b/net.h
index 5b6e814..2b2ee4c 100644
--- a/net.h
+++ b/net.h
@@ -165,7 +165,6 @@ int net_client_parse(QemuOptsList *opts_list, const char *str);
int net_init_clients(void);
void net_check_clients(void);
void net_cleanup(void);
-void net_set_boot_mask(int boot_mask);
void net_host_device_add(Monitor *mon, const QDict *qdict);
void net_host_device_remove(Monitor *mon, const QDict *qdict);
diff --git a/vl.c b/vl.c
index c75f891..349f945 100644
--- a/vl.c
+++ b/vl.c
@@ -4922,7 +4922,7 @@ int main(int argc, char **argv, char **envp)
const char *gdbstub_dev = NULL;
uint32_t boot_devices_bitmap = 0;
int i;
- int snapshot, linux_boot, net_boot;
+ int snapshot, linux_boot;
const char *initrd_filename;
const char *kernel_filename, *kernel_cmdline;
char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
@@ -5961,9 +5961,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
- net_set_boot_mask(net_boot);
-
/* init the bluetooth world */
if (foreach_device_config(DEV_BT, bt_parse))
exit(1);
--
1.6.6.1

View File

@ -1,63 +0,0 @@
From dfbaa3059414b158ff7ce7a74ffff80b0fa2db9c Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Tue, 6 Apr 2010 19:38:53 -0300
Subject: [PATCH] boot: remove unused boot_devices_bitmap variable
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
In addition to removing the variable, this also renames the parse_bootdevices()
function to validate_bootdevices(), as we don't need its return value anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
vl.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index 349f945..a71127c 100644
--- a/vl.c
+++ b/vl.c
@@ -2517,7 +2517,7 @@ int qemu_boot_set(const char *boot_devices)
return boot_set_handler(boot_set_opaque, boot_devices);
}
-static int parse_bootdevices(char *devices)
+static void validate_bootdevices(char *devices)
{
/* We just do some generic consistency checks */
const char *p;
@@ -2543,7 +2543,6 @@ static int parse_bootdevices(char *devices)
}
bitmap |= 1 << (*p - 'a');
}
- return bitmap;
}
static void restore_boot_devices(void *opaque)
@@ -4920,7 +4919,6 @@ static int virtcon_parse(const char *devname)
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
- uint32_t boot_devices_bitmap = 0;
int i;
int snapshot, linux_boot;
const char *initrd_filename;
@@ -5215,13 +5213,13 @@ int main(int argc, char **argv, char **envp)
if (legacy ||
get_param_value(buf, sizeof(buf), "order", optarg)) {
- boot_devices_bitmap = parse_bootdevices(buf);
+ validate_bootdevices(buf);
pstrcpy(boot_devices, sizeof(boot_devices), buf);
}
if (!legacy) {
if (get_param_value(buf, sizeof(buf),
"once", optarg)) {
- boot_devices_bitmap |= parse_bootdevices(buf);
+ validate_bootdevices(buf);
standard_boot_devices = qemu_strdup(boot_devices);
pstrcpy(boot_devices, sizeof(boot_devices), buf);
qemu_register_reset(restore_boot_devices,
--
1.6.6.1

View File

@ -1 +0,0 @@
KERNEL=="kvm", GROUP="kvm", MODE="0666"

12
95-kvm-ppc64-memlock.conf Normal file
View File

@ -0,0 +1,12 @@
# The KVM HV implementation on Power can require a significant amount
# of unswappable memory (about half of which also needs to be host
# physically contiguous) to hold the guest's Hash Page Table (HPT) -
# roughly 1/64th of the guest's RAM size, minimum 16MiB.
#
# These limits allow unprivileged users to start smallish VMs, such as
# those used by libguestfs.
#
# https://bugzilla.redhat.com/show_bug.cgi?id=1293024
#
* hard memlock 65536
* soft memlock 65536

View File

@ -0,0 +1,2 @@
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \
TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"

View File

@ -1,21 +0,0 @@
# Makefile for source rpm: qemu
# $Id$
NAME := qemu
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,34 +0,0 @@
commit d35b261c7a94be9e2fcad5484343544d58ff99be
Author: Richard Henderson <rth@twiddle.net>
Date: Fri Jun 4 12:14:10 2010 -0700
s390x: Avoid _llseek.
There's no _llseek on s390x either. Replace the existing
test for __x86_64__ with a functional test for __NR_llseek.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8222cb9..e94f1ee 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -208,7 +208,7 @@ _syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count)
_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
#endif
_syscall2(int, sys_getpriority, int, which, int, who);
-#if defined(TARGET_NR__llseek) && !defined (__x86_64__)
+#if defined(TARGET_NR__llseek) && defined(__NR_llseek)
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
loff_t *, res, uint, wh);
#endif
@@ -5933,7 +5933,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#ifdef TARGET_NR__llseek /* Not on alpha */
case TARGET_NR__llseek:
{
-#if defined (__x86_64__)
+#if !defined(__NR_llseek)
ret = get_errno(lseek(arg1, ((uint64_t )arg2 << 32) | arg3, arg5));
if (put_user_s64(ret, arg4))
goto efault;

View File

@ -1,63 +0,0 @@
From e69a45b96be09d25429175fa8f0f85e3d7fab5a8 Mon Sep 17 00:00:00 2001
Message-Id: <e69a45b96be09d25429175fa8f0f85e3d7fab5a8.1277191832.git.amit.shah@redhat.com>
From: Kirill A. Shutemov <kirill@shutemov.name>
Date: Wed, 20 Jan 2010 00:56:14 +0100
Subject: [PATCH] block/vvfat.c: fix warnings with _FORTIFY_SOURCE
CC block/vvfat.o
cc1: warnings being treated as errors
block/vvfat.c: In function 'commit_one_file':
block/vvfat.c:2259: error: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
make: *** [block/vvfat.o] Error 1
CC block/vvfat.o
In file included from /usr/include/stdio.h:912,
from ./qemu-common.h:19,
from block/vvfat.c:27:
In function 'snprintf',
inlined from 'init_directories' at block/vvfat.c:871,
inlined from 'vvfat_open' at block/vvfat.c:1068:
/usr/include/bits/stdio2.h:65: error: call to __builtin___snprintf_chk will always overflow destination buffer
make: *** [block/vvfat.o] Error 1
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2dedf83ef0cc3463783d6b71bf1b25476f691f3a)
This fixes Fedora bug 605202.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
block/vvfat.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index c1acb35..592d6e6 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -868,7 +868,8 @@ static int init_directories(BDRVVVFATState* s,
{
direntry_t* entry=array_get_next(&(s->directory));
entry->attributes=0x28; /* archive | volume label */
- snprintf((char*)entry->name,11,"QEMU VVFAT");
+ memcpy(entry->name,"QEMU VVF",8);
+ memcpy(entry->extension,"AT ",3);
}
/* Now build FAT, and write back information into directory */
@@ -2256,7 +2257,11 @@ static int commit_one_file(BDRVVVFATState* s,
c = c1;
}
- ftruncate(fd, size);
+ if (ftruncate(fd, size)) {
+ perror("ftruncate()");
+ close(fd);
+ return -4;
+ }
close(fd);
return commit_mappings(s, first_cluster, dir_index);
--
1.7.0.1

1
bridge.conf Normal file
View File

@ -0,0 +1 @@
allow virbr0

View File

@ -1,96 +0,0 @@
#!/bin/bash
#
# ksm Kernel Samepage Merging
#
# Author: Dan Kenigsberg <danken@redhat.com>
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# chkconfig: 345 84 16
# description: The KSM init script starts and stops the ksm kernel thread.
# config: /etc/sysconfig/ksm
#
### BEGIN INIT INFO
# Provides: ksm
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 3 4 5
# Short-Description: start and stop ksm
# Description: The KSM init script starts and stops the ksm kernel thread.
### END INIT INFO
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/ksm ]; then
. /etc/sysconfig/ksm
fi
prog=ksm
RETVAL=0
# unless KSM_MAX_KERNEL_PAGES is set, let ksm munch up to half of total memory.
default_max_kernel_pages () {
local total pagesize
total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
pagesize=`getconf PAGESIZE`
echo $[total * 1024 / pagesize / 2]
}
start() {
echo -n $"Starting $prog: "
if [ -f /sys/kernel/mm/ksm/max_kernel_pages ]; then
KSM_MAX_KERNEL_PAGES=${KSM_MAX_KERNEL_PAGES:-`default_max_kernel_pages`}
echo $KSM_MAX_KERNEL_PAGES > /sys/kernel/mm/ksm/max_kernel_pages
fi
echo 1 > /sys/kernel/mm/ksm/run
RETVAL=$?
[ $RETVAL = 0 ] && success $"$prog startup" || failure $"$prog startup"
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
echo 0 > /sys/kernel/mm/ksm/run
RETVAL=$?
[ $RETVAL = 0 ] && success $"$prog shutdown" || failure $"$prog shutdown"
echo
}
status() {
if [ ! -f /sys/kernel/mm/ksm/run ] ; then
echo $"$prog not supported"
RETVAL=1
else if [ "$(cat /sys/kernel/mm/ksm/run 2>/dev/null)" != "1" ]; then
echo $"$prog is not running"
RETVAL=1
else
echo $"$prog is running"
RETVAL=0
fi; fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
condrestart)
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
RETVAL=3
esac
exit $RETVAL

View File

@ -1,4 +0,0 @@
# The maximum number of unswappable kernel pages
# which may be allocated by ksm (0 for unlimited)
# If unset, defaults to half of total memory
# KSM_MAX_KERNEL_PAGES=

137
ksmtuned
View File

@ -1,137 +0,0 @@
#!/bin/bash
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# Author: Dan Kenigsberg <danken@redhat.com>
#
# ksmtuned - a simple script that controls whether (and with what vigor) ksm
# should search for duplicated pages.
#
# starts ksm when memory commited to qemu processes exceeds a threshold, and
# make ksm work harder and harder untill memory load falls below that
# threshold.
#
# send SIGUSR1 to this process right after a new qemu process is started, or
# following its death, to retune ksm accordingly
#
# needs testing and ironing. contact danken@redhat.com if something breaks.
if [ -f /etc/ksmtuned.conf ]; then
. /etc/ksmtuned.conf
fi
debug() {
if [ -n "$DEBUG" ]; then
s="`/bin/date`: $*"
[ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s"
fi
}
KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60}
KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300}
KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50}
KSM_NPAGES_MIN=${KSM_NPAGES_MIN:-64}
KSM_NPAGES_MAX=${KSM_NPAGES_MAX:-1250}
# millisecond sleep between ksm scans for 16Gb server. Smaller servers sleep
# more, bigger sleep less.
KSM_SLEEP_MSEC=${KSM_SLEEP_MSEC:-10}
KSM_THRES_COEF=${KSM_THRES_COEF:-20}
KSM_THRES_CONST=${KSM_THRES_CONST:-2048}
total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
debug total $total
npages=0
sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total]
[ $sleep -le 10 ] && sleep=10
debug sleep $sleep
thres=$[total * KSM_THRES_COEF / 100]
if [ $KSM_THRES_CONST -gt $thres ]; then
thres=$KSM_THRES_CONST
fi
debug thres $thres
KSMCTL () {
case x$1 in
xstop)
echo 0 > /sys/kernel/mm/ksm/run
;;
xstart)
echo $2 > /sys/kernel/mm/ksm/pages_to_scan
echo $3 > /sys/kernel/mm/ksm/sleep_millisecs
echo 1 > /sys/kernel/mm/ksm/run
;;
esac
}
committed_memory () {
# calculate how much memory is committed to running qemu processes
local progname
progname=${1:-qemu}
ps -o vsz `pgrep $progname` | awk '{ sum += $1 }; END { print sum }'
}
free_memory () {
awk '/^(MemFree|Buffers|MemCached):/ {free += $2}; END {print free}' \
/proc/meminfo
}
increase_npages() {
local delta
delta=${1:-0}
npages=$[npages + delta]
if [ $npages -lt $KSM_NPAGES_MIN ]; then
npages=$KSM_NPAGES_MIN
elif [ $npages -gt $KSM_NPAGES_MAX ]; then
npages=$KSM_NPAGES_MAX
fi
echo $npages
}
adjust () {
local free committed
free=`free_memory`
committed=`committed_memory`
debug committed $committed free $free
if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then
KSMCTL stop
debug "$[committed + thres] < $total and free > $thres, stop ksm"
return 1
fi
debug "$[committed + thres] > $total, start ksm"
if [ $free -lt $thres ]; then
npages=`increase_npages $KSM_NPAGES_BOOST`
debug "$free < $thres, boost"
else
npages=`increase_npages $KSM_NPAGES_DECAY`
debug "$free > $thres, decay"
fi
KSMCTL start $npages $sleep
debug "KSMCTL start $npages $sleep"
return 0
}
function nothing () {
:
}
loop () {
trap nothing SIGUSR1
while true
do
sleep $KSM_MONITOR_INTERVAL &
wait $!
adjust
done
}
PIDFILE=${PIDFILE-/var/run/ksmtune.pid}
if touch "$PIDFILE"; then
loop &
echo $! > "$PIDFILE"
fi

View File

@ -1,21 +0,0 @@
# Configuration file for ksmtuned.
# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60
# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10
# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX=1250
# KSM_THRES_COEF=20
# KSM_THRES_CONST=2048
# uncomment the following if you want ksmtuned debug info
# LOGFILE=/var/log/ksmtuned
# DEBUG=1

View File

@ -1,88 +0,0 @@
#!/bin/bash
#
# ksmtuned Kernel Samepage Merging (KSM) Tuning Daemon
#
# Author: Dan Kenigsberg <danken@redhat.com>
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# chkconfig: 345 85 15
# description: The KSM tuning daemon controls whether (and with what vigor) \
# ksm should ksm search duplicated pages.
# processname: ksmtuned
# config: /etc/ksmtuned.conf
# pidfile: /var/run/ksmtuned.pid
#
### BEGIN INIT INFO
# Provides: ksmtuned
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 3 4 5
# Short-Description: tune the speed of ksm
# Description: The Kernel Samepage Merging control Daemon is a simple script
# that controls whether (and with what vigor) should ksm search duplicated
# memory pages.
# needs testing and ironing. contact danken@redhat.com if something breaks.
### END INIT INFO
. /etc/rc.d/init.d/functions
prog=ksmtuned
ksmtuned=/usr/sbin/ksmtuned
pidfile=${PIDFILE-/var/run/ksmtune.pid}
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} $ksmtuned
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
restart() {
stop
start
}
condrestart() {
[ -e /var/lock/subsys/$prog ] && restart || :
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $prog
RETVAL=$?
;;
restart)
restart
;;
condrestart)
condrestart
;;
retune)
kill -SIGUSR1 `cat ${pidfile}`
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status|retune|help}"
RETVAL=3
esac
exit $RETVAL

11
kvm-x86.modprobe.conf Normal file
View File

@ -0,0 +1,11 @@
###
### This configuration file was provided by the qemu package.
### Feel free to update as needed.
###
###
### Set these options to enable nested virtualization
###
#options kvm_intel nested=1
#options kvm_amd nested=1

View File

@ -1,9 +0,0 @@
#!/bin/sh
if [ $(grep -c vmx /proc/cpuinfo) -ne 0 ]; then
modprobe -b kvm-intel >/dev/null 2>&1
fi
if [ $(grep -c svm /proc/cpuinfo) -ne 0 ]; then
modprobe -b kvm-amd >/dev/null 2>&1
fi

View File

@ -1,44 +0,0 @@
From 12a074387284fc530876ef709b3d344adea9b226 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:57 +0530
Subject: [PATCH 7/9] Move virtio-serial to Makefile.objs
There's nothing target-dependent in the virtio-serial code so allow it
to be compiled just once for all the targets.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
Makefile.hw | 2 +-
Makefile.target | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.hw b/Makefile.hw
index 6f4dbc4..de8a0c5 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -13,7 +13,7 @@ QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
obj-y =
obj-y += loader.o
-obj-y += virtio.o
+obj-y += virtio.o virtio-serial.o
obj-y += fw_cfg.o
obj-y += watchdog.o
obj-$(CONFIG_ECC) += ecc.o
diff --git a/Makefile.target b/Makefile.target
index 234577c..0e4cfd1 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -166,7 +166,7 @@ ifdef CONFIG_SOFTMMU
obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o
# virtio has to be here due to weird dependency between PCI and virtio-net.
# need to fix this properly
-obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial.o virtio-serial-bus.o virtio-pci.o
+obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
obj-$(CONFIG_KVM) += kvm.o kvm-all.o
# MSI-X depends on kvm for interrupt injection,
# so moved it from Makefile.hw to Makefile.target for now
--
1.6.2.5

View File

@ -1,199 +0,0 @@
This adds notifiers for phys memory changes: a set of callbacks that
vhost can register and update kernel accordingly. Down the road, kvm
code can be switched to use these as well, instead of calling kvm code
directly from exec.c as is done now.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
cpu-common.h | 19 ++++++++++
exec.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 130 insertions(+), 3 deletions(-)
diff --git a/cpu-common.h b/cpu-common.h
index 5e59564..326513d 100644
--- a/cpu-common.h
+++ b/cpu-common.h
@@ -8,6 +8,7 @@
#endif
#include "bswap.h"
+#include "qemu-queue.h"
/* address in the RAM (different from a physical address) */
typedef unsigned long ram_addr_t;
@@ -62,6 +63,24 @@ void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len,
void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque));
void cpu_unregister_map_client(void *cookie);
+struct CPUPhysMemoryClient;
+typedef struct CPUPhysMemoryClient CPUPhysMemoryClient;
+struct CPUPhysMemoryClient {
+ void (*set_memory)(struct CPUPhysMemoryClient *client,
+ target_phys_addr_t start_addr,
+ ram_addr_t size,
+ ram_addr_t phys_offset);
+ int (*sync_dirty_bitmap)(struct CPUPhysMemoryClient *client,
+ target_phys_addr_t start_addr,
+ target_phys_addr_t end_addr);
+ int (*migration_log)(struct CPUPhysMemoryClient *client,
+ int enable);
+ QLIST_ENTRY(CPUPhysMemoryClient) list;
+};
+
+void cpu_register_phys_memory_client(CPUPhysMemoryClient *);
+void cpu_unregister_phys_memory_client(CPUPhysMemoryClient *);
+
uint32_t ldub_phys(target_phys_addr_t addr);
uint32_t lduw_phys(target_phys_addr_t addr);
uint32_t ldl_phys(target_phys_addr_t addr);
diff --git a/exec.c b/exec.c
index 8f873ab..cbba15e 100644
--- a/exec.c
+++ b/exec.c
@@ -1640,6 +1640,101 @@ const CPULogItem cpu_log_items[] = {
{ 0, NULL, NULL },
};
+#ifndef CONFIG_USER_ONLY
+static QLIST_HEAD(memory_client_list, CPUPhysMemoryClient) memory_client_list
+ = QLIST_HEAD_INITIALIZER(memory_client_list);
+
+static void cpu_notify_set_memory(target_phys_addr_t start_addr,
+ ram_addr_t size,
+ ram_addr_t phys_offset)
+{
+ CPUPhysMemoryClient *client;
+ QLIST_FOREACH(client, &memory_client_list, list) {
+ client->set_memory(client, start_addr, size, phys_offset);
+ }
+}
+
+static int cpu_notify_sync_dirty_bitmap(target_phys_addr_t start,
+ target_phys_addr_t end)
+{
+ CPUPhysMemoryClient *client;
+ QLIST_FOREACH(client, &memory_client_list, list) {
+ int r = client->sync_dirty_bitmap(client, start, end);
+ if (r < 0)
+ return r;
+ }
+ return 0;
+}
+
+static int cpu_notify_migration_log(int enable)
+{
+ CPUPhysMemoryClient *client;
+ QLIST_FOREACH(client, &memory_client_list, list) {
+ int r = client->migration_log(client, enable);
+ if (r < 0)
+ return r;
+ }
+ return 0;
+}
+
+static void phys_page_for_each_in_l1_map(PhysPageDesc **phys_map,
+ CPUPhysMemoryClient *client)
+{
+ PhysPageDesc *pd;
+ int l1, l2;
+
+ for (l1 = 0; l1 < L1_SIZE; ++l1) {
+ pd = phys_map[l1];
+ if (!pd) {
+ continue;
+ }
+ for (l2 = 0; l2 < L2_SIZE; ++l2) {
+ if (pd[l2].phys_offset == IO_MEM_UNASSIGNED) {
+ continue;
+ }
+ client->set_memory(client, pd[l2].region_offset,
+ TARGET_PAGE_SIZE, pd[l2].phys_offset);
+ }
+ }
+}
+
+static void phys_page_for_each(CPUPhysMemoryClient *client)
+{
+#if TARGET_PHYS_ADDR_SPACE_BITS > 32
+
+#if TARGET_PHYS_ADDR_SPACE_BITS > (32 + L1_BITS)
+#error unsupported TARGET_PHYS_ADDR_SPACE_BITS
+#endif
+ void **phys_map = (void **)l1_phys_map;
+ int l1;
+ if (!l1_phys_map) {
+ return;
+ }
+ for (l1 = 0; l1 < L1_SIZE; ++l1) {
+ if (phys_map[l1]) {
+ phys_page_for_each_in_l1_map(phys_map[l1], client);
+ }
+ }
+#else
+ if (!l1_phys_map) {
+ return;
+ }
+ phys_page_for_each_in_l1_map(l1_phys_map, client);
+#endif
+}
+
+void cpu_register_phys_memory_client(CPUPhysMemoryClient *client)
+{
+ QLIST_INSERT_HEAD(&memory_client_list, client, list);
+ phys_page_for_each(client);
+}
+
+void cpu_unregister_phys_memory_client(CPUPhysMemoryClient *client)
+{
+ QLIST_REMOVE(client, list);
+}
+#endif
+
static int cmp1(const char *s1, int n, const char *s2)
{
if (strlen(s2) != n)
@@ -1899,10 +1994,16 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
int cpu_physical_memory_set_dirty_tracking(int enable)
{
+ int ret = 0;
+ in_migration = enable;
if (kvm_enabled()) {
- return kvm_set_migration_log(enable);
+ ret = kvm_set_migration_log(enable);
}
- return 0;
+ if (ret < 0) {
+ return ret;
+ }
+ ret = cpu_notify_migration_log(!!enable);
+ return ret;
}
int cpu_physical_memory_get_dirty_tracking(void)
@@ -1915,8 +2016,13 @@ int cpu_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
{
int ret = 0;
- if (kvm_enabled())
+ if (kvm_enabled()) {
ret = kvm_physical_sync_dirty_bitmap(start_addr, end_addr);
+ }
+ if (ret < 0) {
+ return ret;
+ }
+ ret = cpu_notify_sync_dirty_bitmap(start_addr, end_addr);
return ret;
}
@@ -2331,6 +2437,8 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
if (kvm_enabled())
kvm_set_phys_mem(start_addr, size, phys_offset);
+ cpu_notify_set_memory(start_addr, size, phys_offset);
+
if (phys_offset == IO_MEM_UNASSIGNED) {
region_offset = start_addr;
}
--
1.6.6.144.g5c3af

View File

@ -1,135 +0,0 @@
From 8f4d4cb4e4e73d0533aa2cb421c14210c75f6edc Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Mon, 29 Jun 2009 14:49:03 +0100
Subject: [PATCH] Fix linux-user build on ppc
kvm-87 build fails on ppc:
https://koji.fedoraproject.org/koji/getfile?taskID=1441042&name=build.log
gcc -I. -I.. -I/builddir/build/BUILD/qemu-kvm-devel-87/target-i386
-I/builddir/build/BUILD/qemu-kvm-devel-87 -MMD -MT elfload.o -MP
-DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-D__user= -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg
-I/builddir/build/BUILD/qemu-kvm-devel-87/tcg/ppc64
-I/builddir/build/BUILD/qemu-kvm-devel-87/fpu
-I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user
-I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/i386 -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mminimal-toc -g -fno-strict-aliasing
-O2 -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes
-Wstrict-prototypes -Wredundant-decls -c -o elfload.o
/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c
/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:214: error: conflicting types for 'elf_greg_t'
/usr/include/asm/elf.h:123: note: previous declaration of 'elf_greg_t' was here
/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:220: error: conflicting types for 'elf_gregset_t'
/usr/include/asm/elf.h:124: note: previous declaration of 'elf_gregset_t' was here
In file included from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:697:
../elf.h:457:1: warning: "R_PPC_NUM" redefined
In file included from /usr/include/asm/sigcontext.h:13,
from /usr/include/bits/sigcontext.h:28,
from /usr/include/signal.h:339,
from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/qemu.h:4,
from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:16:
/usr/include/asm/elf.h:81:1: warning: this is the location of the previous definition
Problem seems to be that signal.h is pulling in a bunch of ppc
headers which expose elf_greg_t, R_PPC_* and PPC_FEATURE_*.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-fix-linux-user-build-on-ppc.patch
---
elf.h | 2 ++
linux-user/elfload.c | 10 ++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/elf.h b/elf.h
index b042002..14f8aa1 100644
--- a/elf.h
+++ b/elf.h
@@ -454,7 +454,9 @@ typedef struct {
#define R_PPC_SECTOFF_HI 35
#define R_PPC_SECTOFF_HA 36
/* Keep this the last entry. */
+#ifndef R_PPC_NUM
#define R_PPC_NUM 37
+#endif /* R_PPC_NUM */
/* ARM specific declarations */
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 3a8268b..d283f73 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -134,6 +134,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->rip = infop->entry;
}
+#ifdef FIX_BROKEN_PPC_BUILD
typedef target_ulong elf_greg_t;
typedef uint32_t target_uid_t;
typedef uint32_t target_gid_t;
@@ -179,6 +180,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
(*regs)[25] = env->segs[R_FS].selector & 0xffff;
(*regs)[26] = env->segs[R_GS].selector & 0xffff;
}
+#endif /* FIX_BROKEN_PPC_BUILD */
#else
@@ -211,6 +213,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->edx = 0;
}
+#ifdef FIX_BROKEN_PPC_BUILD
typedef target_ulong elf_greg_t;
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
@@ -246,9 +249,12 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
(*regs)[15] = env->regs[R_ESP];
(*regs)[16] = env->segs[R_SS].selector & 0xffff;
}
+#endif /* FIX_BROKEN_PPC_BUILD */
#endif
+#ifdef FIX_BROKEN_PPC_BUILD
#define USE_ELF_CORE_DUMP
+#endif /* FIX_BROKEN_PPC_BUILD */
#define ELF_EXEC_PAGESIZE 4096
#endif
@@ -286,6 +292,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->ARM_r10 = infop->start_data;
}
+#ifdef FIX_BROKEN_PPC_BUILD
typedef uint32_t elf_greg_t;
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
@@ -318,6 +325,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
}
#define USE_ELF_CORE_DUMP
+#endif /* FIX_BROKEN_PPC_BUILD */
#define ELF_EXEC_PAGESIZE 4096
enum
@@ -421,6 +429,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
/* Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP).
See arch/powerpc/include/asm/cputable.h. */
+#ifndef PPC_FEATURE_32
enum {
PPC_FEATURE_32 = 0x80000000,
PPC_FEATURE_64 = 0x40000000,
@@ -452,6 +461,7 @@ enum {
PPC_FEATURE_TRUE_LE = 0x00000002,
PPC_FEATURE_PPC_LE = 0x00000001,
};
+#endif /* !defined(PPC_FEATURE_32) */
#define ELF_HWCAP get_elf_hwcap()
--
1.6.2.5

View File

@ -1,140 +0,0 @@
From 1df18d4a961a66b9ea28ab83b409f4d9d470f148 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Thu, 8 Oct 2009 15:02:08 +0200
Subject: [PATCH] qcow2: Bring synchronous read/write back to life
When the synchronous read and write functions were dropped, they were replaced
by generic emulation functions. Unfortunately, these emulation functions don't
provide the same semantics as the original functions did.
The original bdrv_read would mean that we read some data synchronously and that
we won't be interrupted during this read. The latter assumption is no longer
true with the emulation function which needs to use qemu_aio_poll and therefore
allows the callback of any other concurrent AIO request to be run during the
read. Which in turn means that (meta)data read earlier could have changed and
be invalid now. qcow2 is not prepared to work in this way and it's just scary
how many places there are where other requests could run.
I'm not sure yet where exactly it breaks, but you'll see breakage with virtio
on qcow2 with a backing file. Providing synchronous functions again fixes the
problem for me.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-fix-qcow2-backing-file-with-virtio.patch
---
block/qcow2-cluster.c | 6 ++--
block/qcow2.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++-
block/qcow2.h | 3 ++
3 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index d4631c3..4d0ce16 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -306,8 +306,8 @@ void qcow2_encrypt_sectors(BDRVQcowState *s, int64_t sector_num,
}
-static int qcow_read(BlockDriverState *bs, int64_t sector_num,
- uint8_t *buf, int nb_sectors)
+int qcow2_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf,
+ int nb_sectors)
{
BDRVQcowState *s = bs->opaque;
int ret, index_in_cluster, n, n1;
@@ -358,7 +358,7 @@ static int copy_sectors(BlockDriverState *bs, uint64_t start_sect,
n = n_end - n_start;
if (n <= 0)
return 0;
- ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n);
+ ret = qcow2_read(bs, start_sect + n_start, s->cluster_data, n);
if (ret < 0)
return ret;
if (s->crypt_method) {
diff --git a/block/qcow2.c b/block/qcow2.c
index dd32ea2..ced257e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -855,6 +855,51 @@ static int qcow_make_empty(BlockDriverState *bs)
return 0;
}
+static int qcow2_write(BlockDriverState *bs, int64_t sector_num,
+ const uint8_t *buf, int nb_sectors)
+{
+ BDRVQcowState *s = bs->opaque;
+ int ret, index_in_cluster, n;
+ uint64_t cluster_offset;
+ int n_end;
+ QCowL2Meta l2meta;
+
+ while (nb_sectors > 0) {
+ memset(&l2meta, 0, sizeof(l2meta));
+
+ index_in_cluster = sector_num & (s->cluster_sectors - 1);
+ n_end = index_in_cluster + nb_sectors;
+ if (s->crypt_method &&
+ n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors)
+ n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors;
+ cluster_offset = qcow2_alloc_cluster_offset(bs, sector_num << 9,
+ index_in_cluster,
+ n_end, &n, &l2meta);
+ if (!cluster_offset)
+ return -1;
+ if (s->crypt_method) {
+ qcow2_encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1,
+ &s->aes_encrypt_key);
+ ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512,
+ s->cluster_data, n * 512);
+ } else {
+ ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);
+ }
+ if (ret != n * 512 || qcow2_alloc_cluster_link_l2(bs, cluster_offset, &l2meta) < 0) {
+ qcow2_free_any_clusters(bs, cluster_offset, l2meta.nb_clusters);
+ return -1;
+ }
+ nb_sectors -= n;
+ sector_num += n;
+ buf += n * 512;
+ if (l2meta.nb_clusters != 0) {
+ LIST_REMOVE(&l2meta, next_in_flight);
+ }
+ }
+ s->cluster_cache_offset = -1; /* disable compressed cache */
+ return 0;
+}
+
/* XXX: put compressed sectors first, then all the cluster aligned
tables to avoid losing bytes in alignment */
static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
@@ -1037,8 +1082,10 @@ static BlockDriver bdrv_qcow2 = {
.bdrv_set_key = qcow_set_key,
.bdrv_make_empty = qcow_make_empty,
- .bdrv_aio_readv = qcow_aio_readv,
- .bdrv_aio_writev = qcow_aio_writev,
+ .bdrv_read = qcow2_read,
+ .bdrv_write = qcow2_write,
+ .bdrv_aio_readv = qcow_aio_readv,
+ .bdrv_aio_writev = qcow_aio_writev,
.bdrv_write_compressed = qcow_write_compressed,
.bdrv_snapshot_create = qcow2_snapshot_create,
diff --git a/block/qcow2.h b/block/qcow2.h
index 965a2f4..b41aa63 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -202,6 +202,9 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, uint64_t cluster_offset,
QCowL2Meta *m);
+int qcow2_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf,
+ int nb_sectors);
+
/* qcow2-snapshot.c functions */
int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info);
int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id);
--
1.6.2.5

19
qemu-ga.sysconfig Normal file
View File

@ -0,0 +1,19 @@
# This is a systemd environment file, not a shell script.
# It provides settings for "/lib/systemd/system/qemu-guest-agent.service".
# Comma-separated blacklist of RPCs to disable, or empty list to enable all.
#
# You can get the list of RPC commands using "qemu-ga --blacklist='?'".
# There should be no spaces between commas and commands in the blacklist.
#BLACKLIST_RPC=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush,guest-exec,guest-exec-status
# Fsfreeze hook script specification.
#
# FSFREEZE_HOOK_PATHNAME=/dev/null : disables the feature.
#
# FSFREEZE_HOOK_PATHNAME=/path/to/executable : enables the feature with the
# specified binary or shell script.
#
# FSFREEZE_HOOK_PATHNAME= : enables the feature with the
# default value (invoke "qemu-ga --help" to interrogate).
FSFREEZE_HOOK_PATHNAME=/etc/qemu-ga/fsfreeze-hook

19
qemu-guest-agent.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description=QEMU Guest Agent
BindsTo=dev-virtio\x2dports-org.qemu.guest_agent.0.device
After=dev-virtio\x2dports-org.qemu.guest_agent.0.device
IgnoreOnIsolate=True
[Service]
UMask=0077
EnvironmentFile=/etc/sysconfig/qemu-ga
ExecStart=/usr/bin/qemu-ga \
--method=virtio-serial \
--path=/dev/virtio-ports/org.qemu.guest_agent.0 \
--blacklist=${BLACKLIST_RPC} \
-F${FSFREEZE_HOOK_PATHNAME}
Restart=always
RestartSec=0
[Install]
WantedBy=dev-virtio\x2dports-org.qemu.guest_agent.0.device

View File

@ -1,81 +0,0 @@
This adds API to set ioeventfd to kvm,
as well as stubs for non-eventfd case,
making it possible for users to use this API
without ifdefs.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
kvm-all.c | 20 ++++++++++++++++++++
kvm.h | 16 ++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 0423fff..efdf40c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1102,4 +1102,24 @@ void kvm_remove_all_breakpoints(CPUState *current_env)
}
#endif /* !KVM_CAP_SET_GUEST_DEBUG */
+#ifdef KVM_IOEVENTFD
+int kvm_set_ioeventfd(uint16_t addr, uint16_t data, int fd, bool assigned)
+{
+ struct kvm_ioeventfd kick = {
+ .datamatch = data,
+ .addr = addr,
+ .len = 2,
+ .flags = KVM_IOEVENTFD_FLAG_DATAMATCH | KVM_IOEVENTFD_FLAG_PIO,
+ .fd = fd,
+ };
+ int r;
+ if (!assigned)
+ kick.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN;
+ r = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick);
+ if (r < 0)
+ return r;
+ return 0;
+}
+#endif
+
#include "qemu-kvm.c"
diff --git a/kvm.h b/kvm.h
index 9fa4e25..e98b5c8 100644
--- a/kvm.h
+++ b/kvm.h
@@ -14,6 +14,8 @@
#ifndef QEMU_KVM_H
#define QEMU_KVM_H
+#include <stdbool.h>
+#include <errno.h>
#include "config.h"
#include "qemu-queue.h"
#include "qemu-kvm.h"
@@ -21,6 +23,10 @@
#ifdef KVM_UPSTREAM
#ifdef CONFIG_KVM
+#include <linux/kvm.h>
+#endif
+
+#ifdef CONFIG_KVM
extern int kvm_allowed;
#define kvm_enabled() (kvm_allowed)
@@ -151,4 +157,14 @@ static inline void cpu_synchronize_state(CPUState *env)
#endif
+#if defined(KVM_IOEVENTFD) && defined(CONFIG_KVM)
+int kvm_set_ioeventfd(uint16_t addr, uint16_t data, int fd, bool assigned);
+#else
+static inline
+int kvm_set_ioeventfd(uint16_t data, uint16_t addr, int fd, bool assigned)
+{
+ return -ENOSYS;
+}
+#endif
+
#endif
--
1.6.6.144.g5c3af

View File

@ -1,147 +0,0 @@
This makes it possible to build vhost support
on systems which do not have this header.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
kvm/include/linux/vhost.h | 130 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 130 insertions(+), 0 deletions(-)
create mode 100644 kvm/include/linux/vhost.h
diff --git a/kvm/include/linux/vhost.h b/kvm/include/linux/vhost.h
new file mode 100644
index 0000000..165a484
--- /dev/null
+++ b/kvm/include/linux/vhost.h
@@ -0,0 +1,130 @@
+#ifndef _LINUX_VHOST_H
+#define _LINUX_VHOST_H
+/* Userspace interface for in-kernel virtio accelerators. */
+
+/* vhost is used to reduce the number of system calls involved in virtio.
+ *
+ * Existing virtio net code is used in the guest without modification.
+ *
+ * This header includes interface used by userspace hypervisor for
+ * device configuration.
+ */
+
+#include <linux/types.h>
+
+#include <linux/ioctl.h>
+#include <linux/virtio_config.h>
+#include <linux/virtio_ring.h>
+
+struct vhost_vring_state {
+ unsigned int index;
+ unsigned int num;
+};
+
+struct vhost_vring_file {
+ unsigned int index;
+ int fd; /* Pass -1 to unbind from file. */
+
+};
+
+struct vhost_vring_addr {
+ unsigned int index;
+ /* Option flags. */
+ unsigned int flags;
+ /* Flag values: */
+ /* Whether log address is valid. If set enables logging. */
+#define VHOST_VRING_F_LOG 0
+
+ /* Start of array of descriptors (virtually contiguous) */
+ __u64 desc_user_addr;
+ /* Used structure address. Must be 32 bit aligned */
+ __u64 used_user_addr;
+ /* Available structure address. Must be 16 bit aligned */
+ __u64 avail_user_addr;
+ /* Logging support. */
+ /* Log writes to used structure, at offset calculated from specified
+ * address. Address must be 32 bit aligned. */
+ __u64 log_guest_addr;
+};
+
+struct vhost_memory_region {
+ __u64 guest_phys_addr;
+ __u64 memory_size; /* bytes */
+ __u64 userspace_addr;
+ __u64 flags_padding; /* No flags are currently specified. */
+};
+
+/* All region addresses and sizes must be 4K aligned. */
+#define VHOST_PAGE_SIZE 0x1000
+
+struct vhost_memory {
+ __u32 nregions;
+ __u32 padding;
+ struct vhost_memory_region regions[0];
+};
+
+/* ioctls */
+
+#define VHOST_VIRTIO 0xAF
+
+/* Features bitmask for forward compatibility. Transport bits are used for
+ * vhost specific features. */
+#define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64)
+#define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64)
+
+/* Set current process as the (exclusive) owner of this file descriptor. This
+ * must be called before any other vhost command. Further calls to
+ * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */
+#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
+/* Give up ownership, and reset the device to default values.
+ * Allows subsequent call to VHOST_OWNER_SET to succeed. */
+#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
+
+/* Set up/modify memory layout */
+#define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
+
+/* Write logging setup. */
+/* Memory writes can optionally be logged by setting bit at an offset
+ * (calculated from the physical address) from specified log base.
+ * The bit is set using an atomic 32 bit operation. */
+/* Set base address for logging. */
+#define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
+/* Specify an eventfd file descriptor to signal on log write. */
+#define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
+
+/* Ring setup. */
+/* Set number of descriptors in ring. This parameter can not
+ * be modified while ring is running (bound to a device). */
+#define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state)
+/* Set addresses for the ring. */
+#define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr)
+/* Base value where queue looks for available descriptors */
+#define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
+/* Get accessor: reads index, writes value in num */
+#define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
+
+/* The following ioctls use eventfd file descriptors to signal and poll
+ * for events. */
+
+/* Set eventfd to poll for added buffers */
+#define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file)
+/* Set eventfd to signal when buffers have beed used */
+#define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file)
+/* Set eventfd to signal an error */
+#define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file)
+
+/* VHOST_NET specific defines */
+
+/* Attach virtio net ring to a raw socket, or tap device.
+ * The socket must be already bound to an ethernet device, this device will be
+ * used for transmit. Pass fd -1 to unbind from the socket and the transmit
+ * device. This can be used to stop the ring (e.g. for migration). */
+#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
+
+/* Feature bits */
+/* Log all write descriptors. Can be changed while device is active. */
+#define VHOST_F_LOG_ALL 26
+/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
+#define VHOST_NET_F_VIRTIO_NET_HDR 27
+
+#endif
--
1.6.6.144.g5c3af

View File

@ -1,59 +0,0 @@
Add API to assign/deassign irqfd to kvm.
Add stub so that users do not have to use
ifdefs.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
kvm-all.c | 19 +++++++++++++++++++
kvm.h | 10 ++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index efdf40c..b3fdf29 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1122,4 +1122,23 @@ int kvm_set_ioeventfd(uint16_t addr, uint16_t data, int fd, bool assigned)
}
#endif
+#if defined(KVM_IRQFD)
+int kvm_set_irqfd(int gsi, int fd, bool assigned)
+{
+ struct kvm_irqfd irqfd = {
+ .fd = fd,
+ .gsi = gsi,
+ .flags = assigned ? 0 : KVM_IRQFD_FLAG_DEASSIGN,
+ };
+ int r;
+ if (!kvm_irqchip_in_kernel())
+ return -ENOSYS;
+
+ r = kvm_vm_ioctl(kvm_state, KVM_IRQFD, &irqfd);
+ if (r < 0)
+ return r;
+ return 0;
+}
+#endif
+
#include "qemu-kvm.c"
diff --git a/kvm.h b/kvm.h
index e98b5c8..ad8d122 100644
--- a/kvm.h
+++ b/kvm.h
@@ -167,4 +167,14 @@ int kvm_set_ioeventfd(uint16_t data, uint16_t addr, int fd, bool assigned)
}
#endif
+#if defined(KVM_IRQFD) && defined(CONFIG_KVM)
+int kvm_set_irqfd(int gsi, int fd, bool assigned);
+#else
+static inline
+int kvm_set_irqfd(int gsi, int fd, bool assigned)
+{
+ return -ENOSYS;
+}
+#endif
+
#endif
--
1.6.6.144.g5c3af

10
qemu-kvm.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Libvirt introspects the binary using -M none. In that case, don't try
# to init KVM, which will fail and be noisy if the host has kvm disabled
opts="-machine accel=kvm"
if echo "$@" | grep -q " -M none "; then
opts=
fi
exec /usr/bin/qemu-system-x86_64 $opts "$@"

View File

@ -1,121 +0,0 @@
Support per-vector callbacks for msix mask/unmask.
Will be used for vhost net.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/msix.c | 36 +++++++++++++++++++++++++++++++++++-
hw/msix.h | 1 +
hw/pci.h | 6 ++++++
3 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index d117bcf..3fcf3a1 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -318,6 +318,13 @@ static void msix_mmio_writel(void *opaque, target_phys_addr_t addr,
if (kvm_enabled() && kvm_irqchip_in_kernel()) {
kvm_msix_update(dev, vector, was_masked, msix_is_masked(dev, vector));
}
+ if (was_masked != msix_is_masked(dev, vector) &&
+ dev->msix_mask_notifier && dev->msix_mask_notifier_opaque[vector]) {
+ int r = dev->msix_mask_notifier(dev, vector,
+ dev->msix_mask_notifier_opaque[vector],
+ msix_is_masked(dev, vector));
+ assert(r >= 0);
+ }
msix_handle_mask_update(dev, vector);
}
@@ -356,10 +363,18 @@ void msix_mmio_map(PCIDevice *d, int region_num,
static void msix_mask_all(struct PCIDevice *dev, unsigned nentries)
{
- int vector;
+ int vector, r;
for (vector = 0; vector < nentries; ++vector) {
unsigned offset = vector * MSIX_ENTRY_SIZE + MSIX_VECTOR_CTRL;
+ int was_masked = msix_is_masked(dev, vector);
dev->msix_table_page[offset] |= MSIX_VECTOR_MASK;
+ if (was_masked != msix_is_masked(dev, vector) &&
+ dev->msix_mask_notifier && dev->msix_mask_notifier_opaque[vector]) {
+ r = dev->msix_mask_notifier(dev, vector,
+ dev->msix_mask_notifier_opaque[vector],
+ msix_is_masked(dev, vector));
+ assert(r >= 0);
+ }
}
}
@@ -382,6 +397,9 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
sizeof *dev->msix_irq_entries);
}
#endif
+ dev->msix_mask_notifier_opaque =
+ qemu_mallocz(nentries * sizeof *dev->msix_mask_notifier_opaque);
+ dev->msix_mask_notifier = NULL;
dev->msix_entry_used = qemu_mallocz(MSIX_MAX_ENTRIES *
sizeof *dev->msix_entry_used);
@@ -444,6 +462,8 @@ int msix_uninit(PCIDevice *dev)
dev->msix_entry_used = NULL;
qemu_free(dev->msix_irq_entries);
dev->msix_irq_entries = NULL;
+ qemu_free(dev->msix_mask_notifier_opaque);
+ dev->msix_mask_notifier_opaque = NULL;
dev->cap_present &= ~QEMU_PCI_CAP_MSIX;
return 0;
}
@@ -587,3 +607,17 @@ void msix_unuse_all_vectors(PCIDevice *dev)
return;
msix_free_irq_entries(dev);
}
+
+int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque)
+{
+ int r = 0;
+ if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
+ return 0;
+
+ if (dev->msix_mask_notifier)
+ r = dev->msix_mask_notifier(dev, vector, opaque,
+ msix_is_masked(dev, vector));
+ if (r >= 0)
+ dev->msix_mask_notifier_opaque[vector] = opaque;
+ return r;
+}
diff --git a/hw/msix.h b/hw/msix.h
index a9f7993..f167231 100644
--- a/hw/msix.h
+++ b/hw/msix.h
@@ -33,4 +33,5 @@ void msix_reset(PCIDevice *dev);
extern int msix_supported;
+int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque);
#endif
diff --git a/hw/pci.h b/hw/pci.h
index a225a6a..bf722ca 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -217,6 +217,9 @@ enum {
#define PCI_CAPABILITY_CONFIG_MSI_LENGTH 0x10
#define PCI_CAPABILITY_CONFIG_MSIX_LENGTH 0x10
+typedef int (*msix_mask_notifier_func)(PCIDevice *, unsigned vector,
+ void *opaque, int masked);
+
struct PCIDevice {
DeviceState qdev;
/* PCI config space */
@@ -282,6 +285,9 @@ struct PCIDevice {
struct kvm_irq_routing_entry *msix_irq_entries;
+ void **msix_mask_notifier_opaque;
+ msix_mask_notifier_func msix_mask_notifier;
+
/* Device capability configuration space */
struct {
int supported;
--
1.6.6.144.g5c3af

View File

@ -1,68 +0,0 @@
When vhost is bound to a backend device, we need to stop polling it when
vhost is started, and restart polling when vhost is stopped.
Add an API for that for use by vhost, and implement in tap backend.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit ceb696159d569db5b2a7659ce38752398c236742)
---
net.h | 3 +++
net/tap.c | 8 ++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/net.h b/net.h
index 4971fcb..116bb80 100644
--- a/net.h
+++ b/net.h
@@ -1,6 +1,7 @@
#ifndef QEMU_NET_H
#define QEMU_NET_H
+#include <stdbool.h>
#include "qemu-queue.h"
#include "qemu-common.h"
#include "qdict.h"
@@ -36,6 +37,7 @@ typedef enum {
NET_CLIENT_TYPE_DUMP
} net_client_type;
+typedef void (NetPoll)(VLANClientState *, bool enable);
typedef int (NetCanReceive)(VLANClientState *);
typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t);
typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int);
@@ -51,6 +53,7 @@ typedef struct NetClientInfo {
NetCanReceive *can_receive;
NetCleanup *cleanup;
LinkStatusChanged *link_status_changed;
+ NetPoll *poll;
} NetClientInfo;
struct VLANClientState {
diff --git a/net/tap.c b/net/tap.c
index 0d8b424..d3492de 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -262,6 +262,13 @@ static void tap_cleanup(VLANClientState *nc)
close(s->fd);
}
+static void tap_poll(VLANClientState *nc, bool enable)
+{
+ TAPState *s = DO_UPCAST(TAPState, nc, nc);
+ tap_read_poll(s, enable);
+ tap_write_poll(s, enable);
+}
+
/* fd support */
static NetClientInfo net_tap_info = {
@@ -270,6 +277,7 @@ static NetClientInfo net_tap_info = {
.receive = tap_receive,
.receive_raw = tap_receive_raw,
.receive_iov = tap_receive_iov,
+ .poll = tap_poll,
.cleanup = tap_cleanup,
};
--
1.6.6.144.g5c3af

View File

@ -1,122 +0,0 @@
event notifiers are slightly generalized eventfd descriptors. Current
implementation depends on eventfd because vhost is the only user, and
vhost depends on eventfd anyway, but a stub is provided for non-eventfd
case.
We'll be able to further generalize this when another user comes along
and we see how to best do this.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Makefile.target | 1 +
hw/notifier.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
hw/notifier.h | 16 ++++++++++++++++
qemu-common.h | 1 +
4 files changed, 68 insertions(+), 0 deletions(-)
create mode 100644 hw/notifier.c
create mode 100644 hw/notifier.h
diff --git a/Makefile.target b/Makefile.target
index 6037fed..0c844a9 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -167,6 +167,7 @@ obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o
# virtio has to be here due to weird dependency between PCI and virtio-net.
# need to fix this properly
obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
+obj-y += notifier.o
obj-$(CONFIG_KVM) += kvm.o kvm-all.o
# MSI-X depends on kvm for interrupt injection,
# so moved it from Makefile.hw to Makefile.target for now
diff --git a/hw/notifier.c b/hw/notifier.c
new file mode 100644
index 0000000..dff38de
--- /dev/null
+++ b/hw/notifier.c
@@ -0,0 +1,50 @@
+#include "hw.h"
+#include "notifier.h"
+#ifdef CONFIG_EVENTFD
+#include <sys/eventfd.h>
+#endif
+
+int event_notifier_init(EventNotifier *e, int active)
+{
+#ifdef CONFIG_EVENTFD
+ int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC);
+ if (fd < 0)
+ return -errno;
+ e->fd = fd;
+ return 0;
+#else
+ return -ENOSYS;
+#endif
+}
+
+void event_notifier_cleanup(EventNotifier *e)
+{
+ close(e->fd);
+}
+
+int event_notifier_get_fd(EventNotifier *e)
+{
+ return e->fd;
+}
+
+int event_notifier_test_and_clear(EventNotifier *e)
+{
+ uint64_t value;
+ int r = read(e->fd, &value, sizeof value);
+ return r == sizeof value;
+}
+
+int event_notifier_test(EventNotifier *e)
+{
+ uint64_t value;
+ int r = read(e->fd, &value, sizeof value);
+ if (r == sizeof value) {
+ /* restore previous value. */
+ int s = write(e->fd, &value, sizeof value);
+ /* never blocks because we use EFD_SEMAPHORE.
+ * If we didn't we'd get EAGAIN on overflow
+ * and we'd have to write code to ignore it. */
+ assert(s == sizeof value);
+ }
+ return r == sizeof value;
+}
diff --git a/hw/notifier.h b/hw/notifier.h
new file mode 100644
index 0000000..24117ea
--- /dev/null
+++ b/hw/notifier.h
@@ -0,0 +1,16 @@
+#ifndef QEMU_EVENT_NOTIFIER_H
+#define QEMU_EVENT_NOTIFIER_H
+
+#include "qemu-common.h"
+
+struct EventNotifier {
+ int fd;
+};
+
+int event_notifier_init(EventNotifier *, int active);
+void event_notifier_cleanup(EventNotifier *);
+int event_notifier_get_fd(EventNotifier *);
+int event_notifier_test_and_clear(EventNotifier *);
+int event_notifier_test(EventNotifier *);
+
+#endif
diff --git a/qemu-common.h b/qemu-common.h
index 5fbe0f9..cdead98 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -217,6 +217,7 @@ typedef struct uWireSlave uWireSlave;
typedef struct I2SCodec I2SCodec;
typedef struct DeviceState DeviceState;
typedef struct SSIBus SSIBus;
+typedef struct EventNotifier EventNotifier;
/* CPU save/load. */
void cpu_save(QEMUFile *f, void *opaque);
--
1.6.6.144.g5c3af

View File

@ -1,156 +0,0 @@
This adds "bit" property type, which is a boolean stored in a 32 bit
integer field, with legal values on and off. Will be used by virtio for
feature bits.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit d2364ee424ebf9180afaf21128a71da55321ad00)
---
hw/qdev-properties.c | 62 ++++++++++++++++++++++++++++++++++++++++++++-----
hw/qdev.h | 11 +++++++++
2 files changed, 66 insertions(+), 7 deletions(-)
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 217ddc0..9e123ae 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -9,6 +9,59 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
return ptr;
}
+static uint32_t qdev_get_prop_mask(Property *prop)
+{
+ assert(prop->info->type == PROP_TYPE_BIT);
+ return 0x1 << prop->bitnr;
+}
+
+static void bit_prop_set(DeviceState *dev, Property *props, bool val)
+{
+ uint32_t *p = qdev_get_prop_ptr(dev, props);
+ uint32_t mask = qdev_get_prop_mask(props);
+ if (val)
+ *p |= ~mask;
+ else
+ *p &= ~mask;
+}
+
+static void qdev_prop_cpy(DeviceState *dev, Property *props, void *src)
+{
+ if (props->info->type == PROP_TYPE_BIT) {
+ bool *defval = src;
+ bit_prop_set(dev, props, *defval);
+ } else {
+ char *dst = qdev_get_prop_ptr(dev, props);
+ memcpy(dst, src, props->info->size);
+ }
+}
+
+/* Bit */
+static int parse_bit(DeviceState *dev, Property *prop, const char *str)
+{
+ if (!strncasecmp(str, "on", 2))
+ bit_prop_set(dev, prop, true);
+ else if (!strncasecmp(str, "off", 3))
+ bit_prop_set(dev, prop, false);
+ else
+ return -1;
+ return 0;
+}
+
+static int print_bit(DeviceState *dev, Property *prop, char *dest, size_t len)
+{
+ uint8_t *p = qdev_get_prop_ptr(dev, prop);
+ return snprintf(dest, len, (*p & qdev_get_prop_mask(prop)) ? "on" : "off");
+}
+
+PropertyInfo qdev_prop_bit = {
+ .name = "on/off",
+ .type = PROP_TYPE_BIT,
+ .size = sizeof(uint32_t),
+ .parse = parse_bit,
+ .print = print_bit,
+};
+
/* --- 8bit integer --- */
static int parse_uint8(DeviceState *dev, Property *prop, const char *str)
@@ -511,7 +564,6 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyType type)
{
Property *prop;
- void *dst;
prop = qdev_prop_find(dev, name);
if (!prop) {
@@ -524,8 +576,7 @@ void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyT
__FUNCTION__, dev->info->name, name);
abort();
}
- dst = qdev_get_prop_ptr(dev, prop);
- memcpy(dst, src, prop->info->size);
+ qdev_prop_cpy(dev, prop, src);
}
void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value)
@@ -585,14 +636,11 @@ void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)
void qdev_prop_set_defaults(DeviceState *dev, Property *props)
{
- char *dst;
-
if (!props)
return;
while (props->name) {
if (props->defval) {
- dst = qdev_get_prop_ptr(dev, props);
- memcpy(dst, props->defval, props->info->size);
+ qdev_prop_cpy(dev, props, props->defval);
}
props++;
}
diff --git a/hw/qdev.h b/hw/qdev.h
index bbcdba1..07b9603 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -64,6 +64,7 @@ struct Property {
const char *name;
PropertyInfo *info;
int offset;
+ int bitnr;
void *defval;
};
@@ -82,6 +83,7 @@ enum PropertyType {
PROP_TYPE_NETDEV,
PROP_TYPE_VLAN,
PROP_TYPE_PTR,
+ PROP_TYPE_BIT,
};
struct PropertyInfo {
@@ -173,6 +175,7 @@ void do_device_del(Monitor *mon, const QDict *qdict);
/*** qdev-properties.c ***/
+extern PropertyInfo qdev_prop_bit;
extern PropertyInfo qdev_prop_uint8;
extern PropertyInfo qdev_prop_uint16;
extern PropertyInfo qdev_prop_uint32;
@@ -202,6 +205,14 @@ extern PropertyInfo qdev_prop_pci_devfn;
+ type_check(_type,typeof_field(_state, _field)), \
.defval = (_type[]) { _defval }, \
}
+#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) { \
+ .name = (_name), \
+ .info = &(qdev_prop_bit), \
+ .bitnr = (_bit), \
+ .offset = offsetof(_state, _field) \
+ + type_check(uint32_t,typeof_field(_state, _field)), \
+ .defval = (bool[]) { (_defval) }, \
+ }
#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \
DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_uint8, uint8_t)
--
1.6.6.144.g5c3af

View File

@ -1,24 +0,0 @@
Without this fix, guest crashes with drive=virtio.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit dbd483242c2e6dfaacb9fd3d20c333bbdad87243)
---
hw/qdev-properties.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 9e123ae..277ff9e 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -20,7 +20,7 @@ static void bit_prop_set(DeviceState *dev, Property *props, bool val)
uint32_t *p = qdev_get_prop_ptr(dev, props);
uint32_t mask = qdev_get_prop_mask(props);
if (val)
- *p |= ~mask;
+ *p |= mask;
else
*p &= ~mask;
}
--
1.6.6.144.g5c3af

View File

@ -1,37 +0,0 @@
will be used by virtio-net for vhost net support
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/tap.c | 7 +++++++
net/tap.h | 3 +++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/net/tap.c b/net/tap.c
index d9f2e41..166cf05 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -491,3 +491,10 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan
return 0;
}
+
+struct vhost_net *tap_get_vhost_net(VLANClientState *nc)
+{
+ TAPState *s = DO_UPCAST(TAPState, nc, nc);
+ assert(nc->info->type == NET_CLIENT_TYPE_TAP);
+ return s->vhost_net;
+}
diff --git a/net/tap.h b/net/tap.h
index a244b28..b8cec83 100644
--- a/net/tap.h
+++ b/net/tap.h
@@ -50,4 +50,7 @@ void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
int tap_get_fd(VLANClientState *vc);
+struct vhost_net;
+struct vhost_net *tap_get_vhost_net(VLANClientState *vc);
+
#endif /* QEMU_NET_TAP_H */
--
1.6.6.144.g5c3af

View File

@ -1,39 +0,0 @@
Will be used by vhost to attach/detach to backend.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/tap.c | 7 +++++++
net/tap.h | 2 ++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/net/tap.c b/net/tap.c
index d3492de..7e9ca79 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -269,6 +269,13 @@ static void tap_poll(VLANClientState *nc, bool enable)
tap_write_poll(s, enable);
}
+int tap_get_fd(VLANClientState *nc)
+{
+ TAPState *s = DO_UPCAST(TAPState, nc, nc);
+ assert(nc->info->type == NET_CLIENT_TYPE_TAP);
+ return s->fd;
+}
+
/* fd support */
static NetClientInfo net_tap_info = {
diff --git a/net/tap.h b/net/tap.h
index 538a562..a244b28 100644
--- a/net/tap.h
+++ b/net/tap.h
@@ -48,4 +48,6 @@ int tap_probe_vnet_hdr(int fd);
int tap_probe_has_ufo(int fd);
void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
+int tap_get_fd(VLANClientState *vc);
+
#endif /* QEMU_NET_TAP_H */
--
1.6.6.144.g5c3af

View File

@ -1,117 +0,0 @@
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net.c | 8 ++++++++
net/tap.c | 29 +++++++++++++++++++++++++++++
qemu-options.hx | 4 +++-
3 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/net.c b/net.c
index 6ef93e6..b942d03 100644
--- a/net.c
+++ b/net.c
@@ -976,6 +976,14 @@ static struct {
.name = "vnet_hdr",
.type = QEMU_OPT_BOOL,
.help = "enable the IFF_VNET_HDR flag on the tap interface"
+ }, {
+ .name = "vhost",
+ .type = QEMU_OPT_BOOL,
+ .help = "enable vhost-net network accelerator",
+ }, {
+ .name = "vhostfd",
+ .type = QEMU_OPT_STRING,
+ .help = "file descriptor of an already opened vhost net device",
},
#endif /* _WIN32 */
{ /* end of list */ }
diff --git a/net/tap.c b/net/tap.c
index 7e9ca79..d9f2e41 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -41,6 +41,8 @@
#include "net/tap-linux.h"
+#include "hw/vhost_net.h"
+
/* Maximum GSO packet size (64k) plus plenty of room for
* the ethernet and virtio_net headers
*/
@@ -57,6 +59,7 @@ typedef struct TAPState {
unsigned int has_vnet_hdr : 1;
unsigned int using_vnet_hdr : 1;
unsigned int has_ufo: 1;
+ struct vhost_net *vhost_net;
} TAPState;
static int launch_script(const char *setup_script, const char *ifname, int fd);
@@ -252,6 +255,10 @@ static void tap_cleanup(VLANClientState *nc)
{
TAPState *s = DO_UPCAST(TAPState, nc, nc);
+ if (s->vhost_net) {
+ vhost_net_cleanup(s->vhost_net);
+ }
+
qemu_purge_queued_packets(nc);
if (s->down_script[0])
@@ -307,6 +314,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan,
s->has_ufo = tap_probe_has_ufo(s->fd);
tap_set_offload(&s->nc, 0, 0, 0, 0, 0);
tap_read_poll(s, 1);
+ s->vhost_net = NULL;
return s;
}
@@ -456,5 +464,26 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan
}
}
+ if (qemu_opt_get_bool(opts, "vhost", 0)) {
+ int vhostfd, r;
+ if (qemu_opt_get(opts, "vhostfd")) {
+ r = net_handle_fd_param(mon, qemu_opt_get(opts, "vhostfd"));
+ if (r == -1) {
+ return -1;
+ }
+ vhostfd = r;
+ } else {
+ vhostfd = -1;
+ }
+ s->vhost_net = vhost_net_init(&s->nc, vhostfd);
+ if (!s->vhost_net) {
+ qemu_error("vhost-net requested but could not be initialized\n");
+ return -1;
+ }
+ } else if (qemu_opt_get(opts, "vhostfd")) {
+ qemu_error("vhostfd= is not valid without vhost\n");
+ return -1;
+ }
+
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index ca73ba5..2b3d9b8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -814,7 +814,7 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net tap[,vlan=n][,name=str],ifname=name\n"
" connect the host TAP network interface to VLAN 'n'\n"
#else
- "-net tap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile][,sndbuf=nbytes][,vnet_hdr=on|off]\n"
+ "-net tap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off][,vhostfd=h]\n"
" connect the host TAP network interface to VLAN 'n' and use the\n"
" network scripts 'file' (default=%s)\n"
" and 'dfile' (default=%s);\n"
@@ -824,6 +824,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
" default of 'sndbuf=1048576' can be disabled using 'sndbuf=0'\n"
" use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag; use\n"
" vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n"
+ " use vhost=on to enable experimental in kernel accelerator\n"
+ " use 'vhostfd=h' to connect to an already opened vhost net device\n"
#endif
"-net socket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]\n"
" connect the vlan 'n' to another VLAN using a socket connection\n"
--
1.6.6.144.g5c3af

View File

@ -1,41 +0,0 @@
If we go over the maximum number of iovecs support by syscall we get
back EINVAL from the kernel which translate to I/O errors for the guest.
Add a MAX_IOV defintion for platforms that don't have it. For now we use
the same 1024 define that's used on Linux and various other platforms,
but until the windows block backend implements some kind of vectored I/O
it doesn't matter.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu/block.c
===================================================================
--- qemu.orig/block.c 2010-01-26 10:59:39.757004445 +0100
+++ qemu/block.c 2010-01-26 11:01:38.056023231 +0100
@@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverS
merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]);
}
+ if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) {
+ merge = 0;
+ }
+
if (merge) {
size_t size;
QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
Index: qemu/qemu-common.h
===================================================================
--- qemu.orig/qemu-common.h 2010-01-26 14:41:40.894254285 +0100
+++ qemu/qemu-common.h 2010-01-26 14:42:27.267275698 +0100
@@ -54,6 +54,10 @@ struct iovec {
void *iov_base;
size_t iov_len;
};
+/*
+ * Use the same value as Linux for now.
+ */
+#define IOV_MAX 1024
#else
#include <sys/uio.h>
#endif

View File

@ -1,118 +0,0 @@
Teach configure to check for vhost.h
and disable vhost_net if not present.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>'
---
diff --git a/Makefile.target b/Makefile.target
index 2ebd30c..38783da 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -168,7 +168,8 @@ obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o
# need to fix this properly
obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
obj-y += notifier.o
-obj-y += vhost_net.o vhost.o
+obj-y += vhost_net.o
+obj-$(CONFIG_VHOST_NET) += vhost.o
obj-$(CONFIG_KVM) += kvm.o kvm-all.o
# MSI-X depends on kvm for interrupt injection,
# so moved it from Makefile.hw to Makefile.target for now
diff --git a/configure b/configure
index 88ba002..4994506 100755
--- a/configure
+++ b/configure
@@ -1510,6 +1510,23 @@ EOF
fi
##########################################
+# test for vhost net
+
+if test "$kvm" != "no"; then
+ cat > $TMPC <<EOF
+#include <linux/vhost.h>
+int main(void) { return 0; }
+EOF
+ if compile_prog "$kvm_cflags" "" ; then
+ vhost_net=yes
+ else
+ vhost_net=no
+ fi
+else
+ vhost_net=no
+fi
+
+##########################################
# libpci probe for kvm_cap_device_assignment
if test $kvm_cap_device_assignment = "yes" ; then
cat > $TMPC << EOF
@@ -2058,6 +2075,7 @@ echo "fdt support $fdt"
echo "preadv support $preadv"
echo "fdatasync $fdatasync"
echo "uuid support $uuid"
+echo "vhost-net support $vhost_net"
if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2593,6 +2611,9 @@ case "$target_arch2" in
if test $kvm_cap_device_assignment = "yes" ; then
echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
fi
+ if test $vhost_net = "yes" ; then
+ echo "CONFIG_VHOST_NET=y" >> $config_target_mak
+ fi
fi
esac
echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index c89ff40..cab9a0a 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -16,9 +16,13 @@
#include "net/tap.h"
#include "virtio-net.h"
-#include "vhost.h"
#include "vhost_net.h"
+#include "config.h"
+
+#ifdef CONFIG_VHOST_NET
+#include "vhost.h"
+
struct vhost_net {
struct vhost_dev dev;
struct vhost_virtqueue vqs[2];
@@ -145,3 +149,31 @@ void vhost_net_cleanup(struct vhost_net *net)
qemu_free(net);
}
/* TODO: log */
+#else
+struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
+{
+ return NULL;
+}
+
+int vhost_net_start(struct vhost_net *net,
+ VirtIODevice *dev)
+{
+ return -ENOSYS;
+}
+void vhost_net_stop(struct vhost_net *net,
+ VirtIODevice *dev)
+{
+}
+
+void vhost_net_cleanup(struct vhost_net *net)
+{
+}
+
+unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
+{
+ return features;
+}
+void vhost_net_ack_features(struct vhost_net *net, unsigned features)
+{
+}
+#endif

View File

@ -1,869 +0,0 @@
This adds vhost net support in qemu. Will be tied to tap device and
virtio by following patches. Raw backend is currently missing, will be
worked on/submitted separately.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Makefile.target | 1 +
hw/vhost.c | 603 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/vhost.h | 44 ++++
hw/vhost_net.c | 147 ++++++++++++++
hw/vhost_net.h | 20 ++
5 files changed, 815 insertions(+), 0 deletions(-)
create mode 100644 hw/vhost.c
create mode 100644 hw/vhost.h
create mode 100644 hw/vhost_net.c
create mode 100644 hw/vhost_net.h
diff --git a/Makefile.target b/Makefile.target
index 0c844a9..2ebd30c 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -168,6 +168,7 @@ obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o
# need to fix this properly
obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
obj-y += notifier.o
+obj-y += vhost_net.o vhost.o
obj-$(CONFIG_KVM) += kvm.o kvm-all.o
# MSI-X depends on kvm for interrupt injection,
# so moved it from Makefile.hw to Makefile.target for now
diff --git a/hw/vhost.c b/hw/vhost.c
new file mode 100644
index 0000000..e5c1ead
--- /dev/null
+++ b/hw/vhost.c
@@ -0,0 +1,603 @@
+#include "linux/vhost.h"
+#include <sys/ioctl.h>
+#include <sys/eventfd.h>
+#include "vhost.h"
+#include "hw/hw.h"
+/* For range_get_last */
+#include "pci.h"
+
+static void vhost_dev_sync_region(struct vhost_dev *dev,
+ uint64_t mfirst, uint64_t mlast,
+ uint64_t rfirst, uint64_t rlast)
+{
+ uint64_t start = MAX(mfirst, rfirst);
+ uint64_t end = MIN(mlast, rlast);
+ vhost_log_chunk_t *from = dev->log + start / VHOST_LOG_CHUNK;
+ vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1;
+ uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
+
+ assert(end / VHOST_LOG_CHUNK < dev->log_size);
+ assert(start / VHOST_LOG_CHUNK < dev->log_size);
+ if (end < start) {
+ return;
+ }
+ for (;from < to; ++from) {
+ vhost_log_chunk_t log;
+ int bit;
+ /* We first check with non-atomic: much cheaper,
+ * and we expect non-dirty to be the common case. */
+ if (!*from) {
+ continue;
+ }
+ /* Data must be read atomically. We don't really
+ * need the barrier semantics of __sync
+ * builtins, but it's easier to use them than
+ * roll our own. */
+ log = __sync_fetch_and_and(from, 0);
+ while ((bit = sizeof(log) > sizeof(int) ?
+ ffsll(log) : ffs(log))) {
+ bit -= 1;
+ cpu_physical_memory_set_dirty(addr + bit * VHOST_LOG_PAGE);
+ log &= ~(0x1ull << bit);
+ }
+ addr += VHOST_LOG_CHUNK;
+ }
+}
+
+static int vhost_client_sync_dirty_bitmap(struct CPUPhysMemoryClient *client,
+ target_phys_addr_t start_addr,
+ target_phys_addr_t end_addr)
+{
+ struct vhost_dev *dev = container_of(client, struct vhost_dev, client);
+ int i;
+ if (!dev->log_enabled || !dev->started) {
+ return 0;
+ }
+ for (i = 0; i < dev->mem->nregions; ++i) {
+ struct vhost_memory_region *reg = dev->mem->regions + i;
+ vhost_dev_sync_region(dev, start_addr, end_addr,
+ reg->guest_phys_addr,
+ range_get_last(reg->guest_phys_addr,
+ reg->memory_size));
+ }
+ for (i = 0; i < dev->nvqs; ++i) {
+ struct vhost_virtqueue *vq = dev->vqs + i;
+ unsigned size = sizeof(struct vring_used_elem) * vq->num;
+ vhost_dev_sync_region(dev, start_addr, end_addr, vq->used_phys,
+ range_get_last(vq->used_phys, size));
+ }
+ return 0;
+}
+
+/* Assign/unassign. Keep an unsorted array of non-overlapping
+ * memory regions in dev->mem. */
+static void vhost_dev_unassign_memory(struct vhost_dev *dev,
+ uint64_t start_addr,
+ uint64_t size)
+{
+ int from, to, n = dev->mem->nregions;
+ /* Track overlapping/split regions for sanity checking. */
+ int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
+
+ for (from = 0, to = 0; from < n; ++from, ++to) {
+ struct vhost_memory_region *reg = dev->mem->regions + to;
+ uint64_t reglast;
+ uint64_t memlast;
+ uint64_t change;
+
+ /* clone old region */
+ if (to != from) {
+ memcpy(reg, dev->mem->regions + from, sizeof *reg);
+ }
+
+ /* No overlap is simple */
+ if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
+ start_addr, size)) {
+ continue;
+ }
+
+ /* Split only happens if supplied region
+ * is in the middle of an existing one. Thus it can not
+ * overlap with any other existing region. */
+ assert(!split);
+
+ reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
+ memlast = range_get_last(start_addr, size);
+
+ /* Remove whole region */
+ if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
+ --dev->mem->nregions;
+ --to;
+ assert(to >= 0);
+ ++overlap_middle;
+ continue;
+ }
+
+ /* Shrink region */
+ if (memlast >= reglast) {
+ reg->memory_size = start_addr - reg->guest_phys_addr;
+ assert(reg->memory_size);
+ assert(!overlap_end);
+ ++overlap_end;
+ continue;
+ }
+
+ /* Shift region */
+ if (start_addr <= reg->guest_phys_addr) {
+ change = memlast + 1 - reg->guest_phys_addr;
+ reg->memory_size -= change;
+ reg->guest_phys_addr += change;
+ reg->userspace_addr += change;
+ assert(reg->memory_size);
+ assert(!overlap_start);
+ ++overlap_start;
+ continue;
+ }
+
+ /* This only happens if supplied region
+ * is in the middle of an existing one. Thus it can not
+ * overlap with any other existing region. */
+ assert(!overlap_start);
+ assert(!overlap_end);
+ assert(!overlap_middle);
+ /* Split region: shrink first part, shift second part. */
+ memcpy(dev->mem->regions + n, reg, sizeof *reg);
+ reg->memory_size = start_addr - reg->guest_phys_addr;
+ assert(reg->memory_size);
+ change = memlast + 1 - reg->guest_phys_addr;
+ reg = dev->mem->regions + n;
+ reg->memory_size -= change;
+ assert(reg->memory_size);
+ reg->guest_phys_addr += change;
+ reg->userspace_addr += change;
+ /* Never add more than 1 region */
+ assert(dev->mem->nregions == n);
+ ++dev->mem->nregions;
+ ++split;
+ }
+}
+
+/* Called after unassign, so no regions overlap the given range. */
+static void vhost_dev_assign_memory(struct vhost_dev *dev,
+ uint64_t start_addr,
+ uint64_t size,
+ uint64_t uaddr)
+{
+ int from, to;
+ struct vhost_memory_region *merged = NULL;
+ for (from = 0, to = 0; from < dev->mem->nregions; ++from, ++to) {
+ struct vhost_memory_region *reg = dev->mem->regions + to;
+ uint64_t prlast, urlast;
+ uint64_t pmlast, umlast;
+ uint64_t s, e, u;
+
+ /* clone old region */
+ if (to != from) {
+ memcpy(reg, dev->mem->regions + from, sizeof *reg);
+ }
+ prlast = range_get_last(reg->guest_phys_addr, reg->memory_size);
+ pmlast = range_get_last(start_addr, size);
+ urlast = range_get_last(reg->userspace_addr, reg->memory_size);
+ umlast = range_get_last(uaddr, size);
+
+ /* check for overlapping regions: should never happen. */
+ assert(prlast < start_addr || pmlast < reg->guest_phys_addr);
+ /* Not an adjacent or overlapping region - do not merge. */
+ if ((prlast + 1 != start_addr || urlast + 1 != uaddr) &&
+ (pmlast + 1 != reg->guest_phys_addr ||
+ umlast + 1 != reg->userspace_addr)) {
+ continue;
+ }
+
+ if (merged) {
+ --to;
+ assert(to >= 0);
+ } else {
+ merged = reg;
+ }
+ u = MIN(uaddr, reg->userspace_addr);
+ s = MIN(start_addr, reg->guest_phys_addr);
+ e = MAX(pmlast, prlast);
+ uaddr = merged->userspace_addr = u;
+ start_addr = merged->guest_phys_addr = s;
+ size = merged->memory_size = e - s + 1;
+ assert(merged->memory_size);
+ }
+
+ if (!merged) {
+ struct vhost_memory_region *reg = dev->mem->regions + to;
+ memset(reg, 0, sizeof *reg);
+ reg->memory_size = size;
+ assert(reg->memory_size);
+ reg->guest_phys_addr = start_addr;
+ reg->userspace_addr = uaddr;
+ ++to;
+ }
+ assert(to <= dev->mem->nregions + 1);
+ dev->mem->nregions = to;
+}
+
+static uint64_t vhost_get_log_size(struct vhost_dev *dev)
+{
+ uint64_t log_size = 0;
+ int i;
+ for (i = 0; i < dev->mem->nregions; ++i) {
+ struct vhost_memory_region *reg = dev->mem->regions + i;
+ uint64_t last = range_get_last(reg->guest_phys_addr,
+ reg->memory_size);
+ log_size = MAX(log_size, last / VHOST_LOG_CHUNK + 1);
+ }
+ for (i = 0; i < dev->nvqs; ++i) {
+ struct vhost_virtqueue *vq = dev->vqs + i;
+ uint64_t last = vq->used_phys +
+ sizeof(struct vring_used_elem) * vq->num - 1;
+ log_size = MAX(log_size, last / VHOST_LOG_CHUNK + 1);
+ }
+ return log_size;
+}
+
+static inline void vhost_dev_log_resize(struct vhost_dev* dev, uint64_t size)
+{
+ vhost_log_chunk_t *log;
+ int r;
+ if (size) {
+ log = qemu_mallocz(size * sizeof *log);
+ } else {
+ log = NULL;
+ }
+ r = ioctl(dev->control, VHOST_SET_LOG_BASE,
+ (uint64_t)(unsigned long)log);
+ assert(r >= 0);
+ vhost_client_sync_dirty_bitmap(&dev->client, 0,
+ (target_phys_addr_t)~0x0ull);
+ if (dev->log) {
+ qemu_free(dev->log);
+ }
+ dev->log = log;
+ dev->log_size = size;
+}
+
+static void vhost_client_set_memory(CPUPhysMemoryClient *client,
+ target_phys_addr_t start_addr,
+ ram_addr_t size,
+ ram_addr_t phys_offset)
+{
+ struct vhost_dev *dev = container_of(client, struct vhost_dev, client);
+ ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK;
+ int s = offsetof(struct vhost_memory, regions) +
+ (dev->mem->nregions + 1) * sizeof dev->mem->regions[0];
+ uint64_t log_size;
+ int r;
+ dev->mem = qemu_realloc(dev->mem, s);
+
+ assert(size);
+
+ vhost_dev_unassign_memory(dev, start_addr, size);
+ if (flags == IO_MEM_RAM) {
+ /* Add given mapping, merging adjacent regions if any */
+ vhost_dev_assign_memory(dev, start_addr, size,
+ (uintptr_t)qemu_get_ram_ptr(phys_offset));
+ } else {
+ /* Remove old mapping for this memory, if any. */
+ vhost_dev_unassign_memory(dev, start_addr, size);
+ }
+
+ if (!dev->started) {
+ return;
+ }
+ if (!dev->log_enabled) {
+ r = ioctl(dev->control, VHOST_SET_MEM_TABLE, dev->mem);
+ assert(r >= 0);
+ return;
+ }
+ log_size = vhost_get_log_size(dev);
+ /* We allocate an extra 4K bytes to log,
+ * to reduce the * number of reallocations. */
+#define VHOST_LOG_BUFFER (0x1000 / sizeof *dev->log)
+ /* To log more, must increase log size before table update. */
+ if (dev->log_size < log_size) {
+ vhost_dev_log_resize(dev, log_size + VHOST_LOG_BUFFER);
+ }
+ r = ioctl(dev->control, VHOST_SET_MEM_TABLE, dev->mem);
+ assert(r >= 0);
+ /* To log less, can only decrease log size after table update. */
+ if (dev->log_size > log_size + VHOST_LOG_BUFFER) {
+ vhost_dev_log_resize(dev, log_size);
+ }
+}
+
+static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
+{
+ uint64_t features = dev->acked_features;
+ int r;
+ if (dev->log_enabled) {
+ features |= 0x1 << VHOST_F_LOG_ALL;
+ }
+ r = ioctl(dev->control, VHOST_SET_FEATURES, &features);
+ return r < 0 ? -errno : 0;
+}
+
+static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
+ int enable)
+{
+ struct vhost_dev *dev = container_of(client, struct vhost_dev, client);
+ int r;
+ if (!!enable == dev->log_enabled) {
+ return 0;
+ }
+ if (!dev->started) {
+ dev->log_enabled = enable;
+ return 0;
+ }
+ if (!enable) {
+ r = vhost_dev_set_log(dev, false);
+ if (r < 0) {
+ return r;
+ }
+ if (dev->log) {
+ qemu_free(dev->log);
+ }
+ dev->log = NULL;
+ dev->log_size = 0;
+ } else {
+ vhost_dev_log_resize(dev, vhost_get_log_size(dev));
+ r = vhost_dev_set_log(dev, false);
+ if (r < 0) {
+ return r;
+ }
+ }
+ dev->log_enabled = enable;
+ return 0;
+}
+
+static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
+ struct vhost_virtqueue *vq,
+ unsigned idx, bool enable_log)
+{
+ struct vhost_vring_addr addr = {
+ .index = idx,
+ .desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
+ .avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
+ .used_user_addr = (u_int64_t)(unsigned long)vq->used,
+ .log_guest_addr = vq->used_phys,
+ .flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
+ };
+ int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
+ if (r < 0) {
+ return -errno;
+ }
+ return 0;
+}
+
+static int vhost_virtqueue_init(struct vhost_dev *dev,
+ struct VirtIODevice *vdev,
+ struct vhost_virtqueue *vq,
+ unsigned idx)
+{
+ target_phys_addr_t s, l, a;
+ int r;
+ struct vhost_vring_file file = {
+ .index = idx,
+ };
+ struct vhost_vring_state state = {
+ .index = idx,
+ };
+ struct VirtQueue *q = virtio_queue(vdev, idx);
+
+ vq->num = state.num = virtio_queue_get_num(vdev, idx);
+ r = ioctl(dev->control, VHOST_SET_VRING_NUM, &state);
+ if (r) {
+ return -errno;
+ }
+
+ state.num = virtio_queue_last_avail_idx(vdev, idx);
+ r = ioctl(dev->control, VHOST_SET_VRING_BASE, &state);
+ if (r) {
+ return -errno;
+ }
+
+ s = l = sizeof(struct vring_desc) * vq->num;
+ a = virtio_queue_get_desc(vdev, idx);
+ vq->desc = cpu_physical_memory_map(a, &l, 0);
+ if (!vq->desc || l != s) {
+ r = -ENOMEM;
+ goto fail_alloc;
+ }
+ s = l = offsetof(struct vring_avail, ring) +
+ sizeof(u_int64_t) * vq->num;
+ a = virtio_queue_get_avail(vdev, idx);
+ vq->avail = cpu_physical_memory_map(a, &l, 0);
+ if (!vq->avail || l != s) {
+ r = -ENOMEM;
+ goto fail_alloc;
+ }
+ s = l = offsetof(struct vring_used, ring) +
+ sizeof(struct vring_used_elem) * vq->num;
+ vq->used_phys = a = virtio_queue_get_used(vdev, idx);
+ vq->used = cpu_physical_memory_map(a, &l, 1);
+ if (!vq->used || l != s) {
+ r = -ENOMEM;
+ goto fail_alloc;
+ }
+
+ r = vhost_virtqueue_set_addr(dev, vq, idx, dev->log_enabled);
+ if (r < 0) {
+ r = -errno;
+ goto fail_alloc;
+ }
+ if (!vdev->binding->guest_notifier || !vdev->binding->host_notifier) {
+ fprintf(stderr, "binding does not support irqfd/queuefd\n");
+ r = -ENOSYS;
+ goto fail_alloc;
+ }
+ r = vdev->binding->guest_notifier(vdev->binding_opaque, idx, true);
+ if (r < 0) {
+ fprintf(stderr, "Error binding guest notifier: %d\n", -r);
+ goto fail_guest_notifier;
+ }
+
+ r = vdev->binding->host_notifier(vdev->binding_opaque, idx, true);
+ if (r < 0) {
+ fprintf(stderr, "Error binding host notifier: %d\n", -r);
+ goto fail_host_notifier;
+ }
+
+ file.fd = event_notifier_get_fd(virtio_queue_host_notifier(q));
+ r = ioctl(dev->control, VHOST_SET_VRING_KICK, &file);
+ if (r) {
+ goto fail_kick;
+ }
+
+ file.fd = event_notifier_get_fd(virtio_queue_guest_notifier(q));
+ r = ioctl(dev->control, VHOST_SET_VRING_CALL, &file);
+ if (r) {
+ goto fail_call;
+ }
+
+ return 0;
+
+fail_call:
+fail_kick:
+ vdev->binding->host_notifier(vdev->binding_opaque, idx, false);
+fail_host_notifier:
+ vdev->binding->guest_notifier(vdev->binding_opaque, idx, false);
+fail_guest_notifier:
+fail_alloc:
+ return r;
+}
+
+static void vhost_virtqueue_cleanup(struct vhost_dev *dev,
+ struct VirtIODevice *vdev,
+ struct vhost_virtqueue *vq,
+ unsigned idx)
+{
+ struct vhost_vring_state state = {
+ .index = idx,
+ };
+ int r;
+ r = vdev->binding->guest_notifier(vdev->binding_opaque, idx, false);
+ if (r < 0) {
+ fprintf(stderr, "vhost VQ %d guest cleanup failed: %d\n", idx, r);
+ fflush(stderr);
+ }
+ assert (r >= 0);
+
+ r = vdev->binding->host_notifier(vdev->binding_opaque, idx, false);
+ if (r < 0) {
+ fprintf(stderr, "vhost VQ %d host cleanup failed: %d\n", idx, r);
+ fflush(stderr);
+ }
+ assert (r >= 0);
+ r = ioctl(dev->control, VHOST_GET_VRING_BASE, &state);
+ if (r < 0) {
+ fprintf(stderr, "vhost VQ %d ring restore failed: %d\n", idx, r);
+ fflush(stderr);
+ }
+ virtio_queue_set_last_avail_idx(vdev, idx, state.num);
+ assert (r >= 0);
+}
+
+int vhost_dev_init(struct vhost_dev *hdev, int devfd)
+{
+ uint64_t features;
+ int r;
+ if (devfd >= 0) {
+ hdev->control = devfd;
+ } else {
+ hdev->control = open("/dev/vhost-net", O_RDWR);
+ if (hdev->control < 0)
+ return -errno;
+ }
+ r = ioctl(hdev->control, VHOST_SET_OWNER, NULL);
+ if (r < 0)
+ goto fail;
+
+ r = ioctl(hdev->control, VHOST_GET_FEATURES, &features);
+ if (r < 0)
+ goto fail;
+ hdev->features = features;
+
+ hdev->client.set_memory = vhost_client_set_memory;
+ hdev->client.sync_dirty_bitmap = vhost_client_sync_dirty_bitmap;
+ hdev->client.migration_log = vhost_client_migration_log;
+ hdev->mem = qemu_mallocz(offsetof(struct vhost_memory, regions));
+ hdev->log = NULL;
+ hdev->log_size = 0;
+ hdev->log_enabled = false;
+ hdev->started = false;
+ cpu_register_phys_memory_client(&hdev->client);
+ return 0;
+fail:
+ r = -errno;
+ close(hdev->control);
+ return r;
+}
+
+void vhost_dev_cleanup(struct vhost_dev *hdev)
+{
+ cpu_unregister_phys_memory_client(&hdev->client);
+ qemu_free(hdev->mem);
+ close(hdev->control);
+}
+
+int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
+{
+ int i, r;
+
+ r = vhost_dev_set_log(hdev, hdev->log_enabled);
+ if (r < 0)
+ goto fail;
+ r = ioctl(hdev->control, VHOST_SET_MEM_TABLE, hdev->mem);
+ if (r < 0) {
+ r = -errno;
+ goto fail;
+ }
+ if (hdev->log_enabled) {
+ hdev->log_size = vhost_get_log_size(hdev);
+ hdev->log = hdev->log_size ?
+ qemu_mallocz(hdev->log_size * sizeof *hdev->log) : NULL;
+ r = ioctl(hdev->control, VHOST_SET_LOG_BASE,
+ (uint64_t)(unsigned long)hdev->log);
+ if (r < 0) {
+ r = -errno;
+ goto fail;
+ }
+ }
+
+ for (i = 0; i < hdev->nvqs; ++i) {
+ r = vhost_virtqueue_init(hdev,
+ vdev,
+ hdev->vqs + i,
+ i);
+ if (r < 0)
+ goto fail_vq;
+ }
+ hdev->started = true;
+
+ return 0;
+fail_vq:
+ while (--i >= 0) {
+ vhost_virtqueue_cleanup(hdev,
+ vdev,
+ hdev->vqs + i,
+ i);
+ }
+fail:
+ return r;
+}
+
+void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
+{
+ int i;
+ for (i = 0; i < hdev->nvqs; ++i) {
+ vhost_virtqueue_cleanup(hdev,
+ vdev,
+ hdev->vqs + i,
+ i);
+ }
+ vhost_client_sync_dirty_bitmap(&hdev->client, 0,
+ (target_phys_addr_t)~0x0ull);
+ hdev->started = false;
+ qemu_free(hdev->log);
+ hdev->log_size = 0;
+}
diff --git a/hw/vhost.h b/hw/vhost.h
new file mode 100644
index 0000000..2ed3933
--- /dev/null
+++ b/hw/vhost.h
@@ -0,0 +1,44 @@
+#ifndef VHOST_H
+#define VHOST_H
+
+#include "hw/hw.h"
+#include "hw/virtio.h"
+
+/* Generic structures common for any vhost based device. */
+struct vhost_virtqueue {
+ int kick;
+ int call;
+ void *desc;
+ void *avail;
+ void *used;
+ int num;
+ unsigned long long used_phys;
+};
+
+typedef unsigned long vhost_log_chunk_t;
+#define VHOST_LOG_PAGE 0x1000
+#define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
+#define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
+
+struct vhost_memory;
+struct vhost_dev {
+ CPUPhysMemoryClient client;
+ int control;
+ struct vhost_memory *mem;
+ struct vhost_virtqueue *vqs;
+ int nvqs;
+ unsigned long long features;
+ unsigned long long acked_features;
+ unsigned long long backend_features;
+ bool started;
+ bool log_enabled;
+ vhost_log_chunk_t *log;
+ unsigned long long log_size;
+};
+
+int vhost_dev_init(struct vhost_dev *hdev, int devfd);
+void vhost_dev_cleanup(struct vhost_dev *hdev);
+int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
+void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
+
+#endif
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
new file mode 100644
index 0000000..c89ff40
--- /dev/null
+++ b/hw/vhost_net.c
@@ -0,0 +1,147 @@
+#include <sys/eventfd.h>
+#include <sys/socket.h>
+#include <linux/kvm.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/vhost.h>
+#include <linux/virtio_ring.h>
+#include <netpacket/packet.h>
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <netinet/in.h>
+
+#include <stdio.h>
+
+#include "net.h"
+#include "net/tap.h"
+
+#include "virtio-net.h"
+#include "vhost.h"
+#include "vhost_net.h"
+
+struct vhost_net {
+ struct vhost_dev dev;
+ struct vhost_virtqueue vqs[2];
+ int backend;
+ VLANClientState *vc;
+};
+
+unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
+{
+ /* Clear features not supported by host kernel. */
+ if (!(net->dev.features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)))
+ features &= ~(1 << VIRTIO_F_NOTIFY_ON_EMPTY);
+ if (!(net->dev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)))
+ features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
+ if (!(net->dev.features & (1 << VIRTIO_NET_F_MRG_RXBUF)))
+ features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
+ return features;
+}
+
+void vhost_net_ack_features(struct vhost_net *net, unsigned features)
+{
+ net->dev.acked_features = net->dev.backend_features;
+ if (features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY))
+ net->dev.acked_features |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
+ if (features & (1 << VIRTIO_RING_F_INDIRECT_DESC))
+ net->dev.acked_features |= (1 << VIRTIO_RING_F_INDIRECT_DESC);
+}
+
+static int vhost_net_get_fd(VLANClientState *backend)
+{
+ switch (backend->info->type) {
+ case NET_CLIENT_TYPE_TAP:
+ return tap_get_fd(backend);
+ default:
+ fprintf(stderr, "vhost-net requires tap backend\n");
+ return -EBADFD;
+ }
+}
+
+struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
+{
+ int r;
+ struct vhost_net *net = qemu_malloc(sizeof *net);
+ if (!backend) {
+ fprintf(stderr, "vhost-net requires backend to be setup\n");
+ goto fail;
+ }
+ r = vhost_net_get_fd(backend);
+ if (r < 0)
+ goto fail;
+ net->vc = backend;
+ net->dev.backend_features = tap_has_vnet_hdr(backend) ? 0 :
+ (1 << VHOST_NET_F_VIRTIO_NET_HDR);
+ net->backend = r;
+
+ r = vhost_dev_init(&net->dev, devfd);
+ if (r < 0)
+ goto fail;
+ if (~net->dev.features & net->dev.backend_features) {
+ fprintf(stderr, "vhost lacks feature mask %llu for backend\n",
+ ~net->dev.features & net->dev.backend_features);
+ vhost_dev_cleanup(&net->dev);
+ goto fail;
+ }
+
+ /* Set sane init value. Override when guest acks. */
+ vhost_net_ack_features(net, 0);
+ return net;
+fail:
+ qemu_free(net);
+ return NULL;
+}
+
+int vhost_net_start(struct vhost_net *net,
+ VirtIODevice *dev)
+{
+ struct vhost_vring_file file = { };
+ int r;
+
+ net->dev.nvqs = 2;
+ net->dev.vqs = net->vqs;
+ r = vhost_dev_start(&net->dev, dev);
+ if (r < 0)
+ return r;
+
+ net->vc->info->poll(net->vc, false);
+ qemu_set_fd_handler(net->backend, NULL, NULL, NULL);
+ file.fd = net->backend;
+ for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
+ r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
+ if (r < 0) {
+ r = -errno;
+ goto fail;
+ }
+ }
+ return 0;
+fail:
+ file.fd = -1;
+ while (--file.index >= 0) {
+ int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
+ assert(r >= 0);
+ }
+ net->vc->info->poll(net->vc, true);
+ vhost_dev_stop(&net->dev, dev);
+ return r;
+}
+
+void vhost_net_stop(struct vhost_net *net,
+ VirtIODevice *dev)
+{
+ struct vhost_vring_file file = { .fd = -1 };
+
+ for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
+ int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
+ assert(r >= 0);
+ }
+ net->vc->info->poll(net->vc, true);
+ vhost_dev_stop(&net->dev, dev);
+}
+
+void vhost_net_cleanup(struct vhost_net *net)
+{
+ vhost_dev_cleanup(&net->dev);
+ qemu_free(net);
+}
+/* TODO: log */
diff --git a/hw/vhost_net.h b/hw/vhost_net.h
new file mode 100644
index 0000000..21f0277
--- /dev/null
+++ b/hw/vhost_net.h
@@ -0,0 +1,20 @@
+#ifndef VHOST_NET_H
+#define VHOST_NET_H
+
+#include "net.h"
+
+struct vhost_net;
+
+struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd);
+
+int vhost_net_start(struct vhost_net *net,
+ VirtIODevice *dev);
+void vhost_net_stop(struct vhost_net *net,
+ VirtIODevice *dev);
+
+void vhost_net_cleanup(struct vhost_net *net);
+
+unsigned vhost_net_get_features(struct vhost_net *net, unsigned features);
+void vhost_net_ack_features(struct vhost_net *net, unsigned features);
+
+#endif
--
1.6.6.144.g5c3af

View File

@ -1,47 +0,0 @@
From c11631e8bc91a1d1be2b89196e886a1385820dfb Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:51 +0530
Subject: [PATCH 1/9] virtio: Remove duplicate macro definition for max. virtqueues, bump up the max
VIRTIO_PCI_QUEUE_MAX is redefined in hw/virtio.c. Let's just keep it in
hw/virtio.h.
Also, bump up the value of the maximum allowed virtqueues to 64. This is
in preparation to allow multiple ports per virtio-console device.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio.c | 2 --
hw/virtio.h | 2 +-
2 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/hw/virtio.c b/hw/virtio.c
index cecd0dc..88f4e78 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -75,8 +75,6 @@ struct VirtQueue
void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq);
};
-#define VIRTIO_PCI_QUEUE_MAX 16
-
/* virt queue functions */
static void virtqueue_init(VirtQueue *vq)
{
diff --git a/hw/virtio.h b/hw/virtio.h
index 35532a6..051910a 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -90,7 +90,7 @@ typedef struct {
unsigned (*get_features)(void * opaque);
} VirtIOBindings;
-#define VIRTIO_PCI_QUEUE_MAX 16
+#define VIRTIO_PCI_QUEUE_MAX 64
#define VIRTIO_NO_VECTOR 0xffff
--
1.6.2.5

View File

@ -1,111 +0,0 @@
vhost needs physical addresses for ring and other queue fields,
so add APIs for these.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
hw/virtio.h | 10 +++++++++-
2 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/hw/virtio.c b/hw/virtio.c
index c2b80aa..b16ee1a 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -73,6 +73,9 @@ struct VirtQueue
int inuse;
uint16_t vector;
void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq);
+ VirtIODevice *vdev;
+ EventNotifier guest_notifier;
+ EventNotifier host_notifier;
};
/* virt queue functions */
@@ -594,10 +597,10 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
return &vdev->vq[i];
}
-void virtio_irq(VirtIODevice *vdev, VirtQueue *vq)
+void virtio_irq(VirtQueue *vq)
{
- vdev->isr |= 0x01;
- virtio_notify_vector(vdev, vq->vector);
+ vq->vdev->isr |= 0x01;
+ virtio_notify_vector(vq->vdev, vq->vector);
}
void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
@@ -608,7 +611,8 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
(vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx)))
return;
- virtio_irq(vdev, vq);
+ vdev->isr |= 0x01;
+ virtio_notify_vector(vdev, vq->vector);
}
void virtio_notify_config(VirtIODevice *vdev)
@@ -742,3 +746,42 @@ void virtio_bind_device(VirtIODevice *vdev, const VirtIOBindings *binding,
vdev->binding = binding;
vdev->binding_opaque = opaque;
}
+
+target_phys_addr_t virtio_queue_get_desc(VirtIODevice *vdev, int n)
+{
+ return vdev->vq[n].vring.desc;
+}
+
+target_phys_addr_t virtio_queue_get_avail(VirtIODevice *vdev, int n)
+{
+ return vdev->vq[n].vring.avail;
+}
+
+target_phys_addr_t virtio_queue_get_used(VirtIODevice *vdev, int n)
+{
+ return vdev->vq[n].vring.used;
+}
+
+uint16_t virtio_queue_last_avail_idx(VirtIODevice *vdev, int n)
+{
+ return vdev->vq[n].last_avail_idx;
+}
+
+void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx)
+{
+ vdev->vq[n].last_avail_idx = idx;
+}
+
+VirtQueue *virtio_queue(VirtIODevice *vdev, int n)
+{
+ return vdev->vq + n;
+}
+
+EventNotifier *virtio_queue_guest_notifier(VirtQueue *vq)
+{
+ return &vq->guest_notifier;
+}
+EventNotifier *virtio_queue_host_notifier(VirtQueue *vq)
+{
+ return &vq->host_notifier;
+}
diff --git a/hw/virtio.h b/hw/virtio.h
index 10a0959..f140ca3 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -183,5 +183,13 @@ void virtio_net_exit(VirtIODevice *vdev);
DEFINE_PROP_BIT("indirect_desc", _state, _field, \
VIRTIO_RING_F_INDIRECT_DESC, true)
-void virtio_irq(VirtIODevice *vdev, VirtQueue *vq);
+target_phys_addr_t virtio_queue_get_desc(VirtIODevice *vdev, int n);
+target_phys_addr_t virtio_queue_get_avail(VirtIODevice *vdev, int n);
+target_phys_addr_t virtio_queue_get_used(VirtIODevice *vdev, int n);
+uint16_t virtio_queue_last_avail_idx(VirtIODevice *vdev, int n);
+void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx);
+VirtQueue *virtio_queue(VirtIODevice *vdev, int n);
+EventNotifier *virtio_queue_guest_notifier(VirtQueue *vq);
+EventNotifier *virtio_queue_host_notifier(VirtQueue *vq);
+void virtio_irq(VirtQueue *vq);
#endif
--
1.6.6.144.g5c3af

View File

@ -1,400 +0,0 @@
Add feature bits as properties to virtio. This makes it possible to e.g. define
machine without indirect buffer support, which is required for 0.10
compatibility, or without hardware checksum support, which is required for 0.11
compatibility. Since default values for optional features are now set by qdev,
get_features callback has been modified: it sets non-optional bits, and clears
bits not supported by host.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 8172539d21a03e982aa7f139ddc1607dc1422045)
---
hw/s390-virtio-bus.c | 12 +++++++++---
hw/s390-virtio-bus.h | 1 +
hw/syborg_virtio.c | 13 ++++++++-----
hw/virtio-balloon.c | 4 ++--
hw/virtio-blk.c | 6 +-----
hw/virtio-blk.h | 8 ++++++++
hw/virtio-net.c | 39 ++++++++++++++++-----------------------
hw/virtio-net.h | 20 ++++++++++++++++++++
hw/virtio-pci.c | 25 +++++++++++++++++--------
hw/virtio.c | 2 +-
hw/virtio.h | 7 ++++++-
12 files changed, 91 insertions(+), 50 deletions(-)
--- a/hw/s390-virtio-bus.c 2010-02-09 00:18:58.000000000 -0600
+++ b/hw/s390-virtio-bus.c 2010-02-09 00:02:12.000000000 -0600
@@ -101,6 +101,7 @@ static int s390_virtio_device_init(VirtI
bus->dev_offs += dev_len;
virtio_bind_device(vdev, &virtio_s390_bindings, dev);
+ dev->host_features = vdev->get_features(vdev, dev->host_features);
s390_virtio_device_sync(dev);
return 0;
@@ -222,9 +223,7 @@ static void s390_virtio_device_sync(Virt
cur_offs += num_vq * VIRTIO_VQCONFIG_LEN;
/* Sync feature bitmap */
- if (dev->vdev->get_features) {
- stl_phys(cur_offs, dev->vdev->get_features(dev->vdev));
- }
+ stl_phys(cur_offs, dev->host_features);
dev->feat_offs = cur_offs + dev->feat_len;
cur_offs += dev->feat_len * 2;
@@ -310,10 +309,17 @@ static void virtio_s390_notify(void *opa
kvm_s390_virtio_irq(s390_cpu_addr2state(0), 0, token);
}
+static unsigned virtio_s390_get_features(void *opaque)
+{
+ VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
+ return dev->host_features;
+}
+
/**************** S390 Virtio Bus Device Descriptions *******************/
static const VirtIOBindings virtio_s390_bindings = {
.notify = virtio_s390_notify,
+ .get_features = virtio_s390_get_features,
};
static VirtIOS390DeviceInfo s390_virtio_net = {
--- a/hw/s390-virtio-bus.h 2010-02-09 00:18:58.000000000 -0600
+++ b/s390-virtio-bus.h 2010-02-09 00:18:16.000000000 -0600
@@ -40,6 +40,7 @@ typedef struct VirtIOS390Device {
VirtIODevice *vdev;
DriveInfo *dinfo;
NICConf nic;
+ uint32_t host_features;
/* Max. number of ports we can have for a the virtio-serial device */
uint32_t max_virtserial_ports;
} VirtIOS390Device;
--- a/hw/syborg_virtio.c 2010-02-09 00:18:58.000000000 -0600
+++ b/hw/syborg_virtio.c 2010-02-09 00:02:12.000000000 -0600
@@ -25,6 +25,7 @@
#include "syborg.h"
#include "sysbus.h"
#include "virtio.h"
+#include "virtio-net.h"
#include "sysemu.h"
//#define DEBUG_SYBORG_VIRTIO
@@ -66,6 +67,7 @@ typedef struct {
uint32_t int_enable;
uint32_t id;
NICConf nic;
+ uint32_t host_features;
} SyborgVirtIOProxy;
static uint32_t syborg_virtio_readl(void *opaque, target_phys_addr_t offset)
@@ -86,8 +88,7 @@ static uint32_t syborg_virtio_readl(void
ret = s->id;
break;
case SYBORG_VIRTIO_HOST_FEATURES:
- ret = vdev->get_features(vdev);
- ret |= vdev->binding->get_features(s);
+ ret = s->host_features;
break;
case SYBORG_VIRTIO_GUEST_FEATURES:
ret = vdev->guest_features;
@@ -244,9 +245,8 @@ static void syborg_virtio_update_irq(voi
static unsigned syborg_virtio_get_features(void *opaque)
{
- unsigned ret = 0;
- ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
- return ret;
+ SyborgVirtIOProxy *proxy = opaque;
+ return proxy->host_features;
}
static VirtIOBindings syborg_virtio_bindings = {
@@ -272,6 +272,8 @@ static int syborg_virtio_init(SyborgVirt
qemu_register_reset(virtio_reset, vdev);
virtio_bind_device(vdev, &syborg_virtio_bindings, proxy);
+ proxy->host_features |= (0x1 << VIRTIO_F_NOTIFY_ON_EMPTY);
+ proxy->host_features = vdev->get_features(vdev, proxy->host_features);
return 0;
}
@@ -292,6 +294,7 @@ static SysBusDeviceInfo syborg_virtio_ne
.qdev.size = sizeof(SyborgVirtIOProxy),
.qdev.props = (Property[]) {
DEFINE_NIC_PROPERTIES(SyborgVirtIOProxy, nic),
+ DEFINE_VIRTIO_NET_FEATURES(SyborgVirtIOProxy, host_features),
DEFINE_PROP_END_OF_LIST(),
}
};
--- a/hw/virtio-balloon.c 2010-01-18 12:48:25.000000000 -0600
+++ b/hw/virtio-balloon.c 2010-02-09 00:02:12.000000000 -0600
@@ -125,9 +125,9 @@ static void virtio_balloon_set_config(Vi
dev->actual = config.actual;
}
-static uint32_t virtio_balloon_get_features(VirtIODevice *vdev)
+static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
{
- return 0;
+ return f;
}
static ram_addr_t virtio_balloon_to_target(void *opaque, ram_addr_t target)
--- a/hw/virtio-blk.c 2010-01-18 12:48:25.000000000 -0600
+++ b/hw/virtio-blk.c 2010-02-09 00:02:12.000000000 -0600
@@ -432,19 +432,15 @@ static void virtio_blk_update_config(Vir
memcpy(config, &blkcfg, s->config_size);
}
-static uint32_t virtio_blk_get_features(VirtIODevice *vdev)
+static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features)
{
VirtIOBlock *s = to_virtio_blk(vdev);
- uint32_t features = 0;
features |= (1 << VIRTIO_BLK_F_SEG_MAX);
features |= (1 << VIRTIO_BLK_F_GEOMETRY);
if (bdrv_enable_write_cache(s->bs))
features |= (1 << VIRTIO_BLK_F_WCACHE);
-#ifdef __linux__
- features |= (1 << VIRTIO_BLK_F_SCSI);
-#endif
if (strcmp(s->serial_str, "0"))
features |= 1 << VIRTIO_BLK_F_IDENTIFY;
--- a/hw/virtio-blk.h 2010-01-18 12:48:25.000000000 -0600
+++ b/hw/virtio-blk.h 2010-02-09 00:02:12.000000000 -0600
@@ -92,4 +92,12 @@ struct virtio_scsi_inhdr
uint32_t residual;
};
+#ifdef __linux__
+#define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \
+ DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
+ DEFINE_PROP_BIT("scsi", _state, _field, VIRTIO_BLK_F_SCSI, true)
+#else
+#define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \
+ DEFINE_VIRTIO_COMMON_FEATURES(_state, _field)
+#endif
#endif
--- a/hw/virtio.c 2010-02-09 00:18:58.000000000 -0600
+++ b/hw/virtio.c 2010-02-09 00:02:12.000000000 -0600
@@ -650,7 +650,7 @@ int virtio_load(VirtIODevice *vdev, QEMU
{
int num, i, ret;
uint32_t features;
- uint32_t supported_features = vdev->get_features(vdev) |
+ uint32_t supported_features =
vdev->binding->get_features(vdev->binding_opaque);
if (vdev->binding->load_config) {
--- a/hw/virtio.h 2010-02-09 00:18:58.000000000 -0600
+++ bhw/virtio.h 2010-02-09 00:02:12.000000000 -0600
@@ -105,7 +105,7 @@ struct VirtIODevice
void *config;
uint16_t config_vector;
int nvectors;
- uint32_t (*get_features)(VirtIODevice *vdev);
+ uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features);
uint32_t (*bad_features)(VirtIODevice *vdev);
void (*set_features)(VirtIODevice *vdev, uint32_t val);
void (*get_config)(VirtIODevice *vdev, uint8_t *config);
@@ -176,4 +176,9 @@ VirtIODevice *virtio_balloon_init(Device
void virtio_net_exit(VirtIODevice *vdev);
+#define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \
+ DEFINE_PROP_BIT("indirect_desc", _state, _field, \
+ VIRTIO_RING_F_INDIRECT_DESC, true)
+
+
#endif
--- a/hw/virtio-net.c 2010-02-09 00:18:58.000000000 -0600
+++ b/hw/virtio-net.c 2010-02-09 00:02:12.000000000 -0600
@@ -147,34 +147,27 @@ static int peer_has_ufo(VirtIONet *n)
return n->has_ufo;
}
-static uint32_t virtio_net_get_features(VirtIODevice *vdev)
+static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
{
VirtIONet *n = to_virtio_net(vdev);
- uint32_t features = (1 << VIRTIO_NET_F_MAC) |
- (1 << VIRTIO_NET_F_MRG_RXBUF) |
- (1 << VIRTIO_NET_F_STATUS) |
- (1 << VIRTIO_NET_F_CTRL_VQ) |
- (1 << VIRTIO_NET_F_CTRL_RX) |
- (1 << VIRTIO_NET_F_CTRL_VLAN) |
- (1 << VIRTIO_NET_F_CTRL_RX_EXTRA);
if (peer_has_vnet_hdr(n)) {
tap_using_vnet_hdr(n->nic->nc.peer, 1);
+ } else {
+ features &= ~(0x1 << VIRTIO_NET_F_CSUM);
+ features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO4);
+ features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO6);
+ features &= ~(0x1 << VIRTIO_NET_F_HOST_ECN);
+
+ features &= ~(0x1 << VIRTIO_NET_F_GUEST_CSUM);
+ features &= ~(0x1 << VIRTIO_NET_F_GUEST_TSO4);
+ features &= ~(0x1 << VIRTIO_NET_F_GUEST_TSO6);
+ features &= ~(0x1 << VIRTIO_NET_F_GUEST_ECN);
+ }
- features |= (1 << VIRTIO_NET_F_CSUM);
- features |= (1 << VIRTIO_NET_F_HOST_TSO4);
- features |= (1 << VIRTIO_NET_F_HOST_TSO6);
- features |= (1 << VIRTIO_NET_F_HOST_ECN);
-
- features |= (1 << VIRTIO_NET_F_GUEST_CSUM);
- features |= (1 << VIRTIO_NET_F_GUEST_TSO4);
- features |= (1 << VIRTIO_NET_F_GUEST_TSO6);
- features |= (1 << VIRTIO_NET_F_GUEST_ECN);
-
- if (peer_has_ufo(n)) {
- features |= (1 << VIRTIO_NET_F_GUEST_UFO);
- features |= (1 << VIRTIO_NET_F_HOST_UFO);
- }
+ if (!peer_has_vnet_hdr(n) || !peer_has_ufo(n)) {
+ features &= ~(0x1 << VIRTIO_NET_F_GUEST_UFO);
+ features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);
}
return features;
@@ -192,7 +185,7 @@ static uint32_t virtio_net_bad_features(
features |= (1 << VIRTIO_NET_F_HOST_TSO6);
features |= (1 << VIRTIO_NET_F_HOST_ECN);
- return features & virtio_net_get_features(vdev);
+ return features;
}
static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
--- a/hw/virtio-net.h 2010-01-18 12:48:25.000000000 -0600
+++ b/hw/virtio-net.h 2010-02-09 00:02:12.000000000 -0600
@@ -153,4 +153,24 @@ struct virtio_net_ctrl_mac {
#define VIRTIO_NET_CTRL_VLAN_ADD 0
#define VIRTIO_NET_CTRL_VLAN_DEL 1
+#define DEFINE_VIRTIO_NET_FEATURES(_state, _field) \
+ DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
+ DEFINE_PROP_BIT("csum", _state, _field, VIRTIO_NET_F_CSUM, true), \
+ DEFINE_PROP_BIT("guest_csum", _state, _field, VIRTIO_NET_F_GUEST_CSUM, true), \
+ DEFINE_PROP_BIT("mac", _state, _field, VIRTIO_NET_F_MAC, true), \
+ DEFINE_PROP_BIT("gso", _state, _field, VIRTIO_NET_F_GSO, true), \
+ DEFINE_PROP_BIT("guest_tso4", _state, _field, VIRTIO_NET_F_GUEST_TSO4, true), \
+ DEFINE_PROP_BIT("guest_tso6", _state, _field, VIRTIO_NET_F_GUEST_TSO6, true), \
+ DEFINE_PROP_BIT("guest_ecn", _state, _field, VIRTIO_NET_F_GUEST_ECN, true), \
+ DEFINE_PROP_BIT("guest_ufo", _state, _field, VIRTIO_NET_F_GUEST_UFO, true), \
+ DEFINE_PROP_BIT("host_tso4", _state, _field, VIRTIO_NET_F_HOST_TSO4, true), \
+ DEFINE_PROP_BIT("host_tso6", _state, _field, VIRTIO_NET_F_HOST_TSO6, true), \
+ DEFINE_PROP_BIT("host_ecn", _state, _field, VIRTIO_NET_F_HOST_ECN, true), \
+ DEFINE_PROP_BIT("host_ufo", _state, _field, VIRTIO_NET_F_HOST_UFO, true), \
+ DEFINE_PROP_BIT("mrg_rxbuf", _state, _field, VIRTIO_NET_F_MRG_RXBUF, true), \
+ DEFINE_PROP_BIT("status", _state, _field, VIRTIO_NET_F_STATUS, true), \
+ DEFINE_PROP_BIT("ctrl_vq", _state, _field, VIRTIO_NET_F_CTRL_VQ, true), \
+ DEFINE_PROP_BIT("ctrl_rx", _state, _field, VIRTIO_NET_F_CTRL_RX, true), \
+ DEFINE_PROP_BIT("ctrl_vlan", _state, _field, VIRTIO_NET_F_CTRL_VLAN, true), \
+ DEFINE_PROP_BIT("ctrl_rx_extra", _state, _field, VIRTIO_NET_F_CTRL_RX_EXTRA, true)
#endif
--- a/hw/virtio-pci.c 2010-02-09 00:18:58.000000000 -0600
+++ b/hw/virtio-pci.c 2010-02-09 00:16:13.000000000 -0600
@@ -16,6 +16,8 @@
#include <inttypes.h>
#include "virtio.h"
+#include "virtio-blk.h"
+#include "virtio-net.h"
#include "pci.h"
#include "sysemu.h"
#include "msix.h"
@@ -92,6 +94,7 @@ typedef struct {
uint32_t nvectors;
DriveInfo *dinfo;
NICConf nic;
+ uint32_t host_features;
/* Max. number of ports we can have for a the virtio-serial device */
uint32_t max_virtserial_ports;
} VirtIOPCIProxy;
@@ -177,7 +180,7 @@ static void virtio_ioport_write(void *op
/* Guest does not negotiate properly? We have to assume nothing. */
if (val & (1 << VIRTIO_F_BAD_FEATURE)) {
if (vdev->bad_features)
- val = vdev->bad_features(vdev);
+ val = proxy->host_features & vdev->bad_features(vdev);
else
val = 0;
}
@@ -237,8 +240,7 @@ static uint32_t virtio_ioport_read(VirtI
switch (addr) {
case VIRTIO_PCI_HOST_FEATURES:
- ret = vdev->get_features(vdev);
- ret |= vdev->binding->get_features(proxy);
+ ret = proxy->host_features;
break;
case VIRTIO_PCI_GUEST_FEATURES:
ret = vdev->guest_features;
@@ -384,11 +386,8 @@ static void virtio_write_config(PCIDevic
static unsigned virtio_pci_get_features(void *opaque)
{
- unsigned ret = 0;
- ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
- ret |= (1 << VIRTIO_RING_F_INDIRECT_DESC);
- ret |= (1 << VIRTIO_F_BAD_FEATURE);
- return ret;
+ VirtIOPCIProxy *proxy = opaque;
+ return proxy->host_features;
}
static const VirtIOBindings virtio_pci_bindings = {
@@ -444,6 +443,9 @@ static void virtio_init_pci(VirtIOPCIPro
virtio_map);
virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
+ proxy->host_features |= 0x1 << VIRTIO_F_NOTIFY_ON_EMPTY;
+ proxy->host_features |= 0x1 << VIRTIO_F_BAD_FEATURE;
+ proxy->host_features = vdev->get_features(vdev, proxy->host_features);
}
static int virtio_blk_init_pci(PCIDevice *pci_dev)
@@ -558,6 +560,7 @@ static PCIDeviceInfo virtio_info[] = {
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_PROP_DRIVE("drive", VirtIOPCIProxy, dinfo),
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
+ DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_END_OF_LIST(),
},
.qdev.reset = virtio_pci_reset,
@@ -569,6 +572,7 @@ static PCIDeviceInfo virtio_info[] = {
.romfile = "pxe-virtio.bin",
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3),
+ DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_NIC_PROPERTIES(VirtIOPCIProxy, nic),
DEFINE_PROP_END_OF_LIST(),
},
@@ -582,6 +586,7 @@ static PCIDeviceInfo virtio_info[] = {
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 0),
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+ DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
31),
DEFINE_PROP_END_OF_LIST(),
@@ -592,6 +597,10 @@ static PCIDeviceInfo virtio_info[] = {
.qdev.size = sizeof(VirtIOPCIProxy),
.init = virtio_balloon_init_pci,
.exit = virtio_exit_pci,
+ .qdev.props = (Property[]) {
+ DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
+ DEFINE_PROP_END_OF_LIST(),
+ },
.qdev.reset = virtio_pci_reset,
},{
/* end of list */

View File

@ -1,78 +0,0 @@
Add binding API to set host/guest notifiers.
Will be used by vhost.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio.c | 13 ++++++++++---
hw/virtio.h | 5 ++++-
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/virtio.c b/hw/virtio.c
index fa7184a..c2b80aa 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -594,6 +594,12 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
return &vdev->vq[i];
}
+void virtio_irq(VirtIODevice *vdev, VirtQueue *vq)
+{
+ vdev->isr |= 0x01;
+ virtio_notify_vector(vdev, vq->vector);
+}
+
void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
{
/* Always notify when queue is empty (when feature acknowledge) */
@@ -602,8 +608,7 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
(vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx)))
return;
- vdev->isr |= 0x01;
- virtio_notify_vector(vdev, vq->vector);
+ virtio_irq(vdev, vq);
}
void virtio_notify_config(VirtIODevice *vdev)
@@ -716,8 +721,10 @@ VirtIODevice *virtio_common_init(const char *name, uint16_t device_id,
vdev->queue_sel = 0;
vdev->config_vector = VIRTIO_NO_VECTOR;
vdev->vq = qemu_mallocz(sizeof(VirtQueue) * VIRTIO_PCI_QUEUE_MAX);
- for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++)
+ for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
vdev->vq[i].vector = VIRTIO_NO_VECTOR;
+ vdev->vq[i].vdev = vdev;
+ }
vdev->name = name;
vdev->config_len = config_size;
diff --git a/hw/virtio.h b/hw/virtio.h
index 3994cc9..10a0959 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -18,6 +18,7 @@
#include "net.h"
#include "qdev.h"
#include "sysemu.h"
+#include "notifier.h"
/* from Linux's linux/virtio_config.h */
@@ -88,6 +89,8 @@ typedef struct {
int (*load_config)(void * opaque, QEMUFile *f);
int (*load_queue)(void * opaque, int n, QEMUFile *f);
unsigned (*get_features)(void * opaque);
+ int (*guest_notifier)(void * opaque, int n, bool assigned);
+ int (*host_notifier)(void * opaque, int n, bool assigned);
} VirtIOBindings;
#define VIRTIO_PCI_QUEUE_MAX 64
@@ -180,5 +183,5 @@ void virtio_net_exit(VirtIODevice *vdev);
DEFINE_PROP_BIT("indirect_desc", _state, _field, \
VIRTIO_RING_F_INDIRECT_DESC, true)
-
+void virtio_irq(VirtIODevice *vdev, VirtQueue *vq);
#endif
--
1.6.6.144.g5c3af

View File

@ -1,76 +0,0 @@
vhost net backend needs to be notified when
frontend status changes. Add a callback.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/s390-virtio-bus.c | 3 +++
hw/syborg_virtio.c | 2 ++
hw/virtio-pci.c | 6 ++++++
hw/virtio.h | 1 +
4 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index 980e7eb..f45b67d 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -243,6 +243,9 @@ void s390_virtio_device_update_status(VirtIOS390Device *dev)
uint32_t features;
vdev->status = ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS);
+ if (vdev->set_status) {
+ vdev->set_status(vdev);
+ }
/* Update guest supported feature bitmap */
diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c
index 65239a0..19f6473 100644
--- a/hw/syborg_virtio.c
+++ b/hw/syborg_virtio.c
@@ -152,6 +152,8 @@ static void syborg_virtio_writel(void *opaque, target_phys_addr_t offset,
vdev->status = value & 0xFF;
if (vdev->status == 0)
virtio_reset(vdev);
+ if (vdev->set_status)
+ vdev->set_status(vdev);
break;
case SYBORG_VIRTIO_INT_ENABLE:
s->int_enable = value;
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 573c98a..05898c8 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -208,6 +208,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
virtio_reset(proxy->vdev);
msix_unuse_all_vectors(&proxy->pci_dev);
}
+ if (vdev->set_status) {
+ vdev->set_status(vdev);
+ }
break;
case VIRTIO_MSI_CONFIG_VECTOR:
msix_vector_unuse(&proxy->pci_dev, vdev->config_vector);
@@ -375,6 +378,9 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
if (PCI_COMMAND == address) {
if (!(val & PCI_COMMAND_MASTER)) {
proxy->vdev->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
+ if (proxy->vdev->set_status) {
+ proxy->vdev->set_status(proxy->vdev);
+ }
}
}
diff --git a/hw/virtio.h b/hw/virtio.h
index f140ca3..39d0763 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -114,6 +114,7 @@ struct VirtIODevice
void (*get_config)(VirtIODevice *vdev, uint8_t *config);
void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
void (*reset)(VirtIODevice *vdev);
+ void (*set_status)(VirtIODevice *vdev);
VirtQueue *vq;
const VirtIOBindings *binding;
void *binding_opaque;
--
1.6.6.144.g5c3af

View File

@ -1,25 +0,0 @@
verify that peer is tap before checking for vhost net
Reported-by: Shirley Ma <mashirle@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio-net.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 088029b..b28fd92 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -179,6 +179,10 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);
}
+ if (!n->nic->nc.peer ||
+ n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+ return features;
+ }
if (!tap_get_vhost_net(n->nic->nc.peer)) {
return features;
}
--
1.6.6.144.g5c3af

View File

@ -1,341 +0,0 @@
From 9c7f6b094950f7772068b957c795d76463cdeba0 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Thu, 21 Jan 2010 15:43:26 +0530
Subject: [PATCH 9/9] virtio-console: Rename virtio-serial.c back to virtio-console.c
This file was renamed to ease the reviews of the recent changes
that went in.
Now that the changes are done, rename the file back to its original
name.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
Makefile.hw | 2 +-
hw/virtio-console.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++
hw/virtio-serial.c | 146 ---------------------------------------------------
3 files changed, 147 insertions(+), 147 deletions(-)
create mode 100644 hw/virtio-console.c
delete mode 100644 hw/virtio-serial.c
diff --git a/Makefile.hw b/Makefile.hw
index de8a0c5..43ca541 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -13,7 +13,7 @@ QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
obj-y =
obj-y += loader.o
-obj-y += virtio.o virtio-serial.o
+obj-y += virtio.o virtio-console.o
obj-y += fw_cfg.o
obj-y += watchdog.o
obj-$(CONFIG_ECC) += ecc.o
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
new file mode 100644
index 0000000..bd44ec6
--- /dev/null
+++ b/hw/virtio-console.c
@@ -0,0 +1,146 @@
+/*
+ * Virtio Console and Generic Serial Port Devices
+ *
+ * Copyright Red Hat, Inc. 2009
+ *
+ * Authors:
+ * Amit Shah <amit.shah@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "qemu-char.h"
+#include "virtio-serial.h"
+
+typedef struct VirtConsole {
+ VirtIOSerialPort port;
+ CharDriverState *chr;
+} VirtConsole;
+
+
+/* Callback function that's called when the guest sends us data */
+static size_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
+{
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+ ssize_t ret;
+
+ ret = qemu_chr_write(vcon->chr, buf, len);
+
+ return ret < 0 ? 0 : ret;
+}
+
+/* Readiness of the guest to accept data on a port */
+static int chr_can_read(void *opaque)
+{
+ VirtConsole *vcon = opaque;
+
+ return virtio_serial_guest_ready(&vcon->port);
+}
+
+/* Send data from a char device over to the guest */
+static void chr_read(void *opaque, const uint8_t *buf, int size)
+{
+ VirtConsole *vcon = opaque;
+
+ virtio_serial_write(&vcon->port, buf, size);
+}
+
+static void chr_event(void *opaque, int event)
+{
+ VirtConsole *vcon = opaque;
+
+ switch (event) {
+ case CHR_EVENT_OPENED: {
+ virtio_serial_open(&vcon->port);
+ break;
+ }
+ case CHR_EVENT_CLOSED:
+ virtio_serial_close(&vcon->port);
+ break;
+ }
+}
+
+/* Virtio Console Ports */
+static int virtconsole_initfn(VirtIOSerialDevice *dev)
+{
+ VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ port->info = dev->info;
+
+ port->is_console = true;
+
+ if (vcon->chr) {
+ qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
+ vcon);
+ port->info->have_data = flush_buf;
+ }
+ return 0;
+}
+
+static int virtconsole_exitfn(VirtIOSerialDevice *dev)
+{
+ VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ if (vcon->chr) {
+ port->info->have_data = NULL;
+ qemu_chr_close(vcon->chr);
+ }
+
+ return 0;
+}
+
+static VirtIOSerialPortInfo virtconsole_info = {
+ .qdev.name = "virtconsole",
+ .qdev.size = sizeof(VirtConsole),
+ .init = virtconsole_initfn,
+ .exit = virtconsole_exitfn,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1),
+ DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+ DEFINE_PROP_STRING("name", VirtConsole, port.name),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+};
+
+static void virtconsole_register(void)
+{
+ virtio_serial_port_qdev_register(&virtconsole_info);
+}
+device_init(virtconsole_register)
+
+/* Generic Virtio Serial Ports */
+static int virtserialport_initfn(VirtIOSerialDevice *dev)
+{
+ VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ port->info = dev->info;
+
+ if (vcon->chr) {
+ qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
+ vcon);
+ port->info->have_data = flush_buf;
+ }
+ return 0;
+}
+
+static VirtIOSerialPortInfo virtserialport_info = {
+ .qdev.name = "virtserialport",
+ .qdev.size = sizeof(VirtConsole),
+ .init = virtserialport_initfn,
+ .exit = virtconsole_exitfn,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+ DEFINE_PROP_STRING("name", VirtConsole, port.name),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+};
+
+static void virtserialport_register(void)
+{
+ virtio_serial_port_qdev_register(&virtserialport_info);
+}
+device_init(virtserialport_register)
diff --git a/hw/virtio-serial.c b/hw/virtio-serial.c
deleted file mode 100644
index bd44ec6..0000000
--- a/hw/virtio-serial.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Virtio Console and Generic Serial Port Devices
- *
- * Copyright Red Hat, Inc. 2009
- *
- * Authors:
- * Amit Shah <amit.shah@redhat.com>
- *
- * This work is licensed under the terms of the GNU GPL, version 2. See
- * the COPYING file in the top-level directory.
- */
-
-#include "qemu-char.h"
-#include "virtio-serial.h"
-
-typedef struct VirtConsole {
- VirtIOSerialPort port;
- CharDriverState *chr;
-} VirtConsole;
-
-
-/* Callback function that's called when the guest sends us data */
-static size_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
-{
- VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
- ssize_t ret;
-
- ret = qemu_chr_write(vcon->chr, buf, len);
-
- return ret < 0 ? 0 : ret;
-}
-
-/* Readiness of the guest to accept data on a port */
-static int chr_can_read(void *opaque)
-{
- VirtConsole *vcon = opaque;
-
- return virtio_serial_guest_ready(&vcon->port);
-}
-
-/* Send data from a char device over to the guest */
-static void chr_read(void *opaque, const uint8_t *buf, int size)
-{
- VirtConsole *vcon = opaque;
-
- virtio_serial_write(&vcon->port, buf, size);
-}
-
-static void chr_event(void *opaque, int event)
-{
- VirtConsole *vcon = opaque;
-
- switch (event) {
- case CHR_EVENT_OPENED: {
- virtio_serial_open(&vcon->port);
- break;
- }
- case CHR_EVENT_CLOSED:
- virtio_serial_close(&vcon->port);
- break;
- }
-}
-
-/* Virtio Console Ports */
-static int virtconsole_initfn(VirtIOSerialDevice *dev)
-{
- VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
- VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
-
- port->info = dev->info;
-
- port->is_console = true;
-
- if (vcon->chr) {
- qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
- vcon);
- port->info->have_data = flush_buf;
- }
- return 0;
-}
-
-static int virtconsole_exitfn(VirtIOSerialDevice *dev)
-{
- VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
- VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
-
- if (vcon->chr) {
- port->info->have_data = NULL;
- qemu_chr_close(vcon->chr);
- }
-
- return 0;
-}
-
-static VirtIOSerialPortInfo virtconsole_info = {
- .qdev.name = "virtconsole",
- .qdev.size = sizeof(VirtConsole),
- .init = virtconsole_initfn,
- .exit = virtconsole_exitfn,
- .qdev.props = (Property[]) {
- DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1),
- DEFINE_PROP_CHR("chardev", VirtConsole, chr),
- DEFINE_PROP_STRING("name", VirtConsole, port.name),
- DEFINE_PROP_END_OF_LIST(),
- },
-};
-
-static void virtconsole_register(void)
-{
- virtio_serial_port_qdev_register(&virtconsole_info);
-}
-device_init(virtconsole_register)
-
-/* Generic Virtio Serial Ports */
-static int virtserialport_initfn(VirtIOSerialDevice *dev)
-{
- VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
- VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
-
- port->info = dev->info;
-
- if (vcon->chr) {
- qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
- vcon);
- port->info->have_data = flush_buf;
- }
- return 0;
-}
-
-static VirtIOSerialPortInfo virtserialport_info = {
- .qdev.name = "virtserialport",
- .qdev.size = sizeof(VirtConsole),
- .init = virtserialport_initfn,
- .exit = virtconsole_exitfn,
- .qdev.props = (Property[]) {
- DEFINE_PROP_CHR("chardev", VirtConsole, chr),
- DEFINE_PROP_STRING("name", VirtConsole, port.name),
- DEFINE_PROP_END_OF_LIST(),
- },
-};
-
-static void virtserialport_register(void)
-{
- virtio_serial_port_qdev_register(&virtserialport_info);
-}
-device_init(virtserialport_register)
--
1.6.2.5

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
make it possible to use type without header include
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio.h | 1 -
qemu-common.h | 1 +
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/virtio.h b/hw/virtio.h
index 39d0763..a5bd0ba 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -68,7 +68,6 @@ static inline target_phys_addr_t vring_align(target_phys_addr_t addr,
}
typedef struct VirtQueue VirtQueue;
-typedef struct VirtIODevice VirtIODevice;
#define VIRTQUEUE_MAX_SIZE 1024
diff --git a/qemu-common.h b/qemu-common.h
index cdead98..1a54f9e 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -218,6 +218,7 @@ typedef struct I2SCodec I2SCodec;
typedef struct DeviceState DeviceState;
typedef struct SSIBus SSIBus;
typedef struct EventNotifier EventNotifier;
+typedef struct VirtIODevice VirtIODevice;
/* CPU save/load. */
void cpu_save(QEMUFile *f, void *opaque);
--
1.6.6.144.g5c3af

View File

@ -1,40 +0,0 @@
Mac feature bit isn't going to work as all network cards already have a
'mac' property to set the mac address. Remove it from mask and add in
get_features.
Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit c9f79a3f79a48de28b4575cb5644bcf45d3754d0)
---
hw/virtio-net.c | 2 ++
hw/virtio-net.h | 1 -
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index c2a389f..02d9180 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -151,6 +151,8 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
{
VirtIONet *n = to_virtio_net(vdev);
+ features |= (1 << VIRTIO_NET_F_MAC);
+
if (peer_has_vnet_hdr(n)) {
tap_using_vnet_hdr(n->nic->nc.peer, 1);
} else {
diff --git a/hw/virtio-net.h b/hw/virtio-net.h
index 9130d75..e55119b 100644
--- a/hw/virtio-net.h
+++ b/hw/virtio-net.h
@@ -157,7 +157,6 @@ struct virtio_net_ctrl_mac {
DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
DEFINE_PROP_BIT("csum", _state, _field, VIRTIO_NET_F_CSUM, true), \
DEFINE_PROP_BIT("guest_csum", _state, _field, VIRTIO_NET_F_GUEST_CSUM, true), \
- DEFINE_PROP_BIT("mac", _state, _field, VIRTIO_NET_F_MAC, true), \
DEFINE_PROP_BIT("gso", _state, _field, VIRTIO_NET_F_GSO, true), \
DEFINE_PROP_BIT("guest_tso4", _state, _field, VIRTIO_NET_F_GUEST_TSO4, true), \
DEFINE_PROP_BIT("guest_tso6", _state, _field, VIRTIO_NET_F_GUEST_TSO6, true), \
--
1.6.6.144.g5c3af

View File

@ -1,153 +0,0 @@
This connects virtio-net to vhost net backend.
The code is structured in a way analogous to what we have with vnet
header capability in tap. We start/stop backend on driver start/stop as
well as on save and vm start (for migration).
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio-net.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 02d9180..088029b 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -17,6 +17,7 @@
#include "net/tap.h"
#include "qemu-timer.h"
#include "virtio-net.h"
+#include "vhost_net.h"
#define VIRTIO_NET_VM_VERSION 11
@@ -47,6 +48,8 @@ typedef struct VirtIONet
uint8_t nomulti;
uint8_t nouni;
uint8_t nobcast;
+ uint8_t vhost_started;
+ VMChangeStateEntry *vmstate;
struct {
int in_use;
int first_multi;
@@ -114,6 +117,10 @@ static void virtio_net_reset(VirtIODevice *vdev)
n->nomulti = 0;
n->nouni = 0;
n->nobcast = 0;
+ if (n->vhost_started) {
+ vhost_net_stop(tap_get_vhost_net(n->nic->nc.peer), vdev);
+ n->vhost_started = 0;
+ }
/* Flush any MAC and VLAN filter table state */
n->mac_table.in_use = 0;
@@ -172,7 +179,10 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);
}
- return features;
+ if (!tap_get_vhost_net(n->nic->nc.peer)) {
+ return features;
+ }
+ return vhost_net_get_features(tap_get_vhost_net(n->nic->nc.peer), features);
}
static uint32_t virtio_net_bad_features(VirtIODevice *vdev)
@@ -690,6 +700,12 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
{
VirtIONet *n = opaque;
+ if (n->vhost_started) {
+ /* TODO: should we really stop the backend?
+ * If we don't, it might keep writing to memory. */
+ vhost_net_stop(tap_get_vhost_net(n->nic->nc.peer), &n->vdev);
+ n->vhost_started = 0;
+ }
virtio_save(&n->vdev, f);
qemu_put_buffer(f, n->mac, ETH_ALEN);
@@ -802,7 +818,6 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
qemu_mod_timer(n->tx_timer,
qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
}
-
return 0;
}
@@ -822,6 +837,47 @@ static NetClientInfo net_virtio_info = {
.link_status_changed = virtio_net_set_link_status,
};
+static void virtio_net_set_status(struct VirtIODevice *vdev)
+{
+ VirtIONet *n = to_virtio_net(vdev);
+ if (!n->nic->nc.peer) {
+ return;
+ }
+ if (n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+ return;
+ }
+
+ if (!tap_get_vhost_net(n->nic->nc.peer)) {
+ return;
+ }
+ if (!!n->vhost_started == !!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
+ return;
+ }
+ if (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) {
+ int r = vhost_net_start(tap_get_vhost_net(n->nic->nc.peer), vdev);
+ if (r < 0) {
+ fprintf(stderr, "unable to start vhost net: %d: "
+ "falling back on userspace virtio\n", -r);
+ } else {
+ n->vhost_started = 1;
+ }
+ } else {
+ vhost_net_stop(tap_get_vhost_net(n->nic->nc.peer), vdev);
+ n->vhost_started = 0;
+ }
+}
+
+static void virtio_net_vmstate_change(void *opaque, int running, int reason)
+{
+ VirtIONet *n = opaque;
+ if (!running) {
+ return;
+ }
+ /* This is called when vm is started, it will start vhost backend if it
+ * appropriate e.g. after migration. */
+ virtio_net_set_status(&n->vdev);
+}
+
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
{
VirtIONet *n;
@@ -837,6 +893,7 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
n->vdev.set_features = virtio_net_set_features;
n->vdev.bad_features = virtio_net_bad_features;
n->vdev.reset = virtio_net_reset;
+ n->vdev.set_status = virtio_net_set_status;
n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);
n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx);
n->ctrl_vq = virtio_add_queue(&n->vdev, 64, virtio_net_handle_ctrl);
@@ -859,6 +916,7 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION,
virtio_net_save, virtio_net_load, n);
+ n->vmstate = qemu_add_vm_change_state_handler(virtio_net_vmstate_change, n);
return &n->vdev;
}
@@ -866,6 +924,11 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
void virtio_net_exit(VirtIODevice *vdev)
{
VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
+ qemu_del_vm_change_state_handler(n->vmstate);
+
+ if (n->vhost_started) {
+ vhost_net_stop(tap_get_vhost_net(n->nic->nc.peer), vdev);
+ }
qemu_purge_queued_packets(&n->nic->nc);
--
1.6.6.144.g5c3af

View File

@ -1,98 +0,0 @@
Support host/guest notifiers in virtio-pci.
The last one only with kvm, that's okay
because vhost relies on kvm anyway.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio-pci.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 05898c8..c454093 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -23,6 +23,7 @@
#include "msix.h"
#include "net.h"
#include "loader.h"
+#include "kvm.h"
/* from Linux's linux/virtio_pci.h */
@@ -394,6 +395,65 @@ static unsigned virtio_pci_get_features(void *opaque)
return proxy->host_features;
}
+static void virtio_pci_guest_notifier_read(void *opaque)
+{
+ VirtQueue *vq = opaque;
+ EventNotifier *n = virtio_queue_guest_notifier(vq);
+ if (event_notifier_test_and_clear(n)) {
+ virtio_irq(vq);
+ }
+}
+
+static int virtio_pci_guest_notifier(void *opaque, int n, bool assign)
+{
+ VirtIOPCIProxy *proxy = opaque;
+ VirtQueue *vq = virtio_queue(proxy->vdev, n);
+ EventNotifier *notifier = virtio_queue_guest_notifier(vq);
+
+ if (assign) {
+ int r = event_notifier_init(notifier, 0);
+ if (r < 0)
+ return r;
+ qemu_set_fd_handler(event_notifier_get_fd(notifier),
+ virtio_pci_guest_notifier_read, NULL, vq);
+ } else {
+ qemu_set_fd_handler(event_notifier_get_fd(notifier),
+ NULL, NULL, vq);
+ event_notifier_cleanup(notifier);
+ }
+
+ return 0;
+}
+
+static int virtio_pci_host_notifier(void *opaque, int n, bool assign)
+{
+ VirtIOPCIProxy *proxy = opaque;
+ VirtQueue *vq = virtio_queue(proxy->vdev, n);
+ EventNotifier *notifier = virtio_queue_host_notifier(vq);
+ int r;
+ if (assign) {
+ r = event_notifier_init(notifier, 1);
+ if (r < 0) {
+ return r;
+ }
+ r = kvm_set_ioeventfd(proxy->addr + VIRTIO_PCI_QUEUE_NOTIFY,
+ n, event_notifier_get_fd(notifier),
+ assign);
+ if (r < 0) {
+ event_notifier_cleanup(notifier);
+ }
+ } else {
+ r = kvm_set_ioeventfd(proxy->addr + VIRTIO_PCI_QUEUE_NOTIFY,
+ n, event_notifier_get_fd(notifier),
+ assign);
+ if (r < 0) {
+ return r;
+ }
+ event_notifier_cleanup(notifier);
+ }
+ return r;
+}
+
static const VirtIOBindings virtio_pci_bindings = {
.notify = virtio_pci_notify,
.save_config = virtio_pci_save_config,
@@ -401,6 +461,8 @@ static const VirtIOBindings virtio_pci_bindings = {
.save_queue = virtio_pci_save_queue,
.load_queue = virtio_pci_load_queue,
.get_features = virtio_pci_get_features,
+ .host_notifier = virtio_pci_host_notifier,
+ .guest_notifier = virtio_pci_guest_notifier,
};
static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
--
1.6.6.144.g5c3af

View File

@ -1,34 +0,0 @@
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index e8e0d82..fd0c73f 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -404,6 +404,7 @@ static void virtio_pci_guest_notifier_read(void *opaque)
}
}
+#ifdef CONFIG_KVM
static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
void *opaque, int masked)
{
@@ -424,6 +425,7 @@ static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
}
return 0;
}
+#endif
static int virtio_pci_guest_notifier(void *opaque, int n, bool assign)
{
@@ -526,7 +528,9 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
proxy->pci_dev.config_write = virtio_write_config;
+#ifdef CONFIG_KVM
proxy->pci_dev.msix_mask_notifier = virtio_pci_mask_notifier;
+#endif
size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + vdev->config_len;
if (size & (size-1))

View File

@ -1,70 +0,0 @@
Use irqfd when supported by kernel.
This uses msix mask notifiers: when vector is masked, we poll it from
userspace. When it is unmasked, we poll it from kernel.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio-pci.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c454093..e8e0d82 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -404,6 +404,27 @@ static void virtio_pci_guest_notifier_read(void *opaque)
}
}
+static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
+ void *opaque, int masked)
+{
+ VirtQueue *vq = opaque;
+ EventNotifier *notifier = virtio_queue_guest_notifier(vq);
+ int r = kvm_set_irqfd(dev->msix_irq_entries[vector].gsi,
+ event_notifier_get_fd(notifier),
+ !masked);
+ if (r < 0) {
+ return (r == -ENOSYS) ? 0 : r;
+ }
+ if (masked) {
+ qemu_set_fd_handler(event_notifier_get_fd(notifier),
+ virtio_pci_guest_notifier_read, NULL, vq);
+ } else {
+ qemu_set_fd_handler(event_notifier_get_fd(notifier),
+ NULL, NULL, vq);
+ }
+ return 0;
+}
+
static int virtio_pci_guest_notifier(void *opaque, int n, bool assign)
{
VirtIOPCIProxy *proxy = opaque;
@@ -412,11 +433,15 @@ static int virtio_pci_guest_notifier(void *opaque, int n, bool assign)
if (assign) {
int r = event_notifier_init(notifier, 0);
- if (r < 0)
- return r;
+ if (r < 0)
+ return r;
qemu_set_fd_handler(event_notifier_get_fd(notifier),
virtio_pci_guest_notifier_read, NULL, vq);
+ msix_set_mask_notifier(&proxy->pci_dev,
+ virtio_queue_vector(proxy->vdev, n), vq);
} else {
+ msix_set_mask_notifier(&proxy->pci_dev,
+ virtio_queue_vector(proxy->vdev, n), NULL);
qemu_set_fd_handler(event_notifier_get_fd(notifier),
NULL, NULL, vq);
event_notifier_cleanup(notifier);
@@ -501,6 +526,8 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
proxy->pci_dev.config_write = virtio_write_config;
+ proxy->pci_dev.msix_mask_notifier = virtio_pci_mask_notifier;
+
size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + vdev->config_len;
if (size & (size-1))
size = 1 << qemu_fls(size);
--
1.6.6.144.g5c3af

View File

@ -1,149 +0,0 @@
Rename features->guest_features. This is
what they are, avoid confusion with
host features which we also need to keep around.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 704a76fcd24372a683652651b4597f6654084975)
---
hw/s390-virtio-bus.c | 2 +-
hw/syborg_virtio.c | 4 ++--
hw/virtio-net.c | 10 +++++-----
hw/virtio-pci.c | 4 ++--
hw/virtio.c | 8 ++++----
hw/virtio.h | 2 +-
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index dc154ed..6c0da11 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -251,7 +251,7 @@ void s390_virtio_device_update_status(VirtIOS390Device *dev)
if (vdev->set_features) {
vdev->set_features(vdev, features);
}
- vdev->features = features;
+ vdev->guest_features = features;
}
VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus)
diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c
index a84206a..fe6fc23 100644
--- a/hw/syborg_virtio.c
+++ b/hw/syborg_virtio.c
@@ -90,7 +90,7 @@ static uint32_t syborg_virtio_readl(void *opaque, target_phys_addr_t offset)
ret |= vdev->binding->get_features(s);
break;
case SYBORG_VIRTIO_GUEST_FEATURES:
- ret = vdev->features;
+ ret = vdev->guest_features;
break;
case SYBORG_VIRTIO_QUEUE_BASE:
ret = virtio_queue_get_addr(vdev, vdev->queue_sel);
@@ -132,7 +132,7 @@ static void syborg_virtio_writel(void *opaque, target_phys_addr_t offset,
case SYBORG_VIRTIO_GUEST_FEATURES:
if (vdev->set_features)
vdev->set_features(vdev, value);
- vdev->features = value;
+ vdev->guest_features = value;
break;
case SYBORG_VIRTIO_QUEUE_BASE:
if (value == 0)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 2f201ff..ab20a33 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -768,11 +768,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
if (n->has_vnet_hdr) {
tap_using_vnet_hdr(n->nic->nc.peer, 1);
tap_set_offload(n->nic->nc.peer,
- (n->vdev.features >> VIRTIO_NET_F_GUEST_CSUM) & 1,
- (n->vdev.features >> VIRTIO_NET_F_GUEST_TSO4) & 1,
- (n->vdev.features >> VIRTIO_NET_F_GUEST_TSO6) & 1,
- (n->vdev.features >> VIRTIO_NET_F_GUEST_ECN) & 1,
- (n->vdev.features >> VIRTIO_NET_F_GUEST_UFO) & 1);
+ (n->vdev.guest_features >> VIRTIO_NET_F_GUEST_CSUM) & 1,
+ (n->vdev.guest_features >> VIRTIO_NET_F_GUEST_TSO4) & 1,
+ (n->vdev.guest_features >> VIRTIO_NET_F_GUEST_TSO6) & 1,
+ (n->vdev.guest_features >> VIRTIO_NET_F_GUEST_ECN) & 1,
+ (n->vdev.guest_features >> VIRTIO_NET_F_GUEST_UFO) & 1);
}
}
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 3594152..c23dbc0 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -181,7 +181,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
}
if (vdev->set_features)
vdev->set_features(vdev, val);
- vdev->features = val;
+ vdev->guest_features = val;
break;
case VIRTIO_PCI_QUEUE_PFN:
pa = (target_phys_addr_t)val << VIRTIO_PCI_QUEUE_ADDR_SHIFT;
@@ -239,7 +239,7 @@ static uint32_t virtio_ioport_read(VirtIOPCIProxy *proxy, uint32_t addr)
ret |= vdev->binding->get_features(proxy);
break;
case VIRTIO_PCI_GUEST_FEATURES:
- ret = vdev->features;
+ ret = vdev->guest_features;
break;
case VIRTIO_PCI_QUEUE_PFN:
ret = virtio_queue_get_addr(vdev, vdev->queue_sel)
diff --git a/hw/virtio.c b/hw/virtio.c
index cecd0dc..c25a5f1 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -445,7 +445,7 @@ void virtio_reset(void *opaque)
if (vdev->reset)
vdev->reset(vdev);
- vdev->features = 0;
+ vdev->guest_features = 0;
vdev->queue_sel = 0;
vdev->status = 0;
vdev->isr = 0;
@@ -598,7 +598,7 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
{
/* Always notify when queue is empty (when feature acknowledge) */
if ((vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT) &&
- (!(vdev->features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) ||
+ (!(vdev->guest_features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) ||
(vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx)))
return;
@@ -625,7 +625,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
qemu_put_8s(f, &vdev->status);
qemu_put_8s(f, &vdev->isr);
qemu_put_be16s(f, &vdev->queue_sel);
- qemu_put_be32s(f, &vdev->features);
+ qemu_put_be32s(f, &vdev->guest_features);
qemu_put_be32(f, vdev->config_len);
qemu_put_buffer(f, vdev->config, vdev->config_len);
@@ -670,7 +670,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
features, supported_features);
return -1;
}
- vdev->features = features;
+ vdev->guest_features = features;
vdev->config_len = qemu_get_be32(f);
qemu_get_buffer(f, vdev->config, vdev->config_len);
diff --git a/hw/virtio.h b/hw/virtio.h
index 35532a6..85ef171 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -100,7 +100,7 @@ struct VirtIODevice
uint8_t status;
uint8_t isr;
uint16_t queue_sel;
- uint32_t features;
+ uint32_t guest_features;
size_t config_len;
void *config;
uint16_t config_vector;
--
1.6.6.144.g5c3af

View File

@ -1,63 +0,0 @@
From fcb66d7ac2271bcf0b46d6b1ae2d3db38e78bf2b Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:56 +0530
Subject: [PATCH 6/9] virtio-serial: Add a 'virtserialport' device for generic serial port support
This commit adds a simple chardev-based serial port. Any data the guest
sends is forwarded to the chardev and vice-versa.
Sample uses for such a device can be obtaining info from the guest like
the file systems used, apps installed, etc. for offline usage and
logged-in users, clipboard copy-paste, etc. for online usage.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-serial.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial.c b/hw/virtio-serial.c
index 9c2c93c..bd44ec6 100644
--- a/hw/virtio-serial.c
+++ b/hw/virtio-serial.c
@@ -110,3 +110,37 @@ static void virtconsole_register(void)
virtio_serial_port_qdev_register(&virtconsole_info);
}
device_init(virtconsole_register)
+
+/* Generic Virtio Serial Ports */
+static int virtserialport_initfn(VirtIOSerialDevice *dev)
+{
+ VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ port->info = dev->info;
+
+ if (vcon->chr) {
+ qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
+ vcon);
+ port->info->have_data = flush_buf;
+ }
+ return 0;
+}
+
+static VirtIOSerialPortInfo virtserialport_info = {
+ .qdev.name = "virtserialport",
+ .qdev.size = sizeof(VirtConsole),
+ .init = virtserialport_initfn,
+ .exit = virtconsole_exitfn,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+ DEFINE_PROP_STRING("name", VirtConsole, port.name),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+};
+
+static void virtserialport_register(void)
+{
+ virtio_serial_port_qdev_register(&virtserialport_info);
+}
+device_init(virtserialport_register)
--
1.6.2.5

View File

@ -1,45 +0,0 @@
From 43fa8533e10c478825952d489269d55e5c652c1a Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:58 +0530
Subject: [PATCH 8/9] virtio-serial: Use MSI vectors for port virtqueues
This commit enables the use of MSI interrupts for virtqueue
notifications for ports. We use nr_ports + 1 (for control channel) msi
entries for the ports, as only the in_vq operations need an interrupt on
the guest.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-pci.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c1a1e4c..4451a63 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -497,10 +497,13 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
if (!vdev) {
return -1;
}
+ vdev->nvectors = proxy->nvectors ? proxy->nvectors
+ : proxy->max_virtserial_ports + 1;
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_CONSOLE,
proxy->class_code, 0x00);
+ proxy->nvectors = vdev->nvectors;
return 0;
}
@@ -577,6 +580,7 @@ static PCIDeviceInfo virtio_info[] = {
.init = virtio_serial_init_pci,
.exit = virtio_exit_pci,
.qdev.props = (Property[]) {
+ DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 0),
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
31),
--
1.6.2.5

View File

@ -1,116 +0,0 @@
From ed4daf8c7722562ec05e83ec98a4d4d8adf20f7f Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:54 +0530
Subject: [PATCH 4/9] virtio-serial-bus: Add a port 'name' property for port discovery in guests
The port 'id' or number is internal state between the guest kernel and
our bus implementation. This is invocation-dependent and isn't part of
the guest-host ABI.
To correcly enumerate and map ports between the host and the guest, the
'name' property is used.
Example:
-device virtserialport,name=org.qemu.port.0
This invocation will get us a char device in the guest at:
/dev/virtio-ports/org.qemu.port.0
which can be a symlink to
/dev/vport0p3
This 'name' property is exposed by the guest kernel in a sysfs
attribute:
/sys/kernel/virtio-ports/vport0p3/name
A simple udev script can pick up this name and create the symlink
mentioned above.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-serial-bus.c | 17 +++++++++++++++++
hw/virtio-serial.c | 1 +
hw/virtio-serial.h | 8 ++++++++
3 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 9af21df..6d69c56 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -204,6 +204,8 @@ static void handle_control_message(VirtIOSerial *vser, void *buf)
{
struct VirtIOSerialPort *port;
struct virtio_console_control cpkt, *gcpkt;
+ uint8_t *buffer;
+ size_t buffer_len;
gcpkt = buf;
port = find_port_by_id(vser, ldl_p(&gcpkt->id));
@@ -226,6 +228,21 @@ static void handle_control_message(VirtIOSerial *vser, void *buf)
send_control_event(port, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
}
+ if (port->name) {
+ stw_p(&cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
+ stw_p(&cpkt.value, 1);
+
+ buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
+ buffer = qemu_malloc(buffer_len);
+
+ memcpy(buffer, &cpkt, sizeof(cpkt));
+ memcpy(buffer + sizeof(cpkt), port->name, strlen(port->name));
+ buffer[buffer_len - 1] = 0;
+
+ send_control_msg(port, buffer, buffer_len);
+ qemu_free(buffer);
+ }
+
if (port->host_connected) {
send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
}
diff --git a/hw/virtio-serial.c b/hw/virtio-serial.c
index 1dc031e..9c2c93c 100644
--- a/hw/virtio-serial.c
+++ b/hw/virtio-serial.c
@@ -100,6 +100,7 @@ static VirtIOSerialPortInfo virtconsole_info = {
.qdev.props = (Property[]) {
DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1),
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+ DEFINE_PROP_STRING("name", VirtConsole, port.name),
DEFINE_PROP_END_OF_LIST(),
},
};
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index d9c7acb..28ea7da 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -50,6 +50,7 @@ struct virtio_console_control {
#define VIRTIO_CONSOLE_CONSOLE_PORT 1
#define VIRTIO_CONSOLE_RESIZE 2
#define VIRTIO_CONSOLE_PORT_OPEN 3
+#define VIRTIO_CONSOLE_PORT_NAME 4
/* == In-qemu interface == */
@@ -84,6 +85,13 @@ struct VirtIOSerialPort {
VirtQueue *ivq, *ovq;
/*
+ * This name is sent to the guest and exported via sysfs.
+ * The guest could create symlinks based on this information.
+ * The name is in the reverse fqdn format, like org.qemu.console.0
+ */
+ char *name;
+
+ /*
* This id helps identify ports between the guest and the host.
* The guest sends a "header" with this id with each data packet
* that it sends and the host can then find out which associated
--
1.6.2.5

View File

@ -1,40 +0,0 @@
From c101ff585d5b156a1f3461015a9acd73f15a45f6 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:55 +0530
Subject: [PATCH 5/9] virtio-serial-bus: Add ability to hot-unplug ports
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-serial-bus.c | 2 ++
hw/virtio-serial.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 6d69c56..037864f 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -517,6 +517,8 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
VirtIOSerial *vser = port->vser;
+ send_control_event(port, VIRTIO_CONSOLE_PORT_REMOVE, 1);
+
/*
* Don't decrement nr_ports here; thus we keep a linearly
* increasing port id. Not utilising an id again saves us a couple
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 28ea7da..f297b00 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -51,6 +51,7 @@ struct virtio_console_control {
#define VIRTIO_CONSOLE_RESIZE 2
#define VIRTIO_CONSOLE_PORT_OPEN 3
#define VIRTIO_CONSOLE_PORT_NAME 4
+#define VIRTIO_CONSOLE_PORT_REMOVE 5
/* == In-qemu interface == */
--
1.6.2.5

View File

@ -1,232 +0,0 @@
From 4945aee74f494cc8a17ce1634b5200eb9ee227d2 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 00:36:53 +0530
Subject: [PATCH 3/9] virtio-serial-bus: Maintain guest and host port open/close state
Via control channel messages, the guest can tell us whether a port got
opened or closed. Similarly, we can also indicate to the guest of host
port open/close events.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
hw/virtio-serial-bus.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++
hw/virtio-serial.h | 6 +++
2 files changed, 100 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 5132c9c..9af21df 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -66,6 +66,11 @@ static VirtIOSerialPort *find_port_by_vq(VirtIOSerial *vser, VirtQueue *vq)
return NULL;
}
+static bool use_multiport(VirtIOSerial *vser)
+{
+ return vser->vdev.features & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
+}
+
static size_t write_to_port(VirtIOSerialPort *port,
const uint8_t *buf, size_t size)
{
@@ -139,11 +144,22 @@ static size_t send_control_event(VirtIOSerialPort *port, uint16_t event,
/* Functions for use inside qemu to open and read from/write to ports */
int virtio_serial_open(VirtIOSerialPort *port)
{
+ /* Don't allow opening an already-open port */
+ if (port->host_connected) {
+ return 0;
+ }
+ /* Send port open notification to the guest */
+ port->host_connected = true;
+ send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
+
return 0;
}
int virtio_serial_close(VirtIOSerialPort *port)
{
+ port->host_connected = false;
+ send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
+
return 0;
}
@@ -151,6 +167,9 @@ int virtio_serial_close(VirtIOSerialPort *port)
ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf,
size_t size)
{
+ if (!port || !port->host_connected || !port->guest_connected) {
+ return 0;
+ }
return write_to_port(port, buf, size);
}
@@ -167,6 +186,9 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port)
virtio_queue_empty(vq)) {
return 0;
}
+ if (use_multiport(port->vser) && !port->guest_connected) {
+ return 0;
+ }
if (virtqueue_avail_bytes(vq, 4096, 0)) {
return 4096;
@@ -203,6 +225,11 @@ static void handle_control_message(VirtIOSerial *vser, void *buf)
if (port->is_console) {
send_control_event(port, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
}
+
+ if (port->host_connected) {
+ send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
+ }
+
/*
* When the guest has asked us for this information it means
* the guest is all setup and has its virtqueues
@@ -213,6 +240,19 @@ static void handle_control_message(VirtIOSerial *vser, void *buf)
port->info->guest_ready(port);
}
break;
+
+ case VIRTIO_CONSOLE_PORT_OPEN:
+ port->guest_connected = cpkt.value;
+ if (cpkt.value && port->info->guest_open) {
+ /* Send the guest opened notification if an app is interested */
+ port->info->guest_open(port);
+ }
+
+ if (!cpkt.value && port->info->guest_close) {
+ /* Send the guest closed notification if an app is interested */
+ port->info->guest_close(port);
+ }
+ break;
}
}
@@ -300,6 +340,8 @@ static void set_config(VirtIODevice *vdev, const uint8_t *config_data)
static void virtio_serial_save(QEMUFile *f, void *opaque)
{
VirtIOSerial *s = opaque;
+ VirtIOSerialPort *port;
+ uint32_t nr_active_ports;
/* The virtio device */
virtio_save(&s->vdev, f);
@@ -308,15 +350,41 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
qemu_put_be16s(f, &s->config.cols);
qemu_put_be16s(f, &s->config.rows);
qemu_put_be32s(f, &s->config.nr_ports);
+
+ /* Items in struct VirtIOSerial */
+
+ /* Do this because we might have hot-unplugged some ports */
+ nr_active_ports = 0;
+ QTAILQ_FOREACH(port, &s->ports, next)
+ nr_active_ports++;
+
+ qemu_put_be32s(f, &nr_active_ports);
+
+ /*
+ * Items in struct VirtIOSerialPort.
+ */
+ QTAILQ_FOREACH(port, &s->ports, next) {
+ /*
+ * We put the port number because we may not have an active
+ * port at id 0 that's reserved for a console port, or in case
+ * of ports that might have gotten unplugged
+ */
+ qemu_put_be32s(f, &port->id);
+ qemu_put_byte(f, port->guest_connected);
+ }
}
static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOSerial *s = opaque;
+ VirtIOSerialPort *port;
+ uint32_t nr_active_ports;
+ unsigned int i;
if (version_id > 2) {
return -EINVAL;
}
+
/* The virtio device */
virtio_load(&s->vdev, f);
@@ -329,6 +397,20 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_be16s(f, &s->config.rows);
s->config.nr_ports = qemu_get_be32(f);
+ /* Items in struct VirtIOSerial */
+
+ qemu_get_be32s(f, &nr_active_ports);
+
+ /* Items in struct VirtIOSerialPort */
+ for (i = 0; i < nr_active_ports; i++) {
+ uint32_t id;
+
+ id = qemu_get_be32(f);
+ port = find_port_by_id(s, id);
+
+ port->guest_connected = qemu_get_byte(f);
+ }
+
return 0;
}
@@ -357,6 +439,10 @@ static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
monitor_printf(mon, "%*s dev-prop-int: id: %u\n",
indent, "", port->id);
+ monitor_printf(mon, "%*s dev-prop-int: guest_connected: %d\n",
+ indent, "", port->guest_connected);
+ monitor_printf(mon, "%*s dev-prop-int: host_connected: %d\n",
+ indent, "", port->host_connected);
}
static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
@@ -390,6 +476,14 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
port->id = plugging_port0 ? 0 : port->vser->config.nr_ports++;
+ if (!use_multiport(port->vser)) {
+ /*
+ * Allow writes to guest in this case; we have no way of
+ * knowing if a guest port is connected.
+ */
+ port->guest_connected = true;
+ }
+
QTAILQ_INSERT_TAIL(&port->vser->ports, port, next);
port->ivq = port->vser->ivqs[port->id];
port->ovq = port->vser->ovqs[port->id];
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index fe8e357..d9c7acb 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -49,6 +49,7 @@ struct virtio_console_control {
#define VIRTIO_CONSOLE_PORT_READY 0
#define VIRTIO_CONSOLE_CONSOLE_PORT 1
#define VIRTIO_CONSOLE_RESIZE 2
+#define VIRTIO_CONSOLE_PORT_OPEN 3
/* == In-qemu interface == */
@@ -92,6 +93,11 @@ struct VirtIOSerialPort {
/* Identify if this is a port that binds with hvc in the guest */
uint8_t is_console;
+
+ /* Is the corresponding guest device open? */
+ bool guest_connected;
+ /* Is this device open for IO on the host? */
+ bool host_connected;
};
struct VirtIOSerialPortInfo {
--
1.6.2.5

View File

@ -1,25 +0,0 @@
--- a/hw/virtio-serial-bus.c 2010-02-09 00:41:21.000000000 -0600
+++ b/hw/virtio-serial-bus.c 2010-02-09 00:07:13.000000000 -0600
@@ -68,7 +68,7 @@ static VirtIOSerialPort *find_port_by_vq
static bool use_multiport(VirtIOSerial *vser)
{
- return vser->vdev.features & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
+ return vser->vdev.guest_features & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
}
static size_t write_to_port(VirtIOSerialPort *port,
@@ -333,9 +333,11 @@ static void handle_input(VirtIODevice *v
{
}
-static uint32_t get_features(VirtIODevice *vdev)
+static uint32_t get_features(VirtIODevice *vdev, uint32_t features)
{
- return 1 << VIRTIO_CONSOLE_F_MULTIPORT;
+ features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT);
+
+ return features;
}
/* Guest requested config info */

102
qemu.init
View File

@ -1,102 +0,0 @@
#!/bin/sh
#
# qemu Allow users to run non-native Linux programs by just clicking on them
# (or typing ./file.exe)
#
# chkconfig: 2345 35 98
# description: Allow users to run non-native Linux programs by just clicking \
# on them (or typing ./file.exe)
. /etc/rc.d/init.d/functions
RETVAL=0
QEMU=/usr/bin
start() {
cpu=`uname -m`
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="i386"
;;
"Power Macintosh"|ppc|ppc64)
cpu="ppc"
;;
armv4l|armv5l)
cpu="arm"
;;
sh4)
cpu="sh4"
;;
esac
echo -n $"Registering binary handler for qemu applications"
/sbin/modprobe binfmt_misc &>/dev/null
if [ "$cpu" != i386 -a -x $QEMU/qemu-i386 -a -d /usr/qemu-i386 ] ; then
echo ":qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:$QEMU/qemu-i386:" > /proc/sys/fs/binfmt_misc/register
echo ":qemu-i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:$QEMU/qemu-i386:" > /proc/sys/fs/binfmt_misc/register
fi
if [ "$cpu" != arm -a -x $QEMU/qemu-arm -a -d /usr/qemu-arm ] ; then
echo ":qemu-arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:$QEMU/qemu-arm:" > /proc/sys/fs/binfmt_misc/register
fi
if [ "$cpu" != ppc -a -x $QEMU/qemu-ppc -a -d /usr/qemu-ppc ] ; then
echo ":ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:$QEMU/qemu-ppc:" > /proc/sys/fs/binfmt_misc/register
echo do ppc
fi
if [ "$cpu" != sparc -a -x $QEMU/qemu-sparc -a -d /usr/qemu-sparc ] ; then
echo ":qemu-sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:$QEMU/qemu-sparc:" > /proc/sys/fs/binfmt_misc/register
fi
if [ "$cpu" != sh4 -a -x $QEMU/qemu-sh4 -a -d /usr/qemu-sh4 ] ; then
echo ":qemu-sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:$QEMU/qemu-sh4:" > /proc/sys/fs/binfmt_misc/register
fi
echo
}
stop() {
echo -n $"Unregistering binary handler for qemu applications"
for a in i386 i486 ppc arm sparc sh4 ] ; do
[ -r /proc/sys/fs/binfmt_misc/qemu-$a ] && echo "-1" >/proc/sys/fs/binfmt_misc/qemu-$a
done
echo
}
reload() {
stop
start
}
qemu_status() {
if ls /proc/sys/fs/binfmt_misc/qemu-* &>/dev/null; then
echo $"qemu binary format handlers are registered."
return 0
else
echo $"qemu binary format handlers are not registered."
return 3
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
qemu_status
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if qemu_status &>/dev/null; then
stop
start
fi
;;
*)
echo $"Usage: $prog {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL

2899
qemu.spec

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
ab484975004f66fb48cb5589bd9b9dcb qemu-kvm-0.12.3.tar.gz
SHA512 (qemu-5.2.0-rc4.tar.xz) = 47e918392609c34f904962e5759125485407ae52c273053729054300e10fc67fc7ed443c9af25d1d852a5f5c70eee125c703ce15d0e571068848f405de33db3b