ia64/xen-unstable

changeset 6542:3a8f27c6d56c

Merge.
author adsharma@los-vmm.sc.intel.com
date Mon Aug 22 11:00:37 2005 -0700 (2005-08-22)
parents 483ac5017c9c 2052ce3345c1
children c5ef23281be2
files .hgignore Config.mk Makefile buildconfigs/Rules.mk buildconfigs/mk.linux-2.6-xen buildconfigs/mk.linux-2.6-xen0 buildconfigs/mk.linux-2.6-xenU docs/src/user.tex extras/mini-os/include/time.h extras/mini-os/kernel.c extras/mini-os/time.c linux-2.4-xen-sparse/arch/xen/Makefile linux-2.4-xen-sparse/arch/xen/config.in linux-2.4-xen-sparse/arch/xen/kernel/time.c linux-2.4-xen-sparse/include/asm-xen/bugs.h linux-2.4-xen-sparse/include/asm-xen/fixmap.h linux-2.4-xen-sparse/include/asm-xen/highmem.h linux-2.4-xen-sparse/include/asm-xen/hw_irq.h linux-2.4-xen-sparse/include/asm-xen/io.h linux-2.4-xen-sparse/include/asm-xen/irq.h linux-2.4-xen-sparse/include/asm-xen/mmu_context.h linux-2.4-xen-sparse/include/asm-xen/page.h linux-2.4-xen-sparse/include/asm-xen/pci.h linux-2.4-xen-sparse/include/asm-xen/pgalloc.h linux-2.4-xen-sparse/include/asm-xen/pgtable.h linux-2.4-xen-sparse/include/asm-xen/processor.h linux-2.4-xen-sparse/include/asm-xen/segment.h linux-2.4-xen-sparse/include/asm-xen/smp.h linux-2.4-xen-sparse/include/asm-xen/system.h linux-2.4-xen-sparse/include/asm-xen/vga.h linux-2.4-xen-sparse/include/linux/blk.h linux-2.4-xen-sparse/include/linux/highmem.h linux-2.4-xen-sparse/include/linux/irq.h linux-2.4-xen-sparse/include/linux/mm.h linux-2.4-xen-sparse/include/linux/sched.h linux-2.4-xen-sparse/include/linux/skbuff.h linux-2.4-xen-sparse/include/linux/timer.h linux-2.4-xen-sparse/mkbuildtree linux-2.6-xen-sparse/arch/xen/Kconfig linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/i386/Kconfig linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S linux-2.6-xen-sparse/arch/xen/i386/kernel/head.S linux-2.6-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c linux-2.6-xen-sparse/arch/xen/i386/kernel/init_task.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/i386/kernel/irq.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/i386/kernel/mpparse.c linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smp.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c linux-2.6-xen-sparse/arch/xen/i386/mm/highmem.c linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c linux-2.6-xen-sparse/arch/xen/i386/mm/init.c linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile linux-2.6-xen-sparse/arch/xen/i386/pci/irq.c linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c linux-2.6-xen-sparse/arch/xen/x86_64/Kconfig linux-2.6-xen-sparse/arch/xen/x86_64/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/apic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic_xen.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/irq.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-nommu.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smp.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/vsyscall.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/ioremap.c linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile linux-2.6-xen-sparse/drivers/xen/Makefile linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c linux-2.6-xen-sparse/drivers/xen/blkback/Makefile linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blkback/common.h linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/block.h linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h linux-2.6-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap_datapath.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/usbback/common.h linux-2.6-xen-sparse/drivers/xen/usbback/interface.c linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c linux-2.6-xen-sparse/drivers/xen/usbfront/xhci.h linux-2.6-xen-sparse/drivers/xen/xenbus/Makefile linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c linux-2.6-xen-sparse/include/asm-generic/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/fixmap.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypercall.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/kmap_types.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pci.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/scatterlist.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/swiotlb.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/desc.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/dma-mapping.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/io.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/irq_vectors.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pci.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/processor.h linux-2.6-xen-sparse/include/asm-xen/balloon.h linux-2.6-xen-sparse/include/asm-xen/ctrl_if.h linux-2.6-xen-sparse/include/asm-xen/evtchn.h linux-2.6-xen-sparse/include/asm-xen/gnttab.h linux-2.6-xen-sparse/include/asm-xen/hypervisor.h linux-2.6-xen-sparse/include/asm-xen/xenbus.h linux-2.6-xen-sparse/include/linux/highmem.h linux-2.6-xen-sparse/include/linux/mm.h linux-2.6-xen-sparse/kernel/irq/manage.c linux-2.6-xen-sparse/mkbuildtree linux-2.6-xen-sparse/mm/highmem.c linux-2.6-xen-sparse/mm/memory.c patches/linux-2.6.12/patch-2.6.12.5 patches/linux-2.6.12/smp-alts.patch patches/linux-2.6.12/workaround_double_br_del_if.patch tools/Makefile tools/blktap/blktaplib.c tools/console/client/main.c tools/console/daemon/io.c tools/console/daemon/utils.c tools/debugger/gdb/gdbbuild tools/debugger/libxendebug/xendebug.c tools/debugger/libxendebug/xendebug.h tools/debugger/pdb/Domain.ml tools/debugger/pdb/Domain.mli tools/debugger/pdb/Makefile tools/debugger/pdb/PDB.ml tools/debugger/pdb/Process.ml tools/debugger/pdb/Process.mli tools/debugger/pdb/Util.ml tools/debugger/pdb/Xen_domain.ml tools/debugger/pdb/Xen_domain.mli tools/debugger/pdb/debugger.ml tools/debugger/pdb/linux-2.6-module/Makefile tools/debugger/pdb/linux-2.6-module/debug.c tools/debugger/pdb/linux-2.6-module/module.c tools/debugger/pdb/linux-2.6-module/pdb_debug.h tools/debugger/pdb/linux-2.6-module/pdb_module.h tools/debugger/pdb/linux-2.6-patches/Makefile tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch tools/debugger/pdb/linux-2.6-patches/kdebug.patch tools/debugger/pdb/linux-2.6-patches/makefile.patch tools/debugger/pdb/linux-2.6-patches/ptrace.patch tools/debugger/pdb/linux-2.6-patches/traps.patch tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xcs.c tools/debugger/pdb/pdb_caml_xen.h tools/debugger/pdb/readme tools/debugger/pdb/server.ml tools/examples/Makefile tools/examples/network-bridge tools/examples/xend-config.sxp tools/examples/xmexample.vmx tools/firmware/rombios/rombios.c tools/firmware/vmxassist/vm86.c tools/ioemu/hw/pc.c tools/ioemu/hw/pckbd.c tools/ioemu/monitor.c tools/ioemu/target-i386-dm/Makefile tools/ioemu/target-i386-dm/helper2.c tools/ioemu/target-i386-dm/qemu-dm.debug tools/ioemu/vl.c tools/ioemu/vl.h tools/ioemu/vnc.c tools/libxc/Makefile tools/libxc/linux_boot_params.h tools/libxc/xc.h tools/libxc/xc_core.c tools/libxc/xc_domain.c tools/libxc/xc_gnttab.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_elf.c tools/libxc/xc_private.c tools/libxc/xc_private.h tools/libxc/xc_ptrace.c tools/libxc/xc_vmx_build.c tools/misc/Makefile tools/misc/xend tools/python/setup.py tools/python/xen/lowlevel/xc/xc.c tools/python/xen/lowlevel/xs/xs.c tools/python/xen/lowlevel/xu/xu.c tools/python/xen/sv/CreateDomain.py tools/python/xen/sv/DomInfo.py tools/python/xen/sv/GenTabbed.py tools/python/xen/sv/HTMLBase.py tools/python/xen/sv/Main.py tools/python/xen/sv/NodeInfo.py tools/python/xen/sv/RestoreDomain.py tools/python/xen/sv/Wizard.py tools/python/xen/sv/__init__.py tools/python/xen/sv/util.py tools/python/xen/web/SrvBase.py tools/python/xen/web/SrvDir.py tools/python/xen/web/__init__.py tools/python/xen/web/connection.py tools/python/xen/web/httpserver.py tools/python/xen/web/protocol.py tools/python/xen/web/reactor.py tools/python/xen/web/resource.py tools/python/xen/web/static.py tools/python/xen/web/tcp.py tools/python/xen/web/unix.py tools/python/xen/xend/Args.py tools/python/xen/xend/EventServer.py tools/python/xen/xend/PrettyPrint.py tools/python/xen/xend/Vifctl.py tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendClient.py tools/python/xen/xend/XendDB.py tools/python/xen/xend/XendDmesg.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/XendError.py tools/python/xen/xend/XendLogging.py tools/python/xen/xend/XendNode.py tools/python/xen/xend/XendProtocol.py tools/python/xen/xend/XendRoot.py tools/python/xen/xend/XendVnet.py tools/python/xen/xend/encode.py tools/python/xen/xend/image.py tools/python/xen/xend/scheduler.py tools/python/xen/xend/server/SrvDaemon.py tools/python/xen/xend/server/SrvDmesg.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/SrvNode.py tools/python/xen/xend/server/SrvRoot.py tools/python/xen/xend/server/SrvServer.py tools/python/xen/xend/server/SrvVnetDir.py tools/python/xen/xend/server/SrvXendLog.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/channel.py tools/python/xen/xend/server/controller.py tools/python/xen/xend/server/event.py tools/python/xen/xend/server/messages.py tools/python/xen/xend/server/netif.py tools/python/xen/xend/server/params.py tools/python/xen/xend/server/pciif.py tools/python/xen/xend/server/relocate.py tools/python/xen/xend/sxp.py tools/python/xen/xend/uuid.py tools/python/xen/xend/xenstore/__init__.py tools/python/xen/xend/xenstore/xsnode.py tools/python/xen/xend/xenstore/xsobj.py tools/python/xen/xend/xenstore/xsresource.py tools/python/xen/xm/create.py tools/python/xen/xm/destroy.py tools/python/xen/xm/help.py tools/python/xen/xm/main.py tools/python/xen/xm/migrate.py tools/python/xen/xm/opts.py tools/python/xen/xm/shutdown.py tools/python/xen/xm/sysrq.py tools/security/Makefile tools/security/example.txt tools/security/install.txt tools/security/policies/chwall/chwall-security_label_template.xml tools/security/policies/chwall/chwall-security_policy.xml tools/security/policies/chwall_ste/chwall_ste-security_label_template.xml tools/security/policies/chwall_ste/chwall_ste-security_policy.xml tools/security/policies/null/null-security_label_template.xml tools/security/policies/null/null-security_policy.xml tools/security/policies/security_policy.xsd tools/security/policies/ste/ste-security_label_template.xml tools/security/policies/ste/ste-security_policy.xml tools/security/policy.txt tools/security/readme.txt tools/security/secpol_compat.h tools/security/secpol_tool.c tools/security/secpol_xml2bin.c tools/security/secpol_xml2bin.h tools/security/setlabel.sh tools/security/updategrub.sh tools/sv/Makefile tools/sv/images/destroy.png tools/sv/images/finish.png tools/sv/images/next.png tools/sv/images/pause.png tools/sv/images/previous.png tools/sv/images/reboot.png tools/sv/images/shutdown.png tools/sv/images/small-destroy.png tools/sv/images/small-pause.png tools/sv/images/small-unpause.png tools/sv/images/unpause.png tools/sv/images/xen.png tools/sv/inc/script.js tools/sv/inc/style.css tools/sv/index.psp tools/xcs/xcs.h tools/xcutils/xc_restore.c tools/xenstore/Makefile tools/xenstore/TODO tools/xenstore/testsuite/test.sh tools/xenstore/utils.c tools/xenstore/utils.h tools/xenstore/xenstored.h tools/xenstore/xenstored_core.c tools/xenstore/xenstored_core.h tools/xenstore/xenstored_domain.c tools/xenstore/xenstored_domain.h tools/xenstore/xenstored_transaction.c tools/xenstore/xenstored_transaction.h tools/xenstore/xenstored_watch.c tools/xenstore/xenstored_watch.h tools/xenstore/xs.c tools/xenstore/xs.h tools/xenstore/xs_lib.c tools/xenstore/xs_lib.h tools/xenstore/xs_random.c tools/xenstore/xs_test.c tools/xentrace/xentrace.c xen/Makefile xen/Rules.mk xen/acm/acm_core.c xen/acm/acm_policy.c xen/arch/ia64/Makefile xen/arch/ia64/Rules.mk xen/arch/ia64/asm-offsets.c xen/arch/ia64/asm-xsi-offsets.c xen/arch/ia64/dom_fw.c xen/arch/ia64/domain.c xen/arch/ia64/grant_table.c xen/arch/ia64/hypercall.c xen/arch/ia64/hyperprivop.S xen/arch/ia64/mmio.c xen/arch/ia64/pal_emul.c xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c xen/arch/ia64/patch/linux-2.6.11/kregs.h xen/arch/ia64/pcdp.c xen/arch/ia64/process.c xen/arch/ia64/regionreg.c xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/vcpu.c xen/arch/ia64/vlsapic.c xen/arch/ia64/vmmu.c xen/arch/ia64/vmx_hypercall.c xen/arch/ia64/vmx_ivt.S xen/arch/ia64/vmx_support.c xen/arch/ia64/vmx_vcpu.c xen/arch/ia64/vmx_virt.c xen/arch/ia64/vtlb.c xen/arch/ia64/xenasm.S xen/arch/ia64/xenmem.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c xen/arch/ia64/xentime.c xen/arch/x86/Makefile xen/arch/x86/acpi/boot.c xen/arch/x86/apic.c xen/arch/x86/audit.c xen/arch/x86/cpu/common.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/genapic/es7000plat.c xen/arch/x86/i8259.c xen/arch/x86/io_apic.c xen/arch/x86/mm.c xen/arch/x86/mpparse.c xen/arch/x86/physdev.c xen/arch/x86/setup.c xen/arch/x86/shadow.c xen/arch/x86/shadow32.c xen/arch/x86/shadow_public.c xen/arch/x86/smpboot.c xen/arch/x86/time.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_platform.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/mm.c xen/arch/x86/x86_64/traps.c xen/common/ac_timer.c xen/common/dom0_ops.c xen/common/dom_mem_ops.c xen/common/domain.c xen/common/event_channel.c xen/common/grant_table.c xen/common/lib.c xen/common/page_alloc.c xen/common/perfc.c xen/common/sched_sedf.c xen/common/schedule.c xen/common/symbols.c xen/common/trace.c xen/common/xmalloc.c xen/drivers/char/console.c xen/drivers/char/ns16550.c xen/include/acm/acm_core.h xen/include/acm/acm_hooks.h xen/include/asm-ia64/config.h xen/include/asm-ia64/domain.h xen/include/asm-ia64/event.h xen/include/asm-ia64/ia64_int.h xen/include/asm-ia64/privop.h xen/include/asm-ia64/regionreg.h xen/include/asm-ia64/regs.h xen/include/asm-ia64/vcpu.h xen/include/asm-ia64/vmx.h xen/include/asm-ia64/vmx_uaccess.h xen/include/asm-ia64/vmx_vcpu.h xen/include/asm-ia64/vmx_vpd.h xen/include/asm-ia64/xensystem.h xen/include/asm-x86/apicdef.h xen/include/asm-x86/config.h xen/include/asm-x86/e820.h xen/include/asm-x86/event.h xen/include/asm-x86/fixmap.h xen/include/asm-x86/genapic.h xen/include/asm-x86/hpet.h xen/include/asm-x86/io.h xen/include/asm-x86/mach-bigsmp/mach_apic.h xen/include/asm-x86/mach-default/mach_apic.h xen/include/asm-x86/mach-es7000/mach_apic.h xen/include/asm-x86/mach-generic/mach_apic.h xen/include/asm-x86/mach-summit/mach_apic.h xen/include/asm-x86/mach-summit/mach_mpparse.h xen/include/asm-x86/mm.h xen/include/asm-x86/page.h xen/include/asm-x86/shadow.h xen/include/asm-x86/shadow_64.h xen/include/asm-x86/shadow_public.h xen/include/asm-x86/time.h xen/include/asm-x86/types.h xen/include/asm-x86/uaccess.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_virpit.h xen/include/asm-x86/vmx_vmcs.h xen/include/asm-x86/x86_32/page-3level.h xen/include/asm-x86/x86_32/uaccess.h xen/include/asm-x86/x86_64/page.h xen/include/public/arch-ia64.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/grant_table.h xen/include/public/io/blkif.h xen/include/public/io/domain_controller.h xen/include/public/io/netif.h xen/include/public/physdev.h xen/include/public/trace.h xen/include/public/xen.h xen/include/xen/ac_timer.h xen/include/xen/domain.h xen/include/xen/event.h xen/include/xen/grant_table.h xen/include/xen/mm.h xen/include/xen/perfc_defn.h xen/include/xen/sched.h xen/include/xen/serial.h xen/include/xen/symbols.h xen/include/xen/time.h xen/include/xen/trace.h xen/tools/Makefile xen/tools/symbols.c
line diff
     1.1 --- a/Makefile	Fri Aug 19 16:47:24 2005 -0800
     1.2 +++ b/Makefile	Mon Aug 22 11:00:37 2005 -0700
     1.3 @@ -172,6 +172,12 @@ uninstall:
     1.4  	rm -rf $(D)/usr/bin/xen* $(D)/usr/bin/miniterm
     1.5  	rm -rf $(D)/boot/*xen*
     1.6  	rm -rf $(D)/lib/modules/*xen*
     1.7 +	rm -rf $(D)/usr/bin/cpuperf-perfcntr $(D)/usr/bin/cpuperf-xen
     1.8 +	rm -rf $(D)/usr/bin/xc_shadow
     1.9 +	rm -rf $(D)/usr/share/xen $(D)/usr/libexec/xen
    1.10 +	rm -rf $(D)/usr/share/man/man1/xen*
    1.11 +	rm -rf $(D)/usr/share/man/man8/xen*
    1.12 +	rm -rf $(D)/usr/lib/xen
    1.13  
    1.14  # Legacy targets for compatibility
    1.15  linux24:
     2.1 --- a/buildconfigs/Rules.mk	Fri Aug 19 16:47:24 2005 -0800
     2.2 +++ b/buildconfigs/Rules.mk	Mon Aug 22 11:00:37 2005 -0700
     2.3 @@ -66,6 +66,7 @@ pristine-%/.valid-pristine: %.tar.bz2
     2.4  
     2.5  PATCHDIRS := $(wildcard patches/*-*)
     2.6  
     2.7 +ifneq ($(PATCHDIRS),)
     2.8  -include $(patsubst %,%/.makedep,$(PATCHDIRS))
     2.9  
    2.10  $(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep: 
    2.11 @@ -80,6 +81,7 @@ ref-%/.valid-ref: pristine-%/.valid-pris
    2.12  	([ -d patches/$* ] && \
    2.13  	  for i in patches/$*/*.patch ; do ( cd $(@D) ; patch -p1 <../$$i || exit 1 ) ; done) || true
    2.14  	touch $@ # update timestamp to avoid rebuild
    2.15 +endif
    2.16  
    2.17  %-build:
    2.18  	$(MAKE) -f buildconfigs/mk.$* build
     3.1 --- a/extras/mini-os/include/time.h	Fri Aug 19 16:47:24 2005 -0800
     3.2 +++ b/extras/mini-os/include/time.h	Mon Aug 22 11:00:37 2005 -0700
     3.3 @@ -28,7 +28,7 @@
     3.4   * of real time into system time 
     3.5   */
     3.6  typedef s64 s_time_t;
     3.7 -#define NOW()                   ((s_time_t)get_s_time())
     3.8 +#define NOW()                   ((s_time_t)monotonic_clock())
     3.9  #define SECONDS(_s)             (((s_time_t)(_s))  * 1000000000UL )
    3.10  #define TENTHS(_ts)             (((s_time_t)(_ts)) * 100000000UL )
    3.11  #define HUNDREDTHS(_hs)         (((s_time_t)(_hs)) * 10000000UL )
    3.12 @@ -36,7 +36,8 @@ typedef s64 s_time_t;
    3.13  #define MICROSECS(_us)          (((s_time_t)(_us)) * 1000UL )
    3.14  #define Time_Max                ((s_time_t) 0x7fffffffffffffffLL)
    3.15  #define FOREVER                 Time_Max
    3.16 -
    3.17 +#define NSEC_TO_USEC(_nsec)     (_nsec / 1000UL)
    3.18 +#define NSEC_TO_SEC(_nsec)      (_nsec / 1000000000ULL)
    3.19  
    3.20  /* wall clock time  */
    3.21  typedef long time_t;
    3.22 @@ -46,6 +47,11 @@ struct timeval {
    3.23  	suseconds_t	tv_usec;	/* microseconds */
    3.24  };
    3.25  
    3.26 +struct timespec {
    3.27 +    time_t      ts_sec;
    3.28 +    long        ts_nsec;
    3.29 +};
    3.30 +
    3.31  
    3.32  /* prototypes */
    3.33  void     init_time(void);
     4.1 --- a/extras/mini-os/kernel.c	Fri Aug 19 16:47:24 2005 -0800
     4.2 +++ b/extras/mini-os/kernel.c	Mon Aug 22 11:00:37 2005 -0700
     4.3 @@ -132,20 +132,6 @@ void start_kernel(start_info_t *si)
     4.4      i = 0;
     4.5      for ( ; ; ) 
     4.6      {      
     4.7 -        if(i >= 1000)         
     4.8 -        {
     4.9 -            {
    4.10 -                unsigned long saved;
    4.11 -                __asm__ ("movl %%esp, %0"
    4.12 -                         :"=r"(saved)  /* y is output operand */
    4.13 -                            /* x is input operand */);
    4.14 -//                        :"a"); /* %eax is clobbered register */
    4.15 -                printk("ESP=0x%lx\n", saved);
    4.16 -            }
    4.17 -            
    4.18 -            printk("1000 bloks\n");
    4.19 -            i=0;            
    4.20 -        }
    4.21  //        HYPERVISOR_yield();
    4.22          block(1);
    4.23          i++;
     5.1 --- a/extras/mini-os/time.c	Fri Aug 19 16:47:24 2005 -0800
     5.2 +++ b/extras/mini-os/time.c	Mon Aug 22 11:00:37 2005 -0700
     5.3 @@ -43,19 +43,20 @@
     5.4   * Time functions
     5.5   *************************************************************************/
     5.6  
     5.7 -/* Cached *multiplier* to convert TSC counts to microseconds.
     5.8 - * (see the equation below).
     5.9 - * Equal to 2^32 * (1 / (clocks per usec) ).
    5.10 - * Initialized in time_init.
    5.11 - */
    5.12 -static unsigned long fast_gettimeoffset_quotient;
    5.13 +/* These are peridically updated in shared_info, and then copied here. */
    5.14 +struct shadow_time_info {
    5.15 +	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
    5.16 +	u64 system_timestamp;  /* Time, in nanosecs, since boot.    */
    5.17 +	u32 tsc_to_nsec_mul;
    5.18 +	u32 tsc_to_usec_mul;
    5.19 +	int tsc_shift;
    5.20 +	u32 version;
    5.21 +};
    5.22 +static struct timespec shadow_ts;
    5.23 +static u32 shadow_ts_version;
    5.24  
    5.25 +static struct shadow_time_info shadow;
    5.26  
    5.27 -/* These are peridically updated in shared_info, and then copied here. */
    5.28 -static u32 shadow_tsc_stamp;
    5.29 -static s64 shadow_system_time;
    5.30 -static u32 shadow_time_version;
    5.31 -static struct timeval shadow_tv;
    5.32  
    5.33  #ifndef rmb
    5.34  #define rmb()  __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
    5.35 @@ -63,116 +64,150 @@ static struct timeval shadow_tv;
    5.36  
    5.37  #define HANDLE_USEC_OVERFLOW(_tv)          \
    5.38      do {                                   \
    5.39 -        while ( (_tv).tv_usec >= 1000000 ) \
    5.40 +        while ( (_tv)->tv_usec >= 1000000 ) \
    5.41          {                                  \
    5.42 -            (_tv).tv_usec -= 1000000;      \
    5.43 -            (_tv).tv_sec++;                \
    5.44 +            (_tv)->tv_usec -= 1000000;      \
    5.45 +            (_tv)->tv_sec++;                \
    5.46          }                                  \
    5.47      } while ( 0 )
    5.48  
    5.49 -static void get_time_values_from_xen(void)
    5.50 +static inline int time_values_up_to_date(void)
    5.51  {
    5.52 -    do {
    5.53 -        shadow_time_version = HYPERVISOR_shared_info->time_version2;
    5.54 -        rmb();
    5.55 -        shadow_tv.tv_sec    = HYPERVISOR_shared_info->wc_sec;
    5.56 -        shadow_tv.tv_usec   = HYPERVISOR_shared_info->wc_usec;
    5.57 -        shadow_tsc_stamp    = (u32)HYPERVISOR_shared_info->tsc_timestamp;
    5.58 -        shadow_system_time  = HYPERVISOR_shared_info->system_time;
    5.59 -        rmb();
    5.60 -    }
    5.61 -    while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 );
    5.62 +	struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_time[0]; 
    5.63 +
    5.64 +	return (shadow.version == src->version);
    5.65  }
    5.66  
    5.67  
    5.68 -#define TIME_VALUES_UP_TO_DATE \
    5.69 -    (shadow_time_version == HYPERVISOR_shared_info->time_version2)
    5.70 -
    5.71 -static u32  get_time_delta_usecs(void)
    5.72 +/*
    5.73 + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
    5.74 + * yielding a 64-bit result.
    5.75 + */
    5.76 +static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
    5.77  {
    5.78 -	register unsigned long eax, edx;
    5.79 -
    5.80 -	/* Read the Time Stamp Counter */
    5.81 -
    5.82 -	rdtsc(eax,edx);
    5.83 -
    5.84 -	/* .. relative to previous jiffy (32 bits is enough) */
    5.85 -	eax -= shadow_tsc_stamp;
    5.86 +	u64 product;
    5.87 +#ifdef __i386__
    5.88 +	u32 tmp1, tmp2;
    5.89 +#endif
    5.90  
    5.91 -	/*
    5.92 -	 * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient
    5.93 -	 *             = (tsc_low delta) * (usecs_per_clock)
    5.94 -	 *             = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy)
    5.95 -	 *
    5.96 -	 * Using a mull instead of a divl saves up to 31 clock cycles
    5.97 -	 * in the critical path.
    5.98 -	 */
    5.99 +	if ( shift < 0 )
   5.100 +		delta >>= -shift;
   5.101 +	else
   5.102 +		delta <<= shift;
   5.103  
   5.104 -	__asm__("mull %2"
   5.105 -		:"=a" (eax), "=d" (edx)
   5.106 -		:"rm" (fast_gettimeoffset_quotient),
   5.107 -		 "0" (eax));
   5.108 +#ifdef __i386__
   5.109 +	__asm__ (
   5.110 +		"mul  %5       ; "
   5.111 +		"mov  %4,%%eax ; "
   5.112 +		"mov  %%edx,%4 ; "
   5.113 +		"mul  %5       ; "
   5.114 +		"add  %4,%%eax ; "
   5.115 +		"xor  %5,%5    ; "
   5.116 +		"adc  %5,%%edx ; "
   5.117 +		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
   5.118 +		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
   5.119 +#else
   5.120 +	__asm__ (
   5.121 +		"mul %%rdx ; shrd $32,%%rdx,%%rax"
   5.122 +		: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
   5.123 +#endif
   5.124  
   5.125 -	/* our adjusted time offset in microseconds */
   5.126 -	return edx;
   5.127 +	return product;
   5.128  }
   5.129  
   5.130 -s64 get_s_time (void)
   5.131 -{
   5.132 -    u64 u_delta;
   5.133 -    s64 ret;
   5.134 -
   5.135 - again:
   5.136 -
   5.137 -    u_delta = get_time_delta_usecs();
   5.138 -    ret = shadow_system_time + (1000 * u_delta);
   5.139  
   5.140 -    if ( unlikely(!TIME_VALUES_UP_TO_DATE) )
   5.141 -    {
   5.142 -        /*
   5.143 -         * We may have blocked for a long time, rendering our calculations
   5.144 -         * invalid (e.g. the time delta may have overflowed). Detect that
   5.145 -         * and recalculate with fresh values.
   5.146 -         */
   5.147 -        get_time_values_from_xen();
   5.148 -        goto again;
   5.149 -    }
   5.150 +static unsigned long get_nsec_offset(void)
   5.151 +{
   5.152 +	u64 now, delta;
   5.153 +	rdtscll(now);
   5.154 +	delta = now - shadow.tsc_timestamp;
   5.155 +	return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift);
   5.156 +}
   5.157  
   5.158 -    return ret;
   5.159 +
   5.160 +static void get_time_values_from_xen(void)
   5.161 +{
   5.162 +	struct vcpu_time_info    *src = &HYPERVISOR_shared_info->vcpu_time[0];
   5.163 +
   5.164 + 	do {
   5.165 +		shadow.version = src->version;
   5.166 +		rmb();
   5.167 +		shadow.tsc_timestamp     = src->tsc_timestamp;
   5.168 +		shadow.system_timestamp  = src->system_time;
   5.169 +		shadow.tsc_to_nsec_mul   = src->tsc_to_system_mul;
   5.170 +		shadow.tsc_shift         = src->tsc_shift;
   5.171 +		rmb();
   5.172 +	}
   5.173 +	while ((src->version & 1) | (shadow.version ^ src->version));
   5.174 +
   5.175 +	shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000;
   5.176  }
   5.177  
   5.178 +
   5.179 +
   5.180 +
   5.181 +/* monotonic_clock(): returns # of nanoseconds passed since time_init()
   5.182 + *		Note: This function is required to return accurate
   5.183 + *		time even in the absence of multiple timer ticks.
   5.184 + */
   5.185 +u64 monotonic_clock(void)
   5.186 +{
   5.187 +	u64 time;
   5.188 +	u32 local_time_version;
   5.189 +
   5.190 +	do {
   5.191 +		local_time_version = shadow.version;
   5.192 +		rmb();
   5.193 +		time = shadow.system_timestamp + get_nsec_offset();
   5.194 +        if (!time_values_up_to_date())
   5.195 +			get_time_values_from_xen();
   5.196 +		rmb();
   5.197 +	} while (local_time_version != shadow.version);
   5.198 +
   5.199 +	return time;
   5.200 +}
   5.201 +
   5.202 +static void update_wallclock(void)
   5.203 +{
   5.204 +	shared_info_t *s = HYPERVISOR_shared_info;
   5.205 +
   5.206 +	do {
   5.207 +		shadow_ts_version = s->wc_version;
   5.208 +		rmb();
   5.209 +		shadow_ts.ts_sec  = s->wc_sec;
   5.210 +		shadow_ts.ts_nsec = s->wc_nsec;
   5.211 +		rmb();
   5.212 +	}
   5.213 +	while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version));
   5.214 +}
   5.215 +
   5.216 +
   5.217  void gettimeofday(struct timeval *tv)
   5.218  {
   5.219 -    struct timeval _tv;
   5.220 +    u64 nsec = monotonic_clock();
   5.221 +    nsec += shadow_ts.ts_nsec;
   5.222 +    
   5.223 +    
   5.224 +    tv->tv_sec = shadow_ts.ts_sec;
   5.225 +    tv->tv_sec += NSEC_TO_SEC(nsec);
   5.226 +    tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL);
   5.227 +}
   5.228  
   5.229 -    do {
   5.230 -        get_time_values_from_xen();
   5.231 -        _tv.tv_usec = get_time_delta_usecs();
   5.232 -        _tv.tv_sec   = shadow_tv.tv_sec;
   5.233 -        _tv.tv_usec += shadow_tv.tv_usec;
   5.234 -    }
   5.235 -    while ( unlikely(!TIME_VALUES_UP_TO_DATE) );
   5.236 -
   5.237 -    HANDLE_USEC_OVERFLOW(_tv);
   5.238 -    *tv = _tv;
   5.239 -}
   5.240  
   5.241  static void print_current_time(void)
   5.242  {
   5.243 -    struct timeval tv;
   5.244 -
   5.245 -    get_time_values_from_xen();
   5.246 +    struct timeval tv;    
   5.247  
   5.248      gettimeofday(&tv);
   5.249      printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
   5.250  }
   5.251  
   5.252 +
   5.253  void block(u32 millisecs)
   5.254  {
   5.255      struct timeval tv;
   5.256      gettimeofday(&tv);
   5.257 -    //printk("tv.tv_sec=%ld, tv.tv_usec=%ld, shadow_system_time=%lld\n", tv.tv_sec, tv.tv_usec, shadow_system_time );
   5.258 -    HYPERVISOR_set_timer_op(get_s_time() + 1000000LL * (s64) millisecs);
   5.259 +    HYPERVISOR_set_timer_op(monotonic_clock() + 1000000LL * (s64) millisecs);
   5.260      HYPERVISOR_block();
   5.261  }
   5.262  
   5.263 @@ -185,7 +220,7 @@ static void timer_handler(int ev, struct
   5.264      static int i;
   5.265  
   5.266      get_time_values_from_xen();
   5.267 -
   5.268 +    update_wallclock();
   5.269      i++;
   5.270      if (i >= 1000) {
   5.271          print_current_time();
   5.272 @@ -197,24 +232,5 @@ static void timer_handler(int ev, struct
   5.273  
   5.274  void init_time(void)
   5.275  {
   5.276 -    u64         __cpu_khz;
   5.277 -    unsigned long cpu_khz;
   5.278 -
   5.279 -    __cpu_khz = HYPERVISOR_shared_info->cpu_freq;
   5.280 -
   5.281 -    cpu_khz = (u32) (__cpu_khz/1000);
   5.282 -
   5.283 -    printk("Xen reported: %lu.%03lu MHz processor.\n", 
   5.284 -           cpu_khz / 1000, cpu_khz % 1000);
   5.285 -	/* (10^6 * 2^32) / cpu_hz = (10^3 * 2^32) / cpu_khz =
   5.286 -	   (2^32 * 1 / (clocks/us)) */
   5.287 -	{	
   5.288 -		unsigned long eax=0, edx=1000;
   5.289 -		__asm__("divl %2"
   5.290 -		    :"=a" (fast_gettimeoffset_quotient), "=d" (edx)
   5.291 -		    :"r" (cpu_khz),
   5.292 -		    "0" (eax), "1" (edx));
   5.293 -	}
   5.294 -
   5.295      bind_virq(VIRQ_TIMER, &timer_handler);
   5.296  }
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/Kconfig	Fri Aug 19 16:47:24 2005 -0800
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/Kconfig	Mon Aug 22 11:00:37 2005 -0700
     6.3 @@ -61,15 +61,6 @@ config XEN_BLKDEV_TAP_BE
     6.4            with the blktap.  This option will be removed as the block drivers are
     6.5            modified to use grant tables.
     6.6  
     6.7 -config XEN_BLKDEV_GRANT
     6.8 -        bool "Grant table substrate for block drivers"
     6.9 -        depends on !XEN_BLKDEV_TAP_BE
    6.10 -        default y
    6.11 -        help
    6.12 -          This introduces the use of grant tables as a data exhange mechanism
    6.13 -          between the frontend and backend block drivers. This currently
    6.14 -          conflicts with the block tap.
    6.15 -
    6.16  config XEN_NETDEV_BACKEND
    6.17  	bool "Network-device backend driver"
    6.18  	depends on XEN_PHYSDEV_ACCESS
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Fri Aug 19 16:47:24 2005 -0800
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Mon Aug 22 11:00:37 2005 -0700
     7.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
     7.4  CONFIG_XEN_PHYSDEV_ACCESS=y
     7.5  CONFIG_XEN_BLKDEV_BACKEND=y
     7.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
     7.7 -CONFIG_XEN_BLKDEV_GRANT=y
     7.8  CONFIG_XEN_NETDEV_BACKEND=y
     7.9  CONFIG_XEN_BLKDEV_FRONTEND=y
    7.10  CONFIG_XEN_NETDEV_FRONTEND=y
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Fri Aug 19 16:47:24 2005 -0800
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Mon Aug 22 11:00:37 2005 -0700
     8.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
     8.4  CONFIG_XEN_PHYSDEV_ACCESS=y
     8.5  CONFIG_XEN_BLKDEV_BACKEND=y
     8.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
     8.7 -CONFIG_XEN_BLKDEV_GRANT=y
     8.8  CONFIG_XEN_NETDEV_BACKEND=y
     8.9  CONFIG_XEN_BLKDEV_FRONTEND=y
    8.10  CONFIG_XEN_NETDEV_FRONTEND=y
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Fri Aug 19 16:47:24 2005 -0800
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Mon Aug 22 11:00:37 2005 -0700
     9.3 @@ -12,7 +12,6 @@ CONFIG_NO_IDLE_HZ=y
     9.4  #
     9.5  # CONFIG_XEN_PRIVILEGED_GUEST is not set
     9.6  # CONFIG_XEN_PHYSDEV_ACCESS is not set
     9.7 -CONFIG_XEN_BLKDEV_GRANT=y
     9.8  CONFIG_XEN_BLKDEV_FRONTEND=y
     9.9  CONFIG_XEN_NETDEV_FRONTEND=y
    9.10  CONFIG_XEN_NETDEV_GRANT_TX=y
    10.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Fri Aug 19 16:47:24 2005 -0800
    10.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Mon Aug 22 11:00:37 2005 -0700
    10.3 @@ -12,7 +12,6 @@ CONFIG_NO_IDLE_HZ=y
    10.4  #
    10.5  # CONFIG_XEN_PRIVILEGED_GUEST is not set
    10.6  # CONFIG_XEN_PHYSDEV_ACCESS is not set
    10.7 -CONFIG_XEN_BLKDEV_GRANT=y
    10.8  CONFIG_XEN_BLKDEV_FRONTEND=y
    10.9  CONFIG_XEN_NETDEV_FRONTEND=y
   10.10  CONFIG_XEN_NETDEV_GRANT_TX=y
    11.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Fri Aug 19 16:47:24 2005 -0800
    11.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Mon Aug 22 11:00:37 2005 -0700
    11.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
    11.4  CONFIG_XEN_PHYSDEV_ACCESS=y
    11.5  CONFIG_XEN_BLKDEV_BACKEND=y
    11.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
    11.7 -CONFIG_XEN_BLKDEV_GRANT=y
    11.8  CONFIG_XEN_NETDEV_BACKEND=y
    11.9  CONFIG_XEN_BLKDEV_FRONTEND=y
   11.10  CONFIG_XEN_NETDEV_FRONTEND=y
    12.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Fri Aug 19 16:47:24 2005 -0800
    12.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Mon Aug 22 11:00:37 2005 -0700
    12.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
    12.4  CONFIG_XEN_PHYSDEV_ACCESS=y
    12.5  CONFIG_XEN_BLKDEV_BACKEND=y
    12.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
    12.7 -CONFIG_XEN_BLKDEV_GRANT=y
    12.8  CONFIG_XEN_NETDEV_BACKEND=y
    12.9  CONFIG_XEN_BLKDEV_FRONTEND=y
   12.10  CONFIG_XEN_NETDEV_FRONTEND=y
    13.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Fri Aug 19 16:47:24 2005 -0800
    13.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Mon Aug 22 11:00:37 2005 -0700
    13.3 @@ -923,7 +923,8 @@ static int __init do_boot_cpu(int apicid
    13.4  	ctxt.ctrlreg[3] = virt_to_mfn(swapper_pg_dir) << PAGE_SHIFT;
    13.5  
    13.6  	boot_error = HYPERVISOR_boot_vcpu(cpu, &ctxt);
    13.7 -	printk("boot error: %ld\n", boot_error);
    13.8 +	if (boot_error)
    13.9 +		printk("boot error: %ld\n", boot_error);
   13.10  
   13.11  	if (!boot_error) {
   13.12  		/*
    14.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c	Fri Aug 19 16:47:24 2005 -0800
    14.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c	Mon Aug 22 11:00:37 2005 -0700
    14.3 @@ -43,20 +43,18 @@
    14.4  #define IO_TLB_SHIFT 11
    14.5  
    14.6  int swiotlb_force;
    14.7 +static char *iotlb_virt_start;
    14.8 +static unsigned long iotlb_nslabs;
    14.9  
   14.10  /*
   14.11   * Used to do a quick range check in swiotlb_unmap_single and
   14.12   * swiotlb_sync_single_*, to see if the memory was in fact allocated by this
   14.13   * API.
   14.14   */
   14.15 -static char *iotlb_virt_start, *iotlb_virt_end;
   14.16 -static dma_addr_t iotlb_bus_start, iotlb_bus_end;
   14.17 +static dma_addr_t iotlb_bus_start, iotlb_bus_mask;
   14.18  
   14.19 -/*
   14.20 - * The number of IO TLB blocks (in groups of 64) betweeen iotlb_virt_start and
   14.21 - * iotlb_virt_end.  This is command line adjustable via setup_io_tlb_npages.
   14.22 - */
   14.23 -static unsigned long iotlb_nslabs;
   14.24 +/* Does the given dma address reside within the swiotlb aperture? */
   14.25 +#define in_swiotlb_aperture(a) (!(((a) ^ iotlb_bus_start) & iotlb_bus_mask))
   14.26  
   14.27  /*
   14.28   * When the IOMMU overflows we return a fallback buffer. This sets the size.
   14.29 @@ -94,6 +92,9 @@ setup_io_tlb_npages(char *str)
   14.30  		iotlb_nslabs = simple_strtoul(str, &str, 0) <<
   14.31  			(20 - IO_TLB_SHIFT);
   14.32  		iotlb_nslabs = ALIGN(iotlb_nslabs, IO_TLB_SEGSIZE);
   14.33 +		/* Round up to power of two (xen_create_contiguous_region). */
   14.34 +		while (iotlb_nslabs & (iotlb_nslabs-1))
   14.35 +			iotlb_nslabs += iotlb_nslabs & ~(iotlb_nslabs-1);
   14.36  	}
   14.37  	if (*str == ',')
   14.38  		++str;
   14.39 @@ -120,6 +121,9 @@ swiotlb_init_with_default_size (size_t d
   14.40  	if (!iotlb_nslabs) {
   14.41  		iotlb_nslabs = (default_size >> IO_TLB_SHIFT);
   14.42  		iotlb_nslabs = ALIGN(iotlb_nslabs, IO_TLB_SEGSIZE);
   14.43 +		/* Round up to power of two (xen_create_contiguous_region). */
   14.44 +		while (iotlb_nslabs & (iotlb_nslabs-1))
   14.45 +			iotlb_nslabs += iotlb_nslabs & ~(iotlb_nslabs-1);
   14.46  	}
   14.47  
   14.48  	bytes = iotlb_nslabs * (1UL << IO_TLB_SHIFT);
   14.49 @@ -133,17 +137,12 @@ swiotlb_init_with_default_size (size_t d
   14.50  		      "Use dom0_mem Xen boot parameter to reserve\n"
   14.51  		      "some DMA memory (e.g., dom0_mem=-128M).\n");
   14.52  
   14.53 -	for (i = 0; i < iotlb_nslabs; i += IO_TLB_SEGSIZE)
   14.54 -		xen_create_contiguous_region(
   14.55 -			(unsigned long)iotlb_virt_start + (i << IO_TLB_SHIFT),
   14.56 -			get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT));
   14.57 -
   14.58 -	iotlb_virt_end = iotlb_virt_start + bytes;
   14.59 +	xen_create_contiguous_region(
   14.60 +		(unsigned long)iotlb_virt_start, get_order(bytes));
   14.61  
   14.62  	/*
   14.63  	 * Allocate and initialize the free list array.  This array is used
   14.64 -	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
   14.65 -	 * between iotlb_virt_start and iotlb_virt_end.
   14.66 +	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE.
   14.67  	 */
   14.68  	io_tlb_list = alloc_bootmem(iotlb_nslabs * sizeof(int));
   14.69  	for (i = 0; i < iotlb_nslabs; i++)
   14.70 @@ -156,15 +155,19 @@ swiotlb_init_with_default_size (size_t d
   14.71  	 * Get the overflow emergency buffer
   14.72  	 */
   14.73  	io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
   14.74 +
   14.75  	iotlb_bus_start = virt_to_bus(iotlb_virt_start);
   14.76 -	iotlb_bus_end   = iotlb_bus_start + bytes;
   14.77 +	iotlb_bus_mask  = ~(dma_addr_t)(bytes - 1);
   14.78 +
   14.79  	printk(KERN_INFO "Software IO TLB enabled: \n"
   14.80  	       " Aperture:     %lu megabytes\n"
   14.81  	       " Bus range:    0x%016lx - 0x%016lx\n"
   14.82  	       " Kernel range: 0x%016lx - 0x%016lx\n",
   14.83  	       bytes >> 20,
   14.84 -	       (unsigned long)iotlb_bus_start, (unsigned long)iotlb_bus_end,
   14.85 -	       (unsigned long)iotlb_virt_start, (unsigned long)iotlb_virt_end);
   14.86 +	       (unsigned long)iotlb_bus_start,
   14.87 +	       (unsigned long)iotlb_bus_start + bytes,
   14.88 +	       (unsigned long)iotlb_virt_start,
   14.89 +	       (unsigned long)iotlb_virt_start + bytes);
   14.90  }
   14.91  
   14.92  void
   14.93 @@ -444,7 +447,7 @@ swiotlb_unmap_single(struct device *hwde
   14.94  		     int dir)
   14.95  {
   14.96  	BUG_ON(dir == DMA_NONE);
   14.97 -	if ((dev_addr >= iotlb_bus_start) && (dev_addr < iotlb_bus_end))
   14.98 +	if (in_swiotlb_aperture(dev_addr))
   14.99  		unmap_single(hwdev, bus_to_virt(dev_addr), size, dir);
  14.100  }
  14.101  
  14.102 @@ -463,7 +466,7 @@ swiotlb_sync_single_for_cpu(struct devic
  14.103  			    size_t size, int dir)
  14.104  {
  14.105  	BUG_ON(dir == DMA_NONE);
  14.106 -	if ((dev_addr >= iotlb_bus_start) && (dev_addr < iotlb_bus_end))
  14.107 +	if (in_swiotlb_aperture(dev_addr))
  14.108  		sync_single(hwdev, bus_to_virt(dev_addr), size, dir);
  14.109  }
  14.110  
  14.111 @@ -472,7 +475,7 @@ swiotlb_sync_single_for_device(struct de
  14.112  			       size_t size, int dir)
  14.113  {
  14.114  	BUG_ON(dir == DMA_NONE);
  14.115 -	if ((dev_addr >= iotlb_bus_start) && (dev_addr < iotlb_bus_end))
  14.116 +	if (in_swiotlb_aperture(dev_addr))
  14.117  		sync_single(hwdev, bus_to_virt(dev_addr), size, dir);
  14.118  }
  14.119  
  14.120 @@ -610,7 +613,7 @@ swiotlb_unmap_page(struct device *hwdev,
  14.121  		   size_t size, enum dma_data_direction direction)
  14.122  {
  14.123  	BUG_ON(direction == DMA_NONE);
  14.124 -	if ((dma_address >= iotlb_bus_start) && (dma_address < iotlb_bus_end))
  14.125 +	if (in_swiotlb_aperture(dma_address))
  14.126  		unmap_single(hwdev, bus_to_virt(dma_address), size, direction);
  14.127  }
  14.128  
    15.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Fri Aug 19 16:47:24 2005 -0800
    15.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Mon Aug 22 11:00:37 2005 -0700
    15.3 @@ -405,54 +405,6 @@ void xen_destroy_contiguous_region(unsig
    15.4  	balloon_unlock(flags);
    15.5  }
    15.6  
    15.7 -
    15.8 -unsigned long allocate_empty_lowmem_region(unsigned long pages)
    15.9 -{
   15.10 -	pgd_t         *pgd;
   15.11 -	pud_t         *pud; 
   15.12 -	pmd_t         *pmd;
   15.13 -	pte_t         *pte;
   15.14 -	unsigned long *pfn_array;
   15.15 -	unsigned long  vstart;
   15.16 -	unsigned long  i;
   15.17 -	unsigned int   order = get_order(pages*PAGE_SIZE);
   15.18 -
   15.19 -	vstart = __get_free_pages(GFP_KERNEL, order);
   15.20 -	if (vstart == 0)
   15.21 -		return 0UL;
   15.22 -
   15.23 -	scrub_pages(vstart, 1 << order);
   15.24 -
   15.25 -	pfn_array = vmalloc((1<<order) * sizeof(*pfn_array));
   15.26 -	BUG_ON(pfn_array == NULL);
   15.27 -
   15.28 -	for (i = 0; i < (1<<order); i++) {
   15.29 -		pgd = pgd_offset_k(   (vstart + (i*PAGE_SIZE)));
   15.30 -		pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
   15.31 -		pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
   15.32 -		pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE))); 
   15.33 -		pfn_array[i] = pte_mfn(*pte);
   15.34 -#ifdef CONFIG_X86_64
   15.35 -		xen_l1_entry_update(pte, __pte(0));
   15.36 -#else
   15.37 -		BUG_ON(HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE), 
   15.38 -						    __pte_ma(0), 0));
   15.39 -#endif
   15.40 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
   15.41 -			INVALID_P2M_ENTRY;
   15.42 -	}
   15.43 -
   15.44 -	flush_tlb_all();
   15.45 -
   15.46 -	balloon_put_pages(pfn_array, 1 << order);
   15.47 -
   15.48 -	vfree(pfn_array);
   15.49 -
   15.50 -	return vstart;
   15.51 -}
   15.52 -
   15.53 -EXPORT_SYMBOL(allocate_empty_lowmem_region);
   15.54 -
   15.55  /*
   15.56   * Local variables:
   15.57   *  c-file-style: "linux"
    16.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Fri Aug 19 16:47:24 2005 -0800
    16.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Mon Aug 22 11:00:37 2005 -0700
    16.3 @@ -352,13 +352,6 @@ static void __init pagetable_init (void)
    16.4  	swapper_pg_dir = pgd_base;
    16.5  	init_mm.pgd    = pgd_base;
    16.6  
    16.7 -#ifdef CONFIG_X86_PAE
    16.8 -	int i;
    16.9 -	/* Init entries of the first-level page table to the zero page */
   16.10 -	for (i = 0; i < PTRS_PER_PGD; i++)
   16.11 -		set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT));
   16.12 -#endif
   16.13 -
   16.14  	/* Enable PSE if available */
   16.15  	if (cpu_has_pse) {
   16.16  		set_in_cr4(X86_CR4_PSE);
   16.17 @@ -383,17 +376,6 @@ static void __init pagetable_init (void)
   16.18  	page_table_range_init(vaddr, 0, pgd_base);
   16.19  
   16.20  	permanent_kmaps_init(pgd_base);
   16.21 -
   16.22 -#if 0 /* def CONFIG_X86_PAE */
   16.23 -	/*
   16.24 -	 * Add low memory identity-mappings - SMP needs it when
   16.25 -	 * starting up on an AP from real-mode. In the non-PAE
   16.26 -	 * case we already have these mappings through head.S.
   16.27 -	 * All user-space mappings are explicitly cleared after
   16.28 -	 * SMP startup.
   16.29 -	 */
   16.30 -	set_pgd(&pgd_base[0], pgd_base[USER_PTRS_PER_PGD]);
   16.31 -#endif
   16.32  }
   16.33  
   16.34  #if defined(CONFIG_PM_DISK) || defined(CONFIG_SOFTWARE_SUSPEND)
    17.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile	Fri Aug 19 16:47:24 2005 -0800
    17.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile	Mon Aug 22 11:00:37 2005 -0700
    17.3 @@ -17,7 +17,7 @@ l-pci-y				+= irq.o
    17.4  c-pci-$(CONFIG_X86_VISWS)	:= visws.o fixup.o
    17.5  pci-$(CONFIG_X86_VISWS)		:=
    17.6  c-pci-$(CONFIG_X86_NUMAQ)	:= numa.o
    17.7 -pci-$(CONFIG_X86_NUMAQ)		:= irq.o
    17.8 +l-pci-$(CONFIG_X86_NUMAQ)	:= irq.o
    17.9  
   17.10  obj-y				+= $(pci-y)
   17.11  c-obj-y				+= $(c-pci-y) common.o
   17.12 @@ -27,6 +27,7 @@ c-link	:=
   17.13  $(patsubst %.o,$(obj)/%.c,$(c-obj-y) $(c-link)):
   17.14  	@ln -fsn $(srctree)/arch/i386/pci/$(notdir $@) $@
   17.15  
   17.16 -obj-y	+= $(c-obj-y) $(l-pci-y)
   17.17 +# Make sure irq.o gets linked in before common.o
   17.18 +obj-y	+= $(patsubst common.o,$(l-pci-y) common.o,$(c-obj-y))
   17.19  
   17.20  clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link))
    18.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Fri Aug 19 16:47:24 2005 -0800
    18.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Mon Aug 22 11:00:37 2005 -0700
    18.3 @@ -143,13 +143,8 @@ static int __do_suspend(void *ignore)
    18.4  #define usbif_resume() do{}while(0)
    18.5  #endif
    18.6  
    18.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    18.8      extern int gnttab_suspend(void);
    18.9      extern int gnttab_resume(void);
   18.10 -#else
   18.11 -#define gnttab_suspend() do{}while(0)
   18.12 -#define gnttab_resume()  do{}while(0)
   18.13 -#endif
   18.14  
   18.15  #ifdef CONFIG_SMP
   18.16      extern void smp_suspend(void);
    19.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile	Fri Aug 19 16:47:24 2005 -0800
    19.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile	Mon Aug 22 11:00:37 2005 -0700
    19.3 @@ -36,8 +36,8 @@ quiet_cmd_syscall = SYSCALL $@
    19.4  	$(call if_changed,syscall)
    19.5  
    19.6  AFLAGS_vsyscall-int80.o = -m32 -I$(obj)
    19.7 -AFLAGS_vsyscall-sysenter.o = -m32
    19.8 -AFLAGS_vsyscall-syscall.o = -m32
    19.9 +AFLAGS_vsyscall-sysenter.o = -m32 -I$(obj)
   19.10 +AFLAGS_vsyscall-syscall.o = -m32 -I$(obj)
   19.11  CFLAGS_ia32_ioctl.o += -Ifs/
   19.12  
   19.13  s-link	:= vsyscall-syscall.o vsyscall-sysenter.o vsyscall-sigreturn.o
   19.14 @@ -48,13 +48,11 @@ s-link	:= vsyscall-syscall.o vsyscall-sy
   19.15  $(patsubst %.o,$(obj)/%.c,$(c-obj-y) $(c-link)) $(patsubst %.o,$(obj)/%.S,$(s-obj-y) $(s-link)):
   19.16  	@ln -fsn $(srctree)/arch/x86_64/ia32/$(notdir $@) $@
   19.17  
   19.18 -$(obj)/vsyscall-int80.S: $(obj)/vsyscall-sigreturn.S ../../i386/kernel/vsyscall-note.S
   19.19 -$(obj)/vsyscall-sysenter.S: $(obj)/vsyscall-sigreturn.S
   19.20 -$(obj)/vsyscall-syscall.S: $(obj)/vsyscall-sigreturn.S
   19.21 +$(obj)/vsyscall-int80.o $(obj)/vsyscall-sysenter.o $(obj)/vsyscall-syscall.o: \
   19.22 +	$(obj)/vsyscall-sigreturn.S $(obj)/../../i386/kernel/vsyscall-note.S
   19.23  
   19.24 -../../i386/kernel/vsyscall-note.S:
   19.25 -	@ln -fsn $(srctree)/arch/i386/kernel/$(notdir $@) $(srctree)/arch/xen/i386/kernel/$(notdir $@)
   19.26 -	make -C arch/xen/i386/kernel vsyscall-note.S
   19.27 +$(obj)/../../i386/kernel/vsyscall-note.S:
   19.28 +	@ln -fsn $(srctree)/arch/i386/kernel/$(notdir $@) $@
   19.29  
   19.30  obj-y	+= $(c-obj-y) $(s-obj-y)
   19.31  
    20.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/vsyscall.c	Fri Aug 19 16:47:24 2005 -0800
    20.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/vsyscall.c	Mon Aug 22 11:00:37 2005 -0700
    20.3 @@ -210,15 +210,16 @@ static void __init map_vsyscall(void)
    20.4  	__set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_page0, PAGE_KERNEL_VSYSCALL);
    20.5  }
    20.6  
    20.7 -extern void __set_fixmap_user (enum fixed_addresses, unsigned long, pgprot_t);
    20.8 -
    20.9 +#ifdef CONFIG_XEN
   20.10  static void __init map_vsyscall_user(void)
   20.11  {
   20.12 +	extern void __set_fixmap_user(enum fixed_addresses, unsigned long, pgprot_t);
   20.13  	extern char __vsyscall_0;
   20.14  	unsigned long physaddr_page0 = __pa_symbol(&__vsyscall_0);
   20.15  
   20.16  	__set_fixmap_user(VSYSCALL_FIRST_PAGE, physaddr_page0, PAGE_KERNEL_VSYSCALL);
   20.17  }
   20.18 +#endif
   20.19  
   20.20  static int __init vsyscall_init(void)
   20.21  {
   20.22 @@ -227,7 +228,10 @@ static int __init vsyscall_init(void)
   20.23  	BUG_ON((unsigned long) &vtime != VSYSCALL_ADDR(__NR_vtime));
   20.24  	BUG_ON((VSYSCALL_ADDR(0) != __fix_to_virt(VSYSCALL_FIRST_PAGE)));
   20.25  	map_vsyscall();
   20.26 -        map_vsyscall_user();    /* establish tranlation for user address space */
   20.27 +#ifdef CONFIG_XEN
   20.28 +	map_vsyscall_user();
   20.29 +	sysctl_vsyscall = 0; /* disable vgettimeofay() */
   20.30 +#endif
   20.31  #ifdef CONFIG_SYSCTL
   20.32  	register_sysctl_table(kernel_root_table2, 0);
   20.33  #endif
    21.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile	Fri Aug 19 16:47:24 2005 -0800
    21.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile	Mon Aug 22 11:00:37 2005 -0700
    21.3 @@ -30,8 +30,9 @@ c-link	:=
    21.4  $(patsubst %.o,$(obj)/%.c,$(c-i386-obj-y)):
    21.5  	@ln -fsn $(srctree)/arch/i386/pci/$(notdir $@) $@
    21.6  
    21.7 -obj-y	+= $(c-i386-obj-y) $(c-obj-y)
    21.8 -obj-y	+= $(c-xen-obj-y)
    21.9 +# Make sure irq.o gets linked in before common.o
   21.10 +obj-y	+= $(patsubst common.o,$(c-xen-obj-y) common.o,$(c-i386-obj-y))
   21.11 +obj-y	+= $(c-obj-y)
   21.12  
   21.13  clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link))
   21.14  clean-files += $(patsubst %.o,%.c,$(c-i386-obj-y) $(c-i386-obj-))
    22.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Fri Aug 19 16:47:24 2005 -0800
    22.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Mon Aug 22 11:00:37 2005 -0700
    22.3 @@ -83,12 +83,15 @@ static struct timer_list balloon_timer;
    22.4  
    22.5  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    22.6  /* Use the private and mapping fields of struct page as a list. */
    22.7 -#define PAGE_TO_LIST(p) ( (struct list_head *)&p->private )
    22.8 -#define LIST_TO_PAGE(l) ( list_entry( ((unsigned long *)l),   \
    22.9 -                                      struct page, private ) )
   22.10 -#define UNLIST_PAGE(p)  do { list_del(PAGE_TO_LIST(p));       \
   22.11 -                             p->mapping = NULL;               \
   22.12 -                             p->private = 0; } while(0)
   22.13 +#define PAGE_TO_LIST(p) ((struct list_head *)&p->private)
   22.14 +#define LIST_TO_PAGE(l)				\
   22.15 +	(list_entry(((unsigned long *)l), struct page, private))
   22.16 +#define UNLIST_PAGE(p)				\
   22.17 +	do {					\
   22.18 +		list_del(PAGE_TO_LIST(p));	\
   22.19 +		p->mapping = NULL;		\
   22.20 +		p->private = 0;			\
   22.21 +	} while(0)
   22.22  #else
   22.23  /* There's a dedicated list field in struct page we can use.    */
   22.24  #define PAGE_TO_LIST(p) ( &p->list )
   22.25 @@ -104,56 +107,53 @@ static struct timer_list balloon_timer;
   22.26  #endif
   22.27  
   22.28  #define IPRINTK(fmt, args...) \
   22.29 -    printk(KERN_INFO "xen_mem: " fmt, ##args)
   22.30 +	printk(KERN_INFO "xen_mem: " fmt, ##args)
   22.31  #define WPRINTK(fmt, args...) \
   22.32 -    printk(KERN_WARNING "xen_mem: " fmt, ##args)
   22.33 +	printk(KERN_WARNING "xen_mem: " fmt, ##args)
   22.34  
   22.35  /* balloon_append: add the given page to the balloon. */
   22.36  static void balloon_append(struct page *page)
   22.37  {
   22.38 -    /* Low memory is re-populated first, so highmem pages go at list tail. */
   22.39 -    if ( PageHighMem(page) )
   22.40 -    {
   22.41 -        list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
   22.42 -        balloon_high++;
   22.43 -    }
   22.44 -    else
   22.45 -    {
   22.46 -        list_add(PAGE_TO_LIST(page), &ballooned_pages);
   22.47 -        balloon_low++;
   22.48 -    }
   22.49 +	/* Lowmem is re-populated first, so highmem pages go at list tail. */
   22.50 +	if (PageHighMem(page)) {
   22.51 +		list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
   22.52 +		balloon_high++;
   22.53 +	} else {
   22.54 +		list_add(PAGE_TO_LIST(page), &ballooned_pages);
   22.55 +		balloon_low++;
   22.56 +	}
   22.57  }
   22.58  
   22.59  /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
   22.60  static struct page *balloon_retrieve(void)
   22.61  {
   22.62 -    struct page *page;
   22.63 -
   22.64 -    if ( list_empty(&ballooned_pages) )
   22.65 -        return NULL;
   22.66 +	struct page *page;
   22.67  
   22.68 -    page = LIST_TO_PAGE(ballooned_pages.next);
   22.69 -    UNLIST_PAGE(page);
   22.70 +	if (list_empty(&ballooned_pages))
   22.71 +		return NULL;
   22.72  
   22.73 -    if ( PageHighMem(page) )
   22.74 -        balloon_high--;
   22.75 -    else
   22.76 -        balloon_low--;
   22.77 +	page = LIST_TO_PAGE(ballooned_pages.next);
   22.78 +	UNLIST_PAGE(page);
   22.79  
   22.80 -    return page;
   22.81 +	if (PageHighMem(page))
   22.82 +		balloon_high--;
   22.83 +	else
   22.84 +		balloon_low--;
   22.85 +
   22.86 +	return page;
   22.87  }
   22.88  
   22.89  static void balloon_alarm(unsigned long unused)
   22.90  {
   22.91 -    schedule_work(&balloon_worker);
   22.92 +	schedule_work(&balloon_worker);
   22.93  }
   22.94  
   22.95  static unsigned long current_target(void)
   22.96  {
   22.97 -    unsigned long target = min(target_pages, hard_limit);
   22.98 -    if ( target > (current_pages + balloon_low + balloon_high) )
   22.99 -        target = current_pages + balloon_low + balloon_high;
  22.100 -    return target;
  22.101 +	unsigned long target = min(target_pages, hard_limit);
  22.102 +	if (target > (current_pages + balloon_low + balloon_high))
  22.103 +		target = current_pages + balloon_low + balloon_high;
  22.104 +	return target;
  22.105  }
  22.106  
  22.107  /*
  22.108 @@ -164,161 +164,147 @@ static unsigned long current_target(void
  22.109   */
  22.110  static void balloon_process(void *unused)
  22.111  {
  22.112 -    unsigned long *mfn_list, pfn, i, flags;
  22.113 -    struct page   *page;
  22.114 -    long           credit, debt, rc;
  22.115 -    void          *v;
  22.116 +	unsigned long *mfn_list, pfn, i, flags;
  22.117 +	struct page   *page;
  22.118 +	long           credit, debt, rc;
  22.119 +	void          *v;
  22.120  
  22.121 -    down(&balloon_mutex);
  22.122 +	down(&balloon_mutex);
  22.123  
  22.124   retry:
  22.125 -    mfn_list = NULL;
  22.126 -
  22.127 -    if ( (credit = current_target() - current_pages) > 0 )
  22.128 -    {
  22.129 -        mfn_list = (unsigned long *)vmalloc(credit * sizeof(*mfn_list));
  22.130 -        if ( mfn_list == NULL )
  22.131 -            goto out;
  22.132 -
  22.133 -        balloon_lock(flags);
  22.134 -        rc = HYPERVISOR_dom_mem_op(
  22.135 -            MEMOP_increase_reservation, mfn_list, credit, 0);
  22.136 -        balloon_unlock(flags);
  22.137 -        if ( rc < credit )
  22.138 -        {
  22.139 -            /* We hit the Xen hard limit: reprobe. */
  22.140 -            if ( HYPERVISOR_dom_mem_op(
  22.141 -                MEMOP_decrease_reservation, mfn_list, rc, 0) != rc )
  22.142 -                BUG();
  22.143 -            hard_limit = current_pages + rc - driver_pages;
  22.144 -            vfree(mfn_list);
  22.145 -            goto retry;
  22.146 -        }
  22.147 -
  22.148 -        for ( i = 0; i < credit; i++ )
  22.149 -        {
  22.150 -            if ( (page = balloon_retrieve()) == NULL )
  22.151 -                BUG();
  22.152 -
  22.153 -            pfn = page - mem_map;
  22.154 -            if ( phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY )
  22.155 -                BUG();
  22.156 -
  22.157 -            /* Update P->M and M->P tables. */
  22.158 -            phys_to_machine_mapping[pfn] = mfn_list[i];
  22.159 -            xen_machphys_update(mfn_list[i], pfn);
  22.160 -            
  22.161 -            /* Link back into the page tables if it's not a highmem page. */
  22.162 -            if ( pfn < max_low_pfn )
  22.163 -            {
  22.164 -                BUG_ON(HYPERVISOR_update_va_mapping(
  22.165 -                    (unsigned long)__va(pfn << PAGE_SHIFT),
  22.166 -                    pfn_pte_ma(mfn_list[i], PAGE_KERNEL), 0));
  22.167 -            }
  22.168 -
  22.169 -            /* Finally, relinquish the memory back to the system allocator. */
  22.170 -            ClearPageReserved(page);
  22.171 -            set_page_count(page, 1);
  22.172 -            __free_page(page);
  22.173 -        }
  22.174 +	mfn_list = NULL;
  22.175  
  22.176 -        current_pages += credit;
  22.177 -    }
  22.178 -    else if ( credit < 0 )
  22.179 -    {
  22.180 -        debt = -credit;
  22.181 -
  22.182 -        mfn_list = (unsigned long *)vmalloc(debt * sizeof(*mfn_list));
  22.183 -        if ( mfn_list == NULL )
  22.184 -            goto out;
  22.185 -
  22.186 -        for ( i = 0; i < debt; i++ )
  22.187 -        {
  22.188 -            if ( (page = alloc_page(GFP_HIGHUSER)) == NULL )
  22.189 -            {
  22.190 -                debt = i;
  22.191 -                break;
  22.192 -            }
  22.193 -
  22.194 -            pfn = page - mem_map;
  22.195 -            mfn_list[i] = phys_to_machine_mapping[pfn];
  22.196 +	if ((credit = current_target() - current_pages) > 0) {
  22.197 +		mfn_list = vmalloc(credit * sizeof(*mfn_list));
  22.198 +		if (mfn_list == NULL)
  22.199 +			goto out;
  22.200  
  22.201 -            if ( !PageHighMem(page) )
  22.202 -            {
  22.203 -                v = phys_to_virt(pfn << PAGE_SHIFT);
  22.204 -                scrub_pages(v, 1);
  22.205 -                BUG_ON(HYPERVISOR_update_va_mapping(
  22.206 -                    (unsigned long)v, __pte_ma(0), 0));
  22.207 -            }
  22.208 -#ifdef CONFIG_XEN_SCRUB_PAGES
  22.209 -            else
  22.210 -            {
  22.211 -                v = kmap(page);
  22.212 -                scrub_pages(v, 1);
  22.213 -                kunmap(page);
  22.214 -            }
  22.215 -#endif
  22.216 -        }
  22.217 +		balloon_lock(flags);
  22.218 +		rc = HYPERVISOR_dom_mem_op(
  22.219 +			MEMOP_increase_reservation, mfn_list, credit, 0);
  22.220 +		balloon_unlock(flags);
  22.221 +		if (rc < credit) {
  22.222 +			/* We hit the Xen hard limit: reprobe. */
  22.223 +			BUG_ON(HYPERVISOR_dom_mem_op(
  22.224 +				MEMOP_decrease_reservation,
  22.225 +				mfn_list, rc, 0) != rc);
  22.226 +			hard_limit = current_pages + rc - driver_pages;
  22.227 +			vfree(mfn_list);
  22.228 +			goto retry;
  22.229 +		}
  22.230  
  22.231 -        /* Ensure that ballooned highmem pages don't have cached mappings. */
  22.232 -        kmap_flush_unused();
  22.233 -        flush_tlb_all();
  22.234 +		for (i = 0; i < credit; i++) {
  22.235 +			page = balloon_retrieve();
  22.236 +			BUG_ON(page == NULL);
  22.237  
  22.238 -        /* No more mappings: invalidate pages in P2M and add to balloon. */
  22.239 -        for ( i = 0; i < debt; i++ )
  22.240 -        {
  22.241 -            pfn = mfn_to_pfn(mfn_list[i]);
  22.242 -            phys_to_machine_mapping[pfn] = INVALID_P2M_ENTRY;
  22.243 -            balloon_append(pfn_to_page(pfn));
  22.244 -        }
  22.245 +			pfn = page - mem_map;
  22.246 +			if (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY)
  22.247 +				BUG();
  22.248  
  22.249 -        if ( HYPERVISOR_dom_mem_op(
  22.250 -            MEMOP_decrease_reservation, mfn_list, debt, 0) != debt )
  22.251 -            BUG();
  22.252 +			/* Update P->M and M->P tables. */
  22.253 +			phys_to_machine_mapping[pfn] = mfn_list[i];
  22.254 +			xen_machphys_update(mfn_list[i], pfn);
  22.255 +            
  22.256 +			/* Link back into the page tables if not highmem. */
  22.257 +			if (pfn < max_low_pfn)
  22.258 +				BUG_ON(HYPERVISOR_update_va_mapping(
  22.259 +					(unsigned long)__va(pfn << PAGE_SHIFT),
  22.260 +					pfn_pte_ma(mfn_list[i], PAGE_KERNEL),
  22.261 +					0));
  22.262  
  22.263 -        current_pages -= debt;
  22.264 -    }
  22.265 +			/* Relinquish the page back to the allocator. */
  22.266 +			ClearPageReserved(page);
  22.267 +			set_page_count(page, 1);
  22.268 +			__free_page(page);
  22.269 +		}
  22.270 +
  22.271 +		current_pages += credit;
  22.272 +	} else if (credit < 0) {
  22.273 +		debt = -credit;
  22.274 +
  22.275 +		mfn_list = vmalloc(debt * sizeof(*mfn_list));
  22.276 +		if (mfn_list == NULL)
  22.277 +			goto out;
  22.278 +
  22.279 +		for (i = 0; i < debt; i++) {
  22.280 +			if ((page = alloc_page(GFP_HIGHUSER)) == NULL) {
  22.281 +				debt = i;
  22.282 +				break;
  22.283 +			}
  22.284 +
  22.285 +			pfn = page - mem_map;
  22.286 +			mfn_list[i] = phys_to_machine_mapping[pfn];
  22.287 +
  22.288 +			if (!PageHighMem(page)) {
  22.289 +				v = phys_to_virt(pfn << PAGE_SHIFT);
  22.290 +				scrub_pages(v, 1);
  22.291 +				BUG_ON(HYPERVISOR_update_va_mapping(
  22.292 +					(unsigned long)v, __pte_ma(0), 0));
  22.293 +			}
  22.294 +#ifdef CONFIG_XEN_SCRUB_PAGES
  22.295 +			else {
  22.296 +				v = kmap(page);
  22.297 +				scrub_pages(v, 1);
  22.298 +				kunmap(page);
  22.299 +			}
  22.300 +#endif
  22.301 +		}
  22.302 +
  22.303 +		/* Ensure that ballooned highmem pages don't have kmaps. */
  22.304 +		kmap_flush_unused();
  22.305 +		flush_tlb_all();
  22.306 +
  22.307 +		/* No more mappings: invalidate P2M and add to balloon. */
  22.308 +		for (i = 0; i < debt; i++) {
  22.309 +			pfn = mfn_to_pfn(mfn_list[i]);
  22.310 +			phys_to_machine_mapping[pfn] = INVALID_P2M_ENTRY;
  22.311 +			balloon_append(pfn_to_page(pfn));
  22.312 +		}
  22.313 +
  22.314 +		BUG_ON(HYPERVISOR_dom_mem_op(
  22.315 +			MEMOP_decrease_reservation,mfn_list, debt, 0) != debt);
  22.316 +
  22.317 +		current_pages -= debt;
  22.318 +	}
  22.319  
  22.320   out:
  22.321 -    if ( mfn_list != NULL )
  22.322 -        vfree(mfn_list);
  22.323 +	if (mfn_list != NULL)
  22.324 +		vfree(mfn_list);
  22.325  
  22.326 -    /* Schedule more work if there is some still to be done. */
  22.327 -    if ( current_target() != current_pages )
  22.328 -        mod_timer(&balloon_timer, jiffies + HZ);
  22.329 +	/* Schedule more work if there is some still to be done. */
  22.330 +	if (current_target() != current_pages)
  22.331 +		mod_timer(&balloon_timer, jiffies + HZ);
  22.332  
  22.333 -    up(&balloon_mutex);
  22.334 +	up(&balloon_mutex);
  22.335  }
  22.336  
  22.337  /* Resets the Xen limit, sets new target, and kicks off processing. */
  22.338  static void set_new_target(unsigned long target)
  22.339  {
  22.340 -    /* No need for lock. Not read-modify-write updates. */
  22.341 -    hard_limit   = ~0UL;
  22.342 -    target_pages = target;
  22.343 -    schedule_work(&balloon_worker);
  22.344 +	/* No need for lock. Not read-modify-write updates. */
  22.345 +	hard_limit   = ~0UL;
  22.346 +	target_pages = target;
  22.347 +	schedule_work(&balloon_worker);
  22.348  }
  22.349  
  22.350  static struct xenbus_watch target_watch =
  22.351  {
  22.352 -    .node = "memory/target"
  22.353 +	.node = "memory/target"
  22.354  };
  22.355  
  22.356  /* React to a change in the target key */
  22.357  static void watch_target(struct xenbus_watch *watch, const char *node)
  22.358  {
  22.359 -    unsigned long new_target;
  22.360 -    int err;
  22.361 +	unsigned long new_target;
  22.362 +	int err;
  22.363  
  22.364 -    err = xenbus_scanf("memory", "target", "%lu", &new_target);
  22.365 +	err = xenbus_scanf("memory", "target", "%lu", &new_target);
  22.366 +	if (err != 1) {
  22.367 +		printk(KERN_ERR "Unable to read memory/target\n");
  22.368 +		return;
  22.369 +	} 
  22.370          
  22.371 -    if(err != 1) 
  22.372 -    {
  22.373 -        printk(KERN_ERR "Unable to read memory/target\n");
  22.374 -        return;
  22.375 -    } 
  22.376 -        
  22.377 -    set_new_target(new_target >> PAGE_SHIFT);
  22.378 +	set_new_target(new_target >> PAGE_SHIFT);
  22.379      
  22.380  }
  22.381  
  22.382 @@ -329,141 +315,185 @@ int balloon_init_watcher(struct notifier
  22.383                           unsigned long event,
  22.384                           void *data)
  22.385  {
  22.386 -    int err;
  22.387 -
  22.388 -    BUG_ON(down_trylock(&xenbus_lock) == 0);
  22.389 +	int err;
  22.390  
  22.391 -    err = register_xenbus_watch(&target_watch);
  22.392 +	BUG_ON(down_trylock(&xenbus_lock) == 0);
  22.393  
  22.394 -    if (err) {
  22.395 -        printk(KERN_ERR "Failed to set balloon watcher\n");
  22.396 -    }
  22.397 +	err = register_xenbus_watch(&target_watch);
  22.398 +	if (err)
  22.399 +		printk(KERN_ERR "Failed to set balloon watcher\n");
  22.400  
  22.401 -    return NOTIFY_DONE;
  22.402 +	return NOTIFY_DONE;
  22.403      
  22.404  }
  22.405  
  22.406  static int balloon_write(struct file *file, const char __user *buffer,
  22.407                           unsigned long count, void *data)
  22.408  {
  22.409 -    char memstring[64], *endchar;
  22.410 -    unsigned long long target_bytes;
  22.411 -
  22.412 -    if ( !capable(CAP_SYS_ADMIN) )
  22.413 -        return -EPERM;
  22.414 +	char memstring[64], *endchar;
  22.415 +	unsigned long long target_bytes;
  22.416  
  22.417 -    if ( count <= 1 )
  22.418 -        return -EBADMSG; /* runt */
  22.419 -    if ( count > sizeof(memstring) )
  22.420 -        return -EFBIG;   /* too long */
  22.421 +	if (!capable(CAP_SYS_ADMIN))
  22.422 +		return -EPERM;
  22.423  
  22.424 -    if ( copy_from_user(memstring, buffer, count) )
  22.425 -        return -EFAULT;
  22.426 -    memstring[sizeof(memstring)-1] = '\0';
  22.427 +	if (count <= 1)
  22.428 +		return -EBADMSG; /* runt */
  22.429 +	if (count > sizeof(memstring))
  22.430 +		return -EFBIG;   /* too long */
  22.431  
  22.432 -    target_bytes = memparse(memstring, &endchar);
  22.433 -    set_new_target(target_bytes >> PAGE_SHIFT);
  22.434 +	if (copy_from_user(memstring, buffer, count))
  22.435 +		return -EFAULT;
  22.436 +	memstring[sizeof(memstring)-1] = '\0';
  22.437  
  22.438 -    return count;
  22.439 +	target_bytes = memparse(memstring, &endchar);
  22.440 +	set_new_target(target_bytes >> PAGE_SHIFT);
  22.441 +
  22.442 +	return count;
  22.443  }
  22.444  
  22.445  static int balloon_read(char *page, char **start, off_t off,
  22.446                          int count, int *eof, void *data)
  22.447  {
  22.448 -    int len;
  22.449 -
  22.450 -    len = sprintf(
  22.451 -        page,
  22.452 -        "Current allocation: %8lu kB\n"
  22.453 -        "Requested target:   %8lu kB\n"
  22.454 -        "Low-mem balloon:    %8lu kB\n"
  22.455 -        "High-mem balloon:   %8lu kB\n"
  22.456 -        "Xen hard limit:     ",
  22.457 -        PAGES2KB(current_pages), PAGES2KB(target_pages), 
  22.458 -        PAGES2KB(balloon_low), PAGES2KB(balloon_high));
  22.459 +	int len;
  22.460  
  22.461 -    if ( hard_limit != ~0UL )
  22.462 -        len += sprintf(
  22.463 -            page + len, 
  22.464 -            "%8lu kB (inc. %8lu kB driver headroom)\n",
  22.465 -            PAGES2KB(hard_limit), PAGES2KB(driver_pages));
  22.466 -    else
  22.467 -        len += sprintf(
  22.468 -            page + len,
  22.469 -            "     ??? kB\n");
  22.470 +	len = sprintf(
  22.471 +		page,
  22.472 +		"Current allocation: %8lu kB\n"
  22.473 +		"Requested target:   %8lu kB\n"
  22.474 +		"Low-mem balloon:    %8lu kB\n"
  22.475 +		"High-mem balloon:   %8lu kB\n"
  22.476 +		"Xen hard limit:     ",
  22.477 +		PAGES2KB(current_pages), PAGES2KB(target_pages), 
  22.478 +		PAGES2KB(balloon_low), PAGES2KB(balloon_high));
  22.479  
  22.480 -    *eof = 1;
  22.481 -    return len;
  22.482 +	if (hard_limit != ~0UL) {
  22.483 +		len += sprintf(
  22.484 +			page + len, 
  22.485 +			"%8lu kB (inc. %8lu kB driver headroom)\n",
  22.486 +			PAGES2KB(hard_limit), PAGES2KB(driver_pages));
  22.487 +	} else {
  22.488 +		len += sprintf(
  22.489 +			page + len,
  22.490 +			"     ??? kB\n");
  22.491 +	}
  22.492 +
  22.493 +	*eof = 1;
  22.494 +	return len;
  22.495  }
  22.496  
  22.497  static struct notifier_block xenstore_notifier;
  22.498  
  22.499  static int __init balloon_init(void)
  22.500  {
  22.501 -    unsigned long pfn;
  22.502 -    struct page *page;
  22.503 -
  22.504 -    IPRINTK("Initialising balloon driver.\n");
  22.505 +	unsigned long pfn;
  22.506 +	struct page *page;
  22.507  
  22.508 -    current_pages = min(xen_start_info.nr_pages, max_pfn);
  22.509 -    target_pages  = current_pages;
  22.510 -    balloon_low   = 0;
  22.511 -    balloon_high  = 0;
  22.512 -    driver_pages  = 0UL;
  22.513 -    hard_limit    = ~0UL;
  22.514 +	IPRINTK("Initialising balloon driver.\n");
  22.515  
  22.516 -    init_timer(&balloon_timer);
  22.517 -    balloon_timer.data = 0;
  22.518 -    balloon_timer.function = balloon_alarm;
  22.519 +	current_pages = min(xen_start_info.nr_pages, max_pfn);
  22.520 +	target_pages  = current_pages;
  22.521 +	balloon_low   = 0;
  22.522 +	balloon_high  = 0;
  22.523 +	driver_pages  = 0UL;
  22.524 +	hard_limit    = ~0UL;
  22.525 +
  22.526 +	init_timer(&balloon_timer);
  22.527 +	balloon_timer.data = 0;
  22.528 +	balloon_timer.function = balloon_alarm;
  22.529      
  22.530 -    if ( (balloon_pde = create_xen_proc_entry("balloon", 0644)) == NULL )
  22.531 -    {
  22.532 -        WPRINTK("Unable to create /proc/xen/balloon.\n");
  22.533 -        return -1;
  22.534 -    }
  22.535 +	if ((balloon_pde = create_xen_proc_entry("balloon", 0644)) == NULL) {
  22.536 +		WPRINTK("Unable to create /proc/xen/balloon.\n");
  22.537 +		return -1;
  22.538 +	}
  22.539  
  22.540 -    balloon_pde->read_proc  = balloon_read;
  22.541 -    balloon_pde->write_proc = balloon_write;
  22.542 +	balloon_pde->read_proc  = balloon_read;
  22.543 +	balloon_pde->write_proc = balloon_write;
  22.544      
  22.545 -    /* Initialise the balloon with excess memory space. */
  22.546 -    for ( pfn = xen_start_info.nr_pages; pfn < max_pfn; pfn++ )
  22.547 -    {
  22.548 -        page = &mem_map[pfn];
  22.549 -        if ( !PageReserved(page) )
  22.550 -            balloon_append(page);
  22.551 -    }
  22.552 +	/* Initialise the balloon with excess memory space. */
  22.553 +	for (pfn = xen_start_info.nr_pages; pfn < max_pfn; pfn++) {
  22.554 +		page = &mem_map[pfn];
  22.555 +		if (!PageReserved(page))
  22.556 +			balloon_append(page);
  22.557 +	}
  22.558  
  22.559 -    target_watch.callback = watch_target;
  22.560 -    xenstore_notifier.notifier_call = balloon_init_watcher;
  22.561 +	target_watch.callback = watch_target;
  22.562 +	xenstore_notifier.notifier_call = balloon_init_watcher;
  22.563  
  22.564 -    register_xenstore_notifier(&xenstore_notifier);
  22.565 +	register_xenstore_notifier(&xenstore_notifier);
  22.566      
  22.567 -    return 0;
  22.568 +	return 0;
  22.569  }
  22.570  
  22.571  subsys_initcall(balloon_init);
  22.572  
  22.573  void balloon_update_driver_allowance(long delta)
  22.574  {
  22.575 -    unsigned long flags;
  22.576 -    balloon_lock(flags);
  22.577 -    driver_pages += delta; /* non-atomic update */
  22.578 -    balloon_unlock(flags);
  22.579 +	unsigned long flags;
  22.580 +	balloon_lock(flags);
  22.581 +	driver_pages += delta; /* non-atomic update */
  22.582 +	balloon_unlock(flags);
  22.583  }
  22.584  
  22.585 -void balloon_put_pages(unsigned long *mfn_list, unsigned long nr_mfns)
  22.586 +struct page *balloon_alloc_empty_page_range(unsigned long nr_pages)
  22.587  {
  22.588 -    unsigned long flags;
  22.589 +	int f(pte_t *pte, struct page *pte_page,
  22.590 +	      unsigned long addr, void *data)
  22.591 +	{
  22.592 +		unsigned long mfn = pte_mfn(*pte);
  22.593 +		set_pte(pte, __pte_ma(0));
  22.594 +		phys_to_machine_mapping[__pa(addr) >> PAGE_SHIFT] =
  22.595 +			INVALID_P2M_ENTRY;
  22.596 +		BUG_ON(HYPERVISOR_dom_mem_op(
  22.597 +			MEMOP_decrease_reservation, &mfn, 1, 0) != 1);
  22.598 +		return 0;
  22.599 +        }
  22.600  
  22.601 -    balloon_lock(flags);
  22.602 -    if ( HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, 
  22.603 -                               mfn_list, nr_mfns, 0) != nr_mfns )
  22.604 -        BUG();
  22.605 -    current_pages -= nr_mfns; /* non-atomic update */
  22.606 -    balloon_unlock(flags);
  22.607 +	unsigned long vstart, flags;
  22.608 +	unsigned int  order = get_order(nr_pages * PAGE_SIZE);
  22.609  
  22.610 -    schedule_work(&balloon_worker);
  22.611 +	vstart = __get_free_pages(GFP_KERNEL, order);
  22.612 +	if (vstart == 0)
  22.613 +		return NULL;
  22.614 +
  22.615 +	scrub_pages(vstart, 1 << order);
  22.616 +
  22.617 +	balloon_lock(flags);
  22.618 +	BUG_ON(generic_page_range(
  22.619 +		&init_mm, vstart, PAGE_SIZE << order, f, NULL) != 0);
  22.620 +	current_pages -= 1UL << order;
  22.621 +	balloon_unlock(flags);
  22.622 +
  22.623 +	schedule_work(&balloon_worker);
  22.624 +
  22.625 +	flush_tlb_all();
  22.626 +
  22.627 +	return virt_to_page(vstart);
  22.628 +}
  22.629 +
  22.630 +void balloon_dealloc_empty_page_range(
  22.631 +	struct page *page, unsigned long nr_pages)
  22.632 +{
  22.633 +	unsigned long i, flags;
  22.634 +	unsigned int  order = get_order(nr_pages * PAGE_SIZE);
  22.635 +
  22.636 +	balloon_lock(flags);
  22.637 +	for (i = 0; i < (1UL << order); i++)
  22.638 +		balloon_append(page + i);
  22.639 +	balloon_unlock(flags);
  22.640 +
  22.641 +	schedule_work(&balloon_worker);
  22.642  }
  22.643  
  22.644  EXPORT_SYMBOL(balloon_update_driver_allowance);
  22.645 -EXPORT_SYMBOL(balloon_put_pages);
  22.646 +EXPORT_SYMBOL(balloon_alloc_empty_page_range);
  22.647 +EXPORT_SYMBOL(balloon_dealloc_empty_page_range);
  22.648 +
  22.649 +/*
  22.650 + * Local variables:
  22.651 + *  c-file-style: "linux"
  22.652 + *  indent-tabs-mode: t
  22.653 + *  c-indent-level: 8
  22.654 + *  c-basic-offset: 8
  22.655 + *  tab-width: 8
  22.656 + * End:
  22.657 + */
    23.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Fri Aug 19 16:47:24 2005 -0800
    23.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Mon Aug 22 11:00:37 2005 -0700
    23.3 @@ -80,7 +80,6 @@ static inline void flush_plugged_queue(v
    23.4  }
    23.5  #endif
    23.6  
    23.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    23.8  /* When using grant tables to map a frame for device access then the
    23.9   * handle returned must be used to unmap the frame. This is needed to
   23.10   * drop the ref count on the frame.
   23.11 @@ -89,7 +88,6 @@ static u16 pending_grant_handles[MMAP_PA
   23.12  #define pending_handle(_idx, _i) \
   23.13      (pending_grant_handles[((_idx) * BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
   23.14  #define BLKBACK_INVALID_HANDLE (0xFFFF)
   23.15 -#endif
   23.16  
   23.17  #ifdef CONFIG_XEN_BLKDEV_TAP_BE
   23.18  /*
   23.19 @@ -110,7 +108,6 @@ static void make_response(blkif_t *blkif
   23.20  
   23.21  static void fast_flush_area(int idx, int nr_pages)
   23.22  {
   23.23 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   23.24      struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   23.25      unsigned int i, invcount = 0;
   23.26      u16 handle;
   23.27 @@ -129,21 +126,6 @@ static void fast_flush_area(int idx, int
   23.28      if ( unlikely(HYPERVISOR_grant_table_op(
   23.29                      GNTTABOP_unmap_grant_ref, unmap, invcount)))
   23.30          BUG();
   23.31 -#else
   23.32 -
   23.33 -    multicall_entry_t mcl[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   23.34 -    int               i;
   23.35 -
   23.36 -    for ( i = 0; i < nr_pages; i++ )
   23.37 -    {
   23.38 -	MULTI_update_va_mapping(mcl+i, MMAP_VADDR(idx, i),
   23.39 -				__pte(0), 0);
   23.40 -    }
   23.41 -
   23.42 -    mcl[nr_pages-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
   23.43 -    if ( unlikely(HYPERVISOR_multicall(mcl, nr_pages) != 0) )
   23.44 -        BUG();
   23.45 -#endif
   23.46  }
   23.47  
   23.48  
   23.49 @@ -367,12 +349,7 @@ static void dispatch_rw_block_io(blkif_t
   23.50      unsigned long fas = 0;
   23.51      int i, pending_idx = pending_ring[MASK_PEND_IDX(pending_cons)];
   23.52      pending_req_t *pending_req;
   23.53 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   23.54      struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   23.55 -#else
   23.56 -    unsigned long remap_prot;
   23.57 -    multicall_entry_t mcl[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   23.58 -#endif
   23.59      struct phys_req preq;
   23.60      struct { 
   23.61          unsigned long buf; unsigned int nsec;
   23.62 @@ -399,7 +376,6 @@ static void dispatch_rw_block_io(blkif_t
   23.63      preq.sector_number = req->sector_number;
   23.64      preq.nr_sects      = 0;
   23.65  
   23.66 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   23.67      for ( i = 0; i < nseg; i++ )
   23.68      {
   23.69          fas         = req->frame_and_sects[i];
   23.70 @@ -431,25 +407,15 @@ static void dispatch_rw_block_io(blkif_t
   23.71          }
   23.72  
   23.73          phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
   23.74 -            FOREIGN_FRAME(map[i].dev_bus_addr);
   23.75 +            FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
   23.76  
   23.77          pending_handle(pending_idx, i) = map[i].handle;
   23.78      }
   23.79 -#endif
   23.80  
   23.81      for ( i = 0; i < nseg; i++ )
   23.82      {
   23.83          fas         = req->frame_and_sects[i];
   23.84 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   23.85 -        seg[i].buf  = (map[i].dev_bus_addr << PAGE_SHIFT) |
   23.86 -                      (blkif_first_sect(fas) << 9);
   23.87 -#else
   23.88 -        seg[i].buf  = (fas & PAGE_MASK) | (blkif_first_sect(fas) << 9);
   23.89 -        seg[i].nsec = blkif_last_sect(fas) - blkif_first_sect(fas) + 1;
   23.90 -        if ( seg[i].nsec <= 0 )
   23.91 -            goto bad_descriptor;
   23.92 -        preq.nr_sects += seg[i].nsec;
   23.93 -#endif
   23.94 +        seg[i].buf  = map[i].dev_bus_addr | (blkif_first_sect(fas) << 9);
   23.95      }
   23.96  
   23.97      if ( vbd_translate(&preq, blkif, operation) != 0 )
   23.98 @@ -460,40 +426,6 @@ static void dispatch_rw_block_io(blkif_t
   23.99          goto bad_descriptor;
  23.100      }
  23.101  
  23.102 -#ifndef CONFIG_XEN_BLKDEV_GRANT
  23.103 -    if ( operation == READ )
  23.104 -        remap_prot = _PAGE_PRESENT|_PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_RW;
  23.105 -    else
  23.106 -        remap_prot = _PAGE_PRESENT|_PAGE_DIRTY|_PAGE_ACCESSED;
  23.107 -
  23.108 -
  23.109 -    for ( i = 0; i < nseg; i++ )
  23.110 -    {
  23.111 -	MULTI_update_va_mapping_otherdomain(
  23.112 -	    mcl+i, MMAP_VADDR(pending_idx, i),
  23.113 -	    pfn_pte_ma(seg[i].buf >> PAGE_SHIFT, __pgprot(remap_prot)),
  23.114 -	    0, blkif->domid);
  23.115 -#ifdef CONFIG_XEN_BLKDEV_TAP_BE
  23.116 -        if ( blkif->is_blktap )
  23.117 -            mcl[i].args[MULTI_UVMDOMID_INDEX] = ID_TO_DOM(req->id);
  23.118 -#endif
  23.119 -        phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
  23.120 -            FOREIGN_FRAME(seg[i].buf >> PAGE_SHIFT);
  23.121 -    }
  23.122 -
  23.123 -    BUG_ON(HYPERVISOR_multicall(mcl, nseg) != 0);
  23.124 -
  23.125 -    for ( i = 0; i < nseg; i++ )
  23.126 -    {
  23.127 -        if ( unlikely(mcl[i].result != 0) )
  23.128 -        {
  23.129 -            DPRINTK("invalid buffer -- could not remap it\n");
  23.130 -            fast_flush_area(pending_idx, nseg);
  23.131 -            goto bad_descriptor;
  23.132 -        }
  23.133 -    }
  23.134 -#endif /* end ifndef CONFIG_XEN_BLKDEV_GRANT */
  23.135 -
  23.136      pending_req = &pending_reqs[pending_idx];
  23.137      pending_req->blkif     = blkif;
  23.138      pending_req->id        = req->id;
  23.139 @@ -637,6 +569,7 @@ void blkif_deschedule(blkif_t *blkif)
  23.140  static int __init blkif_init(void)
  23.141  {
  23.142      int i;
  23.143 +    struct page *page;
  23.144  
  23.145      if ( !(xen_start_info.flags & SIF_INITDOMAIN) &&
  23.146           !(xen_start_info.flags & SIF_BLK_BE_DOMAIN) )
  23.147 @@ -644,8 +577,9 @@ static int __init blkif_init(void)
  23.148  
  23.149      blkif_interface_init();
  23.150  
  23.151 -    if ( (mmap_vstart = allocate_empty_lowmem_region(MMAP_PAGES)) == 0 )
  23.152 -        BUG();
  23.153 +    page = balloon_alloc_empty_page_range(MMAP_PAGES);
  23.154 +    BUG_ON(page == NULL);
  23.155 +    mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
  23.156  
  23.157      pending_cons = 0;
  23.158      pending_prod = MAX_PENDING_REQS;
  23.159 @@ -667,10 +601,7 @@ static int __init blkif_init(void)
  23.160  
  23.161      blkif_xenbus_init();
  23.162  
  23.163 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  23.164      memset( pending_grant_handles,  BLKBACK_INVALID_HANDLE, MMAP_PAGES );
  23.165 -    printk(KERN_ALERT "Blkif backend is using grant tables.\n");
  23.166 -#endif
  23.167  
  23.168  #ifdef CONFIG_XEN_BLKDEV_TAP_BE
  23.169      printk(KERN_ALERT "NOTE: Blkif backend is running with tap support on!\n");
    24.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Fri Aug 19 16:47:24 2005 -0800
    24.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Mon Aug 22 11:00:37 2005 -0700
    24.3 @@ -17,9 +17,7 @@
    24.4  #include <asm-xen/hypervisor.h>
    24.5  #include <asm-xen/xen-public/io/blkif.h>
    24.6  #include <asm-xen/xen-public/io/ring.h>
    24.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    24.8  #include <asm-xen/gnttab.h>
    24.9 -#endif
   24.10  
   24.11  #if 0
   24.12  #define ASSERT(_p) \
   24.13 @@ -53,7 +51,7 @@ typedef struct blkif_st {
   24.14      rb_root_t         vbd_rb;        /* Mapping from 16-bit vdevices to VBDs.*/
   24.15      spinlock_t        vbd_lock;      /* Protects VBD mapping. */
   24.16      /* Private fields. */
   24.17 -    enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
   24.18 +    enum { DISCONNECTED, CONNECTED } status;
   24.19      /*
   24.20       * DISCONNECT response is deferred until pending requests are ack'ed.
   24.21       * We therefore need to store the id from the original request.
   24.22 @@ -69,11 +67,9 @@ typedef struct blkif_st {
   24.23      atomic_t         refcnt;
   24.24  
   24.25      struct work_struct work;
   24.26 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   24.27      u16 shmem_handle;
   24.28      unsigned long shmem_vaddr;
   24.29      grant_ref_t shmem_ref;
   24.30 -#endif
   24.31  } blkif_t;
   24.32  
   24.33  void blkif_create(blkif_be_create_t *create);
    25.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Fri Aug 19 16:47:24 2005 -0800
    25.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Mon Aug 22 11:00:37 2005 -0700
    25.3 @@ -7,7 +7,6 @@
    25.4   */
    25.5  
    25.6  #include "common.h"
    25.7 -#include <asm-xen/ctrl_if.h>
    25.8  #include <asm-xen/evtchn.h>
    25.9  
   25.10  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   25.11 @@ -48,19 +47,6 @@ blkif_t *blkif_find(domid_t domid)
   25.12      return blkif;
   25.13  }
   25.14  
   25.15 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   25.16 -static int map_frontend_page(blkif_t *blkif, unsigned long localaddr,
   25.17 -			     unsigned long shared_page)
   25.18 -{
   25.19 -    return direct_remap_area_pages(&init_mm, localaddr,
   25.20 -				   shared_page<<PAGE_SHIFT, PAGE_SIZE,
   25.21 -				   __pgprot(_KERNPG_TABLE), blkif->domid);
   25.22 -}
   25.23 -
   25.24 -static void unmap_frontend_page(blkif_t *blkif)
   25.25 -{
   25.26 -}
   25.27 -#else
   25.28  static int map_frontend_page(blkif_t *blkif, unsigned long localaddr,
   25.29  			     unsigned long shared_page)
   25.30  {
   25.31 @@ -92,7 +78,6 @@ static void unmap_frontend_page(blkif_t 
   25.32      op.dev_bus_addr = 0;
   25.33      BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
   25.34  }
   25.35 -#endif /* CONFIG_XEN_BLKDEV_GRANT */
   25.36  
   25.37  int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
   25.38  {
   25.39 @@ -138,52 +123,6 @@ int blkif_map(blkif_t *blkif, unsigned l
   25.40      return 0;
   25.41  }
   25.42  
   25.43 -static void __blkif_disconnect_complete(void *arg)
   25.44 -{
   25.45 -    blkif_t              *blkif = (blkif_t *)arg;
   25.46 -    ctrl_msg_t            cmsg;
   25.47 -    blkif_be_disconnect_t disc;
   25.48 -
   25.49 -    /*
   25.50 -     * These can't be done in blkif_disconnect() because at that point there
   25.51 -     * may be outstanding requests at the disc whose asynchronous responses
   25.52 -     * must still be notified to the remote driver.
   25.53 -     */
   25.54 -    unmap_frontend_page(blkif);
   25.55 -    vfree(blkif->blk_ring.sring);
   25.56 -
   25.57 -    /* Construct the deferred response message. */
   25.58 -    cmsg.type         = CMSG_BLKIF_BE;
   25.59 -    cmsg.subtype      = CMSG_BLKIF_BE_DISCONNECT;
   25.60 -    cmsg.id           = blkif->disconnect_rspid;
   25.61 -    cmsg.length       = sizeof(blkif_be_disconnect_t);
   25.62 -    disc.domid        = blkif->domid;
   25.63 -    disc.blkif_handle = blkif->handle;
   25.64 -    disc.status       = BLKIF_BE_STATUS_OKAY;
   25.65 -    memcpy(cmsg.msg, &disc, sizeof(disc));
   25.66 -
   25.67 -    /*
   25.68 -     * Make sure message is constructed /before/ status change, because
   25.69 -     * after the status change the 'blkif' structure could be deallocated at
   25.70 -     * any time. Also make sure we send the response /after/ status change,
   25.71 -     * as otherwise a subsequent CONNECT request could spuriously fail if
   25.72 -     * another CPU doesn't see the status change yet.
   25.73 -     */
   25.74 -    mb();
   25.75 -    BUG_ON(blkif->status != DISCONNECTING);
   25.76 -    blkif->status = DISCONNECTED;
   25.77 -    mb();
   25.78 -
   25.79 -    /* Send the successful response. */
   25.80 -    ctrl_if_send_response(&cmsg);
   25.81 -}
   25.82 -
   25.83 -void blkif_disconnect_complete(blkif_t *blkif)
   25.84 -{
   25.85 -    INIT_WORK(&blkif->work, __blkif_disconnect_complete, (void *)blkif);
   25.86 -    schedule_work(&blkif->work);
   25.87 -}
   25.88 -
   25.89  void free_blkif(blkif_t *blkif)
   25.90  {
   25.91      blkif_t     **pblkif;
    26.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Fri Aug 19 16:47:24 2005 -0800
    26.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Mon Aug 22 11:00:37 2005 -0700
    26.3 @@ -75,16 +75,6 @@ static void frontend_changed(struct xenb
    26.4  	if (vbd_is_active(be->vbd))
    26.5  		return;
    26.6  
    26.7 -#ifndef CONFIG_XEN_BLKDEV_GRANT
    26.8 -	err = xenbus_gather(be->frontpath, "shared-frame", "%lu", &sharedmfn,
    26.9 -			    "event-channel", "%u", &evtchn, NULL);
   26.10 -	if (err) {
   26.11 -		xenbus_dev_error(be->dev, err, 
   26.12 -				 "reading %s/shared-frame and event-channel",
   26.13 -				 be->frontpath);
   26.14 -		return;
   26.15 -	}
   26.16 -#else
   26.17  	err = xenbus_gather(be->frontpath, "grant-id", "%lu", &sharedmfn,
   26.18  			    "event-channel", "%u", &evtchn, NULL);
   26.19  	if (err) {
   26.20 @@ -93,7 +83,6 @@ static void frontend_changed(struct xenb
   26.21  				 be->frontpath);
   26.22  		return;
   26.23  	}
   26.24 -#endif
   26.25  
   26.26  	/* Domains must use same shared frame for all vbds. */
   26.27  	if (be->blkif->status == CONNECTED &&
   26.28 @@ -182,16 +171,20 @@ static void backend_changed(struct xenbu
   26.29  			    "frontend-id", "%li", &be->frontend_id,
   26.30  			    "frontend", NULL, &frontend,
   26.31  			    NULL);
   26.32 -	if (err == -ENOENT || err == -ERANGE ||
   26.33 +	if (XENBUS_EXIST_ERR(err) ||
   26.34  	    strlen(frontend) == 0 || !xenbus_exists(frontend, "")) {
   26.35 -		if (frontend)
   26.36 -			kfree(frontend);
   26.37  		/* If we can't get a frontend path and a frontend-id,
   26.38  		 * then our bus-id is no longer valid and we need to
   26.39  		 * destroy the backend device.
   26.40  		 */
   26.41  		goto device_fail;
   26.42  	}
   26.43 +	if (err < 0) {
   26.44 +		xenbus_dev_error(dev, err,
   26.45 +				 "reading %s/frontend or frontend-id",
   26.46 +				 dev->nodename);
   26.47 +		goto device_fail;
   26.48 +	}
   26.49  
   26.50  	if (!be->frontpath || strcmp(frontend, be->frontpath)) {
   26.51  		if (be->watch.node)
   26.52 @@ -199,6 +192,7 @@ static void backend_changed(struct xenbu
   26.53  		if (be->frontpath)
   26.54  			kfree(be->frontpath);
   26.55  		be->frontpath = frontend;
   26.56 +		frontend = NULL;
   26.57  		be->watch.node = be->frontpath;
   26.58  		be->watch.callback = frontend_changed;
   26.59  		err = register_xenbus_watch(&be->watch);
   26.60 @@ -206,14 +200,13 @@ static void backend_changed(struct xenbu
   26.61  			be->watch.node = NULL;
   26.62  			goto device_fail;
   26.63  		}
   26.64 -	} else
   26.65 -		kfree(frontend);
   26.66 +	}
   26.67  
   26.68  	err = xenbus_scanf(dev->nodename, "physical-device", "%li", &pdev);
   26.69 -	if (err == -ENOENT || err == -ERANGE)
   26.70 +	if (XENBUS_EXIST_ERR(err))
   26.71  		goto out;
   26.72  	if (err < 0) {
   26.73 -		xenbus_dev_error(dev, err, "Reading physical-device");
   26.74 +		xenbus_dev_error(dev, err, "reading physical-device");
   26.75  		goto device_fail;
   26.76  	}
   26.77  	if (be->pdev && be->pdev != pdev) {
   26.78 @@ -253,12 +246,14 @@ static void backend_changed(struct xenbu
   26.79  		frontend_changed(&be->watch, be->frontpath);
   26.80  	}
   26.81  
   26.82 + out:
   26.83 +	if (frontend)
   26.84 +		kfree(frontend);
   26.85  	return;
   26.86  
   26.87   device_fail:
   26.88  	device_unregister(&be->dev->dev);
   26.89 - out:
   26.90 -	return;
   26.91 +	goto out;
   26.92  }
   26.93  
   26.94  static int blkback_probe(struct xenbus_device *dev,
    27.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Aug 19 16:47:24 2005 -0800
    27.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Aug 22 11:00:37 2005 -0700
    27.3 @@ -55,10 +55,8 @@
    27.4  #include <scsi/scsi.h>
    27.5  #include <asm-xen/evtchn.h>
    27.6  #include <asm-xen/xenbus.h>
    27.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    27.8  #include <asm-xen/xen-public/grant_table.h>
    27.9  #include <asm-xen/gnttab.h>
   27.10 -#endif
   27.11  
   27.12  typedef unsigned char byte; /* from linux/ide.h */
   27.13  
   27.14 @@ -78,14 +76,12 @@ static blkif_front_ring_t blk_ring;
   27.15  
   27.16  #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
   27.17  
   27.18 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   27.19  static domid_t rdomid = 0;
   27.20  static grant_ref_t gref_head, gref_terminal;
   27.21  #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
   27.22      (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE)
   27.23  #define GRANTREF_INVALID (1<<15)
   27.24  static int shmem_ref;
   27.25 -#endif
   27.26  
   27.27  static struct blk_shadow {
   27.28      blkif_request_t req;
   27.29 @@ -131,30 +127,14 @@ static int sg_operation = -1;
   27.30  
   27.31  static inline void pickle_request(struct blk_shadow *s, blkif_request_t *r)
   27.32  {
   27.33 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   27.34 -    int i;
   27.35 -#endif
   27.36  
   27.37      s->req = *r;
   27.38 -
   27.39 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   27.40 -    for ( i = 0; i < r->nr_segments; i++ )
   27.41 -        s->req.frame_and_sects[i] = machine_to_phys(r->frame_and_sects[i]);
   27.42 -#endif
   27.43  }
   27.44  
   27.45  static inline void unpickle_request(blkif_request_t *r, struct blk_shadow *s)
   27.46  {
   27.47 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   27.48 -    int i;
   27.49 -#endif
   27.50  
   27.51      *r = s->req;
   27.52 -
   27.53 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   27.54 -    for ( i = 0; i < s->req.nr_segments; i++ )
   27.55 -        r->frame_and_sects[i] = phys_to_machine(s->req.frame_and_sects[i]);
   27.56 -#endif
   27.57  }
   27.58  
   27.59  
   27.60 @@ -256,9 +236,7 @@ static int blkif_queue_request(struct re
   27.61      int idx;
   27.62      unsigned long id;
   27.63      unsigned int fsect, lsect;
   27.64 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   27.65      int ref;
   27.66 -#endif
   27.67  
   27.68      if ( unlikely(blkif_state != BLKIF_STATE_CONNECTED) )
   27.69          return 1;
   27.70 @@ -284,7 +262,6 @@ static int blkif_queue_request(struct re
   27.71              buffer_ma = page_to_phys(bvec->bv_page);
   27.72              fsect = bvec->bv_offset >> 9;
   27.73              lsect = fsect + (bvec->bv_len >> 9) - 1;
   27.74 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   27.75              /* install a grant reference. */
   27.76              ref = gnttab_claim_grant_reference(&gref_head, gref_terminal);
   27.77              ASSERT( ref != -ENOSPC );
   27.78 @@ -300,11 +277,6 @@ static int blkif_queue_request(struct re
   27.79  
   27.80              ring_req->frame_and_sects[ring_req->nr_segments++] =
   27.81                  blkif_fas_from_gref(ref, fsect, lsect);
   27.82 -
   27.83 -#else
   27.84 -            ring_req->frame_and_sects[ring_req->nr_segments++] =
   27.85 -                blkif_fas(buffer_ma, fsect, lsect);
   27.86 -#endif
   27.87          }
   27.88      }
   27.89  
   27.90 @@ -711,9 +683,7 @@ static int blkif_queue_request(unsigned 
   27.91      blkif_request_t    *req;
   27.92      struct buffer_head *bh;
   27.93      unsigned int        fsect, lsect;
   27.94 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   27.95      int ref;
   27.96 -#endif
   27.97  
   27.98      fsect = (buffer_ma & ~PAGE_MASK) >> 9;
   27.99      lsect = fsect + nr_sectors - 1;
  27.100 @@ -762,7 +732,6 @@ static int blkif_queue_request(unsigned 
  27.101              bh->b_reqnext = (struct buffer_head *)blk_shadow[req->id].request;
  27.102              blk_shadow[req->id].request = (unsigned long)id;
  27.103  
  27.104 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.105              /* install a grant reference. */
  27.106              ref = gnttab_claim_grant_reference(&gref_head, gref_terminal);
  27.107              ASSERT( ref != -ENOSPC );
  27.108 @@ -778,10 +747,6 @@ static int blkif_queue_request(unsigned 
  27.109  
  27.110              req->frame_and_sects[req->nr_segments] =
  27.111                  blkif_fas_from_gref(ref, fsect, lsect);
  27.112 -#else
  27.113 -            req->frame_and_sects[req->nr_segments] =
  27.114 -                blkif_fas(buffer_ma, fsect, lsect);
  27.115 -#endif
  27.116              if ( ++req->nr_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST )
  27.117                  sg_next_sect += nr_sectors;
  27.118              else
  27.119 @@ -819,7 +784,6 @@ static int blkif_queue_request(unsigned 
  27.120      req->sector_number = (blkif_sector_t)sector_number;
  27.121      req->handle        = handle; 
  27.122      req->nr_segments   = 1;
  27.123 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.124      /* install a grant reference. */
  27.125      ref = gnttab_claim_grant_reference(&gref_head, gref_terminal);
  27.126      ASSERT( ref != -ENOSPC );
  27.127 @@ -833,9 +797,6 @@ static int blkif_queue_request(unsigned 
  27.128      blk_shadow[xid].frame[0] = buffer_ma >> PAGE_SHIFT;
  27.129  
  27.130      req->frame_and_sects[0] = blkif_fas_from_gref(ref, fsect, lsect);
  27.131 -#else
  27.132 -    req->frame_and_sects[0] = blkif_fas(buffer_ma, fsect, lsect);
  27.133 -#endif
  27.134  
  27.135      /* Keep a private copy so we can reissue requests when recovering. */    
  27.136      pickle_request(&blk_shadow[xid], req);
  27.137 @@ -1015,9 +976,7 @@ static void blkif_recover(void)
  27.138      int i;
  27.139      blkif_request_t *req;
  27.140      struct blk_shadow *copy;
  27.141 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.142      int j;
  27.143 -#endif
  27.144  
  27.145      /* Stage 1: Make a safe copy of the shadow state. */
  27.146      copy = (struct blk_shadow *)kmalloc(sizeof(blk_shadow), GFP_KERNEL);
  27.147 @@ -1047,7 +1006,6 @@ static void blkif_recover(void)
  27.148          req->id = GET_ID_FROM_FREELIST();
  27.149          memcpy(&blk_shadow[req->id], &copy[i], sizeof(copy[i]));
  27.150  
  27.151 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.152          /* Rewrite any grant references invalidated by suspend/resume. */
  27.153          for ( j = 0; j < req->nr_segments; j++ )
  27.154          {
  27.155 @@ -1061,7 +1019,6 @@ static void blkif_recover(void)
  27.156              req->frame_and_sects[j] &= ~GRANTREF_INVALID;
  27.157          }
  27.158          blk_shadow[req->id].req = *req;
  27.159 -#endif
  27.160  
  27.161          blk_ring.req_prod_pvt++;
  27.162      }
  27.163 @@ -1085,9 +1042,7 @@ static void blkif_connect(u16 evtchn, do
  27.164      int err = 0;
  27.165  
  27.166      blkif_evtchn = evtchn;
  27.167 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.168      rdomid       = domid;
  27.169 -#endif
  27.170  
  27.171      err = bind_evtchn_to_irqhandler(
  27.172          blkif_evtchn, blkif_int, SA_SAMPLE_RANDOM, "blkif", NULL);
  27.173 @@ -1134,25 +1089,24 @@ static void watch_for_status(struct xenb
  27.174  			    "info", "%u", &binfo,
  27.175  			    "sector-size", "%lu", &sector_size,
  27.176  			    NULL);
  27.177 -
  27.178 -	if (err)
  27.179 +	if (err) {
  27.180  		xenbus_dev_error(info->dev, err, "reading backend fields");
  27.181 -	else {
  27.182 -		xlvbd_add(sectors, info->vdevice, info->handle, binfo,
  27.183 -			  sector_size);
  27.184 -		info->connected = 1;
  27.185 +		return;
  27.186 +	}
  27.187  
  27.188 -		/* First to connect?  blkif is now connected. */
  27.189 -		if (blkif_vbds_connected++ == 0)
  27.190 -			blkif_state = BLKIF_STATE_CONNECTED;
  27.191 +	xlvbd_add(sectors, info->vdevice, info->handle, binfo, sector_size);
  27.192 +	info->connected = 1;
  27.193  
  27.194 -		xenbus_dev_ok(info->dev);
  27.195 +	/* First to connect?  blkif is now connected. */
  27.196 +	if (blkif_vbds_connected++ == 0)
  27.197 +		blkif_state = BLKIF_STATE_CONNECTED;
  27.198  
  27.199 -		/* Kick pending requests. */
  27.200 -		spin_lock_irq(&blkif_io_lock);
  27.201 -		kick_pending_request_queues();
  27.202 -		spin_unlock_irq(&blkif_io_lock);
  27.203 -	}
  27.204 +	xenbus_dev_ok(info->dev);
  27.205 +
  27.206 +	/* Kick pending requests. */
  27.207 +	spin_lock_irq(&blkif_io_lock);
  27.208 +	kick_pending_request_queues();
  27.209 +	spin_unlock_irq(&blkif_io_lock);
  27.210  }
  27.211  
  27.212  static int setup_blkring(struct xenbus_device *dev, unsigned int backend_id)
  27.213 @@ -1169,7 +1123,6 @@ static int setup_blkring(struct xenbus_d
  27.214  	SHARED_RING_INIT(sring);
  27.215  	FRONT_RING_INIT(&blk_ring, sring, PAGE_SIZE);
  27.216  
  27.217 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.218  	shmem_ref = gnttab_claim_grant_reference(&gref_head,
  27.219  						 gref_terminal);
  27.220  	ASSERT(shmem_ref != -ENOSPC);
  27.221 @@ -1177,7 +1130,6 @@ static int setup_blkring(struct xenbus_d
  27.222  					backend_id,
  27.223  					virt_to_mfn(blk_ring.sring),
  27.224  					0);
  27.225 -#endif
  27.226  
  27.227  	op.u.alloc_unbound.dom = backend_id;
  27.228  	err = HYPERVISOR_event_channel_op(&op);
  27.229 @@ -1199,36 +1151,28 @@ static int talk_to_backend(struct xenbus
  27.230  	const char *message;
  27.231  	int err, backend_id;
  27.232  
  27.233 -	backend = xenbus_read(dev->nodename, "backend", NULL);
  27.234 -	if (IS_ERR(backend)) {
  27.235 -		err = PTR_ERR(backend);
  27.236 -		if (err == -ENOENT)
  27.237 -			goto out;
  27.238 -		xenbus_dev_error(dev, err, "reading %s/backend",
  27.239 +	backend = NULL;
  27.240 +	err = xenbus_gather(dev->nodename,
  27.241 +			    "backend-id", "%i", &backend_id,
  27.242 +			    "backend", NULL, &backend,
  27.243 +			    NULL);
  27.244 +	if (XENBUS_EXIST_ERR(err))
  27.245 +		goto out;
  27.246 +	if (backend && strlen(backend) == 0) {
  27.247 +		err = -ENOENT;
  27.248 +		goto out;
  27.249 +	}
  27.250 +	if (err < 0) {
  27.251 +		xenbus_dev_error(dev, err, "reading %s/backend or backend-id",
  27.252  				 dev->nodename);
  27.253  		goto out;
  27.254  	}
  27.255 -	if (strlen(backend) == 0) {
  27.256 -		err = -ENOENT;
  27.257 -		goto free_backend;
  27.258 -	}
  27.259 -
  27.260 -	/* FIXME: This driver can't handle backends on different
  27.261 -	 * domains.  Check and fail gracefully. */
  27.262 -	err = xenbus_scanf(dev->nodename, "backend-id", "%i", &backend_id);
  27.263 -	if (err == -ENOENT)
  27.264 -		goto free_backend;
  27.265 - 	if (err < 0) {
  27.266 -		xenbus_dev_error(dev, err, "reading %s/backend-id",
  27.267 -				 dev->nodename);
  27.268 - 		goto free_backend;
  27.269 - 	}
  27.270  
  27.271  	/* First device?  We create shared ring, alloc event channel. */
  27.272  	if (blkif_vbds == 0) {
  27.273  		err = setup_blkring(dev, backend_id);
  27.274  		if (err)
  27.275 -			goto free_backend;
  27.276 +			goto out;
  27.277  	}
  27.278  
  27.279  	err = xenbus_transaction_start(dev->nodename);
  27.280 @@ -1237,20 +1181,11 @@ static int talk_to_backend(struct xenbus
  27.281  		goto destroy_blkring;
  27.282  	}
  27.283  
  27.284 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.285  	err = xenbus_printf(dev->nodename, "grant-id","%u", shmem_ref);
  27.286  	if (err) {
  27.287  		message = "writing grant-id";
  27.288  		goto abort_transaction;
  27.289  	}
  27.290 -#else
  27.291 -	err = xenbus_printf(dev->nodename, "shared-frame", "%lu",
  27.292 -			    virt_to_mfn(blk_ring.sring));
  27.293 -	if (err) {
  27.294 -		message = "writing shared-frame";
  27.295 -		goto abort_transaction;
  27.296 -	}
  27.297 -#endif
  27.298  	err = xenbus_printf(dev->nodename,
  27.299  			    "event-channel", "%u", blkif_evtchn);
  27.300  	if (err) {
  27.301 @@ -1258,9 +1193,11 @@ static int talk_to_backend(struct xenbus
  27.302  		goto abort_transaction;
  27.303  	}
  27.304  
  27.305 -	info->watch.node = info->backend = backend;
  27.306 +	info->backend = backend;
  27.307 +	backend = NULL;
  27.308 +
  27.309 +	info->watch.node = info->backend;
  27.310  	info->watch.callback = watch_for_status;
  27.311 -
  27.312  	err = register_xenbus_watch(&info->watch);
  27.313  	if (err) {
  27.314  		message = "registering watch on backend";
  27.315 @@ -1272,20 +1209,20 @@ static int talk_to_backend(struct xenbus
  27.316  		xenbus_dev_error(dev, err, "completing transaction");
  27.317  		goto destroy_blkring;
  27.318  	}
  27.319 -	return 0;
  27.320  
  27.321 -abort_transaction:
  27.322 + out:
  27.323 +	if (backend)
  27.324 +		kfree(backend);
  27.325 +	return err;
  27.326 +
  27.327 + abort_transaction:
  27.328  	xenbus_transaction_end(1);
  27.329  	/* Have to do this *outside* transaction.  */
  27.330  	xenbus_dev_error(dev, err, "%s", message);
  27.331 -destroy_blkring:
  27.332 + destroy_blkring:
  27.333  	if (blkif_vbds == 0)
  27.334  		blkif_free();
  27.335 -free_backend:
  27.336 -	kfree(backend);
  27.337 -out:
  27.338 -	printk("%s:%u = %i\n", __FILE__, __LINE__, err);
  27.339 -	return err;
  27.340 +	goto out;
  27.341  }
  27.342  
  27.343  /* Setup supplies the backend dir, virtual device.
  27.344 @@ -1301,7 +1238,7 @@ static int blkfront_probe(struct xenbus_
  27.345  
  27.346  	/* FIXME: Use dynamic device id if this is not set. */
  27.347  	err = xenbus_scanf(dev->nodename, "virtual-device", "%i", &vdevice);
  27.348 -	if (err == -ENOENT)
  27.349 +	if (XENBUS_EXIST_ERR(err))
  27.350  		return err;
  27.351  	if (err < 0) {
  27.352  		xenbus_dev_error(dev, err, "reading virtual-device");
  27.353 @@ -1316,6 +1253,7 @@ static int blkfront_probe(struct xenbus_
  27.354  	info->dev = dev;
  27.355  	info->vdevice = vdevice;
  27.356  	info->connected = 0;
  27.357 +
  27.358  	/* Front end dir is a number, which is used as the id. */
  27.359  	info->handle = simple_strtoul(strrchr(dev->nodename,'/')+1, NULL, 0);
  27.360  	dev->data = info;
  27.361 @@ -1425,13 +1363,10 @@ static int __init xlblk_init(void)
  27.362  {
  27.363      int i;
  27.364  
  27.365 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.366      /* A grant for every ring slot, plus one for the ring itself. */
  27.367 -    if ( 0 > gnttab_alloc_grant_references(MAXIMUM_OUTSTANDING_BLOCK_REQS + 1,
  27.368 -                                           &gref_head, &gref_terminal) )
  27.369 +    if (gnttab_alloc_grant_references(MAXIMUM_OUTSTANDING_BLOCK_REQS + 1,
  27.370 +				      &gref_head, &gref_terminal) < 0)
  27.371          return 1;
  27.372 -    printk(KERN_ALERT "Blkif frontend is using grant tables.\n");
  27.373 -#endif
  27.374  
  27.375      if ( (xen_start_info.flags & SIF_INITDOMAIN) ||
  27.376           (xen_start_info.flags & SIF_BLK_BE_DOMAIN) )
  27.377 @@ -1455,20 +1390,7 @@ static int __init xlblk_init(void)
  27.378  static void blkif_completion(struct blk_shadow *s)
  27.379  {
  27.380      int i;
  27.381 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  27.382      for ( i = 0; i < s->req.nr_segments; i++ )
  27.383          gnttab_release_grant_reference(
  27.384              &gref_head, blkif_gref_from_fas(s->req.frame_and_sects[i]));
  27.385 -#else
  27.386 -    /* This is a hack to get the dirty logging bits set */
  27.387 -    if ( s->req.operation == BLKIF_OP_READ )
  27.388 -    {
  27.389 -        for ( i = 0; i < s->req.nr_segments; i++ )
  27.390 -        {
  27.391 -            unsigned long pfn = s->req.frame_and_sects[i] >> PAGE_SHIFT;
  27.392 -            unsigned long mfn = phys_to_machine_mapping[pfn];
  27.393 -            xen_machphys_update(mfn, pfn);
  27.394 -        }
  27.395 -    }
  27.396 -#endif
  27.397  }
    28.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c	Fri Aug 19 16:47:24 2005 -0800
    28.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c	Mon Aug 22 11:00:37 2005 -0700
    28.3 @@ -5,7 +5,6 @@
    28.4   * Control interface between the driver and a character device.
    28.5   * 
    28.6   * Copyright (c) 2004, Andrew Warfield
    28.7 - *
    28.8   */
    28.9  
   28.10  #include <linux/config.h>
   28.11 @@ -535,8 +534,8 @@ int blktap_write_fe_ring(blkif_request_t
   28.12          /* Set the necessary mappings in p2m and in the VM_FOREIGN 
   28.13           * vm_area_struct to allow user vaddr -> struct page lookups
   28.14           * to work.  This is needed for direct IO to foreign pages. */
   28.15 -        phys_to_machine_mapping[__pa(kvaddr)>>PAGE_SHIFT] =
   28.16 -            FOREIGN_FRAME(map[i].dev_bus_addr);
   28.17 +        phys_to_machine_mapping[__pa(kvaddr) >> PAGE_SHIFT] =
   28.18 +            FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
   28.19  
   28.20          offset = (uvaddr - blktap_vma->vm_start) >> PAGE_SHIFT;
   28.21          ((struct page **)blktap_vma->vm_private_data)[offset] =
   28.22 @@ -776,9 +775,11 @@ static struct miscdevice blktap_miscdev 
   28.23  int blktap_init(void)
   28.24  {
   28.25      int err, i, j;
   28.26 +    struct page *page;
   28.27  
   28.28 -    if ( (mmap_vstart = allocate_empty_lowmem_region(MMAP_PAGES)) == 0 )
   28.29 -        BUG();
   28.30 +    page = balloon_alloc_empty_page_range(MMAP_PAGES);
   28.31 +    BUG_ON(page == NULL);
   28.32 +    mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
   28.33  
   28.34  #ifdef CONFIG_XEN_BLKDEV_GRANT
   28.35      for (i=0; i<MAX_PENDING_REQS ; i++)
    29.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri Aug 19 16:47:24 2005 -0800
    29.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Mon Aug 22 11:00:37 2005 -0700
    29.3 @@ -768,7 +768,7 @@ static void net_tx_action(unsigned long 
    29.4              continue;
    29.5          }
    29.6          phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT] =
    29.7 -                             FOREIGN_FRAME(mop->dev_bus_addr);
    29.8 +                             FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT);
    29.9          grant_tx_ref[pending_idx] = mop->handle;
   29.10  #else
   29.11          if ( unlikely(mcl[0].result != 0) )
   29.12 @@ -968,8 +968,9 @@ static int __init netback_init(void)
   29.13      
   29.14      netif_interface_init();
   29.15  
   29.16 -    mmap_vstart = allocate_empty_lowmem_region(MAX_PENDING_REQS);
   29.17 -    BUG_ON(mmap_vstart == 0);
   29.18 +    page = balloon_alloc_empty_page_range(MAX_PENDING_REQS);
   29.19 +    BUG_ON(page == NULL);
   29.20 +    mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
   29.21  
   29.22      for ( i = 0; i < MAX_PENDING_REQS; i++ )
   29.23      {
    30.1 --- a/linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c	Fri Aug 19 16:47:24 2005 -0800
    30.2 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c	Mon Aug 22 11:00:37 2005 -0700
    30.3 @@ -1027,13 +1027,15 @@ void usbif_release_ports(usbif_priv_t *u
    30.4  static int __init usbif_init(void)
    30.5  {
    30.6      int i;
    30.7 +    struct page *page;
    30.8  
    30.9      if ( !(xen_start_info.flags & SIF_INITDOMAIN) &&
   30.10           !(xen_start_info.flags & SIF_USB_BE_DOMAIN) )
   30.11          return 0;
   30.12 -    
   30.13 -    if ( (mmap_vstart = allocate_empty_lowmem_region(MMAP_PAGES)) == 0 )
   30.14 -        BUG();
   30.15 +
   30.16 +    page = balloon_alloc_empty_page_range(MMAP_PAGES);
   30.17 +    BUG_ON(page == NULL);
   30.18 +    mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
   30.19  
   30.20      pending_cons = 0;
   30.21      pending_prod = MAX_PENDING_REQS;
    31.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h	Fri Aug 19 16:47:24 2005 -0800
    31.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h	Mon Aug 22 11:00:37 2005 -0700
    31.3 @@ -507,14 +507,14 @@ HYPERVISOR_vcpu_pickle(
    31.4      int vcpu, vcpu_guest_context_t *ctxt)
    31.5  {
    31.6      int ret;
    31.7 -    unsigned long ign1, ign2;
    31.8 +
    31.9      __asm__ __volatile__ (
   31.10          TRAP_INSTR
   31.11 -        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   31.12 -	: "0" (__HYPERVISOR_sched_op),
   31.13 -	  "1" (SCHEDOP_vcpu_pickle | (vcpu << SCHEDOP_vcpushift)),
   31.14 -	  "2" (ctxt)
   31.15 -        : __syscall_clobber );
   31.16 +        : "=a" (ret)
   31.17 +	: "0" ((unsigned long)__HYPERVISOR_sched_op),
   31.18 +	"D" ((unsigned long)SCHEDOP_vcpu_pickle | (vcpu << SCHEDOP_vcpushift)),
   31.19 +	"S" ((unsigned long)ctxt)
   31.20 +	: __syscall_clobber );
   31.21  
   31.22      return ret;
   31.23  }
    32.1 --- a/linux-2.6-xen-sparse/include/asm-xen/balloon.h	Fri Aug 19 16:47:24 2005 -0800
    32.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/balloon.h	Mon Aug 22 11:00:37 2005 -0700
    32.3 @@ -35,10 +35,19 @@
    32.4   * Inform the balloon driver that it should allow some slop for device-driver
    32.5   * memory activities.
    32.6   */
    32.7 -extern void balloon_update_driver_allowance(long delta);
    32.8 +extern void
    32.9 +balloon_update_driver_allowance(
   32.10 +	long delta);
   32.11  
   32.12 -/* Give up unmapped pages to the balloon driver. */
   32.13 -extern void balloon_put_pages(unsigned long *mfn_list, unsigned long nr_mfns);
   32.14 +/* Allocate an empty low-memory page range. */
   32.15 +extern struct page *
   32.16 +balloon_alloc_empty_page_range(
   32.17 +	unsigned long nr_pages);
   32.18 +
   32.19 +/* Deallocate an empty page range, adding to the balloon. */
   32.20 +extern void
   32.21 +balloon_dealloc_empty_page_range(
   32.22 +	struct page *page, unsigned long nr_pages);
   32.23  
   32.24  /*
   32.25   * Prevent the balloon driver from changing the memory reservation during
    33.1 --- a/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h	Fri Aug 19 16:47:24 2005 -0800
    33.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h	Mon Aug 22 11:00:37 2005 -0700
    33.3 @@ -137,9 +137,6 @@ void xen_invlpg_mask(cpumask_t *mask, un
    33.4  void xen_create_contiguous_region(unsigned long vstart, unsigned int order);
    33.5  void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
    33.6  
    33.7 -/* Allocate a contiguous empty region of low memory. Return virtual start. */
    33.8 -unsigned long allocate_empty_lowmem_region(unsigned long pages);
    33.9 -
   33.10  #include <asm/hypercall.h>
   33.11  
   33.12  #if defined(CONFIG_X86_64)
    34.1 --- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h	Fri Aug 19 16:47:24 2005 -0800
    34.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h	Mon Aug 22 11:00:37 2005 -0700
    34.3 @@ -128,4 +128,14 @@ void reregister_xenbus_watches(void);
    34.4  void xenbus_suspend(void);
    34.5  void xenbus_resume(void);
    34.6  
    34.7 +#define XENBUS_IS_ERR_READ(str) ({			\
    34.8 +	if (!IS_ERR(str) && strlen(str) == 0) {		\
    34.9 +		kfree(str);				\
   34.10 +		str = ERR_PTR(-ERANGE);			\
   34.11 +	}						\
   34.12 +	IS_ERR(str);					\
   34.13 +})
   34.14 +
   34.15 +#define XENBUS_EXIST_ERR(err) ((err) == -ENOENT || (err) == -ERANGE)
   34.16 +
   34.17  #endif /* _ASM_XEN_XENBUS_H */
    35.1 --- a/tools/firmware/vmxassist/vm86.c	Fri Aug 19 16:47:24 2005 -0800
    35.2 +++ b/tools/firmware/vmxassist/vm86.c	Mon Aug 22 11:00:37 2005 -0700
    35.3 @@ -38,7 +38,7 @@ unsigned prev_eip = 0;
    35.4  enum vm86_mode mode;
    35.5  
    35.6  #ifdef DEBUG
    35.7 -int traceset = 0;
    35.8 +int traceset = 0xff;
    35.9  
   35.10  char *states[] = {
   35.11  	"<VM86_REAL>",
   35.12 @@ -446,6 +446,8 @@ movcr(struct regs *regs, unsigned prefix
   35.13  #endif
   35.14  			if (getreg(regs, modrm) & CR0_PE)
   35.15  				set_mode(regs, VM86_REAL_TO_PROTECTED);
   35.16 +                        else
   35.17 +				set_mode(regs, VM86_REAL);
   35.18  
   35.19  			break;
   35.20  		case 3:
   35.21 @@ -603,7 +605,9 @@ set_mode(struct regs *regs, enum vm86_mo
   35.22  {
   35.23  	switch (newmode) {
   35.24  	case VM86_REAL:
   35.25 -		if (mode == VM86_PROTECTED_TO_REAL) {
   35.26 +		if ((mode == VM86_PROTECTED_TO_REAL) ||
   35.27 +                    (mode == VM86_REAL_TO_PROTECTED)) {
   35.28 +			regs->eflags &= ~EFLAGS_TF;
   35.29  			real_mode(regs);
   35.30  			break;
   35.31  		} else if (mode == VM86_REAL) {
    36.1 --- a/tools/python/xen/xm/create.py	Fri Aug 19 16:47:24 2005 -0800
    36.2 +++ b/tools/python/xen/xm/create.py	Mon Aug 22 11:00:37 2005 -0700
    36.3 @@ -688,7 +688,9 @@ def balloon_out(dom0_min_mem, opts):
    36.4      dom0_cur_alloc = get_dom0_alloc()
    36.5      dom0_new_alloc = dom0_cur_alloc - (domU_need_mem - free_mem)
    36.6  
    36.7 -    if free_mem < domU_need_mem and dom0_new_alloc >= dom0_min_mem:
    36.8 +    if free_mem < domU_need_mem and dom0_new_alloc < dom0_min_mem:
    36.9 +        ret = 1
   36.10 +    if free_mem < domU_need_mem and ret == 0:
   36.11  
   36.12          server.xend_domain_mem_target_set(0, dom0_new_alloc)
   36.13  
   36.14 @@ -734,7 +736,8 @@ def main(argv):
   36.15          dom0_min_mem = xroot.get_dom0_min_mem()
   36.16          if dom0_min_mem != 0:
   36.17              if balloon_out(dom0_min_mem, opts):
   36.18 -                return
   36.19 +                print >>sys.stderr, "error: cannot allocate enough memory for domain"
   36.20 +                sys.exit(1)
   36.21  
   36.22          dom = make_domain(opts, config)
   36.23          if opts.vals.console_autoconnect:
    37.1 --- a/tools/python/xen/xm/main.py	Fri Aug 19 16:47:24 2005 -0800
    37.2 +++ b/tools/python/xen/xm/main.py	Mon Aug 22 11:00:37 2005 -0700
    37.3 @@ -434,7 +434,7 @@ def xm_sedf(args):
    37.4      arg_check(args, 6, "sedf")
    37.5      
    37.6      dom = args[0]
    37.7 -    v = map(int, args[1:5])
    37.8 +    v = map(int, args[1:6])
    37.9      from xen.xend.XendClient import server
   37.10      server.xend_domain_cpu_sedf_set(dom, *v)
   37.11  
    38.1 --- a/xen/arch/ia64/grant_table.c	Fri Aug 19 16:47:24 2005 -0800
    38.2 +++ b/xen/arch/ia64/grant_table.c	Mon Aug 22 11:00:37 2005 -0700
    38.3 @@ -546,15 +546,6 @@ static int
    38.4      {
    38.5          frame = act->frame;
    38.6      }
    38.7 -    else if ( frame == GNTUNMAP_DEV_FROM_VIRT )
    38.8 -    {
    38.9 -        if ( !( flags & GNTMAP_device_map ) )
   38.10 -            PIN_FAIL(unmap_out, GNTST_bad_dev_addr,
   38.11 -                     "Bad frame number: frame not mapped for dev access.\n");
   38.12 -        frame = act->frame;
   38.13 -
   38.14 -        /* Frame will be unmapped for device access below if virt addr okay. */
   38.15 -    }
   38.16      else
   38.17      {
   38.18          if ( unlikely(frame != act->frame) )
   38.19 @@ -616,15 +607,6 @@ static int
   38.20          act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_hstr_inc
   38.21                                                : GNTPIN_hstw_inc;
   38.22  
   38.23 -        if ( frame == GNTUNMAP_DEV_FROM_VIRT )
   38.24 -        {
   38.25 -            act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_devr_inc
   38.26 -                                                  : GNTPIN_devw_inc;
   38.27 -
   38.28 -            map->ref_and_flags &= ~GNTMAP_device_map;
   38.29 -            (void)__put_user(0, &uop->dev_bus_addr);
   38.30 -        }
   38.31 -
   38.32          rc = 0;
   38.33          *va = virt;
   38.34      }
    39.1 --- a/xen/arch/x86/domain_build.c	Fri Aug 19 16:47:24 2005 -0800
    39.2 +++ b/xen/arch/x86/domain_build.c	Mon Aug 22 11:00:37 2005 -0700
    39.3 @@ -69,11 +69,21 @@ boolean_param("dom0_translate", opt_dom0
    39.4  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
    39.5  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
    39.6  
    39.7 -static struct pfn_info *alloc_largest(struct domain *d, unsigned long max)
    39.8 +static struct pfn_info *alloc_chunk(struct domain *d, unsigned long max_pages)
    39.9  {
   39.10      struct pfn_info *page;
   39.11 -    unsigned int order = get_order(max * PAGE_SIZE);
   39.12 -    if ( (max & (max-1)) != 0 )
   39.13 +    unsigned int order;
   39.14 +    /*
   39.15 +     * Allocate up to 2MB at a time:
   39.16 +     *  1. This prevents overflow of get_order() when allocating more than
   39.17 +     *     4GB to domain 0 on a PAE machine.
   39.18 +     *  2. It prevents allocating very large chunks from DMA pools before
   39.19 +     *     the >4GB pool is fully depleted.
   39.20 +     */
   39.21 +    if ( max_pages > (2UL << (20 - PAGE_SHIFT)) )
   39.22 +        max_pages = 2UL << (20 - PAGE_SHIFT);
   39.23 +    order = get_order(max_pages << PAGE_SHIFT);
   39.24 +    if ( (max_pages & (max_pages-1)) != 0 )
   39.25          order--;
   39.26      while ( (page = alloc_domheap_pages(d, order, 0)) == NULL )
   39.27          if ( order-- == 0 )
   39.28 @@ -608,7 +618,7 @@ int construct_dom0(struct domain *d,
   39.29      }
   39.30      while ( pfn < nr_pages )
   39.31      {
   39.32 -        if ( (page = alloc_largest(d, nr_pages - d->tot_pages)) == NULL )
   39.33 +        if ( (page = alloc_chunk(d, nr_pages - d->tot_pages)) == NULL )
   39.34              panic("Not enough RAM for DOM0 reservation.\n");
   39.35          while ( pfn < d->tot_pages )
   39.36          {
    40.1 --- a/xen/arch/x86/mm.c	Fri Aug 19 16:47:24 2005 -0800
    40.2 +++ b/xen/arch/x86/mm.c	Mon Aug 22 11:00:37 2005 -0700
    40.3 @@ -2176,7 +2176,7 @@ int do_mmu_update(
    40.4                          }
    40.5                      }
    40.6  
    40.7 -                    *(unsigned long *)va = req.val;
    40.8 +                    *(intpte_t *)va = req.val;
    40.9                      okay = 1;
   40.10  
   40.11                      if ( shadow_mode_enabled(d) )
   40.12 @@ -2386,7 +2386,7 @@ int clear_grant_pte_mapping(
   40.13      }
   40.14  
   40.15      /* Delete pagetable entry. */
   40.16 -    if ( unlikely(__put_user(0, (unsigned long *)va)))
   40.17 +    if ( unlikely(__put_user(0, (intpte_t *)va)))
   40.18      {
   40.19          DPRINTK("Cannot delete PTE entry at %p.\n", va);
   40.20          put_page_type(page);
   40.21 @@ -2446,12 +2446,11 @@ int update_grant_va_mapping(
   40.22  
   40.23  int clear_grant_va_mapping(unsigned long addr, unsigned long frame)
   40.24  {
   40.25 -    l1_pgentry_t *pl1e;
   40.26 -    unsigned long _ol1e;
   40.27 +    l1_pgentry_t *pl1e, ol1e;
   40.28      
   40.29      pl1e = &linear_pg_table[l1_linear_offset(addr)];
   40.30  
   40.31 -    if ( unlikely(__get_user(_ol1e, (unsigned long *)pl1e) != 0) )
   40.32 +    if ( unlikely(__get_user(ol1e.l1, &pl1e->l1) != 0) )
   40.33      {
   40.34          DPRINTK("Could not find PTE entry for address %lx\n", addr);
   40.35          return GNTST_general_error;
   40.36 @@ -2461,15 +2460,15 @@ int clear_grant_va_mapping(unsigned long
   40.37       * Check that the virtual address supplied is actually mapped to
   40.38       * frame.
   40.39       */
   40.40 -    if ( unlikely((_ol1e >> PAGE_SHIFT) != frame ))
   40.41 +    if ( unlikely(l1e_get_pfn(ol1e) != frame) )
   40.42      {
   40.43          DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n",
   40.44 -                _ol1e, addr, frame);
   40.45 +                l1e_get_pfn(ol1e), addr, frame);
   40.46          return GNTST_general_error;
   40.47      }
   40.48  
   40.49      /* Delete pagetable entry. */
   40.50 -    if ( unlikely(__put_user(0, (unsigned long *)pl1e)))
   40.51 +    if ( unlikely(__put_user(0, &pl1e->l1)) )
   40.52      {
   40.53          DPRINTK("Cannot delete PTE entry at %p.\n", (unsigned long *)pl1e);
   40.54          return GNTST_general_error;
    41.1 --- a/xen/common/grant_table.c	Fri Aug 19 16:47:24 2005 -0800
    41.2 +++ b/xen/common/grant_table.c	Mon Aug 22 11:00:37 2005 -0700
    41.3 @@ -70,13 +70,13 @@ put_maptrack_handle(
    41.4  
    41.5  static int
    41.6  __gnttab_activate_grant_ref(
    41.7 -    struct domain          *mapping_d,          /* IN */
    41.8 +    struct domain   *mapping_d,          /* IN */
    41.9      struct vcpu     *mapping_ed,
   41.10 -    struct domain          *granting_d,
   41.11 -    grant_ref_t             ref,
   41.12 -    u16                     dev_hst_ro_flags,
   41.13 -    unsigned long           addr,
   41.14 -    unsigned long          *pframe )            /* OUT */
   41.15 +    struct domain   *granting_d,
   41.16 +    grant_ref_t      ref,
   41.17 +    u16              dev_hst_ro_flags,
   41.18 +    u64              addr,
   41.19 +    unsigned long   *pframe )            /* OUT */
   41.20  {
   41.21      domid_t               sdom;
   41.22      u16                   sflags;
   41.23 @@ -336,14 +336,15 @@ static int
   41.24      gnttab_map_grant_ref_t *uop,
   41.25      unsigned long *va)
   41.26  {
   41.27 -    domid_t               dom;
   41.28 -    grant_ref_t           ref;
   41.29 -    struct domain        *ld, *rd;
   41.30 -    struct vcpu          *led;
   41.31 -    u16                   dev_hst_ro_flags;
   41.32 -    int                   handle;
   41.33 -    unsigned long         frame = 0, addr;
   41.34 -    int                   rc;
   41.35 +    domid_t        dom;
   41.36 +    grant_ref_t    ref;
   41.37 +    struct domain *ld, *rd;
   41.38 +    struct vcpu   *led;
   41.39 +    u16            dev_hst_ro_flags;
   41.40 +    int            handle;
   41.41 +    u64            addr;
   41.42 +    unsigned long  frame = 0;
   41.43 +    int            rc;
   41.44  
   41.45      led = current;
   41.46      ld = led->domain;
   41.47 @@ -363,7 +364,7 @@ static int
   41.48             (!(dev_hst_ro_flags & GNTMAP_contains_pte) && 
   41.49              unlikely(!__addr_ok(addr))) ) )
   41.50      {
   41.51 -        DPRINTK("Bad virtual address (%lx) or flags (%x).\n",
   41.52 +        DPRINTK("Bad virtual address (%"PRIx64") or flags (%"PRIx16").\n",
   41.53                  addr, dev_hst_ro_flags);
   41.54          (void)__put_user(GNTST_bad_virt_addr, &uop->handle);
   41.55          return GNTST_bad_gntref;
   41.56 @@ -450,7 +451,7 @@ static int
   41.57              = (ref << MAPTRACK_REF_SHIFT) |
   41.58                (dev_hst_ro_flags & MAPTRACK_GNTMAP_MASK);
   41.59  
   41.60 -        (void)__put_user(frame, &uop->dev_bus_addr);
   41.61 +        (void)__put_user((u64)frame << PAGE_SHIFT, &uop->dev_bus_addr);
   41.62  
   41.63          if ( ( dev_hst_ro_flags & GNTMAP_host_map ) &&
   41.64               !( dev_hst_ro_flags & GNTMAP_contains_pte) )
   41.65 @@ -492,29 +493,31 @@ static int
   41.66      gnttab_unmap_grant_ref_t *uop,
   41.67      unsigned long *va)
   41.68  {
   41.69 -    domid_t        dom;
   41.70 -    grant_ref_t    ref;
   41.71 -    u16            handle;
   41.72 -    struct domain *ld, *rd;
   41.73 -
   41.74 +    domid_t          dom;
   41.75 +    grant_ref_t      ref;
   41.76 +    u16              handle;
   41.77 +    struct domain   *ld, *rd;
   41.78      active_grant_entry_t *act;
   41.79 -    grant_entry_t *sha;
   41.80 +    grant_entry_t   *sha;
   41.81      grant_mapping_t *map;
   41.82 -    u16            flags;
   41.83 -    s16            rc = 1;
   41.84 -    unsigned long  frame, addr;
   41.85 +    u16              flags;
   41.86 +    s16              rc = 1;
   41.87 +    u64              addr, dev_bus_addr;
   41.88 +    unsigned long    frame;
   41.89  
   41.90      ld = current->domain;
   41.91  
   41.92      /* Bitwise-OR avoids short-circuiting which screws control flow. */
   41.93      if ( unlikely(__get_user(addr, &uop->host_addr) |
   41.94 -                  __get_user(frame, &uop->dev_bus_addr) |
   41.95 +                  __get_user(dev_bus_addr, &uop->dev_bus_addr) |
   41.96                    __get_user(handle, &uop->handle)) )
   41.97      {
   41.98          DPRINTK("Fault while reading gnttab_unmap_grant_ref_t.\n");
   41.99          return -EFAULT; /* don't set status */
  41.100      }
  41.101  
  41.102 +    frame = (unsigned long)(dev_bus_addr >> PAGE_SHIFT);
  41.103 +
  41.104      map = &ld->grant_table->maptrack[handle];
  41.105  
  41.106      if ( unlikely(handle >= ld->grant_table->maptrack_limit) ||
  41.107 @@ -553,15 +556,6 @@ static int
  41.108      {
  41.109          frame = act->frame;
  41.110      }
  41.111 -    else if ( frame == GNTUNMAP_DEV_FROM_VIRT )
  41.112 -    {
  41.113 -        if ( !( flags & GNTMAP_device_map ) )
  41.114 -            PIN_FAIL(unmap_out, GNTST_bad_dev_addr,
  41.115 -                     "Bad frame number: frame not mapped for dev access.\n");
  41.116 -        frame = act->frame;
  41.117 -
  41.118 -        /* Frame will be unmapped for device access below if virt addr okay. */
  41.119 -    }
  41.120      else
  41.121      {
  41.122          if ( unlikely(frame != act->frame) )
  41.123 @@ -597,15 +591,6 @@ static int
  41.124          act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_hstr_inc
  41.125                                                : GNTPIN_hstw_inc;
  41.126  
  41.127 -        if ( frame == GNTUNMAP_DEV_FROM_VIRT )
  41.128 -        {
  41.129 -            act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_devr_inc
  41.130 -                                                  : GNTPIN_devw_inc;
  41.131 -
  41.132 -            map->ref_and_flags &= ~GNTMAP_device_map;
  41.133 -            (void)__put_user(0, &uop->dev_bus_addr);
  41.134 -        }
  41.135 -
  41.136          rc = 0;
  41.137          if ( !( flags & GNTMAP_contains_pte) )
  41.138              *va = addr;
    42.1 --- a/xen/include/asm-x86/x86_32/page-3level.h	Fri Aug 19 16:47:24 2005 -0800
    42.2 +++ b/xen/include/asm-x86/x86_32/page-3level.h	Mon Aug 22 11:00:37 2005 -0700
    42.3 @@ -63,7 +63,7 @@ typedef l3_pgentry_t root_pgentry_t;
    42.4  
    42.5  /* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */
    42.6  #define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF))
    42.7 -#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 40) | ((x) & 0xFFF))
    42.8 +#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF))
    42.9  
   42.10  #define L1_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PAT/GLOBAL */
   42.11  #define L2_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PSE/GLOBAL */
    43.1 --- a/xen/include/asm-x86/x86_32/uaccess.h	Fri Aug 19 16:47:24 2005 -0800
    43.2 +++ b/xen/include/asm-x86/x86_32/uaccess.h	Mon Aug 22 11:00:37 2005 -0700
    43.3 @@ -22,7 +22,11 @@
    43.4  #define array_access_ok(addr,count,size) \
    43.5      (likely(count < (~0UL/size)) && access_ok(addr,count*size))
    43.6  
    43.7 +/* Undefined function to catch size mismatches on 64-bit get_user/put_user. */
    43.8 +extern void __uaccess_var_not_u64(void);
    43.9 +
   43.10  #define __put_user_u64(x, addr, retval, errret)			\
   43.11 +	if (sizeof(x) != 8) __uaccess_var_not_u64();		\
   43.12  	__asm__ __volatile__(					\
   43.13  		"1:	movl %%eax,0(%2)\n"			\
   43.14  		"2:	movl %%edx,4(%2)\n"			\
   43.15 @@ -52,6 +56,7 @@ do {									\
   43.16  } while (0)
   43.17  
   43.18  #define __get_user_u64(x, addr, retval, errret)			\
   43.19 +	if (sizeof(x) != 8) __uaccess_var_not_u64();		\
   43.20  	__asm__ __volatile__(					\
   43.21  		"1:	movl 0(%2),%%eax\n"			\
   43.22  		"2:	movl 4(%2),%%edx\n"			\
    44.1 --- a/xen/include/public/dom0_ops.h	Fri Aug 19 16:47:24 2005 -0800
    44.2 +++ b/xen/include/public/dom0_ops.h	Mon Aug 22 11:00:37 2005 -0700
    44.3 @@ -19,7 +19,7 @@
    44.4   * This makes sure that old versions of dom0 tools will stop working in a
    44.5   * well-defined way (rather than crashing the machine, for instance).
    44.6   */
    44.7 -#define DOM0_INTERFACE_VERSION   0xAAAA100F
    44.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1010
    44.9  
   44.10  /************************************************************************/
   44.11  
    45.1 --- a/xen/include/public/grant_table.h	Fri Aug 19 16:47:24 2005 -0800
    45.2 +++ b/xen/include/public/grant_table.h	Mon Aug 22 11:00:37 2005 -0700
    45.3 @@ -183,8 +183,6 @@ typedef struct gnttab_unmap_grant_ref {
    45.4      s16         status;               /* GNTST_* */
    45.5  } gnttab_unmap_grant_ref_t;
    45.6  
    45.7 -#define GNTUNMAP_DEV_FROM_VIRT (~0U)
    45.8 -
    45.9  /*
   45.10   * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
   45.11   * <nr_frames> pages. The frame addresses are written to the <frame_list>.
    46.1 --- a/xen/include/public/io/blkif.h	Fri Aug 19 16:47:24 2005 -0800
    46.2 +++ b/xen/include/public/io/blkif.h	Mon Aug 22 11:00:37 2005 -0700
    46.3 @@ -36,11 +36,7 @@ typedef struct blkif_request {
    46.4      unsigned long  id;           /* private guest value, echoed in resp  */
    46.5      blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
    46.6      /* @f_a_s[4:0]=last_sect ; @f_a_s[9:5]=first_sect                        */
    46.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    46.8      /* @f_a_s[:16]= grant reference (16 bits)                                */
    46.9 -#else
   46.10 -    /* @f_a_s[:12]=@frame: machine page frame number.                        */
   46.11 -#endif
   46.12      /* @first_sect: first sector in frame to transfer (inclusive).           */
   46.13      /* @last_sect: last sector in frame to transfer (inclusive).             */
   46.14      unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   46.15 @@ -50,10 +46,8 @@ typedef struct blkif_request {
   46.16  #define blkif_first_sect(_fas) (((_fas)>>5)&31)
   46.17  #define blkif_last_sect(_fas)  ((_fas)&31)
   46.18  
   46.19 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   46.20  #define blkif_fas_from_gref(_gref, _fs, _ls) (((_gref)<<16)|((_fs)<<5)|(_ls))
   46.21  #define blkif_gref_from_fas(_fas) ((_fas)>>16)
   46.22 -#endif
   46.23  
   46.24  typedef struct blkif_response {
   46.25      unsigned long   id;              /* copied from request */
    47.1 --- a/xen/include/public/physdev.h	Fri Aug 19 16:47:24 2005 -0800
    47.2 +++ b/xen/include/public/physdev.h	Mon Aug 22 11:00:37 2005 -0700
    47.3 @@ -27,8 +27,8 @@ typedef struct physdevop_set_iopl {
    47.4  
    47.5  typedef struct physdevop_set_iobitmap {
    47.6      /* IN */
    47.7 -    char *bitmap;
    47.8 -    u32   nr_ports;
    47.9 +    u8 *bitmap;
   47.10 +    u32 nr_ports;
   47.11  } physdevop_set_iobitmap_t;
   47.12  
   47.13  typedef struct physdevop_apic {