summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure54
-rw-r--r--hw/i386/acpi-build.c16
-rw-r--r--hw/net/virtio-net.c48
-rw-r--r--hw/scsi/spapr_vscsi.c2
-rw-r--r--hw/scsi/vmw_pvscsi.c3
-rw-r--r--qapi-schema.json3
-rw-r--r--qmp-commands.hx2
-rw-r--r--tests/acpi-test-data/pc/SSDTbin2261 -> 2261 bytes
-rw-r--r--tests/acpi-test-data/q35/SSDTbin550 -> 550 bytes
-rw-r--r--ui/gtk.c17
10 files changed, 110 insertions, 35 deletions
diff --git a/configure b/configure
index aae617e765..5eaa802a80 100755
--- a/configure
+++ b/configure
@@ -318,6 +318,7 @@ glusterfs_zerofill="no"
virtio_blk_data_plane=""
gtk=""
gtkabi="2.0"
+vte=""
tpm="no"
libssh2=""
vhdx=""
@@ -1063,6 +1064,10 @@ for opt do
;;
--with-gtkabi=*) gtkabi="$optarg"
;;
+ --disable-vte) vte="no"
+ ;;
+ --enable-vte) vte="yes"
+ ;;
--enable-tpm) tpm="yes"
;;
--disable-libssh2) libssh2="no"
@@ -1946,30 +1951,41 @@ if test "$gtk" != "no"; then
gtkpackage="gtk+-$gtkabi"
if test "$gtkabi" = "3.0" ; then
gtkversion="3.0.0"
+ else
+ gtkversion="2.18.0"
+ fi
+ if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
+ gtk_cflags=`$pkg_config --cflags $gtkpackage`
+ gtk_libs=`$pkg_config --libs $gtkpackage`
+ libs_softmmu="$gtk_libs $libs_softmmu"
+ gtk="yes"
+ elif test "$gtk" = "yes"; then
+ feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
+ else
+ gtk="no"
+ fi
+fi
+
+##########################################
+# VTE probe
+
+if test "$vte" != "no"; then
+ if test "$gtkabi" = "3.0"; then
vtepackage="vte-2.90"
vteversion="0.32.0"
else
- gtkversion="2.18.0"
vtepackage="vte"
vteversion="0.24.0"
fi
- if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
- if test "$gtk" = "yes" ; then
- feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
- fi
- gtk="no"
- elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
- if test "$gtk" = "yes" ; then
- error_exit "libvte not found (required for gtk support)"
- fi
- gtk="no"
+ if $pkg_config --exists "$vtepackage >= $vteversion"; then
+ vte_cflags=`$pkg_config --cflags $vtepackage`
+ vte_libs=`$pkg_config --libs $vtepackage`
+ libs_softmmu="$vte_libs $libs_softmmu"
+ vte="yes"
+ elif test "$vte" = "yes"; then
+ feature_not_found "vte" "Install libvte or libvte-2.90 (requires --with-gtkabi=3.0 option to configure) devel"
else
- gtk_cflags=`$pkg_config --cflags $gtkpackage`
- gtk_libs=`$pkg_config --libs $gtkpackage`
- vte_cflags=`$pkg_config --cflags $vtepackage`
- vte_libs=`$pkg_config --libs $vtepackage`
- libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
- gtk="yes"
+ vte="no"
fi
fi
@@ -4053,6 +4069,7 @@ fi
echo "pixman $pixman"
echo "SDL support $sdl"
echo "GTK support $gtk"
+echo "VTE support $vte"
echo "curses support $curses"
echo "curl support $curl"
echo "mingw32 support $mingw32"
@@ -4381,6 +4398,9 @@ echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
if test "$gtk" = "yes" ; then
echo "CONFIG_GTK=y" >> $config_host_mak
echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
+fi
+if test "$vte" = "yes" ; then
+ echo "CONFIG_VTE=y" >> $config_host_mak
echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
fi
if test "$xen" = "yes" ; then
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f1054dd831..7597517b97 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1055,9 +1055,21 @@ build_ssdt(GArray *table_data, GArray *linker,
{
GArray *package = build_alloc_array();
- uint8_t op = 0x13; /* VarPackageOp */
+ uint8_t op;
+
+ /*
+ * Note: The ability to create variable-sized packages was first introduced in ACPI 2.0. ACPI 1.0 only
+ * allowed fixed-size packages with up to 255 elements.
+ * Windows guests up to win2k8 fail when VarPackageOp is used.
+ */
+ if (acpi_cpus <= 255) {
+ op = 0x12; /* PackageOp */
+ build_append_byte(package, acpi_cpus); /* NumElements */
+ } else {
+ op = 0x13; /* VarPackageOp */
+ build_append_int(package, acpi_cpus); /* VarNumElements */
+ }
- build_append_int(package, acpi_cpus); /* VarNumElements */
for (i = 0; i < acpi_cpus; i++) {
uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
build_append_byte(package, b);
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index fd23c4627e..439477b954 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -222,13 +222,33 @@ static char *mac_strdup_printf(const uint8_t *mac)
mac[1], mac[2], mac[3], mac[4], mac[5]);
}
+static intList *get_vlan_table(VirtIONet *n)
+{
+ intList *list, *entry;
+ int i, j;
+
+ list = NULL;
+ for (i = 0; i < MAX_VLAN >> 5; i++) {
+ for (j = 0; n->vlans[i] && j <= 0x1f; j++) {
+ if (n->vlans[i] & (1U << j)) {
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = (i << 5) + j;
+ entry->next = list;
+ list = entry;
+ }
+ }
+ }
+
+ return list;
+}
+
static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
+ VirtIODevice *vdev = VIRTIO_DEVICE(n);
RxFilterInfo *info;
strList *str_list, *entry;
- intList *int_list, *int_entry;
- int i, j;
+ int i;
info = g_malloc0(sizeof(*info));
info->name = g_strdup(nc->name);
@@ -273,19 +293,15 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
str_list = entry;
}
info->multicast_table = str_list;
+ info->vlan_table = get_vlan_table(n);
- int_list = NULL;
- for (i = 0; i < MAX_VLAN >> 5; i++) {
- for (j = 0; n->vlans[i] && j < 0x1f; j++) {
- if (n->vlans[i] & (1U << j)) {
- int_entry = g_malloc0(sizeof(*int_entry));
- int_entry->value = (i << 5) + j;
- int_entry->next = int_list;
- int_list = int_entry;
- }
- }
+ if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) {
+ info->vlan = RX_STATE_ALL;
+ } else if (!info->vlan_table) {
+ info->vlan = RX_STATE_NONE;
+ } else {
+ info->vlan = RX_STATE_NORMAL;
}
- info->vlan_table = int_list;
/* enable event notification after query */
nc->rxfilter_notify_enabled = 1;
@@ -514,6 +530,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
}
vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
}
+
+ if ((1 << VIRTIO_NET_F_CTRL_VLAN) & features) {
+ memset(n->vlans, 0, MAX_VLAN >> 3);
+ } else {
+ memset(n->vlans, 0xff, MAX_VLAN >> 3);
+ }
}
static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index 34478f0157..d4ada4f335 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -690,7 +690,7 @@ static void vscsi_inquiry_no_target(VSCSIState *s, vscsi_req *req)
int rc, len, alen;
/* We dont do EVPD. Also check that page_code is 0 */
- if ((cdb[1] & 0x01) || (cdb[1] & 0x01) || cdb[2] != 0) {
+ if ((cdb[1] & 0x01) || cdb[2] != 0) {
/* Send INVALID FIELD IN CDB */
vscsi_makeup_sense(s, req, ILLEGAL_REQUEST, 0x24, 0);
vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index 7d344b944e..e35bff76a9 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -479,12 +479,13 @@ static void
pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid)
{
PVSCSIRequest *pvscsi_req = req->hba_private;
- PVSCSIState *s = pvscsi_req->dev;
+ PVSCSIState *s;
if (!pvscsi_req) {
trace_pvscsi_command_complete_not_found(req->tag);
return;
}
+ s = pvscsi_req->dev;
if (resid) {
/* Short transfer. */
diff --git a/qapi-schema.json b/qapi-schema.json
index b68cd44ebd..391356fe29 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4184,6 +4184,8 @@
#
# @unicast: unicast receive state
#
+# @vlan: vlan receive state (Since 2.0)
+#
# @broadcast-allowed: whether to receive broadcast
#
# @multicast-overflow: multicast table is overflowed or not
@@ -4207,6 +4209,7 @@
'promiscuous': 'bool',
'multicast': 'RxState',
'unicast': 'RxState',
+ 'vlan': 'RxState',
'broadcast-allowed': 'bool',
'multicast-overflow': 'bool',
'unicast-overflow': 'bool',
diff --git a/qmp-commands.hx b/qmp-commands.hx
index a22621fd44..ed3ab9225b 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3407,6 +3407,7 @@ Each array entry contains the following:
- "promiscuous": promiscuous mode is enabled (json-bool)
- "multicast": multicast receive state (one of 'normal', 'none', 'all')
- "unicast": unicast receive state (one of 'normal', 'none', 'all')
+- "vlan": vlan receive state (one of 'normal', 'none', 'all') (Since 2.0)
- "broadcast-allowed": allow to receive broadcast (json-bool)
- "multicast-overflow": multicast table is overflowed (json-bool)
- "unicast-overflow": unicast table is overflowed (json-bool)
@@ -3424,6 +3425,7 @@ Example:
"name": "vnet0",
"main-mac": "52:54:00:12:34:56",
"unicast": "normal",
+ "vlan": "normal",
"vlan-table": [
4,
0
diff --git a/tests/acpi-test-data/pc/SSDT b/tests/acpi-test-data/pc/SSDT
index 727853eece..6444f60ce7 100644
--- a/tests/acpi-test-data/pc/SSDT
+++ b/tests/acpi-test-data/pc/SSDT
Binary files differ
diff --git a/tests/acpi-test-data/q35/SSDT b/tests/acpi-test-data/q35/SSDT
index c7e20ffad2..9199638757 100644
--- a/tests/acpi-test-data/q35/SSDT
+++ b/tests/acpi-test-data/q35/SSDT
Binary files differ
diff --git a/ui/gtk.c b/ui/gtk.c
index baabf865c0..f056e4034b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -54,7 +54,9 @@
#include <gdk/gdkkeysyms.h>
#include <glib/gi18n.h>
#include <locale.h>
+#if defined(CONFIG_VTE)
#include <vte/vte.h>
+#endif
#include <math.h>
#include "trace.h"
@@ -68,6 +70,9 @@
#define MAX_VCS 10
+#if !defined(CONFIG_VTE)
+# define VTE_CHECK_VERSION(a, b, c) 0
+#endif
/* Compatibility define to let us build on both Gtk2 and Gtk3 */
#if GTK_CHECK_VERSION(3, 0, 0)
@@ -105,8 +110,10 @@ typedef struct VirtualConsole
{
GtkWidget *menu_item;
GtkWidget *terminal;
+#if defined(CONFIG_VTE)
GtkWidget *scrolled_window;
CharDriverState *chr;
+#endif
int fd;
} VirtualConsole;
@@ -1063,6 +1070,7 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
if (arg2 == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->vga_item), TRUE);
} else {
+#if defined(CONFIG_VTE)
VirtualConsole *vc = &s->vc[arg2 - 1];
VteTerminal *term = VTE_TERMINAL(vc->terminal);
int width, height;
@@ -1072,6 +1080,9 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE);
gtk_widget_set_size_request(vc->terminal, width, height);
+#else
+ g_assert_not_reached();
+#endif
}
gtk_widget_set_sensitive(s->grab_item, on_vga);
@@ -1117,7 +1128,7 @@ static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
{
VirtualConsole *vc = chr->opaque;
- return write(vc->fd, buf, len);
+ return vc ? write(vc->fd, buf, len) : len;
}
static int nb_vcs;
@@ -1142,6 +1153,7 @@ void early_gtk_display_init(void)
register_vc_handler(gd_vc_handler);
}
+#if defined(CONFIG_VTE)
static gboolean gd_vc_in(GIOChannel *chan, GIOCondition cond, void *opaque)
{
VirtualConsole *vc = opaque;
@@ -1157,10 +1169,12 @@ static gboolean gd_vc_in(GIOChannel *chan, GIOCondition cond, void *opaque)
return TRUE;
}
+#endif
static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group,
GtkWidget *view_menu)
{
+#if defined(CONFIG_VTE)
const char *label;
char buffer[32];
char path[32];
@@ -1230,6 +1244,7 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
chan = g_io_channel_unix_new(vc->fd);
g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc);
+#endif /* CONFIG_VTE */
return group;
}