commit xen for openSUSE:11.3
Hello community, here is the log from the commit of package xen for openSUSE:11.3 checked in at Tue Mar 1 00:03:15 CET 2011. -------- --- old-versions/11.3/UPDATES/all/xen/xen.changes 2010-12-27 23:54:19.000000000 +0100 +++ 11.3/xen/xen.changes 2011-02-25 17:06:05.000000000 +0100 @@ -1,0 +2,95 @@ +Tue Feb 8 16:02:46 MST 2011 - jfehlig@novell.com + +- bnc#658569 - SLES 11 SP1 dom0 iptables gives lots of physdev + messages + 22385-vif-common.patch + +------------------------------------------------------------------- +Mon Jan 31 10:45:21 MST 2011 - carnold@novell.com + +- bnc#633573 - System fail to boot after running several warm + reboot tests + 22749-vtd-workarounds.patch +- Upstream patches from Jan + 22744-ept-pod-locking.patch + 22777-vtd-ats-fixes.patch + 22781-pod-hap-logdirty.patch + 22782-x86-emul-smsw.patch + 22789-i386-no-x2apic.patch + 22790-svm-resume-migrate-pirqs.patch + 22816-x86-pirq-drop-priv-check.patch + +------------------------------------------------------------------- +Fri Jan 14 08:29:15 MST 2011 - carnold@novell.com + +- bnc#658704 - SLES11 SP1 Xen boot panic in x2apic mode + 22707-x2apic-preenabled-check.patch +- bnc#641419 - L3: Xen: qemu-dm reports "xc_map_foreign_batch: mmap failed: + Cannot allocate memory" + 7434-qemu-rlimit-as.patch +- Additional or upstream patches from Jan + 22693-fam10-mmio-conf-base-protect.patch + 22694-x86_64-no-weak.patch + 22708-xenctx-misc.patch + 21432-4.0-cpu-boot-failure.patch + 22645-amd-flush-filter.patch + qemu-fix-7433.patch + +------------------------------------------------------------------- +Mon Jan 10 15:23:18 CST 2011 - cyliu@novell.com + +- Upstream c/s 7433 to replace internal qemu_altgr_more.patch + 7433-qemu-altgr.patch + +------------------------------------------------------------------- +Fri Jan 7 16:13:24 MST 2011 - jfehlig@novell.com + +- bnc#661931 - Fix fd leak in xenstore library + 21344-4.0-testing-xenstore-fd-leak.patch + +------------------------------------------------------------------- +Tue Jan 4 18:06:31 MST 2011 - carnold@novell.com + +- bnc#656369 - g5plus: sles11sp1 xen crash with 8 socket x2apic + preenabled + 21989-x2apic-resume.patch + 22475-x2apic-cleanup.patch + 22535-x2apic-preenabled.patch +- bnc#658163 - maintenance release - Nehalem system cannot boot + into xen with maintenance release installed + 22504-iommu-dom0-holes.patch + 22506-x86-iommu-dom0-estimate.patch +- bnc#658704 - SLES11 SP1 Xen boot panic in x2apic mode + 21810-x2apic-acpi.patch +- Upstream patches from Jan + 22470-vlapic-tick-loss.patch + 22484-vlapic-tmcct-periodic.patch + 22526-ept-access-once.patch + 22533-x86-32bit-apicid.patch + 22534-x86-max-local-apic.patch + 22538-keyhandler-relax.patch + 22540-32on64-hypercall-debug.patch + 22549-vtd-map-page-leak.patch + 22574-ept-skip-validation.patch + 22632-vtd-print-entries.patch + +------------------------------------------------------------------- +Tue Jan 4 16:53:54 MST 2011 - carnold@novell.com + +- bnc#661298 - maintenance release candidate - Windows VMs reboot + too fast, triggering failsafe + xen-minimum-restart-time.patch + +------------------------------------------------------------------- +Tue Jan 4 10:23:18 CST 2011 - cyliu@novell.com + +- bnc#659070 - fix problem when input '|' in en-us keyboard + qemu_altgr_more.patch + +------------------------------------------------------------------- +Tue Dec 28 11:23:18 MST 2010 - jfehlig@novell.com + +- bnc#659466 - XEN drbd block device type not working on SLES 11 SP1 + 20158-revert.patch + +------------------------------------------------------------------- @@ -10,0 +106,46 @@ +Mon Dec 27 14:43:13 CST 2010 - lidongyang@novell.com + +- bnc#654543 - PV guest won't unplug the IDE disk created by + qemu-dm + a dirty hack, only add the device to drives_table[] if we are FV + domU, that will be unplugged anyway if a PV driver is loaded + later. + ioemu-disable-emulated-ide-if-pv.patch + +------------------------------------------------------------------- +Wed Dec 27 11:31:52 CST 2010 - cyliu@novell.com + +- Upstream patch to replace xenfb_32bpp.patch + 7426-xenfb-depth.patch + +------------------------------------------------------------------- +Tue Dec 21 11:31:52 CST 2010 - lidongyang@novell.com + +- bnc#651822 make sure we only apply the snapshot once, and the + changes made after snapshot-apply hit the disk. + snapshot-xend.patch + snapshot-without-pv-fix.patch + +------------------------------------------------------------------- +Thu Dec 16 17:29:11 MST 2010 - jfehlig@novell.com + +- bnc#613584 - If available, use kpartx '-f' option in domUloader + +------------------------------------------------------------------- +Thu Dec 16 10:14:47 MST 2010 - jfehlig@novell.com + +- bnc#659872 - xend: Do no release domain lock on checkpoint + operation. + +------------------------------------------------------------------- +Tue Dec 14 11:59:26 MST 2010 - carnold@novell.com + +- Upstream patches from Jan + 22431-p2m-remove-bug-check.patch + 22448-x86_64-gdt-ldt-fault-filter.patch + 22466-x86-sis-apic-bug.patch + 22451-hvm-cap-clobber.patch + 22388-x2apic-panic.patch + 22452-x86-irq-migrate-directed-eoi.patch + +------------------------------------------------------------------- @@ -30,0 +172,23 @@ +Fri Dec 3 15:57:58 MST 2010 - carnold@novell.com + +- bnc#654591 - SLES11 SP0->Sp1 regression? (Xen, HVMs, NPIV) + Fixed xen-qemu-iscsi-fix.patch + +------------------------------------------------------------------- +Fri Dec 3 14:50:01 CST 2010 - cyliu@novell.com + +- blktap2 patch - fix problem that blktap2 device info not cleared + when block-attach fail. + blktap2.patch + +------------------------------------------------------------------- +Tue Nov 30 13:44:35 MST 2010 - carnold@novell.com + +- bnc#655438 - Using performance counter in domU on Nehalem cpus + 22417-vpmu-nehalem.patch +- Upstream patches from Jan + 22389-amd-iommu-decls.patch + 22416-acpi-check-mwait.patch + 22431-p2m-remove-bug-check.patch + +------------------------------------------------------------------- @@ -631 +795 @@ -Thu Feb 18 15:18:59 - ksrinivasan@novell.com +Thu Feb 18 15:18:59 MST 2010 - ksrinivasan@novell.com calling whatdependson for 11.3-i586 Old: ---- iommu-dom0-holes.patch x86-iommu-dom0-estimate.patch x86_64-gdt-ldt-fault-filter.patch xenfb_32bpp.patch New: ---- 20158-revert.patch 21344-4.0-testing-xenstore-fd-leak.patch 21432-4.0-cpu-boot-failure.patch 21810-x2apic-acpi.patch 21989-x2apic-resume.patch 22385-vif-common.patch 22388-x2apic-panic.patch 22389-amd-iommu-decls.patch 22416-acpi-check-mwait.patch 22417-vpmu-nehalem.patch 22431-p2m-remove-bug-check.patch 22448-x86_64-gdt-ldt-fault-filter.patch 22451-hvm-cap-clobber.patch 22452-x86-irq-migrate-directed-eoi.patch 22466-x86-sis-apic-bug.patch 22470-vlapic-tick-loss.patch 22475-x2apic-cleanup.patch 22484-vlapic-tmcct-periodic.patch 22504-iommu-dom0-holes.patch 22506-x86-iommu-dom0-estimate.patch 22526-ept-access-once.patch 22533-x86-32bit-apicid.patch 22534-x86-max-local-apic.patch 22535-x2apic-preenabled.patch 22538-keyhandler-relax.patch 22540-32on64-hypercall-debug.patch 22549-vtd-map-page-leak.patch 22574-ept-skip-validation.patch 22632-vtd-print-entries.patch 22645-amd-flush-filter.patch 22693-fam10-mmio-conf-base-protect.patch 22694-x86_64-no-weak.patch 22707-x2apic-preenabled-check.patch 22708-xenctx-misc.patch 22744-ept-pod-locking.patch 22749-vtd-workarounds.patch 22777-vtd-ats-fixes.patch 22781-pod-hap-logdirty.patch 22782-x86-emul-smsw.patch 22789-i386-no-x2apic.patch 22790-svm-resume-migrate-pirqs.patch 22816-x86-pirq-drop-priv-check.patch 7410-qemu-alt-gr.patch 7426-xenfb-depth.patch 7433-qemu-altgr.patch 7434-qemu-rlimit-as.patch altgr_2.patch blktap2.patch ioemu-disable-emulated-ide-if-pv.patch xen-minimum-restart-time.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xen.spec ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:29.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:29.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package xen (Version 4.0.1_21326_02) +# spec file for package xen # # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -38,8 +38,8 @@ %if %{?with_kmp}0 BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11 %endif -Version: 4.0.1_21326_02 -Release: 0.<RELEASE3> +Version: 4.0.1_21326_06 +Release: 0.<RELEASE2> License: GPLv2+ Group: System/Kernel AutoReqProv: on @@ -80,43 +80,89 @@ Patch2: 21271-x86-cache-flush-global.patch Patch3: 21301-svm-lmsl.patch Patch4: 21304-keyhandler-alternative.patch -Patch5: 21406-x86-microcode-quiet.patch -Patch6: 21421-vts-ats-enabling.patch -Patch7: 21526-x86-nehalem-cpuid-mask.patch -Patch8: 21542-amd-erratum-411.patch -Patch9: 21615-dont-save-xen-heap-pages.patch -Patch10: 21627-cpuidle-wrap.patch -Patch11: 21653-xend-mac-addr.patch -Patch12: 21678-xend-mac-fix.patch -Patch13: 21683-vtd-kill-timer-conditional.patch -Patch14: 21723-get-domu-state.patch -Patch15: 21847-pscsi.patch -Patch16: 21866-xenapi.patch -Patch17: 21894-intel-unmask-cpuid.patch -Patch18: 22019-x86-cpuidle-online-check.patch -Patch19: 22051-x86-forced-EOI.patch -Patch20: 22067-x86-irq-domain.patch -Patch21: 22068-vtd-irte-RH-bit.patch -Patch23: 22084-x86-xsave-off.patch -Patch25: 22135-heap-lock.patch -Patch26: 22148-serial-irq-dest.patch -Patch27: 22157-x86-debug-key-i.patch -Patch28: 22159-notify-evtchn-dying.patch -Patch29: 22160-Intel-C6-EOI.patch -Patch30: 22174-x86-pmtimer-accuracy.patch -Patch31: 22175-x86-irq-enter-exit.patch -Patch32: 22177-i386-irq-safe-map_domain_page.patch -Patch33: 22194-tmem-check-pv-mfn.patch -Patch34: 22213-x86-xsave-cpuid-check.patch -Patch35: 22214-x86-msr-misc-enable.patch -Patch36: 22222-x86-timer-extint.patch -Patch37: 22223-vtd-workarounds.patch -Patch38: 22231-x86-pv-ucode-msr-intel.patch -Patch39: 22232-x86-64-lahf-lm-bios-workaround.patch -Patch40: 22280-kexec.patch -Patch41: 22337-vtd-scan-single-func.patch -Patch42: 22348-vtd-check-secbus-devfn.patch -Patch43: 22369-xend-pci-passthru-fix.patch +Patch5: 21344-4.0-testing-xenstore-fd-leak.patch +Patch6: 21406-x86-microcode-quiet.patch +Patch7: 21421-vts-ats-enabling.patch +Patch8: 21432-4.0-cpu-boot-failure.patch +Patch9: 21526-x86-nehalem-cpuid-mask.patch +Patch10: 21542-amd-erratum-411.patch +Patch11: 21615-dont-save-xen-heap-pages.patch +Patch12: 21627-cpuidle-wrap.patch +Patch13: 21653-xend-mac-addr.patch +Patch14: 21678-xend-mac-fix.patch +Patch15: 21683-vtd-kill-timer-conditional.patch +Patch16: 21723-get-domu-state.patch +Patch17: 21810-x2apic-acpi.patch +Patch18: 21847-pscsi.patch +Patch19: 21866-xenapi.patch +Patch20: 21894-intel-unmask-cpuid.patch +Patch21: 21989-x2apic-resume.patch +Patch22: 22019-x86-cpuidle-online-check.patch +Patch23: 22051-x86-forced-EOI.patch +Patch24: 22067-x86-irq-domain.patch +Patch25: 22068-vtd-irte-RH-bit.patch +Patch26: 22084-x86-xsave-off.patch +Patch27: 22135-heap-lock.patch +Patch28: 22148-serial-irq-dest.patch +Patch29: 22157-x86-debug-key-i.patch +Patch30: 22159-notify-evtchn-dying.patch +Patch31: 22160-Intel-C6-EOI.patch +Patch32: 22174-x86-pmtimer-accuracy.patch +Patch33: 22175-x86-irq-enter-exit.patch +Patch34: 22177-i386-irq-safe-map_domain_page.patch +Patch35: 22194-tmem-check-pv-mfn.patch +Patch36: 22213-x86-xsave-cpuid-check.patch +Patch37: 22214-x86-msr-misc-enable.patch +Patch38: 22222-x86-timer-extint.patch +Patch39: 22223-vtd-workarounds.patch +Patch40: 22231-x86-pv-ucode-msr-intel.patch +Patch41: 22232-x86-64-lahf-lm-bios-workaround.patch +Patch42: 22280-kexec.patch +Patch43: 22337-vtd-scan-single-func.patch +Patch44: 22348-vtd-check-secbus-devfn.patch +Patch45: 22369-xend-pci-passthru-fix.patch +Patch46: 22385-vif-common.patch +Patch47: 22388-x2apic-panic.patch +Patch48: 22389-amd-iommu-decls.patch +Patch49: 22416-acpi-check-mwait.patch +Patch50: 22417-vpmu-nehalem.patch +Patch51: 22431-p2m-remove-bug-check.patch +Patch52: 22448-x86_64-gdt-ldt-fault-filter.patch +Patch53: 22451-hvm-cap-clobber.patch +Patch54: 22452-x86-irq-migrate-directed-eoi.patch +Patch55: 22466-x86-sis-apic-bug.patch +Patch56: 22470-vlapic-tick-loss.patch +Patch57: 22475-x2apic-cleanup.patch +Patch58: 22484-vlapic-tmcct-periodic.patch +Patch59: 22504-iommu-dom0-holes.patch +Patch60: 22506-x86-iommu-dom0-estimate.patch +Patch61: 22526-ept-access-once.patch +Patch62: 22533-x86-32bit-apicid.patch +Patch63: 22534-x86-max-local-apic.patch +Patch64: 22535-x2apic-preenabled.patch +Patch65: 22538-keyhandler-relax.patch +Patch66: 22540-32on64-hypercall-debug.patch +Patch67: 22549-vtd-map-page-leak.patch +Patch68: 22574-ept-skip-validation.patch +Patch69: 22632-vtd-print-entries.patch +Patch70: 22645-amd-flush-filter.patch +Patch71: 22694-x86_64-no-weak.patch +Patch72: 22693-fam10-mmio-conf-base-protect.patch +Patch73: 22707-x2apic-preenabled-check.patch +Patch74: 22708-xenctx-misc.patch +Patch75: 22744-ept-pod-locking.patch +Patch76: 22749-vtd-workarounds.patch +Patch77: 22777-vtd-ats-fixes.patch +Patch78: 22781-pod-hap-logdirty.patch +Patch79: 22782-x86-emul-smsw.patch +Patch80: 22789-i386-no-x2apic.patch +Patch81: 22790-svm-resume-migrate-pirqs.patch +Patch82: 22816-x86-pirq-drop-priv-check.patch +# Upstream ioemu patches +Patch200: 7410-qemu-alt-gr.patch +Patch201: 7426-xenfb-depth.patch +Patch202: 7433-qemu-altgr.patch +Patch203: 7434-qemu-rlimit-as.patch # Our patches Patch300: xen-config.diff Patch301: xend-config.diff @@ -180,6 +226,8 @@ Patch373: usb-list.patch Patch374: xend-devid-or-name.patch Patch375: 22326-cpu-pools-numa-placement.patch +Patch376: 20158-revert.patch +#Patch377: suspend_evtchn_lock.patch # Patches for snapshot support Patch400: snapshot-ioemu-save.patch Patch401: snapshot-ioemu-restore.patch @@ -209,30 +257,30 @@ Patch433: multi-xvdp.patch Patch434: check_device_status.patch Patch435: change_home_server.patch -Patch436: xenfb_32bpp.patch -Patch437: stdvga-cache.patch -Patch438: bdrv_default_rwflag.patch +Patch436: altgr_2.patch +Patch438: stdvga-cache.patch +Patch439: bdrv_default_rwflag.patch +Patch440: blktap2.patch +Patch442: xen-minimum-restart-time.patch # Jim's domain lock patch Patch450: xend-domain-lock.patch # Hypervisor and PV driver Patches Patch500: 32on64-extra-mem.patch -Patch501: iommu-dom0-holes.patch -Patch502: x86-iommu-dom0-estimate.patch -Patch503: x86_64-gdt-ldt-fault-filter.patch -Patch504: x86-ioapic-ack-default.patch -Patch505: x86-cpufreq-report.patch -Patch506: dump-exec-state.patch -Patch507: dom-print.patch -Patch508: pvdrv-import-shared-info.patch -Patch509: x86-show-page-walk-early.patch -Patch510: x86-extra-trap-info.patch -Patch511: pvdrv_emulation_control.patch -Patch512: blktap-pv-cdrom.patch -Patch513: pv-driver-build.patch -Patch514: supported_module.diff -Patch515: magic_ioport_compat.patch +Patch501: x86-ioapic-ack-default.patch +Patch502: x86-cpufreq-report.patch +Patch503: dump-exec-state.patch +Patch504: dom-print.patch +Patch505: pvdrv-import-shared-info.patch +Patch506: x86-show-page-walk-early.patch +Patch507: x86-extra-trap-info.patch +Patch508: pvdrv_emulation_control.patch +Patch509: blktap-pv-cdrom.patch +Patch510: pv-driver-build.patch +Patch511: supported_module.diff +Patch512: magic_ioport_compat.patch Patch650: disable_emulated_device.diff Patch651: ioemu-disable-scsi.patch +Patch652: ioemu-disable-emulated-ide-if-pv.patch # novell_shim patches Patch700: hv_tools.patch Patch701: hv_xen_base.patch @@ -596,7 +644,9 @@ %patch19 -p1 %patch20 -p1 %patch21 -p1 +%patch22 -p1 %patch23 -p1 +%patch24 -p1 %patch25 -p1 %patch26 -p1 %patch27 -p1 @@ -616,6 +666,49 @@ %patch41 -p1 %patch42 -p1 %patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +%patch69 -p1 +%patch70 -p1 +%patch71 -p1 +%patch72 -p1 +%patch73 -p1 +%patch74 -p1 +%patch75 -p1 +%patch76 -p1 +%patch77 -p1 +%patch78 -p1 +%patch79 -p1 +%patch80 -p1 +%patch81 -p1 +%patch82 -p1 +%patch200 -p1 +%patch201 -p1 +%patch202 -p1 +%patch203 -p1 %patch300 -p1 %patch301 -p1 %patch302 -p1 @@ -677,6 +770,8 @@ %patch373 -p1 %patch374 -p1 %patch375 -p1 +%patch376 -p1 +#%patch377 -p1 bnc#649209 %patch400 -p1 %patch401 -p1 %patch402 -p1 @@ -704,8 +799,10 @@ %patch434 -p1 %patch435 -p1 %patch436 -p1 -%patch437 -p1 %patch438 -p1 +%patch439 -p1 +%patch440 -p1 +%patch442 -p1 %patch450 -p1 %patch500 -p1 %patch501 -p1 @@ -720,11 +817,9 @@ %patch510 -p1 %patch511 -p1 %patch512 -p1 -%patch513 -p1 -%patch514 -p1 -%patch515 -p1 %patch650 -p1 %patch651 -p1 +%patch652 -p1 %patch700 -p1 %patch701 -p1 %patch702 -p1 ++++++ 20158-revert.patch ++++++ # HG changeset patch # User jfehlig@localhost # Date 1293498049 25200 # Node ID 7584dc7bc3de64340f193a0cab188e85bd50d594 # Parent f9ce5858f7eae84bec34aa10d3585c7e6f6ca6c9 Revert 20158:f9ce5858f7ea xend: Support "bootloader" mode for "drbd:" devices block-drbd (provided by drbd project) handles all the details that c/s 20158 introduces within xend. Subtleties of configuring storage subsystems should not be handled by xend, but instead delegated to the block script mechansim provided by the xen toool stack. Note: Patch submitted upstream but not (yet) accepted since xend is on the way out. http://lists.xensource.com/archives/html/xen-devel/2010-12/msg01160.html Index: xen-4.0.1-testing/tools/python/xen/util/blkif.py =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/util/blkif.py +++ xen-4.0.1-testing/tools/python/xen/util/blkif.py @@ -79,13 +79,6 @@ def parse_uname(uname): if typ == "phy" and not fn.startswith("/"): fn = "/dev/%s" %(fn,) - if typ == "drbd": - if not fn.startswith("drbd"): - (drbdadmstdin, drbdadmstdout) = os.popen2("/sbin/drbdadm "+"sh-dev "+fn) - fn = drbdadmstdout.readline().strip() - else: - fn = "/dev/%s" %(fn,) - if typ in ("tap", "tap2"): (taptype, fn) = fn.split(":", 1) if taptype in ("tapdisk", "ioemu"): Index: xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py @@ -3283,15 +3283,6 @@ class XendDomainInfo: (fn, types) = parse_uname(disk) - # If this is a drbd volume, check if we need to activate it - if disk.find(":") != -1: - (disktype, diskname) = disk.split(':', 1) - if disktype == 'drbd': - (drbdadmstdin, drbdadmstdout) = os.popen2(["/sbin/drbdadm", "state", diskname]) - (state, junk) = drbdadmstdout.readline().split('/', 1) - if state == 'Secondary': - os.system('/sbin/drbdadm primary ' + diskname) - def _shouldMount(types): if types[0] in ('file', 'phy'): return False ++++++ 21344-4.0-testing-xenstore-fd-leak.patch ++++++ # HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1284535198 -3600 # Node ID 86b99b9ad6ef9492b66c98e2377105f3ea584cbf # Parent 89605b79f56529d34d963d0d91c67c46294a7b7c Fix fd leak in xenstore Missing from commit 'libxl: Backported stuff from unstable' Without this change, xs_daemon_open/xs_daemon_close will leak file descriptors. Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r 89605b79f565 -r 86b99b9ad6ef tools/xenstore/xs.c --- a/tools/xenstore/xs.c Mon Sep 13 17:51:50 2010 +0100 +++ b/tools/xenstore/xs.c Wed Sep 15 08:19:58 2010 +0100 @@ -285,6 +285,8 @@ mutex_unlock(&h->request_mutex); mutex_unlock(&h->reply_mutex); mutex_unlock(&h->watch_mutex); + + close_fds_free(h); } static bool read_all(int fd, void *data, unsigned int len) ++++++ 21432-4.0-cpu-boot-failure.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294742461 0 # Node ID 7a203c60d588a7a15a28a6fb16c69feafd157e0d # Parent 64bb7d9904a64cc4561c6d541d857acf46e42180 x86: don't crash when a CPU cannot be brought online during boot References: bnc#656369, bnc#658704 x86_cpu_to_apicid[] gets set to BAD_APICID when bringup of a secondary CPU fails, yet srat_detect_node() wants to use this as array index. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: xen-4.0.1-testing/xen/arch/x86/setup.c =================================================================== --- xen-4.0.1-testing.orig/xen/arch/x86/setup.c +++ xen-4.0.1-testing/xen/arch/x86/setup.c @@ -1103,10 +1103,13 @@ void __init __start_xen(unsigned long mb __cpu_up(i); } - /* Set up cpu_to_node[]. */ - srat_detect_node(i); - /* Set up node_to_cpumask based on cpu_to_node[]. */ - numa_add_cpu(i); + if ( cpu_online(i) ) + { + /* Set up cpu_to_node[]. */ + srat_detect_node(i); + /* Set up node_to_cpumask based on cpu_to_node[]. */ + numa_add_cpu(i); + } } printk("Brought up %ld CPUs\n", (long)num_online_cpus()); ++++++ 21810-x2apic-acpi.patch ++++++ # HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1279284738 -3600 # Node ID fedab6367c9a0141d49853c77a23d6642ba70ff6 # Parent 1f7c2418e58c7d1d5650ea211016b30114de48f2 ACPI: add support for x2APIC ACPI extensions References: bnc#656369, bnc#658704 All logical processors with APIC ID values of 255 and greater will have their APIC reported through Processor X2APIC structure (type-9 entry type) and all logical processors with APIC ID less than 255 will have their APIC reported through legacy Processor Local APIC (type-0 entry type) only. This is the same case even for NMI structure reporting. The Processor X2APIC Affinity structure provides the association between the X2APIC ID of a logical processor and the proximity domain to which the logical processor belongs. This patch adds 2 new subtables to MADT and one new subtable to SRAT. This patch also changes x86_acpiid_to_apicid from u8 to u32 for x2APIC ID, and changes mp_register_lapic to accept 32-bit id. But there are still some 8-bit apic id hardcode and assumptions in Xen code, it needs to be fixed in future. Signed-off-by: Weidong Han <weidong.han@intel.com> --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -81,7 +81,7 @@ u8 acpi_enable_value, acpi_disable_value #warning ACPI uses CMPXCHG, i486 and later hardware #endif -u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = +u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = {[0 ... MAX_MADT_ENTRIES - 1] = 0xff }; EXPORT_SYMBOL(x86_acpiid_to_apicid); @@ -156,6 +156,35 @@ static int __init acpi_parse_madt(struct } static int __init +acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) +{ + struct acpi_table_x2apic *processor = NULL; + + processor = (struct acpi_table_x2apic *)header; + + if (BAD_MADT_ENTRY(processor, end)) + return -EINVAL; + + acpi_table_print_madt_entry(header); + + /* Record local apic id only when enabled */ + if (processor->flags.enabled) + x86_acpiid_to_apicid[processor->acpi_uid] = processor->id; + + /* + * We need to register disabled CPU as well to permit + * counting disabled CPUs. This allows us to size + * cpus_possible_map more accurately, to permit + * to not preallocating memory for all NR_CPUS + * when we use CPU hotplug. + */ + mp_register_lapic(processor->id, /* X2APIC ID */ + processor->flags.enabled); /* Enabled? */ + + return 0; +} + +static int __init acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) { struct acpi_table_lapic *processor = NULL; @@ -201,6 +230,25 @@ acpi_parse_lapic_addr_ovr(struct acpi_su } static int __init +acpi_parse_x2apic_nmi(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_table_x2apic_nmi *x2apic_nmi = NULL; + + x2apic_nmi = (struct acpi_table_x2apic_nmi *)header; + + if (BAD_MADT_ENTRY(x2apic_nmi, end)) + return -EINVAL; + + acpi_table_print_madt_entry(header); + + if (x2apic_nmi->lint != 1) + printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n"); + + return 0; +} + +static int __init acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end) { struct acpi_table_lapic_nmi *lapic_nmi = NULL; @@ -465,7 +513,7 @@ static int __init acpi_parse_fadt(struct */ static int __init acpi_parse_madt_lapic_entries(void) { - int count; + int count, x2count; if (!cpu_has_apic) return -ENODEV; @@ -488,11 +536,13 @@ static int __init acpi_parse_madt_lapic_ count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, MAX_APICS); - if (!count) { + x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic, + MAX_APICS); + if (!count && !x2count) { printk(KERN_ERR PREFIX "No LAPIC entries present\n"); /* TBD: Cleanup to allow fallback to MPS */ return -ENODEV; - } else if (count < 0) { + } else if (count < 0 || x2count < 0) { printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); /* TBD: Cleanup to allow fallback to MPS */ return count; @@ -500,7 +550,10 @@ static int __init acpi_parse_madt_lapic_ count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); - if (count < 0) { + x2count = + acpi_table_parse_madt(ACPI_MADT_X2APIC_NMI, + acpi_parse_x2apic_nmi, 0); + if (count < 0 || x2count < 0) { printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); /* TBD: Cleanup to allow fallback to MPS */ return count; --- a/xen/arch/x86/mpparse.c +++ b/xen/arch/x86/mpparse.c @@ -838,7 +838,7 @@ void __init mp_register_lapic_address ( int __devinit mp_register_lapic ( - u8 id, + u32 id, u8 enabled) { struct mpc_config_processor processor; --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -164,6 +164,36 @@ void __init acpi_numa_slit_init(struct a } #endif +/* Callback for Proximity Domain -> x2APIC mapping */ +void __init +acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) +{ + int pxm, node; + int apic_id; + + if (srat_disabled()) + return; + if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) { + bad_srat(); + return; + } + if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) + return; + pxm = pa->proximity_domain; + node = setup_node(pxm); + if (node < 0) { + printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); + bad_srat(); + return; + } + + apic_id = pa->apic_id; + apicid_to_node[apic_id] = node; + acpi_numa = 1; + printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", + pxm, apic_id, node); +} + /* Callback for Proximity Domain -> LAPIC mapping */ void __init acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) --- a/xen/drivers/acpi/numa.c +++ b/xen/drivers/acpi/numa.c @@ -90,6 +90,21 @@ void __init acpi_table_print_srat_entry( #endif /* ACPI_DEBUG_OUTPUT */ break; + case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: +#ifdef ACPI_DEBUG_OUTPUT + { + struct acpi_srat_x2apic_cpu_affinity *p = + (struct acpi_srat_x2apic_cpu_affinity *)header; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "SRAT Processor (x2apicid[0x%08x]) in" + " proximity domain %d %s\n", + p->apic_id, + p->proximity_domain, + (p->flags & ACPI_SRAT_CPU_ENABLED) ? + "enabled" : "disabled")); + } +#endif /* ACPI_DEBUG_OUTPUT */ + break; default: printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n", @@ -105,6 +120,33 @@ static int __init acpi_parse_slit(struct return 0; } +void __init __attribute__ ((weak)) +acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) +{ + printk(KERN_WARNING PREFIX + "Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id); + return; +} + + +static int __init +acpi_parse_x2apic_affinity(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_srat_x2apic_cpu_affinity *processor_affinity; + + processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header; + if (!processor_affinity) + return -EINVAL; + + acpi_table_print_srat_entry(header); + + /* let architecture-dependent part to do it */ + acpi_numa_x2apic_affinity_init(processor_affinity); + + return 0; +} + static int __init acpi_parse_processor_affinity(struct acpi_subtable_header * header, const unsigned long end) @@ -164,6 +206,8 @@ int __init acpi_numa_init(void) { /* SRAT: Static Resource Affinity Table */ if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { + acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, + acpi_parse_x2apic_affinity, NR_CPUS); acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY, acpi_parse_processor_affinity, NR_CPUS); --- a/xen/drivers/acpi/tables.c +++ b/xen/drivers/acpi/tables.c @@ -63,6 +63,18 @@ void __init acpi_table_print_madt_entry( } break; + case ACPI_MADT_TYPE_LOCAL_X2APIC: + { + struct acpi_madt_local_x2apic *p = + (struct acpi_madt_local_x2apic *)header; + printk(KERN_INFO PREFIX + "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n", + p->local_apic_id, p->uid, + (p->lapic_flags & ACPI_MADT_ENABLED) ? + "enabled" : "disabled"); + } + break; + case ACPI_MADT_TYPE_IO_APIC: { struct acpi_madt_io_apic *p = @@ -117,6 +129,24 @@ void __init acpi_table_print_madt_entry( } break; + case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: + { + u16 polarity, trigger; + struct acpi_madt_local_x2apic_nmi *p = + (struct acpi_madt_local_x2apic_nmi *)header; + + polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK; + trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2; + + printk(KERN_INFO PREFIX + "X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n", + p->uid, + mps_inti_flags_polarity[polarity], + mps_inti_flags_trigger[trigger], + p->lint); + } + break; + case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: { struct acpi_madt_local_apic_override *p = --- a/xen/include/acpi/actbl1.h +++ b/xen/include/acpi/actbl1.h @@ -404,7 +404,9 @@ enum acpi_madt_type { ACPI_MADT_TYPE_IO_SAPIC = 6, ACPI_MADT_TYPE_LOCAL_SAPIC = 7, ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, - ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */ + ACPI_MADT_TYPE_LOCAL_X2APIC = 9, + ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, + ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ }; /* @@ -505,6 +507,26 @@ struct acpi_madt_interrupt_source { #define ACPI_MADT_CPEI_OVERRIDE (1) +/* 9: Processor Local X2APIC (ACPI 4.0) */ + +struct acpi_madt_local_x2apic { + struct acpi_subtable_header header; + u16 reserved; /* Reserved - must be zero */ + u32 local_apic_id; /* Processor X2_APIC ID */ + u32 lapic_flags; + u32 uid; /* Extended X2_APIC processor ID */ +}; + +/* 10: Local X2APIC NMI (ACPI 4.0) */ + +struct acpi_madt_local_x2apic_nmi { + struct acpi_subtable_header header; + u16 inti_flags; + u32 uid; /* Processor X2_APIC ID */ + u8 lint; /* LINTn to which NMI is connected */ + u8 reserved[3]; +}; + /* * Common flags fields for MADT subtables */ @@ -646,11 +668,14 @@ struct acpi_table_srat { enum acpi_srat_type { ACPI_SRAT_TYPE_CPU_AFFINITY = 0, ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, - ACPI_SRAT_TYPE_RESERVED = 2 + ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, + ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ }; /* SRAT sub-tables */ +/* 0: Processor Local APIC/SAPIC Affinity */ + struct acpi_srat_cpu_affinity { struct acpi_subtable_header header; u8 proximity_domain_lo; @@ -661,9 +686,7 @@ struct acpi_srat_cpu_affinity { u32 reserved; /* Reserved, must be zero */ }; -/* Flags */ - -#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ +/* 1: Memory Affinity */ struct acpi_srat_mem_affinity { struct acpi_subtable_header header; @@ -682,6 +705,22 @@ struct acpi_srat_mem_affinity { #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ +/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ + +struct acpi_srat_x2apic_cpu_affinity { + struct acpi_subtable_header header; + u16 reserved; /* Reserved, must be zero */ + u32 proximity_domain; + u32 apic_id; + u32 flags; + u32 clock_domain; + u32 reserved2; +}; + +/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ + +#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ + /******************************************************************************* * * TCPA - Trusted Computing Platform Alliance table --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -151,7 +151,7 @@ struct acpi_sleep_info { #endif /* CONFIG_ACPI_SLEEP */ #define MAX_MADT_ENTRIES 256 -extern u8 x86_acpiid_to_apicid[]; +extern u32 x86_acpiid_to_apicid[]; #define MAX_LOCAL_APIC 256 extern u32 pmtmr_ioport; --- a/xen/include/asm-x86/mpspec.h +++ b/xen/include/asm-x86/mpspec.h @@ -24,7 +24,7 @@ extern int pic_mode; extern int using_apic_timer; #ifdef CONFIG_ACPI -extern int mp_register_lapic (u8 id, u8 enabled); +extern int mp_register_lapic (u32 id, u8 enabled); extern void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu); extern void mp_register_lapic_address (u64 address); extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -57,6 +57,8 @@ enum acpi_madt_entry_id { ACPI_MADT_IOSAPIC, ACPI_MADT_LSAPIC, ACPI_MADT_PLAT_INT_SRC, + ACPI_MADT_X2APIC, + ACPI_MADT_X2APIC_NMI, ACPI_MADT_ENTRY_COUNT }; @@ -76,6 +78,17 @@ struct acpi_table_lapic { } flags; } __attribute__ ((packed)); +struct acpi_table_x2apic { + struct acpi_subtable_header header; + u16 reserved; + u32 id; + struct { + u32 enabled:1; + u32 reserved:31; + } flags; + u32 acpi_uid; +} __attribute__ ((packed)); + struct acpi_table_ioapic { struct acpi_subtable_header header; u8 id; @@ -105,6 +118,14 @@ struct acpi_table_lapic_nmi { u8 lint; } __attribute__ ((packed)); +struct acpi_table_x2apic_nmi { + struct acpi_subtable_header header; + acpi_interrupt_flags flags; + u32 acpi_uid; + u8 lint; + u8 reserved[3]; +} __attribute__ ((packed)); + struct acpi_table_lapic_addr_ovr { struct acpi_subtable_header header; u8 reserved[2]; @@ -280,6 +301,7 @@ void acpi_table_print_srat_entry (struct /* the following four functions are architecture-dependent */ void acpi_numa_slit_init (struct acpi_table_slit *slit); void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); +void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); void acpi_numa_arch_fixup(void); ++++++ 21989-x2apic-resume.patch ++++++ # HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1281707886 -3600 # Node ID 3cee41690fa26853acb0be65065c52f6029ca599 # Parent 01d185dab39e9be399b203bec91870e04f576c23 x2APIC: Improve x2APIC suspend/resume References: bnc#656369, bnc#658704 x2apic depends on interrupt remapping, so it should disable interrupt remapping behind x2apic disabling. And also this patch wraps __enable_x2apic to get rid of duplicated code. Signed-off-by: Weidong Han <weidong.han@intel.com> --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -496,9 +496,20 @@ static void apic_pm_activate(void) apic_pm_state.active = 1; } +static void __enable_x2apic(void) +{ + u32 lo, hi; + + rdmsr(MSR_IA32_APICBASE, lo, hi); + if ( !(lo & MSR_IA32_APICBASE_EXTD) ) + { + lo |= MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD; + wrmsr(MSR_IA32_APICBASE, lo, 0); + } +} + static void resume_x2apic(void) { - uint64_t msr_content; struct IO_APIC_route_entry **ioapic_entries = NULL; ASSERT(x2apic_enabled); @@ -520,14 +531,7 @@ static void resume_x2apic(void) mask_IO_APIC_setup(ioapic_entries); iommu_enable_IR(); - - rdmsrl(MSR_IA32_APICBASE, msr_content); - if ( !(msr_content & MSR_IA32_APICBASE_EXTD) ) - { - msr_content |= MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD; - msr_content = (uint32_t)msr_content; - wrmsrl(MSR_IA32_APICBASE, msr_content); - } + __enable_x2apic(); restore_IO_APIC_setup(ioapic_entries); unmask_8259A(); @@ -743,9 +747,10 @@ int lapic_suspend(void) apic_pm_state.apic_tmict = apic_read(APIC_TMICT); apic_pm_state.apic_tdcr = apic_read(APIC_TDCR); apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR); - + local_irq_save(flags); disable_local_APIC(); + iommu_disable_IR(); local_irq_restore(flags); return 0; } @@ -1042,15 +1047,8 @@ static void enable_bsp_x2apic(void) if ( !x2apic_preenabled ) { - u32 lo, hi; - - rdmsr(MSR_IA32_APICBASE, lo, hi); - if ( !(lo & MSR_IA32_APICBASE_EXTD) ) - { - lo |= MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD; - wrmsr(MSR_IA32_APICBASE, lo, 0); - printk("x2APIC mode enabled.\n"); - } + __enable_x2apic(); + printk("x2APIC mode enabled.\n"); } restore_out: @@ -1064,19 +1062,12 @@ out: static void enable_ap_x2apic(void) { - u32 lo, hi; - ASSERT(smp_processor_id() != 0); /* APs only enable x2apic when BSP did so. */ BUG_ON(!x2apic_enabled); - rdmsr(MSR_IA32_APICBASE, lo, hi); - if ( !(lo & MSR_IA32_APICBASE_EXTD) ) - { - lo |= MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD; - wrmsr(MSR_IA32_APICBASE, lo, 0); - } + __enable_x2apic(); } void enable_x2apic(void) --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -871,6 +871,24 @@ int iommu_enable_IR(void) } /* + * This function is used to disable Interrutp remapping when + * suspend local apic + */ +void iommu_disable_IR(void) +{ + struct acpi_drhd_unit *drhd; + + if ( !iommu_supports_eim() ) + return; + + for_each_drhd_unit ( drhd ) + disable_intremap(drhd->iommu); + + for_each_drhd_unit ( drhd ) + disable_qinval(drhd->iommu); +} + +/* * Check if interrupt remapping is enabled or not * return 1: enabled * return 0: not enabled --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2126,10 +2126,11 @@ static void vtd_suspend(void) iommu_disable_translation(iommu); - if ( iommu_intremap ) - disable_intremap(iommu); - - if ( iommu_qinval ) + /* If interrupt remapping is enabled, queued invalidation + * will be disabled following interupt remapping disabling + * in local apic suspend + */ + if ( !iommu_intremap && iommu_qinval ) disable_qinval(iommu); } } --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -59,6 +59,7 @@ struct iommu { int iommu_setup(void); int iommu_supports_eim(void); int iommu_enable_IR(void); +void iommu_disable_IR(void); int intremap_enabled(void); int iommu_add_device(struct pci_dev *pdev); ++++++ 22223-vtd-workarounds.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:29.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:29.000000000 +0100 @@ -41,6 +41,10 @@ Signed-off-by: Allen Kay <allen.m.kay@intel.com> +Added WLAN device ID 0x422C that was found on Fujitsu's Calpella system to WLAN quirk. + +Signed-off-by: Allen Kay <allen.m.kay@intel.com> + --- a/xen/drivers/passthrough/vtd/Makefile +++ b/xen/drivers/passthrough/vtd/Makefile @@ -6,3 +6,4 @@ obj-y += dmar.o @@ -382,7 +386,7 @@ irq_to_iommu = xmalloc_array(struct iommu*, nr_irqs); BUG_ON(!irq_to_iommu); -@@ -2163,7 +2206,7 @@ static void vtd_resume(void) +@@ -2164,7 +2207,7 @@ static void vtd_resume(void) (u32) iommu_state[i][DMAR_FEUADDR_REG]); spin_unlock_irqrestore(&iommu->register_lock, flags); @@ -403,7 +407,7 @@ #endif --- /dev/null +++ b/xen/drivers/passthrough/vtd/quirks.c -@@ -0,0 +1,262 @@ +@@ -0,0 +1,263 @@ +/* + * Copyright (c) 2010, Intel Corporation. + * @@ -658,6 +662,7 @@ + case 0x00858086: + case 0x42388086: + case 0x422b8086: ++ case 0x422c8086: + map_me_phantom_function(domain, 22, map); + break; + default: ++++++ 22385-vif-common.patch ++++++ # HG changeset patch # User Sander Eikelenboom <linux@eikelenboom.it> # Date 1289399839 0 # Node ID b0fe8260cefa87d0237278dd4c9fae7113b459ea # Parent c19e3371f31b2b039f38026a225be266df151316 tools/hotplug/Linux: supply --physdev-is-bridged in iptables runes With newer (pvops) kernels logs get flooded with this iptables warning: physdev match: using --physdev-out in the OUTPUT, FORWARD and POSTROUTING chains for non-bridged traffic is not supported anymore Using the --physdev-is-bridged option prevents this. See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571634#10 Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Index: xen-4.0.1-testing/tools/hotplug/Linux/vif-common.sh =================================================================== --- xen-4.0.1-testing.orig/tools/hotplug/Linux/vif-common.sh +++ xen-4.0.1-testing/tools/hotplug/Linux/vif-common.sh @@ -73,10 +73,10 @@ frob_iptable() local c="-D" fi - iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT \ + iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$vif" "$@" -j ACCEPT \ 2>/dev/null && iptables "$c" FORWARD -m state --state RELATED,ESTABLISHED -m physdev \ - --physdev-out "$vif" -j ACCEPT 2>/dev/null + --physdev-is-bridged --physdev-out "$vif" -j ACCEPT 2>/dev/null if [ "$command" == "online" -a $? -ne 0 ] then ++++++ 22388-x2apic-panic.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1289813498 0 # Node ID 87f248de52304bc96a80dc093250fed0197f37e0 # Parent 8af10bd7f2d0e9300f1bc68f7e2fb137fa839365 x2apic: Remove a panic condition in enabling x2APIC Currently Xen triggers a panic if user disables VT-d by command line while not disable x2APIC. This requires users to specify both "iommu=0" and "x2apic=0" to disable VT-d if the platform supports x2APIC. It's not user friendly. This patch removes the panic condition. That's to say, don't require user to specify "x2apic=0" when specify "iommu=0". As long as VT-d is not enabled (disabled in BIOS or in command line), x2APIC won't be enabled naturally (x2APIC depends on VT-d Interrupt remapping). Signed-off-by: Weidong Han <weidong.han@intel.com> --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1000,22 +1000,11 @@ static void enable_bsp_x2apic(void) } else { - if ( !iommu_enabled || !iommu_intremap || !iommu_qinval ) - panic("Cannot enable x2APIC due to iommu or interrupt " - "remapping or queued invalidation is disabled " - "by command line!\n"); - else - { - if ( x2apic_preenabled ) - panic("x2APIC: already enabled by BIOS, but " - "iommu_supports_eim fails\n"); - else - { - printk("Not enable x2APIC due to " - "iommu_supports_eim fails!\n"); - return; - } - } + if ( x2apic_preenabled ) + panic("x2APIC: already enabled by BIOS, but " + "iommu_supports_eim failed!\n"); + printk("Not enabling x2APIC: depends oniommu_supports_eim\n"); + return; } } ++++++ 22389-amd-iommu-decls.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1289906913 0 # Node ID 9b2ca938cfe6c0639471e24634bc4a48d889b412 # Parent 87f248de52304bc96a80dc093250fed0197f37e0 amd iommu: Fix HV crash with 32bit pv_ops kernel Signed-off-by: Wei Wang <wei.wang2@amd.com> Tested-by: Conny Seidel <conny.seidel@amd.com> --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h @@ -32,9 +32,6 @@ #define DMA_32BIT_MASK 0x00000000ffffffffULL #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) -extern int amd_iommu_debug; -extern int amd_iommu_perdev_intremap; - #define AMD_IOMMU_DEBUG(fmt, args...) \ do \ { \ --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -30,6 +30,8 @@ extern bool_t iommu_enabled; extern bool_t force_iommu, iommu_verbose; extern bool_t iommu_workaround_bios_bug, iommu_passthrough; extern bool_t iommu_snoop, iommu_qinval, iommu_intremap; +extern bool_t amd_iommu_debug; +extern bool_t amd_iommu_perdev_intremap; #define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu) ++++++ 22416-acpi-check-mwait.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1290453180 0 # Node ID 0cc4ed1ce1f34ce442ed4da106e555931c895395 # Parent 899131a8f9d2b99acc4bbe18593952d30446e71b x86: Check for MWAIT in CPUID before using it in ACPI idle code. Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -717,7 +717,8 @@ static void set_cx( { case ACPI_ADR_SPACE_FIXED_HARDWARE: if ( xen_cx->reg.bit_width == VENDOR_INTEL && - xen_cx->reg.bit_offset == NATIVE_CSTATE_BEYOND_HALT ) + xen_cx->reg.bit_offset == NATIVE_CSTATE_BEYOND_HALT && + boot_cpu_has(X86_FEATURE_MWAIT) ) cx->entry_method = ACPI_CSTATE_EM_FFH; else cx->entry_method = ACPI_CSTATE_EM_HALT; ++++++ 22417-vpmu-nehalem.patch ++++++ References: bnc#655438 # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1290453394 0 # Node ID c0c1f5f0745e25af6f8b4a1006637d98a8d63581 # Parent 0cc4ed1ce1f34ce442ed4da106e555931c895395 x86 hvm: Fix VPMU issue on Nehalem cpus Fix an issue on Nehalem cpus where performance counter overflows may lead to endless interrupt loops on this cpu. Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com> # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1290173202 0 # Node ID b7ed352fa6100104374000cdbd845bbfc6478f08 # Parent 437576a0f2026ded6dcc4b11558714dad1d1d042 VPMU: Add the Intel CPU X7542 to the list of supported prcocessors Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com> --- a/xen/arch/x86/hvm/vmx/vpmu.c +++ b/xen/arch/x86/hvm/vmx/vpmu.c @@ -96,6 +96,7 @@ void vpmu_initialise(struct vcpu *v) case 23: case 26: case 29: + case 46: vpmu->arch_vpmu_ops = &core2_vpmu_ops; break; } --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c @@ -35,6 +35,68 @@ #include <asm/hvm/vmx/vpmu.h> #include <asm/hvm/vmx/vpmu_core2.h> +/* + * QUIRK to workaround an issue on Nehalem processors currently seen + * on family 6 cpus E5520 (model 26) and X7542 (model 46). + * The issue leads to endless PMC interrupt loops on the processor. + * If the interrupt handler is running and a pmc reaches the value 0, this + * value remains forever and it triggers immediately a new interrupt after + * finishing the handler. + * A workaround is to read all flagged counters and if the value is 0 write + * 1 (or another value != 0) into it. + * There exist no errata and the real cause of this behaviour is unknown. + */ +bool_t __read_mostly is_pmc_quirk; + +static void check_pmc_quirk(void) +{ + u8 family = current_cpu_data.x86; + u8 cpu_model = current_cpu_data.x86_model; + is_pmc_quirk = 0; + if ( family == 6 ) + { + if ( cpu_model == 46 || cpu_model == 26 ) + is_pmc_quirk = 1; + } +} + +static int core2_get_pmc_count(void); +static void handle_pmc_quirk(u64 msr_content) +{ + int num_gen_pmc = core2_get_pmc_count(); + int num_fix_pmc = 3; + int i; + u64 val; + + if ( !is_pmc_quirk ) + return; + + val = msr_content; + for ( i = 0; i < num_gen_pmc; i++ ) + { + if ( val & 0x1 ) + { + u64 cnt; + rdmsrl(MSR_P6_PERFCTR0 + i, cnt); + if ( cnt == 0 ) + wrmsrl(MSR_P6_PERFCTR0 + i, 1); + } + val >>= 1; + } + val = msr_content >> 32; + for ( i = 0; i < num_fix_pmc; i++ ) + { + if ( val & 0x1 ) + { + u64 cnt; + rdmsrl(MSR_CORE_PERF_FIXED_CTR0 + i, cnt); + if ( cnt == 0 ) + wrmsrl(MSR_CORE_PERF_FIXED_CTR0 + i, 1); + } + val >>= 1; + } +} + u32 core2_counters_msr[] = { MSR_CORE_PERF_FIXED_CTR0, MSR_CORE_PERF_FIXED_CTR1, @@ -497,6 +559,10 @@ static int core2_vpmu_do_interrupt(struc rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, msr_content); if ( !msr_content ) return 0; + + if ( is_pmc_quirk ) + handle_pmc_quirk(msr_content); + core2_vpmu_cxt->global_ovf_status |= msr_content; msr_content = 0xC000000700000000 | ((1 << core2_get_pmc_count()) - 1); wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content); @@ -518,6 +584,7 @@ static int core2_vpmu_do_interrupt(struc static void core2_vpmu_initialise(struct vcpu *v) { + check_pmc_quirk(); } static void core2_vpmu_destroy(struct vcpu *v) ++++++ 22431-p2m-remove-bug-check.patch ++++++ # HG changeset patch # User Tim Deegan <Tim.Deegan@citrix.com> # Date 1290594003 0 # Node ID 79b71c77907b80772ee8cba0c5bbf8e444e61226 # Parent e5c4e925e1bd15baeadc0817dcceb5fff54b8a74 x86/mm: remove incorrect BUG_ON. This BUG_ON tests a property of an effectively random PFN in the guest, and is explicitly _not_ seeing the MFN that's known to be owned. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -2186,9 +2186,6 @@ guest_physmap_add_entry(struct domain *d P2M_DEBUG("aliased! mfn=%#lx, old gfn=%#lx, new gfn=%#lx\n", mfn + i, ogfn, gfn + i); omfn = gfn_to_mfn_query(d, ogfn, &ot); - /* If we get here, we know the local domain owns the page, - so it can't have been grant mapped in. */ - BUG_ON( p2m_is_grant(ot) ); if ( p2m_is_ram(ot) ) { ASSERT(mfn_valid(omfn)); ++++++ 22448-x86_64-gdt-ldt-fault-filter.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291041272 0 # Node ID 5cd9612db2bba51f63ff7897aca4c72cc4b8e8c2 # Parent aba70e59a90dcb0cacc2c6834a6ce19d03d88601 x86-64: don't crash Xen upon direct pv guest access to GDT/LDT mapping area handle_gdt_ldt_mapping_fault() is intended to deal with indirect accesses (i.e. those caused by descriptor loads) to the GDT/LDT mapping area only. While for 32-bit segment limits indeed prevent the function being entered for direct accesses (i.e. a #GP fault will be raised even before the address translation gets done, on 64-bit even user mode accesses would lead to control reaching the BUG_ON() at the beginning of that function. Fortunately the fix is simple: Since the guest kernel runs in ring 3, any guest direct access will have the "user mode" bit set, whereas descriptor loads always do the translations to access the actual descriptors as kernel mode ones. Signed-off-by: Jan Beulich <jbeulich@novell.com> Further, relax the BUG_ON() in handle_gdt_ldt_mapping_fault() to a check-and-bail. This avoids any problems in future, if we don't execute x86_64 guest kernels in ring 3 (e.g., because we use a lightweight HVM container). Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1051,8 +1051,14 @@ static int handle_gdt_ldt_mapping_fault( unsigned int is_ldt_area = (offset >> (GDT_LDT_VCPU_VA_SHIFT-1)) & 1; unsigned int vcpu_area = (offset >> GDT_LDT_VCPU_VA_SHIFT); - /* Should never fault in another vcpu's area. */ - BUG_ON(vcpu_area != curr->vcpu_id); + /* + * If the fault is in another vcpu's area, it cannot be due to + * a GDT/LDT descriptor load. Thus we can reasonably exit immediately, and + * indeed we have to since map_ldt_shadow_page() works correctly only on + * accesses to a vcpu's own area. + */ + if ( vcpu_area != curr->vcpu_id ) + return 0; /* Byte offset within the gdt/ldt sub-area. */ offset &= (1UL << (GDT_LDT_VCPU_VA_SHIFT-1)) - 1UL; @@ -1223,7 +1229,7 @@ static int fixup_page_fault(unsigned lon if ( unlikely(IN_HYPERVISOR_RANGE(addr)) ) { - if ( !(regs->error_code & PFEC_reserved_bit) && + if ( !(regs->error_code & (PFEC_user_mode | PFEC_reserved_bit)) && (addr >= GDT_LDT_VIRT_START) && (addr < GDT_LDT_VIRT_END) ) return handle_gdt_ldt_mapping_fault( addr - GDT_LDT_VIRT_START, regs); ++++++ 22451-hvm-cap-clobber.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291116848 0 # Node ID 8420b82c22c2cad54860ffdbe8bcec21c65c86be # Parent d281061e6ec06bbbf8e2b0fadbeb9d1a04bc32e2 x86 hvm: Do not overwrite boot-cpu capability data on VMX/SVM startup. Apparently required back in the earliest days of Xen, we now properly initialise CPU capabilities early during bootstrap. Re-writing capability data later now causes problems if specific features have been deliberately masked out. Thanks to Weidong Han at Intel for finding such a bug where XSAVE feature is masked out by default, but then erroneously written back during VMX initialisation. This would cause memory corruption problems during boot for XSAVE-capable systems. Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -915,9 +915,6 @@ void start_svm(struct cpuinfo_x86 *c) return; } - /* Xen does not fill x86_capability words except 0. */ - boot_cpu_data.x86_capability[5] = cpuid_ecx(0x80000001); - if ( !test_bit(X86_FEATURE_SVME, &boot_cpu_data.x86_capability) ) return; --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1433,9 +1433,6 @@ void start_vmx(void) return; } - /* Xen does not fill x86_capability words except 0. */ - boot_cpu_data.x86_capability[4] = cpuid_ecx(1); - if ( !test_bit(X86_FEATURE_VMXE, &boot_cpu_data.x86_capability) ) return; ++++++ 22452-x86-irq-migrate-directed-eoi.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291234227 0 # Node ID 62bf12040b0f4d802dc7e1cd61294776c8a41a89 # Parent 8420b82c22c2cad54860ffdbe8bcec21c65c86be x86: fix IRQ migration when using directed EOI (broken with c/s 20465) In directed-EOI mode, there is no chance to do the migration in mask_and_ack_level_ioapic_irq(), as the remote IRR bit can't possibly be clear after issuing the EOI to the LAPIC. Consequently, there's no point to even try. Instead, migration must be done in end_level_ioapic_irq(), and it requires masking the interrupt source prior to issuing the EOI to the IO-APIC. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1642,11 +1642,14 @@ static void mask_and_ack_level_ioapic_ir ack_APIC_irq(); + if ( directed_eoi_enabled ) + return; + if ((irq_desc[irq].status & IRQ_MOVE_PENDING) && !io_apic_level_ack_pending(irq)) - move_native_irq(irq); + move_masked_irq(irq); - if (!directed_eoi_enabled && !(v & (1 << (i & 0x1f)))) { + if ( !(v & (1 << (i & 0x1f))) ) { atomic_inc(&irq_mis_count); spin_lock(&ioapic_lock); __edge_IO_APIC_irq(irq); @@ -1662,12 +1665,22 @@ static void end_level_ioapic_irq (unsign if ( !ioapic_ack_new ) { - if ( irq_desc[irq].status & IRQ_DISABLED ) - return; - if ( directed_eoi_enabled ) + { + if ( !(irq_desc[irq].status & (IRQ_DISABLED|IRQ_MOVE_PENDING)) ) + { + eoi_IO_APIC_irq(irq); + return; + } + + mask_IO_APIC_irq(irq); eoi_IO_APIC_irq(irq); - else + if ( (irq_desc[irq].status & IRQ_MOVE_PENDING) && + !io_apic_level_ack_pending(irq) ) + move_masked_irq(irq); + } + + if ( !(irq_desc[irq].status & IRQ_DISABLED) ) unmask_IO_APIC_irq(irq); return; ++++++ 22466-x86-sis-apic-bug.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291746724 0 # Node ID bfd13358b8bf3a6ca49702d773435a67f1ea5551 # Parent d4b35162b3a11f7d9c28501192b7e231609e561d x86: remove BUG_ON() from QUIRK_IOAPIC_*_REGSEL handler References: bnc#657692 Since (non-pvops, 32-bit only up to 2.6.27) Linux would report "BAD" unconditionally on all SiS chipset versions (it only looks for a PCI device at 0000:00:00.0 with SiS as the vendor), we must not crash if the report on a 64-bit hypervisor doesn't match the #define (which is zero). While we could honor the quirk indication even on 64-bit, it doesn't seem worthwhile, as there's no evidence that newer SiS chipsets (supporting 64-bit CPUs) are actually affected. This should also address bug 1687 (mis-reported, however, afaict). Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -192,7 +192,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe dprintk(XENLOG_INFO, "Domain 0 says that IO-APIC REGSEL is %s\n", sis_apic_bug ? "bad" : "good"); #else - BUG_ON(sis_apic_bug != (quirk_id == QUIRK_IOAPIC_BAD_REGSEL)); + if ( sis_apic_bug != (quirk_id == QUIRK_IOAPIC_BAD_REGSEL) ) + dprintk(XENLOG_WARNING, + "Domain 0 thinks that IO-APIC REGSEL is %s\n", + sis_apic_bug ? "good" : "bad"); #endif break; default: ++++++ 22470-vlapic-tick-loss.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291883699 0 # Node ID 0c97247c64d61511acff37d1903cb304b387f397 # Parent 84a72f957fe9e1a5af3dfb8f53334faa555e22f8 x86:vlapic: Fix possible guest tick losing after save/restore Guest vcpu may totally lose all ticks if the vlapic->pt.irq was not restored during save/restore process. Fix it. Signed-off-by: Wei Gang <gang.wei@intel.com> --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -863,12 +863,12 @@ static void lapic_rearm(struct vlapic *s unsigned long tmict = vlapic_get_reg(s, APIC_TMICT); uint64_t period; + s->pt.irq = vlapic_get_reg(s, APIC_LVTT) & APIC_VECTOR_MASK; if ( (tmict = vlapic_get_reg(s, APIC_TMICT)) == 0 ) return; period = ((uint64_t)APIC_BUS_CYCLE_NS * (uint32_t)tmict * s->hw.timer_divisor); - s->pt.irq = vlapic_get_reg(s, APIC_LVTT) & APIC_VECTOR_MASK; create_periodic_time(vlapic_vcpu(s), &s->pt, period, vlapic_lvtt_period(s) ? period : 0, s->pt.irq, vlapic_pt_cb, ++++++ 22475-x2apic-cleanup.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291922374 0 # Node ID d9fc83a64a82624e24876250dd88b2cd9528d266 # Parent 49d2aa5cee4ecc2411d8d638e4ee32c10e9b2761 x86: x2apic: Large cleanup References: bnc#656369, bnc#658704 Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -67,12 +67,12 @@ static int enable_local_apic __initdata */ int apic_verbosity; +static int opt_x2apic = 1; +boolean_param("x2apic", opt_x2apic); + int x2apic_enabled __read_mostly = 0; int directed_eoi_enabled __read_mostly = 0; -/* x2APIC is enabled in BIOS */ -static int x2apic_preenabled; - /* * The following vectors are part of the Linux architecture, there * is no hardware IRQ pin equivalent for them, they are triggered @@ -944,30 +944,24 @@ no_apic: return -1; } -void check_x2apic_preenabled(void) +void x2apic_setup(void) { + struct IO_APIC_route_entry **ioapic_entries = NULL; u32 lo, hi; - if ( !x2apic_is_available() ) - return; - - rdmsr(MSR_IA32_APICBASE, lo, hi); - if ( lo & MSR_IA32_APICBASE_EXTD ) + if ( smp_processor_id() != 0 ) { - printk("x2APIC mode is already enabled by BIOS.\n"); - x2apic_preenabled = 1; - x2apic_enabled = 1; + if ( x2apic_enabled ) + __enable_x2apic(); + return; } -} -static void enable_bsp_x2apic(void) -{ - struct IO_APIC_route_entry **ioapic_entries = NULL; - const struct genapic *x2apic_genapic = NULL; - - ASSERT(smp_processor_id() == 0); + if ( !cpu_has_x2apic ) + return; - if ( x2apic_preenabled ) + /* Check whether x2apic mode was already enabled by the BIOS. */ + rdmsr(MSR_IA32_APICBASE, lo, hi); + if ( lo & MSR_IA32_APICBASE_EXTD ) { /* * Interrupt remapping should be also enabled by BIOS when @@ -977,39 +971,33 @@ static void enable_bsp_x2apic(void) if ( !intremap_enabled() ) panic("Interrupt remapping is not enabled by BIOS while " "x2APIC is already enabled by BIOS!\n"); + + printk("x2APIC mode is already enabled by BIOS.\n"); + x2apic_enabled = 1; } - x2apic_genapic = apic_x2apic_probe(); - if ( x2apic_genapic ) - genapic = x2apic_genapic; - else + if ( !opt_x2apic ) { - if ( x2apic_cmdline_disable() ) + if ( !x2apic_enabled ) { - if ( x2apic_preenabled ) - { - /* Ignore x2apic=0, and set default x2apic mode */ - genapic = &apic_x2apic_cluster; - printk("x2APIC: already enabled by BIOS, ignore x2apic=0.\n"); - } - else - { - printk("Not enable x2APIC due to x2apic=0 is set.\n"); - return; - } + printk("Not enabling x2APIC: disabled by cmdline.\n"); + return; } - else + printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n"); + } + + if ( !iommu_supports_eim() ) + { + if ( !x2apic_enabled ) { - if ( x2apic_preenabled ) - panic("x2APIC: already enabled by BIOS, but " - "iommu_supports_eim failed!\n"); - printk("Not enabling x2APIC: depends oniommu_supports_eim\n"); + printk("Not enabling x2APIC: depends on iommu_supports_eim.\n"); return; } + panic("x2APIC: already enabled by BIOS, but " + "iommu_supports_eim failed!\n"); } - ioapic_entries = alloc_ioapic_entries(); - if ( !ioapic_entries ) + if ( (ioapic_entries = alloc_ioapic_entries()) == NULL ) { printk("Allocate ioapic_entries failed\n"); goto out; @@ -1031,13 +1019,13 @@ static void enable_bsp_x2apic(void) goto restore_out; } - x2apic_enabled = 1; + genapic = apic_x2apic_probe(); printk("Switched to APIC driver %s.\n", genapic->name); - if ( !x2apic_preenabled ) + if ( !x2apic_enabled ) { + x2apic_enabled = 1; __enable_x2apic(); - printk("x2APIC mode enabled.\n"); } restore_out: @@ -1049,24 +1037,6 @@ out: free_ioapic_entries(ioapic_entries); } -static void enable_ap_x2apic(void) -{ - ASSERT(smp_processor_id() != 0); - - /* APs only enable x2apic when BSP did so. */ - BUG_ON(!x2apic_enabled); - - __enable_x2apic(); -} - -void enable_x2apic(void) -{ - if ( smp_processor_id() == 0 ) - enable_bsp_x2apic(); - else - enable_ap_x2apic(); -} - void __init init_apic_mappings(void) { unsigned long apic_phys; --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -250,8 +250,8 @@ static void __init early_cpu_detect(void c->x86 = 4; if (c->cpuid_level >= 0x00000001) { - u32 junk, tfms, cap0, misc; - cpuid(0x00000001, &tfms, &misc, &junk, &cap0); + u32 cap4, tfms, cap0, misc; + cpuid(0x00000001, &tfms, &misc, &cap4, &cap0); c->x86 = (tfms >> 8) & 15; c->x86_model = (tfms >> 4) & 15; if (c->x86 == 0xf) @@ -260,9 +260,12 @@ static void __init early_cpu_detect(void c->x86_model += ((tfms >> 16) & 0xF) << 4; c->x86_mask = tfms & 15; cap0 &= ~cleared_caps[0]; + cap4 &= ~cleared_caps[4]; if (cap0 & (1<<19)) c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; - c->x86_capability[0] = cap0; /* Added for Xen bootstrap */ + /* Leaf 0x1 capabilities filled in early for Xen. */ + c->x86_capability[0] = cap0; + c->x86_capability[4] = cap4; } } --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -23,89 +23,44 @@ #include <xen/smp.h> #include <asm/mach-default/mach_mpparse.h> -static int x2apic = 1; -boolean_param("x2apic", x2apic); - -static int x2apic_phys; /* By default we use logical cluster mode. */ +static int x2apic_phys; /* By default we use logical cluster mode. */ boolean_param("x2apic_phys", x2apic_phys); -int x2apic_cmdline_disable(void) -{ - return (x2apic == 0); -} - -static int probe_x2apic_phys(void) +static void init_apic_ldr_x2apic_phys(void) { - return x2apic && x2apic_phys && x2apic_is_available() && - iommu_supports_eim(); } -static int probe_x2apic_cluster(void) -{ - return x2apic && !x2apic_phys && x2apic_is_available() && - iommu_supports_eim(); -} - -const struct genapic apic_x2apic_phys = { - APIC_INIT("x2apic_phys", probe_x2apic_phys), - GENAPIC_X2APIC_PHYS -}; - -const struct genapic apic_x2apic_cluster = { - APIC_INIT("x2apic_cluster", probe_x2apic_cluster), - GENAPIC_X2APIC_CLUSTER -}; - -const struct genapic *apic_x2apic_probe(void) -{ - if ( !x2apic || !x2apic_is_available() ) - return NULL; - - if ( !iommu_supports_eim() ) - return NULL; - - if ( x2apic_phys ) - return &apic_x2apic_phys; - else - return &apic_x2apic_cluster; -} - -void init_apic_ldr_x2apic_phys(void) -{ - return; -} - -void init_apic_ldr_x2apic_cluster(void) +static void init_apic_ldr_x2apic_cluster(void) { int cpu = smp_processor_id(); cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR); } -void clustered_apic_check_x2apic(void) + +static void clustered_apic_check_x2apic(void) { - return; } -cpumask_t target_cpus_x2apic(void) +static cpumask_t target_cpus_x2apic(void) { return cpu_online_map; } -cpumask_t vector_allocation_domain_x2apic(int cpu) +static cpumask_t vector_allocation_domain_x2apic(int cpu) { return cpumask_of_cpu(cpu); } -unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask) +static unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask) { return cpu_physical_id(first_cpu(cpumask)); } -unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask) +static unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask) { return cpu_2_logical_apicid[first_cpu(cpumask)]; } -void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector) +static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector) { unsigned int cpu, cfg; unsigned long flags; @@ -132,7 +87,7 @@ void send_IPI_mask_x2apic_phys(const cpu local_irq_restore(flags); } -void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector) +static void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector) { unsigned int cpu, cfg; unsigned long flags; @@ -148,3 +103,34 @@ void send_IPI_mask_x2apic_cluster(const local_irq_restore(flags); } + +static const struct genapic apic_x2apic_phys = { + APIC_INIT("x2apic_phys", NULL), + .int_delivery_mode = dest_Fixed, + .int_dest_mode = 0 /* physical delivery */, + .init_apic_ldr = init_apic_ldr_x2apic_phys, + .clustered_apic_check = clustered_apic_check_x2apic, + .target_cpus = target_cpus_x2apic, + .vector_allocation_domain = vector_allocation_domain_x2apic, + .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys, + .send_IPI_mask = send_IPI_mask_x2apic_phys, + .send_IPI_self = send_IPI_self_x2apic +}; + +static const struct genapic apic_x2apic_cluster = { + APIC_INIT("x2apic_cluster", NULL), + .int_delivery_mode = dest_LowestPrio, + .int_dest_mode = 1 /* logical delivery */, + .init_apic_ldr = init_apic_ldr_x2apic_cluster, + .clustered_apic_check = clustered_apic_check_x2apic, + .target_cpus = target_cpus_x2apic, + .vector_allocation_domain = vector_allocation_domain_x2apic, + .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster, + .send_IPI_mask = send_IPI_mask_x2apic_cluster, + .send_IPI_self = send_IPI_self_x2apic +}; + +const struct genapic *apic_x2apic_probe(void) +{ + return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; +} --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1006,9 +1006,6 @@ void __init __start_xen(unsigned long mb tboot_probe(); - /* Check if x2APIC is already enabled in BIOS */ - check_x2apic_preenabled(); - /* Unmap the first page of CPU0's stack. */ memguard_guard_stack(cpu0_stack); @@ -1039,8 +1036,7 @@ void __init __start_xen(unsigned long mb init_apic_mappings(); - if ( x2apic_is_available() ) - enable_x2apic(); + x2apic_setup(); percpu_free_unused_areas(); --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -325,8 +325,7 @@ void __devinit smp_callin(void) */ wait_for_init_deassert(&init_deasserted); - if ( x2apic_enabled ) - enable_x2apic(); + x2apic_setup(); /* * (This works even if the APIC is not enabled.) --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -129,15 +129,10 @@ int iommu_supports_eim(void) struct acpi_drhd_unit *drhd; int apic; - if ( !iommu_enabled || !iommu_qinval || !iommu_intremap ) + if ( !iommu_enabled || !iommu_qinval || !iommu_intremap || + list_empty(&acpi_drhd_units) ) return 0; - if ( list_empty(&acpi_drhd_units) ) - { - dprintk(XENLOG_WARNING VTDPREFIX, "VT-d is not supported\n"); - return 0; - } - /* We MUST have a DRHD unit for each IOAPIC. */ for ( apic = 0; apic < nr_ioapics; apic++ ) if ( !ioapic_to_drhd(IO_APIC_ID(apic)) ) --- a/xen/include/asm-x86/apic.h +++ b/xen/include/asm-x86/apic.h @@ -25,21 +25,8 @@ extern int apic_verbosity; extern int x2apic_enabled; extern int directed_eoi_enabled; -extern void check_x2apic_preenabled(void); -extern int x2apic_cmdline_disable(void); -extern void enable_x2apic(void); - -static __inline int x2apic_is_available(void) -{ - unsigned int op = 1, eax, ecx; - - asm ( "cpuid" - : "=a" (eax), "=c" (ecx) - : "0" (op) - : "bx", "dx" ); - - return (ecx & (1U << 21)); -} +void x2apic_setup(void); +const struct genapic *apic_x2apic_probe(void); /* * Define the default level of output to be very little --- a/xen/include/asm-x86/genapic.h +++ b/xen/include/asm-x86/genapic.h @@ -49,8 +49,6 @@ struct genapic { APICFUNC(acpi_madt_oem_check) extern const struct genapic *genapic; -extern const struct genapic apic_x2apic_phys; -extern const struct genapic apic_x2apic_cluster; void init_apic_ldr_flat(void); void clustered_apic_check_flat(void); @@ -70,39 +68,6 @@ cpumask_t vector_allocation_domain_flat( .send_IPI_mask = send_IPI_mask_flat, \ .send_IPI_self = send_IPI_self_flat -const struct genapic *apic_x2apic_probe(void); -void init_apic_ldr_x2apic_phys(void); -void init_apic_ldr_x2apic_cluster(void); -void clustered_apic_check_x2apic(void); -cpumask_t target_cpus_x2apic(void); -unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask); -unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask); -void send_IPI_mask_x2apic_phys(const cpumask_t *mask, int vector); -void send_IPI_mask_x2apic_cluster(const cpumask_t *mask, int vector); -void send_IPI_self_x2apic(int vector); -cpumask_t vector_allocation_domain_x2apic(int cpu); -#define GENAPIC_X2APIC_PHYS \ - .int_delivery_mode = dest_Fixed, \ - .int_dest_mode = 0 /* physical delivery */, \ - .init_apic_ldr = init_apic_ldr_x2apic_phys, \ - .clustered_apic_check = clustered_apic_check_x2apic, \ - .target_cpus = target_cpus_x2apic, \ - .vector_allocation_domain = vector_allocation_domain_x2apic, \ - .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys, \ - .send_IPI_mask = send_IPI_mask_x2apic_phys, \ - .send_IPI_self = send_IPI_self_x2apic - -#define GENAPIC_X2APIC_CLUSTER \ - .int_delivery_mode = dest_LowestPrio, \ - .int_dest_mode = 1 /* logical delivery */, \ - .init_apic_ldr = init_apic_ldr_x2apic_cluster, \ - .clustered_apic_check = clustered_apic_check_x2apic, \ - .target_cpus = target_cpus_x2apic, \ - .vector_allocation_domain = vector_allocation_domain_x2apic, \ - .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster, \ - .send_IPI_mask = send_IPI_mask_x2apic_cluster, \ - .send_IPI_self = send_IPI_self_x2apic - void init_apic_ldr_phys(void); void clustered_apic_check_phys(void); cpumask_t target_cpus_phys(void); @@ -121,4 +86,6 @@ cpumask_t vector_allocation_domain_phys( .send_IPI_mask = send_IPI_mask_phys, \ .send_IPI_self = send_IPI_self_phys +void send_IPI_self_x2apic(int vector); + #endif ++++++ 22484-vlapic-tmcct-periodic.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1291999745 0 # Node ID 3b3fce9050b9b14f3a11123f6943998413ea7e7e # Parent 901c118b363e978566775f9d118b4f2f15598212 hvm vlapic: Fix tmcct read logic when in periodic mode. Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -428,12 +428,19 @@ int vlapic_ipi( static uint32_t vlapic_get_tmcct(struct vlapic *vlapic) { struct vcpu *v = current; - uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT); + uint32_t tmcct = 0, tmict = vlapic_get_reg(vlapic, APIC_TMICT); uint64_t counter_passed; counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update) - / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor); - tmcct = tmict - counter_passed; + / (APIC_BUS_CYCLE_NS * vlapic->hw.timer_divisor)); + + if ( tmict != 0 ) + { + if ( vlapic_lvtt_period(vlapic) ) + counter_passed %= tmict; + if ( counter_passed < tmict ) + tmcct = tmict - counter_passed; + } HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "timer initial count %d, timer current count %d, " ++++++ 22504-iommu-dom0-holes.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292320377 0 # Node ID fd4cbfbbd83e6091a343844eae1da1468f54b72b # Parent ab785e37499c8cdadd1fd5e4ab1bfbbacebf358b x86/iommu: don't map RAM holes above 4G References: bnc#658163 Matching the comment in iommu_set_dom0_mapping(), map only actual RAM from the address range starting at 4G. It's not clear though whether that comment is actually correct (which is why I'm sending this as RFC), but it is certain that on systems with sparse physical memory map we're currently wasting a potentially significant amount of memory for setting up IOMMU page tables that will never be used. The main question is what happens for MMIO ranges living above 4G. Of course, the same issue would currently exist for any such ranges sitting beyond the end of RAM. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -239,8 +239,16 @@ static void amd_iommu_dom0_init(struct d if ( !iommu_passthrough && !need_iommu(d) ) { /* Set up 1:1 page table for dom0 */ - for ( i = 0; i < max_page; i++ ) - amd_iommu_map_page(d, i, i, IOMMUF_readable|IOMMUF_writable); + for ( i = 0; i < max_pdx; i++ ) + { + unsigned long pfn = pdx_to_pfn(i); + + /* + * XXX Should we really map all non-RAM (above 4G)? Minimally + * a pfn_valid() check would seem desirable here. + */ + amd_iommu_map_page(d, pfn, pfn, IOMMUF_readable|IOMMUF_writable); + } } amd_iommu_setup_dom0_devices(d); --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ b/xen/drivers/passthrough/vtd/x86/vtd.c @@ -128,14 +128,14 @@ void hvm_dpci_isairq_eoi(struct domain * void iommu_set_dom0_mapping(struct domain *d) { - u64 i, j, tmp, max_pfn; + unsigned long i, j, tmp, top; extern int xen_in_range(unsigned long mfn); BUG_ON(d->domain_id != 0); - max_pfn = max_t(u64, max_page, 0x100000000ull >> PAGE_SHIFT); + top = max(max_pdx, pfn_to_pdx(0xffffffffUL >> PAGE_SHIFT) + 1); - for ( i = 0; i < max_pfn; i++ ) + for ( i = 0; i < top; i++ ) { /* * Set up 1:1 mapping for dom0. Default to use only conventional RAM @@ -143,18 +143,23 @@ void iommu_set_dom0_mapping(struct domai * inclusive mapping maps in everything below 4GB except unusable * ranges. */ - if ( !page_is_ram_type(i, RAM_TYPE_CONVENTIONAL) && - (!iommu_inclusive_mapping || - page_is_ram_type(i, RAM_TYPE_UNUSABLE)) ) + unsigned long pfn = pdx_to_pfn(i); + + if ( pfn > (0xffffffffUL >> PAGE_SHIFT) ? + (!mfn_valid(pfn) || + !page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL)) : + iommu_inclusive_mapping ? + page_is_ram_type(pfn, RAM_TYPE_UNUSABLE) : + !page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL) ) continue; /* Exclude Xen bits */ - if ( xen_in_range(i) ) + if ( xen_in_range(pfn) ) continue; tmp = 1 << (PAGE_SHIFT - PAGE_SHIFT_4K); for ( j = 0; j < tmp; j++ ) - iommu_map_page(d, (i*tmp+j), (i*tmp+j), + iommu_map_page(d, pfn * tmp + j, pfn * tmp + j, IOMMUF_readable|IOMMUF_writable); if (!(i & (0xfffff >> (PAGE_SHIFT - PAGE_SHIFT_4K)))) ++++++ 22506-x86-iommu-dom0-estimate.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292320450 0 # Node ID 618ba64260faf45e6ec391582099d7388f013e81 # Parent 72326371ae8106b91da0ca6b0436dd2b6478b7a7 x86/iommu: account for necessary allocations when calculating Dom0's initial allocation size References: bnc#658163 As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0 happen only after it got all of its memory allocated, and hence the reserve (mainly for setting up its swiotlb) may get exhausted without accounting for the necessary allocations up front. While not precise, the estimate has been found to be within a couple of pages for the systems it got tested on. For the calculation to be reasonably correct, this depends on the patch titled "x86/iommu: don't map RAM holes above 4G" sent out yesterday. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -188,6 +188,15 @@ static unsigned long __init compute_dom0 if ( is_pv_32on64_domain(d) ) avail -= opt_dom0_max_vcpus - 1; + /* Reserve memory for iommu_dom0_init() (rough estimate). */ + if ( iommu_enabled ) + { + unsigned int s; + + for ( s = 9; s < BITS_PER_LONG; s += 9 ) + avail -= max_pdx >> s; + } + /* * If domain 0 allocation isn't specified, reserve 1/16th of available * memory for things like DMA buffers. This reservation is clamped to ++++++ 22526-ept-access-once.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292410025 0 # Node ID 7a5ee380041707177ca9c78e800095d1f5f3d373 # Parent 01f3b350902385627d1fa9e8cd1c231953e7610c ept: Remove lock in ept_get_entry, replace with access-once semantics. This mirrors the RVI/shadow situation, where p2m read access is lockless because it's done in the hardware (linear map of the p2m table). This fixes the original bug (call it bug A) without introducing bug B (a deadlock). Bug A was caused by a race when updating p2m entries: between testing if it's valid, and testing if it's populate-on-demand, it may have been changed from populate-on-demand to valid. My original patch simply introduced a lock into ept_get_entry, but that caused bug B, caused by circular locking order: p2m_change_type [grabs p2m lock] -> set_p2m_entry -> ept_set_entry -> ept_set_middle_level -> p2m_alloc [grabs hap lock] write cr4 -> hap_update_paging_modes [grabes hap lock] -> hap_update_cr3 -> gfn_to_mfn -> ept_get_entry -> [grabs p2m lock] Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> --- a/xen/arch/x86/mm/hap/p2m-ept.c +++ b/xen/arch/x86/mm/hap/p2m-ept.c @@ -137,7 +137,7 @@ static int ept_next_level(struct domain ept_entry_t **table, unsigned long *gfn_remainder, u32 shift) { - ept_entry_t *ept_entry; + ept_entry_t *ept_entry, e; ept_entry_t *next; u32 index; @@ -145,9 +145,11 @@ static int ept_next_level(struct domain ept_entry = (*table) + index; - if ( !is_epte_present(ept_entry) ) + e=*ept_entry; + + if ( !is_epte_present(&e) ) { - if ( ept_entry->avail1 == p2m_populate_on_demand ) + if ( e.avail1 == p2m_populate_on_demand ) return GUEST_TABLE_POD_PAGE; if ( read_only ) @@ -155,15 +157,17 @@ static int ept_next_level(struct domain if ( !ept_set_middle_entry(d, ept_entry) ) return GUEST_TABLE_MAP_FAILED; + else + e=*ept_entry; } /* The only time sp would be set here is if we had hit a superpage */ - if ( is_epte_superpage(ept_entry) ) + if ( is_epte_superpage(&e) ) return GUEST_TABLE_SUPER_PAGE; else { *gfn_remainder &= (1UL << shift) - 1; - next = map_domain_page(ept_entry->mfn); + next = map_domain_page(e.mfn); unmap_domain_page(*table); *table = next; return GUEST_TABLE_NORMAL_PAGE; @@ -235,35 +239,39 @@ ept_set_entry(struct domain *d, unsigned if ( mfn_valid(mfn_x(mfn)) || direct_mmio || p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_in_start) ) { - ept_entry->emt = epte_get_entry_emt(d, gfn, mfn, &ipat, + ept_entry_t new_entry; + + new_entry.emt = epte_get_entry_emt(d, gfn, mfn, &ipat, direct_mmio); - ept_entry->ipat = ipat; - ept_entry->sp = order ? 1 : 0; + new_entry.ipat = ipat; + new_entry.sp = order ? 1 : 0; if ( ret == GUEST_TABLE_SUPER_PAGE ) { - if ( ept_entry->mfn == (mfn_x(mfn) - offset) ) + if ( new_entry.mfn == (mfn_x(mfn) - offset) ) need_modify_vtd_table = 0; else - ept_entry->mfn = mfn_x(mfn) - offset; + new_entry.mfn = mfn_x(mfn) - offset; - if ( (ept_entry->avail1 == p2m_ram_logdirty) + if ( (new_entry.avail1 == p2m_ram_logdirty) && (p2mt == p2m_ram_rw) ) for ( i = 0; i < 512; i++ ) paging_mark_dirty(d, mfn_x(mfn) - offset + i); } else { - if ( ept_entry->mfn == mfn_x(mfn) ) + if ( new_entry.mfn == mfn_x(mfn) ) need_modify_vtd_table = 0; else - ept_entry->mfn = mfn_x(mfn); + new_entry.mfn = mfn_x(mfn); } - ept_entry->avail1 = p2mt; - ept_entry->avail2 = 0; + new_entry.avail1 = p2mt; + new_entry.avail2 = 0; + + ept_p2m_type_to_flags(&new_entry, p2mt); - ept_p2m_type_to_flags(ept_entry, p2mt); + ept_entry->epte = new_entry.epte; } else ept_entry->epte = 0; ++++++ 22533-x86-32bit-apicid.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292413934 0 # Node ID 548c808be2a6f166657ce7cfb86df7a296a9526a # Parent c0662cb08260d831ae8d211ba16fc7038cb889b6 x86: mpparse and cstate need to use 32bit apic id References: bnc#656369, bnc#658704 Instead of going with mpc_config_processor struct. that field ony have 8 bits. We should not change that struct, because it is shared with mptable. Also need to increase MAX_APICS. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Rather than using a fixed value of 512, make this scale with NR_CPUS (which obviously still doesn't cover all theoretically possible systems, but at least allows some build time control). Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -742,7 +742,7 @@ static void set_cx( int get_cpu_id(u8 acpi_id) { int i; - u8 apic_id; + u32 apic_id; apic_id = x86_acpiid_to_apicid[acpi_id]; if ( apic_id == 0xff ) --- a/xen/arch/x86/mpparse.c +++ b/xen/arch/x86/mpparse.c @@ -99,7 +99,8 @@ static int mpc_record; static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata; /* Return xen's logical cpu_id of the new added cpu or <0 if error */ -static int __devinit MP_processor_info (struct mpc_config_processor *m) +static int __devinit MP_processor_info_x(struct mpc_config_processor *m, + u32 apicidx) { int ver, apicid, cpu = 0; physid_mask_t phys_cpu; @@ -107,7 +108,7 @@ static int __devinit MP_processor_info ( if (!(m->mpc_cpuflag & CPU_ENABLED)) return -EINVAL; - apicid = mpc_apic_id(m, translation_table[mpc_record]); + apicid = mpc_apic_id(m, apicidx, translation_table[mpc_record]); if (m->mpc_featureflag&(1<<0)) Dprintk(" Floating point unit present.\n"); @@ -159,7 +160,7 @@ static int __devinit MP_processor_info ( if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { Dprintk(" Bootup CPU\n"); - boot_cpu_physical_apicid = m->mpc_apicid; + boot_cpu_physical_apicid = apicid; } ver = m->mpc_apicver; @@ -170,10 +171,10 @@ static int __devinit MP_processor_info ( if (ver == 0x0) { printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! " "fixing up to 0x10. (tell your hw vendor)\n", - m->mpc_apicid); + apicid); ver = 0x10; } - apic_version[m->mpc_apicid] = ver; + apic_version[apicid] = ver; phys_cpu = apicid_to_cpu_present(apicid); physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu); @@ -216,6 +217,11 @@ static int __devinit MP_processor_info ( return cpu; } +static int __devinit MP_processor_info(struct mpc_config_processor *m) +{ + return MP_processor_info_x(m, m->mpc_apicid); +} + static void __init MP_bus_info (struct mpc_config_bus *m) { char str[7]; @@ -844,7 +850,7 @@ int __devinit mp_register_lapic ( struct mpc_config_processor processor; int boot_cpu = 0; - if (MAX_APICS - id <= 0) { + if (MAX_APICS <= id) { printk(KERN_WARNING "Processor #%d invalid (max %d)\n", id, MAX_APICS); return -EINVAL; @@ -864,7 +870,7 @@ int __devinit mp_register_lapic ( processor.mpc_reserved[0] = 0; processor.mpc_reserved[1] = 0; - return MP_processor_info(&processor); + return MP_processor_info_x(&processor, id); } void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu) --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -124,7 +124,6 @@ struct sedf_cpu_info { #define PERIOD_BEGIN(inf) ((inf)->deadl_abs - (inf)->period) -#define MIN(x,y) (((x)<(y))?(x):(y)) #define DIV_UP(x,y) (((x) + (y) - 1) / y) #define extra_runs(inf) ((inf->status) & 6) --- a/xen/include/asm-x86/mach-generic/mach_apic.h +++ b/xen/include/asm-x86/mach-generic/mach_apic.h @@ -26,15 +26,15 @@ static inline void enable_apic_mode(void extern u32 bios_cpu_apicid[]; -static inline int mpc_apic_id(struct mpc_config_processor *m, +static inline int mpc_apic_id(struct mpc_config_processor *m, u32 apicid, struct mpc_config_translation *translation_record) { printk("Processor #%d %d:%d APIC version %d\n", - m->mpc_apicid, + apicid, (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, m->mpc_apicver); - return (m->mpc_apicid); + return apicid; } static inline void setup_portio_remap(void) --- a/xen/include/asm-x86/mpspec_def.h +++ b/xen/include/asm-x86/mpspec_def.h @@ -14,7 +14,7 @@ #define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_') #define MAX_MPC_ENTRY 1024 -#define MAX_APICS 256 +#define MAX_APICS MAX(256, 4 * NR_CPUS) struct intel_mp_floating { --- a/xen/include/xen/kernel.h +++ b/xen/include/xen/kernel.h @@ -33,6 +33,13 @@ #define max_t(type,x,y) \ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) +/* + * pre-processor, array size, and bit field width suitable variants; + * please don't use in "normal" expressions. + */ +#define MIN(x,y) ((x) < (y) ? (x) : (y)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) + /** * container_of - cast a member of a structure out to the containing structure * ++++++ 22534-x86-max-local-apic.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292414148 0 # Node ID d4b373ec948bed71b8683e09e41c6afc99f1edb6 # Parent 548c808be2a6f166657ce7cfb86df7a296a9526a x86: increase MAX_LOCAL_APIC References: bnc#656369, bnc#658704 otherwise apicid_to_node[MAX_LOCAL_APIC] will be overrun if apicid > 255. After patch, the mapping get right. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Make this and also MAX_MADT_ENTRIES loosely depend on NR_CPUS. Tie MAX_APICS to MAX_LOCAL_APIC. Fix initializer of x86_acpiid_to_apicid[] to match the array member type of u32, as well as all checks in readers of this array and x86_cpu_to_apicid[]. While the adjustment to xen_vcpu_physid_to_x86_{acpi,apic}id() is not backward compatible, I think it should still be done this way as the former reserving of values beyond 0xff should never have been part of the interface. If considered impossible, a second best solution would appear to be to make the macros depend on __XEN_INTERFACE_VERSION__. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -82,7 +82,7 @@ u8 acpi_enable_value, acpi_disable_value #endif u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = - {[0 ... MAX_MADT_ENTRIES - 1] = 0xff }; + {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID }; EXPORT_SYMBOL(x86_acpiid_to_apicid); /* -------------------------------------------------------------------------- @@ -534,6 +534,7 @@ static int __init acpi_parse_madt_lapic_ mp_register_lapic_address(acpi_lapic_addr); + BUILD_BUG_ON(MAX_APICS != MAX_LOCAL_APIC); count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, MAX_APICS); x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic, @@ -998,12 +999,12 @@ unsigned int acpi_get_processor_id(unsig { unsigned int acpiid, apicid; - if ((apicid = x86_cpu_to_apicid[cpu]) == 0xff) - return 0xff; + if ((apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID) + return INVALID_ACPIID; for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++) if (x86_acpiid_to_apicid[acpiid] == apicid) return acpiid; - return 0xff; + return INVALID_ACPIID; } --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -745,7 +745,7 @@ int get_cpu_id(u8 acpi_id) u32 apic_id; apic_id = x86_acpiid_to_apicid[acpi_id]; - if ( apic_id == 0xff ) + if ( apic_id == BAD_APICID ) return -1; for ( i = 0; i < NR_CPUS; i++ ) --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -96,7 +96,7 @@ struct cpuinfo_x86 cpu_data[NR_CPUS]; EXPORT_SYMBOL(cpu_data); u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly = - { [0 ... NR_CPUS-1] = -1U }; + { [0 ... NR_CPUS-1] = BAD_APICID }; EXPORT_SYMBOL(x86_cpu_to_apicid); static void map_cpu_to_logical_apicid(void); @@ -1479,7 +1479,7 @@ int cpu_add(uint32_t apic_id, uint32_t a return -EINVAL; /* Detect if the cpu has been added before */ - if ( x86_acpiid_to_apicid[acpi_id] != 0xff) + if ( x86_acpiid_to_apicid[acpi_id] != BAD_APICID ) { if (x86_acpiid_to_apicid[acpi_id] != apic_id) return -EINVAL; @@ -1513,7 +1513,7 @@ int cpu_add(uint32_t apic_id, uint32_t a { dprintk(XENLOG_WARNING, "Setup node failed for pxm %x\n", pxm); - x86_acpiid_to_apicid[acpi_id] = 0xff; + x86_acpiid_to_apicid[acpi_id] = BAD_APICID; mp_unregister_lapic(apic_id, cpu); spin_unlock(&cpu_add_remove_lock); return node; --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -150,9 +150,11 @@ struct acpi_sleep_info { #endif /* CONFIG_ACPI_SLEEP */ -#define MAX_MADT_ENTRIES 256 +#define MAX_MADT_ENTRIES MAX(256, 2 * NR_CPUS) extern u32 x86_acpiid_to_apicid[]; -#define MAX_LOCAL_APIC 256 +#define MAX_LOCAL_APIC MAX(256, 4 * NR_CPUS) + +#define INVALID_ACPIID (-1U) extern u32 pmtmr_ioport; --- a/xen/include/asm-x86/numa.h +++ b/xen/include/asm-x86/numa.h @@ -39,7 +39,7 @@ extern int setup_node(int pxm); extern void srat_detect_node(int cpu); extern void setup_node_bootmem(int nodeid, u64 start, u64 end); -extern unsigned char apicid_to_node[256]; +extern unsigned char apicid_to_node[]; #ifdef CONFIG_NUMA extern void __init init_cpu_to_node(void); --- a/xen/include/public/vcpu.h +++ b/xen/include/public/vcpu.h @@ -187,8 +187,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_register_vc /* * Get the physical ID information for a pinned vcpu's underlying physical * processor. The physical ID informmation is architecture-specific. - * On x86: id[31:0]=apic_id, id[63:32]=acpi_id, and all values 0xff and - * greater are reserved. + * On x86: id[31:0]=apic_id, id[63:32]=acpi_id. * This command returns -EINVAL if it is not a valid operation for this VCPU. */ #define VCPUOP_get_physid 12 /* arg == vcpu_get_physid_t */ @@ -197,10 +196,8 @@ struct vcpu_get_physid { }; typedef struct vcpu_get_physid vcpu_get_physid_t; DEFINE_XEN_GUEST_HANDLE(vcpu_get_physid_t); -#define xen_vcpu_physid_to_x86_apicid(physid) \ - ((((uint32_t)(physid)) >= 0xff) ? 0xff : ((uint8_t)(physid))) -#define xen_vcpu_physid_to_x86_acpiid(physid) \ - ((((uint32_t)((physid)>>32)) >= 0xff) ? 0xff : ((uint8_t)((physid)>>32))) +#define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid)) +#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32)) /* * Register a memory location to get a secondary copy of the vcpu time ++++++ 22535-x2apic-preenabled.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292414185 0 # Node ID fcc91cb3efcb83823b7e9c74ee3c97c4a9c0b7d5 # Parent d4b373ec948bed71b8683e09e41c6afc99f1edb6 x86: x2apic pre-enabled but intr-remapping is not enabled References: bnc#656369, bnc#658704 Make it aligned with Linux kernel. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Removed unnecessary bits from the original patch, and removed intremap_enabled() with its only caller gone. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -963,15 +963,6 @@ void x2apic_setup(void) rdmsr(MSR_IA32_APICBASE, lo, hi); if ( lo & MSR_IA32_APICBASE_EXTD ) { - /* - * Interrupt remapping should be also enabled by BIOS when - * x2APIC is already enabled by BIOS, otherwise it's a BIOS - * bug - */ - if ( !intremap_enabled() ) - panic("Interrupt remapping is not enabled by BIOS while " - "x2APIC is already enabled by BIOS!\n"); - printk("x2APIC mode is already enabled by BIOS.\n"); x2apic_enabled = 1; } @@ -1014,6 +1005,10 @@ void x2apic_setup(void) if ( iommu_enable_IR() ) { + if ( x2apic_enabled ) + panic("Interrupt remapping could not be enabled while " + "x2APIC is already enabled by BIOS!\n"); + printk("Would not enable x2APIC due to interrupt remapping " "cannot be enabled.\n"); goto restore_out; --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -884,23 +884,3 @@ void iommu_disable_IR(void) for_each_drhd_unit ( drhd ) disable_qinval(drhd->iommu); } - -/* - * Check if interrupt remapping is enabled or not - * return 1: enabled - * return 0: not enabled - */ -int intremap_enabled(void) -{ - struct acpi_drhd_unit *drhd; - u32 sts; - - for_each_drhd_unit ( drhd ) - { - sts = dmar_readl(drhd->iommu->reg, DMAR_GSTS_REG); - if ( !(sts & DMA_GSTS_IRES) ) - return 0; - } - - return 1; -} --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -62,7 +62,6 @@ int iommu_setup(void); int iommu_supports_eim(void); int iommu_enable_IR(void); void iommu_disable_IR(void); -int intremap_enabled(void); int iommu_add_device(struct pci_dev *pdev); int iommu_remove_device(struct pci_dev *pdev); ++++++ 22538-keyhandler-relax.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292414674 0 # Node ID a3a29e67aa7e75a094e1b4237b10a68cf829b542 # Parent 16673224c1cc2ca3bb9730f1d7c84fe4d96e5323 Reduce side effects of handling '*' debug key References: bnc#659284 NMI watchdog should be suppressed when dumping IRQ handlers. Softirqs should be handled periodically while processing non-IRQ handlers. Signed-off-by: Jan Beulich <jbeulich@novell.com> # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1293185578 0 # Node ID dca1b7cf2e2c27cd160bd1d1d284e3f810d4936c # Parent e8acb9753ff1a5cd3d6a45eda5f4c6f0059c281a re-add calls accidentally deleted from run_all_nonirq_keyhandlers() c/s 22538:a3a29e67aa7e, having got applied in a form different from the one submitted, resulted in the calls to console_{start,end}_log_everything() getting removed without replacement. Add them back since, other than run_all_keyhandlers(), this doesn't run with log-everything already in effect. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -407,14 +407,17 @@ static void run_all_nonirq_keyhandlers(u int k; console_start_log_everything(); + for ( k = 0; k < ARRAY_SIZE(key_table); k++ ) { + process_pending_softirqs_nested(); h = key_table[k]; if ( (h == NULL) || !h->diagnostic || h->irq_callback ) continue; printk("[%c: %s]\n", k, h->desc); (*h->u.fn)(k); } + console_end_log_everything(); } @@ -426,10 +429,11 @@ static void run_all_keyhandlers(unsigned struct keyhandler *h; int k; + watchdog_disable(); + printk("'%c' pressed -> firing all diagnostic keyhandlers\n", key); /* Fire all the IRQ-context diangostic keyhandlers now */ - console_start_log_everything(); for ( k = 0; k < ARRAY_SIZE(key_table); k++ ) { h = key_table[k]; @@ -438,7 +442,8 @@ static void run_all_keyhandlers(unsigned printk("[%c: %s]\n", k, h->desc); (*h->u.irq_fn)(k, regs); } - console_end_log_everything(); + + watchdog_enable(); /* Trigger the others from a tasklet in non-IRQ context */ tasklet_schedule(&run_all_keyhandlers_tasklet); --- a/xen/common/softirq.c +++ b/xen/common/softirq.c @@ -54,6 +54,16 @@ void process_pending_softirqs(void) __do_softirq(1ul<<SCHEDULE_SOFTIRQ); } +void process_pending_softirqs_nested(void) +{ + ASSERT(!in_irq() && local_irq_is_enabled()); + /* + * Do not enter scheduler as it can preempt the calling context, + * and do not run tasklets as we're running one currently. + */ + __do_softirq((1ul<<SCHEDULE_SOFTIRQ) | (1ul<<TASKLET_SOFTIRQ)); +} + asmlinkage void do_softirq(void) { __do_softirq(0); --- a/xen/include/xen/softirq.h +++ b/xen/include/xen/softirq.h @@ -39,6 +39,8 @@ void raise_softirq(unsigned int nr); * Use this instead of do_softirq() when you do not want to be preempted. */ void process_pending_softirqs(void); +/* ... and use this instead when running inside a tasklet. */ +void process_pending_softirqs_nested(void); /* * TASKLETS -- dynamically-allocatable tasks run in softirq context ++++++ 22540-32on64-hypercall-debug.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292415031 0 # Node ID d8279118b4bbb3bb3689b9c20abb25d0c09e2b69 # Parent 20c65aa19075b1a696adb56325827412596ac0d4 x86/32on64: zero-extend hypercall index before use in memory access (debug mode only) Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -36,7 +36,8 @@ ENTRY(compat_hypercall) pushq UREGS_rbx(%rsp); pushq %rcx; pushq %rdx; pushq %rsi; pushq %rdi pushq UREGS_rbp+5*8(%rsp) leaq compat_hypercall_args_table(%rip),%r10 - movq $6,%rcx + movl %eax,%eax + movl $6,%ecx subb (%r10,%rax,1),%cl movq %rsp,%rdi movl $0xDEADBEEF,%eax ++++++ 22549-vtd-map-page-leak.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292513937 0 # Node ID aa18b8ddaf05084aef3f8cff11d92248a8b6fac8 # Parent f46f46bbb69a788037f866025c88743d55dde416 vtd: Require unmap_vtd_domain_page() on a couple of early exit paths. From: Jan Beulich <JBeulich@novell.com> Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1330,6 +1330,7 @@ int domain_context_mapping_one( if ( context_set_domain_id(context, domain, iommu) ) { spin_unlock(&iommu->lock); + unmap_vtd_domain_page(context_entries); return -EFAULT; } @@ -1671,6 +1672,7 @@ static int intel_iommu_map_page( if ( old.val == new.val ) { spin_unlock(&hd->mapping_lock); + unmap_vtd_domain_page(page); return 0; } *pte = new; ++++++ 22574-ept-skip-validation.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1292954974 0 # Node ID b5418c045d029e8bf5eadfd4e1ef0b1822da7186 # Parent ff1b80ccecd9ed049cc694ab117100e83eab179f x86 hvm ept: Remove EPT guest linear address validation For EPT violation resulting from an attempt to load the guest PDPTEs as part of the execution of the MOV CR instruction, the EPT_GLA_VALID is not valid. This situation should not happen in most situation, since we always populate guest memory. But this is not ture for PAE guest under the PoD/Page sharing situation. In that situation, a page pointed by CR3 may be un-populated, and we need handle it in such situation. Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com> --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2129,8 +2129,7 @@ static void ept_handle_violation(unsigne __trace_var(TRC_HVM_NPF, 0, sizeof(_d), (unsigned char *)&_d); } - if ( (qualification & EPT_GLA_VALID) && - hvm_hap_nested_page_fault(gfn) ) + if ( hvm_hap_nested_page_fault(gfn) ) return; /* Everything else is an error. */ ++++++ 22632-vtd-print-entries.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1293185641 0 # Node ID 7cc87dcf30a13bcf600077aa661694caeb0c290c # Parent dca1b7cf2e2c27cd160bd1d1d284e3f810d4936c VT-d: fix and improve print_vtd_entries() Fix leaking of mapped domain pages (root_entry and ctxt_entry when falling out of the level traversing loop). Do this by re-arranging things slightly so that a mapping is retained only as long as it really is needed. Fix the failure to use map_domain_page() in the level traversing loop of the function. Add a mssing return statement in one of the error paths. Also I wonder whether not being able to call print_vtd_entries() from iommu_page_fault_do_one() in ix86 is still correct, now that map_domain_page() is IRQ safe. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -99,7 +99,7 @@ void print_vtd_entries(struct iommu *iom struct context_entry *ctxt_entry; struct root_entry *root_entry; struct dma_pte pte; - u64 *l; + u64 *l, val; u32 l_index, level; printk("print_vtd_entries: iommu = %p bdf = %x:%x.%x gmfn = %"PRIx64"\n", @@ -112,6 +112,11 @@ void print_vtd_entries(struct iommu *iom } root_entry = (struct root_entry *)map_vtd_domain_page(iommu->root_maddr); + if ( root_entry == NULL ) + { + printk(" root_entry == NULL\n"); + return; + } printk(" root_entry = %p\n", root_entry); printk(" root_entry[%x] = %"PRIx64"\n", bus, root_entry[bus].val); @@ -122,61 +127,57 @@ void print_vtd_entries(struct iommu *iom return; } - ctxt_entry = - (struct context_entry *)map_vtd_domain_page(root_entry[bus].val); + val = root_entry[bus].val; + unmap_vtd_domain_page(root_entry); + ctxt_entry = map_vtd_domain_page(val); if ( ctxt_entry == NULL ) { - unmap_vtd_domain_page(root_entry); printk(" ctxt_entry == NULL\n"); return; } printk(" context = %p\n", ctxt_entry); + val = ctxt_entry[devfn].lo; printk(" context[%x] = %"PRIx64"_%"PRIx64"\n", - devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo); + devfn, ctxt_entry[devfn].hi, val); if ( !context_present(ctxt_entry[devfn]) ) { unmap_vtd_domain_page(ctxt_entry); - unmap_vtd_domain_page(root_entry); printk(" ctxt_entry[%x] not present\n", devfn); return; } level = agaw_to_level(context_address_width(ctxt_entry[devfn])); + unmap_vtd_domain_page(ctxt_entry); if ( level != VTD_PAGE_TABLE_LEVEL_3 && level != VTD_PAGE_TABLE_LEVEL_4) { - unmap_vtd_domain_page(ctxt_entry); - unmap_vtd_domain_page(root_entry); printk("Unsupported VTD page table level (%d)!\n", level); + return; } - l = maddr_to_virt(ctxt_entry[devfn].lo); do { - l = (u64*)(((unsigned long)l >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); + l = map_vtd_domain_page(val); printk(" l%d = %p\n", level, l); if ( l == NULL ) { - unmap_vtd_domain_page(ctxt_entry); - unmap_vtd_domain_page(root_entry); printk(" l%d == NULL\n", level); break; } l_index = get_level_index(gmfn, level); printk(" l%d_index = %x\n", level, l_index); - printk(" l%d[%x] = %"PRIx64"\n", level, l_index, l[l_index]); - pte.val = l[l_index]; + pte.val = val = l[l_index]; + unmap_vtd_domain_page(l); + printk(" l%d[%x] = %"PRIx64"\n", level, l_index, val); + + pte.val = val; if ( !dma_pte_present(pte) ) { - unmap_vtd_domain_page(ctxt_entry); - unmap_vtd_domain_page(root_entry); printk(" l%d[%x] not present\n", level, l_index); break; } - - l = maddr_to_virt(l[l_index]); } while ( --level ); } ++++++ 22645-amd-flush-filter.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294220923 0 # Node ID 76d897a06b316bf2278220b006d578faf31ce3fb # Parent fece73d4d30985ce40ef87dcd379ce6beb8aadf3 x86 amd: Revert 6382:b74c15e4dd4f (AMD flush filter configuration) Flush filter is not reliably supported by any processor, we already have code to unconditionally disable the filter, so we don't need the command-line config option. Remove it. Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -237,20 +237,6 @@ int cpu_has_amd_erratum(const struct cpu return 0; } -/* - * amd_flush_filter={on,off}. Forcibly Enable or disable the TLB flush - * filter on AMD 64-bit processors. - */ -static int flush_filter_force; -static void flush_filter(char *s) -{ - if (!strcmp(s, "off")) - flush_filter_force = -1; - if (!strcmp(s, "on")) - flush_filter_force = 1; -} -custom_param("amd_flush_filter", flush_filter); - #define num_physpages 0 /* @@ -545,21 +531,6 @@ static void __devinit init_amd(struct cp break; } - if (c->x86 == 15) { - rdmsr(MSR_K7_HWCR, l, h); - printk(KERN_INFO "CPU%d: AMD Flush Filter %sabled", - smp_processor_id(), (l & (1<<6)) ? "dis" : "en"); - if ((flush_filter_force > 0) && (l & (1<<6))) { - l &= ~(1<<6); - printk(" -> Forcibly enabled"); - } else if ((flush_filter_force < 0) && !(l & (1<<6))) { - l |= 1<<6; - printk(" -> Forcibly disabled"); - } - wrmsr(MSR_K7_HWCR, l, h); - printk("\n"); - } - display_cacheinfo(c); if (cpuid_eax(0x80000000) >= 0x80000008) { ++++++ 22693-fam10-mmio-conf-base-protect.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294648952 0 # Node ID 08bb0eefe87107c30a9bdc6d72f26b20c55ae687 # Parent 66e8062894641e5622aa6adc54297d5700b1cea3 x86-64: don't allow wrmsr to MSR_FAM10H_MMIO_CONF_BASE when Xen itself is using it Signed-off-by: Jan Beulich <jbeulich@novell.com> # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294741846 0 # Node ID a2dcebb88bc4571d64b3f30c1fbb33cfe4f6e2c5 # Parent 1ae74f060a39ae1305b3a434d0faa1a19853fdab x86-64: refine access permission check for wrmsr to MSR_FAM10H_MMIO_CONF_BASE We really don't want the mmconf window to move/disappear whenever we use is ourselves, not only when we enabled it. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1704,6 +1704,10 @@ static int is_cpufreq_controller(struct (d->domain_id == 0)); } +#ifdef CONFIG_X86_64 +#include "x86_64/mmconfig.h" +#endif + static int emulate_privileged_op(struct cpu_user_regs *regs) { struct vcpu *v = current; @@ -2263,7 +2267,13 @@ static int emulate_privileged_op(struct goto fail; if ( !IS_PRIV(v->domain) ) break; - if ( (rdmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, l, h) != 0) || + if ( (rdmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, l, h) != 0) ) + goto fail; + if ( +#ifdef CONFIG_X86_64 + (pci_probe & PCI_PROBE_MASK) == PCI_PROBE_MMCONF ? + eax != l || edx != h : +#endif (((((u64)h << 32) | l) ^ val) & ~( FAM10H_MMIO_CONF_ENABLE | (FAM10H_MMIO_CONF_BUSRANGE_MASK << --- a/xen/arch/x86/x86_64/mmconfig.h +++ b/xen/arch/x86/x86_64/mmconfig.h @@ -34,6 +34,8 @@ #define PCI_VENDOR_ID_NVIDIA 0x10de +extern unsigned int pci_probe; + /* * AMD Fam10h CPUs are buggy, and cannot access MMIO config space * on their northbrige except through the * %eax register. As such, you MUST --- a/xen/arch/x86/x86_64/mmconfig-shared.c +++ b/xen/arch/x86/x86_64/mmconfig-shared.c @@ -24,7 +24,7 @@ #include "mmconfig.h" static int __initdata known_bridge; -static unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF; +unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF; static void __init parse_mmcfg(char *s) { ++++++ 22694-x86_64-no-weak.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294649119 0 # Node ID 9b5d121c8805b40a4338248c346303e1e18d0c4e # Parent 08bb0eefe87107c30a9bdc6d72f26b20c55ae687 x86_64: don't use weak symbols on x86-64 References: bnc#656369, bnc#658704 Various gcc versions inline functions that are both weak and hidden, without even giving a warning. Certainly the risk exists that we'll see the problem again when another weak function gets introduced, but I don't see a way to protect us from that. Signed-off-by: Jan Beulich <jbeulich@novell.com> Just remove the weak attribute altogether. It's the only one in non-ia64-specific code. We can get teh same effect with ifdefs which although a bit unsightly is better than using compiler/linker features we cannot trust. Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/drivers/acpi/numa.c +++ b/xen/drivers/acpi/numa.c @@ -120,14 +120,15 @@ static int __init acpi_parse_slit(struct return 0; } -void __init __attribute__ ((weak)) +#ifndef CONFIG_X86 +void __init acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) { printk(KERN_WARNING PREFIX "Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id); return; } - +#endif static int __init acpi_parse_x2apic_affinity(struct acpi_subtable_header *header, ++++++ 22707-x2apic-preenabled-check.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294746050 0 # Node ID 2ff199e2842b7e4f08ea99558afc32536a77280c # Parent ca10302ac2859b43a41afe425d79ae0df29f2a9c x86: restore x2apic pre-enabled check logic References: bnc#656369, bnc#658704 c/s 22475 removed the early checking without replacement, neglecting the fact that x2apic_enabled must be set early for APIC register accesses done during second stage ACPI table parsing (rooted at acpi_boot_init()) to work correctly. Without this, particularly determination of the boot CPU won't work, resulting in an attempt to bring up that CPU again as a secondary one (which fails). Restore the functionality, now calling it from generic_apic_probe(). Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -947,7 +947,6 @@ no_apic: void x2apic_setup(void) { struct IO_APIC_route_entry **ioapic_entries = NULL; - u32 lo, hi; if ( smp_processor_id() != 0 ) { @@ -959,14 +958,6 @@ void x2apic_setup(void) if ( !cpu_has_x2apic ) return; - /* Check whether x2apic mode was already enabled by the BIOS. */ - rdmsr(MSR_IA32_APICBASE, lo, hi); - if ( lo & MSR_IA32_APICBASE_EXTD ) - { - printk("x2APIC mode is already enabled by BIOS.\n"); - x2apic_enabled = 1; - } - if ( !opt_x2apic ) { if ( !x2apic_enabled ) --- a/xen/arch/x86/genapic/probe.c +++ b/xen/arch/x86/genapic/probe.c @@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force) void __init generic_apic_probe(void) { - int i; - int changed = cmdline_apic = (genapic != NULL); + int i, changed; + + check_x2apic_preenabled(); + cmdline_apic = changed = (genapic != NULL); for (i = 0; !changed && apic_probe[i]; i++) { if (apic_probe[i]->probe()) { --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -20,6 +20,8 @@ #include <xen/cpumask.h> #include <asm/apicdef.h> #include <asm/genapic.h> +#include <asm/msr.h> +#include <asm/processor.h> #include <xen/smp.h> #include <asm/mach-default/mach_mpparse.h> @@ -134,3 +136,20 @@ const struct genapic *apic_x2apic_probe( { return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; } + +void __init check_x2apic_preenabled(void) +{ + u32 lo, hi; + + if ( !cpu_has_x2apic ) + return; + + /* Check whether x2apic mode was already enabled by the BIOS. */ + rdmsr(MSR_IA32_APICBASE, lo, hi); + if ( lo & MSR_IA32_APICBASE_EXTD ) + { + printk("x2APIC mode is already enabled by BIOS.\n"); + x2apic_enabled = 1; + genapic = apic_x2apic_probe(); + } +} --- a/xen/include/asm-x86/apic.h +++ b/xen/include/asm-x86/apic.h @@ -25,6 +25,7 @@ extern int apic_verbosity; extern int x2apic_enabled; extern int directed_eoi_enabled; +void check_x2apic_preenabled(void); void x2apic_setup(void); const struct genapic *apic_x2apic_probe(void); ++++++ 22708-xenctx-misc.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1294746099 0 # Node ID 7926538a633297d65a5d6324bf9bd0eb158a6aff # Parent 2ff199e2842b7e4f08ea99558afc32536a77280c xenctx: misc adjustments - fix off-by-one errors during symbol insertion and lookup - don't store the symbol type, as it wasn't needed at all so far and is only needed now at parsing time - don't insert certain kinds of symbols Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -19,6 +19,7 @@ #include <unistd.h> #include <errno.h> #include <signal.h> +#include <ctype.h> #include <string.h> #include <inttypes.h> #include <getopt.h> @@ -58,7 +59,6 @@ int disp_tlb; struct symbol { guest_word_t address; - char type; char *name; struct symbol *next; } *symbol_table = NULL; @@ -112,12 +112,12 @@ static void insert_symbol(struct symbol /* The System.map is usually already sorted... */ if (prev - && prev->address < symbol->address + && prev->address <= symbol->address && (!prev->next || prev->next->address > symbol->address)) { s = prev; } else { /* ... otherwise do crappy/slow search for the correct place */ - while(s && s->next && s->next->address < symbol->address) + while (s->next && s->next->address <= symbol->address) s = s->next; } @@ -130,13 +130,13 @@ static struct symbol *lookup_symbol(gues { struct symbol *s = symbol_table; - while(s && s->next && s->next->address < address) - s = s->next; + if (!s) + return NULL; - if (s && s->address < address) - return s; + while (s->next && s->next->address < address) + s = s->next; - return NULL; + return s->next && s->next->address <= address ? s->next : s; } static void print_symbol(guest_word_t addr) @@ -159,7 +159,7 @@ static void print_symbol(guest_word_t ad static void read_symbol_table(const char *symtab) { - char line[256]; + char type, line[256]; char *p; struct symbol *symbol; FILE *f; @@ -178,9 +178,13 @@ static void read_symbol_table(const char /* need more checks for syntax here... */ symbol->address = strtoull(line, &p, 16); - p++; - symbol->type = *p++; - p++; + if (!isspace(*p++)) + continue; + type = *p++; + if (!isalpha(type) && type != '?') + continue; + if (!isspace(*p++)) + continue; /* in the future we should handle the module name * being appended here, this would allow us to use @@ -190,7 +194,18 @@ static void read_symbol_table(const char p[strlen(p)-1] = '\0'; symbol->name = strdup(p); - insert_symbol(symbol); + switch (type) { + case 'A': /* global absolute */ + case 'a': /* local absolute */ + break; + case 'U': /* undefined */ + case 'v': /* undefined weak object */ + case 'w': /* undefined weak function */ + continue; + default: + insert_symbol(symbol); + break; + } if (strcmp(symbol->name, "_stext") == 0) kernel_stext = symbol->address; ++++++ 22744-ept-pod-locking.patch ++++++ # HG changeset patch # User Tim Deegan <Tim.Deegan@citrix.com> # Date 1294933573 0 # Node ID b01ef59c8c805df751a8f6ae63cdd5c6a4565255 # Parent 54e91dcae649e23fd267d7afe623fbd52b1b4283 x86/mm: fix EPT PoD locking to match the normal p2m case. This recursive-locking bug was fixed in the main p2m code in 20269:fd3d5d66c446 (in October 2009) but has lurked unseen in the EPT side since then. Copy the fix across. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> --- a/xen/arch/x86/mm/hap/p2m-ept.c +++ b/xen/arch/x86/mm/hap/p2m-ept.c @@ -37,19 +37,26 @@ static int ept_pod_check_and_populate(st ept_entry_t *entry, int order, p2m_query_t q) { + /* Only take the lock if we don't already have it. Otherwise it + * wouldn't be safe to do p2m lookups with the p2m lock held */ + int do_locking = !p2m_locked_by_me(d->arch.p2m); int r; - p2m_lock(d->arch.p2m); + + if ( do_locking ) + p2m_lock(d->arch.p2m); /* Check to make sure this is still PoD */ if ( entry->avail1 != p2m_populate_on_demand ) { - p2m_unlock(d->arch.p2m); + if ( do_locking ) + p2m_unlock(d->arch.p2m); return 0; } r = p2m_pod_demand_populate(d, gfn, order, q); - p2m_unlock(d->arch.p2m); + if ( do_locking ) + p2m_unlock(d->arch.p2m); return r; } ++++++ 22749-vtd-workarounds.patch ++++++ References: bnc#633573 # HG changeset patch # User Allen Kay <allen.m.kay@intel.com> # Date 1294992706 0 # Node ID 93e7bf0e1845f1a82441fb740522a9b9cb32beda # Parent 47713825a3f910fc7cf7571947e8b3b4eab23d5f vt-d: quirks for Sandybridge errata workaround, WLAN, VT-d fault escalation Adding errata workaround for newly released Sandybridge processor graphics, additional WLAN device ID's for WLAN quirk, a quirk for masking VT-d fault escalation to IOH HW that can cause system hangs on some OEM hardware where the BIOS erroneously escalates VT-d faults to the platform. Signed-off-by: Allen Kay <allen.m.kay@intel.com> # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1295625672 0 # Node ID 1637fdbfc21e2c732eca29136943a568f8f341cd # Parent 43592043cefc8357e6e6a0ab9ba85ca480968cb1 [VTD][QUIRK] turn off Sandybridge IGD quirk by default Turn off Sandybridge IGD quirk by default until potential issues such as MMIO register conflict with OS device driver and proper locking in preamble and postamble functions are addressed. Signed-off-by: Allen Kay <allen.m.kay@intel.com> jb: Disabled the body of pci_vtd_quirk() for ix86. --- a/xen/drivers/passthrough/vtd/extern.h +++ b/xen/drivers/passthrough/vtd/extern.h @@ -87,5 +87,6 @@ void __init platform_quirks_init(void); void vtd_ops_preamble_quirk(struct iommu* iommu); void vtd_ops_postamble_quirk(struct iommu* iommu); void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map); +void pci_vtd_quirk(struct pci_dev *pdev); #endif // _VTD_EXTERN_H_ --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1845,6 +1845,7 @@ static void setup_dom0_devices(struct do list_add(&pdev->domain_list, &d->arch.pdev_list); domain_context_mapping(d, pdev->bus, pdev->devfn); pci_enable_acs(pdev); + pci_vtd_quirk(pdev); } } spin_unlock(&pcidevs_lock); --- a/xen/drivers/passthrough/vtd/quirks.c +++ b/xen/drivers/passthrough/vtd/quirks.c @@ -47,11 +47,13 @@ #define IS_CTG(id) (id == 0x2a408086) #define IS_ILK(id) (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 || id == 0x006A8086) #define IS_CPT(id) (id == 0x01008086 || id == 0x01048086) +#define IS_SNB_GFX(id) (id == 0x01068086 || id == 0x01168086 || id == 0x01268086 || id == 0x01028086 || id == 0x01128086 || id == 0x01228086 || id == 0x010A8086) u32 ioh_id; u32 igd_id; bool_t rwbf_quirk; static int is_cantiga_b3; +static int is_snb_gfx; static u8 *igd_reg_va; /* @@ -92,6 +94,12 @@ static void cantiga_b3_errata_init(void) is_cantiga_b3 = 1; } +/* check for Sandybridge IGD device ID's */ +static void snb_errata_init(void) +{ + is_snb_gfx = IS_SNB_GFX(igd_id); +} + /* * QUIRK to workaround Cantiga IGD VT-d low power errata. * This errata impacts IGD assignment on Cantiga systems @@ -104,12 +112,15 @@ static void cantiga_b3_errata_init(void) /* * map IGD MMIO+0x2000 page to allow Xen access to IGD 3D register. */ -static void map_igd_reg(void) +static void *map_igd_reg(void) { u64 igd_mmio, igd_reg; - if ( !is_cantiga_b3 || igd_reg_va != NULL ) - return; + if ( !is_cantiga_b3 && !is_snb_gfx ) + return NULL; + + if ( igd_reg_va ) + return igd_reg_va; /* get IGD mmio address in PCI BAR */ igd_mmio = ((u64)pci_conf_read32(0, IGD_DEV, 0, 0x14) << 32) + @@ -121,6 +132,7 @@ static void map_igd_reg(void) /* ioremap this physical page */ set_fixmap_nocache(FIX_IGD_MMIO, igd_reg); igd_reg_va = (u8 *)fix_to_virt(FIX_IGD_MMIO); + return igd_reg_va; } /* @@ -134,6 +146,9 @@ static int cantiga_vtd_ops_preamble(stru if ( !is_igd_drhd(drhd) || !is_cantiga_b3 ) return 0; + if ( !map_igd_reg() ) + return 0; + /* * read IGD register at IGD MMIO + 0x20A4 to force IGD * to exit low power state. Since map_igd_reg() @@ -144,11 +159,69 @@ static int cantiga_vtd_ops_preamble(stru } /* + * Sandybridge RC6 power management inhibit state erratum. + * This can cause power high power consumption. + * Workaround is to prevent graphics get into RC6 + * state when doing VT-d IOTLB operations, do the VT-d + * IOTLB operation, and then re-enable RC6 state. + */ +static void snb_vtd_ops_preamble(struct iommu* iommu) +{ + struct intel_iommu *intel = iommu->intel; + struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; + s_time_t start_time; + + if ( !is_igd_drhd(drhd) || !is_snb_gfx ) + return; + + if ( !map_igd_reg() ) + return; + + *((volatile u32 *)(igd_reg_va + 0x54)) = 0x000FFFFF; + *((volatile u32 *)(igd_reg_va + 0x700)) = 0; + + start_time = NOW(); + while ( (*((volatile u32 *)(igd_reg_va + 0x2AC)) & 0xF) != 0 ) + { + if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) + { + dprintk(XENLOG_INFO VTDPREFIX, + "snb_vtd_ops_preamble: failed to disable idle handshake\n"); + break; + } + cpu_relax(); + } + + *((volatile u32*)(igd_reg_va + 0x50)) = 0x10001; +} + +static void snb_vtd_ops_postamble(struct iommu* iommu) +{ + struct intel_iommu *intel = iommu->intel; + struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; + + if ( !is_igd_drhd(drhd) || !is_snb_gfx ) + return; + + if ( !map_igd_reg() ) + return; + + *((volatile u32 *)(igd_reg_va + 0x54)) = 0xA; + *((volatile u32 *)(igd_reg_va + 0x50)) = 0x10000; +} + +/* * call before VT-d translation enable and IOTLB flush operations. */ + +static int snb_igd_quirk; +boolean_param("snb_igd_quirk", snb_igd_quirk); + void vtd_ops_preamble_quirk(struct iommu* iommu) { cantiga_vtd_ops_preamble(iommu); + if ( snb_igd_quirk ) + snb_vtd_ops_preamble(iommu); } /* @@ -156,7 +229,8 @@ void vtd_ops_preamble_quirk(struct iommu */ void vtd_ops_postamble_quirk(struct iommu* iommu) { - return; + if ( snb_igd_quirk ) + snb_vtd_ops_postamble(iommu); } /* initialize platform identification flags */ @@ -175,6 +249,8 @@ void __init platform_quirks_init(void) /* initialize cantiga B3 identification */ cantiga_b3_errata_init(); + snb_errata_init(); + /* ioremap IGD MMIO+0x2000 page */ map_igd_reg(); } @@ -246,11 +322,14 @@ void me_wifi_quirk(struct domain *domain id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0); switch (id) { - case 0x00878086: + case 0x00878086: /* Kilmer Peak */ case 0x00898086: - case 0x00828086: + case 0x00828086: /* Taylor Peak */ case 0x00858086: - case 0x42388086: + case 0x008F8086: /* Rainbow Peak */ + case 0x00908086: + case 0x00918086: + case 0x42388086: /* Puma Peak */ case 0x422b8086: case 0x422c8086: map_me_phantom_function(domain, 22, map); @@ -258,6 +337,28 @@ void me_wifi_quirk(struct domain *domain default: break; } + } +} +/* + * Mask reporting Intel VT-d faults to IOH core logic: + * - Some platform escalates VT-d faults to platform errors + * - This can cause system failure upon non-fatal VT-d faults + * - Potential security issue if malicious guest trigger VT-d faults + */ +void pci_vtd_quirk(struct pci_dev *pdev) +{ +#ifndef __i386__ + int bus = pdev->bus; + int dev = PCI_SLOT(pdev->devfn); + int func = PCI_FUNC(pdev->devfn); + int id, val; + + id = pci_conf_read32(bus, dev, func, 0); + if ( id == 0x342e8086 || id == 0x3c288086 ) + { + val = pci_conf_read32(bus, dev, func, 0x1AC); + pci_conf_write32(bus, dev, func, 0x1AC, val | (1 << 31)); } +#endif } ++++++ 22777-vtd-ats-fixes.patch ++++++ # HG changeset patch # User Jan Beulich <jbeulich@novell.com> # Date 1295353690 0 # Node ID 1e7594758b28706c2b72358598ecf632ddda247b # Parent 78e2e5a50daa1702e3fd9dbceada700cdaefd511 VT-d/ATS: misc fixes First of all there were three places potentially de-referencing NULL (two after an allocation failure, and one after a failed lookup). Second, if ATS_ENABLE was already set, the device would not have got added to the ats_devices list, potentially resulting in dev_invalidate_iotlb() doing an incomplete job. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/drivers/passthrough/vtd/x86/ats.c +++ b/xen/drivers/passthrough/vtd/x86/ats.c @@ -91,6 +91,9 @@ int ats_device(int seg, int bus, int dev return 0; pdev = pci_get_pdev(bus, devfn); + if ( !pdev ) + return 0; + drhd = acpi_find_matched_drhd_unit(pdev); if ( !drhd ) return 0; @@ -108,6 +111,8 @@ int ats_device(int seg, int bus, int dev if ( pos && (ats_drhd == NULL) ) { new_drhd = xmalloc(struct acpi_drhd_unit); + if ( !new_drhd ) + return 0; memcpy(new_drhd, drhd, sizeof(struct acpi_drhd_unit)); list_add_tail(&new_drhd->list, &ats_dev_drhd_units); } @@ -116,9 +121,8 @@ int ats_device(int seg, int bus, int dev int enable_ats_device(int seg, int bus, int devfn) { - struct pci_ats_dev *pdev; + struct pci_ats_dev *pdev = NULL; u32 value; - u16 queue_depth; int pos; if ( !acpi_find_matched_atsr_unit(bus, devfn) ) @@ -142,26 +146,43 @@ int enable_ats_device(int seg, int bus, /* BUGBUG: add back seg when multi-seg platform support is enabled */ value = pci_conf_read16(bus, PCI_SLOT(devfn), - PCI_FUNC(devfn), pos + ATS_REG_CAP); - queue_depth = value & ATS_QUEUE_DEPTH_MASK; - - value = pci_conf_read16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos + ATS_REG_CTL); if ( value & ATS_ENABLE ) - return 0; + { + list_for_each_entry ( pdev, &ats_devices, list ) + { + if ( pdev->bus == bus && pdev->devfn == devfn ) + { + pos = 0; + break; + } + } + } + if ( pos ) + pdev = xmalloc(struct pci_ats_dev); + if ( !pdev ) + return -ENOMEM; - value |= ATS_ENABLE; - pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - pos + ATS_REG_CTL, value); + if ( !(value & ATS_ENABLE) ) + { + value |= ATS_ENABLE; + pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), + pos + ATS_REG_CTL, value); + } + + if ( pos ) + { + pdev->bus = bus; + pdev->devfn = devfn; + value = pci_conf_read16(bus, PCI_SLOT(devfn), + PCI_FUNC(devfn), pos + ATS_REG_CAP); + pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK; + list_add(&pdev->list, &ats_devices); + } - pdev = xmalloc(struct pci_ats_dev); - pdev->bus = bus; - pdev->devfn = devfn; - pdev->ats_queue_depth = queue_depth; - list_add(&(pdev->list), &ats_devices); if ( iommu_verbose ) - dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is enabled\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS %s enabled\n", + bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos ? "is" : "was"); return pos; } ++++++ 22781-pod-hap-logdirty.patch ++++++ # HG changeset patch # User George Dunlap <george.dunlap@eu.citrix.com> # Date 1295274541 0 # Node ID 3decd02e0b18ae21fb926c6bad96a4cd02c48272 # Parent 97ab84aca65cdcbce2ddccc51629fb24adb056cf PoD,hap: Fix logdirty mode when using hardware assisted paging When writing a writable p2m entry for a pfn, we need to mark the pfn dirty to avoid corruption when doing live migration. Marking the page dirty exposes another issue, where there are excessive sweeps for zero pages if there's a mismatch between PoD entries and cache entries. Only sweep for zero pages if we actually need more memory. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Tim Deegan <Tim.Deegan@citrix.com> --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1064,14 +1064,22 @@ p2m_pod_demand_populate(struct domain *d if ( unlikely(d->is_dying) ) goto out_fail; - /* If we're low, start a sweep */ - if ( order == 9 && page_list_empty(&p2md->pod.super) ) - p2m_pod_emergency_sweep_super(d); - - if ( page_list_empty(&p2md->pod.single) && - ( ( order == 0 ) - || (order == 9 && page_list_empty(&p2md->pod.super) ) ) ) - p2m_pod_emergency_sweep(d); + /* Once we've ballooned down enough that we can fill the remaining + * PoD entries from the cache, don't sweep even if the particular + * list we want to use is empty: that can lead to thrashing zero pages + * through the cache for no good reason. */ + if ( p2md->pod.entry_count > p2md->pod.count ) + { + + /* If we're low, start a sweep */ + if ( order == 9 && page_list_empty(&p2md->pod.super) ) + p2m_pod_emergency_sweep_super(d); + + if ( page_list_empty(&p2md->pod.single) && + ( ( order == 0 ) + || (order == 9 && page_list_empty(&p2md->pod.super) ) ) ) + p2m_pod_emergency_sweep(d); + } /* Keep track of the highest gfn demand-populated by a guest fault */ if ( q == p2m_guest && gfn > p2md->pod.max_guest ) @@ -1098,7 +1106,10 @@ p2m_pod_demand_populate(struct domain *d set_p2m_entry(d, gfn_aligned, mfn, order, p2m_ram_rw); for( i = 0 ; i < (1UL << order) ; i++ ) + { set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_aligned + i); + paging_mark_dirty(d, mfn_x(mfn) + i); + } p2md->pod.entry_count -= (1 << order); /* Lock: p2m */ BUG_ON(p2md->pod.entry_count < 0); ++++++ 22782-x86-emul-smsw.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1295450944 0 # Node ID fe8a177ae9cb01cda771ba64cea2c0470cf79cd8 # Parent 3decd02e0b18ae21fb926c6bad96a4cd02c48272 x86_emulate: set the operand size for SMSW/reg writeback. Otherwise it defaults to 0 bytes. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Signed-off-by: Keir Fraser <keir@xen.org> --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -3553,8 +3553,7 @@ x86_emulate( goto done; break; case 4: /* smsw */ - if ( ea.type == OP_MEM ) - ea.bytes = 2; + ea.bytes = (ea.type == OP_MEM) ? 2 : op_bytes; dst = ea; fail_if(ops->read_cr == NULL); if ( (rc = ops->read_cr(0, &dst.val, ctxt)) ) ++++++ 22789-i386-no-x2apic.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1295625507 0 # Node ID 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa # Parent 5852612cd4c461e5219db73cc52de0c643c414e8 x86:x2apic: Disable x2apic on x86-32 permanently x2apic initialization on x86_32 uses vcpu pointer before it is initialized. As x2apic is unlikely to be used on x86_32, this patch disables x2apic permanently on x86_32. It also asserts the sanity of vcpu pointer before dereference to prevent further misuse. Signed-off-by: Fengzhe Zhang <fengzhe.zhang@intel.com> jb: Moved logic into check_x2apic_preenabled(), disabled dead code on x86_32. --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -958,6 +958,10 @@ void x2apic_setup(void) if ( !cpu_has_x2apic ) return; +#ifdef __i386__ + BUG(); +#else + if ( !opt_x2apic ) { if ( !x2apic_enabled ) @@ -1019,6 +1023,7 @@ restore_out: unmask_8259A(); out: +#endif /* !__i386__ */ if ( ioapic_entries ) free_ioapic_entries(ioapic_entries); } --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -25,6 +25,8 @@ #include <xen/smp.h> #include <asm/mach-default/mach_mpparse.h> +#ifndef __i386__ + static int x2apic_phys; /* By default we use logical cluster mode. */ boolean_param("x2apic_phys", x2apic_phys); @@ -137,6 +139,8 @@ const struct genapic *apic_x2apic_probe( return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; } +#endif /* !__i386__ */ + void __init check_x2apic_preenabled(void) { u32 lo, hi; @@ -149,7 +153,19 @@ void __init check_x2apic_preenabled(void if ( lo & MSR_IA32_APICBASE_EXTD ) { printk("x2APIC mode is already enabled by BIOS.\n"); +#ifndef __i386__ x2apic_enabled = 1; genapic = apic_x2apic_probe(); +#else + lo &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD); + wrmsr(MSR_IA32_APICBASE, lo, hi); + lo |= MSR_IA32_APICBASE_ENABLE; + wrmsr(MSR_IA32_APICBASE, lo, hi); + printk("x2APIC disabled permanently on x86_32.\n"); +#endif } + +#ifdef __i386__ + clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability); +#endif } ++++++ 22790-svm-resume-migrate-pirqs.patch ++++++ # HG changeset patch # User Keir Fraser <keir@xen.org> # Date 1295625605 0 # Node ID 43592043cefc8357e6e6a0ab9ba85ca480968cb1 # Parent 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa svm: migrate pirq with vcpu hvm_migrate_pirqs() is missing in svm_do_resume(). Signed-off-by: Wei Wang <wei.wang2@amd.com> --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -704,7 +704,7 @@ static void svm_do_resume(struct vcpu *v { v->arch.hvm_svm.launch_core = smp_processor_id(); hvm_migrate_timers(v); - + hvm_migrate_pirqs(v); /* Migrating to another ASID domain. Request a new ASID. */ hvm_asid_flush_vcpu(v); } ++++++ 22816-x86-pirq-drop-priv-check.patch ++++++ # HG changeset patch # User Wei Gang <gang.wei@intel.com> # Date 1296032052 0 # Node ID e7f44fb4ecc378665d2cfd2353693a9f1a00cd72 # Parent 4785c70c2b6d1d8ab4dab3aa7431ef32d0c56362 x86: Fix pirq teardown on domain destruction. The privilege check in unmap_domain_pirq() fails since the teardown completes in RCU (idle domain) context. We can remove the check since it is covered in physdev_op() already, which is the only potentially unprivileged caller. Signed-off-by: Wei Gang <gang.wei@intel.com> --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1552,9 +1552,6 @@ int unmap_domain_pirq(struct domain *d, if ( (pirq < 0) || (pirq >= d->nr_pirqs) ) return -EINVAL; - if ( !IS_PRIV_FOR(current->domain, d) ) - return -EINVAL; - ASSERT(spin_is_locked(&pcidevs_lock)); ASSERT(spin_is_locked(&d->event_lock)); ++++++ 32on64-extra-mem.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:29.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:29.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2920,7 +2920,7 @@ class XendDomainInfo: +@@ -2919,7 +2919,7 @@ class XendDomainInfo: self.guest_bitsize = self.image.getBitSize() # Make sure there's enough RAM available for the domain ++++++ 7410-qemu-alt-gr.patch ++++++ # HG changeset patch # User Ian Jackson <ian.jackson@eu.citrix.com> # Date 1284481903 -3600 # Node ID f71a4c18e34e86e1011662fa42c10ec54bff0688 # Parent 080b5a094d4e0acab6646125f91f988911409016 ioemu: fix VNC altgr-insert behavior When access to a Xen DomU (Linux) from a VNC client in Windows, alt-gr key is not working properly with Spanish keyboard. When Alt + another key pressed, vncserver receives Altgr down, Altgr up and key down messages in order, that causes incorrect output. With following patch, when vncerver receives key down message, it first check if the keysym needs altgr modifer, if it needs altgr modifier but altgr is not 'down', sending altgr keycode before sending key keycode. Signed-off-by: Chunyan Liu <cyliu@novell.com> committer: Ian Jackson <Ian.Jackson@eu.citrix.com> git-commit-id: f95d202ed6444dacb15fbea4dee185eb0e048d9a diff -r 080b5a094d4e -r f71a4c18e34e keymaps.c --- a/tools/ioemu-qemu-xen/keymaps.c Wed Sep 08 16:38:09 2010 +0100 +++ b//tools/ioemu-qemu-xen/keymaps.c Tue Sep 14 17:31:43 2010 +0100 @@ -51,6 +51,7 @@ struct key_range *numlock_range; struct key_range *shift_range; struct key_range *localstate_range; + struct key_range *altgr_range; } kbd_layout_t; static void add_to_key_range(struct key_range **krp, int code) { @@ -133,7 +134,11 @@ add_to_key_range(&k->localstate_range, keycode); //fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode); } - + if (rest && strstr(rest, "altgr")) { + add_to_key_range(&k->altgr_range, keysym); + //fprintf(stderr, "altgr keysym %04x keycode %d\n", keysym, keycode); + } + /* if(keycode&0x80) keycode=(keycode<<8)^0x80e0; */ if (keysym < MAX_NORMAL_KEYCODE) { @@ -233,3 +238,16 @@ return 0; return 1; } + +static inline int keysym_is_altgr(void *kbd_layout, int keysym) +{ + kbd_layout_t *k = kbd_layout; + struct key_range *kr; + + for (kr = k->altgr_range; kr; kr = kr->next) + if (keysym >= kr->start && keysym <= kr->end){ + return 1; + } + return 0; +} + diff -r 080b5a094d4e -r f71a4c18e34e vnc.c --- a/tools/ioemu-qemu-xen/vnc.c Wed Sep 08 16:38:09 2010 +0100 +++ b/tools/ioemu-qemu-xen/vnc.c Tue Sep 14 17:31:43 2010 +0100 @@ -1274,12 +1274,27 @@ } } +static void press_key_altgr_down(VncState *vs, int down) +{ + kbd_put_keycode(0xe0); + if (down){ + kbd_put_keycode(0xb8 & 0x7f); + vs->modifiers_state[0xb8] = 1; + } + else { + kbd_put_keycode(0xb8 | 0x80); + vs->modifiers_state[0xb8] = 0; + } +} + static void do_key_event(VncState *vs, int down, uint32_t sym) { int keycode; int shift_keys = 0; int shift = 0; int keypad = 0; + int altgr = 0; + int altgr_keys = 0; if (is_graphic_console()) { if (sym >= 'A' && sym <= 'Z') { @@ -1289,8 +1304,11 @@ else { shift = keysym_is_shift(vs->kbd_layout, sym & 0xFFFF); } + + altgr = keysym_is_altgr(vs->kbd_layout, sym & 0xFFFF); } shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36]; + altgr_keys = vs->modifiers_state[0xb8]; keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF); if (keycode == 0) { @@ -1357,6 +1375,11 @@ } if (is_graphic_console()) { + + if (altgr && !altgr_keys) { + press_key_altgr_down(vs, down); + } + /* If the shift state needs to change then simulate an additional keypress before sending this one. Ignore for non shiftable keys. */ ++++++ 7426-xenfb-depth.patch ++++++ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xenfb.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xenfb.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xenfb.c @@ -622,6 +622,18 @@ static void xenfb_guest_copy(struct XenF oops = 1; } break; + case 16: + if (bpp == 16) { + for (line = y; line < (y+h); line++) { + memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset + + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8); + } + } else if (bpp == 32) { + BLT(uint16_t, uint32_t, 5, 6, 5, 8, 8, 8); + } else { + oops = 1; + } + break; case 24: if (bpp == 16) { BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); @@ -631,6 +643,18 @@ static void xenfb_guest_copy(struct XenF oops = 1; } break; + case 32: + if (bpp == 16) { + BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); + } else if (bpp == 32) { + for (line = y; line < (y+h); line++) { + memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset + + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8); + } + } else { + oops = 1; + } + break; default: oops = 1; } @@ -784,6 +808,7 @@ static void xenfb_update(void *opaque) static void xenfb_invalidate(void *opaque) { struct XenFB *xenfb = opaque; + xenfb->do_resize = 1; xenfb->up_fullscreen = 1; } ++++++ 7433-qemu-altgr.patch ++++++ # HG changeset patch # User Chun Yan Liu <cyliu@novell.com> # Date 1294271316 0 # Node ID a283996796c91dd29ecff444b78798e0ce902047 # Parent 39df13908a3ad54e79dd3b53ed307e57f12f6d3d fix '|' key display problem in en-us with altgr processing Commit f95d202ed644 handles altgr-insert problem. Unfortunately, with that patch, there is a problem in En-us keyboard: '|' (bar) cannot be displayed. After checking keymap files, we found there are two definitions to "bar" in en-us: bar 0x56 altgr (in "common") bar 0x2b shift (in "en-us") First line is actually invalid in en-us lanuage. The 2nd definition will cover the 1st one. The previous change in didn't consider multi-definition case. It scans keymap files, if keysym needs altgr, it will records that, after that, if keysym is pressed but altgr not pressed, it will add an altgr press opeartion. It is correct if all keysyms are unique and valid. But in the above multi-definition case, there is problem: when reading bar 0x56 altgr (in "common") it will record altgr needed, but in fact, that definition won't be used, it always use the 2nd definition and won't need altgr. Then if the keysym is pressed, the code will still add an altgr press operation, that will cause problem. So, if we cannot avoid multi-definition in keymap files, the altgr flag (whether altgr needed or not) should also be refreshed according to the 2nd defintion. In the above case, when reading the 1st line, it records altgr needed; then reading 2nd line, 2nd definition will cover the 1st, meanwhile the altgr flag should be reset (the 2nd definition doesn't need altgr, so altgr flag should be removed.) Following patch supplements f95d202ed644, and solve the problem. Signed-off-by: Chun Yan Liu <cyliu@novell.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> committer: Ian Jackson <Ian.Jackson@eu.citrix.com> git-commit-id: 99d53fbb69d3e03be61ae10506a304a3d08d792f # HG changeset patch # User Jan Beulich <jbeulich@novell.com> # Date 1295287237 0 # Node ID b47bf8f7a5e1959d6f5c62febaef9e81dc3231a0 # Parent b6bbe8be0afa54774a19ef43767a029ebddb2666 keymaps.c: fix use after free in del_key_range Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and the compiler indirectly warned about it. The patch is only compile tested (I don't even know how to reproduce the original problem), but I suppose worth applying regardless. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Chun Yan Liu <cyliu@novell.com> committer: Ian Jackson <Ian.Jackson@eu.citrix.com> git-commit-id: fdb22f24bc8adb3455b771d804496e11b4570085 --- a/tools/ioemu-qemu-xen/keymaps.c +++ b/tools/ioemu-qemu-xen/keymaps.c @@ -54,6 +54,17 @@ typedef struct { struct key_range *altgr_range; } kbd_layout_t; +static void del_key_range(struct key_range **krp, int code) { + struct key_range *kr; + while ((kr = *krp) != NULL) { + if (code >= kr->start && code <= kr->end) { + *krp = kr->next; + qemu_free(kr); + } else + krp = &kr->next; + } +} + static void add_to_key_range(struct key_range **krp, int code) { struct key_range *kr; for (kr = *krp; kr; kr = kr->next) { @@ -137,6 +148,8 @@ static kbd_layout_t *parse_keyboard_layo if (rest && strstr(rest, "altgr")) { add_to_key_range(&k->altgr_range, keysym); //fprintf(stderr, "altgr keysym %04x keycode %d\n", keysym, keycode); + } else { + del_key_range(&k->altgr_range, keysym); } /* if(keycode&0x80) --- a/tools/ioemu-qemu-xen/vnc.c +++ b/tools/ioemu-qemu-xen/vnc.c @@ -1279,11 +1279,9 @@ static void press_key_altgr_down(VncStat kbd_put_keycode(0xe0); if (down){ kbd_put_keycode(0xb8 & 0x7f); - vs->modifiers_state[0xb8] = 1; } else { kbd_put_keycode(0xb8 | 0x80); - vs->modifiers_state[0xb8] = 0; } } ++++++ 7434-qemu-rlimit-as.patch ++++++ # HG changeset patch # User Jan Beulich <jbeulich@novell.com> # Date 1294771190 0 # Node ID d224cef9d82c5c1ba9a6d73ca2628f288ce6f434 # Parent a283996796c91dd29ecff444b78798e0ce902047 bump RLIMIT_AS if restricted References: bnc#641419 Mostly the same as is already being done for several other RLIMIT_* values. Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Ian Jackson <Ian.Jackson@eu.citrix.com> git-commit-id: 2aa36d470e97f4baa219f78df82e2d3fe3d9f96d --- a/tools/ioemu-qemu-xen/vl.c +++ b/tools/ioemu-qemu-xen/vl.c @@ -4845,6 +4845,13 @@ int main(int argc, char **argv, char **e rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_DATA, &rl) != 0) perror("setrlimit(RLIMIT_DATA)"); + if (getrlimit(RLIMIT_AS, &rl) == 0) { + rl.rlim_cur = rl.rlim_max; + if (setrlimit(RLIMIT_AS, &rl) != 0) + perror("setrlimit(RLIMIT_AS)"); + } else { + perror("getrlimit(RLIMIT_AS)"); + } rl.rlim_cur = RLIM_INFINITY; rl.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_RSS, &rl) != 0) ++++++ altgr_2.patch ++++++ When access domU from Windows VNC client, spanish keyboard altgr key doesn't work. According to log info, we found that the keycodes passed from vncclient to qemu vncserver have something wrong. When altgr and "2" pressed, keycodes vncserver receives are: ALT_R down, CTRL_L down, CTRL_L up, ATL_R up, "2" down, "2" up, ... Since when send "2" down, there is no altgr modifier, the char displayed on screen will be "2" but not "@". To solve this problem, there is another patch applied by upstream which sends an additional altgr modifier before "2" down in the above case. It works well when domU is windows, but on sles10 sp3 domU, sometimes it display "@" and sometimes it still displays "2", especially when press altgr+2 continuously. For the sles10 sp3 domU problem, maybe because there are two many alt_r (same keycode as altgr on "es") up and down events and the domU OS couldn't handle it well. To furtherly solve this problem, I write this patch, when vncserver is "es" and receives a alt_r keysym (this is already abnormal since "es" has no alt_r), then treat the alt_r as alt_l. This can avoid too many altgr keycodes up and down events and make sure the intentionally added altgr keycode can take effect. Signed-off by Chunyan Liu (cyliu@novell.com) Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/vnc.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/vnc.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/vnc.c @@ -1308,6 +1308,9 @@ static void do_key_event(VncState *vs, i shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36]; altgr_keys = vs->modifiers_state[0xb8]; + if ( !strcmp(keyboard_layout,"es") && sym == 0xffea ) + sym = 0xffe9; + keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF); if (keycode == 0) { fprintf(stderr, "Key lost : keysym=0x%x(%d)\n", sym, sym); ++++++ blktap-pv-cdrom.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:29.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:29.000000000 +0100 @@ -741,7 +741,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/blktap/lib/blktaplib.h +++ xen-4.0.1-testing/tools/blktap/lib/blktaplib.h -@@ -225,6 +225,7 @@ typedef struct msg_pid { +@@ -224,6 +224,7 @@ typedef struct msg_pid { #define DISK_TYPE_RAM 3 #define DISK_TYPE_QCOW 4 #define DISK_TYPE_QCOW2 5 @@ -795,7 +795,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/server/BlktapController.py +++ xen-4.0.1-testing/tools/python/xen/xend/server/BlktapController.py -@@ -20,6 +20,7 @@ blktap1_disk_types = [ +@@ -21,6 +21,7 @@ blktap1_disk_types = [ 'ram', 'qcow', 'qcow2', ++++++ blktap2.patch ++++++ Calling function doesn't handle an "Exception" but only VmError, thus cleanup work won't been done if using Exception. Change it to VmError. Signed-off-by ChunyanLiu <cyliu@novell.com> Index: xen-4.0.1-testing/tools/python/xen/xend/server/BlktapController.py =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/server/BlktapController.py +++ xen-4.0.1-testing/tools/python/xen/xend/server/BlktapController.py @@ -4,6 +4,7 @@ import string, re from xen.xend.server.blkif import BlkifController from xen.xend.XendLogging import log from xen.util.xpopen import xPopen3 +from xen.xend.XendError import VmError phantomDev = 0; phantomId = 0; @@ -209,7 +210,7 @@ class Blktap2Controller(BlktapController out = stdout.read(); stdout.close(); stderr.close(); - raise Exception, 'Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file); + raise VmError('Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file)); minor, device, control = parseDeviceString(stdout.readline()) stdout.close(); ++++++ capslock_enable.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:29.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:29.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/vnc.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/vnc.c -@@ -1326,6 +1326,11 @@ static void do_key_event(VncState *vs, i +@@ -1342,6 +1342,11 @@ static void do_key_event(VncState *vs, i } break; case 0x3a: /* CapsLock */ ++++++ change_home_server.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:29.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:29.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3136,6 +3136,11 @@ class XendDomainInfo: +@@ -3135,6 +3135,11 @@ class XendDomainInfo: self._cleanup_phantom_devs(paths) self._cleanupVm() ++++++ cpupools-core-fixup.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -9,10 +9,8 @@ missing adjustments get detected at build time) - remove boot time per-CPU pool assignment messages (bnc#572146) -Index: xen-4.0.1-testing/xen/arch/x86/domain.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/domain.c -+++ xen-4.0.1-testing/xen/arch/x86/domain.c +--- a/xen/arch/x86/domain.c ++++ b/xen/arch/x86/domain.c @@ -1585,6 +1585,7 @@ int continue_hypercall_on_cpu(int cpu, v v->arch.schedule_tail = continue_hypercall_on_cpu_helper; @@ -31,10 +29,8 @@ raise_softirq(SCHEDULE_SOFTIRQ); /* Dummy return value will be overwritten by new schedule_tail. */ -Index: xen-4.0.1-testing/xen/common/sched_credit.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/common/sched_credit.c -+++ xen-4.0.1-testing/xen/common/sched_credit.c +--- a/xen/common/sched_credit.c ++++ b/xen/common/sched_credit.c @@ -176,7 +176,6 @@ struct csched_private { /* * Global variables @@ -58,11 +54,9 @@ .init_domain = csched_dom_init, .destroy_domain = csched_dom_destroy, -Index: xen-4.0.1-testing/xen/common/softirq.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/common/softirq.c -+++ xen-4.0.1-testing/xen/common/softirq.c -@@ -104,12 +104,15 @@ static void tasklet_schedule_list(struct +--- a/xen/common/softirq.c ++++ b/xen/common/softirq.c +@@ -114,12 +114,15 @@ static void tasklet_schedule_list(struct { BUG_ON(!list_empty(&t->list)); list_add_tail(&t->list, tlist); @@ -79,7 +73,7 @@ } spin_unlock_irqrestore(&tasklet_lock, flags); -@@ -120,7 +123,7 @@ void tasklet_schedule(struct tasklet *t) +@@ -130,7 +133,7 @@ void tasklet_schedule(struct tasklet *t) tasklet_schedule_list(t, &tasklet_list, smp_processor_id()); } @@ -88,7 +82,7 @@ { tasklet_schedule_list(t, &per_cpu(tasklet_list_pcpu, cpu), cpu); } -@@ -156,7 +159,15 @@ static void tasklet_action(void) +@@ -166,7 +169,15 @@ static void tasklet_action(void) if ( t->is_scheduled ) { BUG_ON(t->is_dead || !list_empty(&t->list)); @@ -105,10 +99,8 @@ } /* -Index: xen-4.0.1-testing/xen/include/public/domctl.h -=================================================================== ---- xen-4.0.1-testing.orig/xen/include/public/domctl.h -+++ xen-4.0.1-testing/xen/include/public/domctl.h +--- a/xen/include/public/domctl.h ++++ b/xen/include/public/domctl.h @@ -35,7 +35,7 @@ #include "xen.h" #include "grant_table.h" @@ -118,11 +110,9 @@ struct xenctl_cpumap { XEN_GUEST_HANDLE_64(uint8) bitmap; -Index: xen-4.0.1-testing/xen/include/xen/softirq.h -=================================================================== ---- xen-4.0.1-testing.orig/xen/include/xen/softirq.h -+++ xen-4.0.1-testing/xen/include/xen/softirq.h -@@ -50,15 +50,17 @@ struct tasklet +--- a/xen/include/xen/softirq.h ++++ b/xen/include/xen/softirq.h +@@ -52,15 +52,17 @@ struct tasklet bool_t is_scheduled; bool_t is_running; bool_t is_dead; ++++++ cpupools-core.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -1,7 +1,9 @@ From: Juergen Gross <juergen.gross@ts.fujitsu.com> ---- a/xen/arch/x86/acpi/power.c -+++ b/xen/arch/x86/acpi/power.c +Index: xen-4.0.1-testing/xen/arch/x86/acpi/power.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/acpi/power.c ++++ xen-4.0.1-testing/xen/arch/x86/acpi/power.c @@ -234,7 +234,7 @@ static int enter_state(u32 state) return error; } @@ -20,8 +22,10 @@ } static int acpi_get_wake_status(void) ---- a/xen/arch/x86/domain.c -+++ b/xen/arch/x86/domain.c +Index: xen-4.0.1-testing/xen/arch/x86/domain.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/domain.c ++++ xen-4.0.1-testing/xen/arch/x86/domain.c @@ -1522,42 +1522,52 @@ void sync_vcpu_execstate(struct vcpu *v) } @@ -135,8 +139,10 @@ return 0; } ---- a/xen/arch/x86/domain_build.c -+++ b/xen/arch/x86/domain_build.c +Index: xen-4.0.1-testing/xen/arch/x86/domain_build.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/domain_build.c ++++ xen-4.0.1-testing/xen/arch/x86/domain_build.c @@ -9,6 +9,7 @@ #include <xen/lib.h> #include <xen/ctype.h> @@ -154,7 +160,7 @@ if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) opt_dom0_max_vcpus = MAX_VIRT_CPUS; -@@ -287,7 +288,7 @@ int __init construct_dom0( +@@ -296,7 +297,7 @@ int __init construct_dom0( unsigned long _initrd_start, unsigned long initrd_len, char *cmdline) { @@ -163,7 +169,7 @@ struct cpu_user_regs *regs; unsigned long pfn, mfn; unsigned long nr_pages; -@@ -786,8 +787,12 @@ int __init construct_dom0( +@@ -795,8 +796,12 @@ int __init construct_dom0( printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus); @@ -177,8 +183,10 @@ /* Set up CR3 value for write_ptbase */ if ( paging_mode_enabled(d) ) ---- a/xen/arch/x86/microcode.c -+++ b/xen/arch/x86/microcode.c +Index: xen-4.0.1-testing/xen/arch/x86/microcode.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/microcode.c ++++ xen-4.0.1-testing/xen/arch/x86/microcode.c @@ -114,7 +114,7 @@ static int microcode_update_cpu(const vo return err; } @@ -206,8 +214,10 @@ + return continue_hypercall_on_cpu(info->cpu, NULL, + do_microcode_update, info); } ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c +Index: xen-4.0.1-testing/xen/arch/x86/mm.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/mm.c ++++ xen-4.0.1-testing/xen/arch/x86/mm.c @@ -243,7 +243,7 @@ void __init arch_init_memory(void) * Any Xen-heap pages that we will allow to be mapped will have * their domain field set to dom_xen. @@ -234,8 +244,10 @@ BUG_ON(dom_cow == NULL); /* First 1MB of RAM is historically marked as I/O. */ ---- a/xen/arch/x86/platform_hypercall.c -+++ b/xen/arch/x86/platform_hypercall.c +Index: xen-4.0.1-testing/xen/arch/x86/platform_hypercall.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/platform_hypercall.c ++++ xen-4.0.1-testing/xen/arch/x86/platform_hypercall.c @@ -48,12 +48,12 @@ static DEFINE_PER_CPU(uint64_t, freq); extern int set_px_pminfo(uint32_t cpu, struct xen_processor_performance *perf); extern long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power); @@ -251,7 +263,7 @@ { int cpu = (unsigned long)data; return cpu_down(cpu); -@@ -314,7 +314,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe +@@ -317,7 +317,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe if ( op->u.change_freq.flags || !cpu_online(op->u.change_freq.cpu) ) break; per_cpu(freq, op->u.change_freq.cpu) = op->u.change_freq.freq; @@ -260,7 +272,7 @@ cpu_frequency_change_helper, NULL); break; -@@ -470,7 +470,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe +@@ -473,7 +473,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe break; } ret = continue_hypercall_on_cpu( @@ -269,8 +281,10 @@ break; } break; ---- a/xen/arch/x86/setup.c -+++ b/xen/arch/x86/setup.c +Index: xen-4.0.1-testing/xen/arch/x86/setup.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/setup.c ++++ xen-4.0.1-testing/xen/arch/x86/setup.c @@ -2,6 +2,7 @@ #include <xen/init.h> #include <xen/lib.h> @@ -288,7 +302,7 @@ if ( idle_domain == NULL ) BUG(); idle_domain->vcpu = idle_vcpu; -@@ -1122,8 +1123,13 @@ void __init __start_xen(unsigned long mb +@@ -1121,8 +1122,13 @@ void __init __start_xen(unsigned long mb if ( !tboot_protect_mem_regions() ) panic("Could not protect TXT memory regions\n"); @@ -303,8 +317,10 @@ if ( (dom0 == NULL) || (alloc_dom0_vcpu0() == NULL) ) panic("Error creating domain 0\n"); ---- a/xen/arch/x86/smpboot.c -+++ b/xen/arch/x86/smpboot.c +Index: xen-4.0.1-testing/xen/arch/x86/smpboot.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/smpboot.c ++++ xen-4.0.1-testing/xen/arch/x86/smpboot.c @@ -39,6 +39,7 @@ #include <xen/mm.h> #include <xen/domain.h> @@ -313,7 +329,7 @@ #include <xen/irq.h> #include <xen/delay.h> #include <xen/softirq.h> -@@ -1306,10 +1307,11 @@ int __cpu_disable(void) +@@ -1305,10 +1306,11 @@ int __cpu_disable(void) __sync_lazy_execstate(); /* It's now safe to remove this processor from the online map */ @@ -326,7 +342,7 @@ return 0; } -@@ -1341,16 +1343,12 @@ static int take_cpu_down(void *unused) +@@ -1340,16 +1342,12 @@ static int take_cpu_down(void *unused) int cpu_down(unsigned int cpu) { int err = 0; @@ -344,7 +360,7 @@ /* Can not offline BSP */ if (cpu == 0) { err = -EINVAL; -@@ -1364,6 +1362,11 @@ int cpu_down(unsigned int cpu) +@@ -1363,6 +1361,11 @@ int cpu_down(unsigned int cpu) printk("Prepare to bring CPU%d down...\n", cpu); @@ -356,7 +372,7 @@ cpufreq_del_cpu(cpu); err = stop_machine_run(take_cpu_down, NULL, cpu); -@@ -1379,6 +1382,8 @@ int cpu_down(unsigned int cpu) +@@ -1378,6 +1381,8 @@ int cpu_down(unsigned int cpu) out: if (!err) send_guest_global_virq(dom0, VIRQ_PCPU_STATE); @@ -365,7 +381,7 @@ spin_unlock(&cpu_add_remove_lock); return err; } -@@ -1568,6 +1573,7 @@ int __devinit __cpu_up(unsigned int cpu) +@@ -1567,6 +1572,7 @@ int __devinit __cpu_up(unsigned int cpu) process_pending_softirqs(); } @@ -373,8 +389,10 @@ cpufreq_add_cpu(cpu); return 0; } ---- a/xen/arch/x86/sysctl.c -+++ b/xen/arch/x86/sysctl.c +Index: xen-4.0.1-testing/xen/arch/x86/sysctl.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/arch/x86/sysctl.c ++++ xen-4.0.1-testing/xen/arch/x86/sysctl.c @@ -29,7 +29,7 @@ #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) @@ -393,8 +411,10 @@ break; case XEN_SYSCTL_CPU_HOTPLUG_STATUS: ret = 0; ---- a/xen/common/Makefile -+++ b/xen/common/Makefile +Index: xen-4.0.1-testing/xen/common/Makefile +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/Makefile ++++ xen-4.0.1-testing/xen/common/Makefile @@ -1,5 +1,6 @@ obj-y += bitmap.o obj-y += cpu.o @@ -402,8 +422,10 @@ obj-y += domctl.o obj-y += domain.o obj-y += event_channel.o +Index: xen-4.0.1-testing/xen/common/cpupool.c +=================================================================== --- /dev/null -+++ b/xen/common/cpupool.c ++++ xen-4.0.1-testing/xen/common/cpupool.c @@ -0,0 +1,609 @@ +/****************************************************************************** + * cpupool.c @@ -1014,8 +1036,10 @@ + * indent-tabs-mode: nil + * End: + */ ---- a/xen/common/domain.c -+++ b/xen/common/domain.c +Index: xen-4.0.1-testing/xen/common/domain.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/domain.c ++++ xen-4.0.1-testing/xen/common/domain.c @@ -209,7 +209,7 @@ static void __init parse_extra_guest_irq custom_param("extra_guest_irqs", parse_extra_guest_irqs); @@ -1044,8 +1068,10 @@ sched_destroy_domain(d); /* Free page used by xen oprofile buffer. */ ---- a/xen/common/domctl.c -+++ b/xen/common/domctl.c +Index: xen-4.0.1-testing/xen/common/domctl.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/domctl.c ++++ xen-4.0.1-testing/xen/common/domctl.c @@ -11,6 +11,7 @@ #include <xen/lib.h> #include <xen/mm.h> @@ -1121,8 +1147,10 @@ if ( alloc_vcpu(d, i, cpu) == NULL ) goto maxvcpu_out; ---- a/xen/common/kexec.c -+++ b/xen/common/kexec.c +Index: xen-4.0.1-testing/xen/common/kexec.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/kexec.c ++++ xen-4.0.1-testing/xen/common/kexec.c @@ -235,7 +235,7 @@ void kexec_crash(void) BUG(); } @@ -1141,8 +1169,10 @@ break; case KEXEC_TYPE_CRASH: kexec_crash(); /* Does not return */ ---- a/xen/common/sched_credit.c -+++ b/xen/common/sched_credit.c +Index: xen-4.0.1-testing/xen/common/sched_credit.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/sched_credit.c ++++ xen-4.0.1-testing/xen/common/sched_credit.c @@ -70,11 +70,15 @@ /* * Useful macros @@ -2031,7 +2061,7 @@ .destroy_vcpu = csched_vcpu_destroy, .sleep = csched_vcpu_sleep, -@@ -1411,6 +1540,13 @@ const struct scheduler sched_credit_def +@@ -1411,6 +1540,13 @@ const struct scheduler sched_credit_def .dump_cpu_state = csched_dump_pcpu, .dump_settings = csched_dump, .init = csched_init, @@ -2045,8 +2075,10 @@ .tick_suspend = csched_tick_suspend, .tick_resume = csched_tick_resume, ---- a/xen/common/sched_sedf.c -+++ b/xen/common/sched_sedf.c +Index: xen-4.0.1-testing/xen/common/sched_sedf.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/sched_sedf.c ++++ xen-4.0.1-testing/xen/common/sched_sedf.c @@ -21,6 +21,9 @@ printk(_a ); \ } while ( 0 ) @@ -2057,7 +2089,7 @@ #ifndef NDEBUG #define SEDF_STATS #define CHECK(_p) \ -@@ -132,7 +135,7 @@ struct sedf_cpu_info { +@@ -131,7 +134,7 @@ struct sedf_cpu_info { #define sedf_runnable(edom) (!(EDOM_INFO(edom)->status & SEDF_ASLEEP)) @@ -2066,7 +2098,7 @@ static inline int extraq_on(struct vcpu *d, int i) { -@@ -329,30 +332,17 @@ static inline void __add_to_runqueue_sor +@@ -328,30 +331,17 @@ static inline void __add_to_runqueue_sor } @@ -2103,7 +2135,7 @@ /* Every VCPU gets an equal share of extratime by default. */ inf->deadl_abs = 0; inf->latency = 0; -@@ -383,39 +373,88 @@ static int sedf_init_vcpu(struct vcpu *v +@@ -382,39 +372,88 @@ static int sedf_init_vcpu(struct vcpu *v } else { @@ -2205,7 +2237,7 @@ return first_cpu(online_affinity); } -@@ -751,7 +790,7 @@ static struct task_slice sedf_do_extra_s +@@ -750,7 +789,7 @@ static struct task_slice sedf_do_extra_s -timeslice for the current period used up -domain on waitqueue has started it's period -and various others ;) in general: determine which domain to run next*/ @@ -2214,7 +2246,7 @@ { int cpu = smp_processor_id(); struct list_head *runq = RUNQ(cpu); -@@ -786,6 +825,13 @@ static struct task_slice sedf_do_schedul +@@ -785,6 +824,13 @@ static struct task_slice sedf_do_schedul } check_waitq: update_queues(now, runq, waitq); @@ -2228,7 +2260,7 @@ /*now simply pick the first domain from the runqueue, which has the earliest deadline, because the list is sorted*/ -@@ -848,7 +894,7 @@ static struct task_slice sedf_do_schedul +@@ -847,7 +893,7 @@ static struct task_slice sedf_do_schedul } @@ -2237,7 +2269,7 @@ { PRINT(2,"sedf_sleep was called, domain-id %i.%i\n", d->domain->domain_id, d->vcpu_id); -@@ -1067,7 +1113,7 @@ static inline int should_switch(struct v +@@ -1066,7 +1112,7 @@ static inline int should_switch(struct v return 1; } @@ -2246,7 +2278,7 @@ { s_time_t now = NOW(); struct sedf_vcpu_info* inf = EDOM_INFO(d); -@@ -1220,8 +1266,8 @@ static void sedf_dump_domain(struct vcpu +@@ -1219,8 +1265,8 @@ static void sedf_dump_domain(struct vcpu } @@ -2257,7 +2289,7 @@ { struct list_head *list, *queue, *tmp; struct sedf_vcpu_info *d_inf; -@@ -1294,7 +1340,7 @@ static void sedf_dump_cpu_state(int i) +@@ -1293,7 +1339,7 @@ static void sedf_dump_cpu_state(int i) /* Adjusts periods and slices of the domains accordingly to their weights. */ @@ -2266,7 +2298,7 @@ { struct vcpu *p; struct domain *d; -@@ -1315,6 +1361,8 @@ static int sedf_adjust_weights(struct xe +@@ -1314,6 +1360,8 @@ static int sedf_adjust_weights(struct xe rcu_read_lock(&domlist_read_lock); for_each_domain( d ) { @@ -2275,7 +2307,7 @@ for_each_vcpu( d, p ) { if ( EDOM_INFO(p)->weight ) -@@ -1366,7 +1414,7 @@ static int sedf_adjust_weights(struct xe +@@ -1365,7 +1413,7 @@ static int sedf_adjust_weights(struct xe /* set or fetch domain scheduling parameters */ @@ -2284,7 +2316,7 @@ { struct vcpu *v; int rc; -@@ -1376,9 +1424,6 @@ static int sedf_adjust(struct domain *p, +@@ -1375,9 +1423,6 @@ static int sedf_adjust(struct domain *p, p->domain_id, op->u.sedf.period, op->u.sedf.slice, op->u.sedf.latency, (op->u.sedf.extratime)?"yes":"no"); @@ -2294,7 +2326,7 @@ if ( op->cmd == XEN_DOMCTL_SCHEDOP_putinfo ) { /* Check for sane parameters. */ -@@ -1428,7 +1473,7 @@ static int sedf_adjust(struct domain *p, +@@ -1427,7 +1472,7 @@ static int sedf_adjust(struct domain *p, } } @@ -2303,7 +2335,7 @@ if ( rc ) return rc; -@@ -1456,7 +1501,7 @@ static int sedf_adjust(struct domain *p, +@@ -1455,7 +1500,7 @@ static int sedf_adjust(struct domain *p, return 0; } @@ -2312,7 +2344,7 @@ .name = "Simple EDF Scheduler", .opt_name = "sedf", .sched_id = XEN_SCHEDULER_SEDF, -@@ -1464,9 +1509,15 @@ const struct scheduler sched_sedf_def = +@@ -1463,9 +1508,15 @@ const struct scheduler sched_sedf_def = .init_domain = sedf_init_domain, .destroy_domain = sedf_destroy_domain, @@ -2329,8 +2361,10 @@ .do_schedule = sedf_do_schedule, .pick_cpu = sedf_pick_cpu, .dump_cpu_state = sedf_dump_cpu_state, ---- a/xen/common/schedule.c -+++ b/xen/common/schedule.c +Index: xen-4.0.1-testing/xen/common/schedule.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/schedule.c ++++ xen-4.0.1-testing/xen/common/schedule.c @@ -53,10 +53,11 @@ static void poll_timer_fn(void *data); /* This is global for now so that private implementations can reach it */ @@ -2849,9 +2883,11 @@ } #ifdef CONFIG_COMPAT ---- a/xen/common/softirq.c -+++ b/xen/common/softirq.c -@@ -88,9 +88,11 @@ void raise_softirq(unsigned int nr) +Index: xen-4.0.1-testing/xen/common/softirq.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/softirq.c ++++ xen-4.0.1-testing/xen/common/softirq.c +@@ -98,9 +98,11 @@ void raise_softirq(unsigned int nr) } static LIST_HEAD(tasklet_list); @@ -2864,7 +2900,7 @@ { unsigned long flags; -@@ -101,28 +103,44 @@ void tasklet_schedule(struct tasklet *t) +@@ -111,28 +113,44 @@ void tasklet_schedule(struct tasklet *t) if ( !t->is_scheduled && !t->is_running ) { BUG_ON(!list_empty(&t->list)); @@ -2913,7 +2949,7 @@ list_del_init(&t->list); BUG_ON(t->is_dead || t->is_running || !t->is_scheduled); -@@ -138,14 +156,15 @@ static void tasklet_action(void) +@@ -148,14 +166,15 @@ static void tasklet_action(void) if ( t->is_scheduled ) { BUG_ON(t->is_dead || !list_empty(&t->list)); @@ -2931,7 +2967,7 @@ raise_softirq(TASKLET_SOFTIRQ); spin_unlock_irq(&tasklet_lock); -@@ -186,6 +205,12 @@ void tasklet_init( +@@ -196,6 +215,12 @@ void tasklet_init( void __init softirq_init(void) { @@ -2944,8 +2980,10 @@ open_softirq(TASKLET_SOFTIRQ, tasklet_action); } ---- a/xen/common/sysctl.c -+++ b/xen/common/sysctl.c +Index: xen-4.0.1-testing/xen/common/sysctl.c +=================================================================== +--- xen-4.0.1-testing.orig/xen/common/sysctl.c ++++ xen-4.0.1-testing/xen/common/sysctl.c @@ -314,6 +314,14 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc } break; @@ -2961,8 +2999,10 @@ default: ret = arch_do_sysctl(op, u_sysctl); break; ---- a/xen/include/asm-x86/domain.h -+++ b/xen/include/asm-x86/domain.h +Index: xen-4.0.1-testing/xen/include/asm-x86/domain.h +=================================================================== +--- xen-4.0.1-testing.orig/xen/include/asm-x86/domain.h ++++ xen-4.0.1-testing/xen/include/asm-x86/domain.h @@ -458,7 +458,8 @@ struct arch_vcpu #define hvm_svm hvm_vcpu.u.svm @@ -2973,8 +3013,10 @@ void vcpu_show_execution_state(struct vcpu *); void vcpu_show_registers(const struct vcpu *); ---- a/xen/include/public/domctl.h -+++ b/xen/include/public/domctl.h +Index: xen-4.0.1-testing/xen/include/public/domctl.h +=================================================================== +--- xen-4.0.1-testing.orig/xen/include/public/domctl.h ++++ xen-4.0.1-testing/xen/include/public/domctl.h @@ -60,10 +60,10 @@ struct xen_domctl_createdomain { /* Should domain memory integrity be verifed by tboot during Sx? */ #define _XEN_DOMCTL_CDF_s3_integrity 2 @@ -3003,8 +3045,10 @@ struct xen_domctl { uint32_t cmd; #define XEN_DOMCTL_createdomain 1 ---- a/xen/include/public/sysctl.h -+++ b/xen/include/public/sysctl.h +Index: xen-4.0.1-testing/xen/include/public/sysctl.h +=================================================================== +--- xen-4.0.1-testing.orig/xen/include/public/sysctl.h ++++ xen-4.0.1-testing/xen/include/public/sysctl.h @@ -491,6 +491,28 @@ struct xen_sysctl_lockprof_op { typedef struct xen_sysctl_lockprof_op xen_sysctl_lockprof_op_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_lockprof_op_t); @@ -3042,8 +3086,10 @@ uint8_t pad[128]; } u; }; ---- a/xen/include/xen/sched-if.h -+++ b/xen/include/xen/sched-if.h +Index: xen-4.0.1-testing/xen/include/xen/sched-if.h +=================================================================== +--- xen-4.0.1-testing.orig/xen/include/xen/sched-if.h ++++ xen-4.0.1-testing/xen/include/xen/sched-if.h @@ -10,16 +10,26 @@ #include <xen/percpu.h> @@ -3135,8 +3181,10 @@ +struct scheduler *scheduler_get_by_id(unsigned int id); + #endif /* __XEN_SCHED_IF_H__ */ ---- a/xen/include/xen/sched.h -+++ b/xen/include/xen/sched.h +Index: xen-4.0.1-testing/xen/include/xen/sched.h +=================================================================== +--- xen-4.0.1-testing.orig/xen/include/xen/sched.h ++++ xen-4.0.1-testing/xen/include/xen/sched.h @@ -9,6 +9,7 @@ #include <xen/shared.h> #include <public/xen.h> @@ -3145,7 +3193,7 @@ #include <public/vcpu.h> #include <public/xsm/acm.h> #include <xen/time.h> -@@ -132,8 +133,6 @@ struct vcpu +@@ -132,8 +133,6 @@ struct vcpu bool_t defer_shutdown; /* VCPU is paused following shutdown request (d->is_shutting_down)? */ bool_t paused_for_shutdown; @@ -3218,9 +3266,11 @@ #endif /* __SCHED_H__ */ /* ---- a/xen/include/xen/softirq.h -+++ b/xen/include/xen/softirq.h -@@ -58,6 +58,7 @@ struct tasklet +Index: xen-4.0.1-testing/xen/include/xen/softirq.h +=================================================================== +--- xen-4.0.1-testing.orig/xen/include/xen/softirq.h ++++ xen-4.0.1-testing/xen/include/xen/softirq.h +@@ -60,6 +60,7 @@ struct tasklet struct tasklet name = { LIST_HEAD_INIT(name.list), 0, 0, 0, func, data } void tasklet_schedule(struct tasklet *t); ++++++ del_usb_xend_entry.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1313,8 +1313,15 @@ class XendDomainInfo: +@@ -1312,8 +1312,15 @@ class XendDomainInfo: frontpath = self.getDeviceController(deviceClass).frontendPath(dev) backpath = xstransact.Read(frontpath, "backend") thread.start_new_thread(self.getDeviceController(deviceClass).finishDeviceCleanup, (backpath, path)) ++++++ domUloader.py ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -50,6 +50,18 @@ # Helper functions +def kpartx_has_opt(opt): + """ Return True if kpartx supports option opt, otherwise False""" + have_opt = True + kpartx_cmd = 'kpartx -' + opt + ' 2>&1' + p = os.popen(kpartx_cmd) + for line in p.readlines(): + if line.find('invalid option') >= 0: + have_opt = False + break + p.close() + return have_opt + def error(s): print >> sys.stderr, "domUloader error: %s" % s @@ -75,6 +87,9 @@ # """Determines whether dev is a wholedisk dev""" # return not domUname[-1:].isdigit() +# If available, add '-f' option (bnc#613584) +if kpartx_has_opt('f'): + kpartx_args += ' -f' class Wholedisk: "Class representing a whole disk that may have partitions" ++++++ ioemu-blktap-image-format.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -55,7 +55,7 @@ fprintf(stderr, "Could not open image file %s\n", path); return -ENOMEM; } -@@ -525,7 +541,7 @@ static void handle_blktap_ctrlmsg(void* +@@ -521,7 +537,7 @@ static void handle_blktap_ctrlmsg(void* s = state_init(); /*Open file*/ @@ -68,7 +68,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.h +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h -@@ -52,4 +52,18 @@ typedef struct fd_list_entry { +@@ -53,4 +53,18 @@ typedef struct fd_list_entry { int init_blktap(void); ++++++ ioemu-disable-emulated-ide-if-pv.patch ++++++ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/qemu-xen.h =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/qemu-xen.h @@ -1,6 +1,8 @@ #ifndef QEMU_XEN_H #define QEMU_XEN_H +#include "hw/boards.h" + /* vl.c */ extern int restore; extern int vga_ram_size; @@ -73,7 +75,7 @@ void handle_buffered_pio(void); #endif /* xenstore.c */ -void xenstore_parse_domain_config(int domid); +void xenstore_parse_domain_config(int domid, QEMUMachine *machine); int xenstore_parse_disable_pf_config(void); int xenstore_fd(void); void xenstore_process_event(void *opaque); Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/vl.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/vl.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/vl.c @@ -5827,10 +5827,10 @@ int main(int argc, char **argv, char **e if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s))) fprintf(stderr,"Can not read our own domid: %s\n", msg); else - xenstore_parse_domain_config(atoi(domid_s)); + xenstore_parse_domain_config(atoi(domid_s), machine); } #else - xenstore_parse_domain_config(domid); + xenstore_parse_domain_config(domid, machine); #endif /* CONFIG_STUBDOM */ /* we always create the cdrom drive, even if no disk is there */ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/xenstore.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/xenstore.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/xenstore.c @@ -397,7 +397,7 @@ static const char *xenstore_get_guest_uu #define PT_PCI_POWER_MANAGEMENT_DEFAULT 0 int direct_pci_msitranslate; int direct_pci_power_mgmt; -void xenstore_parse_domain_config(int hvm_domid) +void xenstore_parse_domain_config(int hvm_domid, QEMUMachine *machine) { char **e_danger = NULL; char *buf = NULL; @@ -718,15 +718,19 @@ void xenstore_parse_domain_config(int hv #endif - drives_table[nb_drives].bdrv = bs; - drives_table[nb_drives].used = 1; + if (machine == &xenfv_machine) { + drives_table[nb_drives].bdrv = bs; + drives_table[nb_drives].used = 1; #ifdef CONFIG_STUBDOM - media_filename[nb_drives] = strdup(danger_buf); + media_filename[nb_drives] = strdup(danger_buf); #else - media_filename[nb_drives] = strdup(bs->filename); + media_filename[nb_drives] = strdup(bs->filename); #endif - nb_drives++; - + nb_drives++; + } else { + qemu_aio_flush(); + bdrv_close(bs); + } } #ifdef CONFIG_STUBDOM ++++++ ioemu-vnc-resize.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/vnc.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/vnc.c -@@ -1713,6 +1713,25 @@ static int protocol_client_msg(VncState +@@ -1734,6 +1734,25 @@ static int protocol_client_msg(VncState } set_encodings(vs, (int32_t *)(data + 4), limit); ++++++ multi-xvdp.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -34,7 +34,7 @@ xc = xen.lowlevel.xc.xc() xoptions = XendOptions.instance() -@@ -3314,20 +3314,27 @@ class XendDomainInfo: +@@ -3304,20 +3304,27 @@ class XendDomainInfo: # This is a file, not a device. pygrub can cope with a # file if it's raw, but if it's QCOW or other such formats # used through blktap, then we need to mount it first. @@ -76,7 +76,7 @@ try: blcfg = bootloader(blexec, fn, self, False, -@@ -3335,11 +3342,11 @@ class XendDomainInfo: +@@ -3325,11 +3332,11 @@ class XendDomainInfo: finally: if mounted: log.info("Unmounting %s from %s." % ++++++ snapshot-ioemu-delete.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/xenstore.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -935,6 +935,18 @@ static void xenstore_process_dm_command_ +@@ -941,6 +941,18 @@ static void xenstore_process_dm_command_ } snapshot_name = xs_read(xsh, XBT_NULL, path, &len); ++++++ snapshot-ioemu-restore.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -1,92 +1,3 @@ -Index: xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c -=================================================================== ---- xen-4.0.1-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c -@@ -348,6 +348,7 @@ static int write_msg(int fd, int msgtype - msg_dev = (msg_newdev_t *)(buf + sizeof(msg_hdr_t)); - msg_dev->devnum = blkif->minor; - msg_dev->domid = blkif->domid; -+ msg_dev->be_id = blkif->be_id; - - break; - -Index: xen-4.0.1-testing/tools/blktap/lib/blktaplib.h -=================================================================== ---- xen-4.0.1-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.0.1-testing/tools/blktap/lib/blktaplib.h -@@ -189,6 +189,7 @@ typedef struct msg_hdr { - typedef struct msg_newdev { - uint8_t devnum; - uint16_t domid; -+ uint32_t be_id; - } msg_newdev_t; - - typedef struct msg_pid { -Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -=================================================================== ---- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -67,6 +67,8 @@ int write_fd; - static pid_t process; - fd_list_entry_t *fd_start = NULL; - -+extern char* get_snapshot_name(int devid); -+ - static void handle_blktap_iomsg(void* private); - - struct aiocb_info { -@@ -500,6 +502,10 @@ static void handle_blktap_ctrlmsg(void* - - char buf[MSG_SIZE]; - -+#ifndef QEMU_TOOL -+ char *snapshot; -+#endif -+ - length = read(read_fd, buf, MSG_SIZE); - - if (length > 0 && length >= sizeof(msg_hdr_t)) -@@ -555,7 +561,39 @@ static void handle_blktap_ctrlmsg(void* - if (s != NULL) { - ret = ((map_new_dev(s, msg_dev->devnum) - == msg_dev->devnum ? 0: -1)); -- } -+ } -+ -+#ifndef QEMU_TOOL -+ fprintf(stderr, "Reading snapshot name for %d\n", msg_dev->be_id); -+ snapshot = get_snapshot_name(msg_dev->be_id); -+ if (snapshot) { -+ fprintf(stderr, "Using snapshot %s\n", snapshot); -+ ret = bdrv_snapshot_goto(s->bs, snapshot); -+ switch (ret) { -+ case 0: -+ /* Success */ -+ break; -+ case -ENOTSUP: -+ if (s->flags & TD_RDONLY) { -+ fprintf(stderr, "Snapshots not supported for " -+ "image format of a read-only image\n"); -+ } else { -+ fprintf(stderr, "Snapshots not supported " -+ "for this image format"); -+ ret = -1; -+ } -+ break; -+ case -ENOENT: -+ fprintf(stderr, "No such snapshot"); -+ ret = -1; -+ break; -+ default: -+ fprintf(stderr, "Could not load snapshot"); -+ ret = -1; -+ break; -+ } -+ } -+#endif - - memset(buf, 0x00, MSG_SIZE); - msglen = sizeof(msg_hdr_t); Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/xenstore.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/xenstore.c ++++++ snapshot-ioemu-save.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -207,7 +207,7 @@ #include "console.h" #include "hw.h" -@@ -862,6 +863,7 @@ static void xenstore_process_dm_command_ +@@ -868,6 +869,7 @@ static void xenstore_process_dm_command_ { char *path = NULL, *command = NULL, *par = NULL; unsigned int len; @@ -215,7 +215,7 @@ if (pasprintf(&path, "/local/domain/0/device-model/%u/command", domid) == -1) { -@@ -877,7 +879,18 @@ static void xenstore_process_dm_command_ +@@ -883,7 +885,18 @@ static void xenstore_process_dm_command_ if (!strncmp(command, "save", len)) { fprintf(logfile, "dm-command: pause and save state\n"); @@ -235,7 +235,7 @@ } else if (!strncmp(command, "continue", len)) { fprintf(logfile, "dm-command: continue after state save\n"); xen_pause_requested = 0; -@@ -1010,6 +1023,13 @@ void xenstore_record_dm_state(const char +@@ -1016,6 +1029,13 @@ void xenstore_record_dm_state(const char xenstore_record_dm("state", state); } ++++++ snapshot-without-pv-fix.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -22,7 +22,7 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/blktap/drivers/blktapctrl.c +++ xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c -@@ -381,7 +381,22 @@ static int write_msg(int fd, int msgtype +@@ -380,7 +380,22 @@ static int write_msg(int fd, int msgtype msg->cookie = blkif->cookie; break; @@ -46,7 +46,7 @@ default: return -1; } -@@ -476,6 +491,12 @@ static int read_msg(int fd, int msgtype, +@@ -475,6 +490,12 @@ static int read_msg(int fd, int msgtype, DPRINTF("\tPID: [%d]\n",blkif->tappid); } break; @@ -59,7 +59,7 @@ default: DPRINTF("UNKNOWN MESSAGE TYPE RECEIVED\n"); ret = 0; -@@ -758,6 +779,63 @@ static int unmap_blktapctrl(blkif_t *blk +@@ -757,6 +778,63 @@ static int unmap_blktapctrl(blkif_t *blk return 0; } @@ -123,7 +123,7 @@ int open_ctrl_socket(char *devname) { int ret; -@@ -854,6 +932,7 @@ int main(int argc, char *argv[]) +@@ -853,6 +931,7 @@ int main(int argc, char *argv[]) register_new_blkif_hook(blktapctrl_new_blkif); register_new_devmap_hook(map_new_blktapctrl); register_new_unmap_hook(unmap_blktapctrl); @@ -198,7 +198,7 @@ void __init_blkif(void); typedef struct busy_state { -@@ -210,6 +213,8 @@ typedef struct msg_pid { +@@ -209,6 +212,8 @@ typedef struct msg_pid { #define CTLMSG_CLOSE_RSP 8 #define CTLMSG_PID 9 #define CTLMSG_PID_RSP 10 @@ -298,7 +298,16 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -83,8 +83,18 @@ static void unmap_disk(struct td_state * +@@ -35,6 +35,8 @@ + #ifndef QEMU_TOOL + #include "qemu-common.h" + #include "sysemu.h" ++#include "irq.h" ++#include "hw.h" + #endif + + #include "xen_blktap.h" +@@ -81,8 +83,18 @@ static void unmap_disk(struct td_state * { tapdev_info_t *info = s->ring_info; fd_list_entry_t *entry; @@ -317,7 +326,7 @@ if (info != NULL && info->mem > 0) munmap(info->mem, getpagesize() * BLKTAP_MMAP_REGION_SIZE); -@@ -244,18 +254,6 @@ static int open_disk(struct td_state *s, +@@ -242,18 +254,6 @@ static int open_disk(struct td_state *s, s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0); @@ -336,7 +345,7 @@ return 0; } -@@ -496,7 +494,7 @@ static void handle_blktap_ctrlmsg(void* +@@ -494,7 +494,7 @@ static void handle_blktap_ctrlmsg(void* msg_hdr_t *msg; msg_newdev_t *msg_dev; msg_pid_t *msg_pid; @@ -345,14 +354,15 @@ struct td_state *s = NULL; fd_list_entry_t *entry; -@@ -622,6 +620,31 @@ static void handle_blktap_ctrlmsg(void* +@@ -584,6 +584,33 @@ static void handle_blktap_ctrlmsg(void* len = write(write_fd, buf, msglen); break; + case CTLMSG_ADDDEV: + s = get_state(msg->cookie); -+ if (s) { ++ if (s && !s->added) { +#ifndef QEMU_TOOL ++ ide_unplug_harddisks(); + for (i = 0; i < MAX_DRIVES + 1; i++) { + if (drives_table[i].bdrv == NULL) { + drives_table[i].bdrv = s->bs; @@ -361,6 +371,7 @@ + drives_table[i].unit = 0; + drives_table[i].used = 1; + nb_drives++; ++ s->added = 1; + break; + } + } @@ -377,3 +388,17 @@ default: break; } +Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h +=================================================================== +--- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.h ++++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h +@@ -40,7 +40,8 @@ struct td_state { + void *fd_entry; + uint64_t sector_size; + uint64_t size; +- unsigned int info; ++ unsigned int info; ++ int added; + }; + + typedef struct fd_list_entry { ++++++ snapshot-xend.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -47,12 +47,13 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/server/blkif.py +++ xen-4.0.1-testing/tools/python/xen/xend/server/blkif.py -@@ -88,6 +88,9 @@ class BlkifController(DevController): +@@ -88,6 +88,10 @@ class BlkifController(DevController): if bootable != None: back['bootable'] = str(bootable) + if 'snapshotname' in self.vm.info: + back['snapshot'] = self.vm.info['snapshotname'] ++ self.vm.info.pop('snapshotname') + if security.on() == xsconstants.XS_POLICY_USE: self.do_access_control(config, uname) @@ -115,7 +116,16 @@ from xen.xend import XendDomain try: -@@ -112,52 +112,61 @@ def save(fd, dominfo, network, live, dst +@@ -78,6 +78,8 @@ def save(fd, dominfo, network, live, dst + write_exact(fd, SIGNATURE, "could not write guest state file: signature") + + sxprep = dominfo.sxpr() ++ if name: ++ sxprep.append(['snapshotname', name]) + + if node > -1: + insert_after(sxprep,'vcpus',['node', str(node)]) +@@ -112,52 +114,61 @@ def save(fd, dominfo, network, live, dst image_cfg = dominfo.info.get('image', {}) hvm = dominfo.info.is_hvm() @@ -223,7 +233,7 @@ if checkpoint: dominfo.resumeDomain() -@@ -221,6 +230,71 @@ def restore(xd, fd, dominfo = None, paus +@@ -221,6 +232,71 @@ def restore(xd, fd, dominfo = None, paus if othervm is not None and othervm.domid is not None: raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid)) @@ -295,7 +305,7 @@ if dominfo: dominfo.resume() else: -@@ -329,24 +403,7 @@ def restore(xd, fd, dominfo = None, paus +@@ -329,24 +405,7 @@ def restore(xd, fd, dominfo = None, paus dominfo.completeRestore(handler.store_mfn, handler.console_mfn) @@ -345,7 +355,25 @@ xc = xen.lowlevel.xc.xc() xoptions = XendOptions.instance() -@@ -1576,6 +1577,187 @@ class XendDomain: +@@ -319,11 +320,16 @@ class XendDomain: + fd, fn = tempfile.mkstemp() + f = os.fdopen(fd, 'w+b') + try: ++ snapshotname = '' ++ if dominfo.info.has_key('snapshotname'): ++ snapshotname = dominfo.info.pop('snapshotname') ++ + prettyprint(dominfo.sxpr(legacy_only = False), f, + width = 78) + finally: + f.close() +- ++ if snapshotname: ++ dominfo.info['snapshotname'] = snapshotname + try: + shutil.move(fn, self._managed_config_path(dom_uuid)) + except: +@@ -1576,6 +1582,187 @@ class XendDomain: else: log.debug("error: Domain is not running!") @@ -658,3 +686,42 @@ "shutdown": xm_shutdown, "start": xm_start, "sysrq": xm_sysrq, +Index: xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py +=================================================================== +--- xen-4.0.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -507,7 +507,6 @@ class XendDomainInfo: + self._setSchedParams() + self._storeVmDetails() + self._createChannels() +- self._createDevices() + self._storeDomDetails() + self._endRestore() + except: +@@ -2383,7 +2382,7 @@ class XendDomainInfo: + return self.getDeviceController(deviceClass).reconfigureDevice( + devid, devconfig) + +- def _createDevices(self): ++ def _createDevices(self, resume = False): + """Create the devices for a vm. + + @raise: VmError for invalid devices +@@ -2432,7 +2431,7 @@ class XendDomainInfo: + + + if self.image: +- self.image.createDeviceModel() ++ self.image.createDeviceModel(resume) + + #if have pass-through devs, need the virtual pci slots info from qemu + self.pci_device_configure_boot() +@@ -3048,7 +3047,7 @@ class XendDomainInfo: + self._introduceDomain() + self.image = image.create(self, self.info) + if self.image: +- self.image.createDeviceModel(True) ++ self._createDevices(True) + self._storeDomDetails() + self._registerWatches() + self.refreshShutdown() ++++++ tapdisk-ioemu-shutdown-fix.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -20,15 +20,15 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -65,6 +65,7 @@ int read_fd; +@@ -67,6 +67,7 @@ int read_fd; int write_fd; static pid_t process; +int connected_disks = 0; fd_list_entry_t *fd_start = NULL; - extern char* get_snapshot_name(int devid); -@@ -545,6 +546,7 @@ static void handle_blktap_ctrlmsg(void* + static void handle_blktap_iomsg(void* private); +@@ -541,6 +542,7 @@ static void handle_blktap_ctrlmsg(void* /* Allocate the disk structs */ s = state_init(); @@ -36,7 +36,7 @@ /*Open file*/ if (s == NULL || open_disk(s, path, msg->drivertype, msg->readonly)) { -@@ -627,7 +629,8 @@ static void handle_blktap_ctrlmsg(void* +@@ -591,7 +593,8 @@ static void handle_blktap_ctrlmsg(void* case CTLMSG_CLOSE: s = get_state(msg->cookie); if (s) unmap_disk(s); ++++++ x86-cpufreq-report.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -17,7 +17,7 @@ struct xen_platform_op curop, *op = &curop; if ( !IS_PRIV(current->domain) ) -@@ -486,6 +487,24 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe +@@ -489,6 +490,24 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe op->u.mem_add.epfn, op->u.mem_add.pxm); break; ++++++ x86-ioapic-ack-default.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -11,7 +11,7 @@ static void setup_ioapic_ack(char *s) { if ( !strcmp(s, "old") ) -@@ -2062,6 +2062,8 @@ void __init setup_IO_APIC(void) +@@ -2075,6 +2075,8 @@ void __init setup_IO_APIC(void) else io_apic_irqs = ~PIC_IRQS; ++++++ x86-show-page-walk-early.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:30.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:30.000000000 +0100 @@ -1,7 +1,5 @@ -Index: xen-4.0.1-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/mm.c -+++ xen-4.0.1-testing/xen/arch/x86/mm.c +--- a/xen/arch/x86/mm.c ++++ b/xen/arch/x86/mm.c @@ -154,6 +154,8 @@ unsigned long __read_mostly pdx_group_va int opt_allow_hugepage; boolean_param("allowhugepage", opt_allow_hugepage); @@ -11,11 +9,9 @@ #define l1_disallow_mask(d) \ ((d != dom_io) && \ (rangeset_is_empty((d)->iomem_caps) && \ -Index: xen-4.0.1-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/traps.c -+++ xen-4.0.1-testing/xen/arch/x86/traps.c -@@ -1336,6 +1336,7 @@ asmlinkage void do_early_page_fault(stru +--- a/xen/arch/x86/traps.c ++++ b/xen/arch/x86/traps.c +@@ -1342,6 +1342,7 @@ asmlinkage void do_early_page_fault(stru unsigned long *stk = (unsigned long *)regs; printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", regs->cs, _p(regs->eip), _p(cr2), regs->error_code); @@ -23,10 +19,8 @@ printk("Stack dump: "); while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 ) printk("%p ", _p(*stk++)); -Index: xen-4.0.1-testing/xen/arch/x86/x86_32/mm.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-4.0.1-testing/xen/arch/x86/x86_32/mm.c +--- a/xen/arch/x86/x86_32/mm.c ++++ b/xen/arch/x86/x86_32/mm.c @@ -122,6 +122,8 @@ void __init paging_init(void) #undef CNT #undef MFN @@ -36,10 +30,8 @@ /* Create page tables for ioremap()/map_domain_page_global(). */ for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ ) { -Index: xen-4.0.1-testing/xen/arch/x86/x86_32/traps.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/x86_32/traps.c -+++ xen-4.0.1-testing/xen/arch/x86/x86_32/traps.c +--- a/xen/arch/x86/x86_32/traps.c ++++ b/xen/arch/x86/x86_32/traps.c @@ -161,7 +161,8 @@ void show_page_walk(unsigned long addr) l3t += (cr3 & 0xFE0UL) >> 3; l3e = l3t[l3_table_offset(addr)]; @@ -70,10 +62,8 @@ printk(" L1[0x%03lx] = %"PRIpte" %08lx\n", l1_table_offset(addr), l1e_get_intpte(l1e), pfn); unmap_domain_page(l1t); -Index: xen-4.0.1-testing/xen/arch/x86/x86_64/mm.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/x86_64/mm.c -+++ xen-4.0.1-testing/xen/arch/x86/x86_64/mm.c +--- a/xen/arch/x86/x86_64/mm.c ++++ b/xen/arch/x86/x86_64/mm.c @@ -725,6 +725,8 @@ void __init paging_init(void) #undef CNT #undef MFN @@ -83,10 +73,8 @@ /* Create user-accessible L2 directory to map the MPT for compat guests. */ BUILD_BUG_ON(l4_table_offset(RDWR_MPT_VIRT_START) != l4_table_offset(HIRO_COMPAT_MPT_VIRT_START)); -Index: xen-4.0.1-testing/xen/arch/x86/x86_64/traps.c -=================================================================== ---- xen-4.0.1-testing.orig/xen/arch/x86/x86_64/traps.c -+++ xen-4.0.1-testing/xen/arch/x86/x86_64/traps.c +--- a/xen/arch/x86/x86_64/traps.c ++++ b/xen/arch/x86/x86_64/traps.c @@ -176,7 +176,8 @@ void show_page_walk(unsigned long addr) l4t = mfn_to_virt(mfn); l4e = l4t[l4_table_offset(addr)]; @@ -127,10 +115,8 @@ printk(" L1[0x%03lx] = %"PRIpte" %016lx\n", l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -Index: xen-4.0.1-testing/xen/include/asm-x86/mm.h -=================================================================== ---- xen-4.0.1-testing.orig/xen/include/asm-x86/mm.h -+++ xen-4.0.1-testing/xen/include/asm-x86/mm.h +--- a/xen/include/asm-x86/mm.h ++++ b/xen/include/asm-x86/mm.h @@ -443,6 +443,8 @@ TYPE_SAFE(unsigned long,mfn); #define SHARED_M2P_ENTRY (~0UL - 1UL) #define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY) ++++++ xen-minimum-restart-time.patch ++++++ References: bnc#661298 Index: xen-4.0.1-testing/tools/python/xen/xend/XendConstants.py =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendConstants.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendConstants.py @@ -92,7 +92,7 @@ DOM_STATES_OLD = [ SHUTDOWN_TIMEOUT = (60.0 * 5) """Minimum time between domain restarts in seconds.""" -MINIMUM_RESTART_TIME = 60 +MINIMUM_RESTART_TIME = 10 RESTART_IN_PROGRESS = 'xend/restart_in_progress' DUMPCORE_IN_PROGRESS = 'xend/dumpcore_in_progress' ++++++ xend-domain-lock.patch ++++++ --- /var/tmp/diff_new_pack.kIpYU8/_old 2011-03-01 00:02:31.000000000 +0100 +++ /var/tmp/diff_new_pack.kIpYU8/_new 2011-03-01 00:02:31.000000000 +0100 @@ -94,7 +94,7 @@ XendTask.log_progress(0, 30, self._constructDomain) XendTask.log_progress(31, 60, self._initDomain) -@@ -2990,6 +2992,11 @@ class XendDomainInfo: +@@ -2989,6 +2991,11 @@ class XendDomainInfo: self._stateSet(DOM_STATE_HALTED) self.domid = None # Do not push into _stateSet()! @@ -106,7 +106,7 @@ finally: self.refresh_shutdown_lock.release() -@@ -4508,6 +4515,74 @@ class XendDomainInfo: +@@ -4498,6 +4505,74 @@ class XendDomainInfo: def has_device(self, dev_class, dev_uuid): return (dev_uuid in self.info['%s_refs' % dev_class.lower()]) @@ -232,15 +232,16 @@ =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -131,6 +131,7 @@ def save(fd, dominfo, network, live, dst +@@ -133,6 +133,8 @@ def save(fd, dominfo, network, live, dst dominfo.shutdown('suspend') dominfo.waitForSuspend() if line in ('suspend', 'suspended'): -+ dominfo.release_running_lock(domain_name) ++ if checkpoint == False: ++ dominfo.release_running_lock(domain_name) dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, domain_name) log.info("Domain %d suspended.", dominfo.getDomid()) -@@ -408,6 +409,7 @@ def restore(xd, fd, dominfo = None, paus +@@ -410,6 +412,7 @@ def restore(xd, fd, dominfo = None, paus if not paused: dominfo.unpause() ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de