git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #8603 from ts468/upstream.xen

Xen related stuff

commit2bd811155ecc1249b19c8602c8fd88d92d85d7af authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> dateSat 4 Jul 2015, 16:13 (11 years ago) parent58b600991b8523
15 files changed+858−59
nixos/modules/virtualisation/xen-dom0.nix+90−11 pkgs/applications/virtualization/driver/win-pvdrivers/default.nix+30 pkgs/applications/virtualization/driver/win-qemu/default.nix+38 pkgs/applications/virtualization/driver/win-signed-gplpv-drivers/default.nix+46 pkgs/applications/virtualization/driver/win-spice/default.nix+69 pkgs/applications/virtualization/driver/win-virtio/default.nix+37 pkgs/applications/virtualization/xen/0000-qemu-seabios-enable-ATA_DMA.patch+23 pkgs/applications/virtualization/xen/0001-libxl-Spice-image-compression-setting-support-for-up.patch+104 pkgs/applications/virtualization/xen/0002-libxl-Spice-streaming-video-setting-support-for-upst.patch+104 pkgs/applications/virtualization/xen/0003-Add-qxl-vga-interface-support-for-upstream-qem.patch+165 pkgs/applications/virtualization/xen/4.4.1.nix+20−16 pkgs/applications/virtualization/xen/4.5.0.nix+37−16 pkgs/applications/virtualization/xen/4.5.1.nix+67 pkgs/applications/virtualization/xen/generic.nix+20−15 pkgs/top-level/all-packages.nix+8−1
nixos/modules/virtualisation/xen-dom0.nix+90−11
@@ -47,13 +47,32 @@ in
4747 '';
4848 };
4949
50− virtualisation.xen.bridge =
51− mkOption {
52− default = "xenbr0";
53− description =
54− ''
55− Create a bridge for the Xen domUs to connect to.
50+ virtualisation.xen.bridge = {
51+ name = mkOption {
52+ default = "xenbr0";
53+ description = ''
54+ Name of bridge the Xen domUs connect to.
55+ '';
56+ };
57+
58+ address = mkOption {
59+ type = types.str;
60+ default = "172.16.0.1";
61+ description = ''
62+ IPv4 address of the bridge.
5663 '';
64+ };
65+
66+ prefixLength = mkOption {
67+ type = types.addCheck types.int (n: n >= 0 && n <= 32);
68+ default = 16;
69+ description = ''
70+ Subnet mask of the bridge interface, specified as the number of
71+ bits in the prefix (<literal>24</literal>).
72+ A DHCP server will provide IP addresses for the whole, remaining
73+ subnet.
74+ '';
75+ };
5776 };
5877
5978 virtualisation.xen.stored =
@@ -261,11 +280,71 @@ in
261280 description = "Xen bridge";
262281 wantedBy = [ "multi-user.target" ];
263282 before = [ "xen-domains.service" ];
264− serviceConfig.RemainAfterExit = "yes";
265− serviceConfig.ExecStart = "${pkgs.bridge-utils}/bin/brctl addbr ${cfg.bridge}";
266− postStart = "${pkgs.inetutils}/bin/ifconfig ${cfg.bridge} up";
267− serviceConfig.ExecStop = "${pkgs.inetutils}/bin/ifconfig ${cfg.bridge} down";
268− postStop = "${pkgs.bridge-utils}/bin/brctl delbr ${cfg.bridge}";
283+ preStart = ''
284+ mkdir -p /var/run/xen
285+ touch /var/run/xen/dnsmasq.pid
286+ touch /var/run/xen/dnsmasq.etherfile
287+ touch /var/run/xen/dnsmasq.leasefile
288+
289+ IFS='-' read -a data <<< `${pkgs.sipcalc}/bin/sipcalc ${cfg.bridge.address}/${toString cfg.bridge.prefixLength} | grep Usable\ range`
290+ export XEN_BRIDGE_IP_RANGE_START="${"\${data[1]//[[:blank:]]/}"}"
291+ export XEN_BRIDGE_IP_RANGE_END="${"\${data[2]//[[:blank:]]/}"}"
292+
293+ IFS='-' read -a data <<< `${pkgs.sipcalc}/bin/sipcalc ${cfg.bridge.address}/${toString cfg.bridge.prefixLength} | grep Network\ address`
294+ export XEN_BRIDGE_NETWORK_ADDRESS="${"\${data[1]//[[:blank:]]/}"}"
295+
296+ echo "${cfg.bridge.address} host gw dns" > /var/run/xen/dnsmasq.hostsfile
297+
298+ cat <<EOF > /var/run/xen/dnsmasq.conf
299+ no-daemon
300+ pid-file=/var/run/xen/dnsmasq.pid
301+ interface=${cfg.bridge.name}
302+ except-interface=lo
303+ bind-interfaces
304+ auth-server=dns.xen.local,${cfg.bridge.name}
305+ auth-zone=xen.local,$XEN_BRIDGE_NETWORK_ADDRESS/${toString cfg.bridge.prefixLength}
306+ domain=xen.local
307+ addn-hosts=/var/run/xen/dnsmasq.hostsfile
308+ expand-hosts
309+ strict-order
310+ no-hosts
311+ bogus-priv
312+ no-resolv
313+ no-poll
314+ filterwin2k
315+ clear-on-reload
316+ domain-needed
317+ dhcp-hostsfile=/var/run/xen/dnsmasq.etherfile
318+ dhcp-authoritative
319+ dhcp-range=$XEN_BRIDGE_IP_RANGE_START,$XEN_BRIDGE_IP_RANGE_END,$XEN_BRIDGE_NETWORK_ADDRESS
320+ dhcp-no-override
321+ no-ping
322+ dhcp-leasefile=/var/run/xen/dnsmasq.leasefile
323+ EOF
324+
325+ # DHCP
326+ ${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
327+ ${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
328+ # DNS
329+ ${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
330+ ${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
331+
332+ ${pkgs.bridge-utils}/bin/brctl addbr ${cfg.bridge.name}
333+ ${pkgs.inetutils}/bin/ifconfig ${cfg.bridge.name} ${cfg.bridge.address}
334+ ${pkgs.inetutils}/bin/ifconfig ${cfg.bridge.name} up
335+ '';
336+ serviceConfig.ExecStart = "${pkgs.dnsmasq}/bin/dnsmasq --conf-file=/var/run/xen/dnsmasq.conf";
337+ postStop = ''
338+ ${pkgs.inetutils}/bin/ifconfig ${cfg.bridge.name} down
339+ ${pkgs.bridge-utils}/bin/brctl delbr ${cfg.bridge.name}
340+
341+ # DNS
342+ ${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
343+ ${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
344+ # DHCP
345+ ${pkgs.iptables}/bin/iptables -D INPUT -i ${cfg.bridge.name} -p udp --sport 68 --dport 67 -j ACCEPT
346+ ${pkgs.iptables}/bin/iptables -D INPUT -i ${cfg.bridge.name} -p tcp --sport 68 --dport 67 -j ACCEPT
347+ '';
269348 };
270349
271350
pkgs/applications/virtualization/driver/win-pvdrivers/default.nixnew file+30
@@ -0,0 +1,30 @@
1+{ stdenv, fetchgit }:
2+
3+stdenv.mkDerivation {
4+ name = "win-pvdrivers-git-20150701";
5+ version = "20150701";
6+
7+ src = fetchgit {
8+ url = "https://github.com/ts468/win-pvdrivers";
9+ rev = "3054d645fc3ee182bea3e97ff01869f01cc3637a";
10+ sha256 = "6232ca2b7c9af874abbcb9262faf2c74c819727ed2eb64599c790879df535106";
11+ };
12+
13+ buildPhase =
14+ let unpack = x: "tar xf $src/${x}.tar; mkdir -p x86/${x} amd64/${x}; cp ${x}/x86/* x86/${x}/.; cp ${x}/x64/* amd64/${x}/.";
15+ in stdenv.lib.concatStringsSep "\n" (map unpack ["xenbus" "xeniface" "xenvif" "xennet" "xenvbd"]);
16+
17+ installPhase = ''
18+ mkdir -p $out
19+ cp -r x86 $out/.
20+ cp -r amd64 $out/.
21+ '';
22+
23+ meta = with stdenv.lib; {
24+ description = "Xen Subproject: Windows PV Driver";
25+ homepage = "http://xenproject.org/downloads/windows-pv-drivers.html";
26+ maintainers = [ maintainers.tstrobel ];
27+ platforms = platforms.linux;
28+ license = licenses.bsd3;
29+ };
30+}
pkgs/applications/virtualization/driver/win-qemu/default.nixnew file+38
@@ -0,0 +1,38 @@
1+{ stdenv, fetchurl, p7zip }:
2+
3+stdenv.mkDerivation {
4+ name = "win-qemu-0.1.105-1";
5+ version = "0.1.105-1";
6+
7+ phases = [ "buildPhase" "installPhase" ];
8+
9+ src = fetchurl {
10+ url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.105-1/virtio-win.iso";
11+ sha256 = "065gz7s77y0q9kfqbr27451sr28rm9azpi88sqjkfph8c6r8q3wc";
12+ };
13+
14+ buildPhase = ''
15+ ${p7zip}/bin/7z x $src
16+ '';
17+
18+ installPhase =
19+ let
20+ copy_pvpanic = arch: version: "mkdir -p $out/${arch}/qemupanic; cp pvpanic/${version}/${arch}/* $out/${arch}/qemupanic/. \n";
21+ copy_pciserial = arch: "mkdir -p $out/${arch}/qemupciserial; cp qemupciserial/* $out/${arch}/qemupciserial/. \n";
22+ copy_agent = arch: ''
23+ mkdir -p $out/${arch}/qemuagent
24+ cp guest-agent/${if arch=="x86" then "qemu-ga-x86.msi" else "qemu-ga-x64.msi"} $out/${arch}/qemuagent/qemu-guest-agent.msi
25+ (cd $out/${arch}/qemuagent; ${p7zip}/bin/7z x qemu-guest-agent.msi; rm qemu-guest-agent.msi)
26+ '';
27+ copy = arch: version: (copy_pvpanic arch version) + (copy_pciserial arch) + (copy_agent arch);
28+ in
29+ (copy "amd64" "w8.1") + (copy "x86" "w8.1");
30+
31+ meta = with stdenv.lib; {
32+ description = "Windows QEMU Drivers";
33+ homepage = "https://fedoraproject.org/wiki/Windows_Virtio_Drivers";
34+ maintainers = [ maintainers.tstrobel ];
35+ platforms = platforms.linux;
36+ license = licenses.gpl2;
37+ };
38+}
pkgs/applications/virtualization/driver/win-signed-gplpv-drivers/default.nixnew file+46
@@ -0,0 +1,46 @@
1+{ stdenv, fetchurl, p7zip }:
2+
3+let
4+ src_x86 = fetchurl {
5+ url = "http://apt.univention.de/download/addons/gplpv-drivers/gplpv_Vista2008x32_signed_0.11.0.373.msi";
6+ sha256 = "04r11xw8ikjmcdhrsk878c86g0d0pvras5arsas3zs6dhgjykqap";
7+ };
8+
9+ src_amd64 = fetchurl {
10+ url = "http://apt.univention.de/download/addons/gplpv-drivers/gplpv_Vista2008x64_signed_0.11.0.373.msi";
11+ sha256 = "00k628mg9b039p8lmg2l9n81dr15svy70p3m6xmq6f0frmci38ph";
12+ };
13+in
14+
15+stdenv.mkDerivation {
16+ name = "gplpv-0.11.0.373";
17+ version = "0.11.0.373";
18+
19+ phases = [ "buildPhase" "installPhase" ];
20+
21+ buildPhase = ''
22+ mkdir -p x86
23+ (cd x86; ${p7zip}/bin/7z e ${src_x86})
24+ mkdir -p amd64
25+ (cd amd64; ${p7zip}/bin/7z e ${src_amd64})
26+ '';
27+
28+ installPhase = ''
29+ mkdir -p $out/x86 $out/amd64
30+ cp x86/* $out/x86/.
31+ cp amd64/* $out/amd64/.
32+ '';
33+
34+ meta = with stdenv.lib; {
35+ description = ''
36+ A collection of open source Window PV drivers that allow
37+ Windows to be para-virtualized.
38+ The drivers are signed by Univention with a Software Publishers
39+ Certificate obtained from the VeriSign CA.
40+ '';
41+ homepage = "http://wiki.univention.de/index.php?title=Installing-signed-GPLPV-drivers";
42+ maintainers = [ maintainers.tstrobel ];
43+ platforms = platforms.linux;
44+ license = licenses.gpl2;
45+ };
46+}
pkgs/applications/virtualization/driver/win-spice/default.nixnew file+69
@@ -0,0 +1,69 @@
1+{ stdenv, fetchurl, p7zip, win-virtio }:
2+
3+let
4+ src_usbdk_x86 = fetchurl {
5+ url = "http://www.spice-space.org/download/windows/usbdk/UsbDk_1.0.4_x86.msi";
6+ sha256 = "17hv8034wk1xqnanm5jxs4741nl7asps1fdz6lhnrpp6gvj6yg9y";
7+ };
8+
9+ src_usbdk_amd64 = fetchurl {
10+ url = "http://www.spice-space.org/download/windows/usbdk/UsbDk_1.0.4_x64.msi";
11+ sha256 = "0alcqsivp33pm8sy0lmkvq7m5yh6mmcmxdl39zjxjra67kw8r2sd";
12+ };
13+
14+ src_qxlwddm = fetchurl {
15+ url = "http://people.redhat.com/~vrozenfe/qxlwddm/qxlwddm-0.11.zip";
16+ sha256 = "082zdpbh9i3bq2ds8g33rcbcw390jsm7cqf46rrlx02x8r03dm98";
17+ };
18+
19+ src_vdagent_x86 = fetchurl {
20+ url = "http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.3/vdagent_0_7_3_x86.zip";
21+ sha256 = "0d928g49rf4dl79jmvnqh6g864hp1flw1f0384sfp82himm3bxjs";
22+ };
23+
24+ src_vdagent_amd64 = fetchurl {
25+ url = "http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.3/vdagent_0_7_3_x64.zip";
26+ sha256 = "0djmvm66jcmcyhhbjppccbai45nqpva7vyvry6w8nyc0fwi1vm9l";
27+ };
28+in
29+
30+stdenv.mkDerivation {
31+ # use version number of qxlwddm as qxlwddm is the most important component
32+ name = "win-spice-0.11";
33+ version = "0.11";
34+
35+ phases = [ "buildPhase" "installPhase" ];
36+
37+ buildPhase = ''
38+ mkdir -p usbdk/x86 usbdk/amd64
39+ (cd usbdk/x86; ${p7zip}/bin/7z x ${src_usbdk_x86})
40+ (cd usbdk/amd64; ${p7zip}/bin/7z x ${src_usbdk_amd64})
41+
42+ mkdir -p vdagent/x86 vdagent/amd64
43+ (cd vdagent/x86; ${p7zip}/bin/7z x ${src_vdagent_x86}; mv vdagent_0_7_3_x86/* .; rm -r vdagent_0_7_3_x86)
44+ (cd vdagent/amd64; ${p7zip}/bin/7z x ${src_vdagent_amd64}; mv vdagent_0_7_3_x64/* .; rm -r vdagent_0_7_3_x64)
45+
46+ mkdir -p qxlwddm
47+ (cd qxlwddm; ${p7zip}/bin/7z x ${src_qxlwddm}; mv Win8 w8.1; cd w8.1; mv x64 amd64)
48+ '';
49+
50+ installPhase =
51+ let
52+ copy_qxl = arch: version: "mkdir -p $out/${arch}/qxl; cp qxlwddm/${version}/${arch}/* $out/${arch}/qxl/. \n";
53+ copy_usbdk = arch: "mkdir -p $out/${arch}/usbdk; cp usbdk/${arch}/* $out/${arch}/usbdk/. \n";
54+ copy_vdagent = arch: "mkdir -p $out/${arch}/vdagent; cp vdagent/${arch}/* $out/${arch}/vdagent/. \n";
55+ # SPICE needs vioserial
56+ # TODO: Link windows version in win-spice (here) to version used in win-virtio.
57+ # That way it would never matter whether vioserial is installed from win-virtio or win-spice.
58+ copy_vioserial = arch: "mkdir -p $out/${arch}/vioserial; cp ${win-virtio}/${arch}/vioserial/* $out/${arch}/vioserial/. \n";
59+ copy = arch: version: (copy_qxl arch version) + (copy_usbdk arch) + (copy_vdagent arch) + (copy_vioserial arch);
60+ in
61+ (copy "amd64" "w8.1") + (copy "x86" "w8.1");
62+
63+ meta = with stdenv.lib; {
64+ description = ''Windows SPICE Drivers'';
65+ homepage = "http://www.spice-space.org";
66+ maintainers = [ maintainers.tstrobel ];
67+ platforms = platforms.linux;
68+ };
69+}
pkgs/applications/virtualization/driver/win-virtio/default.nixnew file+37
@@ -0,0 +1,37 @@
1+{ stdenv, fetchurl, p7zip }:
2+
3+stdenv.mkDerivation {
4+ name = "win-virtio-0.1.105-1";
5+ version = "0.1.105-1";
6+
7+ phases = [ "buildPhase" "installPhase" ];
8+
9+ src = fetchurl {
10+ url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.105-1/virtio-win.iso";
11+ sha256 = "065gz7s77y0q9kfqbr27451sr28rm9azpi88sqjkfph8c6r8q3wc";
12+ };
13+
14+ buildPhase = ''
15+ ${p7zip}/bin/7z x $src
16+ '';
17+
18+ installPhase =
19+ let
20+ copy = arch: version: {input, output}: "mkdir -p $out/${arch}/${output}; cp ${input}/${version}/${arch}/* $out/${arch}/${output}/.";
21+ virtio = [{input="Balloon"; output="vioballoon";}
22+ {input="NetKVM"; output="vionet";}
23+ {input="vioscsi"; output="vioscsi";}
24+ {input="vioserial"; output="vioserial";}
25+ {input="viostor"; output="viostor";}
26+ {input="viorng"; output="viorng";}
27+ ];
28+ in
29+ stdenv.lib.concatStringsSep "\n" ((map (copy "amd64" "w8.1") virtio) ++ (map (copy "x86" "w8.1") virtio));
30+
31+ meta = with stdenv.lib; {
32+ description = "Windows VirtIO Drivers";
33+ homepage = "https://fedoraproject.org/wiki/Windows_Virtio_Drivers";
34+ maintainers = [ maintainers.tstrobel ];
35+ platforms = platforms.linux;
36+ };
37+}
pkgs/applications/virtualization/xen/0000-qemu-seabios-enable-ATA_DMA.patchnew file+23
@@ -0,0 +1,23 @@
1+diff --git a/src/Kconfig b/src/Kconfig
2+index 45ca59c..faf8951 100644
3+--- a/src/Kconfig
4++++ b/src/Kconfig
5+@@ -144,13 +144,13 @@ menu "Hardware support"
6+ config ATA_DMA
7+ depends on ATA
8+ bool "ATA DMA"
9+- default n
10++ default y
11+ help
12+ Detect and try to use ATA bus mastering DMA controllers.
13+ config ATA_PIO32
14+ depends on ATA
15+ bool "ATA 32bit PIO"
16+- default n
17++ default y
18+ help
19+ Use 32bit PIO accesses on ATA (minor optimization on PCI
20+transfers).
21+ config AHCI
22+--
23+1.7.10.4
pkgs/applications/virtualization/xen/0001-libxl-Spice-image-compression-setting-support-for-up.patchnew file+104
@@ -0,0 +1,104 @@
1+From bd71555985efc423b1a119b6a3177de855763453 Mon Sep 17 00:00:00 2001
2+From: Fabio Fantoni <fabio.fantoni@m2r.biz>
3+Date: Tue, 20 Jan 2015 11:26:30 +0100
4+Subject: [PATCH] libxl: Spice image compression setting support for upstream
5+ qemu
6+
7+Usage:
8+spice_image_compression=[auto_glz|auto_lz|quic|glz|lz|off]
9+
10+Specifies what image compression is to be used by spice (if given),
11+otherwise the qemu default will be used.
12+
13+Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
14+Acked-by: Wei Liu <wei.liu2@citrix.com>
15+---
16+ docs/man/xl.cfg.pod.5 | 6 ++++++
17+ tools/libxl/libxl.h | 11 +++++++++++
18+ tools/libxl/libxl_dm.c | 4 ++++
19+ tools/libxl/libxl_types.idl | 1 +
20+ tools/libxl/xl_cmdimpl.c | 2 ++
21+ 5 files changed, 24 insertions(+)
22+
23+diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
24+index e2f91fc..0c2cbac 100644
25+--- a/docs/man/xl.cfg.pod.5
26++++ b/docs/man/xl.cfg.pod.5
27+@@ -1427,6 +1427,12 @@ for redirection of up to 4 usb devices from spice client to domU's qemu.
28+ It requires an usb controller and if not defined it will automatically adds
29+ an usb2 controller. The default is disabled (0).
30+
31++=item B<spice_image_compression=[auto_glz|auto_lz|quic|glz|lz|off]>
32++
33++Specifies what image compression is to be used by spice (if given), otherwise
34++the qemu default will be used. Please see documentations of your current qemu
35++version for details.
36++
37+ =back
38+
39+ =head3 Miscellaneous Emulated Hardware
40+diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
41+index 0a123f1..b8e0b67 100644
42+--- a/tools/libxl/libxl.h
43++++ b/tools/libxl/libxl.h
44+@@ -528,6 +528,17 @@ typedef struct libxl__ctx libxl_ctx;
45+ #define LIBXL_HAVE_SPICE_USBREDIREDIRECTION 1
46+
47+ /*
48++ * LIBXL_HAVE_SPICE_IMAGECOMPRESSION
49++ *
50++ * If defined, then the libxl_spice_info structure will contain a string type
51++ * field: image_compression. This value defines what Spice image compression
52++ * is used.
53++ *
54++ * If this is not defined, the Spice image compression setting support is ignored.
55++ */
56++#define LIBXL_HAVE_SPICE_IMAGECOMPRESSION 1
57++
58++/*
59+ * LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1
60+ *
61+ * If this is defined, libxl_domain_create_restore()'s API has changed to
62+diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
63+index c2b0487..40c8649 100644
64+--- a/tools/libxl/libxl_dm.c
65++++ b/tools/libxl/libxl_dm.c
66+@@ -398,6 +398,10 @@ static char *dm_spice_options(libxl__gc *gc,
67+ if (!libxl_defbool_val(spice->clipboard_sharing))
68+ opt = libxl__sprintf(gc, "%s,disable-copy-paste", opt);
69+
70++ if (spice->image_compression)
71++ opt = libxl__sprintf(gc, "%s,image-compression=%s", opt,
72++ spice->image_compression);
73++
74+ return opt;
75+ }
76+
77+diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
78+index 1214d2e..052ded9 100644
79+--- a/tools/libxl/libxl_types.idl
80++++ b/tools/libxl/libxl_types.idl
81+@@ -241,6 +241,7 @@ libxl_spice_info = Struct("spice_info", [
82+ ("vdagent", libxl_defbool),
83+ ("clipboard_sharing", libxl_defbool),
84+ ("usbredirection", integer),
85++ ("image_compression", string),
86+ ])
87+
88+ libxl_sdl_info = Struct("sdl_info", [
89+diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
90+index 0b02a6c..00aa69d 100644
91+--- a/tools/libxl/xl_cmdimpl.c
92++++ b/tools/libxl/xl_cmdimpl.c
93+@@ -1948,6 +1948,8 @@ skip_vfb:
94+ &b_info->u.hvm.spice.clipboard_sharing, 0);
95+ if (!xlu_cfg_get_long (config, "spiceusbredirection", &l, 0))
96+ b_info->u.hvm.spice.usbredirection = l;
97++ xlu_cfg_replace_string (config, "spice_image_compression",
98++ &b_info->u.hvm.spice.image_compression, 0);
99+ xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
100+ xlu_cfg_get_defbool(config, "gfx_passthru",
101+ &b_info->u.hvm.gfx_passthru, 0);
102+--
103+1.9.2
104+
pkgs/applications/virtualization/xen/0002-libxl-Spice-streaming-video-setting-support-for-upst.patchnew file+104
@@ -0,0 +1,104 @@
1+From 296c7f3284efe655d95a8ae045a5dc1a20d6fff0 Mon Sep 17 00:00:00 2001
2+From: Fabio Fantoni <fabio.fantoni@m2r.biz>
3+Date: Tue, 20 Jan 2015 11:33:17 +0100
4+Subject: [PATCH] libxl: Spice streaming video setting support for upstream
5+ qemu
6+
7+Usage:
8+spice_streaming_video=[filter|all|off]
9+
10+Specifies what streaming video setting is to be used by spice (if
11+given),
12+otherwise the qemu default will be used.
13+
14+Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
15+Acked-by: Wei Liu <wei.liu2@citrix.com>
16+---
17+ docs/man/xl.cfg.pod.5 | 5 +++++
18+ tools/libxl/libxl.h | 11 +++++++++++
19+ tools/libxl/libxl_dm.c | 4 ++++
20+ tools/libxl/libxl_types.idl | 1 +
21+ tools/libxl/xl_cmdimpl.c | 2 ++
22+ 5 files changed, 23 insertions(+)
23+
24+diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
25+index 0c2cbac..408653f 100644
26+--- a/docs/man/xl.cfg.pod.5
27++++ b/docs/man/xl.cfg.pod.5
28+@@ -1433,6 +1433,11 @@ Specifies what image compression is to be used by spice (if given), otherwise
29+ the qemu default will be used. Please see documentations of your current qemu
30+ version for details.
31+
32++=item B<spice_streaming_video=[filter|all|off]>
33++
34++Specifies what streaming video setting is to be used by spice (if given),
35++otherwise the qemu default will be used.
36++
37+ =back
38+
39+ =head3 Miscellaneous Emulated Hardware
40+diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
41+index b8e0b67..c219f59 100644
42+--- a/tools/libxl/libxl.h
43++++ b/tools/libxl/libxl.h
44+@@ -539,6 +539,17 @@ typedef struct libxl__ctx libxl_ctx;
45+ #define LIBXL_HAVE_SPICE_IMAGECOMPRESSION 1
46+
47+ /*
48++ * LIBXL_HAVE_SPICE_STREAMINGVIDEO
49++ *
50++ * If defined, then the libxl_spice_info structure will contain a string type
51++ * field: streaming_video. This value defines what Spice streaming video setting
52++ * is used.
53++ *
54++ * If this is not defined, the Spice streaming video setting support is ignored.
55++ */
56++#define LIBXL_HAVE_SPICE_STREAMINGVIDEO 1
57++
58++/*
59+ * LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1
60+ *
61+ * If this is defined, libxl_domain_create_restore()'s API has changed to
62+diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
63+index 40c8649..d8d6f0c 100644
64+--- a/tools/libxl/libxl_dm.c
65++++ b/tools/libxl/libxl_dm.c
66+@@ -402,6 +402,10 @@ static char *dm_spice_options(libxl__gc *gc,
67+ opt = libxl__sprintf(gc, "%s,image-compression=%s", opt,
68+ spice->image_compression);
69+
70++ if (spice->streaming_video)
71++ opt = libxl__sprintf(gc, "%s,streaming-video=%s", opt,
72++ spice->streaming_video);
73++
74+ return opt;
75+ }
76+
77+diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
78+index 052ded9..02be466 100644
79+--- a/tools/libxl/libxl_types.idl
80++++ b/tools/libxl/libxl_types.idl
81+@@ -242,6 +242,7 @@ libxl_spice_info = Struct("spice_info", [
82+ ("clipboard_sharing", libxl_defbool),
83+ ("usbredirection", integer),
84+ ("image_compression", string),
85++ ("streaming_video", string),
86+ ])
87+
88+ libxl_sdl_info = Struct("sdl_info", [
89+diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
90+index 00aa69d..b7eac29 100644
91+--- a/tools/libxl/xl_cmdimpl.c
92++++ b/tools/libxl/xl_cmdimpl.c
93+@@ -1950,6 +1950,8 @@ skip_vfb:
94+ b_info->u.hvm.spice.usbredirection = l;
95+ xlu_cfg_replace_string (config, "spice_image_compression",
96+ &b_info->u.hvm.spice.image_compression, 0);
97++ xlu_cfg_replace_string (config, "spice_streaming_video",
98++ &b_info->u.hvm.spice.streaming_video, 0);
99+ xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
100+ xlu_cfg_get_defbool(config, "gfx_passthru",
101+ &b_info->u.hvm.gfx_passthru, 0);
102+--
103+1.9.2
104+
pkgs/applications/virtualization/xen/0003-Add-qxl-vga-interface-support-for-upstream-qem.patchnew file+165
@@ -0,0 +1,165 @@
1+From 161212ef02312c0681d2d809c8ff1e1f0ea6f6f9 Mon Sep 17 00:00:00 2001
2+From: Fabio Fantoni <fabio.fantoni@m2r.biz>
3+Date: Wed, 29 Apr 2015 11:20:28 +0200
4+Subject: [PATCH] libxl: Add qxl vga interface support for upstream qemu
5+
6+Usage:
7+vga="qxl"
8+
9+Qxl vga support many resolutions that not supported by stdvga,
10+mainly the 16:9 ones and other high up to 2560x1600.
11+With QXL you can get improved performance and smooth video also
12+with high resolutions and high quality.
13+Require their drivers installed in the domU and spice used
14+otherwise act as a simple stdvga.
15+
16+Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
17+Signed-off-by: Zhou Peng <zpengxen@gmail.com>
18+Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
19+Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
20+Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
21+---
22+ docs/man/xl.cfg.pod.5 | 10 +++++++++-
23+ tools/libxl/libxl.h | 10 ++++++++++
24+ tools/libxl/libxl_create.c | 13 +++++++++++++
25+ tools/libxl/libxl_dm.c | 8 ++++++++
26+ tools/libxl/libxl_types.idl | 1 +
27+ tools/libxl/xl_cmdimpl.c | 2 ++
28+ 6 files changed, 43 insertions(+), 1 deletion(-)
29+
30+diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
31+index f936dfc..8e4154f 100644
32+--- a/docs/man/xl.cfg.pod.5
33++++ b/docs/man/xl.cfg.pod.5
34+@@ -1360,6 +1360,9 @@ qemu-xen-traditional device-model, the amount of video RAM is fixed at 4 MB,
35+ which is sufficient for 1024x768 at 32 bpp. For the upstream qemu-xen
36+ device-model, the default and minimum is 8 MB.
37+
38++For B<qxl> vga, the default is both default and minimal 128MB.
39++If B<videoram> is set less than 128MB, an error will be triggered.
40++
41+ =item B<stdvga=BOOLEAN>
42+
43+ Select a standard VGA card with VBE (VESA BIOS Extensions) as the
44+@@ -1371,9 +1374,14 @@ This option is deprecated, use vga="stdvga" instead.
45+
46+ =item B<vga="STRING">
47+
48+-Selects the emulated video card (none|stdvga|cirrus).
49++Selects the emulated video card (none|stdvga|cirrus|qxl).
50+ The default is cirrus.
51+
52++In general, QXL should work with the Spice remote display protocol
53++for acceleration, and QXL driver is necessary in guest in this case.
54++QXL can also work with the VNC protocol, but it will be like a standard
55++VGA without acceleration.
56++
57+ =item B<vnc=BOOLEAN>
58+
59+ Allow access to the display via the VNC protocol. This enables the
60+diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
61+index 44bd8e2..efc0617 100644
62+--- a/tools/libxl/libxl.h
63++++ b/tools/libxl/libxl.h
64+@@ -535,6 +535,16 @@ typedef struct libxl__ctx libxl_ctx;
65+ #define LIBXL_HAVE_DOMINFO_OUTSTANDING_MEMKB 1
66+
67+ /*
68++ * LIBXL_HAVE_QXL
69++ *
70++ * If defined, then the libxl_vga_interface_type will contain another value:
71++ * "QXL". This value define if qxl vga is supported.
72++ *
73++ * If this is not defined, the qxl vga support is missed.
74++ */
75++#define LIBXL_HAVE_QXL 1
76++
77++/*
78+ * LIBXL_HAVE_SPICE_VDAGENT
79+ *
80+ * If defined, then the libxl_spice_info structure will contain a boolean type:
81+diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
82+index e5a343f..188f7df 100644
83+--- a/tools/libxl/libxl_create.c
84++++ b/tools/libxl/libxl_create.c
85+@@ -248,6 +248,10 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
86+ if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
87+ b_info->video_memkb = 0;
88+ break;
89++ case LIBXL_VGA_INTERFACE_TYPE_QXL:
90++ LOG(ERROR,"qemu upstream required for qxl vga");
91++ return ERROR_INVAL;
92++ break;
93+ case LIBXL_VGA_INTERFACE_TYPE_STD:
94+ if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
95+ b_info->video_memkb = 8 * 1024;
96+@@ -272,6 +276,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
97+ if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
98+ b_info->video_memkb = 0;
99+ break;
100++ case LIBXL_VGA_INTERFACE_TYPE_QXL:
101++ if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT) {
102++ b_info->video_memkb = (128 * 1024);
103++ } else if (b_info->video_memkb < (128 * 1024)) {
104++ LOG(ERROR,
105++ "128 Mib videoram is the minimum for qxl default");
106++ return ERROR_INVAL;
107++ }
108++ break;
109+ case LIBXL_VGA_INTERFACE_TYPE_STD:
110+ if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
111+ b_info->video_memkb = 16 * 1024;
112+diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
113+index 30c1578..58c9b99 100644
114+--- a/tools/libxl/libxl_dm.c
115++++ b/tools/libxl/libxl_dm.c
116+@@ -251,6 +251,8 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
117+ case LIBXL_VGA_INTERFACE_TYPE_NONE:
118+ flexarray_append_pair(dm_args, "-vga", "none");
119+ break;
120++ case LIBXL_VGA_INTERFACE_TYPE_QXL:
121++ break;
122+ }
123+
124+ if (b_info->u.hvm.boot) {
125+@@ -625,6 +627,12 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
126+ break;
127+ case LIBXL_VGA_INTERFACE_TYPE_NONE:
128+ break;
129++ case LIBXL_VGA_INTERFACE_TYPE_QXL:
130++ /* QXL have 2 ram regions, ram and vram */
131++ flexarray_append_pair(dm_args, "-device",
132++ GCSPRINTF("qxl-vga,vram_size_mb=%"PRIu64",ram_size_mb=%"PRIu64,
133++ (b_info->video_memkb/2/1024), (b_info->video_memkb/2/1024) ) );
134++ break;
135+ }
136+
137+ if (b_info->u.hvm.boot) {
138+diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
139+index 117b61d..023b21e 100644
140+--- a/tools/libxl/libxl_types.idl
141++++ b/tools/libxl/libxl_types.idl
142+@@ -183,6 +183,7 @@ libxl_vga_interface_type = Enumeration("vga_interface_type", [
143+ (1, "CIRRUS"),
144+ (2, "STD"),
145+ (3, "NONE"),
146++ (4, "QXL"),
147+ ], init_val = "LIBXL_VGA_INTERFACE_TYPE_CIRRUS")
148+
149+ libxl_vendor_device = Enumeration("vendor_device", [
150+diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
151+index 648ca08..526a1f6 100644
152+--- a/tools/libxl/xl_cmdimpl.c
153++++ b/tools/libxl/xl_cmdimpl.c
154+@@ -2115,6 +2115,8 @@ skip_vfb:
155+ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS;
156+ } else if (!strcmp(buf, "none")) {
157+ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE;
158++ } else if (!strcmp(buf, "qxl")) {
159++ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_QXL;
160+ } else {
161+ fprintf(stderr, "Unknown vga \"%s\" specified\n", buf);
162+ exit(1);
163+--
164+1.9.2
165+
pkgs/applications/virtualization/xen/4.4.1.nix+20−16
@@ -14,30 +14,34 @@ let
1414 # Sources needed to build the xen tools and tools/firmware.
1515 toolsGits =
1616 [ # tag qemu-xen-4.4.1
17− { name = "qemu-xen";
18− url = git://xenbits.xen.org/qemu-upstream-4.4-testing.git;
19− rev = "65fc9b78ba3d868a26952db0d8e51cecf01d47b4";
20− sha256 = "e24fb58f773fd9134c5aae6d3ca7e9f754dc9822de92b1eb2cedc76faf911f18";
17+ { git = { name = "qemu-xen";
18+ url = git://xenbits.xen.org/qemu-upstream-4.4-testing.git;
19+ rev = "65fc9b78ba3d868a26952db0d8e51cecf01d47b4";
20+ sha256 = "e24fb58f773fd9134c5aae6d3ca7e9f754dc9822de92b1eb2cedc76faf911f18";
21+ };
2122 }
2223 # tag xen-4.4.1
23− { name = "qemu-xen-traditional";
24− url = git://xenbits.xen.org/qemu-xen-4.4-testing.git;
25− rev = "6ae4e588081620b141071eb010ec40aca7e12876";
26− sha256 = "b1ed1feb92fbe658273a8d6d38d6ea60b79c1658413dd93979d6d128d8554ded";
24+ { git = { name = "qemu-xen-traditional";
25+ url = git://xenbits.xen.org/qemu-xen-4.4-testing.git;
26+ rev = "6ae4e588081620b141071eb010ec40aca7e12876";
27+ sha256 = "b1ed1feb92fbe658273a8d6d38d6ea60b79c1658413dd93979d6d128d8554ded";
28+ };
2729 }
2830 ];
2931
3032 firmwareGits =
3133 [ # tag 1.7.3.1
32− { name = "seabios";
33− url = git://xenbits.xen.org/seabios.git;
34− rev = "7d9cbe613694924921ed1a6f8947d711c5832eee";
35− sha256 = "c071282bbcb1dd0d98536ef90cd1410f5d8da19648138e0e3863bc540d954a87";
34+ { git = { name = "seabios";
35+ url = git://xenbits.xen.org/seabios.git;
36+ rev = "7d9cbe613694924921ed1a6f8947d711c5832eee";
37+ sha256 = "c071282bbcb1dd0d98536ef90cd1410f5d8da19648138e0e3863bc540d954a87";
38+ };
3639 }
37− { name = "ovmf";
38− url = git://xenbits.xen.org/ovmf.git;
39− rev = "447d264115c476142f884af0be287622cd244423";
40− sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
40+ { git = { name = "ovmf";
41+ url = git://xenbits.xen.org/ovmf.git;
42+ rev = "447d264115c476142f884af0be287622cd244423";
43+ sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
44+ };
4145 }
4246 ];
4347
pkgs/applications/virtualization/xen/4.5.0.nix+37−16
@@ -14,30 +14,47 @@ let
1414 # Sources needed to build the xen tools and tools/firmware.
1515 firmwareGits =
1616 [ # tag 1.7.5
17− { name = "seabios";
18− url = git://xenbits.xen.org/seabios.git;
19− rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
20− sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
17+ { git = { name = "seabios";
18+ url = git://xenbits.xen.org/seabios.git;
19+ rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
20+ sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
21+ };
22+ patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ];
2123 }
22− { name = "ovmf";
23− url = git://xenbits.xen.org/ovmf.git;
24− rev = "447d264115c476142f884af0be287622cd244423";
25− sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
24+ { git = { name = "ovmf";
25+ url = git://xenbits.xen.org/ovmf.git;
26+ rev = "447d264115c476142f884af0be287622cd244423";
27+ sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
28+ };
2629 }
2730 ];
2831
2932 toolsGits =
3033 [ # tag qemu-xen-4.5.0
31− { name = "qemu-xen";
32− url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
33− rev = "1ebb75b1fee779621b63e84fefa7b07354c43a99";
34− sha256 = "1j312q2mqvkvby9adkkxf7f1pn3nz85g5mr9nbg4qpf2y9cg122z";
34+ { git = { name = "qemu-xen";
35+ url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
36+ rev = "1ebb75b1fee779621b63e84fefa7b07354c43a99";
37+ sha256 = "1j312q2mqvkvby9adkkxf7f1pn3nz85g5mr9nbg4qpf2y9cg122z";
38+ };
3539 }
3640 # tag xen-4.5.0
37− { name = "qemu-xen-traditional";
38− url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
39− rev = "b0d42741f8e9a00854c3b3faca1da84bfc69bf22";
40− sha256 = "ce52b5108936c30ab85ec0c9554f88d5e7b34896f3acb666d56765b49c86f2af";
41+ { git = { name = "qemu-xen-traditional";
42+ url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
43+ rev = "b0d42741f8e9a00854c3b3faca1da84bfc69bf22";
44+ sha256 = "ce52b5108936c30ab85ec0c9554f88d5e7b34896f3acb666d56765b49c86f2af";
45+ };
46+ }
47+ { git = { name = "xen-libhvm";
48+ url = "https://github.com/ts468/xen-libhvm";
49+ rev = "442dcc4f6f4e374a51e4613532468bd6b48bdf63";
50+ sha256 = "9ba97c39a00a54c154785716aa06691d312c99be498ebbc00dc3769968178ba8";
51+ };
52+ description = ''
53+ Helper library for reading ACPI and SMBIOS firmware values
54+ from the host system for use with the HVM guest firmware
55+ pass-through feature in Xen.
56+ '';
57+ #license = licenses.bsd2;
4158 }
4259 ];
4360
@@ -52,6 +69,10 @@ let
5269 quilt push -a
5370 substituteInPlace tools/xenguest/Makefile --replace "_BSD_SOURCE" "_DEFAULT_SOURCE"
5471 '';
72+
73+ xenPatches = [ ./0001-libxl-Spice-image-compression-setting-support-for-up.patch
74+ ./0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
75+ ./0003-Add-qxl-vga-interface-support-for-upstream-qem.patch ];
5576 };
5677
5778in callPackage ./generic.nix (args // { xenConfig=xenConfig; })
pkgs/applications/virtualization/xen/4.5.1.nixnew file+67
@@ -0,0 +1,67 @@
1+{ callPackage, fetchurl, fetchgit, ... } @ args:
2+
3+let
4+ # Xen 4.5.1
5+ xenConfig = {
6+ name = "xen-4.5.1";
7+ version = "4.5.1";
8+
9+ src = fetchurl {
10+ url = "http://bits.xensource.com/oss-xen/release/4.5.1/xen-4.5.1.tar.gz";
11+ sha256 = "0w8kbqy7zixacrpbk3yj51xx7b3f6l8ghsg3551w8ym6zka13336";
12+ };
13+
14+ # Sources needed to build the xen tools and tools/firmware.
15+ firmwareGits =
16+ [ # tag 1.7.5
17+ { git = { name = "seabios";
18+ url = git://xenbits.xen.org/seabios.git;
19+ rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
20+ sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
21+ };
22+ patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ];
23+ }
24+ { git = { name = "ovmf";
25+ url = git://xenbits.xen.org/ovmf.git;
26+ rev = "447d264115c476142f884af0be287622cd244423";
27+ sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
28+ };
29+ }
30+ ];
31+
32+ toolsGits =
33+ [ # tag qemu-xen-4.5.1
34+ { git = { name = "qemu-xen";
35+ url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
36+ rev = "d9552b0af21c27535cd3c8549bb31d26bbecd506";
37+ sha256 = "15dbz8j26wl4vs5jijhccwgd8c6wkmpj4mz899fa7i1bbh8yysfy";
38+ };
39+ }
40+ # tag xen-4.5.1
41+ { git = { name = "qemu-xen-traditional";
42+ url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
43+ rev = "afaa35b4bc975b2b89ad44c481d0d7623e3d1c49";
44+ sha256 = "906b31cf32b52d29e521abaa76d641123bdf24f33fa53c6f109b6d7834e514be";
45+ };
46+ }
47+ { git = { name = "xen-libhvm";
48+ url = "https://github.com/ts468/xen-libhvm";
49+ rev = "442dcc4f6f4e374a51e4613532468bd6b48bdf63";
50+ sha256 = "9ba97c39a00a54c154785716aa06691d312c99be498ebbc00dc3769968178ba8";
51+ };
52+ description = ''
53+ Helper library for reading ACPI and SMBIOS firmware values
54+ from the host system for use with the HVM guest firmware
55+ pass-through feature in Xen.
56+ '';
57+ #license = licenses.bsd2;
58+ }
59+ ];
60+
61+ xenPatches = [ ./0001-libxl-Spice-image-compression-setting-support-for-up.patch
62+ ./0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
63+ ./0003-Add-qxl-vga-interface-support-for-upstream-qem.patch ];
64+ };
65+
66+in callPackage ./generic.nix (args // { xenConfig=xenConfig; })
67+
pkgs/applications/virtualization/xen/generic.nix+20−15
@@ -3,7 +3,7 @@
33, lvm2, utillinux, procps, texinfo, perl, pythonPackages
44, glib, bridge-utils, xlibs, pixman, iproute, udev, bison
55, flex, cmake, ocaml, ocamlPackages, figlet, libaio, yajl
6−, checkpolicy, transfig, glusterfs, fetchgit, xz, spice
6+, checkpolicy, transfig, glusterfs, acl, fetchgit, xz, spice
77, spice_protocol, usbredir, alsaLib, quilt
88, coreutils, gawk, gnused, gnugrep, diffutils, multipath_tools
99, inetutils, iptables, openvswitch, nbd, drbd, xenConfig
@@ -69,15 +69,14 @@ stdenv.mkDerivation {
6969 glib bridge-utils pixman iproute udev bison xlibs.libX11
7070 flex ocaml ocamlPackages.findlib figlet libaio
7171 checkpolicy pythonPackages.markdown transfig
72− glusterfs cmake spice spice_protocol usbredir
72+ glusterfs acl cmake spice spice_protocol usbredir
7373 alsaLib quilt
7474 ];
7575
7676 pythonPath = [ pythonPackages.curses ];
7777
78− patchPhase = if ((xenserverPatched == true) && (builtins.hasAttr "xenserverPatches" xenConfig))
79− then xenConfig.xenserverPatches
80− else "";
78+ patches = stdenv.lib.optionals ((xenserverPatched == false) && (builtins.hasAttr "xenPatches" xenConfig)) xenConfig.xenPatches;
79+ patchPhase = stdenv.lib.optional ((xenserverPatched == true) && (builtins.hasAttr "xenserverPatches" xenConfig)) xenConfig.xenserverPatches;
8180
8281 preConfigure = ''
8382 # Fake wget: copy prefetched downloads instead
@@ -87,13 +86,9 @@ stdenv.mkDerivation {
8786 echo "cp \$4 \$3" >> wget/wget
8887 chmod +x wget/wget
8988 export PATH=$PATH:$PWD/wget
89+ export EXTRA_QEMUU_CONFIGURE_ARGS="--enable-spice --enable-usb-redir --enable-linux-aio"
9090 '';
9191
92− # TODO: If multiple arguments are given with with-extra-qemuu,
93− # then the configuration aborts; the reason is unclear.
94− # If you know how to fix it, please let me know! :)
95− #configureFlags = "--with-extra-qemuu-configure-args='--enable-spice --enable-usb-redir --enable-linux-aio'";
96−
9792 # TODO: Flask needs more testing before enabling it by default.
9893 #makeFlags = "XSM_ENABLE=y FLASK_ENABLE=y PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
9994 makeFlags = "PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
@@ -154,13 +149,17 @@ stdenv.mkDerivation {
154149
155150 # Xen's tools and firmares need various git repositories that it
156151 # usually checks out at time using git. We can't have that.
157− ${flip concatMapStrings xenConfig.toolsGits (x: let src = fetchgit x; in ''
152+ ${flip concatMapStrings xenConfig.toolsGits (x: let src = fetchgit x.git; in ''
158153 cp -r ${src} tools/${src.name}-dir-remote
159− chmod +w tools/${src.name}-dir-remote
154+ chmod -R +w tools/${src.name}-dir-remote
155+ '' + stdenv.lib.optionalString (builtins.hasAttr "patches" x) ''
156+ ( cd tools/${src.name}-dir-remote; ${concatStringsSep "; " (map (p: "patch -p1 < ${p}") x.patches)} )
160157 '')}
161− ${flip concatMapStrings xenConfig.firmwareGits (x: let src = fetchgit x; in ''
158+ ${flip concatMapStrings xenConfig.firmwareGits (x: let src = fetchgit x.git; in ''
162159 cp -r ${src} tools/firmware/${src.name}-dir-remote
163− chmod +w tools/firmware/${src.name}-dir-remote
160+ chmod -R +w tools/firmware/${src.name}-dir-remote
161+ '' + stdenv.lib.optionalString (builtins.hasAttr "patches" x) ''
162+ ( cd tools/firmware/${src.name}-dir-remote; ${concatStringsSep "; " (map (p: "patch -p1 < ${p}") x.patches)} )
164163 '')}
165164
166165 # Xen's stubdoms and firmwares need various sources that are usually fetched
@@ -178,6 +177,9 @@ stdenv.mkDerivation {
178177 postBuild =
179178 ''
180179 make -C docs man-pages
180+
181+ (cd tools/xen-libhvm-dir-remote; make)
182+ (cd tools/xen-libhvm-dir-remote/biospt; cc -Wall -g -D_LINUX -Wstrict-prototypes biospt.c -o biospt -I../libhvm -L../libhvm -lxenhvm)
181183 '';
182184
183185 installPhase =
@@ -192,8 +194,11 @@ stdenv.mkDerivation {
192194
193195 shopt -s extglob
194196 for i in $out/etc/xen/scripts/!(*.sh); do
195− sed -i '2s@^@export PATH=$out/bin:${scriptEnvPath}@' $i
197+ sed -i "2s@^@export PATH=$out/bin:${scriptEnvPath}\n@" $i
196198 done
199+
200+ (cd tools/xen-libhvm-dir-remote; make install)
201+ cp tools/xen-libhvm-dir-remote/biospt/biospt $out/bin/.
197202 '';
198203
199204 meta = {
pkgs/top-level/all-packages.nix+8−1
@@ -13203,8 +13203,15 @@ let
1320313203
1320413204 xen_4_4_1 = callPackage ../applications/virtualization/xen/4.4.1.nix { };
1320513205 xen_4_5_0 = callPackage ../applications/virtualization/xen/4.5.0.nix { };
13206+ xen_4_5_1 = callPackage ../applications/virtualization/xen/4.5.1.nix { };
1320613207 xen_xenServer = callPackage ../applications/virtualization/xen/4.5.0.nix { xenserverPatched = true; };
13207− xen = xen_4_5_0;
13208+ xen = xen_4_5_1;
13209+
13210+ win-spice = callPackage ../applications/virtualization/driver/win-spice { };
13211+ win-virtio = callPackage ../applications/virtualization/driver/win-virtio { };
13212+ win-qemu = callPackage ../applications/virtualization/driver/win-qemu { };
13213+ win-pvdrivers = callPackage ../applications/virtualization/driver/win-pvdrivers { };
13214+ win-signed-gplpv-drivers = callPackage ../applications/virtualization/driver/win-signed-gplpv-drivers { };
1320813215
1320913216 xfe = callPackage ../applications/misc/xfe {
1321013217 fox = fox_1_6;