Hello community, here is the log from the commit of package kvm for openSUSE:Factory checked in at Wed Feb 24 02:11:39 CET 2010. -------- --- kvm/kvm.changes 2009-10-19 10:25:33.000000000 +0200 +++ /mounts/work_src_done/STABLE/kvm/kvm.changes 2010-02-20 00:34:05.000000000 +0100 @@ -1,0 +2,84 @@ +Fri Feb 19 16:46:09 UTC 2010 - brogers@novell.com + +- Fix network booting (bnc#580947) +- Fix virtio network shutdown under load +- Fix buffer overrun +- Fix access after end of array +- Cleanup issues with net device integration +- Fix remaining extraneous stderr output on startup + +------------------------------------------------------------------- +Tue Feb 16 13:19:40 CET 2010 - agraf@suse.de + +- Implement long file names for tar (bnc#580100) + +------------------------------------------------------------------- +Wed Jan 20 20:56:05 UTC 2010 - brogers@novell.com + +- Update to 0.12.2, including these changes among others: + - Update SeaBIOS to 0.5.1 + - vnc: Fix artifacts in hextile decoding + - device assignment: default requires IOMMU + - pc: add machine type for 0.12 + - Fix CPU topology initialization + - vmware_vga: Check cursor dimensions to avoid buffer overflow +- Remove deprecated windows drivers +- ability to build all objects from source now +- build debug package + +------------------------------------------------------------------- +Mon Jan 18 18:28:23 CET 2010 - agraf@suse.de + +- Make dzip not consume endless amounts of ram (bnc#569337) + +------------------------------------------------------------------- +Wed Jan 13 15:58:10 CET 2010 - agraf@suse.de + +- Make block-tar work for images > 8 GB (bnc#565600) + +------------------------------------------------------------------- +Tue Jan 5 17:17:41 UTC 2010 - brogers@novell.com + +- update to 0.12.1.2 (FATE#306513) + Changes from qemu-kvm-0.11.x include: + - merge qemu 0.12.1 + - many changes, including: + - s390 support + - live migration: support migration with non shared storage + - live migration: make save/restore data driven (VMState) + - monitor: introduce machine-protocol (QMP) + - qdev: convert many devices, support reading config from file + - pci: infrastructure to support 64-bit busses + - net: introduce -netdev to support point-to-point networking + - net: add support for GSO and checksum offload + - tons of bug fixes throughout the code base + - many kvm-specific bug fixes + +------------------------------------------------------------------- +Tue Dec 8 00:37:37 CET 2009 - agraf@suse.de + +- enable S390 target which is now upstream (FATE#306513) + +------------------------------------------------------------------- +Mon Dec 7 16:44:43 CET 2009 - agraf@suse.de + +- update to 0.12.0-rc0 (FATE#306513) + - detailed changes following on -rc1 + +------------------------------------------------------------------- +Fri Dec 4 10:50:56 CET 2009 - brogers@suse.de + +- added latest windows virtio drivers to package + previous version of drivers is deprecated + +------------------------------------------------------------------- +Thu Nov 12 17:38:26 CET 2009 - brogers@suse.de + +- Fix package dependencies (bnc#554850) + +------------------------------------------------------------------- +Sat Nov 7 01:02:50 CET 2009 - brogers@suse.de + +- update package description + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- NETKVM-20081229.iso kvm-qemu-preXX-dirty-bitmap-alloc.patch qemu-kvm-0.11.0.tar.bz2 New: ---- S390-qemu-early-printk.patch S390-qemu-kvm.patch S390-qemu-zipl.patch bcc-0.16.17-2.i486.rpm gpxe-0.9.9.tar.bz2 kvm-qemu-preXX-access-after-end-of-array.patch kvm-qemu-preXX-dictzip4.patch kvm-qemu-preXX-dictzip5.patch kvm-qemu-preXX-dictzip6.patch kvm-qemu-preXX-fix-inet-parse-typo.patch kvm-qemu-preXX-netdev1.patch kvm-qemu-preXX-netdev2.patch kvm-qemu-preXX-netdev3.patch kvm-qemu-preXX-netdev4.patch kvm-qemu-preXX-netdev5.patch kvm-qemu-preXX-netdev6.patch kvm-qemu-preXX-network-shutdown-under-load.patch kvm-qemu-preXX-nic-device-pxe-boot.patch kvm-qemu-preXX-usb-serial-buffer-overrun.patch pxe-rom-settings.patch qemu-kvm-0.12.2.tar.bz2 seabios-0.5.1.tar.bz2 seabios-sanitize-version.patch vgabios-bcc-paths.patch virtio-drivers.iso win-virtio-drivers.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kvm.spec ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,7 +1,7 @@ # -# spec file for package kvm (Version 0.11.0) +# spec file for package kvm (Version 0.12.2) # -# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,18 +20,48 @@ %bcond_with vde +%define bios_id seabios-0.5.1 +%define pxe_rom_id gpxe-0.9.9 +#%define vgabios_id vgabios-0.6c + +# note that this list doesn't include the gpxe roms since they get handled +# individually and not as a group +%define firmware_files {bios.bin vgabios.bin vgabios-cirrus.bin optionrom/extboot.bin optionrom/linuxboot.bin optionrom/multiboot.bin optionrom/vapic.bin} + +#ExclusiveArch: %ix86 x86_64 ia64 s390x +ExclusiveArch: %ix86 x86_64 s390x + +%ifarch %ix86 x86_64 +# choice of building all from source or using provided binary x86 blobs +%define build_fw_from_source 1 +# build the Mac BIOS on x86 platforms +%define mac_bios 1 +%else +%define build_fw_from_source 0 +# build no Mac BIOS on others +%define mac_bios 0 +%endif + +%define using_buildservice 0%{?opensuse_bs} + Name: kvm -BuildRequires: SDL-devel alsa alsa-devel gnutls-devel ncurses-devel pciutils-devel perl texinfo +BuildRequires: SDL-devel alsa alsa-devel gnutls-devel ncurses-devel pciutils-devel perl python texinfo %ifarch %ix86 x86_64 ia64 +%if %{build_fw_from_source} +# needed for building vgabios: +BuildRequires: bin86 +%ifarch x86_64 +#needed by bcc compiler which is needed for building vgabios: +BuildRequires: glibc-32bit +%endif +%endif %if %suse_version > 1110 BuildRequires: acpica %else BuildRequires: pmtools %endif %endif -%ifarch %ix86 x86_64 -BuildRequires: dev86 -%endif +Requires: virt-utils %if %suse_version >= 1100 BuildRequires: libcurl-devel libpulse-devel %endif @@ -39,26 +69,32 @@ BuildRequires: vde2-devel %endif Requires: python-curses -%if %suse_version <= 1110 +%if %suse_version < 1110 Requires: kvm-kmp -%else -Conflicts: kernel < 2.6.31 %endif -License: BSD 3-clause (or similar) ; GPL v2 only ; GPL v2 or later ; LGPL v2.1 or later ; MIT License (or similar) +License: BSD3c ; GPLv2 ; GPLv2+ ; LGPLv2.1+ ; MIT Group: System/Kernel Summary: Kernel-based Virtual Machine -Url: http://www.linux-kvm.org -Version: 0.11.0 -Release: 4 -Source0: qemu-%name-%{version}.tar.bz2 -ExclusiveArch: %ix86 x86_64 ia64 +Url: http://kvm.qumranet.com/ +Version: 0.12.2 +Release: 1 +#Release: 0.<RELEASE1> +Source0: qemu-%{name}-%{version}.tar.bz2 Source1: 60-kvm.rules -Source2: NETKVM-20081229.iso -Source3: qemu-ifup +Source2: qemu-ifup +Source4: virtio-drivers.iso +Source5: win-virtio-drivers.tar.bz2 +Source6: %{bios_id}.tar.bz2 +Source7: %{pxe_rom_id}.tar.bz2 +Source8: bcc-0.16.17-2.i486.rpm +#Source9: %{vgabios_id}.tar.bz2 # common and X86 patches -Patch01: qemu-datadir.diff -Patch02: kvm-qemu-default-memsize.patch -Patch03: kvm-qemu-no-fallback-if-open-kvm-fails.patch +Patch01: pxe-rom-settings.patch +Patch02: seabios-sanitize-version.patch +Patch03: vgabios-bcc-paths.patch +Patch04: qemu-datadir.diff +Patch05: kvm-qemu-default-memsize.patch +Patch06: kvm-qemu-no-fallback-if-open-kvm-fails.patch # Mac OS X patches Patch11: kvm-qemu-lpc.patch Patch12: kvm-qemu-applesmc.patch @@ -71,68 +107,93 @@ Patch101: kvm-qemu-preXX-dictzip1.patch Patch102: kvm-qemu-preXX-dictzip2.patch Patch103: kvm-qemu-preXX-dictzip3.patch -Patch104: kvm-qemu-preXX-dirty-bitmap-alloc.patch +Patch104: kvm-qemu-preXX-dictzip4.patch +Patch105: kvm-qemu-preXX-dictzip5.patch +Patch106: kvm-qemu-preXX-dictzip6.patch +Patch107: kvm-qemu-preXX-nic-device-pxe-boot.patch +Patch108: kvm-qemu-preXX-fix-inet-parse-typo.patch +Patch109: kvm-qemu-preXX-netdev1.patch +Patch110: kvm-qemu-preXX-netdev2.patch +Patch111: kvm-qemu-preXX-netdev3.patch +Patch112: kvm-qemu-preXX-netdev4.patch +Patch113: kvm-qemu-preXX-netdev5.patch +Patch114: kvm-qemu-preXX-netdev6.patch +Patch115: kvm-qemu-preXX-access-after-end-of-array.patch +Patch116: kvm-qemu-preXX-usb-serial-buffer-overrun.patch +Patch117: kvm-qemu-preXX-network-shutdown-under-load.patch # for IA64 Source500: ia64-fix-pagesize.pl Patch500: IA64-kvm-suse.patch Patch501: IA64-compile-fix-suse.patch +# for S390 +Patch700: S390-qemu-kvm.patch +Patch701: S390-qemu-zipl.patch +Patch702: S390-qemu-early-printk.patch # For upstream patches: BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: /usr/sbin/groupadd -BuildRequires: kernel-syms %description -KVM (Kernel-based Virtual Machine) is a virtualization software for -Linux which is based on hardware virtualization extensions (Intel VT-X -and AMD-V) and a modified version of qemu to enable full hardware -emulation as far as needed to boot many PC operating systems in -unmodified form, including Linux, Windows and Mac OS X. - -Note: KVM is not yet ready for production use and has known issues. You -can find details the Novell bugzilla: http://bugzilla.novell.com - -KVM depends on Intel VT and AMD-V and does not run on CPUs without -these extensions. qemu can be used on those, with some performance -penalty, instead. - -As the hardware emulation used for KVM is based on QEMU, virtual -machines can be moved between QEMU and KVM hosts seamlessly. - -The package libvirt contains libvirtd, a simple hypervisor for managing -multiple QEMU and KVM virtual machines on one host machine. The -included virtsh allows to define virtual machines using XML files and -allows some simple management of such virtual machines on the command -line. virt-manager is a GUI for connecting to, and controlling virtual -machines based on libvirt. +KVM (Kernel-based Virtual Machine) is virtualization software for Linux. +It is based on the hardware virtualization extensions provided by Intel VT +and AMD-V technologies. KVM kernel modules provide a control interface at +/dev/kvm which the qemu-kvm user-space program uses to provide a hybrid +emulated and actual hardware environment sufficent to run various PC +operating systems (guests) in unmodified form, including Linux, Windows, +and Mac OS X. + +Since qemu-kvm is derived from the qemu processor emulator sources it also +is able to run guests using processor emulation mode, but with the expected +performance impact. Conversely, hardware virtualization features outside +the processor such as iommu and sr-iov are used by KVM allowing for improved +performance. + +The seabios, vgabios and gpxe open source projects are also pulled from to +provide the firmware components included. +To increase performance over emulated hardware devices virtio drivers are +supported, and in the case of Windows, included. +KVM is compatible with various VM management solutions, including libvirt, +virt-manager and vm-install. Authors: -------- Avi Kivity <avi@qumranet.com> Yaniv Kamay <yaniv@qumranet.com> Dor Laor <dor.laor@qumranet.com> + Kevin O'Connor <kevin@koconnor.net> %prep -# build the Mac BIOS on x86 platforms -%ifarch %ix86 x86_64 -%define vanilla 0 -# build no Mac BIOS on others -%else -%define vanilla 1 -%endif -%setup -q -n qemu-%{name}-%{version} +%if %{build_fw_from_source} +mkdir bcc-bits +cd bcc-bits/ +rpm2cpio %{SOURCE8} | cpio -id ./usr/bin/bcc ./usr/lib/bcc/bcc-cc1 +%setup -q -T -D -n %{pxe_rom_id} -b 7 %patch01 -p1 +%endif +%setup -q -n qemu-%{name}-%{version} -a 6 +#%setup -q -n qemu-%{name}-%{version} -a 6 -a 9 +%if %{build_fw_from_source} +#ensure that we only end up with the ones we built +for i in %firmware_files +do + rm -f pc-bios/$i +done %patch02 -p1 %patch03 -p1 +%endif +%patch04 -p1 +%patch05 -p1 +%patch06 -p1 # Mac OS X guest -%if !%{vanilla} +%if %{mac_bios} %patch11 -p1 %patch12 -p1 %patch14 -p1 %patch15 -p1 %patch16 -p1 -cp -a kvm/bios kvm/bios-mac +cp -a roms/seabios roms/seabios-mac %patch90 -p1 -b .bios-mac %endif # Post-release patches @@ -141,15 +202,37 @@ %patch102 -p1 %patch103 -p1 %patch104 -p1 +%patch105 -p1 +%patch106 -p1 +%patch107 -p1 +%patch108 -p1 +%patch109 -p1 +%patch110 -p1 +%patch111 -p1 +%patch112 -p1 +%patch113 -p1 +%patch114 -p1 +%patch115 -p1 +%patch116 -p1 +%patch117 -p1 # IA64 support %ifarch ia64 %patch500 -p1 %patch501 -p1 %endif +# S390 support +%ifarch s390x +%patch700 -p1 +%patch701 -p1 +%patch702 -p1 +%endif %build ./configure --prefix=%{_prefix} \ --audio-card-list="ac97 adlib cs4231a gus" \ +%if %{build_fw_from_source} + --disable-blobs \ +%endif %if %suse_version >= 1100 --audio-drv-list="alsa sdl pa oss" \ %else @@ -158,7 +241,12 @@ %ifarch ia64 --target-list="ia64-softmmu" --disable-cpu-emulation \ %endif - --extra-cflags="%{optflags}" +%ifarch s390x + --target-list="s390x-softmmu" \ +%endif + --extra-cflags="%{optflags}" \ + --disable-strip \ + --disable-werror # Aborts if curses support is not enabled: grep "^CONFIG_CURSES=y" config-host.mak # Patch kvm/user Makefile to accept inital CFLAGS: @@ -166,38 +254,71 @@ sed -i 's/CFLAGS =/CFLAGS +=/' kvm/user/Makefile echo "CFLAGS=%optflags" >> kvm/user/config.mak # Patch the version, so we know which revision was installed: -sed -i "s|kvm-%{version}|kvm-%{version}-%{release}|" config-host.h +# sed -i "s|kvm-%{version}|kvm-%{version}-%{release}|" config-host.h +echo "%{version}-%{release}" > VERSION # userspace: make KVM_KMOD="no" %{?jobs:-j%jobs} # Firmware %ifarch %ix86 x86_64 -make -C kvm/bios -cp kvm/bios/BIOS-bochs-latest pc-bios/bios.bin +make -C roms/seabios +cp roms/seabios/out/bios.bin pc-bios/bios.bin +%if %{mac_bios} +make -C roms/seabios-mac +%endif +%if %{build_fw_from_source} make -C kvm/vgabios cp kvm/vgabios/VGABIOS-lgpl-latest.cirrus.bin pc-bios/vgabios-cirrus.bin cp kvm/vgabios/VGABIOS-lgpl-latest.bin pc-bios/vgabios.bin -cp pc-bios/optionrom/extboot.bin pc-bios/ +cd ../%{pxe_rom_id}/src +#This target makes all of the common objects +#(There is only 1 file that causes grief: src/drivers/net/atl1e.c, but until +# I come up with a better solution, add NO_WERROR=1) +NO_WERROR=1 make bin/blib.a +make bin/8086100e.rom +make bin/10222000.rom +make bin/10500940.rom +make bin/10ec8139.rom +make bin/80861209.rom +make bin/1af41000.rom %endif -%if !%{vanilla} -make -C kvm/bios-mac %endif %install make DESTDIR=%{buildroot} KVM_KMOD="no" install -mv qemu-doc.html qemu-kvm.html -%if !%{vanilla} -install -m 644 kvm/bios-mac/BIOS-bochs-latest %{buildroot}/%{_datadir}/qemu-kvm/bios-mac.bin +%if %{mac_bios} +install -m 644 roms/seabios-mac/out/bios.bin %{buildroot}%{_datadir}/qemu-kvm/bios-mac.bin %endif mkdir -p %{buildroot}%{_docdir}/kvm -install -m 644 qemu-kvm.html %{buildroot}%{_docdir}/kvm/qemu-kvm.html -install -m 755 kvm/kvm_stat %{buildroot}%_bindir/kvm_stat +mv qemu-doc.html qemu-kvm.html +install -m 644 qemu-kvm.html %{buildroot}%{_docdir}/kvm/ +install -m 755 kvm/kvm_stat %{buildroot}%{_bindir}/ +%if %{build_fw_from_source} +for i in %firmware_files +do + install -m 644 pc-bios/$i %{buildroot}%{_datadir}/qemu-kvm/ +done + +install_rom() { + install -m 644 $1.rom %{buildroot}%{_datadir}/qemu-kvm/$2.bin +} +cd ../%{pxe_rom_id}/src/bin/ +install_rom 8086100e pxe-e1000 +install_rom 10222000 pxe-pcnet +install_rom 10500940 pxe-ne2k_pci +install_rom 10ec8139 pxe-rtl8139 +install_rom 80861209 pxe-i82559er +install_rom 1af41000 pxe-virtio +%endif cd %{buildroot} -rm -r .{%_bindir/qemu-io,%_bindir/qemu-img,%_bindir/qemu-nbd,%_datadir/{doc/qemu,qemu-kvm/{openbios-sparc32,openbios-sparc64,ppc_rom.bin,openbios-ppc,video.x,bamboo.dtb,petalogix-s3adsp1800.dtb}}} -%ifarch ia64 s390 +rm -r .{%_bindir/qemu-img,%_bindir/qemu-io,%_bindir/qemu-nbd,%_datadir/doc/qemu} +%if !%{build_fw_from_source} +rm -r .%_datadir/qemu-kvm/{openbios-sparc32,openbios-sparc64,ppc_rom.bin,openbios-ppc,video.x,bamboo.dtb,petalogix-s3adsp1800.dtb} +%endif +%ifarch ia64 s390x rm -f .%_datadir/qemu-kvm/bios.bin %endif rm -r .{%_mandir/man1/qemu-img.1,%_mandir/man8/qemu-nbd.8} -mv .%_bindir/{qemu*,qemu-kvm} +mv .%_bindir/{qemu-system*,qemu-kvm} mv .%_mandir/man1/{qemu.1,qemu-kvm.1} chmod 644 .%_mandir/man1/* install -D -m 644 %{SOURCE1} %{buildroot}/etc/udev/rules.d/60-kvm.rules @@ -205,8 +326,8 @@ %if %suse_version <= 1100 sed -i 's|--allow-unsupported-modules||g' %{buildroot}/etc/udev/rules.d/60-kvm.rules %endif -install -D -m 644 %{SOURCE2} %{buildroot}/usr/share/qemu-kvm/NETKVM-20081229.iso -install -D -m 755 %{SOURCE3} %{buildroot}/usr/share/qemu-kvm/qemu-ifup +install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu-kvm/qemu-ifup +install -D -m 644 %{SOURCE4} %{buildroot}/usr/share/qemu-kvm/virtio-drivers.iso %pre /usr/sbin/groupadd -r kvm 2>/dev/null || : ++++++ IA64-compile-fix-suse.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,71 +1,24 @@ Only in qemu-kvm-0.10.5: config-host.h~ -Index: qemu-kvm-0.10.5/hw/i8259.c +Index: qemu-kvm-0.12.0-rc0/hw/i8259.c =================================================================== ---- qemu-kvm-0.10.5.orig/hw/i8259.c -+++ qemu-kvm-0.10.5/hw/i8259.c -@@ -189,8 +189,10 @@ static void i8259_set_irq(void *opaque, - if (kvm_enabled()) { - int pic_ret; - if (kvm_set_irq(irq, level, &pic_ret)) { +--- qemu-kvm-0.12.0-rc0.orig/hw/i8259.c ++++ qemu-kvm-0.12.0-rc0/hw/i8259.c +@@ -647,8 +647,10 @@ static void kvm_i8259_set_irq(void *opaq + { + int pic_ret; + if (kvm_set_irq(irq, level, &pic_ret)) { +#if 0 - if (pic_ret != 0) - apic_set_irq_delivered(); + if (pic_ret != 0) + apic_set_irq_delivered(); +#endif - return; - } - } -Index: qemu-kvm-0.10.5/hw/ipf.c -=================================================================== ---- qemu-kvm-0.10.5.orig/hw/ipf.c -+++ qemu-kvm-0.10.5/hw/ipf.c -@@ -690,6 +690,7 @@ static int ioapic_map_irq(int devfn, int - void ioapic_set_irq(void *opaque, int irq_num, int level) - { - int vector; -+ int pic_ret; - - PCIDevice *pci_dev = (PCIDevice *)opaque; - vector = ioapic_map_irq(pci_dev->devfn, irq_num); -@@ -700,7 +701,7 @@ void ioapic_set_irq(void *opaque, int ir - ioapic_irq_count[vector] -= 1; - - if (kvm_enabled()) { -- if (kvm_set_irq(vector, ioapic_irq_count[vector] == 0)) -+ if (kvm_set_irq(vector, ioapic_irq_count[vector] == 0, &pic_ret)) - return; + return; } } -Index: qemu-kvm-0.10.5/monitor.c -=================================================================== ---- qemu-kvm-0.10.5.orig/monitor.c -+++ qemu-kvm-0.10.5/monitor.c -@@ -1598,10 +1598,12 @@ static const term_cmd_t term_cmds[] = { - { "host_net_remove", "is", net_host_device_remove, - "vlan_id name", "remove host VLAN client" }, - #endif -+#ifdef CONFIG_SLIRP - { "host_net_redir", "ss?", net_slirp_redir, - "[tcp|udp]:host-port:[guest-host]:guest-port", "redirect TCP or UDP connections from host to guest (requires -net user)\n" - "host_net_redir remove [tcp:|udp:]host-port -- remove redirection\n" - "host_net_redir list -- show all redirections" }, -+#endif - { "balloon", "i", do_balloon, - "target", "request VM to change it's memory allocation (in MB)" }, - { "set_link", "ss", do_set_link, -Index: qemu-kvm-0.10.5/qemu-kvm.c +Index: qemu-kvm-0.12.0-rc0/qemu-kvm.c =================================================================== ---- qemu-kvm-0.10.5.orig/qemu-kvm.c -+++ qemu-kvm-0.10.5/qemu-kvm.c -@@ -750,7 +750,7 @@ static struct kvm_callbacks qemu_kvm_ops - .shutdown = kvm_shutdown, - .io_window = kvm_io_window, - .try_push_interrupts = try_push_interrupts, --#ifdef KVM_CAP_USER_NMI -+#if 0 - .push_nmi = kvm_arch_push_nmi, - #endif - .post_kvm_run = post_kvm_run, -@@ -917,7 +917,6 @@ void kvm_cpu_register_physical_memory(ta +--- qemu-kvm-0.12.0-rc0.orig/qemu-kvm.c ++++ qemu-kvm-0.12.0-rc0/qemu-kvm.c +@@ -2291,7 +2291,6 @@ void kvm_set_phys_mem(target_phys_addr_t } if (must_use_aliases_target(start_addr)) return; @@ -73,7 +26,7 @@ while (size > 0) { p = find_mapping(start_addr); if (p) { -@@ -931,6 +930,7 @@ void kvm_cpu_register_physical_memory(ta +@@ -2305,6 +2304,7 @@ void kvm_set_phys_mem(target_phys_addr_t size = 0; } } @@ -81,26 +34,24 @@ return; } -Index: qemu-kvm-0.10.5/configure +Index: qemu-kvm-0.12.0-rc0/configure =================================================================== ---- qemu-kvm-0.10.5.orig/configure -+++ qemu-kvm-0.10.5/configure -@@ -502,7 +502,7 @@ if test "$werror" = "yes" ; then - CFLAGS="$CFLAGS -Werror" - fi - --CFLAGS="$CFLAGS -I$(readlink -f "$source_path/kvm/libkvm")" -+CFLAGS="$CFLAGS -I$(readlink -f "$source_path/kvm/libkvm") -I$(pwd)/kvm/kernel/arch/x86/include/" - - if test "$solaris" = "no" ; then - if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then -@@ -542,6 +542,9 @@ case "$cpu" in - ARCH_CFLAGS="-m64" - ARCH_LDFLAGS="-m64" +--- qemu-kvm-0.12.0-rc0.orig/configure ++++ qemu-kvm-0.12.0-rc0/configure +@@ -667,6 +667,9 @@ case "$cpu" in + ppc*) + host_guest_base="yes" ;; + ia64) + ARCH_CFLAGS="-I$(pwd)/kvm/kernel/arch/x86/include/" + ;; esac - if test x"$show_help" = x"yes" ; then + [ -z "$guest_base" ] && guest_base="$host_guest_base" +Index: qemu-kvm-0.12.0-rc0/default-configs/ia64-softmmu.mak +=================================================================== +--- /dev/null ++++ qemu-kvm-0.12.0-rc0/default-configs/ia64-softmmu.mak +@@ -0,0 +1,2 @@ ++# Default configuration for mips-softmmu ++ ++++++ IA64-kvm-suse.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -8,30 +8,28 @@ qemu/target-ia64/cpu.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) -Index: qemu-kvm-0.10.5/Makefile.target +Index: qemu-kvm-0.12.0-rc0/ia64.ld =================================================================== ---- qemu-kvm-0.10.5.orig/Makefile.target -+++ qemu-kvm-0.10.5/Makefile.target -@@ -117,7 +117,8 @@ BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH) - endif - - ifeq ($(ARCH),ia64) --CFLAGS+=-mno-sdata -+#CFLAGS+=-mno-sdata -+CFLAGS+=-msdata - endif - - CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) -Index: qemu-kvm-0.10.5/ia64.ld -=================================================================== ---- qemu-kvm-0.10.5.orig/ia64.ld -+++ qemu-kvm-0.10.5/ia64.ld -@@ -3,7 +3,7 @@ OUTPUT_FORMAT("elf64-ia64-little", "elf6 +--- qemu-kvm-0.12.0-rc0.orig/ia64.ld ++++ qemu-kvm-0.12.0-rc0/ia64.ld +@@ -2,6 +2,7 @@ + OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little", "elf64-ia64-little") OUTPUT_ARCH(ia64) - ENTRY(_start) --SEARCH_DIR("/usr/ia64-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); +SEARCH_DIR("/usr/ia64-suse-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); - /* Do we need any of these for elf? - __DYNAMIC = 0; */ + ENTRY(_start) + /* __DYNAMIC = 0; */ SECTIONS +Index: qemu-kvm-0.12.0-rc0/configure +=================================================================== +--- qemu-kvm-0.12.0-rc0.orig/configure ++++ qemu-kvm-0.12.0-rc0/configure +@@ -2664,7 +2664,7 @@ alpha) + cflags="-msmall-data $cflags" + ;; + ia64) +- cflags="-mno-sdata $cflags" ++ cflags="-msdata $cflags" + ;; + esac + ++++++ S390-qemu-early-printk.patch ++++++
From 23b25f548a3640099a8524798cc6379180262c50 Mon Sep 17 00:00:00 2001 From: Alexander Graf <agraf@suse.de> Date: Mon, 19 Oct 2009 12:21:55 +0200 Subject: [PATCH 2/4] Implement early printk in virtio-console
On our S390x Virtio machine we don't have anywhere to display early printks on, because we don't know about VGA or serial ports. So instead we just forward everything to the virtio console that we created anyways. Signed-off-by: Alexander Graf <agraf@suse.de> --- hw/s390-virtio.c | 3 +++ hw/virtio-console.c | 7 +++++++ hw/virtio-console.h | 2 ++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c index 50ffc82..df19729 100644 --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -97,6 +97,9 @@ int s390_virtio_hypercall(CPUState *env) } } else { /* Early printk */ + uint8_t *p = (uint8_t *)qemu_get_ram_ptr(mem); + VirtIOS390Device *dev = s390_virtio_bus_console(s390_bus); + virtio_console_print_early(dev->vdev, p); } break; case KVM_S390_VIRTIO_RESET: diff --git a/hw/virtio-console.c b/hw/virtio-console.c index 57f8f89..cd6cf20 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -105,6 +105,13 @@ static void vcon_event(void *opaque, int event) /* we will ignore any event for the time being */ } +void virtio_console_print_early(VirtIODevice *vdev, uint8_t *buf) +{ + VirtIOConsole *s = to_virtio_console(vdev); + + qemu_chr_write(s->chr, buf, strlen((char*)buf)); +} + static void virtio_console_save(QEMUFile *f, void *opaque) { VirtIOConsole *s = opaque; diff --git a/hw/virtio-console.h b/hw/virtio-console.h index 84d0717..f3ccc3c 100644 --- a/hw/virtio-console.h +++ b/hw/virtio-console.h @@ -16,4 +16,6 @@ /* The ID for virtio console */ #define VIRTIO_ID_CONSOLE 3 +void virtio_console_print_early(VirtIODevice *vdev, uint8_t *buf); + #endif -- 1.6.0.2 ++++++ S390-qemu-kvm.patch ++++++ Index: qemu-kvm-0.12.0-rc0/hw/msix.h =================================================================== --- qemu-kvm-0.12.0-rc0.orig/hw/msix.h +++ qemu-kvm-0.12.0-rc0/hw/msix.h @@ -4,33 +4,33 @@ #include "qemu-common.h" #include "pci.h" -int msix_init(PCIDevice *pdev, unsigned short nentries, - unsigned bar_nr, unsigned bar_size); +static int msix_init(PCIDevice *pdev, unsigned short nentries, + unsigned bar_nr, unsigned bar_size) { return 0; } -void msix_write_config(PCIDevice *pci_dev, uint32_t address, - uint32_t val, int len); +static void msix_write_config(PCIDevice *pci_dev, uint32_t address, + uint32_t val, int len) { } -void msix_mmio_map(PCIDevice *pci_dev, int region_num, - pcibus_t addr, pcibus_t size, int type); +static void msix_mmio_map(PCIDevice *pci_dev, int region_num, + pcibus_t addr, pcibus_t size, int type) { } -int msix_uninit(PCIDevice *d); +static int msix_uninit(PCIDevice *d) { return 0; } -void msix_save(PCIDevice *dev, QEMUFile *f); -void msix_load(PCIDevice *dev, QEMUFile *f); +static void msix_save(PCIDevice *dev, QEMUFile *f) { } +static void msix_load(PCIDevice *dev, QEMUFile *f) { } -int msix_enabled(PCIDevice *dev); -int msix_present(PCIDevice *dev); +static int msix_enabled(PCIDevice *dev) { return 0; } +static int msix_present(PCIDevice *dev) { return 0; } -uint32_t msix_bar_size(PCIDevice *dev); +static uint32_t msix_bar_size(PCIDevice *dev) { return 0; } -int msix_vector_use(PCIDevice *dev, unsigned vector); -void msix_vector_unuse(PCIDevice *dev, unsigned vector); -void msix_unuse_all_vectors(PCIDevice *dev); +static int msix_vector_use(PCIDevice *dev, unsigned vector) { return 0; } +static void msix_vector_unuse(PCIDevice *dev, unsigned vector) { } +static void msix_unuse_all_vectors(PCIDevice *dev) { } -void msix_notify(PCIDevice *dev, unsigned vector); +static void msix_notify(PCIDevice *dev, unsigned vector) { } -void msix_reset(PCIDevice *dev); +static void msix_reset(PCIDevice *dev) { } -extern int msix_supported; +//static int msix_supported = 0; #endif Index: qemu-kvm-0.12.0-rc0/hw/s390-virtio.c =================================================================== --- qemu-kvm-0.12.0-rc0.orig/hw/s390-virtio.c +++ qemu-kvm-0.12.0-rc0/hw/s390-virtio.c @@ -179,7 +179,7 @@ static void s390_init(ram_addr_t ram_siz exit(1); } - cpu_synchronize_state(env); + //cpu_synchronize_state(env); env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000UL; } @@ -236,6 +236,8 @@ static void s390_init(ram_addr_t ram_siz qdev_prop_set_drive(dev, "drive", dinfo); qdev_init_nofail(dev); } + + kvm_arch_load_regs(env); } static QEMUMachine s390_machine = { Index: qemu-kvm-0.12.0-rc0/kvm/include/linux/kvm.h =================================================================== --- qemu-kvm-0.12.0-rc0.orig/kvm/include/linux/kvm.h +++ qemu-kvm-0.12.0-rc0/kvm/include/linux/kvm.h @@ -181,6 +181,10 @@ struct kvm_run { __u64 cr8; __u64 apic_base; + /* the processor status word for s390 */ + __u64 psw_mask; /* psw upper half */ + __u64 psw_addr; /* psw lower half */ + union { /* KVM_EXIT_UNKNOWN */ struct { @@ -206,7 +210,7 @@ struct kvm_run { __u64 data_offset; /* relative to kvm_run start */ } io; struct { - struct kvm_debug_exit_arch arch; + //struct kvm_debug_exit_arch arch; } debug; /* KVM_EXIT_MMIO */ struct { @@ -232,8 +236,6 @@ struct kvm_run { /* KVM_EXIT_S390_SIEIC */ struct { __u8 icptcode; - __u64 mask; /* psw upper half */ - __u64 addr; /* psw lower half */ __u16 ipa; __u32 ipb; } s390_sieic; @@ -372,7 +374,7 @@ struct kvm_s390_interrupt { struct kvm_guest_debug { __u32 control; __u32 pad; - struct kvm_guest_debug_arch arch; + //struct kvm_guest_debug_arch arch; }; enum { Index: qemu-kvm-0.12.0-rc0/Makefile.target =================================================================== --- qemu-kvm-0.12.0-rc0.orig/Makefile.target +++ qemu-kvm-0.12.0-rc0/Makefile.target @@ -51,7 +51,7 @@ libobj-$(CONFIG_NOSOFTFLOAT) += fpu/soft libobj-y += op_helper.o helper.o libobj-$(CONFIG_NEED_MMU) += mmu.o -libobj-$(CONFIG_KVM) += kvm-tpr-opt.o +#libobj-$(CONFIG_KVM) += kvm-tpr-opt.o libobj-$(CONFIG_KVM) += qemu-kvm-helper.o libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o @@ -171,7 +171,7 @@ obj-y += virtio-blk.o virtio-balloon.o v obj-$(CONFIG_KVM) += kvm.o kvm-all.o # MSI-X depends on kvm for interrupt injection, # so moved it from Makefile.hw to Makefile.target for now -obj-y += msix.o +# obj-y += msix.o obj-$(CONFIG_ISA_MMIO) += isa_mmio.o LIBS+=-lz Index: qemu-kvm-0.12.0-rc0/qemu-kvm.c =================================================================== --- qemu-kvm-0.12.0-rc0.orig/qemu-kvm.c +++ qemu-kvm-0.12.0-rc0/qemu-kvm.c @@ -66,7 +66,7 @@ pthread_cond_t qemu_pause_cond = PTHREAD pthread_cond_t qemu_work_cond = PTHREAD_COND_INITIALIZER; __thread CPUState *current_env; -static int qemu_system_ready; +int qemu_system_ready; #define SIG_IPI (SIGRTMIN+4) @@ -157,7 +157,7 @@ static void init_slots(void) static int get_free_slot(kvm_context_t kvm) { - int i; + int i = 0; int tss_ext; #if defined(KVM_CAP_SET_TSS_ADDR) && !defined(__s390__) @@ -171,14 +171,21 @@ static int get_free_slot(kvm_context_t k * slot 0 to hold the extended memory, as the vmx will use the last 3 * pages of this slot. */ +#if 0 if (tss_ext > 0) i = 0; else i = 1; +#endif - for (; i < KVM_MAX_NUM_MEM_REGIONS; ++i) - if (!slots[i].len) + for (; i < KVM_MAX_NUM_MEM_REGIONS; ++i) { + DPRINTF("slot[%d].len = %#lx\n", i, slots[i].len); + if (!slots[i].len) { return i; + } + DPRINTF("slot[%d] skipped\n", i, slots[i].len); + } + return -1; } @@ -450,6 +457,12 @@ static void kvm_create_vcpu(CPUState *en env->kvm_fd = r; env->kvm_state = kvm_state; + r = kvm_vcpu_ioctl(env, KVM_S390_INITIAL_RESET, 0); + if (r < 0) { + fprintf(stderr, "kvm_s390_initial_reset: %m\n"); + exit(1); + } + mmap_size = kvm_ioctl(kvm_state, KVM_GET_VCPU_MMAP_SIZE, 0); if (mmap_size < 0) { fprintf(stderr, "get vcpu mmap size: %m\n"); @@ -939,12 +952,11 @@ int kvm_run(CPUState *env) } #endif -#if !defined(__s390__) if (r == -1) { r = handle_io_window(kvm); goto more; } -#endif + if (1) { switch (run->exit_reason) { case KVM_EXIT_UNKNOWN: @@ -981,7 +993,7 @@ int kvm_run(CPUState *env) case KVM_EXIT_SHUTDOWN: r = handle_shutdown(kvm, env); break; -#if defined(__s390__) +#if 0 case KVM_EXIT_S390_SIEIC: r = kvm_s390_handle_intercept(kvm, env, run); break; @@ -1127,7 +1139,7 @@ int kvm_destroy_memory_region_works(kvm_ return ret; } -int kvm_reinject_control(kvm_context_t kvm, int pit_reinject) +static int kvm_reinject_control(kvm_context_t kvm, int pit_reinject) { #ifdef KVM_CAP_REINJECT_CONTROL int r; @@ -1627,7 +1639,7 @@ static void kvm_do_save_mpstate(void *_e CPUState *env = _env; kvm_arch_save_mpstate(env); -#ifdef KVM_CAP_MP_STATE +#if 0 if (kvm_irqchip_in_kernel()) env->halted = (env->mp_state == KVM_MP_STATE_HALTED); #endif @@ -2293,11 +2305,13 @@ void kvm_set_phys_mem(target_phys_addr_t return; #endif while (size > 0) { +#if 0 p = find_mapping(start_addr); if (p) { kvm_unregister_memory_area(kvm_context, p->phys, p->len); drop_mapping(p->phys); } +#endif start_addr += TARGET_PAGE_SIZE; if (size > TARGET_PAGE_SIZE) { size -= TARGET_PAGE_SIZE; Index: qemu-kvm-0.12.0-rc0/qemu-kvm.h =================================================================== --- qemu-kvm-0.12.0-rc0.orig/qemu-kvm.h +++ qemu-kvm-0.12.0-rc0/qemu-kvm.h @@ -670,6 +670,7 @@ int kvm_enable_vapic(CPUState *env, uint #endif +#if 0 #if defined(__s390__) int kvm_s390_initial_reset(kvm_context_t kvm, int slot); int kvm_s390_interrupt(kvm_context_t kvm, int slot, @@ -677,6 +678,7 @@ int kvm_s390_interrupt(kvm_context_t kvm int kvm_s390_set_initial_psw(kvm_context_t kvm, int slot, psw_t psw); int kvm_s390_store_status(kvm_context_t kvm, int slot, unsigned long addr); #endif +#endif #ifdef KVM_CAP_DEVICE_ASSIGNMENT /*! Index: qemu-kvm-0.12.0-rc0/qemu-kvm-helper.c =================================================================== --- qemu-kvm-0.12.0-rc0.orig/qemu-kvm-helper.c +++ qemu-kvm-0.12.0-rc0/qemu-kvm-helper.c @@ -30,7 +30,7 @@ void qemu_kvm_call_with_env(void (*func) static void call_helper_cpuid(void *junk) { - helper_cpuid(); + //helper_cpuid(); } void qemu_kvm_cpuid_on_env(CPUState *env) Index: qemu-kvm-0.12.0-rc0/target-s390x/kvm.c =================================================================== --- qemu-kvm-0.12.0-rc0.orig/target-s390x/kvm.c +++ qemu-kvm-0.12.0-rc0/target-s390x/kvm.c @@ -70,10 +70,12 @@ #define SCLP_CMDW_READ_SCP_INFO 0x00020001 #define SCLP_CMDW_READ_SCP_INFO_FORCED 0x00120001 +#ifdef KVM_UPSTREAM int kvm_arch_init(KVMState *s, int smp_cpus) { return 0; } +#endif int kvm_arch_init_vcpu(CPUState *env) { @@ -86,17 +88,33 @@ int kvm_arch_init_vcpu(CPUState *env) return ret; } +#ifdef KVM_UPSTREAM void kvm_arch_reset_vcpu(CPUState *env) +#else +void kvm_arch_cpu_reset(CPUState *env) +#endif { /* FIXME: add code to reset vcpu. */ } +#ifdef KVM_UPSTREAM int kvm_arch_put_registers(CPUState *env) +#else +int _kvm_arch_load_regs(CPUState *env); + +void kvm_arch_load_regs(CPUState *env) +{ + _kvm_arch_load_regs(env); +} + +int _kvm_arch_load_regs(CPUState *env) +#endif { struct kvm_regs regs; int ret; int i; + dprintf("put regs!\n"); ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, ®s); if (ret < 0) { return ret; @@ -117,14 +135,27 @@ int kvm_arch_put_registers(CPUState *env return ret; } +#ifdef KVM_UPSTREAM int kvm_arch_get_registers(CPUState *env) +#else +int _kvm_arch_save_regs(CPUState *env); + +void kvm_arch_save_regs(CPUState *env) +{ + _kvm_arch_save_regs(env); +} + +int _kvm_arch_save_regs(CPUState *env) +#endif { uint32_t ret; struct kvm_regs regs; int i; + dprintf("get regs!\n"); ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, ®s); if (ret < 0) { + dprintf("OH NOEZ!\n"); return ret; } @@ -180,6 +211,10 @@ static void kvm_s390_interrupt_internal( { struct kvm_s390_interrupt kvmint; int r; + extern int qemu_system_ready; + + if (!qemu_system_ready) + return; if (!env->kvm_state) { return; @@ -459,10 +494,14 @@ static int handle_intercept(CPUState *en break; } - return r; + return 0; //r; } +#ifdef KVM_UPSTREAM int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run) +#else +static int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run) +#endif { int ret = 0; @@ -476,8 +515,77 @@ int kvm_arch_handle_exit(CPUState *env, break; default: fprintf(stderr, "Unknown KVM exit: %d\n", run->exit_reason); + ret = -1; break; } return ret; } + +int kvm_arch_run(CPUState *env) +{ + return kvm_arch_handle_exit(env, env->kvm_run); +} + +#ifndef KVM_UPSTREAM +void kvm_arch_save_mpstate(CPUState *env) +{ +} + +void kvm_arch_load_mpstate(CPUState *env) +{ +} + +int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, + void **vm_mem) +{ + return 0; +} + +int kvm_arch_qemu_create_context(void) +{ + return 0; +} + +void kvm_show_regs(CPUState *env) +{ + struct kvm_regs regs; + int i, r; + + r = kvm_vcpu_ioctl(env, KVM_GET_REGS, ®s); + if (r < 0) { + perror("KVM_GET_REGS"); + return; + } + + for (i = 0; i < 16; i++) { + fprintf(stderr, "R%02d=%016lx", i, regs.gprs[i]); + if ((i % 4) == 3) { + fprintf(stderr, "\n"); + } else { + fprintf(stderr, " "); + } + } + + fprintf(stderr, "PSW=mask %016lx addr %016lx\n", env->kvm_run->psw_addr, env->kvm_run->psw_mask); + fprintf(stderr, "ENV PSW=mask %016lx addr %016lx\n", env->psw.addr, env->psw.mask); +} + +int kvm_arch_halt(CPUState *env) +{ + return 1; +} + +void kvm_show_code(CPUState *env) +{ +} + +int kvm_arch_has_work(CPUState *env) +{ + return 1; +} + +void kvm_arch_process_irqchip_events(CPUState *env) +{ +} +#endif Index: qemu-kvm-0.12.0-rc0/target-s390x/libkvm.h =================================================================== --- /dev/null +++ qemu-kvm-0.12.0-rc0/target-s390x/libkvm.h @@ -0,0 +1,26 @@ +/* + * This header is for functions & variables that will ONLY be + * used inside libkvm for x86. + * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE + * WITHIN LIBKVM. + * + * derived from libkvm.c + * + * Copyright (C) 2006 Qumranet, Inc. + * + * Authors: + * Avi Kivity <avi@qumranet.com> + * Yaniv Kamay <yaniv@qumranet.com> + * + * This work is licensed under the GNU LGPL license, version 2. + */ + +#ifndef KVM_X86_H +#define KVM_X86_H + +#define PAGE_SIZE 4096ul +#define PAGE_MASK (~(PAGE_SIZE - 1)) + +#define smp_wmb() asm volatile("" ::: "memory") + +#endif ++++++ S390-qemu-zipl.patch ++++++
From 4d82c2bd78aae55328576eebdf3ce9be0e52c81d Mon Sep 17 00:00:00 2001 From: Alexander Graf <agraf@suse.de> Date: Tue, 24 Nov 2009 13:29:58 +0100 Subject: [PATCH 1/4] Add zipl bootloader interpreter
The default bootloader on S390 is zipl. Because we don't emulate normal S390 hardware we need to write our own parser for the bootloader configuration, so we can boot off real hard disks. This patch adds a pretty simple implementation of such an interpreter. It only supports 512 bytes sector sizes, always boots the default entry and doesn't work with reboots yet. But it's better than nothing. Signed-off-by: Alexander Graf <agraf@suse.de> --- v5 -> v6: - coding style --- Makefile.target | 2 +- hw/s390-virtio.c | 11 ++- hw/s390-zipl.c | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/s390-zipl.h | 20 ++++ target-s390x/cpu.h | 1 + 5 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 hw/s390-zipl.c create mode 100644 hw/s390-zipl.h Index: qemu-kvm-0.12.0-rc0/Makefile.target =================================================================== --- qemu-kvm-0.12.0-rc0.orig/Makefile.target +++ qemu-kvm-0.12.0-rc0/Makefile.target @@ -321,7 +321,7 @@ obj-sh4-y += ide/core.o ide/mmio.o obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o obj-m68k-y += m68k-semi.o dummy_m68k.o -obj-s390x-y = s390-virtio-bus.o s390-virtio.o +obj-s390x-y = s390-virtio-bus.o s390-virtio.o s390-zipl.o ifeq ($(TARGET_ARCH), ia64) firmware.o: firmware.c Index: qemu-kvm-0.12.0-rc0/hw/s390-virtio.c =================================================================== --- qemu-kvm-0.12.0-rc0.orig/hw/s390-virtio.c +++ qemu-kvm-0.12.0-rc0/hw/s390-virtio.c @@ -29,6 +29,7 @@ #include "hw/virtio-console.h" #include "hw/sysbus.h" #include "kvm.h" +#include "s390-zipl.h" #include "hw/s390-virtio-bus.h" @@ -170,6 +171,7 @@ static void s390_init(ram_addr_t ram_siz env->halted = 0; env->exception_index = 0; + // cpu_synchronize_state(env); if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); @@ -179,9 +181,7 @@ static void s390_init(ram_addr_t ram_siz exit(1); } - //cpu_synchronize_state(env); - env->psw.addr = KERN_IMAGE_START; - env->psw.mask = 0x0000000180000000UL; + env->reset_addr = KERN_IMAGE_START; } if (initrd_filename) { @@ -235,8 +235,12 @@ static void s390_init(ram_addr_t ram_siz dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive(dev, "drive", dinfo); qdev_init_nofail(dev); + + zipl_load(env, dinfo->bdrv); } + env->psw.mask = 0x0000000180000000UL; + env->psw.addr = env->reset_addr; kvm_arch_load_regs(env); } Index: qemu-kvm-0.12.0-rc0/hw/s390-zipl.c =================================================================== --- /dev/null +++ qemu-kvm-0.12.0-rc0/hw/s390-zipl.c @@ -0,0 +1,246 @@ +/* + * QEMU S390 zipl interpreter + * + * Copyright (c) 2009 Alexander Graf <agraf@suse.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "hw.h" +#include "block.h" +#include "sysemu.h" +#include "net.h" +#include "boards.h" +#include "monitor.h" +#include "loader.h" +#include "elf.h" +#include "hw/virtio.h" +#include "hw/virtio-console.h" +#include "hw/sysbus.h" +#include "kvm.h" +#include "s390-zipl.h" + +#include "hw/s390-virtio-bus.h" + +//#define DEBUG_S390 + +#ifdef DEBUG_S390 +#define dprintf(fmt, ...) \ + do { fprintf(stderr, "zipl: " fmt, ## __VA_ARGS__); } while (0) +#else +#define dprintf(fmt, ...) \ + do { } while (0) +#endif + +struct scsi_blockptr { + uint64_t blockno; + uint16_t size; + uint16_t blockct; + uint8_t reserved[4]; +} __attribute__ ((packed)); + +struct component_entry { + struct scsi_blockptr data; + uint8_t pad[7]; + uint8_t component_type; + uint64_t load_address; +} __attribute((packed)); + +struct component_header { + uint8_t magic[4]; + uint8_t type; + uint8_t reserved[27]; +} __attribute((packed)); + +struct mbr { + uint8_t magic[4]; + uint32_t version_id; + uint8_t reserved[8]; + struct scsi_blockptr blockptr; +} __attribute__ ((packed)); + +#define ZIPL_MAGIC "zIPL" +#define SECTOR_SIZE 512 + +#define ZIPL_COMP_HEADER_IPL 0x00 +#define ZIPL_COMP_HEADER_DUMP 0x01 + +#define ZIPL_COMP_ENTRY_LOAD 0x02 +#define ZIPL_COMP_ENTRY_EXEC 0x01 + +/* Check for ZIPL magic. Returns 0 if not matched. */ +static int zipl_magic(uint8_t *ptr) +{ + int r; + + r = !memcmp(ptr, ZIPL_MAGIC, 4); + if (!r) { + dprintf("invalid magic: %#hhx %#hhx %#hhx %#hhx\n", + ptr[0], ptr[1], ptr[2], ptr[3]); + } + + return r; +} + +static int zipl_load_segment(BlockDriverState *bdrv, + struct component_entry *entry) +{ + int max_entries = SECTOR_SIZE / sizeof(struct scsi_blockptr); + struct scsi_blockptr bprs[max_entries + 1]; + uint64_t blockno, address; + int i, len; + uint8_t *tmp; + + blockno = be64_to_cpu(entry->data.blockno); + address = be64_to_cpu(entry->load_address); + + dprintf("loading segment at %#lx : %#lx\n", blockno, address); + + do { + if (bdrv_read(bdrv, blockno, (uint8_t *)&bprs, 1) == -1) { + dprintf("failed reading bprs at %#lx\n", blockno); + goto fail; + } + + for (i = 0; i < max_entries; i++) { + blockno = be64_to_cpu(bprs[i].blockno); + if (!blockno) { + break; + } + + len = be16_to_cpu(bprs[i].size) * + (be16_to_cpu(bprs[i].blockct) + 1); + tmp = qemu_malloc(len); + if (bdrv_pread(bdrv, blockno * SECTOR_SIZE, tmp, len) == -1) { + dprintf("failed reading %#x b segment at %#lx\n", + len, blockno * SECTOR_SIZE); + qemu_free(tmp); + goto fail; + } + + cpu_physical_memory_write(address, tmp, len); + qemu_free(tmp); + address += len; + } + } while (blockno); + + return 0; + +fail: + dprintf("failed loading segment\n"); + return -1; +} + +/* Run a zipl program */ +static int zipl_run(CPUState *env, BlockDriverState *bdrv, struct scsi_blockptr *pte) +{ + struct component_header *header; + struct component_entry *entry; + uint8_t sec[SECTOR_SIZE]; + + bdrv_read(bdrv, be64_to_cpu(pte->blockno), sec, 1); + header = (struct component_header *)sec; + + if (!zipl_magic(sec)) { + goto fail; + } + + if (header->type != ZIPL_COMP_HEADER_IPL) { + goto fail; + } + + dprintf("start loading images\n"); + + /* Load image(s) into RAM */ + entry = (struct component_entry *)(&header[1]); + while (entry->component_type == ZIPL_COMP_ENTRY_LOAD) { + if (zipl_load_segment(bdrv, entry) < 0) { + goto fail; + } + + entry++; + + if ((uint8_t*)(&entry[1]) > (sec + SECTOR_SIZE)) { + goto fail; + } + } + + /* And set the reset vector, so we know where to start */ + if (entry->component_type != ZIPL_COMP_ENTRY_EXEC) { + goto fail; + } + + env->reset_addr = be64_to_cpu(entry->load_address) & 0x7fffffff; + dprintf("set reset addr to: %#lx\n", env->reset_addr); + + return 0; + +fail: + dprintf("failed running zipl\n"); + return -1; +} + +int zipl_load(CPUState *env, BlockDriverState *bdrv) +{ + struct mbr mbr; + uint8_t sec[SECTOR_SIZE], *ns, *ns_end; + int program_table_entries = 0; + int pte_len = sizeof(struct scsi_blockptr); + struct scsi_blockptr *prog_table_entry; + + /* Grab the MBR */ + + if (bdrv_pread(bdrv, 0, &mbr, sizeof(mbr)) == -1) { + goto fail; + } + + if (!zipl_magic(mbr.magic)) { + goto fail; + } + + /* Parse the program table */ + if (bdrv_read(bdrv, be64_to_cpu(mbr.blockptr.blockno), sec, 1) == -1) { + goto fail; + } + + if (!zipl_magic(sec)) { + goto fail; + } + + ns_end = sec + SECTOR_SIZE; + for (ns = (sec + pte_len); (ns + pte_len) < ns_end; ns++) { + prog_table_entry = (struct scsi_blockptr *)ns; + if (!prog_table_entry->blockno) { + break; + } + + program_table_entries++; + } + + dprintf("Found %d program table entries\n", program_table_entries); + + if (!program_table_entries) { + goto fail; + } + + /* Run the default entry */ + + prog_table_entry = (struct scsi_blockptr *)(sec + pte_len); + + return zipl_run(env, bdrv, prog_table_entry); + +fail: + dprintf("failed loading zipl\n"); + return -1; +} Index: qemu-kvm-0.12.0-rc0/hw/s390-zipl.h =================================================================== --- /dev/null +++ qemu-kvm-0.12.0-rc0/hw/s390-zipl.h @@ -0,0 +1,20 @@ +/* + * QEMU S390x ZIPL loading helper + * + * Copyright (c) 2009 Alexander Graf <agraf@suse.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +extern int zipl_load(CPUState *env, BlockDriverState *bdrv); Index: qemu-kvm-0.12.0-rc0/target-s390x/cpu.h =================================================================== --- qemu-kvm-0.12.0-rc0.orig/target-s390x/cpu.h +++ qemu-kvm-0.12.0-rc0/target-s390x/cpu.h @@ -63,6 +63,7 @@ typedef struct CPUS390XState { int cc; /* condition code (0-3) */ uint64_t __excp_addr; + uint64_t reset_addr; CPU_COMMON } CPUS390XState; ++++++ kvm-bios.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -4,38 +4,22 @@ - An PBLK which provides the size of the L2 and L3 caches - If newer hardware like ICH6 IDE is found, init it Signed-off-by: Alex Graf - http://alex.csgraf.de -Index: qemu-kvm-0.11.0/kvm/bios-mac/acpi-dsdt.dsl +Index: qemu-kvm-0.12.2/roms/seabios-mac/src/acpi-dsdt.dsl =================================================================== ---- qemu-kvm-0.11.0.orig/kvm/bios-mac/acpi-dsdt.dsl -+++ qemu-kvm-0.11.0/kvm/bios-mac/acpi-dsdt.dsl -@@ -38,6 +38,47 @@ DefinitionBlock ( - - /* PCI Bus definition */ - Scope(\_SB) { -+ Device (HPET) -+ { -+ Name (_HID, EisaId ("PNP0103")) -+ Name (_CID, 0x010CD041) -+ Name (BUF0, ResourceTemplate () -+ { -+ IRQNoFlags () -+ {2} -+ IRQNoFlags () -+ {8} -+ Memory32Fixed (ReadOnly, -+ 0xFED00000, // Address Base -+ 0x00000400, // Address Length -+ _Y16) -+ }) -+ Method (_STA, 0, NotSerialized) -+ { -+ Return (0x0F) -+ } -+ Method (_CRS, 0, Serialized) -+ { -+ Return (BUF0) -+ } -+ } +--- qemu-kvm-0.12.2.orig/roms/seabios-mac/src/acpi-dsdt.dsl ++++ qemu-kvm-0.12.2/roms/seabios-mac/src/acpi-dsdt.dsl +@@ -198,6 +198,7 @@ DefinitionBlock ( + + Device(HPET) { + Name(_HID, EISAID("PNP0103")) ++ Name(_CID, 0x010CD041) + Name(_UID, 0) + Method (_STA, 0, NotSerialized) { + Return(0x0F) +@@ -214,6 +215,23 @@ DefinitionBlock ( + ) + }) + } + Device (SMC) + { + Name (_HID, EisaId ("APP0001")) @@ -53,68 +37,41 @@ + {6} + }) + } - Device(PCI0) { - Name (_HID, EisaId ("PNP0A03")) - Name (_ADR, 0x00) -Index: qemu-kvm-0.11.0/kvm/bios-mac/rombios32.c -=================================================================== ---- qemu-kvm-0.11.0.orig/kvm/bios-mac/rombios32.c -+++ qemu-kvm-0.11.0/kvm/bios-mac/rombios32.c -@@ -713,6 +713,9 @@ void smp_probe(void) - #define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 - #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 - #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -+#define PCI_DEVICE_ID_INTEL_874079 0x27a0 /* i945GM Express Chipset */ -+#define PCI_DEVICE_ID_INTEL_945GL 0x27b9 /* ICH7 LPC */ -+#define PCI_DEVICE_ID_INTEL_ICH6IDE 0x269e + } - #define PCI_VENDOR_ID_IBM 0x1014 - #define PCI_VENDOR_ID_APPLE 0x106b -@@ -726,7 +729,9 @@ static uint32_t pci_bios_io_addr; - static uint32_t pci_bios_mem_addr; - static uint32_t pci_bios_bigmem_addr; + Scope(\_SB.PCI0) { +Index: qemu-kvm-0.12.2/roms/seabios-mac/src/pciinit.c +=================================================================== +--- qemu-kvm-0.12.2.orig/roms/seabios-mac/src/pciinit.c ++++ qemu-kvm-0.12.2/roms/seabios-mac/src/pciinit.c +@@ -18,7 +18,8 @@ static u32 pci_bios_io_addr; + static u32 pci_bios_mem_addr; /* host irqs corresponding to PCI irqs A-D */ --static uint8_t pci_irqs[4] = { 10, 10, 11, 11 }; -+static uint8_t pci_irqs[4] = { 11, 10, 11, 10 }; -+//static uint8_t pci_irqs[4] = { 10, 10, 11, 11 }; -+//static uint8_t pci_irqs[4] = { 0x10, 0x11, 0x12, 0x13 }; - static PCIDevice i440_pcidev; - - static void pci_config_writel(PCIDevice *d, uint32_t addr, uint32_t val) -@@ -857,7 +862,9 @@ static void pci_bios_init_bridges(PCIDev - - if (vendor_id == PCI_VENDOR_ID_INTEL && - (device_id == PCI_DEVICE_ID_INTEL_82371SB_0 || -- device_id == PCI_DEVICE_ID_INTEL_82371AB_0)) { -+ device_id == PCI_DEVICE_ID_INTEL_82371AB_0 || -+ device_id == PCI_DEVICE_ID_INTEL_874079 || -+ device_id == PCI_DEVICE_ID_INTEL_945GL)) { + static u8 pci_irqs[4] = { +- 10, 10, 11, 11 ++// 10, 10, 11, 11 ++ 11, 10, 11, 10 + }; + + static void pci_set_io_region_addr(u16 bdf, int region_num, u32 addr) +@@ -53,7 +54,9 @@ static void pci_bios_init_bridges(u16 bd + + if (vendor_id == PCI_VENDOR_ID_INTEL + && (device_id == PCI_DEVICE_ID_INTEL_82371SB_0 +- || device_id == PCI_DEVICE_ID_INTEL_82371AB_0)) { ++ || device_id == PCI_DEVICE_ID_INTEL_82371AB_0 ++ || device_id == PCI_DEVICE_ID_INTEL_82945GM_HB ++ || device_id == PCI_DEVICE_ID_INTEL_ICH7_1)) { int i, irq; - uint8_t elcr[2]; - -@@ -957,8 +964,9 @@ static void pci_bios_init_device(PCIDevi - case 0x0101: /* Mass storage controller - IDE interface */ - if (vendor_id == PCI_VENDOR_ID_INTEL && - (device_id == PCI_DEVICE_ID_INTEL_82371SB_1 || -- device_id == PCI_DEVICE_ID_INTEL_82371AB)) { -- /* PIIX3/PIIX4 IDE */ -+ device_id == PCI_DEVICE_ID_INTEL_82371AB || -+ device_id == PCI_DEVICE_ID_INTEL_ICH6IDE)) { -+ /* PIIX3/PIIX4/ICH6 IDE */ - pci_config_writew(d, 0x40, 0x8000); // enable IDE0 - pci_config_writew(d, 0x42, 0x8000); // enable IDE1 - goto default_map; -@@ -1063,6 +1071,13 @@ void pci_for_each_device(void (*init_fun - } - } - } -+ /* PBLK (CPU information structure) */ -+ { -+ uint32_t *pblk = (void*) (0x410); -+ *pblk = 0; -+ ((char*)pblk)[4] = 64; /* size of the Level 2 cache */ -+ ((char*)pblk)[5] = 0; /* size of the Level 3 cache */ -+ } - } + u8 elcr[2]; - void pci_bios_init(void) +@@ -90,7 +93,8 @@ static void pci_bios_init_device(u16 bdf + case PCI_CLASS_STORAGE_IDE: + if (vendor_id == PCI_VENDOR_ID_INTEL + && (device_id == PCI_DEVICE_ID_INTEL_82371SB_1 +- || device_id == PCI_DEVICE_ID_INTEL_82371AB)) { ++ || device_id == PCI_DEVICE_ID_INTEL_82371AB ++ || device_id == PCI_DEVICE_ID_INTEL_ESB2_18)) { + /* PIIX3/PIIX4 IDE */ + pci_config_writew(bdf, 0x40, 0x8000); // enable IDE0 + pci_config_writew(bdf, 0x42, 0x8000); // enable IDE1 ++++++ kvm-no-pp-directives-in-macros.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,7 +1,7 @@ -Index: qemu-kvm-0.11.0/qemu-img.c +Index: qemu-kvm-0.12.2/qemu-img.c =================================================================== ---- qemu-kvm-0.11.0.orig/qemu-img.c -+++ qemu-kvm-0.11.0/qemu-img.c +--- qemu-kvm-0.12.2.orig/qemu-img.c ++++ qemu-kvm-0.12.2/qemu-img.c @@ -58,7 +58,7 @@ static void format_print(void *opaque, c /* Please keep in synch with qemu-img.texi */ static void help(void) @@ -11,11 +11,11 @@ "usage: qemu-img command [command options]\n" "QEMU disk image utility\n" "\n" -Index: qemu-kvm-0.11.0/vl.c +Index: qemu-kvm-0.12.2/vl.c =================================================================== ---- qemu-kvm-0.11.0.orig/vl.c -+++ qemu-kvm-0.11.0/vl.c -@@ -4447,7 +4447,7 @@ static void version(void) +--- qemu-kvm-0.12.2.orig/vl.c ++++ qemu-kvm-0.12.2/vl.c +@@ -4271,7 +4271,7 @@ static void version(void) static void help(int exitcode) { version(); ++++++ kvm-qemu-applesmc.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,21 +1,21 @@ #qemu-only -> submit upstream qemu -Index: qemu-kvm-0.11.0/Makefile.target +Index: qemu-kvm-0.12.2/Makefile.target =================================================================== ---- qemu-kvm-0.11.0.orig/Makefile.target -+++ qemu-kvm-0.11.0/Makefile.target -@@ -529,7 +529,7 @@ obj-y += wdt_ib700.o wdt_i6300esb.o - obj-i386-y = ide.o pckbd.o vga.o $(sound-obj-y) dma.o +--- qemu-kvm-0.12.2.orig/Makefile.target ++++ qemu-kvm-0.12.2/Makefile.target +@@ -206,7 +206,7 @@ obj-i386-y += pckbd.o $(sound-obj-y) dma + obj-i386-y += vga.o vga-pci.o vga-isa.o obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o -obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o lpc.o +obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o lpc.o applesmc.o - obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o + obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o obj-i386-y += extboot.o - ifeq ($(USE_KVM_PIT), 1) -Index: qemu-kvm-0.11.0/hw/applesmc.c + obj-i386-y += ne2000-isa.o +Index: qemu-kvm-0.12.2/hw/applesmc.c =================================================================== --- /dev/null -+++ qemu-kvm-0.11.0/hw/applesmc.c ++++ qemu-kvm-0.12.2/hw/applesmc.c @@ -0,0 +1,171 @@ +/* + * Apple SMC controller @@ -188,13 +188,13 @@ + register_ioport_write(APPLESMC_CMD_PORT, 4, 1, applesmc_io_cmd_writeb, s); +} + -Index: qemu-kvm-0.11.0/hw/pc.h +Index: qemu-kvm-0.12.2/hw/pc.h =================================================================== ---- qemu-kvm-0.11.0.orig/hw/pc.h -+++ qemu-kvm-0.11.0/hw/pc.h -@@ -179,6 +179,10 @@ void pci_piix4_ide_init(PCIBus *bus, Blo +--- qemu-kvm-0.12.2.orig/hw/pc.h ++++ qemu-kvm-0.12.2/hw/pc.h +@@ -163,6 +163,10 @@ void isa_cirrus_vga_init(void); - void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd); + void isa_ne2000_init(int base, int irq, NICInfo *nd); +/* applesmc.c */ +void applesmc_init(void); @@ -203,25 +203,25 @@ /* lpc.c */ void lpc_init(PCIBus *bus, int devfn, qemu_irq *pic); -Index: qemu-kvm-0.11.0/vl.c +Index: qemu-kvm-0.12.2/vl.c =================================================================== ---- qemu-kvm-0.11.0.orig/vl.c -+++ qemu-kvm-0.11.0/vl.c -@@ -5245,6 +5245,9 @@ int main(int argc, char **argv, char **e - case QEMU_OPTION_no_fd_bootchk: - fd_bootchk = 0; +--- qemu-kvm-0.12.2.orig/vl.c ++++ qemu-kvm-0.12.2/vl.c +@@ -5495,6 +5495,9 @@ int main(int argc, char **argv, char **e + exit(1); + } break; + case QEMU_OPTION_osk: -+ applesmc_setkey(optarg); ++ applesmc_setkey((char*)optarg); + break; #endif - case QEMU_OPTION_net: - if (nb_net_clients >= MAX_NET_CLIENTS) { -Index: qemu-kvm-0.11.0/qemu-options.hx + #ifdef CONFIG_KVM + #ifdef KVM_UPSTREAM +Index: qemu-kvm-0.12.2/qemu-options.hx =================================================================== ---- qemu-kvm-0.11.0.orig/qemu-options.hx -+++ qemu-kvm-0.11.0/qemu-options.hx -@@ -684,6 +684,15 @@ be needed to boot from old floppy disks. +--- qemu-kvm-0.12.2.orig/qemu-options.hx ++++ qemu-kvm-0.12.2/qemu-options.hx +@@ -711,6 +711,15 @@ be needed to boot from old floppy disks. ETEXI #ifdef TARGET_I386 ++++++ kvm-qemu-default-memsize.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,13 +1,13 @@ -Index: qemu-kvm-0.11.0/vl.c +Index: qemu-kvm-0.12.2/vl.c =================================================================== ---- qemu-kvm-0.11.0.orig/vl.c -+++ qemu-kvm-0.11.0/vl.c -@@ -175,7 +175,7 @@ int main(int argc, char **argv) +--- qemu-kvm-0.12.2.orig/vl.c ++++ qemu-kvm-0.12.2/vl.c +@@ -173,7 +173,7 @@ int main(int argc, char **argv) //#define DEBUG_NET //#define DEBUG_SLIRP -#define DEFAULT_RAM_SIZE 128 +#define DEFAULT_RAM_SIZE 384 - /* Max number of USB devices that can be specified on the commandline. */ - #define MAX_USB_CMDLINE 8 + static const char *data_dir; + const char *bios_name = NULL; ++++++ kvm-qemu-ide-ich6.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,59 +1,46 @@ #qemu-only -> submit upstream qemu -Index: qemu-kvm-0.11.0/hw/ide.c +Index: qemu-kvm-0.12.2/hw/irq.c =================================================================== ---- qemu-kvm-0.11.0.orig/hw/ide.c -+++ qemu-kvm-0.11.0/hw/ide.c -@@ -474,6 +474,7 @@ static inline int media_is_cd(IDEState * - #define IDE_TYPE_PIIX3 0 - #define IDE_TYPE_CMD646 1 - #define IDE_TYPE_PIIX4 2 -+#define IDE_TYPE_ICH6 3 +--- qemu-kvm-0.12.2.orig/hw/irq.c ++++ qemu-kvm-0.12.2/hw/irq.c +@@ -35,6 +35,7 @@ void qemu_set_irq(qemu_irq irq, int leve + if (!irq) + return; - /* CMD646 specific */ - #define MRDMODE 0x71 -@@ -3411,6 +3412,57 @@ void pci_piix3_ide_init(PCIBus *bus, Blo ++//printf("IRQ set %#hhx = %#hhd using %p\n", irq->n, level, irq->handler); + irq->handler(irq->opaque, irq->n, level); + } - qemu_register_reset(piix3_reset, d); - piix3_reset(d); -+ -+ pci_register_bar((PCIDevice *)d, 4, 0x10, -+ PCI_ADDRESS_SPACE_IO, bmdma_map); -+ -+ ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], pic[14]); -+ ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], pic[15]); -+ ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6); -+ ide_init_ioport(&d->ide_if[2], 0x170, 0x376); -+ -+ for (i = 0; i < 4; i++) -+ if (hd_table[i]) -+ hd_table[i]->private = &d->dev; -+ -+ register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d); -+} -+ -+ -+/* hd_table must contain 4 block drivers */ -+/* NOTE: for the ICH-6, the IRQs and IOports are hardcoded */ -+void pci_ich6_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, -+ qemu_irq *pic) +Index: qemu-kvm-0.12.2/hw/ide.h +=================================================================== +--- qemu-kvm-0.12.2.orig/hw/ide.h ++++ qemu-kvm-0.12.2/hw/ide.h +@@ -12,6 +12,7 @@ void pci_cmd646_ide_init(PCIBus *bus, Dr + int secondary_ide_enabled); + void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); + void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); ++void pci_ich6_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); + + /* ide-macio.c */ + int pmac_ide_init (DriveInfo **hd_table, qemu_irq irq, +Index: qemu-kvm-0.12.2/hw/ide/piix.c +=================================================================== +--- qemu-kvm-0.12.2.orig/hw/ide/piix.c ++++ qemu-kvm-0.12.2/hw/ide/piix.c +@@ -155,6 +155,29 @@ static int pci_piix4_ide_initfn(PCIDevic + return pci_piix_ide_initfn(d); + } + ++static int pci_ich6_ide_initfn(PCIDevice *dev) +{ -+ PCIIDEState *d; + uint8_t *pci_conf; -+ int i; ++ PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); + -+ /* register a function 1 of ICH-6 */ -+ d = (PCIIDEState *)pci_register_device(bus, "ICH-6 IDE", -+ sizeof(PCIIDEState), -+ devfn, -+ NULL, NULL); -+ d->type = IDE_TYPE_ICH6; ++ pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL); ++ pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_ICH6); + + pci_conf = d->dev.config; -+ pci_conf[0x00] = 0x86; // Intel -+ pci_conf[0x01] = 0x80; -+ pci_conf[0x02] = 0x9e; -+ pci_conf[0x03] = 0x26; + + pci_conf[0x09] = 0x80; // legacy ATA mode + pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE @@ -65,33 +52,50 @@ + pci_conf[0x42] = 0; + pci_conf[0x43] = 0x00; // secondary port disabled + -+ qemu_register_reset(piix3_reset, d); -+ piix3_reset(d); - - pci_register_bar((PCIDevice *)d, 4, 0x10, - PCI_ADDRESS_SPACE_IO, bmdma_map); -Index: qemu-kvm-0.11.0/hw/irq.c -=================================================================== ---- qemu-kvm-0.11.0.orig/hw/irq.c -+++ qemu-kvm-0.11.0/hw/irq.c -@@ -35,6 +35,7 @@ void qemu_set_irq(qemu_irq irq, int leve - if (!irq) - return; - -+//printf("IRQ set %#hhx = %#hhd using %p\n", irq->n, level, irq->handler); - irq->handler(irq->opaque, irq->n, level); ++ return pci_piix_ide_initfn(d); ++} ++ + /* hd_table must contain 4 block drivers */ + /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ + void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) +@@ -175,6 +198,16 @@ void pci_piix4_ide_init(PCIBus *bus, Dri + pci_ide_create_devs(dev, hd_table); } -Index: qemu-kvm-0.11.0/hw/pc.h ++/* hd_table must contain 4 block drivers */ ++/* NOTE: for the ICH6, the IRQs and IOports are hardcoded */ ++void pci_ich6_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) ++{ ++ PCIDevice *dev; ++ ++ dev = pci_create_simple(bus, devfn, "ICH6 IDE"); ++ pci_ide_create_devs(dev, hd_table); ++} ++ + static PCIDeviceInfo piix_ide_info[] = { + { + .qdev.name = "piix3-ide", +@@ -187,6 +220,11 @@ static PCIDeviceInfo piix_ide_info[] = { + .qdev.no_user = 1, + .init = pci_piix4_ide_initfn, + },{ ++ .qdev.name = "ICH6 IDE", ++ .qdev.size = sizeof(PCIIDEState), ++ .qdev.no_user = 1, ++ .init = pci_ich6_ide_initfn, ++ },{ + /* end of list */ + } + }; +Index: qemu-kvm-0.12.2/hw/pci_ids.h =================================================================== ---- qemu-kvm-0.11.0.orig/hw/pc.h -+++ qemu-kvm-0.11.0/hw/pc.h -@@ -174,6 +174,8 @@ void pci_piix3_ide_init(PCIBus *bus, Blo - qemu_irq *pic); - void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, - qemu_irq *pic); -+void pci_ich6_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, -+ qemu_irq *pic); - - /* ne2000.c */ - +--- qemu-kvm-0.12.2.orig/hw/pci_ids.h ++++ qemu-kvm-0.12.2/hw/pci_ids.h +@@ -88,6 +88,7 @@ + #define PCI_VENDOR_ID_INTEL 0x8086 + #define PCI_DEVICE_ID_INTEL_82441 0x1237 + #define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415 ++#define PCI_DEVICE_ID_INTEL_ICH6 0x269e + #define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab + #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 + #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 ++++++ kvm-qemu-lpc.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,21 +1,21 @@ #qemu-only -> submit upstream qemu -Index: qemu-kvm-0.11.0-rc1/Makefile.target +Index: qemu-kvm-0.12.2/Makefile.target =================================================================== ---- qemu-kvm-0.11.0-rc1.orig/Makefile.target -+++ qemu-kvm-0.11.0-rc1/Makefile.target -@@ -529,7 +529,7 @@ obj-y += wdt_ib700.o wdt_i6300esb.o - obj-i386-y = ide.o pckbd.o vga.o $(sound-obj-y) dma.o +--- qemu-kvm-0.12.2.orig/Makefile.target ++++ qemu-kvm-0.12.2/Makefile.target +@@ -206,7 +206,7 @@ obj-i386-y += pckbd.o $(sound-obj-y) dma + obj-i386-y += vga.o vga-pci.o vga-isa.o obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o -obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o +obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o lpc.o - obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o + obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o obj-i386-y += extboot.o - ifeq ($(USE_KVM_PIT), 1) -Index: qemu-kvm-0.11.0-rc1/hw/lpc.c + obj-i386-y += ne2000-isa.o +Index: qemu-kvm-0.12.2/hw/lpc.c =================================================================== --- /dev/null -+++ qemu-kvm-0.11.0-rc1/hw/lpc.c ++++ qemu-kvm-0.12.2/hw/lpc.c @@ -0,0 +1,162 @@ +/* + * Low Pin Count emulation @@ -179,13 +179,13 @@ +#endif +} + -Index: qemu-kvm-0.11.0-rc1/hw/pc.h +Index: qemu-kvm-0.12.2/hw/pc.h =================================================================== ---- qemu-kvm-0.11.0-rc1.orig/hw/pc.h -+++ qemu-kvm-0.11.0-rc1/hw/pc.h -@@ -179,6 +179,9 @@ void pci_piix4_ide_init(PCIBus *bus, Blo +--- qemu-kvm-0.12.2.orig/hw/pc.h ++++ qemu-kvm-0.12.2/hw/pc.h +@@ -163,6 +163,9 @@ void isa_cirrus_vga_init(void); - void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd); + void isa_ne2000_init(int base, int irq, NICInfo *nd); +/* lpc.c */ +void lpc_init(PCIBus *bus, int devfn, qemu_irq *pic); ++++++ kvm-qemu-macmodel.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -7,13 +7,13 @@ # pc_init1(.... , PCI | IOAPIC | PIIX, ..... # pc_init1(.... , PCI | ICH6, LPC, SMC , ...) -Index: qemu-kvm-0.11.0/hw/pc.c +Index: qemu-kvm-0.12.2/hw/pc.c =================================================================== ---- qemu-kvm-0.11.0.orig/hw/pc.c -+++ qemu-kvm-0.11.0/hw/pc.c -@@ -92,6 +92,12 @@ static void option_rom_setup_reset(targe - qemu_register_reset(option_rom_reset, rrd); - } +--- qemu-kvm-0.12.2.orig/hw/pc.c ++++ qemu-kvm-0.12.2/hw/pc.c +@@ -92,6 +92,12 @@ static void isa_irq_handler(void *opaque + qemu_set_irq(isa->ioapic[n], level); + }; +enum pc_model { + MODEL_ISA = 0, @@ -24,7 +24,7 @@ static void ioport80_write(void *opaque, uint32_t addr, uint32_t data) { } -@@ -1116,7 +1122,7 @@ static void pc_init1(ram_addr_t ram_size +@@ -991,7 +997,7 @@ static void pc_init1(ram_addr_t ram_size const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, @@ -33,7 +33,7 @@ { char *filename; int ret, linux_boot, i; -@@ -1147,11 +1153,15 @@ static void pc_init1(ram_addr_t ram_size +@@ -1021,11 +1027,15 @@ static void pc_init1(ram_addr_t ram_size /* init CPUs */ if (cpu_model == NULL) { @@ -51,7 +51,7 @@ } if (kvm_enabled()) { -@@ -1184,8 +1194,16 @@ static void pc_init1(ram_addr_t ram_size +@@ -1058,8 +1068,16 @@ static void pc_init1(ram_addr_t ram_size /* BIOS load */ @@ -70,16 +70,16 @@ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); -@@ -1283,7 +1301,7 @@ static void pc_init1(ram_addr_t ram_size - i8259 = i8259_init(cpu_irq[0]); - ferr_irq = i8259[13]; +@@ -1129,7 +1147,7 @@ static void pc_init1(ram_addr_t ram_size + isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24); + } - if (pci_enabled) { + if (model > MODEL_ISA) { - pci_bus = i440fx_init(&i440fx_state, i8259); - piix3_devfn = piix3_init(pci_bus, -1); + pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq); } else { -@@ -1296,18 +1314,18 @@ static void pc_init1(ram_addr_t ram_size + pci_bus = NULL; +@@ -1145,18 +1163,18 @@ static void pc_init1(ram_addr_t ram_size register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (cirrus_vga_enabled) { @@ -101,75 +101,50 @@ pci_vga_init(pci_bus, 0, 0); } else { isa_vga_init(); -@@ -1321,8 +1339,13 @@ static void pc_init1(ram_addr_t ram_size +@@ -1170,7 +1188,12 @@ static void pc_init1(ram_addr_t ram_size register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); - if (pci_enabled) { -- ioapic = ioapic_init(); -+ switch (model) { -+ case MODEL_MAC: -+ applesmc_init(); -+ lpc_init(pci_bus, piix3_devfn, i8259); -+ case MODEL_PCI: -+ ioapic = ioapic_init(); -+ break; - } - #ifdef USE_KVM_PIT - if (kvm_enabled() && qemu_kvm_pit_in_kernel()) -@@ -1334,7 +1357,7 @@ static void pc_init1(ram_addr_t ram_size - if (!no_hpet) { - hpet_init(i8259); - } -- if (pci_enabled) { ++ if (model == MODEL_MAC) { ++ applesmc_init(); ++ lpc_init(pci_bus, piix3_devfn, i8259); ++ } ++ + if (model > MODEL_ISA) { - pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic); + isa_irq_state->ioapic = ioapic_init(); + ioapic_irq_hack = isa_irq; } - -@@ -1357,7 +1380,7 @@ static void pc_init1(ram_addr_t ram_size +@@ -1200,7 +1223,7 @@ static void pc_init1(ram_addr_t ram_size for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; - if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) -+ if (model == MODEL_ISA || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) - pc_init_ne2k_isa(nd, i8259); ++ if (!(model > MODEL_ISA) || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) + pc_init_ne2k_isa(nd); else - pci_nic_init(nd, "rtl8139", NULL); -@@ -1378,19 +1401,25 @@ static void pc_init1(ram_addr_t ram_size - hd[i] = NULL; + pci_nic_init_nofail(nd, "rtl8139", NULL); +@@ -1215,7 +1238,9 @@ static void pc_init1(ram_addr_t ram_size + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } - if (pci_enabled) { -- pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); -- } else { -- for(i = 0; i < MAX_IDE_BUS; i++) { -- isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], -- hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); -- } -+ switch(model) { -+ case MODEL_MAC: -+ pci_ich6_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); -+ break; -+ case MODEL_PCI: -+ pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); -+ break; -+ default: -+ for(i = 0; i < 2; i++) { -+ isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], -+ hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); -+ } -+ break; - } - - i8042_init(i8259[1], i8259[12], 0x60); ++ if (model == MODEL_MAC) { ++ pci_ich6_ide_init(pci_bus, hd, piix3_devfn + 1); ++ else if (model > MODEL_ISA) { + pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); + } else { + for(i = 0; i < MAX_IDE_BUS; i++) { +@@ -1227,7 +1252,7 @@ static void pc_init1(ram_addr_t ram_size + isa_dev = isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO -- audio_init(pci_enabled ? pci_bus : NULL, i8259); -+ audio_init((model > MODEL_ISA) ? pci_bus : NULL, i8259); +- audio_init(pci_enabled ? pci_bus : NULL, isa_irq); ++ audio_init((model > MODEL_ISA) ? pci_bus : NULL, isa_irq); #endif for(i = 0; i < MAX_FD; i++) { -@@ -1404,11 +1433,11 @@ static void pc_init1(ram_addr_t ram_size +@@ -1237,11 +1262,11 @@ static void pc_init1(ram_addr_t ram_size cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd); @@ -183,7 +158,7 @@ uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ i2c_bus *smbus; -@@ -1427,7 +1456,7 @@ static void pc_init1(ram_addr_t ram_size +@@ -1262,7 +1287,7 @@ static void pc_init1(ram_addr_t ram_size i440fx_init_memory_mappings(i440fx_state); } @@ -192,33 +167,17 @@ int max_bus; int bus; -@@ -1438,7 +1467,7 @@ static void pc_init1(ram_addr_t ram_size - } - - /* Add virtio block devices */ -- if (pci_enabled) { -+ if (model > MODEL_ISA) { - int index; - int unit_id = 0; - -@@ -1463,13 +1492,13 @@ static void pc_init1(ram_addr_t ram_size - } - - /* Add virtio balloon device */ -- if (pci_enabled && virtio_balloon) { -+ if ((model >= MODEL_PCI) && virtio_balloon) { - pci_dev = pci_create("virtio-balloon-pci", virtio_balloon_devaddr); - qdev_init(&pci_dev->qdev); +@@ -1285,7 +1310,7 @@ static void pc_init1(ram_addr_t ram_size } /* Add virtio console devices */ - if (pci_enabled) { -+ if (model >= MODEL_PCI) { ++ if (model > MODEL_ISA) { for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { if (virtcon_hds[i]) { pci_create_simple(pci_bus, -1, "virtio-console-pci"); -@@ -1485,6 +1514,19 @@ static void pc_init1(ram_addr_t ram_size - #endif /* USE_KVM_DEVICE_ASSIGNMENT */ +@@ -1300,6 +1325,19 @@ static void pc_init1(ram_addr_t ram_size + #endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */ } +static void pc_init_mac(ram_addr_t ram_size, @@ -237,7 +196,7 @@ static void pc_init_pci(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, -@@ -1494,7 +1536,7 @@ static void pc_init_pci(ram_addr_t ram_s +@@ -1309,7 +1347,7 @@ static void pc_init_pci(ram_addr_t ram_s { pc_init1(ram_size, boot_device, kernel_filename, kernel_cmdline, @@ -246,8 +205,8 @@ } static void pc_init_isa(ram_addr_t ram_size, -@@ -1506,7 +1548,7 @@ static void pc_init_isa(ram_addr_t ram_s - { +@@ -1323,7 +1361,7 @@ static void pc_init_isa(ram_addr_t ram_s + cpu_model = "486"; pc_init1(ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename, cpu_model, 0); @@ -255,8 +214,8 @@ } /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE) -@@ -1526,6 +1568,13 @@ static QEMUMachine pc_machine = { - .is_default = 1, +@@ -1362,6 +1400,13 @@ static QEMUMachine pc_machine_v0_11 = { + } }; +static QEMUMachine mac_machine = { @@ -269,19 +228,19 @@ static QEMUMachine pc_machine_v0_10 = { .name = "pc-0.10", .desc = "Standard PC, qemu 0.10", -@@ -1561,6 +1610,7 @@ static void pc_machine_init(void) - qemu_register_machine(&pc_machine); +@@ -1406,6 +1451,7 @@ static void pc_machine_init(void) + qemu_register_machine(&pc_machine_v0_11); qemu_register_machine(&pc_machine_v0_10); qemu_register_machine(&isapc_machine); + qemu_register_machine(&mac_machine); } machine_init(pc_machine_init); -Index: qemu-kvm-0.11.0/vl.c +Index: qemu-kvm-0.12.2/vl.c =================================================================== ---- qemu-kvm-0.11.0.orig/vl.c -+++ qemu-kvm-0.11.0/vl.c -@@ -5837,6 +5837,10 @@ int main(int argc, char **argv, char **e +--- qemu-kvm-0.12.2.orig/vl.c ++++ qemu-kvm-0.12.2/vl.c +@@ -5898,6 +5898,10 @@ int main(int argc, char **argv, char **e if (kvm_enabled()) { int ret; @@ -291,4 +250,4 @@ + ret = kvm_init(smp_cpus); if (ret < 0) { - #if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION) + #if defined(KVM_UPSTREAM) || defined(CONFIG_NO_CPU_EMULATION) ++++++ kvm-qemu-no-fallback-if-open-kvm-fails.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -1,8 +1,8 @@ -Index: qemu-kvm-0.11.0/vl.c +Index: qemu-kvm-0.12.2/vl.c =================================================================== ---- qemu-kvm-0.11.0.orig/vl.c -+++ qemu-kvm-0.11.0/vl.c -@@ -5840,6 +5840,8 @@ int main(int argc, char **argv, char **e +--- qemu-kvm-0.12.2.orig/vl.c ++++ qemu-kvm-0.12.2/vl.c +@@ -5901,6 +5901,8 @@ int main(int argc, char **argv, char **e fprintf(stderr, "failed to initialize KVM\n"); exit(1); #endif ++++++ kvm-qemu-preXX-access-after-end-of-array.patch ++++++ If a write requests crosses a L2 table boundary and all clusters until the end of the L2 table are usable for the request, we must not look at the next L2 entry because we already have arrived at the end of the array. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- block/qcow2-cluster.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: qemu-kvm-0.12.2/block/qcow2-cluster.c =================================================================== --- qemu-kvm-0.12.2.orig/block/qcow2-cluster.c +++ qemu-kvm-0.12.2/block/qcow2-cluster.c @@ -723,12 +723,15 @@ uint64_t qcow2_alloc_cluster_offset(Bloc while (i < nb_clusters) { i += count_contiguous_clusters(nb_clusters - i, s->cluster_size, &l2_table[l2_index], i, 0); - - if(be64_to_cpu(l2_table[l2_index + i])) + if ((i >= nb_clusters) || be64_to_cpu(l2_table[l2_index + i])) { break; + } i += count_contiguous_free_clusters(nb_clusters - i, &l2_table[l2_index + i]); + if (i >= nb_clusters) { + break; + } cluster_offset = be64_to_cpu(l2_table[l2_index + i]); @@ -736,6 +739,7 @@ uint64_t qcow2_alloc_cluster_offset(Bloc (cluster_offset & QCOW_OFLAG_COMPRESSED)) break; } + assert(i <= nb_clusters); nb_clusters = i; /* ++++++ kvm-qemu-preXX-dictzip1.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -24,23 +24,23 @@ 2 files changed, 502 insertions(+), 1 deletions(-) create mode 100644 block/dictzip.c -Index: qemu-kvm-0.11.0/Makefile +Index: qemu-kvm-0.12.2/Makefile =================================================================== ---- qemu-kvm-0.11.0.orig/Makefile -+++ qemu-kvm-0.11.0/Makefile -@@ -86,7 +86,7 @@ block-obj-y += nbd.o block.o aio.o aes.o +--- qemu-kvm-0.12.2.orig/Makefile ++++ qemu-kvm-0.12.2/Makefile +@@ -110,7 +110,7 @@ block-obj-$(CONFIG_POSIX) += compatfd.o - block-nested-y += cow.o qcow.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o + block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o -block-nested-y += parallels.o nbd.o +block-nested-y += parallels.o nbd.o dictzip.o - - - ifdef CONFIG_WIN32 -Index: qemu-kvm-0.11.0/block/dictzip.c + block-nested-$(CONFIG_WIN32) += raw-win32.o + block-nested-$(CONFIG_POSIX) += raw-posix.o + block-nested-$(CONFIG_CURL) += curl.o +Index: qemu-kvm-0.12.2/block/dictzip.c =================================================================== --- /dev/null -+++ qemu-kvm-0.11.0/block/dictzip.c ++++ qemu-kvm-0.12.2/block/dictzip.c @@ -0,0 +1,567 @@ +/* + * DictZip Block driver for dictzip enabled gzip files ++++++ kvm-qemu-preXX-dictzip2.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -25,23 +25,23 @@ 2 files changed, 334 insertions(+), 1 deletions(-) create mode 100644 block/tar.c -Index: qemu-kvm-0.11.0/Makefile +Index: qemu-kvm-0.12.2/Makefile =================================================================== ---- qemu-kvm-0.11.0.orig/Makefile -+++ qemu-kvm-0.11.0/Makefile -@@ -86,7 +86,7 @@ block-obj-y += nbd.o block.o aio.o aes.o +--- qemu-kvm-0.12.2.orig/Makefile ++++ qemu-kvm-0.12.2/Makefile +@@ -110,7 +110,7 @@ block-obj-$(CONFIG_POSIX) += compatfd.o - block-nested-y += cow.o qcow.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o + block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o -block-nested-y += parallels.o nbd.o dictzip.o +block-nested-y += parallels.o nbd.o dictzip.o tar.o - - - ifdef CONFIG_WIN32 -Index: qemu-kvm-0.11.0/block/tar.c + block-nested-$(CONFIG_WIN32) += raw-win32.o + block-nested-$(CONFIG_POSIX) += raw-posix.o + block-nested-$(CONFIG_CURL) += curl.o +Index: qemu-kvm-0.12.2/block/tar.c =================================================================== --- /dev/null -+++ qemu-kvm-0.11.0/block/tar.c ++++ qemu-kvm-0.12.2/block/tar.c @@ -0,0 +1,338 @@ +/* + * Tar block driver ++++++ kvm-qemu-preXX-dictzip3.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:12.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:12.000000000 +0100 @@ -7,14 +7,14 @@ block.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) -Index: qemu-kvm-0.11.0/block.c +Index: qemu-kvm-0.12.2/block.c =================================================================== ---- qemu-kvm-0.11.0.orig/block.c -+++ qemu-kvm-0.11.0/block.c -@@ -358,11 +358,11 @@ int bdrv_open2(BlockDriverState *bs, con +--- qemu-kvm-0.12.2.orig/block.c ++++ qemu-kvm-0.12.2/block.c +@@ -384,12 +384,11 @@ int bdrv_open2(BlockDriverState *bs, con return ret; } - total_size = bdrv_getlength(bs1) >> SECTOR_BITS; + total_size = bdrv_getlength(bs1) >> BDRV_SECTOR_BITS; + bdrv_delete(bs1); - if (bs1->drv && bs1->drv->protocol_name) @@ -22,6 +22,7 @@ is_protocol = 1; - bdrv_delete(bs1); - +- get_tmp_filename(tmp_filename, sizeof(tmp_filename)); + /* Real path is meaningless for protocols */ ++++++ kvm-qemu-preXX-dictzip4.patch ++++++
From b8f1a7842100d00718fb74e19b84adbe8c1f5d6e Mon Sep 17 00:00:00 2001 From: Alexander Graf <agraf@suse.de> Date: Tue, 12 Jan 2010 00:24:24 +0100 Subject: [PATCH] TAR: Support files with size > 8GB
When a file in tar is bigger than 8GB, tar uses big endian binary encoding instead of the normal ascii octal encoding. While I implemented this mechanism, I screwed up and thought it was a 64-bit big-endian value. I was wrong. It's a 96-bit big endian value. Since I doubt we'll get files that are bigger than 2TB anytime soon, let's just only read the last 64 bits of the value. Fixes running tar files with image files > 8GB. Signed-off-by: Alexander Graf <agraf@suse.de> --- block/tar.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/tar.c b/block/tar.c index e143dad..d663c53 100644 --- a/block/tar.c +++ b/block/tar.c @@ -108,14 +108,17 @@ static uint64_t tar2u64(char *ptr) char oldend = ptr[12]; ptr[12] = '\0'; - if (*ptr & 0x80) - retval = be64_to_cpu(*(uint64_t *)ptr); - else + if (*ptr & 0x80) { + /* XXX we only support files up to 64 bit length */ + retval = be64_to_cpu(*(uint64_t *)(ptr+4)); + dprintf("Convert %lx -> %#lx\n", *(uint64_t*)(ptr+4), retval); + } else { retval = strtol(ptr, NULL, 8); + dprintf("Convert %s -> %#lx\n", ptr, retval); + } ptr[12] = oldend; - dprintf("Convert %s -> %#lx\n", ptr, retval); return retval; } -- 1.6.0.2 ++++++ kvm-qemu-preXX-dictzip5.patch ++++++
From 5cd8516cd3327e9e4b850d60ae4936892ed8efba Mon Sep 17 00:00:00 2001 From: Alexander Graf <agraf@suse.de> Date: Mon, 18 Jan 2010 18:16:56 +0100 Subject: [PATCH] DZIP: Make the cache actually free its contents
I had a little thinko in the DictZip freeing code. To free a buffer from the cache, we should look at the actual cache variable and not some other struct. This fixes big memory consumption seen with DZip. --- block/dictzip.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/dictzip.c b/block/dictzip.c index b991e6d..95ffe91 100644 --- a/block/dictzip.c +++ b/block/dictzip.c @@ -390,7 +390,7 @@ static void dictzip_read_cb(void *opaque, int ret) s->cache_index = 0; cache->len = 0; - if (cache[s->cache_index].buf) + if (cache->buf) qemu_free(cache->buf); cache->start = acb->gz_start; cache->buf = buf; -- 1.6.0.2 ++++++ kvm-qemu-preXX-dictzip6.patch ++++++
From c2351a5153a61e15b04ec8ac37c580cc50ef80d9 Mon Sep 17 00:00:00 2001 From: Alexander Graf <agraf@suse.de> Date: Tue, 16 Feb 2010 12:52:18 +0100 Subject: [PATCH] TAR: Implement 'L' extension type
GNU Tar has several extensions. One of them is 'L', used to identify long file names. Without this extension a file name can be at most 100 bytes, including the directory name. We do hit that limit from time to time, so let's implement the extension and be able to use images with long file names. Signed-off-by: Alexander Graf <agraf@suse.de> --- block/tar.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/block/tar.c b/block/tar.c index d663c53..d7fe2b7 100644 --- a/block/tar.c +++ b/block/tar.c @@ -57,6 +57,7 @@ typedef struct BDRVTarState { SparseCache *sparse; int sparse_num; uint64_t last_end; + char longfile[2048]; } BDRVTarState; static int tar_probe(const uint8_t *buf, int buf_size, const char *filename) @@ -99,6 +100,9 @@ static int is_target_file(BlockDriverState *bs, char *filename) retval = 1; dprintf("does filename %s match? %s\n", filename, retval ? "yes" : "no"); + + /* make sure we're not using this name again */ + filename[0] = '\0'; return retval; } @@ -151,6 +155,7 @@ static int tar_open(BlockDriverState *bs, const char *filename, int flags) { BDRVTarState *s = bs->opaque; char header[SECTOR_SIZE]; + char *real_file = header; char *magic; const char *fname = filename; size_t header_offs = 0; @@ -191,7 +196,17 @@ static int tar_open(BlockDriverState *bs, const char *filename, int flags) s->file_sec = (header_offs / SECTOR_SIZE) + 1; header_offs += s->file_len + SECTOR_SIZE; - } while(!is_target_file(bs, header)); + + if (header[OFFS_TYPE] == 'L') { + bdrv_pread(s->hd, header_offs - s->file_len, s->longfile, + sizeof(s->longfile)); + s->longfile[sizeof(s->longfile)-1] = '\0'; + } else if (s->longfile[0]) { + real_file = s->longfile; + } else { + real_file = header; + } + } while(!is_target_file(bs, real_file)); /* We found an image! */ -- 1.6.0.2 ++++++ kvm-qemu-preXX-fix-inet-parse-typo.patch ++++++ commit 2198a62eb2518b61c3fc7db26515f106e7498932 Author: Marcelo Tosatti <mtosatti@redhat.com> Date: Tue Feb 9 15:31:46 2010 -0200 fix inet_parse typo qemu_opt_set wants on/off, not yes/no. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> diff --git a/qemu-sockets.c b/qemu-sockets.c index d912fed..23c3def 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -424,7 +424,7 @@ static int inet_parse(QemuOpts *opts, const char *str) __FUNCTION__, str); return -1; } - qemu_opt_set(opts, "ipv6", "yes"); + qemu_opt_set(opts, "ipv6", "on"); } else if (qemu_isdigit(str[0])) { /* IPv4 addr */ if (2 != sscanf(str,"%64[0-9.]:%32[^,]%n",addr,port,&pos)) { @@ -432,7 +432,7 @@ static int inet_parse(QemuOpts *opts, const char *str) __FUNCTION__, str); return -1; } - qemu_opt_set(opts, "ipv4", "yes"); + qemu_opt_set(opts, "ipv4", "on"); } else { /* hostname */ if (2 != sscanf(str,"%64[^:]:%32[^,]%n",addr,port,&pos)) { @@ -450,9 +450,9 @@ static int inet_parse(QemuOpts *opts, const char *str) if (h) qemu_opt_set(opts, "to", h+4); if (strstr(optstr, ",ipv4")) - qemu_opt_set(opts, "ipv4", "yes"); + qemu_opt_set(opts, "ipv4", "on"); if (strstr(optstr, ",ipv6")) - qemu_opt_set(opts, "ipv6", "yes"); + qemu_opt_set(opts, "ipv6", "on"); return 0; } ++++++ kvm-qemu-preXX-netdev1.patch ++++++ Unused since commit 9ad4531e. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- net.c | 14 -------------- net.h | 1 - 2 files changed, 0 insertions(+), 15 deletions(-) Index: qemu-kvm-0.12.2/net.c =================================================================== --- qemu-kvm-0.12.2.orig/net.c +++ qemu-kvm-0.12.2/net.c @@ -1129,20 +1129,6 @@ int net_client_init(Monitor *mon, QemuOp return -1; } -void net_client_uninit(NICInfo *nd) -{ - if (nd->vlan) { - nd->vlan->nb_guest_devs--; - } - nb_nics--; - - qemu_free(nd->model); - qemu_free(nd->name); - qemu_free(nd->devaddr); - - nd->used = 0; -} - static int net_host_check_device(const char *device) { int i; Index: qemu-kvm-0.12.2/net.h =================================================================== --- qemu-kvm-0.12.2.orig/net.h +++ qemu-kvm-0.12.2/net.h @@ -170,7 +170,6 @@ extern const char *legacy_tftp_prefix; extern const char *legacy_bootp_filename; int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev); -void net_client_uninit(NICInfo *nd); int net_client_parse(QemuOptsList *opts_list, const char *str); int net_init_clients(void); void net_cleanup(void); ++++++ kvm-qemu-preXX-netdev2.patch ++++++ Call it right after -device devices get created. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- net.c | 4 +--- net.h | 1 + vl.c | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) Index: qemu-kvm-0.12.2/net.c =================================================================== --- qemu-kvm-0.12.2.orig/net.c +++ qemu-kvm-0.12.2/net.c @@ -1276,7 +1276,7 @@ void net_cleanup(void) } } -static void net_check_clients(void) +void net_check_clients(void) { VLANState *vlan; @@ -1324,8 +1324,6 @@ int net_init_clients(void) return -1; } - net_check_clients(); - return 0; } Index: qemu-kvm-0.12.2/net.h =================================================================== --- qemu-kvm-0.12.2.orig/net.h +++ qemu-kvm-0.12.2/net.h @@ -172,6 +172,7 @@ extern const char *legacy_bootp_filename int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev); int net_client_parse(QemuOptsList *opts_list, const char *str); int net_init_clients(void); +void net_check_clients(void); void net_cleanup(void); void net_set_boot_mask(int boot_mask); void net_host_device_add(Monitor *mon, const QDict *qdict); Index: qemu-kvm-0.12.2/vl.c =================================================================== --- qemu-kvm-0.12.2.orig/vl.c +++ qemu-kvm-0.12.2/vl.c @@ -6093,6 +6093,8 @@ int main(int argc, char **argv, char **e if (qemu_opts_foreach(&qemu_device_opts, device_init_func, NULL, 1) != 0) exit(1); + net_check_clients(); + if (!display_state) dumb_display_init(); /* just use the first displaystate for the moment */ ++++++ kvm-qemu-preXX-netdev3.patch ++++++ net_check_clients() prints this when an VLAN has host devices, but no guest devices. It uses VLANState members nb_guest_devs and nb_host_devs to keep track of these devices. However, -device does not update nb_guest_devs, only net_init_nic() does that, for -net nic. Check the VLAN clients directly, and remove the counters. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- net.c | 25 ++++++++++++++++++------- net.h | 1 - net/slirp.c | 4 ---- net/socket.c | 4 ---- net/tap-win32.c | 4 ---- net/tap.c | 4 ---- net/vde.c | 4 ---- 7 files changed, 18 insertions(+), 28 deletions(-) Index: qemu-kvm-0.12.2/net.c =================================================================== --- qemu-kvm-0.12.2.orig/net.c +++ qemu-kvm-0.12.2/net.c @@ -813,9 +813,6 @@ static int net_init_nic(QemuOpts *opts, nd->used = 1; nd->link = Link_default; - if (vlan) { - nd->vlan->nb_guest_devs++; - } nb_nics++; return idx; @@ -1279,16 +1276,32 @@ void net_cleanup(void) void net_check_clients(void) { VLANState *vlan; + VLANClientState *vc; + int has_nic, has_host_dev; + QTAILQ_FOREACH(vlan, &vlans, next) { - if (vlan->nb_guest_devs == 0 && vlan->nb_host_devs == 0) - continue; - if (vlan->nb_guest_devs == 0) - fprintf(stderr, "Warning: vlan %d with no nics\n", vlan->id); - if (vlan->nb_host_devs == 0) - fprintf(stderr, - "Warning: vlan %d is not connected to host network\n", - vlan->id); + QTAILQ_FOREACH(vc, &vlan->clients, next) { + + switch (vc->info->type) { + case NET_CLIENT_TYPE_NIC: + has_nic = 1; + break; + case NET_CLIENT_TYPE_SLIRP: + case NET_CLIENT_TYPE_TAP: + case NET_CLIENT_TYPE_SOCKET: + case NET_CLIENT_TYPE_VDE: + has_host_dev = 1; + break; + default: ; + } + } + if (has_host_dev && !has_nic) + fprintf(stderr, "Warning: vlan %d with no nics\n", vlan->id); + if (has_nic && !has_host_dev) + fprintf(stderr, + "Warning: vlan %d is not connected to host network\n", + vlan->id); } } Index: qemu-kvm-0.12.2/net.h =================================================================== --- qemu-kvm-0.12.2.orig/net.h +++ qemu-kvm-0.12.2/net.h @@ -85,7 +85,6 @@ struct VLANState { int id; QTAILQ_HEAD(, VLANClientState) clients; QTAILQ_ENTRY(VLANState) next; - unsigned int nb_guest_devs, nb_host_devs; NetQueue *send_queue; }; Index: qemu-kvm-0.12.2/net/slirp.c =================================================================== --- qemu-kvm-0.12.2.orig/net/slirp.c +++ qemu-kvm-0.12.2/net/slirp.c @@ -728,10 +728,6 @@ int net_init_slirp(QemuOpts *opts, qemu_free(config); } - if (ret != -1 && vlan) { - vlan->nb_host_devs++; - } - qemu_free(vnet); return ret; Index: qemu-kvm-0.12.2/net/socket.c =================================================================== --- qemu-kvm-0.12.2.orig/net/socket.c +++ qemu-kvm-0.12.2/net/socket.c @@ -569,9 +569,5 @@ int net_init_socket(QemuOpts *opts, return -1; } - if (vlan) { - vlan->nb_host_devs++; - } - return 0; } Index: qemu-kvm-0.12.2/net/tap-win32.c =================================================================== --- qemu-kvm-0.12.2.orig/net/tap-win32.c +++ qemu-kvm-0.12.2/net/tap-win32.c @@ -714,10 +714,6 @@ int net_init_tap(QemuOpts *opts, Monitor return -1; } - if (vlan) { - vlan->nb_host_devs++; - } - return 0; } Index: qemu-kvm-0.12.2/net/tap.c =================================================================== --- qemu-kvm-0.12.2.orig/net/tap.c +++ qemu-kvm-0.12.2/net/tap.c @@ -441,9 +441,5 @@ int net_init_tap(QemuOpts *opts, Monitor } } - if (vlan) { - vlan->nb_host_devs++; - } - return 0; } Index: qemu-kvm-0.12.2/net/vde.c =================================================================== --- qemu-kvm-0.12.2.orig/net/vde.c +++ qemu-kvm-0.12.2/net/vde.c @@ -127,9 +127,5 @@ int net_init_vde(QemuOpts *opts, Monitor return -1; } - if (vlan) { - vlan->nb_host_devs++; - } - return 0; } ++++++ kvm-qemu-preXX-netdev4.patch ++++++ Clients not associated with a VLAN exist since commit d80b9fc6. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- net.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) Index: qemu-kvm-0.12.2/net.c =================================================================== --- qemu-kvm-0.12.2.orig/net.c +++ qemu-kvm-0.12.2/net.c @@ -1303,6 +1303,13 @@ void net_check_clients(void) "Warning: vlan %d is not connected to host network\n", vlan->id); } + QTAILQ_FOREACH(vc, &non_vlan_clients, next) { + if (!vc->peer) { + fprintf(stderr, "Warning: %s %s has no peer\n", + vc->info->type == NET_CLIENT_TYPE_NIC ? "nic" : "netdev", + vc->name); + } + } } static int net_init_client(QemuOpts *opts, void *dummy) ++++++ kvm-qemu-preXX-netdev5.patch ++++++ Clients not associated with a VLAN exist since commit d80b9fc6. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- net.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) Index: qemu-kvm-0.12.2/net.c =================================================================== --- qemu-kvm-0.12.2.orig/net.c +++ qemu-kvm-0.12.2/net.c @@ -1211,16 +1211,23 @@ void net_set_boot_mask(int net_boot_mask void do_info_network(Monitor *mon) { VLANState *vlan; + VLANClientState *vc; QTAILQ_FOREACH(vlan, &vlans, next) { - VLANClientState *vc; - monitor_printf(mon, "VLAN %d devices:\n", vlan->id); QTAILQ_FOREACH(vc, &vlan->clients, next) { monitor_printf(mon, " %s: %s\n", vc->name, vc->info_str); } } + monitor_printf(mon, "Devices not on any VLAN:\n"); + QTAILQ_FOREACH(vc, &non_vlan_clients, next) { + monitor_printf(mon, " %s: %s", vc->name, vc->info_str); + if (vc->peer) { + monitor_printf(mon, " peer=%s", vc->peer->name); + } + monitor_printf(mon, "\n"); + } } void do_set_link(Monitor *mon, const QDict *qdict) ++++++ kvm-qemu-preXX-netdev6.patch ++++++ Clients not associated with a VLAN exist since commit d80b9fc6. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- net.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) Index: qemu-kvm-0.12.2/net.c =================================================================== --- qemu-kvm-0.12.2.orig/net.c +++ qemu-kvm-0.12.2/net.c @@ -1244,6 +1244,7 @@ void do_set_link(Monitor *mon, const QDi } } } + vc = qemu_find_netdev(name); done: if (!vc) { ++++++ kvm-qemu-preXX-network-shutdown-under-load.patch ++++++ commit 06b1297017415ae6a07a0e97ad7d8e90b2d95823 Author: Tom Lendacky <tahm@linux.vnet.ibm.com> Date: Mon Feb 8 10:10:01 2010 -0600 virtio-net: fix network stall under load Fix a race condition where qemu finds that there are not enough virtio ring buffers available and the guest make more buffers available before qemu can enable notifications. Signed-off-by: Tom Lendacky <toml@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Index: qemu-kvm-0.12.2/hw/virtio-net.c =================================================================== --- qemu-kvm-0.12.2.orig/hw/virtio-net.c +++ qemu-kvm-0.12.2/hw/virtio-net.c @@ -384,7 +384,15 @@ static int virtio_net_has_buffers(VirtIO (n->mergeable_rx_bufs && !virtqueue_avail_bytes(n->rx_vq, bufsize, 0))) { virtio_queue_set_notification(n->rx_vq, 1); - return 0; + + /* To avoid a race condition where the guest has made some buffers + * available after the above check but before notification was + * enabled, check for available buffers again. + */ + if (virtio_queue_empty(n->rx_vq) || + (n->mergeable_rx_bufs && + !virtqueue_avail_bytes(n->rx_vq, bufsize, 0))) + return 0; } virtio_queue_set_notification(n->rx_vq, 0); ++++++ kvm-qemu-preXX-nic-device-pxe-boot.patch ++++++ --- a/vl.c +++ b/vl.c @@ -5956,8 +5956,11 @@ int main(int argc, char **argv, char **e exit(1); } - net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF; - net_set_boot_mask(net_boot); + if (nb_nics) + { + net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF; + net_set_boot_mask(net_boot); + } /* init the bluetooth world */ if (foreach_device_config(DEV_BT, bt_parse)) ++++++ kvm-qemu-preXX-usb-serial-buffer-overrun.patch ++++++ commit 4ab4183d766f10f9fc35cd9ef4acee39f241986f Author: David S. Ahern <daahern@cisco.com> Date: Wed Feb 3 09:00:54 2010 -0700 segfault due to buffer overrun in usb-serial This fixes a segfault due to buffer overrun in the usb-serial device. The memcpy was incrementing the start location by recv_used yet, the computation of first_size (how much to write at the end of the buffer before wrapping to the front) was not accounting for it. This causes the next element after the receive buffer (recv_ptr) to get overwritten with random data. Signed-off-by: David Ahern <daahern@cisco.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> diff --git a/hw/usb-serial.c b/hw/usb-serial.c index 37293ea..c3f3401 100644 --- a/hw/usb-serial.c +++ b/hw/usb-serial.c @@ -497,12 +497,28 @@ static int usb_serial_can_read(void *opaque) static void usb_serial_read(void *opaque, const uint8_t *buf, int size) { USBSerialState *s = opaque; - int first_size = RECV_BUF - s->recv_ptr; - if (first_size > size) - first_size = size; - memcpy(s->recv_buf + s->recv_ptr + s->recv_used, buf, first_size); - if (size > first_size) - memcpy(s->recv_buf, buf + first_size, size - first_size); + int first_size, start; + + /* room in the buffer? */ + if (size > (RECV_BUF - s->recv_used)) + size = RECV_BUF - s->recv_used; + + start = s->recv_ptr + s->recv_used; + if (start < RECV_BUF) { + /* copy data to end of buffer */ + first_size = RECV_BUF - start; + if (first_size > size) + first_size = size; + + memcpy(s->recv_buf + start, buf, first_size); + + /* wrap around to front if needed */ + if (size > first_size) + memcpy(s->recv_buf, buf + first_size, size - first_size); + } else { + start -= RECV_BUF; + memcpy(s->recv_buf + start, buf, size); + } s->recv_used += size; } ++++++ kvm-qemu-rtl8139-link.patch ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:13.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:13.000000000 +0100 @@ -1,29 +1,29 @@ # Fix the Link detection in MacOS # Author Alex Graf - agraf@suse -Index: qemu-kvm-0.11.0/hw/rtl8139.c +Index: qemu-kvm-0.12.2/hw/rtl8139.c =================================================================== ---- qemu-kvm-0.11.0.orig/hw/rtl8139.c -+++ qemu-kvm-0.11.0/hw/rtl8139.c -@@ -422,6 +422,9 @@ static void RTL8139TallyCounters_load(QE - /* Saves values of tally counters to VM state file */ - static void RTL8139TallyCounters_save(QEMUFile* f, RTL8139TallyCounters *tally_counters); +--- qemu-kvm-0.12.2.orig/hw/rtl8139.c ++++ qemu-kvm-0.12.2/hw/rtl8139.c +@@ -417,6 +417,9 @@ static void RTL8139TallyCounters_clear(R + /* Writes tally counters to specified physical memory address */ + static void RTL8139TallyCounters_physical_memory_write(target_phys_addr_t tc_addr, RTL8139TallyCounters* counters); +static uint32_t rtl8139_io_readb(void *opaque, uint8_t addr); +static uint32_t rtl8139_io_readw(void *opaque, uint8_t addr); + typedef struct RTL8139State { + PCIDevice dev; uint8_t phys[8]; /* mac address */ - uint8_t mult[8]; /* multicast mask array */ -@@ -462,6 +465,7 @@ typedef struct RTL8139State { +@@ -458,6 +461,7 @@ typedef struct RTL8139State { uint16_t CpCmd; uint8_t TxThresh; + enum NICLink link; - PCIDevice *pci_dev; - VLANClientState *vc; -@@ -1233,7 +1237,7 @@ static void rtl8139_reset(void *opaque) + NICState *nic; + NICConf conf; +@@ -1228,7 +1232,7 @@ static void rtl8139_reset(DeviceState *d s->Config0 = 0x0; /* No boot ROM */ s->Config1 = 0xC; /* IO mapped and MEM mapped registers available */ s->Config3 = 0x1; /* fast back-to-back compatible */ @@ -32,7 +32,7 @@ s->CSCR = CSCR_F_LINK_100 | CSCR_HEART_BIT | CSCR_LD; -@@ -1259,6 +1263,13 @@ static void rtl8139_reset(void *opaque) +@@ -1254,6 +1258,13 @@ static void rtl8139_reset(DeviceState *d s->TimerInt = 0; s->TCTR_base = 0; @@ -46,7 +46,7 @@ /* reset tally counters */ RTL8139TallyCounters_clear(&s->tally_counters); } -@@ -2856,7 +2867,7 @@ static uint32_t rtl8139_io_readb(void *o +@@ -2839,7 +2850,7 @@ static uint32_t rtl8139_io_readb(void *o break; case MediaStatus: @@ -55,29 +55,30 @@ DEBUG_PRINT(("RTL8139: MediaStatus read 0x%x\n", ret)); break; -@@ -3478,6 +3489,15 @@ static void pci_rtl8139_init(PCIDevice * - s->pci_dev = (PCIDevice *)d; - qdev_get_macaddr(&dev->qdev, s->macaddr); - qemu_register_reset(rtl8139_reset, s); -+ switch(dev->qdev.nd->link) { -+ case Link_10mbps: -+ case Link_100mbps: -+ s->link = dev->qdev.nd->link; -+ break; -+ default: -+ s->link = Link_100mbps; -+ break; -+ } - rtl8139_reset(s); - s->vc = qdev_get_vlan_client(&dev->qdev, - rtl8139_can_receive, rtl8139_receive, NULL, -Index: qemu-kvm-0.11.0/net.h +@@ -3339,6 +3350,16 @@ static int pci_rtl8139_init(PCIDevice *d + + qemu_macaddr_default_if_unset(&s->conf.macaddr); + ++ switch(s->conf.link) { ++ case Link_10mbps: ++ case Link_100mbps: ++ s->link = s->conf.link; ++ break; ++ default: ++ s->link = Link_100mbps; ++ break; ++ } ++ + s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf, + dev->qdev.info->name, dev->qdev.id, s); + qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); +Index: qemu-kvm-0.12.2/net.h =================================================================== ---- qemu-kvm-0.11.0.orig/net.h -+++ qemu-kvm-0.11.0/net.h -@@ -99,6 +99,13 @@ enum { - NIC_NVECTORS_UNSPECIFIED = -1 - }; +--- qemu-kvm-0.12.2.orig/net.h ++++ qemu-kvm-0.12.2/net.h +@@ -13,15 +13,24 @@ struct MACAddr { + + /* qdev nic properties */ +enum NICLink { + Link_default, @@ -86,42 +87,79 @@ + Link_1000mbps, +}; + - struct NICInfo { - uint8_t macaddr[6]; - const char *model; -@@ -109,6 +116,7 @@ struct NICInfo { - VLANClientState *vc; - void *private; + typedef struct NICConf { + MACAddr macaddr; + VLANState *vlan; + VLANClientState *peer; ++ uint32_t link; + } NICConf; + + #define DEFINE_NIC_PROPERTIES(_state, _conf) \ + DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ + DEFINE_PROP_VLAN("vlan", _state, _conf.vlan), \ ++ DEFINE_PROP_UINT32("link", _state, _conf.link, Link_default), \ + DEFINE_PROP_NETDEV("netdev", _state, _conf.peer) + + /* VLANs support */ +@@ -133,6 +142,7 @@ struct NICInfo { + VLANState *vlan; + VLANClientState *netdev; int used; + enum NICLink link; int bootable; int nvectors; }; -Index: qemu-kvm-0.11.0/net.c -=================================================================== ---- qemu-kvm-0.11.0.orig/net.c -+++ qemu-kvm-0.11.0/net.c -@@ -2671,6 +2671,7 @@ int net_client_init(Monitor *mon, const - } - nd->vlan = vlan; - nd->name = name; -+ nd->link = Link_default; - nd->used = 1; - name = NULL; - nb_nics++; -Index: qemu-kvm-0.11.0/hw/pc.c +Index: qemu-kvm-0.12.2/net.c =================================================================== ---- qemu-kvm-0.11.0.orig/hw/pc.c -+++ qemu-kvm-0.11.0/hw/pc.c -@@ -1382,7 +1382,10 @@ static void pc_init1(ram_addr_t ram_size +--- qemu-kvm-0.12.2.orig/net.c ++++ qemu-kvm-0.12.2/net.c +@@ -812,6 +812,7 @@ static int net_init_nic(QemuOpts *opts, + } - if (model == MODEL_ISA || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) - pc_init_ne2k_isa(nd, i8259); + nd->used = 1; ++ nd->link = Link_default; + if (vlan) { + nd->vlan->nb_guest_devs++; + } +Index: qemu-kvm-0.12.2/hw/pc.c +=================================================================== +--- qemu-kvm-0.12.2.orig/hw/pc.c ++++ qemu-kvm-0.12.2/hw/pc.c +@@ -1223,10 +1223,14 @@ static void pc_init1(ram_addr_t ram_size + for(i = 0; i < nb_nics; i++) { + NICInfo *nd = &nd_table[i]; + +- if (!(model > MODEL_ISA) || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) ++ if (!(model > MODEL_ISA) || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) { + pc_init_ne2k_isa(nd); - else -+ else if (model == MODEL_MAC) { ++ } else if (model == MODEL_MAC) { + nd->link = Link_10mbps; -+ pci_nic_init(nd, "rtl8139", NULL); -+ } else - pci_nic_init(nd, "rtl8139", NULL); + pci_nic_init_nofail(nd, "rtl8139", NULL); ++ } else { ++ pci_nic_init_nofail(nd, "rtl8139", NULL); ++ } } + if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { +@@ -1240,7 +1244,7 @@ static void pc_init1(ram_addr_t ram_size + + if (model == MODEL_MAC) { + pci_ich6_ide_init(pci_bus, hd, piix3_devfn + 1); +- else if (model > MODEL_ISA) { ++ } else if (model > MODEL_ISA) { + pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); + } else { + for(i = 0; i < MAX_IDE_BUS; i++) { +Index: qemu-kvm-0.12.2/hw/qdev.c +=================================================================== +--- qemu-kvm-0.12.2.orig/hw/qdev.c ++++ qemu-kvm-0.12.2/hw/qdev.c +@@ -372,6 +372,7 @@ void qdev_set_nic_properties(DeviceState + qdev_prop_exists(dev, "vectors")) { + qdev_prop_set_uint32(dev, "vectors", nd->nvectors); + } ++ qdev_prop_set_uint32(dev, "link", nd->link); + } + + static int next_block_unit[IF_COUNT]; ++++++ pxe-rom-settings.patch ++++++ diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile index 8f6c97e..c5c8dbc 100644 --- a/src/arch/i386/Makefile +++ b/src/arch/i386/Makefile @@ -69,7 +69,7 @@ CFLAGS += -Ui386 # Locations of utilities # -ISOLINUX_BIN = /usr/lib/syslinux/isolinux.bin +ISOLINUX_BIN = /usr/share/syslinux/isolinux.bin # i386-specific directories containing source files # diff --git a/src/config/general.h b/src/config/general.h index ee07dfc..fa97198 100644 --- a/src/config/general.h +++ b/src/config/general.h @@ -31,7 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); * Timer configuration * */ -#define BANNER_TIMEOUT 20 /* Tenths of a second for which the shell +#define BANNER_TIMEOUT 0 /* Tenths of a second for which the shell banner should appear */ /* @@ -79,7 +79,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); * you want to use. * */ -//#define IMAGE_NBI /* NBI image support */ +#define IMAGE_NBI /* NBI image support */ //#define IMAGE_ELF /* ELF image support */ //#define IMAGE_FREEBSD /* FreeBSD kernel image support */ //#define IMAGE_MULTIBOOT /* MultiBoot image support */ ++++++ qemu-datadir.diff ++++++ --- /var/tmp/diff_new_pack.p2Araj/_old 2010-02-24 02:11:13.000000000 +0100 +++ /var/tmp/diff_new_pack.p2Araj/_new 2010-02-24 02:11:13.000000000 +0100 @@ -1,8 +1,8 @@ -Index: qemu-kvm-0.11.0/configure +Index: qemu-kvm-0.12.2/configure =================================================================== ---- qemu-kvm-0.11.0.orig/configure -+++ qemu-kvm-0.11.0/configure -@@ -1508,7 +1508,7 @@ else +--- qemu-kvm-0.12.2.orig/configure ++++ qemu-kvm-0.12.2/configure +@@ -1975,7 +1975,7 @@ else prefix="/usr/local" fi mansuffix="/share/man" @@ -11,11 +11,11 @@ docsuffix="/share/doc/qemu" binsuffix="/bin" fi -Index: qemu-kvm-0.11.0/vl.c +Index: qemu-kvm-0.12.2/vl.c =================================================================== ---- qemu-kvm-0.11.0.orig/vl.c -+++ qemu-kvm-0.11.0/vl.c -@@ -4792,7 +4792,7 @@ static char *find_datadir(const char *ar +--- qemu-kvm-0.12.2.orig/vl.c ++++ qemu-kvm-0.12.2/vl.c +@@ -4619,7 +4619,7 @@ static char *find_datadir(const char *ar /* Find a likely location for support files using the location of the binary. For installed binaries this will be "$bindir/../share/qemu". When running from the build tree this will be "$bindir/../pc-bios". */ ++++++ qemu-kvm-0.11.0.tar.bz2 -> qemu-kvm-0.12.2.tar.bz2 ++++++ ++++ 183668 lines of diff (skipped) ++++++ seabios-sanitize-version.patch ++++++ Index: qemu-kvm-0.12.2/roms/seabios/Makefile =================================================================== --- qemu-kvm-0.12.2.orig/roms/seabios/Makefile +++ qemu-kvm-0.12.2/roms/seabios/Makefile @@ -5,7 +5,7 @@ # This file may be distributed under the terms of the GNU LGPLv3 license. # Program version -VERSION=0.5.1-$(shell date +"%Y%m%d_%H%M%S")-$(shell hostname) +VERSION=0.5.1-$(shell date +"%Y%m%d_%H%M%S") # Output directory OUT=out/ ++++++ vgabios-bcc-paths.patch ++++++ Index: qemu-kvm-0.12.2/kvm/vgabios/Makefile =================================================================== --- qemu-kvm-0.12.2.orig/kvm/vgabios/Makefile +++ qemu-kvm-0.12.2/kvm/vgabios/Makefile @@ -5,7 +5,7 @@ CFLAGS = -g -O2 -Wall -Wstrict-prototyp LDFLAGS = GCC = gcc -BCC = bcc +BCC = ../../../bcc-bits/usr/bin/bcc -B ../../../bcc-bits/usr/lib/bcc/ AS86 = as86 RELEASE = `pwd | sed "s-.*/--"` ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org