mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pci, pc, virtio: fixes, cleanups, tests Lots of work on tests: BiosTablesTest UEFI app, vhost-user testing for non-Linux hosts. Misc cleanups and fixes all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Fri 22 Feb 2019 15:51:40 GMT # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: (26 commits) pci: Sanity test minimum downstream LNKSTA hw/smbios: fix offset of type 3 sku field pci: Move NVIDIA vendor id to the rest of ids virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size virtio-balloon: Use ram_block_discard_range() instead of raw madvise() virtio-balloon: Rework ballon_page() interface virtio-balloon: Corrections to address verification virtio-balloon: Remove unnecessary MADV_WILLNEED on deflate i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue Revert "contrib/vhost-user-blk: fix the compilation issue" pc-dimm: use same mechanism for [get|set]_addr tests/data: introduce "uefi-boot-images" with the "bios-tables-test" ISOs tests/uefi-test-tools: add build scripts tests: introduce "uefi-test-tools" with the BiosTablesTest UEFI app roms: build the EfiRom utility from the roms/edk2 submodule roms: add the edk2 project as a git submodule vhost-user-test: create a temporary directory per TestServer vhost-user-test: small changes to init_hugepagefs vhost-user-test: create a main loop per TestServer ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -49,3 +49,6 @@
|
||||
[submodule "tests/fp/berkeley-softfloat-3"]
|
||||
path = tests/fp/berkeley-softfloat-3
|
||||
url = https://github.com/cota/berkeley-softfloat-3
|
||||
[submodule "roms/edk2"]
|
||||
path = roms/edk2
|
||||
url = https://github.com/tianocore/edk2.git
|
||||
|
||||
@@ -609,7 +609,11 @@ clean:
|
||||
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
|
||||
rm -f qemu-options.def
|
||||
rm -f *.msi
|
||||
find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
|
||||
find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
|
||||
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
|
||||
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
|
||||
! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
|
||||
-exec rm {} +
|
||||
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
|
||||
rm -f fsdev/*.pod scsi/*.pod
|
||||
rm -f qemu-img-cmds.h
|
||||
|
||||
@@ -9,10 +9,9 @@ common-obj-$(CONFIG_POSIX) += hostmem-file.o
|
||||
common-obj-y += cryptodev.o
|
||||
common-obj-y += cryptodev-builtin.o
|
||||
|
||||
ifeq ($(CONFIG_VIRTIO),y)
|
||||
ifeq ($(CONFIG_VIRTIO_CRYPTO),y)
|
||||
common-obj-y += cryptodev-vhost.o
|
||||
common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += \
|
||||
cryptodev-vhost-user.o
|
||||
common-obj-$(CONFIG_VHOST_CRYPTO) += cryptodev-vhost-user.o
|
||||
endif
|
||||
|
||||
common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
|
||||
|
||||
@@ -368,10 +368,10 @@ libattr=""
|
||||
xfs=""
|
||||
tcg="yes"
|
||||
membarrier=""
|
||||
vhost_net="no"
|
||||
vhost_crypto="no"
|
||||
vhost_scsi="no"
|
||||
vhost_vsock="no"
|
||||
vhost_net=""
|
||||
vhost_crypto=""
|
||||
vhost_scsi=""
|
||||
vhost_vsock=""
|
||||
vhost_user=""
|
||||
kvm="no"
|
||||
hax="no"
|
||||
@@ -783,6 +783,7 @@ case $targetos in
|
||||
MINGW32*)
|
||||
mingw32="yes"
|
||||
hax="yes"
|
||||
vhost_user="no"
|
||||
audio_possible_drivers="dsound sdl"
|
||||
if check_include dsound.h; then
|
||||
audio_drv_list="dsound"
|
||||
@@ -884,10 +885,6 @@ Linux)
|
||||
linux="yes"
|
||||
linux_user="yes"
|
||||
kvm="yes"
|
||||
vhost_net="yes"
|
||||
vhost_crypto="yes"
|
||||
vhost_scsi="yes"
|
||||
vhost_vsock="yes"
|
||||
QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES"
|
||||
supported_os="yes"
|
||||
libudev="yes"
|
||||
@@ -1263,11 +1260,7 @@ for opt do
|
||||
;;
|
||||
--disable-vhost-crypto) vhost_crypto="no"
|
||||
;;
|
||||
--enable-vhost-crypto)
|
||||
vhost_crypto="yes"
|
||||
if test "$mingw32" = "yes"; then
|
||||
error_exit "vhost-crypto isn't available on win32"
|
||||
fi
|
||||
--enable-vhost-crypto) vhost_crypto="yes"
|
||||
;;
|
||||
--disable-vhost-scsi) vhost_scsi="no"
|
||||
;;
|
||||
@@ -1476,11 +1469,11 @@ for opt do
|
||||
;;
|
||||
--disable-vhost-user) vhost_user="no"
|
||||
;;
|
||||
--enable-vhost-user)
|
||||
vhost_user="yes"
|
||||
if test "$mingw32" = "yes"; then
|
||||
error_exit "vhost-user isn't available on win32"
|
||||
fi
|
||||
--enable-vhost-user) vhost_user="yes"
|
||||
;;
|
||||
--disable-vhost-kernel) vhost_kernel="no"
|
||||
;;
|
||||
--enable-vhost-kernel) vhost_kernel="yes"
|
||||
;;
|
||||
--disable-capstone) capstone="no"
|
||||
;;
|
||||
@@ -1512,14 +1505,6 @@ for opt do
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$vhost_user" = ""; then
|
||||
if test "$mingw32" = "yes"; then
|
||||
vhost_user="no"
|
||||
else
|
||||
vhost_user="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$cpu" in
|
||||
ppc)
|
||||
CPU_CFLAGS="-m32"
|
||||
@@ -1743,8 +1728,12 @@ disabled with --disable-FEATURE, default is enabled if available:
|
||||
linux-aio Linux AIO support
|
||||
cap-ng libcap-ng support
|
||||
attr attr and xattr support
|
||||
vhost-net vhost-net acceleration support
|
||||
vhost-crypto vhost-crypto acceleration support
|
||||
vhost-net vhost-net kernel acceleration support
|
||||
vhost-vsock virtio sockets device support
|
||||
vhost-scsi vhost-scsi kernel target support
|
||||
vhost-crypto vhost-user-crypto backend support
|
||||
vhost-kernel vhost kernel backend support
|
||||
vhost-user vhost-user backend support
|
||||
spice spice
|
||||
rbd rados block device (rbd)
|
||||
libiscsi iscsi support
|
||||
@@ -1770,7 +1759,6 @@ disabled with --disable-FEATURE, default is enabled if available:
|
||||
jemalloc jemalloc support
|
||||
avx2 AVX2 optimization support
|
||||
replication replication support
|
||||
vhost-vsock virtio sockets device support
|
||||
opengl opengl support
|
||||
virglrenderer virgl rendering support
|
||||
xfsctl xfsctl support
|
||||
@@ -1787,7 +1775,6 @@ disabled with --disable-FEATURE, default is enabled if available:
|
||||
parallels parallels image format support
|
||||
sheepdog sheepdog block driver support
|
||||
crypto-afalg Linux AF_ALG crypto backend driver
|
||||
vhost-user vhost-user support
|
||||
capstone capstone disassembler support
|
||||
debug-mutex mutex debugging support
|
||||
libpmem libpmem support
|
||||
@@ -2177,6 +2164,45 @@ else
|
||||
l2tpv3=no
|
||||
fi
|
||||
|
||||
#########################################
|
||||
# vhost interdependencies and host support
|
||||
|
||||
# vhost backends
|
||||
test "$vhost_user" = "" && vhost_user=yes
|
||||
if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
|
||||
error_exit "vhost-user isn't available on win32"
|
||||
fi
|
||||
test "$vhost_kernel" = "" && vhost_kernel=$linux
|
||||
if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
|
||||
error_exit "vhost-kernel is only available on Linux"
|
||||
fi
|
||||
|
||||
# vhost-kernel devices
|
||||
test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
|
||||
if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
|
||||
error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
|
||||
fi
|
||||
test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
|
||||
if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
|
||||
error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
|
||||
fi
|
||||
|
||||
# vhost-user backends
|
||||
test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
|
||||
if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
|
||||
error_exit "--enable-vhost-net-user requires --enable-vhost-user"
|
||||
fi
|
||||
test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
|
||||
if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
|
||||
error_exit "--enable-vhost-crypto requires --enable-vhost-user"
|
||||
fi
|
||||
|
||||
# OR the vhost-kernel and vhost-user values for simplicity
|
||||
if test "$vhost_net" = ""; then
|
||||
test "$vhost_net_user" = "yes" && vhost_net=yes
|
||||
test "$vhost_kernel" = "yes" && vhost_net=yes
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# MinGW / Mingw-w64 localtime_r/gmtime_r check
|
||||
|
||||
@@ -6622,8 +6648,11 @@ fi
|
||||
if test "$vhost_scsi" = "yes" ; then
|
||||
echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$vhost_net" = "yes" && test "$vhost_user" = "yes"; then
|
||||
echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
|
||||
if test "$vhost_net" = "yes" ; then
|
||||
echo "CONFIG_VHOST_NET=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$vhost_net_user" = "yes" ; then
|
||||
echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$vhost_crypto" = "yes" ; then
|
||||
echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
|
||||
@@ -6631,6 +6660,9 @@ fi
|
||||
if test "$vhost_vsock" = "yes" ; then
|
||||
echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$vhost_kernel" = "yes" ; then
|
||||
echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$vhost_user" = "yes" ; then
|
||||
echo "CONFIG_VHOST_USER=y" >> $config_host_mak
|
||||
fi
|
||||
@@ -7401,12 +7433,6 @@ if supported_xen_target $target; then
|
||||
fi
|
||||
if supported_kvm_target $target; then
|
||||
echo "CONFIG_KVM=y" >> $config_target_mak
|
||||
if test "$vhost_net" = "yes" ; then
|
||||
echo "CONFIG_VHOST_NET=y" >> $config_target_mak
|
||||
if test "$vhost_user" = "yes" ; then
|
||||
echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if supported_hax_target $target; then
|
||||
echo "CONFIG_HAX=y" >> $config_target_mak
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
CONFIG_VHOST_USER_SCSI=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
|
||||
CONFIG_VHOST_USER_BLK=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
|
||||
CONFIG_VHOST_USER_SCSI=$(CONFIG_VHOST_USER)
|
||||
CONFIG_VHOST_USER_BLK=$(CONFIG_VHOST_USER)
|
||||
CONFIG_VIRTIO=y
|
||||
CONFIG_VIRTIO_9P=$(CONFIG_VIRTFS)
|
||||
CONFIG_VIRTIO_BALLOON=y
|
||||
|
||||
+1
-3
@@ -204,9 +204,7 @@ static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
|
||||
|
||||
static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
|
||||
{
|
||||
const PCDIMMDevice *dimm = PC_DIMM(md);
|
||||
|
||||
return dimm->addr;
|
||||
return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, &error_abort);
|
||||
}
|
||||
|
||||
static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
|
||||
|
||||
@@ -37,7 +37,9 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o
|
||||
obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o
|
||||
|
||||
obj-$(CONFIG_VIRTIO_NET) += virtio-net.o
|
||||
obj-y += vhost_net.o
|
||||
common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET)) += vhost_net.o
|
||||
common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET))) += vhost_net-stub.o
|
||||
common-obj-$(CONFIG_ALL) += vhost_net-stub.o
|
||||
|
||||
obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \
|
||||
fsl_etsec/rings.o fsl_etsec/miim.o
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* vhost-net support
|
||||
*
|
||||
* Copyright Red Hat, Inc. 2010
|
||||
*
|
||||
* Authors:
|
||||
* Michael S. Tsirkin <mst@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "net/net.h"
|
||||
#include "net/tap.h"
|
||||
#include "net/vhost-user.h"
|
||||
|
||||
#include "hw/virtio/virtio-net.h"
|
||||
#include "net/vhost_net.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
|
||||
uint64_t vhost_net_get_max_queues(VHostNetState *net)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct vhost_net *vhost_net_init(VhostNetOptions *options)
|
||||
{
|
||||
error_report("vhost-net support is not compiled in");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int vhost_net_start(VirtIODevice *dev,
|
||||
NetClientState *ncs,
|
||||
int total_queues)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
void vhost_net_stop(VirtIODevice *dev,
|
||||
NetClientState *ncs,
|
||||
int total_queues)
|
||||
{
|
||||
}
|
||||
|
||||
void vhost_net_cleanup(struct vhost_net *net)
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t vhost_net_get_acked_features(VHostNetState *net)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool vhost_net_virtqueue_pending(VHostNetState *net, int idx)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
|
||||
int idx, bool mask)
|
||||
{
|
||||
}
|
||||
|
||||
int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
VHostNetState *get_vhost_net(NetClientState *nc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vhost_set_vring_enable(NetClientState *nc, int enable)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+6
-79
@@ -18,17 +18,13 @@
|
||||
#include "net/tap.h"
|
||||
#include "net/vhost-user.h"
|
||||
|
||||
#include "standard-headers/linux/vhost_types.h"
|
||||
#include "hw/virtio/virtio-net.h"
|
||||
#include "net/vhost_net.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
|
||||
#ifdef CONFIG_VHOST_NET
|
||||
#include <linux/vhost.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/kvm.h>
|
||||
#include <netpacket/packet.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
@@ -136,7 +132,7 @@ static int vhost_net_get_fd(NetClientState *backend)
|
||||
return tap_get_fd(backend);
|
||||
default:
|
||||
fprintf(stderr, "vhost-net requires tap backend\n");
|
||||
return -EBADFD;
|
||||
return -ENOSYS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +190,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
|
||||
}
|
||||
|
||||
/* Set sane init value. Override when guest acks. */
|
||||
#ifdef CONFIG_VHOST_NET_USER
|
||||
if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
|
||||
features = vhost_user_get_acked_features(net->nc);
|
||||
if (~net->dev.features & features) {
|
||||
@@ -203,6 +200,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vhost_net_ack_features(net, features);
|
||||
|
||||
@@ -414,10 +412,12 @@ VHostNetState *get_vhost_net(NetClientState *nc)
|
||||
case NET_CLIENT_DRIVER_TAP:
|
||||
vhost_net = tap_get_vhost_net(nc);
|
||||
break;
|
||||
#ifdef CONFIG_VHOST_NET_USER
|
||||
case NET_CLIENT_DRIVER_VHOST_USER:
|
||||
vhost_net = vhost_user_get_vhost_net(nc);
|
||||
assert(vhost_net);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -449,76 +449,3 @@ int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
|
||||
|
||||
return vhost_ops->vhost_net_set_mtu(&net->dev, mtu);
|
||||
}
|
||||
|
||||
#else
|
||||
uint64_t vhost_net_get_max_queues(VHostNetState *net)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct vhost_net *vhost_net_init(VhostNetOptions *options)
|
||||
{
|
||||
error_report("vhost-net support is not compiled in");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int vhost_net_start(VirtIODevice *dev,
|
||||
NetClientState *ncs,
|
||||
int total_queues)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
void vhost_net_stop(VirtIODevice *dev,
|
||||
NetClientState *ncs,
|
||||
int total_queues)
|
||||
{
|
||||
}
|
||||
|
||||
void vhost_net_cleanup(struct vhost_net *net)
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t vhost_net_get_acked_features(VHostNetState *net)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool vhost_net_virtqueue_pending(VHostNetState *net, int idx)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
|
||||
int idx, bool mask)
|
||||
{
|
||||
}
|
||||
|
||||
int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
VHostNetState *get_vhost_net(NetClientState *nc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vhost_set_vring_enable(NetClientState *nc, int enable)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+10
-3
@@ -834,9 +834,12 @@ void pcie_add_capability(PCIDevice *dev,
|
||||
/*
|
||||
* Sync the PCIe Link Status negotiated speed and width of a bridge with the
|
||||
* downstream device. If downstream device is not present, re-write with the
|
||||
* Link Capability fields. Limit width and speed to bridge capabilities for
|
||||
* compatibility. Use config_read to access the downstream device since it
|
||||
* could be an assigned device with volatile link information.
|
||||
* Link Capability fields. If downstream device reports invalid width or
|
||||
* speed, replace with minimum values (LnkSta fields are RsvdZ on VFs but such
|
||||
* values interfere with PCIe native hotplug detecting new devices). Limit
|
||||
* width and speed to bridge capabilities for compatibility. Use config_read
|
||||
* to access the downstream device since it could be an assigned device with
|
||||
* volatile link information.
|
||||
*/
|
||||
void pcie_sync_bridge_lnk(PCIDevice *bridge_dev)
|
||||
{
|
||||
@@ -856,11 +859,15 @@ void pcie_sync_bridge_lnk(PCIDevice *bridge_dev)
|
||||
if ((lnksta & PCI_EXP_LNKSTA_NLW) > (lnkcap & PCI_EXP_LNKCAP_MLW)) {
|
||||
lnksta &= ~PCI_EXP_LNKSTA_NLW;
|
||||
lnksta |= lnkcap & PCI_EXP_LNKCAP_MLW;
|
||||
} else if (!(lnksta & PCI_EXP_LNKSTA_NLW)) {
|
||||
lnksta |= QEMU_PCI_EXP_LNKSTA_NLW(QEMU_PCI_EXP_LNK_X1);
|
||||
}
|
||||
|
||||
if ((lnksta & PCI_EXP_LNKSTA_CLS) > (lnkcap & PCI_EXP_LNKCAP_SLS)) {
|
||||
lnksta &= ~PCI_EXP_LNKSTA_CLS;
|
||||
lnksta |= lnkcap & PCI_EXP_LNKCAP_SLS;
|
||||
} else if (!(lnksta & PCI_EXP_LNKSTA_CLS)) {
|
||||
lnksta |= QEMU_PCI_EXP_LNKSTA_CLS(QEMU_PCI_EXP_LNK_2_5GT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -563,6 +563,7 @@ static void smbios_build_type_3_table(void)
|
||||
t->height = 0;
|
||||
t->number_of_power_cords = 0;
|
||||
t->contained_element_count = 0;
|
||||
t->contained_element_record_length = 0;
|
||||
SMBIOS_TABLE_SET_STR(3, sku_number_str, type3.sku);
|
||||
|
||||
SMBIOS_BUILD_TABLE_POST;
|
||||
|
||||
@@ -526,8 +526,6 @@ static void vfio_probe_ati_bar2_quirk(VFIOPCIDevice *vdev, int nr)
|
||||
* note it for future reference.
|
||||
*/
|
||||
|
||||
#define PCI_VENDOR_ID_NVIDIA 0x10de
|
||||
|
||||
/*
|
||||
* Nvidia has several different methods to get to config space, the
|
||||
* nouveu project has several of these documented here:
|
||||
|
||||
@@ -2,15 +2,18 @@ ifeq ($(CONFIG_VIRTIO),y)
|
||||
common-obj-y += virtio-bus.o
|
||||
obj-y += virtio.o
|
||||
|
||||
obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL)) += vhost.o vhost-backend.o
|
||||
common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL))) += vhost-stub.o
|
||||
obj-$(CONFIG_VHOST_USER) += vhost-user.o
|
||||
|
||||
common-obj-$(CONFIG_VIRTIO_RNG) += virtio-rng.o
|
||||
common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
|
||||
common-obj-$(CONFIG_VIRTIO_MMIO) += virtio-mmio.o
|
||||
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon.o
|
||||
obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-crypto.o
|
||||
obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-pci.o
|
||||
|
||||
obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
|
||||
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o
|
||||
|
||||
ifeq ($(CONFIG_VIRTIO_PCI),y)
|
||||
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o
|
||||
obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o
|
||||
@@ -28,5 +31,4 @@ obj-$(CONFIG_VIRTIO_SERIAL) += virtio-serial-pci.o
|
||||
endif
|
||||
endif
|
||||
|
||||
common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) += vhost-stub.o
|
||||
common-obj-$(CONFIG_ALL) += vhost-stub.o
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <linux/vhost.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "hw/virtio/vhost.h"
|
||||
#include "hw/virtio/vhost-backend.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "standard-headers/linux/vhost_types.h"
|
||||
|
||||
#ifdef CONFIG_VHOST_KERNEL
|
||||
#include <linux/vhost.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
static int vhost_kernel_call(struct vhost_dev *dev, unsigned long int request,
|
||||
void *arg)
|
||||
@@ -265,18 +268,23 @@ static const VhostOps kernel_ops = {
|
||||
.vhost_set_iotlb_callback = vhost_kernel_set_iotlb_callback,
|
||||
.vhost_send_device_iotlb_msg = vhost_kernel_send_device_iotlb_msg,
|
||||
};
|
||||
#endif
|
||||
|
||||
int vhost_set_backend_type(struct vhost_dev *dev, VhostBackendType backend_type)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
switch (backend_type) {
|
||||
#ifdef CONFIG_VHOST_KERNEL
|
||||
case VHOST_BACKEND_TYPE_KERNEL:
|
||||
dev->vhost_ops = &kernel_ops;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_VHOST_USER
|
||||
case VHOST_BACKEND_TYPE_USER:
|
||||
dev->vhost_ops = &user_ops;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
error_report("Unknown vhost backend type");
|
||||
r = -1;
|
||||
|
||||
+12
-1
@@ -27,8 +27,12 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <linux/vhost.h>
|
||||
|
||||
#include "standard-headers/linux/vhost_types.h"
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
#include <linux/userfaultfd.h>
|
||||
#endif
|
||||
|
||||
#define VHOST_MEMORY_MAX_NREGIONS 8
|
||||
#define VHOST_USER_F_PROTOCOL_FEATURES 30
|
||||
@@ -1110,6 +1114,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
/*
|
||||
* Called back from the postcopy fault thread when a fault is received on our
|
||||
* ufd.
|
||||
@@ -1177,6 +1182,7 @@ static int vhost_user_postcopy_waker(struct PostCopyFD *pcfd, RAMBlock *rb,
|
||||
trace_vhost_user_postcopy_waker_nomatch(qemu_ram_get_idstr(rb), offset);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Called at the start of an inbound postcopy on reception of the
|
||||
@@ -1184,6 +1190,7 @@ static int vhost_user_postcopy_waker(struct PostCopyFD *pcfd, RAMBlock *rb,
|
||||
*/
|
||||
static int vhost_user_postcopy_advise(struct vhost_dev *dev, Error **errp)
|
||||
{
|
||||
#ifdef CONFIG_LINUX
|
||||
struct vhost_user *u = dev->opaque;
|
||||
CharBackend *chr = u->user->chr;
|
||||
int ufd;
|
||||
@@ -1227,6 +1234,10 @@ static int vhost_user_postcopy_advise(struct vhost_dev *dev, Error **errp)
|
||||
u->postcopy_fd.idstr = "vhost-user"; /* Need to find unique name */
|
||||
postcopy_register_shared_ufd(&u->postcopy_fd);
|
||||
return 0;
|
||||
#else
|
||||
error_setg(errp, "Postcopy not supported on non-Linux systems");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include "qemu/range.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/memfd.h"
|
||||
#include <linux/vhost.h>
|
||||
#include "standard-headers/linux/vhost_types.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
#include "hw/virtio/virtio-access.h"
|
||||
|
||||
+86
-16
@@ -33,11 +33,81 @@
|
||||
|
||||
#define BALLOON_PAGE_SIZE (1 << VIRTIO_BALLOON_PFN_SHIFT)
|
||||
|
||||
static void balloon_page(void *addr, int deflate)
|
||||
struct PartiallyBalloonedPage {
|
||||
RAMBlock *rb;
|
||||
ram_addr_t base;
|
||||
unsigned long bitmap[];
|
||||
};
|
||||
|
||||
static void balloon_inflate_page(VirtIOBalloon *balloon,
|
||||
MemoryRegion *mr, hwaddr offset)
|
||||
{
|
||||
if (!qemu_balloon_is_inhibited()) {
|
||||
qemu_madvise(addr, BALLOON_PAGE_SIZE,
|
||||
deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
|
||||
void *addr = memory_region_get_ram_ptr(mr) + offset;
|
||||
RAMBlock *rb;
|
||||
size_t rb_page_size;
|
||||
int subpages;
|
||||
ram_addr_t ram_offset, host_page_base;
|
||||
|
||||
/* XXX is there a better way to get to the RAMBlock than via a
|
||||
* host address? */
|
||||
rb = qemu_ram_block_from_host(addr, false, &ram_offset);
|
||||
rb_page_size = qemu_ram_pagesize(rb);
|
||||
host_page_base = ram_offset & ~(rb_page_size - 1);
|
||||
|
||||
if (rb_page_size == BALLOON_PAGE_SIZE) {
|
||||
/* Easy case */
|
||||
|
||||
ram_block_discard_range(rb, ram_offset, rb_page_size);
|
||||
/* We ignore errors from ram_block_discard_range(), because it
|
||||
* has already reported them, and failing to discard a balloon
|
||||
* page is not fatal */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Hard case
|
||||
*
|
||||
* We've put a piece of a larger host page into the balloon - we
|
||||
* need to keep track until we have a whole host page to
|
||||
* discard
|
||||
*/
|
||||
warn_report_once(
|
||||
"Balloon used with backing page size > 4kiB, this may not be reliable");
|
||||
|
||||
subpages = rb_page_size / BALLOON_PAGE_SIZE;
|
||||
|
||||
if (balloon->pbp
|
||||
&& (rb != balloon->pbp->rb
|
||||
|| host_page_base != balloon->pbp->base)) {
|
||||
/* We've partially ballooned part of a host page, but now
|
||||
* we're trying to balloon part of a different one. Too hard,
|
||||
* give up on the old partial page */
|
||||
free(balloon->pbp);
|
||||
balloon->pbp = NULL;
|
||||
}
|
||||
|
||||
if (!balloon->pbp) {
|
||||
/* Starting on a new host page */
|
||||
size_t bitlen = BITS_TO_LONGS(subpages) * sizeof(unsigned long);
|
||||
balloon->pbp = g_malloc0(sizeof(PartiallyBalloonedPage) + bitlen);
|
||||
balloon->pbp->rb = rb;
|
||||
balloon->pbp->base = host_page_base;
|
||||
}
|
||||
|
||||
bitmap_set(balloon->pbp->bitmap,
|
||||
(ram_offset - balloon->pbp->base) / BALLOON_PAGE_SIZE,
|
||||
subpages);
|
||||
|
||||
if (bitmap_full(balloon->pbp->bitmap, subpages)) {
|
||||
/* We've accumulated a full host page, we can actually discard
|
||||
* it now */
|
||||
|
||||
ram_block_discard_range(rb, balloon->pbp->base, rb_page_size);
|
||||
/* We ignore errors from ram_block_discard_range(), because it
|
||||
* has already reported them, and failing to discard a balloon
|
||||
* page is not fatal */
|
||||
|
||||
free(balloon->pbp);
|
||||
balloon->pbp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,17 +292,19 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
|
||||
}
|
||||
|
||||
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &pfn, 4) == 4) {
|
||||
ram_addr_t pa;
|
||||
ram_addr_t addr;
|
||||
hwaddr pa;
|
||||
int p = virtio_ldl_p(vdev, &pfn);
|
||||
|
||||
pa = (ram_addr_t) p << VIRTIO_BALLOON_PFN_SHIFT;
|
||||
pa = (hwaddr) p << VIRTIO_BALLOON_PFN_SHIFT;
|
||||
offset += 4;
|
||||
|
||||
/* FIXME: remove get_system_memory(), but how? */
|
||||
section = memory_region_find(get_system_memory(), pa, 1);
|
||||
if (!int128_nz(section.size) ||
|
||||
!memory_region_is_ram(section.mr) ||
|
||||
section = memory_region_find(get_system_memory(), pa,
|
||||
BALLOON_PAGE_SIZE);
|
||||
if (!section.mr) {
|
||||
trace_virtio_balloon_bad_addr(pa);
|
||||
continue;
|
||||
}
|
||||
if (!memory_region_is_ram(section.mr) ||
|
||||
memory_region_is_rom(section.mr) ||
|
||||
memory_region_is_romd(section.mr)) {
|
||||
trace_virtio_balloon_bad_addr(pa);
|
||||
@@ -242,11 +314,9 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
|
||||
|
||||
trace_virtio_balloon_handle_output(memory_region_name(section.mr),
|
||||
pa);
|
||||
/* Using memory_region_get_ram_ptr is bending the rules a bit, but
|
||||
should be OK because we only want a single page. */
|
||||
addr = section.offset_within_region;
|
||||
balloon_page(memory_region_get_ram_ptr(section.mr) + addr,
|
||||
!!(vq == s->dvq));
|
||||
if (!qemu_balloon_is_inhibited() && vq != s->dvq) {
|
||||
balloon_inflate_page(s, section.mr, section.offset_within_region);
|
||||
}
|
||||
memory_region_unref(section.mr);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
#pragma GCC poison CONFIG_XTENSA_DIS
|
||||
|
||||
#pragma GCC poison CONFIG_LINUX_USER
|
||||
#pragma GCC poison CONFIG_VHOST_NET
|
||||
#pragma GCC poison CONFIG_KVM
|
||||
#pragma GCC poison CONFIG_SOFTMMU
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ struct smbios_type_3 {
|
||||
uint8_t height;
|
||||
uint8_t number_of_power_cords;
|
||||
uint8_t contained_element_count;
|
||||
uint8_t contained_element_record_length;
|
||||
uint8_t sku_number_str;
|
||||
/* contained elements follow */
|
||||
} QEMU_PACKED;
|
||||
|
||||
@@ -271,4 +271,6 @@
|
||||
|
||||
#define PCI_VENDOR_ID_SYNOPSYS 0x16C3
|
||||
|
||||
#define PCI_VENDOR_ID_NVIDIA 0x10de
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user