Merge branch 'master' of ssh://arne_f@ipfire.org/pub/git/ipfire-2.x

Conflicts:
	make.sh
This commit is contained in:
Arne Fitzenreiter
2009-04-20 19:39:10 +02:00
84 changed files with 276605 additions and 23 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,667 @@
boot/xen-3.4.0-rc2-pre.gz
boot/xen-3.4.gz
boot/xen-3.gz
boot/xen-syms-3.4.0-rc2-pre
boot/xen.gz
etc/rc.d/init.d/xend
etc/rc.d/init.d/xendomains
etc/sysconfig/xendomains
etc/udev/rules.d/xen-backend.rules
etc/udev/rules.d/xend.rules
etc/udev/xen-backend.rules
etc/udev/xend.rules
etc/xen
#etc/xen/README
#etc/xen/README.incompatibilities
etc/xen/auto
etc/xen/qemu-ifup
etc/xen/scripts
etc/xen/scripts/block
etc/xen/scripts/block-common.sh
etc/xen/scripts/block-enbd
etc/xen/scripts/block-nbd
etc/xen/scripts/external-device-migrate
etc/xen/scripts/locking.sh
etc/xen/scripts/logging.sh
etc/xen/scripts/network-bridge
etc/xen/scripts/network-nat
etc/xen/scripts/network-route
etc/xen/scripts/vif-bridge
etc/xen/scripts/vif-common.sh
etc/xen/scripts/vif-nat
etc/xen/scripts/vif-route
etc/xen/scripts/vscsi
etc/xen/scripts/vtpm
etc/xen/scripts/vtpm-common.sh
etc/xen/scripts/vtpm-delete
etc/xen/scripts/vtpm-hotplug-common.sh
etc/xen/scripts/vtpm-impl
etc/xen/scripts/vtpm-migration.sh
etc/xen/scripts/xen-hotplug-cleanup
etc/xen/scripts/xen-hotplug-common.sh
etc/xen/scripts/xen-network-common.sh
etc/xen/scripts/xen-script-common.sh
etc/xen/xend-config.sxp
etc/xen/xend-pci-permissive.sxp
etc/xen/xend-pci-quirks.sxp
etc/xen/xm-config.xml
etc/xen/xmexample.hvm
etc/xen/xmexample.hvm-dm
etc/xen/xmexample.hvm-stubdom
etc/xen/xmexample.nbd
etc/xen/xmexample.pv-grub
etc/xen/xmexample.vti
etc/xen/xmexample1
etc/xen/xmexample2
etc/xen/xmexample3
usr/bin/pygrub
usr/bin/qemu-img-xen
usr/bin/qemu-nbd-xen
usr/bin/xen-detect
usr/bin/xencons
usr/bin/xenstore
usr/bin/xenstore-chmod
usr/bin/xenstore-control
usr/bin/xenstore-exists
usr/bin/xenstore-list
usr/bin/xenstore-ls
usr/bin/xenstore-read
usr/bin/xenstore-rm
usr/bin/xenstore-write
usr/bin/xentrace
usr/bin/xentrace_format
usr/bin/xentrace_setsize
#usr/include/blktaplib.h
#usr/include/flask.h
#usr/include/fsimage.h
#usr/include/fsimage_grub.h
#usr/include/fsimage_plugin.h
#usr/include/xen
#usr/include/xen/COPYING
#usr/include/xen/arch-ia64
#usr/include/xen/arch-ia64.h
#usr/include/xen/arch-ia64/debug_op.h
#usr/include/xen/arch-ia64/hvm
#usr/include/xen/arch-ia64/hvm/memmap.h
#usr/include/xen/arch-ia64/hvm/save.h
#usr/include/xen/arch-ia64/sioemu.h
#usr/include/xen/arch-x86
#usr/include/xen/arch-x86/cpuid.h
#usr/include/xen/arch-x86/hvm
#usr/include/xen/arch-x86/hvm/save.h
#usr/include/xen/arch-x86/xen-mca.h
#usr/include/xen/arch-x86/xen-x86_32.h
#usr/include/xen/arch-x86/xen-x86_64.h
#usr/include/xen/arch-x86/xen.h
#usr/include/xen/arch-x86_32.h
#usr/include/xen/arch-x86_64.h
#usr/include/xen/callback.h
#usr/include/xen/dom0_ops.h
#usr/include/xen/domctl.h
#usr/include/xen/elfnote.h
#usr/include/xen/event_channel.h
#usr/include/xen/features.h
#usr/include/xen/foreign
#usr/include/xen/foreign/ia64.h
#usr/include/xen/foreign/x86_32.h
#usr/include/xen/foreign/x86_64.h
#usr/include/xen/grant_table.h
#usr/include/xen/hvm
#usr/include/xen/hvm/e820.h
#usr/include/xen/hvm/hvm_info_table.h
#usr/include/xen/hvm/hvm_op.h
#usr/include/xen/hvm/ioreq.h
#usr/include/xen/hvm/params.h
#usr/include/xen/hvm/save.h
#usr/include/xen/io
#usr/include/xen/io/blkif.h
#usr/include/xen/io/console.h
#usr/include/xen/io/fbif.h
#usr/include/xen/io/fsif.h
#usr/include/xen/io/kbdif.h
#usr/include/xen/io/netif.h
#usr/include/xen/io/pciif.h
#usr/include/xen/io/protocols.h
#usr/include/xen/io/ring.h
#usr/include/xen/io/tpmif.h
#usr/include/xen/io/usbif.h
#usr/include/xen/io/vscsiif.h
#usr/include/xen/io/xenbus.h
#usr/include/xen/io/xs_wire.h
#usr/include/xen/kexec.h
#usr/include/xen/memory.h
#usr/include/xen/nmi.h
#usr/include/xen/physdev.h
#usr/include/xen/platform.h
#usr/include/xen/sched.h
#usr/include/xen/sys
#usr/include/xen/sys/evtchn.h
#usr/include/xen/sys/gntdev.h
#usr/include/xen/sys/privcmd.h
#usr/include/xen/sysctl.h
#usr/include/xen/trace.h
#usr/include/xen/vcpu.h
#usr/include/xen/version.h
#usr/include/xen/xen-compat.h
#usr/include/xen/xen.h
#usr/include/xen/xencomm.h
#usr/include/xen/xenoprof.h
#usr/include/xen/xsm
#usr/include/xen/xsm/acm.h
#usr/include/xen/xsm/acm_ops.h
#usr/include/xen/xsm/flask_op.h
#usr/include/xenctrl.h
#usr/include/xenguest.h
#usr/include/xs.h
#usr/include/xs_lib.h
usr/lib/fs
usr/lib/fs/ext2fs-lib
usr/lib/fs/ext2fs-lib/fsimage.so
usr/lib/fs/fat
usr/lib/fs/fat/fsimage.so
usr/lib/fs/iso9660
usr/lib/fs/iso9660/fsimage.so
usr/lib/fs/reiserfs
usr/lib/fs/reiserfs/fsimage.so
usr/lib/fs/ufs
usr/lib/fs/ufs/fsimage.so
usr/lib/fs/zfs
usr/lib/fs/zfs/fsimage.so
#usr/lib/libblktap.a
usr/lib/libblktap.so
usr/lib/libblktap.so.3.0
usr/lib/libblktap.so.3.0.0
#usr/lib/libflask.a
usr/lib/libflask.so
usr/lib/libflask.so.1.0
usr/lib/libflask.so.1.0.0
usr/lib/libfsimage.so
usr/lib/libfsimage.so.1.0
usr/lib/libfsimage.so.1.0.0
#usr/lib/libxenctrl.a
usr/lib/libxenctrl.so
usr/lib/libxenctrl.so.3.4
usr/lib/libxenctrl.so.3.4.0
#usr/lib/libxenguest.a
usr/lib/libxenguest.so
usr/lib/libxenguest.so.3.4
usr/lib/libxenguest.so.3.4.0
#usr/lib/libxenstore.a
usr/lib/libxenstore.so
usr/lib/libxenstore.so.3.0
usr/lib/libxenstore.so.3.0.0
usr/lib/python2.4/site-packages/fsimage.so
usr/lib/python2.4/site-packages/grub
usr/lib/python2.4/site-packages/grub/GrubConf.py
usr/lib/python2.4/site-packages/grub/GrubConf.pyc
usr/lib/python2.4/site-packages/grub/LiloConf.py
usr/lib/python2.4/site-packages/grub/LiloConf.pyc
usr/lib/python2.4/site-packages/grub/__init__.py
usr/lib/python2.4/site-packages/grub/__init__.pyc
usr/lib/python2.4/site-packages/xen
usr/lib/python2.4/site-packages/xen/__init__.py
usr/lib/python2.4/site-packages/xen/__init__.pyc
usr/lib/python2.4/site-packages/xen/lowlevel
usr/lib/python2.4/site-packages/xen/lowlevel/__init__.py
usr/lib/python2.4/site-packages/xen/lowlevel/__init__.pyc
usr/lib/python2.4/site-packages/xen/lowlevel/acm.so
usr/lib/python2.4/site-packages/xen/lowlevel/flask.so
usr/lib/python2.4/site-packages/xen/lowlevel/ptsname.so
usr/lib/python2.4/site-packages/xen/lowlevel/xc.so
usr/lib/python2.4/site-packages/xen/lowlevel/xs.so
usr/lib/python2.4/site-packages/xen/sv
usr/lib/python2.4/site-packages/xen/sv/CreateDomain.py
usr/lib/python2.4/site-packages/xen/sv/CreateDomain.pyc
usr/lib/python2.4/site-packages/xen/sv/DomInfo.py
usr/lib/python2.4/site-packages/xen/sv/DomInfo.pyc
usr/lib/python2.4/site-packages/xen/sv/GenTabbed.py
usr/lib/python2.4/site-packages/xen/sv/GenTabbed.pyc
usr/lib/python2.4/site-packages/xen/sv/HTMLBase.py
usr/lib/python2.4/site-packages/xen/sv/HTMLBase.pyc
usr/lib/python2.4/site-packages/xen/sv/Main.py
usr/lib/python2.4/site-packages/xen/sv/Main.pyc
usr/lib/python2.4/site-packages/xen/sv/NodeInfo.py
usr/lib/python2.4/site-packages/xen/sv/NodeInfo.pyc
usr/lib/python2.4/site-packages/xen/sv/RestoreDomain.py
usr/lib/python2.4/site-packages/xen/sv/RestoreDomain.pyc
usr/lib/python2.4/site-packages/xen/sv/Wizard.py
usr/lib/python2.4/site-packages/xen/sv/Wizard.pyc
usr/lib/python2.4/site-packages/xen/sv/__init__.py
usr/lib/python2.4/site-packages/xen/sv/__init__.pyc
usr/lib/python2.4/site-packages/xen/sv/util.py
usr/lib/python2.4/site-packages/xen/sv/util.pyc
usr/lib/python2.4/site-packages/xen/util
usr/lib/python2.4/site-packages/xen/util/Brctl.py
usr/lib/python2.4/site-packages/xen/util/Brctl.pyc
usr/lib/python2.4/site-packages/xen/util/SSHTransport.py
usr/lib/python2.4/site-packages/xen/util/SSHTransport.pyc
usr/lib/python2.4/site-packages/xen/util/__init__.py
usr/lib/python2.4/site-packages/xen/util/__init__.pyc
usr/lib/python2.4/site-packages/xen/util/acmpolicy.py
usr/lib/python2.4/site-packages/xen/util/acmpolicy.pyc
usr/lib/python2.4/site-packages/xen/util/asserts.py
usr/lib/python2.4/site-packages/xen/util/asserts.pyc
usr/lib/python2.4/site-packages/xen/util/auxbin.py
usr/lib/python2.4/site-packages/xen/util/auxbin.pyc
usr/lib/python2.4/site-packages/xen/util/blkif.py
usr/lib/python2.4/site-packages/xen/util/blkif.pyc
usr/lib/python2.4/site-packages/xen/util/bootloader.py
usr/lib/python2.4/site-packages/xen/util/bootloader.pyc
usr/lib/python2.4/site-packages/xen/util/bugtool.py
usr/lib/python2.4/site-packages/xen/util/bugtool.pyc
usr/lib/python2.4/site-packages/xen/util/diagnose.py
usr/lib/python2.4/site-packages/xen/util/diagnose.pyc
usr/lib/python2.4/site-packages/xen/util/dictio.py
usr/lib/python2.4/site-packages/xen/util/dictio.pyc
usr/lib/python2.4/site-packages/xen/util/ip.py
usr/lib/python2.4/site-packages/xen/util/ip.pyc
usr/lib/python2.4/site-packages/xen/util/mac.py
usr/lib/python2.4/site-packages/xen/util/mac.pyc
usr/lib/python2.4/site-packages/xen/util/mkdir.py
usr/lib/python2.4/site-packages/xen/util/mkdir.pyc
usr/lib/python2.4/site-packages/xen/util/oshelp.py
usr/lib/python2.4/site-packages/xen/util/oshelp.pyc
usr/lib/python2.4/site-packages/xen/util/pci.py
usr/lib/python2.4/site-packages/xen/util/pci.pyc
usr/lib/python2.4/site-packages/xen/util/rwlock.py
usr/lib/python2.4/site-packages/xen/util/rwlock.pyc
usr/lib/python2.4/site-packages/xen/util/utils.py
usr/lib/python2.4/site-packages/xen/util/utils.pyc
usr/lib/python2.4/site-packages/xen/util/vscsi_util.py
usr/lib/python2.4/site-packages/xen/util/vscsi_util.pyc
usr/lib/python2.4/site-packages/xen/util/xmlrpcclient.py
usr/lib/python2.4/site-packages/xen/util/xmlrpcclient.pyc
usr/lib/python2.4/site-packages/xen/util/xmlrpclib2.py
usr/lib/python2.4/site-packages/xen/util/xmlrpclib2.pyc
usr/lib/python2.4/site-packages/xen/util/xpopen.py
usr/lib/python2.4/site-packages/xen/util/xpopen.pyc
usr/lib/python2.4/site-packages/xen/util/xsconstants.py
usr/lib/python2.4/site-packages/xen/util/xsconstants.pyc
usr/lib/python2.4/site-packages/xen/util/xsm
usr/lib/python2.4/site-packages/xen/util/xsm/__init__.py
usr/lib/python2.4/site-packages/xen/util/xsm/__init__.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/acm
usr/lib/python2.4/site-packages/xen/util/xsm/acm/__init__.py
usr/lib/python2.4/site-packages/xen/util/xsm/acm/__init__.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/acm/acm.py
usr/lib/python2.4/site-packages/xen/util/xsm/acm/acm.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/dummy
usr/lib/python2.4/site-packages/xen/util/xsm/dummy/__init__.py
usr/lib/python2.4/site-packages/xen/util/xsm/dummy/__init__.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/dummy/dummy.py
usr/lib/python2.4/site-packages/xen/util/xsm/dummy/dummy.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/flask
usr/lib/python2.4/site-packages/xen/util/xsm/flask/__init__.py
usr/lib/python2.4/site-packages/xen/util/xsm/flask/__init__.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/flask/flask.py
usr/lib/python2.4/site-packages/xen/util/xsm/flask/flask.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/xsm.py
usr/lib/python2.4/site-packages/xen/util/xsm/xsm.pyc
usr/lib/python2.4/site-packages/xen/util/xsm/xsm_core.py
usr/lib/python2.4/site-packages/xen/util/xsm/xsm_core.pyc
usr/lib/python2.4/site-packages/xen/util/xspolicy.py
usr/lib/python2.4/site-packages/xen/util/xspolicy.pyc
usr/lib/python2.4/site-packages/xen/web
usr/lib/python2.4/site-packages/xen/web/SrvBase.py
usr/lib/python2.4/site-packages/xen/web/SrvBase.pyc
usr/lib/python2.4/site-packages/xen/web/SrvDir.py
usr/lib/python2.4/site-packages/xen/web/SrvDir.pyc
usr/lib/python2.4/site-packages/xen/web/__init__.py
usr/lib/python2.4/site-packages/xen/web/__init__.pyc
usr/lib/python2.4/site-packages/xen/web/connection.py
usr/lib/python2.4/site-packages/xen/web/connection.pyc
usr/lib/python2.4/site-packages/xen/web/http.py
usr/lib/python2.4/site-packages/xen/web/http.pyc
usr/lib/python2.4/site-packages/xen/web/httpserver.py
usr/lib/python2.4/site-packages/xen/web/httpserver.pyc
usr/lib/python2.4/site-packages/xen/web/protocol.py
usr/lib/python2.4/site-packages/xen/web/protocol.pyc
usr/lib/python2.4/site-packages/xen/web/resource.py
usr/lib/python2.4/site-packages/xen/web/resource.pyc
usr/lib/python2.4/site-packages/xen/web/static.py
usr/lib/python2.4/site-packages/xen/web/static.pyc
usr/lib/python2.4/site-packages/xen/web/tcp.py
usr/lib/python2.4/site-packages/xen/web/tcp.pyc
usr/lib/python2.4/site-packages/xen/web/unix.py
usr/lib/python2.4/site-packages/xen/web/unix.pyc
usr/lib/python2.4/site-packages/xen/xend
usr/lib/python2.4/site-packages/xen/xend/Args.py
usr/lib/python2.4/site-packages/xen/xend/Args.pyc
usr/lib/python2.4/site-packages/xen/xend/PrettyPrint.py
usr/lib/python2.4/site-packages/xen/xend/PrettyPrint.pyc
usr/lib/python2.4/site-packages/xen/xend/Vifctl.py
usr/lib/python2.4/site-packages/xen/xend/Vifctl.pyc
usr/lib/python2.4/site-packages/xen/xend/XendAPI.py
usr/lib/python2.4/site-packages/xen/xend/XendAPI.pyc
usr/lib/python2.4/site-packages/xen/xend/XendAPIConstants.py
usr/lib/python2.4/site-packages/xen/xend/XendAPIConstants.pyc
usr/lib/python2.4/site-packages/xen/xend/XendAPIStore.py
usr/lib/python2.4/site-packages/xen/xend/XendAPIStore.pyc
usr/lib/python2.4/site-packages/xen/xend/XendAPIVersion.py
usr/lib/python2.4/site-packages/xen/xend/XendAPIVersion.pyc
usr/lib/python2.4/site-packages/xen/xend/XendAuthSessions.py
usr/lib/python2.4/site-packages/xen/xend/XendAuthSessions.pyc
usr/lib/python2.4/site-packages/xen/xend/XendBase.py
usr/lib/python2.4/site-packages/xen/xend/XendBase.pyc
usr/lib/python2.4/site-packages/xen/xend/XendBootloader.py
usr/lib/python2.4/site-packages/xen/xend/XendBootloader.pyc
usr/lib/python2.4/site-packages/xen/xend/XendCheckpoint.py
usr/lib/python2.4/site-packages/xen/xend/XendCheckpoint.pyc
usr/lib/python2.4/site-packages/xen/xend/XendClient.py
usr/lib/python2.4/site-packages/xen/xend/XendClient.pyc
usr/lib/python2.4/site-packages/xen/xend/XendConfig.py
usr/lib/python2.4/site-packages/xen/xend/XendConfig.pyc
usr/lib/python2.4/site-packages/xen/xend/XendConstants.py
usr/lib/python2.4/site-packages/xen/xend/XendConstants.pyc
usr/lib/python2.4/site-packages/xen/xend/XendDPCI.py
usr/lib/python2.4/site-packages/xen/xend/XendDPCI.pyc
usr/lib/python2.4/site-packages/xen/xend/XendDSCSI.py
usr/lib/python2.4/site-packages/xen/xend/XendDSCSI.pyc
usr/lib/python2.4/site-packages/xen/xend/XendDevices.py
usr/lib/python2.4/site-packages/xen/xend/XendDevices.pyc
usr/lib/python2.4/site-packages/xen/xend/XendDmesg.py
usr/lib/python2.4/site-packages/xen/xend/XendDmesg.pyc
usr/lib/python2.4/site-packages/xen/xend/XendDomain.py
usr/lib/python2.4/site-packages/xen/xend/XendDomain.pyc
usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.py
usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.pyc
usr/lib/python2.4/site-packages/xen/xend/XendError.py
usr/lib/python2.4/site-packages/xen/xend/XendError.pyc
usr/lib/python2.4/site-packages/xen/xend/XendLocalStorageRepo.py
usr/lib/python2.4/site-packages/xen/xend/XendLocalStorageRepo.pyc
usr/lib/python2.4/site-packages/xen/xend/XendLogging.py
usr/lib/python2.4/site-packages/xen/xend/XendLogging.pyc
usr/lib/python2.4/site-packages/xen/xend/XendMonitor.py
usr/lib/python2.4/site-packages/xen/xend/XendMonitor.pyc
usr/lib/python2.4/site-packages/xen/xend/XendNetwork.py
usr/lib/python2.4/site-packages/xen/xend/XendNetwork.pyc
usr/lib/python2.4/site-packages/xen/xend/XendNode.py
usr/lib/python2.4/site-packages/xen/xend/XendNode.pyc
usr/lib/python2.4/site-packages/xen/xend/XendOptions.py
usr/lib/python2.4/site-packages/xen/xend/XendOptions.pyc
usr/lib/python2.4/site-packages/xen/xend/XendPBD.py
usr/lib/python2.4/site-packages/xen/xend/XendPBD.pyc
usr/lib/python2.4/site-packages/xen/xend/XendPIF.py
usr/lib/python2.4/site-packages/xen/xend/XendPIF.pyc
usr/lib/python2.4/site-packages/xen/xend/XendPIFMetrics.py
usr/lib/python2.4/site-packages/xen/xend/XendPIFMetrics.pyc
usr/lib/python2.4/site-packages/xen/xend/XendPPCI.py
usr/lib/python2.4/site-packages/xen/xend/XendPPCI.pyc
usr/lib/python2.4/site-packages/xen/xend/XendPSCSI.py
usr/lib/python2.4/site-packages/xen/xend/XendPSCSI.pyc
usr/lib/python2.4/site-packages/xen/xend/XendProtocol.py
usr/lib/python2.4/site-packages/xen/xend/XendProtocol.pyc
usr/lib/python2.4/site-packages/xen/xend/XendQCoWStorageRepo.py
usr/lib/python2.4/site-packages/xen/xend/XendQCoWStorageRepo.pyc
usr/lib/python2.4/site-packages/xen/xend/XendStateStore.py
usr/lib/python2.4/site-packages/xen/xend/XendStateStore.pyc
usr/lib/python2.4/site-packages/xen/xend/XendStorageRepository.py
usr/lib/python2.4/site-packages/xen/xend/XendStorageRepository.pyc
usr/lib/python2.4/site-packages/xen/xend/XendTask.py
usr/lib/python2.4/site-packages/xen/xend/XendTask.pyc
usr/lib/python2.4/site-packages/xen/xend/XendTaskManager.py
usr/lib/python2.4/site-packages/xen/xend/XendTaskManager.pyc
usr/lib/python2.4/site-packages/xen/xend/XendVDI.py
usr/lib/python2.4/site-packages/xen/xend/XendVDI.pyc
usr/lib/python2.4/site-packages/xen/xend/XendVMMetrics.py
usr/lib/python2.4/site-packages/xen/xend/XendVMMetrics.pyc
usr/lib/python2.4/site-packages/xen/xend/XendVnet.py
usr/lib/python2.4/site-packages/xen/xend/XendVnet.pyc
usr/lib/python2.4/site-packages/xen/xend/XendXSPolicy.py
usr/lib/python2.4/site-packages/xen/xend/XendXSPolicy.pyc
usr/lib/python2.4/site-packages/xen/xend/XendXSPolicyAdmin.py
usr/lib/python2.4/site-packages/xen/xend/XendXSPolicyAdmin.pyc
usr/lib/python2.4/site-packages/xen/xend/__init__.py
usr/lib/python2.4/site-packages/xen/xend/__init__.pyc
usr/lib/python2.4/site-packages/xen/xend/arch.py
usr/lib/python2.4/site-packages/xen/xend/arch.pyc
usr/lib/python2.4/site-packages/xen/xend/balloon.py
usr/lib/python2.4/site-packages/xen/xend/balloon.pyc
usr/lib/python2.4/site-packages/xen/xend/encode.py
usr/lib/python2.4/site-packages/xen/xend/encode.pyc
usr/lib/python2.4/site-packages/xen/xend/image.py
usr/lib/python2.4/site-packages/xen/xend/image.pyc
usr/lib/python2.4/site-packages/xen/xend/osdep.py
usr/lib/python2.4/site-packages/xen/xend/osdep.pyc
usr/lib/python2.4/site-packages/xen/xend/server
usr/lib/python2.4/site-packages/xen/xend/server/BlktapController.py
usr/lib/python2.4/site-packages/xen/xend/server/BlktapController.pyc
usr/lib/python2.4/site-packages/xen/xend/server/ConsoleController.py
usr/lib/python2.4/site-packages/xen/xend/server/ConsoleController.pyc
usr/lib/python2.4/site-packages/xen/xend/server/DevConstants.py
usr/lib/python2.4/site-packages/xen/xend/server/DevConstants.pyc
usr/lib/python2.4/site-packages/xen/xend/server/DevController.py
usr/lib/python2.4/site-packages/xen/xend/server/DevController.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SSLXMLRPCServer.py
usr/lib/python2.4/site-packages/xen/xend/server/SSLXMLRPCServer.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvDaemon.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvDaemon.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvDmesg.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvDmesg.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvDomain.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvDomain.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvDomainDir.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvDomainDir.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvNode.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvNode.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvRoot.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvRoot.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvServer.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvServer.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvVnetDir.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvVnetDir.pyc
usr/lib/python2.4/site-packages/xen/xend/server/SrvXendLog.py
usr/lib/python2.4/site-packages/xen/xend/server/SrvXendLog.pyc
usr/lib/python2.4/site-packages/xen/xend/server/XMLRPCServer.py
usr/lib/python2.4/site-packages/xen/xend/server/XMLRPCServer.pyc
usr/lib/python2.4/site-packages/xen/xend/server/__init__.py
usr/lib/python2.4/site-packages/xen/xend/server/__init__.pyc
usr/lib/python2.4/site-packages/xen/xend/server/blkif.py
usr/lib/python2.4/site-packages/xen/xend/server/blkif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/iopif.py
usr/lib/python2.4/site-packages/xen/xend/server/iopif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/irqif.py
usr/lib/python2.4/site-packages/xen/xend/server/irqif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/netif.py
usr/lib/python2.4/site-packages/xen/xend/server/netif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/params.py
usr/lib/python2.4/site-packages/xen/xend/server/params.pyc
usr/lib/python2.4/site-packages/xen/xend/server/pciif.py
usr/lib/python2.4/site-packages/xen/xend/server/pciif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/pciquirk.py
usr/lib/python2.4/site-packages/xen/xend/server/pciquirk.pyc
usr/lib/python2.4/site-packages/xen/xend/server/relocate.py
usr/lib/python2.4/site-packages/xen/xend/server/relocate.pyc
usr/lib/python2.4/site-packages/xen/xend/server/tests
usr/lib/python2.4/site-packages/xen/xend/server/tests/__init__.py
usr/lib/python2.4/site-packages/xen/xend/server/tests/__init__.pyc
usr/lib/python2.4/site-packages/xen/xend/server/tests/test_controllers.py
usr/lib/python2.4/site-packages/xen/xend/server/tests/test_controllers.pyc
usr/lib/python2.4/site-packages/xen/xend/server/tpmif.py
usr/lib/python2.4/site-packages/xen/xend/server/tpmif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/udevevent.py
usr/lib/python2.4/site-packages/xen/xend/server/udevevent.pyc
usr/lib/python2.4/site-packages/xen/xend/server/vfbif.py
usr/lib/python2.4/site-packages/xen/xend/server/vfbif.pyc
usr/lib/python2.4/site-packages/xen/xend/server/vscsiif.py
usr/lib/python2.4/site-packages/xen/xend/server/vscsiif.pyc
usr/lib/python2.4/site-packages/xen/xend/sxp.py
usr/lib/python2.4/site-packages/xen/xend/sxp.pyc
usr/lib/python2.4/site-packages/xen/xend/tests
usr/lib/python2.4/site-packages/xen/xend/tests/__init__.py
usr/lib/python2.4/site-packages/xen/xend/tests/__init__.pyc
usr/lib/python2.4/site-packages/xen/xend/tests/test_XendConfig.py
usr/lib/python2.4/site-packages/xen/xend/tests/test_XendConfig.pyc
usr/lib/python2.4/site-packages/xen/xend/tests/test_sxp.py
usr/lib/python2.4/site-packages/xen/xend/tests/test_sxp.pyc
usr/lib/python2.4/site-packages/xen/xend/tests/test_uuid.py
usr/lib/python2.4/site-packages/xen/xend/tests/test_uuid.pyc
usr/lib/python2.4/site-packages/xen/xend/uuid.py
usr/lib/python2.4/site-packages/xen/xend/uuid.pyc
usr/lib/python2.4/site-packages/xen/xend/xenstore
usr/lib/python2.4/site-packages/xen/xend/xenstore/__init__.py
usr/lib/python2.4/site-packages/xen/xend/xenstore/__init__.pyc
usr/lib/python2.4/site-packages/xen/xend/xenstore/tests
usr/lib/python2.4/site-packages/xen/xend/xenstore/tests/__init__.py
usr/lib/python2.4/site-packages/xen/xend/xenstore/tests/__init__.pyc
usr/lib/python2.4/site-packages/xen/xend/xenstore/tests/stress_xs.py
usr/lib/python2.4/site-packages/xen/xend/xenstore/tests/stress_xs.pyc
usr/lib/python2.4/site-packages/xen/xend/xenstore/xstransact.py
usr/lib/python2.4/site-packages/xen/xend/xenstore/xstransact.pyc
usr/lib/python2.4/site-packages/xen/xend/xenstore/xsutil.py
usr/lib/python2.4/site-packages/xen/xend/xenstore/xsutil.pyc
usr/lib/python2.4/site-packages/xen/xend/xenstore/xswatch.py
usr/lib/python2.4/site-packages/xen/xend/xenstore/xswatch.pyc
usr/lib/python2.4/site-packages/xen/xm
usr/lib/python2.4/site-packages/xen/xm/XenAPI.py
usr/lib/python2.4/site-packages/xen/xm/XenAPI.pyc
usr/lib/python2.4/site-packages/xen/xm/__init__.py
usr/lib/python2.4/site-packages/xen/xm/__init__.pyc
usr/lib/python2.4/site-packages/xen/xm/addlabel.py
usr/lib/python2.4/site-packages/xen/xm/addlabel.pyc
usr/lib/python2.4/site-packages/xen/xm/console.py
usr/lib/python2.4/site-packages/xen/xm/console.pyc
usr/lib/python2.4/site-packages/xen/xm/create.py
usr/lib/python2.4/site-packages/xen/xm/create.pyc
usr/lib/python2.4/site-packages/xen/xm/dry-run.py
usr/lib/python2.4/site-packages/xen/xm/dry-run.pyc
usr/lib/python2.4/site-packages/xen/xm/dumppolicy.py
usr/lib/python2.4/site-packages/xen/xm/dumppolicy.pyc
usr/lib/python2.4/site-packages/xen/xm/getlabel.py
usr/lib/python2.4/site-packages/xen/xm/getlabel.pyc
usr/lib/python2.4/site-packages/xen/xm/getpolicy.py
usr/lib/python2.4/site-packages/xen/xm/getpolicy.pyc
usr/lib/python2.4/site-packages/xen/xm/help.py
usr/lib/python2.4/site-packages/xen/xm/help.pyc
usr/lib/python2.4/site-packages/xen/xm/labels.py
usr/lib/python2.4/site-packages/xen/xm/labels.pyc
usr/lib/python2.4/site-packages/xen/xm/main.py
usr/lib/python2.4/site-packages/xen/xm/main.pyc
usr/lib/python2.4/site-packages/xen/xm/migrate.py
usr/lib/python2.4/site-packages/xen/xm/migrate.pyc
usr/lib/python2.4/site-packages/xen/xm/new.py
usr/lib/python2.4/site-packages/xen/xm/new.pyc
usr/lib/python2.4/site-packages/xen/xm/opts.py
usr/lib/python2.4/site-packages/xen/xm/opts.pyc
usr/lib/python2.4/site-packages/xen/xm/resetpolicy.py
usr/lib/python2.4/site-packages/xen/xm/resetpolicy.pyc
usr/lib/python2.4/site-packages/xen/xm/resources.py
usr/lib/python2.4/site-packages/xen/xm/resources.pyc
usr/lib/python2.4/site-packages/xen/xm/rmlabel.py
usr/lib/python2.4/site-packages/xen/xm/rmlabel.pyc
usr/lib/python2.4/site-packages/xen/xm/setpolicy.py
usr/lib/python2.4/site-packages/xen/xm/setpolicy.pyc
usr/lib/python2.4/site-packages/xen/xm/shutdown.py
usr/lib/python2.4/site-packages/xen/xm/shutdown.pyc
usr/lib/python2.4/site-packages/xen/xm/tests
usr/lib/python2.4/site-packages/xen/xm/tests/__init__.py
usr/lib/python2.4/site-packages/xen/xm/tests/__init__.pyc
usr/lib/python2.4/site-packages/xen/xm/tests/test_create.py
usr/lib/python2.4/site-packages/xen/xm/tests/test_create.pyc
usr/lib/python2.4/site-packages/xen/xm/xenapi_create.py
usr/lib/python2.4/site-packages/xen/xm/xenapi_create.pyc
usr/lib/python2.4/site-packages/xen/xsview
usr/lib/python2.4/site-packages/xen/xsview/__init__.py
usr/lib/python2.4/site-packages/xen/xsview/__init__.pyc
usr/lib/python2.4/site-packages/xen/xsview/main.py
usr/lib/python2.4/site-packages/xen/xsview/main.pyc
usr/lib/python2.4/site-packages/xen/xsview/xsviewer.py
usr/lib/python2.4/site-packages/xen/xsview/xsviewer.pyc
usr/lib/xen
usr/lib/xen/bin
usr/lib/xen/bin/lsevtchn
usr/lib/xen/bin/qemu-dm
usr/lib/xen/bin/readnotes
usr/lib/xen/bin/xc_restore
usr/lib/xen/bin/xc_save
usr/lib/xen/bin/xenconsole
usr/lib/xen/bin/xenctx
usr/lib/xen/boot
usr/lib/xen/boot/hvmloader
usr/sbin/blktapctrl
usr/sbin/flask-loadpolicy
usr/sbin/fs-backend
usr/sbin/img2qcow
usr/sbin/qcow-create
usr/sbin/qcow2raw
usr/sbin/tapdisk
usr/sbin/xen-bugtool
usr/sbin/xen-python-path
usr/sbin/xenbaked
usr/sbin/xenconsoled
usr/sbin/xend
usr/sbin/xenmon.py
usr/sbin/xenperf
usr/sbin/xenpm
usr/sbin/xenpmd
usr/sbin/xenstored
usr/sbin/xentop
usr/sbin/xentrace_setmask
usr/sbin/xm
usr/sbin/xsview
#usr/share/doc/xen
#usr/share/doc/xen/README.blktap
#usr/share/doc/xen/README.xenmon
#usr/share/doc/xen/create.dtd
#usr/share/man/man1/xentop.1
#usr/share/man/man1/xentrace_format.1
#usr/share/man/man8/xentrace.8
usr/share/xen
usr/share/xen/qemu
usr/share/xen/qemu/bamboo.dtb
usr/share/xen/qemu/bios.bin
usr/share/xen/qemu/keymaps
usr/share/xen/qemu/keymaps/ar
usr/share/xen/qemu/keymaps/common
usr/share/xen/qemu/keymaps/da
usr/share/xen/qemu/keymaps/de
usr/share/xen/qemu/keymaps/de-ch
usr/share/xen/qemu/keymaps/en-gb
usr/share/xen/qemu/keymaps/en-us
usr/share/xen/qemu/keymaps/es
usr/share/xen/qemu/keymaps/et
usr/share/xen/qemu/keymaps/fi
usr/share/xen/qemu/keymaps/fo
usr/share/xen/qemu/keymaps/fr
usr/share/xen/qemu/keymaps/fr-be
usr/share/xen/qemu/keymaps/fr-ca
usr/share/xen/qemu/keymaps/fr-ch
usr/share/xen/qemu/keymaps/hr
usr/share/xen/qemu/keymaps/hu
usr/share/xen/qemu/keymaps/is
usr/share/xen/qemu/keymaps/it
usr/share/xen/qemu/keymaps/ja
usr/share/xen/qemu/keymaps/lt
usr/share/xen/qemu/keymaps/lv
usr/share/xen/qemu/keymaps/mk
usr/share/xen/qemu/keymaps/modifiers
usr/share/xen/qemu/keymaps/nl
usr/share/xen/qemu/keymaps/nl-be
usr/share/xen/qemu/keymaps/no
usr/share/xen/qemu/keymaps/pl
usr/share/xen/qemu/keymaps/pt
usr/share/xen/qemu/keymaps/pt-br
usr/share/xen/qemu/keymaps/ru
usr/share/xen/qemu/keymaps/sl
usr/share/xen/qemu/keymaps/sv
usr/share/xen/qemu/keymaps/th
usr/share/xen/qemu/keymaps/tr
usr/share/xen/qemu/openbios-ppc
usr/share/xen/qemu/openbios-sparc32
usr/share/xen/qemu/openbios-sparc64
usr/share/xen/qemu/ppc_rom.bin
usr/share/xen/qemu/pxe-e1000.bin
usr/share/xen/qemu/pxe-ne2k_pci.bin
usr/share/xen/qemu/pxe-pcnet.bin
usr/share/xen/qemu/pxe-rtl8139.bin
usr/share/xen/qemu/vgabios-cirrus.bin
usr/share/xen/qemu/vgabios.bin
usr/share/xen/qemu/video.x
var/lib/xen
var/lib/xenstored
var/log/xen
var/run/xend
var/run/xend/boot
var/run/xenstored
var/xen
var/xen/dump

132
lfs/linux
View File

@@ -34,10 +34,14 @@ DIR_APP = $(DIR_SRC)/$(THISAPP)
CFLAGS =
CXXFLAGS =
# Normal build or SMP build.
ifeq "$(firstword $(MAKEFILES))" "linux-xen"
XEN=1
endif
# Normal build or XEN build.
#
ifeq "$(SMP)" "1"
TARGET = $(DIR_INFO)/linux-$(VER)-smp
ifeq "$(XEN)" "1"
TARGET = $(DIR_INFO)/linux-$(VER)-xen
else
TARGET = $(DIR_INFO)/linux-$(VER)
endif
@@ -95,6 +99,86 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
ln -s linux-$(VER) /usr/src/linux
# Linux Intermediate Queueing Device
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27-imq.patch
# Xen
ifeq "$(XEN)" "1"
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60000_add-console-use-vt.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60001_linux-2.6.19-rc1-kexec-move_segment_code-i386.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60002_linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60003_ipv6-no-autoconf.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60004_pci-reassign-resources.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60005_sfc-driverlink.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60006_sfc-resource-driver.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60007_sfc-driverlink-conditional.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60008_xen3-auto-xen-arch.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60009_xen3-auto-xen-drivers.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60010_xen3-auto-include-xen-interface.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60011_xen3-auto-xen-kconfig.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/xen_aio.diff
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/skbuff-xen-imq.diff
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60012_xen3-auto-common.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60013_xen3-auto-arch-x86.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60014_xen3-auto-arch-i386.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60015_xen3-auto-arch-x86_64.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60016_xen3-fixup-xen.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60017_735-balloon-exit.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60018_737-kexec-free.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60019_740-blkback-resource-leak.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60020_746-pirq-status-page.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60021_747-x86-undo-mfn-limit.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60022_748-x86-ioapic-cleanup.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60023_xen3-fixup-kconfig.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60024_xen3-fixup-common.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60025_xen3-fixup-arch-x86.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60026_xen3-fixup-sfc.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60027_xen3-patch-2.6.18.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60028_xen3-patch-2.6.19.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60029_xen3-patch-2.6.20.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60030_xen3-patch-2.6.21.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60031_xen3-patch-2.6.22.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60032_xen3-patch-2.6.23.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60033_xen3-patch-2.6.24.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60034_xen3-patch-2.6.25.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60035_xen3-patch-2.6.26.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60036_xen3-patch-2.6.27.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60037_xen3-patch-2.6.27.1-2.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60038_xen3-patch-2.6.27.3-4.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60039_xen3-patch-2.6.27.4-5.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60040_xen3-patch-2.6.27.5-6.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60041_xen3-panic-on-io-nmi.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60042_xen-balloon-max-target.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60043_xen-blkback-cdrom.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60044_xen-blktap-write-barriers.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60045_xen-scsifront-block-timeout-update.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60046_xen-op-packet.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60047_xen-blkfront-cdrom.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60048_xen-sections.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60049_xen-kconfig-compat-3.2.0.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60050_xen-cpufreq-report.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60051_xen-rt2860-build.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60052_xen-sysdev-suspend.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60053_xen-ipi-per-cpu-irq.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60054_xen-virq-per-cpu-irq.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60055_xen-configurable-guest-devices.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60056_xen-netback-nr-irqs.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60057_xen-netback-notify-multi.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60058_xen-x86-panic-no-reboot.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60059_xen-x86-dcr-fallback.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60060_xen-x86-consistent-nmi.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60061_xen-x86-no-lapic.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60062_xen-x86-pmd-handling.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60063_xen-x86-bigmem.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60064_xen-x86-machphys-prediction.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60065_xen-x86-no-lazy-tlb.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60066_xen-x86-exit-mmap.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60067_xen-i386-panic-on-oops.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60068_xen-x86_64-pgd-pin.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60069_xen-x86_64-pgd-alloc-order.patch1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60070_xen-x86_64-dump-user-pgt.patch1
endif
# Not report deprecated syscall 1.23 (for kudzu)
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
@@ -120,29 +204,24 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.21.tar.gz
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.21/kernel-2.6.25-2.6.28-layer7-2.21.patch
# Linux Intermediate Queueing Device
ifeq "$(XEN)" ""
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27-imq.patch
endif
# Cleanup kernel source
cd $(DIR_APP) && make mrproper
ifeq "$(SMP)" "1"
cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
ifeq "$(XEN)" "1"
cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-xen $(DIR_APP)/.config
else
cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
endif
cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
cd $(DIR_APP) && make CC="$(KGCC)" clean
ifeq "$(SMP)" "1"
cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-smp/' Makefile
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire-smp
cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-smp
ln -sf vmlinuz-$(VER)-ipfire-smp /boot/vmlinuz-ipfire-smp
ifeq "$(XEN)" "1"
cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-xen/' Makefile
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)"
cd $(DIR_APP) && cp -v vmlinux /boot/vmlinuz-$(VER)-ipfire-xen
cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-xen
ln -sf vmlinuz-$(VER)-ipfire-xen /boot/vmlinuz-ipfire-xen
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
@@ -159,19 +238,28 @@ else
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
endif
ifeq "$(SMP)" ""
# Only do this once on the non-SMP pass
ifeq "$(XEN)" ""
# Only do this once on the non-XEN pass
cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
endif
ifeq "$(XEN)" "1"
# Rename ide-cd module to match with old kernel
mv /lib/modules/$(VER)-ipfire-xen/kernel/drivers/ide/ide-cd_mod.ko \
/lib/modules/$(VER)-ipfire-xen/kernel/drivers/ide/ide-cd.ko
# Remove mISDN modules
rm -rvf /lib/modules/$(VER)-ipfire-xen/kernel/drivers/isdn/mISDN
rm -rvf /lib/modules/$(VER)-ipfire-xen/kernel/drivers/isdn/hardware/mISDN
else
# Rename ide-cd module to match with old kernel
mv /lib/modules/$(VER)-ipfire/kernel/drivers/ide/ide-cd_mod.ko \
/lib/modules/$(VER)-ipfire/kernel/drivers/ide/ide-cd.ko
# Remove mISDN modules
@rm -rf /lib/modules/$(VER)-ipfire/kernel/drivers/isdn/mISDN
@rm -rf /lib/modules/$(VER)-ipfire/kernel/drivers/isdn/hardware/mISDN
rm -rvf /lib/modules/$(VER)-ipfire/kernel/drivers/isdn/mISDN
rm -rvf /lib/modules/$(VER)-ipfire/kernel/drivers/isdn/hardware/mISDN
endif
@rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
@$(POSTBUILD)

1
lfs/linux-xen Symbolic link
View File

@@ -0,0 +1 @@
linux

View File

@@ -72,7 +72,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_SRC)/mISDN.git && KVERS=$(KVER)-ipfire make force
cd $(DIR_SRC)/mISDN.git && KVERS=$(KVER)-ipfire make $(MAKETUNING)
cd $(DIR_SRC)/mISDN.git && KVERS=$(KVER)-ipfire make install
cd $(DIR_SRC)/mISDN.git && KVERS=$(KVER)-ipfire make install DEPMOD="depmod $(KVER)"
mv /lib/modules/$(KVER)-ipfire/extra /lib/modules/$(KVER)-ipfire/mISDN
@rm -rf $(DIR_SRC)/mISDN*
@$(POSTBUILD)

97
lfs/x11libs Normal file
View File

@@ -0,0 +1,97 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = core28-r1
THISAPP = x11libs-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = x11libs
PAK_VER = 1
DEPS = ""
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = 4bd8907ab971fb8efacec575492d504b
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
md5 : $(subst %,%_MD5,$(objects))
dist:
@$(PAK)
###############################################################################
# Downloading, checking, md5sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_MD5,$(objects)) :
@$(MD5)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
export XORG_PREFIX="/usr"
export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"
cd $(DIR_APP) && ./install-proto.sh
cd $(DIR_APP) && ./install-util.sh
cd $(DIR_APP) && tar xvjf libXau-1.0.4.tar.bz2 && cd libXau-1.0.4 && ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var && make && make install
cd $(DIR_APP) && tar xvjf libXdmcp-1.0.2.tar.bz2 && cd libXdmcp-1.0.2 && ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var && make && make install
cd $(DIR_APP) && tar xvjf xcb-proto-1.1.tar.bz2 && cd xcb-proto-1.1 && ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var && make && make install && install -dv -m755 /usr/share/doc/xcb-proto-1.1 && install -v -m644 doc/* /usr/share/doc/xcb-proto-1.1
## libpthread-stubs
cd $(DIR_APP) && tar xvjf libpthread-stubs-0.1.tar.bz2 && cd libpthread-stubs-0.1 && ./configure --prefix=/usr && make && make install
cd $(DIR_APP) && tar xvjf libxcb-1.1.tar.bz2 && cd libxcb-1.1 && ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var --docdir='${datadir}'/doc/libxcb-1.1 && make && make install && export LIBXCB_ALLOW_SLOPPY_LOCK=1
## gperf
cd $(DIR_APP) && tar xvzf gperf-3.0.3.tar.gz && cd gperf-3.0.3 && ./configure --prefix=/usr && make && makeinfo -o doc/gperf.txt --plaintext doc/gperf.texi && make install && install -v -m755 -d /usr/share/doc/gperf-3.0.3 && install -m644 -v doc/gperf.{dvi,ps,pdf,txt} /usr/share/doc/gperf-3.0.3
cd $(DIR_APP) && tar xvjf xcb-util-0.3.0.tar.bz2 && cd xcb-util-0.3.0 && ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var && make && make install
cd $(DIR_APP) && ./install-lib.sh
cd $(DIR_APP) && tar xvzf bin86-0.16.17.tar.gz && cd bin86-0.16.17 && make && make install
cd $(DIR_APP) && tar xvzf Dev86src-0.16.17.tar.gz && cd dev86-0.16.17 && make && make install
@rm -rf $(DIR_APP)
@$(POSTBUILD)

82
lfs/xen Normal file
View File

@@ -0,0 +1,82 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = 3.4.0
THISAPP = xen-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = xen
PAK_VER = 1
DEPS = "x11libs"
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = e8c908d0387269d905a673d29b703f1d
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
md5 : $(subst %,%_MD5,$(objects))
dist:
@$(PAK)
###############################################################################
# Downloading, checking, md5sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_MD5,$(objects)) :
@$(MD5)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && make xen && make install-xen
cd $(DIR_APP) && make tools && make install-tools
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -347,6 +347,7 @@ buildipfire() {
ipfiremake mISDN
ipfiremake which
ipfiremake compat-wireless
ipfiremake linux XEN=1
ipfiremake pkg-config
ipfiremake linux-atm
ipfiremake cpio
@@ -596,6 +597,8 @@ buildipfire() {
ipfiremake sslh
ipfiremake perl-gettext
ipfiremake vdradmin
ipfiremake x11libs
ipfiremake xen
ipfiremake miau
ipfiremake net-snmp
ipfiremake perl-DBI

View File

@@ -0,0 +1,58 @@
Subject: add console_use_vt
From: kraxel@suse.de
Patch-mainline: no
$subject says all
---
drivers/char/tty_io.c | 7 ++++++-
include/linux/console.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -136,6 +136,8 @@ LIST_HEAD(tty_drivers); /* linked list
DEFINE_MUTEX(tty_mutex);
EXPORT_SYMBOL(tty_mutex);
+int console_use_vt = 1;
+
#ifdef CONFIG_UNIX98_PTYS
extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */
static int ptmx_open(struct inode *, struct file *);
@@ -2200,7 +2202,7 @@ retry_open:
goto got_driver;
}
#ifdef CONFIG_VT
- if (device == MKDEV(TTY_MAJOR, 0)) {
+ if (console_use_vt && device == MKDEV(TTY_MAJOR, 0)) {
extern struct tty_driver *console_driver;
driver = console_driver;
index = fg_console;
@@ -3729,6 +3731,8 @@ static int __init tty_init(void)
#endif
#ifdef CONFIG_VT
+ if (!console_use_vt)
+ goto out_vt;
cdev_init(&vc0_cdev, &console_fops);
if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
@@ -3736,6 +3740,7 @@ static int __init tty_init(void)
device_create_drvdata(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
vty_init();
+ out_vt:
#endif
return 0;
}
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -63,6 +63,7 @@ extern const struct consw dummy_con; /*
extern const struct consw vga_con; /* VGA text console */
extern const struct consw newport_con; /* SGI Newport console */
extern const struct consw prom_con; /* SPARC PROM console */
+extern int console_use_vt;
int con_is_bound(const struct consw *csw);
int register_con_driver(const struct consw *csw, int first, int last);

View File

@@ -0,0 +1,178 @@
Subject: kexec: Move asm segment handling code to the assembly file (i386)
From: http://xenbits.xensource.com/xen-unstable.hg (tip 13816)
Patch-mainline: obsolete
This patch moves the idt, gdt, and segment handling code from machine_kexec.c
to relocate_kernel.S. The main reason behind this move is to avoid code
duplication in the Xen hypervisor. With this patch all code required to kexec
is put on the control page.
On top of that this patch also counts as a cleanup - I think it is much
nicer to write assembly directly in assembly files than wrap inline assembly
in C functions for no apparent reason.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Acked-by: jbeulich@novell.com
---
Applies to 2.6.19-rc1.
machine_kexec.c | 59 -----------------------------------------------------
relocate_kernel.S | 58 +++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 53 insertions(+), 64 deletions(-)
Index: head-2008-11-17/arch/x86/kernel/machine_kexec_32.c
===================================================================
--- head-2008-11-17.orig/arch/x86/kernel/machine_kexec_32.c 2008-11-17 13:15:56.000000000 +0100
+++ head-2008-11-17/arch/x86/kernel/machine_kexec_32.c 2008-11-17 13:38:03.000000000 +0100
@@ -34,48 +34,6 @@ static u32 kexec_pmd1[1024] PAGE_ALIGNED
static u32 kexec_pte0[1024] PAGE_ALIGNED;
static u32 kexec_pte1[1024] PAGE_ALIGNED;
-static void set_idt(void *newidt, __u16 limit)
-{
- struct desc_ptr curidt;
-
- /* ia32 supports unaliged loads & stores */
- curidt.size = limit;
- curidt.address = (unsigned long)newidt;
-
- load_idt(&curidt);
-}
-
-
-static void set_gdt(void *newgdt, __u16 limit)
-{
- struct desc_ptr curgdt;
-
- /* ia32 supports unaligned loads & stores */
- curgdt.size = limit;
- curgdt.address = (unsigned long)newgdt;
-
- load_gdt(&curgdt);
-}
-
-static void load_segments(void)
-{
-#define __STR(X) #X
-#define STR(X) __STR(X)
-
- __asm__ __volatile__ (
- "\tljmp $"STR(__KERNEL_CS)",$1f\n"
- "\t1:\n"
- "\tmovl $"STR(__KERNEL_DS)",%%eax\n"
- "\tmovl %%eax,%%ds\n"
- "\tmovl %%eax,%%es\n"
- "\tmovl %%eax,%%fs\n"
- "\tmovl %%eax,%%gs\n"
- "\tmovl %%eax,%%ss\n"
- ::: "eax", "memory");
-#undef STR
-#undef __STR
-}
-
/*
* A architecture hook called to validate the
* proposed image and prepare the control pages
@@ -167,23 +125,6 @@ void machine_kexec(struct kimage *image)
page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
<< PAGE_SHIFT);
- /* The segment registers are funny things, they have both a
- * visible and an invisible part. Whenever the visible part is
- * set to a specific selector, the invisible part is loaded
- * with from a table in memory. At no other time is the
- * descriptor table in memory accessed.
- *
- * I take advantage of this here by force loading the
- * segments, before I zap the gdt with an invalid value.
- */
- load_segments();
- /* The gdt & idt are now invalid.
- * If you want to load them you must set up your own idt & gdt.
- */
- set_gdt(phys_to_virt(0),0);
- set_idt(phys_to_virt(0),0);
-
- /* now call it */
image->start = relocate_kernel_ptr((unsigned long)image->head,
(unsigned long)page_list,
image->start, cpu_has_pae,
Index: head-2008-11-17/arch/x86/kernel/relocate_kernel_32.S
===================================================================
--- head-2008-11-17.orig/arch/x86/kernel/relocate_kernel_32.S 2008-11-17 13:15:56.000000000 +0100
+++ head-2008-11-17/arch/x86/kernel/relocate_kernel_32.S 2008-11-17 13:38:03.000000000 +0100
@@ -199,14 +199,45 @@ relocate_new_kernel:
movl PTR(PA_PGD)(%ebp), %eax
movl %eax, %cr3
+ /* setup idt */
+ movl %edi, %eax
+ addl $(idt_48 - relocate_kernel), %eax
+ lidtl (%eax)
+
+ /* setup gdt */
+ movl %edi, %eax
+ addl $(gdt - relocate_kernel), %eax
+ movl %edi, %esi
+ addl $((gdt_48 - relocate_kernel) + 2), %esi
+ movl %eax, (%esi)
+
+ movl %edi, %eax
+ addl $(gdt_48 - relocate_kernel), %eax
+ lgdtl (%eax)
+
+ /* setup data segment registers */
+ mov $(gdt_ds - gdt), %eax
+ mov %eax, %ds
+ mov %eax, %es
+ mov %eax, %fs
+ mov %eax, %gs
+ mov %eax, %ss
+
/* setup a new stack at the end of the physical control page */
lea PAGE_SIZE(%edi), %esp
- /* jump to identity mapped page */
- movl %edi, %eax
- addl $(identity_mapped - relocate_kernel), %eax
- pushl %eax
- ret
+ /* load new code segment and jump to identity mapped page */
+ movl %edi, %esi
+ xorl %eax, %eax
+ pushl %eax
+ pushl %esi
+ pushl %eax
+ movl $(gdt_cs - gdt), %eax
+ pushl %eax
+ movl %edi, %eax
+ addl $(identity_mapped - relocate_kernel),%eax
+ pushl %eax
+ iretl
identity_mapped:
/* store the start address on the stack */
@@ -378,5 +409,22 @@ swap_pages:
popl %ebp
ret
+ .align 16
+gdt:
+ .quad 0x0000000000000000 /* NULL descriptor */
+gdt_cs:
+ .quad 0x00cf9a000000ffff /* kernel 4GB code at 0x00000000 */
+gdt_ds:
+ .quad 0x00cf92000000ffff /* kernel 4GB data at 0x00000000 */
+gdt_end:
+
+gdt_48:
+ .word gdt_end - gdt - 1 /* limit */
+ .long 0 /* base - filled in by code above */
+
+idt_48:
+ .word 0 /* limit */
+ .long 0 /* base */
+
.globl kexec_control_code_size
.set kexec_control_code_size, . - relocate_kernel

View File

@@ -0,0 +1,168 @@
Subject: kexec: Move asm segment handling code to the assembly file (x86_64)
From: http://xenbits.xensource.com/xen-unstable.hg (tip 13816)
Patch-mainline: obsolete
This patch moves the idt, gdt, and segment handling code from machine_kexec.c
to relocate_kernel.S. The main reason behind this move is to avoid code
duplication in the Xen hypervisor. With this patch all code required to kexec
is put on the control page.
On top of that this patch also counts as a cleanup - I think it is much
nicer to write assembly directly in assembly files than wrap inline assembly
in C functions for no apparent reason.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Acked-by: jbeulich@novell.com
---
Applies to 2.6.19-rc1.
machine_kexec.c | 58 -----------------------------------------------------
relocate_kernel.S | 50 +++++++++++++++++++++++++++++++++++++++++----
2 files changed, 45 insertions(+), 63 deletions(-)
Index: head-2008-08-18/arch/x86/kernel/machine_kexec_64.c
===================================================================
--- head-2008-08-18.orig/arch/x86/kernel/machine_kexec_64.c 2008-08-18 09:05:04.000000000 +0200
+++ head-2008-08-18/arch/x86/kernel/machine_kexec_64.c 2008-08-18 10:13:08.000000000 +0200
@@ -115,47 +115,6 @@ static int init_pgtable(struct kimage *i
return init_level4_page(image, level4p, 0, max_pfn << PAGE_SHIFT);
}
-static void set_idt(void *newidt, u16 limit)
-{
- struct desc_ptr curidt;
-
- /* x86-64 supports unaliged loads & stores */
- curidt.size = limit;
- curidt.address = (unsigned long)newidt;
-
- __asm__ __volatile__ (
- "lidtq %0\n"
- : : "m" (curidt)
- );
-};
-
-
-static void set_gdt(void *newgdt, u16 limit)
-{
- struct desc_ptr curgdt;
-
- /* x86-64 supports unaligned loads & stores */
- curgdt.size = limit;
- curgdt.address = (unsigned long)newgdt;
-
- __asm__ __volatile__ (
- "lgdtq %0\n"
- : : "m" (curgdt)
- );
-};
-
-static void load_segments(void)
-{
- __asm__ __volatile__ (
- "\tmovl %0,%%ds\n"
- "\tmovl %0,%%es\n"
- "\tmovl %0,%%ss\n"
- "\tmovl %0,%%fs\n"
- "\tmovl %0,%%gs\n"
- : : "a" (__KERNEL_DS) : "memory"
- );
-}
-
int machine_kexec_prepare(struct kimage *image)
{
unsigned long start_pgtable;
@@ -214,23 +173,6 @@ void machine_kexec(struct kimage *image)
page_list[PA_TABLE_PAGE] =
(unsigned long)__pa(page_address(image->control_code_page));
- /* The segment registers are funny things, they have both a
- * visible and an invisible part. Whenever the visible part is
- * set to a specific selector, the invisible part is loaded
- * with from a table in memory. At no other time is the
- * descriptor table in memory accessed.
- *
- * I take advantage of this here by force loading the
- * segments, before I zap the gdt with an invalid value.
- */
- load_segments();
- /* The gdt & idt are now invalid.
- * If you want to load them you must set up your own idt & gdt.
- */
- set_gdt(phys_to_virt(0),0);
- set_idt(phys_to_virt(0),0);
-
- /* now call it */
relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
image->start);
}
Index: head-2008-08-18/arch/x86/kernel/relocate_kernel_64.S
===================================================================
--- head-2008-08-18.orig/arch/x86/kernel/relocate_kernel_64.S 2008-07-13 23:51:29.000000000 +0200
+++ head-2008-08-18/arch/x86/kernel/relocate_kernel_64.S 2008-08-18 10:13:08.000000000 +0200
@@ -160,13 +160,39 @@ relocate_new_kernel:
movq PTR(PA_PGD)(%rsi), %r9
movq %r9, %cr3
+ /* setup idt */
+ movq %r8, %rax
+ addq $(idt_80 - relocate_kernel), %rax
+ lidtq (%rax)
+
+ /* setup gdt */
+ movq %r8, %rax
+ addq $(gdt - relocate_kernel), %rax
+ movq %r8, %r9
+ addq $((gdt_80 - relocate_kernel) + 2), %r9
+ movq %rax, (%r9)
+
+ movq %r8, %rax
+ addq $(gdt_80 - relocate_kernel), %rax
+ lgdtq (%rax)
+
+ /* setup data segment registers */
+ xorl %eax, %eax
+ movl %eax, %ds
+ movl %eax, %es
+ movl %eax, %fs
+ movl %eax, %gs
+ movl %eax, %ss
+
/* setup a new stack at the end of the physical control page */
lea PAGE_SIZE(%r8), %rsp
- /* jump to identity mapped page */
- addq $(identity_mapped - relocate_kernel), %r8
- pushq %r8
- ret
+ /* load new code segment and jump to identity mapped page */
+ movq %r8, %rax
+ addq $(identity_mapped - relocate_kernel), %rax
+ pushq $(gdt_cs - gdt)
+ pushq %rax
+ lretq
identity_mapped:
/* store the start address on the stack */
@@ -262,5 +288,19 @@ identity_mapped:
xorq %r13, %r13
xorq %r14, %r14
xorq %r15, %r15
-
ret
+
+ .align 16
+gdt:
+ .quad 0x0000000000000000 /* NULL descriptor */
+gdt_cs:
+ .quad 0x00af9a000000ffff
+gdt_end:
+
+gdt_80:
+ .word gdt_end - gdt - 1 /* limit */
+ .quad 0 /* base - filled in by code above */
+
+idt_80:
+ .word 0 /* limit */
+ .quad 0 /* base */

View File

@@ -0,0 +1,39 @@
From: Olaf Kirch <okir@suse.de>
Subject: Allow to bring up network interface w/o ipv6 autoconf
References: 161888
When bringing up a xen bridge device, it will always be configured to
use a MAC address of ff:ff:ff:ff:ff:fe. This greatly confuses IPv6 DAD,
which starts logging lots and lots of useless messages to syslog.
We really want to disable IPv6 on these interfaces, and there doesn't
seem to be a reliable way to do this without bringing the interface
up first (and triggering IPv6 autoconf).
This patch makes autoconf (DAD and router discovery) depend on the
interface's ability to do multicast. Turning off multicast for an
interface before bringing it up will suppress autoconfiguration.
net/ipv6/addrconf.c | 2 ++
1 files changed, 2 insertions(+)
Index: head-2008-09-25/net/ipv6/addrconf.c
===================================================================
--- head-2008-09-25.orig/net/ipv6/addrconf.c 2008-09-25 13:56:12.000000000 +0200
+++ head-2008-09-25/net/ipv6/addrconf.c 2008-09-25 14:15:19.000000000 +0200
@@ -2781,6 +2781,7 @@ static void addrconf_dad_start(struct in
spin_lock_bh(&ifp->lock);
if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||
+ !(dev->flags&IFF_MULTICAST) ||
idev->cnf.accept_dad < 1 ||
!(ifp->flags&IFA_F_TENTATIVE) ||
ifp->flags & IFA_F_NODAD) {
@@ -2878,6 +2879,7 @@ static void addrconf_dad_completed(struc
if (ifp->idev->cnf.forwarding == 0 &&
ifp->idev->cnf.rtr_solicits > 0 &&
(dev->flags&IFF_LOOPBACK) == 0 &&
+ (dev->flags & IFF_MULTICAST) &&
(ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
/*
* If a host as already performed a random delay

View File

@@ -0,0 +1,307 @@
Subject: xen/dom0: Reassign memory resources to device for pci passthrough
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 745:2268be46c75e)
Patch-mainline: obsolete
Acked-by: jbeulich@novell.com
Index: head-2008-12-01/drivers/pci/Makefile
===================================================================
--- head-2008-12-01.orig/drivers/pci/Makefile 2008-12-01 10:53:15.000000000 +0100
+++ head-2008-12-01/drivers/pci/Makefile 2008-10-21 13:09:46.000000000 +0200
@@ -4,6 +4,7 @@
obj-y += access.o bus.o probe.o remove.o pci.o quirks.o slot.o \
pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
+obj-$(CONFIG_PCI_REASSIGN) += reassigndev.o
obj-$(CONFIG_PROC_FS) += proc.o
# Build PCI Express stuff if needed
Index: head-2008-12-01/drivers/pci/pci.h
===================================================================
--- head-2008-12-01.orig/drivers/pci/pci.h 2008-12-01 10:53:15.000000000 +0100
+++ head-2008-12-01/drivers/pci/pci.h 2008-10-21 13:09:01.000000000 +0200
@@ -144,3 +144,9 @@ struct pci_slot_attribute {
};
#define to_pci_slot_attr(s) container_of(s, struct pci_slot_attribute, attr)
+#ifdef CONFIG_PCI_REASSIGN
+extern int is_reassigndev(struct pci_dev *dev);
+extern void pci_disable_bridge_window(struct pci_dev *dev);
+#else
+#define is_reassigndev(dev) 0
+#endif
Index: head-2008-12-01/drivers/pci/quirks.c
===================================================================
--- head-2008-12-01.orig/drivers/pci/quirks.c 2008-12-01 10:53:15.000000000 +0100
+++ head-2008-12-01/drivers/pci/quirks.c 2008-10-29 10:52:40.000000000 +0100
@@ -24,6 +24,54 @@
#include <linux/kallsyms.h>
#include "pci.h"
+#ifdef CONFIG_PCI_REASSIGN
+/*
+ * This quirk function disables the device and releases resources
+ * which is specified by kernel's boot parameter 'reassigndev'.
+ * Later on, kernel will assign page-aligned memory resource back
+ * to that device.
+ */
+static void __devinit quirk_release_resources(struct pci_dev *dev)
+{
+ int i;
+ struct resource *r;
+
+ if (is_reassigndev(dev)) {
+ if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL &&
+ (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) {
+ /* PCI Host Bridge isn't a target device */
+ return;
+ }
+ printk(KERN_INFO
+ "PCI: Disable device and release resources [%s].\n",
+ pci_name(dev));
+ pci_disable_device(dev);
+
+ for (i=0; i < PCI_NUM_RESOURCES; i++) {
+ r = &dev->resource[i];
+ if (!(r->flags & IORESOURCE_MEM))
+ continue;
+
+ r->end = r->end - r->start;
+ r->start = 0;
+
+ if (i < PCI_BRIDGE_RESOURCES) {
+ pci_update_resource(dev, r, i);
+ }
+ }
+ /* need to disable bridge's resource window,
+ * to make kernel enable to reassign new resource
+ * window later on.
+ */
+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
+ (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
+ pci_disable_bridge_window(dev);
+ }
+ }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_release_resources);
+#endif
+
/* The Mellanox Tavor device gives false positive parity errors
* Mark this device with a broken_parity_status, to allow
* PCI scanning code to "skip" this now blacklisted device.
Index: head-2008-12-01/drivers/pci/reassigndev.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ head-2008-12-01/drivers/pci/reassigndev.c 2008-10-21 13:13:38.000000000 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2008, NEC Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/string.h>
+#include "pci.h"
+
+
+#define REASSIGNDEV_PARAM_MAX (2048)
+#define TOKEN_MAX (12) /* "SSSS:BB:DD.F" length is 12 */
+
+static char param_reassigndev[REASSIGNDEV_PARAM_MAX] = {0};
+
+static int __init reassigndev_setup(char *str)
+{
+ strncpy(param_reassigndev, str, REASSIGNDEV_PARAM_MAX);
+ param_reassigndev[REASSIGNDEV_PARAM_MAX - 1] = '\0';
+ return 1;
+}
+__setup("reassigndev=", reassigndev_setup);
+
+int is_reassigndev(struct pci_dev *dev)
+{
+ char dev_str[TOKEN_MAX+1];
+ int seg, bus, slot, func;
+ int len;
+ char *p, *next_str;
+
+ p = param_reassigndev;
+ for (; p; p = next_str + 1) {
+ next_str = strpbrk(p, ",");
+ if (next_str) {
+ len = next_str - p;
+ } else {
+ len = strlen(p);
+ }
+ if (len > 0 && len <= TOKEN_MAX) {
+ strncpy(dev_str, p, len);
+ *(dev_str + len) = '\0';
+
+ if (sscanf(dev_str, "%x:%x:%x.%x",
+ &seg, &bus, &slot, &func) != 4) {
+ if (sscanf(dev_str, "%x:%x.%x",
+ &bus, &slot, &func) == 3) {
+ seg = 0;
+ } else {
+ /* failed to scan strings */
+ seg = -1;
+ bus = -1;
+ }
+ }
+ if (seg == pci_domain_nr(dev->bus) &&
+ bus == dev->bus->number &&
+ slot == PCI_SLOT(dev->devfn) &&
+ func == PCI_FUNC(dev->devfn)) {
+ /* It's a target device */
+ return 1;
+ }
+ }
+ if (!next_str)
+ break;
+ }
+
+ return 0;
+}
Index: head-2008-12-01/drivers/pci/setup-bus.c
===================================================================
--- head-2008-12-01.orig/drivers/pci/setup-bus.c 2008-12-01 10:53:15.000000000 +0100
+++ head-2008-12-01/drivers/pci/setup-bus.c 2008-10-21 13:09:01.000000000 +0200
@@ -26,6 +26,7 @@
#include <linux/cache.h>
#include <linux/slab.h>
+#include "pci.h"
static void pbus_assign_resources_sorted(struct pci_bus *bus)
{
@@ -343,7 +344,8 @@ static int pbus_size_mem(struct pci_bus
list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
-
+ int reassign = is_reassigndev(dev);
+
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
struct resource *r = &dev->resource[i];
resource_size_t r_size;
@@ -351,6 +353,10 @@ static int pbus_size_mem(struct pci_bus
if (r->parent || (r->flags & mask) != type)
continue;
r_size = r->end - r->start + 1;
+
+ if ((i < PCI_BRIDGE_RESOURCES) && reassign)
+ r_size = ALIGN(r_size, PAGE_SIZE);
+
/* For bridges size != alignment */
align = resource_alignment(r);
order = __ffs(align) - 20;
Index: head-2008-12-01/drivers/pci/setup-res.c
===================================================================
--- head-2008-12-01.orig/drivers/pci/setup-res.c 2008-12-01 10:53:15.000000000 +0100
+++ head-2008-12-01/drivers/pci/setup-res.c 2008-12-01 11:10:02.000000000 +0100
@@ -126,6 +126,21 @@ int pci_claim_resource(struct pci_dev *d
return err;
}
+#ifdef CONFIG_PCI_REASSIGN
+void pci_disable_bridge_window(struct pci_dev *dev)
+{
+ printk(KERN_DEBUG "PCI: Disable bridge window on %s\n", pci_name(dev));
+
+ /* MMIO Base/Limit */
+ pci_write_config_dword(dev, PCI_MEMORY_BASE, 0x0000fff0);
+
+ /* Prefetchable MMIO Base/Limit */
+ pci_write_config_dword(dev, PCI_PREF_LIMIT_UPPER32, 0);
+ pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0x0000fff0);
+ pci_write_config_dword(dev, PCI_PREF_BASE_UPPER32, 0xffffffff);
+}
+#endif
+
int pci_assign_resource(struct pci_dev *dev, int resno)
{
struct pci_bus *bus = dev->bus;
@@ -144,6 +159,10 @@ int pci_assign_resource(struct pci_dev *
(unsigned long long)res->end, res->flags);
return -EINVAL;
}
+ if (resno < PCI_BRIDGE_RESOURCES
+ && is_reassigndev(dev)
+ && (res->flags & IORESOURCE_MEM))
+ align = ALIGN(align, PAGE_SIZE);
/* First, try exact prefetching match.. */
ret = pci_bus_alloc_resource(bus, res, size, align, min,
@@ -169,8 +188,15 @@ int pci_assign_resource(struct pci_dev *
(unsigned long long)res->end);
} else {
res->flags &= ~IORESOURCE_STARTALIGN;
- if (resno < PCI_BRIDGE_RESOURCES)
+ if (resno < PCI_BRIDGE_RESOURCES) {
+#ifdef CONFIG_PCI_REASSIGN
+ printk(KERN_DEBUG "PCI: Assign resource(%d) on %s "
+ "%016llx - %016llx\n", resno, pci_name(dev),
+ (unsigned long long)res->start,
+ (unsigned long long)res->end);
+#endif
pci_update_resource(dev, res, resno);
+ }
}
return ret;
@@ -208,6 +234,12 @@ int pci_assign_resource_fixed(struct pci
(unsigned long long)res->start,
(unsigned long long)res->end);
} else if (resno < PCI_BRIDGE_RESOURCES) {
+#ifdef CONFIG_PCI_REASSIGN
+ printk(KERN_DEBUG "PCI: Assign resource(%d) on %s "
+ "%016llx - %016llx\n", resno, pci_name(dev),
+ (unsigned long long)res->start,
+ (unsigned long long)res->end);
+#endif
pci_update_resource(dev, res, resno);
}
@@ -220,6 +252,7 @@ EXPORT_SYMBOL_GPL(pci_assign_resource_fi
void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
{
int i;
+ int reassigndev = is_reassigndev(dev);
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
struct resource *r;
@@ -242,12 +275,22 @@ void pdev_sort_resources(struct pci_dev
(unsigned long long)r->end, r->flags);
continue;
}
+ if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM) &&
+ reassigndev)
+ r_align = ALIGN(r_align, PAGE_SIZE);
+
for (list = head; ; list = list->next) {
resource_size_t align = 0;
struct resource_list *ln = list->next;
- if (ln)
+ if (ln) {
align = resource_alignment(ln->res);
+ if (ln->res - ln->dev->resource <
+ PCI_BRIDGE_RESOURCES &&
+ (ln->res->flags & IORESOURCE_MEM) &&
+ is_reassigndev(ln->dev))
+ align = ALIGN(align, PAGE_SIZE);
+ }
if (r_align > align) {
tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,264 @@
From: jbeulich@novell.com
Subject: conditionalize driverlink additions to Solarflare driver
Patch-mainline: obsolete
References: FATE#303479
At once converted the EFX_TRACE() invocations after vetoed RX/TX
callbacks to ...LOG() ones, which is consistent with Solarflare's
current code according to David Riddoch (2008-09-12).
Index: head-2008-09-01/drivers/net/sfc/Kconfig
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/Kconfig 2008-07-17 16:18:07.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/Kconfig 2008-09-12 14:01:48.000000000 +0200
@@ -13,8 +13,12 @@ config SFC
To compile this driver as a module, choose M here. The module
will be called sfc.
+config SFC_DRIVERLINK
+ bool
+
config SFC_RESOURCE
depends on SFC && X86
+ select SFC_DRIVERLINK
tristate "Solarflare Solarstorm SFC4000 resource driver"
help
This module provides the SFC resource manager driver.
Index: head-2008-09-01/drivers/net/sfc/Makefile
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/Makefile 2008-07-17 16:18:07.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/Makefile 2008-09-12 12:22:05.000000000 +0200
@@ -1,7 +1,7 @@
sfc-y += efx.o falcon.o tx.o rx.o falcon_xmac.o \
selftest.o ethtool.o xfp_phy.o \
- mdio_10g.o tenxpress.o boards.o sfe4001.o \
- driverlink.o
+ mdio_10g.o tenxpress.o boards.o sfe4001.o
+sfc-$(CONFIG_SFC_DRIVERLINK) += driverlink.o
obj-$(CONFIG_SFC) += sfc.o
obj-$(CONFIG_SFC_RESOURCE) += sfc_resource/
Index: head-2008-09-01/drivers/net/sfc/driverlink.c
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/driverlink.c 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/driverlink.c 2008-09-12 13:57:29.000000000 +0200
@@ -14,7 +14,6 @@
#include <linux/rtnetlink.h>
#include "net_driver.h"
#include "efx.h"
-#include "driverlink_api.h"
#include "driverlink.h"
/* Protects @efx_driverlink_lock and @efx_driver_list */
Index: head-2008-09-01/drivers/net/sfc/driverlink.h
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/driverlink.h 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/driverlink.h 2008-09-12 16:14:04.000000000 +0200
@@ -15,6 +15,10 @@
struct efx_dl_device;
struct efx_nic;
+#ifdef CONFIG_SFC_DRIVERLINK
+
+#include "driverlink_api.h"
+
/* Efx callback devices
*
* A list of the devices that own each callback. The partner to
@@ -40,4 +44,23 @@ extern void efx_dl_unregister_nic(struct
extern void efx_dl_reset_suspend(struct efx_nic *efx);
extern void efx_dl_reset_resume(struct efx_nic *efx, int ok);
+#define EFX_DL_LOG EFX_LOG
+
+#else /* CONFIG_SFC_DRIVERLINK */
+
+enum efx_veto { EFX_ALLOW_PACKET = 0 };
+
+static inline int efx_nop_callback(struct efx_nic *efx) { return 0; }
+#define EFX_DL_CALLBACK(port, name, ...) efx_nop_callback(port)
+
+static inline int efx_dl_register_nic(struct efx_nic *efx) { return 0; }
+static inline void efx_dl_unregister_nic(struct efx_nic *efx) {}
+
+static inline void efx_dl_reset_suspend(struct efx_nic *efx) {}
+static inline void efx_dl_reset_resume(struct efx_nic *efx, int ok) {}
+
+#define EFX_DL_LOG(efx, fmt, args...) ((void)(efx))
+
+#endif /* CONFIG_SFC_DRIVERLINK */
+
#endif /* EFX_DRIVERLINK_H */
Index: head-2008-09-01/drivers/net/sfc/efx.c
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/efx.c 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/efx.c 2008-09-12 12:42:32.000000000 +0200
@@ -1596,6 +1596,7 @@ static void efx_unregister_netdev(struct
* Device reset and suspend
*
**************************************************************************/
+#ifdef CONFIG_SFC_DRIVERLINK
/* Serialise access to the driverlink callbacks, by quiescing event processing
* (without flushing the descriptor queues), and acquiring the rtnl_lock */
void efx_suspend(struct efx_nic *efx)
@@ -1613,6 +1614,7 @@ void efx_resume(struct efx_nic *efx)
efx_start_all(efx);
rtnl_unlock();
}
+#endif
/* The final hardware and software finalisation before reset. */
static int efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
@@ -1899,9 +1901,11 @@ static int efx_init_struct(struct efx_ni
mutex_init(&efx->mac_lock);
efx->phy_op = &efx_dummy_phy_operations;
efx->mii.dev = net_dev;
+#ifdef CONFIG_SFC_DRIVERLINK
INIT_LIST_HEAD(&efx->dl_node);
INIT_LIST_HEAD(&efx->dl_device_list);
efx->dl_cb = efx_default_callbacks;
+#endif
INIT_WORK(&efx->reconfigure_work, efx_reconfigure_work);
atomic_set(&efx->netif_stop_count, 1);
Index: head-2008-09-01/drivers/net/sfc/falcon.c
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/falcon.c 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/falcon.c 2008-09-12 13:51:32.000000000 +0200
@@ -36,12 +36,17 @@
/**
* struct falcon_nic_data - Falcon NIC state
+ * @next_buffer_table: First available buffer table id
* @resources: Resource information for driverlink client
* @pci_dev2: The secondary PCI device if present
* @i2c_data: Operations and state for I2C bit-bashing algorithm
*/
struct falcon_nic_data {
+#ifndef CONFIG_SFC_DRIVERLINK
+ unsigned next_buffer_table;
+#else
struct efx_dl_falcon_resources resources;
+#endif
struct pci_dev *pci_dev2;
struct i2c_algo_bit_data i2c_data;
};
@@ -322,8 +327,13 @@ static int falcon_alloc_special_buffer(s
memset(buffer->addr, 0xff, len);
/* Select new buffer ID */
+#ifndef CONFIG_SFC_DRIVERLINK
+ buffer->index = nic_data->next_buffer_table;
+ nic_data->next_buffer_table += buffer->entries;
+#else
buffer->index = nic_data->resources.buffer_table_min;
nic_data->resources.buffer_table_min += buffer->entries;
+#endif
EFX_LOG(efx, "allocating special buffers %d-%d at %llx+%x "
"(virt %p phys %lx)\n", buffer->index,
@@ -2382,6 +2392,7 @@ static int falcon_probe_nvconfig(struct
* should live. */
static int falcon_dimension_resources(struct efx_nic *efx)
{
+#ifdef CONFIG_SFC_DRIVERLINK
unsigned internal_dcs_entries;
struct falcon_nic_data *nic_data = efx->nic_data;
struct efx_dl_falcon_resources *res = &nic_data->resources;
@@ -2426,6 +2437,7 @@ static int falcon_dimension_resources(st
if (EFX_INT_MODE_USE_MSI(efx))
res->flags |= EFX_DL_FALCON_USE_MSI;
+#endif
return 0;
}
@@ -2551,7 +2563,9 @@ int falcon_probe_nic(struct efx_nic *efx
return 0;
fail6:
+#ifdef CONFIG_SFC_DRIVERLINK
efx->dl_info = NULL;
+#endif
fail5:
falcon_free_buffer(efx, &efx->irq_status);
fail4:
@@ -2742,7 +2756,9 @@ void falcon_remove_nic(struct efx_nic *e
/* Tear down the private nic state */
kfree(efx->nic_data);
efx->nic_data = NULL;
+#ifdef CONFIG_SFC_DRIVERLINK
efx->dl_info = NULL;
+#endif
}
void falcon_update_nic_stats(struct efx_nic *efx)
Index: head-2008-09-01/drivers/net/sfc/net_driver.h
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/net_driver.h 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/net_driver.h 2008-09-12 13:57:19.000000000 +0200
@@ -30,7 +30,6 @@
#include "enum.h"
#include "bitfield.h"
-#include "driverlink_api.h"
#include "driverlink.h"
#define EFX_MAX_LRO_DESCRIPTORS 8
@@ -762,11 +761,13 @@ struct efx_nic {
void *loopback_selftest;
const char *silicon_rev;
+#ifdef CONFIG_SFC_DRIVERLINK
struct efx_dl_device_info *dl_info;
struct list_head dl_node;
struct list_head dl_device_list;
struct efx_dl_callbacks dl_cb;
struct efx_dl_cb_devices dl_cb_dev;
+#endif
};
static inline int efx_dev_registered(struct efx_nic *efx)
Index: head-2008-09-01/drivers/net/sfc/rx.c
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/rx.c 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/rx.c 2008-09-12 16:13:49.000000000 +0200
@@ -559,8 +559,8 @@ static inline void efx_rx_packet_lro(str
* an obvious interface to this, so veto packets before LRO */
veto = EFX_DL_CALLBACK(efx, rx_packet, rx_buf->data, rx_buf->len);
if (unlikely(veto)) {
- EFX_TRACE(efx, "LRO RX vetoed by driverlink %s driver\n",
- efx->dl_cb_dev.rx_packet->driver->name);
+ EFX_DL_LOG(efx, "LRO RX vetoed by driverlink %s driver\n",
+ efx->dl_cb_dev.rx_packet->driver->name);
/* Free the buffer now */
efx_free_rx_buffer(efx, rx_buf);
return;
@@ -741,8 +741,8 @@ void __efx_rx_packet(struct efx_channel
/* Allow callback to veto the packet */
veto = EFX_DL_CALLBACK(efx, rx_packet, rx_buf->data, rx_buf->len);
if (unlikely(veto)) {
- EFX_LOG(efx, "RX vetoed by driverlink %s driver\n",
- efx->dl_cb_dev.rx_packet->driver->name);
+ EFX_DL_LOG(efx, "RX vetoed by driverlink %s driver\n",
+ efx->dl_cb_dev.rx_packet->driver->name);
/* Free the buffer now */
efx_free_rx_buffer(efx, rx_buf);
goto done;
Index: head-2008-09-01/drivers/net/sfc/tx.c
===================================================================
--- head-2008-09-01.orig/drivers/net/sfc/tx.c 2008-08-18 10:16:46.000000000 +0200
+++ head-2008-09-01/drivers/net/sfc/tx.c 2008-09-12 16:13:34.000000000 +0200
@@ -374,9 +374,9 @@ int efx_hard_start_xmit(struct sk_buff *
/* See if driverlink wants to veto the packet. */
veto = EFX_DL_CALLBACK(efx, tx_packet, skb);
if (unlikely(veto)) {
- EFX_TRACE(efx, "TX queue %d packet vetoed by "
- "driverlink %s driver\n", tx_queue->queue,
- efx->dl_cb_dev.tx_packet->driver->name);
+ EFX_DL_LOG(efx, "TX queue %d packet vetoed by "
+ "driverlink %s driver\n", tx_queue->queue,
+ efx->dl_cb_dev.tx_packet->driver->name);
/* Free the skb; nothing else will do it */
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,848 @@
Subject: xen3 xen-kconfig
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 728:832aac894efd)
Patch-mainline: obsolete
Acked-by: jbeulich@novell.com
Index: head-2008-11-25/arch/x86/Kconfig
===================================================================
--- head-2008-11-25.orig/arch/x86/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/Kconfig 2008-11-17 13:39:31.000000000 +0100
@@ -44,6 +44,7 @@ config GENERIC_LOCKBREAK
config GENERIC_TIME
def_bool y
+ depends on !X86_XEN
config GENERIC_CMOS_UPDATE
def_bool y
@@ -188,7 +189,7 @@ config X86_64_SMP
config X86_HT
bool
- depends on SMP
+ depends on SMP && !XEN
depends on (X86_32 && !X86_VOYAGER) || X86_64
default y
@@ -200,6 +201,17 @@ config X86_BIOS_REBOOT
config X86_TRAMPOLINE
bool
depends on X86_SMP || (X86_VOYAGER && SMP) || (64BIT && ACPI_SLEEP)
+ depends on !XEN
+ default y
+
+config X86_NO_TSS
+ bool
+ depends on X86_XEN || X86_64_XEN
+ default y
+
+config X86_NO_IDT
+ bool
+ depends on X86_XEN || X86_64_XEN
default y
config KTIME_SCALAR
@@ -267,6 +279,17 @@ config X86_PC
help
Choose this option if your computer is a standard PC or compatible.
+config X86_XEN
+ bool "Xen-compatible"
+ select XEN
+ select X86_PAE
+ select X86_UP_APIC if !SMP && XEN_PRIVILEGED_GUEST
+ select X86_UP_IOAPIC if !SMP && XEN_PRIVILEGED_GUEST
+ select SWIOTLB
+ help
+ Choose this option if you plan to run this kernel on top of the
+ Xen Hypervisor.
+
config X86_ELAN
bool "AMD Elan"
depends on X86_32
@@ -334,6 +357,13 @@ config X86_BIGSMP
endif
+config X86_64_XEN
+ bool "Enable Xen compatible kernel"
+ select XEN
+ select SWIOTLB
+ help
+ This option will compile a kernel compatible with Xen hypervisor
+
config X86_VSMP
bool "Support for ScaleMP vSMP"
select PARAVIRT
@@ -474,6 +504,7 @@ source "arch/x86/Kconfig.cpu"
config HPET_TIMER
def_bool X86_64
prompt "HPET Timer Support" if X86_32
+ depends on !X86_XEN && !X86_64_XEN
help
Use the IA-PC HPET (High Precision Event Timer) to manage
time in preference to the PIT and RTC, if a HPET is
@@ -510,7 +541,7 @@ config GART_IOMMU
default y
select SWIOTLB
select AGP
- depends on X86_64 && PCI
+ depends on X86_64 && PCI && !X86_64_XEN
help
Support for full DMA access of devices with 32bit memory access only
on systems with more than 3GB. This is usually needed for USB,
@@ -525,7 +556,7 @@ config GART_IOMMU
config CALGARY_IOMMU
bool "IBM Calgary IOMMU support"
select SWIOTLB
- depends on X86_64 && PCI && EXPERIMENTAL
+ depends on X86_64 && PCI && !X86_64_XEN && EXPERIMENTAL
help
Support for hardware IOMMUs in IBM's xSeries x366 and x460
systems. Needed to run systems with more than 3GB of memory
@@ -593,6 +624,7 @@ config NR_CPUS
depends on SMP
default "4096" if MAXSMP
default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
+ default "16" if X86_64_XEN
default "8"
help
This allows you to specify the maximum number of CPUs which this
@@ -648,7 +680,7 @@ config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
config X86_UP_APIC
bool "Local APIC support on uniprocessors"
- depends on X86_32 && !SMP && !(X86_VOYAGER || X86_GENERICARCH)
+ depends on X86_32 && !SMP && !(X86_VOYAGER || X86_GENERICARCH || XEN_UNPRIVILEGED_GUEST)
help
A local APIC (Advanced Programmable Interrupt Controller) is an
integrated interrupt controller in the CPU. If you have a single-CPU
@@ -674,18 +706,25 @@ config X86_UP_IOAPIC
config X86_LOCAL_APIC
def_bool y
depends on X86_64 || (X86_32 && (X86_UP_APIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH))
+ depends on !XEN_UNPRIVILEGED_GUEST
config X86_IO_APIC
def_bool y
depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH))
+ depends on !XEN_UNPRIVILEGED_GUEST
config X86_VISWS_APIC
def_bool y
depends on X86_32 && X86_VISWS
+config X86_XEN_GENAPIC
+ bool
+ depends on X86_64_XEN
+ default y
+
config X86_MCE
bool "Machine Check Exception"
- depends on !X86_VOYAGER
+ depends on !(X86_VOYAGER || XEN)
---help---
Machine Check Exception support allows the processor to notify the
kernel if it detects a problem (e.g. overheating, component failure).
@@ -785,7 +824,7 @@ config I8K
config X86_REBOOTFIXUPS
def_bool n
prompt "Enable X86 board specific fixups for reboot"
- depends on X86_32 && X86
+ depends on X86_32 && !X86_XEN
---help---
This enables chipset and/or board specific fixups to be done
in order to get reboot to work correctly. This is only needed on
@@ -802,6 +841,7 @@ config X86_REBOOTFIXUPS
config MICROCODE
tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
+ depends on !XEN_UNPRIVILEGED_GUEST
select FW_LOADER
---help---
If you say Y here, you will be able to update the microcode on
@@ -969,7 +1009,7 @@ config DIRECT_GBPAGES
# Common NUMA Features
config NUMA
bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
- depends on SMP
+ depends on SMP && !XEN
depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL)
default n if X86_PC
default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP)
@@ -1071,7 +1111,7 @@ config ARCH_SPARSEMEM_DEFAULT
config ARCH_SPARSEMEM_ENABLE
def_bool y
- depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC)
+ depends on (X86_64 && !X86_64_XEN) || NUMA || (EXPERIMENTAL && X86_PC)
select SPARSEMEM_STATIC if X86_32
select SPARSEMEM_VMEMMAP_ENABLE if X86_64
@@ -1117,6 +1157,7 @@ config X86_RESERVE_LOW_64K
config MATH_EMULATION
bool
prompt "Math emulation" if X86_32
+ depends on !X86_XEN
---help---
Linux can emulate a math coprocessor (used for floating point
operations) if you don't have one. 486DX and Pentium processors have
@@ -1142,6 +1183,7 @@ config MATH_EMULATION
config MTRR
bool "MTRR (Memory Type Range Register) support"
+ depends on !XEN_UNPRIVILEGED_GUEST
---help---
On Intel P6 family processors (Pentium Pro, Pentium II and later)
the Memory Type Range Registers (MTRRs) may be used to control
@@ -1223,7 +1265,7 @@ config X86_PAT
config EFI
def_bool n
prompt "EFI runtime service support"
- depends on ACPI
+ depends on ACPI && !X86_XEN && !X86_64_XEN
---help---
This enables the kernel to use EFI runtime services that are
available (such as the EFI variable services).
@@ -1238,7 +1280,7 @@ config EFI
config IRQBALANCE
def_bool y
prompt "Enable kernel irq balancing"
- depends on X86_32 && SMP && X86_IO_APIC
+ depends on X86_32 && SMP && X86_IO_APIC && !X86_XEN
help
The default yes will allow the kernel to do irq load balancing.
Saying no will keep the kernel from doing irq load balancing.
@@ -1301,6 +1343,7 @@ source kernel/Kconfig.hz
config KEXEC
bool "kexec system call"
depends on X86_BIOS_REBOOT
+ depends on !XEN_UNPRIVILEGED_GUEST
help
kexec is a system call that implements the ability to shutdown your
current kernel, and to start another kernel. It is like a reboot
@@ -1318,6 +1361,7 @@ config KEXEC
config CRASH_DUMP
bool "kernel crash dumps"
depends on X86_64 || (X86_32 && HIGHMEM)
+ depends on !XEN
help
Generate crash dump after being started by kexec.
This should be normally only set in special crash dump kernels
@@ -1436,6 +1480,7 @@ config COMPAT_VDSO
def_bool y
prompt "Compat VDSO support"
depends on X86_32 || IA32_EMULATION
+ depends on !X86_XEN
help
Map the 32-bit VDSO to the predictable old-style address too.
---help---
@@ -1458,7 +1503,7 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
depends on NUMA
menu "Power management options"
- depends on !X86_VOYAGER
+ depends on !(X86_VOYAGER || XEN_UNPRIVILEGED_GUEST)
config ARCH_HIBERNATION_HEADER
def_bool y
@@ -1475,7 +1520,7 @@ config X86_APM_BOOT
menuconfig APM
tristate "APM (Advanced Power Management) BIOS support"
- depends on X86_32 && PM_SLEEP
+ depends on X86_32 && PM_SLEEP && !XEN
---help---
APM is a BIOS specification for saving power using several different
techniques. This is mostly useful for battery powered laptops with
@@ -1641,6 +1686,7 @@ choice
config PCI_GOBIOS
bool "BIOS"
+ depends on !X86_XEN
config PCI_GOMMCONFIG
bool "MMConfig"
@@ -1652,6 +1698,13 @@ config PCI_GOOLPC
bool "OLPC"
depends on OLPC
+config PCI_GOXEN_FE
+ bool "Xen PCI Frontend"
+ depends on X86_XEN
+ help
+ The PCI device frontend driver allows the kernel to import arbitrary
+ PCI devices from a PCI backend to support PCI driver domains.
+
config PCI_GOANY
bool "Any"
@@ -1659,7 +1712,7 @@ endchoice
config PCI_BIOS
def_bool y
- depends on X86_32 && PCI && (PCI_GOBIOS || PCI_GOANY)
+ depends on X86_32 && PCI && !XEN && (PCI_GOBIOS || PCI_GOANY)
# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
config PCI_DIRECT
@@ -1682,6 +1735,22 @@ config PCI_MMCONFIG
bool "Support mmconfig PCI config space access"
depends on X86_64 && PCI && ACPI
+config XEN_PCIDEV_FRONTEND
+ bool "Xen PCI Frontend" if X86_64
+ depends on PCI && ((X86_XEN && (PCI_GOXEN_FE || PCI_GOANY)) || X86_64_XEN)
+ select HOTPLUG
+ default y
+ help
+ The PCI device frontend driver allows the kernel to import arbitrary
+ PCI devices from a PCI backend to support PCI driver domains.
+
+config XEN_PCIDEV_FE_DEBUG
+ bool "Xen PCI Frontend Debugging"
+ depends on XEN_PCIDEV_FRONTEND
+ default n
+ help
+ Enables some debug statements within the PCI Frontend.
+
config DMAR
bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL
@@ -1732,7 +1801,7 @@ if X86_32
config ISA
bool "ISA support"
- depends on !X86_VOYAGER
+ depends on !X86_VOYAGER && !XEN
help
Find out whether you have ISA slots on your motherboard. ISA is the
name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -1759,7 +1828,7 @@ config EISA
source "drivers/eisa/Kconfig"
config MCA
- bool "MCA support" if !X86_VOYAGER
+ bool "MCA support" if !X86_VOYAGER && !XEN
default y if X86_VOYAGER
help
MicroChannel Architecture is found in some IBM PS/2 machines and
@@ -1871,4 +1940,6 @@ source "crypto/Kconfig"
source "arch/x86/kvm/Kconfig"
+source "drivers/xen/Kconfig"
+
source "lib/Kconfig"
Index: head-2008-11-25/arch/x86/Kconfig.cpu
===================================================================
--- head-2008-11-25.orig/arch/x86/Kconfig.cpu 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/Kconfig.cpu 2008-11-10 11:49:15.000000000 +0100
@@ -340,7 +340,7 @@ config X86_PPRO_FENCE
config X86_F00F_BUG
def_bool y
- depends on M586MMX || M586TSC || M586 || M486 || M386
+ depends on (M586MMX || M586TSC || M586 || M486 || M386) && !X86_NO_IDT
config X86_WP_WORKS_OK
def_bool y
@@ -397,6 +397,7 @@ config X86_P6_NOP
config X86_TSC
def_bool y
depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64
+ depends on !XEN
config X86_CMPXCHG64
def_bool y
Index: head-2008-11-25/arch/x86/Kconfig.debug
===================================================================
--- head-2008-11-25.orig/arch/x86/Kconfig.debug 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/Kconfig.debug 2008-11-10 11:49:15.000000000 +0100
@@ -130,7 +130,7 @@ config 4KSTACKS
config DOUBLEFAULT
default y
bool "Enable doublefault exception handler" if EMBEDDED
- depends on X86_32
+ depends on X86_32 && !X86_NO_TSS
help
This option allows trapping of rare doublefault exceptions that
would otherwise cause a system to silently reboot. Disabling this
Index: head-2008-11-25/drivers/acpi/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/acpi/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/acpi/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -362,6 +362,7 @@ config ACPI_SYSTEM
config X86_PM_TIMER
bool "Power Management Timer Support" if EMBEDDED
depends on X86
+ depends on !XEN
default y
help
The Power Management Timer is available on all ACPI-capable,
@@ -415,4 +416,13 @@ config ACPI_SBS
This driver adds support for the Smart Battery System, another
type of access to battery information, found on some laptops.
+config ACPI_PV_SLEEP
+ bool
+ depends on X86 && XEN && ACPI_SLEEP
+ default y
+
+config PROCESSOR_EXTERNAL_CONTROL
+ bool
+ depends on (X86 || IA64) && XEN
+ default y
endif # ACPI
Index: head-2008-11-25/drivers/char/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/char/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/char/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -1037,7 +1037,7 @@ config MAX_RAW_DEVS
config HPET
bool "HPET - High Precision Event Timer" if (X86 || IA64)
default n
- depends on ACPI
+ depends on ACPI && !XEN
help
If you say Y here, you will have a miscdevice named "/dev/hpet/". Each
open selects one of the timers supported by the HPET. The timers are
Index: head-2008-11-25/drivers/char/tpm/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/char/tpm/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/char/tpm/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -57,4 +57,13 @@ config TCG_INFINEON
Further information on this driver and the supported hardware
can be found at http://www.prosec.rub.de/tpm
+config TCG_XEN
+ tristate "XEN TPM Interface"
+ depends on XEN
+ ---help---
+ If you want to make TPM support available to a Xen user domain,
+ say Yes and it will be accessible from within Linux.
+ To compile this driver as a module, choose M here; the module
+ will be called tpm_xenu.
+
endif # TCG_TPM
Index: head-2008-11-25/drivers/cpufreq/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/cpufreq/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/cpufreq/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -1,5 +1,6 @@
config CPU_FREQ
bool "CPU Frequency scaling"
+ depends on !PROCESSOR_EXTERNAL_CONTROL
help
CPU Frequency scaling allows you to change the clock speed of
CPUs on the fly. This is a nice method to save power, because
Index: head-2008-11-25/drivers/pci/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/pci/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/pci/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -21,6 +21,9 @@ config PCI_MSI
If you don't know what to do here, say N.
+config PCI_REASSIGN
+ bool
+
config PCI_LEGACY
bool "Enable deprecated pci_find_* API"
depends on PCI
Index: head-2008-11-25/drivers/serial/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/serial/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/serial/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -10,6 +10,7 @@ menu "Serial drivers"
config SERIAL_8250
tristate "8250/16550 and compatible serial support"
depends on (BROKEN || !SPARC)
+ depends on !XEN_DISABLE_SERIAL
select SERIAL_CORE
---help---
This selects whether you want to include the driver for the standard
Index: head-2008-11-25/drivers/video/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/video/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/video/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -1601,7 +1601,7 @@ config FB_CYBLA
tristate "Cyberblade/i1 support"
depends on FB && PCI && X86_32 && !64BIT
select FB_CFB_IMAGEBLIT
- select VIDEO_SELECT
+ select VIDEO_SELECT if !XEN
---help---
This driver is supposed to support the Trident Cyberblade/i1
graphics core integrated in the VIA VT8601A North Bridge,
Index: head-2008-11-25/drivers/video/console/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/video/console/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/video/console/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -46,6 +46,7 @@ config VGACON_SOFT_SCROLLBACK_SIZE
config VIDEO_SELECT
bool "Video mode selection support"
depends on X86 && VGA_CONSOLE
+ depends on !XEN
---help---
This enables support for text mode selection on kernel startup. If
you want to take advantage of some high-resolution text mode your
Index: head-2008-11-25/drivers/xen/Kconfig
===================================================================
--- head-2008-11-25.orig/drivers/xen/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/drivers/xen/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -1,6 +1,307 @@
+#
+# This Kconfig describe xen options
+#
+
+mainmenu "Xen Configuration"
+
+config XEN
+ bool
+
+if XEN
+config XEN_INTERFACE_VERSION
+ hex
+ default 0x00030207
+
+menu "XEN"
+
+config XEN_PRIVILEGED_GUEST
+ bool "Privileged Guest (domain 0)"
+ select PCI_REASSIGN if PCI
+ help
+ Support for privileged operation (domain 0)
+
+config XEN_UNPRIVILEGED_GUEST
+ def_bool !XEN_PRIVILEGED_GUEST
+
+config XEN_PRIVCMD
+ def_bool y
+ depends on PROC_FS
+
+config XEN_XENBUS_DEV
+ def_bool y
+ depends on PROC_FS
+
+config XEN_NETDEV_ACCEL_SFC_UTIL
+ depends on X86
+ tristate
+
+config XEN_BACKEND
+ tristate "Backend driver support"
+ default XEN_PRIVILEGED_GUEST
+ help
+ Support for backend device drivers that provide I/O services
+ to other virtual machines.
+
+config XEN_BLKDEV_BACKEND
+ tristate "Block-device backend driver"
+ depends on XEN_BACKEND
+ default XEN_BACKEND
+ help
+ The block-device backend driver allows the kernel to export its
+ block devices to other guests via a high-performance shared-memory
+ interface.
+
+config XEN_BLKDEV_TAP
+ tristate "Block-device tap backend driver"
+ depends on XEN_BACKEND
+ default XEN_BACKEND
+ help
+ The block tap driver is an alternative to the block back driver
+ and allows VM block requests to be redirected to userspace through
+ a device interface. The tap allows user-space development of
+ high-performance block backends, where disk images may be implemented
+ as files, in memory, or on other hosts across the network. This
+ driver can safely coexist with the existing blockback driver.
+
+config XEN_NETDEV_BACKEND
+ tristate "Network-device backend driver"
+ depends on XEN_BACKEND && NET
+ default XEN_BACKEND
+ help
+ The network-device backend driver allows the kernel to export its
+ network devices to other guests via a high-performance shared-memory
+ interface.
+
+config XEN_NETDEV_PIPELINED_TRANSMITTER
+ bool "Pipelined transmitter (DANGEROUS)"
+ depends on XEN_NETDEV_BACKEND
+ help
+ If the net backend is a dumb domain, such as a transparent Ethernet
+ bridge with no local IP interface, it is safe to say Y here to get
+ slightly lower network overhead.
+ If the backend has a local IP interface; or may be doing smart things
+ like reassembling packets to perform firewall filtering; or if you
+ are unsure; or if you experience network hangs when this option is
+ enabled; then you must say N here.
+
+config XEN_NETDEV_ACCEL_SFC_BACKEND
+ tristate "Network-device backend driver acceleration for Solarflare NICs"
+ depends on XEN_NETDEV_BACKEND && SFC && SFC_RESOURCE && X86
+ select XEN_NETDEV_ACCEL_SFC_UTIL
+ default m
+
+config XEN_NETDEV_LOOPBACK
+ tristate "Network-device loopback driver"
+ depends on XEN_NETDEV_BACKEND
+ help
+ A two-interface loopback device to emulate a local netfront-netback
+ connection. If unsure, it is probably safe to say N here.
+
+config XEN_PCIDEV_BACKEND
+ tristate "PCI-device backend driver"
+ depends on PCI && XEN_BACKEND
+ default XEN_BACKEND
+ help
+ The PCI device backend driver allows the kernel to export arbitrary
+ PCI devices to other guests. If you select this to be a module, you
+ will need to make sure no other driver has bound to the device(s)
+ you want to make visible to other guests.
+
+choice
+ prompt "PCI Backend Mode"
+ depends on XEN_PCIDEV_BACKEND
+ default XEN_PCIDEV_BACKEND_VPCI if !IA64
+ default XEN_PCIDEV_BACKEND_CONTROLLER if IA64
+
+config XEN_PCIDEV_BACKEND_VPCI
+ bool "Virtual PCI"
+ ---help---
+ This PCI Backend hides the true PCI topology and makes the frontend
+ think there is a single PCI bus with only the exported devices on it.
+ For example, a device at 03:05.0 will be re-assigned to 00:00.0. A
+ second device at 02:1a.1 will be re-assigned to 00:01.1.
+
+config XEN_PCIDEV_BACKEND_PASS
+ bool "Passthrough"
+ ---help---
+ This PCI Backend provides a real view of the PCI topology to the
+ frontend (for example, a device at 06:01.b will still appear at
+ 06:01.b to the frontend). This is similar to how Xen 2.0.x exposed
+ PCI devices to its driver domains. This may be required for drivers
+ which depend on finding their hardward in certain bus/slot
+ locations.
+
+config XEN_PCIDEV_BACKEND_SLOT
+ bool "Slot"
+ ---help---
+ This PCI Backend hides the true PCI topology and makes the frontend
+ think there is a single PCI bus with only the exported devices on it.
+ Contrary to the virtual PCI backend, a function becomes a new slot.
+ For example, a device at 03:05.2 will be re-assigned to 00:00.0. A
+ second device at 02:1a.1 will be re-assigned to 00:01.0.
+
+config XEN_PCIDEV_BACKEND_CONTROLLER
+ bool "Controller"
+ depends on IA64
+ ---help---
+ This PCI backend virtualizes the PCI bus topology by providing a
+ virtual bus per PCI root device. Devices which are physically under
+ the same root bus will appear on the same virtual bus. For systems
+ with complex I/O addressing, this is the only backend which supports
+ extended I/O port spaces and MMIO translation offsets. This backend
+ also supports slot virtualization. For example, a device at
+ 0000:01:02.1 will be re-assigned to 0000:00:00.0. A second device
+ at 0000:02:05.0 (behind a P2P bridge on bus 0000:01) will be
+ re-assigned to 0000:00:01.0. A third device at 0000:16:05.0 (under
+ a different PCI root bus) will be re-assigned to 0000:01:00.0.
+
+endchoice
+
+config XEN_PCIDEV_BE_DEBUG
+ bool "PCI Backend Debugging"
+ depends on XEN_PCIDEV_BACKEND
+
+config XEN_TPMDEV_BACKEND
+ tristate "TPM-device backend driver"
+ depends on XEN_BACKEND
+ help
+ The TPM-device backend driver
+
+config XEN_SCSI_BACKEND
+ tristate "SCSI backend driver"
+ depends on SCSI && XEN_BACKEND
+ default m
+ help
+ The SCSI backend driver allows the kernel to export its SCSI Devices
+ to other guests via a high-performance shared-memory interface.
+
+config XEN_BLKDEV_FRONTEND
+ tristate "Block-device frontend driver"
+ default y
+ help
+ The block-device frontend driver allows the kernel to access block
+ devices mounted within another guest OS. Unless you are building a
+ dedicated device-driver domain, or your master control domain
+ (domain 0), then you almost certainly want to say Y here.
+
+config XEN_NETDEV_FRONTEND
+ tristate "Network-device frontend driver"
+ depends on NET
+ default y
+ help
+ The network-device frontend driver allows the kernel to access
+ network interfaces within another guest OS. Unless you are building a
+ dedicated device-driver domain, or your master control domain
+ (domain 0), then you almost certainly want to say Y here.
+
+config XEN_NETDEV_ACCEL_SFC_FRONTEND
+ tristate "Network-device frontend driver acceleration for Solarflare NICs"
+ depends on XEN_NETDEV_FRONTEND && X86
+ select XEN_NETDEV_ACCEL_SFC_UTIL
+ default m
+
+config XEN_SCSI_FRONTEND
+ tristate "SCSI frontend driver"
+ depends on SCSI
+ default m
+ help
+ The SCSI frontend driver allows the kernel to access SCSI Devices
+ within another guest OS.
+
+config XEN_GRANT_DEV
+ tristate "User-space granted page access driver"
+ default XEN_PRIVILEGED_GUEST
+ help
+ Device for accessing (in user-space) pages that have been granted
+ by other domains.
+
+config XEN_FRAMEBUFFER
+ tristate "Framebuffer-device frontend driver"
+ depends on FB
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ default y
+ help
+ The framebuffer-device frontend drivers allows the kernel to create a
+ virtual framebuffer. This framebuffer can be viewed in another
+ domain. Unless this domain has access to a real video card, you
+ probably want to say Y here.
+
+config XEN_KEYBOARD
+ tristate "Keyboard-device frontend driver"
+ depends on XEN_FRAMEBUFFER && INPUT
+ default y
+ help
+ The keyboard-device frontend driver allows the kernel to create a
+ virtual keyboard. This keyboard can then be driven by another
+ domain. If you've said Y to CONFIG_XEN_FRAMEBUFFER, you probably
+ want to say Y here.
+
+config XEN_DISABLE_SERIAL
+ bool "Disable serial port drivers"
+ default y
+ help
+ Disable serial port drivers, allowing the Xen console driver
+ to provide a serial console at ttyS0.
+
+config XEN_SYSFS
+ tristate "Export Xen attributes in sysfs"
+ depends on SYSFS
+ select SYS_HYPERVISOR
+ default y
+ help
+ Xen hypervisor attributes will show up under /sys/hypervisor/.
+
+choice
+ prompt "Xen version compatibility"
+ default XEN_COMPAT_030002_AND_LATER
+
+ config XEN_COMPAT_030002_AND_LATER
+ bool "3.0.2 and later"
+
+ config XEN_COMPAT_030004_AND_LATER
+ bool "3.0.4 and later"
+
+ config XEN_COMPAT_030100_AND_LATER
+ bool "3.1.0 and later"
+
+ config XEN_COMPAT_LATEST_ONLY
+ bool "no compatibility code"
+
+endchoice
+
+config XEN_COMPAT
+ hex
+ default 0xffffff if XEN_COMPAT_LATEST_ONLY
+ default 0x030100 if XEN_COMPAT_030100_AND_LATER
+ default 0x030004 if XEN_COMPAT_030004_AND_LATER
+ default 0x030002 if XEN_COMPAT_030002_AND_LATER
+ default 0
+
+endmenu
+
+config HAVE_IRQ_IGNORE_UNHANDLED
+ def_bool y
+
+config NO_IDLE_HZ
+ def_bool y
+
+config XEN_SMPBOOT
+ def_bool y
+ depends on SMP && !PPC_XEN
+
+config XEN_XENCOMM
+ bool
+
+config XEN_DEVMEM
+ def_bool y
+
+endif
+
config XEN_BALLOON
- bool "Xen memory balloon driver"
- depends on XEN
+ bool "Xen memory balloon driver" if PARAVIRT_XEN
+ depends on (XEN && !PPC_XEN) || PARAVIRT_XEN
default y
help
The balloon driver allows the Xen domain to request more memory from
@@ -8,12 +309,14 @@ config XEN_BALLOON
return unneeded memory to the system.
config XEN_SCRUB_PAGES
- bool "Scrub pages before returning them to system"
- depends on XEN_BALLOON
+ bool "Scrub memory before freeing it to Xen"
+ depends on XEN || XEN_BALLOON
default y
help
- Scrub pages before returning them to the system for reuse by
- other domains. This makes sure that any confidential data
- is not accidentally visible to other domains. Is it more
- secure, but slightly less efficient.
+ Erase memory contents before freeing it back to Xen's global
+ pool. This ensures that any secrets contained within that
+ memory (e.g., private keys) cannot be found by other guests that
+ may be running on the machine. Most people will want to say Y here.
+ If security is not a concern then you may increase performance by
+ saying N.
If in doubt, say yes.
Index: head-2008-11-25/fs/Kconfig
===================================================================
--- head-2008-11-25.orig/fs/Kconfig 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/fs/Kconfig 2008-11-10 11:49:15.000000000 +0100
@@ -1011,6 +1011,7 @@ config HUGETLBFS
bool "HugeTLB file system support"
depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \
(S390 && 64BIT) || BROKEN
+ depends on !XEN
help
hugetlbfs is a filesystem backing for HugeTLB pages, based on
ramfs. For architectures that support it, say Y here and read
Index: head-2008-11-25/kernel/Kconfig.preempt
===================================================================
--- head-2008-11-25.orig/kernel/Kconfig.preempt 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/kernel/Kconfig.preempt 2008-11-10 11:49:15.000000000 +0100
@@ -35,6 +35,7 @@ config PREEMPT_VOLUNTARY
config PREEMPT
bool "Preemptible Kernel (Low-Latency Desktop)"
+ depends on !XEN
help
This option reduces the latency of the kernel by making
all kernel code (that is not executing in a critical section)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,357 @@
Subject: xen3 arch-x86
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 728:832aac894efd)
Patch-mainline: obsolete
Acked-by: jbeulich@novell.com
Index: head-2008-12-01/arch/x86/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -115,6 +115,10 @@ mcore-y := arch/x86/mach-default/
mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-x86/mach-voyager
mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/
+# Xen subarch support
+mflags-$(CONFIG_X86_XEN) := -Iinclude/asm-x86/mach-xen
+mcore-$(CONFIG_X86_XEN) := arch/x86/mach-xen/
+
# generic subarchitecture
mflags-$(CONFIG_X86_GENERICARCH):= -Iinclude/asm-x86/mach-generic
fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/
@@ -183,9 +187,26 @@ drivers-$(CONFIG_KDB) += arch/x86/kdb/
boot := arch/x86/boot
-PHONY += zImage bzImage compressed zlilo bzlilo \
+PHONY += zImage bzImage vmlinuz compressed zlilo bzlilo \
zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install
+ifdef CONFIG_XEN
+CPPFLAGS := -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) \
+ -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS)
+
+ifdef CONFIG_X86_64
+LDFLAGS_vmlinux := -e startup_64
+endif
+
+# Default kernel to build
+all: vmlinuz
+
+# KBUILD_IMAGE specifies the target image being built
+KBUILD_IMAGE := $(boot)/vmlinuz
+
+vmlinuz: vmlinux
+ $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
+else
# Default kernel to build
all: bzImage
@@ -208,6 +229,7 @@ zdisk bzdisk: vmlinux
fdimage fdimage144 fdimage288 isoimage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
+endif
install:
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
Index: head-2008-12-01/arch/x86/boot/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/boot/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/boot/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -25,7 +25,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
#RAMDISK := -DRAMDISK=512
-targets := vmlinux.bin setup.bin setup.elf zImage bzImage
+targets := vmlinux.bin setup.bin setup.elf zImage bzImage vmlinuz vmlinux-stripped
subdir- := compressed
setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o
@@ -190,5 +190,13 @@ zlilo: $(BOOTIMAGE)
cp System.map $(INSTALL_PATH)/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
+$(obj)/vmlinuz: $(obj)/vmlinux-stripped FORCE
+ $(call if_changed,gzip)
+ @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+$(obj)/vmlinux-stripped: OBJCOPYFLAGS := -g --strip-unneeded
+$(obj)/vmlinux-stripped: vmlinux FORCE
+ $(call if_changed,objcopy)
+
install:
sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
Index: head-2008-12-01/arch/x86/kernel/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/Makefile 2008-12-01 11:14:33.000000000 +0100
@@ -99,10 +99,13 @@ scx200-y += scx200_32.o
obj-$(CONFIG_OLPC) += olpc.o
+obj-$(CONFIG_X86_XEN) += fixup.o
+
###
# 64 bit specific files
ifeq ($(CONFIG_X86_64),y)
obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
+ obj-$(CONFIG_X86_XEN_GENAPIC) += genapic_xen_64.o
obj-y += bios_uv.o
obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o
obj-$(CONFIG_AUDIT) += audit_64.o
@@ -116,4 +119,10 @@ ifeq ($(CONFIG_X86_64),y)
obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
+
+ time_64-$(CONFIG_XEN) += time_32.o
+ pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o
endif
+
+disabled-obj-$(CONFIG_XEN) := i8259_$(BITS).o reboot.o smpboot_$(BITS).o
+%/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) :=
Index: head-2008-12-01/arch/x86/kernel/acpi/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/acpi/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/acpi/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -5,6 +5,9 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wake
ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += cstate.o processor.o
+ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),)
+obj-$(CONFIG_XEN) += processor_extcntl_xen.o
+endif
endif
$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin
@@ -12,3 +15,4 @@ $(obj)/wakeup_rm.o: $(obj)/realmode/w
$(obj)/realmode/wakeup.bin: FORCE
$(Q)$(MAKE) $(build)=$(obj)/realmode
+disabled-obj-$(CONFIG_XEN) := cstate.o wakeup_$(BITS).o
Index: head-2008-12-01/arch/x86/kernel/acpi/boot.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/acpi/boot.c 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/acpi/boot.c 2008-12-01 11:11:08.000000000 +0100
@@ -130,8 +130,10 @@ char *__init __acpi_map_table(unsigned l
if (!phys || !size)
return NULL;
+#ifndef CONFIG_XEN
if (phys+size <= (max_low_pfn_mapped << PAGE_SHIFT))
return __va(phys);
+#endif
offset = phys & (PAGE_SIZE - 1);
mapped_size = PAGE_SIZE - offset;
Index: head-2008-12-01/arch/x86/kernel/acpi/processor.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/acpi/processor.c 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/acpi/processor.c 2008-12-01 11:11:08.000000000 +0100
@@ -75,7 +75,18 @@ static void init_intel_pdc(struct acpi_p
/* Initialize _PDC data based on the CPU vendor */
void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
{
+#ifdef CONFIG_XEN
+ /*
+ * As a work-around, just use cpu0's cpuinfo for all processors.
+ * Further work is required to expose xen hypervisor interface of
+ * getting physical cpuinfo to dom0 kernel and then
+ * arch_acpi_processor_init_pdc can set _PDC parameters according
+ * to Xen's phys information.
+ */
+ struct cpuinfo_x86 *c = &boot_cpu_data;
+#else
struct cpuinfo_x86 *c = &cpu_data(pr->id);
+#endif
pr->pdc = NULL;
if (c->x86_vendor == X86_VENDOR_INTEL)
Index: head-2008-12-01/arch/x86/kernel/cpu/mtrr/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/cpu/mtrr/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/cpu/mtrr/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -1,3 +1,4 @@
obj-y := main.o if.o generic.o state.o
obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
+obj-$(CONFIG_XEN) := main.o if.o
Index: head-2008-12-01/arch/x86/kernel/crash.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/crash.c 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/crash.c 2008-12-01 11:11:08.000000000 +0100
@@ -32,6 +32,7 @@
/* This keeps a track of which one is crashing cpu. */
static int crashing_cpu;
+#ifndef CONFIG_XEN
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
static atomic_t waiting_for_crash_ipi;
@@ -190,6 +191,7 @@ static void halt_current_cpu(struct pt_r
/* There are no cpus to shootdown */
}
#endif
+#endif /* CONFIG_XEN */
void native_machine_crash_shutdown(struct pt_regs *regs)
{
@@ -206,11 +208,13 @@ void native_machine_crash_shutdown(struc
/* Make a note of crashing cpu. Will be used in NMI callback.*/
crashing_cpu = safe_smp_processor_id();
+#ifndef CONFIG_XEN
nmi_shootdown_cpus();
lapic_shutdown();
#if defined(CONFIG_X86_IO_APIC)
disable_IO_APIC();
#endif
+#endif /* CONFIG_XEN */
#ifdef CONFIG_HPET_TIMER
hpet_disable();
#endif
Index: head-2008-12-01/arch/x86/lib/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/lib/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/lib/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -25,3 +25,5 @@ else
lib-y += memmove_64.o memset_64.o
lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o
endif
+
+lib-$(CONFIG_XEN_SCRUB_PAGES) += scrub.o
Index: head-2008-12-01/arch/x86/mm/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -21,4 +21,6 @@ obj-$(CONFIG_K8_NUMA) += k8topology_64.
endif
obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o
+obj-$(CONFIG_XEN) += hypervisor.o
+
obj-$(CONFIG_MEMTEST) += memtest.o
Index: head-2008-12-01/arch/x86/oprofile/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/oprofile/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/oprofile/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -6,7 +6,14 @@ DRIVER_OBJS = $(addprefix ../../../drive
oprofilefs.o oprofile_stats.o \
timer_int.o )
+ifdef CONFIG_XEN
+XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
+ xenoprofile.o)
+oprofile-y := $(DRIVER_OBJS) \
+ $(XENOPROF_COMMON_OBJS) xenoprof.o
+else
oprofile-y := $(DRIVER_OBJS) init.o backtrace.o
oprofile-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_athlon.o \
op_model_ppro.o op_model_p4.o
oprofile-$(CONFIG_X86_IO_APIC) += nmi_timer_int.o
+endif
Index: head-2008-12-01/arch/x86/pci/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/pci/Makefile 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/arch/x86/pci/Makefile 2008-12-01 11:11:08.000000000 +0100
@@ -4,6 +4,9 @@ obj-$(CONFIG_PCI_BIOS) += pcbios.o
obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o
obj-$(CONFIG_PCI_DIRECT) += direct.o
obj-$(CONFIG_PCI_OLPC) += olpc.o
+# pcifront should be after mmconfig.o and direct.o as it should only
+# take over if direct access to the PCI bus is unavailable
+obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += pcifront.o
obj-y += fixup.o
obj-$(CONFIG_ACPI) += acpi.o
Index: head-2008-12-01/include/asm-x86/acpi.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/acpi.h 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/include/asm-x86/acpi.h 2008-12-01 11:11:08.000000000 +0100
@@ -30,6 +30,10 @@
#include <asm/mmu.h>
#include <asm/mpspec.h>
+#ifdef CONFIG_XEN
+#include <xen/interface/platform.h>
+#endif
+
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
@@ -124,6 +128,27 @@ extern unsigned long acpi_wakeup_address
/* early initialization routine */
extern void acpi_reserve_bootmem(void);
+#ifdef CONFIG_XEN
+static inline int acpi_notify_hypervisor_state(u8 sleep_state,
+ u32 pm1a_cnt_val,
+ u32 pm1b_cnt_val)
+{
+ struct xen_platform_op op = {
+ .cmd = XENPF_enter_acpi_sleep,
+ .interface_version = XENPF_INTERFACE_VERSION,
+ .u = {
+ .enter_acpi_sleep = {
+ .pm1a_cnt_val = pm1a_cnt_val,
+ .pm1b_cnt_val = pm1b_cnt_val,
+ .sleep_state = sleep_state,
+ },
+ },
+ };
+
+ return HYPERVISOR_platform_op(&op);
+}
+#endif /* CONFIG_XEN */
+
/*
* Check if the CPU can handle C2 and deeper
*/
@@ -156,7 +181,9 @@ static inline void disable_acpi(void) {
#endif /* !CONFIG_ACPI */
+#ifndef CONFIG_XEN
#define ARCH_HAS_POWER_INIT 1
+#endif
struct bootnode;
Index: head-2008-12-01/include/asm-x86/apic.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/apic.h 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/include/asm-x86/apic.h 2008-12-01 11:11:08.000000000 +0100
@@ -12,7 +12,9 @@
#include <asm/cpufeature.h>
#include <asm/msr.h>
+#ifndef CONFIG_XEN
#define ARCH_APICTIMER_STOPS_ON_C3 1
+#endif
/*
* Debugging macros
Index: head-2008-12-01/include/asm-x86/kexec.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/kexec.h 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/include/asm-x86/kexec.h 2008-12-01 11:11:08.000000000 +0100
@@ -170,6 +170,19 @@ relocate_kernel(unsigned long indirectio
unsigned long start_address) ATTRIB_NORET;
#endif
+/* Under Xen we need to work with machine addresses. These macros give the
+ * machine address of a certain page to the generic kexec code instead of
+ * the pseudo physical address which would be given by the default macros.
+ */
+
+#ifdef CONFIG_XEN
+#define KEXEC_ARCH_HAS_PAGE_MACROS
+#define kexec_page_to_pfn(page) pfn_to_mfn(page_to_pfn(page))
+#define kexec_pfn_to_page(pfn) pfn_to_page(mfn_to_pfn(pfn))
+#define kexec_virt_to_phys(addr) virt_to_machine(addr)
+#define kexec_phys_to_virt(addr) phys_to_virt(machine_to_phys(addr))
+#endif
+
#endif /* __ASSEMBLY__ */
#endif /* _KEXEC_H */

View File

@@ -0,0 +1,280 @@
Subject: xen3 arch-i386
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 728:832aac894efd)
Patch-mainline: obsolete
Acked-by: jbeulich@novell.com
Index: head-2008-11-25/arch/x86/kernel/asm-offsets_32.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/asm-offsets_32.c 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/asm-offsets_32.c 2008-11-25 12:35:53.000000000 +0100
@@ -91,9 +91,14 @@ void foo(void)
OFFSET(pbe_orig_address, pbe, orig_address);
OFFSET(pbe_next, pbe, next);
+#ifndef CONFIG_X86_NO_TSS
/* Offset from the sysenter stack to tss.sp0 */
- DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
+ DEFINE(SYSENTER_stack_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
sizeof(struct tss_struct));
+#else
+ /* sysenter stack points directly to sp0 */
+ DEFINE(SYSENTER_stack_sp0, 0);
+#endif
DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
Index: head-2008-11-25/arch/x86/kernel/entry_32.S
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/entry_32.S 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/entry_32.S 2008-11-25 12:35:53.000000000 +0100
@@ -293,7 +293,7 @@ ENTRY(ia32_sysenter_target)
CFI_SIGNAL_FRAME
CFI_DEF_CFA esp, 0
CFI_REGISTER esp, ebp
- movl TSS_sysenter_sp0(%esp),%esp
+ movl SYSENTER_stack_sp0(%esp),%esp
sysenter_past_esp:
/*
* Interrupts are disabled here, but we can't trace it until
@@ -782,7 +782,7 @@ END(device_not_available)
* that sets up the real kernel stack. Check here, since we can't
* allow the wrong stack to be used.
*
- * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
+ * "SYSENTER_stack_sp0+12" is because the NMI/debug handler will have
* already pushed 3 words if it hits on the sysenter instruction:
* eflags, cs and eip.
*
@@ -794,7 +794,7 @@ END(device_not_available)
cmpw $__KERNEL_CS,4(%esp); \
jne ok; \
label: \
- movl TSS_sysenter_sp0+offset(%esp),%esp; \
+ movl SYSENTER_stack_sp0+offset(%esp),%esp; \
CFI_DEF_CFA esp, 0; \
CFI_UNDEFINED eip; \
pushfl; \
Index: head-2008-11-25/arch/x86/kernel/machine_kexec_32.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/machine_kexec_32.c 2008-11-17 13:38:03.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/machine_kexec_32.c 2008-11-25 12:35:53.000000000 +0100
@@ -25,6 +25,10 @@
#include <asm/system.h>
#include <asm/cacheflush.h>
+#ifdef CONFIG_XEN
+#include <xen/interface/kexec.h>
+#endif
+
#define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
static u32 kexec_pgd[1024] PAGE_ALIGNED;
#ifdef CONFIG_X86_PAE
@@ -34,6 +38,55 @@ static u32 kexec_pmd1[1024] PAGE_ALIGNED
static u32 kexec_pte0[1024] PAGE_ALIGNED;
static u32 kexec_pte1[1024] PAGE_ALIGNED;
+#ifdef CONFIG_XEN
+
+#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT)
+
+#if PAGES_NR > KEXEC_XEN_NO_PAGES
+#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break
+#endif
+
+#if PA_CONTROL_PAGE != 0
+#error PA_CONTROL_PAGE is non zero - Xen support will break
+#endif
+
+void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)
+{
+ void *control_page;
+
+ memset(xki->page_list, 0, sizeof(xki->page_list));
+
+ control_page = page_address(image->control_code_page);
+ memcpy(control_page, relocate_kernel, PAGE_SIZE);
+
+ xki->page_list[PA_CONTROL_PAGE] = __ma(control_page);
+ xki->page_list[PA_PGD] = __ma(kexec_pgd);
+#ifdef CONFIG_X86_PAE
+ xki->page_list[PA_PMD_0] = __ma(kexec_pmd0);
+ xki->page_list[PA_PMD_1] = __ma(kexec_pmd1);
+#endif
+ xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
+ xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
+
+}
+
+int __init machine_kexec_setup_resources(struct resource *hypervisor,
+ struct resource *phys_cpus,
+ int nr_phys_cpus)
+{
+ int k;
+
+ /* The per-cpu crash note resources belong to the hypervisor resource */
+ for (k = 0; k < nr_phys_cpus; k++)
+ request_resource(hypervisor, phys_cpus + k);
+
+ return 0;
+}
+
+void machine_kexec_register_resources(struct resource *res) { ; }
+
+#endif /* CONFIG_XEN */
+
/*
* A architecture hook called to validate the
* proposed image and prepare the control pages
@@ -64,6 +117,7 @@ void machine_kexec_cleanup(struct kimage
set_pages_nx(image->control_code_page, 1);
}
+#ifndef CONFIG_XEN
/*
* Do not allocate memory (or fail in any way) in machine_kexec().
* We are past the point of no return, committed to rebooting now.
@@ -137,6 +191,7 @@ void machine_kexec(struct kimage *image)
__ftrace_enabled_restore(save_ftrace_enabled);
}
+#endif
void arch_crash_save_vmcoreinfo(void)
{
Index: head-2008-11-25/arch/x86/kernel/vm86_32.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/vm86_32.c 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/vm86_32.c 2008-11-25 12:35:53.000000000 +0100
@@ -124,7 +124,9 @@ static int copy_vm86_regs_from_user(stru
struct pt_regs *save_v86_state(struct kernel_vm86_regs *regs)
{
+#ifndef CONFIG_X86_NO_TSS
struct tss_struct *tss;
+#endif
struct pt_regs *ret;
unsigned long tmp;
@@ -147,12 +149,16 @@ struct pt_regs *save_v86_state(struct ke
do_exit(SIGSEGV);
}
+#ifndef CONFIG_X86_NO_TSS
tss = &per_cpu(init_tss, get_cpu());
+#endif
current->thread.sp0 = current->thread.saved_sp0;
current->thread.sysenter_cs = __KERNEL_CS;
load_sp0(tss, &current->thread);
current->thread.saved_sp0 = 0;
+#ifndef CONFIG_X86_NO_TSS
put_cpu();
+#endif
ret = KVM86->regs32;
@@ -279,7 +285,9 @@ out:
static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk)
{
+#ifndef CONFIG_X86_NO_TSS
struct tss_struct *tss;
+#endif
/*
* make sure the vm86() system call doesn't try to do anything silly
*/
@@ -324,12 +332,16 @@ static void do_sys_vm86(struct kernel_vm
tsk->thread.saved_fs = info->regs32->fs;
savesegment(gs, tsk->thread.saved_gs);
+#ifndef CONFIG_X86_NO_TSS
tss = &per_cpu(init_tss, get_cpu());
+#endif
tsk->thread.sp0 = (unsigned long) &info->VM86_TSS_ESP0;
if (cpu_has_sep)
tsk->thread.sysenter_cs = 0;
load_sp0(tss, &tsk->thread);
+#ifndef CONFIG_X86_NO_TSS
put_cpu();
+#endif
tsk->thread.screen_bitmap = info->screen_bitmap;
if (info->flags & VM86_SCREEN_BITMAP)
Index: head-2008-11-25/arch/x86/power/cpu_32.c
===================================================================
--- head-2008-11-25.orig/arch/x86/power/cpu_32.c 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/power/cpu_32.c 2008-11-25 12:35:53.000000000 +0100
@@ -65,6 +65,7 @@ static void do_fpu_end(void)
static void fix_processor_context(void)
{
+#ifndef CONFIG_X86_NO_TSS
int cpu = smp_processor_id();
struct tss_struct *t = &per_cpu(init_tss, cpu);
@@ -74,6 +75,7 @@ static void fix_processor_context(void)
* 386 hardware has concept of busy TSS or some
* similar stupidity.
*/
+#endif
load_TR_desc(); /* This does ltr */
load_LDT(&current->active_mm->context); /* This does lldt */
Index: head-2008-11-25/arch/x86/vdso/vdso32-setup.c
===================================================================
--- head-2008-11-25.orig/arch/x86/vdso/vdso32-setup.c 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/vdso/vdso32-setup.c 2008-11-25 12:35:53.000000000 +0100
@@ -26,6 +26,10 @@
#include <asm/vdso.h>
#include <asm/proto.h>
+#ifdef CONFIG_XEN
+#include <xen/interface/callback.h>
+#endif
+
enum {
VDSO_DISABLED = 0,
VDSO_ENABLED = 1,
@@ -225,6 +229,7 @@ static inline void map_compat_vdso(int m
void enable_sep_cpu(void)
{
+#ifndef CONFIG_XEN
int cpu = get_cpu();
struct tss_struct *tss = &per_cpu(init_tss, cpu);
@@ -239,6 +244,35 @@ void enable_sep_cpu(void)
wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0);
wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0);
put_cpu();
+#else
+ extern asmlinkage void ia32pv_sysenter_target(void);
+ static struct callback_register sysenter = {
+ .type = CALLBACKTYPE_sysenter,
+ .address = { __KERNEL_CS, (unsigned long)ia32pv_sysenter_target },
+ };
+
+ if (!boot_cpu_has(X86_FEATURE_SEP))
+ return;
+
+ get_cpu();
+
+ if (xen_feature(XENFEAT_supervisor_mode_kernel))
+ sysenter.address.eip = (unsigned long)ia32_sysenter_target;
+
+ switch (HYPERVISOR_callback_op(CALLBACKOP_register, &sysenter)) {
+ case 0:
+ break;
+#if CONFIG_XEN_COMPAT < 0x030200
+ case -ENOSYS:
+ sysenter.type = CALLBACKTYPE_sysenter_deprecated;
+ if (HYPERVISOR_callback_op(CALLBACKOP_register, &sysenter) == 0)
+ break;
+#endif
+ default:
+ clear_bit(X86_FEATURE_SEP, boot_cpu_data.x86_capability);
+ break;
+ }
+#endif
}
static struct vm_area_struct gate_vma;

View File

@@ -0,0 +1,248 @@
Subject: xen3 arch-x86_64
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 728:832aac894efd)
Patch-mainline: obsolete
Acked-by: jbeulich@novell.com
Index: head-2008-11-25/arch/x86/kernel/asm-offsets_64.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/asm-offsets_64.c 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/asm-offsets_64.c 2008-11-25 12:35:54.000000000 +0100
@@ -122,8 +122,10 @@ int main(void)
ENTRY(cr8);
BLANK();
#undef ENTRY
+#ifndef CONFIG_X86_NO_TSS
DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
BLANK();
+#endif
DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
BLANK();
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
Index: head-2008-11-25/arch/x86/kernel/machine_kexec_64.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/machine_kexec_64.c 2008-08-18 10:13:08.000000000 +0200
+++ head-2008-11-25/arch/x86/kernel/machine_kexec_64.c 2008-11-25 12:35:54.000000000 +0100
@@ -27,6 +27,119 @@ static u64 kexec_pud1[512] PAGE_ALIGNED;
static u64 kexec_pmd1[512] PAGE_ALIGNED;
static u64 kexec_pte1[512] PAGE_ALIGNED;
+#ifdef CONFIG_XEN
+
+/* In the case of Xen, override hypervisor functions to be able to create
+ * a regular identity mapping page table...
+ */
+
+#include <xen/interface/kexec.h>
+#include <xen/interface/memory.h>
+
+#define x__pmd(x) ((pmd_t) { (x) } )
+#define x__pud(x) ((pud_t) { (x) } )
+#define x__pgd(x) ((pgd_t) { (x) } )
+
+#define x_pmd_val(x) ((x).pmd)
+#define x_pud_val(x) ((x).pud)
+#define x_pgd_val(x) ((x).pgd)
+
+static inline void x_set_pmd(pmd_t *dst, pmd_t val)
+{
+ x_pmd_val(*dst) = x_pmd_val(val);
+}
+
+static inline void x_set_pud(pud_t *dst, pud_t val)
+{
+ x_pud_val(*dst) = phys_to_machine(x_pud_val(val));
+}
+
+static inline void x_pud_clear (pud_t *pud)
+{
+ x_pud_val(*pud) = 0;
+}
+
+static inline void x_set_pgd(pgd_t *dst, pgd_t val)
+{
+ x_pgd_val(*dst) = phys_to_machine(x_pgd_val(val));
+}
+
+static inline void x_pgd_clear (pgd_t * pgd)
+{
+ x_pgd_val(*pgd) = 0;
+}
+
+#define X__PAGE_KERNEL_LARGE_EXEC \
+ _PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_PSE
+#define X_KERNPG_TABLE _PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY
+
+#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT)
+
+#if PAGES_NR > KEXEC_XEN_NO_PAGES
+#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break
+#endif
+
+#if PA_CONTROL_PAGE != 0
+#error PA_CONTROL_PAGE is non zero - Xen support will break
+#endif
+
+void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)
+{
+ void *control_page;
+ void *table_page;
+
+ memset(xki->page_list, 0, sizeof(xki->page_list));
+
+ control_page = page_address(image->control_code_page) + PAGE_SIZE;
+ memcpy(control_page, relocate_kernel, PAGE_SIZE);
+
+ table_page = page_address(image->control_code_page);
+
+ xki->page_list[PA_CONTROL_PAGE] = __ma(control_page);
+ xki->page_list[PA_TABLE_PAGE] = __ma(table_page);
+
+ xki->page_list[PA_PGD] = __ma(kexec_pgd);
+ xki->page_list[PA_PUD_0] = __ma(kexec_pud0);
+ xki->page_list[PA_PUD_1] = __ma(kexec_pud1);
+ xki->page_list[PA_PMD_0] = __ma(kexec_pmd0);
+ xki->page_list[PA_PMD_1] = __ma(kexec_pmd1);
+ xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
+ xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
+}
+
+int __init machine_kexec_setup_resources(struct resource *hypervisor,
+ struct resource *phys_cpus,
+ int nr_phys_cpus)
+{
+ int k;
+
+ /* The per-cpu crash note resources belong to the hypervisor resource */
+ for (k = 0; k < nr_phys_cpus; k++)
+ request_resource(hypervisor, phys_cpus + k);
+
+ return 0;
+}
+
+void machine_kexec_register_resources(struct resource *res) { ; }
+
+#else /* CONFIG_XEN */
+
+#define x__pmd(x) __pmd(x)
+#define x__pud(x) __pud(x)
+#define x__pgd(x) __pgd(x)
+
+#define x_set_pmd(x, y) set_pmd(x, y)
+#define x_set_pud(x, y) set_pud(x, y)
+#define x_set_pgd(x, y) set_pgd(x, y)
+
+#define x_pud_clear(x) pud_clear(x)
+#define x_pgd_clear(x) pgd_clear(x)
+
+#define X__PAGE_KERNEL_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC
+#define X_KERNPG_TABLE _KERNPG_TABLE
+
+#endif /* CONFIG_XEN */
+
static void init_level2_page(pmd_t *level2p, unsigned long addr)
{
unsigned long end_addr;
@@ -34,7 +147,7 @@ static void init_level2_page(pmd_t *leve
addr &= PAGE_MASK;
end_addr = addr + PUD_SIZE;
while (addr < end_addr) {
- set_pmd(level2p++, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC));
+ x_set_pmd(level2p++, x__pmd(addr | X__PAGE_KERNEL_LARGE_EXEC));
addr += PMD_SIZE;
}
}
@@ -59,12 +172,12 @@ static int init_level3_page(struct kimag
}
level2p = (pmd_t *)page_address(page);
init_level2_page(level2p, addr);
- set_pud(level3p++, __pud(__pa(level2p) | _KERNPG_TABLE));
+ x_set_pud(level3p++, x__pud(__pa(level2p) | X_KERNPG_TABLE));
addr += PUD_SIZE;
}
/* clear the unused entries */
while (addr < end_addr) {
- pud_clear(level3p++);
+ x_pud_clear(level3p++);
addr += PUD_SIZE;
}
out:
@@ -95,12 +208,12 @@ static int init_level4_page(struct kimag
if (result) {
goto out;
}
- set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE));
+ x_set_pgd(level4p++, x__pgd(__pa(level3p) | X_KERNPG_TABLE));
addr += PGDIR_SIZE;
}
/* clear the unused entries */
while (addr < end_addr) {
- pgd_clear(level4p++);
+ x_pgd_clear(level4p++);
addr += PGDIR_SIZE;
}
out:
@@ -111,8 +224,14 @@ out:
static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
{
pgd_t *level4p;
+ unsigned long x_max_pfn = max_pfn;
+
+#ifdef CONFIG_XEN
+ x_max_pfn = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
+#endif
+
level4p = (pgd_t *)__va(start_pgtable);
- return init_level4_page(image, level4p, 0, max_pfn << PAGE_SHIFT);
+ return init_level4_page(image, level4p, 0, x_max_pfn << PAGE_SHIFT);
}
int machine_kexec_prepare(struct kimage *image)
@@ -136,6 +255,7 @@ void machine_kexec_cleanup(struct kimage
return;
}
+#ifndef CONFIG_XEN
/*
* Do not allocate memory (or fail in any way) in machine_kexec().
* We are past the point of no return, committed to rebooting now.
@@ -176,6 +296,7 @@ void machine_kexec(struct kimage *image)
relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
image->start);
}
+#endif
void arch_crash_save_vmcoreinfo(void)
{
Index: head-2008-11-25/arch/x86/power/cpu_64.c
===================================================================
--- head-2008-11-25.orig/arch/x86/power/cpu_64.c 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/power/cpu_64.c 2008-11-25 12:35:54.000000000 +0100
@@ -135,6 +135,7 @@ void restore_processor_state(void)
static void fix_processor_context(void)
{
+#ifndef CONFIG_X86_NO_TSS
int cpu = smp_processor_id();
struct tss_struct *t = &per_cpu(init_tss, cpu);
@@ -146,6 +147,7 @@ static void fix_processor_context(void)
set_tss_desc(cpu, t);
get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9;
+#endif
syscall_init(); /* This sets MSR_*STAR and related */
load_TR_desc(); /* This does ltr */
Index: head-2008-11-25/arch/x86/vdso/Makefile
===================================================================
--- head-2008-11-25.orig/arch/x86/vdso/Makefile 2008-11-25 12:33:06.000000000 +0100
+++ head-2008-11-25/arch/x86/vdso/Makefile 2008-11-25 12:35:54.000000000 +0100
@@ -65,6 +65,8 @@ obj-$(VDSO32-y) += vdso32-syms.lds
vdso32.so-$(VDSO32-y) += int80
vdso32.so-$(CONFIG_COMPAT) += syscall
vdso32.so-$(VDSO32-y) += sysenter
+xen-vdso32-$(subst 1,$(CONFIG_COMPAT),$(shell expr $(CONFIG_XEN_COMPAT)0 '<' 0x0302000)) += int80
+vdso32.so-$(CONFIG_XEN) += $(xen-vdso32-y)
vdso32-images = $(vdso32.so-y:%=vdso32-%.so)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/163a3807cb1f
# HG changeset 735+738 patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1227525200 0
# Node ID 163a3807cb1fb4f35304a99c63f4deac322df2da
# Parent 412b24a36929b7cbedc793b4aad06b334bea021b
Subject: linux: remove sysfs files during balloon module exit
Patch-mainline: obsolete
Relevant when building pv drivers.
Also adjust some section attributes of the sysfs code.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/bf8b1ee634e2
balloon: Fix the build by including <linux/init.h>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: head-2008-11-25/drivers/xen/balloon/balloon.c
===================================================================
--- head-2008-11-25.orig/drivers/xen/balloon/balloon.c 2008-07-21 11:00:33.000000000 +0200
+++ head-2008-11-25/drivers/xen/balloon/balloon.c 2008-11-25 13:31:07.000000000 +0100
@@ -577,8 +577,8 @@ subsys_initcall(balloon_init);
static void __exit balloon_exit(void)
{
- /* XXX - release balloon here */
- return;
+ balloon_sysfs_exit();
+ /* XXX - release balloon here */
}
module_exit(balloon_exit);
Index: head-2008-11-25/drivers/xen/balloon/sysfs.c
===================================================================
--- head-2008-11-25.orig/drivers/xen/balloon/sysfs.c 2008-04-02 12:34:02.000000000 +0200
+++ head-2008-11-25/drivers/xen/balloon/sysfs.c 2008-11-25 13:31:07.000000000 +0100
@@ -30,6 +30,7 @@
#include <linux/capability.h>
#include <linux/errno.h>
+#include <linux/init.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/sysdev.h>
@@ -111,7 +112,7 @@ static struct sysdev_class balloon_sysde
static struct sys_device balloon_sysdev;
-static int register_balloon(struct sys_device *sysdev)
+static int __init register_balloon(struct sys_device *sysdev)
{
int i, error;
@@ -148,7 +149,7 @@ static int register_balloon(struct sys_d
return error;
}
-static void unregister_balloon(struct sys_device *sysdev)
+static __exit void unregister_balloon(struct sys_device *sysdev)
{
int i;
@@ -159,12 +160,12 @@ static void unregister_balloon(struct sy
sysdev_class_unregister(&balloon_sysdev_class);
}
-int balloon_sysfs_init(void)
+int __init balloon_sysfs_init(void)
{
return register_balloon(&balloon_sysdev);
}
-void balloon_sysfs_exit(void)
+void __exit balloon_sysfs_exit(void)
{
unregister_balloon(&balloon_sysdev);
}

View File

@@ -0,0 +1,26 @@
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/6bb7f500d5e4
# HG changeset 737 patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1227611796 0
# Node ID 6bb7f500d5e4a68007607863fa7bfe0c69d6eec7
# Parent 1b68d09b868fdcd724c6b86eb2790748a9fd0bb7
Subject: kexec: Don't pass limit_pages_to_max_mfn() regions to xen_destroy_contiguous_region().
Patch-mainline: obsolete
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Acked-by: jbeulich@novell.com
Index: head-2008-11-25/kernel/kexec.c
===================================================================
--- head-2008-11-25.orig/kernel/kexec.c 2008-11-25 12:35:50.000000000 +0100
+++ head-2008-11-25/kernel/kexec.c 2008-11-25 13:31:12.000000000 +0100
@@ -397,9 +397,6 @@ static void kimage_free_pages(struct pag
count = 1 << order;
for (i = 0; i < count; i++)
ClearPageReserved(page + i);
-#ifdef CONFIG_XEN
- xen_destroy_contiguous_region((unsigned long)page_address(page), order);
-#endif
__free_pages(page, order);
}

View File

@@ -0,0 +1,58 @@
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/5012c470f875
# HG changeset 740 patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1227697833 0
# Node ID 5012c470f8757e97c2e0f7eccfafcb1e2367443e
# Parent f236d7def9944909bf40015ff4a08817b0803ed9
Subject: blkback, blktap: Fix potential resource leak.
Patch-mainline: obsolete
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Acked-by: jbeulich@novell.com
Index: head-2008-12-01/drivers/xen/blkback/blkback.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/blkback/blkback.c 2008-11-10 11:44:21.000000000 +0100
+++ head-2008-12-01/drivers/xen/blkback/blkback.c 2008-12-01 11:21:10.000000000 +0100
@@ -317,14 +317,14 @@ static int do_block_io_op(blkif_t *blkif
if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc))
break;
- pending_req = alloc_req();
- if (NULL == pending_req) {
- blkif->st_oo_req++;
+ if (kthread_should_stop()) {
more_to_do = 1;
break;
}
- if (kthread_should_stop()) {
+ pending_req = alloc_req();
+ if (NULL == pending_req) {
+ blkif->st_oo_req++;
more_to_do = 1;
break;
}
Index: head-2008-12-01/drivers/xen/blktap/blktap.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/blktap/blktap.c 2008-11-10 11:44:21.000000000 +0100
+++ head-2008-12-01/drivers/xen/blktap/blktap.c 2008-12-01 11:21:10.000000000 +0100
@@ -1286,14 +1286,14 @@ static int do_block_io_op(blkif_t *blkif
break;
}
- pending_req = alloc_req();
- if (NULL == pending_req) {
- blkif->st_oo_req++;
+ if (kthread_should_stop()) {
more_to_do = 1;
break;
}
- if (kthread_should_stop()) {
+ pending_req = alloc_req();
+ if (NULL == pending_req) {
+ blkif->st_oo_req++;
more_to_do = 1;
break;
}

View File

@@ -0,0 +1,161 @@
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/d545a95fca73
# HG changeset 746+749 patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1227879027 0
# Node ID d545a95fca739d0b1963b73a9eb64ea64a244e76
# Parent 2268be46c75ec6eddb7cd387af8a236a565f6140
Subject: linux/x86: use shared page indicating the need for an EOI notification
Patch-mainline: obsolete
Signed-off-by: Jan Beulich <jbeulich@novell.com>
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/cdc6729dc702
Subject: evtchn: Fix the build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: head-2008-12-01/drivers/xen/core/evtchn.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/evtchn.c 2008-12-01 11:22:35.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/evtchn.c 2008-12-01 11:23:06.000000000 +0100
@@ -123,9 +123,6 @@ DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS])
/* Reference counts for bindings to IRQs. */
static int irq_bindcount[NR_IRQS];
-/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */
-static DECLARE_BITMAP(pirq_needs_eoi, NR_PIRQS);
-
#ifdef CONFIG_SMP
static u8 cpu_evtchn[NR_EVENT_CHANNELS];
@@ -756,16 +753,48 @@ static struct hw_interrupt_type dynirq_t
.retrigger = resend_irq_on_evtchn,
};
-static inline void pirq_unmask_notify(int irq)
+/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */
+static int pirq_eoi_does_unmask;
+static DECLARE_BITMAP(pirq_needs_eoi, ALIGN(NR_PIRQS, PAGE_SIZE * 8))
+ __attribute__ ((__section__(".bss.page_aligned"), __aligned__(PAGE_SIZE)));
+
+static void pirq_unmask_and_notify(unsigned int evtchn, unsigned int irq)
{
struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) };
- if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi)))
- VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi));
+
+ if (pirq_eoi_does_unmask) {
+ if (test_bit(eoi.irq, pirq_needs_eoi))
+ VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi));
+ else
+ unmask_evtchn(evtchn);
+ } else if (test_bit(irq - PIRQ_BASE, pirq_needs_eoi)) {
+ if (smp_processor_id() != cpu_from_evtchn(evtchn)) {
+ struct evtchn_unmask unmask = { .port = evtchn };
+ struct multicall_entry mcl[2];
+
+ mcl[0].op = __HYPERVISOR_event_channel_op;
+ mcl[0].args[0] = EVTCHNOP_unmask;
+ mcl[0].args[1] = (unsigned long)&unmask;
+ mcl[1].op = __HYPERVISOR_physdev_op;
+ mcl[1].args[0] = PHYSDEVOP_eoi;
+ mcl[1].args[1] = (unsigned long)&eoi;
+
+ if (HYPERVISOR_multicall(mcl, 2))
+ BUG();
+ } else {
+ unmask_evtchn(evtchn);
+ VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi));
+ }
+ } else
+ unmask_evtchn(evtchn);
}
static inline void pirq_query_unmask(int irq)
{
struct physdev_irq_status_query irq_status;
+
+ if (pirq_eoi_does_unmask)
+ return;
irq_status.irq = evtchn_get_xen_pirq(irq);
if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status))
irq_status.flags = 0;
@@ -806,8 +835,7 @@ static unsigned int startup_pirq(unsigne
irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn);
out:
- unmask_evtchn(evtchn);
- pirq_unmask_notify(irq);
+ pirq_unmask_and_notify(evtchn, irq);
return 0;
}
@@ -859,10 +887,8 @@ static void end_pirq(unsigned int irq)
if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) ==
(IRQ_DISABLED|IRQ_PENDING)) {
shutdown_pirq(irq);
- } else if (VALID_EVTCHN(evtchn)) {
- unmask_evtchn(evtchn);
- pirq_unmask_notify(irq);
- }
+ } else if (VALID_EVTCHN(evtchn))
+ pirq_unmask_and_notify(evtchn, irq);
}
static struct hw_interrupt_type pirq_type = {
@@ -1012,6 +1038,14 @@ void irq_resume(void)
init_evtchn_cpu_bindings();
+ if (pirq_eoi_does_unmask) {
+ struct physdev_pirq_eoi_mfn eoi_mfn;
+
+ eoi_mfn.mfn = virt_to_bus(pirq_needs_eoi) >> PAGE_SHIFT;
+ if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_mfn, &eoi_mfn))
+ BUG();
+ }
+
/* New event-channel space is not 'live' yet. */
for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++)
mask_evtchn(evtchn);
@@ -1098,9 +1132,15 @@ int evtchn_get_xen_pirq(int irq)
void __init xen_init_IRQ(void)
{
unsigned int i;
+ struct physdev_pirq_eoi_mfn eoi_mfn;
init_evtchn_cpu_bindings();
+ BUG_ON(!bitmap_empty(pirq_needs_eoi, PAGE_SIZE * 8));
+ eoi_mfn.mfn = virt_to_bus(pirq_needs_eoi) >> PAGE_SHIFT;
+ if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_mfn, &eoi_mfn) == 0)
+ pirq_eoi_does_unmask = 1;
+
/* No event channels are 'live' right now. */
for (i = 0; i < NR_EVENT_CHANNELS; i++)
mask_evtchn(i);
Index: head-2008-12-01/include/xen/interface/physdev.h
===================================================================
--- head-2008-12-01.orig/include/xen/interface/physdev.h 2008-12-01 11:22:59.000000000 +0100
+++ head-2008-12-01/include/xen/interface/physdev.h 2008-12-01 11:23:06.000000000 +0100
@@ -41,6 +41,21 @@ typedef struct physdev_eoi physdev_eoi_t
DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
/*
+ * Register a shared page for the hypervisor to indicate whether the guest
+ * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
+ * once the guest used this function in that the associated event channel
+ * will automatically get unmasked. The page registered is used as a bit
+ * array indexed by Xen's PIRQ value.
+ */
+#define PHYSDEVOP_pirq_eoi_mfn 17
+struct physdev_pirq_eoi_mfn {
+ /* IN */
+ xen_pfn_t mfn;
+};
+typedef struct physdev_pirq_eoi_mfn physdev_pirq_eoi_mfn_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_mfn_t);
+
+/*
* Query the status of an IRQ line.
* @arg == pointer to physdev_irq_status_query structure.
*/

View File

@@ -0,0 +1,219 @@
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/39a8680e7a70
# HG changeset 747 patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1227879058 0
# Node ID 39a8680e7a70a28ce639c507fb6a9bc0aa7d8f14
# Parent d545a95fca739d0b1963b73a9eb64ea64a244e76
Subject: linux/x86: revert the effect of xen_limit_pages_to_max_mfn()
Patch-mainline: obsolete
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: head-2008-12-01/arch/x86/mm/hypervisor.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/hypervisor.c 2008-10-29 09:55:56.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/hypervisor.c 2008-12-01 11:25:57.000000000 +0100
@@ -374,6 +374,15 @@ void xen_destroy_contiguous_region(unsig
}
EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
+static void undo_limit_pages(struct page *pages, unsigned int order)
+{
+ BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
+ BUG_ON(order > MAX_CONTIG_ORDER);
+ xen_limit_pages_to_max_mfn(pages, order, 0);
+ ClearPageForeign(pages);
+ __free_pages(pages, order);
+}
+
int xen_limit_pages_to_max_mfn(
struct page *pages, unsigned int order, unsigned int address_bits)
{
@@ -402,16 +411,28 @@ int xen_limit_pages_to_max_mfn(
if (unlikely(order > MAX_CONTIG_ORDER))
return -ENOMEM;
- bitmap_zero(limit_map, 1U << order);
+ if (address_bits) {
+ if (address_bits < PAGE_SHIFT)
+ return -EINVAL;
+ bitmap_zero(limit_map, 1U << order);
+ } else if (order) {
+ BUILD_BUG_ON(sizeof(pages->index) != sizeof(*limit_map));
+ for (i = 0; i < BITS_TO_LONGS(1U << order); ++i)
+ limit_map[i] = pages[i + 1].index;
+ } else
+ __set_bit(0, limit_map);
+
set_xen_guest_handle(exchange.in.extent_start, in_frames);
set_xen_guest_handle(exchange.out.extent_start, out_frames);
/* 0. Scrub the pages. */
for (i = 0, n = 0; i < 1U<<order ; i++) {
page = &pages[i];
- if (!(pfn_to_mfn(page_to_pfn(page)) >> (address_bits - PAGE_SHIFT)))
- continue;
- __set_bit(i, limit_map);
+ if (address_bits) {
+ if (!(pfn_to_mfn(page_to_pfn(page)) >> (address_bits - PAGE_SHIFT)))
+ continue;
+ __set_bit(i, limit_map);
+ }
if (!PageHighMem(page))
scrub_pages(page_address(page), 1);
@@ -497,7 +518,19 @@ int xen_limit_pages_to_max_mfn(
balloon_unlock(flags);
- return success ? 0 : -ENOMEM;
+ if (!success)
+ return -ENOMEM;
+
+ if (address_bits) {
+ if (order) {
+ BUILD_BUG_ON(sizeof(*limit_map) != sizeof(pages->index));
+ for (i = 0; i < BITS_TO_LONGS(1U << order); ++i)
+ pages[i + 1].index = limit_map[i];
+ }
+ SetPageForeign(pages, undo_limit_pages);
+ }
+
+ return 0;
}
EXPORT_SYMBOL_GPL(xen_limit_pages_to_max_mfn);
Index: head-2008-12-01/arch/x86/mm/pgtable_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/pgtable_32-xen.c 2007-10-09 11:48:25.000000000 +0200
+++ head-2008-12-01/arch/x86/mm/pgtable_32-xen.c 2008-12-01 11:25:57.000000000 +0100
@@ -152,6 +152,12 @@ pte_t *pte_alloc_one_kernel(struct mm_st
return pte;
}
+static void _pte_free(struct page *page, unsigned int order)
+{
+ BUG_ON(order);
+ pte_free(page);
+}
+
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
struct page *pte;
@@ -162,7 +168,7 @@ struct page *pte_alloc_one(struct mm_str
pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
#endif
if (pte) {
- SetPageForeign(pte, pte_free);
+ SetPageForeign(pte, _pte_free);
init_page_count(pte);
}
return pte;
Index: head-2008-12-01/arch/x86/mm/pageattr_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/pageattr_64-xen.c 2008-07-21 11:00:32.000000000 +0200
+++ head-2008-12-01/arch/x86/mm/pageattr_64-xen.c 2008-12-01 11:25:57.000000000 +0100
@@ -248,13 +248,19 @@ void _arch_exit_mmap(struct mm_struct *m
mm_unpin(mm);
}
+static void _pte_free(struct page *page, unsigned int order)
+{
+ BUG_ON(order);
+ pte_free(page);
+}
+
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
struct page *pte;
pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
if (pte) {
- SetPageForeign(pte, pte_free);
+ SetPageForeign(pte, _pte_free);
init_page_count(pte);
}
return pte;
Index: head-2008-12-01/drivers/xen/core/gnttab.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/gnttab.c 2008-12-01 11:23:17.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/gnttab.c 2008-12-01 11:25:57.000000000 +0100
@@ -505,8 +505,9 @@ static int gnttab_map(unsigned int start
return 0;
}
-static void gnttab_page_free(struct page *page)
+static void gnttab_page_free(struct page *page, unsigned int order)
{
+ BUG_ON(order);
ClearPageForeign(page);
gnttab_reset_grant_page(page);
put_page(page);
Index: head-2008-12-01/drivers/xen/netback/netback.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/netback/netback.c 2008-12-01 11:23:17.000000000 +0100
+++ head-2008-12-01/drivers/xen/netback/netback.c 2008-12-01 11:25:57.000000000 +0100
@@ -55,7 +55,6 @@ struct netbk_tx_pending_inuse {
};
static void netif_idx_release(u16 pending_idx);
-static void netif_page_release(struct page *page);
static void make_tx_response(netif_t *netif,
netif_tx_request_t *txp,
s8 st);
@@ -1436,8 +1435,9 @@ static void netif_idx_release(u16 pendin
tasklet_schedule(&net_tx_tasklet);
}
-static void netif_page_release(struct page *page)
+static void netif_page_release(struct page *page, unsigned int order)
{
+ BUG_ON(order);
netif_idx_release(netif_page_index(page));
}
Index: head-2008-12-01/include/linux/page-flags.h
===================================================================
--- head-2008-12-01.orig/include/linux/page-flags.h 2008-12-01 11:23:17.000000000 +0100
+++ head-2008-12-01/include/linux/page-flags.h 2008-12-01 11:25:57.000000000 +0100
@@ -275,15 +275,15 @@ CLEARPAGEFLAG(Uptodate, uptodate)
#define PageForeign(page) test_bit(PG_foreign, &(page)->flags)
#define SetPageForeign(_page, dtor) do { \
set_bit(PG_foreign, &(_page)->flags); \
- BUG_ON((dtor) == (void (*)(struct page *))0); \
+ BUG_ON((dtor) == (void (*)(struct page *, unsigned int))0); \
(_page)->index = (long)(dtor); \
} while (0)
#define ClearPageForeign(page) do { \
clear_bit(PG_foreign, &(page)->flags); \
(page)->index = 0; \
} while (0)
-#define PageForeignDestructor(_page) \
- ((void (*)(struct page *))(_page)->index)(_page)
+#define PageForeignDestructor(_page, order) \
+ ((void (*)(struct page *, unsigned int))(_page)->index)(_page, order)
extern void cancel_dirty_page(struct page *page, unsigned int account_size);
Index: head-2008-12-01/mm/page_alloc.c
===================================================================
--- head-2008-12-01.orig/mm/page_alloc.c 2008-12-01 11:23:17.000000000 +0100
+++ head-2008-12-01/mm/page_alloc.c 2008-12-01 11:25:57.000000000 +0100
@@ -535,7 +535,7 @@ static void __free_pages_ok(struct page
#ifdef CONFIG_XEN
if (PageForeign(page)) {
- PageForeignDestructor(page);
+ PageForeignDestructor(page, order);
return;
}
#endif
@@ -1003,7 +1003,7 @@ static void free_hot_cold_page(struct pa
#ifdef CONFIG_XEN
if (PageForeign(page)) {
- PageForeignDestructor(page);
+ PageForeignDestructor(page, 0);
return;
}
#endif

View File

@@ -0,0 +1,134 @@
From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/2892ca2b9c17
# HG changeset 748 patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1227879081 0
# Node ID 2892ca2b9c17857f6922e803406711881988d850
# Parent 39a8680e7a70a28ce639c507fb6a9bc0aa7d8f14
Subject: linux/x86: cleanup IO-APIC code
Patch-mainline: obsolete
- get 32-bit code in sync with 64-bit wrt ExtINT pin detection being
unnecessary
- eliminate build warnings resulting from c/s 725
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: head-2008-12-01/arch/x86/kernel/io_apic_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/io_apic_32-xen.c 2008-11-25 12:22:34.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/io_apic_32-xen.c 2008-12-01 11:28:17.000000000 +0100
@@ -87,8 +87,10 @@ static inline void xen_io_apic_write(uns
int (*ioapic_renumber_irq)(int ioapic, int irq);
atomic_t irq_mis_count;
+#ifndef CONFIG_XEN
/* Where if anywhere is the i8259 connect in external int mode */
static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
+#endif
static DEFINE_SPINLOCK(ioapic_lock);
static DEFINE_SPINLOCK(vector_lock);
@@ -793,6 +795,7 @@ static int find_irq_entry(int apic, int
return -1;
}
+#ifndef CONFIG_XEN
/*
* Find the pin to which IRQ[irq] (ISA) is connected
*/
@@ -842,6 +845,7 @@ static int __init find_isa_irq_apic(int
return -1;
}
+#endif
/*
* Find a specific PCI IRQ entry.
@@ -1687,7 +1691,9 @@ void /*__init*/ print_PIC(void)
static void __init enable_IO_APIC(void)
{
union IO_APIC_reg_01 reg_01;
+#ifndef CONFIG_XEN
int i8259_apic, i8259_pin;
+#endif
int i, apic;
unsigned long flags;
@@ -1708,6 +1714,7 @@ static void __init enable_IO_APIC(void)
spin_unlock_irqrestore(&ioapic_lock, flags);
nr_ioapic_registers[apic] = reg_01.bits.entries+1;
}
+#ifndef CONFIG_XEN
for(apic = 0; apic < nr_ioapics; apic++) {
int pin;
/* See if any of the pins is in ExtINT mode */
@@ -1749,6 +1756,7 @@ static void __init enable_IO_APIC(void)
{
printk(KERN_WARNING "ExtINT in hardware and MP table differ\n");
}
+#endif
/*
* Do not trust the IO-APIC being empty at bootup
@@ -2517,6 +2525,8 @@ static int __init io_apic_bug_finalize(v
late_initcall(io_apic_bug_finalize);
+#ifndef CONFIG_XEN
+
struct sysfs_ioapic_data {
struct sys_device dev;
struct IO_APIC_route_entry entry[0];
@@ -2570,10 +2580,8 @@ static int ioapic_resume(struct sys_devi
static struct sysdev_class ioapic_sysdev_class = {
set_kset_name("ioapic"),
-#ifndef CONFIG_XEN
.suspend = ioapic_suspend,
.resume = ioapic_resume,
-#endif
};
static int __init ioapic_init_sysfs(void)
@@ -2611,6 +2619,8 @@ static int __init ioapic_init_sysfs(void
device_initcall(ioapic_init_sysfs);
+#endif /* CONFIG_XEN */
+
/* --------------------------------------------------------------------------
ACPI-based IOAPIC Configuration
-------------------------------------------------------------------------- */
Index: head-2008-12-01/arch/x86/kernel/io_apic_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/io_apic_64-xen.c 2008-11-25 12:22:34.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/io_apic_64-xen.c 2008-12-01 11:28:17.000000000 +0100
@@ -2054,6 +2054,8 @@ void __init setup_IO_APIC(void)
print_IO_APIC();
}
+#ifndef CONFIG_XEN
+
struct sysfs_ioapic_data {
struct sys_device dev;
struct IO_APIC_route_entry entry[0];
@@ -2107,10 +2109,8 @@ static int ioapic_resume(struct sys_devi
static struct sysdev_class ioapic_sysdev_class = {
set_kset_name("ioapic"),
-#ifndef CONFIG_XEN
.suspend = ioapic_suspend,
.resume = ioapic_resume,
-#endif
};
static int __init ioapic_init_sysfs(void)
@@ -2148,6 +2148,8 @@ static int __init ioapic_init_sysfs(void
device_initcall(ioapic_init_sysfs);
+#endif /* CONFIG_XEN */
+
/* --------------------------------------------------------------------------
ACPI-based IOAPIC Configuration
-------------------------------------------------------------------------- */

View File

@@ -0,0 +1,39 @@
Subject: Fix xen configuration.
From: jbeulich@novell.com
Patch-mainline: obsolete
Index: head-2008-10-24/arch/x86/Kconfig
===================================================================
--- head-2008-10-24.orig/arch/x86/Kconfig 2008-10-24 10:43:32.000000000 +0200
+++ head-2008-10-24/arch/x86/Kconfig 2008-10-24 10:44:52.000000000 +0200
@@ -137,6 +137,7 @@ config HAVE_CPUMASK_OF_CPU_MAP
config ARCH_HIBERNATION_POSSIBLE
def_bool y
depends on !SMP || !X86_VOYAGER
+ depends on !XEN
config ARCH_SUSPEND_POSSIBLE
def_bool y
@@ -195,7 +196,7 @@ config X86_HT
config X86_BIOS_REBOOT
bool
- depends on !X86_VOYAGER
+ depends on !X86_VOYAGER && !XEN
default y
config X86_TRAMPOLINE
Index: head-2008-10-24/drivers/xen/Kconfig
===================================================================
--- head-2008-10-24.orig/drivers/xen/Kconfig 2008-10-24 10:43:32.000000000 +0200
+++ head-2008-10-24/drivers/xen/Kconfig 2008-10-24 10:44:52.000000000 +0200
@@ -22,6 +22,9 @@ config XEN_PRIVILEGED_GUEST
config XEN_UNPRIVILEGED_GUEST
def_bool !XEN_PRIVILEGED_GUEST
+ select PM
+ select PM_SLEEP
+ select PM_SLEEP_SMP if SMP
config XEN_PRIVCMD
def_bool y

View File

@@ -0,0 +1,307 @@
Subject: Fix xen build.
From: jbeulich@novell.com
Patch-mainline: obsolete
---
drivers/acpi/hardware/hwsleep.c | 2 ++
drivers/ide/ide-lib.c | 11 +++++++++++
drivers/oprofile/buffer_sync.c | 35 ++++++++++++++++++++++++-----------
drivers/oprofile/cpu_buffer.c | 6 ++++++
drivers/oprofile/oprof.c | 2 ++
drivers/oprofile/oprofile_files.c | 6 ++++++
include/linux/mm.h | 2 ++
include/linux/oprofile.h | 6 ++++--
mm/memory.c | 2 ++
9 files changed, 59 insertions(+), 13 deletions(-)
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -430,6 +430,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_stat
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
*
******************************************************************************/
+#ifndef CONFIG_XEN
acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
{
u32 in_value;
@@ -479,6 +480,7 @@ acpi_status asmlinkage acpi_enter_sleep_
}
ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
+#endif
/*******************************************************************************
*
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -177,6 +177,16 @@ void ide_toggle_bounce(ide_drive_t *driv
{
u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */
+#ifndef CONFIG_XEN
+ if (!PCI_DMA_BUS_IS_PHYS) {
+ addr = BLK_BOUNCE_ANY;
+ } else if (on && drive->media == ide_disk) {
+ struct device *dev = drive->hwif->dev;
+
+ if (dev && dev->dma_mask)
+ addr = *dev->dma_mask;
+ }
+#else
if (on && drive->media == ide_disk) {
struct device *dev = drive->hwif->dev;
@@ -185,6 +195,7 @@ void ide_toggle_bounce(ide_drive_t *driv
else if (dev && dev->dma_mask)
addr = *dev->dma_mask;
}
+#endif
if (drive->queue)
blk_queue_bounce_limit(drive->queue, addr);
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -44,7 +44,9 @@ static cpumask_t marked_cpus = CPU_MASK_
static DEFINE_SPINLOCK(task_mortuary);
static void process_task_mortuary(void);
+#ifdef CONFIG_XEN
static int cpu_current_domain[NR_CPUS];
+#endif
/* Take ownership of the task struct and place it on the
* list for processing. Only after two full buffer syncs
@@ -153,11 +155,13 @@ static void end_sync(void)
int sync_start(void)
{
int err;
+#ifdef CONFIG_XEN
int i;
for (i = 0; i < NR_CPUS; i++) {
cpu_current_domain[i] = COORDINATOR_DOMAIN;
}
+#endif
start_cpu_work();
@@ -302,12 +306,14 @@ static void add_cpu_mode_switch(unsigned
}
}
+#ifdef CONFIG_XEN
static void add_domain_switch(unsigned long domain_id)
{
add_event_entry(ESCAPE_CODE);
add_event_entry(DOMAIN_SWITCH_CODE);
add_event_entry(domain_id);
}
+#endif
static void
add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
@@ -531,11 +537,14 @@ void sync_buffer(int cpu)
add_cpu_switch(cpu);
+#ifdef CONFIG_XEN
/* We need to assign the first samples in this CPU buffer to the
same domain that we were processing at the last sync_buffer */
if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
add_domain_switch(cpu_current_domain[cpu]);
}
+#endif
+
/* Remember, only we can modify tail_pos */
available = get_slots(cpu_buf);
@@ -553,8 +562,10 @@ void sync_buffer(int cpu)
} else if (s->event == CPU_TRACE_BEGIN) {
state = sb_bt_start;
add_trace_begin();
+#ifdef CONFIG_XEN
} else if (s->event == CPU_DOMAIN_SWITCH) {
- domain_switch = 1;
+ domain_switch = 1;
+#endif
} else {
struct mm_struct * oldmm = mm;
@@ -568,21 +579,21 @@ void sync_buffer(int cpu)
add_user_ctx_switch(new, cookie);
}
} else {
+#ifdef CONFIG_XEN
if (domain_switch) {
cpu_current_domain[cpu] = s->eip;
add_domain_switch(s->eip);
domain_switch = 0;
- } else {
- if (cpu_current_domain[cpu] !=
+ } else if (cpu_current_domain[cpu] !=
COORDINATOR_DOMAIN) {
- add_sample_entry(s->eip, s->event);
- }
- else if (state >= sb_bt_start &&
- !add_sample(mm, s, cpu_mode)) {
- if (state == sb_bt_start) {
- state = sb_bt_ignore;
- atomic_inc(&oprofile_stats.bt_lost_no_mapping);
- }
+ add_sample_entry(s->eip, s->event);
+ } else
+#endif
+ if (state >= sb_bt_start &&
+ !add_sample(mm, s, cpu_mode)) {
+ if (state == sb_bt_start) {
+ state = sb_bt_ignore;
+ atomic_inc(&oprofile_stats.bt_lost_no_mapping);
}
}
}
@@ -591,10 +602,12 @@ void sync_buffer(int cpu)
}
release_mm(mm);
+#ifdef CONFIG_XEN
/* We reset domain to COORDINATOR at each CPU switch */
if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
add_domain_switch(COORDINATOR_DOMAIN);
}
+#endif
mark_done(cpu);
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -38,7 +38,11 @@ static void wq_sync_buffer(struct work_s
#define DEFAULT_TIMER_EXPIRE (HZ / 10)
static int work_enabled;
+#ifndef CONFIG_XEN
+#define current_domain COORDINATOR_DOMAIN
+#else
static int32_t current_domain = COORDINATOR_DOMAIN;
+#endif
void free_cpu_buffers(void)
{
@@ -303,6 +307,7 @@ void oprofile_add_trace(unsigned long pc
add_sample(cpu_buf, pc, 0);
}
+#ifdef CONFIG_XEN
int oprofile_add_domain_switch(int32_t domain_id)
{
struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
@@ -321,6 +326,7 @@ int oprofile_add_domain_switch(int32_t d
return 1;
}
+#endif
/*
* This serves to avoid cpu buffer overflow, and makes sure
--- a/drivers/oprofile/oprof.c
+++ b/drivers/oprofile/oprof.c
@@ -37,6 +37,7 @@ static DEFINE_MUTEX(start_mutex);
*/
static int timer = 0;
+#ifdef CONFIG_XEN
int oprofile_set_active(int active_domains[], unsigned int adomains)
{
int err;
@@ -62,6 +63,7 @@ int oprofile_set_passive(int passive_dom
mutex_unlock(&start_mutex);
return err;
}
+#endif
int oprofile_setup(void)
{
--- a/drivers/oprofile/oprofile_files.c
+++ b/drivers/oprofile/oprofile_files.c
@@ -124,6 +124,8 @@ static const struct file_operations dump
.write = dump_write,
};
+#ifdef CONFIG_XEN
+
#define TMPBUFSIZE 512
static unsigned int adomains = 0;
@@ -313,12 +315,16 @@ static struct file_operations passive_do
.write = pdomain_write,
};
+#endif /* CONFIG_XEN */
+
void oprofile_create_files(struct super_block * sb, struct dentry * root)
{
oprofilefs_create_file(sb, root, "enable", &enable_fops);
oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
+#ifdef CONFIG_XEN
oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops);
oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops);
+#endif
oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -187,10 +187,12 @@ struct vm_operations_struct {
int (*access)(struct vm_area_struct *vma, unsigned long addr,
void *buf, int len, int write);
+#ifdef CONFIG_XEN
/* Area-specific function for clearing the PTE at @ptep. Returns the
* original value of @ptep. */
pte_t (*zap_pte)(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep, int is_fullmm);
+#endif
#ifdef CONFIG_NUMA
/*
* set_policy() op must add a reference to any non-NULL @new mempolicy
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -16,8 +16,9 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
-
+#ifdef CONFIG_XEN
#include <xen/interface/xenoprof.h>
+#endif
/* Each escaped entry is prefixed by ESCAPE_CODE
* then one of the following codes, then the
@@ -50,11 +51,12 @@ struct oprofile_operations {
/* create any necessary configuration files in the oprofile fs.
* Optional. */
int (*create_files)(struct super_block * sb, struct dentry * root);
+#ifdef CONFIG_XEN
/* setup active domains with Xen */
int (*set_active)(int *active_domains, unsigned int adomains);
/* setup passive domains with Xen */
int (*set_passive)(int *passive_domains, unsigned int pdomains);
-
+#endif
/* Do any necessary interrupt setup. Optional. */
int (*setup)(void);
/* Do any necessary interrupt shutdown. Optional. */
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -758,10 +758,12 @@ static unsigned long zap_pte_range(struc
page->index > details->last_index))
continue;
}
+#ifdef CONFIG_XEN
if (unlikely(vma->vm_ops && vma->vm_ops->zap_pte))
ptent = vma->vm_ops->zap_pte(vma, addr, pte,
tlb->fullmm);
else
+#endif
ptent = ptep_get_and_clear_full(mm, addr, pte,
tlb->fullmm);
tlb_remove_tlb_entry(tlb, pte, addr);

View File

@@ -0,0 +1,60 @@
Subject: xen3 x86 build fixes.
From: jbeulich@novell.com
Patch-mainline: obsolete
Index: head-2008-11-25/arch/x86/kernel/crash.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/crash.c 2008-11-25 14:34:12.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/crash.c 2008-11-25 12:41:33.000000000 +0100
@@ -29,10 +29,10 @@
#include <mach_ipi.h>
+#ifndef CONFIG_XEN
/* This keeps a track of which one is crashing cpu. */
static int crashing_cpu;
-#ifndef CONFIG_XEN
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
static atomic_t waiting_for_crash_ipi;
@@ -206,9 +206,9 @@ void native_machine_crash_shutdown(struc
/* The kernel is broken so disable interrupts */
local_irq_disable();
+#ifndef CONFIG_XEN
/* Make a note of crashing cpu. Will be used in NMI callback.*/
crashing_cpu = safe_smp_processor_id();
-#ifndef CONFIG_XEN
nmi_shootdown_cpus();
lapic_shutdown();
#if defined(CONFIG_X86_IO_APIC)
Index: head-2008-11-25/arch/x86/power/Makefile
===================================================================
--- head-2008-11-25.orig/arch/x86/power/Makefile 2008-11-25 14:34:12.000000000 +0100
+++ head-2008-11-25/arch/x86/power/Makefile 2008-11-25 12:41:33.000000000 +0100
@@ -1,2 +1,4 @@
obj-$(CONFIG_PM_SLEEP) += cpu_$(BITS).o
obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o
+
+disabled-obj-$(CONFIG_XEN) := cpu_$(BITS).o
Index: head-2008-11-25/arch/x86/power/cpu_64.c
===================================================================
--- head-2008-11-25.orig/arch/x86/power/cpu_64.c 2008-11-25 14:34:12.000000000 +0100
+++ head-2008-11-25/arch/x86/power/cpu_64.c 2008-11-25 12:41:33.000000000 +0100
@@ -135,7 +135,6 @@ void restore_processor_state(void)
static void fix_processor_context(void)
{
-#ifndef CONFIG_X86_NO_TSS
int cpu = smp_processor_id();
struct tss_struct *t = &per_cpu(init_tss, cpu);
@@ -147,7 +146,6 @@ static void fix_processor_context(void)
set_tss_desc(cpu, t);
get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9;
-#endif
syscall_init(); /* This sets MSR_*STAR and related */
load_TR_desc(); /* This does ltr */

View File

@@ -0,0 +1,63 @@
Subject: Fix Xen build wrt. SFC files coming from Solarflare.
From: jbeulich@novell.com
Patch-mainline: obsolete
Index: head-2008-04-15/drivers/xen/sfc_netback/accel_solarflare.c
===================================================================
--- head-2008-04-15.orig/drivers/xen/sfc_netback/accel_solarflare.c 2008-04-18 18:23:11.000000000 +0200
+++ head-2008-04-15/drivers/xen/sfc_netback/accel_solarflare.c 2008-04-18 18:24:46.000000000 +0200
@@ -173,7 +173,7 @@ static int efx_device_to_efab_nic_index(
int i;
for (i = 0; i < EFHW_MAX_NR_DEVS; i++) {
- struct efhw_nic *nic = efrm_nic_table.nic[i];
+ struct efhw_nic *nic = efrm_nic_tablep->nic[i];
/*
* It's possible for the nic structure to have not
Index: head-2008-04-15/drivers/xen/sfc_netback/ci/efrm/nic_table.h
===================================================================
--- head-2008-04-15.orig/drivers/xen/sfc_netback/ci/efrm/nic_table.h 2008-02-20 09:32:49.000000000 +0100
+++ head-2008-04-15/drivers/xen/sfc_netback/ci/efrm/nic_table.h 2008-04-18 18:25:47.000000000 +0200
@@ -62,21 +62,21 @@ struct efrm_nic_table {
};
/* Resource driver structures used by other drivers as well */
-extern struct efrm_nic_table efrm_nic_table;
+extern struct efrm_nic_table *efrm_nic_tablep;
static inline void efrm_nic_table_hold(void)
{
- atomic_inc(&efrm_nic_table.ref_count);
+ atomic_inc(&efrm_nic_tablep->ref_count);
}
static inline void efrm_nic_table_rele(void)
{
- atomic_dec(&efrm_nic_table.ref_count);
+ atomic_dec(&efrm_nic_tablep->ref_count);
}
static inline int efrm_nic_table_held(void)
{
- return (atomic_read(&efrm_nic_table.ref_count) != 0);
+ return (atomic_read(&efrm_nic_tablep->ref_count) != 0);
}
/* Run code block _x multiple times with variable nic set to each
@@ -86,13 +86,13 @@ static inline int efrm_nic_table_held(vo
for ((_nic_i) = (efrm_nic_table_hold(), 0); \
(_nic_i) < EFHW_MAX_NR_DEVS || (efrm_nic_table_rele(), 0); \
(_nic_i)++) \
- if (((_nic) = efrm_nic_table.nic[_nic_i]))
+ if (((_nic) = efrm_nic_tablep->nic[_nic_i]))
#define EFRM_FOR_EACH_NIC_IN_SET(_set, _i, _nic) \
for ((_i) = (efrm_nic_table_hold(), 0); \
(_i) < EFHW_MAX_NR_DEVS || (efrm_nic_table_rele(), 0); \
++(_i)) \
- if (((_nic) = efrm_nic_table.nic[_i]) && \
+ if (((_nic) = efrm_nic_tablep->nic[_i]) && \
efrm_nic_set_read((_set), (_i)))
#endif /* __CI_EFRM_NIC_TABLE_H__ */

View File

@@ -0,0 +1,313 @@
From: www.kernel.org
Subject: Linux 2.6.18
Patch-mainline: 2.6.18
Automatically created from "patches.kernel.org/patch-2.6.18" by xen-port-patches.py
Acked-by: jbeulich@novell.com
Index: head-2008-12-01/arch/x86/Kconfig
===================================================================
--- head-2008-12-01.orig/arch/x86/Kconfig 2008-12-01 11:28:20.000000000 +0100
+++ head-2008-12-01/arch/x86/Kconfig 2008-12-01 11:28:55.000000000 +0100
@@ -44,7 +44,6 @@ config GENERIC_LOCKBREAK
config GENERIC_TIME
def_bool y
- depends on !X86_XEN
config GENERIC_CMOS_UPDATE
def_bool y
Index: head-2008-12-01/arch/x86/kernel/Makefile
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/Makefile 2008-12-01 11:14:33.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/Makefile 2008-12-01 11:28:55.000000000 +0100
@@ -124,5 +124,5 @@ ifeq ($(CONFIG_X86_64),y)
pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o
endif
-disabled-obj-$(CONFIG_XEN) := i8259_$(BITS).o reboot.o smpboot_$(BITS).o
+disabled-obj-$(CONFIG_XEN) := i8253.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o
%/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) :=
Index: head-2008-12-01/arch/x86/kernel/entry_32-xen.S
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/entry_32-xen.S 2007-12-10 08:47:31.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/entry_32-xen.S 2008-12-01 11:28:55.000000000 +0100
@@ -388,8 +388,10 @@ ENTRY(sysenter_entry_pv)
movl %ebp,12(%esp)
movl $__USER_CS,4(%esp)
addl $4,%esp
+ CFI_ADJUST_CFA_OFFSET -4
/* +5*4 is SS:ESP,EFLAGS,CS:EIP. +8 is esp0 setting. */
pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
+ CFI_ADJUST_CFA_OFFSET 4
/*
* Load the potential sixth argument from user stack.
* Careful about security.
Index: head-2008-12-01/arch/x86/kernel/time_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/time_32-xen.c 2008-09-01 12:07:31.000000000 +0200
+++ head-2008-12-01/arch/x86/kernel/time_32-xen.c 2008-12-01 11:28:55.000000000 +0100
@@ -76,8 +76,13 @@
#if defined (__i386__)
#include <asm/i8259.h>
+#include <asm/i8253.h>
+DEFINE_SPINLOCK(i8253_lock);
+EXPORT_SYMBOL(i8253_lock);
#endif
+#define XEN_SHIFT 22
+
int pit_latch_buggy; /* extern */
#if defined(__x86_64__)
@@ -97,10 +102,6 @@ extern unsigned long wall_jiffies;
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);
-extern struct init_timer_opts timer_tsc_init;
-extern struct timer_opts timer_tsc;
-#define timer_none timer_tsc
-
/* These are peridically updated in shared_info, and then copied here. */
struct shadow_time_info {
u64 tsc_timestamp; /* TSC at last update of time vals. */
@@ -229,14 +230,6 @@ static inline u64 scale_delta(u64 delta,
return product;
}
-#if 0 /* defined (__i386__) */
-int read_current_timer(unsigned long *timer_val)
-{
- rdtscl(*timer_val);
- return 0;
-}
-#endif
-
void init_cpu_khz(void)
{
u64 __cpu_khz = 1000000ULL << 32;
@@ -256,6 +249,7 @@ static u64 get_nsec_offset(struct shadow
return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
}
+#ifdef CONFIG_X86_64
static unsigned long get_usec_offset(struct shadow_time_info *shadow)
{
u64 now, delta;
@@ -263,6 +257,7 @@ static unsigned long get_usec_offset(str
delta = now - shadow->tsc_timestamp;
return scale_delta(delta, shadow->tsc_to_usec_mul, shadow->tsc_shift);
}
+#endif
static void __update_wallclock(time_t sec, long nsec)
{
@@ -379,6 +374,8 @@ void rtc_cmos_write(unsigned char val, u
}
EXPORT_SYMBOL(rtc_cmos_write);
+#ifdef CONFIG_X86_64
+
/*
* This version of gettimeofday has microsecond resolution
* and better than microsecond precision on fast x86 machines with TSC.
@@ -513,6 +510,8 @@ int do_settimeofday(struct timespec *tv)
EXPORT_SYMBOL(do_settimeofday);
+#endif
+
static void sync_xen_wallclock(unsigned long dummy);
static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0);
static void sync_xen_wallclock(unsigned long dummy)
@@ -564,11 +563,15 @@ static int set_rtc_mmss(unsigned long no
return retval;
}
+#ifdef CONFIG_X86_64
/* monotonic_clock(): returns # of nanoseconds passed since time_init()
* Note: This function is required to return accurate
* time even in the absence of multiple timer ticks.
*/
unsigned long long monotonic_clock(void)
+#else
+unsigned long long sched_clock(void)
+#endif
{
unsigned int cpu = get_cpu();
struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
@@ -588,9 +591,9 @@ unsigned long long monotonic_clock(void)
return time;
}
+#ifdef CONFIG_X86_64
EXPORT_SYMBOL(monotonic_clock);
-#ifdef __x86_64__
unsigned long long sched_clock(void)
{
return monotonic_clock();
@@ -760,6 +763,89 @@ irqreturn_t timer_interrupt(int irq, voi
return IRQ_HANDLED;
}
+#ifndef CONFIG_X86_64
+
+void tsc_init(void)
+{
+ init_cpu_khz();
+ printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
+ cpu_khz / 1000, cpu_khz % 1000);
+
+ use_tsc_delay();
+}
+
+#include <linux/clocksource.h>
+
+void mark_tsc_unstable(void)
+{
+#ifndef CONFIG_XEN /* XXX Should tell the hypervisor about this fact. */
+ tsc_unstable = 1;
+#endif
+}
+EXPORT_SYMBOL_GPL(mark_tsc_unstable);
+
+static cycle_t xen_clocksource_read(void)
+{
+#ifdef CONFIG_SMP
+ static cycle_t last_ret;
+#ifndef CONFIG_64BIT
+ cycle_t last = cmpxchg64(&last_ret, 0, 0);
+#else
+ cycle_t last = last_ret;
+#define cmpxchg64 cmpxchg
+#endif
+ cycle_t ret = sched_clock();
+
+ if (unlikely((s64)(ret - last) < 0)) {
+ if (last - ret > permitted_clock_jitter
+ && printk_ratelimit()) {
+ unsigned int cpu = get_cpu();
+ struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
+
+ printk(KERN_WARNING "clocksource/%u: "
+ "Time went backwards: "
+ "ret=%Lx delta=%Ld shadow=%Lx offset=%Lx\n",
+ cpu, ret, ret - last, shadow->system_timestamp,
+ get_nsec_offset(shadow));
+ put_cpu();
+ }
+ return last;
+ }
+
+ for (;;) {
+ cycle_t cur = cmpxchg64(&last_ret, last, ret);
+
+ if (cur == last || (s64)(ret - cur) < 0)
+ return ret;
+ last = cur;
+ }
+#else
+ return sched_clock();
+#endif
+}
+
+static struct clocksource clocksource_xen = {
+ .name = "xen",
+ .rating = 400,
+ .read = xen_clocksource_read,
+ .mask = CLOCKSOURCE_MASK(64),
+ .mult = 1 << XEN_SHIFT, /* time directly in nanoseconds */
+ .shift = XEN_SHIFT,
+ .is_continuous = 1,
+};
+
+static int __init init_xen_clocksource(void)
+{
+ clocksource_xen.mult = clocksource_khz2mult(cpu_khz,
+ clocksource_xen.shift);
+
+ return clocksource_register(&clocksource_xen);
+}
+
+module_init(init_xen_clocksource);
+
+#endif
+
static void init_missing_ticks_accounting(unsigned int cpu)
{
struct vcpu_register_runstate_memory_area area;
@@ -948,11 +1034,11 @@ void __init time_init(void)
update_wallclock();
+#ifdef CONFIG_X86_64
init_cpu_khz();
printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
cpu_khz / 1000, cpu_khz % 1000);
-#if defined(__x86_64__)
vxtime.mode = VXTIME_TSC;
vxtime.quot = (1000000L << 32) / vxtime_hz;
vxtime.tsc_quot = (1000L << 32) / cpu_khz;
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-07-21 11:00:33.000000000 +0200
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 11:28:55.000000000 +0100
@@ -392,7 +392,6 @@ static inline int pmd_large(pmd_t pte) {
/*
* Level 4 access.
- * Never use these in the common code.
*/
#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK))
#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/processor_32.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/processor_32.h 2008-01-28 12:24:19.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/processor_32.h 2008-12-01 11:28:55.000000000 +0100
@@ -23,7 +23,7 @@
#include <xen/interface/physdev.h>
/* flag for disabling the tsc */
-extern int tsc_disable;
+#define tsc_disable 0
struct desc_struct {
unsigned long a,b;
Index: head-2008-12-01/include/asm-x86/thread_info.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/thread_info.h 2008-12-01 10:53:14.000000000 +0100
+++ head-2008-12-01/include/asm-x86/thread_info.h 2008-12-01 11:28:55.000000000 +0100
@@ -142,12 +142,16 @@ struct thread_info {
(_TIF_SIGPENDING|_TIF_MCE_NOTIFY|_TIF_NOTIFY_RESUME|_TIF_PERFMON_WORK)
/* flags to check in __switch_to() */
+#ifndef CONFIG_XEN
#define _TIF_WORK_CTXSW \
(_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_BTS_TRACE_TS| \
_TIF_NOTSC)
#define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
+#else
+#define _TIF_WORK_CTXSW _TIF_DEBUG
+#endif
#define PREEMPT_ACTIVE 0x10000000
Index: head-2008-12-01/arch/x86/kernel/setup64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/setup64-xen.c 2008-01-28 12:24:19.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/setup64-xen.c 2008-12-01 11:28:55.000000000 +0100
@@ -363,5 +363,7 @@ void __cpuinit cpu_init (void)
fpu_init();
- raw_local_save_flags(kernel_eflags);
+ asm ("pushfq; popq %0" : "=rm" (kernel_eflags));
+ if (raw_irqs_disabled())
+ kernel_eflags &= ~X86_EFLAGS_IF;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: Linux 2.6.27.2
Upstream 2.6.27.2 release from kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Automatically created from "patches.kernel.org/patch-2.6.27.1-2" by xen-port-patches.py
Index: head-2008-11-25/arch/x86/kernel/io_apic_32-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/io_apic_32-xen.c 2008-11-25 14:37:19.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/io_apic_32-xen.c 2008-11-25 14:37:27.000000000 +0100
@@ -2381,6 +2381,9 @@ void __init setup_IO_APIC(void)
/* Reserve all the system vectors. */
for (i = first_system_vector; i < NR_VECTORS; i++)
set_bit(i, used_vectors);
+
+ /* Mark FIRST_DEVICE_VECTOR which is assigned to IRQ0 as used. */
+ set_bit(FIRST_DEVICE_VECTOR, used_vectors);
#endif
enable_IO_APIC();
Index: head-2008-11-25/arch/x86/mm/ioremap-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/mm/ioremap-xen.c 2008-11-27 09:34:01.000000000 +0100
+++ head-2008-11-25/arch/x86/mm/ioremap-xen.c 2008-11-27 09:36:21.000000000 +0100
@@ -784,7 +784,7 @@ void __init *early_ioremap(unsigned long
*/
offset = phys_addr & ~PAGE_MASK;
phys_addr &= PAGE_MASK;
- size = PAGE_ALIGN(last_addr) - phys_addr;
+ size = PAGE_ALIGN(last_addr + 1) - phys_addr;
/*
* Mappings have to fit in the FIX_BTMAP area.

View File

@@ -0,0 +1,30 @@
From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: Linux 2.6.27.4
Upstream 2.6.27.4 release from kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Automatically created from "patches.kernel.org/patch-2.6.27.3-4" by xen-port-patches.py
Index: head-2008-10-29/arch/x86/kernel/acpi/sleep-xen.c
===================================================================
--- head-2008-10-29.orig/arch/x86/kernel/acpi/sleep-xen.c 2008-10-29 11:26:27.000000000 +0100
+++ head-2008-10-29/arch/x86/kernel/acpi/sleep-xen.c 2008-10-29 11:29:30.000000000 +0100
@@ -10,6 +10,7 @@
#include <linux/dmi.h>
#include <linux/cpumask.h>
#include <asm/segment.h>
+#include <asm/desc.h>
#include "realmode/wakeup.h"
#include "sleep.h"
@@ -101,6 +102,8 @@ int acpi_save_state_mem(void)
header->trampoline_segment = setup_trampoline() >> 4;
#ifdef CONFIG_SMP
stack_start.sp = temp_stack + 4096;
+ early_gdt_descr.address =
+ (unsigned long)get_cpu_gdt_table(smp_processor_id());
#endif
initial_code = (unsigned long)wakeup_long64;
saved_magic = 0x123456789abcdef0;

View File

@@ -0,0 +1,49 @@
From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: Linux 2.6.27.5
Upstream 2.6.27.5 release from kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Automatically created from "patches.kernel.org/patch-2.6.27.4-5" by xen-port-patches.py
Index: head-2008-11-25/arch/x86/kernel/process_64-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/process_64-xen.c 2008-11-25 13:34:32.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/process_64-xen.c 2008-11-10 12:12:28.000000000 +0100
@@ -786,12 +786,12 @@ unsigned long get_wchan(struct task_stru
if (!p || p == current || p->state==TASK_RUNNING)
return 0;
stack = (unsigned long)task_stack_page(p);
- if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE)
+ if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
return 0;
fp = *(u64 *)(p->thread.sp);
do {
if (fp < (unsigned long)stack ||
- fp > (unsigned long)stack+THREAD_SIZE)
+ fp >= (unsigned long)stack+THREAD_SIZE)
return 0;
ip = *(u64 *)(fp+8);
if (!in_sched_functions(ip))
Index: head-2008-11-25/arch/x86/mm/pat-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/mm/pat-xen.c 2008-11-27 09:35:47.000000000 +0100
+++ head-2008-11-25/arch/x86/mm/pat-xen.c 2008-11-27 09:36:36.000000000 +0100
@@ -415,12 +415,16 @@ static inline int range_is_allowed(unsig
return 1;
}
#else
+/* This check is needed to avoid cache aliasing when PAT is enabled */
static inline int range_is_allowed(unsigned long mfn, unsigned long size)
{
u64 from = ((u64)mfn) << PAGE_SHIFT;
u64 to = from + size;
u64 cursor = from;
+ if (!pat_enabled)
+ return 1;
+
while (cursor < to) {
if (!devmem_is_allowed(mfn)) {
printk(KERN_INFO

View File

@@ -0,0 +1,89 @@
From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: Linux 2.6.27.6
Upstream 2.6.27.6 release from kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Automatically created from "patches.kernel.org/patch-2.6.27.5-6" by xen-port-patches.py
Index: head-2008-11-17/arch/x86/Kconfig
===================================================================
--- head-2008-11-17.orig/arch/x86/Kconfig 2008-11-18 16:18:56.000000000 +0100
+++ head-2008-11-17/arch/x86/Kconfig 2008-11-18 16:19:14.000000000 +0100
@@ -1143,6 +1143,7 @@ config HIGHPTE
config X86_RESERVE_LOW_64K
bool "Reserve low 64K of RAM on AMI/Phoenix BIOSen"
default y
+ depends on !XEN
help
Reserve the first 64K of physical RAM on BIOSes that are known
to potentially corrupt that memory range. A numbers of BIOSes are
Index: head-2008-11-17/arch/x86/kernel/setup-xen.c
===================================================================
--- head-2008-11-17.orig/arch/x86/kernel/setup-xen.c 2008-11-17 13:42:08.000000000 +0100
+++ head-2008-11-17/arch/x86/kernel/setup-xen.c 2008-11-17 13:55:53.000000000 +0100
@@ -645,6 +645,41 @@ static struct x86_quirks default_x86_qui
struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
+#ifdef CONFIG_X86_RESERVE_LOW_64K
+static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
+{
+ printk(KERN_NOTICE
+ "%s detected: BIOS may corrupt low RAM, working it around.\n",
+ d->ident);
+
+ e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
+ sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+
+ return 0;
+}
+#endif
+
+/* List of systems that have known low memory corruption BIOS problems */
+static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
+#ifdef CONFIG_X86_RESERVE_LOW_64K
+ {
+ .callback = dmi_low_memory_corruption,
+ .ident = "AMI BIOS",
+ .matches = {
+ DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
+ },
+ },
+ {
+ .callback = dmi_low_memory_corruption,
+ .ident = "Phoenix BIOS",
+ .matches = {
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
+ },
+ },
+#endif
+ {}
+};
+
/*
* Determine if we were loaded by an EFI loader. If so, then we have also been
* passed the efi memmap, systab, etc., so we should use these data structures
@@ -819,6 +854,11 @@ void __init setup_arch(char **cmdline_p)
finish_e820_parsing();
+ if (is_initial_xendomain()) {
+ dmi_scan_machine();
+ dmi_check_system(bad_bios_dmi_table);
+ }
+
#ifdef CONFIG_X86_32
probe_roms();
#endif
@@ -922,9 +962,6 @@ void __init setup_arch(char **cmdline_p)
vsmp_init();
#endif
- if (is_initial_xendomain())
- dmi_scan_machine();
-
io_delay_init();
#ifdef CONFIG_ACPI

View File

@@ -0,0 +1,66 @@
From: Kurt Garloff <garloff@suse.de>
Subject: [PATCH] X86: sysctl to allow panic on IOCK NMI error
References: bnc427979
This patch introduces a sysctl /proc/sys/kernel/panic_on_io_nmi.,
which defaults to 0 (off).
When enabled, the kernel panics when the kernel receives an NMI
caused by an IO error.
The IO error triggered NMI indicates a serious system condition,
which could result in IO data corruption. Rather than contiuing,
panicing and dumping might be a better choice, so one can figure
out what's causing the IO error.
This could be especially important to companies running IO intensive
applications where corruption must be avoided, e.g. a banks databases.
Signed-off-by: Roberto Angelino <robertangelino@gmail.com>
Automatically created from "patches.suse/panic-on-io-nmi.diff" by xen-port-patches.py
Index: head-2008-11-25/arch/x86/kernel/traps_32-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/traps_32-xen.c 2008-11-25 12:57:05.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/traps_32-xen.c 2008-11-25 13:13:12.000000000 +0100
@@ -83,6 +83,7 @@ gate_desc idt_table[256]
#endif
int panic_on_unrecovered_nmi;
+int panic_on_io_nmi;
int kstack_depth_to_print = 24;
static unsigned int code_bytes = 64;
static int ignore_nmis;
@@ -670,6 +671,9 @@ io_check_error(unsigned char reason, str
printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
show_registers(regs);
+ if (panic_on_io_nmi)
+ panic("NMI IOCK error: Not continuing");
+
/* Re-enable the IOCK line, wait for a few seconds */
clear_io_check_error(reason);
}
Index: head-2008-11-25/arch/x86/kernel/traps_64-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/traps_64-xen.c 2008-11-25 12:57:05.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/traps_64-xen.c 2008-11-25 13:13:12.000000000 +0100
@@ -56,6 +56,7 @@
#include <mach_traps.h>
int panic_on_unrecovered_nmi;
+int panic_on_io_nmi;
int kstack_depth_to_print = 12;
static unsigned int code_bytes = 64;
static int ignore_nmis;
@@ -772,6 +773,9 @@ io_check_error(unsigned char reason, str
printk("NMI: IOCK error (debug interrupt?)\n");
show_registers(regs);
+ if (panic_on_io_nmi)
+ panic("NMI IOCK error: Not continuing");
+
/* Re-enable the IOCK line, wait for a few seconds */
clear_io_check_error(reason);
}

View File

@@ -0,0 +1,85 @@
From: ccoffing@novell.com
Subject: Expose min/max limits of domain ballooning
Patch-mainline: obsolete
References: 152667, 184727
jb: Also added this to the sysfs representation.
Index: head-2008-11-25/drivers/xen/balloon/balloon.c
===================================================================
--- head-2008-11-25.orig/drivers/xen/balloon/balloon.c 2008-11-25 13:33:56.000000000 +0100
+++ head-2008-11-25/drivers/xen/balloon/balloon.c 2008-11-25 13:34:52.000000000 +0100
@@ -194,7 +194,7 @@ static unsigned long current_target(void
return target;
}
-static unsigned long minimum_target(void)
+unsigned long balloon_minimum_target(void)
{
#ifndef CONFIG_XEN
#define max_pfn num_physpages
@@ -421,7 +421,7 @@ void balloon_set_new_target(unsigned lon
{
/* No need for lock. Not read-modify-write updates. */
bs.hard_limit = ~0UL;
- bs.target_pages = max(target, minimum_target());
+ bs.target_pages = max(target, balloon_minimum_target());
schedule_work(&balloon_worker);
}
@@ -496,11 +496,14 @@ static int balloon_read(char *page, char
page,
"Current allocation: %8lu kB\n"
"Requested target: %8lu kB\n"
+ "Minimum target: %8lu kB\n"
+ "Maximum target: %8lu kB\n"
"Low-mem balloon: %8lu kB\n"
"High-mem balloon: %8lu kB\n"
"Driver pages: %8lu kB\n"
"Xen hard limit: ",
PAGES2KB(bs.current_pages), PAGES2KB(bs.target_pages),
+ PAGES2KB(balloon_minimum_target()), PAGES2KB(num_physpages),
PAGES2KB(bs.balloon_low), PAGES2KB(bs.balloon_high),
PAGES2KB(bs.driver_pages));
Index: head-2008-11-25/drivers/xen/balloon/common.h
===================================================================
--- head-2008-11-25.orig/drivers/xen/balloon/common.h 2007-06-12 13:13:44.000000000 +0200
+++ head-2008-11-25/drivers/xen/balloon/common.h 2008-11-25 13:34:52.000000000 +0100
@@ -47,6 +47,7 @@ struct balloon_stats {
unsigned long balloon_high;
};
+extern unsigned long num_physpages;
extern struct balloon_stats balloon_stats;
#define bs balloon_stats
@@ -54,5 +55,6 @@ int balloon_sysfs_init(void);
void balloon_sysfs_exit(void);
void balloon_set_new_target(unsigned long target);
+unsigned long balloon_minimum_target(void);
#endif /* __XEN_BALLOON_COMMON_H__ */
Index: head-2008-11-25/drivers/xen/balloon/sysfs.c
===================================================================
--- head-2008-11-25.orig/drivers/xen/balloon/sysfs.c 2008-11-25 13:34:32.000000000 +0100
+++ head-2008-11-25/drivers/xen/balloon/sysfs.c 2008-11-25 13:34:52.000000000 +0100
@@ -53,6 +53,8 @@
static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL)
BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(bs.current_pages));
+BALLOON_SHOW(min_kb, "%lu\n", PAGES2KB(balloon_minimum_target()));
+BALLOON_SHOW(max_kb, "%lu\n", PAGES2KB(num_physpages));
BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(bs.balloon_low));
BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(bs.balloon_high));
BALLOON_SHOW(hard_limit_kb,
@@ -97,6 +99,8 @@ static struct sysdev_attribute *balloon_
static struct attribute *balloon_info_attrs[] = {
&attr_current_kb.attr,
+ &attr_min_kb.attr,
+ &attr_max_kb.attr,
&attr_low_kb.attr,
&attr_high_kb.attr,
&attr_hard_limit_kb.attr,

View File

@@ -0,0 +1,269 @@
Subject: CDROM removable media-present attribute plus handling code
From: plc@novell.com
Patch-mainline: obsolete
References: 159907
Index: head-2008-05-08/drivers/xen/blkback/Makefile
===================================================================
--- head-2008-05-08.orig/drivers/xen/blkback/Makefile 2008-05-08 15:34:23.000000000 +0200
+++ head-2008-05-08/drivers/xen/blkback/Makefile 2008-05-08 15:05:13.000000000 +0200
@@ -1,3 +1,3 @@
obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkbk.o
-blkbk-y := blkback.o xenbus.o interface.o vbd.o
+blkbk-y := blkback.o xenbus.o interface.o vbd.o cdrom.o
Index: head-2008-05-08/drivers/xen/blkback/cdrom.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ head-2008-05-08/drivers/xen/blkback/cdrom.c 2008-05-13 15:34:40.000000000 +0200
@@ -0,0 +1,162 @@
+/******************************************************************************
+ * blkback/cdrom.c
+ *
+ * Routines for managing cdrom watch and media-present attribute of a
+ * cdrom type virtual block device (VBD).
+ *
+ * Copyright (c) 2003-2005, Keir Fraser & Steve Hand
+ * Copyright (c) 2007 Pat Campbell
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "common.h"
+
+#undef DPRINTK
+#define DPRINTK(_f, _a...) \
+ printk("(%s() file=%s, line=%d) " _f "\n", \
+ __PRETTY_FUNCTION__, __FILE__ , __LINE__ , ##_a )
+
+
+#define MEDIA_PRESENT "media-present"
+
+static void cdrom_media_changed(struct xenbus_watch *, const char **, unsigned int);
+
+/**
+ * Writes media-present=1 attribute for the given vbd device if not
+ * already there
+ */
+static int cdrom_xenstore_write_media_present(struct backend_info *be)
+{
+ struct xenbus_device *dev = be->dev;
+ struct xenbus_transaction xbt;
+ int err;
+ int media_present;
+
+ err = xenbus_scanf(XBT_NIL, dev->nodename, MEDIA_PRESENT, "%d",
+ &media_present);
+ if (0 < err) {
+ DPRINTK("already written err%d", err);
+ return(0);
+ }
+ media_present = 1;
+
+again:
+ err = xenbus_transaction_start(&xbt);
+ if (err) {
+ xenbus_dev_fatal(dev, err, "starting transaction");
+ return(-1);
+ }
+
+ err = xenbus_printf(xbt, dev->nodename, MEDIA_PRESENT, "%d", media_present );
+ if (err) {
+ xenbus_dev_fatal(dev, err, "writing %s/%s",
+ dev->nodename, MEDIA_PRESENT);
+ goto abort;
+ }
+ err = xenbus_transaction_end(xbt, 0);
+ if (err == -EAGAIN)
+ goto again;
+ if (err)
+ xenbus_dev_fatal(dev, err, "ending transaction");
+ return 0;
+ abort:
+ xenbus_transaction_end(xbt, 1);
+ return -1;
+}
+
+/**
+ *
+ */
+static int cdrom_is_type(struct backend_info *be)
+{
+ DPRINTK("type:%x", be->blkif->vbd.type );
+ return (be->blkif->vbd.type & VDISK_CDROM)
+ && (be->blkif->vbd.type & GENHD_FL_REMOVABLE);
+}
+
+/**
+ *
+ */
+void cdrom_add_media_watch(struct backend_info *be)
+{
+ struct xenbus_device *dev = be->dev;
+ int err;
+
+ DPRINTK("nodename:%s", dev->nodename);
+ if (cdrom_is_type(be)) {
+ DPRINTK("is a cdrom");
+ if ( cdrom_xenstore_write_media_present(be) == 0 ) {
+ DPRINTK( "xenstore wrote OK");
+ err = xenbus_watch_path2(dev, dev->nodename, MEDIA_PRESENT,
+ &be->backend_cdrom_watch,
+ cdrom_media_changed);
+ if (err)
+ DPRINTK( "media_present watch add failed" );
+ }
+ }
+}
+
+/**
+ * Callback received when the "media_present" xenstore node is changed
+ */
+static void cdrom_media_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
+{
+ int err;
+ unsigned media_present;
+ struct backend_info *be
+ = container_of(watch, struct backend_info, backend_cdrom_watch);
+ struct xenbus_device *dev = be->dev;
+
+ if (!cdrom_is_type(be)) {
+ DPRINTK("callback not for a cdrom" );
+ return;
+ }
+
+ err = xenbus_scanf(XBT_NIL, dev->nodename, MEDIA_PRESENT, "%d",
+ &media_present);
+ if (err == 0 || err == -ENOENT) {
+ DPRINTK("xenbus_read of cdrom media_present node error:%d",err);
+ return;
+ }
+
+ if (media_present == 0)
+ vbd_free(&be->blkif->vbd);
+ else {
+ char *p = strrchr(dev->otherend, '/') + 1;
+ long handle = simple_strtoul(p, NULL, 0);
+
+ if (!be->blkif->vbd.bdev) {
+ err = vbd_create(be->blkif, handle, be->major, be->minor,
+ !strchr(be->mode, 'w'), 1);
+ if (err) {
+ be->major = be->minor = 0;
+ xenbus_dev_fatal(dev, err, "creating vbd structure");
+ return;
+ }
+ }
+ }
+}
Index: head-2008-05-08/drivers/xen/blkback/common.h
===================================================================
--- head-2008-05-08.orig/drivers/xen/blkback/common.h 2008-05-08 15:34:23.000000000 +0200
+++ head-2008-05-08/drivers/xen/blkback/common.h 2008-05-13 15:35:13.000000000 +0200
@@ -96,6 +96,17 @@ typedef struct blkif_st {
grant_ref_t shmem_ref;
} blkif_t;
+struct backend_info
+{
+ struct xenbus_device *dev;
+ blkif_t *blkif;
+ struct xenbus_watch backend_watch;
+ struct xenbus_watch backend_cdrom_watch;
+ unsigned major;
+ unsigned minor;
+ char *mode;
+};
+
blkif_t *blkif_alloc(domid_t domid);
void blkif_disconnect(blkif_t *blkif);
void blkif_free(blkif_t *blkif);
@@ -136,4 +147,7 @@ int blkif_schedule(void *arg);
int blkback_barrier(struct xenbus_transaction xbt,
struct backend_info *be, int state);
+/* cdrom media change */
+void cdrom_add_media_watch(struct backend_info *be);
+
#endif /* __BLKIF__BACKEND__COMMON_H__ */
Index: head-2008-05-08/drivers/xen/blkback/vbd.c
===================================================================
--- head-2008-05-08.orig/drivers/xen/blkback/vbd.c 2008-05-08 15:34:23.000000000 +0200
+++ head-2008-05-08/drivers/xen/blkback/vbd.c 2008-05-08 15:05:13.000000000 +0200
@@ -106,6 +106,9 @@ int vbd_translate(struct phys_req *req,
if ((operation != READ) && vbd->readonly)
goto out;
+ if (vbd->bdev == NULL)
+ goto out;
+
if (unlikely((req->sector_number + req->nr_sects) > vbd_sz(vbd)))
goto out;
Index: head-2008-05-08/drivers/xen/blkback/xenbus.c
===================================================================
--- head-2008-05-08.orig/drivers/xen/blkback/xenbus.c 2008-05-08 15:34:23.000000000 +0200
+++ head-2008-05-08/drivers/xen/blkback/xenbus.c 2008-05-08 15:05:13.000000000 +0200
@@ -28,16 +28,6 @@
pr_debug("blkback/xenbus (%s:%d) " fmt ".\n", \
__FUNCTION__, __LINE__, ##args)
-struct backend_info
-{
- struct xenbus_device *dev;
- blkif_t *blkif;
- struct xenbus_watch backend_watch;
- unsigned major;
- unsigned minor;
- char *mode;
-};
-
static void connect(struct backend_info *);
static int connect_ring(struct backend_info *);
static void backend_changed(struct xenbus_watch *, const char **,
@@ -183,6 +173,12 @@ static int blkback_remove(struct xenbus_
be->backend_watch.node = NULL;
}
+ if (be->backend_cdrom_watch.node) {
+ unregister_xenbus_watch(&be->backend_cdrom_watch);
+ kfree(be->backend_cdrom_watch.node);
+ be->backend_cdrom_watch.node = NULL;
+ }
+
if (be->blkif) {
blkif_disconnect(be->blkif);
vbd_free(&be->blkif->vbd);
@@ -339,6 +335,9 @@ static void backend_changed(struct xenbu
/* We're potentially connected now */
update_blkif_status(be->blkif);
+
+ /* Add watch for cdrom media status if necessay */
+ cdrom_add_media_watch(be);
}
}

View File

@@ -0,0 +1,109 @@
From: kwolf@suse.de
Subject: blktap: Write Barriers
Patch-mainline: obsolete
Index: head-2008-11-10/drivers/xen/blktap/blktap.c
===================================================================
--- head-2008-11-10.orig/drivers/xen/blktap/blktap.c 2008-11-10 12:10:23.000000000 +0100
+++ head-2008-11-10/drivers/xen/blktap/blktap.c 2008-11-10 12:14:32.000000000 +0100
@@ -1324,6 +1324,9 @@ static int do_block_io_op(blkif_t *blkif
dispatch_rw_block_io(blkif, &req, pending_req);
break;
+ case BLKIF_OP_WRITE_BARRIER:
+ /* TODO Some counter? */
+ /* Fall through */
case BLKIF_OP_WRITE:
blkif->st_wr_req++;
dispatch_rw_block_io(blkif, &req, pending_req);
@@ -1355,7 +1358,7 @@ static void dispatch_rw_block_io(blkif_t
pending_req_t *pending_req)
{
extern void ll_rw_block(int rw, int nr, struct buffer_head * bhs[]);
- int op, operation = (req->operation == BLKIF_OP_WRITE) ? WRITE : READ;
+ int op, operation;
struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
unsigned int nseg;
int ret, i, nr_sects = 0;
@@ -1366,6 +1369,21 @@ static void dispatch_rw_block_io(blkif_t
uint16_t mmap_idx = pending_req->mem_idx;
struct mm_struct *mm;
+ switch (req->operation) {
+ case BLKIF_OP_READ:
+ operation = READ;
+ break;
+ case BLKIF_OP_WRITE:
+ operation = WRITE;
+ break;
+ case BLKIF_OP_WRITE_BARRIER:
+ operation = WRITE_BARRIER;
+ break;
+ default:
+ operation = 0; /* make gcc happy */
+ BUG();
+ }
+
if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV)
goto fail_response;
@@ -1404,7 +1422,7 @@ static void dispatch_rw_block_io(blkif_t
pending_req->blkif = blkif;
pending_req->id = req->id;
- pending_req->operation = operation;
+ pending_req->operation = req->operation;
pending_req->status = BLKIF_RSP_OKAY;
pending_req->nr_pages = nseg;
op = 0;
@@ -1421,7 +1439,7 @@ static void dispatch_rw_block_io(blkif_t
kvaddr = idx_to_kaddr(mmap_idx, pending_idx, i);
flags = GNTMAP_host_map;
- if (operation == WRITE)
+ if (operation != READ)
flags |= GNTMAP_readonly;
gnttab_set_map_op(&map[op], kvaddr, flags,
req->seg[i].gref, blkif->domid);
@@ -1438,7 +1456,7 @@ static void dispatch_rw_block_io(blkif_t
flags = GNTMAP_host_map | GNTMAP_application_map
| GNTMAP_contains_pte;
- if (operation == WRITE)
+ if (operation != READ)
flags |= GNTMAP_readonly;
gnttab_set_map_op(&map[op], ptep, flags,
req->seg[i].gref, blkif->domid);
Index: head-2008-11-10/drivers/xen/blktap/xenbus.c
===================================================================
--- head-2008-11-10.orig/drivers/xen/blktap/xenbus.c 2008-11-10 12:14:29.000000000 +0100
+++ head-2008-11-10/drivers/xen/blktap/xenbus.c 2008-11-10 12:14:32.000000000 +0100
@@ -395,7 +395,28 @@ static void connect(struct backend_info
int err;
struct xenbus_device *dev = be->dev;
+ struct xenbus_transaction xbt;
+ /* Write feature-barrier to xenstore */
+again:
+ err = xenbus_transaction_start(&xbt);
+ if (err) {
+ xenbus_dev_fatal(dev, err, "starting transaction");
+ return;
+ }
+
+ err = xenbus_printf(xbt, dev->nodename, "feature-barrier", "1");
+ if (err) {
+ xenbus_dev_fatal(dev, err, "writing feature-barrier");
+ xenbus_transaction_end(xbt, 1);
+ return;
+ }
+
+ err = xenbus_transaction_end(xbt, 0);
+ if (err == -EAGAIN)
+ goto again;
+
+ /* Switch state */
err = xenbus_switch_state(dev, XenbusStateConnected);
if (err)
xenbus_dev_fatal(dev, err, "switching to Connected state",

View File

@@ -0,0 +1,31 @@
From: Hannes Reinecke <hare@suse.de>
Subject: Update XEN scsifront driver to request timeouts
Patch-mainline: obsolete
Update XEN scsifront driver to the block request handling
patches.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Index: head-2008-09-15/drivers/xen/scsifront/scsifront.c
===================================================================
--- head-2008-09-15.orig/drivers/xen/scsifront/scsifront.c 2008-09-15 15:22:09.000000000 +0200
+++ head-2008-09-15/drivers/xen/scsifront/scsifront.c 2008-09-15 15:22:12.000000000 +0200
@@ -348,7 +348,7 @@ static int scsifront_queuecommand(struct
memset(ring_req->cmnd, 0, VSCSIIF_MAX_COMMAND_SIZE);
ring_req->sc_data_direction = (uint8_t)sc->sc_data_direction;
- ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
+ ring_req->timeout_per_command = (sc->request->timeout / HZ);
info->shadow[rqid].req_scsi_cmnd = (unsigned long)sc;
info->shadow[rqid].sc_data_direction = sc->sc_data_direction;
@@ -418,7 +418,7 @@ static int scsifront_dev_reset_handler(s
memset(ring_req->cmnd, 0, VSCSIIF_MAX_COMMAND_SIZE);
ring_req->sc_data_direction = (uint8_t)sc->sc_data_direction;
- ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
+ ring_req->timeout_per_command = (sc->request->timeout / HZ);
ring_req->nr_segments = 0;
scsifront_do_request(info);

View File

@@ -0,0 +1,152 @@
From: plc@novell.com
Subject: add support for new operation type BLKIF_OP_PACKET
Patch-mainline: obsolete
References: fate#300964
Index: head-2008-11-10/drivers/xen/blkback/blkback.c
===================================================================
--- head-2008-11-10.orig/drivers/xen/blkback/blkback.c 2008-11-10 12:07:53.000000000 +0100
+++ head-2008-11-10/drivers/xen/blkback/blkback.c 2008-11-10 12:15:51.000000000 +0100
@@ -192,13 +192,15 @@ static void fast_flush_area(pending_req_
static void print_stats(blkif_t *blkif)
{
- printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | br %4d\n",
+ printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | br %4d | pk %4d\n",
current->comm, blkif->st_oo_req,
- blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req);
+ blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req,
+ blkif->st_pk_req);
blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000);
blkif->st_rd_req = 0;
blkif->st_wr_req = 0;
blkif->st_oo_req = 0;
+ blkif->st_pk_req = 0;
}
int blkif_schedule(void *arg)
@@ -358,6 +360,13 @@ static int do_block_io_op(blkif_t *blkif
blkif->st_wr_req++;
dispatch_rw_block_io(blkif, &req, pending_req);
break;
+ case BLKIF_OP_PACKET:
+ DPRINTK("error: block operation BLKIF_OP_PACKET not implemented\n");
+ blkif->st_pk_req++;
+ make_response(blkif, req.id, req.operation,
+ BLKIF_RSP_ERROR);
+ free_req(pending_req);
+ break;
default:
/* A good sign something is wrong: sleep for a while to
* avoid excessive CPU consumption by a bad guest. */
Index: head-2008-11-10/drivers/xen/blkback/common.h
===================================================================
--- head-2008-11-10.orig/drivers/xen/blkback/common.h 2008-11-10 12:14:31.000000000 +0100
+++ head-2008-11-10/drivers/xen/blkback/common.h 2008-11-10 12:15:51.000000000 +0100
@@ -87,6 +87,7 @@ typedef struct blkif_st {
int st_wr_req;
int st_oo_req;
int st_br_req;
+ int st_pk_req;
int st_rd_sect;
int st_wr_sect;
Index: head-2008-11-10/drivers/xen/blkfront/blkfront.c
===================================================================
--- head-2008-11-10.orig/drivers/xen/blkfront/blkfront.c 2008-11-10 12:10:12.000000000 +0100
+++ head-2008-11-10/drivers/xen/blkfront/blkfront.c 2008-11-10 12:15:51.000000000 +0100
@@ -622,6 +622,8 @@ static int blkif_queue_request(struct re
BLKIF_OP_WRITE : BLKIF_OP_READ;
if (blk_barrier_rq(req))
ring_req->operation = BLKIF_OP_WRITE_BARRIER;
+ if (blk_pc_request(req))
+ ring_req->operation = BLKIF_OP_PACKET;
ring_req->nr_segments = 0;
rq_for_each_segment(bvec, req, iter) {
@@ -678,7 +680,7 @@ void do_blkif_request(struct request_que
while ((req = elv_next_request(rq)) != NULL) {
info = req->rq_disk->private_data;
- if (!blk_fs_request(req)) {
+ if (!blk_fs_request(req) && !blk_pc_request(req)) {
end_request(req, 0);
continue;
}
@@ -755,6 +757,7 @@ static irqreturn_t blkif_int(int irq, vo
/* fall through */
case BLKIF_OP_READ:
case BLKIF_OP_WRITE:
+ case BLKIF_OP_PACKET:
if (unlikely(bret->status != BLKIF_RSP_OKAY))
DPRINTK("Bad return from blkdev data "
"request: %x\n", bret->status);
Index: head-2008-11-10/drivers/xen/blktap/blktap.c
===================================================================
--- head-2008-11-10.orig/drivers/xen/blktap/blktap.c 2008-11-10 12:14:32.000000000 +0100
+++ head-2008-11-10/drivers/xen/blktap/blktap.c 2008-11-10 12:15:51.000000000 +0100
@@ -1090,13 +1090,14 @@ static void fast_flush_area(pending_req_
static void print_stats(blkif_t *blkif)
{
- printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d\n",
+ printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | pk %4d\n",
current->comm, blkif->st_oo_req,
- blkif->st_rd_req, blkif->st_wr_req);
+ blkif->st_rd_req, blkif->st_wr_req, blkif->st_pk_req);
blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000);
blkif->st_rd_req = 0;
blkif->st_wr_req = 0;
blkif->st_oo_req = 0;
+ blkif->st_pk_req = 0;
}
int tap_blkif_schedule(void *arg)
@@ -1332,6 +1333,11 @@ static int do_block_io_op(blkif_t *blkif
dispatch_rw_block_io(blkif, &req, pending_req);
break;
+ case BLKIF_OP_PACKET:
+ blkif->st_pk_req++;
+ dispatch_rw_block_io(blkif, &req, pending_req);
+ break;
+
default:
/* A good sign something is wrong: sleep for a while to
* avoid excessive CPU consumption by a bad guest. */
@@ -1370,6 +1376,8 @@ static void dispatch_rw_block_io(blkif_t
struct mm_struct *mm;
switch (req->operation) {
+ case BLKIF_OP_PACKET:
+ /* Fall through */
case BLKIF_OP_READ:
operation = READ;
break;
Index: head-2008-11-10/drivers/xen/blktap/common.h
===================================================================
--- head-2008-11-10.orig/drivers/xen/blktap/common.h 2008-11-10 12:06:12.000000000 +0100
+++ head-2008-11-10/drivers/xen/blktap/common.h 2008-11-10 12:15:51.000000000 +0100
@@ -75,6 +75,7 @@ typedef struct blkif_st {
int st_rd_req;
int st_wr_req;
int st_oo_req;
+ int st_pk_req;
int st_rd_sect;
int st_wr_sect;
Index: head-2008-11-10/include/xen/interface/io/blkif.h
===================================================================
--- head-2008-11-10.orig/include/xen/interface/io/blkif.h 2008-11-10 11:49:25.000000000 +0100
+++ head-2008-11-10/include/xen/interface/io/blkif.h 2008-11-10 12:15:51.000000000 +0100
@@ -76,6 +76,10 @@
* "feature-flush-cache" node!
*/
#define BLKIF_OP_FLUSH_DISKCACHE 3
+/*
+ * Device specific command packet contained within the request
+ */
+#define BLKIF_OP_PACKET 4
/*
* Maximum scatter/gather segments per request.

View File

@@ -0,0 +1,692 @@
From: plc@novell.com
Subject: implement forwarding of CD-ROM specific commands
Patch-mainline: obsolete
References: fate#300964
Index: head-2008-10-24/drivers/cdrom/Makefile
===================================================================
--- head-2008-10-24.orig/drivers/cdrom/Makefile 2008-10-24 14:05:33.000000000 +0200
+++ head-2008-10-24/drivers/cdrom/Makefile 2008-10-01 16:35:07.000000000 +0200
@@ -9,6 +9,7 @@ obj-$(CONFIG_BLK_DEV_IDECD) +=
obj-$(CONFIG_BLK_DEV_SR) += cdrom.o
obj-$(CONFIG_PARIDE_PCD) += cdrom.o
obj-$(CONFIG_CDROM_PKTCDVD) += cdrom.o
+obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += cdrom.o
obj-$(CONFIG_VIOCD) += viocd.o cdrom.o
obj-$(CONFIG_GDROM) += gdrom.o cdrom.o
Index: head-2008-10-24/drivers/xen/blkfront/Makefile
===================================================================
--- head-2008-10-24.orig/drivers/xen/blkfront/Makefile 2008-10-24 14:05:33.000000000 +0200
+++ head-2008-10-24/drivers/xen/blkfront/Makefile 2008-10-01 16:35:07.000000000 +0200
@@ -1,5 +1,5 @@
obj-$(CONFIG_XEN_BLKDEV_FRONTEND) := xenblk.o
-xenblk-objs := blkfront.o vbd.o
+xenblk-objs := blkfront.o vbd.o vcd.o
Index: head-2008-10-24/drivers/xen/blkfront/blkfront.c
===================================================================
--- head-2008-10-24.orig/drivers/xen/blkfront/blkfront.c 2008-10-01 16:35:04.000000000 +0200
+++ head-2008-10-24/drivers/xen/blkfront/blkfront.c 2008-10-01 16:35:07.000000000 +0200
@@ -372,6 +372,8 @@ static void connect(struct blkfront_info
add_disk(info->gd);
info->is_ready = 1;
+
+ register_vcd(info);
}
/**
@@ -402,6 +404,8 @@ static void blkfront_closing(struct xenb
xlvbd_sysfs_delif(info);
+ unregister_vcd(info);
+
xlvbd_del(info);
out:
Index: head-2008-10-24/drivers/xen/blkfront/block.h
===================================================================
--- head-2008-10-24.orig/drivers/xen/blkfront/block.h 2008-10-24 14:05:33.000000000 +0200
+++ head-2008-10-24/drivers/xen/blkfront/block.h 2008-10-01 16:35:07.000000000 +0200
@@ -154,4 +154,8 @@ static inline void xlvbd_sysfs_delif(str
}
#endif
+/* Virtual cdrom block-device */
+extern void register_vcd(struct blkfront_info *info);
+extern void unregister_vcd(struct blkfront_info *info);
+
#endif /* __XEN_DRIVERS_BLOCK_H__ */
Index: head-2008-10-24/drivers/xen/blkfront/vbd.c
===================================================================
--- head-2008-10-24.orig/drivers/xen/blkfront/vbd.c 2008-10-24 14:05:33.000000000 +0200
+++ head-2008-10-24/drivers/xen/blkfront/vbd.c 2008-10-24 14:08:33.000000000 +0200
@@ -281,7 +281,8 @@ xlvbd_add(blkif_sector_t capacity, int v
goto out;
info->mi = mi;
- if ((minor & ((1 << mi->type->partn_shift) - 1)) == 0)
+ if (!(vdisk_info & VDISK_CDROM) &&
+ (minor & ((1 << mi->type->partn_shift) - 1)) == 0)
nr_minors = 1 << mi->type->partn_shift;
gd = alloc_disk(nr_minors);
@@ -290,7 +291,7 @@ xlvbd_add(blkif_sector_t capacity, int v
offset = mi->index * mi->type->disks_per_major +
(minor >> mi->type->partn_shift);
- if (nr_minors > 1) {
+ if (nr_minors > 1 || (vdisk_info & VDISK_CDROM)) {
if (offset < 26) {
sprintf(gd->disk_name, "%s%c",
mi->type->diskname, 'a' + offset );
Index: head-2008-10-24/drivers/xen/blkfront/vcd.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ head-2008-10-24/drivers/xen/blkfront/vcd.c 2008-10-01 16:35:07.000000000 +0200
@@ -0,0 +1,476 @@
+/*******************************************************************************
+* vcd.c
+*
+* Implements CDROM cmd packet passing between frontend guest and backend driver.
+*
+* Copyright (c) 2008, Pat Campell plc@novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this source file (the "Software"), to deal in the Software without
+* restriction, including without limitation the rights to use, copy, modify,
+* merge, publish, distribute, sublicense, and/or sell copies of the Software,
+* and to permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+* IN THE SOFTWARE.
+*/
+
+#define REVISION "$Revision: 1.0 $"
+
+#include <linux/module.h>
+#include <linux/blkdev.h>
+#include <linux/list.h>
+#include <linux/cdrom.h>
+#include <xen/interface/io/cdromif.h>
+#include "block.h"
+
+/* List of cdrom_device_info, can have as many as blkfront supports */
+struct vcd_disk {
+ struct list_head vcd_entry;
+ struct cdrom_device_info vcd_cdrom_info;
+ spinlock_t vcd_cdrom_info_lock;
+};
+static LIST_HEAD(vcd_disks);
+static DEFINE_SPINLOCK(vcd_disks_lock);
+
+static struct vcd_disk * xencdrom_get_list_entry(struct gendisk *disk)
+{
+ struct vcd_disk * ret_vcd = NULL;
+ struct vcd_disk * vcd;
+
+ spin_lock(&vcd_disks_lock);
+ list_for_each_entry(vcd, &vcd_disks, vcd_entry) {
+ if (vcd->vcd_cdrom_info.disk == disk) {
+ spin_lock(&vcd->vcd_cdrom_info_lock);
+ ret_vcd = vcd;
+ break;
+ }
+ }
+ spin_unlock(&vcd_disks_lock);
+ return ret_vcd;
+}
+
+static void submit_message(struct blkfront_info *info, void * sp)
+{
+ struct request *req = NULL;
+
+ req = blk_get_request(info->rq, READ, __GFP_WAIT);
+ if (blk_rq_map_kern(info->rq, req, sp, PAGE_SIZE, __GFP_WAIT))
+ goto out;
+
+ req->rq_disk = info->gd;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
+ req->cmd_type = REQ_TYPE_BLOCK_PC;
+ req->cmd_flags |= REQ_NOMERGE;
+#else
+ req->flags |= REQ_BLOCK_PC;
+#endif
+ req->sector = 0;
+ req->nr_sectors = 1;
+ req->timeout = 60*HZ;
+
+ blk_execute_rq(req->q, info->gd, req, 1);
+
+out:
+ blk_put_request(req);
+}
+
+static int submit_cdrom_cmd(struct blkfront_info *info,
+ struct packet_command * cgc)
+{
+ int ret = 0;
+ struct page *page;
+ size_t size;
+ union xen_block_packet *sp;
+ struct xen_cdrom_packet *xcp;
+ struct vcd_generic_command * vgc;
+
+ if (cgc->buffer && cgc->buflen > MAX_PACKET_DATA) {
+ printk(KERN_WARNING "%s() Packet buffer length is to large \n", __func__);
+ return -EIO;
+ }
+
+ page = alloc_page(GFP_NOIO);
+ if (!page) {
+ printk(KERN_CRIT "%s() Unable to allocate page\n", __func__);
+ return -ENOMEM;
+ }
+
+ size = PAGE_SIZE;
+ memset(page_address(page), 0, PAGE_SIZE);
+ sp = page_address(page);
+ xcp = &(sp->xcp);
+ xcp->type = XEN_TYPE_CDROM_PACKET;
+ xcp->payload_offset = PACKET_PAYLOAD_OFFSET;
+
+ vgc = (struct vcd_generic_command *)((char *)sp + xcp->payload_offset);
+ memcpy(vgc->cmd, cgc->cmd, CDROM_PACKET_SIZE);
+ vgc->stat = cgc->stat;
+ vgc->data_direction = cgc->data_direction;
+ vgc->quiet = cgc->quiet;
+ vgc->timeout = cgc->timeout;
+ if (cgc->sense) {
+ vgc->sense_offset = PACKET_SENSE_OFFSET;
+ memcpy((char *)sp + vgc->sense_offset, cgc->sense, sizeof(struct request_sense));
+ }
+ if (cgc->buffer) {
+ vgc->buffer_offset = PACKET_BUFFER_OFFSET;
+ memcpy((char *)sp + vgc->buffer_offset, cgc->buffer, cgc->buflen);
+ vgc->buflen = cgc->buflen;
+ }
+
+ submit_message(info,sp);
+
+ if (xcp->ret)
+ ret = xcp->err;
+
+ if (cgc->sense) {
+ memcpy(cgc->sense, (char *)sp + PACKET_SENSE_OFFSET, sizeof(struct request_sense));
+ }
+ if (cgc->buffer && cgc->buflen) {
+ memcpy(cgc->buffer, (char *)sp + PACKET_BUFFER_OFFSET, cgc->buflen);
+ }
+
+ __free_page(page);
+ return ret;
+}
+
+
+static int xencdrom_open(struct cdrom_device_info *cdi, int purpose)
+{
+ int ret = 0;
+ struct page *page;
+ struct blkfront_info *info;
+ union xen_block_packet *sp;
+ struct xen_cdrom_open *xco;
+
+ info = cdi->disk->private_data;
+
+ if (strlen(info->xbdev->otherend) > MAX_PACKET_DATA) {
+ return -EIO;
+ }
+
+ page = alloc_page(GFP_NOIO);
+ if (!page) {
+ printk(KERN_CRIT "%s() Unable to allocate page\n", __func__);
+ return -ENOMEM;
+ }
+
+ memset(page_address(page), 0, PAGE_SIZE);
+ sp = page_address(page);
+ xco = &(sp->xco);
+ xco->type = XEN_TYPE_CDROM_OPEN;
+ xco->payload_offset = sizeof(struct xen_cdrom_open);
+ strcpy((char *)sp + xco->payload_offset, info->xbdev->otherend);
+
+ submit_message(info,sp);
+
+ if (xco->ret) {
+ ret = xco->err;
+ goto out;
+ }
+
+ if (xco->media_present)
+ set_capacity(cdi->disk, xco->sectors);
+
+out:
+ __free_page(page);
+ return ret;
+}
+
+static void xencdrom_release(struct cdrom_device_info *cdi)
+{
+}
+
+static int xencdrom_media_changed(struct cdrom_device_info *cdi, int disc_nr)
+{
+ int ret;
+ struct page *page;
+ struct blkfront_info *info;
+ union xen_block_packet *sp;
+ struct xen_cdrom_media_changed *xcmc;
+
+ info = cdi->disk->private_data;
+
+ page = alloc_page(GFP_NOIO);
+ if (!page) {
+ printk(KERN_CRIT "%s() Unable to allocate page\n", __func__);
+ return -ENOMEM;
+ }
+
+ memset(page_address(page), 0, PAGE_SIZE);
+ sp = page_address(page);
+ xcmc = &(sp->xcmc);
+ xcmc->type = XEN_TYPE_CDROM_MEDIA_CHANGED;
+ submit_message(info,sp);
+ ret = xcmc->media_changed;
+
+ __free_page(page);
+
+ return ret;
+}
+
+static int xencdrom_tray_move(struct cdrom_device_info *cdi, int position)
+{
+ int ret;
+ struct packet_command cgc;
+ struct blkfront_info *info;
+
+ info = cdi->disk->private_data;
+ init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
+ cgc.cmd[0] = GPCMD_START_STOP_UNIT;
+ if (position)
+ cgc.cmd[4] = 2;
+ else
+ cgc.cmd[4] = 3;
+ ret = submit_cdrom_cmd(info, &cgc);
+ return ret;
+}
+
+static int xencdrom_lock_door(struct cdrom_device_info *cdi, int lock)
+{
+ int ret = 0;
+ struct blkfront_info *info;
+ struct packet_command cgc;
+
+ info = cdi->disk->private_data;
+ init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
+ cgc.cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
+ cgc.cmd[4] = lock;
+ ret = submit_cdrom_cmd(info, &cgc);
+ return ret;
+}
+
+static int xencdrom_packet(struct cdrom_device_info *cdi,
+ struct packet_command *cgc)
+{
+ int ret = -EIO;
+ struct blkfront_info *info;
+
+ info = cdi->disk->private_data;
+ ret = submit_cdrom_cmd(info, cgc);
+ cgc->stat = ret;
+ return ret;
+}
+
+static int xencdrom_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
+ void *arg)
+{
+ return -EINVAL;
+}
+
+/* Query backend to see if CDROM packets are supported */
+static int xencdrom_supported(struct blkfront_info *info)
+{
+ struct page *page;
+ union xen_block_packet *sp;
+ struct xen_cdrom_support *xcs;
+
+ page = alloc_page(GFP_NOIO);
+ if (!page) {
+ printk(KERN_CRIT "%s() Unable to allocate page\n", __func__);
+ return -ENOMEM;
+ }
+
+ memset(page_address(page), 0, PAGE_SIZE);
+ sp = page_address(page);
+ xcs = &(sp->xcs);
+ xcs->type = XEN_TYPE_CDROM_SUPPORT;
+ submit_message(info,sp);
+ return xcs->supported;
+}
+
+static struct cdrom_device_ops xencdrom_dops = {
+ .open = xencdrom_open,
+ .release = xencdrom_release,
+ .media_changed = xencdrom_media_changed,
+ .tray_move = xencdrom_tray_move,
+ .lock_door = xencdrom_lock_door,
+ .generic_packet = xencdrom_packet,
+ .audio_ioctl = xencdrom_audio_ioctl,
+ .capability = (CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | \
+ CDC_MEDIA_CHANGED | CDC_GENERIC_PACKET | CDC_DVD | \
+ CDC_CD_R),
+ .n_minors = 1,
+};
+
+static int xencdrom_block_open(struct inode *inode, struct file *file)
+{
+ struct blkfront_info *info = inode->i_bdev->bd_disk->private_data;
+ struct vcd_disk * vcd;
+ int ret = 0;
+
+ if ((vcd = xencdrom_get_list_entry(info->gd))) {
+ ret = cdrom_open(&vcd->vcd_cdrom_info, inode, file);
+ info->users = vcd->vcd_cdrom_info.use_count;
+ spin_unlock(&vcd->vcd_cdrom_info_lock);
+ }
+ return ret;
+}
+
+static int xencdrom_block_release(struct inode *inode, struct file *file)
+{
+ struct blkfront_info *info = inode->i_bdev->bd_disk->private_data;
+ struct vcd_disk * vcd;
+ int ret = 0;
+
+ if ((vcd = xencdrom_get_list_entry(info->gd))) {
+ ret = cdrom_release(&vcd->vcd_cdrom_info, file);
+ spin_unlock(&vcd->vcd_cdrom_info_lock);
+ if (vcd->vcd_cdrom_info.use_count == 0) {
+ info->users = 1;
+ blkif_release(inode, file);
+ }
+ }
+ return ret;
+}
+
+static int xencdrom_block_ioctl(struct inode *inode, struct file *file,
+ unsigned cmd, unsigned long arg)
+{
+ struct blkfront_info *info = inode->i_bdev->bd_disk->private_data;
+ struct vcd_disk * vcd;
+ int ret = 0;
+
+ if (!(vcd = xencdrom_get_list_entry(info->gd)))
+ goto out;
+
+ switch (cmd) {
+ case 2285: /* SG_IO */
+ ret = -ENOSYS;
+ break;
+ case CDROMEJECT:
+ ret = xencdrom_tray_move(&vcd->vcd_cdrom_info, 1);
+ break;
+ case CDROMCLOSETRAY:
+ ret = xencdrom_tray_move(&vcd->vcd_cdrom_info, 0);
+ break;
+ case CDROM_GET_CAPABILITY:
+ ret = vcd->vcd_cdrom_info.ops->capability & ~vcd->vcd_cdrom_info.mask;
+ break;
+ case CDROM_SET_OPTIONS:
+ ret = vcd->vcd_cdrom_info.options;
+ break;
+ case CDROM_SEND_PACKET:
+ {
+ struct packet_command * cgc = (struct packet_command *)arg;
+ ret = submit_cdrom_cmd(info, cgc);
+ }
+ break;
+ default:
+ /* Not supported, augment supported above if necessary */
+ printk( "%s():%d Unsupported IOCTL:%x \n", __func__, __LINE__, cmd);
+ ret = -ENOTTY;
+ break;
+ }
+ spin_unlock(&vcd->vcd_cdrom_info_lock);
+out:
+ return ret;
+}
+
+/* Called as result of cdrom_open, vcd_cdrom_info_lock already held */
+static int xencdrom_block_media_changed(struct gendisk *disk)
+{
+ struct vcd_disk * vcd;
+ struct vcd_disk * ret_vcd = NULL;
+ int ret = 0;
+
+ spin_lock(&vcd_disks_lock);
+ list_for_each_entry(vcd, &vcd_disks, vcd_entry) {
+ if (vcd->vcd_cdrom_info.disk == disk) {
+ ret_vcd = vcd;
+ break;
+ }
+ }
+ spin_unlock(&vcd_disks_lock);
+ if (ret_vcd) {
+ ret = cdrom_media_changed(&ret_vcd->vcd_cdrom_info);
+ }
+ return ret;
+}
+
+static struct block_device_operations xencdrom_bdops =
+{
+ .owner = THIS_MODULE,
+ .open = xencdrom_block_open,
+ .release = xencdrom_block_release,
+ .ioctl = xencdrom_block_ioctl,
+ .media_changed = xencdrom_block_media_changed,
+};
+
+void register_vcd(struct blkfront_info *info)
+{
+ struct gendisk * gd = info->gd;
+ struct vcd_disk * vcd;
+
+ /* Make sure this is for a CD device */
+ if (!(gd->flags & GENHD_FL_CD))
+ goto out;
+
+ /* Make sure we have backend support */
+ if (!xencdrom_supported(info)) {
+ goto out;
+ }
+
+ /* Create new vcd_disk and fill in cdrom_info */
+ vcd = (struct vcd_disk *)kzalloc(sizeof(struct vcd_disk), GFP_KERNEL);
+ if (!vcd) {
+ printk(KERN_INFO "%s(): Unable to allocate vcd struct!\n", __func__);
+ goto out;
+ }
+ spin_lock_init(&vcd->vcd_cdrom_info_lock);
+
+ vcd->vcd_cdrom_info.ops = &xencdrom_dops;
+ vcd->vcd_cdrom_info.speed = 4;
+ vcd->vcd_cdrom_info.capacity = 1;
+ vcd->vcd_cdrom_info.options = 0;
+ strcpy(vcd->vcd_cdrom_info.name, gd->disk_name);
+ vcd->vcd_cdrom_info.mask = ( CDC_CD_RW | CDC_DVD_R | CDC_DVD_RAM |
+ CDC_SELECT_DISC | CDC_SELECT_SPEED |
+ CDC_MRW | CDC_MRW_W | CDC_RAM);
+
+ if (register_cdrom(&(vcd->vcd_cdrom_info)) != 0) {
+ printk(KERN_WARNING "%s() Cannot register blkdev as a cdrom %d!\n", __func__,
+ gd->major);
+ goto err_out;
+ }
+ xencdrom_bdops.owner = gd->fops->owner;
+ gd->fops = &xencdrom_bdops;
+ vcd->vcd_cdrom_info.disk = gd;
+
+ spin_lock(&vcd_disks_lock);
+ list_add(&(vcd->vcd_entry), &vcd_disks);
+ spin_unlock(&vcd_disks_lock);
+out:
+ return;
+err_out:
+ kfree(vcd);
+}
+
+void unregister_vcd(struct blkfront_info *info) {
+ struct gendisk * gd = info->gd;
+ struct vcd_disk * vcd;
+
+ spin_lock(&vcd_disks_lock);
+ list_for_each_entry(vcd, &vcd_disks, vcd_entry) {
+ if (vcd->vcd_cdrom_info.disk == gd) {
+ spin_lock(&vcd->vcd_cdrom_info_lock);
+ unregister_cdrom(&vcd->vcd_cdrom_info);
+ list_del(&vcd->vcd_entry);
+ spin_unlock(&vcd->vcd_cdrom_info_lock);
+ kfree(vcd);
+ break;
+ }
+ }
+ spin_unlock(&vcd_disks_lock);
+}
+
Index: head-2008-10-24/include/xen/interface/io/cdromif.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ head-2008-10-24/include/xen/interface/io/cdromif.h 2008-10-01 16:35:07.000000000 +0200
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * cdromif.h
+ *
+ * Shared definitions between backend driver and Xen guest Virtual CDROM
+ * block device.
+ *
+ * Copyright (c) 2008, Pat Campell plc@novell.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __XEN_PUBLIC_IO_CDROMIF_H__
+#define __XEN_PUBLIC_IO_CDROMIF_H__
+
+/*
+ * Queries backend for CDROM support
+ */
+#define XEN_TYPE_CDROM_SUPPORT _IO('c', 1)
+
+struct xen_cdrom_support
+{
+ uint32_t type;
+ int8_t ret; /* returned, 0 succeded, -1 error */
+ int8_t err; /* returned, backend errno */
+ int8_t supported; /* returned, 1 supported */
+};
+
+/*
+ * Opens backend device, returns drive geometry or
+ * any encountered errors
+ */
+#define XEN_TYPE_CDROM_OPEN _IO('c', 2)
+
+struct xen_cdrom_open
+{
+ uint32_t type;
+ int8_t ret;
+ int8_t err;
+ int8_t pad;
+ int8_t media_present; /* returned */
+ uint32_t sectors; /* returned */
+ uint32_t sector_size; /* returned */
+ int32_t payload_offset; /* offset to backend node name payload */
+};
+
+/*
+ * Queries backend for media changed status
+ */
+#define XEN_TYPE_CDROM_MEDIA_CHANGED _IO('c', 3)
+
+struct xen_cdrom_media_changed
+{
+ uint32_t type;
+ int8_t ret;
+ int8_t err;
+ int8_t media_changed; /* returned */
+};
+
+/*
+ * Sends vcd generic CDROM packet to backend, followed
+ * immediately by the vcd_generic_command payload
+ */
+#define XEN_TYPE_CDROM_PACKET _IO('c', 4)
+
+struct xen_cdrom_packet
+{
+ uint32_t type;
+ int8_t ret;
+ int8_t err;
+ int8_t pad[2];
+ int32_t payload_offset; /* offset to vcd_generic_command payload */
+};
+
+/* CDROM_PACKET_COMMAND, payload for XEN_TYPE_CDROM_PACKET */
+struct vcd_generic_command
+{
+ uint8_t cmd[CDROM_PACKET_SIZE];
+ uint8_t pad[4];
+ uint32_t buffer_offset;
+ uint32_t buflen;
+ int32_t stat;
+ uint32_t sense_offset;
+ uint8_t data_direction;
+ uint8_t pad1[3];
+ int32_t quiet;
+ int32_t timeout;
+};
+
+union xen_block_packet
+{
+ uint32_t type;
+ struct xen_cdrom_support xcs;
+ struct xen_cdrom_open xco;
+ struct xen_cdrom_media_changed xcmc;
+ struct xen_cdrom_packet xcp;
+};
+
+#define PACKET_PAYLOAD_OFFSET (sizeof(struct xen_cdrom_packet))
+#define PACKET_SENSE_OFFSET (PACKET_PAYLOAD_OFFSET + sizeof(struct vcd_generic_command))
+#define PACKET_BUFFER_OFFSET (PACKET_SENSE_OFFSET + sizeof(struct request_sense))
+#define MAX_PACKET_DATA (PAGE_SIZE - sizeof(struct xen_cdrom_packet) - \
+ sizeof(struct vcd_generic_command) - sizeof(struct request_sense))
+
+#endif

View File

@@ -0,0 +1,174 @@
From: jbeulich@novell.com
Subject: fix placement of some routines/data
Patch-mainline: obsolete
Index: head-2008-12-01/arch/x86/kernel/e820-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/e820-xen.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/e820-xen.c 2008-12-01 12:07:15.000000000 +0100
@@ -42,7 +42,7 @@
* user can e.g. boot the original kernel with mem=1G while still booting the
* next kernel with full memory.
*/
-struct e820map e820;
+struct e820map __initdata e820;
struct e820map e820_saved;
#ifdef CONFIG_XEN
static struct e820map machine_e820;
Index: head-2008-12-01/arch/x86/kernel/process_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/process_32-xen.c 2008-12-01 12:06:01.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/process_32-xen.c 2008-12-01 12:07:15.000000000 +0100
@@ -99,7 +99,7 @@ static void cpu_exit_clear(void)
}
#endif
-static inline void play_dead(void)
+static void __ref play_dead(void)
{
idle_task_exit();
local_irq_disable();
Index: head-2008-12-01/arch/x86/kernel/process_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/process_64-xen.c 2008-12-01 12:06:01.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/process_64-xen.c 2008-12-01 12:07:15.000000000 +0100
@@ -95,7 +95,7 @@ void exit_idle(void)
}
#ifdef CONFIG_HOTPLUG_CPU
-static inline void play_dead(void)
+static void __ref play_dead(void)
{
idle_task_exit();
#ifndef CONFIG_XEN
Index: head-2008-12-01/arch/x86/kernel/time_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/time_32-xen.c 2008-12-01 11:58:30.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/time_32-xen.c 2008-12-01 12:07:15.000000000 +0100
@@ -704,7 +704,7 @@ int xen_update_persistent_clock(void)
/* Dynamically-mapped IRQ. */
DEFINE_PER_CPU(int, timer_irq);
-static void setup_cpu0_timer_irq(void)
+static void __init setup_cpu0_timer_irq(void)
{
per_cpu(timer_irq, 0) =
bind_virq_to_irqhandler(
@@ -915,7 +915,7 @@ int __cpuinit local_setup_timer(unsigned
return 0;
}
-void __cpuexit local_teardown_timer(unsigned int cpu)
+void __cpuinit local_teardown_timer(unsigned int cpu)
{
BUG_ON(cpu == 0);
unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL);
Index: head-2008-12-01/arch/x86/mm/ioremap-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/ioremap-xen.c 2008-12-01 12:03:09.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/ioremap-xen.c 2008-12-01 12:07:15.000000000 +0100
@@ -201,7 +201,8 @@ int touch_pte_range(struct mm_struct *mm
EXPORT_SYMBOL(touch_pte_range);
-int page_is_ram(unsigned long pagenr)
+#ifdef CONFIG_X86_32
+int __init page_is_ram(unsigned long pagenr)
{
resource_size_t addr, end;
int i;
@@ -239,6 +240,7 @@ int page_is_ram(unsigned long pagenr)
}
return 0;
}
+#endif
/*
* Fix up the linear direct mapping of the kernel to avoid cache attribute
Index: head-2008-12-01/drivers/xen/core/cpu_hotplug.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/cpu_hotplug.c 2008-01-21 11:15:26.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/cpu_hotplug.c 2008-12-01 12:07:15.000000000 +0100
@@ -24,7 +24,7 @@ static int local_cpu_hotplug_request(voi
return (current->mm != NULL);
}
-static void vcpu_hotplug(unsigned int cpu)
+static void __cpuinit vcpu_hotplug(unsigned int cpu)
{
int err;
char dir[32], state[32];
@@ -51,7 +51,7 @@ static void vcpu_hotplug(unsigned int cp
}
}
-static void handle_vcpu_hotplug_event(
+static void __cpuinit handle_vcpu_hotplug_event(
struct xenbus_watch *watch, const char **vec, unsigned int len)
{
unsigned int cpu;
@@ -80,12 +80,12 @@ static int smpboot_cpu_notify(struct not
return NOTIFY_OK;
}
-static int setup_cpu_watcher(struct notifier_block *notifier,
- unsigned long event, void *data)
+static int __cpuinit setup_cpu_watcher(struct notifier_block *notifier,
+ unsigned long event, void *data)
{
unsigned int i;
- static struct xenbus_watch cpu_watch = {
+ static struct xenbus_watch __cpuinitdata cpu_watch = {
.node = "cpu",
.callback = handle_vcpu_hotplug_event,
.flags = XBWF_new_thread };
@@ -105,7 +105,7 @@ static int __init setup_vcpu_hotplug_eve
{
static struct notifier_block hotplug_cpu = {
.notifier_call = smpboot_cpu_notify };
- static struct notifier_block xsn_cpu = {
+ static struct notifier_block __cpuinitdata xsn_cpu = {
.notifier_call = setup_cpu_watcher };
if (!is_running_on_xen())
@@ -119,7 +119,7 @@ static int __init setup_vcpu_hotplug_eve
arch_initcall(setup_vcpu_hotplug_event);
-int smp_suspend(void)
+int __ref smp_suspend(void)
{
unsigned int cpu;
int err;
@@ -140,7 +140,7 @@ int smp_suspend(void)
return 0;
}
-void smp_resume(void)
+void __ref smp_resume(void)
{
unsigned int cpu;
Index: head-2008-12-01/drivers/xen/core/smpboot.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/smpboot.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/smpboot.c 2008-12-01 12:07:15.000000000 +0100
@@ -176,7 +176,7 @@ static int __cpuinit xen_smp_intr_init(u
}
#ifdef CONFIG_HOTPLUG_CPU
-static void __cpuexit xen_smp_intr_exit(unsigned int cpu)
+static void __cpuinit xen_smp_intr_exit(unsigned int cpu)
{
if (cpu != 0)
local_teardown_timer(cpu);
@@ -395,7 +395,7 @@ int __cpuexit __cpu_disable(void)
return 0;
}
-void __cpuexit __cpu_die(unsigned int cpu)
+void __cpuinit __cpu_die(unsigned int cpu)
{
while (HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL)) {
current->state = TASK_UNINTERRUPTIBLE;

View File

@@ -0,0 +1,26 @@
From: jbeulich@novell.com
Subject: add 3.2.0-compatibility configure option
Patch-mainline: obsolete
Index: head-2008-10-24/drivers/xen/Kconfig
===================================================================
--- head-2008-10-24.orig/drivers/xen/Kconfig 2008-10-24 10:46:02.000000000 +0200
+++ head-2008-10-24/drivers/xen/Kconfig 2008-10-24 10:52:17.000000000 +0200
@@ -267,6 +267,9 @@ choice
config XEN_COMPAT_030100_AND_LATER
bool "3.1.0 and later"
+ config XEN_COMPAT_030200_AND_LATER
+ bool "3.2.0 and later"
+
config XEN_COMPAT_LATEST_ONLY
bool "no compatibility code"
@@ -275,6 +278,7 @@ endchoice
config XEN_COMPAT
hex
default 0xffffff if XEN_COMPAT_LATEST_ONLY
+ default 0x030200 if XEN_COMPAT_030200_AND_LATER
default 0x030100 if XEN_COMPAT_030100_AND_LATER
default 0x030004 if XEN_COMPAT_030004_AND_LATER
default 0x030002 if XEN_COMPAT_030002_AND_LATER

View File

@@ -0,0 +1,65 @@
From: jbeulich@novell.com
Subject: make /proc/cpuinfo track CPU speed
Patch-mainline: obsolete
Index: head-2008-10-01/arch/x86/kernel/acpi/processor_extcntl_xen.c
===================================================================
--- head-2008-10-01.orig/arch/x86/kernel/acpi/processor_extcntl_xen.c 2008-10-01 15:43:24.000000000 +0200
+++ head-2008-10-01/arch/x86/kernel/acpi/processor_extcntl_xen.c 2008-10-01 16:44:34.000000000 +0200
@@ -207,3 +207,14 @@ void arch_acpi_processor_init_extcntl(co
*ops = &xen_extcntl_ops;
}
EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
+
+unsigned int cpufreq_quick_get(unsigned int cpu)
+{
+ xen_platform_op_t op = {
+ .cmd = XENPF_get_cpu_freq,
+ .interface_version = XENPF_INTERFACE_VERSION,
+ .u.get_cpu_freq.vcpu = cpu
+ };
+
+ return HYPERVISOR_platform_op(&op) == 0 ? op.u.get_cpu_freq.freq : 0;
+}
Index: head-2008-10-01/include/linux/cpufreq.h
===================================================================
--- head-2008-10-01.orig/include/linux/cpufreq.h 2008-10-01 14:44:59.000000000 +0200
+++ head-2008-10-01/include/linux/cpufreq.h 2008-10-01 16:44:34.000000000 +0200
@@ -282,7 +282,7 @@ int cpufreq_update_policy(unsigned int c
unsigned int cpufreq_get(unsigned int cpu);
/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
-#ifdef CONFIG_CPU_FREQ
+#if defined(CONFIG_CPU_FREQ) || defined(CONFIG_PROCESSOR_EXTERNAL_CONTROL)
unsigned int cpufreq_quick_get(unsigned int cpu);
#else
static inline unsigned int cpufreq_quick_get(unsigned int cpu)
Index: head-2008-10-01/include/xen/interface/platform.h
===================================================================
--- head-2008-10-01.orig/include/xen/interface/platform.h 2008-09-25 13:55:33.000000000 +0200
+++ head-2008-10-01/include/xen/interface/platform.h 2008-10-01 16:44:34.000000000 +0200
@@ -312,6 +312,16 @@ struct xenpf_set_processor_pminfo {
typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t);
+#define XENPF_get_cpu_freq ('N' << 24)
+struct xenpf_get_cpu_freq {
+ /* IN variables */
+ uint32_t vcpu;
+ /* OUT variables */
+ uint32_t freq; /* in kHz */
+};
+typedef struct xenpf_get_cpu_freq xenpf_get_cpu_freq_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_get_cpu_freq_t);
+
struct xen_platform_op {
uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -327,6 +337,7 @@ struct xen_platform_op {
struct xenpf_change_freq change_freq;
struct xenpf_getidletime getidletime;
struct xenpf_set_processor_pminfo set_pminfo;
+ struct xenpf_get_cpu_freq get_cpu_freq;
uint8_t pad[128];
} u;
};

View File

@@ -0,0 +1,18 @@
From: jbeulich@novell.com
Subject: fix issue with Windows-style types used in rt2680
Patch-mainline: obsolete
Index: head-2008-11-17/include/asm-x86/mach-xen/asm/hypervisor.h
===================================================================
--- head-2008-11-17.orig/include/asm-x86/mach-xen/asm/hypervisor.h 2008-11-17 14:06:21.000000000 +0100
+++ head-2008-11-17/include/asm-x86/mach-xen/asm/hypervisor.h 2008-11-18 14:12:19.000000000 +0100
@@ -340,4 +340,9 @@ MULTI_grant_table_op(multicall_entry_t *
#endif
+#ifdef LINUX
+/* drivers/staging/rt2860/ uses Windows-style types, including VOID */
+#undef VOID
+#endif
+
#endif /* __HYPERVISOR_H__ */

View File

@@ -0,0 +1,388 @@
From: jbeulich@novell.com
Subject: use base kernel suspend/resume infrastructure
Patch-mainline: obsolete
... rather than calling just a few functions explicitly.
Index: head-2008-12-01/arch/x86/kernel/time_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/time_32-xen.c 2008-12-01 12:07:15.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/time_32-xen.c 2008-12-01 12:07:30.000000000 +0100
@@ -88,6 +88,10 @@ static DEFINE_PER_CPU(struct vcpu_runsta
/* Must be signed, as it's compared with s64 quantities which can be -ve. */
#define NS_PER_TICK (1000000000LL/HZ)
+static struct vcpu_set_periodic_timer xen_set_periodic_tick = {
+ .period_ns = NS_PER_TICK
+};
+
static void __clock_was_set(struct work_struct *unused)
{
clock_was_set();
@@ -599,6 +603,25 @@ void mark_tsc_unstable(char *reason)
}
EXPORT_SYMBOL_GPL(mark_tsc_unstable);
+static void init_missing_ticks_accounting(unsigned int cpu)
+{
+ struct vcpu_register_runstate_memory_area area;
+ struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
+ int rc;
+
+ memset(runstate, 0, sizeof(*runstate));
+
+ area.addr.v = runstate;
+ rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
+ WARN_ON(rc && rc != -ENOSYS);
+
+ per_cpu(processed_blocked_time, cpu) =
+ runstate->time[RUNSTATE_blocked];
+ per_cpu(processed_stolen_time, cpu) =
+ runstate->time[RUNSTATE_runnable] +
+ runstate->time[RUNSTATE_offline];
+}
+
static cycle_t cs_last;
static cycle_t xen_clocksource_read(void)
@@ -635,11 +658,34 @@ static cycle_t xen_clocksource_read(void
#endif
}
+/* No locking required. Interrupts are disabled on all CPUs. */
static void xen_clocksource_resume(void)
{
- extern void time_resume(void);
+ unsigned int cpu;
+
+ init_cpu_khz();
+
+ for_each_online_cpu(cpu) {
+ switch (HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
+ &xen_set_periodic_tick)) {
+ case 0:
+#if CONFIG_XEN_COMPAT <= 0x030004
+ case -ENOSYS:
+#endif
+ break;
+ default:
+ BUG();
+ }
+ get_time_values_from_xen(cpu);
+ per_cpu(processed_system_time, cpu) =
+ per_cpu(shadow_time, 0).system_timestamp;
+ init_missing_ticks_accounting(cpu);
+ }
+
+ processed_system_time = per_cpu(shadow_time, 0).system_timestamp;
+
+ update_wallclock();
- time_resume();
cs_last = local_clock();
}
@@ -654,25 +700,6 @@ static struct clocksource clocksource_xe
.resume = xen_clocksource_resume,
};
-static void init_missing_ticks_accounting(unsigned int cpu)
-{
- struct vcpu_register_runstate_memory_area area;
- struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
- int rc;
-
- memset(runstate, 0, sizeof(*runstate));
-
- area.addr.v = runstate;
- rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
- WARN_ON(rc && rc != -ENOSYS);
-
- per_cpu(processed_blocked_time, cpu) =
- runstate->time[RUNSTATE_blocked];
- per_cpu(processed_stolen_time, cpu) =
- runstate->time[RUNSTATE_runnable] +
- runstate->time[RUNSTATE_offline];
-}
-
unsigned long xen_read_persistent_clock(void)
{
const shared_info_t *s = HYPERVISOR_shared_info;
@@ -717,10 +744,6 @@ static void __init setup_cpu0_timer_irq(
BUG_ON(per_cpu(timer_irq, 0) < 0);
}
-static struct vcpu_set_periodic_timer xen_set_periodic_tick = {
- .period_ns = NS_PER_TICK
-};
-
void __init time_init(void)
{
init_cpu_khz();
@@ -844,35 +867,6 @@ void xen_halt(void)
}
EXPORT_SYMBOL(xen_halt);
-/* No locking required. Interrupts are disabled on all CPUs. */
-void time_resume(void)
-{
- unsigned int cpu;
-
- init_cpu_khz();
-
- for_each_online_cpu(cpu) {
- switch (HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
- &xen_set_periodic_tick)) {
- case 0:
-#if CONFIG_XEN_COMPAT <= 0x030004
- case -ENOSYS:
-#endif
- break;
- default:
- BUG();
- }
- get_time_values_from_xen(cpu);
- per_cpu(processed_system_time, cpu) =
- per_cpu(shadow_time, 0).system_timestamp;
- init_missing_ticks_accounting(cpu);
- }
-
- processed_system_time = per_cpu(shadow_time, 0).system_timestamp;
-
- update_wallclock();
-}
-
#ifdef CONFIG_SMP
static char timer_name[NR_CPUS][15];
Index: head-2008-12-01/drivers/xen/core/evtchn.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/evtchn.c 2008-12-02 09:11:31.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/evtchn.c 2008-12-02 09:23:09.000000000 +0100
@@ -35,6 +35,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
+#include <linux/sysdev.h>
#include <linux/version.h>
#include <asm/atomic.h>
#include <asm/system.h>
@@ -1061,9 +1062,20 @@ static void restore_cpu_ipis(unsigned in
}
}
-void irq_resume(void)
+static int evtchn_resume(struct sys_device *dev)
{
unsigned int cpu, irq, evtchn;
+ struct evtchn_status status;
+
+ /* Avoid doing anything in the 'suspend cancelled' case. */
+ status.dom = DOMID_SELF;
+ status.port = evtchn_from_irq(__get_cpu_var(virq_to_irq)[VIRQ_TIMER]);
+ if (HYPERVISOR_event_channel_op(EVTCHNOP_status, &status))
+ BUG();
+ if (status.status == EVTCHNSTAT_virq
+ && status.vcpu == smp_processor_id()
+ && status.u.virq == VIRQ_TIMER)
+ return 0;
init_evtchn_cpu_bindings();
@@ -1094,7 +1106,32 @@ void irq_resume(void)
restore_cpu_ipis(cpu);
}
+ return 0;
+}
+
+static struct sysdev_class evtchn_sysclass = {
+ .name = "evtchn",
+ .resume = evtchn_resume,
+};
+
+static struct sys_device device_evtchn = {
+ .id = 0,
+ .cls = &evtchn_sysclass,
+};
+
+static int __init evtchn_register(void)
+{
+ int err;
+
+ if (is_initial_xendomain())
+ return 0;
+
+ err = sysdev_class_register(&evtchn_sysclass);
+ if (!err)
+ err = sysdev_register(&device_evtchn);
+ return err;
}
+core_initcall(evtchn_register);
#endif
#if defined(CONFIG_X86_IO_APIC)
Index: head-2008-12-01/drivers/xen/core/gnttab.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/gnttab.c 2008-12-02 09:26:17.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/gnttab.c 2008-12-02 09:26:51.000000000 +0100
@@ -35,6 +35,7 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/seqlock.h>
+#include <linux/sysdev.h>
#include <xen/interface/xen.h>
#include <xen/gnttab.h>
#include <asm/pgtable.h>
@@ -704,23 +705,37 @@ EXPORT_SYMBOL(gnttab_post_map_adjust);
#endif /* __HAVE_ARCH_PTE_SPECIAL */
-int gnttab_resume(void)
+static int gnttab_resume(struct sys_device *dev)
{
if (max_nr_grant_frames() < nr_grant_frames)
return -ENOSYS;
return gnttab_map(0, nr_grant_frames - 1);
}
+#define gnttab_resume() gnttab_resume(NULL)
#ifdef CONFIG_PM_SLEEP
-int gnttab_suspend(void)
-{
#ifdef CONFIG_X86
+static int gnttab_suspend(struct sys_device *dev, pm_message_t state)
+{
apply_to_page_range(&init_mm, (unsigned long)shared,
PAGE_SIZE * nr_grant_frames,
unmap_pte_fn, NULL);
-#endif
return 0;
}
+#else
+#define gnttab_suspend NULL
+#endif
+
+static struct sysdev_class gnttab_sysclass = {
+ .name = "gnttab",
+ .resume = gnttab_resume,
+ .suspend = gnttab_suspend,
+};
+
+static struct sys_device device_gnttab = {
+ .id = 0,
+ .cls = &gnttab_sysclass,
+};
#endif
#else /* !CONFIG_XEN */
@@ -800,6 +815,17 @@ int __devinit gnttab_init(void)
if (!is_running_on_xen())
return -ENODEV;
+#if defined(CONFIG_XEN) && defined(CONFIG_PM_SLEEP)
+ if (!is_initial_xendomain()) {
+ int err = sysdev_class_register(&gnttab_sysclass);
+
+ if (!err)
+ err = sysdev_register(&device_gnttab);
+ if (err)
+ return err;
+ }
+#endif
+
nr_grant_frames = 1;
boot_max_nr_grant_frames = __max_nr_grant_frames();
Index: head-2008-12-01/drivers/xen/core/machine_reboot.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/machine_reboot.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/machine_reboot.c 2008-12-01 12:07:30.000000000 +0100
@@ -17,6 +17,7 @@
#include <xen/xencons.h>
#include <xen/cpu_hotplug.h>
#include <xen/interface/vcpu.h>
+#include "../../base/base.h"
#if defined(__i386__) || defined(__x86_64__)
@@ -149,7 +150,6 @@ static int take_machine_down(void *_susp
{
struct suspend *suspend = _suspend;
int suspend_cancelled, err;
- extern void time_resume(void);
if (suspend->fast_suspend) {
BUG_ON(!irqs_disabled());
@@ -175,20 +175,23 @@ static int take_machine_down(void *_susp
}
mm_pin_all();
- gnttab_suspend();
- pre_suspend();
-
- /*
- * This hypercall returns 1 if suspend was cancelled or the domain was
- * merely checkpointed, and 0 if it is resuming in a new domain.
- */
- suspend_cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
+ suspend_cancelled = sysdev_suspend(PMSG_FREEZE);
+ if (!suspend_cancelled) {
+ pre_suspend();
+ /*
+ * This hypercall returns 1 if suspend was cancelled or the domain was
+ * merely checkpointed, and 0 if it is resuming in a new domain.
+ */
+ suspend_cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
+ } else
+ BUG_ON(suspend_cancelled > 0);
suspend->resume_notifier(suspend_cancelled);
- post_suspend(suspend_cancelled);
- gnttab_resume();
+ if (suspend_cancelled >= 0) {
+ post_suspend(suspend_cancelled);
+ sysdev_resume();
+ }
if (!suspend_cancelled) {
- irq_resume();
#ifdef __x86_64__
/*
* Older versions of Xen do not save/restore the user %cr3.
@@ -200,7 +203,6 @@ static int take_machine_down(void *_susp
current->active_mm->pgd)));
#endif
}
- time_resume();
if (!suspend->fast_suspend)
local_irq_enable();
Index: head-2008-12-01/include/xen/evtchn.h
===================================================================
--- head-2008-12-01.orig/include/xen/evtchn.h 2008-12-02 09:25:52.000000000 +0100
+++ head-2008-12-01/include/xen/evtchn.h 2008-12-01 12:07:30.000000000 +0100
@@ -93,7 +93,9 @@ int bind_ipi_to_irqhandler(
*/
void unbind_from_irqhandler(unsigned int irq, void *dev_id);
+#ifndef CONFIG_XEN
void irq_resume(void);
+#endif
/* Entry point for notifications into Linux subsystems. */
asmlinkage void evtchn_do_upcall(struct pt_regs *regs);
Index: head-2008-12-01/include/xen/gnttab.h
===================================================================
--- head-2008-12-01.orig/include/xen/gnttab.h 2008-12-02 09:25:52.000000000 +0100
+++ head-2008-12-01/include/xen/gnttab.h 2008-12-01 12:07:30.000000000 +0100
@@ -110,8 +110,9 @@ static inline void __gnttab_dma_unmap_pa
void gnttab_reset_grant_page(struct page *page);
-int gnttab_suspend(void);
+#ifndef CONFIG_XEN
int gnttab_resume(void);
+#endif
void *arch_gnttab_alloc_shared(unsigned long *frames);

View File

@@ -0,0 +1,725 @@
From: jbeulich@novell.com
Subject: fold IPIs onto a single IRQ each
Patch-mainline: obsolete
Index: head-2008-12-01/arch/x86/kernel/genapic_xen_64.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/genapic_xen_64.c 2008-11-25 13:12:11.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/genapic_xen_64.c 2008-12-01 12:07:34.000000000 +0100
@@ -25,13 +25,9 @@
#include <asm/genapic.h>
#include <xen/evtchn.h>
-DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
-
static inline void __send_IPI_one(unsigned int cpu, int vector)
{
- int irq = per_cpu(ipi_to_irq, cpu)[vector];
- BUG_ON(irq < 0);
- notify_remote_via_irq(irq);
+ notify_remote_via_ipi(vector, cpu);
}
static void xen_send_IPI_shortcut(unsigned int shortcut,
Index: head-2008-12-01/arch/x86/kernel/ipi-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/ipi-xen.c 2008-11-25 13:12:11.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/ipi-xen.c 2008-12-01 12:07:34.000000000 +0100
@@ -48,15 +48,6 @@ static inline int __prepare_ICR2(unsigne
}
#else
#include <xen/evtchn.h>
-
-DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
-
-static inline void __send_IPI_one(unsigned int cpu, int vector)
-{
- int irq = per_cpu(ipi_to_irq, cpu)[vector];
- BUG_ON(irq < 0);
- notify_remote_via_irq(irq);
-}
#endif
void __send_IPI_shortcut(unsigned int shortcut, int vector)
@@ -90,12 +81,12 @@ void __send_IPI_shortcut(unsigned int sh
switch (shortcut) {
case APIC_DEST_SELF:
- __send_IPI_one(smp_processor_id(), vector);
+ notify_remote_via_ipi(vector, smp_processor_id());
break;
case APIC_DEST_ALLBUT:
for_each_online_cpu(cpu)
if (cpu != smp_processor_id())
- __send_IPI_one(cpu, vector);
+ notify_remote_via_ipi(vector, cpu);
break;
default:
printk("XXXXXX __send_IPI_shortcut %08x vector %d\n", shortcut,
@@ -165,7 +156,7 @@ void send_IPI_mask_bitmask(const cpumask
WARN_ON(!cpus_empty(mask));
for_each_online_cpu(cpu)
if (cpu_isset(cpu, cpumask))
- __send_IPI_one(cpu, vector);
+ notify_remote_via_ipi(vector, cpu);
#endif
local_irq_restore(flags);
}
Index: head-2008-12-01/arch/x86/kernel/irq_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/irq_32-xen.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/irq_32-xen.c 2008-12-01 12:07:34.000000000 +0100
@@ -404,6 +404,9 @@ void fixup_irqs(cpumask_t map)
if (irq == 2)
continue;
+ if (irq_desc[irq].status & IRQ_PER_CPU)
+ continue;
+
cpus_and(mask, irq_desc[irq].affinity, map);
if (any_online_cpu(mask) == NR_CPUS) {
/*printk("Breaking affinity for irq %i\n", irq);*/
Index: head-2008-12-01/arch/x86/kernel/irq_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/irq_64-xen.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/irq_64-xen.c 2008-12-01 12:07:34.000000000 +0100
@@ -245,6 +245,7 @@ void fixup_irqs(cpumask_t map)
spin_lock(&irq_desc[irq].lock);
if (!irq_has_action(irq) ||
+ (irq_desc[irq].status & IRQ_PER_CPU) ||
cpus_equal(irq_desc[irq].affinity, map)) {
spin_unlock(&irq_desc[irq].lock);
continue;
Index: head-2008-12-01/drivers/xen/Kconfig
===================================================================
--- head-2008-12-01.orig/drivers/xen/Kconfig 2008-10-24 10:52:17.000000000 +0200
+++ head-2008-12-01/drivers/xen/Kconfig 2008-12-01 12:07:34.000000000 +0100
@@ -4,6 +4,7 @@
config XEN
bool
+ select IRQ_PER_CPU if SMP
if XEN
config XEN_INTERFACE_VERSION
@@ -292,6 +293,9 @@ config HAVE_IRQ_IGNORE_UNHANDLED
config GENERIC_HARDIRQS_NO__DO_IRQ
def_bool y
+config IRQ_PER_CPU
+ bool
+
config NO_IDLE_HZ
def_bool y
Index: head-2008-12-01/drivers/xen/core/evtchn.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/evtchn.c 2008-12-02 09:14:14.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/evtchn.c 2008-12-02 09:14:29.000000000 +0100
@@ -57,6 +57,22 @@ static DEFINE_SPINLOCK(irq_mapping_updat
static int evtchn_to_irq[NR_EVENT_CHANNELS] = {
[0 ... NR_EVENT_CHANNELS-1] = -1 };
+/* IRQ <-> IPI mapping. */
+#ifndef NR_IPIS
+#define NR_IPIS 1
+#endif
+#if defined(CONFIG_SMP) && defined(CONFIG_X86)
+static int ipi_to_irq[NR_IPIS] __read_mostly = {[0 ... NR_IPIS-1] = -1};
+static DEFINE_PER_CPU(int[NR_IPIS], ipi_to_evtchn) = {[0 ... NR_IPIS-1] = -1};
+#else
+#define PER_CPU_IPI_IRQ
+#endif
+#if !defined(CONFIG_SMP) || !defined(PER_CPU_IPI_IRQ)
+#define BUG_IF_IPI(irq) BUG_ON(type_from_irq(irq) == IRQT_IPI)
+#else
+#define BUG_IF_IPI(irq) ((void)(irq))
+#endif
+
/* Packed IRQ information: binding type, sub-type index, and event channel. */
static u32 irq_info[NR_IRQS];
@@ -97,10 +113,12 @@ static inline u32 mk_irq_info(u32 type,
* Accessors for packed IRQ information.
*/
+#ifdef PER_CPU_IPI_IRQ
static inline unsigned int evtchn_from_irq(int irq)
{
return irq_info[irq] & ((1U << _EVTCHN_BITS) - 1);
}
+#endif
static inline unsigned int index_from_irq(int irq)
{
@@ -112,14 +130,28 @@ static inline unsigned int type_from_irq
return irq_info[irq] >> (32 - _IRQT_BITS);
}
+#ifndef PER_CPU_IPI_IRQ
+static inline unsigned int evtchn_from_per_cpu_irq(unsigned int irq, unsigned int cpu)
+{
+ BUG_ON(type_from_irq(irq) != IRQT_IPI);
+ return per_cpu(ipi_to_evtchn, cpu)[index_from_irq(irq)];
+}
+
+static inline unsigned int evtchn_from_irq(unsigned int irq)
+{
+ if (type_from_irq(irq) != IRQT_IPI)
+ return irq_info[irq] & ((1U << _EVTCHN_BITS) - 1);
+ return evtchn_from_per_cpu_irq(irq, smp_processor_id());
+}
+#endif
+
/* IRQ <-> VIRQ mapping. */
DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]) = {[0 ... NR_VIRQS-1] = -1};
+#if defined(CONFIG_SMP) && defined(PER_CPU_IPI_IRQ)
/* IRQ <-> IPI mapping. */
-#ifndef NR_IPIS
-#define NR_IPIS 1
-#endif
DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]) = {[0 ... NR_IPIS-1] = -1};
+#endif
/* Reference counts for bindings to IRQs. */
static int irq_bindcount[NR_IRQS];
@@ -144,8 +176,14 @@ static void bind_evtchn_to_cpu(unsigned
BUG_ON(!test_bit(chn, s->evtchn_mask));
- if (irq != -1)
- irq_desc[irq].affinity = cpumask_of_cpu(cpu);
+ if (irq != -1) {
+ struct irq_desc *desc = irq_desc + irq;
+
+ if (!(desc->status & IRQ_PER_CPU))
+ desc->affinity = cpumask_of_cpu(cpu);
+ else
+ cpu_set(cpu, desc->affinity);
+ }
clear_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu_evtchn[chn]]);
set_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu]);
@@ -439,6 +477,7 @@ static int bind_virq_to_irq(unsigned int
return irq;
}
+#if defined(CONFIG_SMP) && defined(PER_CPU_IPI_IRQ)
static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
{
struct evtchn_bind_ipi bind_ipi;
@@ -470,6 +509,7 @@ static int bind_ipi_to_irq(unsigned int
spin_unlock(&irq_mapping_update_lock);
return irq;
}
+#endif
static void unbind_from_irq(unsigned int irq)
{
@@ -477,6 +517,7 @@ static void unbind_from_irq(unsigned int
unsigned int cpu;
int evtchn = evtchn_from_irq(irq);
+ BUG_IF_IPI(irq);
spin_lock(&irq_mapping_update_lock);
if ((--irq_bindcount[irq] == 0) && VALID_EVTCHN(evtchn)) {
@@ -490,10 +531,12 @@ static void unbind_from_irq(unsigned int
per_cpu(virq_to_irq, cpu_from_evtchn(evtchn))
[index_from_irq(irq)] = -1;
break;
+#if defined(CONFIG_SMP) && defined(PER_CPU_IPI_IRQ)
case IRQT_IPI:
per_cpu(ipi_to_irq, cpu_from_evtchn(evtchn))
[index_from_irq(irq)] = -1;
break;
+#endif
default:
break;
}
@@ -512,6 +555,46 @@ static void unbind_from_irq(unsigned int
spin_unlock(&irq_mapping_update_lock);
}
+#if defined(CONFIG_SMP) && !defined(PER_CPU_IPI_IRQ)
+void unbind_from_per_cpu_irq(unsigned int irq, unsigned int cpu)
+{
+ struct evtchn_close close;
+ int evtchn = evtchn_from_per_cpu_irq(irq, cpu);
+
+ spin_lock(&irq_mapping_update_lock);
+
+ if (VALID_EVTCHN(evtchn)) {
+ struct irq_desc *desc = irq_desc + irq;
+
+ mask_evtchn(evtchn);
+
+ BUG_ON(irq_bindcount[irq] <= 1);
+ irq_bindcount[irq]--;
+ cpu_clear(cpu, desc->affinity);
+
+ close.port = evtchn;
+ if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
+ BUG();
+
+ switch (type_from_irq(irq)) {
+ case IRQT_IPI:
+ per_cpu(ipi_to_evtchn, cpu)[index_from_irq(irq)] = -1;
+ break;
+ default:
+ BUG();
+ break;
+ }
+
+ /* Closed ports are implicitly re-bound to VCPU0. */
+ bind_evtchn_to_cpu(evtchn, 0);
+
+ evtchn_to_irq[evtchn] = -1;
+ }
+
+ spin_unlock(&irq_mapping_update_lock);
+}
+#endif /* CONFIG_SMP && !PER_CPU_IPI_IRQ */
+
int bind_caller_port_to_irqhandler(
unsigned int caller_port,
irq_handler_t handler,
@@ -606,6 +689,8 @@ int bind_virq_to_irqhandler(
}
EXPORT_SYMBOL_GPL(bind_virq_to_irqhandler);
+#ifdef CONFIG_SMP
+#ifdef PER_CPU_IPI_IRQ
int bind_ipi_to_irqhandler(
unsigned int ipi,
unsigned int cpu,
@@ -628,7 +713,72 @@ int bind_ipi_to_irqhandler(
return irq;
}
-EXPORT_SYMBOL_GPL(bind_ipi_to_irqhandler);
+#else
+int __cpuinit bind_ipi_to_irqaction(
+ unsigned int ipi,
+ unsigned int cpu,
+ struct irqaction *action)
+{
+ struct evtchn_bind_ipi bind_ipi;
+ int evtchn, irq, retval = 0;
+
+ spin_lock(&irq_mapping_update_lock);
+
+ if (per_cpu(ipi_to_evtchn, cpu)[ipi] != -1) {
+ spin_unlock(&irq_mapping_update_lock);
+ return -EBUSY;
+ }
+
+ if ((irq = ipi_to_irq[ipi]) == -1) {
+ if ((irq = find_unbound_irq()) < 0) {
+ spin_unlock(&irq_mapping_update_lock);
+ return irq;
+ }
+
+ /* Extra reference so count will never drop to zero. */
+ irq_bindcount[irq]++;
+
+ ipi_to_irq[ipi] = irq;
+ irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, 0);
+ irq_desc[irq].handle_irq = handle_percpu_irq;
+ retval = 1;
+ }
+
+ bind_ipi.vcpu = cpu;
+ if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
+ &bind_ipi) != 0)
+ BUG();
+
+ evtchn = bind_ipi.port;
+ evtchn_to_irq[evtchn] = irq;
+ per_cpu(ipi_to_evtchn, cpu)[ipi] = evtchn;
+
+ bind_evtchn_to_cpu(evtchn, cpu);
+
+ irq_bindcount[irq]++;
+
+ spin_unlock(&irq_mapping_update_lock);
+
+ if (retval == 0) {
+ unsigned long flags;
+
+ local_irq_save(flags);
+ unmask_evtchn(evtchn);
+ local_irq_restore(flags);
+ } else {
+ action->flags |= IRQF_PERCPU;
+ retval = setup_irq(irq, action);
+ if (retval) {
+ unbind_from_per_cpu_irq(irq, cpu);
+ BUG_ON(retval > 0);
+ irq = retval;
+ }
+ }
+
+ return irq;
+}
+#endif /* PER_CPU_IPI_IRQ */
+#endif /* CONFIG_SMP */
void unbind_from_irqhandler(unsigned int irq, void *dev_id)
{
@@ -654,6 +804,7 @@ static void rebind_irq_to_cpu(unsigned i
{
int evtchn = evtchn_from_irq(irq);
+ BUG_IF_IPI(irq);
if (VALID_EVTCHN(evtchn))
rebind_evtchn_to_cpu(evtchn, tcpu);
}
@@ -737,6 +888,7 @@ static struct irq_chip dynirq_chip = {
.unmask = unmask_dynirq,
.mask_ack = ack_dynirq,
.ack = ack_dynirq,
+ .eoi = end_dynirq,
.end = end_dynirq,
#ifdef CONFIG_SMP
.set_affinity = set_affinity_irq,
@@ -909,10 +1061,21 @@ int irq_ignore_unhandled(unsigned int ir
return !!(irq_status.flags & XENIRQSTAT_shared);
}
+#if defined(CONFIG_SMP) && !defined(PER_CPU_IPI_IRQ)
+void notify_remote_via_ipi(unsigned int ipi, unsigned int cpu)
+{
+ int evtchn = evtchn_from_per_cpu_irq(ipi_to_irq[ipi], cpu);
+
+ if (VALID_EVTCHN(evtchn))
+ notify_remote_via_evtchn(evtchn);
+}
+#endif
+
void notify_remote_via_irq(int irq)
{
int evtchn = evtchn_from_irq(irq);
+ BUG_IF_IPI(irq);
if (VALID_EVTCHN(evtchn))
notify_remote_via_evtchn(evtchn);
}
@@ -920,6 +1083,7 @@ EXPORT_SYMBOL_GPL(notify_remote_via_irq)
int irq_to_evtchn_port(int irq)
{
+ BUG_IF_IPI(irq);
return evtchn_from_irq(irq);
}
EXPORT_SYMBOL_GPL(irq_to_evtchn_port);
@@ -1035,11 +1199,16 @@ static void restore_cpu_virqs(unsigned i
static void restore_cpu_ipis(unsigned int cpu)
{
+#ifdef CONFIG_SMP
struct evtchn_bind_ipi bind_ipi;
int ipi, irq, evtchn;
for (ipi = 0; ipi < NR_IPIS; ipi++) {
+#ifdef PER_CPU_IPI_IRQ
if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1)
+#else
+ if ((irq = ipi_to_irq[ipi]) == -1)
+#endif
continue;
BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0));
@@ -1053,13 +1222,17 @@ static void restore_cpu_ipis(unsigned in
/* Record the new mapping. */
evtchn_to_irq[evtchn] = irq;
+#ifdef PER_CPU_IPI_IRQ
irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn);
+#else
+ per_cpu(ipi_to_evtchn, cpu)[ipi] = evtchn;
+#endif
bind_evtchn_to_cpu(evtchn, cpu);
/* Ready for use. */
unmask_evtchn(evtchn);
-
}
+#endif
}
static int evtchn_resume(struct sys_device *dev)
@@ -1103,8 +1276,17 @@ static int evtchn_resume(struct sys_devi
for_each_possible_cpu(cpu) {
restore_cpu_virqs(cpu);
+#ifdef PER_CPU_IPI_IRQ
restore_cpu_ipis(cpu);
+#else
+ /* No IPI <-> event-channel mappings. */
+ for (irq = 0; irq < NR_IPIS; ++irq)
+ per_cpu(ipi_to_evtchn, cpu)[irq] = -1;
+#endif
}
+#ifndef PER_CPU_IPI_IRQ
+ restore_cpu_ipis(smp_processor_id());
+#endif
return 0;
}
Index: head-2008-12-01/drivers/xen/core/smpboot.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/smpboot.c 2008-12-01 12:07:15.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/smpboot.c 2008-12-01 12:07:34.000000000 +0100
@@ -53,12 +53,9 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
DEFINE_PER_CPU(int, cpu_state) = { 0 };
#endif
-static DEFINE_PER_CPU(int, resched_irq);
-static DEFINE_PER_CPU(int, callfunc_irq);
-static DEFINE_PER_CPU(int, call1func_irq);
-static char resched_name[NR_CPUS][15];
-static char callfunc_name[NR_CPUS][15];
-static char call1func_name[NR_CPUS][15];
+static int __read_mostly resched_irq = -1;
+static int __read_mostly callfunc_irq = -1;
+static int __read_mostly call1func_irq = -1;
#ifdef CONFIG_X86_LOCAL_APIC
#define set_cpu_to_apicid(cpu, apicid) (per_cpu(x86_cpu_to_apicid, cpu) = (apicid))
@@ -117,43 +114,50 @@ remove_siblinginfo(unsigned int cpu)
static int __cpuinit xen_smp_intr_init(unsigned int cpu)
{
+ static struct irqaction resched_action = {
+ .handler = smp_reschedule_interrupt,
+ .flags = IRQF_DISABLED,
+ .name = "resched"
+ }, callfunc_action = {
+ .handler = smp_call_function_interrupt,
+ .flags = IRQF_DISABLED,
+ .name = "callfunc"
+ }, call1func_action = {
+ .handler = smp_call_function_single_interrupt,
+ .flags = IRQF_DISABLED,
+ .name = "call1func"
+ };
int rc;
- per_cpu(resched_irq, cpu) = per_cpu(callfunc_irq, cpu) =
- per_cpu(call1func_irq, cpu) = -1;
-
- sprintf(resched_name[cpu], "resched%u", cpu);
- rc = bind_ipi_to_irqhandler(RESCHEDULE_VECTOR,
- cpu,
- smp_reschedule_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- resched_name[cpu],
- NULL);
+ rc = bind_ipi_to_irqaction(RESCHEDULE_VECTOR,
+ cpu,
+ &resched_action);
if (rc < 0)
goto fail;
- per_cpu(resched_irq, cpu) = rc;
-
- sprintf(callfunc_name[cpu], "callfunc%u", cpu);
- rc = bind_ipi_to_irqhandler(CALL_FUNCTION_VECTOR,
- cpu,
- smp_call_function_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- callfunc_name[cpu],
- NULL);
+ if (resched_irq < 0)
+ resched_irq = rc;
+ else
+ BUG_ON(resched_irq != rc);
+
+ rc = bind_ipi_to_irqaction(CALL_FUNCTION_VECTOR,
+ cpu,
+ &callfunc_action);
if (rc < 0)
goto fail;
- per_cpu(callfunc_irq, cpu) = rc;
-
- sprintf(call1func_name[cpu], "call1func%u", cpu);
- rc = bind_ipi_to_irqhandler(CALL_FUNC_SINGLE_VECTOR,
- cpu,
- smp_call_function_single_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- call1func_name[cpu],
- NULL);
+ if (callfunc_irq < 0)
+ callfunc_irq = rc;
+ else
+ BUG_ON(callfunc_irq != rc);
+
+ rc = bind_ipi_to_irqaction(CALL_FUNC_SINGLE_VECTOR,
+ cpu,
+ &call1func_action);
if (rc < 0)
goto fail;
- per_cpu(call1func_irq, cpu) = rc;
+ if (call1func_irq < 0)
+ call1func_irq = rc;
+ else
+ BUG_ON(call1func_irq != rc);
rc = xen_spinlock_init(cpu);
if (rc < 0)
@@ -165,12 +169,12 @@ static int __cpuinit xen_smp_intr_init(u
return 0;
fail:
- if (per_cpu(resched_irq, cpu) >= 0)
- unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL);
- if (per_cpu(callfunc_irq, cpu) >= 0)
- unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL);
- if (per_cpu(call1func_irq, cpu) >= 0)
- unbind_from_irqhandler(per_cpu(call1func_irq, cpu), NULL);
+ if (resched_irq >= 0)
+ unbind_from_per_cpu_irq(resched_irq, cpu);
+ if (callfunc_irq >= 0)
+ unbind_from_per_cpu_irq(callfunc_irq, cpu);
+ if (call1func_irq >= 0)
+ unbind_from_per_cpu_irq(call1func_irq, cpu);
xen_spinlock_cleanup(cpu);
return rc;
}
@@ -181,9 +185,9 @@ static void __cpuinit xen_smp_intr_exit(
if (cpu != 0)
local_teardown_timer(cpu);
- unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL);
- unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL);
- unbind_from_irqhandler(per_cpu(call1func_irq, cpu), NULL);
+ unbind_from_per_cpu_irq(resched_irq, cpu);
+ unbind_from_per_cpu_irq(callfunc_irq, cpu);
+ unbind_from_per_cpu_irq(call1func_irq, cpu);
xen_spinlock_cleanup(cpu);
}
#endif
Index: head-2008-12-01/drivers/xen/core/spinlock.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/spinlock.c 2008-12-01 11:51:53.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/spinlock.c 2008-12-01 12:07:34.000000000 +0100
@@ -14,8 +14,7 @@
extern irqreturn_t smp_reschedule_interrupt(int, void *);
-static DEFINE_PER_CPU(int, spinlock_irq) = -1;
-static char spinlock_name[NR_CPUS][15];
+static int __read_mostly spinlock_irq = -1;
struct spinning {
raw_spinlock_t *lock;
@@ -32,34 +31,37 @@ static DEFINE_PER_CPU(raw_rwlock_t, spin
int __cpuinit xen_spinlock_init(unsigned int cpu)
{
+ static struct irqaction spinlock_action = {
+ .handler = smp_reschedule_interrupt,
+ .flags = IRQF_DISABLED,
+ .name = "spinlock"
+ };
int rc;
- sprintf(spinlock_name[cpu], "spinlock%u", cpu);
- rc = bind_ipi_to_irqhandler(SPIN_UNLOCK_VECTOR,
- cpu,
- smp_reschedule_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- spinlock_name[cpu],
- NULL);
+ rc = bind_ipi_to_irqaction(SPIN_UNLOCK_VECTOR,
+ cpu,
+ &spinlock_action);
if (rc < 0)
return rc;
- disable_irq(rc); /* make sure it's never delivered */
- per_cpu(spinlock_irq, cpu) = rc;
+ if (spinlock_irq < 0) {
+ disable_irq(rc); /* make sure it's never delivered */
+ spinlock_irq = rc;
+ } else
+ BUG_ON(spinlock_irq != rc);
return 0;
}
void __cpuinit xen_spinlock_cleanup(unsigned int cpu)
{
- if (per_cpu(spinlock_irq, cpu) >= 0)
- unbind_from_irqhandler(per_cpu(spinlock_irq, cpu), NULL);
- per_cpu(spinlock_irq, cpu) = -1;
+ if (spinlock_irq >= 0)
+ unbind_from_per_cpu_irq(spinlock_irq, cpu);
}
int xen_spin_wait(raw_spinlock_t *lock, unsigned int token)
{
- int rc = 0, irq = __get_cpu_var(spinlock_irq);
+ int rc = 0, irq = spinlock_irq;
raw_rwlock_t *rm_lock;
unsigned long flags;
struct spinning spinning;
@@ -153,7 +155,7 @@ void xen_spin_kick(raw_spinlock_t *lock,
raw_local_irq_restore(flags);
if (unlikely(spinning)) {
- notify_remote_via_irq(per_cpu(spinlock_irq, cpu));
+ notify_remote_via_ipi(SPIN_UNLOCK_VECTOR, cpu);
return;
}
}
Index: head-2008-12-01/include/xen/evtchn.h
===================================================================
--- head-2008-12-01.orig/include/xen/evtchn.h 2008-12-01 12:07:30.000000000 +0100
+++ head-2008-12-01/include/xen/evtchn.h 2008-12-01 12:07:34.000000000 +0100
@@ -78,6 +78,8 @@ int bind_virq_to_irqhandler(
unsigned long irqflags,
const char *devname,
void *dev_id);
+#if defined(CONFIG_SMP) && !defined(MODULE)
+#ifndef CONFIG_X86
int bind_ipi_to_irqhandler(
unsigned int ipi,
unsigned int cpu,
@@ -85,6 +87,13 @@ int bind_ipi_to_irqhandler(
unsigned long irqflags,
const char *devname,
void *dev_id);
+#else
+int bind_ipi_to_irqaction(
+ unsigned int ipi,
+ unsigned int cpu,
+ struct irqaction *action);
+#endif
+#endif
/*
* Common unbind function for all event sources. Takes IRQ to unbind from.
@@ -93,6 +102,11 @@ int bind_ipi_to_irqhandler(
*/
void unbind_from_irqhandler(unsigned int irq, void *dev_id);
+#if defined(CONFIG_SMP) && !defined(MODULE) && defined(CONFIG_X86)
+/* Specialized unbind function for per-CPU IRQs. */
+void unbind_from_per_cpu_irq(unsigned int irq, unsigned int cpu);
+#endif
+
#ifndef CONFIG_XEN
void irq_resume(void);
#endif
@@ -184,4 +198,8 @@ int clear_pirq_hw_action(int pirq);
#define PIRQ_END 5
#define PIRQ_ACK 6
+#if defined(CONFIG_SMP) && !defined(MODULE) && defined(CONFIG_X86)
+void notify_remote_via_ipi(unsigned int ipi, unsigned int cpu);
+#endif
+
#endif /* __ASM_EVTCHN_H__ */

View File

@@ -0,0 +1,657 @@
From: jbeulich@novell.com
Subject: fold per-CPU VIRQs onto a single IRQ each
Patch-mainline: obsolete
Index: head-2008-12-01/arch/x86/kernel/time_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/time_32-xen.c 2008-12-01 12:07:30.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/time_32-xen.c 2008-12-01 12:08:40.000000000 +0100
@@ -729,19 +729,17 @@ int xen_update_persistent_clock(void)
}
/* Dynamically-mapped IRQ. */
-DEFINE_PER_CPU(int, timer_irq);
+static int __read_mostly timer_irq = -1;
+static struct irqaction timer_action = {
+ .handler = timer_interrupt,
+ .flags = IRQF_DISABLED,
+ .name = "timer"
+};
static void __init setup_cpu0_timer_irq(void)
{
- per_cpu(timer_irq, 0) =
- bind_virq_to_irqhandler(
- VIRQ_TIMER,
- 0,
- timer_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- "timer0",
- NULL);
- BUG_ON(per_cpu(timer_irq, 0) < 0);
+ timer_irq = bind_virq_to_irqaction(VIRQ_TIMER, 0, &timer_action);
+ BUG_ON(timer_irq < 0);
}
void __init time_init(void)
@@ -868,8 +866,6 @@ void xen_halt(void)
EXPORT_SYMBOL(xen_halt);
#ifdef CONFIG_SMP
-static char timer_name[NR_CPUS][15];
-
int __cpuinit local_setup_timer(unsigned int cpu)
{
int seq, irq;
@@ -895,16 +891,10 @@ int __cpuinit local_setup_timer(unsigned
init_missing_ticks_accounting(cpu);
} while (read_seqretry(&xtime_lock, seq));
- sprintf(timer_name[cpu], "timer%u", cpu);
- irq = bind_virq_to_irqhandler(VIRQ_TIMER,
- cpu,
- timer_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- timer_name[cpu],
- NULL);
+ irq = bind_virq_to_irqaction(VIRQ_TIMER, cpu, &timer_action);
if (irq < 0)
return irq;
- per_cpu(timer_irq, cpu) = irq;
+ BUG_ON(timer_irq != irq);
return 0;
}
@@ -912,7 +902,7 @@ int __cpuinit local_setup_timer(unsigned
void __cpuinit local_teardown_timer(unsigned int cpu)
{
BUG_ON(cpu == 0);
- unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL);
+ unbind_from_per_cpu_irq(timer_irq, cpu, &timer_action);
}
#endif
Index: head-2008-12-01/drivers/xen/core/evtchn.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/evtchn.c 2008-12-02 09:14:29.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/evtchn.c 2008-12-03 15:54:25.000000000 +0100
@@ -57,6 +57,23 @@ static DEFINE_SPINLOCK(irq_mapping_updat
static int evtchn_to_irq[NR_EVENT_CHANNELS] = {
[0 ... NR_EVENT_CHANNELS-1] = -1 };
+#if defined(CONFIG_SMP) && defined(CONFIG_X86)
+static struct per_cpu_irqaction {
+ struct irqaction action; /* must be first */
+ struct per_cpu_irqaction *next;
+ cpumask_t cpus;
+} *virq_actions[NR_VIRQS];
+/* IRQ <-> VIRQ mapping. */
+static DECLARE_BITMAP(virq_per_cpu, NR_VIRQS) __read_mostly;
+static DEFINE_PER_CPU(int[NR_VIRQS], virq_to_evtchn) = {[0 ... NR_VIRQS-1] = -1};
+#define BUG_IF_VIRQ_PER_CPU(irq) \
+ BUG_ON(type_from_irq(irq) == IRQT_VIRQ \
+ && test_bit(index_from_irq(irq), virq_per_cpu))
+#else
+#define BUG_IF_VIRQ_PER_CPU(irq) ((void)(irq))
+#define PER_CPU_VIRQ_IRQ
+#endif
+
/* IRQ <-> IPI mapping. */
#ifndef NR_IPIS
#define NR_IPIS 1
@@ -113,13 +130,6 @@ static inline u32 mk_irq_info(u32 type,
* Accessors for packed IRQ information.
*/
-#ifdef PER_CPU_IPI_IRQ
-static inline unsigned int evtchn_from_irq(int irq)
-{
- return irq_info[irq] & ((1U << _EVTCHN_BITS) - 1);
-}
-#endif
-
static inline unsigned int index_from_irq(int irq)
{
return (irq_info[irq] >> _EVTCHN_BITS) & ((1U << _INDEX_BITS) - 1);
@@ -130,20 +140,34 @@ static inline unsigned int type_from_irq
return irq_info[irq] >> (32 - _IRQT_BITS);
}
-#ifndef PER_CPU_IPI_IRQ
static inline unsigned int evtchn_from_per_cpu_irq(unsigned int irq, unsigned int cpu)
{
- BUG_ON(type_from_irq(irq) != IRQT_IPI);
- return per_cpu(ipi_to_evtchn, cpu)[index_from_irq(irq)];
+ switch (type_from_irq(irq)) {
+#ifndef PER_CPU_VIRQ_IRQ
+ case IRQT_VIRQ:
+ return per_cpu(virq_to_evtchn, cpu)[index_from_irq(irq)];
+#endif
+#ifndef PER_CPU_IPI_IRQ
+ case IRQT_IPI:
+ return per_cpu(ipi_to_evtchn, cpu)[index_from_irq(irq)];
+#endif
+ }
+ BUG();
}
static inline unsigned int evtchn_from_irq(unsigned int irq)
{
- if (type_from_irq(irq) != IRQT_IPI)
- return irq_info[irq] & ((1U << _EVTCHN_BITS) - 1);
- return evtchn_from_per_cpu_irq(irq, smp_processor_id());
-}
+ switch (type_from_irq(irq)) {
+#ifndef PER_CPU_VIRQ_IRQ
+ case IRQT_VIRQ:
+#endif
+#ifndef PER_CPU_IPI_IRQ
+ case IRQT_IPI:
#endif
+ return evtchn_from_per_cpu_irq(irq, smp_processor_id());
+ }
+ return irq_info[irq] & ((1U << _EVTCHN_BITS) - 1);
+}
/* IRQ <-> VIRQ mapping. */
DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]) = {[0 ... NR_VIRQS-1] = -1};
@@ -463,6 +487,14 @@ static int bind_virq_to_irq(unsigned int
evtchn = bind_virq.port;
evtchn_to_irq[evtchn] = irq;
+#ifndef PER_CPU_VIRQ_IRQ
+ {
+ unsigned int cpu;
+
+ for_each_possible_cpu(cpu)
+ per_cpu(virq_to_evtchn, cpu)[virq] = evtchn;
+ }
+#endif
irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
per_cpu(virq_to_irq, cpu)[virq] = irq;
@@ -517,7 +549,9 @@ static void unbind_from_irq(unsigned int
unsigned int cpu;
int evtchn = evtchn_from_irq(irq);
+ BUG_IF_VIRQ_PER_CPU(irq);
BUG_IF_IPI(irq);
+
spin_lock(&irq_mapping_update_lock);
if ((--irq_bindcount[irq] == 0) && VALID_EVTCHN(evtchn)) {
@@ -530,6 +564,11 @@ static void unbind_from_irq(unsigned int
case IRQT_VIRQ:
per_cpu(virq_to_irq, cpu_from_evtchn(evtchn))
[index_from_irq(irq)] = -1;
+#ifndef PER_CPU_VIRQ_IRQ
+ for_each_possible_cpu(cpu)
+ per_cpu(virq_to_evtchn, cpu)
+ [index_from_irq(irq)] = -1;
+#endif
break;
#if defined(CONFIG_SMP) && defined(PER_CPU_IPI_IRQ)
case IRQT_IPI:
@@ -555,11 +594,13 @@ static void unbind_from_irq(unsigned int
spin_unlock(&irq_mapping_update_lock);
}
-#if defined(CONFIG_SMP) && !defined(PER_CPU_IPI_IRQ)
-void unbind_from_per_cpu_irq(unsigned int irq, unsigned int cpu)
+#if defined(CONFIG_SMP) && (!defined(PER_CPU_IPI_IRQ) || !defined(PER_CPU_VIRQ_IRQ))
+void unbind_from_per_cpu_irq(unsigned int irq, unsigned int cpu,
+ struct irqaction *action)
{
struct evtchn_close close;
int evtchn = evtchn_from_per_cpu_irq(irq, cpu);
+ struct irqaction *free_action = NULL;
spin_lock(&irq_mapping_update_lock);
@@ -570,6 +611,32 @@ void unbind_from_per_cpu_irq(unsigned in
BUG_ON(irq_bindcount[irq] <= 1);
irq_bindcount[irq]--;
+
+#ifndef PER_CPU_VIRQ_IRQ
+ if (type_from_irq(irq) == IRQT_VIRQ) {
+ unsigned int virq = index_from_irq(irq);
+ struct per_cpu_irqaction *cur, *prev = NULL;
+
+ cur = virq_actions[virq];
+ while (cur) {
+ if (cur->action.dev_id == action) {
+ cpu_clear(cpu, cur->cpus);
+ if (cpus_empty(cur->cpus)) {
+ if (prev)
+ prev->next = cur->next;
+ else
+ virq_actions[virq] = cur->next;
+ free_action = action;
+ }
+ } else if (cpu_isset(cpu, cur->cpus))
+ evtchn = 0;
+ cur = (prev = cur)->next;
+ }
+ if (!VALID_EVTCHN(evtchn))
+ goto done;
+ }
+#endif
+
cpu_clear(cpu, desc->affinity);
close.port = evtchn;
@@ -577,9 +644,16 @@ void unbind_from_per_cpu_irq(unsigned in
BUG();
switch (type_from_irq(irq)) {
+#ifndef PER_CPU_VIRQ_IRQ
+ case IRQT_VIRQ:
+ per_cpu(virq_to_evtchn, cpu)[index_from_irq(irq)] = -1;
+ break;
+#endif
+#ifndef PER_CPU_IPI_IRQ
case IRQT_IPI:
per_cpu(ipi_to_evtchn, cpu)[index_from_irq(irq)] = -1;
break;
+#endif
default:
BUG();
break;
@@ -591,9 +665,16 @@ void unbind_from_per_cpu_irq(unsigned in
evtchn_to_irq[evtchn] = -1;
}
+#ifndef PER_CPU_VIRQ_IRQ
+done:
+#endif
spin_unlock(&irq_mapping_update_lock);
+
+ if (free_action)
+ free_irq(irq, free_action);
}
-#endif /* CONFIG_SMP && !PER_CPU_IPI_IRQ */
+EXPORT_SYMBOL_GPL(unbind_from_per_cpu_irq);
+#endif /* CONFIG_SMP && (!PER_CPU_IPI_IRQ || !PER_CPU_VIRQ_IRQ) */
int bind_caller_port_to_irqhandler(
unsigned int caller_port,
@@ -675,6 +756,8 @@ int bind_virq_to_irqhandler(
{
int irq, retval;
+ BUG_IF_VIRQ_PER_CPU(virq);
+
irq = bind_virq_to_irq(virq, cpu);
if (irq < 0)
return irq;
@@ -690,6 +773,108 @@ int bind_virq_to_irqhandler(
EXPORT_SYMBOL_GPL(bind_virq_to_irqhandler);
#ifdef CONFIG_SMP
+#ifndef PER_CPU_VIRQ_IRQ
+int bind_virq_to_irqaction(
+ unsigned int virq,
+ unsigned int cpu,
+ struct irqaction *action)
+{
+ struct evtchn_bind_virq bind_virq;
+ int evtchn, irq, retval = 0;
+ struct per_cpu_irqaction *cur = NULL, *new;
+
+ BUG_ON(!test_bit(virq, virq_per_cpu));
+
+ if (action->dev_id)
+ return -EINVAL;
+
+ new = kzalloc(sizeof(*new), GFP_ATOMIC);
+ if (new) {
+ new->action = *action;
+ new->action.dev_id = action;
+ }
+
+ spin_lock(&irq_mapping_update_lock);
+
+ for (cur = virq_actions[virq]; cur; cur = cur->next)
+ if (cur->action.dev_id == action)
+ break;
+ if (!cur) {
+ if (!new) {
+ spin_unlock(&irq_mapping_update_lock);
+ return -ENOMEM;
+ }
+ new->next = virq_actions[virq];
+ virq_actions[virq] = cur = new;
+ retval = 1;
+ }
+ cpu_set(cpu, cur->cpus);
+ action = &cur->action;
+
+ if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) {
+ unsigned int cpu;
+
+ BUG_ON(!retval);
+
+ if ((irq = find_unbound_irq()) < 0) {
+ if (cur)
+ virq_actions[virq] = cur->next;
+ spin_unlock(&irq_mapping_update_lock);
+ if (cur != new)
+ kfree(new);
+ return irq;
+ }
+
+ /* Extra reference so count will never drop to zero. */
+ irq_bindcount[irq]++;
+
+ for_each_possible_cpu(cpu)
+ per_cpu(virq_to_irq, cpu)[virq] = irq;
+ irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, 0);
+ irq_desc[irq].handle_irq = handle_percpu_irq;
+ }
+
+ if ((evtchn = per_cpu(virq_to_evtchn, cpu)[virq]) == -1) {
+ bind_virq.virq = virq;
+ bind_virq.vcpu = cpu;
+ if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
+ &bind_virq) != 0)
+ BUG();
+ evtchn = bind_virq.port;
+ evtchn_to_irq[evtchn] = irq;
+ per_cpu(virq_to_evtchn, cpu)[virq] = evtchn;
+
+ bind_evtchn_to_cpu(evtchn, cpu);
+ }
+
+ irq_bindcount[irq]++;
+
+ spin_unlock(&irq_mapping_update_lock);
+
+ if (cur != new)
+ kfree(new);
+
+ if (retval == 0) {
+ unsigned long flags;
+
+ local_irq_save(flags);
+ unmask_evtchn(evtchn);
+ local_irq_restore(flags);
+ } else {
+ action->flags |= IRQF_PERCPU;
+ retval = setup_irq(irq, action);
+ if (retval) {
+ unbind_from_per_cpu_irq(irq, cpu, cur->action.dev_id);
+ BUG_ON(retval > 0);
+ irq = retval;
+ }
+ }
+
+ return irq;
+}
+EXPORT_SYMBOL_GPL(bind_virq_to_irqaction);
+#endif
+
#ifdef PER_CPU_IPI_IRQ
int bind_ipi_to_irqhandler(
unsigned int ipi,
@@ -769,7 +954,7 @@ int __cpuinit bind_ipi_to_irqaction(
action->flags |= IRQF_PERCPU;
retval = setup_irq(irq, action);
if (retval) {
- unbind_from_per_cpu_irq(irq, cpu);
+ unbind_from_per_cpu_irq(irq, cpu, NULL);
BUG_ON(retval > 0);
irq = retval;
}
@@ -804,7 +989,9 @@ static void rebind_irq_to_cpu(unsigned i
{
int evtchn = evtchn_from_irq(irq);
+ BUG_IF_VIRQ_PER_CPU(irq);
BUG_IF_IPI(irq);
+
if (VALID_EVTCHN(evtchn))
rebind_evtchn_to_cpu(evtchn, tcpu);
}
@@ -1075,7 +1262,9 @@ void notify_remote_via_irq(int irq)
{
int evtchn = evtchn_from_irq(irq);
+ BUG_ON(type_from_irq(irq) == IRQT_VIRQ);
BUG_IF_IPI(irq);
+
if (VALID_EVTCHN(evtchn))
notify_remote_via_evtchn(evtchn);
}
@@ -1083,6 +1272,7 @@ EXPORT_SYMBOL_GPL(notify_remote_via_irq)
int irq_to_evtchn_port(int irq)
{
+ BUG_IF_VIRQ_PER_CPU(irq);
BUG_IF_IPI(irq);
return evtchn_from_irq(irq);
}
@@ -1177,6 +1367,20 @@ static void restore_cpu_virqs(unsigned i
if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1)
continue;
+#ifndef PER_CPU_VIRQ_IRQ
+ if (test_bit(virq, virq_per_cpu)) {
+ const struct per_cpu_irqaction *cur;
+
+ if(cpu != smp_processor_id())
+ continue;
+ for (cur = virq_actions[virq]; cur; cur = cur->next)
+ if (cpu_isset(cpu, cur->cpus))
+ break;
+ if (!cur)
+ continue;
+ }
+#endif
+
BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0));
/* Get a new binding from Xen. */
@@ -1189,7 +1393,19 @@ static void restore_cpu_virqs(unsigned i
/* Record the new mapping. */
evtchn_to_irq[evtchn] = irq;
+#ifndef PER_CPU_VIRQ_IRQ
+ if (test_bit(virq, virq_per_cpu))
+ per_cpu(virq_to_evtchn, cpu)[virq] = evtchn;
+ else {
+ unsigned int cpu;
+
+ irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
+ for_each_possible_cpu(cpu)
+ per_cpu(virq_to_evtchn, cpu)[virq] = evtchn;
+ }
+#else
irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
+#endif
bind_evtchn_to_cpu(evtchn, cpu);
/* Ready for use. */
@@ -1242,7 +1458,11 @@ static int evtchn_resume(struct sys_devi
/* Avoid doing anything in the 'suspend cancelled' case. */
status.dom = DOMID_SELF;
+#ifdef PER_CPU_VIRQ_IRQ
status.port = evtchn_from_irq(__get_cpu_var(virq_to_irq)[VIRQ_TIMER]);
+#else
+ status.port = __get_cpu_var(virq_to_evtchn)[VIRQ_TIMER];
+#endif
if (HYPERVISOR_event_channel_op(EVTCHNOP_status, &status))
BUG();
if (status.status == EVTCHNSTAT_virq
@@ -1391,6 +1611,15 @@ void __init xen_init_IRQ(void)
unsigned int i;
struct physdev_pirq_eoi_mfn eoi_mfn;
+#ifndef PER_CPU_VIRQ_IRQ
+ __set_bit(VIRQ_TIMER, virq_per_cpu);
+ __set_bit(VIRQ_DEBUG, virq_per_cpu);
+ __set_bit(VIRQ_XENOPROF, virq_per_cpu);
+#ifdef CONFIG_IA64
+ __set_bit(VIRQ_ITC, virq_per_cpu);
+#endif
+#endif
+
init_evtchn_cpu_bindings();
BUG_ON(!bitmap_empty(pirq_needs_eoi, PAGE_SIZE * 8));
Index: head-2008-12-01/drivers/xen/core/smpboot.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/smpboot.c 2008-12-01 12:07:34.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/smpboot.c 2008-12-01 12:08:40.000000000 +0100
@@ -170,11 +170,11 @@ static int __cpuinit xen_smp_intr_init(u
fail:
if (resched_irq >= 0)
- unbind_from_per_cpu_irq(resched_irq, cpu);
+ unbind_from_per_cpu_irq(resched_irq, cpu, NULL);
if (callfunc_irq >= 0)
- unbind_from_per_cpu_irq(callfunc_irq, cpu);
+ unbind_from_per_cpu_irq(callfunc_irq, cpu, NULL);
if (call1func_irq >= 0)
- unbind_from_per_cpu_irq(call1func_irq, cpu);
+ unbind_from_per_cpu_irq(call1func_irq, cpu, NULL);
xen_spinlock_cleanup(cpu);
return rc;
}
@@ -185,9 +185,9 @@ static void __cpuinit xen_smp_intr_exit(
if (cpu != 0)
local_teardown_timer(cpu);
- unbind_from_per_cpu_irq(resched_irq, cpu);
- unbind_from_per_cpu_irq(callfunc_irq, cpu);
- unbind_from_per_cpu_irq(call1func_irq, cpu);
+ unbind_from_per_cpu_irq(resched_irq, cpu, NULL);
+ unbind_from_per_cpu_irq(callfunc_irq, cpu, NULL);
+ unbind_from_per_cpu_irq(call1func_irq, cpu, NULL);
xen_spinlock_cleanup(cpu);
}
#endif
Index: head-2008-12-01/drivers/xen/core/spinlock.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/spinlock.c 2008-12-01 12:07:34.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/spinlock.c 2008-12-01 12:08:40.000000000 +0100
@@ -56,7 +56,7 @@ int __cpuinit xen_spinlock_init(unsigned
void __cpuinit xen_spinlock_cleanup(unsigned int cpu)
{
if (spinlock_irq >= 0)
- unbind_from_per_cpu_irq(spinlock_irq, cpu);
+ unbind_from_per_cpu_irq(spinlock_irq, cpu, NULL);
}
int xen_spin_wait(raw_spinlock_t *lock, unsigned int token)
Index: head-2008-12-01/drivers/xen/netback/netback.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/netback/netback.c 2008-12-01 11:36:55.000000000 +0100
+++ head-2008-12-01/drivers/xen/netback/netback.c 2008-12-01 12:08:40.000000000 +0100
@@ -1543,6 +1543,12 @@ static irqreturn_t netif_be_dbg(int irq,
return IRQ_HANDLED;
}
+
+static struct irqaction netif_be_dbg_action = {
+ .handler = netif_be_dbg,
+ .flags = IRQF_SHARED,
+ .name = "net-be-dbg"
+};
#endif
static int __init netback_init(void)
@@ -1602,12 +1608,9 @@ static int __init netback_init(void)
netif_xenbus_init();
#ifdef NETBE_DEBUG_INTERRUPT
- (void)bind_virq_to_irqhandler(VIRQ_DEBUG,
- 0,
- netif_be_dbg,
- IRQF_SHARED,
- "net-be-dbg",
- &netif_be_dbg);
+ (void)bind_virq_to_irqaction(VIRQ_DEBUG,
+ 0,
+ &netif_be_dbg_action);
#endif
return 0;
Index: head-2008-12-01/drivers/xen/xenoprof/xenoprofile.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/xenoprof/xenoprofile.c 2008-12-01 11:37:10.000000000 +0100
+++ head-2008-12-01/drivers/xen/xenoprof/xenoprofile.c 2008-12-01 12:08:40.000000000 +0100
@@ -212,6 +212,11 @@ static irqreturn_t xenoprof_ovf_interrup
return IRQ_HANDLED;
}
+static struct irqaction ovf_action = {
+ .handler = xenoprof_ovf_interrupt,
+ .flags = IRQF_DISABLED,
+ .name = "xenoprof"
+};
static void unbind_virq(void)
{
@@ -219,7 +224,7 @@ static void unbind_virq(void)
for_each_online_cpu(i) {
if (ovf_irq[i] >= 0) {
- unbind_from_irqhandler(ovf_irq[i], NULL);
+ unbind_from_per_cpu_irq(ovf_irq[i], i, &ovf_action);
ovf_irq[i] = -1;
}
}
@@ -232,12 +237,7 @@ static int bind_virq(void)
int result;
for_each_online_cpu(i) {
- result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
- i,
- xenoprof_ovf_interrupt,
- IRQF_DISABLED|IRQF_NOBALANCING,
- "xenoprof",
- NULL);
+ result = bind_virq_to_irqaction(VIRQ_XENOPROF, i, &ovf_action);
if (result < 0) {
unbind_virq();
Index: head-2008-12-01/include/xen/evtchn.h
===================================================================
--- head-2008-12-01.orig/include/xen/evtchn.h 2008-12-01 12:07:34.000000000 +0100
+++ head-2008-12-01/include/xen/evtchn.h 2008-12-01 12:08:40.000000000 +0100
@@ -78,6 +78,17 @@ int bind_virq_to_irqhandler(
unsigned long irqflags,
const char *devname,
void *dev_id);
+#if defined(CONFIG_SMP) && defined(CONFIG_XEN) && defined(CONFIG_X86)
+int bind_virq_to_irqaction(
+ unsigned int virq,
+ unsigned int cpu,
+ struct irqaction *action);
+#else
+#define bind_virq_to_irqaction(virq, cpu, action) \
+ bind_virq_to_irqhandler(virq, cpu, (action)->handler, \
+ (action)->flags | IRQF_NOBALANCING, \
+ (action)->name, action)
+#endif
#if defined(CONFIG_SMP) && !defined(MODULE)
#ifndef CONFIG_X86
int bind_ipi_to_irqhandler(
@@ -102,9 +113,13 @@ int bind_ipi_to_irqaction(
*/
void unbind_from_irqhandler(unsigned int irq, void *dev_id);
-#if defined(CONFIG_SMP) && !defined(MODULE) && defined(CONFIG_X86)
+#if defined(CONFIG_SMP) && defined(CONFIG_XEN) && defined(CONFIG_X86)
/* Specialized unbind function for per-CPU IRQs. */
-void unbind_from_per_cpu_irq(unsigned int irq, unsigned int cpu);
+void unbind_from_per_cpu_irq(unsigned int irq, unsigned int cpu,
+ struct irqaction *);
+#else
+#define unbind_from_per_cpu_irq(irq, cpu, action) \
+ unbind_from_irqhandler(irq, action)
#endif
#ifndef CONFIG_XEN

View File

@@ -0,0 +1,80 @@
From: jbeulich@novell.com
Subject: allow number of guest devices to be configurable
Patch-mainline: obsolete
... and derive NR_DYNIRQS from this (rather than having a hard-coded
value).
Similarly, allow the number of simultaneous transmits in netback to be
configurable.
---
drivers/xen/Kconfig | 19 +++++++++++++++++++
drivers/xen/netback/netback.c | 3 ++-
include/asm-x86/mach-xen/asm/irq_vectors.h | 2 +-
3 files changed, 22 insertions(+), 2 deletions(-)
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -74,6 +74,15 @@ config XEN_NETDEV_BACKEND
network devices to other guests via a high-performance shared-memory
interface.
+config XEN_NETDEV_TX_SHIFT
+ int "Maximum simultaneous transmit requests (as a power of 2)"
+ depends on XEN_NETDEV_BACKEND
+ range 5 16
+ default 8
+ help
+ The maximum number transmits the driver can hold pending, expressed
+ as the exponent of a power of 2.
+
config XEN_NETDEV_PIPELINED_TRANSMITTER
bool "Pipelined transmitter (DANGEROUS)"
depends on XEN_NETDEV_BACKEND
@@ -255,6 +264,16 @@ config XEN_SYSFS
help
Xen hypervisor attributes will show up under /sys/hypervisor/.
+config XEN_NR_GUEST_DEVICES
+ int "Number of guest devices"
+ range 0 4032 if 64BIT
+ range 0 960
+ default 256 if XEN_BACKEND
+ default 16
+ help
+ Specify the total number of virtual devices (i.e. both frontend
+ and backend) that you want the kernel to be able to service.
+
choice
prompt "Xen version compatibility"
default XEN_COMPAT_030002_AND_LATER
--- a/drivers/xen/netback/netback.c
+++ b/drivers/xen/netback/netback.c
@@ -74,7 +74,7 @@ static DECLARE_TASKLET(net_rx_tasklet, n
static struct timer_list net_timer;
static struct timer_list netbk_tx_pending_timer;
-#define MAX_PENDING_REQS 256
+#define MAX_PENDING_REQS (1U << CONFIG_XEN_NETDEV_TX_SHIFT)
static struct sk_buff_head rx_queue;
@@ -1196,6 +1196,7 @@ static void net_tx_action(unsigned long
net_tx_action_dealloc();
mop = tx_map_ops;
+ BUILD_BUG_ON(MAX_SKB_FRAGS >= MAX_PENDING_REQS);
while (((NR_PENDING_REQS + MAX_SKB_FRAGS) < MAX_PENDING_REQS) &&
!list_empty(&net_schedule_list)) {
/* Get a netif from the list with work to do. */
--- a/include/asm-x86/mach-xen/asm/irq_vectors.h
+++ b/include/asm-x86/mach-xen/asm/irq_vectors.h
@@ -44,7 +44,7 @@
#endif
#define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS)
-#define NR_DYNIRQS 256
+#define NR_DYNIRQS (64 + CONFIG_XEN_NR_GUEST_DEVICES)
#define NR_IRQS (NR_PIRQS + NR_DYNIRQS)
#define NR_IRQ_VECTORS NR_IRQS

View File

@@ -0,0 +1,65 @@
From: jbeulich@novell.com
Subject: netback: reduce overhead of IRQ recording
Patch-mainline: obsolete
Since both NR_PIRQS and NR_DYNIRQS are no longer hardcoded, the
(memory) overhead of tracking which ones to send notifications to can
be pretty unbounded. Also, store the dynirq rather than the raw irq
to push up the limit where the type of notify_list needs to become
'int' rather than 'u16'.
Index: head-2008-12-01/drivers/xen/netback/interface.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/netback/interface.c 2007-06-12 13:13:45.000000000 +0200
+++ head-2008-12-01/drivers/xen/netback/interface.c 2008-12-01 12:10:26.000000000 +0100
@@ -273,6 +273,7 @@ int netif_map(netif_t *netif, unsigned l
netif->dev->name, netif);
if (err < 0)
goto err_hypervisor;
+ BUG_ON(err < DYNIRQ_BASE || err >= DYNIRQ_BASE + NR_DYNIRQS);
netif->irq = err;
disable_irq(netif->irq);
Index: head-2008-12-01/drivers/xen/netback/netback.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/netback/netback.c 2008-12-01 12:10:23.000000000 +0100
+++ head-2008-12-01/drivers/xen/netback/netback.c 2008-12-01 12:10:26.000000000 +0100
@@ -564,8 +564,12 @@ static void net_rx_action(unsigned long
static mmu_update_t rx_mmu[NET_RX_RING_SIZE];
static gnttab_transfer_t grant_trans_op[NET_RX_RING_SIZE];
static gnttab_copy_t grant_copy_op[NET_RX_RING_SIZE];
- static unsigned char rx_notify[NR_IRQS];
+ static DECLARE_BITMAP(rx_notify, NR_DYNIRQS);
+#if NR_DYNIRQS <= 0x10000
static u16 notify_list[NET_RX_RING_SIZE];
+#else
+ static int notify_list[NET_RX_RING_SIZE];
+#endif
static struct netbk_rx_meta meta[NET_RX_RING_SIZE];
struct netrx_pending_operations npo = {
@@ -714,11 +718,9 @@ static void net_rx_action(unsigned long
nr_frags);
RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&netif->rx, ret);
- irq = netif->irq;
- if (ret && !rx_notify[irq]) {
- rx_notify[irq] = 1;
+ irq = netif->irq - DYNIRQ_BASE;
+ if (ret && !__test_and_set_bit(irq, rx_notify))
notify_list[notify_nr++] = irq;
- }
if (netif_queue_stopped(netif->dev) &&
netif_schedulable(netif) &&
@@ -732,8 +734,8 @@ static void net_rx_action(unsigned long
while (notify_nr != 0) {
irq = notify_list[--notify_nr];
- rx_notify[irq] = 0;
- notify_remote_via_irq(irq);
+ __clear_bit(irq, rx_notify);
+ notify_remote_via_irq(irq + DYNIRQ_BASE);
}
/* More work to do? */

View File

@@ -0,0 +1,91 @@
From: jbeulich@novell.com
Subject: netback: use multicall for send multiple notifications
Patch-mainline: obsolete
This also does a small fairness improvement since now notifications
get sent in the order requests came in rather than in the inverse one.
Index: head-2008-12-01/drivers/xen/core/evtchn.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/evtchn.c 2008-12-03 15:54:25.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/evtchn.c 2008-12-03 15:54:45.000000000 +0100
@@ -1270,6 +1270,21 @@ void notify_remote_via_irq(int irq)
}
EXPORT_SYMBOL_GPL(notify_remote_via_irq);
+int multi_notify_remote_via_irq(multicall_entry_t *mcl, int irq)
+{
+ int evtchn = evtchn_from_irq(irq);
+
+ BUG_ON(type_from_irq(irq) == IRQT_VIRQ);
+ BUG_IF_IPI(irq);
+
+ if (!VALID_EVTCHN(evtchn))
+ return -EINVAL;
+
+ multi_notify_remote_via_evtchn(mcl, evtchn);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(multi_notify_remote_via_irq);
+
int irq_to_evtchn_port(int irq)
{
BUG_IF_VIRQ_PER_CPU(irq);
Index: head-2008-12-01/drivers/xen/netback/netback.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/netback/netback.c 2008-12-01 12:10:26.000000000 +0100
+++ head-2008-12-01/drivers/xen/netback/netback.c 2008-12-01 12:10:27.000000000 +0100
@@ -732,10 +732,20 @@ static void net_rx_action(unsigned long
npo.meta_cons += nr_frags + 1;
}
- while (notify_nr != 0) {
- irq = notify_list[--notify_nr];
+ if (notify_nr == 1) {
+ irq = *notify_list;
__clear_bit(irq, rx_notify);
notify_remote_via_irq(irq + DYNIRQ_BASE);
+ } else {
+ for (count = ret = 0; ret < notify_nr; ++ret) {
+ irq = notify_list[ret];
+ __clear_bit(irq, rx_notify);
+ if (!multi_notify_remote_via_irq(rx_mcl + count,
+ irq + DYNIRQ_BASE))
+ ++count;
+ }
+ if (HYPERVISOR_multicall(rx_mcl, count))
+ BUG();
}
/* More work to do? */
Index: head-2008-12-01/include/xen/evtchn.h
===================================================================
--- head-2008-12-01.orig/include/xen/evtchn.h 2008-12-01 12:08:40.000000000 +0100
+++ head-2008-12-01/include/xen/evtchn.h 2008-12-01 12:10:27.000000000 +0100
@@ -179,6 +179,18 @@ static inline void notify_remote_via_evt
VOID(HYPERVISOR_event_channel_op(EVTCHNOP_send, &send));
}
+static inline void
+multi_notify_remote_via_evtchn(multicall_entry_t *mcl, int port)
+{
+ struct evtchn_send *send = (void *)(mcl->args + 2);
+
+ BUILD_BUG_ON(sizeof(*send) > sizeof(mcl->args) - 2 * sizeof(*mcl->args));
+ send->port = port;
+ mcl->op = __HYPERVISOR_event_channel_op;
+ mcl->args[0] = EVTCHNOP_send;
+ mcl->args[1] = (unsigned long)send;
+}
+
/* Clear an irq's pending state, in preparation for polling on it. */
void xen_clear_irq_pending(int irq);
@@ -197,6 +209,7 @@ void xen_poll_irq(int irq);
* by bind_*_to_irqhandler().
*/
void notify_remote_via_irq(int irq);
+int multi_notify_remote_via_irq(multicall_entry_t *, int irq);
int irq_to_evtchn_port(int irq);
#define PIRQ_SET_MAPPING 0x0

View File

@@ -0,0 +1,34 @@
From: jbeulich@novell.com
Subject: Don't automatically reboot Dom0 on panic (match native)
Patch-mainline: obsolete
$subject says it all.
Index: head-2008-11-17/arch/x86/kernel/setup-xen.c
===================================================================
--- head-2008-11-17.orig/arch/x86/kernel/setup-xen.c 2008-11-17 13:57:02.000000000 +0100
+++ head-2008-11-17/arch/x86/kernel/setup-xen.c 2008-11-17 13:58:02.000000000 +0100
@@ -701,15 +701,16 @@ void __init setup_arch(char **cmdline_p)
unsigned long p2m_pages;
struct physdev_set_iopl set_iopl;
+ if (!is_initial_xendomain()) {
#ifdef CONFIG_X86_32
- /* Force a quick death if the kernel panics (not domain 0). */
- extern int panic_timeout;
- if (!panic_timeout && !is_initial_xendomain())
- panic_timeout = 1;
+ /* Force a quick death if the kernel panics (not domain 0). */
+ extern int panic_timeout;
+ if (!panic_timeout)
+ panic_timeout = 1;
#endif
-
- /* Register a call for panic conditions. */
- atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
+ /* Register a call for panic conditions. */
+ atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
+ }
WARN_ON(HYPERVISOR_vm_assist(VMASST_CMD_enable,
VMASST_TYPE_writable_pagetables));

View File

@@ -0,0 +1,158 @@
Subject: Add fallback when XENMEM_exchange fails to replace contiguous region
From: jbeulich@novell.com
Patch-mainline: obsolete
References: 181869
This avoids losing precious special memory in places where any memory can be
used.
Index: head-2008-11-20/arch/x86/mm/hypervisor.c
===================================================================
--- head-2008-11-20.orig/arch/x86/mm/hypervisor.c 2008-11-21 15:51:34.000000000 +0100
+++ head-2008-11-20/arch/x86/mm/hypervisor.c 2008-11-17 12:12:39.000000000 +0100
@@ -42,6 +42,7 @@
#include <xen/interface/memory.h>
#include <linux/module.h>
#include <linux/percpu.h>
+#include <linux/highmem.h>
#include <asm/tlbflush.h>
#include <linux/highmem.h>
@@ -668,6 +669,83 @@ void xen_destroy_contiguous_region(unsig
BUG();
balloon_unlock(flags);
+
+ if (unlikely(!success)) {
+ /* Try hard to get the special memory back to Xen. */
+ exchange.in.extent_order = 0;
+ set_xen_guest_handle(exchange.in.extent_start, &in_frame);
+
+ for (i = 0; i < (1U<<order); i++) {
+ struct page *page = alloc_page(__GFP_HIGHMEM|__GFP_COLD);
+ unsigned long pfn;
+ mmu_update_t mmu;
+ unsigned int j = 0;
+
+ if (!page) {
+ printk(KERN_WARNING "Xen and kernel out of memory "
+ "while trying to release an order %u "
+ "contiguous region\n", order);
+ break;
+ }
+ pfn = page_to_pfn(page);
+
+ balloon_lock(flags);
+
+ if (!PageHighMem(page)) {
+ void *v = __va(pfn << PAGE_SHIFT);
+
+ scrub_pages(v, 1);
+ MULTI_update_va_mapping(cr_mcl + j, (unsigned long)v,
+ __pte_ma(0), UVMF_INVLPG|UVMF_ALL);
+ ++j;
+ }
+#ifdef CONFIG_XEN_SCRUB_PAGES
+ else {
+ scrub_pages(kmap(page), 1);
+ kunmap(page);
+ kmap_flush_unused();
+ }
+#endif
+
+ frame = pfn_to_mfn(pfn);
+ set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
+
+ MULTI_update_va_mapping(cr_mcl + j, vstart,
+ pfn_pte_ma(frame, PAGE_KERNEL),
+ UVMF_INVLPG|UVMF_ALL);
+ ++j;
+
+ pfn = __pa(vstart) >> PAGE_SHIFT;
+ set_phys_to_machine(pfn, frame);
+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+ mmu.ptr = ((uint64_t)frame << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
+ mmu.val = pfn;
+ cr_mcl[j].op = __HYPERVISOR_mmu_update;
+ cr_mcl[j].args[0] = (unsigned long)&mmu;
+ cr_mcl[j].args[1] = 1;
+ cr_mcl[j].args[2] = 0;
+ cr_mcl[j].args[3] = DOMID_SELF;
+ ++j;
+ }
+
+ cr_mcl[j].op = __HYPERVISOR_memory_op;
+ cr_mcl[j].args[0] = XENMEM_decrease_reservation;
+ cr_mcl[j].args[1] = (unsigned long)&exchange.in;
+
+ if (HYPERVISOR_multicall(cr_mcl, j + 1))
+ BUG();
+ BUG_ON(cr_mcl[j].result != 1);
+ while (j--)
+ BUG_ON(cr_mcl[j].result != 0);
+
+ balloon_unlock(flags);
+
+ free_empty_pages(&page, 1);
+
+ in_frame++;
+ vstart += PAGE_SIZE;
+ }
+ }
}
EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
Index: head-2008-11-20/drivers/xen/balloon/balloon.c
===================================================================
--- head-2008-11-20.orig/drivers/xen/balloon/balloon.c 2008-11-21 15:56:56.000000000 +0100
+++ head-2008-11-20/drivers/xen/balloon/balloon.c 2008-11-21 16:00:18.000000000 +0100
@@ -687,7 +687,7 @@ struct page **alloc_empty_pages_and_page
goto out;
}
-void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
+static void _free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages, int free_vec)
{
unsigned long flags;
int i;
@@ -702,11 +702,24 @@ void free_empty_pages_and_pagevec(struct
}
balloon_unlock(flags);
- kfree(pagevec);
+ if (free_vec)
+ kfree(pagevec);
+ else
+ totalram_pages = bs.current_pages -= nr_pages;
schedule_work(&balloon_worker);
}
+void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
+{
+ _free_empty_pages_and_pagevec(pagevec, nr_pages, 1);
+}
+
+void free_empty_pages(struct page **pagevec, int nr_pages)
+{
+ _free_empty_pages_and_pagevec(pagevec, nr_pages, 0);
+}
+
void balloon_release_driver_page(struct page *page)
{
unsigned long flags;
Index: head-2008-11-20/include/xen/balloon.h
===================================================================
--- head-2008-11-20.orig/include/xen/balloon.h 2008-11-21 15:51:34.000000000 +0100
+++ head-2008-11-20/include/xen/balloon.h 2008-11-21 09:39:34.000000000 +0100
@@ -47,6 +47,10 @@ void balloon_update_driver_allowance(lon
struct page **alloc_empty_pages_and_pagevec(int nr_pages);
void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages);
+/* Free an empty page range (not allocated through
+ alloc_empty_pages_and_pagevec), adding to the balloon. */
+void free_empty_pages(struct page **pagevec, int nr_pages);
+
void balloon_release_driver_page(struct page *page);
/*

View File

@@ -0,0 +1,259 @@
From: jbeulich@novell.com
Subject: make i386 and x86 NMI code consistent, disable all APIC-related stuff
Patch-mainline: obsolete
References: 191115
---
arch/x86/kernel/Makefile | 1 -
arch/x86/kernel/cpu/Makefile | 2 +-
arch/x86/kernel/nmi.c | 13 ++++++++++---
arch/x86/kernel/traps_32-xen.c | 2 ++
arch/x86/kernel/traps_64-xen.c | 6 +++++-
arch/x86/mach-xen/setup.c | 4 ----
include/asm-x86/irq.h | 2 +-
include/asm-x86/nmi.h | 12 ++++++++----
kernel/sysctl.c | 2 ++
9 files changed, 29 insertions(+), 15 deletions(-)
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_CPU_FREQ) += cpufreq/
obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
+disabled-obj-$(CONFIG_XEN) := perfctr-watchdog.o
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -120,7 +120,6 @@ ifeq ($(CONFIG_X86_64),y)
obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
- obj-$(CONFIG_XEN) += nmi.o
time_64-$(CONFIG_XEN) += time_32.o
endif
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -27,7 +27,7 @@
#include <linux/kdebug.h>
#include <linux/smp.h>
-#ifndef CONFIG_XEN
+#ifdef ARCH_HAS_NMI_WATCHDOG
#include <asm/i8259.h>
#endif
#include <asm/io_apic.h>
@@ -41,6 +41,9 @@
#include <mach_traps.h>
int unknown_nmi_panic;
+
+#ifdef ARCH_HAS_NMI_WATCHDOG
+
int nmi_watchdog_enabled;
static cpumask_t backtrace_mask = CPU_MASK_NONE;
@@ -181,10 +184,8 @@ int __init check_nmi_watchdog(void)
kfree(prev_nmi_count);
return 0;
error:
-#ifndef CONFIG_XEN
if (nmi_watchdog == NMI_IO_APIC && !timer_through_8259)
disable_8259A_irq(0);
-#endif
#ifdef CONFIG_X86_32
timer_ack = 0;
#endif
@@ -460,6 +461,8 @@ nmi_watchdog_tick(struct pt_regs *regs,
return rc;
}
+#endif /* ARCH_HAS_NMI_WATCHDOG */
+
#ifdef CONFIG_SYSCTL
static int __init setup_unknown_nmi_panic(char *str)
@@ -479,6 +482,7 @@ static int unknown_nmi_panic_callback(st
return 0;
}
+#ifdef ARCH_HAS_NMI_WATCHDOG
/*
* proc handler for /proc/sys/kernel/nmi
*/
@@ -511,6 +515,7 @@ int proc_nmi_enabled(struct ctl_table *t
}
return 0;
}
+#endif
#endif /* CONFIG_SYSCTL */
@@ -523,6 +528,7 @@ int do_nmi_callback(struct pt_regs *regs
return 0;
}
+#ifdef ARCH_HAS_NMI_WATCHDOG
void __trigger_all_cpu_backtrace(void)
{
int i;
@@ -535,3 +541,4 @@ void __trigger_all_cpu_backtrace(void)
mdelay(1);
}
}
+#endif
--- a/arch/x86/kernel/traps_32-xen.c
+++ b/arch/x86/kernel/traps_32-xen.c
@@ -823,12 +823,14 @@ static notrace __kprobes void default_do
== NOTIFY_STOP)
return;
#ifdef CONFIG_X86_LOCAL_APIC
+#ifdef ARCH_HAS_NMI_WATCHDOG
/*
* Ok, so this is none of the documented NMI sources,
* so it must be the NMI watchdog.
*/
if (nmi_watchdog_tick(regs, reason))
return;
+#endif
if (!do_nmi_callback(regs, cpu))
unknown_nmi_error(reason, regs);
#else
--- a/arch/x86/kernel/traps_64-xen.c
+++ b/arch/x86/kernel/traps_64-xen.c
@@ -636,7 +636,7 @@ void die(const char *str, struct pt_regs
oops_end(flags, regs, SIGSEGV);
}
-#if defined(CONFIG_X86_LOCAL_APIC) || defined(CONFIG_SYSCTL)
+#ifdef CONFIG_SYSCTL
notrace __kprobes void
die_nmi(char *str, struct pt_regs *regs, int do_panic)
{
@@ -882,6 +882,7 @@ asmlinkage notrace __kprobes void defaul
== NOTIFY_STOP)
return;
#ifdef CONFIG_X86_LOCAL_APIC
+#ifdef ARCH_HAS_NMI_WATCHDOG
/*
* Ok, so this is none of the documented NMI sources,
* so it must be the NMI watchdog.
@@ -891,6 +892,9 @@ asmlinkage notrace __kprobes void defaul
#endif
if (!do_nmi_callback(regs, cpu))
unknown_nmi_error(reason, regs);
+#else
+ unknown_nmi_error(reason, regs);
+#endif
return;
}
--- a/arch/x86/mach-xen/setup.c
+++ b/arch/x86/mach-xen/setup.c
@@ -108,12 +108,10 @@ void __init machine_specific_arch_setup(
.address = CALLBACK_ADDR(system_call)
};
#endif
-#if defined(CONFIG_X86_LOCAL_APIC) || defined(CONFIG_X86_32)
static struct callback_register __initdata nmi_cb = {
.type = CALLBACKTYPE_nmi,
.address = CALLBACK_ADDR(nmi)
};
-#endif
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
if (ret == 0)
@@ -137,7 +135,6 @@ void __init machine_specific_arch_setup(
#endif
BUG_ON(ret);
-#if defined(CONFIG_X86_LOCAL_APIC) || defined(CONFIG_X86_32)
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
#if CONFIG_XEN_COMPAT <= 0x030002
if (ret == -ENOSYS) {
@@ -148,7 +145,6 @@ void __init machine_specific_arch_setup(
HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
}
#endif
-#endif
#ifdef CONFIG_X86_32
/* Do an early initialization of the fixmap area */
--- a/include/asm-x86/irq.h
+++ b/include/asm-x86/irq.h
@@ -15,7 +15,7 @@ static inline int irq_canonicalize(int i
return ((irq == 2) ? 9 : irq);
}
-#ifdef CONFIG_X86_LOCAL_APIC
+#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
# define ARCH_HAS_NMI_WATCHDOG
#endif
--- a/include/asm-x86/nmi.h
+++ b/include/asm-x86/nmi.h
@@ -5,8 +5,6 @@
#include <asm/irq.h>
#include <asm/io.h>
-#ifdef ARCH_HAS_NMI_WATCHDOG
-
/**
* do_nmi_callback
*
@@ -20,6 +18,11 @@ extern void default_do_nmi(struct pt_reg
#endif
extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
+
+extern int unknown_nmi_panic;
+
+#ifdef ARCH_HAS_NMI_WATCHDOG
+
extern int check_nmi_watchdog(void);
extern int nmi_watchdog_enabled;
extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
@@ -46,7 +49,6 @@ struct ctl_table;
struct file;
extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
void __user *, size_t *, loff_t *);
-extern int unknown_nmi_panic;
void __trigger_all_cpu_backtrace(void);
#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
@@ -69,7 +71,6 @@ static inline int nmi_watchdog_active(vo
*/
return nmi_watchdog & 0x3;
}
-#endif
void lapic_watchdog_stop(void);
int lapic_watchdog_init(unsigned nmi_hz);
@@ -78,6 +79,9 @@ unsigned lapic_adjust_nmi_hz(unsigned hz
int lapic_watchdog_ok(void);
void disable_lapic_nmi_watchdog(void);
void enable_lapic_nmi_watchdog(void);
+
+#endif
+
void stop_nmi(void);
void restart_nmi(void);
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -673,6 +673,7 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = &proc_dointvec,
},
+#ifdef ARCH_HAS_NMI_WATCHDOG
{
.procname = "nmi_watchdog",
.data = &nmi_watchdog_enabled,
@@ -681,6 +682,7 @@ static struct ctl_table kern_table[] = {
.proc_handler = &proc_nmi_enabled,
},
#endif
+#endif
#if defined(CONFIG_X86)
{
.ctl_name = KERN_PANIC_ON_NMI,

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,627 @@
From: jbeulich@novell.com
Subject: consolidate pmd/pud/pgd entry handling
Patch-mainline: obsolete
Index: head-2008-12-01/arch/x86/mm/hypervisor.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/hypervisor.c 2008-12-01 12:10:32.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/hypervisor.c 2008-12-01 12:13:06.000000000 +0100
@@ -356,31 +356,91 @@ void xen_l1_entry_update(pte_t *ptr, pte
}
EXPORT_SYMBOL_GPL(xen_l1_entry_update);
+static void do_lN_entry_update(mmu_update_t *mmu, unsigned int mmu_count,
+ struct page *page)
+{
+ if (likely(page)) {
+ multicall_entry_t mcl[2];
+ unsigned long pfn = page_to_pfn(page);
+
+ MULTI_update_va_mapping(mcl,
+ (unsigned long)__va(pfn << PAGE_SHIFT),
+ pfn_pte(pfn, PAGE_KERNEL_RO), 0);
+ SetPagePinned(page);
+ MULTI_mmu_update(mcl + 1, mmu, mmu_count, NULL, DOMID_SELF);
+ if (unlikely(HYPERVISOR_multicall_check(mcl, 2, NULL)))
+ BUG();
+ } else if (unlikely(HYPERVISOR_mmu_update(mmu, mmu_count,
+ NULL, DOMID_SELF) < 0))
+ BUG();
+}
+
void xen_l2_entry_update(pmd_t *ptr, pmd_t val)
{
mmu_update_t u;
+ struct page *page = NULL;
+
+ if (likely(pmd_present(val)) && likely(!pmd_large(val))
+ && likely(mem_map)
+ && likely(PagePinned(virt_to_page(ptr)))) {
+ page = pmd_page(val);
+ if (unlikely(PagePinned(page)))
+ page = NULL;
+ else if (PageHighMem(page)) {
+#ifdef CONFIG_HIGHPTE
+ BUG();
+#endif
+ kmap_flush_unused();
+ page = NULL;
+ }
+ }
u.ptr = virt_to_machine(ptr);
u.val = __pmd_val(val);
- BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
+ do_lN_entry_update(&u, 1, page);
}
#if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
void xen_l3_entry_update(pud_t *ptr, pud_t val)
{
mmu_update_t u;
+ struct page *page = NULL;
+
+ if (likely(pud_present(val))
+#ifdef CONFIG_X86_64
+ && likely(!pud_large(val))
+#endif
+ && likely(mem_map)
+ && likely(PagePinned(virt_to_page(ptr)))) {
+ page = pud_page(val);
+ if (unlikely(PagePinned(page)))
+ page = NULL;
+ }
u.ptr = virt_to_machine(ptr);
u.val = __pud_val(val);
- BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
+ do_lN_entry_update(&u, 1, page);
}
#endif
#ifdef CONFIG_X86_64
-void xen_l4_entry_update(pgd_t *ptr, pgd_t val)
+void xen_l4_entry_update(pgd_t *ptr, int user, pgd_t val)
{
- mmu_update_t u;
- u.ptr = virt_to_machine(ptr);
- u.val = __pgd_val(val);
- BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
+ mmu_update_t u[2];
+ struct page *page = NULL;
+
+ if (likely(pgd_present(val)) && likely(mem_map)
+ && likely(PagePinned(virt_to_page(ptr)))) {
+ page = pgd_page(val);
+ if (unlikely(PagePinned(page)))
+ page = NULL;
+ }
+ u[0].ptr = virt_to_machine(ptr);
+ u[0].val = __pgd_val(val);
+ if (user) {
+ u[1].ptr = virt_to_machine(__user_pgd(ptr));
+ u[1].val = __pgd_val(val);
+ do_lN_entry_update(u, 2, page);
+ } else
+ do_lN_entry_update(u, 1, page);
}
#endif /* CONFIG_X86_64 */
Index: head-2008-12-01/arch/x86/mm/init_32-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/init_32-xen.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/init_32-xen.c 2008-12-01 12:13:06.000000000 +0100
@@ -681,6 +681,8 @@ static void __init zone_sizes_init(void)
#endif
free_area_init_nodes(max_zone_pfns);
+
+ xen_init_pgd_pin();
}
void __init setup_bootmem_allocator(void)
@@ -1040,8 +1042,6 @@ void __init mem_init(void)
cpa_init();
save_pg_dir();
zap_low_mappings();
-
- SetPagePinned(virt_to_page(init_mm.pgd));
}
#ifdef CONFIG_MEMORY_HOTPLUG
Index: head-2008-12-01/arch/x86/mm/init_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/init_64-xen.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/init_64-xen.c 2008-12-01 12:13:06.000000000 +0100
@@ -195,7 +195,10 @@ set_pte_vaddr_pud(pud_t *pud_page, unsig
if (pud_none(*pud)) {
pmd = (pmd_t *) spp_getpage();
make_page_readonly(pmd, XENFEAT_writable_page_tables);
- pud_populate(&init_mm, pud, pmd);
+ if (!after_bootmem)
+ xen_l3_entry_update(pud, __pud(__pa(pmd) | _PAGE_TABLE));
+ else
+ pud_populate(&init_mm, pud, pmd);
if (pmd != pmd_offset(pud, 0)) {
printk(KERN_ERR "PAGETABLE BUG #01! %p <-> %p\n",
pmd, pmd_offset(pud, 0));
@@ -462,7 +465,6 @@ phys_pmd_init(pmd_t *pmd_page, unsigned
early_make_page_readonly(pte, XENFEAT_writable_page_tables);
*pmd = __pmd(pte_phys | _PAGE_TABLE);
} else {
- make_page_readonly(pte, XENFEAT_writable_page_tables);
spin_lock(&init_mm.page_table_lock);
pmd_populate_kernel(&init_mm, pmd, __va(pte_phys));
spin_unlock(&init_mm.page_table_lock);
@@ -529,7 +531,6 @@ phys_pud_init(pud_t *pud_page, unsigned
else
*pud = __pud(pmd_phys | _PAGE_TABLE);
} else {
- make_page_readonly(pmd, XENFEAT_writable_page_tables);
spin_lock(&init_mm.page_table_lock);
pud_populate(&init_mm, pud, __va(pmd_phys));
spin_unlock(&init_mm.page_table_lock);
@@ -824,7 +825,6 @@ static unsigned long __init kernel_physi
early_make_page_readonly(pud, XENFEAT_writable_page_tables);
xen_l4_entry_update(pgd, __pgd(pud_phys | _PAGE_TABLE));
} else {
- make_page_readonly(pud, XENFEAT_writable_page_tables);
spin_lock(&init_mm.page_table_lock);
pgd_populate(&init_mm, pgd, __va(pud_phys));
spin_unlock(&init_mm.page_table_lock);
@@ -1013,7 +1013,7 @@ void __init paging_init(void)
sparse_init();
free_area_init_nodes(max_zone_pfns);
- SetPagePinned(virt_to_page(init_mm.pgd));
+ xen_init_pgd_pin();
}
#endif
Index: head-2008-12-01/arch/x86/mm/ioremap-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/ioremap-xen.c 2008-12-01 12:07:15.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/ioremap-xen.c 2008-12-01 12:13:06.000000000 +0100
@@ -678,7 +678,7 @@ void __init early_ioremap_clear(void)
printk(KERN_INFO "early_ioremap_clear()\n");
pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN));
- pmd_clear(pmd);
+ xen_l2_entry_update(pmd, __pmd(0));
make_lowmem_page_writable(bm_pte, XENFEAT_writable_page_tables);
/* paravirt_release_pte(__pa(bm_pte) >> PAGE_SHIFT); */
__flush_tlb_all();
Index: head-2008-12-01/arch/x86/mm/pgtable-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/pgtable-xen.c 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:06.000000000 +0100
@@ -42,16 +42,16 @@ pgtable_t pte_alloc_one(struct mm_struct
void __pte_free(pgtable_t pte)
{
if (!PageHighMem(pte)) {
- unsigned long va = (unsigned long)page_address(pte);
- unsigned int level;
- pte_t *ptep = lookup_address(va, &level);
-
- BUG_ON(!ptep || level != PG_LEVEL_4K || !pte_present(*ptep));
- if (!pte_write(*ptep)
- && HYPERVISOR_update_va_mapping(va,
- mk_pte(pte, PAGE_KERNEL),
- 0))
- BUG();
+ if (PagePinned(pte)) {
+ unsigned long pfn = page_to_pfn(pte);
+
+ if (HYPERVISOR_update_va_mapping((unsigned long)__va(pfn << PAGE_SHIFT),
+ pfn_pte(pfn,
+ PAGE_KERNEL),
+ 0))
+ BUG();
+ ClearPagePinned(pte);
+ }
} else
#ifdef CONFIG_HIGHPTE
ClearPagePinned(pte);
@@ -93,14 +93,15 @@ pmd_t *pmd_alloc_one(struct mm_struct *m
void __pmd_free(pgtable_t pmd)
{
- unsigned long va = (unsigned long)page_address(pmd);
- unsigned int level;
- pte_t *ptep = lookup_address(va, &level);
-
- BUG_ON(!ptep || level != PG_LEVEL_4K || !pte_present(*ptep));
- if (!pte_write(*ptep)
- && HYPERVISOR_update_va_mapping(va, mk_pte(pmd, PAGE_KERNEL), 0))
- BUG();
+ if (PagePinned(pmd)) {
+ unsigned long pfn = page_to_pfn(pmd);
+
+ if (HYPERVISOR_update_va_mapping((unsigned long)__va(pfn << PAGE_SHIFT),
+ pfn_pte(pfn, PAGE_KERNEL),
+ 0))
+ BUG();
+ ClearPagePinned(pmd);
+ }
ClearPageForeign(pmd);
init_page_count(pmd);
@@ -192,21 +193,20 @@ static inline unsigned int pgd_walk_set_
{
unsigned long pfn = page_to_pfn(page);
- if (PageHighMem(page)) {
- if (pgprot_val(flags) & _PAGE_RW)
- ClearPagePinned(page);
- else
- SetPagePinned(page);
- } else {
- MULTI_update_va_mapping(per_cpu(pb_mcl, cpu) + seq,
- (unsigned long)__va(pfn << PAGE_SHIFT),
- pfn_pte(pfn, flags), 0);
- if (unlikely(++seq == PIN_BATCH)) {
- if (unlikely(HYPERVISOR_multicall_check(per_cpu(pb_mcl, cpu),
- PIN_BATCH, NULL)))
- BUG();
- seq = 0;
- }
+ if (pgprot_val(flags) & _PAGE_RW)
+ ClearPagePinned(page);
+ else
+ SetPagePinned(page);
+ if (PageHighMem(page))
+ return seq;
+ MULTI_update_va_mapping(per_cpu(pb_mcl, cpu) + seq,
+ (unsigned long)__va(pfn << PAGE_SHIFT),
+ pfn_pte(pfn, flags), 0);
+ if (unlikely(++seq == PIN_BATCH)) {
+ if (unlikely(HYPERVISOR_multicall_check(per_cpu(pb_mcl, cpu),
+ PIN_BATCH, NULL)))
+ BUG();
+ seq = 0;
}
return seq;
@@ -253,6 +253,16 @@ static void pgd_walk(pgd_t *pgd_base, pg
}
}
+#ifdef CONFIG_X86_PAE
+ for (; g < PTRS_PER_PGD; g++, pgd++) {
+ BUG_ON(pgd_none(*pgd));
+ pud = pud_offset(pgd, 0);
+ BUG_ON(pud_none(*pud));
+ pmd = pmd_offset(pud, 0);
+ seq = pgd_walk_set_prot(virt_to_page(pmd),flags,cpu,seq);
+ }
+#endif
+
mcl = per_cpu(pb_mcl, cpu);
#ifdef CONFIG_X86_64
if (unlikely(seq > PIN_BATCH - 2)) {
@@ -288,6 +298,51 @@ static void pgd_walk(pgd_t *pgd_base, pg
put_cpu();
}
+void __init xen_init_pgd_pin(void)
+{
+ pgd_t *pgd = init_mm.pgd;
+ pud_t *pud;
+ pmd_t *pmd;
+ unsigned int g, u, m;
+
+ if (xen_feature(XENFEAT_auto_translated_physmap))
+ return;
+
+ SetPagePinned(virt_to_page(pgd));
+ for (g = 0; g < PTRS_PER_PGD; g++, pgd++) {
+#ifndef CONFIG_X86_PAE
+ if (g >= pgd_index(HYPERVISOR_VIRT_START)
+ && g <= pgd_index(HYPERVISOR_VIRT_END - 1))
+ continue;
+#endif
+ if (!pgd_present(*pgd))
+ continue;
+ pud = pud_offset(pgd, 0);
+ if (PTRS_PER_PUD > 1) /* not folded */
+ SetPagePinned(virt_to_page(pud));
+ for (u = 0; u < PTRS_PER_PUD; u++, pud++) {
+ if (!pud_present(*pud))
+ continue;
+ pmd = pmd_offset(pud, 0);
+ if (PTRS_PER_PMD > 1) /* not folded */
+ SetPagePinned(virt_to_page(pmd));
+ for (m = 0; m < PTRS_PER_PMD; m++, pmd++) {
+#ifdef CONFIG_X86_PAE
+ if (g == pgd_index(HYPERVISOR_VIRT_START)
+ && m >= pmd_index(HYPERVISOR_VIRT_START))
+ continue;
+#endif
+ if (!pmd_present(*pmd))
+ continue;
+ SetPagePinned(pmd_page(*pmd));
+ }
+ }
+ }
+#ifdef CONFIG_X86_64
+ SetPagePinned(virt_to_page(level3_user_pgt));
+#endif
+}
+
static void __pgd_pin(pgd_t *pgd)
{
pgd_walk(pgd, PAGE_KERNEL_RO);
@@ -480,21 +535,18 @@ static void pgd_dtor(void *pgd)
void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
{
- struct page *page = virt_to_page(pmd);
- unsigned long pfn = page_to_pfn(page);
-
- paravirt_alloc_pmd(mm, __pa(pmd) >> PAGE_SHIFT);
-
/* Note: almost everything apart from _PAGE_PRESENT is
reserved at the pmd (PDPT) level. */
- if (PagePinned(virt_to_page(mm->pgd))) {
- BUG_ON(PageHighMem(page));
- BUG_ON(HYPERVISOR_update_va_mapping(
- (unsigned long)__va(pfn << PAGE_SHIFT),
- pfn_pte(pfn, PAGE_KERNEL_RO), 0));
- set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
- } else
- *pudp = __pud(__pa(pmd) | _PAGE_PRESENT);
+ pud_t pud = __pud(__pa(pmd) | _PAGE_PRESENT);
+
+ paravirt_alloc_pmd(mm, page_to_pfn(virt_to_page(pmd)));
+
+ if (likely(!PagePinned(virt_to_page(pudp)))) {
+ *pudp = pud;
+ return;
+ }
+
+ set_pud(pudp, pud);
/*
* According to Intel App note "TLBs, Paging-Structure Caches,
@@ -585,13 +637,10 @@ static void pgd_prepopulate_pmd(struct m
i++, pud++, addr += PUD_SIZE) {
pmd_t *pmd = pmds[i];
- if (i >= KERNEL_PGD_BOUNDARY) {
+ if (i >= KERNEL_PGD_BOUNDARY)
memcpy(pmd,
(pmd_t *)pgd_page_vaddr(swapper_pg_dir[i]),
sizeof(pmd_t) * PTRS_PER_PMD);
- make_lowmem_page_readonly(
- pmd, XENFEAT_writable_page_tables);
- }
/* It is safe to poke machine addresses of pmds under the pgd_lock. */
pud_populate(mm, pud, pmd);
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/hypervisor.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/hypervisor.h 2008-12-01 12:07:29.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/hypervisor.h 2008-12-01 12:13:06.000000000 +0100
@@ -94,10 +94,12 @@ void xen_invlpg(unsigned long ptr);
void xen_l1_entry_update(pte_t *ptr, pte_t val);
void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */
-void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */
+void xen_l4_entry_update(pgd_t *ptr, int user, pgd_t val); /* x86_64 only */
void xen_pgd_pin(unsigned long ptr);
void xen_pgd_unpin(unsigned long ptr);
+void xen_init_pgd_pin(void);
+
void xen_set_ldt(const void *ptr, unsigned int ents);
#ifdef CONFIG_SMP
@@ -323,6 +325,18 @@ MULTI_update_va_mapping(
}
static inline void
+MULTI_mmu_update(multicall_entry_t *mcl, mmu_update_t *req,
+ unsigned int count, unsigned int *success_count,
+ domid_t domid)
+{
+ mcl->op = __HYPERVISOR_mmu_update;
+ mcl->args[0] = (unsigned long)req;
+ mcl->args[1] = count;
+ mcl->args[2] = (unsigned long)success_count;
+ mcl->args[3] = domid;
+}
+
+static inline void
MULTI_grant_table_op(multicall_entry_t *mcl, unsigned int cmd,
void *uop, unsigned int count)
{
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgalloc.h 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc.h 2008-12-01 12:13:06.000000000 +0100
@@ -64,20 +64,16 @@ static inline void pmd_populate(struct m
struct page *pte)
{
unsigned long pfn = page_to_pfn(pte);
+ pmd_t ent = __pmd(((pmdval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE);
paravirt_alloc_pte(mm, pfn);
- if (PagePinned(virt_to_page(mm->pgd))) {
- if (!PageHighMem(pte))
- BUG_ON(HYPERVISOR_update_va_mapping(
- (unsigned long)__va(pfn << PAGE_SHIFT),
- pfn_pte(pfn, PAGE_KERNEL_RO), 0));
-#ifndef CONFIG_X86_64
- else if (!TestSetPagePinned(pte))
- kmap_flush_unused();
+ if (PagePinned(virt_to_page(pmd))) {
+#ifndef CONFIG_HIGHPTE
+ BUG_ON(PageHighMem(pte));
#endif
- set_pmd(pmd, __pmd(((pmdval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE));
+ set_pmd(pmd, ent);
} else
- *pmd = __pmd(((pmdval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE);
+ *pmd = ent;
}
#define pmd_pgtable(pmd) pmd_page(pmd)
@@ -99,39 +95,28 @@ extern void pud_populate(struct mm_struc
#else /* !CONFIG_X86_PAE */
static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
{
+ pud_t ent = __pud(_PAGE_TABLE | __pa(pmd));
+
paravirt_alloc_pmd(mm, __pa(pmd) >> PAGE_SHIFT);
- if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
- BUG_ON(HYPERVISOR_update_va_mapping(
- (unsigned long)pmd,
- pfn_pte(virt_to_phys(pmd)>>PAGE_SHIFT,
- PAGE_KERNEL_RO), 0));
- set_pud(pud, __pud(_PAGE_TABLE | __pa(pmd)));
- } else
- *pud = __pud(_PAGE_TABLE | __pa(pmd));
+ if (PagePinned(virt_to_page(pud)))
+ set_pud(pud, ent);
+ else
+ *pud = ent;
}
#endif /* CONFIG_X86_PAE */
#if PAGETABLE_LEVELS > 3
#define __user_pgd(pgd) ((pgd) + PTRS_PER_PGD)
-/*
- * We need to use the batch mode here, but pgd_pupulate() won't be
- * be called frequently.
- */
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
{
+ pgd_t ent = __pgd(_PAGE_TABLE | __pa(pud));
+
paravirt_alloc_pud(mm, __pa(pud) >> PAGE_SHIFT);
- if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
- BUG_ON(HYPERVISOR_update_va_mapping(
- (unsigned long)pud,
- pfn_pte(virt_to_phys(pud)>>PAGE_SHIFT,
- PAGE_KERNEL_RO), 0));
- set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)));
- set_pgd(__user_pgd(pgd), __pgd(_PAGE_TABLE | __pa(pud)));
- } else {
- *(pgd) = __pgd(_PAGE_TABLE | __pa(pud));
- *__user_pgd(pgd) = *(pgd);
- }
+ if (unlikely(PagePinned(virt_to_page(pgd))))
+ xen_l4_entry_update(pgd, 1, ent);
+ else
+ *__user_pgd(pgd) = *pgd = ent;
}
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable-3level.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable-3level.h 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable-3level.h 2008-12-01 12:13:06.000000000 +0100
@@ -76,12 +76,15 @@ static inline void __xen_pte_clear(pte_t
ptep->pte_high = 0;
}
-static inline void xen_pmd_clear(pmd_t *pmd)
-{
- xen_l2_entry_update(pmd, __pmd(0));
-}
+#define xen_pmd_clear(pmd) \
+({ \
+ pmd_t *__pmdp = (pmd); \
+ PagePinned(virt_to_page(__pmdp)) \
+ ? set_pmd(__pmdp, __pmd(0)) \
+ : (void)(*__pmdp = __pmd(0)); \
+})
-static inline void pud_clear(pud_t *pudp)
+static inline void __xen_pud_clear(pud_t *pudp)
{
pgdval_t pgd;
@@ -102,13 +105,21 @@ static inline void pud_clear(pud_t *pudp
xen_tlb_flush();
}
-#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PTE_PFN_MASK))
+#define xen_pud_clear(pudp) \
+({ \
+ pud_t *__pudp = (pudp); \
+ PagePinned(virt_to_page(__pudp)) \
+ ? __xen_pud_clear(__pudp) \
+ : (void)(*__pudp = __pud(0)); \
+})
+
+#define pud_page(pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT)
#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))
/* Find an entry in the second-level page table.. */
-#define pmd_offset(pud, address) ((pmd_t *)pud_page(*(pud)) + \
+#define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) + \
pmd_index(address))
#ifdef CONFIG_SMP
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 12:13:06.000000000 +0100
@@ -110,33 +110,41 @@ static inline void xen_set_pmd(pmd_t *pm
xen_l2_entry_update(pmdp, pmd);
}
-static inline void xen_pmd_clear(pmd_t *pmd)
-{
- xen_set_pmd(pmd, xen_make_pmd(0));
-}
+#define xen_pmd_clear(pmd) \
+({ \
+ pmd_t *__pmdp = (pmd); \
+ PagePinned(virt_to_page(__pmdp)) \
+ ? set_pmd(__pmdp, xen_make_pmd(0)) \
+ : (void)(*__pmdp = xen_make_pmd(0)); \
+})
static inline void xen_set_pud(pud_t *pudp, pud_t pud)
{
xen_l3_entry_update(pudp, pud);
}
-static inline void xen_pud_clear(pud_t *pud)
-{
- xen_set_pud(pud, xen_make_pud(0));
-}
+#define xen_pud_clear(pud) \
+({ \
+ pud_t *__pudp = (pud); \
+ PagePinned(virt_to_page(__pudp)) \
+ ? set_pud(__pudp, xen_make_pud(0)) \
+ : (void)(*__pudp = xen_make_pud(0)); \
+})
#define __user_pgd(pgd) ((pgd) + PTRS_PER_PGD)
static inline void xen_set_pgd(pgd_t *pgdp, pgd_t pgd)
{
- xen_l4_entry_update(pgdp, pgd);
+ xen_l4_entry_update(pgdp, 0, pgd);
}
-static inline void xen_pgd_clear(pgd_t *pgd)
-{
- xen_set_pgd(pgd, xen_make_pgd(0));
- xen_set_pgd(__user_pgd(pgd), xen_make_pgd(0));
-}
+#define xen_pgd_clear(pgd) \
+({ \
+ pgd_t *__pgdp = (pgd); \
+ PagePinned(virt_to_page(__pgdp)) \
+ ? xen_l4_entry_update(__pgdp, 1, xen_make_pgd(0)) \
+ : (void)(*__user_pgd(__pgdp) = *__pgdp = xen_make_pgd(0)); \
+})
#define pte_same(a, b) ((a).pte == (b).pte)

View File

@@ -0,0 +1,168 @@
From: jbeulich@novell.com
Subject: fix issues with the assignment of huge amounts of memory
Patch-mainline: obsolete
At the same time remove the non-applicable and broken support for the
memmap= command line option.
Also fix the overlap of the modules area with the fixmaps on x86-64.
Index: head-2008-11-25/arch/x86/kernel/e820-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/e820-xen.c 2008-11-27 10:20:43.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/e820-xen.c 2008-11-25 13:18:07.000000000 +0100
@@ -1235,6 +1235,26 @@ static int __init parse_memopt(char *p)
i = e820.nr_map - 1;
current_end = e820.map[i].addr + e820.map[i].size;
+
+ /*
+ * A little less than 2% of available memory are needed for page
+ * tables, p2m map, and mem_map. Hence the maximum amount of memory
+ * we can potentially balloon up to can in no case exceed about 50
+ * times of what we've been given initially. Since even with that we
+ * won't be able to boot (due to various calculations done based on
+ * the total number of pages) we further restrict this to factor 32.
+ */
+ if ((mem_size >> (PAGE_SHIFT + 5)) > xen_start_info->nr_pages) {
+ u64 size = (u64)xen_start_info->nr_pages << 5;
+
+ printk(KERN_WARNING "mem=%Luk is invalid for an initial"
+ " allocation of %luk, using %Luk\n",
+ (unsigned long long)mem_size >> 10,
+ xen_start_info->nr_pages << (PAGE_SHIFT - 10),
+ (unsigned long long)size << (PAGE_SHIFT - 10));
+ mem_size = size << PAGE_SHIFT;
+ }
+
if (current_end < mem_size) {
/*
* The e820 map ends before our requested size so
@@ -1294,6 +1314,7 @@ static int __init parse_memmap_opt(char
return *p == '\0' ? 0 : -EINVAL;
}
early_param("memmap", parse_memmap_opt);
+#endif
void __init finish_e820_parsing(void)
{
@@ -1308,7 +1329,6 @@ void __init finish_e820_parsing(void)
e820_print_map("user");
}
}
-#endif
static inline const char *e820_type_to_string(int e820_type)
{
Index: head-2008-11-25/arch/x86/kernel/setup-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/setup-xen.c 2008-11-17 13:58:02.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/setup-xen.c 2008-11-27 10:26:10.000000000 +0100
@@ -128,12 +128,7 @@ static struct notifier_block xen_panic_b
unsigned long *phys_to_machine_mapping;
EXPORT_SYMBOL(phys_to_machine_mapping);
-unsigned long *pfn_to_mfn_frame_list_list,
-#ifdef CONFIG_X86_64
- *pfn_to_mfn_frame_list[512];
-#else
- *pfn_to_mfn_frame_list[128];
-#endif
+unsigned long *pfn_to_mfn_frame_list_list, **pfn_to_mfn_frame_list;
/* Raw start-of-day parameters from the hypervisor. */
start_info_t *xen_start_info;
@@ -1055,17 +1050,17 @@ void __init setup_arch(char **cmdline_p)
p2m_pages = xen_start_info->nr_pages;
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
- unsigned long i, j;
+ unsigned long i, j, size;
unsigned int k, fpp;
/* Make sure we have a large enough P->M table. */
phys_to_machine_mapping = alloc_bootmem_pages(
max_pfn * sizeof(unsigned long));
- memset(phys_to_machine_mapping, ~0,
- max_pfn * sizeof(unsigned long));
memcpy(phys_to_machine_mapping,
(unsigned long *)xen_start_info->mfn_list,
p2m_pages * sizeof(unsigned long));
+ memset(phys_to_machine_mapping + p2m_pages, ~0,
+ (max_pfn - p2m_pages) * sizeof(unsigned long));
free_bootmem(
__pa(xen_start_info->mfn_list),
PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
@@ -1075,15 +1070,26 @@ void __init setup_arch(char **cmdline_p)
* Initialise the list of the frames that specify the list of
* frames that make up the p2m table. Used by save/restore.
*/
- pfn_to_mfn_frame_list_list = alloc_bootmem_pages(PAGE_SIZE);
-
fpp = PAGE_SIZE/sizeof(unsigned long);
+ size = (max_pfn + fpp - 1) / fpp;
+ size = (size + fpp - 1) / fpp;
+ ++size; /* include a zero terminator for crash tools */
+ size *= sizeof(unsigned long);
+ pfn_to_mfn_frame_list_list = alloc_bootmem_pages(size);
+ if (size > PAGE_SIZE
+ && xen_create_contiguous_region((unsigned long)
+ pfn_to_mfn_frame_list_list,
+ get_order(size), 0))
+ BUG();
+ size -= sizeof(unsigned long);
+ pfn_to_mfn_frame_list = alloc_bootmem(size);
+
for (i = j = 0, k = -1; i < max_pfn; i += fpp, j++) {
if (j == fpp)
j = 0;
if (j == 0) {
k++;
- BUG_ON(k>=ARRAY_SIZE(pfn_to_mfn_frame_list));
+ BUG_ON(k * sizeof(unsigned long) >= size);
pfn_to_mfn_frame_list[k] =
alloc_bootmem_pages(PAGE_SIZE);
pfn_to_mfn_frame_list_list[k] =
Index: head-2008-11-25/arch/x86/mm/init_64-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/mm/init_64-xen.c 2008-11-17 13:58:22.000000000 +0100
+++ head-2008-11-25/arch/x86/mm/init_64-xen.c 2008-11-25 13:18:07.000000000 +0100
@@ -660,6 +660,13 @@ static void __init extend_init_mapping(u
while (va < (__START_KERNEL_map
+ (table_cur << PAGE_SHIFT)
+ tables_space)) {
+ if (!pmd_index(va) && !pte_index(va)) {
+ page = (unsigned long *)init_level4_pgt;
+ addr = page[pgd_index(va)];
+ addr_to_page(addr, page);
+ addr = page[pud_index(va)];
+ addr_to_page(addr, page);
+ }
pmd = (pmd_t *)&page[pmd_index(va)];
if (pmd_none(*pmd)) {
pte_page = alloc_static_page(&phys);
Index: head-2008-11-25/drivers/xen/core/machine_reboot.c
===================================================================
--- head-2008-11-25.orig/drivers/xen/core/machine_reboot.c 2008-11-18 18:17:30.000000000 +0100
+++ head-2008-11-25/drivers/xen/core/machine_reboot.c 2008-11-25 13:18:07.000000000 +0100
@@ -84,7 +84,7 @@ static void post_suspend(int suspend_can
unsigned long shinfo_mfn;
extern unsigned long max_pfn;
extern unsigned long *pfn_to_mfn_frame_list_list;
- extern unsigned long *pfn_to_mfn_frame_list[];
+ extern unsigned long **pfn_to_mfn_frame_list;
if (suspend_cancelled) {
xen_start_info->store_mfn =
Index: head-2008-11-25/include/asm-x86/mach-xen/asm/pgtable_64.h
===================================================================
--- head-2008-11-25.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-11-18 17:46:21.000000000 +0100
+++ head-2008-11-25/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-11-25 13:18:07.000000000 +0100
@@ -158,7 +158,7 @@ static inline void xen_set_pgd(pgd_t *pg
#define PGDIR_MASK (~(PGDIR_SIZE - 1))
-#define MAXMEM _AC(0x00003fffffffffff, UL)
+#define MAXMEM _AC(0x000000dfffffffff, UL)
#define VMALLOC_START _AC(0xffffc20000000000, UL)
#define VMALLOC_END _AC(0xffffe1ffffffffff, UL)
#define VMEMMAP_START _AC(0xffffe20000000000, UL)

View File

@@ -0,0 +1,210 @@
From: jbeulich@novell.com
Subject: properly predict phys<->mach translations
Patch-mainline: obsolete
Index: head-2008-11-04/include/asm-x86/mach-xen/asm/maddr_32.h
===================================================================
--- head-2008-11-04.orig/include/asm-x86/mach-xen/asm/maddr_32.h 2008-11-04 11:54:55.000000000 +0100
+++ head-2008-11-04/include/asm-x86/mach-xen/asm/maddr_32.h 2008-10-17 12:45:23.000000000 +0200
@@ -30,17 +30,19 @@ extern unsigned int machine_to_phys_or
static inline unsigned long pfn_to_mfn(unsigned long pfn)
{
- if (xen_feature(XENFEAT_auto_translated_physmap))
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
return pfn;
- BUG_ON(max_mapnr && pfn >= max_mapnr);
+ if (likely(max_mapnr))
+ BUG_ON(pfn >= max_mapnr);
return phys_to_machine_mapping[pfn] & ~FOREIGN_FRAME_BIT;
}
static inline int phys_to_machine_mapping_valid(unsigned long pfn)
{
- if (xen_feature(XENFEAT_auto_translated_physmap))
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
return 1;
- BUG_ON(max_mapnr && pfn >= max_mapnr);
+ if (likely(max_mapnr))
+ BUG_ON(pfn >= max_mapnr);
return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
}
@@ -48,7 +50,7 @@ static inline unsigned long mfn_to_pfn(u
{
unsigned long pfn;
- if (xen_feature(XENFEAT_auto_translated_physmap))
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
return mfn;
if (unlikely((mfn >> machine_to_phys_order) != 0))
@@ -95,17 +97,18 @@ static inline unsigned long mfn_to_pfn(u
static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
{
unsigned long pfn = mfn_to_pfn(mfn);
- if ((pfn < max_mapnr)
- && !xen_feature(XENFEAT_auto_translated_physmap)
- && (phys_to_machine_mapping[pfn] != mfn))
+ if (likely(pfn < max_mapnr)
+ && likely(!xen_feature(XENFEAT_auto_translated_physmap))
+ && unlikely(phys_to_machine_mapping[pfn] != mfn))
return max_mapnr; /* force !pfn_valid() */
return pfn;
}
static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
{
- BUG_ON(max_mapnr && pfn >= max_mapnr);
- if (xen_feature(XENFEAT_auto_translated_physmap)) {
+ if (likely(max_mapnr))
+ BUG_ON(pfn >= max_mapnr);
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) {
BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
return;
}
Index: head-2008-11-04/include/asm-x86/mach-xen/asm/maddr_64.h
===================================================================
--- head-2008-11-04.orig/include/asm-x86/mach-xen/asm/maddr_64.h 2008-11-04 11:54:55.000000000 +0100
+++ head-2008-11-04/include/asm-x86/mach-xen/asm/maddr_64.h 2008-10-17 12:46:35.000000000 +0200
@@ -25,17 +25,19 @@ extern unsigned int machine_to_phys_or
static inline unsigned long pfn_to_mfn(unsigned long pfn)
{
- if (xen_feature(XENFEAT_auto_translated_physmap))
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
return pfn;
- BUG_ON(max_mapnr && pfn >= max_mapnr);
+ if (likely(max_mapnr))
+ BUG_ON(pfn >= max_mapnr);
return phys_to_machine_mapping[pfn] & ~FOREIGN_FRAME_BIT;
}
static inline int phys_to_machine_mapping_valid(unsigned long pfn)
{
- if (xen_feature(XENFEAT_auto_translated_physmap))
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
return 1;
- BUG_ON(max_mapnr && pfn >= max_mapnr);
+ if (likely(max_mapnr))
+ BUG_ON(pfn >= max_mapnr);
return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
}
@@ -43,7 +45,7 @@ static inline unsigned long mfn_to_pfn(u
{
unsigned long pfn;
- if (xen_feature(XENFEAT_auto_translated_physmap))
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
return mfn;
if (unlikely((mfn >> machine_to_phys_order) != 0))
@@ -90,17 +92,18 @@ static inline unsigned long mfn_to_pfn(u
static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
{
unsigned long pfn = mfn_to_pfn(mfn);
- if ((pfn < max_mapnr)
- && !xen_feature(XENFEAT_auto_translated_physmap)
- && (phys_to_machine_mapping[pfn] != mfn))
+ if (likely(pfn < max_mapnr)
+ && likely(!xen_feature(XENFEAT_auto_translated_physmap))
+ && unlikely(phys_to_machine_mapping[pfn] != mfn))
return max_mapnr; /* force !pfn_valid() */
return pfn;
}
static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
{
- BUG_ON(max_mapnr && pfn >= max_mapnr);
- if (xen_feature(XENFEAT_auto_translated_physmap)) {
+ if (likely(max_mapnr))
+ BUG_ON(pfn >= max_mapnr);
+ if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) {
BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
return;
}
Index: head-2008-11-04/include/asm-x86/mach-xen/asm/page.h
===================================================================
--- head-2008-11-04.orig/include/asm-x86/mach-xen/asm/page.h 2008-11-04 11:55:22.000000000 +0100
+++ head-2008-11-04/include/asm-x86/mach-xen/asm/page.h 2008-10-17 12:53:40.000000000 +0200
@@ -102,7 +102,7 @@ static inline void copy_user_page(void *
#define __pgd_ma(x) ((pgd_t) { (x) } )
static inline pgd_t xen_make_pgd(pgdval_t val)
{
- if (val & _PAGE_PRESENT)
+ if (likely(val & _PAGE_PRESENT))
val = pte_phys_to_machine(val);
return (pgd_t) { val };
}
@@ -112,10 +112,10 @@ static inline pgdval_t xen_pgd_val(pgd_t
{
pgdval_t ret = __pgd_val(pgd);
#if PAGETABLE_LEVELS == 2 && CONFIG_XEN_COMPAT <= 0x030002
- if (ret)
+ if (likely(ret))
ret = machine_to_phys(ret) | _PAGE_PRESENT;
#else
- if (ret & _PAGE_PRESENT)
+ if (likely(ret & _PAGE_PRESENT))
ret = pte_machine_to_phys(ret);
#endif
return ret;
@@ -128,7 +128,7 @@ typedef struct { pudval_t pud; } pud_t;
#define __pud_ma(x) ((pud_t) { (x) } )
static inline pud_t xen_make_pud(pudval_t val)
{
- if (val & _PAGE_PRESENT)
+ if (likely(val & _PAGE_PRESENT))
val = pte_phys_to_machine(val);
return (pud_t) { val };
}
@@ -137,7 +137,7 @@ static inline pud_t xen_make_pud(pudval_
static inline pudval_t xen_pud_val(pud_t pud)
{
pudval_t ret = __pud_val(pud);
- if (ret & _PAGE_PRESENT)
+ if (likely(ret & _PAGE_PRESENT))
ret = pte_machine_to_phys(ret);
return ret;
}
@@ -156,7 +156,7 @@ typedef struct { pmdval_t pmd; } pmd_t;
#define __pmd_ma(x) ((pmd_t) { (x) } )
static inline pmd_t xen_make_pmd(pmdval_t val)
{
- if (val & _PAGE_PRESENT)
+ if (likely(val & _PAGE_PRESENT))
val = pte_phys_to_machine(val);
return (pmd_t) { val };
}
@@ -166,10 +166,10 @@ static inline pmdval_t xen_pmd_val(pmd_t
{
pmdval_t ret = __pmd_val(pmd);
#if CONFIG_XEN_COMPAT <= 0x030002
- if (ret)
+ if (likely(ret))
ret = pte_machine_to_phys(ret) | _PAGE_PRESENT;
#else
- if (ret & _PAGE_PRESENT)
+ if (likely(ret & _PAGE_PRESENT))
ret = pte_machine_to_phys(ret);
#endif
return ret;
@@ -188,7 +188,7 @@ static inline pmdval_t xen_pmd_val(pmd_t
#define __pte_ma(x) ((pte_t) { .pte = (x) } )
static inline pte_t xen_make_pte(pteval_t val)
{
- if ((val & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT)
+ if (likely((val & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT))
val = pte_phys_to_machine(val);
return (pte_t) { .pte = val };
}
@@ -197,7 +197,7 @@ static inline pte_t xen_make_pte(pteval_
static inline pteval_t xen_pte_val(pte_t pte)
{
pteval_t ret = __pte_val(pte);
- if ((pte.pte_low & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT)
+ if (likely((pte.pte_low & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT))
ret = pte_machine_to_phys(ret);
return ret;
}

View File

@@ -0,0 +1,57 @@
From: jbeulich@novell.com
Subject: ensure inadvertent uses of lazy TLB data are caught during the build
Patch-mainline: obsolete
Index: head-2008-11-17/arch/x86/kernel/cpu/common_64-xen.c
===================================================================
--- head-2008-11-17.orig/arch/x86/kernel/cpu/common_64-xen.c 2008-11-17 14:06:21.000000000 +0100
+++ head-2008-11-17/arch/x86/kernel/cpu/common_64-xen.c 2008-11-17 14:07:10.000000000 +0100
@@ -557,8 +557,10 @@ void pda_init(int cpu)
pda->irqcount = -1;
pda->kernelstack = (unsigned long)stack_thread_info() -
PDA_STACKOFFSET + THREAD_SIZE;
+#ifndef CONFIG_XEN
pda->active_mm = &init_mm;
pda->mmu_state = 0;
+#endif
if (cpu == 0) {
/* others are initialized in smpboot.c */
Index: head-2008-11-17/include/asm-x86/mach-xen/asm/tlbflush.h
===================================================================
--- head-2008-11-17.orig/include/asm-x86/mach-xen/asm/tlbflush.h 2008-11-17 13:41:59.000000000 +0100
+++ head-2008-11-17/include/asm-x86/mach-xen/asm/tlbflush.h 2008-11-17 14:07:10.000000000 +0100
@@ -82,6 +82,7 @@ static inline void flush_tlb_range(struc
flush_tlb_mm(vma->vm_mm);
}
+#ifndef CONFIG_XEN
#define TLBSTATE_OK 1
#define TLBSTATE_LAZY 2
@@ -93,6 +94,7 @@ struct tlb_state {
};
DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
#endif
+#endif
#endif /* SMP */
Index: head-2008-11-17/include/asm-x86/pda.h
===================================================================
--- head-2008-11-17.orig/include/asm-x86/pda.h 2008-11-17 13:15:55.000000000 +0100
+++ head-2008-11-17/include/asm-x86/pda.h 2008-11-17 14:07:10.000000000 +0100
@@ -26,9 +26,13 @@ struct x8664_pda {
short in_bootmem; /* pda lives in bootmem */
unsigned int __softirq_pending;
unsigned int __nmi_count; /* number of NMI on this CPUs */
+#ifndef CONFIG_XEN
short mmu_state;
short isidle;
struct mm_struct *active_mm;
+#else
+ short isidle;
+#endif
unsigned apic_timer_irqs;
unsigned irq0_irqs;
unsigned irq_resched_count;

View File

@@ -0,0 +1,67 @@
Subject: be more aggressive about de-activating mm-s under destruction
From: jbeulich@novell.com
Patch-mainline: obsolete
... by not only handling the current task on the CPU arch_exit_mmap()
gets executed on, but also forcing remote CPUs to do so.
Index: head-2008-12-01/arch/x86/mm/pgtable-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:06.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:16.000000000 +0100
@@ -418,27 +418,44 @@ void arch_dup_mmap(struct mm_struct *old
mm_pin(mm);
}
-void arch_exit_mmap(struct mm_struct *mm)
+/*
+ * We aggressively remove defunct pgd from cr3. We execute unmap_vmas() *much*
+ * faster this way, as no hypercalls are needed for the page table updates.
+ */
+static void leave_active_mm(struct task_struct *tsk, struct mm_struct *mm)
+ __releases(tsk->alloc_lock)
{
- struct task_struct *tsk = current;
-
- task_lock(tsk);
-
- /*
- * We aggressively remove defunct pgd from cr3. We execute unmap_vmas()
- * *much* faster this way, as no tlb flushes means bigger wrpt batches.
- */
if (tsk->active_mm == mm) {
tsk->active_mm = &init_mm;
atomic_inc(&init_mm.mm_count);
switch_mm(mm, &init_mm, tsk);
- atomic_dec(&mm->mm_count);
- BUG_ON(atomic_read(&mm->mm_count) == 0);
+ if (atomic_dec_and_test(&mm->mm_count))
+ BUG();
}
task_unlock(tsk);
+}
+
+static void _leave_active_mm(void *mm)
+{
+ struct task_struct *tsk = current;
+
+ if (spin_trylock(&tsk->alloc_lock))
+ leave_active_mm(tsk, mm);
+}
+
+void arch_exit_mmap(struct mm_struct *mm)
+{
+ struct task_struct *tsk = current;
+
+ task_lock(tsk);
+ leave_active_mm(tsk, mm);
+
+ preempt_disable();
+ smp_call_function_mask(mm->cpu_vm_mask, _leave_active_mm, mm, 1);
+ preempt_enable();
if (PagePinned(virt_to_page(mm->pgd))
&& atomic_read(&mm->mm_count) == 1

View File

@@ -0,0 +1,25 @@
From: jbeulich@novell.com
Subject: Parse oops=panic (match x86-64)
Patch-mainline: obsolete
Index: head-2008-11-25/arch/x86/kernel/traps_32-xen.c
===================================================================
--- head-2008-11-25.orig/arch/x86/kernel/traps_32-xen.c 2008-11-25 13:17:46.000000000 +0100
+++ head-2008-11-25/arch/x86/kernel/traps_32-xen.c 2008-11-25 13:18:12.000000000 +0100
@@ -1277,6 +1277,16 @@ void __cpuinit smp_trap_init(trap_info_t
}
}
+static int __init oops_setup(char *s)
+{
+ if (!s)
+ return -EINVAL;
+ if (!strcmp(s, "panic"))
+ panic_on_oops = 1;
+ return 0;
+}
+early_param("oops", oops_setup);
+
static int __init kstack_setup(char *s)
{
kstack_depth_to_print = simple_strtoul(s, NULL, 0);

View File

@@ -0,0 +1,119 @@
From: jbeulich@novell.com
Subject: make pinning of pgd pairs transparent to callers
Patch-mainline: obsolete
Index: head-2008-12-01/arch/x86/mm/hypervisor.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/hypervisor.c 2008-12-01 12:13:06.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/hypervisor.c 2008-12-01 12:13:22.000000000 +0100
@@ -517,26 +517,38 @@ void xen_invlpg_mask(cpumask_t *mask, un
#endif /* CONFIG_SMP */
-void xen_pgd_pin(unsigned long ptr)
-{
- struct mmuext_op op;
#ifdef CONFIG_X86_64
- op.cmd = MMUEXT_PIN_L4_TABLE;
-#elif defined(CONFIG_X86_PAE)
- op.cmd = MMUEXT_PIN_L3_TABLE;
+#define NR_PGD_PIN_OPS 2
#else
- op.cmd = MMUEXT_PIN_L2_TABLE;
+#define NR_PGD_PIN_OPS 1
#endif
- op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
- BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
+
+void xen_pgd_pin(pgd_t *pgd)
+{
+ struct mmuext_op op[NR_PGD_PIN_OPS];
+
+ op[0].cmd = MMUEXT_PIN_L3_TABLE;
+ op[0].arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
+#ifdef CONFIG_X86_64
+ op[1].cmd = op[0].cmd = MMUEXT_PIN_L4_TABLE;
+ op[1].arg1.mfn = pfn_to_mfn(__pa(__user_pgd(pgd)) >> PAGE_SHIFT);
+#endif
+ if (HYPERVISOR_mmuext_op(op, NR_PGD_PIN_OPS, NULL, DOMID_SELF) < 0)
+ BUG();
}
-void xen_pgd_unpin(unsigned long ptr)
+void xen_pgd_unpin(pgd_t *pgd)
{
- struct mmuext_op op;
- op.cmd = MMUEXT_UNPIN_TABLE;
- op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
- BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
+ struct mmuext_op op[NR_PGD_PIN_OPS];
+
+ op[0].cmd = MMUEXT_UNPIN_TABLE;
+ op[0].arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
+#ifdef CONFIG_X86_64
+ op[1].cmd = MMUEXT_UNPIN_TABLE;
+ op[1].arg1.mfn = pfn_to_mfn(__pa(__user_pgd(pgd)) >> PAGE_SHIFT);
+#endif
+ if (HYPERVISOR_mmuext_op(op, NR_PGD_PIN_OPS, NULL, DOMID_SELF) < 0)
+ BUG();
}
void xen_set_ldt(const void *ptr, unsigned int ents)
Index: head-2008-12-01/arch/x86/mm/init_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/init_64-xen.c 2008-12-01 12:13:13.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/init_64-xen.c 2008-12-01 12:13:22.000000000 +0100
@@ -629,10 +629,8 @@ void __init xen_init_pt(void)
early_make_page_readonly(level1_fixmap_pgt,
XENFEAT_writable_page_tables);
- if (!xen_feature(XENFEAT_writable_page_tables)) {
- xen_pgd_pin(__pa_symbol(init_level4_pgt));
- xen_pgd_pin(__pa_symbol(__user_pgd(init_level4_pgt)));
- }
+ if (!xen_feature(XENFEAT_writable_page_tables))
+ xen_pgd_pin(init_level4_pgt);
}
static void __init extend_init_mapping(unsigned long tables_space)
Index: head-2008-12-01/arch/x86/mm/pgtable-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:16.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:22.000000000 +0100
@@ -347,19 +347,13 @@ static void __pgd_pin(pgd_t *pgd)
{
pgd_walk(pgd, PAGE_KERNEL_RO);
kmap_flush_unused();
- xen_pgd_pin(__pa(pgd)); /* kernel */
-#ifdef CONFIG_X86_64
- xen_pgd_pin(__pa(__user_pgd(pgd))); /* user */
-#endif
+ xen_pgd_pin(pgd);
SetPagePinned(virt_to_page(pgd));
}
static void __pgd_unpin(pgd_t *pgd)
{
- xen_pgd_unpin(__pa(pgd));
-#ifdef CONFIG_X86_64
- xen_pgd_unpin(__pa(__user_pgd(pgd)));
-#endif
+ xen_pgd_unpin(pgd);
pgd_walk(pgd, PAGE_KERNEL);
ClearPagePinned(virt_to_page(pgd));
}
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/hypervisor.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/hypervisor.h 2008-12-01 12:13:06.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/hypervisor.h 2008-12-01 12:13:22.000000000 +0100
@@ -95,8 +95,8 @@ void xen_l1_entry_update(pte_t *ptr, pte
void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */
void xen_l4_entry_update(pgd_t *ptr, int user, pgd_t val); /* x86_64 only */
-void xen_pgd_pin(unsigned long ptr);
-void xen_pgd_unpin(unsigned long ptr);
+void xen_pgd_pin(pgd_t *);
+void xen_pgd_unpin(pgd_t *);
void xen_init_pgd_pin(void);

View File

@@ -0,0 +1,370 @@
From: jbeulich@novell.com
Subject: don't require order-1 allocations for pgd-s
Patch-mainline: obsolete
At the same time remove the useless user mode pair of init_level4_pgt.
Index: head-2008-12-01/arch/x86/kernel/cpu/common_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/cpu/common_64-xen.c 2008-12-01 12:13:15.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/cpu/common_64-xen.c 2008-12-01 12:13:27.000000000 +0100
@@ -530,8 +530,7 @@ static void __init_refok switch_pt(int c
#ifdef CONFIG_XEN
if (cpu == 0)
xen_init_pt();
- xen_pt_switch(__pa_symbol(init_level4_pgt));
- xen_new_user_pt(__pa_symbol(__user_pgd(init_level4_pgt)));
+ xen_pt_switch(init_level4_pgt);
#endif
}
Index: head-2008-12-01/arch/x86/kernel/head_64-xen.S
===================================================================
--- head-2008-12-01.orig/arch/x86/kernel/head_64-xen.S 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/arch/x86/kernel/head_64-xen.S 2008-12-01 12:13:27.000000000 +0100
@@ -44,14 +44,6 @@ ENTRY(name)
NEXT_PAGE(init_level4_pgt)
.fill 512,8,0
- /*
- * We update two pgd entries to make kernel and user pgd consistent
- * at pgd_populate(). It can be used for kernel modules. So we place
- * this page here for those cases to avoid memory corruption.
- * We also use this page to establish the initial mapping for the
- * vsyscall area.
- */
- .fill 512,8,0
NEXT_PAGE(level3_kernel_pgt)
.fill 512,8,0
Index: head-2008-12-01/arch/x86/mm/hypervisor.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/hypervisor.c 2008-12-01 12:13:22.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/hypervisor.c 2008-12-01 12:13:27.000000000 +0100
@@ -422,7 +422,7 @@ void xen_l3_entry_update(pud_t *ptr, pud
#endif
#ifdef CONFIG_X86_64
-void xen_l4_entry_update(pgd_t *ptr, int user, pgd_t val)
+void xen_l4_entry_update(pgd_t *ptr, pgd_t val)
{
mmu_update_t u[2];
struct page *page = NULL;
@@ -435,8 +435,10 @@ void xen_l4_entry_update(pgd_t *ptr, int
}
u[0].ptr = virt_to_machine(ptr);
u[0].val = __pgd_val(val);
- if (user) {
- u[1].ptr = virt_to_machine(__user_pgd(ptr));
+ if (((unsigned long)ptr & ~PAGE_MASK)
+ < pgd_index(__HYPERVISOR_VIRT_START) * sizeof(*ptr)
+ && (ptr = __user_pgd(ptr)) != NULL) {
+ u[1].ptr = virt_to_machine(ptr);
u[1].val = __pgd_val(val);
do_lN_entry_update(u, 2, page);
} else
@@ -444,21 +446,25 @@ void xen_l4_entry_update(pgd_t *ptr, int
}
#endif /* CONFIG_X86_64 */
-void xen_pt_switch(unsigned long ptr)
+#ifdef CONFIG_X86_64
+void xen_pt_switch(pgd_t *pgd)
{
struct mmuext_op op;
op.cmd = MMUEXT_NEW_BASEPTR;
- op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+ op.arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
}
-void xen_new_user_pt(unsigned long ptr)
+void xen_new_user_pt(pgd_t *pgd)
{
struct mmuext_op op;
+
+ pgd = __user_pgd(pgd);
op.cmd = MMUEXT_NEW_USER_BASEPTR;
- op.arg1.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+ op.arg1.mfn = pgd ? pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT) : 0;
BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
}
+#endif
void xen_tlb_flush(void)
{
@@ -526,28 +532,38 @@ void xen_invlpg_mask(cpumask_t *mask, un
void xen_pgd_pin(pgd_t *pgd)
{
struct mmuext_op op[NR_PGD_PIN_OPS];
+ unsigned int nr = NR_PGD_PIN_OPS;
op[0].cmd = MMUEXT_PIN_L3_TABLE;
op[0].arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
#ifdef CONFIG_X86_64
op[1].cmd = op[0].cmd = MMUEXT_PIN_L4_TABLE;
- op[1].arg1.mfn = pfn_to_mfn(__pa(__user_pgd(pgd)) >> PAGE_SHIFT);
+ pgd = __user_pgd(pgd);
+ if (pgd)
+ op[1].arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
+ else
+ nr = 1;
#endif
- if (HYPERVISOR_mmuext_op(op, NR_PGD_PIN_OPS, NULL, DOMID_SELF) < 0)
+ if (HYPERVISOR_mmuext_op(op, nr, NULL, DOMID_SELF) < 0)
BUG();
}
void xen_pgd_unpin(pgd_t *pgd)
{
struct mmuext_op op[NR_PGD_PIN_OPS];
+ unsigned int nr = NR_PGD_PIN_OPS;
op[0].cmd = MMUEXT_UNPIN_TABLE;
op[0].arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
#ifdef CONFIG_X86_64
- op[1].cmd = MMUEXT_UNPIN_TABLE;
- op[1].arg1.mfn = pfn_to_mfn(__pa(__user_pgd(pgd)) >> PAGE_SHIFT);
+ pgd = __user_pgd(pgd);
+ if (pgd) {
+ op[1].cmd = MMUEXT_UNPIN_TABLE;
+ op[1].arg1.mfn = pfn_to_mfn(__pa(pgd) >> PAGE_SHIFT);
+ } else
+ nr = 1;
#endif
- if (HYPERVISOR_mmuext_op(op, NR_PGD_PIN_OPS, NULL, DOMID_SELF) < 0)
+ if (HYPERVISOR_mmuext_op(op, nr, NULL, DOMID_SELF) < 0)
BUG();
}
Index: head-2008-12-01/arch/x86/mm/init_64-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/init_64-xen.c 2008-12-01 12:13:22.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/init_64-xen.c 2008-12-01 12:13:27.000000000 +0100
@@ -604,9 +604,6 @@ void __init xen_init_pt(void)
__pud(__pa_symbol(level2_kernel_pgt) | _PAGE_TABLE);
memcpy(level2_kernel_pgt, page, PAGE_SIZE);
- __user_pgd(init_level4_pgt)[pgd_index(VSYSCALL_START)] =
- __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE);
-
/* Do an early initialization of the fixmap area. */
addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE);
level3_kernel_pgt[pud_index(addr)] =
@@ -616,8 +613,6 @@ void __init xen_init_pt(void)
early_make_page_readonly(init_level4_pgt,
XENFEAT_writable_page_tables);
- early_make_page_readonly(__user_pgd(init_level4_pgt),
- XENFEAT_writable_page_tables);
early_make_page_readonly(level3_kernel_pgt,
XENFEAT_writable_page_tables);
early_make_page_readonly(level3_user_pgt,
Index: head-2008-12-01/arch/x86/mm/pgtable-xen.c
===================================================================
--- head-2008-12-01.orig/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:22.000000000 +0100
+++ head-2008-12-01/arch/x86/mm/pgtable-xen.c 2008-12-01 12:13:27.000000000 +0100
@@ -270,9 +270,11 @@ static void pgd_walk(pgd_t *pgd_base, pg
BUG();
seq = 0;
}
+ pgd = __user_pgd(pgd_base);
+ BUG_ON(!pgd);
MULTI_update_va_mapping(mcl + seq,
- (unsigned long)__user_pgd(pgd_base),
- pfn_pte(virt_to_phys(__user_pgd(pgd_base))>>PAGE_SHIFT, flags),
+ (unsigned long)pgd,
+ pfn_pte(virt_to_phys(pgd)>>PAGE_SHIFT, flags),
0);
MULTI_update_va_mapping(mcl + seq + 1,
(unsigned long)pgd_base,
@@ -658,12 +660,29 @@ static void pgd_prepopulate_pmd(struct m
}
}
+static inline pgd_t *user_pgd_alloc(pgd_t *pgd)
+{
#ifdef CONFIG_X86_64
-/* We allocate two contiguous pages for kernel and user. */
-#define PGD_ORDER 1
-#else
-#define PGD_ORDER 0
+ if (pgd) {
+ pgd_t *upgd = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+
+ if (upgd)
+ virt_to_page(pgd)->index = (long)upgd;
+ else {
+ free_page((unsigned long)pgd);
+ pgd = NULL;
+ }
+ }
+#endif
+ return pgd;
+}
+
+static inline void user_pgd_free(pgd_t *pgd)
+{
+#ifdef CONFIG_X86_64
+ free_page(virt_to_page(pgd)->index);
#endif
+}
pgd_t *pgd_alloc(struct mm_struct *mm)
{
@@ -671,7 +690,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
pmd_t *pmds[PREALLOCATED_PMDS];
unsigned long flags;
- pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, PGD_ORDER);
+ pgd = user_pgd_alloc((void *)__get_free_page(GFP_KERNEL|__GFP_ZERO));
if (pgd == NULL)
goto out;
@@ -710,7 +729,8 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
out_free_pmds:
free_pmds(pmds, mm, !xen_feature(XENFEAT_pae_pgdir_above_4gb));
out_free_pgd:
- free_pages((unsigned long)pgd, PGD_ORDER);
+ user_pgd_free(pgd);
+ free_page((unsigned long)pgd);
out:
return NULL;
}
@@ -729,7 +749,8 @@ void pgd_free(struct mm_struct *mm, pgd_
pgd_mop_up_pmds(mm, pgd);
paravirt_pgd_free(mm, pgd);
- free_pages((unsigned long)pgd, PGD_ORDER);
+ user_pgd_free(pgd);
+ free_page((unsigned long)pgd);
}
/* blktap and gntdev need this, as otherwise they would implicitly (and
Index: head-2008-12-01/drivers/xen/core/machine_reboot.c
===================================================================
--- head-2008-12-01.orig/drivers/xen/core/machine_reboot.c 2008-12-01 12:13:13.000000000 +0100
+++ head-2008-12-01/drivers/xen/core/machine_reboot.c 2008-12-01 12:13:27.000000000 +0100
@@ -199,8 +199,7 @@ static int take_machine_down(void *_susp
* in fast-suspend mode as that implies a new enough Xen.
*/
if (!suspend->fast_suspend)
- xen_new_user_pt(__pa(__user_pgd(
- current->active_mm->pgd)));
+ xen_new_user_pt(current->active_mm->pgd);
#endif
}
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/hypervisor.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/hypervisor.h 2008-12-01 12:13:22.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/hypervisor.h 2008-12-01 12:13:27.000000000 +0100
@@ -85,8 +85,8 @@ void do_hypervisor_callback(struct pt_re
* be MACHINE addresses.
*/
-void xen_pt_switch(unsigned long ptr);
-void xen_new_user_pt(unsigned long ptr); /* x86_64 only */
+void xen_pt_switch(pgd_t *);
+void xen_new_user_pt(pgd_t *); /* x86_64 only */
void xen_load_gs(unsigned int selector); /* x86_64 only */
void xen_tlb_flush(void);
void xen_invlpg(unsigned long ptr);
@@ -94,7 +94,7 @@ void xen_invlpg(unsigned long ptr);
void xen_l1_entry_update(pte_t *ptr, pte_t val);
void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */
-void xen_l4_entry_update(pgd_t *ptr, int user, pgd_t val); /* x86_64 only */
+void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */
void xen_pgd_pin(pgd_t *);
void xen_pgd_unpin(pgd_t *);
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/mmu_context_64.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/mmu_context_64.h 2008-12-01 11:49:07.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/mmu_context_64.h 2008-12-01 12:13:27.000000000 +0100
@@ -46,6 +46,7 @@ static inline void switch_mm(struct mm_s
{
unsigned cpu = smp_processor_id();
struct mmuext_op _op[3], *op = _op;
+ pgd_t *upgd;
if (likely(prev != next)) {
BUG_ON(!xen_feature(XENFEAT_writable_page_tables) &&
@@ -64,9 +65,11 @@ static inline void switch_mm(struct mm_s
op->arg1.mfn = pfn_to_mfn(__pa(next->pgd) >> PAGE_SHIFT);
op++;
- /* xen_new_user_pt(__pa(__user_pgd(next->pgd))) */
+ /* xen_new_user_pt(next->pgd) */
op->cmd = MMUEXT_NEW_USER_BASEPTR;
- op->arg1.mfn = pfn_to_mfn(__pa(__user_pgd(next->pgd)) >> PAGE_SHIFT);
+ upgd = __user_pgd(next->pgd);
+ op->arg1.mfn = likely(upgd)
+ ? pfn_to_mfn(__pa(upgd) >> PAGE_SHIFT) : 0;
op++;
if (unlikely(next->context.ldt != prev->context.ldt)) {
@@ -90,7 +93,7 @@ static inline void switch_mm(struct mm_s
* to make sure to use no freed page tables.
*/
load_cr3(next->pgd);
- xen_new_user_pt(__pa(__user_pgd(next->pgd)));
+ xen_new_user_pt(next->pgd);
load_LDT_nolock(&next->context);
}
}
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgalloc.h 2008-12-01 12:13:06.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc.h 2008-12-01 12:13:27.000000000 +0100
@@ -106,15 +106,13 @@ static inline void pud_populate(struct m
#endif /* CONFIG_X86_PAE */
#if PAGETABLE_LEVELS > 3
-#define __user_pgd(pgd) ((pgd) + PTRS_PER_PGD)
-
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
{
pgd_t ent = __pgd(_PAGE_TABLE | __pa(pud));
paravirt_alloc_pud(mm, __pa(pud) >> PAGE_SHIFT);
if (unlikely(PagePinned(virt_to_page(pgd))))
- xen_l4_entry_update(pgd, 1, ent);
+ xen_l4_entry_update(pgd, ent);
else
*__user_pgd(pgd) = *pgd = ent;
}
Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h
===================================================================
--- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 12:13:13.000000000 +0100
+++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 12:13:27.000000000 +0100
@@ -131,18 +131,25 @@ static inline void xen_set_pud(pud_t *pu
: (void)(*__pudp = xen_make_pud(0)); \
})
-#define __user_pgd(pgd) ((pgd) + PTRS_PER_PGD)
+static inline pgd_t *__user_pgd(pgd_t *pgd)
+{
+ if (unlikely(((unsigned long)pgd & PAGE_MASK)
+ == (unsigned long)init_level4_pgt))
+ return NULL;
+ return (pgd_t *)(virt_to_page(pgd)->index
+ + ((unsigned long)pgd & ~PAGE_MASK));
+}
static inline void xen_set_pgd(pgd_t *pgdp, pgd_t pgd)
{
- xen_l4_entry_update(pgdp, 0, pgd);
+ xen_l4_entry_update(pgdp, pgd);
}
#define xen_pgd_clear(pgd) \
({ \
pgd_t *__pgdp = (pgd); \
PagePinned(virt_to_page(__pgdp)) \
- ? xen_l4_entry_update(__pgdp, 1, xen_make_pgd(0)) \
+ ? xen_l4_entry_update(__pgdp, xen_make_pgd(0)) \
: (void)(*__user_pgd(__pgdp) = *__pgdp = xen_make_pgd(0)); \
})

View File

@@ -0,0 +1,48 @@
From: jbeulich@novell.com
Subject: dump the correct page tables for user mode faults
Patch-mainline: obsolete
Index: head-2008-11-10/arch/x86/mm/fault-xen.c
===================================================================
--- head-2008-11-10.orig/arch/x86/mm/fault-xen.c 2008-11-17 11:33:51.000000000 +0100
+++ head-2008-11-10/arch/x86/mm/fault-xen.c 2008-11-17 11:38:21.000000000 +0100
@@ -189,9 +189,11 @@ static int bad_address(void *p)
unsigned long dummy;
return probe_kernel_address((unsigned long *)p, dummy);
}
+#else
+#define dump_pagetable(addr, krnl) dump_pagetable(addr)
#endif
-static void dump_pagetable(unsigned long address)
+static void dump_pagetable(unsigned long address, bool kernel)
{
#ifdef CONFIG_X86_32
__typeof__(pte_val(__pte(0))) page;
@@ -239,6 +241,8 @@ static void dump_pagetable(unsigned long
pgd = (pgd_t *)read_cr3();
pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
+ if (!kernel)
+ pgd = __user_pgd(pgd);
pgd += pgd_index(address);
if (bad_address(pgd)) goto bad;
printk("PGD %lx ", pgd_val(*pgd));
@@ -419,7 +423,7 @@ static void show_fault_oops(struct pt_re
printk(KERN_CONT " at %p\n", (void *) address);
printk(KERN_ALERT "IP:");
printk_address(regs->ip, 1);
- dump_pagetable(address);
+ dump_pagetable(address, !(error_code & PF_USER));
}
#ifdef CONFIG_X86_64
@@ -431,7 +435,7 @@ static noinline void pgtable_bad(unsigne
printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
current->comm, address);
- dump_pagetable(address);
+ dump_pagetable(address, !(error_code & PF_USER));
tsk = current;
tsk->thread.cr2 = address;
tsk->thread.trap_no = 14;

View File

@@ -0,0 +1,21 @@
--- linux-2.6.27.21/include/linux/skbuff.h 2009-04-03 10:39:10.000000000 +0000
+++ linux-2.6.27.21/include/linux/skbuff.h 2009-04-03 10:41:59.000000000 +0000
@@ -330,11 +330,17 @@
#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
__u8 do_not_encrypt:1;
#endif
- /* 0/13/14 bit hole */
+
#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
__u8 imq_flags:IMQ_F_BITS;
#endif
+#ifdef CONFIG_XEN
+ __u8 proto_data_valid:1,
+ proto_csum_blank:1;
+#endif
+ /* 10-16 bit hole */
+
#ifdef CONFIG_NET_DMA
dma_cookie_t dma_cookie;
#endif

330
src/patches/xen_aio.diff Normal file
View File

@@ -0,0 +1,330 @@
--- linux-2.6.27.21/fs/aio.c 2009-03-23 22:04:09.000000000 +0000
+++ linux-2.6.27.8/fs/aio.c 2009-03-29 15:53:57.000000000 +0000
@@ -36,6 +36,11 @@
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
+#ifdef CONFIG_EPOLL
+#include <linux/poll.h>
+#include <linux/eventpoll.h>
+#endif
+
#if DEBUG > 1
#define dprintk printk
#else
@@ -428,7 +433,7 @@
req->private = NULL;
req->ki_iovec = NULL;
INIT_LIST_HEAD(&req->ki_run_list);
- req->ki_eventfd = NULL;
+ req->ki_eventfd = ERR_PTR(-EINVAL);
/* Check if the completion queue has enough free space to
* accept an event from this io.
@@ -470,6 +475,8 @@
{
assert_spin_locked(&ctx->ctx_lock);
+ if (!IS_ERR(req->ki_eventfd))
+ fput(req->ki_eventfd);
if (req->ki_dtor)
req->ki_dtor(req);
if (req->ki_iovec != &req->ki_inline_vec)
@@ -491,11 +498,8 @@
list_del(&req->ki_list);
spin_unlock_irq(&fput_lock);
- /* Complete the fput(s) */
- if (req->ki_filp != NULL)
- __fput(req->ki_filp);
- if (req->ki_eventfd != NULL)
- __fput(req->ki_eventfd);
+ /* Complete the fput */
+ __fput(req->ki_filp);
/* Link the iocb into the context's free list */
spin_lock_irq(&ctx->ctx_lock);
@@ -513,14 +517,12 @@
*/
static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
{
- int schedule_putreq = 0;
-
dprintk(KERN_DEBUG "aio_put(%p): f_count=%ld\n",
req, atomic_long_read(&req->ki_filp->f_count));
assert_spin_locked(&ctx->ctx_lock);
- req->ki_users--;
+ req->ki_users --;
BUG_ON(req->ki_users < 0);
if (likely(req->ki_users))
return 0;
@@ -528,23 +530,10 @@
req->ki_cancel = NULL;
req->ki_retry = NULL;
- /*
- * Try to optimize the aio and eventfd file* puts, by avoiding to
- * schedule work in case it is not __fput() time. In normal cases,
- * we would not be holding the last reference to the file*, so
- * this function will be executed w/out any aio kthread wakeup.
+ /* Must be done under the lock to serialise against cancellation.
+ * Call this aio_fput as it duplicates fput via the fput_work.
*/
- if (unlikely(atomic_long_dec_and_test(&req->ki_filp->f_count)))
- schedule_putreq++;
- else
- req->ki_filp = NULL;
- if (req->ki_eventfd != NULL) {
- if (unlikely(atomic_long_dec_and_test(&req->ki_eventfd->f_count)))
- schedule_putreq++;
- else
- req->ki_eventfd = NULL;
- }
- if (unlikely(schedule_putreq)) {
+ if (unlikely(atomic_long_dec_and_test(&req->ki_filp->f_count))) {
get_ioctx(ctx);
spin_lock(&fput_lock);
list_add(&req->ki_list, &fput_head);
@@ -1008,7 +997,7 @@
* eventfd. The eventfd_signal() function is safe to be called
* from IRQ context.
*/
- if (iocb->ki_eventfd != NULL)
+ if (!IS_ERR(iocb->ki_eventfd))
eventfd_signal(iocb->ki_eventfd, 1);
put_rq:
@@ -1026,6 +1015,11 @@
if (waitqueue_active(&ctx->wait))
wake_up(&ctx->wait);
+#ifdef CONFIG_EPOLL
+ if (ctx->file && waitqueue_active(&ctx->poll_wait))
+ wake_up(&ctx->poll_wait);
+#endif
+
spin_unlock_irqrestore(&ctx->ctx_lock, flags);
return ret;
}
@@ -1033,6 +1027,8 @@
/* aio_read_evt
* Pull an event off of the ioctx's event ring. Returns the number of
* events fetched (0 or 1 ;-)
+ * If ent parameter is 0, just returns the number of events that would
+ * be fetched.
* FIXME: make this use cmpxchg.
* TODO: make the ringbuffer user mmap()able (requires FIXME).
*/
@@ -1055,13 +1051,18 @@
head = ring->head % info->nr;
if (head != ring->tail) {
- struct io_event *evp = aio_ring_event(info, head, KM_USER1);
- *ent = *evp;
- head = (head + 1) % info->nr;
- smp_mb(); /* finish reading the event before updatng the head */
- ring->head = head;
- ret = 1;
- put_aio_ring_event(evp, KM_USER1);
+ if (ent) { /* event requested */
+ struct io_event *evp =
+ aio_ring_event(info, head, KM_USER1);
+ *ent = *evp;
+ head = (head + 1) % info->nr;
+ /* finish reading the event before updatng the head */
+ smp_mb();
+ ring->head = head;
+ ret = 1;
+ put_aio_ring_event(evp, KM_USER1);
+ } else /* only need to know availability */
+ ret = 1;
}
spin_unlock(&info->ring_lock);
@@ -1251,6 +1252,13 @@
aio_cancel_all(ioctx);
wait_for_all_aios(ioctx);
+#ifdef CONFIG_EPOLL
+ /* forget the poll file, but it's up to the user to close it */
+ if (ioctx->file) {
+ ioctx->file->private_data = 0;
+ ioctx->file = 0;
+ }
+#endif
/*
* Wake up any waiters. The setting of ctx->dead must be seen
@@ -1261,6 +1269,67 @@
put_ioctx(ioctx); /* once for the lookup */
}
+#ifdef CONFIG_EPOLL
+
+static int aio_queue_fd_close(struct inode *inode, struct file *file)
+{
+ struct kioctx *ioctx = file->private_data;
+ if (ioctx) {
+ file->private_data = 0;
+ spin_lock_irq(&ioctx->ctx_lock);
+ ioctx->file = 0;
+ spin_unlock_irq(&ioctx->ctx_lock);
+ }
+ return 0;
+}
+
+static unsigned int aio_queue_fd_poll(struct file *file, poll_table *wait)
+{ unsigned int pollflags = 0;
+ struct kioctx *ioctx = file->private_data;
+
+ if (ioctx) {
+
+ spin_lock_irq(&ioctx->ctx_lock);
+ /* Insert inside our poll wait queue */
+ poll_wait(file, &ioctx->poll_wait, wait);
+
+ /* Check our condition */
+ if (aio_read_evt(ioctx, 0))
+ pollflags = POLLIN | POLLRDNORM;
+ spin_unlock_irq(&ioctx->ctx_lock);
+ }
+
+ return pollflags;
+}
+
+static const struct file_operations aioq_fops = {
+ .release = aio_queue_fd_close,
+ .poll = aio_queue_fd_poll
+};
+
+/* make_aio_fd:
+ * Create a file descriptor that can be used to poll the event queue.
+ * Based and piggybacked on the excellent epoll code.
+ */
+
+static int make_aio_fd(struct kioctx *ioctx)
+{
+ int error, fd;
+ struct inode *inode;
+ struct file *file;
+
+ error = ep_getfd(&fd, &inode, &file, NULL, &aioq_fops);
+ if (error)
+ return error;
+
+ /* associate the file with the IO context */
+ file->private_data = ioctx;
+ ioctx->file = file;
+ init_waitqueue_head(&ioctx->poll_wait);
+ return fd;
+}
+#endif
+
/* sys_io_setup:
* Create an aio_context capable of receiving at least nr_events.
* ctxp must not point to an aio_context that already exists, and
@@ -1273,18 +1342,30 @@
* resources are available. May fail with -EFAULT if an invalid
* pointer is passed for ctxp. Will fail with -ENOSYS if not
* implemented.
+ *
+ * To request a selectable fd, the user context has to be initialized
+ * to 1, instead of 0, and the return value is the fd.
+ * This keeps the system call compatible, since a non-zero value
+ * was not allowed so far.
*/
-SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
+asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)
{
struct kioctx *ioctx = NULL;
unsigned long ctx;
long ret;
+ int make_fd = 0;
ret = get_user(ctx, ctxp);
if (unlikely(ret))
goto out;
ret = -EINVAL;
+#ifdef CONFIG_EPOLL
+ if (ctx == 1) {
+ make_fd = 1;
+ ctx = 0;
+ }
+#endif
if (unlikely(ctx || nr_events == 0)) {
pr_debug("EINVAL: io_setup: ctx %lu nr_events %u\n",
ctx, nr_events);
@@ -1295,8 +1376,12 @@
ret = PTR_ERR(ioctx);
if (!IS_ERR(ioctx)) {
ret = put_user(ioctx->user_id, ctxp);
- if (!ret)
- return 0;
+#ifdef CONFIG_EPOLL
+ if (make_fd && ret >= 0)
+ ret = make_aio_fd(ioctx);
+#endif
+ if (ret >= 0)
+ return ret;
get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */
io_destroy(ioctx);
@@ -1312,7 +1397,7 @@
* implemented. May fail with -EFAULT if the context pointed to
* is invalid.
*/
-SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
+asmlinkage long sys_io_destroy(aio_context_t ctx)
{
struct kioctx *ioctx = lookup_ioctx(ctx);
if (likely(NULL != ioctx)) {
@@ -1612,7 +1697,6 @@
req->ki_eventfd = eventfd_fget((int) iocb->aio_resfd);
if (IS_ERR(req->ki_eventfd)) {
ret = PTR_ERR(req->ki_eventfd);
- req->ki_eventfd = NULL;
goto out_put_req;
}
}
@@ -1667,8 +1751,8 @@
* are available to queue any iocbs. Will return 0 if nr is 0. Will
* fail with -ENOSYS if not implemented.
*/
-SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
- struct iocb __user * __user *, iocbpp)
+asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
+ struct iocb __user * __user *iocbpp)
{
struct kioctx *ctx;
long ret = 0;
@@ -1742,8 +1826,8 @@
* invalid. May fail with -EAGAIN if the iocb specified was not
* cancelled. Will fail with -ENOSYS if not implemented.
*/
-SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
- struct io_event __user *, result)
+asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
+ struct io_event __user *result)
{
int (*cancel)(struct kiocb *iocb, struct io_event *res);
struct kioctx *ctx;
@@ -1804,11 +1888,11 @@
* will be updated if not NULL and the operation blocks. Will fail
* with -ENOSYS if not implemented.
*/
-SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
- long, min_nr,
- long, nr,
- struct io_event __user *, events,
- struct timespec __user *, timeout)
+asmlinkage long sys_io_getevents(aio_context_t ctx_id,
+ long min_nr,
+ long nr,
+ struct io_event __user *events,
+ struct timespec __user *timeout)
{
struct kioctx *ioctx = lookup_ioctx(ctx_id);
long ret = -EINVAL;

View File

@@ -0,0 +1,24 @@
--- linux-2.6.27.21/include/linux/skbuff.h 2009-03-29 17:24:56.000000000 +0000
+++ linux-2.6.27.8/include/linux/skbuff.h 2009-03-29 17:38:37.000000000 +0000
@@ -217,6 +217,8 @@
* @local_df: allow local fragmentation
* @cloned: Head may be cloned (check refcnt to be sure)
* @nohdr: Payload reference only, must not modify header
+ * @proto_data_valid: Protocol data validated since arriving at localhost
+ * @proto_csum_blank: Protocol csum must be added before leaving localhost
* @pkt_type: Packet class
* @fclone: skbuff clone status
* @ip_summed: Driver fed us an IP checksum
@@ -320,7 +322,11 @@
#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
__u8 do_not_encrypt:1;
#endif
- /* 0/13/14 bit hole */
+#ifdef CONFIG_XEN
+ __u8 proto_data_valid:1,
+ proto_csum_blank:1;
+#endif
+ /* 10-16 bit hole */
#ifdef CONFIG_NET_DMA
dma_cookie_t dma_cookie;