3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #8603 from ts468/upstream.xen

Xen related stuff
This commit is contained in:
Mateusz Kowalczyk 2015-07-04 16:13:33 +01:00
commit 2bd811155e
15 changed files with 858 additions and 59 deletions

View file

@ -47,13 +47,32 @@ in
'';
};
virtualisation.xen.bridge =
mkOption {
default = "xenbr0";
description =
''
Create a bridge for the Xen domUs to connect to.
virtualisation.xen.bridge = {
name = mkOption {
default = "xenbr0";
description = ''
Name of bridge the Xen domUs connect to.
'';
};
address = mkOption {
type = types.str;
default = "172.16.0.1";
description = ''
IPv4 address of the bridge.
'';
};
prefixLength = mkOption {
type = types.addCheck types.int (n: n >= 0 && n <= 32);
default = 16;
description = ''
Subnet mask of the bridge interface, specified as the number of
bits in the prefix (<literal>24</literal>).
A DHCP server will provide IP addresses for the whole, remaining
subnet.
'';
};
};
virtualisation.xen.stored =
@ -261,11 +280,71 @@ in
description = "Xen bridge";
wantedBy = [ "multi-user.target" ];
before = [ "xen-domains.service" ];
serviceConfig.RemainAfterExit = "yes";
serviceConfig.ExecStart = "${pkgs.bridge-utils}/bin/brctl addbr ${cfg.bridge}";
postStart = "${pkgs.inetutils}/bin/ifconfig ${cfg.bridge} up";
serviceConfig.ExecStop = "${pkgs.inetutils}/bin/ifconfig ${cfg.bridge} down";
postStop = "${pkgs.bridge-utils}/bin/brctl delbr ${cfg.bridge}";
preStart = ''
mkdir -p /var/run/xen
touch /var/run/xen/dnsmasq.pid
touch /var/run/xen/dnsmasq.etherfile
touch /var/run/xen/dnsmasq.leasefile
IFS='-' read -a data <<< `${pkgs.sipcalc}/bin/sipcalc ${cfg.bridge.address}/${toString cfg.bridge.prefixLength} | grep Usable\ range`
export XEN_BRIDGE_IP_RANGE_START="${"\${data[1]//[[:blank:]]/}"}"
export XEN_BRIDGE_IP_RANGE_END="${"\${data[2]//[[:blank:]]/}"}"
IFS='-' read -a data <<< `${pkgs.sipcalc}/bin/sipcalc ${cfg.bridge.address}/${toString cfg.bridge.prefixLength} | grep Network\ address`
export XEN_BRIDGE_NETWORK_ADDRESS="${"\${data[1]//[[:blank:]]/}"}"
echo "${cfg.bridge.address} host gw dns" > /var/run/xen/dnsmasq.hostsfile
cat <<EOF > /var/run/xen/dnsmasq.conf
no-daemon
pid-file=/var/run/xen/dnsmasq.pid
interface=${cfg.bridge.name}
except-interface=lo
bind-interfaces
auth-server=dns.xen.local,${cfg.bridge.name}
auth-zone=xen.local,$XEN_BRIDGE_NETWORK_ADDRESS/${toString cfg.bridge.prefixLength}
domain=xen.local
addn-hosts=/var/run/xen/dnsmasq.hostsfile
expand-hosts
strict-order
no-hosts
bogus-priv
no-resolv
no-poll
filterwin2k
clear-on-reload
domain-needed
dhcp-hostsfile=/var/run/xen/dnsmasq.etherfile
dhcp-authoritative
dhcp-range=$XEN_BRIDGE_IP_RANGE_START,$XEN_BRIDGE_IP_RANGE_END,$XEN_BRIDGE_NETWORK_ADDRESS
dhcp-no-override
no-ping
dhcp-leasefile=/var/run/xen/dnsmasq.leasefile
EOF
# DHCP
${pkgs.iptables}/bin/iptables -I INPUT -i ${cfg.bridge.name} -p tcp -s $XEN_BRIDGE_NETWORK_ADDRESS/${toString cfg.bridge.prefixLength} --sport 68 --dport 67 -j ACCEPT
${pkgs.iptables}/bin/iptables -I INPUT -i ${cfg.bridge.name} -p udp -s $XEN_BRIDGE_NETWORK_ADDRESS/${toString cfg.bridge.prefixLength} --sport 68 --dport 67 -j ACCEPT
# DNS
${pkgs.iptables}/bin/iptables -I INPUT -i ${cfg.bridge.name} -p tcp -d ${cfg.bridge.address} --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
${pkgs.iptables}/bin/iptables -I INPUT -i ${cfg.bridge.name} -p udp -d ${cfg.bridge.address} --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
${pkgs.bridge-utils}/bin/brctl addbr ${cfg.bridge.name}
${pkgs.inetutils}/bin/ifconfig ${cfg.bridge.name} ${cfg.bridge.address}
${pkgs.inetutils}/bin/ifconfig ${cfg.bridge.name} up
'';
serviceConfig.ExecStart = "${pkgs.dnsmasq}/bin/dnsmasq --conf-file=/var/run/xen/dnsmasq.conf";
postStop = ''
${pkgs.inetutils}/bin/ifconfig ${cfg.bridge.name} down
${pkgs.bridge-utils}/bin/brctl delbr ${cfg.bridge.name}
# DNS
${pkgs.iptables}/bin/iptables -D INPUT -i ${cfg.bridge.name} -p udp -d ${cfg.bridge.address} --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
${pkgs.iptables}/bin/iptables -D INPUT -i ${cfg.bridge.name} -p tcp -d ${cfg.bridge.address} --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
# DHCP
${pkgs.iptables}/bin/iptables -D INPUT -i ${cfg.bridge.name} -p udp --sport 68 --dport 67 -j ACCEPT
${pkgs.iptables}/bin/iptables -D INPUT -i ${cfg.bridge.name} -p tcp --sport 68 --dport 67 -j ACCEPT
'';
};

View file

@ -0,0 +1,30 @@
{ stdenv, fetchgit }:
stdenv.mkDerivation {
name = "win-pvdrivers-git-20150701";
version = "20150701";
src = fetchgit {
url = "https://github.com/ts468/win-pvdrivers";
rev = "3054d645fc3ee182bea3e97ff01869f01cc3637a";
sha256 = "6232ca2b7c9af874abbcb9262faf2c74c819727ed2eb64599c790879df535106";
};
buildPhase =
let unpack = x: "tar xf $src/${x}.tar; mkdir -p x86/${x} amd64/${x}; cp ${x}/x86/* x86/${x}/.; cp ${x}/x64/* amd64/${x}/.";
in stdenv.lib.concatStringsSep "\n" (map unpack ["xenbus" "xeniface" "xenvif" "xennet" "xenvbd"]);
installPhase = ''
mkdir -p $out
cp -r x86 $out/.
cp -r amd64 $out/.
'';
meta = with stdenv.lib; {
description = "Xen Subproject: Windows PV Driver";
homepage = "http://xenproject.org/downloads/windows-pv-drivers.html";
maintainers = [ maintainers.tstrobel ];
platforms = platforms.linux;
license = licenses.bsd3;
};
}

View file

@ -0,0 +1,38 @@
{ stdenv, fetchurl, p7zip }:
stdenv.mkDerivation {
name = "win-qemu-0.1.105-1";
version = "0.1.105-1";
phases = [ "buildPhase" "installPhase" ];
src = fetchurl {
url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.105-1/virtio-win.iso";
sha256 = "065gz7s77y0q9kfqbr27451sr28rm9azpi88sqjkfph8c6r8q3wc";
};
buildPhase = ''
${p7zip}/bin/7z x $src
'';
installPhase =
let
copy_pvpanic = arch: version: "mkdir -p $out/${arch}/qemupanic; cp pvpanic/${version}/${arch}/* $out/${arch}/qemupanic/. \n";
copy_pciserial = arch: "mkdir -p $out/${arch}/qemupciserial; cp qemupciserial/* $out/${arch}/qemupciserial/. \n";
copy_agent = arch: ''
mkdir -p $out/${arch}/qemuagent
cp guest-agent/${if arch=="x86" then "qemu-ga-x86.msi" else "qemu-ga-x64.msi"} $out/${arch}/qemuagent/qemu-guest-agent.msi
(cd $out/${arch}/qemuagent; ${p7zip}/bin/7z x qemu-guest-agent.msi; rm qemu-guest-agent.msi)
'';
copy = arch: version: (copy_pvpanic arch version) + (copy_pciserial arch) + (copy_agent arch);
in
(copy "amd64" "w8.1") + (copy "x86" "w8.1");
meta = with stdenv.lib; {
description = "Windows QEMU Drivers";
homepage = "https://fedoraproject.org/wiki/Windows_Virtio_Drivers";
maintainers = [ maintainers.tstrobel ];
platforms = platforms.linux;
license = licenses.gpl2;
};
}

View file

@ -0,0 +1,46 @@
{ stdenv, fetchurl, p7zip }:
let
src_x86 = fetchurl {
url = "http://apt.univention.de/download/addons/gplpv-drivers/gplpv_Vista2008x32_signed_0.11.0.373.msi";
sha256 = "04r11xw8ikjmcdhrsk878c86g0d0pvras5arsas3zs6dhgjykqap";
};
src_amd64 = fetchurl {
url = "http://apt.univention.de/download/addons/gplpv-drivers/gplpv_Vista2008x64_signed_0.11.0.373.msi";
sha256 = "00k628mg9b039p8lmg2l9n81dr15svy70p3m6xmq6f0frmci38ph";
};
in
stdenv.mkDerivation {
name = "gplpv-0.11.0.373";
version = "0.11.0.373";
phases = [ "buildPhase" "installPhase" ];
buildPhase = ''
mkdir -p x86
(cd x86; ${p7zip}/bin/7z e ${src_x86})
mkdir -p amd64
(cd amd64; ${p7zip}/bin/7z e ${src_amd64})
'';
installPhase = ''
mkdir -p $out/x86 $out/amd64
cp x86/* $out/x86/.
cp amd64/* $out/amd64/.
'';
meta = with stdenv.lib; {
description = ''
A collection of open source Window PV drivers that allow
Windows to be para-virtualized.
The drivers are signed by Univention with a Software Publishers
Certificate obtained from the VeriSign CA.
'';
homepage = "http://wiki.univention.de/index.php?title=Installing-signed-GPLPV-drivers";
maintainers = [ maintainers.tstrobel ];
platforms = platforms.linux;
license = licenses.gpl2;
};
}

View file

@ -0,0 +1,69 @@
{ stdenv, fetchurl, p7zip, win-virtio }:
let
src_usbdk_x86 = fetchurl {
url = "http://www.spice-space.org/download/windows/usbdk/UsbDk_1.0.4_x86.msi";
sha256 = "17hv8034wk1xqnanm5jxs4741nl7asps1fdz6lhnrpp6gvj6yg9y";
};
src_usbdk_amd64 = fetchurl {
url = "http://www.spice-space.org/download/windows/usbdk/UsbDk_1.0.4_x64.msi";
sha256 = "0alcqsivp33pm8sy0lmkvq7m5yh6mmcmxdl39zjxjra67kw8r2sd";
};
src_qxlwddm = fetchurl {
url = "http://people.redhat.com/~vrozenfe/qxlwddm/qxlwddm-0.11.zip";
sha256 = "082zdpbh9i3bq2ds8g33rcbcw390jsm7cqf46rrlx02x8r03dm98";
};
src_vdagent_x86 = fetchurl {
url = "http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.3/vdagent_0_7_3_x86.zip";
sha256 = "0d928g49rf4dl79jmvnqh6g864hp1flw1f0384sfp82himm3bxjs";
};
src_vdagent_amd64 = fetchurl {
url = "http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.3/vdagent_0_7_3_x64.zip";
sha256 = "0djmvm66jcmcyhhbjppccbai45nqpva7vyvry6w8nyc0fwi1vm9l";
};
in
stdenv.mkDerivation {
# use version number of qxlwddm as qxlwddm is the most important component
name = "win-spice-0.11";
version = "0.11";
phases = [ "buildPhase" "installPhase" ];
buildPhase = ''
mkdir -p usbdk/x86 usbdk/amd64
(cd usbdk/x86; ${p7zip}/bin/7z x ${src_usbdk_x86})
(cd usbdk/amd64; ${p7zip}/bin/7z x ${src_usbdk_amd64})
mkdir -p vdagent/x86 vdagent/amd64
(cd vdagent/x86; ${p7zip}/bin/7z x ${src_vdagent_x86}; mv vdagent_0_7_3_x86/* .; rm -r vdagent_0_7_3_x86)
(cd vdagent/amd64; ${p7zip}/bin/7z x ${src_vdagent_amd64}; mv vdagent_0_7_3_x64/* .; rm -r vdagent_0_7_3_x64)
mkdir -p qxlwddm
(cd qxlwddm; ${p7zip}/bin/7z x ${src_qxlwddm}; mv Win8 w8.1; cd w8.1; mv x64 amd64)
'';
installPhase =
let
copy_qxl = arch: version: "mkdir -p $out/${arch}/qxl; cp qxlwddm/${version}/${arch}/* $out/${arch}/qxl/. \n";
copy_usbdk = arch: "mkdir -p $out/${arch}/usbdk; cp usbdk/${arch}/* $out/${arch}/usbdk/. \n";
copy_vdagent = arch: "mkdir -p $out/${arch}/vdagent; cp vdagent/${arch}/* $out/${arch}/vdagent/. \n";
# SPICE needs vioserial
# TODO: Link windows version in win-spice (here) to version used in win-virtio.
# That way it would never matter whether vioserial is installed from win-virtio or win-spice.
copy_vioserial = arch: "mkdir -p $out/${arch}/vioserial; cp ${win-virtio}/${arch}/vioserial/* $out/${arch}/vioserial/. \n";
copy = arch: version: (copy_qxl arch version) + (copy_usbdk arch) + (copy_vdagent arch) + (copy_vioserial arch);
in
(copy "amd64" "w8.1") + (copy "x86" "w8.1");
meta = with stdenv.lib; {
description = ''Windows SPICE Drivers'';
homepage = "http://www.spice-space.org";
maintainers = [ maintainers.tstrobel ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,37 @@
{ stdenv, fetchurl, p7zip }:
stdenv.mkDerivation {
name = "win-virtio-0.1.105-1";
version = "0.1.105-1";
phases = [ "buildPhase" "installPhase" ];
src = fetchurl {
url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.105-1/virtio-win.iso";
sha256 = "065gz7s77y0q9kfqbr27451sr28rm9azpi88sqjkfph8c6r8q3wc";
};
buildPhase = ''
${p7zip}/bin/7z x $src
'';
installPhase =
let
copy = arch: version: {input, output}: "mkdir -p $out/${arch}/${output}; cp ${input}/${version}/${arch}/* $out/${arch}/${output}/.";
virtio = [{input="Balloon"; output="vioballoon";}
{input="NetKVM"; output="vionet";}
{input="vioscsi"; output="vioscsi";}
{input="vioserial"; output="vioserial";}
{input="viostor"; output="viostor";}
{input="viorng"; output="viorng";}
];
in
stdenv.lib.concatStringsSep "\n" ((map (copy "amd64" "w8.1") virtio) ++ (map (copy "x86" "w8.1") virtio));
meta = with stdenv.lib; {
description = "Windows VirtIO Drivers";
homepage = "https://fedoraproject.org/wiki/Windows_Virtio_Drivers";
maintainers = [ maintainers.tstrobel ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,23 @@
diff --git a/src/Kconfig b/src/Kconfig
index 45ca59c..faf8951 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -144,13 +144,13 @@ menu "Hardware support"
config ATA_DMA
depends on ATA
bool "ATA DMA"
- default n
+ default y
help
Detect and try to use ATA bus mastering DMA controllers.
config ATA_PIO32
depends on ATA
bool "ATA 32bit PIO"
- default n
+ default y
help
Use 32bit PIO accesses on ATA (minor optimization on PCI
transfers).
config AHCI
--
1.7.10.4

View file

@ -0,0 +1,104 @@
From bd71555985efc423b1a119b6a3177de855763453 Mon Sep 17 00:00:00 2001
From: Fabio Fantoni <fabio.fantoni@m2r.biz>
Date: Tue, 20 Jan 2015 11:26:30 +0100
Subject: [PATCH] libxl: Spice image compression setting support for upstream
qemu
Usage:
spice_image_compression=[auto_glz|auto_lz|quic|glz|lz|off]
Specifies what image compression is to be used by spice (if given),
otherwise the qemu default will be used.
Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
docs/man/xl.cfg.pod.5 | 6 ++++++
tools/libxl/libxl.h | 11 +++++++++++
tools/libxl/libxl_dm.c | 4 ++++
tools/libxl/libxl_types.idl | 1 +
tools/libxl/xl_cmdimpl.c | 2 ++
5 files changed, 24 insertions(+)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index e2f91fc..0c2cbac 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1427,6 +1427,12 @@ for redirection of up to 4 usb devices from spice client to domU's qemu.
It requires an usb controller and if not defined it will automatically adds
an usb2 controller. The default is disabled (0).
+=item B<spice_image_compression=[auto_glz|auto_lz|quic|glz|lz|off]>
+
+Specifies what image compression is to be used by spice (if given), otherwise
+the qemu default will be used. Please see documentations of your current qemu
+version for details.
+
=back
=head3 Miscellaneous Emulated Hardware
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 0a123f1..b8e0b67 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -528,6 +528,17 @@ typedef struct libxl__ctx libxl_ctx;
#define LIBXL_HAVE_SPICE_USBREDIREDIRECTION 1
/*
+ * LIBXL_HAVE_SPICE_IMAGECOMPRESSION
+ *
+ * If defined, then the libxl_spice_info structure will contain a string type
+ * field: image_compression. This value defines what Spice image compression
+ * is used.
+ *
+ * If this is not defined, the Spice image compression setting support is ignored.
+ */
+#define LIBXL_HAVE_SPICE_IMAGECOMPRESSION 1
+
+/*
* LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1
*
* If this is defined, libxl_domain_create_restore()'s API has changed to
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index c2b0487..40c8649 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -398,6 +398,10 @@ static char *dm_spice_options(libxl__gc *gc,
if (!libxl_defbool_val(spice->clipboard_sharing))
opt = libxl__sprintf(gc, "%s,disable-copy-paste", opt);
+ if (spice->image_compression)
+ opt = libxl__sprintf(gc, "%s,image-compression=%s", opt,
+ spice->image_compression);
+
return opt;
}
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 1214d2e..052ded9 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -241,6 +241,7 @@ libxl_spice_info = Struct("spice_info", [
("vdagent", libxl_defbool),
("clipboard_sharing", libxl_defbool),
("usbredirection", integer),
+ ("image_compression", string),
])
libxl_sdl_info = Struct("sdl_info", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 0b02a6c..00aa69d 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1948,6 +1948,8 @@ skip_vfb:
&b_info->u.hvm.spice.clipboard_sharing, 0);
if (!xlu_cfg_get_long (config, "spiceusbredirection", &l, 0))
b_info->u.hvm.spice.usbredirection = l;
+ xlu_cfg_replace_string (config, "spice_image_compression",
+ &b_info->u.hvm.spice.image_compression, 0);
xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
xlu_cfg_get_defbool(config, "gfx_passthru",
&b_info->u.hvm.gfx_passthru, 0);
--
1.9.2

View file

@ -0,0 +1,104 @@
From 296c7f3284efe655d95a8ae045a5dc1a20d6fff0 Mon Sep 17 00:00:00 2001
From: Fabio Fantoni <fabio.fantoni@m2r.biz>
Date: Tue, 20 Jan 2015 11:33:17 +0100
Subject: [PATCH] libxl: Spice streaming video setting support for upstream
qemu
Usage:
spice_streaming_video=[filter|all|off]
Specifies what streaming video setting is to be used by spice (if
given),
otherwise the qemu default will be used.
Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
docs/man/xl.cfg.pod.5 | 5 +++++
tools/libxl/libxl.h | 11 +++++++++++
tools/libxl/libxl_dm.c | 4 ++++
tools/libxl/libxl_types.idl | 1 +
tools/libxl/xl_cmdimpl.c | 2 ++
5 files changed, 23 insertions(+)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index 0c2cbac..408653f 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1433,6 +1433,11 @@ Specifies what image compression is to be used by spice (if given), otherwise
the qemu default will be used. Please see documentations of your current qemu
version for details.
+=item B<spice_streaming_video=[filter|all|off]>
+
+Specifies what streaming video setting is to be used by spice (if given),
+otherwise the qemu default will be used.
+
=back
=head3 Miscellaneous Emulated Hardware
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index b8e0b67..c219f59 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -539,6 +539,17 @@ typedef struct libxl__ctx libxl_ctx;
#define LIBXL_HAVE_SPICE_IMAGECOMPRESSION 1
/*
+ * LIBXL_HAVE_SPICE_STREAMINGVIDEO
+ *
+ * If defined, then the libxl_spice_info structure will contain a string type
+ * field: streaming_video. This value defines what Spice streaming video setting
+ * is used.
+ *
+ * If this is not defined, the Spice streaming video setting support is ignored.
+ */
+#define LIBXL_HAVE_SPICE_STREAMINGVIDEO 1
+
+/*
* LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1
*
* If this is defined, libxl_domain_create_restore()'s API has changed to
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 40c8649..d8d6f0c 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -402,6 +402,10 @@ static char *dm_spice_options(libxl__gc *gc,
opt = libxl__sprintf(gc, "%s,image-compression=%s", opt,
spice->image_compression);
+ if (spice->streaming_video)
+ opt = libxl__sprintf(gc, "%s,streaming-video=%s", opt,
+ spice->streaming_video);
+
return opt;
}
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 052ded9..02be466 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -242,6 +242,7 @@ libxl_spice_info = Struct("spice_info", [
("clipboard_sharing", libxl_defbool),
("usbredirection", integer),
("image_compression", string),
+ ("streaming_video", string),
])
libxl_sdl_info = Struct("sdl_info", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 00aa69d..b7eac29 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1950,6 +1950,8 @@ skip_vfb:
b_info->u.hvm.spice.usbredirection = l;
xlu_cfg_replace_string (config, "spice_image_compression",
&b_info->u.hvm.spice.image_compression, 0);
+ xlu_cfg_replace_string (config, "spice_streaming_video",
+ &b_info->u.hvm.spice.streaming_video, 0);
xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
xlu_cfg_get_defbool(config, "gfx_passthru",
&b_info->u.hvm.gfx_passthru, 0);
--
1.9.2

View file

@ -0,0 +1,165 @@
From 161212ef02312c0681d2d809c8ff1e1f0ea6f6f9 Mon Sep 17 00:00:00 2001
From: Fabio Fantoni <fabio.fantoni@m2r.biz>
Date: Wed, 29 Apr 2015 11:20:28 +0200
Subject: [PATCH] libxl: Add qxl vga interface support for upstream qemu
Usage:
vga="qxl"
Qxl vga support many resolutions that not supported by stdvga,
mainly the 16:9 ones and other high up to 2560x1600.
With QXL you can get improved performance and smooth video also
with high resolutions and high quality.
Require their drivers installed in the domU and spice used
otherwise act as a simple stdvga.
Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Signed-off-by: Zhou Peng <zpengxen@gmail.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
---
docs/man/xl.cfg.pod.5 | 10 +++++++++-
tools/libxl/libxl.h | 10 ++++++++++
tools/libxl/libxl_create.c | 13 +++++++++++++
tools/libxl/libxl_dm.c | 8 ++++++++
tools/libxl/libxl_types.idl | 1 +
tools/libxl/xl_cmdimpl.c | 2 ++
6 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index f936dfc..8e4154f 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1360,6 +1360,9 @@ qemu-xen-traditional device-model, the amount of video RAM is fixed at 4 MB,
which is sufficient for 1024x768 at 32 bpp. For the upstream qemu-xen
device-model, the default and minimum is 8 MB.
+For B<qxl> vga, the default is both default and minimal 128MB.
+If B<videoram> is set less than 128MB, an error will be triggered.
+
=item B<stdvga=BOOLEAN>
Select a standard VGA card with VBE (VESA BIOS Extensions) as the
@@ -1371,9 +1374,14 @@ This option is deprecated, use vga="stdvga" instead.
=item B<vga="STRING">
-Selects the emulated video card (none|stdvga|cirrus).
+Selects the emulated video card (none|stdvga|cirrus|qxl).
The default is cirrus.
+In general, QXL should work with the Spice remote display protocol
+for acceleration, and QXL driver is necessary in guest in this case.
+QXL can also work with the VNC protocol, but it will be like a standard
+VGA without acceleration.
+
=item B<vnc=BOOLEAN>
Allow access to the display via the VNC protocol. This enables the
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 44bd8e2..efc0617 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -535,6 +535,16 @@ typedef struct libxl__ctx libxl_ctx;
#define LIBXL_HAVE_DOMINFO_OUTSTANDING_MEMKB 1
/*
+ * LIBXL_HAVE_QXL
+ *
+ * If defined, then the libxl_vga_interface_type will contain another value:
+ * "QXL". This value define if qxl vga is supported.
+ *
+ * If this is not defined, the qxl vga support is missed.
+ */
+#define LIBXL_HAVE_QXL 1
+
+/*
* LIBXL_HAVE_SPICE_VDAGENT
*
* If defined, then the libxl_spice_info structure will contain a boolean type:
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index e5a343f..188f7df 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -248,6 +248,10 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
b_info->video_memkb = 0;
break;
+ case LIBXL_VGA_INTERFACE_TYPE_QXL:
+ LOG(ERROR,"qemu upstream required for qxl vga");
+ return ERROR_INVAL;
+ break;
case LIBXL_VGA_INTERFACE_TYPE_STD:
if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
b_info->video_memkb = 8 * 1024;
@@ -272,6 +276,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
b_info->video_memkb = 0;
break;
+ case LIBXL_VGA_INTERFACE_TYPE_QXL:
+ if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT) {
+ b_info->video_memkb = (128 * 1024);
+ } else if (b_info->video_memkb < (128 * 1024)) {
+ LOG(ERROR,
+ "128 Mib videoram is the minimum for qxl default");
+ return ERROR_INVAL;
+ }
+ break;
case LIBXL_VGA_INTERFACE_TYPE_STD:
if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
b_info->video_memkb = 16 * 1024;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 30c1578..58c9b99 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -251,6 +251,8 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
case LIBXL_VGA_INTERFACE_TYPE_NONE:
flexarray_append_pair(dm_args, "-vga", "none");
break;
+ case LIBXL_VGA_INTERFACE_TYPE_QXL:
+ break;
}
if (b_info->u.hvm.boot) {
@@ -625,6 +627,12 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
break;
case LIBXL_VGA_INTERFACE_TYPE_NONE:
break;
+ case LIBXL_VGA_INTERFACE_TYPE_QXL:
+ /* QXL have 2 ram regions, ram and vram */
+ flexarray_append_pair(dm_args, "-device",
+ GCSPRINTF("qxl-vga,vram_size_mb=%"PRIu64",ram_size_mb=%"PRIu64,
+ (b_info->video_memkb/2/1024), (b_info->video_memkb/2/1024) ) );
+ break;
}
if (b_info->u.hvm.boot) {
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 117b61d..023b21e 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -183,6 +183,7 @@ libxl_vga_interface_type = Enumeration("vga_interface_type", [
(1, "CIRRUS"),
(2, "STD"),
(3, "NONE"),
+ (4, "QXL"),
], init_val = "LIBXL_VGA_INTERFACE_TYPE_CIRRUS")
libxl_vendor_device = Enumeration("vendor_device", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 648ca08..526a1f6 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2115,6 +2115,8 @@ skip_vfb:
b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS;
} else if (!strcmp(buf, "none")) {
b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE;
+ } else if (!strcmp(buf, "qxl")) {
+ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_QXL;
} else {
fprintf(stderr, "Unknown vga \"%s\" specified\n", buf);
exit(1);
--
1.9.2

View file

@ -14,30 +14,34 @@ let
# Sources needed to build the xen tools and tools/firmware.
toolsGits =
[ # tag qemu-xen-4.4.1
{ name = "qemu-xen";
url = git://xenbits.xen.org/qemu-upstream-4.4-testing.git;
rev = "65fc9b78ba3d868a26952db0d8e51cecf01d47b4";
sha256 = "e24fb58f773fd9134c5aae6d3ca7e9f754dc9822de92b1eb2cedc76faf911f18";
{ git = { name = "qemu-xen";
url = git://xenbits.xen.org/qemu-upstream-4.4-testing.git;
rev = "65fc9b78ba3d868a26952db0d8e51cecf01d47b4";
sha256 = "e24fb58f773fd9134c5aae6d3ca7e9f754dc9822de92b1eb2cedc76faf911f18";
};
}
# tag xen-4.4.1
{ name = "qemu-xen-traditional";
url = git://xenbits.xen.org/qemu-xen-4.4-testing.git;
rev = "6ae4e588081620b141071eb010ec40aca7e12876";
sha256 = "b1ed1feb92fbe658273a8d6d38d6ea60b79c1658413dd93979d6d128d8554ded";
{ git = { name = "qemu-xen-traditional";
url = git://xenbits.xen.org/qemu-xen-4.4-testing.git;
rev = "6ae4e588081620b141071eb010ec40aca7e12876";
sha256 = "b1ed1feb92fbe658273a8d6d38d6ea60b79c1658413dd93979d6d128d8554ded";
};
}
];
firmwareGits =
[ # tag 1.7.3.1
{ name = "seabios";
url = git://xenbits.xen.org/seabios.git;
rev = "7d9cbe613694924921ed1a6f8947d711c5832eee";
sha256 = "c071282bbcb1dd0d98536ef90cd1410f5d8da19648138e0e3863bc540d954a87";
{ git = { name = "seabios";
url = git://xenbits.xen.org/seabios.git;
rev = "7d9cbe613694924921ed1a6f8947d711c5832eee";
sha256 = "c071282bbcb1dd0d98536ef90cd1410f5d8da19648138e0e3863bc540d954a87";
};
}
{ name = "ovmf";
url = git://xenbits.xen.org/ovmf.git;
rev = "447d264115c476142f884af0be287622cd244423";
sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
{ git = { name = "ovmf";
url = git://xenbits.xen.org/ovmf.git;
rev = "447d264115c476142f884af0be287622cd244423";
sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
};
}
];

View file

@ -14,30 +14,47 @@ let
# Sources needed to build the xen tools and tools/firmware.
firmwareGits =
[ # tag 1.7.5
{ name = "seabios";
url = git://xenbits.xen.org/seabios.git;
rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
{ git = { name = "seabios";
url = git://xenbits.xen.org/seabios.git;
rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
};
patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ];
}
{ name = "ovmf";
url = git://xenbits.xen.org/ovmf.git;
rev = "447d264115c476142f884af0be287622cd244423";
sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
{ git = { name = "ovmf";
url = git://xenbits.xen.org/ovmf.git;
rev = "447d264115c476142f884af0be287622cd244423";
sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
};
}
];
toolsGits =
[ # tag qemu-xen-4.5.0
{ name = "qemu-xen";
url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
rev = "1ebb75b1fee779621b63e84fefa7b07354c43a99";
sha256 = "1j312q2mqvkvby9adkkxf7f1pn3nz85g5mr9nbg4qpf2y9cg122z";
{ git = { name = "qemu-xen";
url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
rev = "1ebb75b1fee779621b63e84fefa7b07354c43a99";
sha256 = "1j312q2mqvkvby9adkkxf7f1pn3nz85g5mr9nbg4qpf2y9cg122z";
};
}
# tag xen-4.5.0
{ name = "qemu-xen-traditional";
url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
rev = "b0d42741f8e9a00854c3b3faca1da84bfc69bf22";
sha256 = "ce52b5108936c30ab85ec0c9554f88d5e7b34896f3acb666d56765b49c86f2af";
{ git = { name = "qemu-xen-traditional";
url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
rev = "b0d42741f8e9a00854c3b3faca1da84bfc69bf22";
sha256 = "ce52b5108936c30ab85ec0c9554f88d5e7b34896f3acb666d56765b49c86f2af";
};
}
{ git = { name = "xen-libhvm";
url = "https://github.com/ts468/xen-libhvm";
rev = "442dcc4f6f4e374a51e4613532468bd6b48bdf63";
sha256 = "9ba97c39a00a54c154785716aa06691d312c99be498ebbc00dc3769968178ba8";
};
description = ''
Helper library for reading ACPI and SMBIOS firmware values
from the host system for use with the HVM guest firmware
pass-through feature in Xen.
'';
#license = licenses.bsd2;
}
];
@ -52,6 +69,10 @@ let
quilt push -a
substituteInPlace tools/xenguest/Makefile --replace "_BSD_SOURCE" "_DEFAULT_SOURCE"
'';
xenPatches = [ ./0001-libxl-Spice-image-compression-setting-support-for-up.patch
./0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
./0003-Add-qxl-vga-interface-support-for-upstream-qem.patch ];
};
in callPackage ./generic.nix (args // { xenConfig=xenConfig; })

View file

@ -0,0 +1,67 @@
{ callPackage, fetchurl, fetchgit, ... } @ args:
let
# Xen 4.5.1
xenConfig = {
name = "xen-4.5.1";
version = "4.5.1";
src = fetchurl {
url = "http://bits.xensource.com/oss-xen/release/4.5.1/xen-4.5.1.tar.gz";
sha256 = "0w8kbqy7zixacrpbk3yj51xx7b3f6l8ghsg3551w8ym6zka13336";
};
# Sources needed to build the xen tools and tools/firmware.
firmwareGits =
[ # tag 1.7.5
{ git = { name = "seabios";
url = git://xenbits.xen.org/seabios.git;
rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
};
patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ];
}
{ git = { name = "ovmf";
url = git://xenbits.xen.org/ovmf.git;
rev = "447d264115c476142f884af0be287622cd244423";
sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
};
}
];
toolsGits =
[ # tag qemu-xen-4.5.1
{ git = { name = "qemu-xen";
url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
rev = "d9552b0af21c27535cd3c8549bb31d26bbecd506";
sha256 = "15dbz8j26wl4vs5jijhccwgd8c6wkmpj4mz899fa7i1bbh8yysfy";
};
}
# tag xen-4.5.1
{ git = { name = "qemu-xen-traditional";
url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
rev = "afaa35b4bc975b2b89ad44c481d0d7623e3d1c49";
sha256 = "906b31cf32b52d29e521abaa76d641123bdf24f33fa53c6f109b6d7834e514be";
};
}
{ git = { name = "xen-libhvm";
url = "https://github.com/ts468/xen-libhvm";
rev = "442dcc4f6f4e374a51e4613532468bd6b48bdf63";
sha256 = "9ba97c39a00a54c154785716aa06691d312c99be498ebbc00dc3769968178ba8";
};
description = ''
Helper library for reading ACPI and SMBIOS firmware values
from the host system for use with the HVM guest firmware
pass-through feature in Xen.
'';
#license = licenses.bsd2;
}
];
xenPatches = [ ./0001-libxl-Spice-image-compression-setting-support-for-up.patch
./0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
./0003-Add-qxl-vga-interface-support-for-upstream-qem.patch ];
};
in callPackage ./generic.nix (args // { xenConfig=xenConfig; })

View file

@ -3,7 +3,7 @@
, lvm2, utillinux, procps, texinfo, perl, pythonPackages
, glib, bridge-utils, xlibs, pixman, iproute, udev, bison
, flex, cmake, ocaml, ocamlPackages, figlet, libaio, yajl
, checkpolicy, transfig, glusterfs, fetchgit, xz, spice
, checkpolicy, transfig, glusterfs, acl, fetchgit, xz, spice
, spice_protocol, usbredir, alsaLib, quilt
, coreutils, gawk, gnused, gnugrep, diffutils, multipath_tools
, inetutils, iptables, openvswitch, nbd, drbd, xenConfig
@ -69,15 +69,14 @@ stdenv.mkDerivation {
glib bridge-utils pixman iproute udev bison xlibs.libX11
flex ocaml ocamlPackages.findlib figlet libaio
checkpolicy pythonPackages.markdown transfig
glusterfs cmake spice spice_protocol usbredir
glusterfs acl cmake spice spice_protocol usbredir
alsaLib quilt
];
pythonPath = [ pythonPackages.curses ];
patchPhase = if ((xenserverPatched == true) && (builtins.hasAttr "xenserverPatches" xenConfig))
then xenConfig.xenserverPatches
else "";
patches = stdenv.lib.optionals ((xenserverPatched == false) && (builtins.hasAttr "xenPatches" xenConfig)) xenConfig.xenPatches;
patchPhase = stdenv.lib.optional ((xenserverPatched == true) && (builtins.hasAttr "xenserverPatches" xenConfig)) xenConfig.xenserverPatches;
preConfigure = ''
# Fake wget: copy prefetched downloads instead
@ -87,13 +86,9 @@ stdenv.mkDerivation {
echo "cp \$4 \$3" >> wget/wget
chmod +x wget/wget
export PATH=$PATH:$PWD/wget
export EXTRA_QEMUU_CONFIGURE_ARGS="--enable-spice --enable-usb-redir --enable-linux-aio"
'';
# TODO: If multiple arguments are given with with-extra-qemuu,
# then the configuration aborts; the reason is unclear.
# If you know how to fix it, please let me know! :)
#configureFlags = "--with-extra-qemuu-configure-args='--enable-spice --enable-usb-redir --enable-linux-aio'";
# TODO: Flask needs more testing before enabling it by default.
#makeFlags = "XSM_ENABLE=y FLASK_ENABLE=y PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
makeFlags = "PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
@ -154,13 +149,17 @@ stdenv.mkDerivation {
# Xen's tools and firmares need various git repositories that it
# usually checks out at time using git. We can't have that.
${flip concatMapStrings xenConfig.toolsGits (x: let src = fetchgit x; in ''
${flip concatMapStrings xenConfig.toolsGits (x: let src = fetchgit x.git; in ''
cp -r ${src} tools/${src.name}-dir-remote
chmod +w tools/${src.name}-dir-remote
chmod -R +w tools/${src.name}-dir-remote
'' + stdenv.lib.optionalString (builtins.hasAttr "patches" x) ''
( cd tools/${src.name}-dir-remote; ${concatStringsSep "; " (map (p: "patch -p1 < ${p}") x.patches)} )
'')}
${flip concatMapStrings xenConfig.firmwareGits (x: let src = fetchgit x; in ''
${flip concatMapStrings xenConfig.firmwareGits (x: let src = fetchgit x.git; in ''
cp -r ${src} tools/firmware/${src.name}-dir-remote
chmod +w tools/firmware/${src.name}-dir-remote
chmod -R +w tools/firmware/${src.name}-dir-remote
'' + stdenv.lib.optionalString (builtins.hasAttr "patches" x) ''
( cd tools/firmware/${src.name}-dir-remote; ${concatStringsSep "; " (map (p: "patch -p1 < ${p}") x.patches)} )
'')}
# Xen's stubdoms and firmwares need various sources that are usually fetched
@ -178,6 +177,9 @@ stdenv.mkDerivation {
postBuild =
''
make -C docs man-pages
(cd tools/xen-libhvm-dir-remote; make)
(cd tools/xen-libhvm-dir-remote/biospt; cc -Wall -g -D_LINUX -Wstrict-prototypes biospt.c -o biospt -I../libhvm -L../libhvm -lxenhvm)
'';
installPhase =
@ -192,8 +194,11 @@ stdenv.mkDerivation {
shopt -s extglob
for i in $out/etc/xen/scripts/!(*.sh); do
sed -i '2s@^@export PATH=$out/bin:${scriptEnvPath}@' $i
sed -i "2s@^@export PATH=$out/bin:${scriptEnvPath}\n@" $i
done
(cd tools/xen-libhvm-dir-remote; make install)
cp tools/xen-libhvm-dir-remote/biospt/biospt $out/bin/.
'';
meta = {

View file

@ -13203,8 +13203,15 @@ let
xen_4_4_1 = callPackage ../applications/virtualization/xen/4.4.1.nix { };
xen_4_5_0 = callPackage ../applications/virtualization/xen/4.5.0.nix { };
xen_4_5_1 = callPackage ../applications/virtualization/xen/4.5.1.nix { };
xen_xenServer = callPackage ../applications/virtualization/xen/4.5.0.nix { xenserverPatched = true; };
xen = xen_4_5_0;
xen = xen_4_5_1;
win-spice = callPackage ../applications/virtualization/driver/win-spice { };
win-virtio = callPackage ../applications/virtualization/driver/win-virtio { };
win-qemu = callPackage ../applications/virtualization/driver/win-qemu { };
win-pvdrivers = callPackage ../applications/virtualization/driver/win-pvdrivers { };
win-signed-gplpv-drivers = callPackage ../applications/virtualization/driver/win-signed-gplpv-drivers { };
xfe = callPackage ../applications/misc/xfe {
fox = fox_1_6;