ia64/xen-unstable
changeset 9476:d75a6cc5e68a
merge with xen-unstable.hg
author | awilliam@xenbuild.aw |
---|---|
date | Tue Mar 28 08:54:58 2006 -0700 (2006-03-28) |
parents | 7e3cbc409676 4109c4e7804a |
children | b579cf0ad753 |
files | extras/mini-os/xenbus/Makefile extras/mini-os/xenbus/xenbus_comms.c extras/mini-os/xenbus/xenbus_comms.h extras/mini-os/xenbus/xenbus_xs.c |
line diff
1.1 --- a/.hgtags Mon Mar 27 15:36:47 2006 -0700 1.2 +++ b/.hgtags Tue Mar 28 08:54:58 2006 -0700 1.3 @@ -13,3 +13,4 @@ 9afec5bc14aeb197ef37ea54a57eacd427463fc3 1.4 30c521db4c71960b0cf1d9c9e1b658e77b535a3e split-1.0 1.5 3d330e41f41ce1bc118c02346e18949ad5d67f6b split-1.1 1.6 c8fdb0caa77b429cf47f9707926e83947778cb48 RELEASE-3.0.0 1.7 +af0573e9e5258db0a9d28aa954dd302ddd2c2d23 3.0.2-rc
2.1 --- a/Makefile Mon Mar 27 15:36:47 2006 -0700 2.2 +++ b/Makefile Tue Mar 28 08:54:58 2006 -0700 2.3 @@ -2,7 +2,7 @@ 2.4 # Grand Unified Makefile for Xen. 2.5 # 2.6 2.7 -KERNELS ?= linux-2.6-xen0 linux-2.6-xenU 2.8 +KERNELS ?= linux-2.6-xen 2.9 # You may use wildcards in the above e.g. KERNELS=*2.6* 2.10 2.11 XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) )
3.1 --- a/buildconfigs/linux-defconfig_xen0_ia64 Mon Mar 27 15:36:47 2006 -0700 3.2 +++ b/buildconfigs/linux-defconfig_xen0_ia64 Tue Mar 28 08:54:58 2006 -0700 3.3 @@ -1,7 +1,7 @@ 3.4 # 3.5 # Automatically generated make config: don't edit 3.6 -# Linux kernel version: 2.6.16-rc3-xen0 3.7 -# Thu Feb 16 13:20:46 2006 3.8 +# Linux kernel version: 2.6.16-xen0 3.9 +# Mon Mar 27 14:46:03 2006 3.10 # 3.11 3.12 # 3.13 @@ -95,8 +95,7 @@ CONFIG_ARCH_XEN=y 3.14 CONFIG_XEN_PRIVILEGED_GUEST=y 3.15 CONFIG_XEN_BLKDEV_GRANT=y 3.16 CONFIG_XEN_BLKDEV_FRONTEND=y 3.17 -CONFIG_XEN_VT=y 3.18 -CONFIG_VT=y 3.19 +CONFIG_XEN_BLKDEV_BACKEND=y 3.20 CONFIG_XEN_SYSFS=y 3.21 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 3.22 CONFIG_DMA_IS_DMA32=y 3.23 @@ -378,7 +377,7 @@ CONFIG_BLK_DEV_IDESCSI=y 3.24 # 3.25 # IDE chipset support/bugfixes 3.26 # 3.27 -CONFIG_IDE_GENERIC=y 3.28 +# CONFIG_IDE_GENERIC is not set 3.29 CONFIG_BLK_DEV_IDEPCI=y 3.30 # CONFIG_IDEPCI_SHARE_IRQ is not set 3.31 # CONFIG_BLK_DEV_OFFBOARD is not set 3.32 @@ -706,6 +705,7 @@ CONFIG_GAMEPORT=y 3.33 # 3.34 # Character devices 3.35 # 3.36 +CONFIG_VT=y 3.37 CONFIG_VT_CONSOLE=y 3.38 CONFIG_HW_CONSOLE=y 3.39 CONFIG_SERIAL_NONSTANDARD=y 3.40 @@ -1252,11 +1252,7 @@ CONFIG_USB_MON=y 3.41 # CONFIG_INFINIBAND is not set 3.42 3.43 # 3.44 -# SN Devices 3.45 -# 3.46 - 3.47 -# 3.48 -# EDAC - error detection and reporting (RAS) 3.49 +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 3.50 # 3.51 3.52 #
4.1 --- a/buildconfigs/linux-defconfig_xenU_ia64 Mon Mar 27 15:36:47 2006 -0700 4.2 +++ b/buildconfigs/linux-defconfig_xenU_ia64 Tue Mar 28 08:54:58 2006 -0700 4.3 @@ -1,7 +1,7 @@ 4.4 # 4.5 # Automatically generated make config: don't edit 4.6 -# Linux kernel version: 2.6.16-rc3-xenU 4.7 -# Thu Feb 16 13:47:59 2006 4.8 +# Linux kernel version: 2.6.16-xenU 4.9 +# Mon Mar 27 14:01:13 2006 4.10 # 4.11 4.12 # 4.13 @@ -92,8 +92,7 @@ CONFIG_ARCH_XEN=y 4.14 CONFIG_XEN_PRIVILEGED_GUEST=y 4.15 CONFIG_XEN_BLKDEV_GRANT=y 4.16 CONFIG_XEN_BLKDEV_FRONTEND=y 4.17 -# CONFIG_XEN_VT is not set 4.18 -# CONFIG_VT is not set 4.19 +CONFIG_XEN_BLKDEV_BACKEND=y 4.20 CONFIG_XEN_SYSFS=y 4.21 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 4.22 CONFIG_DMA_IS_DMA32=y 4.23 @@ -607,6 +606,9 @@ CONFIG_SERIO=y 4.24 # 4.25 # Character devices 4.26 # 4.27 +CONFIG_VT=y 4.28 +CONFIG_VT_CONSOLE=y 4.29 +CONFIG_HW_CONSOLE=y 4.30 # CONFIG_SERIAL_NONSTANDARD is not set 4.31 4.32 # 4.33 @@ -865,6 +867,13 @@ CONFIG_FB_RADEON_DEBUG=y 4.34 # CONFIG_FB_VIRTUAL is not set 4.35 4.36 # 4.37 +# Console display driver support 4.38 +# 4.39 +CONFIG_VGA_CONSOLE=y 4.40 +CONFIG_DUMMY_CONSOLE=y 4.41 +# CONFIG_FRAMEBUFFER_CONSOLE is not set 4.42 + 4.43 +# 4.44 # Logo configuration 4.45 # 4.46 CONFIG_LOGO=y 4.47 @@ -1122,11 +1131,7 @@ CONFIG_USB_MON=y 4.48 # CONFIG_INFINIBAND is not set 4.49 4.50 # 4.51 -# SN Devices 4.52 -# 4.53 - 4.54 -# 4.55 -# EDAC - error detection and reporting (RAS) 4.56 +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 4.57 # 4.58 4.59 #
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/buildconfigs/linux-defconfig_xen_ia64 Tue Mar 28 08:54:58 2006 -0700 5.3 @@ -0,0 +1,1523 @@ 5.4 +# 5.5 +# Automatically generated make config: don't edit 5.6 +# Linux kernel version: 2.6.16-xen 5.7 +# Mon Mar 27 14:36:21 2006 5.8 +# 5.9 + 5.10 +# 5.11 +# Code maturity level options 5.12 +# 5.13 +CONFIG_EXPERIMENTAL=y 5.14 +CONFIG_LOCK_KERNEL=y 5.15 +CONFIG_INIT_ENV_ARG_LIMIT=32 5.16 + 5.17 +# 5.18 +# General setup 5.19 +# 5.20 +CONFIG_LOCALVERSION="" 5.21 +CONFIG_LOCALVERSION_AUTO=y 5.22 +CONFIG_SWAP=y 5.23 +CONFIG_SYSVIPC=y 5.24 +CONFIG_POSIX_MQUEUE=y 5.25 +CONFIG_BSD_PROCESS_ACCT=y 5.26 +# CONFIG_BSD_PROCESS_ACCT_V3 is not set 5.27 +CONFIG_SYSCTL=y 5.28 +# CONFIG_AUDIT is not set 5.29 +CONFIG_IKCONFIG=y 5.30 +CONFIG_IKCONFIG_PROC=y 5.31 +# CONFIG_CPUSETS is not set 5.32 +CONFIG_INITRAMFS_SOURCE="" 5.33 +CONFIG_CC_OPTIMIZE_FOR_SIZE=y 5.34 +# CONFIG_EMBEDDED is not set 5.35 +CONFIG_KALLSYMS=y 5.36 +CONFIG_KALLSYMS_ALL=y 5.37 +CONFIG_KALLSYMS_EXTRA_PASS=y 5.38 +CONFIG_HOTPLUG=y 5.39 +CONFIG_PRINTK=y 5.40 +CONFIG_BUG=y 5.41 +CONFIG_ELF_CORE=y 5.42 +CONFIG_BASE_FULL=y 5.43 +CONFIG_FUTEX=y 5.44 +CONFIG_EPOLL=y 5.45 +CONFIG_SHMEM=y 5.46 +CONFIG_CC_ALIGN_FUNCTIONS=0 5.47 +CONFIG_CC_ALIGN_LABELS=0 5.48 +CONFIG_CC_ALIGN_LOOPS=0 5.49 +CONFIG_CC_ALIGN_JUMPS=0 5.50 +CONFIG_SLAB=y 5.51 +# CONFIG_TINY_SHMEM is not set 5.52 +CONFIG_BASE_SMALL=0 5.53 +# CONFIG_SLOB is not set 5.54 + 5.55 +# 5.56 +# Loadable module support 5.57 +# 5.58 +CONFIG_MODULES=y 5.59 +CONFIG_MODULE_UNLOAD=y 5.60 +# CONFIG_MODULE_FORCE_UNLOAD is not set 5.61 +CONFIG_OBSOLETE_MODPARM=y 5.62 +CONFIG_MODVERSIONS=y 5.63 +CONFIG_MODULE_SRCVERSION_ALL=y 5.64 +CONFIG_KMOD=y 5.65 +CONFIG_STOP_MACHINE=y 5.66 + 5.67 +# 5.68 +# Block layer 5.69 +# 5.70 + 5.71 +# 5.72 +# IO Schedulers 5.73 +# 5.74 +CONFIG_IOSCHED_NOOP=y 5.75 +CONFIG_IOSCHED_AS=y 5.76 +CONFIG_IOSCHED_DEADLINE=y 5.77 +CONFIG_IOSCHED_CFQ=y 5.78 +CONFIG_DEFAULT_AS=y 5.79 +# CONFIG_DEFAULT_DEADLINE is not set 5.80 +# CONFIG_DEFAULT_CFQ is not set 5.81 +# CONFIG_DEFAULT_NOOP is not set 5.82 +CONFIG_DEFAULT_IOSCHED="anticipatory" 5.83 + 5.84 +# 5.85 +# Processor type and features 5.86 +# 5.87 +CONFIG_IA64=y 5.88 +CONFIG_64BIT=y 5.89 +CONFIG_MMU=y 5.90 +CONFIG_SWIOTLB=y 5.91 +CONFIG_RWSEM_XCHGADD_ALGORITHM=y 5.92 +CONFIG_GENERIC_CALIBRATE_DELAY=y 5.93 +CONFIG_TIME_INTERPOLATION=y 5.94 +CONFIG_EFI=y 5.95 +CONFIG_GENERIC_IOMAP=y 5.96 +CONFIG_XEN=y 5.97 +CONFIG_ARCH_XEN=y 5.98 +CONFIG_XEN_PRIVILEGED_GUEST=y 5.99 +CONFIG_XEN_BLKDEV_GRANT=y 5.100 +CONFIG_XEN_BLKDEV_FRONTEND=y 5.101 +CONFIG_XEN_BLKDEV_BACKEND=y 5.102 +CONFIG_XEN_SYSFS=y 5.103 +CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 5.104 +CONFIG_DMA_IS_DMA32=y 5.105 +# CONFIG_IA64_GENERIC is not set 5.106 +CONFIG_IA64_DIG=y 5.107 +# CONFIG_IA64_HP_ZX1 is not set 5.108 +# CONFIG_IA64_HP_ZX1_SWIOTLB is not set 5.109 +# CONFIG_IA64_SGI_SN2 is not set 5.110 +# CONFIG_IA64_HP_SIM is not set 5.111 +# CONFIG_ITANIUM is not set 5.112 +CONFIG_MCKINLEY=y 5.113 +# CONFIG_IA64_PAGE_SIZE_4KB is not set 5.114 +# CONFIG_IA64_PAGE_SIZE_8KB is not set 5.115 +CONFIG_IA64_PAGE_SIZE_16KB=y 5.116 +# CONFIG_IA64_PAGE_SIZE_64KB is not set 5.117 +CONFIG_PGTABLE_3=y 5.118 +# CONFIG_PGTABLE_4 is not set 5.119 +CONFIG_HZ_100=y 5.120 +# CONFIG_HZ_250 is not set 5.121 +# CONFIG_HZ_1000 is not set 5.122 +CONFIG_HZ=100 5.123 +CONFIG_IA64_L1_CACHE_SHIFT=7 5.124 +CONFIG_IA64_CYCLONE=y 5.125 +CONFIG_IOSAPIC=y 5.126 +CONFIG_FORCE_MAX_ZONEORDER=11 5.127 +CONFIG_SMP=y 5.128 +CONFIG_NR_CPUS=4 5.129 +CONFIG_HOTPLUG_CPU=y 5.130 +# CONFIG_SCHED_SMT is not set 5.131 +# CONFIG_PREEMPT is not set 5.132 +CONFIG_SELECT_MEMORY_MODEL=y 5.133 +CONFIG_FLATMEM_MANUAL=y 5.134 +# CONFIG_DISCONTIGMEM_MANUAL is not set 5.135 +# CONFIG_SPARSEMEM_MANUAL is not set 5.136 +CONFIG_FLATMEM=y 5.137 +CONFIG_FLAT_NODE_MEM_MAP=y 5.138 +# CONFIG_SPARSEMEM_STATIC is not set 5.139 +CONFIG_SPLIT_PTLOCK_CPUS=4 5.140 +CONFIG_ARCH_SELECT_MEMORY_MODEL=y 5.141 +CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 5.142 +CONFIG_ARCH_FLATMEM_ENABLE=y 5.143 +CONFIG_ARCH_SPARSEMEM_ENABLE=y 5.144 +# CONFIG_VIRTUAL_MEM_MAP is not set 5.145 +# CONFIG_IA32_SUPPORT is not set 5.146 +CONFIG_IA64_MCA_RECOVERY=y 5.147 +CONFIG_PERFMON=y 5.148 +CONFIG_IA64_PALINFO=y 5.149 + 5.150 +# 5.151 +# Firmware Drivers 5.152 +# 5.153 +CONFIG_EFI_VARS=y 5.154 +CONFIG_EFI_PCDP=y 5.155 +CONFIG_BINFMT_ELF=y 5.156 +CONFIG_BINFMT_MISC=y 5.157 + 5.158 +# 5.159 +# Power management and ACPI 5.160 +# 5.161 +CONFIG_PM=y 5.162 +CONFIG_PM_LEGACY=y 5.163 +# CONFIG_PM_DEBUG is not set 5.164 + 5.165 +# 5.166 +# ACPI (Advanced Configuration and Power Interface) Support 5.167 +# 5.168 +CONFIG_ACPI=y 5.169 +CONFIG_ACPI_BUTTON=y 5.170 +CONFIG_ACPI_FAN=y 5.171 +CONFIG_ACPI_PROCESSOR=y 5.172 +CONFIG_ACPI_HOTPLUG_CPU=y 5.173 +CONFIG_ACPI_THERMAL=y 5.174 +CONFIG_ACPI_BLACKLIST_YEAR=0 5.175 +# CONFIG_ACPI_DEBUG is not set 5.176 +CONFIG_ACPI_EC=y 5.177 +CONFIG_ACPI_POWER=y 5.178 +CONFIG_ACPI_SYSTEM=y 5.179 +CONFIG_ACPI_CONTAINER=y 5.180 + 5.181 +# 5.182 +# CPU Frequency scaling 5.183 +# 5.184 +# CONFIG_CPU_FREQ is not set 5.185 + 5.186 +# 5.187 +# Bus options (PCI, PCMCIA) 5.188 +# 5.189 +CONFIG_PCI=y 5.190 +CONFIG_PCI_DOMAINS=y 5.191 +CONFIG_PCI_LEGACY_PROC=y 5.192 +# CONFIG_PCI_DEBUG is not set 5.193 + 5.194 +# 5.195 +# PCI Hotplug Support 5.196 +# 5.197 +CONFIG_HOTPLUG_PCI=y 5.198 +# CONFIG_HOTPLUG_PCI_FAKE is not set 5.199 +CONFIG_HOTPLUG_PCI_ACPI=y 5.200 +# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set 5.201 +# CONFIG_HOTPLUG_PCI_CPCI is not set 5.202 +# CONFIG_HOTPLUG_PCI_SHPC is not set 5.203 + 5.204 +# 5.205 +# PCCARD (PCMCIA/CardBus) support 5.206 +# 5.207 +# CONFIG_PCCARD is not set 5.208 + 5.209 +# 5.210 +# Networking 5.211 +# 5.212 +CONFIG_NET=y 5.213 + 5.214 +# 5.215 +# Networking options 5.216 +# 5.217 +# CONFIG_NETDEBUG is not set 5.218 +CONFIG_PACKET=y 5.219 +# CONFIG_PACKET_MMAP is not set 5.220 +CONFIG_UNIX=y 5.221 +# CONFIG_NET_KEY is not set 5.222 +CONFIG_INET=y 5.223 +CONFIG_IP_MULTICAST=y 5.224 +# CONFIG_IP_ADVANCED_ROUTER is not set 5.225 +CONFIG_IP_FIB_HASH=y 5.226 +# CONFIG_IP_PNP is not set 5.227 +# CONFIG_NET_IPIP is not set 5.228 +# CONFIG_NET_IPGRE is not set 5.229 +# CONFIG_IP_MROUTE is not set 5.230 +CONFIG_ARPD=y 5.231 +CONFIG_SYN_COOKIES=y 5.232 +# CONFIG_INET_AH is not set 5.233 +# CONFIG_INET_ESP is not set 5.234 +# CONFIG_INET_IPCOMP is not set 5.235 +# CONFIG_INET_TUNNEL is not set 5.236 +CONFIG_INET_DIAG=y 5.237 +CONFIG_INET_TCP_DIAG=y 5.238 +# CONFIG_TCP_CONG_ADVANCED is not set 5.239 +CONFIG_TCP_CONG_BIC=y 5.240 + 5.241 +# 5.242 +# IP: Virtual Server Configuration 5.243 +# 5.244 +# CONFIG_IP_VS is not set 5.245 +# CONFIG_IPV6 is not set 5.246 +CONFIG_NETFILTER=y 5.247 +# CONFIG_NETFILTER_DEBUG is not set 5.248 +CONFIG_BRIDGE_NETFILTER=y 5.249 + 5.250 +# 5.251 +# Core Netfilter Configuration 5.252 +# 5.253 +# CONFIG_NETFILTER_NETLINK is not set 5.254 +# CONFIG_NF_CONNTRACK is not set 5.255 +# CONFIG_NETFILTER_XTABLES is not set 5.256 + 5.257 +# 5.258 +# IP: Netfilter Configuration 5.259 +# 5.260 +# CONFIG_IP_NF_CONNTRACK is not set 5.261 +# CONFIG_IP_NF_QUEUE is not set 5.262 + 5.263 +# 5.264 +# Bridge: Netfilter Configuration 5.265 +# 5.266 +# CONFIG_BRIDGE_NF_EBTABLES is not set 5.267 + 5.268 +# 5.269 +# DCCP Configuration (EXPERIMENTAL) 5.270 +# 5.271 +# CONFIG_IP_DCCP is not set 5.272 + 5.273 +# 5.274 +# SCTP Configuration (EXPERIMENTAL) 5.275 +# 5.276 +# CONFIG_IP_SCTP is not set 5.277 + 5.278 +# 5.279 +# TIPC Configuration (EXPERIMENTAL) 5.280 +# 5.281 +# CONFIG_TIPC is not set 5.282 +# CONFIG_ATM is not set 5.283 +CONFIG_BRIDGE=y 5.284 +# CONFIG_VLAN_8021Q is not set 5.285 +# CONFIG_DECNET is not set 5.286 +# CONFIG_LLC2 is not set 5.287 +# CONFIG_IPX is not set 5.288 +# CONFIG_ATALK is not set 5.289 +# CONFIG_X25 is not set 5.290 +# CONFIG_LAPB is not set 5.291 +# CONFIG_NET_DIVERT is not set 5.292 +# CONFIG_ECONET is not set 5.293 +# CONFIG_WAN_ROUTER is not set 5.294 + 5.295 +# 5.296 +# QoS and/or fair queueing 5.297 +# 5.298 +# CONFIG_NET_SCHED is not set 5.299 + 5.300 +# 5.301 +# Network testing 5.302 +# 5.303 +# CONFIG_NET_PKTGEN is not set 5.304 +# CONFIG_HAMRADIO is not set 5.305 +# CONFIG_IRDA is not set 5.306 +# CONFIG_BT is not set 5.307 +# CONFIG_IEEE80211 is not set 5.308 + 5.309 +# 5.310 +# Device Drivers 5.311 +# 5.312 + 5.313 +# 5.314 +# Generic Driver Options 5.315 +# 5.316 +CONFIG_STANDALONE=y 5.317 +CONFIG_PREVENT_FIRMWARE_BUILD=y 5.318 +CONFIG_FW_LOADER=y 5.319 +# CONFIG_DEBUG_DRIVER is not set 5.320 + 5.321 +# 5.322 +# Connector - unified userspace <-> kernelspace linker 5.323 +# 5.324 +# CONFIG_CONNECTOR is not set 5.325 + 5.326 +# 5.327 +# Memory Technology Devices (MTD) 5.328 +# 5.329 +# CONFIG_MTD is not set 5.330 + 5.331 +# 5.332 +# Parallel port support 5.333 +# 5.334 +# CONFIG_PARPORT is not set 5.335 + 5.336 +# 5.337 +# Plug and Play support 5.338 +# 5.339 +# CONFIG_PNP is not set 5.340 + 5.341 +# 5.342 +# Block devices 5.343 +# 5.344 +# CONFIG_BLK_CPQ_DA is not set 5.345 +# CONFIG_BLK_CPQ_CISS_DA is not set 5.346 +# CONFIG_BLK_DEV_DAC960 is not set 5.347 +# CONFIG_BLK_DEV_UMEM is not set 5.348 +# CONFIG_BLK_DEV_COW_COMMON is not set 5.349 +CONFIG_BLK_DEV_LOOP=y 5.350 +CONFIG_BLK_DEV_CRYPTOLOOP=y 5.351 +CONFIG_BLK_DEV_NBD=y 5.352 +# CONFIG_BLK_DEV_SX8 is not set 5.353 +# CONFIG_BLK_DEV_UB is not set 5.354 +CONFIG_BLK_DEV_RAM=y 5.355 +CONFIG_BLK_DEV_RAM_COUNT=16 5.356 +CONFIG_BLK_DEV_RAM_SIZE=4096 5.357 +CONFIG_BLK_DEV_INITRD=y 5.358 +# CONFIG_CDROM_PKTCDVD is not set 5.359 +# CONFIG_ATA_OVER_ETH is not set 5.360 + 5.361 +# 5.362 +# ATA/ATAPI/MFM/RLL support 5.363 +# 5.364 +CONFIG_IDE=y 5.365 +CONFIG_IDE_MAX_HWIFS=4 5.366 +CONFIG_BLK_DEV_IDE=y 5.367 + 5.368 +# 5.369 +# Please see Documentation/ide.txt for help/info on IDE drives 5.370 +# 5.371 +# CONFIG_BLK_DEV_IDE_SATA is not set 5.372 +CONFIG_BLK_DEV_IDEDISK=y 5.373 +# CONFIG_IDEDISK_MULTI_MODE is not set 5.374 +CONFIG_BLK_DEV_IDECD=y 5.375 +# CONFIG_BLK_DEV_IDETAPE is not set 5.376 +CONFIG_BLK_DEV_IDEFLOPPY=y 5.377 +CONFIG_BLK_DEV_IDESCSI=y 5.378 +# CONFIG_IDE_TASK_IOCTL is not set 5.379 + 5.380 +# 5.381 +# IDE chipset support/bugfixes 5.382 +# 5.383 +# CONFIG_IDE_GENERIC is not set 5.384 +CONFIG_BLK_DEV_IDEPCI=y 5.385 +# CONFIG_IDEPCI_SHARE_IRQ is not set 5.386 +# CONFIG_BLK_DEV_OFFBOARD is not set 5.387 +CONFIG_BLK_DEV_GENERIC=y 5.388 +# CONFIG_BLK_DEV_OPTI621 is not set 5.389 +CONFIG_BLK_DEV_IDEDMA_PCI=y 5.390 +# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 5.391 +CONFIG_IDEDMA_PCI_AUTO=y 5.392 +# CONFIG_IDEDMA_ONLYDISK is not set 5.393 +# CONFIG_BLK_DEV_AEC62XX is not set 5.394 +# CONFIG_BLK_DEV_ALI15X3 is not set 5.395 +# CONFIG_BLK_DEV_AMD74XX is not set 5.396 +CONFIG_BLK_DEV_CMD64X=y 5.397 +# CONFIG_BLK_DEV_TRIFLEX is not set 5.398 +# CONFIG_BLK_DEV_CY82C693 is not set 5.399 +# CONFIG_BLK_DEV_CS5520 is not set 5.400 +# CONFIG_BLK_DEV_CS5530 is not set 5.401 +# CONFIG_BLK_DEV_HPT34X is not set 5.402 +# CONFIG_BLK_DEV_HPT366 is not set 5.403 +# CONFIG_BLK_DEV_SC1200 is not set 5.404 +CONFIG_BLK_DEV_PIIX=y 5.405 +# CONFIG_BLK_DEV_IT821X is not set 5.406 +# CONFIG_BLK_DEV_NS87415 is not set 5.407 +# CONFIG_BLK_DEV_PDC202XX_OLD is not set 5.408 +# CONFIG_BLK_DEV_PDC202XX_NEW is not set 5.409 +# CONFIG_BLK_DEV_SVWKS is not set 5.410 +# CONFIG_BLK_DEV_SIIMAGE is not set 5.411 +# CONFIG_BLK_DEV_SLC90E66 is not set 5.412 +# CONFIG_BLK_DEV_TRM290 is not set 5.413 +# CONFIG_BLK_DEV_VIA82CXXX is not set 5.414 +# CONFIG_IDE_ARM is not set 5.415 +CONFIG_BLK_DEV_IDEDMA=y 5.416 +# CONFIG_IDEDMA_IVB is not set 5.417 +CONFIG_IDEDMA_AUTO=y 5.418 +# CONFIG_BLK_DEV_HD is not set 5.419 + 5.420 +# 5.421 +# SCSI device support 5.422 +# 5.423 +# CONFIG_RAID_ATTRS is not set 5.424 +CONFIG_SCSI=y 5.425 +CONFIG_SCSI_PROC_FS=y 5.426 + 5.427 +# 5.428 +# SCSI support type (disk, tape, CD-ROM) 5.429 +# 5.430 +CONFIG_BLK_DEV_SD=y 5.431 +CONFIG_CHR_DEV_ST=y 5.432 +CONFIG_CHR_DEV_OSST=y 5.433 +CONFIG_BLK_DEV_SR=y 5.434 +CONFIG_BLK_DEV_SR_VENDOR=y 5.435 +CONFIG_CHR_DEV_SG=y 5.436 +# CONFIG_CHR_DEV_SCH is not set 5.437 + 5.438 +# 5.439 +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 5.440 +# 5.441 +CONFIG_SCSI_MULTI_LUN=y 5.442 +CONFIG_SCSI_CONSTANTS=y 5.443 +CONFIG_SCSI_LOGGING=y 5.444 + 5.445 +# 5.446 +# SCSI Transport Attributes 5.447 +# 5.448 +CONFIG_SCSI_SPI_ATTRS=y 5.449 +CONFIG_SCSI_FC_ATTRS=y 5.450 +# CONFIG_SCSI_ISCSI_ATTRS is not set 5.451 +CONFIG_SCSI_SAS_ATTRS=y 5.452 + 5.453 +# 5.454 +# SCSI low-level drivers 5.455 +# 5.456 +# CONFIG_ISCSI_TCP is not set 5.457 +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 5.458 +# CONFIG_SCSI_3W_9XXX is not set 5.459 +# CONFIG_SCSI_ACARD is not set 5.460 +# CONFIG_SCSI_AACRAID is not set 5.461 +# CONFIG_SCSI_AIC7XXX is not set 5.462 +# CONFIG_SCSI_AIC7XXX_OLD is not set 5.463 +# CONFIG_SCSI_AIC79XX is not set 5.464 +# CONFIG_MEGARAID_NEWGEN is not set 5.465 +# CONFIG_MEGARAID_LEGACY is not set 5.466 +# CONFIG_MEGARAID_SAS is not set 5.467 +# CONFIG_SCSI_SATA is not set 5.468 +# CONFIG_SCSI_DMX3191D is not set 5.469 +# CONFIG_SCSI_FUTURE_DOMAIN is not set 5.470 +# CONFIG_SCSI_IPS is not set 5.471 +# CONFIG_SCSI_INITIO is not set 5.472 +# CONFIG_SCSI_INIA100 is not set 5.473 +CONFIG_SCSI_SYM53C8XX_2=y 5.474 +CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 5.475 +CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 5.476 +CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 5.477 +# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 5.478 +# CONFIG_SCSI_IPR is not set 5.479 +CONFIG_SCSI_QLOGIC_FC=y 5.480 +# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set 5.481 +CONFIG_SCSI_QLOGIC_1280=y 5.482 +# CONFIG_SCSI_QLA_FC is not set 5.483 +# CONFIG_SCSI_LPFC is not set 5.484 +# CONFIG_SCSI_DC395x is not set 5.485 +# CONFIG_SCSI_DC390T is not set 5.486 +# CONFIG_SCSI_DEBUG is not set 5.487 + 5.488 +# 5.489 +# Multi-device support (RAID and LVM) 5.490 +# 5.491 +CONFIG_MD=y 5.492 +# CONFIG_BLK_DEV_MD is not set 5.493 +# CONFIG_BLK_DEV_DM is not set 5.494 + 5.495 +# 5.496 +# Fusion MPT device support 5.497 +# 5.498 +CONFIG_FUSION=y 5.499 +CONFIG_FUSION_SPI=y 5.500 +# CONFIG_FUSION_FC is not set 5.501 +CONFIG_FUSION_SAS=y 5.502 +CONFIG_FUSION_MAX_SGE=128 5.503 +# CONFIG_FUSION_CTL is not set 5.504 + 5.505 +# 5.506 +# IEEE 1394 (FireWire) support 5.507 +# 5.508 +# CONFIG_IEEE1394 is not set 5.509 + 5.510 +# 5.511 +# I2O device support 5.512 +# 5.513 +# CONFIG_I2O is not set 5.514 + 5.515 +# 5.516 +# Network device support 5.517 +# 5.518 +CONFIG_NETDEVICES=y 5.519 +CONFIG_DUMMY=y 5.520 +# CONFIG_BONDING is not set 5.521 +# CONFIG_EQUALIZER is not set 5.522 +CONFIG_TUN=y 5.523 + 5.524 +# 5.525 +# ARCnet devices 5.526 +# 5.527 +CONFIG_ARCNET=y 5.528 +# CONFIG_ARCNET_1201 is not set 5.529 +# CONFIG_ARCNET_1051 is not set 5.530 +# CONFIG_ARCNET_RAW is not set 5.531 +# CONFIG_ARCNET_CAP is not set 5.532 +# CONFIG_ARCNET_COM90xx is not set 5.533 +# CONFIG_ARCNET_COM90xxIO is not set 5.534 +# CONFIG_ARCNET_RIM_I is not set 5.535 +# CONFIG_ARCNET_COM20020 is not set 5.536 + 5.537 +# 5.538 +# PHY device support 5.539 +# 5.540 +# CONFIG_PHYLIB is not set 5.541 + 5.542 +# 5.543 +# Ethernet (10 or 100Mbit) 5.544 +# 5.545 +CONFIG_NET_ETHERNET=y 5.546 +CONFIG_MII=y 5.547 +# CONFIG_HAPPYMEAL is not set 5.548 +# CONFIG_SUNGEM is not set 5.549 +# CONFIG_CASSINI is not set 5.550 +# CONFIG_NET_VENDOR_3COM is not set 5.551 + 5.552 +# 5.553 +# Tulip family network device support 5.554 +# 5.555 +CONFIG_NET_TULIP=y 5.556 +# CONFIG_DE2104X is not set 5.557 +CONFIG_TULIP=y 5.558 +CONFIG_TULIP_MWI=y 5.559 +CONFIG_TULIP_MMIO=y 5.560 +CONFIG_TULIP_NAPI=y 5.561 +CONFIG_TULIP_NAPI_HW_MITIGATION=y 5.562 +# CONFIG_DE4X5 is not set 5.563 +# CONFIG_WINBOND_840 is not set 5.564 +# CONFIG_DM9102 is not set 5.565 +# CONFIG_ULI526X is not set 5.566 +# CONFIG_HP100 is not set 5.567 +CONFIG_NET_PCI=y 5.568 +# CONFIG_PCNET32 is not set 5.569 +# CONFIG_AMD8111_ETH is not set 5.570 +# CONFIG_ADAPTEC_STARFIRE is not set 5.571 +# CONFIG_B44 is not set 5.572 +# CONFIG_FORCEDETH is not set 5.573 +# CONFIG_DGRS is not set 5.574 +CONFIG_EEPRO100=y 5.575 +CONFIG_E100=y 5.576 +# CONFIG_FEALNX is not set 5.577 +# CONFIG_NATSEMI is not set 5.578 +# CONFIG_NE2K_PCI is not set 5.579 +# CONFIG_8139CP is not set 5.580 +# CONFIG_8139TOO is not set 5.581 +# CONFIG_SIS900 is not set 5.582 +# CONFIG_EPIC100 is not set 5.583 +# CONFIG_SUNDANCE is not set 5.584 +# CONFIG_VIA_RHINE is not set 5.585 + 5.586 +# 5.587 +# Ethernet (1000 Mbit) 5.588 +# 5.589 +# CONFIG_ACENIC is not set 5.590 +# CONFIG_DL2K is not set 5.591 +CONFIG_E1000=y 5.592 +# CONFIG_E1000_NAPI is not set 5.593 +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 5.594 +# CONFIG_NS83820 is not set 5.595 +# CONFIG_HAMACHI is not set 5.596 +# CONFIG_YELLOWFIN is not set 5.597 +# CONFIG_R8169 is not set 5.598 +# CONFIG_SIS190 is not set 5.599 +# CONFIG_SKGE is not set 5.600 +# CONFIG_SKY2 is not set 5.601 +# CONFIG_SK98LIN is not set 5.602 +# CONFIG_VIA_VELOCITY is not set 5.603 +CONFIG_TIGON3=y 5.604 +# CONFIG_BNX2 is not set 5.605 + 5.606 +# 5.607 +# Ethernet (10000 Mbit) 5.608 +# 5.609 +# CONFIG_CHELSIO_T1 is not set 5.610 +# CONFIG_IXGB is not set 5.611 +# CONFIG_S2IO is not set 5.612 + 5.613 +# 5.614 +# Token Ring devices 5.615 +# 5.616 +# CONFIG_TR is not set 5.617 + 5.618 +# 5.619 +# Wireless LAN (non-hamradio) 5.620 +# 5.621 +# CONFIG_NET_RADIO is not set 5.622 + 5.623 +# 5.624 +# Wan interfaces 5.625 +# 5.626 +# CONFIG_WAN is not set 5.627 +# CONFIG_FDDI is not set 5.628 +# CONFIG_HIPPI is not set 5.629 +# CONFIG_PPP is not set 5.630 +# CONFIG_SLIP is not set 5.631 +# CONFIG_NET_FC is not set 5.632 +# CONFIG_SHAPER is not set 5.633 +CONFIG_NETCONSOLE=y 5.634 +CONFIG_NETPOLL=y 5.635 +# CONFIG_NETPOLL_RX is not set 5.636 +# CONFIG_NETPOLL_TRAP is not set 5.637 +CONFIG_NET_POLL_CONTROLLER=y 5.638 + 5.639 +# 5.640 +# ISDN subsystem 5.641 +# 5.642 +CONFIG_ISDN=m 5.643 + 5.644 +# 5.645 +# Old ISDN4Linux 5.646 +# 5.647 +# CONFIG_ISDN_I4L is not set 5.648 + 5.649 +# 5.650 +# CAPI subsystem 5.651 +# 5.652 +# CONFIG_ISDN_CAPI is not set 5.653 + 5.654 +# 5.655 +# Telephony Support 5.656 +# 5.657 +# CONFIG_PHONE is not set 5.658 + 5.659 +# 5.660 +# Input device support 5.661 +# 5.662 +CONFIG_INPUT=y 5.663 + 5.664 +# 5.665 +# Userland interfaces 5.666 +# 5.667 +CONFIG_INPUT_MOUSEDEV=y 5.668 +CONFIG_INPUT_MOUSEDEV_PSAUX=y 5.669 +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 5.670 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 5.671 +CONFIG_INPUT_JOYDEV=y 5.672 +# CONFIG_INPUT_TSDEV is not set 5.673 +CONFIG_INPUT_EVDEV=y 5.674 +# CONFIG_INPUT_EVBUG is not set 5.675 + 5.676 +# 5.677 +# Input Device Drivers 5.678 +# 5.679 +CONFIG_INPUT_KEYBOARD=y 5.680 +CONFIG_KEYBOARD_ATKBD=y 5.681 +# CONFIG_KEYBOARD_SUNKBD is not set 5.682 +# CONFIG_KEYBOARD_LKKBD is not set 5.683 +# CONFIG_KEYBOARD_XTKBD is not set 5.684 +# CONFIG_KEYBOARD_NEWTON is not set 5.685 +CONFIG_INPUT_MOUSE=y 5.686 +CONFIG_MOUSE_PS2=y 5.687 +# CONFIG_MOUSE_SERIAL is not set 5.688 +# CONFIG_MOUSE_VSXXXAA is not set 5.689 +# CONFIG_INPUT_JOYSTICK is not set 5.690 +# CONFIG_INPUT_TOUCHSCREEN is not set 5.691 +# CONFIG_INPUT_MISC is not set 5.692 + 5.693 +# 5.694 +# Hardware I/O ports 5.695 +# 5.696 +CONFIG_SERIO=y 5.697 +CONFIG_SERIO_I8042=y 5.698 +# CONFIG_SERIO_SERPORT is not set 5.699 +# CONFIG_SERIO_PCIPS2 is not set 5.700 +CONFIG_SERIO_LIBPS2=y 5.701 +# CONFIG_SERIO_RAW is not set 5.702 +CONFIG_GAMEPORT=y 5.703 +# CONFIG_GAMEPORT_NS558 is not set 5.704 +# CONFIG_GAMEPORT_L4 is not set 5.705 +# CONFIG_GAMEPORT_EMU10K1 is not set 5.706 +# CONFIG_GAMEPORT_FM801 is not set 5.707 + 5.708 +# 5.709 +# Character devices 5.710 +# 5.711 +CONFIG_VT=y 5.712 +CONFIG_VT_CONSOLE=y 5.713 +CONFIG_HW_CONSOLE=y 5.714 +CONFIG_SERIAL_NONSTANDARD=y 5.715 +# CONFIG_COMPUTONE is not set 5.716 +# CONFIG_ROCKETPORT is not set 5.717 +# CONFIG_CYCLADES is not set 5.718 +# CONFIG_DIGIEPCA is not set 5.719 +# CONFIG_MOXA_INTELLIO is not set 5.720 +# CONFIG_MOXA_SMARTIO is not set 5.721 +# CONFIG_ISI is not set 5.722 +# CONFIG_SYNCLINKMP is not set 5.723 +# CONFIG_SYNCLINK_GT is not set 5.724 +# CONFIG_N_HDLC is not set 5.725 +# CONFIG_SPECIALIX is not set 5.726 +# CONFIG_SX is not set 5.727 +# CONFIG_STALDRV is not set 5.728 + 5.729 +# 5.730 +# Serial drivers 5.731 +# 5.732 +CONFIG_SERIAL_8250=y 5.733 +CONFIG_SERIAL_8250_CONSOLE=y 5.734 +CONFIG_SERIAL_8250_ACPI=y 5.735 +CONFIG_SERIAL_8250_NR_UARTS=6 5.736 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 5.737 +CONFIG_SERIAL_8250_EXTENDED=y 5.738 +CONFIG_SERIAL_8250_SHARE_IRQ=y 5.739 +# CONFIG_SERIAL_8250_DETECT_IRQ is not set 5.740 +# CONFIG_SERIAL_8250_RSA is not set 5.741 + 5.742 +# 5.743 +# Non-8250 serial port support 5.744 +# 5.745 +CONFIG_SERIAL_CORE=y 5.746 +CONFIG_SERIAL_CORE_CONSOLE=y 5.747 +# CONFIG_SERIAL_JSM is not set 5.748 +CONFIG_UNIX98_PTYS=y 5.749 +CONFIG_LEGACY_PTYS=y 5.750 +CONFIG_LEGACY_PTY_COUNT=256 5.751 + 5.752 +# 5.753 +# IPMI 5.754 +# 5.755 +# CONFIG_IPMI_HANDLER is not set 5.756 + 5.757 +# 5.758 +# Watchdog Cards 5.759 +# 5.760 +# CONFIG_WATCHDOG is not set 5.761 +# CONFIG_HW_RANDOM is not set 5.762 +CONFIG_EFI_RTC=y 5.763 +# CONFIG_DTLK is not set 5.764 +# CONFIG_R3964 is not set 5.765 +# CONFIG_APPLICOM is not set 5.766 + 5.767 +# 5.768 +# Ftape, the floppy tape device driver 5.769 +# 5.770 +CONFIG_AGP=y 5.771 +CONFIG_AGP_I460=y 5.772 +CONFIG_DRM=y 5.773 +# CONFIG_DRM_TDFX is not set 5.774 +# CONFIG_DRM_R128 is not set 5.775 +# CONFIG_DRM_RADEON is not set 5.776 +# CONFIG_DRM_MGA is not set 5.777 +# CONFIG_DRM_SIS is not set 5.778 +# CONFIG_DRM_VIA is not set 5.779 +# CONFIG_DRM_SAVAGE is not set 5.780 +# CONFIG_RAW_DRIVER is not set 5.781 +# CONFIG_HPET is not set 5.782 +# CONFIG_HANGCHECK_TIMER is not set 5.783 + 5.784 +# 5.785 +# TPM devices 5.786 +# 5.787 +# CONFIG_TCG_TPM is not set 5.788 +# CONFIG_TELCLOCK is not set 5.789 + 5.790 +# 5.791 +# I2C support 5.792 +# 5.793 +CONFIG_I2C=y 5.794 +CONFIG_I2C_CHARDEV=y 5.795 + 5.796 +# 5.797 +# I2C Algorithms 5.798 +# 5.799 +CONFIG_I2C_ALGOBIT=y 5.800 +CONFIG_I2C_ALGOPCF=y 5.801 +# CONFIG_I2C_ALGOPCA is not set 5.802 + 5.803 +# 5.804 +# I2C Hardware Bus support 5.805 +# 5.806 +# CONFIG_I2C_ALI1535 is not set 5.807 +# CONFIG_I2C_ALI1563 is not set 5.808 +# CONFIG_I2C_ALI15X3 is not set 5.809 +# CONFIG_I2C_AMD756 is not set 5.810 +# CONFIG_I2C_AMD8111 is not set 5.811 +# CONFIG_I2C_I801 is not set 5.812 +# CONFIG_I2C_I810 is not set 5.813 +# CONFIG_I2C_PIIX4 is not set 5.814 +# CONFIG_I2C_NFORCE2 is not set 5.815 +# CONFIG_I2C_PARPORT_LIGHT is not set 5.816 +# CONFIG_I2C_PROSAVAGE is not set 5.817 +# CONFIG_I2C_SAVAGE4 is not set 5.818 +# CONFIG_SCx200_ACB is not set 5.819 +# CONFIG_I2C_SIS5595 is not set 5.820 +# CONFIG_I2C_SIS630 is not set 5.821 +# CONFIG_I2C_SIS96X is not set 5.822 +# CONFIG_I2C_STUB is not set 5.823 +# CONFIG_I2C_VIA is not set 5.824 +# CONFIG_I2C_VIAPRO is not set 5.825 +# CONFIG_I2C_VOODOO3 is not set 5.826 +# CONFIG_I2C_PCA_ISA is not set 5.827 + 5.828 +# 5.829 +# Miscellaneous I2C Chip support 5.830 +# 5.831 +# CONFIG_SENSORS_DS1337 is not set 5.832 +# CONFIG_SENSORS_DS1374 is not set 5.833 +# CONFIG_SENSORS_EEPROM is not set 5.834 +# CONFIG_SENSORS_PCF8574 is not set 5.835 +# CONFIG_SENSORS_PCA9539 is not set 5.836 +# CONFIG_SENSORS_PCF8591 is not set 5.837 +# CONFIG_SENSORS_RTC8564 is not set 5.838 +# CONFIG_SENSORS_MAX6875 is not set 5.839 +# CONFIG_RTC_X1205_I2C is not set 5.840 +# CONFIG_I2C_DEBUG_CORE is not set 5.841 +# CONFIG_I2C_DEBUG_ALGO is not set 5.842 +# CONFIG_I2C_DEBUG_BUS is not set 5.843 +# CONFIG_I2C_DEBUG_CHIP is not set 5.844 + 5.845 +# 5.846 +# SPI support 5.847 +# 5.848 +# CONFIG_SPI is not set 5.849 +# CONFIG_SPI_MASTER is not set 5.850 + 5.851 +# 5.852 +# Dallas's 1-wire bus 5.853 +# 5.854 +# CONFIG_W1 is not set 5.855 + 5.856 +# 5.857 +# Hardware Monitoring support 5.858 +# 5.859 +CONFIG_HWMON=y 5.860 +# CONFIG_HWMON_VID is not set 5.861 +# CONFIG_SENSORS_ADM1021 is not set 5.862 +# CONFIG_SENSORS_ADM1025 is not set 5.863 +# CONFIG_SENSORS_ADM1026 is not set 5.864 +# CONFIG_SENSORS_ADM1031 is not set 5.865 +# CONFIG_SENSORS_ADM9240 is not set 5.866 +# CONFIG_SENSORS_ASB100 is not set 5.867 +# CONFIG_SENSORS_ATXP1 is not set 5.868 +# CONFIG_SENSORS_DS1621 is not set 5.869 +# CONFIG_SENSORS_F71805F is not set 5.870 +# CONFIG_SENSORS_FSCHER is not set 5.871 +# CONFIG_SENSORS_FSCPOS is not set 5.872 +# CONFIG_SENSORS_GL518SM is not set 5.873 +# CONFIG_SENSORS_GL520SM is not set 5.874 +# CONFIG_SENSORS_IT87 is not set 5.875 +# CONFIG_SENSORS_LM63 is not set 5.876 +# CONFIG_SENSORS_LM75 is not set 5.877 +# CONFIG_SENSORS_LM77 is not set 5.878 +# CONFIG_SENSORS_LM78 is not set 5.879 +# CONFIG_SENSORS_LM80 is not set 5.880 +# CONFIG_SENSORS_LM83 is not set 5.881 +# CONFIG_SENSORS_LM85 is not set 5.882 +# CONFIG_SENSORS_LM87 is not set 5.883 +# CONFIG_SENSORS_LM90 is not set 5.884 +# CONFIG_SENSORS_LM92 is not set 5.885 +# CONFIG_SENSORS_MAX1619 is not set 5.886 +# CONFIG_SENSORS_PC87360 is not set 5.887 +# CONFIG_SENSORS_SIS5595 is not set 5.888 +# CONFIG_SENSORS_SMSC47M1 is not set 5.889 +# CONFIG_SENSORS_SMSC47B397 is not set 5.890 +# CONFIG_SENSORS_VIA686A is not set 5.891 +# CONFIG_SENSORS_VT8231 is not set 5.892 +# CONFIG_SENSORS_W83781D is not set 5.893 +# CONFIG_SENSORS_W83792D is not set 5.894 +# CONFIG_SENSORS_W83L785TS is not set 5.895 +# CONFIG_SENSORS_W83627HF is not set 5.896 +# CONFIG_SENSORS_W83627EHF is not set 5.897 +# CONFIG_HWMON_DEBUG_CHIP is not set 5.898 + 5.899 +# 5.900 +# Misc devices 5.901 +# 5.902 + 5.903 +# 5.904 +# Multimedia Capabilities Port drivers 5.905 +# 5.906 + 5.907 +# 5.908 +# Multimedia devices 5.909 +# 5.910 +CONFIG_VIDEO_DEV=y 5.911 + 5.912 +# 5.913 +# Video For Linux 5.914 +# 5.915 + 5.916 +# 5.917 +# Video Adapters 5.918 +# 5.919 +# CONFIG_VIDEO_ADV_DEBUG is not set 5.920 +# CONFIG_VIDEO_BT848 is not set 5.921 +# CONFIG_VIDEO_CPIA is not set 5.922 +# CONFIG_VIDEO_SAA5246A is not set 5.923 +# CONFIG_VIDEO_SAA5249 is not set 5.924 +# CONFIG_TUNER_3036 is not set 5.925 +# CONFIG_VIDEO_STRADIS is not set 5.926 +# CONFIG_VIDEO_ZORAN is not set 5.927 +# CONFIG_VIDEO_SAA7134 is not set 5.928 +# CONFIG_VIDEO_MXB is not set 5.929 +# CONFIG_VIDEO_DPC is not set 5.930 +# CONFIG_VIDEO_HEXIUM_ORION is not set 5.931 +# CONFIG_VIDEO_HEXIUM_GEMINI is not set 5.932 +# CONFIG_VIDEO_CX88 is not set 5.933 +# CONFIG_VIDEO_EM28XX is not set 5.934 +# CONFIG_VIDEO_OVCAMCHIP is not set 5.935 +# CONFIG_VIDEO_AUDIO_DECODER is not set 5.936 +# CONFIG_VIDEO_DECODER is not set 5.937 + 5.938 +# 5.939 +# Radio Adapters 5.940 +# 5.941 +# CONFIG_RADIO_GEMTEK_PCI is not set 5.942 +# CONFIG_RADIO_MAXIRADIO is not set 5.943 +# CONFIG_RADIO_MAESTRO is not set 5.944 + 5.945 +# 5.946 +# Digital Video Broadcasting Devices 5.947 +# 5.948 +# CONFIG_DVB is not set 5.949 + 5.950 +# 5.951 +# Graphics support 5.952 +# 5.953 +CONFIG_FB=y 5.954 +CONFIG_FB_CFB_FILLRECT=y 5.955 +CONFIG_FB_CFB_COPYAREA=y 5.956 +CONFIG_FB_CFB_IMAGEBLIT=y 5.957 +# CONFIG_FB_MACMODES is not set 5.958 +CONFIG_FB_MODE_HELPERS=y 5.959 +# CONFIG_FB_TILEBLITTING is not set 5.960 +# CONFIG_FB_CIRRUS is not set 5.961 +# CONFIG_FB_PM2 is not set 5.962 +# CONFIG_FB_CYBER2000 is not set 5.963 +# CONFIG_FB_ASILIANT is not set 5.964 +# CONFIG_FB_IMSTT is not set 5.965 +# CONFIG_FB_S1D13XXX is not set 5.966 +# CONFIG_FB_NVIDIA is not set 5.967 +# CONFIG_FB_RIVA is not set 5.968 +# CONFIG_FB_MATROX is not set 5.969 +# CONFIG_FB_RADEON_OLD is not set 5.970 +CONFIG_FB_RADEON=y 5.971 +CONFIG_FB_RADEON_I2C=y 5.972 +CONFIG_FB_RADEON_DEBUG=y 5.973 +# CONFIG_FB_ATY128 is not set 5.974 +# CONFIG_FB_ATY is not set 5.975 +# CONFIG_FB_SAVAGE is not set 5.976 +# CONFIG_FB_SIS is not set 5.977 +# CONFIG_FB_NEOMAGIC is not set 5.978 +# CONFIG_FB_KYRO is not set 5.979 +# CONFIG_FB_3DFX is not set 5.980 +# CONFIG_FB_VOODOO1 is not set 5.981 +# CONFIG_FB_TRIDENT is not set 5.982 +# CONFIG_FB_VIRTUAL is not set 5.983 + 5.984 +# 5.985 +# Console display driver support 5.986 +# 5.987 +CONFIG_VGA_CONSOLE=y 5.988 +CONFIG_DUMMY_CONSOLE=y 5.989 +# CONFIG_FRAMEBUFFER_CONSOLE is not set 5.990 + 5.991 +# 5.992 +# Logo configuration 5.993 +# 5.994 +CONFIG_LOGO=y 5.995 +# CONFIG_LOGO_LINUX_MONO is not set 5.996 +# CONFIG_LOGO_LINUX_VGA16 is not set 5.997 +CONFIG_LOGO_LINUX_CLUT224=y 5.998 +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 5.999 + 5.1000 +# 5.1001 +# Sound 5.1002 +# 5.1003 +CONFIG_SOUND=y 5.1004 + 5.1005 +# 5.1006 +# Advanced Linux Sound Architecture 5.1007 +# 5.1008 +CONFIG_SND=y 5.1009 +CONFIG_SND_TIMER=y 5.1010 +CONFIG_SND_PCM=y 5.1011 +CONFIG_SND_HWDEP=y 5.1012 +CONFIG_SND_RAWMIDI=y 5.1013 +CONFIG_SND_SEQUENCER=y 5.1014 +CONFIG_SND_SEQ_DUMMY=y 5.1015 +CONFIG_SND_OSSEMUL=y 5.1016 +CONFIG_SND_MIXER_OSS=y 5.1017 +CONFIG_SND_PCM_OSS=y 5.1018 +CONFIG_SND_SEQUENCER_OSS=y 5.1019 +# CONFIG_SND_DYNAMIC_MINORS is not set 5.1020 +CONFIG_SND_SUPPORT_OLD_API=y 5.1021 +# CONFIG_SND_VERBOSE_PRINTK is not set 5.1022 +# CONFIG_SND_DEBUG is not set 5.1023 + 5.1024 +# 5.1025 +# Generic devices 5.1026 +# 5.1027 +CONFIG_SND_MPU401_UART=y 5.1028 +CONFIG_SND_OPL3_LIB=y 5.1029 +CONFIG_SND_AC97_CODEC=y 5.1030 +CONFIG_SND_AC97_BUS=y 5.1031 +CONFIG_SND_DUMMY=y 5.1032 +CONFIG_SND_VIRMIDI=y 5.1033 +CONFIG_SND_MTPAV=y 5.1034 +CONFIG_SND_SERIAL_U16550=y 5.1035 +CONFIG_SND_MPU401=y 5.1036 + 5.1037 +# 5.1038 +# PCI devices 5.1039 +# 5.1040 +# CONFIG_SND_AD1889 is not set 5.1041 +# CONFIG_SND_ALI5451 is not set 5.1042 +CONFIG_SND_ATIIXP=y 5.1043 +# CONFIG_SND_ATIIXP_MODEM is not set 5.1044 +# CONFIG_SND_AU8810 is not set 5.1045 +# CONFIG_SND_AU8820 is not set 5.1046 +# CONFIG_SND_AU8830 is not set 5.1047 +# CONFIG_SND_AZT3328 is not set 5.1048 +# CONFIG_SND_BT87X is not set 5.1049 +# CONFIG_SND_CA0106 is not set 5.1050 +# CONFIG_SND_CMIPCI is not set 5.1051 +# CONFIG_SND_CS4281 is not set 5.1052 +# CONFIG_SND_CS46XX is not set 5.1053 +# CONFIG_SND_EMU10K1 is not set 5.1054 +# CONFIG_SND_EMU10K1X is not set 5.1055 +# CONFIG_SND_ENS1370 is not set 5.1056 +# CONFIG_SND_ENS1371 is not set 5.1057 +# CONFIG_SND_ES1938 is not set 5.1058 +# CONFIG_SND_ES1968 is not set 5.1059 +CONFIG_SND_FM801=y 5.1060 +CONFIG_SND_FM801_TEA575X=y 5.1061 +# CONFIG_SND_HDA_INTEL is not set 5.1062 +# CONFIG_SND_HDSP is not set 5.1063 +# CONFIG_SND_HDSPM is not set 5.1064 +# CONFIG_SND_ICE1712 is not set 5.1065 +# CONFIG_SND_ICE1724 is not set 5.1066 +# CONFIG_SND_INTEL8X0 is not set 5.1067 +# CONFIG_SND_INTEL8X0M is not set 5.1068 +# CONFIG_SND_KORG1212 is not set 5.1069 +# CONFIG_SND_MAESTRO3 is not set 5.1070 +# CONFIG_SND_MIXART is not set 5.1071 +# CONFIG_SND_NM256 is not set 5.1072 +# CONFIG_SND_PCXHR is not set 5.1073 +# CONFIG_SND_RME32 is not set 5.1074 +# CONFIG_SND_RME96 is not set 5.1075 +# CONFIG_SND_RME9652 is not set 5.1076 +# CONFIG_SND_SONICVIBES is not set 5.1077 +# CONFIG_SND_TRIDENT is not set 5.1078 +# CONFIG_SND_VIA82XX is not set 5.1079 +# CONFIG_SND_VIA82XX_MODEM is not set 5.1080 +# CONFIG_SND_VX222 is not set 5.1081 +# CONFIG_SND_YMFPCI is not set 5.1082 + 5.1083 +# 5.1084 +# USB devices 5.1085 +# 5.1086 +# CONFIG_SND_USB_AUDIO is not set 5.1087 + 5.1088 +# 5.1089 +# Open Sound System 5.1090 +# 5.1091 +CONFIG_SOUND_PRIME=y 5.1092 +# CONFIG_OBSOLETE_OSS_DRIVER is not set 5.1093 +# CONFIG_SOUND_FUSION is not set 5.1094 +# CONFIG_SOUND_ICH is not set 5.1095 +# CONFIG_SOUND_TRIDENT is not set 5.1096 +# CONFIG_SOUND_MSNDCLAS is not set 5.1097 +# CONFIG_SOUND_MSNDPIN is not set 5.1098 +# CONFIG_SOUND_TVMIXER is not set 5.1099 + 5.1100 +# 5.1101 +# USB support 5.1102 +# 5.1103 +CONFIG_USB_ARCH_HAS_HCD=y 5.1104 +CONFIG_USB_ARCH_HAS_OHCI=y 5.1105 +CONFIG_USB=y 5.1106 +# CONFIG_USB_DEBUG is not set 5.1107 + 5.1108 +# 5.1109 +# Miscellaneous USB options 5.1110 +# 5.1111 +CONFIG_USB_DEVICEFS=y 5.1112 +CONFIG_USB_BANDWIDTH=y 5.1113 +# CONFIG_USB_DYNAMIC_MINORS is not set 5.1114 +# CONFIG_USB_SUSPEND is not set 5.1115 +# CONFIG_USB_OTG is not set 5.1116 + 5.1117 +# 5.1118 +# USB Host Controller Drivers 5.1119 +# 5.1120 +CONFIG_USB_EHCI_HCD=y 5.1121 +# CONFIG_USB_EHCI_SPLIT_ISO is not set 5.1122 +# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 5.1123 +# CONFIG_USB_ISP116X_HCD is not set 5.1124 +CONFIG_USB_OHCI_HCD=y 5.1125 +# CONFIG_USB_OHCI_BIG_ENDIAN is not set 5.1126 +CONFIG_USB_OHCI_LITTLE_ENDIAN=y 5.1127 +CONFIG_USB_UHCI_HCD=y 5.1128 +# CONFIG_USB_SL811_HCD is not set 5.1129 + 5.1130 +# 5.1131 +# USB Device Class drivers 5.1132 +# 5.1133 +# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set 5.1134 +# CONFIG_USB_ACM is not set 5.1135 +# CONFIG_USB_PRINTER is not set 5.1136 + 5.1137 +# 5.1138 +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 5.1139 +# 5.1140 + 5.1141 +# 5.1142 +# may also be needed; see USB_STORAGE Help for more information 5.1143 +# 5.1144 +CONFIG_USB_STORAGE=y 5.1145 +# CONFIG_USB_STORAGE_DEBUG is not set 5.1146 +# CONFIG_USB_STORAGE_DATAFAB is not set 5.1147 +# CONFIG_USB_STORAGE_FREECOM is not set 5.1148 +# CONFIG_USB_STORAGE_ISD200 is not set 5.1149 +# CONFIG_USB_STORAGE_DPCM is not set 5.1150 +# CONFIG_USB_STORAGE_USBAT is not set 5.1151 +# CONFIG_USB_STORAGE_SDDR09 is not set 5.1152 +# CONFIG_USB_STORAGE_SDDR55 is not set 5.1153 +# CONFIG_USB_STORAGE_JUMPSHOT is not set 5.1154 +# CONFIG_USB_STORAGE_ALAUDA is not set 5.1155 +# CONFIG_USB_LIBUSUAL is not set 5.1156 + 5.1157 +# 5.1158 +# USB Input Devices 5.1159 +# 5.1160 +CONFIG_USB_HID=y 5.1161 +CONFIG_USB_HIDINPUT=y 5.1162 +# CONFIG_USB_HIDINPUT_POWERBOOK is not set 5.1163 +# CONFIG_HID_FF is not set 5.1164 +CONFIG_USB_HIDDEV=y 5.1165 +# CONFIG_USB_AIPTEK is not set 5.1166 +# CONFIG_USB_WACOM is not set 5.1167 +# CONFIG_USB_ACECAD is not set 5.1168 +# CONFIG_USB_KBTAB is not set 5.1169 +# CONFIG_USB_POWERMATE is not set 5.1170 +# CONFIG_USB_MTOUCH is not set 5.1171 +# CONFIG_USB_ITMTOUCH is not set 5.1172 +# CONFIG_USB_EGALAX is not set 5.1173 +# CONFIG_USB_YEALINK is not set 5.1174 +# CONFIG_USB_XPAD is not set 5.1175 +# CONFIG_USB_ATI_REMOTE is not set 5.1176 +# CONFIG_USB_ATI_REMOTE2 is not set 5.1177 +# CONFIG_USB_KEYSPAN_REMOTE is not set 5.1178 +# CONFIG_USB_APPLETOUCH is not set 5.1179 + 5.1180 +# 5.1181 +# USB Imaging devices 5.1182 +# 5.1183 +# CONFIG_USB_MDC800 is not set 5.1184 +# CONFIG_USB_MICROTEK is not set 5.1185 + 5.1186 +# 5.1187 +# USB Multimedia devices 5.1188 +# 5.1189 +# CONFIG_USB_DABUSB is not set 5.1190 +# CONFIG_USB_VICAM is not set 5.1191 +# CONFIG_USB_DSBR is not set 5.1192 +# CONFIG_USB_ET61X251 is not set 5.1193 +# CONFIG_USB_IBMCAM is not set 5.1194 +# CONFIG_USB_KONICAWC is not set 5.1195 +# CONFIG_USB_OV511 is not set 5.1196 +# CONFIG_USB_SE401 is not set 5.1197 +# CONFIG_USB_SN9C102 is not set 5.1198 +# CONFIG_USB_STV680 is not set 5.1199 +# CONFIG_USB_PWC is not set 5.1200 + 5.1201 +# 5.1202 +# USB Network Adapters 5.1203 +# 5.1204 +# CONFIG_USB_CATC is not set 5.1205 +# CONFIG_USB_KAWETH is not set 5.1206 +# CONFIG_USB_PEGASUS is not set 5.1207 +# CONFIG_USB_RTL8150 is not set 5.1208 +# CONFIG_USB_USBNET is not set 5.1209 +CONFIG_USB_MON=y 5.1210 + 5.1211 +# 5.1212 +# USB port drivers 5.1213 +# 5.1214 + 5.1215 +# 5.1216 +# USB Serial Converter support 5.1217 +# 5.1218 +# CONFIG_USB_SERIAL is not set 5.1219 + 5.1220 +# 5.1221 +# USB Miscellaneous drivers 5.1222 +# 5.1223 +# CONFIG_USB_EMI62 is not set 5.1224 +# CONFIG_USB_EMI26 is not set 5.1225 +# CONFIG_USB_AUERSWALD is not set 5.1226 +# CONFIG_USB_RIO500 is not set 5.1227 +# CONFIG_USB_LEGOTOWER is not set 5.1228 +# CONFIG_USB_LCD is not set 5.1229 +# CONFIG_USB_LED is not set 5.1230 +# CONFIG_USB_CYTHERM is not set 5.1231 +# CONFIG_USB_PHIDGETKIT is not set 5.1232 +# CONFIG_USB_PHIDGETSERVO is not set 5.1233 +# CONFIG_USB_IDMOUSE is not set 5.1234 +# CONFIG_USB_SISUSBVGA is not set 5.1235 +# CONFIG_USB_LD is not set 5.1236 +# CONFIG_USB_TEST is not set 5.1237 + 5.1238 +# 5.1239 +# USB DSL modem support 5.1240 +# 5.1241 + 5.1242 +# 5.1243 +# USB Gadget Support 5.1244 +# 5.1245 +# CONFIG_USB_GADGET is not set 5.1246 + 5.1247 +# 5.1248 +# MMC/SD Card support 5.1249 +# 5.1250 +# CONFIG_MMC is not set 5.1251 + 5.1252 +# 5.1253 +# InfiniBand support 5.1254 +# 5.1255 +# CONFIG_INFINIBAND is not set 5.1256 + 5.1257 +# 5.1258 +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 5.1259 +# 5.1260 + 5.1261 +# 5.1262 +# File systems 5.1263 +# 5.1264 +CONFIG_EXT2_FS=y 5.1265 +CONFIG_EXT2_FS_XATTR=y 5.1266 +CONFIG_EXT2_FS_POSIX_ACL=y 5.1267 +CONFIG_EXT2_FS_SECURITY=y 5.1268 +# CONFIG_EXT2_FS_XIP is not set 5.1269 +CONFIG_EXT3_FS=y 5.1270 +CONFIG_EXT3_FS_XATTR=y 5.1271 +CONFIG_EXT3_FS_POSIX_ACL=y 5.1272 +CONFIG_EXT3_FS_SECURITY=y 5.1273 +CONFIG_JBD=y 5.1274 +# CONFIG_JBD_DEBUG is not set 5.1275 +CONFIG_FS_MBCACHE=y 5.1276 +CONFIG_REISERFS_FS=y 5.1277 +# CONFIG_REISERFS_CHECK is not set 5.1278 +# CONFIG_REISERFS_PROC_INFO is not set 5.1279 +CONFIG_REISERFS_FS_XATTR=y 5.1280 +CONFIG_REISERFS_FS_POSIX_ACL=y 5.1281 +CONFIG_REISERFS_FS_SECURITY=y 5.1282 +# CONFIG_JFS_FS is not set 5.1283 +CONFIG_FS_POSIX_ACL=y 5.1284 +CONFIG_XFS_FS=y 5.1285 +CONFIG_XFS_EXPORT=y 5.1286 +# CONFIG_XFS_QUOTA is not set 5.1287 +# CONFIG_XFS_SECURITY is not set 5.1288 +# CONFIG_XFS_POSIX_ACL is not set 5.1289 +# CONFIG_XFS_RT is not set 5.1290 +# CONFIG_OCFS2_FS is not set 5.1291 +# CONFIG_MINIX_FS is not set 5.1292 +# CONFIG_ROMFS_FS is not set 5.1293 +CONFIG_INOTIFY=y 5.1294 +# CONFIG_QUOTA is not set 5.1295 +CONFIG_DNOTIFY=y 5.1296 +CONFIG_AUTOFS_FS=y 5.1297 +CONFIG_AUTOFS4_FS=y 5.1298 +# CONFIG_FUSE_FS is not set 5.1299 + 5.1300 +# 5.1301 +# CD-ROM/DVD Filesystems 5.1302 +# 5.1303 +CONFIG_ISO9660_FS=y 5.1304 +CONFIG_JOLIET=y 5.1305 +# CONFIG_ZISOFS is not set 5.1306 +CONFIG_UDF_FS=y 5.1307 +CONFIG_UDF_NLS=y 5.1308 + 5.1309 +# 5.1310 +# DOS/FAT/NT Filesystems 5.1311 +# 5.1312 +CONFIG_FAT_FS=y 5.1313 +CONFIG_MSDOS_FS=y 5.1314 +CONFIG_VFAT_FS=y 5.1315 +CONFIG_FAT_DEFAULT_CODEPAGE=437 5.1316 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 5.1317 +# CONFIG_NTFS_FS is not set 5.1318 + 5.1319 +# 5.1320 +# Pseudo filesystems 5.1321 +# 5.1322 +CONFIG_PROC_FS=y 5.1323 +CONFIG_PROC_KCORE=y 5.1324 +CONFIG_SYSFS=y 5.1325 +CONFIG_TMPFS=y 5.1326 +# CONFIG_HUGETLB_PAGE is not set 5.1327 +CONFIG_RAMFS=y 5.1328 +# CONFIG_RELAYFS_FS is not set 5.1329 +# CONFIG_CONFIGFS_FS is not set 5.1330 + 5.1331 +# 5.1332 +# Miscellaneous filesystems 5.1333 +# 5.1334 +# CONFIG_ADFS_FS is not set 5.1335 +# CONFIG_AFFS_FS is not set 5.1336 +# CONFIG_HFS_FS is not set 5.1337 +# CONFIG_HFSPLUS_FS is not set 5.1338 +# CONFIG_BEFS_FS is not set 5.1339 +# CONFIG_BFS_FS is not set 5.1340 +# CONFIG_EFS_FS is not set 5.1341 +# CONFIG_CRAMFS is not set 5.1342 +# CONFIG_VXFS_FS is not set 5.1343 +# CONFIG_HPFS_FS is not set 5.1344 +# CONFIG_QNX4FS_FS is not set 5.1345 +# CONFIG_SYSV_FS is not set 5.1346 +# CONFIG_UFS_FS is not set 5.1347 + 5.1348 +# 5.1349 +# Network File Systems 5.1350 +# 5.1351 +CONFIG_NFS_FS=y 5.1352 +CONFIG_NFS_V3=y 5.1353 +# CONFIG_NFS_V3_ACL is not set 5.1354 +CONFIG_NFS_V4=y 5.1355 +CONFIG_NFS_DIRECTIO=y 5.1356 +CONFIG_NFSD=y 5.1357 +CONFIG_NFSD_V3=y 5.1358 +# CONFIG_NFSD_V3_ACL is not set 5.1359 +CONFIG_NFSD_V4=y 5.1360 +CONFIG_NFSD_TCP=y 5.1361 +CONFIG_LOCKD=y 5.1362 +CONFIG_LOCKD_V4=y 5.1363 +CONFIG_EXPORTFS=y 5.1364 +CONFIG_NFS_COMMON=y 5.1365 +CONFIG_SUNRPC=y 5.1366 +CONFIG_SUNRPC_GSS=y 5.1367 +CONFIG_RPCSEC_GSS_KRB5=y 5.1368 +# CONFIG_RPCSEC_GSS_SPKM3 is not set 5.1369 +CONFIG_SMB_FS=y 5.1370 +CONFIG_SMB_NLS_DEFAULT=y 5.1371 +CONFIG_SMB_NLS_REMOTE="cp437" 5.1372 +CONFIG_CIFS=y 5.1373 +# CONFIG_CIFS_STATS is not set 5.1374 +# CONFIG_CIFS_XATTR is not set 5.1375 +# CONFIG_CIFS_EXPERIMENTAL is not set 5.1376 +# CONFIG_NCP_FS is not set 5.1377 +# CONFIG_CODA_FS is not set 5.1378 +# CONFIG_AFS_FS is not set 5.1379 +# CONFIG_9P_FS is not set 5.1380 + 5.1381 +# 5.1382 +# Partition Types 5.1383 +# 5.1384 +CONFIG_PARTITION_ADVANCED=y 5.1385 +# CONFIG_ACORN_PARTITION is not set 5.1386 +# CONFIG_OSF_PARTITION is not set 5.1387 +# CONFIG_AMIGA_PARTITION is not set 5.1388 +# CONFIG_ATARI_PARTITION is not set 5.1389 +# CONFIG_MAC_PARTITION is not set 5.1390 +CONFIG_MSDOS_PARTITION=y 5.1391 +# CONFIG_BSD_DISKLABEL is not set 5.1392 +# CONFIG_MINIX_SUBPARTITION is not set 5.1393 +# CONFIG_SOLARIS_X86_PARTITION is not set 5.1394 +# CONFIG_UNIXWARE_DISKLABEL is not set 5.1395 +# CONFIG_LDM_PARTITION is not set 5.1396 +CONFIG_SGI_PARTITION=y 5.1397 +# CONFIG_ULTRIX_PARTITION is not set 5.1398 +# CONFIG_SUN_PARTITION is not set 5.1399 +# CONFIG_KARMA_PARTITION is not set 5.1400 +CONFIG_EFI_PARTITION=y 5.1401 + 5.1402 +# 5.1403 +# Native Language Support 5.1404 +# 5.1405 +CONFIG_NLS=y 5.1406 +CONFIG_NLS_DEFAULT="iso8859-1" 5.1407 +CONFIG_NLS_CODEPAGE_437=y 5.1408 +CONFIG_NLS_CODEPAGE_737=y 5.1409 +CONFIG_NLS_CODEPAGE_775=y 5.1410 +CONFIG_NLS_CODEPAGE_850=y 5.1411 +CONFIG_NLS_CODEPAGE_852=y 5.1412 +CONFIG_NLS_CODEPAGE_855=y 5.1413 +CONFIG_NLS_CODEPAGE_857=y 5.1414 +CONFIG_NLS_CODEPAGE_860=y 5.1415 +CONFIG_NLS_CODEPAGE_861=y 5.1416 +CONFIG_NLS_CODEPAGE_862=y 5.1417 +CONFIG_NLS_CODEPAGE_863=y 5.1418 +CONFIG_NLS_CODEPAGE_864=y 5.1419 +CONFIG_NLS_CODEPAGE_865=y 5.1420 +CONFIG_NLS_CODEPAGE_866=y 5.1421 +CONFIG_NLS_CODEPAGE_869=y 5.1422 +CONFIG_NLS_CODEPAGE_936=y 5.1423 +CONFIG_NLS_CODEPAGE_950=y 5.1424 +CONFIG_NLS_CODEPAGE_932=y 5.1425 +CONFIG_NLS_CODEPAGE_949=y 5.1426 +CONFIG_NLS_CODEPAGE_874=y 5.1427 +CONFIG_NLS_ISO8859_8=y 5.1428 +# CONFIG_NLS_CODEPAGE_1250 is not set 5.1429 +CONFIG_NLS_CODEPAGE_1251=y 5.1430 +# CONFIG_NLS_ASCII is not set 5.1431 +CONFIG_NLS_ISO8859_1=y 5.1432 +CONFIG_NLS_ISO8859_2=y 5.1433 +CONFIG_NLS_ISO8859_3=y 5.1434 +CONFIG_NLS_ISO8859_4=y 5.1435 +CONFIG_NLS_ISO8859_5=y 5.1436 +CONFIG_NLS_ISO8859_6=y 5.1437 +CONFIG_NLS_ISO8859_7=y 5.1438 +CONFIG_NLS_ISO8859_9=y 5.1439 +CONFIG_NLS_ISO8859_13=y 5.1440 +CONFIG_NLS_ISO8859_14=y 5.1441 +CONFIG_NLS_ISO8859_15=y 5.1442 +CONFIG_NLS_KOI8_R=y 5.1443 +CONFIG_NLS_KOI8_U=y 5.1444 +CONFIG_NLS_UTF8=y 5.1445 + 5.1446 +# 5.1447 +# Library routines 5.1448 +# 5.1449 +# CONFIG_CRC_CCITT is not set 5.1450 +# CONFIG_CRC16 is not set 5.1451 +CONFIG_CRC32=y 5.1452 +# CONFIG_LIBCRC32C is not set 5.1453 +CONFIG_GENERIC_HARDIRQS=y 5.1454 +CONFIG_GENERIC_IRQ_PROBE=y 5.1455 +CONFIG_GENERIC_PENDING_IRQ=y 5.1456 + 5.1457 +# 5.1458 +# Instrumentation Support 5.1459 +# 5.1460 +# CONFIG_PROFILING is not set 5.1461 +# CONFIG_KPROBES is not set 5.1462 + 5.1463 +# 5.1464 +# Kernel hacking 5.1465 +# 5.1466 +# CONFIG_PRINTK_TIME is not set 5.1467 +CONFIG_MAGIC_SYSRQ=y 5.1468 +CONFIG_DEBUG_KERNEL=y 5.1469 +CONFIG_LOG_BUF_SHIFT=20 5.1470 +CONFIG_DETECT_SOFTLOCKUP=y 5.1471 +# CONFIG_SCHEDSTATS is not set 5.1472 +# CONFIG_DEBUG_SLAB is not set 5.1473 +CONFIG_DEBUG_MUTEXES=y 5.1474 +# CONFIG_DEBUG_SPINLOCK is not set 5.1475 +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 5.1476 +# CONFIG_DEBUG_KOBJECT is not set 5.1477 +# CONFIG_DEBUG_INFO is not set 5.1478 +# CONFIG_DEBUG_FS is not set 5.1479 +# CONFIG_DEBUG_VM is not set 5.1480 +CONFIG_FORCED_INLINING=y 5.1481 +# CONFIG_RCU_TORTURE_TEST is not set 5.1482 +CONFIG_IA64_GRANULE_16MB=y 5.1483 +# CONFIG_IA64_GRANULE_64MB is not set 5.1484 +CONFIG_IA64_PRINT_HAZARDS=y 5.1485 +# CONFIG_DISABLE_VHPT is not set 5.1486 +# CONFIG_IA64_DEBUG_CMPXCHG is not set 5.1487 +# CONFIG_IA64_DEBUG_IRQ is not set 5.1488 + 5.1489 +# 5.1490 +# Security options 5.1491 +# 5.1492 +# CONFIG_KEYS is not set 5.1493 +# CONFIG_SECURITY is not set 5.1494 + 5.1495 +# 5.1496 +# Cryptographic options 5.1497 +# 5.1498 +CONFIG_CRYPTO=y 5.1499 +# CONFIG_CRYPTO_HMAC is not set 5.1500 +# CONFIG_CRYPTO_NULL is not set 5.1501 +# CONFIG_CRYPTO_MD4 is not set 5.1502 +CONFIG_CRYPTO_MD5=y 5.1503 +# CONFIG_CRYPTO_SHA1 is not set 5.1504 +# CONFIG_CRYPTO_SHA256 is not set 5.1505 +# CONFIG_CRYPTO_SHA512 is not set 5.1506 +# CONFIG_CRYPTO_WP512 is not set 5.1507 +# CONFIG_CRYPTO_TGR192 is not set 5.1508 +CONFIG_CRYPTO_DES=y 5.1509 +# CONFIG_CRYPTO_BLOWFISH is not set 5.1510 +# CONFIG_CRYPTO_TWOFISH is not set 5.1511 +# CONFIG_CRYPTO_SERPENT is not set 5.1512 +# CONFIG_CRYPTO_AES is not set 5.1513 +# CONFIG_CRYPTO_CAST5 is not set 5.1514 +# CONFIG_CRYPTO_CAST6 is not set 5.1515 +# CONFIG_CRYPTO_TEA is not set 5.1516 +# CONFIG_CRYPTO_ARC4 is not set 5.1517 +# CONFIG_CRYPTO_KHAZAD is not set 5.1518 +# CONFIG_CRYPTO_ANUBIS is not set 5.1519 +# CONFIG_CRYPTO_DEFLATE is not set 5.1520 +# CONFIG_CRYPTO_MICHAEL_MIC is not set 5.1521 +# CONFIG_CRYPTO_CRC32C is not set 5.1522 +# CONFIG_CRYPTO_TEST is not set 5.1523 + 5.1524 +# 5.1525 +# Hardware crypto devices 5.1526 +#
6.1 --- a/buildconfigs/linux-defconfig_xen_x86_64 Mon Mar 27 15:36:47 2006 -0700 6.2 +++ b/buildconfigs/linux-defconfig_xen_x86_64 Tue Mar 28 08:54:58 2006 -0700 6.3 @@ -1,7 +1,7 @@ 6.4 # 6.5 # Automatically generated make config: don't edit 6.6 -# Linux kernel version: 2.6.16-rc3-xen 6.7 -# Mon Feb 20 11:37:11 2006 6.8 +# Linux kernel version: 2.6.16-xen 6.9 +# Mon Mar 27 09:43:44 2006 6.10 # 6.11 CONFIG_X86_64=y 6.12 CONFIG_64BIT=y 6.13 @@ -102,6 +102,8 @@ CONFIG_X86_PC=y 6.14 # CONFIG_MPSC is not set 6.15 CONFIG_GENERIC_CPU=y 6.16 CONFIG_X86_64_XEN=y 6.17 +CONFIG_X86_NO_TSS=y 6.18 +CONFIG_X86_NO_IDT=y 6.19 CONFIG_X86_L1_CACHE_BYTES=128 6.20 CONFIG_X86_L1_CACHE_SHIFT=7 6.21 CONFIG_X86_GOOD_APIC=y 6.22 @@ -1138,7 +1140,7 @@ CONFIG_AMD8111_ETH=m 6.23 CONFIG_AMD8111E_NAPI=y 6.24 CONFIG_ADAPTEC_STARFIRE=m 6.25 CONFIG_ADAPTEC_STARFIRE_NAPI=y 6.26 -CONFIG_B44=m 6.27 +# CONFIG_B44 is not set 6.28 CONFIG_FORCEDETH=m 6.29 CONFIG_DGRS=m 6.30 CONFIG_EEPRO100=m 6.31 @@ -1782,8 +1784,8 @@ CONFIG_VIDEO_DPC=m 6.32 CONFIG_VIDEO_HEXIUM_ORION=m 6.33 CONFIG_VIDEO_HEXIUM_GEMINI=m 6.34 CONFIG_VIDEO_CX88=m 6.35 +CONFIG_VIDEO_CX88_ALSA=m 6.36 CONFIG_VIDEO_CX88_DVB=m 6.37 -CONFIG_VIDEO_CX88_ALSA=m 6.38 CONFIG_VIDEO_CX88_DVB_ALL_FRONTENDS=y 6.39 CONFIG_VIDEO_CX88_VP3054=m 6.40 CONFIG_VIDEO_EM28XX=m 6.41 @@ -2331,11 +2333,7 @@ CONFIG_INFINIBAND_IPOIB=m 6.42 CONFIG_INFINIBAND_SRP=m 6.43 6.44 # 6.45 -# SN Devices 6.46 -# 6.47 - 6.48 -# 6.49 -# EDAC - error detection and reporting (RAS) 6.50 +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 6.51 # 6.52 CONFIG_EDAC=m 6.53
7.1 --- a/docs/src/user.tex Mon Mar 27 15:36:47 2006 -0700 7.2 +++ b/docs/src/user.tex Tue Mar 28 08:54:58 2006 -0700 7.3 @@ -52,6 +52,40 @@ are licensed under the terms of the GNU 7.4 Zope Public License 2.0, or under ``BSD-style'' licenses. Please refer to the 7.5 COPYING file for details. 7.6 7.7 +Xen includes software by Christopher Clark. This software is covered by the 7.8 +following licence: 7.9 + 7.10 +\begin{quote} 7.11 +Copyright (c) 2002, Christopher Clark. All rights reserved. 7.12 + 7.13 +Redistribution and use in source and binary forms, with or without 7.14 +modification, are permitted provided that the following conditions are met: 7.15 + 7.16 +\begin{itemize} 7.17 +\item Redistributions of source code must retain the above copyright notice, 7.18 +this list of conditions and the following disclaimer. 7.19 + 7.20 +\item Redistributions in binary form must reproduce the above copyright 7.21 +notice, this list of conditions and the following disclaimer in the 7.22 +documentation and/or other materials provided with the distribution. 7.23 + 7.24 +\item Neither the name of the original author; nor the names of any 7.25 +contributors may be used to endorse or promote products derived from this 7.26 +software without specific prior written permission. 7.27 +\end{itemize} 7.28 + 7.29 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 7.30 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 7.31 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 7.32 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 7.33 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 7.34 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 7.35 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 7.36 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 7.37 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 7.38 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 7.39 +\end{quote} 7.40 + 7.41 \cleardoublepage 7.42 7.43
8.1 --- a/extras/mini-os/Makefile Mon Mar 27 15:36:47 2006 -0700 8.2 +++ b/extras/mini-os/Makefile Tue Mar 28 08:54:58 2006 -0700 8.3 @@ -41,8 +41,7 @@ default: $(TARGET) 8.4 8.5 links: 8.6 [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen 8.7 - [ -e xenbus/xenstored.h ] || ln -sf ../../../tools/xenstore/xenstored.h xenbus/xenstored.h 8.8 - 8.9 + 8.10 $(TARGET): links $(OBJS) 8.11 $(LD) -N -T minios-$(TARGET_ARCH).lds $(OBJS) -o $@.elf 8.12 gzip -f -9 -c $@.elf >$@.gz
9.1 --- a/extras/mini-os/console/console.c Mon Mar 27 15:36:47 2006 -0700 9.2 +++ b/extras/mini-os/console/console.c Tue Mar 28 08:54:58 2006 -0700 9.3 @@ -116,12 +116,12 @@ void print(int direct, const char *fmt, 9.4 { 9.5 (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf); 9.6 return; 9.7 + } else { 9.8 + if(!console_initialised) 9.9 + (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf); 9.10 + 9.11 + console_print(buf, strlen(buf)); 9.12 } 9.13 - 9.14 - if(!console_initialised) 9.15 - (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf); 9.16 - 9.17 - console_print(buf, strlen(buf)); 9.18 } 9.19 9.20 void printk(const char *fmt, ...)
10.1 --- a/extras/mini-os/console/xencons_ring.c Mon Mar 27 15:36:47 2006 -0700 10.2 +++ b/extras/mini-os/console/xencons_ring.c Tue Mar 28 08:54:58 2006 -0700 10.3 @@ -10,7 +10,6 @@ 10.4 10.5 10.6 /* TODO - need to define BUG_ON for whole mini-os, need crash-dump as well */ 10.7 -extern void do_exit(void); 10.8 #define BUG_ON(_cond) do{if(_cond) do_exit();} while(0); 10.9 10.10 static inline struct xencons_interface *xencons_interface(void) 10.11 @@ -29,7 +28,6 @@ int xencons_ring_send_no_notify(const ch 10.12 int sent = 0; 10.13 struct xencons_interface *intf = xencons_interface(); 10.14 XENCONS_RING_IDX cons, prod; 10.15 - 10.16 cons = intf->out_cons; 10.17 prod = intf->out_prod; 10.18 mb();
11.1 --- a/extras/mini-os/events.c Mon Mar 27 15:36:47 2006 -0700 11.2 +++ b/extras/mini-os/events.c Tue Mar 28 08:54:58 2006 -0700 11.3 @@ -74,9 +74,9 @@ int bind_evtchn( u32 port, void (*handle 11.4 11.5 void unbind_evtchn( u32 port ) 11.6 { 11.7 - if (ev_actions[port].handler) 11.8 + if (ev_actions[port].handler == default_handler) 11.9 printk("WARN: No handler for port %d when unbinding\n", port); 11.10 - ev_actions[port].handler = NULL; 11.11 + ev_actions[port].handler = default_handler; 11.12 ev_actions[port].status |= EVS_DISABLED; 11.13 } 11.14
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/extras/mini-os/include/console.h Tue Mar 28 08:54:58 2006 -0700 12.3 @@ -0,0 +1,49 @@ 12.4 +/* 12.5 + **************************************************************************** 12.6 + * (C) 2006 - Grzegorz Milos - Cambridge University 12.7 + **************************************************************************** 12.8 + * 12.9 + * File: console.h 12.10 + * Author: Grzegorz Milos 12.11 + * Changes: 12.12 + * 12.13 + * Date: Mar 2006 12.14 + * 12.15 + * Environment: Xen Minimal OS 12.16 + * Description: Console interface. 12.17 + * 12.18 + * Handles console I/O. Defines printk. 12.19 + * 12.20 + **************************************************************************** 12.21 + * Permission is hereby granted, free of charge, to any person obtaining a copy 12.22 + * of this software and associated documentation files (the "Software"), to 12.23 + * deal in the Software without restriction, including without limitation the 12.24 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 12.25 + * sell copies of the Software, and to permit persons to whom the Software is 12.26 + * furnished to do so, subject to the following conditions: 12.27 + * 12.28 + * The above copyright notice and this permission notice shall be included in 12.29 + * all copies or substantial portions of the Software. 12.30 + * 12.31 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12.32 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12.33 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 12.34 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 12.35 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 12.36 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 12.37 + * DEALINGS IN THE SOFTWARE. 12.38 + */ 12.39 +#ifndef _LIB_CONSOLE_H_ 12.40 +#define _LIB_CONSOLE_H_ 12.41 + 12.42 +#include<traps.h> 12.43 + 12.44 +void printk(const char *fmt, ...); 12.45 +void xprintk(const char *fmt, ...); 12.46 + 12.47 +void xencons_rx(char *buf, unsigned len, struct pt_regs *regs); 12.48 +void xencons_tx(void); 12.49 + 12.50 +void init_console(void); 12.51 + 12.52 +#endif /* _LIB_CONSOLE_H_ */
13.1 --- a/extras/mini-os/include/os.h Mon Mar 27 15:36:47 2006 -0700 13.2 +++ b/extras/mini-os/include/os.h Tue Mar 28 08:54:58 2006 -0700 13.3 @@ -9,6 +9,7 @@ 13.4 13.5 #define NULL 0 13.6 13.7 + 13.8 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 13.9 #define __builtin_expect(x, expected_value) (x) 13.10 #endif 13.11 @@ -20,6 +21,10 @@ 13.12 #ifndef __ASSEMBLY__ 13.13 #include <types.h> 13.14 #include <hypervisor.h> 13.15 + 13.16 +extern void do_exit(void); 13.17 +#define BUG do_exit 13.18 + 13.19 #endif 13.20 #include <xen/xen.h> 13.21
14.1 --- a/extras/mini-os/include/wait.h Mon Mar 27 15:36:47 2006 -0700 14.2 +++ b/extras/mini-os/include/wait.h Tue Mar 28 08:54:58 2006 -0700 14.3 @@ -66,6 +66,14 @@ static inline void wake_up(struct wait_q 14.4 } 14.5 } 14.6 14.7 +#define add_waiter(w, wq) do { \ 14.8 + unsigned long flags; \ 14.9 + local_irq_save(flags); \ 14.10 + add_wait_queue(&wq, &w); \ 14.11 + block(current); \ 14.12 + local_irq_restore(flags); \ 14.13 +} while (0) 14.14 + 14.15 #define wait_event(wq, condition) do{ \ 14.16 unsigned long flags; \ 14.17 if(condition) \
15.1 --- a/extras/mini-os/include/xenbus.h Mon Mar 27 15:36:47 2006 -0700 15.2 +++ b/extras/mini-os/include/xenbus.h Tue Mar 28 08:54:58 2006 -0700 15.3 @@ -1,224 +1,6 @@ 15.4 -/****************************************************************************** 15.5 - * xenbus.h 15.6 - * 15.7 - * Talks to Xen Store to figure out what devices we have. 15.8 - * 15.9 - * Copyright (C) 2005 Rusty Russell, IBM Corporation 15.10 - * Copyright (C) 2005 XenSource Ltd. 15.11 - * 15.12 - * This file may be distributed separately from the Linux kernel, or 15.13 - * incorporated into other software packages, subject to the following license: 15.14 - * 15.15 - * Permission is hereby granted, free of charge, to any person obtaining a copy 15.16 - * of this source file (the "Software"), to deal in the Software without 15.17 - * restriction, including without limitation the rights to use, copy, modify, 15.18 - * merge, publish, distribute, sublicense, and/or sell copies of the Software, 15.19 - * and to permit persons to whom the Software is furnished to do so, subject to 15.20 - * the following conditions: 15.21 - * 15.22 - * The above copyright notice and this permission notice shall be included in 15.23 - * all copies or substantial portions of the Software. 15.24 - * 15.25 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15.26 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15.27 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15.28 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15.29 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 15.30 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 15.31 - * IN THE SOFTWARE. 15.32 - */ 15.33 - 15.34 -#ifndef _ASM_XEN_XENBUS_H 15.35 -#define _ASM_XEN_XENBUS_H 15.36 - 15.37 -#include <errno.h> 15.38 -#include <xen/io/xenbus.h> 15.39 -#include <xen/io/xs_wire.h> 15.40 - 15.41 -/* Register callback to watch this node. */ 15.42 -struct xenbus_watch 15.43 -{ 15.44 - struct list_head list; 15.45 - 15.46 - /* Path being watched. */ 15.47 - const char *node; 15.48 - 15.49 - /* Callback (executed in a process context with no locks held). */ 15.50 - void (*callback)(struct xenbus_watch *, 15.51 - const char **vec, unsigned int len); 15.52 -}; 15.53 - 15.54 - 15.55 -/* A xenbus device. */ 15.56 -struct xenbus_device { 15.57 - const char *devicetype; 15.58 - const char *nodename; 15.59 - const char *otherend; 15.60 - int otherend_id; 15.61 - struct xenbus_watch otherend_watch; 15.62 - int has_error; 15.63 - void *data; 15.64 -}; 15.65 - 15.66 -struct xenbus_device_id 15.67 -{ 15.68 - /* .../device/<device_type>/<identifier> */ 15.69 - char devicetype[32]; /* General class of device. */ 15.70 -}; 15.71 - 15.72 -/* A xenbus driver. */ 15.73 -struct xenbus_driver { 15.74 - char *name; 15.75 - struct module *owner; 15.76 - const struct xenbus_device_id *ids; 15.77 - int (*probe)(struct xenbus_device *dev, 15.78 - const struct xenbus_device_id *id); 15.79 - void (*otherend_changed)(struct xenbus_device *dev, 15.80 - XenbusState backend_state); 15.81 - int (*remove)(struct xenbus_device *dev); 15.82 - int (*suspend)(struct xenbus_device *dev); 15.83 - int (*resume)(struct xenbus_device *dev); 15.84 - int (*hotplug)(struct xenbus_device *, char **, int, char *, int); 15.85 - int (*read_otherend_details)(struct xenbus_device *dev); 15.86 -}; 15.87 - 15.88 -int xenbus_register_frontend(struct xenbus_driver *drv); 15.89 -int xenbus_register_backend(struct xenbus_driver *drv); 15.90 -void xenbus_unregister_driver(struct xenbus_driver *drv); 15.91 - 15.92 -struct xenbus_transaction; 15.93 - 15.94 -char **xenbus_directory(struct xenbus_transaction *t, 15.95 - const char *dir, const char *node, unsigned int *num); 15.96 -void *xenbus_read(struct xenbus_transaction *t, 15.97 - const char *dir, const char *node, unsigned int *len); 15.98 -int xenbus_write(struct xenbus_transaction *t, 15.99 - const char *dir, const char *node, const char *string); 15.100 -int xenbus_mkdir(struct xenbus_transaction *t, 15.101 - const char *dir, const char *node); 15.102 -int xenbus_exists(struct xenbus_transaction *t, 15.103 - const char *dir, const char *node); 15.104 -int xenbus_rm(struct xenbus_transaction *t, const char *dir, const char *node); 15.105 -struct xenbus_transaction *xenbus_transaction_start(void); 15.106 -int xenbus_transaction_end(struct xenbus_transaction *t, int abort); 15.107 - 15.108 -/* Single read and scanf: returns -errno or num scanned if > 0. */ 15.109 -int xenbus_scanf(struct xenbus_transaction *t, 15.110 - const char *dir, const char *node, const char *fmt, ...) 15.111 - __attribute__((format(scanf, 4, 5))); 15.112 +#ifndef XENBUS_H__ 15.113 +#define XENBUS_H__ 15.114 15.115 -/* Single printf and write: returns -errno or 0. */ 15.116 -int xenbus_printf(struct xenbus_transaction *t, 15.117 - const char *dir, const char *node, const char *fmt, ...) 15.118 - __attribute__((format(printf, 4, 5))); 15.119 - 15.120 -/* Generic read function: NULL-terminated triples of name, 15.121 - * sprintf-style type string, and pointer. Returns 0 or errno.*/ 15.122 -int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...); 15.123 - 15.124 -int register_xenbus_watch(struct xenbus_watch *watch); 15.125 -void unregister_xenbus_watch(struct xenbus_watch *watch); 15.126 -void xs_suspend(void); 15.127 -void xs_resume(void); 15.128 - 15.129 -/* Used by xenbus_dev to borrow kernel's store connection. */ 15.130 -void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg); 15.131 - 15.132 -/* Called from xen core code. */ 15.133 -void xenbus_suspend(void); 15.134 -void xenbus_resume(void); 15.135 - 15.136 -#define XENBUS_IS_ERR_READ(str) ({ \ 15.137 - if (!IS_ERR(str) && strlen(str) == 0) { \ 15.138 - kfree(str); \ 15.139 - str = ERR_PTR(-ERANGE); \ 15.140 - } \ 15.141 - IS_ERR(str); \ 15.142 -}) 15.143 - 15.144 -#define XENBUS_EXIST_ERR(err) ((err) == -ENOENT || (err) == -ERANGE) 15.145 - 15.146 - 15.147 -/** 15.148 - * Register a watch on the given path, using the given xenbus_watch structure 15.149 - * for storage, and the given callback function as the callback. Return 0 on 15.150 - * success, or -errno on error. On success, the given path will be saved as 15.151 - * watch->node, and remains the caller's to free. On error, watch->node will 15.152 - * be NULL, the device will switch to XenbusStateClosing, and the error will 15.153 - * be saved in the store. 15.154 - */ 15.155 -int xenbus_watch_path(struct xenbus_device *dev, const char *path, 15.156 - struct xenbus_watch *watch, 15.157 - void (*callback)(struct xenbus_watch *, 15.158 - const char **, unsigned int)); 15.159 - 15.160 +void init_xenbus(void); 15.161 15.162 -/** 15.163 - * Register a watch on the given path/path2, using the given xenbus_watch 15.164 - * structure for storage, and the given callback function as the callback. 15.165 - * Return 0 on success, or -errno on error. On success, the watched path 15.166 - * (path/path2) will be saved as watch->node, and becomes the caller's to 15.167 - * kfree(). On error, watch->node will be NULL, so the caller has nothing to 15.168 - * free, the device will switch to XenbusStateClosing, and the error will be 15.169 - * saved in the store. 15.170 - */ 15.171 -int xenbus_watch_path2(struct xenbus_device *dev, const char *path, 15.172 - const char *path2, struct xenbus_watch *watch, 15.173 - void (*callback)(struct xenbus_watch *, 15.174 - const char **, unsigned int)); 15.175 - 15.176 - 15.177 -/** 15.178 - * Advertise in the store a change of the given driver to the given new_state. 15.179 - * Perform the change inside the given transaction xbt. xbt may be NULL, in 15.180 - * which case this is performed inside its own transaction. Return 0 on 15.181 - * success, or -errno on error. On error, the device will switch to 15.182 - * XenbusStateClosing, and the error will be saved in the store. 15.183 - */ 15.184 -int xenbus_switch_state(struct xenbus_device *dev, 15.185 - struct xenbus_transaction *xbt, 15.186 - XenbusState new_state); 15.187 - 15.188 - 15.189 -/** 15.190 - * Grant access to the given ring_mfn to the peer of the given device. Return 15.191 - * 0 on success, or -errno on error. On error, the device will switch to 15.192 - * XenbusStateClosing, and the error will be saved in the store. 15.193 - */ 15.194 -int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn); 15.195 - 15.196 - 15.197 -/** 15.198 - * Allocate an event channel for the given xenbus_device, assigning the newly 15.199 - * created local port to *port. Return 0 on success, or -errno on error. On 15.200 - * error, the device will switch to XenbusStateClosing, and the error will be 15.201 - * saved in the store. 15.202 - */ 15.203 -int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port); 15.204 - 15.205 - 15.206 -/** 15.207 - * Return the state of the driver rooted at the given store path, or 15.208 - * XenbusStateClosed if no state can be read. 15.209 - */ 15.210 -XenbusState xenbus_read_driver_state(const char *path); 15.211 - 15.212 - 15.213 -/*** 15.214 - * Report the given negative errno into the store, along with the given 15.215 - * formatted message. 15.216 - */ 15.217 -void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt, 15.218 - ...); 15.219 - 15.220 - 15.221 -/*** 15.222 - * Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by 15.223 - * xenbus_switch_state(dev, NULL, XenbusStateClosing) to schedule an orderly 15.224 - * closedown of this driver and its peer. 15.225 - */ 15.226 -void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt, 15.227 - ...); 15.228 - 15.229 - 15.230 -#endif /* _ASM_XEN_XENBUS_H */ 15.231 +#endif /* XENBUS_H__ */
16.1 --- a/extras/mini-os/kernel.c Mon Mar 27 15:36:47 2006 -0700 16.2 +++ b/extras/mini-os/kernel.c Tue Mar 28 08:54:58 2006 -0700 16.3 @@ -35,7 +35,6 @@ 16.4 #include <lib.h> 16.5 #include <sched.h> 16.6 #include <xenbus.h> 16.7 -#include "xenbus/xenbus_comms.h" 16.8 16.9 /* 16.10 * Shared page for communicating with the hypervisor. 16.11 @@ -76,7 +75,15 @@ static shared_info_t *map_shared_info(un 16.12 } 16.13 16.14 16.15 -extern void init_console(void); 16.16 +void test_xenbus(void); 16.17 + 16.18 +/* Do initialisation from a thread once the scheduler's available */ 16.19 +static void init_xs(void *ign) 16.20 +{ 16.21 + init_xenbus(); 16.22 + 16.23 + test_xenbus(); 16.24 +} 16.25 16.26 /* 16.27 * INITIAL C ENTRY POINT. 16.28 @@ -84,11 +91,13 @@ extern void init_console(void); 16.29 void start_kernel(start_info_t *si) 16.30 { 16.31 static char hello[] = "Bootstrapping...\n"; 16.32 + 16.33 (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); 16.34 16.35 /* Copy the start_info struct to a globally-accessible area. */ 16.36 + /* WARN: don't do printk before here, it uses information from 16.37 + shared_info. Use xprintk instead. */ 16.38 memcpy(&start_info, si, sizeof(*si)); 16.39 - 16.40 /* Grab the shared_info pointer and put it in a safe place. */ 16.41 HYPERVISOR_shared_info = map_shared_info(start_info.shared_info); 16.42 16.43 @@ -120,28 +129,24 @@ void start_kernel(start_info_t *si) 16.44 si->cmd_line ? (const char *)si->cmd_line : "NULL"); 16.45 16.46 16.47 - /* 16.48 - * If used for porting another OS, start here to figure out your 16.49 - * guest os entry point. Otherwise continue below... 16.50 - */ 16.51 - /* init memory management */ 16.52 + /* Init memory management. */ 16.53 init_mm(); 16.54 16.55 - /* set up events */ 16.56 + /* Set up events. */ 16.57 init_events(); 16.58 16.59 - /* init time and timers */ 16.60 + /* Init time and timers. */ 16.61 init_time(); 16.62 16.63 - /* init the console driver */ 16.64 + /* Init the console driver. */ 16.65 init_console(); 16.66 - 16.67 - /* init scheduler */ 16.68 + 16.69 + /* Init scheduler. */ 16.70 init_sched(); 16.71 - 16.72 - /* init xenbus */ 16.73 - xs_init(); 16.74 - 16.75 + 16.76 + /* Init XenBus from a separate thread */ 16.77 + create_thread("init_xs", init_xs, NULL); 16.78 + 16.79 /* Everything initialised, start idle thread */ 16.80 run_idle_thread(); 16.81 } 16.82 @@ -156,6 +161,6 @@ void start_kernel(start_info_t *si) 16.83 16.84 void do_exit(void) 16.85 { 16.86 - printk("do_exit called!\n"); 16.87 + printk("Do_exit called!\n"); 16.88 for ( ;; ) HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash); 16.89 }
17.1 --- a/extras/mini-os/minios-x86_32.lds Mon Mar 27 15:36:47 2006 -0700 17.2 +++ b/extras/mini-os/minios-x86_32.lds Tue Mar 28 08:54:58 2006 -0700 17.3 @@ -21,15 +21,6 @@ SECTIONS 17.4 17.5 _edata = .; /* End of data section */ 17.6 17.7 - . = ALIGN(8192); /* init_task */ 17.8 - .data.init_task : { *(.data.init_task) } 17.9 - 17.10 - . = ALIGN(4096); 17.11 - .data.page_aligned : { *(.data.idt) } 17.12 - 17.13 - . = ALIGN(32); 17.14 - .data.cacheline_aligned : { *(.data.cacheline_aligned) } 17.15 - 17.16 __bss_start = .; /* BSS */ 17.17 .bss : { 17.18 *(.bss)
18.1 --- a/extras/mini-os/mm.c Mon Mar 27 15:36:47 2006 -0700 18.2 +++ b/extras/mini-os/mm.c Tue Mar 28 08:54:58 2006 -0700 18.3 @@ -51,7 +51,6 @@ 18.4 unsigned long *phys_to_machine_mapping; 18.5 extern char *stack; 18.6 extern char _text, _etext, _edata, _end; 18.7 -extern void do_exit(void); 18.8 extern void page_walk(unsigned long virt_addr); 18.9 18.10 /********************* 18.11 @@ -373,7 +372,7 @@ void new_pt_frame(unsigned long *pt_pfn, 18.12 unsigned long *tab = (unsigned long *)start_info.pt_base; 18.13 unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn); 18.14 unsigned long prot_e, prot_t, pincmd; 18.15 - mmu_update_t mmu_updates[0]; 18.16 + mmu_update_t mmu_updates[1]; 18.17 struct mmuext_op pin_request; 18.18 18.19 DEBUG("Allocating new L%d pt frame for pt_pfn=%lx, "
19.1 --- a/extras/mini-os/sched.c Mon Mar 27 15:36:47 2006 -0700 19.2 +++ b/extras/mini-os/sched.c Tue Mar 28 08:54:58 2006 -0700 19.3 @@ -65,6 +65,8 @@ 19.4 struct thread *idle_thread = NULL; 19.5 LIST_HEAD(exited_threads); 19.6 19.7 +void idle_thread_fn(void *unused); 19.8 + 19.9 void dump_stack(struct thread *thread) 19.10 { 19.11 unsigned long *bottom = (unsigned long *)thread->stack + 2048; 19.12 @@ -132,7 +134,7 @@ void schedule(void) 19.13 xfree(thread); 19.14 } 19.15 } 19.16 - next = idle_thread; 19.17 + next = idle_thread; 19.18 /* Thread list needs to be protected */ 19.19 list_for_each(iterator, &idle_thread->thread_list) 19.20 { 19.21 @@ -203,8 +205,13 @@ struct thread* create_thread(char *name, 19.22 set_runnable(thread); 19.23 19.24 local_irq_save(flags); 19.25 - if(idle_thread != NULL) 19.26 + if(idle_thread != NULL) { 19.27 list_add_tail(&thread->thread_list, &idle_thread->thread_list); 19.28 + } else if(function != idle_thread_fn) 19.29 + { 19.30 + printk("BUG: Not allowed to create thread before initialising scheduler.\n"); 19.31 + BUG(); 19.32 + } 19.33 local_irq_restore(flags); 19.34 19.35 return thread; 19.36 @@ -282,19 +289,9 @@ void th_f2(void *data) 19.37 19.38 void init_sched(void) 19.39 { 19.40 - printk("Initialising scheduler\n"); 19.41 - 19.42 + printk("Initialising scheduler, idle_thread %p\n", idle_thread); 19.43 + 19.44 idle_thread = create_thread("Idle", idle_thread_fn, NULL); 19.45 INIT_LIST_HEAD(&idle_thread->thread_list); 19.46 - 19.47 - 19.48 -/* create_thread("1", th_f1, (void *)0x1234); 19.49 - create_thread("2", th_f1, (void *)0x1234); 19.50 - create_thread("3", th_f1, (void *)0x1234); 19.51 - create_thread("4", th_f1, (void *)0x1234); 19.52 - create_thread("5", th_f1, (void *)0x1234); 19.53 - create_thread("6", th_f1, (void *)0x1234); 19.54 - create_thread("second", th_f2, NULL); 19.55 -*/ 19.56 } 19.57
20.1 --- a/extras/mini-os/traps.c Mon Mar 27 15:36:47 2006 -0700 20.2 +++ b/extras/mini-os/traps.c Tue Mar 28 08:54:58 2006 -0700 20.3 @@ -29,11 +29,18 @@ void spurious_interrupt_bug(void); 20.4 void machine_check(void); 20.5 20.6 20.7 -extern void do_exit(void); 20.8 - 20.9 void dump_regs(struct pt_regs *regs) 20.10 { 20.11 - printk("FIXME: proper register dump (with the stack dump)\n"); 20.12 + printk("EIP: %x, EFLAGS %x.\n", regs->eip, regs->eflags); 20.13 + printk("EBX: %08x ECX: %08x EDX: %08x\n", 20.14 + regs->ebx, regs->ecx, regs->edx); 20.15 + printk("ESI: %08x EDI: %08x EBP: %08x EAX: %08x\n", 20.16 + regs->esi, regs->edi, regs->ebp, regs->eax); 20.17 + printk("DS: %04x ES: %04x orig_eax: %08x, eip: %08x\n", 20.18 + regs->xds, regs->xes, regs->orig_eax, regs->eip); 20.19 + printk("CS: %04x EFLAGS: %08x esp: %08x ss: %04x\n", 20.20 + regs->xcs, regs->eflags, regs->esp, regs->xss); 20.21 + 20.22 } 20.23 20.24 20.25 @@ -94,10 +101,14 @@ void page_walk(unsigned long virt_addres 20.26 20.27 } 20.28 20.29 -void do_page_fault(struct pt_regs *regs, unsigned long error_code, 20.30 - unsigned long addr) 20.31 +#define read_cr2() \ 20.32 + (HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].arch.cr2) 20.33 + 20.34 +void do_page_fault(struct pt_regs *regs, unsigned long error_code) 20.35 { 20.36 - printk("Page fault at linear address %p\n", addr); 20.37 + unsigned long addr = read_cr2(); 20.38 + printk("Page fault at linear address %p, regs %p, code %lx\n", addr, regs, 20.39 + error_code); 20.40 dump_regs(regs); 20.41 #ifdef __x86_64__ 20.42 /* FIXME: _PAGE_PSE */
21.1 --- a/extras/mini-os/x86_32.S Mon Mar 27 15:36:47 2006 -0700 21.2 +++ b/extras/mini-os/x86_32.S Tue Mar 28 08:54:58 2006 -0700 21.3 @@ -30,10 +30,10 @@ shared_info: 21.4 hypercall_page: 21.5 .org 0x3000 21.6 21.7 -ES = 0x20 21.8 -ORIG_EAX = 0x24 21.9 -EIP = 0x28 21.10 -CS = 0x2C 21.11 +ES = 0x1c 21.12 +ORIG_EAX = 0x20 21.13 +EIP = 0x24 21.14 +CS = 0x28 21.15 21.16 #define ENTRY(X) .globl X ; X : 21.17 21.18 @@ -94,32 +94,6 @@ do_exception: 21.19 call *%edi 21.20 addl $8,%esp 21.21 21.22 -/* pushl %ds 21.23 - pushl %eax 21.24 - xorl %eax,%eax 21.25 - pushl %ebp 21.26 - pushl %edi 21.27 - pushl %esi 21.28 - pushl %edx 21.29 - decl %eax # eax = -1 21.30 - pushl %ecx 21.31 - pushl %ebx 21.32 - cld 21.33 - movl %es,%ecx 21.34 - movl ORIG_EAX(%esp), %esi # get the error code 21.35 - movl ES(%esp), %edi # get the function address 21.36 - movl %eax, ORIG_EAX(%esp) 21.37 - movl %ecx, ES(%esp) 21.38 - movl %esp,%edx 21.39 - pushl %esi # push the error code 21.40 - pushl %edx # push the pt_regs pointer 21.41 - movl $(__KERNEL_DS),%edx 21.42 - movl %edx,%ds 21.43 - movl %edx,%es 21.44 - call *%edi 21.45 - addl $8,%esp */ 21.46 - 21.47 - 21.48 ret_from_exception: 21.49 movb CS(%esp),%cl 21.50 test $2,%cl # slow return to ring 2 or 3 21.51 @@ -290,15 +264,16 @@ ENTRY(page_fault) 21.52 pushl %ecx 21.53 pushl %ebx 21.54 cld 21.55 - movl %es,%edi 21.56 - movl ES(%esp), %ecx /* get the faulting address */ 21.57 - movl ORIG_EAX(%esp), %edx /* get the error code */ 21.58 + movl ORIG_EAX(%esp), %edi 21.59 movl %eax, ORIG_EAX(%esp) 21.60 - movl %edi, ES(%esp) 21.61 + movl %es, %ecx 21.62 + movl %ecx, ES(%esp) 21.63 movl $(__KERNEL_DS),%eax 21.64 movl %eax, %ds 21.65 movl %eax, %es 21.66 - movl %esp,%eax /* pt_regs pointer */ 21.67 + pushl %edi 21.68 + movl %esp, %eax 21.69 + pushl %eax 21.70 call do_page_fault 21.71 jmp ret_from_exception 21.72
22.1 --- a/extras/mini-os/xenbus/Makefile Mon Mar 27 15:36:47 2006 -0700 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,9 +0,0 @@ 22.4 -all: xenstore.h xenbus_comms.o xenbus_xs.o xenbus_probe.o 22.5 - 22.6 -xenstore.h: 22.7 - [ -e xenstored.h ] || ln -sf ../../../tools/xenstore/xenstored.h xenstored.h 22.8 - 22.9 -clean: 22.10 - #Taken care of by main Makefile 22.11 - #rm xenstored.h 22.12 - #rm *.o
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/extras/mini-os/xenbus/xenbus.c Tue Mar 28 08:54:58 2006 -0700 23.3 @@ -0,0 +1,387 @@ 23.4 +/* 23.5 + **************************************************************************** 23.6 + * (C) 2006 - Cambridge University 23.7 + **************************************************************************** 23.8 + * 23.9 + * File: mm.c 23.10 + * Author: Steven Smith (sos22@cam.ac.uk) 23.11 + * Changes: Grzegorz Milos (gm281@cam.ac.uk) 23.12 + * 23.13 + * Date: Mar 2006, chages Aug 2005 23.14 + * 23.15 + * Environment: Xen Minimal OS 23.16 + * Description: Minimal implementation of xenbus 23.17 + * 23.18 + **************************************************************************** 23.19 + **/ 23.20 +#include <os.h> 23.21 +#include <mm.h> 23.22 +#include <traps.h> 23.23 +#include <lib.h> 23.24 +#include <xenbus.h> 23.25 +#include <events.h> 23.26 +#include <errno.h> 23.27 +#include <sched.h> 23.28 +#include <wait.h> 23.29 +#include <xen/io/xs_wire.h> 23.30 +#include <spinlock.h> 23.31 +#include <xmalloc.h> 23.32 + 23.33 +#define BUG_ON(x) do { \ 23.34 + if (x) {printk("BUG at %s:%d\n", __FILE__, __LINE__); BUG(); } \ 23.35 +} while (0) 23.36 + 23.37 +#define min(x,y) ({ \ 23.38 + typeof(x) tmpx = (x); \ 23.39 + typeof(y) tmpy = (y); \ 23.40 + tmpx < tmpy ? tmpx : tmpy; \ 23.41 + }) 23.42 + 23.43 +#ifdef XENBUS_DEBUG 23.44 +#define DEBUG(_f, _a...) \ 23.45 + printk("MINI_OS(file=xenbus.c, line=%d) " _f , __LINE__, ## _a) 23.46 +#else 23.47 +#define DEBUG(_f, _a...) ((void)0) 23.48 +#endif 23.49 + 23.50 + 23.51 +static struct xenstore_domain_interface *xenstore_buf; 23.52 +static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); 23.53 +struct xenbus_req_info 23.54 +{ 23.55 + int in_use:1; 23.56 + struct wait_queue_head waitq; 23.57 + void *reply; 23.58 +}; 23.59 + 23.60 +#define NR_REQS 32 23.61 +static struct xenbus_req_info req_info[NR_REQS]; 23.62 + 23.63 +static void memcpy_from_ring(const void *Ring, 23.64 + void *Dest, 23.65 + int off, 23.66 + int len) 23.67 +{ 23.68 + int c1, c2; 23.69 + const char *ring = Ring; 23.70 + char *dest = Dest; 23.71 + c1 = min(len, XENSTORE_RING_SIZE - off); 23.72 + c2 = len - c1; 23.73 + memcpy(dest, ring + off, c1); 23.74 + memcpy(dest + c1, ring, c2); 23.75 +} 23.76 + 23.77 +static void xenbus_thread_func(void *ign) 23.78 +{ 23.79 + struct xsd_sockmsg msg; 23.80 + unsigned prod; 23.81 + 23.82 + for (;;) 23.83 + { 23.84 + wait_event(xb_waitq, prod != xenstore_buf->rsp_prod); 23.85 + while (1) 23.86 + { 23.87 + prod = xenstore_buf->rsp_prod; 23.88 + DEBUG("Rsp_cons %d, rsp_prod %d.\n", xenstore_buf->rsp_cons, 23.89 + xenstore_buf->rsp_prod); 23.90 + if (xenstore_buf->rsp_prod - xenstore_buf->rsp_cons < sizeof(msg)) 23.91 + break; 23.92 + rmb(); 23.93 + memcpy_from_ring(xenstore_buf->rsp, 23.94 + &msg, 23.95 + MASK_XENSTORE_IDX(xenstore_buf->rsp_cons), 23.96 + sizeof(msg)); 23.97 + DEBUG("Msg len %d, %d avail, id %d.\n", 23.98 + msg.len + sizeof(msg), 23.99 + xenstore_buf->rsp_prod - xenstore_buf->rsp_cons, 23.100 + msg.req_id); 23.101 + if (xenstore_buf->rsp_prod - xenstore_buf->rsp_cons < 23.102 + sizeof(msg) + msg.len) 23.103 + break; 23.104 + 23.105 + DEBUG("Message is good.\n"); 23.106 + req_info[msg.req_id].reply = malloc(sizeof(msg) + msg.len); 23.107 + memcpy_from_ring(xenstore_buf->rsp, 23.108 + req_info[msg.req_id].reply, 23.109 + MASK_XENSTORE_IDX(xenstore_buf->rsp_cons), 23.110 + msg.len + sizeof(msg)); 23.111 + wake_up(&req_info[msg.req_id].waitq); 23.112 + xenstore_buf->rsp_cons += msg.len + sizeof(msg); 23.113 + } 23.114 + } 23.115 +} 23.116 + 23.117 +static void xenbus_evtchn_handler(int port, struct pt_regs *regs) 23.118 +{ 23.119 + wake_up(&xb_waitq); 23.120 +} 23.121 + 23.122 +static int nr_live_reqs; 23.123 +static spinlock_t req_lock = SPIN_LOCK_UNLOCKED; 23.124 +static DECLARE_WAIT_QUEUE_HEAD(req_wq); 23.125 + 23.126 +/* Release a xenbus identifier */ 23.127 +static void release_xenbus_id(int id) 23.128 +{ 23.129 + BUG_ON(!req_info[id].in_use); 23.130 + spin_lock(&req_lock); 23.131 + nr_live_reqs--; 23.132 + if (nr_live_reqs == NR_REQS - 1) 23.133 + wake_up(&req_wq); 23.134 + spin_unlock(&req_lock); 23.135 +} 23.136 + 23.137 +/* Allocate an identifier for a xenbus request. Blocks if none are 23.138 + available. */ 23.139 +static int allocate_xenbus_id(void) 23.140 +{ 23.141 + static int probe; 23.142 + int o_probe; 23.143 + 23.144 + while (1) 23.145 + { 23.146 + spin_lock(&req_lock); 23.147 + if (nr_live_reqs < NR_REQS) 23.148 + break; 23.149 + spin_unlock(&req_lock); 23.150 + wait_event(req_wq, (nr_live_reqs < NR_REQS)); 23.151 + } 23.152 + 23.153 + o_probe = probe; 23.154 + for (;;) 23.155 + { 23.156 + if (!req_info[o_probe].in_use) 23.157 + break; 23.158 + o_probe = (o_probe + 1) % NR_REQS; 23.159 + BUG_ON(o_probe == probe); 23.160 + } 23.161 + nr_live_reqs++; 23.162 + req_info[o_probe].in_use = 1; 23.163 + probe = o_probe + 1; 23.164 + spin_unlock(&req_lock); 23.165 + init_waitqueue_head(&req_info[o_probe].waitq); 23.166 + return o_probe; 23.167 +} 23.168 + 23.169 +/* Initialise xenbus. */ 23.170 +void init_xenbus(void) 23.171 +{ 23.172 + int err; 23.173 + DEBUG("init_xenbus called.\n"); 23.174 + xenstore_buf = mfn_to_virt(start_info.store_mfn); 23.175 + create_thread("xenstore", xenbus_thread_func, NULL); 23.176 + DEBUG("buf at %p.\n", xenstore_buf); 23.177 + err = bind_evtchn(start_info.store_evtchn, 23.178 + xenbus_evtchn_handler); 23.179 + DEBUG("xenbus on irq %d\n", err); 23.180 +} 23.181 + 23.182 +struct write_req { 23.183 + const void *data; 23.184 + unsigned len; 23.185 +}; 23.186 + 23.187 +/* Send data to xenbus. This can block. All of the requests are seen 23.188 + by xenbus as if sent atomically. The header is added 23.189 + automatically, using type %type, req_id %req_id, and trans_id 23.190 + %trans_id. */ 23.191 +static void xb_write(int type, int req_id, int trans_id, 23.192 + const struct write_req *req, int nr_reqs) 23.193 +{ 23.194 + XENSTORE_RING_IDX prod; 23.195 + int r; 23.196 + int len = 0; 23.197 + const struct write_req *cur_req; 23.198 + int req_off; 23.199 + int total_off; 23.200 + int this_chunk; 23.201 + struct xsd_sockmsg m = {.type = type, .req_id = req_id, 23.202 + .tx_id = trans_id }; 23.203 + struct write_req header_req = { &m, sizeof(m) }; 23.204 + 23.205 + for (r = 0; r < nr_reqs; r++) 23.206 + len += req[r].len; 23.207 + m.len = len; 23.208 + len += sizeof(m); 23.209 + 23.210 + cur_req = &header_req; 23.211 + 23.212 + BUG_ON(len > XENSTORE_RING_SIZE); 23.213 + /* Wait for the ring to drain to the point where we can send the 23.214 + message. */ 23.215 + prod = xenstore_buf->req_prod; 23.216 + if (prod + len - xenstore_buf->req_cons > XENSTORE_RING_SIZE) 23.217 + { 23.218 + /* Wait for there to be space on the ring */ 23.219 + DEBUG("prod %d, len %d, cons %d, size %d; waiting.\n", 23.220 + prod, len, xenstore_buf->req_cons, XENSTORE_RING_SIZE); 23.221 + wait_event(xb_waitq, 23.222 + xenstore_buf->req_prod + len - xenstore_buf->req_cons <= 23.223 + XENSTORE_RING_SIZE); 23.224 + DEBUG("Back from wait.\n"); 23.225 + prod = xenstore_buf->req_prod; 23.226 + } 23.227 + 23.228 + /* We're now guaranteed to be able to send the message without 23.229 + overflowing the ring. Do so. */ 23.230 + total_off = 0; 23.231 + req_off = 0; 23.232 + while (total_off < len) 23.233 + { 23.234 + this_chunk = min(cur_req->len - req_off, 23.235 + XENSTORE_RING_SIZE - MASK_XENSTORE_IDX(prod)); 23.236 + memcpy((char *)xenstore_buf->req + MASK_XENSTORE_IDX(prod), 23.237 + (char *)cur_req->data + req_off, this_chunk); 23.238 + prod += this_chunk; 23.239 + req_off += this_chunk; 23.240 + total_off += this_chunk; 23.241 + if (req_off == cur_req->len) 23.242 + { 23.243 + req_off = 0; 23.244 + if (cur_req == &header_req) 23.245 + cur_req = req; 23.246 + else 23.247 + cur_req++; 23.248 + } 23.249 + } 23.250 + 23.251 + DEBUG("Complete main loop of xb_write.\n"); 23.252 + BUG_ON(req_off != 0); 23.253 + BUG_ON(total_off != len); 23.254 + BUG_ON(prod > xenstore_buf->req_cons + XENSTORE_RING_SIZE); 23.255 + 23.256 + /* Remote must see entire message before updating indexes */ 23.257 + wmb(); 23.258 + 23.259 + xenstore_buf->req_prod += len; 23.260 + 23.261 + /* Send evtchn to notify remote */ 23.262 + notify_remote_via_evtchn(start_info.store_evtchn); 23.263 +} 23.264 + 23.265 +/* Send a mesasge to xenbus, in the same fashion as xb_write, and 23.266 + block waiting for a reply. The reply is malloced and should be 23.267 + freed by the caller. */ 23.268 +static void *xenbus_msg_reply(int type, 23.269 + int trans, 23.270 + struct write_req *io, 23.271 + int nr_reqs) 23.272 +{ 23.273 + int id; 23.274 + DEFINE_WAIT(w); 23.275 + void *rep; 23.276 + struct xsd_sockmsg *repmsg; 23.277 + 23.278 + id = allocate_xenbus_id(); 23.279 + add_waiter(w, req_info[id].waitq); 23.280 + 23.281 + xb_write(type, id, trans, io, nr_reqs); 23.282 + 23.283 + schedule(); 23.284 + wake(current); 23.285 + 23.286 + rep = req_info[id].reply; 23.287 + repmsg = rep; 23.288 + BUG_ON(repmsg->req_id != id); 23.289 + release_xenbus_id(id); 23.290 + 23.291 + return rep; 23.292 +} 23.293 + 23.294 +/* Send a debug message to xenbus. Can block. */ 23.295 +static void xenbus_debug_msg(const char *msg) 23.296 +{ 23.297 + int len = strlen(msg); 23.298 + struct write_req req[] = { 23.299 + { "print", sizeof("print") }, 23.300 + { msg, len }, 23.301 + { "", 1 }}; 23.302 + void *reply; 23.303 + struct xsd_sockmsg *repmsg; 23.304 + 23.305 + reply = xenbus_msg_reply(XS_DEBUG, 0, req, 3); 23.306 + repmsg = reply; 23.307 + DEBUG("Got a reply, type %d, id %d, len %d.\n", 23.308 + repmsg->type, repmsg->req_id, repmsg->len); 23.309 +} 23.310 + 23.311 +/* List the contents of a directory. Returns a malloc()ed array of 23.312 + pointers to malloc()ed strings. The array is NULL terminated. May 23.313 + block. */ 23.314 +static char **xenbus_ls(const char *pre) 23.315 +{ 23.316 + void *reply; 23.317 + struct xsd_sockmsg *repmsg; 23.318 + struct write_req req[] = { { pre, strlen(pre)+1 } }; 23.319 + int nr_elems, x, i; 23.320 + char **res; 23.321 + 23.322 + repmsg = xenbus_msg_reply(XS_DIRECTORY, 0, req, 1); 23.323 + reply = repmsg + 1; 23.324 + for (x = nr_elems = 0; x < repmsg->len; x++) 23.325 + nr_elems += (((char *)reply)[x] == 0); 23.326 + res = malloc(sizeof(res[0]) * (nr_elems + 1)); 23.327 + for (x = i = 0; i < nr_elems; i++) { 23.328 + int l = strlen((char *)reply + x); 23.329 + res[i] = malloc(l + 1); 23.330 + memcpy(res[i], (char *)reply + x, l + 1); 23.331 + x += l + 1; 23.332 + } 23.333 + res[i] = NULL; 23.334 + free(repmsg); 23.335 + return res; 23.336 +} 23.337 + 23.338 +static char *xenbus_read(const char *path) 23.339 +{ 23.340 + struct write_req req[] = { {path, strlen(path) + 1}}; 23.341 + struct xsd_sockmsg *rep; 23.342 + char *res; 23.343 + rep = xenbus_msg_reply(XS_READ, 0, req, 1); 23.344 + res = malloc(rep->len + 1); 23.345 + memcpy(res, rep + 1, rep->len); 23.346 + res[rep->len] = 0; 23.347 + free(rep); 23.348 + return res; 23.349 +} 23.350 + 23.351 +static void do_ls_test(const char *pre) 23.352 +{ 23.353 + char **dirs; 23.354 + int x; 23.355 + 23.356 + DEBUG("ls %s...\n", pre); 23.357 + dirs = xenbus_ls(pre); 23.358 + for (x = 0; dirs[x]; x++) 23.359 + { 23.360 + DEBUG("ls %s[%d] -> %s\n", pre, x, dirs[x]); 23.361 + free(dirs[x]); 23.362 + } 23.363 + free(dirs); 23.364 +} 23.365 + 23.366 +static void do_read_test(const char *path) 23.367 +{ 23.368 + char *res; 23.369 + DEBUG("Read %s...\n", path); 23.370 + res = xenbus_read(path); 23.371 + DEBUG("Read %s -> %s.\n", path, res); 23.372 + free(res); 23.373 +} 23.374 + 23.375 +/* Simple testing thing */ 23.376 +void test_xenbus(void) 23.377 +{ 23.378 + DEBUG("Doing xenbus test.\n"); 23.379 + xenbus_debug_msg("Testing xenbus...\n"); 23.380 + 23.381 + DEBUG("Doing ls test.\n"); 23.382 + do_ls_test("device"); 23.383 + do_ls_test("device/vif"); 23.384 + do_ls_test("device/vif/0"); 23.385 + 23.386 + DEBUG("Doing read test.\n"); 23.387 + do_read_test("device/vif/0/mac"); 23.388 + do_read_test("device/vif/0/backend"); 23.389 + printk("Xenbus initialised.\n"); 23.390 +}
24.1 --- a/extras/mini-os/xenbus/xenbus_comms.c Mon Mar 27 15:36:47 2006 -0700 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,184 +0,0 @@ 24.4 -/****************************************************************************** 24.5 - * xenbus_comms.c 24.6 - * 24.7 - * Low level code to talks to Xen Store: ringbuffer and event channel. 24.8 - * 24.9 - * Copyright (C) 2005 Rusty Russell, IBM Corporation 24.10 - * 24.11 - * This file may be distributed separately from the Linux kernel, or 24.12 - * incorporated into other software packages, subject to the following license: 24.13 - * 24.14 - * Permission is hereby granted, free of charge, to any person obtaining a copy 24.15 - * of this source file (the "Software"), to deal in the Software without 24.16 - * restriction, including without limitation the rights to use, copy, modify, 24.17 - * merge, publish, distribute, sublicense, and/or sell copies of the Software, 24.18 - * and to permit persons to whom the Software is furnished to do so, subject to 24.19 - * the following conditions: 24.20 - * 24.21 - * The above copyright notice and this permission notice shall be included in 24.22 - * all copies or substantial portions of the Software. 24.23 - * 24.24 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24.25 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24.26 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24.27 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24.28 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24.29 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 24.30 - * IN THE SOFTWARE. 24.31 - */ 24.32 -#include <types.h> 24.33 -#include <wait.h> 24.34 -#include <mm.h> 24.35 -#include <hypervisor.h> 24.36 -#include <events.h> 24.37 -#include <os.h> 24.38 -#include <lib.h> 24.39 -#include <xenbus.h> 24.40 -#include "xenbus_comms.h" 24.41 - 24.42 -static int xenbus_irq; 24.43 - 24.44 -extern void xenbus_probe(void *); 24.45 -extern int xenstored_ready; 24.46 - 24.47 -DECLARE_WAIT_QUEUE_HEAD(xb_waitq); 24.48 - 24.49 -static inline struct xenstore_domain_interface *xenstore_domain_interface(void) 24.50 -{ 24.51 - return mfn_to_virt(start_info.store_mfn); 24.52 -} 24.53 - 24.54 -static void wake_waiting(int port, struct pt_regs *regs) 24.55 -{ 24.56 - wake_up(&xb_waitq); 24.57 -} 24.58 - 24.59 -static int check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod) 24.60 -{ 24.61 - return ((prod - cons) <= XENSTORE_RING_SIZE); 24.62 -} 24.63 - 24.64 -static void *get_output_chunk(XENSTORE_RING_IDX cons, 24.65 - XENSTORE_RING_IDX prod, 24.66 - char *buf, uint32_t *len) 24.67 -{ 24.68 - *len = XENSTORE_RING_SIZE - MASK_XENSTORE_IDX(prod); 24.69 - if ((XENSTORE_RING_SIZE - (prod - cons)) < *len) 24.70 - *len = XENSTORE_RING_SIZE - (prod - cons); 24.71 - return buf + MASK_XENSTORE_IDX(prod); 24.72 -} 24.73 - 24.74 -static const void *get_input_chunk(XENSTORE_RING_IDX cons, 24.75 - XENSTORE_RING_IDX prod, 24.76 - const char *buf, uint32_t *len) 24.77 -{ 24.78 - *len = XENSTORE_RING_SIZE - MASK_XENSTORE_IDX(cons); 24.79 - if ((prod - cons) < *len) 24.80 - *len = prod - cons; 24.81 - return buf + MASK_XENSTORE_IDX(cons); 24.82 -} 24.83 - 24.84 -int xb_write(const void *data, unsigned len) 24.85 -{ 24.86 - struct xenstore_domain_interface *intf = xenstore_domain_interface(); 24.87 - XENSTORE_RING_IDX cons, prod; 24.88 - 24.89 - while (len != 0) { 24.90 - void *dst; 24.91 - unsigned int avail; 24.92 - 24.93 - wait_event(xb_waitq, (intf->req_prod - intf->req_cons) != 24.94 - XENSTORE_RING_SIZE); 24.95 - 24.96 - /* Read indexes, then verify. */ 24.97 - cons = intf->req_cons; 24.98 - prod = intf->req_prod; 24.99 - mb(); 24.100 - if (!check_indexes(cons, prod)) 24.101 - return -EIO; 24.102 - 24.103 - dst = get_output_chunk(cons, prod, intf->req, &avail); 24.104 - if (avail == 0) 24.105 - continue; 24.106 - if (avail > len) 24.107 - avail = len; 24.108 - 24.109 - memcpy(dst, data, avail); 24.110 - data = (void*) ( (unsigned long)data + avail ); 24.111 - len -= avail; 24.112 - 24.113 - /* Other side must not see new header until data is there. */ 24.114 - wmb(); 24.115 - intf->req_prod += avail; 24.116 - 24.117 - /* This implies mb() before other side sees interrupt. */ 24.118 - notify_remote_via_evtchn(start_info.store_evtchn); 24.119 - } 24.120 - 24.121 - return 0; 24.122 -} 24.123 - 24.124 -int xb_read(void *data, unsigned len) 24.125 -{ 24.126 - struct xenstore_domain_interface *intf = xenstore_domain_interface(); 24.127 - XENSTORE_RING_IDX cons, prod; 24.128 - 24.129 - while (len != 0) { 24.130 - unsigned int avail; 24.131 - const char *src; 24.132 - 24.133 - wait_event(xb_waitq, 24.134 - intf->rsp_cons != intf->rsp_prod); 24.135 - 24.136 - /* Read indexes, then verify. */ 24.137 - cons = intf->rsp_cons; 24.138 - prod = intf->rsp_prod; 24.139 - mb(); 24.140 - if (!check_indexes(cons, prod)) 24.141 - return -EIO; 24.142 - 24.143 - src = get_input_chunk(cons, prod, intf->rsp, &avail); 24.144 - if (avail == 0) 24.145 - continue; 24.146 - if (avail > len) 24.147 - avail = len; 24.148 - 24.149 - /* We must read header before we read data. */ 24.150 - rmb(); 24.151 - 24.152 - memcpy(data, src, avail); 24.153 - data = (void*) ( (unsigned long)data + avail ); 24.154 - len -= avail; 24.155 - 24.156 - /* Other side must not see free space until we've copied out */ 24.157 - mb(); 24.158 - intf->rsp_cons += avail; 24.159 - 24.160 - printk("Finished read of %i bytes (%i to go)\n", avail, len); 24.161 - 24.162 - /* Implies mb(): they will see new header. */ 24.163 - notify_remote_via_evtchn(start_info.store_evtchn); 24.164 - } 24.165 - 24.166 - return 0; 24.167 -} 24.168 - 24.169 -/* Set up interrupt handler off store event channel. */ 24.170 -int xb_init_comms(void) 24.171 -{ 24.172 - int err; 24.173 - 24.174 - if (xenbus_irq) 24.175 - unbind_evtchn(xenbus_irq); 24.176 - 24.177 - err = bind_evtchn( 24.178 - start_info.store_evtchn, wake_waiting); 24.179 - if (err <= 0) { 24.180 - printk("XENBUS request irq failed %i\n", err); 24.181 - return err; 24.182 - } 24.183 - 24.184 - xenbus_irq = err; 24.185 - 24.186 - return 0; 24.187 -}
25.1 --- a/extras/mini-os/xenbus/xenbus_comms.h Mon Mar 27 15:36:47 2006 -0700 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,40 +0,0 @@ 25.4 -/* 25.5 - * Private include for xenbus communications. 25.6 - * 25.7 - * Copyright (C) 2005 Rusty Russell, IBM Corporation 25.8 - * 25.9 - * This file may be distributed separately from the Linux kernel, or 25.10 - * incorporated into other software packages, subject to the following license: 25.11 - * 25.12 - * Permission is hereby granted, free of charge, to any person obtaining a copy 25.13 - * of this source file (the "Software"), to deal in the Software without 25.14 - * restriction, including without limitation the rights to use, copy, modify, 25.15 - * merge, publish, distribute, sublicense, and/or sell copies of the Software, 25.16 - * and to permit persons to whom the Software is furnished to do so, subject to 25.17 - * the following conditions: 25.18 - * 25.19 - * The above copyright notice and this permission notice shall be included in 25.20 - * all copies or substantial portions of the Software. 25.21 - * 25.22 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25.23 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25.24 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25.25 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25.26 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25.27 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25.28 - * IN THE SOFTWARE. 25.29 - */ 25.30 - 25.31 -#ifndef _XENBUS_COMMS_H 25.32 -#define _XENBUS_COMMS_H 25.33 - 25.34 -int xs_init(void); 25.35 -int xb_init_comms(void); 25.36 - 25.37 -/* Low level routines. */ 25.38 -int xb_write(const void *data, unsigned len); 25.39 -int xb_read(void *data, unsigned len); 25.40 -int xs_input_avail(void); 25.41 -extern struct wait_queue_head xb_waitq; 25.42 - 25.43 -#endif /* _XENBUS_COMMS_H */
26.1 --- a/extras/mini-os/xenbus/xenbus_xs.c Mon Mar 27 15:36:47 2006 -0700 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,796 +0,0 @@ 26.4 -/****************************************************************************** 26.5 - * xenbus_xs.c 26.6 - * 26.7 - * This is the kernel equivalent of the "xs" library. We don't need everything 26.8 - * and we use xenbus_comms for communication. 26.9 - * 26.10 - * Copyright (C) 2005 Rusty Russell, IBM Corporation 26.11 - * 26.12 - * This file may be distributed separately from the Linux kernel, or 26.13 - * incorporated into other software packages, subject to the following license: 26.14 - * 26.15 - * Permission is hereby granted, free of charge, to any person obtaining a copy 26.16 - * of this source file (the "Software"), to deal in the Software without 26.17 - * restriction, including without limitation the rights to use, copy, modify, 26.18 - * merge, publish, distribute, sublicense, and/or sell copies of the Software, 26.19 - * and to permit persons to whom the Software is furnished to do so, subject to 26.20 - * the following conditions: 26.21 - * 26.22 - * The above copyright notice and this permission notice shall be included in 26.23 - * all copies or substantial portions of the Software. 26.24 - * 26.25 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26.26 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26.27 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26.28 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26.29 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26.30 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26.31 - * IN THE SOFTWARE. 26.32 - */ 26.33 -#include <errno.h> 26.34 -#include <types.h> 26.35 -#include <list.h> 26.36 -#include <lib.h> 26.37 -#include <err.h> 26.38 -#include <os.h> 26.39 -#include <xmalloc.h> 26.40 -#include <fcntl.h> 26.41 -#include <xenbus.h> 26.42 -#include <wait.h> 26.43 -#include <sched.h> 26.44 -#include <semaphore.h> 26.45 -#include <spinlock.h> 26.46 -#include <xen/io/xs_wire.h> 26.47 -#include "xenbus_comms.h" 26.48 - 26.49 -#define streq(a, b) (strcmp((a), (b)) == 0) 26.50 - 26.51 -struct xs_stored_msg { 26.52 - struct list_head list; 26.53 - 26.54 - struct xsd_sockmsg hdr; 26.55 - 26.56 - union { 26.57 - /* Queued replies. */ 26.58 - struct { 26.59 - char *body; 26.60 - } reply; 26.61 - 26.62 - /* Queued watch events. */ 26.63 - struct { 26.64 - struct xenbus_watch *handle; 26.65 - char **vec; 26.66 - unsigned int vec_size; 26.67 - } watch; 26.68 - } u; 26.69 -}; 26.70 - 26.71 -struct xs_handle { 26.72 - /* A list of replies. Currently only one will ever be outstanding. */ 26.73 - struct list_head reply_list; 26.74 - spinlock_t reply_lock; 26.75 - struct wait_queue_head reply_waitq; 26.76 - 26.77 - /* One request at a time. */ 26.78 - struct semaphore request_mutex; 26.79 - 26.80 - /* Protect transactions against save/restore. */ 26.81 - struct rw_semaphore suspend_mutex; 26.82 -}; 26.83 - 26.84 -static struct xs_handle xs_state; 26.85 - 26.86 -/* List of registered watches, and a lock to protect it. */ 26.87 -static LIST_HEAD(watches); 26.88 -static DEFINE_SPINLOCK(watches_lock); 26.89 - 26.90 -/* List of pending watch callback events, and a lock to protect it. */ 26.91 -static LIST_HEAD(watch_events); 26.92 -static DEFINE_SPINLOCK(watch_events_lock); 26.93 - 26.94 -/* 26.95 - * Details of the xenwatch callback kernel thread. The thread waits on the 26.96 - * watch_events_waitq for work to do (queued on watch_events list). When it 26.97 - * wakes up it acquires the xenwatch_mutex before reading the list and 26.98 - * carrying out work. 26.99 - */ 26.100 -/* static */ DECLARE_MUTEX(xenwatch_mutex); 26.101 -static DECLARE_WAIT_QUEUE_HEAD(watch_events_waitq); 26.102 - 26.103 -static int get_error(const char *errorstring) 26.104 -{ 26.105 - unsigned int i; 26.106 - 26.107 - for (i = 0; !streq(errorstring, xsd_errors[i].errstring); i++) { 26.108 - if (i == ARRAY_SIZE(xsd_errors) - 1) { 26.109 - printk("XENBUS xen store gave: unknown error %s", 26.110 - errorstring); 26.111 - return EINVAL; 26.112 - } 26.113 - } 26.114 - return xsd_errors[i].errnum; 26.115 -} 26.116 - 26.117 -static void *read_reply(enum xsd_sockmsg_type *type, unsigned int *len) 26.118 -{ 26.119 - struct xs_stored_msg *msg; 26.120 - char *body; 26.121 - 26.122 - spin_lock(&xs_state.reply_lock); 26.123 - 26.124 - while (list_empty(&xs_state.reply_list)) { 26.125 - spin_unlock(&xs_state.reply_lock); 26.126 - wait_event(xs_state.reply_waitq, 26.127 - !list_empty(&xs_state.reply_list)); 26.128 - spin_lock(&xs_state.reply_lock); 26.129 - } 26.130 - 26.131 - msg = list_entry(xs_state.reply_list.next, 26.132 - struct xs_stored_msg, list); 26.133 - list_del(&msg->list); 26.134 - 26.135 - spin_unlock(&xs_state.reply_lock); 26.136 - 26.137 - *type = msg->hdr.type; 26.138 - if (len) 26.139 - *len = msg->hdr.len; 26.140 - body = msg->u.reply.body; 26.141 - 26.142 - free(msg); 26.143 - 26.144 - return body; 26.145 -} 26.146 - 26.147 -/* Emergency write. */ 26.148 -void xenbus_debug_write(const char *str, unsigned int count) 26.149 -{ 26.150 - struct xsd_sockmsg msg = { 0 }; 26.151 - 26.152 - msg.type = XS_DEBUG; 26.153 - msg.len = sizeof("print") + count + 1; 26.154 - 26.155 - down(&xs_state.request_mutex); 26.156 - xb_write(&msg, sizeof(msg)); 26.157 - xb_write("print", sizeof("print")); 26.158 - xb_write(str, count); 26.159 - xb_write("", 1); 26.160 - up(&xs_state.request_mutex); 26.161 -} 26.162 - 26.163 -void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) 26.164 -{ 26.165 - void *ret; 26.166 - struct xsd_sockmsg req_msg = *msg; 26.167 - int err; 26.168 - 26.169 - if (req_msg.type == XS_TRANSACTION_START) 26.170 - down_read(&xs_state.suspend_mutex); 26.171 - 26.172 - down(&xs_state.request_mutex); 26.173 - 26.174 - err = xb_write(msg, sizeof(*msg) + msg->len); 26.175 - if (err) { 26.176 - msg->type = XS_ERROR; 26.177 - ret = ERR_PTR(err); 26.178 - } else { 26.179 - ret = read_reply(&msg->type, &msg->len); 26.180 - } 26.181 - 26.182 - up(&xs_state.request_mutex); 26.183 - 26.184 - if ((msg->type == XS_TRANSACTION_END) || 26.185 - ((req_msg.type == XS_TRANSACTION_START) && 26.186 - (msg->type == XS_ERROR))) 26.187 - up_read(&xs_state.suspend_mutex); 26.188 - 26.189 - return ret; 26.190 -} 26.191 - 26.192 -/* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */ 26.193 -static void *xs_talkv(struct xenbus_transaction *t, 26.194 - enum xsd_sockmsg_type type, 26.195 - const struct kvec *iovec, 26.196 - unsigned int num_vecs, 26.197 - unsigned int *len) 26.198 -{ 26.199 - struct xsd_sockmsg msg; 26.200 - void *ret = NULL; 26.201 - unsigned int i; 26.202 - int err; 26.203 - 26.204 - msg.tx_id = (u32)(unsigned long)t; 26.205 - msg.req_id = 0; 26.206 - msg.type = type; 26.207 - msg.len = 0; 26.208 - for (i = 0; i < num_vecs; i++) 26.209 - msg.len += iovec[i].iov_len; 26.210 - 26.211 - down(&xs_state.request_mutex); 26.212 - 26.213 - err = xb_write(&msg, sizeof(msg)); 26.214 - if (err) { 26.215 - up(&xs_state.request_mutex); 26.216 - return ERR_PTR(err); 26.217 - } 26.218 - 26.219 - for (i = 0; i < num_vecs; i++) { 26.220 - err = xb_write(iovec[i].iov_base, iovec[i].iov_len);; 26.221 - if (err) { 26.222 - up(&xs_state.request_mutex); 26.223 - return ERR_PTR(err); 26.224 - } 26.225 - } 26.226 - 26.227 - ret = read_reply(&msg.type, len); 26.228 - 26.229 - up(&xs_state.request_mutex); 26.230 - 26.231 - if (IS_ERR(ret)) 26.232 - return ret; 26.233 - 26.234 - if (msg.type == XS_ERROR) { 26.235 - err = get_error(ret); 26.236 - free(ret); 26.237 - return ERR_PTR(-err); 26.238 - } 26.239 - 26.240 - // BUG_ON(msg.type != type); 26.241 - return ret; 26.242 -} 26.243 - 26.244 -/* Simplified version of xs_talkv: single message. */ 26.245 -static void *xs_single(struct xenbus_transaction *t, 26.246 - enum xsd_sockmsg_type type, 26.247 - const char *string, 26.248 - unsigned int *len) 26.249 -{ 26.250 - struct kvec iovec; 26.251 - 26.252 - iovec.iov_base = (void *)string; 26.253 - iovec.iov_len = strlen(string) + 1; 26.254 - return xs_talkv(t, type, &iovec, 1, len); 26.255 -} 26.256 - 26.257 -/* Many commands only need an ack, don't care what it says. */ 26.258 -static int xs_error(char *reply) 26.259 -{ 26.260 - if (IS_ERR(reply)) 26.261 - return PTR_ERR(reply); 26.262 - free(reply); 26.263 - return 0; 26.264 -} 26.265 - 26.266 -static unsigned int count_strings(const char *strings, unsigned int len) 26.267 -{ 26.268 - unsigned int num; 26.269 - const char *p; 26.270 - 26.271 - for (p = strings, num = 0; p < strings + len; p += strlen(p) + 1) 26.272 - num++; 26.273 - 26.274 - return num; 26.275 -} 26.276 - 26.277 -/* Return the path to dir with /name appended. Buffer must be kfree()'ed. */ 26.278 -static char *join(const char *dir, const char *name) 26.279 -{ 26.280 - char *buffer; 26.281 - 26.282 - buffer = malloc(strlen(dir) + strlen("/") + strlen(name) + 1); 26.283 - if (buffer == NULL) 26.284 - return ERR_PTR(-ENOMEM); 26.285 - 26.286 - strcpy(buffer, dir); 26.287 - if (!streq(name, "")) { 26.288 - strcat(buffer, "/"); 26.289 - strcat(buffer, name); 26.290 - } 26.291 - 26.292 - return buffer; 26.293 -} 26.294 - 26.295 -static char **split(char *strings, unsigned int len, unsigned int *num) 26.296 -{ 26.297 - char *p, **ret; 26.298 - 26.299 - /* Count the strings. */ 26.300 - *num = count_strings(strings, len); 26.301 - 26.302 - /* Transfer to one big alloc for easy freeing. */ 26.303 - ret = malloc(*num * sizeof(char *) + len); 26.304 - if (!ret) { 26.305 - free(strings); 26.306 - return ERR_PTR(-ENOMEM); 26.307 - } 26.308 - memcpy(&ret[*num], strings, len); 26.309 - free(strings); 26.310 - 26.311 - strings = (char *)&ret[*num]; 26.312 - for (p = strings, *num = 0; p < strings + len; p += strlen(p) + 1) 26.313 - ret[(*num)++] = p; 26.314 - 26.315 - return ret; 26.316 -} 26.317 - 26.318 -char **xenbus_directory(struct xenbus_transaction *t, 26.319 - const char *dir, const char *node, unsigned int *num) 26.320 -{ 26.321 - char *strings, *path; 26.322 - unsigned int len; 26.323 - 26.324 - path = join(dir, node); 26.325 - if (IS_ERR(path)) 26.326 - return (char **)path; 26.327 - 26.328 - strings = xs_single(t, XS_DIRECTORY, path, &len); 26.329 - free(path); 26.330 - if (IS_ERR(strings)) 26.331 - return (char **)strings; 26.332 - 26.333 - return split(strings, len, num); 26.334 -} 26.335 - 26.336 -/* Check if a path exists. Return 1 if it does. */ 26.337 -int xenbus_exists(struct xenbus_transaction *t, 26.338 - const char *dir, const char *node) 26.339 -{ 26.340 - char **d; 26.341 - int dir_n; 26.342 - 26.343 - d = xenbus_directory(t, dir, node, &dir_n); 26.344 - if (IS_ERR(d)) 26.345 - return 0; 26.346 - free(d); 26.347 - return 1; 26.348 -} 26.349 - 26.350 -/* Get the value of a single file. 26.351 - * Returns a kmalloced value: call free() on it after use. 26.352 - * len indicates length in bytes. 26.353 - */ 26.354 -void *xenbus_read(struct xenbus_transaction *t, 26.355 - const char *dir, const char *node, unsigned int *len) 26.356 -{ 26.357 - char *path; 26.358 - void *ret; 26.359 - 26.360 - path = join(dir, node); 26.361 - if (IS_ERR(path)) 26.362 - return (void *)path; 26.363 - 26.364 - ret = xs_single(t, XS_READ, path, len); 26.365 - free(path); 26.366 - return ret; 26.367 -} 26.368 - 26.369 -/* Write the value of a single file. 26.370 - * Returns -err on failure. 26.371 - */ 26.372 -int xenbus_write(struct xenbus_transaction *t, 26.373 - const char *dir, const char *node, const char *string) 26.374 -{ 26.375 - const char *path; 26.376 - struct kvec iovec[2]; 26.377 - int ret; 26.378 - 26.379 - path = join(dir, node); 26.380 - if (IS_ERR(path)) 26.381 - return PTR_ERR(path); 26.382 - 26.383 - iovec[0].iov_base = (void *)path; 26.384 - iovec[0].iov_len = strlen(path) + 1; 26.385 - iovec[1].iov_base = (void *)string; 26.386 - iovec[1].iov_len = strlen(string); 26.387 - 26.388 - ret = xs_error(xs_talkv(t, XS_WRITE, iovec, ARRAY_SIZE(iovec), NULL)); 26.389 - free(path); 26.390 - return ret; 26.391 -} 26.392 - 26.393 -/* Create a new directory. */ 26.394 -int xenbus_mkdir(struct xenbus_transaction *t, 26.395 - const char *dir, const char *node) 26.396 -{ 26.397 - char *path; 26.398 - int ret; 26.399 - 26.400 - path = join(dir, node); 26.401 - if (IS_ERR(path)) 26.402 - return PTR_ERR(path); 26.403 - 26.404 - ret = xs_error(xs_single(t, XS_MKDIR, path, NULL)); 26.405 - free(path); 26.406 - return ret; 26.407 -} 26.408 - 26.409 -/* Destroy a file or directory (directories must be empty). */ 26.410 -int xenbus_rm(struct xenbus_transaction *t, const char *dir, const char *node) 26.411 -{ 26.412 - char *path; 26.413 - int ret; 26.414 - 26.415 - path = join(dir, node); 26.416 - if (IS_ERR(path)) 26.417 - return PTR_ERR(path); 26.418 - 26.419 - ret = xs_error(xs_single(t, XS_RM, path, NULL)); 26.420 - free(path); 26.421 - return ret; 26.422 -} 26.423 - 26.424 -/* Start a transaction: changes by others will not be seen during this 26.425 - * transaction, and changes will not be visible to others until end. 26.426 - */ 26.427 -struct xenbus_transaction *xenbus_transaction_start(void) 26.428 -{ 26.429 - char *id_str; 26.430 - unsigned long id; 26.431 - 26.432 - down_read(&xs_state.suspend_mutex); 26.433 - 26.434 - id_str = xs_single(NULL, XS_TRANSACTION_START, "", NULL); 26.435 - if (IS_ERR(id_str)) { 26.436 - up_read(&xs_state.suspend_mutex); 26.437 - return (struct xenbus_transaction *)id_str; 26.438 - } 26.439 - 26.440 - id = simple_strtoul(id_str, NULL, 0); 26.441 - free(id_str); 26.442 - 26.443 - return (struct xenbus_transaction *)id; 26.444 -} 26.445 - 26.446 -/* End a transaction. 26.447 - * If abandon is true, transaction is discarded instead of committed. 26.448 - */ 26.449 -int xenbus_transaction_end(struct xenbus_transaction *t, int abort) 26.450 -{ 26.451 - char abortstr[2]; 26.452 - int err; 26.453 - 26.454 - if (abort) 26.455 - strcpy(abortstr, "F"); 26.456 - else 26.457 - strcpy(abortstr, "T"); 26.458 - 26.459 - err = xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL)); 26.460 - 26.461 - up_read(&xs_state.suspend_mutex); 26.462 - 26.463 - return err; 26.464 -} 26.465 - 26.466 -/* Single read and scanf: returns -errno or num scanned. */ 26.467 -int xenbus_scanf(struct xenbus_transaction *t, 26.468 - const char *dir, const char *node, const char *fmt, ...) 26.469 -{ 26.470 - va_list ap; 26.471 - int ret; 26.472 - char *val; 26.473 - 26.474 - val = xenbus_read(t, dir, node, NULL); 26.475 - if (IS_ERR(val)) 26.476 - return PTR_ERR(val); 26.477 - 26.478 - va_start(ap, fmt); 26.479 - ret = vsscanf(val, fmt, ap); 26.480 - va_end(ap); 26.481 - free(val); 26.482 - /* Distinctive errno. */ 26.483 - if (ret == 0) 26.484 - return -ERANGE; 26.485 - return ret; 26.486 -} 26.487 - 26.488 -/* Single printf and write: returns -errno or 0. */ 26.489 -int xenbus_printf(struct xenbus_transaction *t, 26.490 - const char *dir, const char *node, const char *fmt, ...) 26.491 -{ 26.492 - va_list ap; 26.493 - int ret; 26.494 -#define PRINTF_BUFFER_SIZE 4096 26.495 - char *printf_buffer; 26.496 - 26.497 - printf_buffer = malloc(PRINTF_BUFFER_SIZE); 26.498 - if (printf_buffer == NULL) 26.499 - return -ENOMEM; 26.500 - 26.501 - va_start(ap, fmt); 26.502 - ret = vsnprintf(printf_buffer, PRINTF_BUFFER_SIZE, fmt, ap); 26.503 - va_end(ap); 26.504 - 26.505 - // BUG_ON(ret > PRINTF_BUFFER_SIZE-1); 26.506 - ret = xenbus_write(t, dir, node, printf_buffer); 26.507 - 26.508 - free(printf_buffer); 26.509 - 26.510 - return ret; 26.511 -} 26.512 - 26.513 -/* Takes tuples of names, scanf-style args, and void **, NULL terminated. */ 26.514 -int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...) 26.515 -{ 26.516 - va_list ap; 26.517 - const char *name; 26.518 - int ret = 0; 26.519 - 26.520 - va_start(ap, dir); 26.521 - while (ret == 0 && (name = va_arg(ap, char *)) != NULL) { 26.522 - const char *fmt = va_arg(ap, char *); 26.523 - void *result = va_arg(ap, void *); 26.524 - char *p; 26.525 - 26.526 - p = xenbus_read(t, dir, name, NULL); 26.527 - if (IS_ERR(p)) { 26.528 - ret = PTR_ERR(p); 26.529 - break; 26.530 - } 26.531 - if (fmt) { 26.532 - if (sscanf(p, fmt, result) == 0) 26.533 - ret = -EINVAL; 26.534 - free(p); 26.535 - } else 26.536 - *(char **)result = p; 26.537 - } 26.538 - va_end(ap); 26.539 - return ret; 26.540 -} 26.541 - 26.542 -static int xs_watch(const char *path, const char *token) 26.543 -{ 26.544 - struct kvec iov[2]; 26.545 - 26.546 - iov[0].iov_base = (void *)path; 26.547 - iov[0].iov_len = strlen(path) + 1; 26.548 - iov[1].iov_base = (void *)token; 26.549 - iov[1].iov_len = strlen(token) + 1; 26.550 - 26.551 - return xs_error(xs_talkv(NULL, XS_WATCH, iov, 26.552 - ARRAY_SIZE(iov), NULL)); 26.553 -} 26.554 - 26.555 -static int xs_unwatch(const char *path, const char *token) 26.556 -{ 26.557 - struct kvec iov[2]; 26.558 - 26.559 - iov[0].iov_base = (char *)path; 26.560 - iov[0].iov_len = strlen(path) + 1; 26.561 - iov[1].iov_base = (char *)token; 26.562 - iov[1].iov_len = strlen(token) + 1; 26.563 - 26.564 - return xs_error(xs_talkv(NULL, XS_UNWATCH, iov, 26.565 - ARRAY_SIZE(iov), NULL)); 26.566 -} 26.567 - 26.568 -static struct xenbus_watch *find_watch(const char *token) 26.569 -{ 26.570 - struct xenbus_watch *i, *cmp; 26.571 - 26.572 - cmp = (void *)simple_strtoul(token, NULL, 16); 26.573 - 26.574 - list_for_each_entry(i, &watches, list) 26.575 - if (i == cmp) 26.576 - return i; 26.577 - 26.578 - return NULL; 26.579 -} 26.580 - 26.581 -/* Register callback to watch this node. */ 26.582 -int register_xenbus_watch(struct xenbus_watch *watch) 26.583 -{ 26.584 - /* Pointer in ascii is the token. */ 26.585 - char token[sizeof(watch) * 2 + 1]; 26.586 - int err; 26.587 - 26.588 - sprintf(token, "%lX", (long)watch); 26.589 - 26.590 - down_read(&xs_state.suspend_mutex); 26.591 - 26.592 - spin_lock(&watches_lock); 26.593 - // BUG_ON(find_watch(token)); 26.594 - list_add(&watch->list, &watches); 26.595 - spin_unlock(&watches_lock); 26.596 - 26.597 - err = xs_watch(watch->node, token); 26.598 - 26.599 - /* Ignore errors due to multiple registration. */ 26.600 - if ((err != 0) && (err != -EEXIST)) { 26.601 - spin_lock(&watches_lock); 26.602 - list_del(&watch->list); 26.603 - spin_unlock(&watches_lock); 26.604 - } 26.605 - 26.606 - up_read(&xs_state.suspend_mutex); 26.607 - 26.608 - return err; 26.609 -} 26.610 - 26.611 -void unregister_xenbus_watch(struct xenbus_watch *watch) 26.612 -{ 26.613 - struct xs_stored_msg *msg, *tmp; 26.614 - char token[sizeof(watch) * 2 + 1]; 26.615 - int err; 26.616 - 26.617 - sprintf(token, "%lX", (long)watch); 26.618 - 26.619 - down_read(&xs_state.suspend_mutex); 26.620 - 26.621 - spin_lock(&watches_lock); 26.622 - // BUG_ON(!find_watch(token)); 26.623 - list_del(&watch->list); 26.624 - spin_unlock(&watches_lock); 26.625 - 26.626 - err = xs_unwatch(watch->node, token); 26.627 - if (err) 26.628 - printk("XENBUS Failed to release watch %s: %i\n", 26.629 - watch->node, err); 26.630 - 26.631 - up_read(&xs_state.suspend_mutex); 26.632 - 26.633 - /* Cancel pending watch events. */ 26.634 - spin_lock(&watch_events_lock); 26.635 - list_for_each_entry_safe(msg, tmp, &watch_events, list) { 26.636 - if (msg->u.watch.handle != watch) 26.637 - continue; 26.638 - list_del(&msg->list); 26.639 - free(msg->u.watch.vec); 26.640 - free(msg); 26.641 - } 26.642 - spin_unlock(&watch_events_lock); 26.643 -} 26.644 - 26.645 -void xs_suspend(void) 26.646 -{ 26.647 - down_write(&xs_state.suspend_mutex); 26.648 - down(&xs_state.request_mutex); 26.649 -} 26.650 - 26.651 -void xs_resume(void) 26.652 -{ 26.653 - struct xenbus_watch *watch; 26.654 - char token[sizeof(watch) * 2 + 1]; 26.655 - 26.656 - up(&xs_state.request_mutex); 26.657 - 26.658 - /* No need for watches_lock: the suspend_mutex is sufficient. */ 26.659 - list_for_each_entry(watch, &watches, list) { 26.660 - sprintf(token, "%lX", (long)watch); 26.661 - xs_watch(watch->node, token); 26.662 - } 26.663 - 26.664 - up_write(&xs_state.suspend_mutex); 26.665 -} 26.666 - 26.667 -static void xenwatch_thread(void *unused) 26.668 -{ 26.669 - struct list_head *ent; 26.670 - struct xs_stored_msg *msg; 26.671 - 26.672 - for (;;) { 26.673 - wait_event(watch_events_waitq, 26.674 - !list_empty(&watch_events)); 26.675 - 26.676 - down(&xenwatch_mutex); 26.677 - 26.678 - spin_lock(&watch_events_lock); 26.679 - ent = watch_events.next; 26.680 - if (ent != &watch_events) 26.681 - list_del(ent); 26.682 - spin_unlock(&watch_events_lock); 26.683 - 26.684 - if (ent != &watch_events) { 26.685 - msg = list_entry(ent, struct xs_stored_msg, list); 26.686 - msg->u.watch.handle->callback( 26.687 - msg->u.watch.handle, 26.688 - (const char **)msg->u.watch.vec, 26.689 - msg->u.watch.vec_size); 26.690 - free(msg->u.watch.vec); 26.691 - free(msg); 26.692 - } 26.693 - 26.694 - up(&xenwatch_mutex); 26.695 - } 26.696 -} 26.697 - 26.698 -static int process_msg(void) 26.699 -{ 26.700 - struct xs_stored_msg *msg; 26.701 - char *body; 26.702 - int err; 26.703 - 26.704 - msg = malloc(sizeof(*msg)); 26.705 - if (msg == NULL) 26.706 - return -ENOMEM; 26.707 - 26.708 - err = xb_read(&msg->hdr, sizeof(msg->hdr)); 26.709 - if (err) { 26.710 - free(msg); 26.711 - return err; 26.712 - } 26.713 - 26.714 - body = malloc(msg->hdr.len + 1); 26.715 - if (body == NULL) { 26.716 - free(msg); 26.717 - return -ENOMEM; 26.718 - } 26.719 - 26.720 - err = xb_read(body, msg->hdr.len); 26.721 - if (err) { 26.722 - free(body); 26.723 - free(msg); 26.724 - return err; 26.725 - } 26.726 - body[msg->hdr.len] = '\0'; 26.727 - 26.728 - if (msg->hdr.type == XS_WATCH_EVENT) { 26.729 - msg->u.watch.vec = split(body, msg->hdr.len, 26.730 - &msg->u.watch.vec_size); 26.731 - if (IS_ERR(msg->u.watch.vec)) { 26.732 - free(msg); 26.733 - return PTR_ERR(msg->u.watch.vec); 26.734 - } 26.735 - 26.736 - spin_lock(&watches_lock); 26.737 - msg->u.watch.handle = find_watch( 26.738 - msg->u.watch.vec[XS_WATCH_TOKEN]); 26.739 - if (msg->u.watch.handle != NULL) { 26.740 - spin_lock(&watch_events_lock); 26.741 - list_add_tail(&msg->list, &watch_events); 26.742 - wake_up(&watch_events_waitq); 26.743 - spin_unlock(&watch_events_lock); 26.744 - } else { 26.745 - free(msg->u.watch.vec); 26.746 - free(msg); 26.747 - } 26.748 - spin_unlock(&watches_lock); 26.749 - } else { 26.750 - msg->u.reply.body = body; 26.751 - spin_lock(&xs_state.reply_lock); 26.752 - list_add_tail(&msg->list, &xs_state.reply_list); 26.753 - spin_unlock(&xs_state.reply_lock); 26.754 - wake_up(&xs_state.reply_waitq); 26.755 - } 26.756 - 26.757 - return 0; 26.758 -} 26.759 - 26.760 -static void xenbus_thread(void *unused) 26.761 -{ 26.762 - int err; 26.763 - 26.764 - for (;;) { 26.765 - err = process_msg(); 26.766 - if (err) 26.767 - printk("XENBUS error %d while reading " 26.768 - "message\n", err); 26.769 - } 26.770 -} 26.771 - 26.772 -int xs_init(void) 26.773 -{ 26.774 - int err; 26.775 - struct thread *kxwatcher_thread; 26.776 - struct thread *kxenbus_thread; 26.777 - 26.778 - INIT_LIST_HEAD(&xs_state.reply_list); 26.779 - spin_lock_init(&xs_state.reply_lock); 26.780 - init_waitqueue_head(&xs_state.reply_waitq); 26.781 - 26.782 - init_MUTEX(&xs_state.request_mutex); 26.783 - init_rwsem(&xs_state.suspend_mutex); 26.784 - 26.785 - /* Initialize the shared memory rings to talk to xenstored */ 26.786 - err = xb_init_comms(); 26.787 - if (err) 26.788 - return err; 26.789 - 26.790 - kxwatcher_thread = create_thread("kxwatch", xenwatch_thread, NULL); 26.791 - if (IS_ERR(kxwatcher_thread)) 26.792 - return PTR_ERR(kxwatcher_thread); 26.793 - 26.794 - kxenbus_thread = create_thread("kxenbus", xenbus_thread, NULL); 26.795 - if (IS_ERR(kxenbus_thread)) 26.796 - return PTR_ERR(kxenbus_thread); 26.797 - 26.798 - return 0; 26.799 -}
27.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/cpu/common-xen.c Mon Mar 27 15:36:47 2006 -0700 27.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/cpu/common-xen.c Tue Mar 28 08:54:58 2006 -0700 27.3 @@ -34,8 +34,6 @@ static int disable_x86_serial_nr __devin 27.4 27.5 struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {}; 27.6 27.7 -extern void machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c); 27.8 - 27.9 extern int disable_pse; 27.10 27.11 static void default_init(struct cpuinfo_x86 * c) 27.12 @@ -425,8 +423,6 @@ void __devinit identify_cpu(struct cpuin 27.13 c->x86_vendor, c->x86_model); 27.14 } 27.15 27.16 - machine_specific_modify_cpu_capabilities(c); 27.17 - 27.18 /* Now the feature flags better reflect actual CPU features! */ 27.19 27.20 printk(KERN_DEBUG "CPU: After all inits, caps:");
28.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S Mon Mar 27 15:36:47 2006 -0700 28.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S Tue Mar 28 08:54:58 2006 -0700 28.3 @@ -462,7 +462,7 @@ vector=0 28.4 ENTRY(irq_entries_start) 28.5 .rept NR_IRQS 28.6 ALIGN 28.7 -1: pushl $vector-256 28.8 +1: pushl 0x80000000+$vector 28.9 jmp common_interrupt 28.10 .data 28.11 .long 1b 28.12 @@ -479,7 +479,7 @@ common_interrupt: 28.13 28.14 #define BUILD_INTERRUPT(name, nr) \ 28.15 ENTRY(name) \ 28.16 - pushl $nr-256; \ 28.17 + pushl 0x80000000+$nr; \ 28.18 SAVE_ALL \ 28.19 movl %esp,%eax; \ 28.20 call smp_/**/name; \
29.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S Mon Mar 27 15:36:47 2006 -0700 29.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S Tue Mar 28 08:54:58 2006 -0700 29.3 @@ -32,14 +32,14 @@ ENTRY(startup_32) 29.4 29.5 /* get vendor info */ 29.6 xorl %eax,%eax # call CPUID with 0 -> return vendor ID 29.7 - cpuid 29.8 + XEN_CPUID 29.9 movl %eax,X86_CPUID # save CPUID level 29.10 movl %ebx,X86_VENDOR_ID # lo 4 chars 29.11 movl %edx,X86_VENDOR_ID+4 # next 4 chars 29.12 movl %ecx,X86_VENDOR_ID+8 # last 4 chars 29.13 29.14 movl $1,%eax # Use the CPUID instruction to get CPU type 29.15 - cpuid 29.16 + XEN_CPUID 29.17 movb %al,%cl # save reg for future use 29.18 andb $0x0f,%ah # mask processor family 29.19 movb %ah,X86
30.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/irq-xen.c Mon Mar 27 15:36:47 2006 -0700 30.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/irq-xen.c Tue Mar 28 08:54:58 2006 -0700 30.3 @@ -53,8 +53,8 @@ static union irq_ctx *softirq_ctx[NR_CPU 30.4 */ 30.5 fastcall unsigned int do_IRQ(struct pt_regs *regs) 30.6 { 30.7 - /* high bits used in ret_from_ code */ 30.8 - int irq = regs->orig_eax & __IRQ_MASK(HARDIRQ_BITS); 30.9 + /* high bit used in ret_from_ code */ 30.10 + int irq = regs->orig_eax & __IRQ_MASK(BITS_PER_LONG - 1); 30.11 #ifdef CONFIG_4KSTACKS 30.12 union irq_ctx *curctx, *irqctx; 30.13 u32 *isp;
31.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Mon Mar 27 15:36:47 2006 -0700 31.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Tue Mar 28 08:54:58 2006 -0700 31.3 @@ -32,13 +32,13 @@ 31.4 #endif 31.5 31.6 static int direct_remap_area_pte_fn(pte_t *pte, 31.7 - struct page *pte_page, 31.8 + struct page *pmd_page, 31.9 unsigned long address, 31.10 void *data) 31.11 { 31.12 mmu_update_t **v = (mmu_update_t **)data; 31.13 31.14 - (*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pte_page)) << 31.15 + (*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pmd_page)) << 31.16 PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK); 31.17 (*v)++; 31.18 31.19 @@ -67,9 +67,9 @@ static int __direct_remap_pfn_range(stru 31.20 for (i = 0; i < size; i += PAGE_SIZE) { 31.21 if ((v - u) == (PAGE_SIZE / sizeof(mmu_update_t))) { 31.22 /* Fill in the PTE pointers. */ 31.23 - rc = generic_page_range(mm, start_address, 31.24 - address - start_address, 31.25 - direct_remap_area_pte_fn, &w); 31.26 + rc = apply_to_page_range(mm, start_address, 31.27 + address - start_address, 31.28 + direct_remap_area_pte_fn, &w); 31.29 if (rc) 31.30 goto out; 31.31 w = u; 31.32 @@ -93,8 +93,9 @@ static int __direct_remap_pfn_range(stru 31.33 31.34 if (v != u) { 31.35 /* get the ptep's filled in */ 31.36 - rc = generic_page_range(mm, start_address, address - start_address, 31.37 - direct_remap_area_pte_fn, &w); 31.38 + rc = apply_to_page_range(mm, start_address, 31.39 + address - start_address, 31.40 + direct_remap_area_pte_fn, &w); 31.41 if (rc) 31.42 goto out; 31.43 rc = -EFAULT; 31.44 @@ -142,11 +143,11 @@ int direct_kernel_remap_pfn_range(unsign 31.45 EXPORT_SYMBOL(direct_kernel_remap_pfn_range); 31.46 31.47 static int lookup_pte_fn( 31.48 - pte_t *pte, struct page *pte_page, unsigned long addr, void *data) 31.49 + pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) 31.50 { 31.51 uint64_t *ptep = (uint64_t *)data; 31.52 if (ptep) 31.53 - *ptep = ((uint64_t)pfn_to_mfn(page_to_pfn(pte_page)) << 31.54 + *ptep = ((uint64_t)pfn_to_mfn(page_to_pfn(pmd_page)) << 31.55 PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK); 31.56 return 0; 31.57 } 31.58 @@ -155,13 +156,14 @@ int create_lookup_pte_addr(struct mm_str 31.59 unsigned long address, 31.60 uint64_t *ptep) 31.61 { 31.62 - return generic_page_range(mm, address, PAGE_SIZE, lookup_pte_fn, ptep); 31.63 + return apply_to_page_range(mm, address, PAGE_SIZE, 31.64 + lookup_pte_fn, ptep); 31.65 } 31.66 31.67 EXPORT_SYMBOL(create_lookup_pte_addr); 31.68 31.69 static int noop_fn( 31.70 - pte_t *pte, struct page *pte_page, unsigned long addr, void *data) 31.71 + pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) 31.72 { 31.73 return 0; 31.74 } 31.75 @@ -170,7 +172,7 @@ int touch_pte_range(struct mm_struct *mm 31.76 unsigned long address, 31.77 unsigned long size) 31.78 { 31.79 - return generic_page_range(mm, address, size, noop_fn, NULL); 31.80 + return apply_to_page_range(mm, address, size, noop_fn, NULL); 31.81 } 31.82 31.83 EXPORT_SYMBOL(touch_pte_range);
32.1 --- a/linux-2.6-xen-sparse/arch/ia64/Kconfig Mon Mar 27 15:36:47 2006 -0700 32.2 +++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig Tue Mar 28 08:54:58 2006 -0700 32.3 @@ -84,19 +84,6 @@ config XEN_BLKDEV_BACKEND 32.4 bool 32.5 default y 32.6 32.7 -config XEN_VT 32.8 - bool "Override for turning on CONFIG_VT for domU" 32.9 - default y 32.10 - help 32.11 - Hack to turn off CONFIG_VT for domU 32.12 - 32.13 -config VT 32.14 - bool 32.15 - default y if XEN && XEN_VT 32.16 - default n if XEN && !XEN_VT 32.17 - help 32.18 - Hack to turn off CONFIG_VT for domU 32.19 - 32.20 config XEN_SYSFS 32.21 bool "Export Xen attributes in sysfs" 32.22 depends on XEN && SYSFS
33.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Mon Mar 27 15:36:47 2006 -0700 33.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Tue Mar 28 08:54:58 2006 -0700 33.3 @@ -506,6 +506,22 @@ setup_arch (char **cmdline_p) 33.4 conswitchp = &vga_con; 33.5 # endif 33.6 } 33.7 +#ifdef CONFIG_XEN 33.8 + if (running_on_xen) { 33.9 + extern shared_info_t *HYPERVISOR_shared_info; 33.10 + 33.11 + /* xen_start_info isn't setup yet, get the flags manually */ 33.12 + if (HYPERVISOR_shared_info->arch.flags & SIF_INITDOMAIN) { 33.13 + if (!(HYPERVISOR_shared_info->arch.flags & SIF_PRIVILEGED)) 33.14 + panic("Xen granted us console access " 33.15 + "but not privileged status"); 33.16 + } else { 33.17 + extern int console_use_vt; 33.18 + conswitchp = NULL; 33.19 + console_use_vt = 0; 33.20 + } 33.21 + } 33.22 +#endif 33.23 #endif 33.24 33.25 /* enable IA-64 Machine Check Abort Handling unless disabled */
34.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/apic-xen.c Mon Mar 27 15:36:47 2006 -0700 34.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/apic-xen.c Tue Mar 28 08:54:58 2006 -0700 34.3 @@ -114,8 +114,6 @@ void smp_apic_timer_interrupt(struct pt_ 34.4 irq_exit(); 34.5 } 34.6 34.7 -int __initdata unsync_tsc_on_multicluster; 34.8 - 34.9 /* 34.10 * This interrupt should _never_ happen with our APIC/SMP architecture 34.11 */
35.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S Mon Mar 27 15:36:47 2006 -0700 35.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S Tue Mar 28 08:54:58 2006 -0700 35.3 @@ -584,7 +584,7 @@ retint_kernel: 35.4 */ 35.5 .macro apicinterrupt num,func 35.6 INTR_FRAME 35.7 - pushq $\num-256 35.8 + pushq 0x8000000000000000+$\num 35.9 CFI_ADJUST_CFA_OFFSET 8 35.10 interrupt \func 35.11 jmp error_entry 35.12 @@ -855,32 +855,12 @@ ecrit: /**** END OF CRITICAL REGION *** 35.13 # i.e. it just resumes from the next instruction interrupted with the same context. 35.14 35.15 # Hypervisor uses this for application faults while it executes. 35.16 +# Unlike i386 there is no need to reload the saved segment selectors: 35.17 +# Xen already reloaded all valid ones and zeroed the others. 35.18 ENTRY(failsafe_callback) 35.19 - addq $0x10,%rsp /* skip rcx and r11 */ 35.20 -1: mov (%rsp),%ds 35.21 -2: mov 8(%rsp),%es 35.22 -3: mov 16(%rsp),%fs 35.23 -4: mov 24(%rsp),%gs 35.24 - addq $0x20,%rsp /* skip the above selectors */ 35.25 + addq $0x30,%rsp /* skip %rcx,%r11,%ds,%es,%fs,%gs */ 35.26 SAVE_ALL 35.27 jmp error_exit 35.28 -.section .fixup,"ax"; \ 35.29 -6: movq $0,(%rsp); \ 35.30 - jmp 1b; \ 35.31 -7: movq $0,8(%rsp); \ 35.32 - jmp 2b; \ 35.33 -8: movq $0,16(%rsp); \ 35.34 - jmp 3b; \ 35.35 -9: movq $0,24(%rsp); \ 35.36 - jmp 4b; \ 35.37 -.previous; \ 35.38 -.section __ex_table,"a";\ 35.39 - .align 16; \ 35.40 - .quad 1b,6b; \ 35.41 - .quad 2b,7b; \ 35.42 - .quad 3b,8b; \ 35.43 - .quad 4b,9b; \ 35.44 -.previous 35.45 35.46 #if 0 35.47 .section __ex_table,"a"
36.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/irq-xen.c Mon Mar 27 15:36:47 2006 -0700 36.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/irq-xen.c Tue Mar 28 08:54:58 2006 -0700 36.3 @@ -96,8 +96,8 @@ skip: 36.4 */ 36.5 asmlinkage unsigned int do_IRQ(struct pt_regs *regs) 36.6 { 36.7 - /* high bits used in ret_from_ code */ 36.8 - int irq = regs->orig_rax & __IRQ_MASK(HARDIRQ_BITS); 36.9 + /* high bit used in ret_from_ code */ 36.10 + int irq = regs->orig_rax & __IRQ_MASK(BITS_PER_LONG - 1); 36.11 36.12 exit_idle(); 36.13 irq_enter();
37.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Mon Mar 27 15:36:47 2006 -0700 37.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Tue Mar 28 08:54:58 2006 -0700 37.3 @@ -82,8 +82,6 @@ 37.4 extern unsigned long start_pfn; 37.5 extern struct edid_info edid_info; 37.6 37.7 -extern void machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c); 37.8 - 37.9 shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page; 37.10 EXPORT_SYMBOL(HYPERVISOR_shared_info); 37.11 37.12 @@ -1433,8 +1431,6 @@ void __cpuinit identify_cpu(struct cpuin 37.13 select_idle_routine(c); 37.14 detect_ht(c); 37.15 37.16 - machine_specific_modify_cpu_capabilities(c); 37.17 - 37.18 /* 37.19 * On SMP, boot_cpu_data holds the common feature set between 37.20 * all CPUs; so make sure that we indicate which features are
38.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon Mar 27 15:36:47 2006 -0700 38.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Tue Mar 28 08:54:58 2006 -0700 38.3 @@ -517,7 +517,7 @@ void balloon_update_driver_allowance(lon 38.4 } 38.5 38.6 static int dealloc_pte_fn( 38.7 - pte_t *pte, struct page *pte_page, unsigned long addr, void *data) 38.8 + pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) 38.9 { 38.10 unsigned long mfn = pte_mfn(*pte); 38.11 int ret; 38.12 @@ -547,8 +547,8 @@ struct page *balloon_alloc_empty_page_ra 38.13 scrub_pages(vstart, 1 << order); 38.14 38.15 balloon_lock(flags); 38.16 - ret = generic_page_range( 38.17 - &init_mm, vstart, PAGE_SIZE << order, dealloc_pte_fn, NULL); 38.18 + ret = apply_to_page_range(&init_mm, vstart, 38.19 + PAGE_SIZE << order, dealloc_pte_fn, NULL); 38.20 BUG_ON(ret); 38.21 current_pages -= 1UL << order; 38.22 totalram_pages = current_pages;
39.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Mon Mar 27 15:36:47 2006 -0700 39.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Tue Mar 28 08:54:58 2006 -0700 39.3 @@ -58,17 +58,37 @@ static int evtchn_to_irq[NR_EVENT_CHANNE 39.4 39.5 /* Packed IRQ information: binding type, sub-type index, and event channel. */ 39.6 static u32 irq_info[NR_IRQS]; 39.7 + 39.8 /* Binding types. */ 39.9 enum { IRQT_UNBOUND, IRQT_PIRQ, IRQT_VIRQ, IRQT_IPI, IRQT_EVTCHN }; 39.10 + 39.11 /* Constructor for packed IRQ information. */ 39.12 -#define mk_irq_info(type, index, evtchn) \ 39.13 - (((u32)(type) << 24) | ((u32)(index) << 16) | (u32)(evtchn)) 39.14 +static inline u32 mk_irq_info(u32 type, u32 index, u32 evtchn) 39.15 +{ 39.16 + return ((type << 24) | (index << 16) | evtchn); 39.17 +} 39.18 + 39.19 /* Convenient shorthand for packed representation of an unbound IRQ. */ 39.20 #define IRQ_UNBOUND mk_irq_info(IRQT_UNBOUND, 0, 0) 39.21 -/* Accessor macros for packed IRQ information. */ 39.22 -#define evtchn_from_irq(irq) ((u16)(irq_info[irq])) 39.23 -#define index_from_irq(irq) ((u8)(irq_info[irq] >> 16)) 39.24 -#define type_from_irq(irq) ((u8)(irq_info[irq] >> 24)) 39.25 + 39.26 +/* 39.27 + * Accessors for packed IRQ information. 39.28 + */ 39.29 + 39.30 +static inline unsigned int evtchn_from_irq(int irq) 39.31 +{ 39.32 + return (u16)(irq_info[irq]); 39.33 +} 39.34 + 39.35 +static inline unsigned int index_from_irq(int irq) 39.36 +{ 39.37 + return (u8)(irq_info[irq] >> 16); 39.38 +} 39.39 + 39.40 +static inline unsigned int type_from_irq(int irq) 39.41 +{ 39.42 + return (u8)(irq_info[irq] >> 24); 39.43 +} 39.44 39.45 /* IRQ <-> VIRQ mapping. */ 39.46 DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]); 39.47 @@ -90,10 +110,13 @@ static unsigned long pirq_needs_unmask_n 39.48 static u8 cpu_evtchn[NR_EVENT_CHANNELS]; 39.49 static unsigned long cpu_evtchn_mask[NR_CPUS][NR_EVENT_CHANNELS/BITS_PER_LONG]; 39.50 39.51 -#define active_evtchns(cpu,sh,idx) \ 39.52 - ((sh)->evtchn_pending[idx] & \ 39.53 - cpu_evtchn_mask[cpu][idx] & \ 39.54 - ~(sh)->evtchn_mask[idx]) 39.55 +static inline unsigned long active_evtchns(unsigned int cpu, shared_info_t *sh, 39.56 + unsigned int idx) 39.57 +{ 39.58 + return (sh->evtchn_pending[idx] & 39.59 + cpu_evtchn_mask[cpu][idx] & 39.60 + ~sh->evtchn_mask[idx]); 39.61 +} 39.62 39.63 static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) 39.64 { 39.65 @@ -109,16 +132,31 @@ static void init_evtchn_cpu_bindings(voi 39.66 memset(cpu_evtchn_mask[0], ~0, sizeof(cpu_evtchn_mask[0])); 39.67 } 39.68 39.69 -#define cpu_from_evtchn(evtchn) (cpu_evtchn[evtchn]) 39.70 +static inline unsigned int cpu_from_evtchn(unsigned int evtchn) 39.71 +{ 39.72 + return cpu_evtchn[evtchn]; 39.73 +} 39.74 39.75 #else 39.76 39.77 -#define active_evtchns(cpu,sh,idx) \ 39.78 - ((sh)->evtchn_pending[idx] & \ 39.79 - ~(sh)->evtchn_mask[idx]) 39.80 -#define bind_evtchn_to_cpu(chn,cpu) ((void)0) 39.81 -#define init_evtchn_cpu_bindings() ((void)0) 39.82 -#define cpu_from_evtchn(evtchn) (0) 39.83 +static inline unsigned long active_evtchns(unsigned int cpu, shared_info_t *sh, 39.84 + unsigned int idx) 39.85 +{ 39.86 + return (sh->evtchn_pending[idx] & ~sh->evtchn_mask[idx]); 39.87 +} 39.88 + 39.89 +static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) 39.90 +{ 39.91 +} 39.92 + 39.93 +static void init_evtchn_cpu_bindings(void) 39.94 +{ 39.95 +} 39.96 + 39.97 +static inline unsigned int cpu_from_evtchn(unsigned int evtchn) 39.98 +{ 39.99 + return 0; 39.100 +} 39.101 39.102 #endif 39.103 39.104 @@ -132,9 +170,9 @@ static inline void exit_idle(void) {} 39.105 #include <asm/idle.h> 39.106 #define IRQ_REG orig_rax 39.107 #endif 39.108 -#define do_IRQ(irq, regs) do { \ 39.109 - (regs)->IRQ_REG = (irq); \ 39.110 - do_IRQ((regs)); \ 39.111 +#define do_IRQ(irq, regs) do { \ 39.112 + (regs)->IRQ_REG = (irq) | (1UL << (BITS_PER_LONG - 1)); \ 39.113 + do_IRQ((regs)); \ 39.114 } while (0) 39.115 #endif 39.116
40.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Mon Mar 27 15:36:47 2006 -0700 40.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Tue Mar 28 08:54:58 2006 -0700 40.3 @@ -360,7 +360,7 @@ gnttab_request_free_callback(struct gntt 40.4 } 40.5 40.6 #ifndef __ia64__ 40.7 -static int map_pte_fn(pte_t *pte, struct page *pte_page, 40.8 +static int map_pte_fn(pte_t *pte, struct page *pmd_page, 40.9 unsigned long addr, void *data) 40.10 { 40.11 unsigned long **frames = (unsigned long **)data; 40.12 @@ -370,7 +370,7 @@ static int map_pte_fn(pte_t *pte, struct 40.13 return 0; 40.14 } 40.15 40.16 -static int unmap_pte_fn(pte_t *pte, struct page *pte_page, 40.17 +static int unmap_pte_fn(pte_t *pte, struct page *pmd_page, 40.18 unsigned long addr, void *data) 40.19 { 40.20 40.21 @@ -384,6 +384,7 @@ gnttab_resume(void) 40.22 { 40.23 gnttab_setup_table_t setup; 40.24 unsigned long frames[NR_GRANT_FRAMES]; 40.25 + int rc; 40.26 #ifndef __ia64__ 40.27 void *pframes = frames; 40.28 struct vm_struct *area; 40.29 @@ -393,8 +394,8 @@ gnttab_resume(void) 40.30 setup.nr_frames = NR_GRANT_FRAMES; 40.31 setup.frame_list = frames; 40.32 40.33 - BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1)); 40.34 - BUG_ON(setup.status != 0); 40.35 + rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1); 40.36 + BUG_ON(rc || setup.status); 40.37 40.38 #ifndef __ia64__ 40.39 if (shared == NULL) { 40.40 @@ -402,9 +403,10 @@ gnttab_resume(void) 40.41 BUG_ON(area == NULL); 40.42 shared = area->addr; 40.43 } 40.44 - BUG_ON(generic_page_range(&init_mm, (unsigned long)shared, 40.45 - PAGE_SIZE * NR_GRANT_FRAMES, 40.46 - map_pte_fn, &pframes)); 40.47 + rc = apply_to_page_range(&init_mm, (unsigned long)shared, 40.48 + PAGE_SIZE * NR_GRANT_FRAMES, 40.49 + map_pte_fn, &pframes); 40.50 + BUG_ON(rc); 40.51 #else 40.52 shared = __va(frames[0] << PAGE_SHIFT); 40.53 printk("grant table at %p\n", shared); 40.54 @@ -418,9 +420,9 @@ gnttab_suspend(void) 40.55 { 40.56 40.57 #ifndef __ia64__ 40.58 - generic_page_range(&init_mm, (unsigned long)shared, 40.59 - PAGE_SIZE * NR_GRANT_FRAMES, 40.60 - unmap_pte_fn, NULL); 40.61 + apply_to_page_range(&init_mm, (unsigned long)shared, 40.62 + PAGE_SIZE * NR_GRANT_FRAMES, 40.63 + unmap_pte_fn, NULL); 40.64 #endif 40.65 40.66 return 0;
41.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Mon Mar 27 15:36:47 2006 -0700 41.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Tue Mar 28 08:54:58 2006 -0700 41.3 @@ -25,9 +25,10 @@ void (*pm_power_off)(void); 41.4 EXPORT_SYMBOL(pm_power_off); 41.5 #endif 41.6 41.7 +extern void ctrl_alt_del(void); 41.8 + 41.9 #define SHUTDOWN_INVALID -1 41.10 #define SHUTDOWN_POWEROFF 0 41.11 -#define SHUTDOWN_REBOOT 1 41.12 #define SHUTDOWN_SUSPEND 2 41.13 /* Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only 41.14 * report a crash, not be instructed to crash! 41.15 @@ -234,33 +235,19 @@ static int shutdown_process(void *__unus 41.16 { 41.17 static char *envp[] = { "HOME=/", "TERM=linux", 41.18 "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; 41.19 - static char *restart_argv[] = { "/sbin/reboot", NULL }; 41.20 static char *poweroff_argv[] = { "/sbin/poweroff", NULL }; 41.21 41.22 extern asmlinkage long sys_reboot(int magic1, int magic2, 41.23 unsigned int cmd, void *arg); 41.24 41.25 - daemonize("shutdown"); 41.26 - 41.27 - switch (shutting_down) { 41.28 - case SHUTDOWN_POWEROFF: 41.29 - case SHUTDOWN_HALT: 41.30 + if ((shutting_down == SHUTDOWN_POWEROFF) || 41.31 + (shutting_down == SHUTDOWN_HALT)) { 41.32 if (execve("/sbin/poweroff", poweroff_argv, envp) < 0) { 41.33 sys_reboot(LINUX_REBOOT_MAGIC1, 41.34 LINUX_REBOOT_MAGIC2, 41.35 LINUX_REBOOT_CMD_POWER_OFF, 41.36 NULL); 41.37 } 41.38 - break; 41.39 - 41.40 - case SHUTDOWN_REBOOT: 41.41 - if (execve("/sbin/reboot", restart_argv, envp) < 0) { 41.42 - sys_reboot(LINUX_REBOOT_MAGIC1, 41.43 - LINUX_REBOOT_MAGIC2, 41.44 - LINUX_REBOOT_CMD_RESTART, 41.45 - NULL); 41.46 - } 41.47 - break; 41.48 } 41.49 41.50 shutting_down = SHUTDOWN_INVALID; /* could try again */ 41.51 @@ -331,7 +318,7 @@ static void shutdown_handler(struct xenb 41.52 if (strcmp(str, "poweroff") == 0) 41.53 shutting_down = SHUTDOWN_POWEROFF; 41.54 else if (strcmp(str, "reboot") == 0) 41.55 - shutting_down = SHUTDOWN_REBOOT; 41.56 + ctrl_alt_del(); 41.57 else if (strcmp(str, "suspend") == 0) 41.58 shutting_down = SHUTDOWN_SUSPEND; 41.59 else if (strcmp(str, "halt") == 0) 41.60 @@ -391,8 +378,6 @@ static struct xenbus_watch sysrq_watch = 41.61 }; 41.62 #endif 41.63 41.64 -static struct notifier_block xenstore_notifier; 41.65 - 41.66 static int setup_shutdown_watcher(struct notifier_block *notifier, 41.67 unsigned long event, 41.68 void *data) 41.69 @@ -420,11 +405,10 @@ static int setup_shutdown_watcher(struct 41.70 41.71 static int __init setup_shutdown_event(void) 41.72 { 41.73 - 41.74 - xenstore_notifier.notifier_call = setup_shutdown_watcher; 41.75 - 41.76 + static struct notifier_block xenstore_notifier = { 41.77 + .notifier_call = setup_shutdown_watcher 41.78 + }; 41.79 register_xenstore_notifier(&xenstore_notifier); 41.80 - 41.81 return 0; 41.82 } 41.83
42.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Mon Mar 27 15:36:47 2006 -0700 42.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Mar 28 08:54:58 2006 -0700 42.3 @@ -331,7 +331,7 @@ static void net_rx_action(unsigned long 42.4 if (make_rx_response(netif, id, status, 42.5 (unsigned long)skb->data & ~PAGE_MASK, 42.6 size, skb->proto_csum_valid ? 42.7 - NETRXF_csum_valid : 0) && 42.8 + NETRXF_data_validated : 0) && 42.9 (rx_notify[irq] == 0)) { 42.10 rx_notify[irq] = 1; 42.11 notify_list[notify_nr++] = irq;
43.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Mar 27 15:36:47 2006 -0700 43.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Mar 28 08:54:58 2006 -0700 43.3 @@ -68,18 +68,12 @@ 43.4 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) 43.5 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) 43.6 43.7 -#define alloc_xen_skb(_l) __dev_alloc_skb((_l), GFP_ATOMIC|__GFP_NOWARN) 43.8 - 43.9 -#define init_skb_shinfo(_skb) \ 43.10 - do { \ 43.11 - atomic_set(&(skb_shinfo(_skb)->dataref), 1); \ 43.12 - skb_shinfo(_skb)->nr_frags = 0; \ 43.13 - skb_shinfo(_skb)->frag_list = NULL; \ 43.14 - } while (0) 43.15 - 43.16 -static unsigned long rx_pfn_array[NET_RX_RING_SIZE]; 43.17 -static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1]; 43.18 -static mmu_update_t rx_mmu[NET_RX_RING_SIZE]; 43.19 +static inline void init_skb_shinfo(struct sk_buff *skb) 43.20 +{ 43.21 + atomic_set(&(skb_shinfo(skb)->dataref), 1); 43.22 + skb_shinfo(skb)->nr_frags = 0; 43.23 + skb_shinfo(skb)->frag_list = NULL; 43.24 +} 43.25 43.26 struct netfront_info 43.27 { 43.28 @@ -134,16 +128,28 @@ struct netfront_info 43.29 int tx_ring_ref; 43.30 int rx_ring_ref; 43.31 u8 mac[ETH_ALEN]; 43.32 + 43.33 + unsigned long rx_pfn_array[NET_RX_RING_SIZE]; 43.34 + multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1]; 43.35 + mmu_update_t rx_mmu[NET_RX_RING_SIZE]; 43.36 }; 43.37 43.38 -/* Access macros for acquiring freeing slots in {tx,rx}_skbs[]. */ 43.39 -#define ADD_ID_TO_FREELIST(_list, _id) \ 43.40 - (_list)[(_id)] = (_list)[0]; \ 43.41 - (_list)[0] = (void *)(unsigned long)(_id); 43.42 -#define GET_ID_FROM_FREELIST(_list) \ 43.43 - ({ unsigned long _id = (unsigned long)(_list)[0]; \ 43.44 - (_list)[0] = (_list)[_id]; \ 43.45 - (unsigned short)_id; }) 43.46 +/* 43.47 + * Access macros for acquiring freeing slots in {tx,rx}_skbs[]. 43.48 + */ 43.49 + 43.50 +static inline void add_id_to_freelist(struct sk_buff **list, unsigned short id) 43.51 +{ 43.52 + list[id] = list[0]; 43.53 + list[0] = (void *)(unsigned long)id; 43.54 +} 43.55 + 43.56 +static inline unsigned short get_id_from_freelist(struct sk_buff **list) 43.57 +{ 43.58 + unsigned int id = (unsigned int)(unsigned long)list[0]; 43.59 + list[0] = list[id]; 43.60 + return id; 43.61 +} 43.62 43.63 #ifdef DEBUG 43.64 static char *be_state_name[] = { 43.65 @@ -484,7 +490,7 @@ static void network_tx_buf_gc(struct net 43.66 gnttab_release_grant_reference( 43.67 &np->gref_tx_head, np->grant_tx_ref[id]); 43.68 np->grant_tx_ref[id] = GRANT_INVALID_REF; 43.69 - ADD_ID_TO_FREELIST(np->tx_skbs, id); 43.70 + add_id_to_freelist(np->tx_skbs, id); 43.71 dev_kfree_skb_irq(skb); 43.72 } 43.73 43.74 @@ -545,9 +551,10 @@ static void network_alloc_rx_buffers(str 43.75 * Subtract dev_alloc_skb headroom (16 bytes) and shared info 43.76 * tailroom then round down to SKB_DATA_ALIGN boundary. 43.77 */ 43.78 - skb = alloc_xen_skb( 43.79 + skb = __dev_alloc_skb( 43.80 ((PAGE_SIZE - sizeof(struct skb_shared_info)) & 43.81 - (-SKB_DATA_ALIGN(1))) - 16); 43.82 + (-SKB_DATA_ALIGN(1))) - 16, 43.83 + GFP_ATOMIC|__GFP_NOWARN); 43.84 if (skb == NULL) { 43.85 /* Any skbuffs queued for refill? Force them out. */ 43.86 if (i != 0) 43.87 @@ -576,7 +583,7 @@ static void network_alloc_rx_buffers(str 43.88 43.89 skb->dev = dev; 43.90 43.91 - id = GET_ID_FROM_FREELIST(np->rx_skbs); 43.92 + id = get_id_from_freelist(np->rx_skbs); 43.93 43.94 np->rx_skbs[id] = skb; 43.95 43.96 @@ -588,13 +595,13 @@ static void network_alloc_rx_buffers(str 43.97 np->xbdev->otherend_id, 43.98 __pa(skb->head) >> PAGE_SHIFT); 43.99 RING_GET_REQUEST(&np->rx, req_prod + i)->gref = ref; 43.100 - rx_pfn_array[i] = virt_to_mfn(skb->head); 43.101 + np->rx_pfn_array[i] = virt_to_mfn(skb->head); 43.102 43.103 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 43.104 /* Remove this page before passing back to Xen. */ 43.105 set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT, 43.106 INVALID_P2M_ENTRY); 43.107 - MULTI_update_va_mapping(rx_mcl+i, 43.108 + MULTI_update_va_mapping(np->rx_mcl+i, 43.109 (unsigned long)skb->head, 43.110 __pte(0), 0); 43.111 } 43.112 @@ -603,7 +610,7 @@ static void network_alloc_rx_buffers(str 43.113 /* Tell the ballon driver what is going on. */ 43.114 balloon_update_driver_allowance(i); 43.115 43.116 - reservation.extent_start = rx_pfn_array; 43.117 + reservation.extent_start = np->rx_pfn_array; 43.118 reservation.nr_extents = i; 43.119 reservation.extent_order = 0; 43.120 reservation.address_bits = 0; 43.121 @@ -611,19 +618,19 @@ static void network_alloc_rx_buffers(str 43.122 43.123 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 43.124 /* After all PTEs have been zapped, flush the TLB. */ 43.125 - rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] = 43.126 + np->rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] = 43.127 UVMF_TLB_FLUSH|UVMF_ALL; 43.128 43.129 /* Give away a batch of pages. */ 43.130 - rx_mcl[i].op = __HYPERVISOR_memory_op; 43.131 - rx_mcl[i].args[0] = XENMEM_decrease_reservation; 43.132 - rx_mcl[i].args[1] = (unsigned long)&reservation; 43.133 + np->rx_mcl[i].op = __HYPERVISOR_memory_op; 43.134 + np->rx_mcl[i].args[0] = XENMEM_decrease_reservation; 43.135 + np->rx_mcl[i].args[1] = (unsigned long)&reservation; 43.136 43.137 /* Zap PTEs and give away pages in one big multicall. */ 43.138 - (void)HYPERVISOR_multicall(rx_mcl, i+1); 43.139 + (void)HYPERVISOR_multicall(np->rx_mcl, i+1); 43.140 43.141 /* Check return status of HYPERVISOR_memory_op(). */ 43.142 - if (unlikely(rx_mcl[i].result != i)) 43.143 + if (unlikely(np->rx_mcl[i].result != i)) 43.144 panic("Unable to reduce memory reservation\n"); 43.145 } else 43.146 if (HYPERVISOR_memory_op(XENMEM_decrease_reservation, 43.147 @@ -656,7 +663,8 @@ static int network_start_xmit(struct sk_ 43.148 if (unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >= 43.149 PAGE_SIZE)) { 43.150 struct sk_buff *nskb; 43.151 - if (unlikely((nskb = alloc_xen_skb(skb->len)) == NULL)) 43.152 + nskb = __dev_alloc_skb(skb->len, GFP_ATOMIC|__GFP_NOWARN); 43.153 + if (unlikely(nskb == NULL)) 43.154 goto drop; 43.155 skb_put(nskb, skb->len); 43.156 memcpy(nskb->data, skb->data, skb->len); 43.157 @@ -674,7 +682,7 @@ static int network_start_xmit(struct sk_ 43.158 43.159 i = np->tx.req_prod_pvt; 43.160 43.161 - id = GET_ID_FROM_FREELIST(np->tx_skbs); 43.162 + id = get_id_from_freelist(np->tx_skbs); 43.163 np->tx_skbs[id] = skb; 43.164 43.165 tx = RING_GET_REQUEST(&np->tx, i); 43.166 @@ -739,8 +747,8 @@ static int netif_poll(struct net_device 43.167 struct sk_buff *skb, *nskb; 43.168 netif_rx_response_t *rx; 43.169 RING_IDX i, rp; 43.170 - mmu_update_t *mmu = rx_mmu; 43.171 - multicall_entry_t *mcl = rx_mcl; 43.172 + mmu_update_t *mmu = np->rx_mmu; 43.173 + multicall_entry_t *mcl = np->rx_mcl; 43.174 int work_done, budget, more_to_do = 1; 43.175 struct sk_buff_head rxq; 43.176 unsigned long flags; 43.177 @@ -796,14 +804,14 @@ static int netif_poll(struct net_device 43.178 np->grant_rx_ref[rx->id] = GRANT_INVALID_REF; 43.179 43.180 skb = np->rx_skbs[rx->id]; 43.181 - ADD_ID_TO_FREELIST(np->rx_skbs, rx->id); 43.182 + add_id_to_freelist(np->rx_skbs, rx->id); 43.183 43.184 /* NB. We handle skb overflow later. */ 43.185 skb->data = skb->head + rx->offset; 43.186 skb->len = rx->status; 43.187 skb->tail = skb->data + skb->len; 43.188 43.189 - if (rx->flags & NETRXF_csum_valid) 43.190 + if (rx->flags & NETRXF_data_validated) 43.191 skb->ip_summed = CHECKSUM_UNNECESSARY; 43.192 43.193 np->stats.rx_packets++; 43.194 @@ -831,14 +839,14 @@ static int netif_poll(struct net_device 43.195 balloon_update_driver_allowance(-work_done); 43.196 43.197 /* Do all the remapping work, and M2P updates, in one big hypercall. */ 43.198 - if (likely((mcl - rx_mcl) != 0)) { 43.199 + if (likely((mcl - np->rx_mcl) != 0)) { 43.200 mcl->op = __HYPERVISOR_mmu_update; 43.201 - mcl->args[0] = (unsigned long)rx_mmu; 43.202 - mcl->args[1] = mmu - rx_mmu; 43.203 + mcl->args[0] = (unsigned long)np->rx_mmu; 43.204 + mcl->args[1] = mmu - np->rx_mmu; 43.205 mcl->args[2] = 0; 43.206 mcl->args[3] = DOMID_SELF; 43.207 mcl++; 43.208 - (void)HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl); 43.209 + (void)HYPERVISOR_multicall(np->rx_mcl, mcl - np->rx_mcl); 43.210 } 43.211 43.212 while ((skb = __skb_dequeue(&rxq)) != NULL) { 43.213 @@ -871,7 +879,8 @@ static int netif_poll(struct net_device 43.214 16 - (skb->data - skb->head)); 43.215 } 43.216 43.217 - nskb = alloc_xen_skb(skb->len + 2); 43.218 + nskb = __dev_alloc_skb(skb->len + 2, 43.219 + GFP_ATOMIC|__GFP_NOWARN); 43.220 if (nskb != NULL) { 43.221 skb_reserve(nskb, 2); 43.222 skb_put(nskb, skb->len);
44.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/passthrough.c Mon Mar 27 15:36:47 2006 -0700 44.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/passthrough.c Tue Mar 28 08:54:58 2006 -0700 44.3 @@ -7,10 +7,13 @@ 44.4 44.5 #include <linux/list.h> 44.6 #include <linux/pci.h> 44.7 +#include <linux/spinlock.h> 44.8 #include "pciback.h" 44.9 44.10 struct passthrough_dev_data { 44.11 + /* Access to dev_list must be protected by lock */ 44.12 struct list_head dev_list; 44.13 + spinlock_t lock; 44.14 }; 44.15 44.16 struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev, 44.17 @@ -19,33 +22,66 @@ struct pci_dev *pciback_get_pci_dev(stru 44.18 { 44.19 struct passthrough_dev_data *dev_data = pdev->pci_dev_data; 44.20 struct pci_dev_entry *dev_entry; 44.21 + struct pci_dev *dev = NULL; 44.22 + unsigned long flags; 44.23 + 44.24 + spin_lock_irqsave(&dev_data->lock, flags); 44.25 44.26 list_for_each_entry(dev_entry, &dev_data->dev_list, list) { 44.27 if (domain == (unsigned int)pci_domain_nr(dev_entry->dev->bus) 44.28 && bus == (unsigned int)dev_entry->dev->bus->number 44.29 - && devfn == dev_entry->dev->devfn) 44.30 - return dev_entry->dev; 44.31 + && devfn == dev_entry->dev->devfn) { 44.32 + dev = dev_entry->dev; 44.33 + break; 44.34 + } 44.35 } 44.36 44.37 - return NULL; 44.38 + spin_unlock_irqrestore(&dev_data->lock, flags); 44.39 + 44.40 + return dev; 44.41 } 44.42 44.43 -/* Must hold pciback_device->dev_lock when calling this */ 44.44 int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev) 44.45 { 44.46 struct passthrough_dev_data *dev_data = pdev->pci_dev_data; 44.47 struct pci_dev_entry *dev_entry; 44.48 + unsigned long flags; 44.49 44.50 dev_entry = kmalloc(sizeof(*dev_entry), GFP_KERNEL); 44.51 if (!dev_entry) 44.52 return -ENOMEM; 44.53 dev_entry->dev = dev; 44.54 44.55 + spin_lock_irqsave(&dev_data->lock, flags); 44.56 list_add_tail(&dev_entry->list, &dev_data->dev_list); 44.57 + spin_unlock_irqrestore(&dev_data->lock, flags); 44.58 44.59 return 0; 44.60 } 44.61 44.62 +void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev) 44.63 +{ 44.64 + struct passthrough_dev_data *dev_data = pdev->pci_dev_data; 44.65 + struct pci_dev_entry *dev_entry, *t; 44.66 + struct pci_dev *found_dev = NULL; 44.67 + unsigned long flags; 44.68 + 44.69 + spin_lock_irqsave(&dev_data->lock, flags); 44.70 + 44.71 + list_for_each_entry_safe(dev_entry, t, &dev_data->dev_list, list) { 44.72 + if (dev_entry->dev == dev) { 44.73 + list_del(&dev_entry->list); 44.74 + found_dev = dev_entry->dev; 44.75 + kfree(dev_entry); 44.76 + } 44.77 + } 44.78 + 44.79 + spin_unlock_irqrestore(&dev_data->lock, flags); 44.80 + 44.81 + if (found_dev) 44.82 + pcistub_put_pci_dev(found_dev); 44.83 +} 44.84 + 44.85 int pciback_init_devices(struct pciback_device *pdev) 44.86 { 44.87 struct passthrough_dev_data *dev_data; 44.88 @@ -54,6 +90,8 @@ int pciback_init_devices(struct pciback_ 44.89 if (!dev_data) 44.90 return -ENOMEM; 44.91 44.92 + spin_lock_init(&dev_data->lock); 44.93 + 44.94 INIT_LIST_HEAD(&dev_data->dev_list); 44.95 44.96 pdev->pci_dev_data = dev_data; 44.97 @@ -71,6 +109,8 @@ int pciback_publish_pci_roots(struct pci 44.98 int found; 44.99 unsigned int domain, bus; 44.100 44.101 + spin_lock(&dev_data->lock); 44.102 + 44.103 list_for_each_entry(dev_entry, &dev_data->dev_list, list) { 44.104 /* Only publish this device as a root if none of its 44.105 * parent bridges are exported 44.106 @@ -96,10 +136,11 @@ int pciback_publish_pci_roots(struct pci 44.107 } 44.108 } 44.109 44.110 + spin_unlock(&dev_data->lock); 44.111 + 44.112 return err; 44.113 } 44.114 44.115 -/* Must hold pciback_device->dev_lock when calling this */ 44.116 void pciback_release_devices(struct pciback_device *pdev) 44.117 { 44.118 struct passthrough_dev_data *dev_data = pdev->pci_dev_data;
45.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c Mon Mar 27 15:36:47 2006 -0700 45.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c Tue Mar 28 08:54:58 2006 -0700 45.3 @@ -7,110 +7,190 @@ 45.4 #include <linux/init.h> 45.5 #include <linux/list.h> 45.6 #include <linux/spinlock.h> 45.7 +#include <linux/kref.h> 45.8 #include <asm/atomic.h> 45.9 #include "pciback.h" 45.10 45.11 static char *pci_devs_to_hide = NULL; 45.12 module_param_named(hide, pci_devs_to_hide, charp, 0444); 45.13 45.14 -struct pci_stub_device_id { 45.15 +struct pcistub_device_id { 45.16 struct list_head slot_list; 45.17 int domain; 45.18 unsigned char bus; 45.19 unsigned int devfn; 45.20 }; 45.21 -LIST_HEAD(pci_stub_device_ids); 45.22 +static LIST_HEAD(pcistub_device_ids); 45.23 +static DEFINE_SPINLOCK(device_ids_lock); 45.24 45.25 -struct pci_stub_device { 45.26 +struct pcistub_device { 45.27 + struct kref kref; 45.28 struct list_head dev_list; 45.29 + spinlock_t lock; 45.30 + 45.31 struct pci_dev *dev; 45.32 - atomic_t in_use; 45.33 + struct pciback_device *pdev; /* non-NULL if struct pci_dev is in use */ 45.34 }; 45.35 -/* Access to pci_stub_devices & seized_devices lists and the initialize_devices 45.36 - * flag must be locked with pci_stub_devices_lock 45.37 +/* Access to pcistub_devices & seized_devices lists and the initialize_devices 45.38 + * flag must be locked with pcistub_devices_lock 45.39 */ 45.40 -DEFINE_SPINLOCK(pci_stub_devices_lock); 45.41 -LIST_HEAD(pci_stub_devices); 45.42 +static DEFINE_SPINLOCK(pcistub_devices_lock); 45.43 +static LIST_HEAD(pcistub_devices); 45.44 45.45 /* wait for device_initcall before initializing our devices 45.46 * (see pcistub_init_devices_late) 45.47 */ 45.48 static int initialize_devices = 0; 45.49 -LIST_HEAD(seized_devices); 45.50 +static LIST_HEAD(seized_devices); 45.51 45.52 -static inline struct pci_dev *get_pci_dev(struct pci_stub_device *psdev) 45.53 +static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev) 45.54 { 45.55 - if (atomic_dec_and_test(&psdev->in_use)) 45.56 - return psdev->dev; 45.57 - else { 45.58 - atomic_inc(&psdev->in_use); 45.59 + struct pcistub_device *psdev; 45.60 + 45.61 + dev_dbg(&dev->dev, "pcistub_device_alloc\n"); 45.62 + 45.63 + psdev = kzalloc(sizeof(*psdev), GFP_ATOMIC); 45.64 + if (!psdev) 45.65 + return NULL; 45.66 + 45.67 + psdev->dev = pci_dev_get(dev); 45.68 + if (!psdev->dev) { 45.69 + kfree(psdev); 45.70 return NULL; 45.71 } 45.72 + 45.73 + kref_init(&psdev->kref); 45.74 + spin_lock_init(&psdev->lock); 45.75 + 45.76 + return psdev; 45.77 +} 45.78 + 45.79 +/* Don't call this directly as it's called by pcistub_device_put */ 45.80 +static void pcistub_device_release(struct kref *kref) 45.81 +{ 45.82 + struct pcistub_device *psdev; 45.83 + 45.84 + psdev = container_of(kref, struct pcistub_device, kref); 45.85 + 45.86 + dev_dbg(&psdev->dev->dev, "pcistub_device_release\n"); 45.87 + 45.88 + /* Clean-up the device */ 45.89 + pciback_reset_device(psdev->dev); 45.90 + pciback_config_free(psdev->dev); 45.91 + kfree(pci_get_drvdata(psdev->dev)); 45.92 + pci_set_drvdata(psdev->dev, NULL); 45.93 + 45.94 + pci_dev_put(psdev->dev); 45.95 + 45.96 + kfree(psdev); 45.97 } 45.98 45.99 -struct pci_dev *pcistub_get_pci_dev_by_slot(int domain, int bus, 45.100 +static inline void pcistub_device_get(struct pcistub_device *psdev) 45.101 +{ 45.102 + kref_get(&psdev->kref); 45.103 +} 45.104 + 45.105 +static inline void pcistub_device_put(struct pcistub_device *psdev) 45.106 +{ 45.107 + kref_put(&psdev->kref, pcistub_device_release); 45.108 +} 45.109 + 45.110 +static struct pci_dev *pcistub_device_get_pci_dev(struct pciback_device *pdev, 45.111 + struct pcistub_device *psdev) 45.112 +{ 45.113 + struct pci_dev *pci_dev = NULL; 45.114 + unsigned long flags; 45.115 + 45.116 + pcistub_device_get(psdev); 45.117 + 45.118 + spin_lock_irqsave(&psdev->lock, flags); 45.119 + if (!psdev->pdev) { 45.120 + psdev->pdev = pdev; 45.121 + pci_dev = psdev->dev; 45.122 + } 45.123 + spin_unlock_irqrestore(&psdev->lock, flags); 45.124 + 45.125 + if (!pci_dev) 45.126 + pcistub_device_put(psdev); 45.127 + 45.128 + return pci_dev; 45.129 +} 45.130 + 45.131 +struct pci_dev *pcistub_get_pci_dev_by_slot(struct pciback_device *pdev, 45.132 + int domain, int bus, 45.133 int slot, int func) 45.134 { 45.135 - struct pci_stub_device *psdev; 45.136 + struct pcistub_device *psdev; 45.137 struct pci_dev *found_dev = NULL; 45.138 + unsigned long flags; 45.139 45.140 - spin_lock(&pci_stub_devices_lock); 45.141 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.142 45.143 - list_for_each_entry(psdev, &pci_stub_devices, dev_list) { 45.144 + list_for_each_entry(psdev, &pcistub_devices, dev_list) { 45.145 if (psdev->dev != NULL 45.146 && domain == pci_domain_nr(psdev->dev->bus) 45.147 && bus == psdev->dev->bus->number 45.148 && PCI_DEVFN(slot, func) == psdev->dev->devfn) { 45.149 - found_dev = get_pci_dev(psdev); 45.150 + found_dev = pcistub_device_get_pci_dev(pdev, psdev); 45.151 break; 45.152 } 45.153 } 45.154 45.155 - spin_unlock(&pci_stub_devices_lock); 45.156 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.157 return found_dev; 45.158 } 45.159 45.160 -struct pci_dev *pcistub_get_pci_dev(struct pci_dev *dev) 45.161 +struct pci_dev *pcistub_get_pci_dev(struct pciback_device *pdev, 45.162 + struct pci_dev *dev) 45.163 { 45.164 - struct pci_stub_device *psdev; 45.165 + struct pcistub_device *psdev; 45.166 struct pci_dev *found_dev = NULL; 45.167 + unsigned long flags; 45.168 45.169 - spin_lock(&pci_stub_devices_lock); 45.170 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.171 45.172 - list_for_each_entry(psdev, &pci_stub_devices, dev_list) { 45.173 + list_for_each_entry(psdev, &pcistub_devices, dev_list) { 45.174 if (psdev->dev == dev) { 45.175 - found_dev = get_pci_dev(psdev); 45.176 + found_dev = pcistub_device_get_pci_dev(pdev, psdev); 45.177 break; 45.178 } 45.179 } 45.180 45.181 - spin_unlock(&pci_stub_devices_lock); 45.182 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.183 return found_dev; 45.184 } 45.185 45.186 void pcistub_put_pci_dev(struct pci_dev *dev) 45.187 { 45.188 - struct pci_stub_device *psdev; 45.189 + struct pcistub_device *psdev, *found_psdev = NULL; 45.190 + unsigned long flags; 45.191 45.192 - spin_lock(&pci_stub_devices_lock); 45.193 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.194 45.195 - list_for_each_entry(psdev, &pci_stub_devices, dev_list) { 45.196 + list_for_each_entry(psdev, &pcistub_devices, dev_list) { 45.197 if (psdev->dev == dev) { 45.198 - /* Cleanup our device 45.199 - * (so it's ready for the next domain) 45.200 - */ 45.201 - pciback_reset_device(psdev->dev); 45.202 - 45.203 - atomic_inc(&psdev->in_use); 45.204 + found_psdev = psdev; 45.205 break; 45.206 } 45.207 } 45.208 45.209 - spin_unlock(&pci_stub_devices_lock); 45.210 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.211 + 45.212 + /* Cleanup our device 45.213 + * (so it's ready for the next domain) 45.214 + */ 45.215 + pciback_reset_device(found_psdev->dev); 45.216 + pciback_config_reset(found_psdev->dev); 45.217 + 45.218 + spin_lock_irqsave(&found_psdev->lock, flags); 45.219 + found_psdev->pdev = NULL; 45.220 + spin_unlock_irqrestore(&found_psdev->lock, flags); 45.221 + 45.222 + pcistub_device_put(found_psdev); 45.223 } 45.224 45.225 -static int __devinit pcistub_match(struct pci_dev *dev, 45.226 - struct pci_stub_device_id *pdev_id) 45.227 +static int __devinit pcistub_match_one(struct pci_dev *dev, 45.228 + struct pcistub_device_id *pdev_id) 45.229 { 45.230 /* Match the specified device by domain, bus, slot, func and also if 45.231 * any of the device's parent bridges match. 45.232 @@ -125,23 +205,44 @@ static int __devinit pcistub_match(struc 45.233 return 0; 45.234 } 45.235 45.236 +static int __devinit pcistub_match(struct pci_dev *dev) 45.237 +{ 45.238 + struct pcistub_device_id *pdev_id; 45.239 + unsigned long flags; 45.240 + int found = 0; 45.241 + 45.242 + spin_lock_irqsave(&device_ids_lock, flags); 45.243 + list_for_each_entry(pdev_id, &pcistub_device_ids, slot_list) { 45.244 + if (pcistub_match_one(dev, pdev_id)) { 45.245 + found = 1; 45.246 + break; 45.247 + } 45.248 + } 45.249 + spin_unlock_irqrestore(&device_ids_lock, flags); 45.250 + 45.251 + return found; 45.252 +} 45.253 + 45.254 static int __devinit pcistub_init_device(struct pci_dev *dev) 45.255 { 45.256 struct pciback_dev_data *dev_data; 45.257 int err = 0; 45.258 45.259 + dev_dbg(&dev->dev, "initializing...\n"); 45.260 + 45.261 /* The PCI backend is not intended to be a module (or to work with 45.262 * removable PCI devices (yet). If it were, pciback_config_free() 45.263 * would need to be called somewhere to free the memory allocated 45.264 * here and then to call kfree(pci_get_drvdata(psdev->dev)). 45.265 */ 45.266 - dev_data = kmalloc(sizeof(*dev_data), GFP_KERNEL); 45.267 + dev_data = kmalloc(sizeof(*dev_data), GFP_ATOMIC); 45.268 if (!dev_data) { 45.269 err = -ENOMEM; 45.270 goto out; 45.271 } 45.272 pci_set_drvdata(dev, dev_data); 45.273 45.274 + dev_dbg(&dev->dev, "initializing config\n"); 45.275 err = pciback_config_init(dev); 45.276 if (err) 45.277 goto out; 45.278 @@ -153,14 +254,15 @@ static int __devinit pcistub_init_device 45.279 * This makes the assumption that the device's resources won't 45.280 * change after this point (otherwise this code may break!) 45.281 */ 45.282 + dev_dbg(&dev->dev, "enabling device\n"); 45.283 err = pci_enable_device(dev); 45.284 if (err) 45.285 goto config_release; 45.286 45.287 /* Now disable the device (this also ensures some private device 45.288 * data is setup before we export) 45.289 - * This calls pciback_config_reset(dev) 45.290 */ 45.291 + dev_dbg(&dev->dev, "reset device\n"); 45.292 pciback_reset_device(dev); 45.293 45.294 return 0; 45.295 @@ -182,60 +284,82 @@ static int __devinit pcistub_init_device 45.296 */ 45.297 static int __init pcistub_init_devices_late(void) 45.298 { 45.299 - struct pci_stub_device *psdev, *t; 45.300 + struct pcistub_device *psdev; 45.301 + unsigned long flags; 45.302 int err = 0; 45.303 45.304 - spin_lock(&pci_stub_devices_lock); 45.305 + pr_debug("pciback: pcistub_init_devices_late\n"); 45.306 + 45.307 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.308 45.309 - list_for_each_entry_safe(psdev, t, &seized_devices, dev_list) { 45.310 + while (!list_empty(&seized_devices)) { 45.311 + psdev = container_of(seized_devices.next, 45.312 + struct pcistub_device, dev_list); 45.313 list_del(&psdev->dev_list); 45.314 + 45.315 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.316 + 45.317 err = pcistub_init_device(psdev->dev); 45.318 if (err) { 45.319 - printk(KERN_ERR 45.320 - "pciback: %s error %d initializing device\n", 45.321 - pci_name(psdev->dev), err); 45.322 + dev_err(&psdev->dev->dev, 45.323 + "error %d initializing device\n", err); 45.324 kfree(psdev); 45.325 - continue; 45.326 + psdev = NULL; 45.327 } 45.328 45.329 - list_add_tail(&psdev->dev_list, &pci_stub_devices); 45.330 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.331 + 45.332 + if (psdev) 45.333 + list_add_tail(&psdev->dev_list, &pcistub_devices); 45.334 } 45.335 45.336 initialize_devices = 1; 45.337 45.338 - spin_unlock(&pci_stub_devices_lock); 45.339 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.340 45.341 return 0; 45.342 } 45.343 45.344 static int __devinit pcistub_seize(struct pci_dev *dev) 45.345 { 45.346 - struct pci_stub_device *psdev; 45.347 + struct pcistub_device *psdev; 45.348 + unsigned long flags; 45.349 + int initialize_devices_copy; 45.350 int err = 0; 45.351 45.352 - psdev = kmalloc(sizeof(*psdev), GFP_KERNEL); 45.353 + psdev = pcistub_device_alloc(dev); 45.354 if (!psdev) 45.355 return -ENOMEM; 45.356 45.357 - psdev->dev = dev; 45.358 - atomic_set(&psdev->in_use, 1); 45.359 + /* initialize_devices has to be accessed under a spin lock. But since 45.360 + * it can only change from 0 -> 1, if it's already 1, we don't have to 45.361 + * worry about it changing. That's why we can take a *copy* of 45.362 + * initialize_devices and wait till we're outside of the lock to 45.363 + * check if it's 1 (don't ever check if it's 0 outside of the lock) 45.364 + */ 45.365 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.366 + 45.367 + initialize_devices_copy = initialize_devices; 45.368 45.369 - spin_lock(&pci_stub_devices_lock); 45.370 + if (!initialize_devices_copy) { 45.371 + dev_dbg(&dev->dev, "deferring initialization\n"); 45.372 + list_add(&psdev->dev_list, &seized_devices); 45.373 + } 45.374 45.375 - if (initialize_devices) { 45.376 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.377 + 45.378 + if (initialize_devices_copy) { 45.379 + /* don't want irqs disabled when calling pcistub_init_device */ 45.380 err = pcistub_init_device(psdev->dev); 45.381 if (err) 45.382 goto out; 45.383 45.384 - list_add(&psdev->dev_list, &pci_stub_devices); 45.385 - } else 45.386 - list_add(&psdev->dev_list, &seized_devices); 45.387 + list_add(&psdev->dev_list, &pcistub_devices); 45.388 + } 45.389 45.390 out: 45.391 - spin_unlock(&pci_stub_devices_lock); 45.392 - 45.393 if (err) 45.394 - kfree(psdev); 45.395 + pcistub_device_put(psdev); 45.396 45.397 return err; 45.398 } 45.399 @@ -243,47 +367,78 @@ static int __devinit pcistub_seize(struc 45.400 static int __devinit pcistub_probe(struct pci_dev *dev, 45.401 const struct pci_device_id *id) 45.402 { 45.403 - struct pci_stub_device_id *pdev_id; 45.404 - struct pci_dev *seized_dev; 45.405 int err = 0; 45.406 45.407 - list_for_each_entry(pdev_id, &pci_stub_device_ids, slot_list) { 45.408 + dev_dbg(&dev->dev, "probing...\n"); 45.409 45.410 - if (!pcistub_match(dev, pdev_id)) 45.411 - continue; 45.412 + if (pcistub_match(dev)) { 45.413 45.414 if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL 45.415 && dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { 45.416 - printk(KERN_ERR 45.417 - "pciback: %s: can't export pci devices that " 45.418 - "don't have a normal (0) or bridge (1) " 45.419 - "header type!\n", pci_name(dev)); 45.420 - break; 45.421 + dev_err(&dev->dev, "can't export pci devices that " 45.422 + "don't have a normal (0) or bridge (1) " 45.423 + "header type!\n"); 45.424 + err = -ENODEV; 45.425 + goto out; 45.426 } 45.427 45.428 - pr_info("pciback: seizing PCI device %s\n", pci_name(dev)); 45.429 - seized_dev = pci_dev_get(dev); 45.430 - 45.431 - if (seized_dev) { 45.432 - err = pcistub_seize(seized_dev); 45.433 - if (err) { 45.434 - pci_dev_put(dev); 45.435 - goto out; 45.436 - } 45.437 - 45.438 - /* Success! */ 45.439 - goto out; 45.440 - } 45.441 - } 45.442 - 45.443 - /* Didn't find the device */ 45.444 - err = -ENODEV; 45.445 + dev_info(&dev->dev, "seizing device\n"); 45.446 + err = pcistub_seize(dev); 45.447 + } else 45.448 + /* Didn't find the device */ 45.449 + err = -ENODEV; 45.450 45.451 out: 45.452 return err; 45.453 } 45.454 45.455 -struct pci_device_id pcistub_ids[] = { 45.456 +static void pcistub_remove(struct pci_dev *dev) 45.457 +{ 45.458 + struct pcistub_device *psdev, *found_psdev = NULL; 45.459 + unsigned long flags; 45.460 + 45.461 + dev_dbg(&dev->dev, "removing\n"); 45.462 + 45.463 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.464 + 45.465 + list_for_each_entry(psdev, &pcistub_devices, dev_list) { 45.466 + if (psdev->dev == dev) { 45.467 + found_psdev = psdev; 45.468 + break; 45.469 + } 45.470 + } 45.471 + 45.472 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.473 + 45.474 + if (found_psdev) { 45.475 + dev_dbg(&dev->dev, "found device to remove - in use? %p\n", 45.476 + found_psdev->pdev); 45.477 + 45.478 + if (found_psdev->pdev) { 45.479 + printk(KERN_WARNING "pciback: ****** removing device " 45.480 + "%s while still in-use! ******\n", 45.481 + pci_name(found_psdev->dev)); 45.482 + printk(KERN_WARNING "pciback: ****** driver domain may " 45.483 + "still access this device's i/o resources!\n"); 45.484 + printk(KERN_WARNING "pciback: ****** shutdown driver " 45.485 + "domain before binding device\n"); 45.486 + printk(KERN_WARNING "pciback: ****** to other drivers " 45.487 + "or domains\n"); 45.488 + 45.489 + pciback_release_pci_dev(found_psdev->pdev, 45.490 + found_psdev->dev); 45.491 + } 45.492 + 45.493 + spin_lock_irqsave(&pcistub_devices_lock, flags); 45.494 + list_del(&found_psdev->dev_list); 45.495 + spin_unlock_irqrestore(&pcistub_devices_lock, flags); 45.496 + 45.497 + /* the final put for releasing from the list */ 45.498 + pcistub_device_put(found_psdev); 45.499 + } 45.500 +} 45.501 + 45.502 +static struct pci_device_id pcistub_ids[] = { 45.503 { 45.504 .vendor = PCI_ANY_ID, 45.505 .device = PCI_ANY_ID, 45.506 @@ -298,16 +453,152 @@ struct pci_device_id pcistub_ids[] = { 45.507 * for a normal device. I don't want it to be loaded automatically. 45.508 */ 45.509 45.510 -struct pci_driver pciback_pci_driver = { 45.511 +static struct pci_driver pciback_pci_driver = { 45.512 .name = "pciback", 45.513 .id_table = pcistub_ids, 45.514 .probe = pcistub_probe, 45.515 + .remove = pcistub_remove, 45.516 }; 45.517 45.518 +static inline int str_to_slot(const char *buf, int *domain, int *bus, 45.519 + int *slot, int *func) 45.520 +{ 45.521 + int err; 45.522 + 45.523 + err = sscanf(buf, " %x:%x:%x.%x", domain, bus, slot, func); 45.524 + if (err == 4) 45.525 + return 0; 45.526 + else if (err < 0) 45.527 + return -EINVAL; 45.528 + 45.529 + /* try again without domain */ 45.530 + *domain = 0; 45.531 + err = sscanf(buf, " %x:%x.%x", bus, slot, func); 45.532 + if (err == 3) 45.533 + return 0; 45.534 + 45.535 + return -EINVAL; 45.536 +} 45.537 + 45.538 +static int pcistub_device_id_add(int domain, int bus, int slot, int func) 45.539 +{ 45.540 + struct pcistub_device_id *pci_dev_id; 45.541 + unsigned long flags; 45.542 + 45.543 + pci_dev_id = kmalloc(sizeof(*pci_dev_id), GFP_KERNEL); 45.544 + if (!pci_dev_id) 45.545 + return -ENOMEM; 45.546 + 45.547 + pci_dev_id->domain = domain; 45.548 + pci_dev_id->bus = bus; 45.549 + pci_dev_id->devfn = PCI_DEVFN(slot, func); 45.550 + 45.551 + pr_debug("pciback: wants to seize %04x:%02x:%02x.%01x\n", 45.552 + domain, bus, slot, func); 45.553 + 45.554 + spin_lock_irqsave(&device_ids_lock, flags); 45.555 + list_add_tail(&pci_dev_id->slot_list, &pcistub_device_ids); 45.556 + spin_unlock_irqrestore(&device_ids_lock, flags); 45.557 + 45.558 + return 0; 45.559 +} 45.560 + 45.561 +static int pcistub_device_id_remove(int domain, int bus, int slot, int func) 45.562 +{ 45.563 + struct pcistub_device_id *pci_dev_id, *t; 45.564 + int devfn = PCI_DEVFN(slot, func); 45.565 + int err = -ENOENT; 45.566 + unsigned long flags; 45.567 + 45.568 + spin_lock_irqsave(&device_ids_lock, flags); 45.569 + list_for_each_entry_safe(pci_dev_id, t, &pcistub_device_ids, slot_list) { 45.570 + 45.571 + if (pci_dev_id->domain == domain 45.572 + && pci_dev_id->bus == bus && pci_dev_id->devfn == devfn) { 45.573 + /* Don't break; here because it's possible the same 45.574 + * slot could be in the list more than once 45.575 + */ 45.576 + list_del(&pci_dev_id->slot_list); 45.577 + kfree(pci_dev_id); 45.578 + 45.579 + err = 0; 45.580 + 45.581 + pr_debug("pciback: removed %04x:%02x:%02x.%01x from " 45.582 + "seize list\n", domain, bus, slot, func); 45.583 + } 45.584 + } 45.585 + spin_unlock_irqrestore(&device_ids_lock, flags); 45.586 + 45.587 + return err; 45.588 +} 45.589 + 45.590 +static ssize_t pcistub_slot_add(struct device_driver *drv, const char *buf, 45.591 + size_t count) 45.592 +{ 45.593 + int domain, bus, slot, func; 45.594 + int err; 45.595 + 45.596 + err = str_to_slot(buf, &domain, &bus, &slot, &func); 45.597 + if (err) 45.598 + goto out; 45.599 + 45.600 + err = pcistub_device_id_add(domain, bus, slot, func); 45.601 + 45.602 + out: 45.603 + if (!err) 45.604 + err = count; 45.605 + return err; 45.606 +} 45.607 + 45.608 +DRIVER_ATTR(new_slot, S_IWUSR, NULL, pcistub_slot_add); 45.609 + 45.610 +static ssize_t pcistub_slot_remove(struct device_driver *drv, const char *buf, 45.611 + size_t count) 45.612 +{ 45.613 + int domain, bus, slot, func; 45.614 + int err; 45.615 + 45.616 + err = str_to_slot(buf, &domain, &bus, &slot, &func); 45.617 + if (err) 45.618 + goto out; 45.619 + 45.620 + err = pcistub_device_id_remove(domain, bus, slot, func); 45.621 + 45.622 + out: 45.623 + if (!err) 45.624 + err = count; 45.625 + return err; 45.626 +} 45.627 + 45.628 +DRIVER_ATTR(remove_slot, S_IWUSR, NULL, pcistub_slot_remove); 45.629 + 45.630 +static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf) 45.631 +{ 45.632 + struct pcistub_device_id *pci_dev_id; 45.633 + size_t count = 0; 45.634 + unsigned long flags; 45.635 + 45.636 + spin_lock_irqsave(&device_ids_lock, flags); 45.637 + list_for_each_entry(pci_dev_id, &pcistub_device_ids, slot_list) { 45.638 + if (count >= PAGE_SIZE) 45.639 + break; 45.640 + 45.641 + count += scnprintf(buf + count, PAGE_SIZE - count, 45.642 + "%04x:%02x:%02x.%01x\n", 45.643 + pci_dev_id->domain, pci_dev_id->bus, 45.644 + PCI_SLOT(pci_dev_id->devfn), 45.645 + PCI_FUNC(pci_dev_id->devfn)); 45.646 + } 45.647 + spin_unlock_irqrestore(&device_ids_lock, flags); 45.648 + 45.649 + return count; 45.650 +} 45.651 + 45.652 +DRIVER_ATTR(slots, S_IRUSR, pcistub_slot_show, NULL); 45.653 + 45.654 static int __init pcistub_init(void) 45.655 { 45.656 int pos = 0; 45.657 - struct pci_stub_device_id *pci_dev_id; 45.658 int err = 0; 45.659 int domain, bus, slot, func; 45.660 int parsed; 45.661 @@ -328,33 +619,27 @@ static int __init pcistub_init(void) 45.662 goto parse_error; 45.663 } 45.664 45.665 - pci_dev_id = kmalloc(sizeof(*pci_dev_id), GFP_KERNEL); 45.666 - if (!pci_dev_id) { 45.667 - err = -ENOMEM; 45.668 + err = pcistub_device_id_add(domain, bus, slot, func); 45.669 + if (err) 45.670 goto out; 45.671 - } 45.672 - 45.673 - pci_dev_id->domain = domain; 45.674 - pci_dev_id->bus = bus; 45.675 - pci_dev_id->devfn = PCI_DEVFN(slot, func); 45.676 - 45.677 - pr_debug 45.678 - ("pciback: wants to seize %04x:%02x:%02x.%01x\n", 45.679 - domain, bus, slot, func); 45.680 - 45.681 - list_add_tail(&pci_dev_id->slot_list, 45.682 - &pci_stub_device_ids); 45.683 45.684 /* if parsed<=0, we've reached the end of the string */ 45.685 pos += parsed; 45.686 } while (parsed > 0 && pci_devs_to_hide[pos]); 45.687 + } 45.688 45.689 - /* If we're the first PCI Device Driver to register, we're the 45.690 - * first one to get offered PCI devices as they become 45.691 - * available (and thus we can be the first to grab them) 45.692 - */ 45.693 - pci_register_driver(&pciback_pci_driver); 45.694 - } 45.695 + /* If we're the first PCI Device Driver to register, we're the 45.696 + * first one to get offered PCI devices as they become 45.697 + * available (and thus we can be the first to grab them) 45.698 + */ 45.699 + err = pci_register_driver(&pciback_pci_driver); 45.700 + if (err < 0) 45.701 + goto out; 45.702 + 45.703 + driver_create_file(&pciback_pci_driver.driver, &driver_attr_new_slot); 45.704 + driver_create_file(&pciback_pci_driver.driver, 45.705 + &driver_attr_remove_slot); 45.706 + driver_create_file(&pciback_pci_driver.driver, &driver_attr_slots); 45.707 45.708 out: 45.709 return err; 45.710 @@ -386,19 +671,22 @@ static int __init pciback_init(void) 45.711 return err; 45.712 #endif 45.713 45.714 - if (list_empty(&pci_stub_device_ids)) 45.715 - return -ENODEV; 45.716 pcistub_init_devices_late(); 45.717 pciback_xenbus_register(); 45.718 45.719 - __unsafe(THIS_MODULE); 45.720 - 45.721 return 0; 45.722 } 45.723 45.724 -static void pciback_cleanup(void) 45.725 +static void __exit pciback_cleanup(void) 45.726 { 45.727 - BUG(); 45.728 + pciback_xenbus_unregister(); 45.729 + 45.730 + driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot); 45.731 + driver_remove_file(&pciback_pci_driver.driver, 45.732 + &driver_attr_remove_slot); 45.733 + driver_remove_file(&pciback_pci_driver.driver, &driver_attr_slots); 45.734 + 45.735 + pci_unregister_driver(&pciback_pci_driver); 45.736 } 45.737 45.738 module_init(pciback_init);
46.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h Mon Mar 27 15:36:47 2006 -0700 46.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h Tue Mar 28 08:54:58 2006 -0700 46.3 @@ -37,9 +37,11 @@ struct pciback_dev_data { 46.4 }; 46.5 46.6 /* Get/Put PCI Devices that are hidden from the PCI Backend Domain */ 46.7 -struct pci_dev *pcistub_get_pci_dev_by_slot(int domain, int bus, 46.8 +struct pci_dev *pcistub_get_pci_dev_by_slot(struct pciback_device *pdev, 46.9 + int domain, int bus, 46.10 int slot, int func); 46.11 -struct pci_dev *pcistub_get_pci_dev(struct pci_dev *dev); 46.12 +struct pci_dev *pcistub_get_pci_dev(struct pciback_device *pdev, 46.13 + struct pci_dev *dev); 46.14 void pcistub_put_pci_dev(struct pci_dev *dev); 46.15 46.16 /* Ensure a device is turned off or reset */ 46.17 @@ -57,6 +59,7 @@ int pciback_config_write(struct pci_dev 46.18 typedef int (*publish_pci_root_cb) (struct pciback_device * pdev, 46.19 unsigned int domain, unsigned int bus); 46.20 int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev); 46.21 +void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev); 46.22 struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev, 46.23 unsigned int domain, unsigned int bus, 46.24 unsigned int devfn); 46.25 @@ -69,6 +72,7 @@ void pciback_release_devices(struct pcib 46.26 irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs); 46.27 46.28 int pciback_xenbus_register(void); 46.29 +void pciback_xenbus_unregister(void); 46.30 46.31 extern int verbose_request; 46.32 #endif
47.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c Mon Mar 27 15:36:47 2006 -0700 47.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c Tue Mar 28 08:54:58 2006 -0700 47.3 @@ -12,9 +12,8 @@ int verbose_request = 0; 47.4 module_param(verbose_request, int, 0644); 47.5 47.6 /* Ensure a device is "turned off" and ready to be exported. 47.7 - * This also sets up the device's private data to keep track of what should 47.8 - * be in the base address registers (BARs) so that we can keep the 47.9 - * client from manipulating them directly. 47.10 + * (Also see pciback_config_reset to ensure virtual configuration space is 47.11 + * ready to be re-exported) 47.12 */ 47.13 void pciback_reset_device(struct pci_dev *dev) 47.14 {
48.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/vpci.c Mon Mar 27 15:36:47 2006 -0700 48.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/vpci.c Tue Mar 28 08:54:58 2006 -0700 48.3 @@ -8,12 +8,15 @@ 48.4 #include <linux/list.h> 48.5 #include <linux/slab.h> 48.6 #include <linux/pci.h> 48.7 +#include <linux/spinlock.h> 48.8 #include "pciback.h" 48.9 48.10 #define PCI_SLOT_MAX 32 48.11 48.12 struct vpci_dev_data { 48.13 + /* Access to dev_list must be protected by lock */ 48.14 struct list_head dev_list[PCI_SLOT_MAX]; 48.15 + spinlock_t lock; 48.16 }; 48.17 48.18 static inline struct list_head *list_first(struct list_head *head) 48.19 @@ -25,25 +28,29 @@ struct pci_dev *pciback_get_pci_dev(stru 48.20 unsigned int domain, unsigned int bus, 48.21 unsigned int devfn) 48.22 { 48.23 - struct pci_dev_entry *dev_entry; 48.24 + struct pci_dev_entry *entry; 48.25 + struct pci_dev *dev = NULL; 48.26 struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; 48.27 + unsigned long flags; 48.28 48.29 if (domain != 0 || bus != 0) 48.30 return NULL; 48.31 48.32 if (PCI_SLOT(devfn) < PCI_SLOT_MAX) { 48.33 - /* we don't need to lock the list here because once the backend 48.34 - * is in operation, it won't have any more devices addeded 48.35 - * (or removed). 48.36 - */ 48.37 - list_for_each_entry(dev_entry, 48.38 + spin_lock_irqsave(&vpci_dev->lock, flags); 48.39 + 48.40 + list_for_each_entry(entry, 48.41 &vpci_dev->dev_list[PCI_SLOT(devfn)], 48.42 list) { 48.43 - if (PCI_FUNC(dev_entry->dev->devfn) == PCI_FUNC(devfn)) 48.44 - return dev_entry->dev; 48.45 + if (PCI_FUNC(entry->dev->devfn) == PCI_FUNC(devfn)) { 48.46 + dev = entry->dev; 48.47 + break; 48.48 + } 48.49 } 48.50 + 48.51 + spin_unlock_irqrestore(&vpci_dev->lock, flags); 48.52 } 48.53 - return NULL; 48.54 + return dev; 48.55 } 48.56 48.57 static inline int match_slot(struct pci_dev *l, struct pci_dev *r) 48.58 @@ -55,12 +62,12 @@ static inline int match_slot(struct pci_ 48.59 return 0; 48.60 } 48.61 48.62 -/* Must hold pciback_device->dev_lock when calling this */ 48.63 int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev) 48.64 { 48.65 int err = 0, slot; 48.66 struct pci_dev_entry *t, *dev_entry; 48.67 struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; 48.68 + unsigned long flags; 48.69 48.70 if ((dev->class >> 24) == PCI_BASE_CLASS_BRIDGE) { 48.71 err = -EFAULT; 48.72 @@ -79,6 +86,8 @@ int pciback_add_pci_dev(struct pciback_d 48.73 48.74 dev_entry->dev = dev; 48.75 48.76 + spin_lock_irqsave(&vpci_dev->lock, flags); 48.77 + 48.78 /* Keep multi-function devices together on the virtual PCI bus */ 48.79 for (slot = 0; slot < PCI_SLOT_MAX; slot++) { 48.80 if (!list_empty(&vpci_dev->dev_list[slot])) { 48.81 @@ -92,7 +101,7 @@ int pciback_add_pci_dev(struct pciback_d 48.82 PCI_FUNC(dev->devfn)); 48.83 list_add_tail(&dev_entry->list, 48.84 &vpci_dev->dev_list[slot]); 48.85 - goto out; 48.86 + goto unlock; 48.87 } 48.88 } 48.89 } 48.90 @@ -105,7 +114,7 @@ int pciback_add_pci_dev(struct pciback_d 48.91 pci_name(dev), slot); 48.92 list_add_tail(&dev_entry->list, 48.93 &vpci_dev->dev_list[slot]); 48.94 - goto out; 48.95 + goto unlock; 48.96 } 48.97 } 48.98 48.99 @@ -113,10 +122,41 @@ int pciback_add_pci_dev(struct pciback_d 48.100 xenbus_dev_fatal(pdev->xdev, err, 48.101 "No more space on root virtual PCI bus"); 48.102 48.103 + unlock: 48.104 + spin_unlock_irqrestore(&vpci_dev->lock, flags); 48.105 out: 48.106 return err; 48.107 } 48.108 48.109 +void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev) 48.110 +{ 48.111 + int slot; 48.112 + struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; 48.113 + struct pci_dev *found_dev = NULL; 48.114 + unsigned long flags; 48.115 + 48.116 + spin_lock_irqsave(&vpci_dev->lock, flags); 48.117 + 48.118 + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { 48.119 + struct pci_dev_entry *e, *tmp; 48.120 + list_for_each_entry_safe(e, tmp, &vpci_dev->dev_list[slot], 48.121 + list) { 48.122 + if (e->dev == dev) { 48.123 + list_del(&e->list); 48.124 + found_dev = e->dev; 48.125 + kfree(e); 48.126 + goto out; 48.127 + } 48.128 + } 48.129 + } 48.130 + 48.131 + out: 48.132 + spin_unlock_irqrestore(&vpci_dev->lock, flags); 48.133 + 48.134 + if (found_dev) 48.135 + pcistub_put_pci_dev(found_dev); 48.136 +} 48.137 + 48.138 int pciback_init_devices(struct pciback_device *pdev) 48.139 { 48.140 int slot; 48.141 @@ -126,6 +166,8 @@ int pciback_init_devices(struct pciback_ 48.142 if (!vpci_dev) 48.143 return -ENOMEM; 48.144 48.145 + spin_lock_init(&vpci_dev->lock); 48.146 + 48.147 for (slot = 0; slot < PCI_SLOT_MAX; slot++) { 48.148 INIT_LIST_HEAD(&vpci_dev->dev_list[slot]); 48.149 } 48.150 @@ -142,7 +184,6 @@ int pciback_publish_pci_roots(struct pci 48.151 return publish_cb(pdev, 0, 0); 48.152 } 48.153 48.154 -/* Must hold pciback_device->dev_lock when calling this */ 48.155 void pciback_release_devices(struct pciback_device *pdev) 48.156 { 48.157 int slot;
49.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Mon Mar 27 15:36:47 2006 -0700 49.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Tue Mar 28 08:54:58 2006 -0700 49.3 @@ -12,7 +12,7 @@ 49.4 49.5 #define INVALID_EVTCHN_IRQ (-1) 49.6 49.7 -struct pciback_device *alloc_pdev(struct xenbus_device *xdev) 49.8 +static struct pciback_device *alloc_pdev(struct xenbus_device *xdev) 49.9 { 49.10 struct pciback_device *pdev; 49.11 49.12 @@ -38,7 +38,7 @@ struct pciback_device *alloc_pdev(struct 49.13 return pdev; 49.14 } 49.15 49.16 -void free_pdev(struct pciback_device *pdev) 49.17 +static void free_pdev(struct pciback_device *pdev) 49.18 { 49.19 if (pdev->be_watching) 49.20 unregister_xenbus_watch(&pdev->be_watch); 49.21 @@ -247,7 +247,7 @@ static int pciback_export_device(struct 49.22 dev_dbg(&pdev->xdev->dev, "exporting dom %x bus %x slot %x func %x\n", 49.23 domain, bus, slot, func); 49.24 49.25 - dev = pcistub_get_pci_dev_by_slot(domain, bus, slot, func); 49.26 + dev = pcistub_get_pci_dev_by_slot(pdev, domain, bus, slot, func); 49.27 if (!dev) { 49.28 err = -EINVAL; 49.29 xenbus_dev_fatal(pdev->xdev, err, 49.30 @@ -434,3 +434,8 @@ int __init pciback_xenbus_register(void) 49.31 { 49.32 return xenbus_register_backend(&xenbus_pciback_driver); 49.33 } 49.34 + 49.35 +void __exit pciback_xenbus_unregister(void) 49.36 +{ 49.37 + xenbus_unregister_driver(&xenbus_pciback_driver); 49.38 +}
50.1 --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c Mon Mar 27 15:36:47 2006 -0700 50.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c Tue Mar 28 08:54:58 2006 -0700 50.3 @@ -56,19 +56,19 @@ static int do_pci_op(struct pcifront_dev 50.4 notify_remote_via_evtchn(port); 50.5 50.6 /* 50.7 - * We set a poll timeout of 5 seconds but give up on return after 50.8 - * 4 seconds. It is better to time out too late rather than too early 50.9 + * We set a poll timeout of 3 seconds but give up on return after 50.10 + * 2 seconds. It is better to time out too late rather than too early 50.11 * (in the latter case we end up continually re-executing poll() with a 50.12 * timeout in the past). 1s difference gives plenty of slack for error. 50.13 */ 50.14 do_gettimeofday(&tv); 50.15 - ns_timeout = timeval_to_ns(&tv) + 4 * (nsec_t)NSEC_PER_SEC; 50.16 + ns_timeout = timeval_to_ns(&tv) + 2 * (nsec_t)NSEC_PER_SEC; 50.17 50.18 clear_evtchn(port); 50.19 50.20 while (test_bit(_XEN_PCIF_active, 50.21 (unsigned long *)&pdev->sh_info->flags)) { 50.22 - if (HYPERVISOR_poll(&port, 1, jiffies + 5*HZ)) 50.23 + if (HYPERVISOR_poll(&port, 1, jiffies + 3*HZ)) 50.24 BUG(); 50.25 clear_evtchn(port); 50.26 do_gettimeofday(&tv); 50.27 @@ -173,7 +173,7 @@ static void pcifront_claim_resource(stru 50.28 50.29 if (!r->parent && r->start && r->flags) { 50.30 dev_dbg(&pdev->xdev->dev, "claiming resource %s/%d\n", 50.31 - pci_name(dev), i); 50.32 + pci_name(dev), i); 50.33 pci_claim_resource(dev, i); 50.34 } 50.35 } 50.36 @@ -234,25 +234,38 @@ int pcifront_scan_root(struct pcifront_d 50.37 return err; 50.38 } 50.39 50.40 +static void free_root_bus_devs(struct pci_bus *bus) 50.41 +{ 50.42 + struct pci_dev *dev; 50.43 + 50.44 + spin_lock(&pci_bus_lock); 50.45 + while (!list_empty(&bus->devices)) { 50.46 + dev = container_of(bus->devices.next, struct pci_dev, bus_list); 50.47 + spin_unlock(&pci_bus_lock); 50.48 + 50.49 + dev_dbg(&dev->dev, "removing device\n"); 50.50 + pci_remove_bus_device(dev); 50.51 + 50.52 + spin_lock(&pci_bus_lock); 50.53 + } 50.54 + spin_unlock(&pci_bus_lock); 50.55 +} 50.56 + 50.57 void pcifront_free_roots(struct pcifront_device *pdev) 50.58 { 50.59 struct pci_bus_entry *bus_entry, *t; 50.60 50.61 + dev_dbg(&pdev->xdev->dev, "cleaning up root buses\n"); 50.62 + 50.63 list_for_each_entry_safe(bus_entry, t, &pdev->root_buses, list) { 50.64 - /* TODO: Removing a PCI Bus is untested (as it normally 50.65 - * just goes away on domain shutdown) 50.66 - */ 50.67 list_del(&bus_entry->list); 50.68 50.69 - spin_lock(&pci_bus_lock); 50.70 - list_del(&bus_entry->bus->node); 50.71 - spin_unlock(&pci_bus_lock); 50.72 + free_root_bus_devs(bus_entry->bus); 50.73 50.74 kfree(bus_entry->bus->sysdata); 50.75 50.76 device_unregister(bus_entry->bus->bridge); 50.77 - 50.78 - /* Do we need to free() the bus itself? */ 50.79 + pci_remove_bus(bus_entry->bus); 50.80 50.81 kfree(bus_entry); 50.82 }
51.1 --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Mon Mar 27 15:36:47 2006 -0700 51.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Tue Mar 28 08:54:58 2006 -0700 51.3 @@ -50,6 +50,8 @@ static void free_pdev(struct pcifront_de 51.4 { 51.5 dev_dbg(&pdev->xdev->dev, "freeing pdev @ 0x%p\n", pdev); 51.6 51.7 + pcifront_free_roots(pdev); 51.8 + 51.9 if (pdev->evtchn != INVALID_EVTCHN) 51.10 xenbus_free_evtchn(pdev->xdev, pdev->evtchn); 51.11
52.1 --- a/linux-2.6-xen-sparse/drivers/xen/util.c Mon Mar 27 15:36:47 2006 -0700 52.2 +++ b/linux-2.6-xen-sparse/drivers/xen/util.c Tue Mar 28 08:54:58 2006 -0700 52.3 @@ -6,9 +6,9 @@ 52.4 #include <asm/uaccess.h> 52.5 #include <xen/driver_util.h> 52.6 52.7 -static int f(pte_t *pte, struct page *pte_page, unsigned long addr, void *data) 52.8 +static int f(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) 52.9 { 52.10 - /* generic_page_range() does all the hard work. */ 52.11 + /* apply_to_page_range() does all the hard work. */ 52.12 return 0; 52.13 } 52.14 52.15 @@ -24,8 +24,8 @@ struct vm_struct *alloc_vm_area(unsigned 52.16 * This ensures that page tables are constructed for this region 52.17 * of kernel virtual address space and mapped into init_mm. 52.18 */ 52.19 - if (generic_page_range(&init_mm, (unsigned long)area->addr, 52.20 - area->size, f, NULL)) { 52.21 + if (apply_to_page_range(&init_mm, (unsigned long)area->addr, 52.22 + area->size, f, NULL)) { 52.23 free_vm_area(area); 52.24 return NULL; 52.25 }
53.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Mar 27 15:36:47 2006 -0700 53.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Tue Mar 28 08:54:58 2006 -0700 53.3 @@ -1039,8 +1039,7 @@ static int __init xenbus_probe_init(void 53.4 xsd_port_intf = create_xen_proc_entry("xsd_port", 0400); 53.5 if (xsd_port_intf) 53.6 xsd_port_intf->read_proc = xsd_port_read; 53.7 - } 53.8 - else 53.9 + } else 53.10 xenstored_ready = 1; 53.11 53.12 /* Initialize the interface to xenstore. */
54.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h Mon Mar 27 15:36:47 2006 -0700 54.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h Tue Mar 28 08:54:58 2006 -0700 54.3 @@ -146,7 +146,7 @@ static inline void detect_ht(struct cpui 54.4 */ 54.5 static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) 54.6 { 54.7 - __asm__("cpuid" 54.8 + __asm__(XEN_CPUID 54.9 : "=a" (*eax), 54.10 "=b" (*ebx), 54.11 "=c" (*ecx), 54.12 @@ -158,7 +158,7 @@ static inline void cpuid(unsigned int op 54.13 static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, 54.14 int *edx) 54.15 { 54.16 - __asm__("cpuid" 54.17 + __asm__(XEN_CPUID 54.18 : "=a" (*eax), 54.19 "=b" (*ebx), 54.20 "=c" (*ecx), 54.21 @@ -173,7 +173,7 @@ static inline unsigned int cpuid_eax(uns 54.22 { 54.23 unsigned int eax; 54.24 54.25 - __asm__("cpuid" 54.26 + __asm__(XEN_CPUID 54.27 : "=a" (eax) 54.28 : "0" (op) 54.29 : "bx", "cx", "dx"); 54.30 @@ -183,7 +183,7 @@ static inline unsigned int cpuid_ebx(uns 54.31 { 54.32 unsigned int eax, ebx; 54.33 54.34 - __asm__("cpuid" 54.35 + __asm__(XEN_CPUID 54.36 : "=a" (eax), "=b" (ebx) 54.37 : "0" (op) 54.38 : "cx", "dx" ); 54.39 @@ -193,7 +193,7 @@ static inline unsigned int cpuid_ecx(uns 54.40 { 54.41 unsigned int eax, ecx; 54.42 54.43 - __asm__("cpuid" 54.44 + __asm__(XEN_CPUID 54.45 : "=a" (eax), "=c" (ecx) 54.46 : "0" (op) 54.47 : "bx", "dx" ); 54.48 @@ -203,7 +203,7 @@ static inline unsigned int cpuid_edx(uns 54.49 { 54.50 unsigned int eax, edx; 54.51 54.52 - __asm__("cpuid" 54.53 + __asm__(XEN_CPUID 54.54 : "=a" (eax), "=d" (edx) 54.55 : "0" (op) 54.56 : "bx", "cx"); 54.57 @@ -237,20 +237,11 @@ extern unsigned long mmu_cr4_features; 54.58 54.59 static inline void set_in_cr4 (unsigned long mask) 54.60 { 54.61 + unsigned cr4; 54.62 mmu_cr4_features |= mask; 54.63 - switch (mask) { 54.64 - case X86_CR4_OSFXSR: 54.65 - case X86_CR4_OSXMMEXCPT: 54.66 - break; 54.67 - default: 54.68 - do { 54.69 - const char *msg = "Xen unsupported cr4 update\n"; 54.70 - (void)HYPERVISOR_console_io( 54.71 - CONSOLEIO_write, __builtin_strlen(msg), 54.72 - (char *)msg); 54.73 - BUG(); 54.74 - } while (0); 54.75 - } 54.76 + cr4 = read_cr4(); 54.77 + cr4 |= mask; 54.78 + write_cr4(cr4); 54.79 } 54.80 54.81 static inline void clear_in_cr4 (unsigned long mask)
55.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h Mon Mar 27 15:36:47 2006 -0700 55.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h Tue Mar 28 08:54:58 2006 -0700 55.3 @@ -16,18 +16,6 @@ static char * __init machine_specific_me 55.4 return "Xen"; 55.5 } 55.6 55.7 -void __devinit machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c) 55.8 -{ 55.9 - clear_bit(X86_FEATURE_VME, c->x86_capability); 55.10 - clear_bit(X86_FEATURE_DE, c->x86_capability); 55.11 - clear_bit(X86_FEATURE_PSE, c->x86_capability); 55.12 - clear_bit(X86_FEATURE_PGE, c->x86_capability); 55.13 - clear_bit(X86_FEATURE_SEP, c->x86_capability); 55.14 - if (!(xen_start_info->flags & SIF_PRIVILEGED)) 55.15 - clear_bit(X86_FEATURE_MTRR, c->x86_capability); 55.16 - c->hlt_works_ok = 0; 55.17 -} 55.18 - 55.19 extern void hypervisor_callback(void); 55.20 extern void failsafe_callback(void); 55.21 extern void nmi(void); 55.22 @@ -51,8 +39,6 @@ static void __init machine_specific_arch 55.23 cb.handler_address = (unsigned long)&nmi; 55.24 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb); 55.25 55.26 - machine_specific_modify_cpu_capabilities(&boot_cpu_data); 55.27 - 55.28 if (HYPERVISOR_xen_version(XENVER_platform_parameters, 55.29 &pp) == 0) 55.30 set_fixaddr_top(pp.virt_start - PAGE_SIZE);
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/msr.h Tue Mar 28 08:54:58 2006 -0700 56.3 @@ -0,0 +1,399 @@ 56.4 +#ifndef X86_64_MSR_H 56.5 +#define X86_64_MSR_H 1 56.6 + 56.7 +#ifndef __ASSEMBLY__ 56.8 +/* 56.9 + * Access to machine-specific registers (available on 586 and better only) 56.10 + * Note: the rd* operations modify the parameters directly (without using 56.11 + * pointer indirection), this allows gcc to optimize better 56.12 + */ 56.13 + 56.14 +#define rdmsr(msr,val1,val2) \ 56.15 + __asm__ __volatile__("rdmsr" \ 56.16 + : "=a" (val1), "=d" (val2) \ 56.17 + : "c" (msr)) 56.18 + 56.19 + 56.20 +#define rdmsrl(msr,val) do { unsigned long a__,b__; \ 56.21 + __asm__ __volatile__("rdmsr" \ 56.22 + : "=a" (a__), "=d" (b__) \ 56.23 + : "c" (msr)); \ 56.24 + val = a__ | (b__<<32); \ 56.25 +} while(0) 56.26 + 56.27 +#define wrmsr(msr,val1,val2) \ 56.28 + __asm__ __volatile__("wrmsr" \ 56.29 + : /* no outputs */ \ 56.30 + : "c" (msr), "a" (val1), "d" (val2)) 56.31 + 56.32 +#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) 56.33 + 56.34 +/* wrmsr with exception handling */ 56.35 +#define wrmsr_safe(msr,a,b) ({ int ret__; \ 56.36 + asm volatile("2: wrmsr ; xorl %0,%0\n" \ 56.37 + "1:\n\t" \ 56.38 + ".section .fixup,\"ax\"\n\t" \ 56.39 + "3: movl %4,%0 ; jmp 1b\n\t" \ 56.40 + ".previous\n\t" \ 56.41 + ".section __ex_table,\"a\"\n" \ 56.42 + " .align 8\n\t" \ 56.43 + " .quad 2b,3b\n\t" \ 56.44 + ".previous" \ 56.45 + : "=a" (ret__) \ 56.46 + : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \ 56.47 + ret__; }) 56.48 + 56.49 +#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32)) 56.50 + 56.51 +#define rdmsr_safe(msr,a,b) \ 56.52 + ({ int ret__; \ 56.53 + asm volatile ("1: rdmsr\n" \ 56.54 + "2:\n" \ 56.55 + ".section .fixup,\"ax\"\n" \ 56.56 + "3: movl %4,%0\n" \ 56.57 + " jmp 2b\n" \ 56.58 + ".previous\n" \ 56.59 + ".section __ex_table,\"a\"\n" \ 56.60 + " .align 8\n" \ 56.61 + " .quad 1b,3b\n" \ 56.62 + ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b))\ 56.63 + :"c"(msr), "i"(-EIO), "0"(0)); \ 56.64 + ret__; }) 56.65 + 56.66 +#define rdtsc(low,high) \ 56.67 + __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) 56.68 + 56.69 +#define rdtscl(low) \ 56.70 + __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") 56.71 + 56.72 +#define rdtscll(val) do { \ 56.73 + unsigned int __a,__d; \ 56.74 + asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ 56.75 + (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ 56.76 +} while(0) 56.77 + 56.78 +#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 56.79 + 56.80 +#define rdpmc(counter,low,high) \ 56.81 + __asm__ __volatile__("rdpmc" \ 56.82 + : "=a" (low), "=d" (high) \ 56.83 + : "c" (counter)) 56.84 + 56.85 +static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, 56.86 + unsigned int *ecx, unsigned int *edx) 56.87 +{ 56.88 + __asm__(XEN_CPUID 56.89 + : "=a" (*eax), 56.90 + "=b" (*ebx), 56.91 + "=c" (*ecx), 56.92 + "=d" (*edx) 56.93 + : "0" (op)); 56.94 +} 56.95 + 56.96 +/* Some CPUID calls want 'count' to be placed in ecx */ 56.97 +static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, 56.98 + int *edx) 56.99 +{ 56.100 + __asm__(XEN_CPUID 56.101 + : "=a" (*eax), 56.102 + "=b" (*ebx), 56.103 + "=c" (*ecx), 56.104 + "=d" (*edx) 56.105 + : "0" (op), "c" (count)); 56.106 +} 56.107 + 56.108 +/* 56.109 + * CPUID functions returning a single datum 56.110 + */ 56.111 +static inline unsigned int cpuid_eax(unsigned int op) 56.112 +{ 56.113 + unsigned int eax; 56.114 + 56.115 + __asm__(XEN_CPUID 56.116 + : "=a" (eax) 56.117 + : "0" (op) 56.118 + : "bx", "cx", "dx"); 56.119 + return eax; 56.120 +} 56.121 +static inline unsigned int cpuid_ebx(unsigned int op) 56.122 +{ 56.123 + unsigned int eax, ebx; 56.124 + 56.125 + __asm__(XEN_CPUID 56.126 + : "=a" (eax), "=b" (ebx) 56.127 + : "0" (op) 56.128 + : "cx", "dx" ); 56.129 + return ebx; 56.130 +} 56.131 +static inline unsigned int cpuid_ecx(unsigned int op) 56.132 +{ 56.133 + unsigned int eax, ecx; 56.134 + 56.135 + __asm__(XEN_CPUID 56.136 + : "=a" (eax), "=c" (ecx) 56.137 + : "0" (op) 56.138 + : "bx", "dx" ); 56.139 + return ecx; 56.140 +} 56.141 +static inline unsigned int cpuid_edx(unsigned int op) 56.142 +{ 56.143 + unsigned int eax, edx; 56.144 + 56.145 + __asm__(XEN_CPUID 56.146 + : "=a" (eax), "=d" (edx) 56.147 + : "0" (op) 56.148 + : "bx", "cx"); 56.149 + return edx; 56.150 +} 56.151 + 56.152 +#define MSR_IA32_UCODE_WRITE 0x79 56.153 +#define MSR_IA32_UCODE_REV 0x8b 56.154 + 56.155 + 56.156 +#endif 56.157 + 56.158 +/* AMD/K8 specific MSRs */ 56.159 +#define MSR_EFER 0xc0000080 /* extended feature register */ 56.160 +#define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target */ 56.161 +#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */ 56.162 +#define MSR_CSTAR 0xc0000083 /* compatibility mode SYSCALL target */ 56.163 +#define MSR_SYSCALL_MASK 0xc0000084 /* EFLAGS mask for syscall */ 56.164 +#define MSR_FS_BASE 0xc0000100 /* 64bit GS base */ 56.165 +#define MSR_GS_BASE 0xc0000101 /* 64bit FS base */ 56.166 +#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow (or USER_GS from kernel) */ 56.167 +/* EFER bits: */ 56.168 +#define _EFER_SCE 0 /* SYSCALL/SYSRET */ 56.169 +#define _EFER_LME 8 /* Long mode enable */ 56.170 +#define _EFER_LMA 10 /* Long mode active (read-only) */ 56.171 +#define _EFER_NX 11 /* No execute enable */ 56.172 + 56.173 +#define EFER_SCE (1<<_EFER_SCE) 56.174 +#define EFER_LME (1<<_EFER_LME) 56.175 +#define EFER_LMA (1<<_EFER_LMA) 56.176 +#define EFER_NX (1<<_EFER_NX) 56.177 + 56.178 +/* Intel MSRs. Some also available on other CPUs */ 56.179 +#define MSR_IA32_TSC 0x10 56.180 +#define MSR_IA32_PLATFORM_ID 0x17 56.181 + 56.182 +#define MSR_IA32_PERFCTR0 0xc1 56.183 +#define MSR_IA32_PERFCTR1 0xc2 56.184 + 56.185 +#define MSR_MTRRcap 0x0fe 56.186 +#define MSR_IA32_BBL_CR_CTL 0x119 56.187 + 56.188 +#define MSR_IA32_SYSENTER_CS 0x174 56.189 +#define MSR_IA32_SYSENTER_ESP 0x175 56.190 +#define MSR_IA32_SYSENTER_EIP 0x176 56.191 + 56.192 +#define MSR_IA32_MCG_CAP 0x179 56.193 +#define MSR_IA32_MCG_STATUS 0x17a 56.194 +#define MSR_IA32_MCG_CTL 0x17b 56.195 + 56.196 +#define MSR_IA32_EVNTSEL0 0x186 56.197 +#define MSR_IA32_EVNTSEL1 0x187 56.198 + 56.199 +#define MSR_IA32_DEBUGCTLMSR 0x1d9 56.200 +#define MSR_IA32_LASTBRANCHFROMIP 0x1db 56.201 +#define MSR_IA32_LASTBRANCHTOIP 0x1dc 56.202 +#define MSR_IA32_LASTINTFROMIP 0x1dd 56.203 +#define MSR_IA32_LASTINTTOIP 0x1de 56.204 + 56.205 +#define MSR_MTRRfix64K_00000 0x250 56.206 +#define MSR_MTRRfix16K_80000 0x258 56.207 +#define MSR_MTRRfix16K_A0000 0x259 56.208 +#define MSR_MTRRfix4K_C0000 0x268 56.209 +#define MSR_MTRRfix4K_C8000 0x269 56.210 +#define MSR_MTRRfix4K_D0000 0x26a 56.211 +#define MSR_MTRRfix4K_D8000 0x26b 56.212 +#define MSR_MTRRfix4K_E0000 0x26c 56.213 +#define MSR_MTRRfix4K_E8000 0x26d 56.214 +#define MSR_MTRRfix4K_F0000 0x26e 56.215 +#define MSR_MTRRfix4K_F8000 0x26f 56.216 +#define MSR_MTRRdefType 0x2ff 56.217 + 56.218 +#define MSR_IA32_MC0_CTL 0x400 56.219 +#define MSR_IA32_MC0_STATUS 0x401 56.220 +#define MSR_IA32_MC0_ADDR 0x402 56.221 +#define MSR_IA32_MC0_MISC 0x403 56.222 + 56.223 +#define MSR_P6_PERFCTR0 0xc1 56.224 +#define MSR_P6_PERFCTR1 0xc2 56.225 +#define MSR_P6_EVNTSEL0 0x186 56.226 +#define MSR_P6_EVNTSEL1 0x187 56.227 + 56.228 +/* K7/K8 MSRs. Not complete. See the architecture manual for a more complete list. */ 56.229 +#define MSR_K7_EVNTSEL0 0xC0010000 56.230 +#define MSR_K7_PERFCTR0 0xC0010004 56.231 +#define MSR_K7_EVNTSEL1 0xC0010001 56.232 +#define MSR_K7_PERFCTR1 0xC0010005 56.233 +#define MSR_K7_EVNTSEL2 0xC0010002 56.234 +#define MSR_K7_PERFCTR2 0xC0010006 56.235 +#define MSR_K7_EVNTSEL3 0xC0010003 56.236 +#define MSR_K7_PERFCTR3 0xC0010007 56.237 +#define MSR_K8_TOP_MEM1 0xC001001A 56.238 +#define MSR_K8_TOP_MEM2 0xC001001D 56.239 +#define MSR_K8_SYSCFG 0xC0010010 56.240 +#define MSR_K8_HWCR 0xC0010015 56.241 + 56.242 +/* K6 MSRs */ 56.243 +#define MSR_K6_EFER 0xC0000080 56.244 +#define MSR_K6_STAR 0xC0000081 56.245 +#define MSR_K6_WHCR 0xC0000082 56.246 +#define MSR_K6_UWCCR 0xC0000085 56.247 +#define MSR_K6_PSOR 0xC0000087 56.248 +#define MSR_K6_PFIR 0xC0000088 56.249 + 56.250 +/* Centaur-Hauls/IDT defined MSRs. */ 56.251 +#define MSR_IDT_FCR1 0x107 56.252 +#define MSR_IDT_FCR2 0x108 56.253 +#define MSR_IDT_FCR3 0x109 56.254 +#define MSR_IDT_FCR4 0x10a 56.255 + 56.256 +#define MSR_IDT_MCR0 0x110 56.257 +#define MSR_IDT_MCR1 0x111 56.258 +#define MSR_IDT_MCR2 0x112 56.259 +#define MSR_IDT_MCR3 0x113 56.260 +#define MSR_IDT_MCR4 0x114 56.261 +#define MSR_IDT_MCR5 0x115 56.262 +#define MSR_IDT_MCR6 0x116 56.263 +#define MSR_IDT_MCR7 0x117 56.264 +#define MSR_IDT_MCR_CTRL 0x120 56.265 + 56.266 +/* VIA Cyrix defined MSRs*/ 56.267 +#define MSR_VIA_FCR 0x1107 56.268 +#define MSR_VIA_LONGHAUL 0x110a 56.269 +#define MSR_VIA_RNG 0x110b 56.270 +#define MSR_VIA_BCR2 0x1147 56.271 + 56.272 +/* Intel defined MSRs. */ 56.273 +#define MSR_IA32_P5_MC_ADDR 0 56.274 +#define MSR_IA32_P5_MC_TYPE 1 56.275 +#define MSR_IA32_PLATFORM_ID 0x17 56.276 +#define MSR_IA32_EBL_CR_POWERON 0x2a 56.277 + 56.278 +#define MSR_IA32_APICBASE 0x1b 56.279 +#define MSR_IA32_APICBASE_BSP (1<<8) 56.280 +#define MSR_IA32_APICBASE_ENABLE (1<<11) 56.281 +#define MSR_IA32_APICBASE_BASE (0xfffff<<12) 56.282 + 56.283 +/* P4/Xeon+ specific */ 56.284 +#define MSR_IA32_MCG_EAX 0x180 56.285 +#define MSR_IA32_MCG_EBX 0x181 56.286 +#define MSR_IA32_MCG_ECX 0x182 56.287 +#define MSR_IA32_MCG_EDX 0x183 56.288 +#define MSR_IA32_MCG_ESI 0x184 56.289 +#define MSR_IA32_MCG_EDI 0x185 56.290 +#define MSR_IA32_MCG_EBP 0x186 56.291 +#define MSR_IA32_MCG_ESP 0x187 56.292 +#define MSR_IA32_MCG_EFLAGS 0x188 56.293 +#define MSR_IA32_MCG_EIP 0x189 56.294 +#define MSR_IA32_MCG_RESERVED 0x18A 56.295 + 56.296 +#define MSR_P6_EVNTSEL0 0x186 56.297 +#define MSR_P6_EVNTSEL1 0x187 56.298 + 56.299 +#define MSR_IA32_PERF_STATUS 0x198 56.300 +#define MSR_IA32_PERF_CTL 0x199 56.301 + 56.302 +#define MSR_IA32_THERM_CONTROL 0x19a 56.303 +#define MSR_IA32_THERM_INTERRUPT 0x19b 56.304 +#define MSR_IA32_THERM_STATUS 0x19c 56.305 +#define MSR_IA32_MISC_ENABLE 0x1a0 56.306 + 56.307 +#define MSR_IA32_DEBUGCTLMSR 0x1d9 56.308 +#define MSR_IA32_LASTBRANCHFROMIP 0x1db 56.309 +#define MSR_IA32_LASTBRANCHTOIP 0x1dc 56.310 +#define MSR_IA32_LASTINTFROMIP 0x1dd 56.311 +#define MSR_IA32_LASTINTTOIP 0x1de 56.312 + 56.313 +#define MSR_IA32_MC0_CTL 0x400 56.314 +#define MSR_IA32_MC0_STATUS 0x401 56.315 +#define MSR_IA32_MC0_ADDR 0x402 56.316 +#define MSR_IA32_MC0_MISC 0x403 56.317 + 56.318 +/* Pentium IV performance counter MSRs */ 56.319 +#define MSR_P4_BPU_PERFCTR0 0x300 56.320 +#define MSR_P4_BPU_PERFCTR1 0x301 56.321 +#define MSR_P4_BPU_PERFCTR2 0x302 56.322 +#define MSR_P4_BPU_PERFCTR3 0x303 56.323 +#define MSR_P4_MS_PERFCTR0 0x304 56.324 +#define MSR_P4_MS_PERFCTR1 0x305 56.325 +#define MSR_P4_MS_PERFCTR2 0x306 56.326 +#define MSR_P4_MS_PERFCTR3 0x307 56.327 +#define MSR_P4_FLAME_PERFCTR0 0x308 56.328 +#define MSR_P4_FLAME_PERFCTR1 0x309 56.329 +#define MSR_P4_FLAME_PERFCTR2 0x30a 56.330 +#define MSR_P4_FLAME_PERFCTR3 0x30b 56.331 +#define MSR_P4_IQ_PERFCTR0 0x30c 56.332 +#define MSR_P4_IQ_PERFCTR1 0x30d 56.333 +#define MSR_P4_IQ_PERFCTR2 0x30e 56.334 +#define MSR_P4_IQ_PERFCTR3 0x30f 56.335 +#define MSR_P4_IQ_PERFCTR4 0x310 56.336 +#define MSR_P4_IQ_PERFCTR5 0x311 56.337 +#define MSR_P4_BPU_CCCR0 0x360 56.338 +#define MSR_P4_BPU_CCCR1 0x361 56.339 +#define MSR_P4_BPU_CCCR2 0x362 56.340 +#define MSR_P4_BPU_CCCR3 0x363 56.341 +#define MSR_P4_MS_CCCR0 0x364 56.342 +#define MSR_P4_MS_CCCR1 0x365 56.343 +#define MSR_P4_MS_CCCR2 0x366 56.344 +#define MSR_P4_MS_CCCR3 0x367 56.345 +#define MSR_P4_FLAME_CCCR0 0x368 56.346 +#define MSR_P4_FLAME_CCCR1 0x369 56.347 +#define MSR_P4_FLAME_CCCR2 0x36a 56.348 +#define MSR_P4_FLAME_CCCR3 0x36b 56.349 +#define MSR_P4_IQ_CCCR0 0x36c 56.350 +#define MSR_P4_IQ_CCCR1 0x36d 56.351 +#define MSR_P4_IQ_CCCR2 0x36e 56.352 +#define MSR_P4_IQ_CCCR3 0x36f 56.353 +#define MSR_P4_IQ_CCCR4 0x370 56.354 +#define MSR_P4_IQ_CCCR5 0x371 56.355 +#define MSR_P4_ALF_ESCR0 0x3ca 56.356 +#define MSR_P4_ALF_ESCR1 0x3cb 56.357 +#define MSR_P4_BPU_ESCR0 0x3b2 56.358 +#define MSR_P4_BPU_ESCR1 0x3b3 56.359 +#define MSR_P4_BSU_ESCR0 0x3a0 56.360 +#define MSR_P4_BSU_ESCR1 0x3a1 56.361 +#define MSR_P4_CRU_ESCR0 0x3b8 56.362 +#define MSR_P4_CRU_ESCR1 0x3b9 56.363 +#define MSR_P4_CRU_ESCR2 0x3cc 56.364 +#define MSR_P4_CRU_ESCR3 0x3cd 56.365 +#define MSR_P4_CRU_ESCR4 0x3e0 56.366 +#define MSR_P4_CRU_ESCR5 0x3e1 56.367 +#define MSR_P4_DAC_ESCR0 0x3a8 56.368 +#define MSR_P4_DAC_ESCR1 0x3a9 56.369 +#define MSR_P4_FIRM_ESCR0 0x3a4 56.370 +#define MSR_P4_FIRM_ESCR1 0x3a5 56.371 +#define MSR_P4_FLAME_ESCR0 0x3a6 56.372 +#define MSR_P4_FLAME_ESCR1 0x3a7 56.373 +#define MSR_P4_FSB_ESCR0 0x3a2 56.374 +#define MSR_P4_FSB_ESCR1 0x3a3 56.375 +#define MSR_P4_IQ_ESCR0 0x3ba 56.376 +#define MSR_P4_IQ_ESCR1 0x3bb 56.377 +#define MSR_P4_IS_ESCR0 0x3b4 56.378 +#define MSR_P4_IS_ESCR1 0x3b5 56.379 +#define MSR_P4_ITLB_ESCR0 0x3b6 56.380 +#define MSR_P4_ITLB_ESCR1 0x3b7 56.381 +#define MSR_P4_IX_ESCR0 0x3c8 56.382 +#define MSR_P4_IX_ESCR1 0x3c9 56.383 +#define MSR_P4_MOB_ESCR0 0x3aa 56.384 +#define MSR_P4_MOB_ESCR1 0x3ab 56.385 +#define MSR_P4_MS_ESCR0 0x3c0 56.386 +#define MSR_P4_MS_ESCR1 0x3c1 56.387 +#define MSR_P4_PMH_ESCR0 0x3ac 56.388 +#define MSR_P4_PMH_ESCR1 0x3ad 56.389 +#define MSR_P4_RAT_ESCR0 0x3bc 56.390 +#define MSR_P4_RAT_ESCR1 0x3bd 56.391 +#define MSR_P4_SAAT_ESCR0 0x3ae 56.392 +#define MSR_P4_SAAT_ESCR1 0x3af 56.393 +#define MSR_P4_SSU_ESCR0 0x3be 56.394 +#define MSR_P4_SSU_ESCR1 0x3bf /* guess: not defined in manual */ 56.395 +#define MSR_P4_TBPU_ESCR0 0x3c2 56.396 +#define MSR_P4_TBPU_ESCR1 0x3c3 56.397 +#define MSR_P4_TC_ESCR0 0x3c4 56.398 +#define MSR_P4_TC_ESCR1 0x3c5 56.399 +#define MSR_P4_U2L_ESCR0 0x3b0 56.400 +#define MSR_P4_U2L_ESCR1 0x3b1 56.401 + 56.402 +#endif
57.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/processor.h Mon Mar 27 15:36:47 2006 -0700 57.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/processor.h Tue Mar 28 08:54:58 2006 -0700 57.3 @@ -141,31 +141,21 @@ extern unsigned long mmu_cr4_features; 57.4 static inline void set_in_cr4 (unsigned long mask) 57.5 { 57.6 mmu_cr4_features |= mask; 57.7 - switch (mask) { 57.8 - case X86_CR4_OSFXSR: 57.9 - case X86_CR4_OSXMMEXCPT: 57.10 - break; 57.11 - default: 57.12 - do { 57.13 - const char *msg = "Xen unsupported cr4 update\n"; 57.14 - (void)HYPERVISOR_console_io( 57.15 - CONSOLEIO_write, __builtin_strlen(msg), 57.16 - (char *)msg); 57.17 - BUG(); 57.18 - } while (0); 57.19 - } 57.20 + __asm__("movq %%cr4,%%rax\n\t" 57.21 + "orq %0,%%rax\n\t" 57.22 + "movq %%rax,%%cr4\n" 57.23 + : : "irg" (mask) 57.24 + :"ax"); 57.25 } 57.26 57.27 static inline void clear_in_cr4 (unsigned long mask) 57.28 { 57.29 -#ifndef CONFIG_XEN 57.30 mmu_cr4_features &= ~mask; 57.31 __asm__("movq %%cr4,%%rax\n\t" 57.32 "andq %0,%%rax\n\t" 57.33 "movq %%rax,%%cr4\n" 57.34 : : "irg" (~mask) 57.35 :"ax"); 57.36 -#endif 57.37 } 57.38 57.39
58.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h Mon Mar 27 15:36:47 2006 -0700 58.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h Tue Mar 28 08:54:58 2006 -0700 58.3 @@ -6,17 +6,6 @@ 58.4 * use of all of the static functions. 58.5 **/ 58.6 58.7 -void __cpuinit machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c) 58.8 -{ 58.9 - clear_bit(X86_FEATURE_VME, c->x86_capability); 58.10 - clear_bit(X86_FEATURE_DE, c->x86_capability); 58.11 - clear_bit(X86_FEATURE_PSE, c->x86_capability); 58.12 - clear_bit(X86_FEATURE_PGE, c->x86_capability); 58.13 - clear_bit(X86_FEATURE_SEP, c->x86_capability); 58.14 - if (!(xen_start_info->flags & SIF_PRIVILEGED)) 58.15 - clear_bit(X86_FEATURE_MTRR, c->x86_capability); 58.16 -} 58.17 - 58.18 extern void hypervisor_callback(void); 58.19 extern void failsafe_callback(void); 58.20 extern void nmi(void); 58.21 @@ -36,6 +25,4 @@ static void __init machine_specific_arch 58.22 cb.handler_address = (unsigned long)&nmi; 58.23 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb); 58.24 #endif 58.25 - 58.26 - machine_specific_modify_cpu_capabilities(&boot_cpu_data); 58.27 }
59.1 --- a/linux-2.6-xen-sparse/include/linux/mm.h Mon Mar 27 15:36:47 2006 -0700 59.2 +++ b/linux-2.6-xen-sparse/include/linux/mm.h Tue Mar 28 08:54:58 2006 -0700 59.3 @@ -1020,10 +1020,10 @@ struct page *follow_page(struct vm_area_ 59.4 #define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ 59.5 59.6 #ifdef CONFIG_XEN 59.7 -typedef int (*pte_fn_t)(pte_t *pte, struct page *pte_page, unsigned long addr, 59.8 - void *data); 59.9 -extern int generic_page_range(struct mm_struct *mm, unsigned long address, 59.10 - unsigned long size, pte_fn_t fn, void *data); 59.11 +typedef int (*pte_fn_t)(pte_t *pte, struct page *pmd_page, unsigned long addr, 59.12 + void *data); 59.13 +extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, 59.14 + unsigned long size, pte_fn_t fn, void *data); 59.15 #endif 59.16 59.17 #ifdef CONFIG_PROC_FS
60.1 --- a/linux-2.6-xen-sparse/mm/memory.c Mon Mar 27 15:36:47 2006 -0700 60.2 +++ b/linux-2.6-xen-sparse/mm/memory.c Tue Mar 28 08:54:58 2006 -0700 60.3 @@ -1378,36 +1378,39 @@ int remap_pfn_range(struct vm_area_struc 60.4 EXPORT_SYMBOL(remap_pfn_range); 60.5 60.6 #ifdef CONFIG_XEN 60.7 -static inline int generic_pte_range(struct mm_struct *mm, pmd_t *pmd, 60.8 - unsigned long addr, unsigned long end, 60.9 - pte_fn_t fn, void *data) 60.10 +static inline int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, 60.11 + unsigned long addr, unsigned long end, 60.12 + pte_fn_t fn, void *data) 60.13 { 60.14 pte_t *pte; 60.15 int err; 60.16 - struct page *pte_page; 60.17 + struct page *pmd_page; 60.18 + spinlock_t *ptl; 60.19 60.20 pte = (mm == &init_mm) ? 60.21 pte_alloc_kernel(pmd, addr) : 60.22 - pte_alloc_map(mm, pmd, addr); 60.23 + pte_alloc_map_lock(mm, pmd, addr, &ptl); 60.24 if (!pte) 60.25 return -ENOMEM; 60.26 60.27 - pte_page = pmd_page(*pmd); 60.28 + BUG_ON(pmd_huge(*pmd)); 60.29 + 60.30 + pmd_page = pmd_page(*pmd); 60.31 60.32 do { 60.33 - err = fn(pte, pte_page, addr, data); 60.34 + err = fn(pte, pmd_page, addr, data); 60.35 if (err) 60.36 break; 60.37 } while (pte++, addr += PAGE_SIZE, addr != end); 60.38 60.39 if (mm != &init_mm) 60.40 - pte_unmap(pte-1); 60.41 + pte_unmap_unlock(pte-1, ptl); 60.42 return err; 60.43 } 60.44 60.45 -static inline int generic_pmd_range(struct mm_struct *mm, pud_t *pud, 60.46 - unsigned long addr, unsigned long end, 60.47 - pte_fn_t fn, void *data) 60.48 +static inline int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, 60.49 + unsigned long addr, unsigned long end, 60.50 + pte_fn_t fn, void *data) 60.51 { 60.52 pmd_t *pmd; 60.53 unsigned long next; 60.54 @@ -1418,16 +1421,16 @@ static inline int generic_pmd_range(stru 60.55 return -ENOMEM; 60.56 do { 60.57 next = pmd_addr_end(addr, end); 60.58 - err = generic_pte_range(mm, pmd, addr, next, fn, data); 60.59 + err = apply_to_pte_range(mm, pmd, addr, next, fn, data); 60.60 if (err) 60.61 break; 60.62 } while (pmd++, addr = next, addr != end); 60.63 return err; 60.64 } 60.65 60.66 -static inline int generic_pud_range(struct mm_struct *mm, pgd_t *pgd, 60.67 - unsigned long addr, unsigned long end, 60.68 - pte_fn_t fn, void *data) 60.69 +static inline int apply_to_pud_range(struct mm_struct *mm, pgd_t *pgd, 60.70 + unsigned long addr, unsigned long end, 60.71 + pte_fn_t fn, void *data) 60.72 { 60.73 pud_t *pud; 60.74 unsigned long next; 60.75 @@ -1438,7 +1441,7 @@ static inline int generic_pud_range(stru 60.76 return -ENOMEM; 60.77 do { 60.78 next = pud_addr_end(addr, end); 60.79 - err = generic_pmd_range(mm, pud, addr, next, fn, data); 60.80 + err = apply_to_pmd_range(mm, pud, addr, next, fn, data); 60.81 if (err) 60.82 break; 60.83 } while (pud++, addr = next, addr != end); 60.84 @@ -1449,8 +1452,8 @@ static inline int generic_pud_range(stru 60.85 * Scan a region of virtual memory, filling in page tables as necessary 60.86 * and calling a provided function on each leaf page table. 60.87 */ 60.88 -int generic_page_range(struct mm_struct *mm, unsigned long addr, 60.89 - unsigned long size, pte_fn_t fn, void *data) 60.90 +int apply_to_page_range(struct mm_struct *mm, unsigned long addr, 60.91 + unsigned long size, pte_fn_t fn, void *data) 60.92 { 60.93 pgd_t *pgd; 60.94 unsigned long next; 60.95 @@ -1461,12 +1464,13 @@ int generic_page_range(struct mm_struct 60.96 pgd = pgd_offset(mm, addr); 60.97 do { 60.98 next = pgd_addr_end(addr, end); 60.99 - err = generic_pud_range(mm, pgd, addr, next, fn, data); 60.100 + err = apply_to_pud_range(mm, pgd, addr, next, fn, data); 60.101 if (err) 60.102 break; 60.103 } while (pgd++, addr = next, addr != end); 60.104 return err; 60.105 } 60.106 +EXPORT_SYMBOL_GPL(apply_to_page_range); 60.107 #endif 60.108 60.109 /*
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/patches/linux-2.6.16/device_bind.patch Tue Mar 28 08:54:58 2006 -0700 61.3 @@ -0,0 +1,14 @@ 61.4 +--- linux-2.6.16/drivers/base/bus.c 2006-03-16 10:50:20.000000000 -0500 61.5 ++++ linux-2.6.16/drivers/base/bus.c 2006-03-16 11:02:08.000000000 -0500 61.6 +@@ -188,6 +188,11 @@ static ssize_t driver_bind(struct device 61.7 + up(&dev->sem); 61.8 + if (dev->parent) 61.9 + up(&dev->parent->sem); 61.10 ++ 61.11 ++ if (err > 0) /* success */ 61.12 ++ err = count; 61.13 ++ else if (err == 0) /* driver didn't accept device */ 61.14 ++ err = -ENODEV; 61.15 + } 61.16 + put_device(dev); 61.17 + put_bus(bus);
62.1 --- a/tools/Makefile Mon Mar 27 15:36:47 2006 -0700 62.2 +++ b/tools/Makefile Tue Mar 28 08:54:58 2006 -0700 62.3 @@ -37,6 +37,7 @@ install: check 62.4 $(MAKE) -C $$subdir $@; \ 62.5 done 62.6 $(MAKE) ioemuinstall 62.7 + $(INSTALL_DIR) -p $(DESTDIR)/var/xen/dump 62.8 62.9 clean: check_clean 62.10 @set -e; for subdir in $(SUBDIRS); do \
63.1 --- a/tools/debugger/gdb/README Mon Mar 27 15:36:47 2006 -0700 63.2 +++ b/tools/debugger/gdb/README Tue Mar 28 08:54:58 2006 -0700 63.3 @@ -11,8 +11,8 @@ To build the GDB server: 63.4 to your test machine. 63.5 63.6 To build a debuggable guest kernel image: 63.7 - 1. cd linux-2.6.12-xenU 63.8 - 2. ARCH=xen make menuconfig 63.9 + 1. cd linux-2.6.xx-xenU 63.10 + 2. make menuconfig 63.11 3. From within the configurator, enable the following options: 63.12 # Kernel hacking -> Compile the kernel with debug info [*] 63.13 -> Compile the kernel with frame pointers
64.1 --- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv Mon Mar 27 15:36:47 2006 -0700 64.2 +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv Tue Mar 28 08:54:58 2006 -0700 64.3 @@ -61,7 +61,7 @@ case "${target}" in 64.4 srv_linux_thread_db=yes 64.5 ;; 64.6 x86_64-*-linux*) srv_regobj=reg-x86-64.o 64.7 - srv_tgtobj="linux-low.o linux-x86-64-low.o i387-fp.o" 64.8 + srv_tgtobj="linux-xen-low.o linux-x86-64-low.o i387-fp.o" 64.9 srv_linux_regsets=yes 64.10 ;; 64.11 xscale*-*-linux*) srv_regobj=reg-arm.o
65.1 --- a/tools/examples/xen-backend.agent Mon Mar 27 15:36:47 2006 -0700 65.2 +++ b/tools/examples/xen-backend.agent Tue Mar 28 08:54:58 2006 -0700 65.3 @@ -2,6 +2,10 @@ 65.4 65.5 PATH=/etc/xen/scripts:$PATH 65.6 65.7 +. /etc/xen/scripts/locking.sh 65.8 + 65.9 +claim_lock xenbus_hotplug_global 65.10 + 65.11 case "$XENBUS_TYPE" in 65.12 vbd) 65.13 /etc/xen/scripts/block "$ACTION" 65.14 @@ -25,3 +29,5 @@ case "$ACTION" in 65.15 offline) 65.16 ;; 65.17 esac 65.18 + 65.19 +release_lock xenbus_hotplug_global
66.1 --- a/tools/examples/xend-config.sxp Mon Mar 27 15:36:47 2006 -0700 66.2 +++ b/tools/examples/xend-config.sxp Tue Mar 28 08:54:58 2006 -0700 66.3 @@ -15,7 +15,9 @@ 66.4 #(loglevel DEBUG) 66.5 66.6 #(xend-http-server no) 66.7 -#(xend-unix-server yes) 66.8 +#(xend-unix-server no) 66.9 +#(xend-tcp-xmlrpc-server no) 66.10 +#(xend-unix-xmlrpc-server yes) 66.11 #(xend-relocation-server no) 66.12 (xend-relocation-server yes) 66.13
67.1 --- a/tools/ioemu/hw/pcnet.c Mon Mar 27 15:36:47 2006 -0700 67.2 +++ b/tools/ioemu/hw/pcnet.c Tue Mar 28 08:54:58 2006 -0700 67.3 @@ -45,21 +45,6 @@ 67.4 #define PCNET_PNPMMIO_SIZE 0x20 67.5 67.6 67.7 -typedef struct PCNetState_st PCNetState; 67.8 - 67.9 -struct PCNetState_st { 67.10 - PCIDevice dev; 67.11 - NetDriverState *nd; 67.12 - int mmio_io_addr, rap, isr, lnkst; 67.13 - target_phys_addr_t rdra, tdra; 67.14 - uint8_t prom[16]; 67.15 - uint16_t csr[128]; 67.16 - uint16_t bcr[32]; 67.17 - uint64_t timer; 67.18 - int xmit_pos, recv_pos; 67.19 - uint8_t buffer[4096]; 67.20 -}; 67.21 - 67.22 #include "pcnet.h" 67.23 67.24 static void pcnet_poll(PCNetState *s); 67.25 @@ -217,6 +202,11 @@ static void pcnet_init(PCNetState *s) 67.26 CSR_RCVRC(s) = CSR_RCVRL(s); 67.27 CSR_XMTRC(s) = CSR_XMTRL(s); 67.28 67.29 + /* flush any cached receive descriptors */ 67.30 + s->crmd.rmd1.own = 0; 67.31 + s->nrmd.rmd1.own = 0; 67.32 + s->nnrmd.rmd1.own = 0; 67.33 + 67.34 #ifdef PCNET_DEBUG 67.35 printf("pcnet ss32=%d rdra=0x%08x[%d] tdra=0x%08x[%d]\n", 67.36 BCR_SSIZE32(s), 67.37 @@ -239,6 +229,11 @@ static void pcnet_start(PCNetState *s) 67.38 if (!CSR_DRX(s)) 67.39 s->csr[0] |= 0x0020; /* set RXON */ 67.40 67.41 + /* flush any cached receive descriptors */ 67.42 + s->crmd.rmd1.own = 0; 67.43 + s->nrmd.rmd1.own = 0; 67.44 + s->nnrmd.rmd1.own = 0; 67.45 + 67.46 s->csr[0] &= ~0x0004; /* clear STOP bit */ 67.47 s->csr[0] |= 0x0002; 67.48 } 67.49 @@ -260,29 +255,21 @@ static void pcnet_rdte_poll(PCNetState * 67.50 s->csr[28] = s->csr[29] = 0; 67.51 if (s->rdra) { 67.52 int bad = 0; 67.53 -#if 1 67.54 target_phys_addr_t crda = pcnet_rdra_addr(s, CSR_RCVRC(s)); 67.55 target_phys_addr_t nrda = pcnet_rdra_addr(s, -1 + CSR_RCVRC(s)); 67.56 target_phys_addr_t nnrd = pcnet_rdra_addr(s, -2 + CSR_RCVRC(s)); 67.57 -#else 67.58 - target_phys_addr_t crda = s->rdra + 67.59 - (CSR_RCVRL(s) - CSR_RCVRC(s)) * 67.60 - (BCR_SWSTYLE(s) ? 16 : 8 ); 67.61 - int nrdc = CSR_RCVRC(s)<=1 ? CSR_RCVRL(s) : CSR_RCVRC(s)-1; 67.62 - target_phys_addr_t nrda = s->rdra + 67.63 - (CSR_RCVRL(s) - nrdc) * 67.64 - (BCR_SWSTYLE(s) ? 16 : 8 ); 67.65 - int nnrc = nrdc<=1 ? CSR_RCVRL(s) : nrdc-1; 67.66 - target_phys_addr_t nnrd = s->rdra + 67.67 - (CSR_RCVRL(s) - nnrc) * 67.68 - (BCR_SWSTYLE(s) ? 16 : 8 ); 67.69 -#endif 67.70 67.71 - CHECK_RMD(PHYSADDR(s,crda), bad); 67.72 + if (!s->crmd.rmd1.own) { 67.73 + CHECK_RMD(&(s->crmd),PHYSADDR(s,crda), bad); 67.74 + } 67.75 if (!bad) { 67.76 - CHECK_RMD(PHYSADDR(s,nrda), bad); 67.77 + if (s->crmd.rmd1.own && !s->nrmd.rmd1.own) { 67.78 + CHECK_RMD(&(s->nrmd),PHYSADDR(s,nrda), bad); 67.79 + } 67.80 if (bad || (nrda == crda)) nrda = 0; 67.81 - CHECK_RMD(PHYSADDR(s,nnrd), bad); 67.82 + if (s->crmd.rmd1.own && s->nrmd.rmd1.own && !s->nnrmd.rmd1.own) { 67.83 + CHECK_RMD(&(s->nnrmd),PHYSADDR(s,nnrd), bad); 67.84 + } 67.85 if (bad || (nnrd == crda)) nnrd = 0; 67.86 67.87 s->csr[28] = crda & 0xffff; 67.88 @@ -303,14 +290,12 @@ static void pcnet_rdte_poll(PCNetState * 67.89 } 67.90 67.91 if (CSR_CRDA(s)) { 67.92 - struct pcnet_RMD rmd; 67.93 - RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s))); 67.94 - CSR_CRBC(s) = rmd.rmd1.bcnt; 67.95 - CSR_CRST(s) = ((uint32_t *)&rmd)[1] >> 16; 67.96 + CSR_CRBC(s) = s->crmd.rmd1.bcnt; 67.97 + CSR_CRST(s) = ((uint32_t *)&(s->crmd))[1] >> 16; 67.98 #ifdef PCNET_DEBUG_RMD_X 67.99 printf("CRDA=0x%08x CRST=0x%04x RCVRC=%d RMD1=0x%08x RMD2=0x%08x\n", 67.100 PHYSADDR(s,CSR_CRDA(s)), CSR_CRST(s), CSR_RCVRC(s), 67.101 - ((uint32_t *)&rmd)[1], ((uint32_t *)&rmd)[2]); 67.102 + ((uint32_t *)&(s->crmd))[1], ((uint32_t *)&(s->crmd))[2]); 67.103 PRINT_RMD(&rmd); 67.104 #endif 67.105 } else { 67.106 @@ -318,10 +303,8 @@ static void pcnet_rdte_poll(PCNetState * 67.107 } 67.108 67.109 if (CSR_NRDA(s)) { 67.110 - struct pcnet_RMD rmd; 67.111 - RMDLOAD(&rmd, PHYSADDR(s,CSR_NRDA(s))); 67.112 - CSR_NRBC(s) = rmd.rmd1.bcnt; 67.113 - CSR_NRST(s) = ((uint32_t *)&rmd)[1] >> 16; 67.114 + CSR_NRBC(s) = s->nrmd.rmd1.bcnt; 67.115 + CSR_NRST(s) = ((uint32_t *)&(s->nrmd))[1] >> 16; 67.116 } else { 67.117 CSR_NRBC(s) = CSR_NRST(s) = 0; 67.118 } 67.119 @@ -336,6 +319,7 @@ static int pcnet_tdte_poll(PCNetState *s 67.120 (CSR_XMTRL(s) - CSR_XMTRC(s)) * 67.121 (BCR_SWSTYLE(s) ? 16 : 8 ); 67.122 int bad = 0; 67.123 + s->csr[0] &= ~0x0008; /* clear TDMD */ 67.124 CHECK_TMD(PHYSADDR(s, cxda),bad); 67.125 if (!bad) { 67.126 if (CSR_CXDA(s) != cxda) { 67.127 @@ -354,12 +338,8 @@ static int pcnet_tdte_poll(PCNetState *s 67.128 } 67.129 67.130 if (CSR_CXDA(s)) { 67.131 - struct pcnet_TMD tmd; 67.132 - 67.133 - TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s))); 67.134 - 67.135 - CSR_CXBC(s) = tmd.tmd1.bcnt; 67.136 - CSR_CXST(s) = ((uint32_t *)&tmd)[1] >> 16; 67.137 + CSR_CXBC(s) = s->tmd.tmd1.bcnt; 67.138 + CSR_CXST(s) = ((uint32_t *)&(s->tmd))[1] >> 16; 67.139 } else { 67.140 CSR_CXBC(s) = CSR_CXST(s) = 0; 67.141 } 67.142 @@ -373,14 +353,11 @@ static int pcnet_can_receive(void *opaqu 67.143 if (CSR_STOP(s) || CSR_SPND(s)) 67.144 return 0; 67.145 67.146 - if (s->recv_pos > 0) 67.147 - return 0; 67.148 - 67.149 pcnet_rdte_poll(s); 67.150 if (!(CSR_CRST(s) & 0x8000)) { 67.151 return 0; 67.152 } 67.153 - return sizeof(s->buffer)-16; 67.154 + return sizeof(s->rx_buffer)-16; 67.155 } 67.156 67.157 #define MIN_BUF_SIZE 60 67.158 @@ -389,7 +366,7 @@ static void pcnet_receive(void *opaque, 67.159 { 67.160 PCNetState *s = opaque; 67.161 int is_padr = 0, is_bcast = 0, is_ladr = 0; 67.162 - uint8_t buf1[60]; 67.163 + int pad; 67.164 67.165 if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size) 67.166 return; 67.167 @@ -399,12 +376,10 @@ static void pcnet_receive(void *opaque, 67.168 #endif 67.169 67.170 /* if too small buffer, then expand it */ 67.171 - if (size < MIN_BUF_SIZE) { 67.172 - memcpy(buf1, buf, size); 67.173 - memset(buf1 + size, 0, MIN_BUF_SIZE - size); 67.174 - buf = buf1; 67.175 - size = MIN_BUF_SIZE; 67.176 - } 67.177 + if (size < MIN_BUF_SIZE) 67.178 + pad = MIN_BUF_SIZE - size + 4; 67.179 + else 67.180 + pad = 4; 67.181 67.182 if (CSR_PROM(s) 67.183 || (is_padr=padr_match(s, buf, size)) 67.184 @@ -413,124 +388,74 @@ static void pcnet_receive(void *opaque, 67.185 67.186 pcnet_rdte_poll(s); 67.187 67.188 - if (!(CSR_CRST(s) & 0x8000) && s->rdra) { 67.189 - struct pcnet_RMD rmd; 67.190 - int rcvrc = CSR_RCVRC(s)-1,i; 67.191 - target_phys_addr_t nrda; 67.192 - for (i = CSR_RCVRL(s)-1; i > 0; i--, rcvrc--) { 67.193 - if (rcvrc <= 1) 67.194 - rcvrc = CSR_RCVRL(s); 67.195 - nrda = s->rdra + 67.196 - (CSR_RCVRL(s) - rcvrc) * 67.197 - (BCR_SWSTYLE(s) ? 16 : 8 ); 67.198 - RMDLOAD(&rmd, PHYSADDR(s,nrda)); 67.199 - if (rmd.rmd1.own) { 67.200 + if (size > 2000) { 67.201 #ifdef PCNET_DEBUG_RMD 67.202 - printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n", 67.203 - rcvrc, CSR_RCVRC(s)); 67.204 + printf("pcnet - oversize packet discarded.\n"); 67.205 #endif 67.206 - CSR_RCVRC(s) = rcvrc; 67.207 - pcnet_rdte_poll(s); 67.208 - break; 67.209 - } 67.210 - } 67.211 - } 67.212 - 67.213 - if (!(CSR_CRST(s) & 0x8000)) { 67.214 + } else if (!(CSR_CRST(s) & 0x8000)) { 67.215 #ifdef PCNET_DEBUG_RMD 67.216 printf("pcnet - no buffer: RCVRC=%d\n", CSR_RCVRC(s)); 67.217 #endif 67.218 s->csr[0] |= 0x1000; /* Set MISS flag */ 67.219 CSR_MISSC(s)++; 67.220 } else { 67.221 - uint8_t *src = &s->buffer[8]; 67.222 + uint8_t *src = &s->rx_buffer[8]; 67.223 target_phys_addr_t crda = CSR_CRDA(s); 67.224 - struct pcnet_RMD rmd; 67.225 + target_phys_addr_t nrda = CSR_NRDA(s); 67.226 + target_phys_addr_t nnrda = CSR_NNRD(s); 67.227 int pktcount = 0; 67.228 + int packet_size = size + pad; 67.229 67.230 memcpy(src, buf, size); 67.231 - 67.232 - if (!CSR_ASTRP_RCV(s)) { 67.233 - uint32_t fcs = ~0; 67.234 -#if 0 67.235 - uint8_t *p = s->buffer; 67.236 - 67.237 - ((uint32_t *)p)[0] = ((uint32_t *)p)[1] = 0xaaaaaaaa; 67.238 - p[7] = 0xab; 67.239 -#else 67.240 - uint8_t *p = src; 67.241 -#endif 67.242 - 67.243 - while (size < 46) { 67.244 - src[size++] = 0; 67.245 - } 67.246 - 67.247 - while (p != &src[size]) { 67.248 - CRC(fcs, *p++); 67.249 - } 67.250 - ((uint32_t *)&src[size])[0] = htonl(fcs); 67.251 - size += 4; /* FCS at end of packet */ 67.252 - } else size += 4; 67.253 + memset(src + size, 0, pad); 67.254 + size += pad; 67.255 67.256 #ifdef PCNET_DEBUG_MATCH 67.257 PRINT_PKTHDR(buf); 67.258 #endif 67.259 67.260 - RMDLOAD(&rmd, PHYSADDR(s,crda)); 67.261 - /*if (!CSR_LAPPEN(s))*/ 67.262 - rmd.rmd1.stp = 1; 67.263 - 67.264 -#define PCNET_RECV_STORE() do { \ 67.265 - int count = MIN(4096 - rmd.rmd1.bcnt,size); \ 67.266 - target_phys_addr_t rbadr = PHYSADDR(s, rmd.rmd0.rbadr); \ 67.267 - cpu_physical_memory_write(rbadr, src, count); \ 67.268 - cpu_physical_memory_set_dirty(rbadr); \ 67.269 - cpu_physical_memory_set_dirty(rbadr+count); \ 67.270 - src += count; size -= count; \ 67.271 - rmd.rmd2.mcnt = count; rmd.rmd1.own = 0; \ 67.272 - RMDSTORE(&rmd, PHYSADDR(s,crda)); \ 67.273 - pktcount++; \ 67.274 -} while (0) 67.275 + s->crmd.rmd1.stp = 1; 67.276 + do { 67.277 + int count = MIN(4096 - s->crmd.rmd1.bcnt,size); 67.278 + target_phys_addr_t rbadr = PHYSADDR(s, s->crmd.rmd0.rbadr); 67.279 + cpu_physical_memory_write(rbadr, src, count); 67.280 + cpu_physical_memory_set_dirty(rbadr); 67.281 + cpu_physical_memory_set_dirty(rbadr+count); 67.282 + src += count; size -= count; 67.283 + if (size > 0 && s->nrmd.rmd1.own) { 67.284 + RMDSTORE(&(s->crmd), PHYSADDR(s,crda)); 67.285 + crda = nrda; 67.286 + nrda = nnrda; 67.287 + s->crmd = s->nrmd; 67.288 + s->nrmd = s->nnrmd; 67.289 + s->nnrmd.rmd1.own = 0; 67.290 + } 67.291 + pktcount++; 67.292 + } while (size > 0 && s->crmd.rmd1.own); 67.293 67.294 - PCNET_RECV_STORE(); 67.295 - if ((size > 0) && CSR_NRDA(s)) { 67.296 - target_phys_addr_t nrda = CSR_NRDA(s); 67.297 - RMDLOAD(&rmd, PHYSADDR(s,nrda)); 67.298 - if (rmd.rmd1.own) { 67.299 - crda = nrda; 67.300 - PCNET_RECV_STORE(); 67.301 - if ((size > 0) && (nrda=CSR_NNRD(s))) { 67.302 - RMDLOAD(&rmd, PHYSADDR(s,nrda)); 67.303 - if (rmd.rmd1.own) { 67.304 - crda = nrda; 67.305 - PCNET_RECV_STORE(); 67.306 - } 67.307 - } 67.308 - } 67.309 + if (size == 0) { 67.310 + s->crmd.rmd1.enp = 1; 67.311 + s->crmd.rmd2.mcnt = packet_size; 67.312 + s->crmd.rmd1.pam = !CSR_PROM(s) && is_padr; 67.313 + s->crmd.rmd1.lafm = !CSR_PROM(s) && is_ladr; 67.314 + s->crmd.rmd1.bam = !CSR_PROM(s) && is_bcast; 67.315 + } else { 67.316 + s->crmd.rmd1.oflo = 1; 67.317 + s->crmd.rmd1.buff = 1; 67.318 + s->crmd.rmd1.err = 1; 67.319 } 67.320 - 67.321 -#undef PCNET_RECV_STORE 67.322 - 67.323 - RMDLOAD(&rmd, PHYSADDR(s,crda)); 67.324 - if (size == 0) { 67.325 - rmd.rmd1.enp = 1; 67.326 - rmd.rmd1.pam = !CSR_PROM(s) && is_padr; 67.327 - rmd.rmd1.lafm = !CSR_PROM(s) && is_ladr; 67.328 - rmd.rmd1.bam = !CSR_PROM(s) && is_bcast; 67.329 - } else { 67.330 - rmd.rmd1.oflo = 1; 67.331 - rmd.rmd1.buff = 1; 67.332 - rmd.rmd1.err = 1; 67.333 - } 67.334 - RMDSTORE(&rmd, PHYSADDR(s,crda)); 67.335 + RMDSTORE(&(s->crmd), PHYSADDR(s,crda)); 67.336 s->csr[0] |= 0x0400; 67.337 + s->crmd = s->nrmd; 67.338 + s->nrmd = s->nnrmd; 67.339 + s->nnrmd.rmd1.own = 0; 67.340 67.341 #ifdef PCNET_DEBUG 67.342 printf("RCVRC=%d CRDA=0x%08x BLKS=%d\n", 67.343 CSR_RCVRC(s), PHYSADDR(s,CSR_CRDA(s)), pktcount); 67.344 #endif 67.345 #ifdef PCNET_DEBUG_RMD 67.346 - PRINT_RMD(&rmd); 67.347 + PRINT_RMD(&s->crmd); 67.348 #endif 67.349 67.350 while (pktcount--) { 67.351 @@ -551,80 +476,88 @@ static void pcnet_receive(void *opaque, 67.352 67.353 static void pcnet_transmit(PCNetState *s) 67.354 { 67.355 - target_phys_addr_t xmit_cxda = 0; 67.356 + target_phys_addr_t start_addr = 0; 67.357 + struct pcnet_TMD start_tmd; 67.358 int count = CSR_XMTRL(s)-1; 67.359 - s->xmit_pos = -1; 67.360 + int xmit_pos = 0; 67.361 + int len; 67.362 + 67.363 67.364 if (!CSR_TXON(s)) { 67.365 s->csr[0] &= ~0x0008; 67.366 return; 67.367 } 67.368 67.369 - txagain: 67.370 - if (pcnet_tdte_poll(s)) { 67.371 - struct pcnet_TMD tmd; 67.372 - 67.373 - TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s))); 67.374 + while (pcnet_tdte_poll(s)) { 67.375 67.376 #ifdef PCNET_DEBUG_TMD 67.377 printf(" TMDLOAD 0x%08x\n", PHYSADDR(s,CSR_CXDA(s))); 67.378 - PRINT_TMD(&tmd); 67.379 + PRINT_TMD(&(s->tmd)); 67.380 #endif 67.381 - if (tmd.tmd1.stp) { 67.382 - s->xmit_pos = 0; 67.383 - if (!tmd.tmd1.enp) { 67.384 - cpu_physical_memory_read(PHYSADDR(s, tmd.tmd0.tbadr), 67.385 - s->buffer, 4096 - tmd.tmd1.bcnt); 67.386 - s->xmit_pos += 4096 - tmd.tmd1.bcnt; 67.387 - } 67.388 - xmit_cxda = PHYSADDR(s,CSR_CXDA(s)); 67.389 - } 67.390 - if (tmd.tmd1.enp && (s->xmit_pos >= 0)) { 67.391 - cpu_physical_memory_read(PHYSADDR(s, tmd.tmd0.tbadr), 67.392 - s->buffer + s->xmit_pos, 4096 - tmd.tmd1.bcnt); 67.393 - s->xmit_pos += 4096 - tmd.tmd1.bcnt; 67.394 - 67.395 - tmd.tmd1.own = 0; 67.396 - TMDSTORE(&tmd, PHYSADDR(s,CSR_CXDA(s))); 67.397 - 67.398 -#ifdef PCNET_DEBUG 67.399 - printf("pcnet_transmit size=%d\n", s->xmit_pos); 67.400 -#endif 67.401 - if (CSR_LOOP(s)) 67.402 - pcnet_receive(s, s->buffer, s->xmit_pos); 67.403 - else 67.404 - qemu_send_packet(s->nd, s->buffer, s->xmit_pos); 67.405 - 67.406 - s->csr[0] &= ~0x0008; /* clear TDMD */ 67.407 - s->csr[4] |= 0x0004; /* set TXSTRT */ 67.408 - s->xmit_pos = -1; 67.409 - } else { 67.410 - tmd.tmd1.own = 0; 67.411 - TMDSTORE(&tmd, PHYSADDR(s,CSR_CXDA(s))); 67.412 - } 67.413 - if (!CSR_TOKINTD(s) || (CSR_LTINTEN(s) && tmd.tmd1.ltint)) 67.414 - s->csr[0] |= 0x0200; /* set TINT */ 67.415 - 67.416 - if (CSR_XMTRC(s)<=1) 67.417 + len = 4096 - s->tmd.tmd1.bcnt; 67.418 + if (CSR_XMTRC(s) <= 1) 67.419 CSR_XMTRC(s) = CSR_XMTRL(s); 67.420 else 67.421 CSR_XMTRC(s)--; 67.422 - if (count--) 67.423 - goto txagain; 67.424 + 67.425 + /* handle start followed by start */ 67.426 + if (s->tmd.tmd1.stp && start_addr) { 67.427 + TMDSTORE(&start_tmd, start_addr); 67.428 + start_addr = 0; 67.429 + xmit_pos = 0; 67.430 + } 67.431 + if ((xmit_pos + len) < sizeof(s->tx_buffer)) { 67.432 + cpu_physical_memory_read(PHYSADDR(s, s->tmd.tmd0.tbadr), 67.433 + s->tx_buffer + xmit_pos, len); 67.434 + xmit_pos += len; 67.435 + } else { 67.436 + s->tmd.tmd2.buff = s->tmd.tmd2.uflo = s->tmd.tmd1.err = 1; 67.437 + TMDSTORE(&(s->tmd), PHYSADDR(s,CSR_CXDA(s))); 67.438 + if (start_addr == PHYSADDR(s,CSR_CXDA(s))) 67.439 + start_addr = 0; /* don't clear own bit twice */ 67.440 + continue; 67.441 + } 67.442 + if (s->tmd.tmd1.stp) { 67.443 + if (s->tmd.tmd1.enp) { 67.444 + if (CSR_LOOP(s)) 67.445 + pcnet_receive(s, s->tx_buffer, xmit_pos); 67.446 + else 67.447 + qemu_send_packet(s->nd, s->tx_buffer, xmit_pos); 67.448 67.449 - } else 67.450 - if (s->xmit_pos >= 0) { 67.451 - struct pcnet_TMD tmd; 67.452 - TMDLOAD(&tmd, PHYSADDR(s,xmit_cxda)); 67.453 - tmd.tmd2.buff = tmd.tmd2.uflo = tmd.tmd1.err = 1; 67.454 - tmd.tmd1.own = 0; 67.455 - TMDSTORE(&tmd, PHYSADDR(s,xmit_cxda)); 67.456 + s->csr[4] |= 0x0008; /* set TXSTRT */ 67.457 + TMDSTORE(&(s->tmd), PHYSADDR(s,CSR_CXDA(s))); 67.458 + xmit_pos = 0; 67.459 + count--; 67.460 + } else { 67.461 + start_tmd = s->tmd; 67.462 + start_addr = PHYSADDR(s,CSR_CXDA(s)); 67.463 + } 67.464 + } else if (s->tmd.tmd1.enp) { 67.465 + TMDSTORE(&(s->tmd), PHYSADDR(s,CSR_CXDA(s))); 67.466 + if (start_addr) { 67.467 + TMDSTORE(&start_tmd, start_addr); 67.468 + } 67.469 + start_addr = 0; 67.470 + xmit_pos = 0; 67.471 + count--; 67.472 + 67.473 + } else { 67.474 + TMDSTORE(&(s->tmd), PHYSADDR(s,CSR_CXDA(s))); 67.475 + } 67.476 + if (!CSR_TOKINTD(s) || (CSR_LTINTEN(s) && s->tmd.tmd1.ltint)) 67.477 + s->csr[0] |= 0x0200; /* set TINT */ 67.478 + 67.479 + if (count <= 0) 67.480 + break; 67.481 + 67.482 + } 67.483 + if (start_addr) { 67.484 + start_tmd.tmd2.buff = start_tmd.tmd2.uflo = start_tmd.tmd1.err = 1; 67.485 + TMDSTORE(&start_tmd, PHYSADDR(s,start_addr)); 67.486 s->csr[0] |= 0x0200; /* set TINT */ 67.487 if (!CSR_DXSUFLO(s)) { 67.488 s->csr[0] &= ~0x0010; 67.489 - } else 67.490 - if (count--) 67.491 - goto txagain; 67.492 + } 67.493 } 67.494 } 67.495
68.1 --- a/tools/ioemu/hw/pcnet.h Mon Mar 27 15:36:47 2006 -0700 68.2 +++ b/tools/ioemu/hw/pcnet.h Tue Mar 28 08:54:58 2006 -0700 68.3 @@ -177,6 +177,26 @@ struct pcnet_RMD { 68.4 } rmd3; 68.5 }; 68.6 68.7 +typedef struct PCNetState_st PCNetState; 68.8 + 68.9 +struct PCNetState_st { 68.10 + PCIDevice dev; 68.11 + NetDriverState *nd; 68.12 + int mmio_io_addr, rap, isr, lnkst; 68.13 + target_phys_addr_t rdra, tdra; 68.14 + uint8_t prom[16]; 68.15 + uint16_t csr[128]; 68.16 + uint16_t bcr[32]; 68.17 + uint64_t timer; 68.18 + int recv_pos; 68.19 + uint8_t tx_buffer[2048]; 68.20 + uint8_t rx_buffer[2048]; 68.21 + struct pcnet_TMD tmd; 68.22 + struct pcnet_RMD crmd; 68.23 + struct pcnet_RMD nrmd; 68.24 + struct pcnet_RMD nnrmd; 68.25 +}; 68.26 + 68.27 68.28 #define PRINT_TMD(T) printf( \ 68.29 "TMD0 : TBADR=0x%08x\n" \ 68.30 @@ -230,18 +250,17 @@ static inline void pcnet_tmd_load(PCNetS 68.31 cpu_physical_memory_read(addr+4, (void *)&tmd->tmd1, 4); 68.32 cpu_physical_memory_read(addr, (void *)&tmd->tmd0, 4); 68.33 } else { 68.34 - uint32_t xda[4]; 68.35 - cpu_physical_memory_read(addr, 68.36 - (void *)&xda[0], sizeof(xda)); 68.37 - ((uint32_t *)tmd)[0] = xda[2]; 68.38 - ((uint32_t *)tmd)[1] = xda[1]; 68.39 - ((uint32_t *)tmd)[2] = xda[0]; 68.40 - ((uint32_t *)tmd)[3] = xda[3]; 68.41 + uint32_t xda[2]; 68.42 + cpu_physical_memory_read(addr+4, (void *)&xda[0], sizeof(xda)); 68.43 + ((uint32_t *)tmd)[0] = xda[1]; 68.44 + ((uint32_t *)tmd)[1] = xda[0]; 68.45 + ((uint32_t *)tmd)[2] = 0; 68.46 } 68.47 } 68.48 68.49 static inline void pcnet_tmd_store(PCNetState *s, struct pcnet_TMD *tmd, target_phys_addr_t addr) 68.50 { 68.51 + tmd->tmd1.own = 0; 68.52 cpu_physical_memory_set_dirty(addr); 68.53 if (!BCR_SWSTYLE(s)) { 68.54 uint16_t xda[4]; 68.55 @@ -259,13 +278,10 @@ static inline void pcnet_tmd_store(PCNet 68.56 cpu_physical_memory_write(addr+8, (void *)&tmd->tmd2, 4); 68.57 cpu_physical_memory_write(addr+4, (void *)&tmd->tmd1, 4); 68.58 } else { 68.59 - uint32_t xda[4]; 68.60 + uint32_t xda[2]; 68.61 xda[0] = ((uint32_t *)tmd)[2]; 68.62 xda[1] = ((uint32_t *)tmd)[1]; 68.63 - xda[2] = ((uint32_t *)tmd)[0]; 68.64 - xda[3] = ((uint32_t *)tmd)[3]; 68.65 - cpu_physical_memory_write(addr, 68.66 - (void *)&xda[0], sizeof(xda)); 68.67 + cpu_physical_memory_write(addr, (void *)&xda[0], sizeof(xda)); 68.68 } 68.69 cpu_physical_memory_set_dirty(addr+15); 68.70 } 68.71 @@ -286,22 +302,21 @@ static inline void pcnet_rmd_load(PCNetS 68.72 } 68.73 else 68.74 if (BCR_SWSTYLE(s) != 3) { 68.75 - rmd->rmd2.zeros = 0; 68.76 + ((uint32_t *)rmd)[2] = 0; 68.77 cpu_physical_memory_read(addr+4, (void *)&rmd->rmd1, 4); 68.78 cpu_physical_memory_read(addr, (void *)&rmd->rmd0, 4); 68.79 } else { 68.80 - uint32_t rda[4]; 68.81 - cpu_physical_memory_read(addr, 68.82 - (void *)&rda[0], sizeof(rda)); 68.83 - ((uint32_t *)rmd)[0] = rda[2]; 68.84 - ((uint32_t *)rmd)[1] = rda[1]; 68.85 - ((uint32_t *)rmd)[2] = rda[0]; 68.86 - ((uint32_t *)rmd)[3] = rda[3]; 68.87 + uint32_t rda[2]; 68.88 + cpu_physical_memory_read(addr+4, (void *)&rda[0], sizeof(rda)); 68.89 + ((uint32_t *)rmd)[0] = rda[1]; 68.90 + ((uint32_t *)rmd)[1] = rda[0]; 68.91 + ((uint32_t *)rmd)[2] = 0; 68.92 } 68.93 } 68.94 68.95 static inline void pcnet_rmd_store(PCNetState *s, struct pcnet_RMD *rmd, target_phys_addr_t addr) 68.96 { 68.97 + rmd->rmd1.own = 0; 68.98 cpu_physical_memory_set_dirty(addr); 68.99 if (!BCR_SWSTYLE(s)) { 68.100 uint16_t rda[4]; \ 68.101 @@ -319,13 +334,10 @@ static inline void pcnet_rmd_store(PCNet 68.102 cpu_physical_memory_write(addr+8, (void *)&rmd->rmd2, 4); 68.103 cpu_physical_memory_write(addr+4, (void *)&rmd->rmd1, 4); 68.104 } else { 68.105 - uint32_t rda[4]; 68.106 + uint32_t rda[2]; 68.107 rda[0] = ((uint32_t *)rmd)[2]; 68.108 rda[1] = ((uint32_t *)rmd)[1]; 68.109 - rda[2] = ((uint32_t *)rmd)[0]; 68.110 - rda[3] = ((uint32_t *)rmd)[3]; 68.111 - cpu_physical_memory_write(addr, 68.112 - (void *)&rda[0], sizeof(rda)); 68.113 + cpu_physical_memory_write(addr, (void *)&rda[0], sizeof(rda)); 68.114 } 68.115 cpu_physical_memory_set_dirty(addr+15); 68.116 } 68.117 @@ -340,79 +352,16 @@ static inline void pcnet_rmd_store(PCNet 68.118 68.119 #define RMDSTORE(RMD,ADDR) pcnet_rmd_store(s,RMD,ADDR) 68.120 68.121 -#if 1 68.122 - 68.123 -#define CHECK_RMD(ADDR,RES) do { \ 68.124 - struct pcnet_RMD rmd; \ 68.125 - RMDLOAD(&rmd,(ADDR)); \ 68.126 - (RES) |= (rmd.rmd1.ones != 15); \ 68.127 -} while (0) 68.128 - 68.129 -#define CHECK_TMD(ADDR,RES) do { \ 68.130 - struct pcnet_TMD tmd; \ 68.131 - TMDLOAD(&tmd,(ADDR)); \ 68.132 - (RES) |= (tmd.tmd1.ones != 15); \ 68.133 +#define CHECK_RMD(RMD,ADDR,RES) do { \ 68.134 + RMDLOAD((RMD),(ADDR)); \ 68.135 + (RES) |= ((RMD)->rmd1.ones != 15); \ 68.136 } while (0) 68.137 68.138 -#else 68.139 - 68.140 -#define CHECK_RMD(ADDR,RES) do { \ 68.141 - switch (BCR_SWSTYLE(s)) { \ 68.142 - case 0x00: \ 68.143 - do { \ 68.144 - uint16_t rda[4]; \ 68.145 - cpu_physical_memory_read((ADDR), \ 68.146 - (void *)&rda[0], sizeof(rda)); \ 68.147 - (RES) |= (rda[2] & 0xf000)!=0xf000; \ 68.148 - (RES) |= (rda[3] & 0xf000)!=0x0000; \ 68.149 - } while (0); \ 68.150 - break; \ 68.151 - case 0x01: \ 68.152 - case 0x02: \ 68.153 - do { \ 68.154 - uint32_t rda[4]; \ 68.155 - cpu_physical_memory_read((ADDR), \ 68.156 - (void *)&rda[0], sizeof(rda)); \ 68.157 - (RES) |= (rda[1] & 0x0000f000L)!=0x0000f000L; \ 68.158 - (RES) |= (rda[2] & 0x0000f000L)!=0x00000000L; \ 68.159 - } while (0); \ 68.160 - break; \ 68.161 - case 0x03: \ 68.162 - do { \ 68.163 - uint32_t rda[4]; \ 68.164 - cpu_physical_memory_read((ADDR), \ 68.165 - (void *)&rda[0], sizeof(rda)); \ 68.166 - (RES) |= (rda[0] & 0x0000f000L)!=0x00000000L; \ 68.167 - (RES) |= (rda[1] & 0x0000f000L)!=0x0000f000L; \ 68.168 - } while (0); \ 68.169 - break; \ 68.170 - } \ 68.171 +#define CHECK_TMD(ADDR,RES) do { \ 68.172 + TMDLOAD(&(s->tmd),(ADDR)); \ 68.173 + (RES) |= (s->tmd.tmd1.ones != 15); \ 68.174 } while (0) 68.175 68.176 -#define CHECK_TMD(ADDR,RES) do { \ 68.177 - switch (BCR_SWSTYLE(s)) { \ 68.178 - case 0x00: \ 68.179 - do { \ 68.180 - uint16_t xda[4]; \ 68.181 - cpu_physical_memory_read((ADDR), \ 68.182 - (void *)&xda[0], sizeof(xda)); \ 68.183 - (RES) |= (xda[2] & 0xf000)!=0xf000;\ 68.184 - } while (0); \ 68.185 - break; \ 68.186 - case 0x01: \ 68.187 - case 0x02: \ 68.188 - case 0x03: \ 68.189 - do { \ 68.190 - uint32_t xda[4]; \ 68.191 - cpu_physical_memory_read((ADDR), \ 68.192 - (void *)&xda[0], sizeof(xda)); \ 68.193 - (RES) |= (xda[1] & 0x0000f000L)!=0x0000f000L; \ 68.194 - } while (0); \ 68.195 - break; \ 68.196 - } \ 68.197 -} while (0) 68.198 - 68.199 -#endif 68.200 68.201 #define PRINT_PKTHDR(BUF) do { \ 68.202 struct ether_header *hdr = (void *)(BUF); \
69.1 --- a/tools/libxc/Makefile Mon Mar 27 15:36:47 2006 -0700 69.2 +++ b/tools/libxc/Makefile Tue Mar 28 08:54:58 2006 -0700 69.3 @@ -21,16 +21,12 @@ SRCS += xc_private.c 69.4 SRCS += xc_sedf.c 69.5 SRCS += xc_tbuf.c 69.6 69.7 -ifeq ($(XEN_TARGET_ARCH),x86_32) 69.8 +ifeq ($(patsubst x86%,x86,$(XEN_TARGET_ARCH)),x86) 69.9 SRCS += xc_ptrace.c 69.10 SRCS += xc_ptrace_core.c 69.11 SRCS += xc_pagetab.c 69.12 endif 69.13 69.14 -ifeq ($(XEN_TARGET_ARCH),x86_64) 69.15 -SRCS += xc_pagetab.c 69.16 -endif 69.17 - 69.18 BUILD_SRCS := 69.19 BUILD_SRCS += xc_linux_build.c 69.20 BUILD_SRCS += xc_load_bin.c
70.1 --- a/tools/libxc/xc_core.c Mon Mar 27 15:36:47 2006 -0700 70.2 +++ b/tools/libxc/xc_core.c Tue Mar 28 08:54:58 2006 -0700 70.3 @@ -3,7 +3,6 @@ 70.4 #include "xc_elf.h" 70.5 #include <stdlib.h> 70.6 #include <unistd.h> 70.7 -#include <zlib.h> 70.8 70.9 /* number of pages to write at a time */ 70.10 #define DUMP_INCREMENT (4 * 1024)
71.1 --- a/tools/libxc/xc_private.c Mon Mar 27 15:36:47 2006 -0700 71.2 +++ b/tools/libxc/xc_private.c Tue Mar 28 08:54:58 2006 -0700 71.3 @@ -4,7 +4,6 @@ 71.4 * Helper functions for the rest of the library. 71.5 */ 71.6 71.7 -#include <zlib.h> 71.8 #include "xc_private.h" 71.9 #include <xen/memory.h> 71.10
72.1 --- a/tools/libxc/xc_ptrace.c Mon Mar 27 15:36:47 2006 -0700 72.2 +++ b/tools/libxc/xc_ptrace.c Tue Mar 28 08:54:58 2006 -0700 72.3 @@ -38,9 +38,6 @@ static char *ptrace_names[] = { 72.4 }; 72.5 #endif 72.6 72.7 -/* XXX application state */ 72.8 -static long nr_pages = 0; 72.9 -static unsigned long *page_array = NULL; 72.10 static int current_domid = -1; 72.11 static int current_isfile; 72.12 72.13 @@ -196,6 +193,60 @@ map_domain_va_pae( 72.14 return (void *)((unsigned long)v | (va & (PAGE_SIZE - 1))); 72.15 } 72.16 72.17 +#ifdef __x86_64__ 72.18 +static void * 72.19 +map_domain_va( 72.20 + int xc_handle, 72.21 + int cpu, 72.22 + void *guest_va, 72.23 + int perm) 72.24 +{ 72.25 + unsigned long l3p, l2p, l1p, p, va = (unsigned long)guest_va; 72.26 + uint64_t *l4, *l3, *l2, *l1; 72.27 + static void *v; 72.28 + 72.29 + if ((ctxt[cpu].ctrlreg[4] & 0x20) == 0 ) /* legacy ia32 mode */ 72.30 + return map_domain_va_pae(xc_handle, cpu, guest_va, perm); 72.31 + 72.32 + if (fetch_regs(xc_handle, cpu, NULL)) 72.33 + return NULL; 72.34 + 72.35 + l4 = xc_map_foreign_range( 72.36 + xc_handle, current_domid, PAGE_SIZE, PROT_READ, ctxt[cpu].ctrlreg[3] >> PAGE_SHIFT); 72.37 + if ( l4 == NULL ) 72.38 + return NULL; 72.39 + 72.40 + l3p = l4[l4_table_offset(va)] >> PAGE_SHIFT; 72.41 + l3 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, l3p); 72.42 + if ( l3 == NULL ) 72.43 + return NULL; 72.44 + 72.45 + l2p = l3[l3_table_offset(va)] >> PAGE_SHIFT; 72.46 + l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, l2p); 72.47 + if ( l2 == NULL ) 72.48 + return NULL; 72.49 + 72.50 + l1p = l2[l2_table_offset(va)] >> PAGE_SHIFT; 72.51 + l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, l1p); 72.52 + if ( l1 == NULL ) 72.53 + return NULL; 72.54 + 72.55 + p = l1[l1_table_offset(va)] >> PAGE_SHIFT; 72.56 + if ( v != NULL ) 72.57 + munmap(v, PAGE_SIZE); 72.58 + v = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, p); 72.59 + if ( v == NULL ) 72.60 + return NULL; 72.61 + 72.62 + return (void *)((unsigned long)v | (va & (PAGE_SIZE - 1))); 72.63 +} 72.64 +#endif 72.65 + 72.66 +#ifdef __i386__ 72.67 +/* XXX application state */ 72.68 +static long nr_pages = 0; 72.69 +static unsigned long *page_array = NULL; 72.70 + 72.71 static void * 72.72 map_domain_va( 72.73 int xc_handle, 72.74 @@ -216,15 +267,18 @@ map_domain_va( 72.75 static unsigned long page_phys[MAX_VIRT_CPUS]; 72.76 static unsigned long *page_virt[MAX_VIRT_CPUS]; 72.77 static int prev_perm[MAX_VIRT_CPUS]; 72.78 - static enum { MODE_UNKNOWN, MODE_32, MODE_PAE } mode; 72.79 + static enum { MODE_UNKNOWN, MODE_32, MODE_PAE, MODE_64 } mode; 72.80 72.81 if ( mode == MODE_UNKNOWN ) 72.82 { 72.83 xen_capabilities_info_t caps; 72.84 (void)xc_version(xc_handle, XENVER_capabilities, caps); 72.85 - mode = MODE_32; 72.86 - if ( strstr(caps, "_x86_32p") ) 72.87 + if ( strstr(caps, "-x86_64") ) 72.88 + mode = MODE_64; 72.89 + else if ( strstr(caps, "-x86_32p") ) 72.90 mode = MODE_PAE; 72.91 + else if ( strstr(caps, "-x86_32") ) 72.92 + mode = MODE_32; 72.93 } 72.94 72.95 if ( mode == MODE_PAE ) 72.96 @@ -304,6 +358,8 @@ map_domain_va( 72.97 return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK)); 72.98 } 72.99 72.100 +#endif 72.101 + 72.102 static int 72.103 __xc_waitdomain( 72.104 int xc_handle,
73.1 --- a/tools/libxc/xc_ptrace.h Mon Mar 27 15:36:47 2006 -0700 73.2 +++ b/tools/libxc/xc_ptrace.h Tue Mar 28 08:54:58 2006 -0700 73.3 @@ -10,6 +10,96 @@ 73.4 #define PDRSHIFT 22 73.5 #define PSL_T 0x00000100 /* trace enable bit */ 73.6 73.7 +#ifdef __x86_64__ 73.8 +struct gdb_regs 73.9 +{ 73.10 + unsigned long r15; 73.11 + unsigned long r14; 73.12 + unsigned long r13; 73.13 + unsigned long r12; 73.14 + unsigned long rbp; 73.15 + unsigned long rbx; 73.16 + unsigned long r11; 73.17 + unsigned long r10; 73.18 + unsigned long r9; 73.19 + unsigned long r8; 73.20 + unsigned long rax; 73.21 + unsigned long rcx; 73.22 + unsigned long rdx; 73.23 + unsigned long rsi; 73.24 + unsigned long rdi; 73.25 + unsigned long orig_rax; 73.26 + unsigned long rip; 73.27 + unsigned long xcs; 73.28 + unsigned long eflags; 73.29 + unsigned long rsp; 73.30 + unsigned long xss; 73.31 + unsigned long fs_base; 73.32 + unsigned long gs_base; 73.33 + unsigned long xds; 73.34 + unsigned long xes; 73.35 + unsigned long xfs; 73.36 + unsigned long xgs; 73.37 +}; 73.38 + 73.39 +#define SET_PT_REGS(pt, xc) \ 73.40 +{ \ 73.41 + pt.r8 = xc.r8; \ 73.42 + pt.r9 = xc.r9; \ 73.43 + pt.r10 = xc.r10; \ 73.44 + pt.r11 = xc.r11; \ 73.45 + pt.r12 = xc.r12; \ 73.46 + pt.r13 = xc.r13; \ 73.47 + pt.r14 = xc.r14; \ 73.48 + pt.r15 = xc.r15; \ 73.49 + pt.rbx = xc.rbx; \ 73.50 + pt.rcx = xc.rcx; \ 73.51 + pt.rdx = xc.rdx; \ 73.52 + pt.rsi = xc.rsi; \ 73.53 + pt.rdi = xc.rdi; \ 73.54 + pt.rbp = xc.rbp; \ 73.55 + pt.rax = xc.rax; \ 73.56 + pt.rip = xc.rip; \ 73.57 + pt.xcs = xc.cs; \ 73.58 + pt.eflags = xc.eflags; \ 73.59 + pt.rsp = xc.rsp; \ 73.60 + pt.xss = xc.ss; \ 73.61 + pt.xes = xc.es; \ 73.62 + pt.xds = xc.ds; \ 73.63 + pt.xfs = xc.fs; \ 73.64 + pt.xgs = xc.gs; \ 73.65 +} 73.66 + 73.67 +#define SET_XC_REGS(pt, xc) \ 73.68 +{ \ 73.69 + xc.r8 = pt->r8; \ 73.70 + xc.r9 = pt->r9; \ 73.71 + xc.r10 = pt->r10; \ 73.72 + xc.r11 = pt->r11; \ 73.73 + xc.r12 = pt->r12; \ 73.74 + xc.r13 = pt->r13; \ 73.75 + xc.r14 = pt->r14; \ 73.76 + xc.r15 = pt->r15; \ 73.77 + xc.rbx = pt->rbx; \ 73.78 + xc.rcx = pt->rcx; \ 73.79 + xc.rdx = pt->rdx; \ 73.80 + xc.rsi = pt->rsi; \ 73.81 + xc.rdi = pt->rdi; \ 73.82 + xc.rbp = pt->rbp; \ 73.83 + xc.rax = pt->rax; \ 73.84 + xc.rip = pt->rip; \ 73.85 + xc.cs = pt->xcs; \ 73.86 + xc.eflags = pt->eflags; \ 73.87 + xc.rsp = pt->rsp; \ 73.88 + xc.ss = pt->xss; \ 73.89 + xc.es = pt->xes; \ 73.90 + xc.ds = pt->xds; \ 73.91 + xc.fs = pt->xfs; \ 73.92 + xc.gs = pt->xgs; \ 73.93 +} 73.94 + 73.95 +#elif __i386__ 73.96 + 73.97 struct gdb_regs { 73.98 long ebx; /* 0 */ 73.99 long ecx; /* 4 */ 73.100 @@ -30,8 +120,6 @@ struct gdb_regs { 73.101 int xss; /* 64 */ 73.102 }; 73.103 73.104 - 73.105 -#define printval(x) printf("%s = %lx\n", #x, (long)x); 73.106 #define SET_PT_REGS(pt, xc) \ 73.107 { \ 73.108 pt.ebx = xc.ebx; \ 73.109 @@ -71,7 +159,9 @@ struct gdb_regs { 73.110 xc.fs = pt->xfs; \ 73.111 xc.gs = pt->xgs; \ 73.112 } 73.113 +#endif 73.114 73.115 +#define printval(x) printf("%s = %lx\n", #x, (long)x); 73.116 #define vtopdi(va) ((va) >> PDRSHIFT) 73.117 #define vtopti(va) (((va) >> PAGE_SHIFT) & 0x3ff) 73.118 #endif
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/tools/python/xen/util/xmlrpclib2.py Tue Mar 28 08:54:58 2006 -0700 74.3 @@ -0,0 +1,111 @@ 74.4 +#============================================================================ 74.5 +# This library is free software; you can redistribute it and/or 74.6 +# modify it under the terms of version 2.1 of the GNU Lesser General Public 74.7 +# License as published by the Free Software Foundation. 74.8 +# 74.9 +# This library is distributed in the hope that it will be useful, 74.10 +# but WITHOUT ANY WARRANTY; without even the implied warranty of 74.11 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 74.12 +# Lesser General Public License for more details. 74.13 +# 74.14 +# You should have received a copy of the GNU Lesser General Public 74.15 +# License along with this library; if not, write to the Free Software 74.16 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 74.17 +#============================================================================ 74.18 +# Copyright (C) 2006 Anthony Liguori <aliguori@us.ibm.com> 74.19 +# Copyright (C) 2006 XenSource Ltd. 74.20 +#============================================================================ 74.21 + 74.22 +""" 74.23 +An enhanced XML-RPC client/server interface for Python. 74.24 +""" 74.25 + 74.26 +from httplib import HTTPConnection, HTTP 74.27 +from xmlrpclib import Transport 74.28 +from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler 74.29 +import xmlrpclib, socket, os, traceback 74.30 +import SocketServer 74.31 + 74.32 +# A new ServerProxy that also supports httpu urls. An http URL comes in the 74.33 +# form: 74.34 +# 74.35 +# httpu:///absolute/path/to/socket.sock 74.36 +# 74.37 +# It assumes that the RPC handler is /RPC2. This probably needs to be improved 74.38 + 74.39 +class HTTPUnixConnection(HTTPConnection): 74.40 + def connect(self): 74.41 + self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) 74.42 + self.sock.connect(self.host) 74.43 + 74.44 +class HTTPUnix(HTTP): 74.45 + _connection_class = HTTPUnixConnection 74.46 + 74.47 +class UnixTransport(Transport): 74.48 + def request(self, host, handler, request_body, verbose=0): 74.49 + self.__handler = handler 74.50 + return Transport.request(self, host, '/RPC2', request_body, verbose) 74.51 + def make_connection(self, host): 74.52 + return HTTPUnix(self.__handler) 74.53 + 74.54 +class ServerProxy(xmlrpclib.ServerProxy): 74.55 + def __init__(self, uri, transport=None, encoding=None, verbose=0, 74.56 + allow_none=1): 74.57 + if transport == None: 74.58 + (protocol, rest) = uri.split(':', 1) 74.59 + if protocol == 'httpu': 74.60 + uri = 'http:' + rest 74.61 + transport = UnixTransport() 74.62 + xmlrpclib.ServerProxy.__init__(self, uri, transport, encoding, 74.63 + verbose, allow_none) 74.64 + 74.65 +# This is a base XML-RPC server for TCP. It sets allow_reuse_address to 74.66 +# true, and has an improved marshaller that serializes unknown exceptions 74.67 +# with full traceback information. 74.68 + 74.69 +class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer): 74.70 + allow_reuse_address = True 74.71 + 74.72 + def _marshaled_dispatch(self, data, dispatch_method = None): 74.73 + params, method = xmlrpclib.loads(data) 74.74 + try: 74.75 + if dispatch_method is not None: 74.76 + response = dispatch_method(method, params) 74.77 + else: 74.78 + response = self._dispatch(method, params) 74.79 + 74.80 + response = (response,) 74.81 + response = xmlrpclib.dumps(response, 74.82 + methodresponse=1, 74.83 + allow_none=1) 74.84 + except xmlrpclib.Fault, fault: 74.85 + response = xmlrpclib.dumps(fault) 74.86 + except: 74.87 + response = xmlrpclib.dumps( 74.88 + xmlrpclib.Fault(1, traceback.format_exc()) 74.89 + ) 74.90 + 74.91 + return response 74.92 + 74.93 +# This is a XML-RPC server that sits on a Unix domain socket. 74.94 +# It implements proper support for allow_reuse_address by 74.95 +# unlink()'ing an existing socket. 74.96 + 74.97 +class UnixXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): 74.98 + def address_string(self): 74.99 + try: 74.100 + return SimpleXMLRPCRequestHandler.address_string(self) 74.101 + except ValueError, e: 74.102 + return self.client_address[:2] 74.103 + 74.104 +class UnixXMLRPCServer(TCPXMLRPCServer): 74.105 + address_family = socket.AF_UNIX 74.106 + 74.107 + def __init__(self, addr, logRequests): 74.108 + if self.allow_reuse_address: 74.109 + try: 74.110 + os.unlink(addr) 74.111 + except OSError, exc: 74.112 + pass 74.113 + TCPXMLRPCServer.__init__(self, addr, UnixXMLRPCRequestHandler, 74.114 + logRequests)
75.1 --- a/tools/python/xen/xend/XendClient.py Mon Mar 27 15:36:47 2006 -0700 75.2 +++ b/tools/python/xen/xend/XendClient.py Tue Mar 28 08:54:58 2006 -0700 75.3 @@ -14,403 +14,15 @@ 75.4 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 75.5 #============================================================================ 75.6 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com> 75.7 +# Copyright (C) 2006 Anthony Liguori <aliguori@us.ibm.com> 75.8 #============================================================================ 75.9 75.10 -"""Client API for the HTTP interface on xend. 75.11 -Callable as a script - see main(). 75.12 -Supports inet or unix connection to xend. 75.13 - 75.14 -This API is the 'control-plane' for xend. 75.15 -The 'data-plane' is done separately. 75.16 -""" 75.17 -import os 75.18 -import sys 75.19 -import types 75.20 - 75.21 -import sxp 75.22 -import PrettyPrint 75.23 -from XendProtocol import HttpXendClientProtocol, \ 75.24 - UnixXendClientProtocol, \ 75.25 - XendError 75.26 - 75.27 -def fileof(val): 75.28 - """Converter for passing configs or other 'large' data. 75.29 - Handles lists, files directly. 75.30 - Assumes a string is a file name and passes its contents. 75.31 - """ 75.32 - if isinstance(val, types.ListType): 75.33 - return sxp.to_string(val) 75.34 - if isinstance(val, types.StringType): 75.35 - return file(val) 75.36 - if hasattr(val, 'readlines'): 75.37 - return val 75.38 - raise XendError('cannot convert value') 75.39 - 75.40 -class URL: 75.41 - """A URL. 75.42 - """ 75.43 - 75.44 - def __init__(self, proto='http', host='localhost', port=None, path='', query=None, frag=None): 75.45 - self.proto = proto 75.46 - self.host = host 75.47 - if port: port = int(port) 75.48 - self.port = port 75.49 - self.path = path 75.50 - self.query = query 75.51 - self.frag = frag 75.52 - 75.53 - def url(self): 75.54 - """Get the full URL string including protocol, location and the full path. 75.55 - """ 75.56 - return self.proto + '://' + self.location() + self.fullpath() 75.57 - 75.58 - def location(self): 75.59 - """Get the location part of the URL, including host and port, if present. 75.60 - """ 75.61 - if self.port: 75.62 - return self.host + ':' + str(self.port) 75.63 - else: 75.64 - return self.host 75.65 - 75.66 - def fullpath(self): 75.67 - """Get the full path part of the URL, including query and fragment if present. 75.68 - """ 75.69 - u = [ self.path ] 75.70 - if self.query: 75.71 - u.append('?') 75.72 - u.append(self.query) 75.73 - if self.frag: 75.74 - u.append('#') 75.75 - u.append(self.frag) 75.76 - return ''.join(u) 75.77 - 75.78 - def relative(self, path='', query=None, frag=None): 75.79 - """Create a URL relative to this one. 75.80 - """ 75.81 - return URL(proto=self.proto, 75.82 - host=self.host, 75.83 - port=self.port, 75.84 - path=self.path + path, 75.85 - query=query, 75.86 - frag=frag) 75.87 - 75.88 -class Xend: 75.89 - """Client interface to Xend. 75.90 - """ 75.91 - 75.92 - """Default location of the xend server.""" 75.93 - SRV_DEFAULT = "localhost:8000" 75.94 - 75.95 - """Environment variable to set the location of xend.""" 75.96 - SRV_VAR = "XEND" 75.97 - 75.98 - """Default path to the xend root on the server.""" 75.99 - ROOT_DEFAULT = "/xend/" 75.100 - 75.101 - """Environment variable to set the xend root path.""" 75.102 - ROOT_VAR = "XEND_ROOT" 75.103 +from xen.util.xmlrpclib2 import ServerProxy 75.104 75.105 - def __init__(self, client=None, srv=None, root=None): 75.106 - """Create a xend client interface. 75.107 - If the client protocol is not specified, the default 75.108 - is to use a synchronous protocol. 75.109 - 75.110 - @param client: client protocol to use 75.111 - @param srv: server host, and optional port (format host:port) 75.112 - @param root: xend root path on the server 75.113 - """ 75.114 - if client is None: 75.115 - client = HttpXendClientProtocol() 75.116 - self.client = client 75.117 - self.bind(srv, root) 75.118 - 75.119 - def default_server(self): 75.120 - """Get the default location of the xend server. 75.121 - """ 75.122 - return os.getenv(self.SRV_VAR, self.SRV_DEFAULT) 75.123 - 75.124 - def default_root(self): 75.125 - """Get the default root path on the xend server. 75.126 - """ 75.127 - return os.getenv(self.ROOT_VAR, self.ROOT_DEFAULT) 75.128 - 75.129 - def bind(self, srv=None, root=None): 75.130 - """Bind to a given server. 75.131 - 75.132 - @param srv: server location (host:port) 75.133 - @param root: xend root path on the server 75.134 - """ 75.135 - if srv is None: srv = self.default_server() 75.136 - if root is None: root = self.default_root() 75.137 - if not root.endswith('/'): root += '/' 75.138 - (host, port) = srv.split(':', 1) 75.139 - self.url = URL(host=host, port=port, path=root) 75.140 - 75.141 - def xendGet(self, url, args=None): 75.142 - return self.client.xendGet(url, args) 75.143 - 75.144 - def xendPost(self, url, data): 75.145 - return self.client.xendPost(url, data) 75.146 - 75.147 - def nodeurl(self, id=''): 75.148 - return self.url.relative('node/' + str(id)) 75.149 - 75.150 - def domainurl(self, id=''): 75.151 - return self.url.relative('domain/' + str(id)) 75.152 - 75.153 - def deviceurl(self, id=''): 75.154 - return self.url.relative('device/' + str(id)) 75.155 - 75.156 - def vneturl(self, id=''): 75.157 - return self.url.relative('vnet/' + str(id)) 75.158 - 75.159 - def xend(self): 75.160 - return self.xendGet(self.url) 75.161 - 75.162 - def xend_node(self): 75.163 - return self.xendGet(self.nodeurl()) 75.164 - 75.165 - def xend_node_shutdown(self): 75.166 - return self.xendPost(self.nodeurl(), 75.167 - {'op' : 'shutdown'}) 75.168 - 75.169 - def xend_node_restart(self): 75.170 - return self.xendPost(self.nodeurl(), 75.171 - {'op' : 'reboot'}) 75.172 - 75.173 - def xend_node_get_dmesg(self): 75.174 - return self.xendGet(self.nodeurl('dmesg')) 75.175 - 75.176 - def xend_node_clear_dmesg(self): 75.177 - return self.xendPost(self.nodeurl('dmesg'), 75.178 - {'op' : 'clear' } ) 75.179 - 75.180 - def xend_node_log(self): 75.181 - return self.xendGet(self.nodeurl('log')) 75.182 - 75.183 - def xend_node_cpu_bvt_slice_set(self, ctx_allow): 75.184 - return self.xendPost(self.nodeurl(), 75.185 - {'op' : 'cpu_bvt_slice_set', 75.186 - 'ctx_allow' : ctx_allow }) 75.187 - 75.188 - def xend_domains(self): 75.189 - return self.xendGet(self.domainurl()) 75.190 - 75.191 - def xend_list_domains(self, detail = True): 75.192 - return self.xendGet(self.domainurl(), 75.193 - {'detail': detail and '1' or '0'}) 75.194 - 75.195 - def xend_domain_vcpuinfo(self, dom): 75.196 - return self.xendGet(self.domainurl(dom), {'op': 'vcpuinfo'}) 75.197 - 75.198 - def xend_domain_create(self, conf): 75.199 - return self.xendPost(self.domainurl(), 75.200 - {'op' : 'create', 75.201 - 'config' : fileof(conf) }) 75.202 - 75.203 - def xend_domain_restore(self, filename): 75.204 - return self.xendPost(self.domainurl(), 75.205 - {'op' : 'restore', 75.206 - 'file' : filename }) 75.207 +XML_RPC_SOCKET = "/var/run/xend-xmlrpc.sock" 75.208 75.209 - def xend_domain_configure(self, id, conf): 75.210 - return self.xendPost(self.domainurl(id), 75.211 - {'op' : 'configure', 75.212 - 'config' : fileof(conf) }) 75.213 - 75.214 - def xend_domain(self, id): 75.215 - return self.xendGet(self.domainurl(id)) 75.216 - 75.217 - def xend_domain_wait_for_devices(self, id): 75.218 - return self.xendPost(self.domainurl(id), 75.219 - {'op' : 'wait_for_devices' }) 75.220 - 75.221 - def xend_domain_unpause(self, id): 75.222 - return self.xendPost(self.domainurl(id), 75.223 - {'op' : 'unpause' }) 75.224 - 75.225 - def xend_domain_pause(self, id): 75.226 - return self.xendPost(self.domainurl(id), 75.227 - {'op' : 'pause' }) 75.228 - 75.229 - def xend_domain_rename(self, id, name): 75.230 - return self.xendPost(self.domainurl(id), 75.231 - {'op' : 'rename', 75.232 - 'name' : name}) 75.233 - 75.234 - def xend_domain_shutdown(self, id, reason): 75.235 - return self.xendPost(self.domainurl(id), 75.236 - {'op' : 'shutdown', 75.237 - 'reason' : reason}) 75.238 - 75.239 - def xend_domain_sysrq(self, id, key): 75.240 - return self.xendPost(self.domainurl(id), 75.241 - {'op' : 'sysrq', 75.242 - 'key' : key}) 75.243 - 75.244 - def xend_domain_destroy(self, id): 75.245 - return self.xendPost(self.domainurl(id), 75.246 - {'op' : 'destroy' }) 75.247 - 75.248 - def xend_domain_save(self, id, filename): 75.249 - return self.xendPost(self.domainurl(id), 75.250 - {'op' : 'save', 75.251 - 'file' : filename }) 75.252 - 75.253 - def xend_domain_migrate(self, id, dst, live=0, resource=0, port=0): 75.254 - return self.xendPost(self.domainurl(id), 75.255 - {'op' : 'migrate', 75.256 - 'destination': dst, 75.257 - 'live' : live, 75.258 - 'resource' : resource, 75.259 - 'port' : port }) 75.260 - 75.261 - def xend_domain_pincpu(self, id, vcpu, cpumap): 75.262 - return self.xendPost(self.domainurl(id), 75.263 - {'op' : 'pincpu', 75.264 - 'vcpu' : vcpu, 75.265 - 'cpumap' : str(cpumap) }) 75.266 - 75.267 - def xend_domain_cpu_bvt_set(self, id, mcuadv, warpback, warpvalue, warpl, warpu): 75.268 - return self.xendPost(self.domainurl(id), 75.269 - {'op' : 'cpu_bvt_set', 75.270 - 'mcuadv' : mcuadv, 75.271 - 'warpback' : warpback, 75.272 - 'warpvalue': warpvalue, 75.273 - 'warpl' : warpl, 75.274 - 'warpu' : warpu }) 75.275 - 75.276 - def xend_domain_cpu_sedf_get(self, id): 75.277 - return self.xendPost(self.domainurl(id), 75.278 - {'op' : 'cpu_sedf_get'}) 75.279 - 75.280 - def xend_domain_cpu_sedf_set(self, id, period, slice, latency, extratime, weight): 75.281 - return self.xendPost(self.domainurl(id), 75.282 - {'op' : 'cpu_sedf_set', 75.283 - 'period' : period, 75.284 - 'slice' : slice, 75.285 - 'latency' : latency, 75.286 - 'extratime' : extratime, 75.287 - 'weight' : weight }) 75.288 - 75.289 - def xend_domain_maxmem_set(self, id, memory): 75.290 - return self.xendPost(self.domainurl(id), 75.291 - { 'op' : 'maxmem_set', 75.292 - 'memory' : memory }) 75.293 - 75.294 - def xend_domain_mem_target_set(self, id, mem_target): 75.295 - val = self.xendPost(self.domainurl(id), 75.296 - {'op' : 'mem_target_set', 75.297 - 'target' : mem_target }) 75.298 - return val 75.299 - 75.300 - def xend_domain_set_vcpus(self, dom, vcpus): 75.301 - return self.xendPost(self.domainurl(dom), 75.302 - {'op' : 'set_vcpus', 75.303 - 'vcpus' : vcpus }) 75.304 - 75.305 - def xend_domain_devices(self, id, type): 75.306 - return self.xendPost(self.domainurl(id), 75.307 - {'op' : 'devices', 75.308 - 'type' : type }) 75.309 +ERROR_INTERNAL = 1 75.310 +ERROR_GENERIC = 2 75.311 +ERROR_INVALID_DOMAIN = 3 75.312 75.313 - def xend_domain_device_create(self, id, config): 75.314 - return self.xendPost(self.domainurl(id), 75.315 - {'op' : 'device_create', 75.316 - 'config' : fileof(config) }) 75.317 - 75.318 - def xend_domain_device_refresh(self, id, type, dev): 75.319 - return self.xendPost(self.domainurl(id), 75.320 - {'op' : 'device_refresh', 75.321 - 'type' : type, 75.322 - 'dev' : dev }) 75.323 - 75.324 - def xend_domain_device_destroy(self, id, type, dev): 75.325 - return self.xendPost(self.domainurl(id), 75.326 - {'op' : 'device_destroy', 75.327 - 'type' : type, 75.328 - 'dev' : dev }) 75.329 - 75.330 - def xend_domain_device_configure(self, id, config, dev): 75.331 - return self.xendPost(self.domainurl(id), 75.332 - {'op' : 'device_configure', 75.333 - 'dev' : dev, 75.334 - 'config' : fileof(config) }) 75.335 - 75.336 - def xend_vnets(self): 75.337 - return self.xendGet(self.vneturl()) 75.338 - 75.339 - def xend_vnet_create(self, conf): 75.340 - return self.xendPost(self.vneturl(), 75.341 - {'op' : 'create', 75.342 - 'config' : fileof(conf) }) 75.343 - 75.344 - def xend_vnet(self, id): 75.345 - return self.xendGet(self.vneturl(id)) 75.346 - 75.347 - def xend_vnet_delete(self, id): 75.348 - return self.xendPost(self.vneturl(id), 75.349 - {'op' : 'delete' }) 75.350 - 75.351 -def getHttpServer(srv=None): 75.352 - """Create and return a xend client. 75.353 - """ 75.354 - return Xend(srv=srv, client=HttpXendClientProtocol()) 75.355 - 75.356 -def getUnixServer(srv=None): 75.357 - """Create and return a unix-domain xend client. 75.358 - """ 75.359 - return Xend(client=UnixXendClientProtocol(srv)) 75.360 - 75.361 -def xendmain(srv, fn, args, unix=False): 75.362 - if unix: 75.363 - xend = getUnixServer(srv) 75.364 - else: 75.365 - xend = getHttpServer(srv) 75.366 - xend.rc = 0 75.367 - try: 75.368 - v = getattr(xend, fn)(*args) 75.369 - PrettyPrint.prettyprint(v) 75.370 - return 0 75.371 - except XendError, err: 75.372 - print 'ERROR:', err 75.373 - return 1 75.374 - 75.375 -def main(argv): 75.376 - """Call an API function: 75.377 - 75.378 - python XendClient.py fn args... 75.379 - 75.380 - The leading 'xend_' on the function can be omitted. 75.381 - Example: 75.382 - 75.383 -python XendClient.py domains 75.384 - (0 8) 75.385 -python XendClient.py domain 0 75.386 - (domain (id 0) (name Domain-0) (memory 128)) 75.387 - """ 75.388 - from getopt import getopt 75.389 - short_options = 'x:au:d' 75.390 - long_options = ['xend=', 'unix=', 'debug'] 75.391 - (options, args) = getopt(argv[1:], short_options, long_options) 75.392 - srv = None 75.393 - unix = 1 75.394 - for k, v in options: 75.395 - if k in ['-x', '--xend']: 75.396 - srv = v 75.397 - elif k in ['-u', '--unix']: 75.398 - unix = int(v) 75.399 - if len(args): 75.400 - fn = args[0] 75.401 - args = args[1:] 75.402 - else: 75.403 - fn = 'xend' 75.404 - args = [] 75.405 - if not fn.startswith('xend'): 75.406 - fn = 'xend_' + fn 75.407 - sys.exit(xendmain(srv, fn, args, unix=unix)) 75.408 - 75.409 -if __name__ == "__main__": 75.410 - main(sys.argv) 75.411 -else: 75.412 - server = getUnixServer() 75.413 +server = ServerProxy('httpu:///var/run/xend-xmlrpc.sock')
76.1 --- a/tools/python/xen/xend/XendDomain.py Mon Mar 27 15:36:47 2006 -0700 76.2 +++ b/tools/python/xen/xend/XendDomain.py Tue Mar 28 08:54:58 2006 -0700 76.3 @@ -81,7 +81,8 @@ class XendDomain: 76.4 # that we're sure that we haven't missed any releases, but inside 76.5 # the domains_lock, as we don't want the watch to fire until after 76.6 # the refresh call has completed. 76.7 - xswatch("@releaseDomain", self.onReleaseDomain) 76.8 + xswatch("@introduceDomain", self.onChangeDomain) 76.9 + xswatch("@releaseDomain", self.onChangeDomain) 76.10 76.11 self.refresh(True) 76.12 finally: 76.13 @@ -121,7 +122,7 @@ class XendDomain: 76.14 76.15 ## private: 76.16 76.17 - def onReleaseDomain(self, _): 76.18 + def onChangeDomain(self, _): 76.19 self.domains_lock.acquire() 76.20 try: 76.21 self.refresh() 76.22 @@ -355,7 +356,7 @@ class XendDomain: 76.23 def domain_unpause(self, domid): 76.24 """Unpause domain execution.""" 76.25 try: 76.26 - dominfo = self.domain_lookup(domid) 76.27 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.28 log.info("Domain %s (%d) unpaused.", dominfo.getName(), 76.29 dominfo.getDomid()) 76.30 return dominfo.unpause() 76.31 @@ -366,7 +367,7 @@ class XendDomain: 76.32 def domain_pause(self, domid): 76.33 """Pause domain execution.""" 76.34 try: 76.35 - dominfo = self.domain_lookup(domid) 76.36 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.37 log.info("Domain %s (%d) paused.", dominfo.getName(), 76.38 dominfo.getDomid()) 76.39 return dominfo.pause() 76.40 @@ -377,10 +378,10 @@ class XendDomain: 76.41 def domain_destroy(self, domid): 76.42 """Terminate domain immediately.""" 76.43 76.44 - if domid == PRIV_DOMAIN: 76.45 - raise XendError("Cannot destroy privileged domain %i" % domid) 76.46 - 76.47 - dominfo = self.domain_lookup(domid) 76.48 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.49 + if dominfo and dominfo.getDomid() == PRIV_DOMAIN: 76.50 + raise XendError("Cannot destroy privileged domain %s" % domid) 76.51 + 76.52 if dominfo: 76.53 val = dominfo.destroy() 76.54 else: 76.55 @@ -393,7 +394,7 @@ class XendDomain: 76.56 def domain_migrate(self, domid, dst, live=False, resource=0, port=0): 76.57 """Start domain migration.""" 76.58 76.59 - dominfo = self.domain_lookup(domid) 76.60 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.61 76.62 if dominfo.getDomid() == PRIV_DOMAIN: 76.63 raise XendError("Cannot migrate privileged domain %i" % domid) 76.64 @@ -418,7 +419,7 @@ class XendDomain: 76.65 """ 76.66 76.67 try: 76.68 - dominfo = self.domain_lookup(domid) 76.69 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.70 76.71 if dominfo.getDomid() == PRIV_DOMAIN: 76.72 raise XendError("Cannot save privileged domain %i" % domid) 76.73 @@ -438,7 +439,7 @@ class XendDomain: 76.74 76.75 @param cpumap: string repr of list of usable cpus 76.76 """ 76.77 - dominfo = self.domain_lookup(domid) 76.78 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.79 # convert cpumap string into a list of ints 76.80 cpumap = map(lambda x: int(x), 76.81 cpumap.replace("[", "").replace("]", "").split(",")) 76.82 @@ -451,7 +452,7 @@ class XendDomain: 76.83 warpu): 76.84 """Set BVT (Borrowed Virtual Time) scheduler parameters for a domain. 76.85 """ 76.86 - dominfo = self.domain_lookup(domid) 76.87 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.88 try: 76.89 return xc.bvtsched_domain_set(dom=dominfo.getDomid(), 76.90 mcuadv=mcuadv, 76.91 @@ -464,7 +465,7 @@ class XendDomain: 76.92 def domain_cpu_bvt_get(self, domid): 76.93 """Get BVT (Borrowed Virtual Time) scheduler parameters for a domain. 76.94 """ 76.95 - dominfo = self.domain_lookup(domid) 76.96 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.97 try: 76.98 return xc.bvtsched_domain_get(dominfo.getDomid()) 76.99 except Exception, ex: 76.100 @@ -475,7 +476,7 @@ class XendDomain: 76.101 weight): 76.102 """Set Simple EDF scheduler parameters for a domain. 76.103 """ 76.104 - dominfo = self.domain_lookup(domid) 76.105 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.106 try: 76.107 return xc.sedf_domain_set(dominfo.getDomid(), period, slice_, 76.108 latency, extratime, weight) 76.109 @@ -485,7 +486,7 @@ class XendDomain: 76.110 def domain_cpu_sedf_get(self, domid): 76.111 """Get Simple EDF scheduler parameters for a domain. 76.112 """ 76.113 - dominfo = self.domain_lookup(domid) 76.114 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.115 try: 76.116 76.117 sedf_info = xc.sedf_domain_get(dominfo.getDomid()) 76.118 @@ -507,7 +508,7 @@ class XendDomain: 76.119 @param mem: memory limit (in MiB) 76.120 @return: 0 on success, -1 on error 76.121 """ 76.122 - dominfo = self.domain_lookup(domid) 76.123 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.124 maxmem = int(mem) * 1024 76.125 try: 76.126 return xc.domain_setmaxmem(dominfo.getDomid(), maxmem) 76.127 @@ -521,7 +522,7 @@ class XendDomain: 76.128 @param last: last IO port 76.129 @return: 0 on success, -1 on error 76.130 """ 76.131 - dominfo = self.domain_lookup(domid) 76.132 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.133 nr_ports = last - first + 1 76.134 try: 76.135 return xc.domain_ioport_permission(dominfo.getDomid(), 76.136 @@ -538,7 +539,7 @@ class XendDomain: 76.137 @param last: last IO port 76.138 @return: 0 on success, -1 on error 76.139 """ 76.140 - dominfo = self.domain_lookup(domid) 76.141 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 76.142 nr_ports = last - first + 1 76.143 try: 76.144 return xc.domain_ioport_permission(dominfo.getDomid(),
77.1 --- a/tools/python/xen/xend/XendError.py Mon Mar 27 15:36:47 2006 -0700 77.2 +++ b/tools/python/xen/xend/XendError.py Tue Mar 28 08:54:58 2006 -0700 77.3 @@ -15,9 +15,18 @@ 77.4 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com> 77.5 #============================================================================ 77.6 77.7 -class XendError(ValueError): 77.8 +from xmlrpclib import Fault 77.9 + 77.10 +import XendClient 77.11 + 77.12 +class XendInvalidDomain(Fault): 77.13 + def __init__(self, value): 77.14 + Fault.__init__(self, XendClient.ERROR_INVALID_DOMAIN, value) 77.15 + 77.16 +class XendError(Fault): 77.17 77.18 def __init__(self, value): 77.19 + Fault.__init__(self, XendClient.ERROR_GENERIC, value) 77.20 self.value = value 77.21 77.22 def __str__(self):
78.1 --- a/tools/python/xen/xend/XendRoot.py Mon Mar 27 15:36:47 2006 -0700 78.2 +++ b/tools/python/xen/xend/XendRoot.py Tue Mar 28 08:54:58 2006 -0700 78.3 @@ -57,9 +57,14 @@ class XendRoot: 78.4 """Default level of information to be logged.""" 78.5 loglevel_default = 'DEBUG' 78.6 78.7 - """Default for the flag indicating whether xend should run an http server.""" 78.8 + """Default for the flag indicating whether xend should run an http server 78.9 + (deprecated).""" 78.10 xend_http_server_default = 'no' 78.11 78.12 + xend_tcp_xmlrpc_server_default = 'no' 78.13 + 78.14 + xend_unix_xmlrpc_server_default = 'yes' 78.15 + 78.16 """Default interface address xend listens at. """ 78.17 xend_address_default = '' 78.18 78.19 @@ -77,8 +82,9 @@ class XendRoot: 78.20 78.21 xend_relocation_hosts_allow_default = '' 78.22 78.23 - """Default for the flag indicating whether xend should run a unix-domain server.""" 78.24 - xend_unix_server_default = 'yes' 78.25 + """Default for the flag indicating whether xend should run a unix-domain 78.26 + server (deprecated).""" 78.27 + xend_unix_server_default = 'no' 78.28 78.29 """Default path the unix-domain server listens at.""" 78.30 xend_unix_path_default = '/var/lib/xend/xend-socket' 78.31 @@ -180,6 +186,12 @@ class XendRoot: 78.32 """ 78.33 return self.get_config_bool("xend-http-server", self.xend_http_server_default) 78.34 78.35 + def get_xend_tcp_xmlrpc_server(self): 78.36 + return self.get_config_bool("xend-tcp-xmlrpc-server", self.xend_tcp_xmlrpc_server_default) 78.37 + 78.38 + def get_xend_unix_xmlrpc_server(self): 78.39 + return self.get_config_bool("xend-unix-xmlrpc-server", self.xend_unix_xmlrpc_server_default) 78.40 + 78.41 def get_xend_relocation_server(self): 78.42 """Get the flag indicating whether xend should run a relocation server. 78.43 """
79.1 --- a/tools/python/xen/xend/server/SrvServer.py Mon Mar 27 15:36:47 2006 -0700 79.2 +++ b/tools/python/xen/xend/server/SrvServer.py Tue Mar 28 08:54:58 2006 -0700 79.3 @@ -52,6 +52,7 @@ from xen.xend.XendLogging import log 79.4 from xen.web.SrvDir import SrvDir 79.5 79.6 from SrvRoot import SrvRoot 79.7 +from XMLRPCServer import XMLRPCServer 79.8 79.9 79.10 xroot = XendRoot.instance() 79.11 @@ -114,4 +115,10 @@ def create(): 79.12 path = xroot.get_xend_unix_path() 79.13 log.info('unix path=' + path) 79.14 servers.add(UnixHttpServer(root, path)) 79.15 + 79.16 + if xroot.get_xend_tcp_xmlrpc_server(): 79.17 + servers.add(XMLRPCServer(True)) 79.18 + 79.19 + if xroot.get_xend_unix_xmlrpc_server(): 79.20 + servers.add(XMLRPCServer()) 79.21 return servers
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 80.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py Tue Mar 28 08:54:58 2006 -0700 80.3 @@ -0,0 +1,113 @@ 80.4 +#============================================================================ 80.5 +# This library is free software; you can redistribute it and/or 80.6 +# modify it under the terms of version 2.1 of the GNU Lesser General Public 80.7 +# License as published by the Free Software Foundation. 80.8 +# 80.9 +# This library is distributed in the hope that it will be useful, 80.10 +# but WITHOUT ANY WARRANTY; without even the implied warranty of 80.11 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 80.12 +# Lesser General Public License for more details. 80.13 +# 80.14 +# You should have received a copy of the GNU Lesser General Public 80.15 +# License along with this library; if not, write to the Free Software 80.16 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 80.17 +#============================================================================ 80.18 +# Copyright (C) 2006 Anthony Liguori <aliguori@us.ibm.com> 80.19 +# Copyright (C) 2006 XenSource Ltd. 80.20 +#============================================================================ 80.21 + 80.22 +import xmlrpclib 80.23 + 80.24 +from xen.xend import XendDomain, XendDomainInfo, XendNode, \ 80.25 + XendLogging, XendDmesg 80.26 +from xen.util.xmlrpclib2 import UnixXMLRPCServer, TCPXMLRPCServer 80.27 + 80.28 +from xen.xend.XendClient import XML_RPC_SOCKET, ERROR_INVALID_DOMAIN 80.29 +from xen.xend.XendError import * 80.30 + 80.31 +def lookup(domid): 80.32 + info = XendDomain.instance().domain_lookup_by_name_or_id(domid) 80.33 + if not info: 80.34 + raise XendInvalidDomain(str(domid)) 80.35 + return info 80.36 + 80.37 +def dispatch(domid, fn, args): 80.38 + info = lookup(domid) 80.39 + return getattr(info, fn)(*args) 80.40 + 80.41 +def domain(domid): 80.42 + info = lookup(domid) 80.43 + return info.sxpr() 80.44 + 80.45 +def domains(detail=1): 80.46 + if detail < 1: 80.47 + return XendDomain.instance().list_names() 80.48 + else: 80.49 + domains = XendDomain.instance().list_sorted() 80.50 + return map(lambda dom: dom.sxpr(), domains) 80.51 + 80.52 +def domain_create(config): 80.53 + info = XendDomain.instance().domain_create(config) 80.54 + return info.sxpr() 80.55 + 80.56 +def domain_restore(src): 80.57 + info = XendDomain.instance().domain_restore(src) 80.58 + return info.sxpr() 80.59 + 80.60 +def get_log(): 80.61 + f = open(XendLogging.getLogFilename(), 'r') 80.62 + try: 80.63 + return f.read() 80.64 + finally: 80.65 + f.close() 80.66 + 80.67 +methods = ['device_create', 'destroyDevice', 'getDeviceSxprs', 80.68 + 'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown', 80.69 + 'send_sysrq', 'getVCPUInfo', 'waitForDevices'] 80.70 + 80.71 +exclude = ['domain_create', 'domain_restore'] 80.72 + 80.73 +class XMLRPCServer: 80.74 + def __init__(self, use_tcp=False): 80.75 + self.ready = False 80.76 + self.use_tcp = use_tcp 80.77 + 80.78 + def run(self): 80.79 + if self.use_tcp: 80.80 + # bind to something fixed for now as we may eliminate 80.81 + # tcp support completely. 80.82 + self.server = TCPXMLRPCServer(("localhost", 8005), logRequests=False) 80.83 + else: 80.84 + self.server = UnixXMLRPCServer(XML_RPC_SOCKET, False) 80.85 + 80.86 + # Functions in XendDomainInfo 80.87 + for name in methods: 80.88 + fn = eval("lambda domid, *args: dispatch(domid, '%s', args)"%name) 80.89 + self.server.register_function(fn, "xend.domain.%s" % name) 80.90 + 80.91 + # Functions in XendDomain 80.92 + inst = XendDomain.instance() 80.93 + for name in dir(inst): 80.94 + fn = getattr(inst, name) 80.95 + if name.startswith("domain_") and callable(fn): 80.96 + if name not in exclude: 80.97 + self.server.register_function(fn, "xend.domain.%s" % name[7:]) 80.98 + 80.99 + # Functions in XendNode and XendDmesg 80.100 + for type, lst, n in [(XendNode, ['info', 'cpu_bvt_slice_set'], 'node'), 80.101 + (XendDmesg, ['info', 'clear'], 'node.dmesg')]: 80.102 + inst = type.instance() 80.103 + for name in lst: 80.104 + self.server.register_function(getattr(inst, name), 80.105 + "xend.%s.%s" % (n, name)) 80.106 + 80.107 + # A few special cases 80.108 + self.server.register_function(domain, 'xend.domain') 80.109 + self.server.register_function(domains, 'xend.domains') 80.110 + self.server.register_function(get_log, 'xend.node.log') 80.111 + self.server.register_function(domain_create, 'xend.domain.create') 80.112 + self.server.register_function(domain_restore, 'xend.domain.restore') 80.113 + 80.114 + self.server.register_introspection_functions() 80.115 + self.ready = True 80.116 + self.server.serve_forever()
81.1 --- a/tools/python/xen/xend/server/pciif.py Mon Mar 27 15:36:47 2006 -0700 81.2 +++ b/tools/python/xen/xend/server/pciif.py Tue Mar 28 08:54:58 2006 -0700 81.3 @@ -118,10 +118,12 @@ class PciController(DevController): 81.4 "parse it's resources - %s"+str(e)) 81.5 81.6 if dev.driver!='pciback': 81.7 - raise VmError(("pci: PCI Backend does not own device "+ 81.8 - "%s\n"+ 81.9 - "See the pciback.hide kernel "+ 81.10 - "command-line parameter")%(dev.name)) 81.11 + raise VmError(("pci: PCI Backend does not own device "+ \ 81.12 + "%s\n"+ \ 81.13 + "See the pciback.hide kernel "+ \ 81.14 + "command-line parameter or\n"+ \ 81.15 + "bind your slot/device to the PCI backend using sysfs" \ 81.16 + )%(dev.name)) 81.17 81.18 for (start, size) in dev.ioports: 81.19 log.debug('pci: enabling ioport 0x%x/0x%x'%(start,size))
82.1 --- a/tools/python/xen/xm/create.py Mon Mar 27 15:36:47 2006 -0700 82.2 +++ b/tools/python/xen/xm/create.py Tue Mar 28 08:54:58 2006 -0700 82.3 @@ -30,7 +30,7 @@ import re 82.4 82.5 from xen.xend import sxp 82.6 from xen.xend import PrettyPrint 82.7 -from xen.xend.XendClient import server, XendError 82.8 +from xen.xend.XendClient import server 82.9 from xen.xend.XendBootloader import bootloader 82.10 from xen.util import blkif 82.11 82.12 @@ -813,8 +813,8 @@ def make_domain(opts, config): 82.13 """ 82.14 82.15 try: 82.16 - dominfo = server.xend_domain_create(config) 82.17 - except XendError, ex: 82.18 + dominfo = server.xend.domain.create(config) 82.19 + except Exception, ex: 82.20 import signal 82.21 if vncpid: 82.22 os.kill(vncpid, signal.SIGKILL) 82.23 @@ -822,13 +822,17 @@ def make_domain(opts, config): 82.24 82.25 dom = sxp.child_value(dominfo, 'name') 82.26 82.27 - if server.xend_domain_wait_for_devices(dom) < 0: 82.28 - server.xend_domain_destroy(dom) 82.29 + try: 82.30 + server.xend.domain.waitForDevices(dom) 82.31 + except: 82.32 + server.xend.domain.destroy(dom) 82.33 err("Device creation failed for domain %s" % dom) 82.34 82.35 if not opts.vals.paused: 82.36 - if server.xend_domain_unpause(dom) < 0: 82.37 - server.xend_domain_destroy(dom) 82.38 + try: 82.39 + server.xend.domain.unpause(dom) 82.40 + except: 82.41 + server.xend.domain.destroy(dom) 82.42 err("Failed to unpause domain %s" % dom) 82.43 opts.info("Started domain %s" % (dom)) 82.44 return int(sxp.child_value(dominfo, 'domid'))
83.1 --- a/tools/python/xen/xm/main.py Mon Mar 27 15:36:47 2006 -0700 83.2 +++ b/tools/python/xen/xm/main.py Tue Mar 28 08:54:58 2006 -0700 83.3 @@ -1,6 +1,6 @@ 83.4 # (C) Copyright IBM Corp. 2005 83.5 # Copyright (C) 2004 Mike Wray 83.6 -# Copyright (c) 2005 XenSource Ltd 83.7 +# Copyright (c) 2005-2006 XenSource Ltd. 83.8 # 83.9 # Authors: 83.10 # Sean Dague <sean at dague dot net> 83.11 @@ -29,8 +29,8 @@ import getopt 83.12 import socket 83.13 import warnings 83.14 warnings.filterwarnings('ignore', category=FutureWarning) 83.15 +import xmlrpclib 83.16 83.17 -import xen.xend.XendError 83.18 import xen.xend.XendProtocol 83.19 83.20 from xen.xend import PrettyPrint 83.21 @@ -38,7 +38,8 @@ from xen.xend import sxp 83.22 from xen.xm.opts import * 83.23 83.24 import console 83.25 - 83.26 +import xen.xend.XendClient 83.27 +from xen.xend.XendClient import server 83.28 83.29 # getopt.gnu_getopt is better, but only exists in Python 2.3+. Use 83.30 # getopt.getopt if gnu_getopt is not available. This will mean that options 83.31 @@ -319,8 +320,7 @@ def xm_save(args): 83.32 err("xm save: Unable to create file %s" % savefile) 83.33 sys.exit(1) 83.34 83.35 - from xen.xend.XendClient import server 83.36 - server.xend_domain_save(dom, savefile) 83.37 + server.xend.domain.save(dom, savefile) 83.38 83.39 def xm_restore(args): 83.40 arg_check(args, "restore", 1) 83.41 @@ -331,16 +331,14 @@ def xm_restore(args): 83.42 err("xm restore: Unable to read file %s" % savefile) 83.43 sys.exit(1) 83.44 83.45 - from xen.xend.XendClient import server 83.46 - server.xend_domain_restore(savefile) 83.47 + server.xend.domain.restore(savefile) 83.48 83.49 83.50 def getDomains(domain_names): 83.51 - from xen.xend.XendClient import server 83.52 if domain_names: 83.53 - return map(server.xend_domain, domain_names) 83.54 + return map(server.xend.domain, domain_names) 83.55 else: 83.56 - return server.xend_list_domains() 83.57 + return server.xend.domains(1) 83.58 83.59 83.60 def xm_list(args): 83.61 @@ -416,12 +414,11 @@ def xm_brief_list(doms): 83.62 83.63 def xm_vcpu_list(args): 83.64 83.65 - from xen.xend.XendClient import server 83.66 if args: 83.67 - dominfo = map(server.xend_domain_vcpuinfo, args) 83.68 + dominfo = map(server.xend.domain.getVCPUInfo, args) 83.69 else: 83.70 - doms = server.xend_list_domains(False) 83.71 - dominfo = map(server.xend_domain_vcpuinfo, doms) 83.72 + doms = server.xend.domains(False) 83.73 + dominfo = map(server.xend.domain.getVCPUInfo, doms) 83.74 83.75 print 'Name ID VCPU CPU State Time(s) CPU Affinity' 83.76 83.77 @@ -475,8 +472,7 @@ def xm_vcpu_list(args): 83.78 cpumap = map(lambda x: int(x), cpumap) 83.79 cpumap.sort() 83.80 83.81 - from xen.xend.XendClient import server 83.82 - for x in server.xend_node()[1:]: 83.83 + for x in server.xend.node.info()[1:]: 83.84 if len(x) > 1 and x[0] == 'nr_cpus': 83.85 nr_cpus = int(x[1]) 83.86 # normalize cpumap by modulus nr_cpus, and drop duplicates 83.87 @@ -532,21 +528,18 @@ def xm_pause(args): 83.88 arg_check(args, "pause", 1) 83.89 dom = args[0] 83.90 83.91 - from xen.xend.XendClient import server 83.92 - server.xend_domain_pause(dom) 83.93 + server.xend.domain.pause(dom) 83.94 83.95 def xm_unpause(args): 83.96 arg_check(args, "unpause", 1) 83.97 dom = args[0] 83.98 83.99 - from xen.xend.XendClient import server 83.100 - server.xend_domain_unpause(dom) 83.101 + server.xend.domain.unpause(dom) 83.102 83.103 def xm_rename(args): 83.104 arg_check(args, "rename", 2) 83.105 83.106 - from xen.xend.XendClient import server 83.107 - server.xend_domain_rename(args[0], args[1]) 83.108 + server.xend.domain.setName(args[0], args[1]) 83.109 83.110 def xm_subcommand(command, args): 83.111 cmd = __import__(command, globals(), locals(), 'xen.xm') 83.112 @@ -574,8 +567,7 @@ def xm_vcpu_pin(args): 83.113 vcpu = int(args[1]) 83.114 cpumap = cpu_make_map(args[2]) 83.115 83.116 - from xen.xend.XendClient import server 83.117 - server.xend_domain_pincpu(dom, vcpu, cpumap) 83.118 + server.xend.domain.pincpu(dom, vcpu, cpumap) 83.119 83.120 def xm_mem_max(args): 83.121 arg_check(args, "mem-max", 2) 83.122 @@ -583,8 +575,7 @@ def xm_mem_max(args): 83.123 dom = args[0] 83.124 mem = int_unit(args[1], 'm') 83.125 83.126 - from xen.xend.XendClient import server 83.127 - server.xend_domain_maxmem_set(dom, mem) 83.128 + server.xend.domain.maxmem_set(dom, mem) 83.129 83.130 def xm_mem_set(args): 83.131 arg_check(args, "mem-set", 2) 83.132 @@ -592,20 +583,17 @@ def xm_mem_set(args): 83.133 dom = args[0] 83.134 mem_target = int_unit(args[1], 'm') 83.135 83.136 - from xen.xend.XendClient import server 83.137 - server.xend_domain_mem_target_set(dom, mem_target) 83.138 + server.xend.domain.setMemoryTarget(dom, mem_target) 83.139 83.140 def xm_vcpu_set(args): 83.141 arg_check(args, "vcpu-set", 2) 83.142 83.143 - from xen.xend.XendClient import server 83.144 - server.xend_domain_set_vcpus(args[0], int(args[1])) 83.145 + server.xend.domain.setVCpuCount(args[0], int(args[1])) 83.146 83.147 83.148 def xm_destroy(args): 83.149 arg_check(args, "destroy", 1) 83.150 - from xen.xend.XendClient import server 83.151 - server.xend_domain_destroy(args[0]) 83.152 + server.xend.domain.destroy(args[0]) 83.153 83.154 83.155 def xm_domid(args): 83.156 @@ -613,8 +601,7 @@ def xm_domid(args): 83.157 83.158 name = args[0] 83.159 83.160 - from xen.xend.XendClient import server 83.161 - dom = server.xend_domain(name) 83.162 + dom = server.xend.domain(name) 83.163 print sxp.child_value(dom, 'domid') 83.164 83.165 def xm_domname(args): 83.166 @@ -622,23 +609,20 @@ def xm_domname(args): 83.167 83.168 name = args[0] 83.169 83.170 - from xen.xend.XendClient import server 83.171 - dom = server.xend_domain(name) 83.172 + dom = server.xend.domain(name) 83.173 print sxp.child_value(dom, 'name') 83.174 83.175 def xm_sched_bvt(args): 83.176 arg_check(args, "sched-bvt", 6) 83.177 dom = args[0] 83.178 v = map(long, args[1:6]) 83.179 - from xen.xend.XendClient import server 83.180 - server.xend_domain_cpu_bvt_set(dom, *v) 83.181 + server.xend.domain.cpu_bvt_set(dom, *v) 83.182 83.183 def xm_sched_bvt_ctxallow(args): 83.184 arg_check(args, "sched-bvt-ctxallow", 1) 83.185 83.186 slice = int(args[0]) 83.187 - from xen.xend.XendClient import server 83.188 - server.xend_node_cpu_bvt_slice_set(slice) 83.189 + server.xend.node.cpu_bvt_slice_set(slice) 83.190 83.191 def xm_sched_sedf(args): 83.192 def ns_to_ms(val): 83.193 @@ -695,13 +679,12 @@ def xm_sched_sedf(args): 83.194 'Slice(ms)', 'Lat(ms)', 83.195 'Extra','Weight') 83.196 83.197 - from xen.xend.XendClient import server 83.198 doms = filter(lambda x : domid_match(domid, x), 83.199 [parse_doms_info(dom) for dom in getDomains("")]) 83.200 for d in doms: 83.201 # fetch current values so as not to clobber them 83.202 sedf_info = \ 83.203 - parse_sedf_info(server.xend_domain_cpu_sedf_get(d['dom'])) 83.204 + parse_sedf_info(server.xend.domain.cpu_sedf_get(d['dom'])) 83.205 sedf_info['name'] = d['name'] 83.206 83.207 # update values in case of call to set 83.208 @@ -713,7 +696,7 @@ def xm_sched_sedf(args): 83.209 v = map(int, [sedf_info['period'], sedf_info['slice'], 83.210 sedf_info['latency'],sedf_info['extratime'], 83.211 sedf_info['weight']]) 83.212 - rv = server.xend_domain_cpu_sedf_set(d['dom'], *v) 83.213 + rv = server.xend.domain.cpu_sedf_set(d['dom'], *v) 83.214 if int(rv) != 0: 83.215 err("Failed to set sedf parameters (rv=%d)."%(rv)) 83.216 83.217 @@ -725,8 +708,7 @@ def xm_sched_sedf(args): 83.218 def xm_info(args): 83.219 arg_check(args, "info", 0) 83.220 83.221 - from xen.xend.XendClient import server 83.222 - info = server.xend_node() 83.223 + info = server.xend.node.info() 83.224 83.225 for x in info[1:]: 83.226 if len(x) < 2: 83.227 @@ -738,8 +720,7 @@ def xm_console(args): 83.228 arg_check(args, "console", 1) 83.229 83.230 dom = args[0] 83.231 - from xen.xend.XendClient import server 83.232 - info = server.xend_domain(dom) 83.233 + info = server.xend.domain(dom) 83.234 domid = int(sxp.child_value(info, 'domid', '-1')) 83.235 console.execConsole(domid) 83.236 83.237 @@ -768,17 +749,15 @@ its contents if the [-c|--clear] flag is 83.238 if not (1 <= len(myargs) <= 2): 83.239 err('Invalid arguments: ' + str(myargs)) 83.240 83.241 - from xen.xend.XendClient import server 83.242 if not gopts.vals.clear: 83.243 - print server.xend_node_get_dmesg() 83.244 + print server.xend.node.dmesg.info() 83.245 else: 83.246 - server.xend_node_clear_dmesg() 83.247 + server.xend.node.dmesg.clear() 83.248 83.249 def xm_log(args): 83.250 arg_check(args, "log", 0) 83.251 83.252 - from xen.xend.XendClient import server 83.253 - print server.xend_node_log() 83.254 + print server.xend.node.log() 83.255 83.256 def parse_dev_info(info): 83.257 def get_info(n, t, d): 83.258 @@ -826,13 +805,12 @@ def xm_network_list(args): 83.259 print 'No domain parameter given' 83.260 sys.exit(1) 83.261 dom = params[0] 83.262 - from xen.xend.XendClient import server 83.263 if use_long: 83.264 - devs = server.xend_domain_devices(dom, 'vif') 83.265 + devs = server.xend.domain.getDeviceSxprs(dom, 'vif') 83.266 map(PrettyPrint.prettyprint, devs) 83.267 else: 83.268 hdr = 0 83.269 - for x in server.xend_domain_devices(dom, 'vif'): 83.270 + for x in server.xend.domain.getDeviceSxprs(dom, 'vif'): 83.271 if hdr == 0: 83.272 print 'Idx BE MAC Addr. handle state evt-ch tx-/rx-ring-ref BE-path' 83.273 hdr = 1 83.274 @@ -857,13 +835,12 @@ def xm_block_list(args): 83.275 print 'No domain parameter given' 83.276 sys.exit(1) 83.277 dom = params[0] 83.278 - from xen.xend.XendClient import server 83.279 if use_long: 83.280 - devs = server.xend_domain_devices(dom, 'vbd') 83.281 + devs = server.xend.domain.getDeviceSxprs(dom, 'vbd') 83.282 map(PrettyPrint.prettyprint, devs) 83.283 else: 83.284 hdr = 0 83.285 - for x in server.xend_domain_devices(dom, 'vbd'): 83.286 + for x in server.xend.domain.getDeviceSxprs(dom, 'vbd'): 83.287 if hdr == 0: 83.288 print 'Vdev BE handle state evt-ch ring-ref BE-path' 83.289 hdr = 1 83.290 @@ -887,13 +864,12 @@ def xm_vtpm_list(args): 83.291 print 'No domain parameter given' 83.292 sys.exit(1) 83.293 dom = params[0] 83.294 - from xen.xend.XendClient import server 83.295 if use_long: 83.296 - devs = server.xend_domain_devices(dom, 'vtpm') 83.297 + devs = server.xend.domain.getDeviceSxprs(dom, 'vtpm') 83.298 map(PrettyPrint.prettyprint, devs) 83.299 else: 83.300 hdr = 0 83.301 - for x in server.xend_domain_devices(dom, 'vtpm'): 83.302 + for x in server.xend.domain.getDeviceSxprs(dom, 'vtpm'): 83.303 if hdr == 0: 83.304 print 'Idx BE handle state evt-ch ring-ref BE-path' 83.305 hdr = 1 83.306 @@ -919,8 +895,7 @@ def xm_block_attach(args): 83.307 if len(args) == 5: 83.308 vbd.append(['backend', args[4]]) 83.309 83.310 - from xen.xend.XendClient import server 83.311 - server.xend_domain_device_create(dom, vbd) 83.312 + server.xend.domain.device_create(dom, vbd) 83.313 83.314 83.315 def xm_network_attach(args): 83.316 @@ -932,8 +907,7 @@ def xm_network_attach(args): 83.317 for a in args[1:]: 83.318 vif.append(a.split("=")) 83.319 83.320 - from xen.xend.XendClient import server 83.321 - server.xend_domain_device_create(dom, vif) 83.322 + server.xend.domain.device_create(dom, vif) 83.323 83.324 83.325 def detach(args, command, deviceClass): 83.326 @@ -942,8 +916,7 @@ def detach(args, command, deviceClass): 83.327 dom = args[0] 83.328 dev = args[1] 83.329 83.330 - from xen.xend.XendClient import server 83.331 - server.xend_domain_device_destroy(dom, deviceClass, dev) 83.332 + server.xend.domain.destroyDevice(dom, deviceClass, dev) 83.333 83.334 83.335 def xm_block_detach(args): 83.336 @@ -955,7 +928,6 @@ def xm_network_detach(args): 83.337 83.338 83.339 def xm_vnet_list(args): 83.340 - from xen.xend.XendClient import server 83.341 try: 83.342 (options, params) = getopt.gnu_getopt(args, 'l', ['long']) 83.343 except getopt.GetoptError, opterr: 83.344 @@ -990,13 +962,11 @@ def xm_vnet_create(args): 83.345 print "File not found: %s" % conf 83.346 sys.exit(1) 83.347 83.348 - from xen.xend.XendClient import server 83.349 server.xend_vnet_create(conf) 83.350 83.351 def xm_vnet_delete(args): 83.352 arg_check(args, "vnet-delete", 1) 83.353 vnet = args[0] 83.354 - from xen.xend.XendClient import server 83.355 server.xend_vnet_delete(vnet) 83.356 83.357 commands = { 83.358 @@ -1132,23 +1102,13 @@ def main(argv=sys.argv): 83.359 else: 83.360 err("Error connecting to xend: %s." % ex[1]) 83.361 sys.exit(1) 83.362 - except xen.xend.XendError.XendError, ex: 83.363 - if len(args) > 0: 83.364 - handle_xend_error(argv[1], args, ex) 83.365 + except SystemExit: 83.366 + sys.exit(1) 83.367 + except xmlrpclib.Fault, ex: 83.368 + if ex.faultCode == xen.xend.XendClient.ERROR_INVALID_DOMAIN: 83.369 + print "Error: the domain '%s' does not exist." % ex.faultString 83.370 else: 83.371 - print "Unexpected error:", sys.exc_info()[0] 83.372 - print 83.373 - print "Please report to xen-devel@lists.xensource.com" 83.374 - raise 83.375 - except xen.xend.XendProtocol.XendError, ex: 83.376 - if len(args) > 0: 83.377 - handle_xend_error(argv[1], args, ex) 83.378 - else: 83.379 - print "Unexpected error:", sys.exc_info()[0] 83.380 - print 83.381 - print "Please report to xen-devel@lists.xensource.com" 83.382 - raise 83.383 - except SystemExit: 83.384 + print "Error: %s" % ex.faultString 83.385 sys.exit(1) 83.386 except: 83.387 print "Unexpected error:", sys.exc_info()[0]
84.1 --- a/tools/python/xen/xm/migrate.py Mon Mar 27 15:36:47 2006 -0700 84.2 +++ b/tools/python/xen/xm/migrate.py Tue Mar 28 08:54:58 2006 -0700 84.3 @@ -60,4 +60,4 @@ def main(argv): 84.4 opts.err('Invalid arguments: ' + str(args)) 84.5 dom = args[0] 84.6 dst = args[1] 84.7 - server.xend_domain_migrate(dom, dst, opts.vals.live, opts.vals.resource, opts.vals.port) 84.8 + server.xend.domain.migrate(dom, dst, opts.vals.live, opts.vals.resource, opts.vals.port)
85.1 --- a/tools/python/xen/xm/shutdown.py Mon Mar 27 15:36:47 2006 -0700 85.2 +++ b/tools/python/xen/xm/shutdown.py Tue Mar 28 08:54:58 2006 -0700 85.3 @@ -53,8 +53,8 @@ gopts.opt('reboot', short='R', 85.4 use='Shutdown and reboot.') 85.5 85.6 def shutdown(opts, doms, mode, wait): 85.7 - if doms == None: doms = server.xend_domains() 85.8 - dom0_name = sxp.child_value(server.xend_domain(0), 'name') 85.9 + if doms == None: doms = server.xend.domains(0) 85.10 + dom0_name = sxp.child_value(server.xend.domain(0), 'name') 85.11 for x in [dom0_name, DOM0_ID]: 85.12 if x in doms: 85.13 if opts.vals.all: 85.14 @@ -62,10 +62,10 @@ def shutdown(opts, doms, mode, wait): 85.15 else: 85.16 opts.err("Can't specify Domain-0") 85.17 for d in doms: 85.18 - server.xend_domain_shutdown(d, mode) 85.19 + server.xend.domain.shutdown(d, mode) 85.20 if wait: 85.21 while doms: 85.22 - alive = server.xend_domains() 85.23 + alive = server.xend.domains(0) 85.24 dead = [] 85.25 for d in doms: 85.26 if d in alive: continue
86.1 --- a/tools/python/xen/xm/sysrq.py Mon Mar 27 15:36:47 2006 -0700 86.2 +++ b/tools/python/xen/xm/sysrq.py Tue Mar 28 08:54:58 2006 -0700 86.3 @@ -28,4 +28,4 @@ def main(argv): 86.4 if len(args) < 2: opts.err('Missing sysrq character') 86.5 dom = args[0] 86.6 req = ord(args[1][0]) 86.7 - server.xend_domain_sysrq(dom, req) 86.8 + server.xend.domain.send_sysrq(dom, req)
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/tools/xenstore/README Tue Mar 28 08:54:58 2006 -0700 87.3 @@ -0,0 +1,5 @@ 87.4 +The following files are imported from the Samba project. We use the versions 87.5 +from Samba 3, the current stable branch. 87.6 + 87.7 +talloc.c: samba-trunk/source/lib/talloc.c r14291 2006-03-13 04:27:47 +0000 87.8 +talloc.h: samba-trunk/source/include/talloc.h r11986 2005-12-01 00:43:36 +0000
88.1 --- a/tools/xenstore/talloc.c Mon Mar 27 15:36:47 2006 -0700 88.2 +++ b/tools/xenstore/talloc.c Tue Mar 28 08:54:58 2006 -0700 88.3 @@ -1,4 +1,4 @@ 88.4 -/* 88.5 +/* 88.6 Samba Unix SMB/CIFS implementation. 88.7 88.8 Samba trivial allocation library - new interface 88.9 @@ -6,27 +6,30 @@ 88.10 NOTE: Please read talloc_guide.txt for full documentation 88.11 88.12 Copyright (C) Andrew Tridgell 2004 88.13 - 88.14 - This program is free software; you can redistribute it and/or modify 88.15 - it under the terms of the GNU General Public License as published by 88.16 - the Free Software Foundation; either version 2 of the License, or 88.17 - (at your option) any later version. 88.18 - 88.19 - This program is distributed in the hope that it will be useful, 88.20 + 88.21 + ** NOTE! The following LGPL license applies to the talloc 88.22 + ** library. This does NOT imply that all of Samba is released 88.23 + ** under the LGPL 88.24 + 88.25 + This library is free software; you can redistribute it and/or 88.26 + modify it under the terms of the GNU Lesser General Public 88.27 + License as published by the Free Software Foundation; either 88.28 + version 2 of the License, or (at your option) any later version. 88.29 + 88.30 + This library is distributed in the hope that it will be useful, 88.31 but WITHOUT ANY WARRANTY; without even the implied warranty of 88.32 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 88.33 - GNU General Public License for more details. 88.34 - 88.35 - You should have received a copy of the GNU General Public License 88.36 - along with this program; if not, write to the Free Software 88.37 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 88.38 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 88.39 + Lesser General Public License for more details. 88.40 + 88.41 + You should have received a copy of the GNU Lesser General Public 88.42 + License along with this library; if not, write to the Free Software 88.43 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 88.44 */ 88.45 88.46 /* 88.47 inspired by http://swapped.cc/halloc/ 88.48 */ 88.49 88.50 - 88.51 #ifdef _SAMBA_BUILD_ 88.52 #include "includes.h" 88.53 #if ((SAMBA_VERSION_MAJOR==3)&&(SAMBA_VERSION_MINOR<9)) 88.54 @@ -52,15 +55,13 @@ 88.55 88.56 /* use this to force every realloc to change the pointer, to stress test 88.57 code that might not cope */ 88.58 -#ifdef TESTING 88.59 -#define ALWAYS_REALLOC 1 88.60 -void *test_malloc(size_t size); 88.61 -#define malloc test_malloc 88.62 -#endif 88.63 +#define ALWAYS_REALLOC 0 88.64 + 88.65 88.66 #define MAX_TALLOC_SIZE 0x10000000 88.67 -#define TALLOC_MAGIC 0xe814ec4f 88.68 -#define TALLOC_MAGIC_FREE 0x7faebef3 88.69 +#define TALLOC_MAGIC 0xe814ec70 88.70 +#define TALLOC_FLAG_FREE 0x01 88.71 +#define TALLOC_FLAG_LOOP 0x02 88.72 #define TALLOC_MAGIC_REFERENCE ((const char *)1) 88.73 88.74 /* by default we abort when given a bad pointer (such as when talloc_free() is called 88.75 @@ -83,8 +84,7 @@ void *test_malloc(size_t size); 88.76 */ 88.77 static const void *null_context; 88.78 static void *cleanup_context; 88.79 -static int (*malloc_fail_handler)(void *); 88.80 -static void *malloc_fail_data; 88.81 + 88.82 88.83 struct talloc_reference_handle { 88.84 struct talloc_reference_handle *next, *prev; 88.85 @@ -97,24 +97,27 @@ struct talloc_chunk { 88.86 struct talloc_chunk *next, *prev; 88.87 struct talloc_chunk *parent, *child; 88.88 struct talloc_reference_handle *refs; 88.89 - size_t size; 88.90 - unsigned magic; 88.91 talloc_destructor_t destructor; 88.92 const char *name; 88.93 + size_t size; 88.94 + unsigned flags; 88.95 }; 88.96 88.97 +/* 16 byte alignment seems to keep everyone happy */ 88.98 +#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15) 88.99 +#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc)) 88.100 + 88.101 /* panic if we get a bad magic value */ 88.102 static struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr) 88.103 { 88.104 - struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, ptr)-1; 88.105 - if (tc->magic != TALLOC_MAGIC) { 88.106 - if (tc->magic == TALLOC_MAGIC_FREE) { 88.107 - TALLOC_ABORT("Bad talloc magic value - double free"); 88.108 - } else { 88.109 - TALLOC_ABORT("Bad talloc magic value - unknown value"); 88.110 - } 88.111 + const char *pp = ptr; 88.112 + struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); 88.113 + if ((tc->flags & ~0xF) != TALLOC_MAGIC) { 88.114 + TALLOC_ABORT("Bad talloc magic value - unknown value"); 88.115 } 88.116 - 88.117 + if (tc->flags & TALLOC_FLAG_FREE) { 88.118 + TALLOC_ABORT("Bad talloc magic value - double free"); 88.119 + } 88.120 return tc; 88.121 } 88.122 88.123 @@ -159,7 +162,7 @@ static struct talloc_chunk *talloc_paren 88.124 void *talloc_parent(const void *ptr) 88.125 { 88.126 struct talloc_chunk *tc = talloc_parent_chunk(ptr); 88.127 - return (void *)(tc+1); 88.128 + return tc? TC_PTR_FROM_CHUNK(tc) : NULL; 88.129 } 88.130 88.131 /* 88.132 @@ -177,17 +180,11 @@ void *_talloc(const void *context, size_ 88.133 return NULL; 88.134 } 88.135 88.136 - tc = malloc(sizeof(*tc)+size); 88.137 - if (tc == NULL) { 88.138 - if (malloc_fail_handler) 88.139 - if (malloc_fail_handler(malloc_fail_data)) 88.140 - tc = malloc(sizeof(*tc)+size); 88.141 - if (!tc) 88.142 - return NULL; 88.143 - } 88.144 + tc = malloc(TC_HDR_SIZE+size); 88.145 + if (tc == NULL) return NULL; 88.146 88.147 tc->size = size; 88.148 - tc->magic = TALLOC_MAGIC; 88.149 + tc->flags = TALLOC_MAGIC; 88.150 tc->destructor = NULL; 88.151 tc->child = NULL; 88.152 tc->name = NULL; 88.153 @@ -207,7 +204,7 @@ void *_talloc(const void *context, size_ 88.154 tc->next = tc->prev = tc->parent = NULL; 88.155 } 88.156 88.157 - return (void *)(tc+1); 88.158 + return TC_PTR_FROM_CHUNK(tc); 88.159 } 88.160 88.161 88.162 @@ -292,7 +289,11 @@ static int talloc_unreference(const void 88.163 88.164 for (h=tc->refs;h;h=h->next) { 88.165 struct talloc_chunk *p = talloc_parent_chunk(h); 88.166 - if ((p==NULL && context==NULL) || p+1 == context) break; 88.167 + if (p == NULL) { 88.168 + if (context == NULL) break; 88.169 + } else if (TC_PTR_FROM_CHUNK(p) == context) { 88.170 + break; 88.171 + } 88.172 } 88.173 if (h == NULL) { 88.174 return -1; 88.175 @@ -343,7 +344,7 @@ int talloc_unlink(const void *context, v 88.176 88.177 new_p = talloc_parent_chunk(tc_p->refs); 88.178 if (new_p) { 88.179 - new_parent = new_p+1; 88.180 + new_parent = TC_PTR_FROM_CHUNK(new_p); 88.181 } else { 88.182 new_parent = NULL; 88.183 } 88.184 @@ -471,6 +472,8 @@ void *talloc_init(const char *fmt, ...) 88.185 va_list ap; 88.186 void *ptr; 88.187 88.188 + talloc_enable_null_tracking(); 88.189 + 88.190 ptr = _talloc(NULL, 0); 88.191 if (ptr == NULL) return NULL; 88.192 88.193 @@ -502,16 +505,16 @@ void talloc_free_children(void *ptr) 88.194 choice is owner of any remaining reference to this 88.195 pointer, the second choice is our parent, and the 88.196 final choice is the null context. */ 88.197 - void *child = tc->child+1; 88.198 + void *child = TC_PTR_FROM_CHUNK(tc->child); 88.199 const void *new_parent = null_context; 88.200 if (tc->child->refs) { 88.201 struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); 88.202 - if (p) new_parent = p+1; 88.203 + if (p) new_parent = TC_PTR_FROM_CHUNK(p); 88.204 } 88.205 if (talloc_free(child) == -1) { 88.206 if (new_parent == null_context) { 88.207 struct talloc_chunk *p = talloc_parent_chunk(ptr); 88.208 - if (p) new_parent = p+1; 88.209 + if (p) new_parent = TC_PTR_FROM_CHUNK(p); 88.210 } 88.211 talloc_steal(new_parent, child); 88.212 } 88.213 @@ -541,6 +544,11 @@ int talloc_free(void *ptr) 88.214 return -1; 88.215 } 88.216 88.217 + if (tc->flags & TALLOC_FLAG_LOOP) { 88.218 + /* we have a free loop - stop looping */ 88.219 + return 0; 88.220 + } 88.221 + 88.222 if (tc->destructor) { 88.223 talloc_destructor_t d = tc->destructor; 88.224 if (d == (talloc_destructor_t)-1) { 88.225 @@ -554,6 +562,8 @@ int talloc_free(void *ptr) 88.226 tc->destructor = NULL; 88.227 } 88.228 88.229 + tc->flags |= TALLOC_FLAG_LOOP; 88.230 + 88.231 talloc_free_children(ptr); 88.232 88.233 if (tc->parent) { 88.234 @@ -566,7 +576,7 @@ int talloc_free(void *ptr) 88.235 if (tc->next) tc->next->prev = tc->prev; 88.236 } 88.237 88.238 - tc->magic = TALLOC_MAGIC_FREE; 88.239 + tc->flags |= TALLOC_FLAG_FREE; 88.240 88.241 free(tc); 88.242 return 0; 88.243 @@ -606,36 +616,24 @@ void *_talloc_realloc(const void *contex 88.244 } 88.245 88.246 /* by resetting magic we catch users of the old memory */ 88.247 - tc->magic = TALLOC_MAGIC_FREE; 88.248 + tc->flags |= TALLOC_FLAG_FREE; 88.249 88.250 #if ALWAYS_REALLOC 88.251 - new_ptr = malloc(size + sizeof(*tc)); 88.252 - if (!new_ptr) { 88.253 - tc->magic = TALLOC_MAGIC; 88.254 - if (malloc_fail_handler) 88.255 - if (malloc_fail_handler(malloc_fail_data)) 88.256 - new_ptr = malloc(size + sizeof(*tc)); 88.257 - } 88.258 + new_ptr = malloc(size + TC_HDR_SIZE); 88.259 if (new_ptr) { 88.260 - memcpy(new_ptr, tc, tc->size + sizeof(*tc)); 88.261 + memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE); 88.262 free(tc); 88.263 } 88.264 #else 88.265 - new_ptr = realloc(tc, size + sizeof(*tc)); 88.266 - if (!new_ptr) { 88.267 - tc->magic = TALLOC_MAGIC; 88.268 - if (malloc_fail_handler) 88.269 - if (malloc_fail_handler(malloc_fail_data)) 88.270 - new_ptr = realloc(tc, size + sizeof(*tc)); 88.271 - } 88.272 + new_ptr = realloc(tc, size + TC_HDR_SIZE); 88.273 #endif 88.274 if (!new_ptr) { 88.275 - tc->magic = TALLOC_MAGIC; 88.276 + tc->flags &= ~TALLOC_FLAG_FREE; 88.277 return NULL; 88.278 } 88.279 88.280 tc = new_ptr; 88.281 - tc->magic = TALLOC_MAGIC; 88.282 + tc->flags &= ~TALLOC_FLAG_FREE; 88.283 if (tc->parent) { 88.284 tc->parent->child = new_ptr; 88.285 } 88.286 @@ -651,9 +649,9 @@ void *_talloc_realloc(const void *contex 88.287 } 88.288 88.289 tc->size = size; 88.290 - talloc_set_name_const(tc+1, name); 88.291 + talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name); 88.292 88.293 - return (void *)(tc+1); 88.294 + return TC_PTR_FROM_CHUNK(tc); 88.295 } 88.296 88.297 /* 88.298 @@ -730,10 +728,19 @@ off_t talloc_total_size(const void *ptr) 88.299 88.300 tc = talloc_chunk_from_ptr(ptr); 88.301 88.302 + if (tc->flags & TALLOC_FLAG_LOOP) { 88.303 + return 0; 88.304 + } 88.305 + 88.306 + tc->flags |= TALLOC_FLAG_LOOP; 88.307 + 88.308 total = tc->size; 88.309 for (c=tc->child;c;c=c->next) { 88.310 - total += talloc_total_size(c+1); 88.311 + total += talloc_total_size(TC_PTR_FROM_CHUNK(c)); 88.312 } 88.313 + 88.314 + tc->flags &= ~TALLOC_FLAG_LOOP; 88.315 + 88.316 return total; 88.317 } 88.318 88.319 @@ -743,20 +750,21 @@ off_t talloc_total_size(const void *ptr) 88.320 off_t talloc_total_blocks(const void *ptr) 88.321 { 88.322 off_t total = 0; 88.323 - struct talloc_chunk *c, *tc; 88.324 + struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr); 88.325 88.326 - if (ptr == NULL) { 88.327 - ptr = null_context; 88.328 - } 88.329 - if (ptr == NULL) { 88.330 + if (tc->flags & TALLOC_FLAG_LOOP) { 88.331 return 0; 88.332 } 88.333 - tc = talloc_chunk_from_ptr(ptr); 88.334 + 88.335 + tc->flags |= TALLOC_FLAG_LOOP; 88.336 88.337 total++; 88.338 for (c=tc->child;c;c=c->next) { 88.339 - total += talloc_total_blocks(c+1); 88.340 + total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c)); 88.341 } 88.342 + 88.343 + tc->flags &= ~TALLOC_FLAG_LOOP; 88.344 + 88.345 return total; 88.346 } 88.347 88.348 @@ -782,23 +790,29 @@ void talloc_report_depth(const void *ptr 88.349 { 88.350 struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr); 88.351 88.352 + if (tc->flags & TALLOC_FLAG_LOOP) { 88.353 + return; 88.354 + } 88.355 + 88.356 + tc->flags |= TALLOC_FLAG_LOOP; 88.357 + 88.358 for (c=tc->child;c;c=c->next) { 88.359 if (c->name == TALLOC_MAGIC_REFERENCE) { 88.360 - struct talloc_reference_handle *handle = (void *)(c+1); 88.361 + struct talloc_reference_handle *handle = TC_PTR_FROM_CHUNK(c); 88.362 const char *name2 = talloc_get_name(handle->ptr); 88.363 fprintf(f, "%*sreference to: %s\n", depth*4, "", name2); 88.364 } else { 88.365 - const char *name = talloc_get_name(c+1); 88.366 + const char *name = talloc_get_name(TC_PTR_FROM_CHUNK(c)); 88.367 fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d)\n", 88.368 depth*4, "", 88.369 name, 88.370 - (unsigned long)talloc_total_size(c+1), 88.371 - (unsigned long)talloc_total_blocks(c+1), 88.372 - talloc_reference_count(c+1)); 88.373 - talloc_report_depth(c+1, f, depth+1); 88.374 + (unsigned long)talloc_total_size(TC_PTR_FROM_CHUNK(c)), 88.375 + (unsigned long)talloc_total_blocks(TC_PTR_FROM_CHUNK(c)), 88.376 + talloc_reference_count(TC_PTR_FROM_CHUNK(c))); 88.377 + talloc_report_depth(TC_PTR_FROM_CHUNK(c), f, depth+1); 88.378 } 88.379 } 88.380 - 88.381 + tc->flags &= ~TALLOC_FLAG_LOOP; 88.382 } 88.383 88.384 /* 88.385 @@ -841,9 +855,9 @@ void talloc_report(const void *ptr, FILE 88.386 88.387 for (c=tc->child;c;c=c->next) { 88.388 fprintf(f, "\t%-30s contains %6lu bytes in %3lu blocks\n", 88.389 - talloc_get_name(c+1), 88.390 - (unsigned long)talloc_total_size(c+1), 88.391 - (unsigned long)talloc_total_blocks(c+1)); 88.392 + talloc_get_name(TC_PTR_FROM_CHUNK(c)), 88.393 + (unsigned long)talloc_total_size(TC_PTR_FROM_CHUNK(c)), 88.394 + (unsigned long)talloc_total_blocks(TC_PTR_FROM_CHUNK(c))); 88.395 } 88.396 fflush(f); 88.397 } 88.398 @@ -878,6 +892,74 @@ void talloc_enable_null_tracking(void) 88.399 } 88.400 } 88.401 88.402 +#ifdef _SAMBA_BUILD_ 88.403 +/* Ugly calls to Samba-specific sprintf_append... JRA. */ 88.404 + 88.405 +/* 88.406 + report on memory usage by all children of a pointer, giving a full tree view 88.407 +*/ 88.408 +static void talloc_report_depth_str(const void *ptr, char **pps, ssize_t *plen, size_t *pbuflen, int depth) 88.409 +{ 88.410 + struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr); 88.411 + 88.412 + if (tc->flags & TALLOC_FLAG_LOOP) { 88.413 + return; 88.414 + } 88.415 + 88.416 + tc->flags |= TALLOC_FLAG_LOOP; 88.417 + 88.418 + for (c=tc->child;c;c=c->next) { 88.419 + if (c->name == TALLOC_MAGIC_REFERENCE) { 88.420 + struct talloc_reference_handle *handle = TC_PTR_FROM_CHUNK(c); 88.421 + const char *name2 = talloc_get_name(handle->ptr); 88.422 + 88.423 + sprintf_append(NULL, pps, plen, pbuflen, 88.424 + "%*sreference to: %s\n", depth*4, "", name2); 88.425 + 88.426 + } else { 88.427 + const char *name = talloc_get_name(TC_PTR_FROM_CHUNK(c)); 88.428 + 88.429 + sprintf_append(NULL, pps, plen, pbuflen, 88.430 + "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d)\n", 88.431 + depth*4, "", 88.432 + name, 88.433 + (unsigned long)talloc_total_size(TC_PTR_FROM_CHUNK(c)), 88.434 + (unsigned long)talloc_total_blocks(TC_PTR_FROM_CHUNK(c)), 88.435 + talloc_reference_count(TC_PTR_FROM_CHUNK(c))); 88.436 + 88.437 + talloc_report_depth_str(TC_PTR_FROM_CHUNK(c), pps, plen, pbuflen, depth+1); 88.438 + } 88.439 + } 88.440 + tc->flags &= ~TALLOC_FLAG_LOOP; 88.441 +} 88.442 + 88.443 +/* 88.444 + report on memory usage by all children of a pointer 88.445 +*/ 88.446 +char *talloc_describe_all(void) 88.447 +{ 88.448 + ssize_t len = 0; 88.449 + size_t buflen = 512; 88.450 + char *s = NULL; 88.451 + 88.452 + if (null_context == NULL) { 88.453 + return NULL; 88.454 + } 88.455 + 88.456 + sprintf_append(NULL, &s, &len, &buflen, 88.457 + "full talloc report on '%s' (total %lu bytes in %lu blocks)\n", 88.458 + talloc_get_name(null_context), 88.459 + (unsigned long)talloc_total_size(null_context), 88.460 + (unsigned long)talloc_total_blocks(null_context)); 88.461 + 88.462 + if (!s) { 88.463 + return NULL; 88.464 + } 88.465 + talloc_report_depth_str(null_context, &s, &len, &buflen, 1); 88.466 + return s; 88.467 +} 88.468 +#endif 88.469 + 88.470 /* 88.471 enable leak reporting on exit 88.472 */ 88.473 @@ -942,6 +1024,30 @@ char *talloc_strdup(const void *t, const 88.474 } 88.475 88.476 /* 88.477 + append to a talloced string 88.478 +*/ 88.479 +char *talloc_append_string(const void *t, char *orig, const char *append) 88.480 +{ 88.481 + char *ret; 88.482 + size_t olen = strlen(orig); 88.483 + size_t alenz; 88.484 + 88.485 + if (!append) 88.486 + return orig; 88.487 + 88.488 + alenz = strlen(append) + 1; 88.489 + 88.490 + ret = talloc_realloc(t, orig, char, olen + alenz); 88.491 + if (!ret) 88.492 + return NULL; 88.493 + 88.494 + /* append the string with the trailing \0 */ 88.495 + memcpy(&ret[olen], append, alenz); 88.496 + 88.497 + return ret; 88.498 +} 88.499 + 88.500 +/* 88.501 strndup with a talloc 88.502 */ 88.503 char *talloc_strndup(const void *t, const char *p, size_t n) 88.504 @@ -949,7 +1055,7 @@ char *talloc_strndup(const void *t, cons 88.505 size_t len; 88.506 char *ret; 88.507 88.508 - for (len=0; p[len] && len<n; len++) ; 88.509 + for (len=0; len<n && p[len]; len++) ; 88.510 88.511 ret = _talloc(t, len + 1); 88.512 if (!ret) { return NULL; } 88.513 @@ -974,10 +1080,14 @@ char *talloc_vasprintf(const void *t, co 88.514 int len; 88.515 char *ret; 88.516 va_list ap2; 88.517 + char c; 88.518 88.519 VA_COPY(ap2, ap); 88.520 88.521 - len = vsnprintf(NULL, 0, fmt, ap2); 88.522 + /* this call looks strange, but it makes it work on older solaris boxes */ 88.523 + if ((len = vsnprintf(&c, 1, fmt, ap2)) < 0) { 88.524 + return NULL; 88.525 + } 88.526 88.527 ret = _talloc(t, len+1); 88.528 if (ret) { 88.529 @@ -1029,7 +1139,15 @@ static char *talloc_vasprintf_append(cha 88.530 VA_COPY(ap2, ap); 88.531 88.532 s_len = tc->size - 1; 88.533 - len = vsnprintf(NULL, 0, fmt, ap2); 88.534 + if ((len = vsnprintf(NULL, 0, fmt, ap2)) <= 0) { 88.535 + /* Either the vsnprintf failed or the format resulted in 88.536 + * no characters being formatted. In the former case, we 88.537 + * ought to return NULL, in the latter we ought to return 88.538 + * the original string. Most current callers of this 88.539 + * function expect it to never return NULL. 88.540 + */ 88.541 + return s; 88.542 + } 88.543 88.544 s = talloc_realloc(NULL, s, char, s_len + len+1); 88.545 if (!s) return NULL; 88.546 @@ -1133,11 +1251,45 @@ size_t talloc_get_size(const void *conte 88.547 return tc->size; 88.548 } 88.549 88.550 -talloc_fail_handler *talloc_set_fail_handler(talloc_fail_handler *handler, 88.551 - void *data) 88.552 +/* 88.553 + find a parent of this context that has the given name, if any 88.554 +*/ 88.555 +void *talloc_find_parent_byname(const void *context, const char *name) 88.556 { 88.557 - talloc_fail_handler *old = malloc_fail_handler; 88.558 - malloc_fail_handler = handler; 88.559 - malloc_fail_data = data; 88.560 - return old; 88.561 + struct talloc_chunk *tc; 88.562 + 88.563 + if (context == NULL) { 88.564 + return NULL; 88.565 + } 88.566 + 88.567 + tc = talloc_chunk_from_ptr(context); 88.568 + while (tc) { 88.569 + if (tc->name && strcmp(tc->name, name) == 0) { 88.570 + return TC_PTR_FROM_CHUNK(tc); 88.571 + } 88.572 + while (tc && tc->prev) tc = tc->prev; 88.573 + tc = tc->parent; 88.574 + } 88.575 + return NULL; 88.576 } 88.577 + 88.578 +/* 88.579 + show the parentage of a context 88.580 +*/ 88.581 +void talloc_show_parents(const void *context, FILE *file) 88.582 +{ 88.583 + struct talloc_chunk *tc; 88.584 + 88.585 + if (context == NULL) { 88.586 + fprintf(file, "talloc no parents for NULL\n"); 88.587 + return; 88.588 + } 88.589 + 88.590 + tc = talloc_chunk_from_ptr(context); 88.591 + fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context)); 88.592 + while (tc) { 88.593 + fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc))); 88.594 + while (tc && tc->prev) tc = tc->prev; 88.595 + tc = tc->parent; 88.596 + } 88.597 +}
89.1 --- a/tools/xenstore/talloc.h Mon Mar 27 15:36:47 2006 -0700 89.2 +++ b/tools/xenstore/talloc.h Tue Mar 28 08:54:58 2006 -0700 89.3 @@ -6,19 +6,23 @@ 89.4 89.5 Copyright (C) Andrew Tridgell 2004-2005 89.6 89.7 - This program is free software; you can redistribute it and/or modify 89.8 - it under the terms of the GNU General Public License as published by 89.9 - the Free Software Foundation; either version 2 of the License, or 89.10 - (at your option) any later version. 89.11 + ** NOTE! The following LGPL license applies to the talloc 89.12 + ** library. This does NOT imply that all of Samba is released 89.13 + ** under the LGPL 89.14 89.15 - This program is distributed in the hope that it will be useful, 89.16 + This library is free software; you can redistribute it and/or 89.17 + modify it under the terms of the GNU Lesser General Public 89.18 + License as published by the Free Software Foundation; either 89.19 + version 2 of the License, or (at your option) any later version. 89.20 + 89.21 + This library is distributed in the hope that it will be useful, 89.22 but WITHOUT ANY WARRANTY; without even the implied warranty of 89.23 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 89.24 - GNU General Public License for more details. 89.25 - 89.26 - You should have received a copy of the GNU General Public License 89.27 - along with this program; if not, write to the Free Software 89.28 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 89.29 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 89.30 + Lesser General Public License for more details. 89.31 + 89.32 + You should have received a copy of the GNU Lesser General Public 89.33 + License along with this library; if not, write to the Free Software 89.34 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 89.35 */ 89.36 89.37 /* this is only needed for compatibility with the old talloc */ 89.38 @@ -58,13 +62,18 @@ typedef void TALLOC_CTX; 89.39 #define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count) 89.40 #define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count) 89.41 89.42 +#if 0 89.43 +/* Not correct for Samba3. */ 89.44 #define data_blob(ptr, size) data_blob_named(ptr, size, "DATA_BLOB: "__location__) 89.45 #define data_blob_talloc(ctx, ptr, size) data_blob_talloc_named(ctx, ptr, size, "DATA_BLOB: "__location__) 89.46 #define data_blob_dup_talloc(ctx, blob) data_blob_talloc_named(ctx, (blob)->data, (blob)->length, "DATA_BLOB: "__location__) 89.47 +#endif 89.48 89.49 #define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type) 89.50 #define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type) 89.51 89.52 +#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type) 89.53 + 89.54 89.55 #if TALLOC_DEPRECATED 89.56 #define talloc_zero_p(ctx, type) talloc_zero(ctx, type) 89.57 @@ -117,6 +126,7 @@ void *_talloc_zero(const void *ctx, size 89.58 void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); 89.59 char *talloc_strdup(const void *t, const char *p); 89.60 char *talloc_strndup(const void *t, const char *p, size_t n); 89.61 +char *talloc_append_string(const void *t, char *orig, const char *append); 89.62 char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); 89.63 char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); 89.64 char *talloc_asprintf_append(char *s, 89.65 @@ -127,8 +137,8 @@ void *_talloc_realloc_array(const void * 89.66 void *talloc_realloc_fn(const void *context, void *ptr, size_t size); 89.67 void *talloc_autofree_context(void); 89.68 size_t talloc_get_size(const void *ctx); 89.69 +void *talloc_find_parent_byname(const void *ctx, const char *name); 89.70 +void talloc_show_parents(const void *context, FILE *file); 89.71 89.72 -typedef int talloc_fail_handler(void *); 89.73 -talloc_fail_handler *talloc_set_fail_handler(talloc_fail_handler *, void *); 89.74 #endif 89.75
90.1 --- a/tools/xenstore/xenstored_core.c Mon Mar 27 15:36:47 2006 -0700 90.2 +++ b/tools/xenstore/xenstored_core.c Tue Mar 28 08:54:58 2006 -0700 90.3 @@ -1231,39 +1231,17 @@ static void process_message(struct conne 90.4 conn->transaction = NULL; 90.5 } 90.6 90.7 -static int out_of_mem(void *data) 90.8 -{ 90.9 - longjmp(*(jmp_buf *)data, 1); 90.10 -} 90.11 - 90.12 static void consider_message(struct connection *conn) 90.13 { 90.14 - jmp_buf talloc_fail; 90.15 - 90.16 if (verbose) 90.17 xprintf("Got message %s len %i from %p\n", 90.18 sockmsg_string(conn->in->hdr.msg.type), 90.19 conn->in->hdr.msg.len, conn); 90.20 90.21 - /* For simplicity, we kill the connection on OOM. */ 90.22 - talloc_set_fail_handler(out_of_mem, &talloc_fail); 90.23 - if (setjmp(talloc_fail)) { 90.24 - talloc_free(conn); 90.25 - goto end; 90.26 - } 90.27 - 90.28 process_message(conn, conn->in); 90.29 90.30 talloc_free(conn->in); 90.31 conn->in = new_buffer(conn); 90.32 - 90.33 -end: 90.34 - talloc_set_fail_handler(NULL, NULL); 90.35 - if (talloc_total_blocks(NULL) 90.36 - != talloc_total_blocks(talloc_autofree_context()) + 1) { 90.37 - talloc_report_full(NULL, stderr); 90.38 - abort(); 90.39 - } 90.40 } 90.41 90.42 /* Errors in reading or allocating here mean we get out of sync, so we
91.1 --- a/tools/xentrace/Makefile Mon Mar 27 15:36:47 2006 -0700 91.2 +++ b/tools/xentrace/Makefile Tue Mar 28 08:54:58 2006 -0700 91.3 @@ -6,7 +6,7 @@ INSTALL_DATA = $(INSTALL) -m0644 91.4 XEN_ROOT=../.. 91.5 include $(XEN_ROOT)/tools/Rules.mk 91.6 91.7 -CFLAGS += -Werror 91.8 +CFLAGS += -Werror -D_LARGEFILE64_SOURCE 91.9 91.10 CFLAGS += -I $(XEN_XC) 91.11 CFLAGS += -I $(XEN_LIBXC)
92.1 --- a/tools/xentrace/formats Mon Mar 27 15:36:47 2006 -0700 92.2 +++ b/tools/xentrace/formats Tue Mar 28 08:54:58 2006 -0700 92.3 @@ -16,6 +16,6 @@ 0x00080001 CPU%(cpu)d %(tsc)d VMX_ 92.4 0x00080002 CPU%(cpu)d %(tsc)d VMX_VECTOR [ domid = 0x%(1)08x, eip = 0x%(2)08x, vector = 0x%(3)08x ] 92.5 0x00080003 CPU%(cpu)d %(tsc)d VMX_INT [ domid = 0x%(1)08x, trap = 0x%(2)08x, va = 0x%(3)08x ] 92.6 92.7 -0x00090001 CPU%(cpu)d %(tsc)d VMENTRY 0x%(1)08x 0x%(2)08x 0x%(3)08x 0x%(4)08x 0x%(5)08x 92.8 -0x00090002 CPU%(cpu)d %(tsc)d VMEXIT 0x%(1)08x 0x%(2)08x 0x%(3)08x 92.9 +0x00081001 CPU%(cpu)d %(tsc)d VMEXIT 0x%(1)08x 0x%(2)08x 0x%(3)08x 92.10 +0x00081002 CPU%(cpu)d %(tsc)d VMENTRY 0x%(1)08x 0x%(2)08x 0x%(3)08x 0x%(4)08x 0x%(5)08x 92.11
93.1 --- a/tools/xentrace/xentrace.c Mon Mar 27 15:36:47 2006 -0700 93.2 +++ b/tools/xentrace/xentrace.c Tue Mar 28 08:54:58 2006 -0700 93.3 @@ -498,7 +498,7 @@ int main(int argc, char **argv) 93.4 } 93.5 93.6 if ( opts.outfile ) 93.7 - outfd = open(opts.outfile, O_WRONLY | O_CREAT); 93.8 + outfd = open(opts.outfile, O_WRONLY | O_CREAT | O_LARGEFILE, 0644); 93.9 93.10 if(outfd < 0) 93.11 {
94.1 --- a/tools/xm-test/lib/XmTestLib/Test.py Mon Mar 27 15:36:47 2006 -0700 94.2 +++ b/tools/xm-test/lib/XmTestLib/Test.py Tue Mar 28 08:54:58 2006 -0700 94.3 @@ -131,12 +131,12 @@ def becomeNonRoot(): 94.4 if os.geteuid() == 0: 94.5 FAIL("Could not become a non-root user") 94.6 94.7 -def FAIL(reason): 94.8 - print "\nREASON: %s" % reason 94.9 +def FAIL(format, *args): 94.10 + print "\nREASON:", (format % args) 94.11 sys.exit(TEST_FAIL) 94.12 94.13 -def SKIP(reason): 94.14 - print "\nREASON: %s" % reason 94.15 +def SKIP(format, *args): 94.16 + print "\nREASON:", (format % args) 94.17 sys.exit(TEST_SKIP) 94.18 94.19 def saveLog(logText, filename=None):
95.1 --- a/tools/xm-test/ramdisk/Makefile.am Mon Mar 27 15:36:47 2006 -0700 95.2 +++ b/tools/xm-test/ramdisk/Makefile.am Tue Mar 28 08:54:58 2006 -0700 95.3 @@ -1,3 +1,4 @@ 95.4 +INITRD ?= http://xm-test.xensource.com/ramdisks 95.5 95.6 EXTRA_DIST = skel configs patches 95.7 95.8 @@ -60,7 +61,7 @@ disk.img: existing 95.9 fi 95.10 95.11 existing: 95.12 - @if test -n "$(INITRD)"; then \ 95.13 + @if [ -n "$(INITRD)" ] && [ ! -f $(XMTEST_VER_IMG) ] ; then \ 95.14 wget $(INITRD)/$(XMTEST_VER_IMG); \ 95.15 fi 95.16 @if [ -f $(XMTEST_VER_IMG) ] ; then \
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 96.2 +++ b/tools/xm-test/ramdisk/README-XenSource-initrd-0.7-img Tue Mar 28 08:54:58 2006 -0700 96.3 @@ -0,0 +1,42 @@ 96.4 +XenSource xm-test 0.7 initrd.img 96.5 +================================ 96.6 + 96.7 +http://xm-test.xensource.com/ramdisks/initrd-0.7.img is an initrd suitable for 96.8 +use with Xen's xm-test regression testing suite. It has been built and 96.9 +provided by XenSource, for the convenience of Xen users. xm-test initrds may 96.10 +be mixed across minor xm-test versions, but not across major versions; this 96.11 +initrd is suitable for all 0.7.x versions of xm-test (as shipped with Xen 96.12 +3.0.x). 96.13 + 96.14 +In order to use this initrd, run "./autogen; ./configure; make existing" 96.15 +inside the xm-test directory, and the initrd will be downloaded automatically. 96.16 +Alternatively, if you have already downloaded this file, place it into the 96.17 +xm-test/ramdisk directory and run the same command. In either case, 96.18 +runtest.sh can then be used as normal. See xm-test/README for more details. 96.19 + 96.20 +This initrd was built using the infrastructure provided by xm-test. It is a 96.21 +full guest operating system and filesystem, and as such includes a large 96.22 +number of pieces of software. The source code for the majority of these are 96.23 +included in full inside the file 96.24 +http://xm-test.xensource.com/ramdisks/initrd.0.7.img-buildroot.tar.bz2, or 96.25 +alongside this file. Copyright statements and licences are contained therein. 96.26 +The remaining source code is included in the Xen distribution, at 96.27 +http://www.xensource.com/xen/downloads/archives.html. The configurations used 96.28 +for BusyBox, uClibc, and Buildroot are available as 96.29 +http://xm-test.xensource.com/ramdisks/initrd-0.7-busybox-config, 96.30 +http://xm-test.xensource.com/ramdisks/initrd-0.7-uClibc-config, and 96.31 +http://xm-test.xensource.com/ramdisks/initrd-0.7-buildroot-config 96.32 +respectively, or alongside this file. 96.33 + 96.34 +XenSource and the Xen contributors are grateful to the authors of these 96.35 +software packages for their contributions to free and open-source software. 96.36 + 96.37 + 96.38 +Buildroot and BusyBox are Copyright (c) Erik Andersen <andersen@codepoet.org>. 96.39 +BusyBox is licensed under the GNU General Public License (GPL). A copy of 96.40 +this license is available in the file GPL-2, 96.41 +http://xm-test.xensource.com/ramdisks/GPL-2, or alongside this file. 96.42 + 96.43 +uClibc is licensed under the GNU Lesser General Public License (LGPL). A copy 96.44 +of this license is available in the file 96.45 +http://xm-test.xensource.com/ramdisks/LGPL-2, or alongside this file.
97.1 --- a/tools/xm-test/tests/block-create/Makefile.am Mon Mar 27 15:36:47 2006 -0700 97.2 +++ b/tools/xm-test/tests/block-create/Makefile.am Tue Mar 28 08:54:58 2006 -0700 97.3 @@ -12,7 +12,7 @@ TESTS = 01_block_attach_device_pos.test 97.4 11_block_attach_shared_dom0.test \ 97.5 12_block_attach_shared_domU.test 97.6 97.7 -EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) 97.8 +EXTRA_DIST = $(TESTS) 97.9 97.10 TESTS_ENVIRONMENT=@TENV@ 97.11
98.1 --- a/tools/xm-test/tests/create/Makefile.am Mon Mar 27 15:36:47 2006 -0700 98.2 +++ b/tools/xm-test/tests/create/Makefile.am Tue Mar 28 08:54:58 2006 -0700 98.3 @@ -15,7 +15,7 @@ TESTS = 01_create_basic_pos.test \ 98.4 14_create_blockroot_pos.test \ 98.5 15_create_smallmem_pos.test 98.6 98.7 -EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) 98.8 +EXTRA_DIST = $(TESTS) 98.9 98.10 TESTS_ENVIRONMENT=@TENV@ 98.11
99.1 --- a/xen/arch/x86/dom0_ops.c Mon Mar 27 15:36:47 2006 -0700 99.2 +++ b/xen/arch/x86/dom0_ops.c Tue Mar 28 08:54:58 2006 -0700 99.3 @@ -460,8 +460,7 @@ void arch_getdomaininfo_ctxt( 99.4 99.5 if ( hvm_guest(v) ) 99.6 { 99.7 - hvm_store_cpu_guest_regs(v, &c->user_regs); 99.8 - hvm_store_cpu_guest_ctrl_regs(v, c->ctrlreg); 99.9 + hvm_store_cpu_guest_regs(v, &c->user_regs, c->ctrlreg); 99.10 } 99.11 else 99.12 {
100.1 --- a/xen/arch/x86/hvm/platform.c Mon Mar 27 15:36:47 2006 -0700 100.2 +++ b/xen/arch/x86/hvm/platform.c Tue Mar 28 08:54:58 2006 -0700 100.3 @@ -773,7 +773,7 @@ void handle_mmio(unsigned long va, unsig 100.4 mmio_opp = &v->arch.hvm_vcpu.mmio_op; 100.5 100.6 regs = mmio_opp->inst_decoder_regs; 100.7 - hvm_store_cpu_guest_regs(v, regs); 100.8 + hvm_store_cpu_guest_regs(v, regs, NULL); 100.9 100.10 if ((inst_len = hvm_instruction_length(v)) <= 0) { 100.11 printf("handle_mmio: failed to get instruction length\n");
101.1 --- a/xen/arch/x86/hvm/svm/intr.c Mon Mar 27 15:36:47 2006 -0700 101.2 +++ b/xen/arch/x86/hvm/svm/intr.c Tue Mar 28 08:54:58 2006 -0700 101.3 @@ -44,6 +44,58 @@ 101.4 */ 101.5 #define BSP_CPU(v) (!(v->vcpu_id)) 101.6 101.7 +u64 svm_get_guest_time(struct vcpu *v) 101.8 +{ 101.9 + struct hvm_virpit *vpit = &(v->domain->arch.hvm_domain.vpit); 101.10 + u64 host_tsc; 101.11 + 101.12 + rdtscll(host_tsc); 101.13 + return host_tsc + vpit->cache_tsc_offset; 101.14 +} 101.15 + 101.16 +void svm_set_guest_time(struct vcpu *v, u64 gtime) 101.17 +{ 101.18 + struct hvm_virpit *vpit = &(v->domain->arch.hvm_domain.vpit); 101.19 + u64 host_tsc; 101.20 + 101.21 + rdtscll(host_tsc); 101.22 + 101.23 + vpit->cache_tsc_offset = gtime - host_tsc; 101.24 + v->arch.hvm_svm.vmcb->tsc_offset = vpit->cache_tsc_offset; 101.25 +} 101.26 + 101.27 +static inline void 101.28 +interrupt_post_injection(struct vcpu * v, int vector, int type) 101.29 +{ 101.30 + struct hvm_virpit *vpit = &(v->domain->arch.hvm_domain.vpit); 101.31 + 101.32 + if ( is_pit_irq(v, vector, type) ) { 101.33 + if ( !vpit->first_injected ) { 101.34 + vpit->pending_intr_nr = 0; 101.35 + vpit->last_pit_gtime = svm_get_guest_time(v); 101.36 + vpit->scheduled = NOW() + vpit->period; 101.37 + set_timer(&vpit->pit_timer, vpit->scheduled); 101.38 + vpit->first_injected = 1; 101.39 + } else { 101.40 + vpit->pending_intr_nr--; 101.41 + } 101.42 + vpit->inject_point = NOW(); 101.43 + 101.44 + vpit->last_pit_gtime += vpit->period; 101.45 + svm_set_guest_time(v, vpit->last_pit_gtime); 101.46 + } 101.47 + 101.48 + switch(type) 101.49 + { 101.50 + case VLAPIC_DELIV_MODE_EXT: 101.51 + break; 101.52 + 101.53 + default: 101.54 + vlapic_post_injection(v, vector, type); 101.55 + break; 101.56 + } 101.57 +} 101.58 + 101.59 static inline int svm_inject_extint(struct vcpu *v, int trap, int error_code) 101.60 { 101.61 struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; 101.62 @@ -64,45 +116,6 @@ static inline int svm_inject_extint(stru 101.63 return 0; 101.64 } 101.65 101.66 -void svm_set_tsc_shift(struct vcpu *v, struct hvm_virpit *vpit) 101.67 -{ 101.68 - struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; 101.69 - u64 drift; 101.70 - 101.71 - if ( vpit->first_injected ) 101.72 - drift = vpit->period_cycles * vpit->pending_intr_nr; 101.73 - else 101.74 - drift = 0; 101.75 - vmcb->tsc_offset = ( 0 - drift ); 101.76 -} 101.77 - 101.78 -static inline void 101.79 -interrupt_post_injection(struct vcpu * v, int vector, int type) 101.80 -{ 101.81 - struct hvm_virpit *vpit = &(v->domain->arch.hvm_domain.vpit); 101.82 - 101.83 - if ( is_pit_irq(v, vector, type) ) { 101.84 - if ( !vpit->first_injected ) { 101.85 - vpit->first_injected = 1; 101.86 - vpit->pending_intr_nr = 0; 101.87 - } 101.88 - else if (vpit->pending_intr_nr) { 101.89 - --vpit->pending_intr_nr; 101.90 - } 101.91 - vpit->inject_point = NOW(); 101.92 - svm_set_tsc_shift (v, vpit); 101.93 - } 101.94 - 101.95 - switch(type) 101.96 - { 101.97 - case VLAPIC_DELIV_MODE_EXT: 101.98 - break; 101.99 - 101.100 - default: 101.101 - vlapic_post_injection(v, vector, type); 101.102 - } 101.103 -} 101.104 - 101.105 asmlinkage void svm_intr_assist(void) 101.106 { 101.107 struct vcpu *v = current;
102.1 --- a/xen/arch/x86/hvm/svm/svm.c Mon Mar 27 15:36:47 2006 -0700 102.2 +++ b/xen/arch/x86/hvm/svm/svm.c Tue Mar 28 08:54:58 2006 -0700 102.3 @@ -201,31 +201,41 @@ int svm_initialize_guest_resources(struc 102.4 } 102.5 102.6 static void svm_store_cpu_guest_regs( 102.7 - struct vcpu *v, struct cpu_user_regs *regs) 102.8 + struct vcpu *v, struct cpu_user_regs *regs, unsigned long *crs) 102.9 { 102.10 struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; 102.11 102.12 + if ( regs != NULL ) 102.13 + { 102.14 #if defined (__x86_64__) 102.15 - regs->rip = vmcb->rip; 102.16 - regs->rsp = vmcb->rsp; 102.17 - regs->rflags = vmcb->rflags; 102.18 - regs->cs = vmcb->cs.sel; 102.19 - regs->ds = vmcb->ds.sel; 102.20 - regs->es = vmcb->es.sel; 102.21 - regs->ss = vmcb->ss.sel; 102.22 - regs->gs = vmcb->gs.sel; 102.23 - regs->fs = vmcb->fs.sel; 102.24 + regs->rip = vmcb->rip; 102.25 + regs->rsp = vmcb->rsp; 102.26 + regs->rflags = vmcb->rflags; 102.27 + regs->cs = vmcb->cs.sel; 102.28 + regs->ds = vmcb->ds.sel; 102.29 + regs->es = vmcb->es.sel; 102.30 + regs->ss = vmcb->ss.sel; 102.31 + regs->gs = vmcb->gs.sel; 102.32 + regs->fs = vmcb->fs.sel; 102.33 #elif defined (__i386__) 102.34 - regs->eip = vmcb->rip; 102.35 - regs->esp = vmcb->rsp; 102.36 - regs->eflags = vmcb->rflags; 102.37 - regs->cs = vmcb->cs.sel; 102.38 - regs->ds = vmcb->ds.sel; 102.39 - regs->es = vmcb->es.sel; 102.40 - regs->ss = vmcb->ss.sel; 102.41 - regs->gs = vmcb->gs.sel; 102.42 - regs->fs = vmcb->fs.sel; 102.43 + regs->eip = vmcb->rip; 102.44 + regs->esp = vmcb->rsp; 102.45 + regs->eflags = vmcb->rflags; 102.46 + regs->cs = vmcb->cs.sel; 102.47 + regs->ds = vmcb->ds.sel; 102.48 + regs->es = vmcb->es.sel; 102.49 + regs->ss = vmcb->ss.sel; 102.50 + regs->gs = vmcb->gs.sel; 102.51 + regs->fs = vmcb->fs.sel; 102.52 #endif 102.53 + } 102.54 + 102.55 + if ( crs != NULL ) 102.56 + { 102.57 + crs[0] = vmcb->cr0; 102.58 + crs[3] = vmcb->cr3; 102.59 + crs[4] = vmcb->cr4; 102.60 + } 102.61 } 102.62 102.63 static void svm_load_cpu_guest_regs( 102.64 @@ -372,15 +382,6 @@ static inline int long_mode_do_msr_write 102.65 return 1; 102.66 } 102.67 102.68 -void svm_store_cpu_guest_ctrl_regs(struct vcpu *v, unsigned long crs[8]) 102.69 -{ 102.70 - struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; 102.71 - 102.72 - crs[0] = vmcb->cr0; 102.73 - crs[3] = vmcb->cr3; 102.74 - crs[4] = vmcb->cr4; 102.75 -} 102.76 - 102.77 void svm_modify_guest_state(struct vcpu *v) 102.78 { 102.79 svm_modify_vmcb(v, &v->arch.guest_context.user_regs); 102.80 @@ -448,7 +449,6 @@ int start_svm(void) 102.81 hvm_funcs.store_cpu_guest_regs = svm_store_cpu_guest_regs; 102.82 hvm_funcs.load_cpu_guest_regs = svm_load_cpu_guest_regs; 102.83 102.84 - hvm_funcs.store_cpu_guest_ctrl_regs = svm_store_cpu_guest_ctrl_regs; 102.85 hvm_funcs.modify_guest_state = svm_modify_guest_state; 102.86 102.87 hvm_funcs.realmode = svm_realmode; 102.88 @@ -670,8 +670,18 @@ static void arch_svm_do_launch(struct vc 102.89 reset_stack_and_jump(svm_asm_do_launch); 102.90 } 102.91 102.92 +static void svm_freeze_time(struct vcpu *v) 102.93 +{ 102.94 + struct hvm_virpit *vpit = &v->domain->arch.hvm_domain.vpit; 102.95 + 102.96 + v->domain->arch.hvm_domain.guest_time = svm_get_guest_time(v); 102.97 + if ( vpit->first_injected ) 102.98 + stop_timer(&(vpit->pit_timer)); 102.99 +} 102.100 + 102.101 static void svm_ctxt_switch_from(struct vcpu *v) 102.102 { 102.103 + svm_freeze_time(v); 102.104 } 102.105 102.106 static void svm_ctxt_switch_to(struct vcpu *v) 102.107 @@ -718,6 +728,8 @@ static void svm_relinquish_guest_resourc 102.108 102.109 for_each_vcpu ( d, v ) 102.110 { 102.111 + if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) ) 102.112 + continue; 102.113 #if 0 102.114 /* Memory leak by not freeing this. XXXKAF: *Why* is not per core?? */ 102.115 free_host_save_area(v->arch.hvm_svm.host_save_area); 102.116 @@ -911,7 +923,7 @@ static void svm_vmexit_do_cpuid(struct v 102.117 102.118 if (input == 1) 102.119 { 102.120 - if ( hvm_apic_support(v->domain) && 102.121 + if ( !hvm_apic_support(v->domain) || 102.122 !vlapic_global_enabled((VLAPIC(v))) ) 102.123 clear_bit(X86_FEATURE_APIC, &edx); 102.124 102.125 @@ -1251,11 +1263,6 @@ static void svm_io_instruction(struct vc 102.126 102.127 /* Need the original rip, here. */ 102.128 addr = svm_get_io_address(vmcb, regs, dir, real); 102.129 - /* 102.130 - * On SVM, the RIP of the intruction following the IN/OUT is saved in 102.131 - * ExitInfo2 102.132 - */ 102.133 - vmcb->rip = vmcb->exitinfo2; 102.134 102.135 /* "rep" prefix */ 102.136 if (info.fields.rep) 102.137 @@ -1288,6 +1295,8 @@ static void svm_io_instruction(struct vc 102.138 else 102.139 count = (addr & ~PAGE_MASK) / size; 102.140 } 102.141 + else 102.142 + vmcb->rip = vmcb->exitinfo2; 102.143 102.144 send_pio_req(regs, port, count, size, addr, dir, 1); 102.145 } 102.146 @@ -1693,7 +1702,7 @@ static inline void svm_do_msr_access(str 102.147 { 102.148 struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; 102.149 int inst_len; 102.150 - int64_t tsc_sum; 102.151 + u64 msr_content=0; 102.152 102.153 ASSERT(vmcb); 102.154 102.155 @@ -1708,24 +1717,27 @@ static inline void svm_do_msr_access(str 102.156 inst_len = __get_instruction_length(vmcb, INSTR_RDMSR, NULL); 102.157 102.158 regs->edx = 0; 102.159 - switch (regs->ecx) 102.160 + switch (regs->ecx) { 102.161 + case MSR_IA32_TIME_STAMP_COUNTER: 102.162 { 102.163 + struct hvm_virpit *vpit; 102.164 + 102.165 + rdtscll(msr_content); 102.166 + vpit = &(v->domain->arch.hvm_domain.vpit); 102.167 + msr_content += vpit->cache_tsc_offset; 102.168 + break; 102.169 + } 102.170 case MSR_IA32_SYSENTER_CS: 102.171 - regs->eax = vmcb->sysenter_cs; 102.172 + msr_content = vmcb->sysenter_cs; 102.173 break; 102.174 case MSR_IA32_SYSENTER_ESP: 102.175 - regs->eax = vmcb->sysenter_esp; 102.176 + msr_content = vmcb->sysenter_esp; 102.177 break; 102.178 case MSR_IA32_SYSENTER_EIP: 102.179 - regs->eax = vmcb->sysenter_eip; 102.180 + msr_content = vmcb->sysenter_eip; 102.181 break; 102.182 - case MSR_IA32_TIME_STAMP_COUNTER: 102.183 - __asm__ __volatile__("rdtsc" : "=a" (regs->eax), "=d" (regs->edx)); 102.184 - tsc_sum = regs->edx; 102.185 - tsc_sum = (tsc_sum << 32) + regs->eax; 102.186 - tsc_sum += (int64_t) vmcb->tsc_offset; 102.187 - regs->eax = tsc_sum & 0xFFFFFFFF; 102.188 - regs->edx = (tsc_sum >> 32) & 0xFFFFFFFF; 102.189 + case MSR_IA32_APICBASE: 102.190 + msr_content = VLAPIC(v) ? VLAPIC(v)->apic_base_msr : 0; 102.191 break; 102.192 default: 102.193 if (long_mode_do_msr_read(regs)) 102.194 @@ -1733,21 +1745,30 @@ static inline void svm_do_msr_access(str 102.195 rdmsr_safe(regs->ecx, regs->eax, regs->edx); 102.196 break; 102.197 } 102.198 + regs->eax = msr_content & 0xFFFFFFFF; 102.199 + regs->edx = msr_content >> 32; 102.200 } 102.201 else 102.202 { 102.203 inst_len = __get_instruction_length(vmcb, INSTR_WRMSR, NULL); 102.204 + msr_content = (regs->eax & 0xFFFFFFFF) | ((u64)regs->edx << 32); 102.205 102.206 switch (regs->ecx) 102.207 { 102.208 + case MSR_IA32_TIME_STAMP_COUNTER: 102.209 + svm_set_guest_time(v, msr_content); 102.210 + break; 102.211 case MSR_IA32_SYSENTER_CS: 102.212 - vmcb->sysenter_cs = regs->eax; 102.213 + vmcb->sysenter_cs = msr_content; 102.214 break; 102.215 case MSR_IA32_SYSENTER_ESP: 102.216 - vmcb->sysenter_esp = regs->eax; 102.217 + vmcb->sysenter_esp = msr_content; 102.218 break; 102.219 case MSR_IA32_SYSENTER_EIP: 102.220 - vmcb->sysenter_eip = regs->eax; 102.221 + vmcb->sysenter_eip = msr_content; 102.222 + break; 102.223 + case MSR_IA32_APICBASE: 102.224 + vlapic_msr_set(VLAPIC(v), msr_content); 102.225 break; 102.226 default: 102.227 long_mode_do_msr_write(regs);
103.1 --- a/xen/arch/x86/hvm/svm/vmcb.c Mon Mar 27 15:36:47 2006 -0700 103.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c Tue Mar 28 08:54:58 2006 -0700 103.3 @@ -123,7 +123,7 @@ static int construct_vmcb_controls(struc 103.4 GENERAL1_INTERCEPT_RDTSC | GENERAL1_INTERCEPT_PUSHF | 103.5 GENERAL1_INTERCEPT_SWINT | GENERAL1_INTERCEPT_POPF | 103.6 GENERAL1_INTERCEPT_IRET | GENERAL1_INTERCEPT_PAUSE | 103.7 - GENERAL1_INTERCEPT_TASK_SWITCH | GENERAL1_INTERCEPT_SMI 103.8 + GENERAL1_INTERCEPT_TASK_SWITCH 103.9 ); 103.10 103.11 /* turn on the general 2 intercepts */ 103.12 @@ -467,6 +467,8 @@ void svm_do_launch(struct vcpu *v) 103.13 v->arch.hvm_svm.injecting_event = 0; 103.14 v->arch.hvm_svm.saved_irq_vector = -1; 103.15 103.16 + svm_set_guest_time(v, 0); 103.17 + 103.18 if (svm_dbg_on) 103.19 svm_dump_vmcb(__func__, vmcb); 103.20 } 103.21 @@ -494,16 +496,17 @@ void svm_do_resume(struct vcpu *v) 103.22 struct hvm_virpit *vpit = &d->arch.hvm_domain.vpit; 103.23 103.24 svm_stts(v); 103.25 + 103.26 + /* pick up the elapsed PIT ticks and re-enable pit_timer */ 103.27 + if ( vpit->first_injected) { 103.28 + svm_set_guest_time(v, v->domain->arch.hvm_domain.guest_time); 103.29 + pickup_deactive_ticks(vpit); 103.30 + } 103.31 103.32 if ( test_bit(iopacket_port(v), &d->shared_info->evtchn_pending[0]) || 103.33 test_bit(ARCH_HVM_IO_WAIT, &v->arch.hvm_vcpu.ioflags) ) 103.34 hvm_wait_io(); 103.35 103.36 - /* pick up the elapsed PIT ticks and re-enable pit_timer */ 103.37 - if ( vpit->first_injected ) 103.38 - pickup_deactive_ticks(vpit); 103.39 - svm_set_tsc_shift(v, vpit); 103.40 - 103.41 /* We can't resume the guest if we're waiting on I/O */ 103.42 ASSERT(!test_bit(ARCH_HVM_IO_WAIT, &v->arch.hvm_vcpu.ioflags)); 103.43 }
104.1 --- a/xen/arch/x86/hvm/vmx/io.c Mon Mar 27 15:36:47 2006 -0700 104.2 +++ b/xen/arch/x86/hvm/vmx/io.c Tue Mar 28 08:54:58 2006 -0700 104.3 @@ -86,7 +86,7 @@ interrupt_post_injection(struct vcpu * v 104.4 } 104.5 vpit->inject_point = NOW(); 104.6 104.7 - vpit->last_pit_gtime += vpit->period; 104.8 + vpit->last_pit_gtime += vpit->period_cycles; 104.9 set_guest_time(v, vpit->last_pit_gtime); 104.10 } 104.11 104.12 @@ -206,8 +206,11 @@ void vmx_do_resume(struct vcpu *v) 104.13 vmx_stts(); 104.14 104.15 /* pick up the elapsed PIT ticks and re-enable pit_timer */ 104.16 - if ( vpit->first_injected) { 104.17 - set_guest_time(v, v->domain->arch.hvm_domain.guest_time); 104.18 + if ( vpit->first_injected ) { 104.19 + if ( v->domain->arch.hvm_domain.guest_time ) { 104.20 + set_guest_time(v, v->domain->arch.hvm_domain.guest_time); 104.21 + v->domain->arch.hvm_domain.guest_time = 0; 104.22 + } 104.23 pickup_deactive_ticks(vpit); 104.24 } 104.25
105.1 --- a/xen/arch/x86/hvm/vmx/vmx.c Mon Mar 27 15:36:47 2006 -0700 105.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Mar 28 08:54:58 2006 -0700 105.3 @@ -89,6 +89,8 @@ static void vmx_relinquish_guest_resourc 105.4 105.5 for_each_vcpu ( d, v ) 105.6 { 105.7 + if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) ) 105.8 + continue; 105.9 vmx_request_clear_vmcs(v); 105.10 destroy_vmcs(&v->arch.hvm_vmx); 105.11 free_monitor_pagetable(v); 105.12 @@ -358,9 +360,10 @@ static void vmx_freeze_time(struct vcpu 105.13 { 105.14 struct hvm_virpit *vpit = &v->domain->arch.hvm_domain.vpit; 105.15 105.16 - v->domain->arch.hvm_domain.guest_time = get_guest_time(v); 105.17 - if ( vpit->first_injected ) 105.18 + if ( vpit->first_injected && !v->domain->arch.hvm_domain.guest_time ) { 105.19 + v->domain->arch.hvm_domain.guest_time = get_guest_time(v); 105.20 stop_timer(&(vpit->pit_timer)); 105.21 + } 105.22 } 105.23 105.24 static void vmx_ctxt_switch_from(struct vcpu *v) 105.25 @@ -397,31 +400,81 @@ void vmx_migrate_timers(struct vcpu *v) 105.26 migrate_timer(&(VLAPIC(v)->vlapic_timer), v->processor); 105.27 } 105.28 105.29 -void vmx_store_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) 105.30 +struct vmx_store_cpu_guest_regs_callback_info { 105.31 + struct vcpu *v; 105.32 + struct cpu_user_regs *regs; 105.33 + unsigned long *crs; 105.34 +}; 105.35 + 105.36 +static void vmx_store_cpu_guest_regs( 105.37 + struct vcpu *v, struct cpu_user_regs *regs, unsigned long *crs); 105.38 + 105.39 +static void vmx_store_cpu_guest_regs_callback(void *data) 105.40 +{ 105.41 + struct vmx_store_cpu_guest_regs_callback_info *info = data; 105.42 + vmx_store_cpu_guest_regs(info->v, info->regs, info->crs); 105.43 +} 105.44 + 105.45 +static void vmx_store_cpu_guest_regs( 105.46 + struct vcpu *v, struct cpu_user_regs *regs, unsigned long *crs) 105.47 { 105.48 + if ( v != current ) 105.49 + { 105.50 + /* Non-current VCPUs must be paused to get a register snapshot. */ 105.51 + ASSERT(atomic_read(&v->pausecnt) != 0); 105.52 + 105.53 + if ( v->arch.hvm_vmx.launch_cpu != smp_processor_id() ) 105.54 + { 105.55 + /* Get register details from remote CPU. */ 105.56 + struct vmx_store_cpu_guest_regs_callback_info info = { 105.57 + .v = v, .regs = regs, .crs = crs }; 105.58 + cpumask_t cpumask = cpumask_of_cpu(v->arch.hvm_vmx.launch_cpu); 105.59 + on_selected_cpus(cpumask, vmx_store_cpu_guest_regs_callback, 105.60 + &info, 1, 1); 105.61 + return; 105.62 + } 105.63 + 105.64 + /* Register details are on this CPU. Load the correct VMCS. */ 105.65 + __vmptrld(virt_to_maddr(v->arch.hvm_vmx.vmcs)); 105.66 + } 105.67 + 105.68 + ASSERT(v->arch.hvm_vmx.launch_cpu == smp_processor_id()); 105.69 + 105.70 + if ( regs != NULL ) 105.71 + { 105.72 #if defined (__x86_64__) 105.73 - __vmread(GUEST_RFLAGS, ®s->rflags); 105.74 - __vmread(GUEST_SS_SELECTOR, ®s->ss); 105.75 - __vmread(GUEST_CS_SELECTOR, ®s->cs); 105.76 - __vmread(GUEST_DS_SELECTOR, ®s->ds); 105.77 - __vmread(GUEST_ES_SELECTOR, ®s->es); 105.78 - __vmread(GUEST_GS_SELECTOR, ®s->gs); 105.79 - __vmread(GUEST_FS_SELECTOR, ®s->fs); 105.80 - __vmread(GUEST_RIP, ®s->rip); 105.81 - __vmread(GUEST_RSP, ®s->rsp); 105.82 + __vmread(GUEST_RFLAGS, ®s->rflags); 105.83 + __vmread(GUEST_SS_SELECTOR, ®s->ss); 105.84 + __vmread(GUEST_CS_SELECTOR, ®s->cs); 105.85 + __vmread(GUEST_DS_SELECTOR, ®s->ds); 105.86 + __vmread(GUEST_ES_SELECTOR, ®s->es); 105.87 + __vmread(GUEST_GS_SELECTOR, ®s->gs); 105.88 + __vmread(GUEST_FS_SELECTOR, ®s->fs); 105.89 + __vmread(GUEST_RIP, ®s->rip); 105.90 + __vmread(GUEST_RSP, ®s->rsp); 105.91 #elif defined (__i386__) 105.92 - __vmread(GUEST_RFLAGS, ®s->eflags); 105.93 - __vmread(GUEST_SS_SELECTOR, ®s->ss); 105.94 - __vmread(GUEST_CS_SELECTOR, ®s->cs); 105.95 - __vmread(GUEST_DS_SELECTOR, ®s->ds); 105.96 - __vmread(GUEST_ES_SELECTOR, ®s->es); 105.97 - __vmread(GUEST_GS_SELECTOR, ®s->gs); 105.98 - __vmread(GUEST_FS_SELECTOR, ®s->fs); 105.99 - __vmread(GUEST_RIP, ®s->eip); 105.100 - __vmread(GUEST_RSP, ®s->esp); 105.101 -#else 105.102 -#error Unsupported architecture 105.103 + __vmread(GUEST_RFLAGS, ®s->eflags); 105.104 + __vmread(GUEST_SS_SELECTOR, ®s->ss); 105.105 + __vmread(GUEST_CS_SELECTOR, ®s->cs); 105.106 + __vmread(GUEST_DS_SELECTOR, ®s->ds); 105.107 + __vmread(GUEST_ES_SELECTOR, ®s->es); 105.108 + __vmread(GUEST_GS_SELECTOR, ®s->gs); 105.109 + __vmread(GUEST_FS_SELECTOR, ®s->fs); 105.110 + __vmread(GUEST_RIP, ®s->eip); 105.111 + __vmread(GUEST_RSP, ®s->esp); 105.112 #endif 105.113 + } 105.114 + 105.115 + if ( crs != NULL ) 105.116 + { 105.117 + __vmread(CR0_READ_SHADOW, &crs[0]); 105.118 + __vmread(GUEST_CR3, &crs[3]); 105.119 + __vmread(CR4_READ_SHADOW, &crs[4]); 105.120 + } 105.121 + 105.122 + /* Reload current VCPU's VMCS if it was temporarily unloaded. */ 105.123 + if ( (v != current) && hvm_guest(current) ) 105.124 + __vmptrld(virt_to_maddr(current->arch.hvm_vmx.vmcs)); 105.125 } 105.126 105.127 void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) 105.128 @@ -455,13 +508,6 @@ void vmx_load_cpu_guest_regs(struct vcpu 105.129 #endif 105.130 } 105.131 105.132 -void vmx_store_cpu_guest_ctrl_regs(struct vcpu *v, unsigned long crs[8]) 105.133 -{ 105.134 - __vmread(CR0_READ_SHADOW, &crs[0]); 105.135 - __vmread(GUEST_CR3, &crs[3]); 105.136 - __vmread(CR4_READ_SHADOW, &crs[4]); 105.137 -} 105.138 - 105.139 void vmx_modify_guest_state(struct vcpu *v) 105.140 { 105.141 modify_vmcs(&v->arch.hvm_vmx, &v->arch.guest_context.user_regs); 105.142 @@ -615,7 +661,6 @@ int start_vmx(void) 105.143 hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs; 105.144 hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs; 105.145 105.146 - hvm_funcs.store_cpu_guest_ctrl_regs = vmx_store_cpu_guest_ctrl_regs; 105.147 hvm_funcs.modify_guest_state = vmx_modify_guest_state; 105.148 105.149 hvm_funcs.realmode = vmx_realmode; 105.150 @@ -945,7 +990,7 @@ static void vmx_io_instruction(struct cp 105.151 port = (exit_qualification >> 16) & 0xFFFF; 105.152 else 105.153 port = regs->edx & 0xffff; 105.154 - TRACE_VMEXIT(2, port); 105.155 + TRACE_VMEXIT(1, port); 105.156 size = (exit_qualification & 7) + 1; 105.157 dir = test_bit(3, &exit_qualification); /* direction */ 105.158 105.159 @@ -1308,7 +1353,8 @@ static int vmx_set_cr0(unsigned long val 105.160 vm_entry_value |= VM_ENTRY_CONTROLS_IA32E_MODE; 105.161 __vmwrite(VM_ENTRY_CONTROLS, vm_entry_value); 105.162 105.163 - if ( !shadow_set_guest_paging_levels(v->domain, 4) ) { 105.164 + if ( !shadow_set_guest_paging_levels(v->domain, PAGING_L4) ) 105.165 + { 105.166 printk("Unsupported guest paging levels\n"); 105.167 domain_crash_synchronous(); /* need to take a clean path */ 105.168 } 105.169 @@ -1317,9 +1363,26 @@ static int vmx_set_cr0(unsigned long val 105.170 #endif /* __x86_64__ */ 105.171 { 105.172 #if CONFIG_PAGING_LEVELS >= 3 105.173 - if ( !shadow_set_guest_paging_levels(v->domain, 2) ) { 105.174 - printk("Unsupported guest paging levels\n"); 105.175 - domain_crash_synchronous(); /* need to take a clean path */ 105.176 + /* seems it's a 32-bit or 32-bit PAE guest */ 105.177 + 105.178 + if ( test_bit(VMX_CPU_STATE_PAE_ENABLED, 105.179 + &v->arch.hvm_vmx.cpu_state) ) 105.180 + { 105.181 + /* The guest enables PAE first and then it enables PG, it is 105.182 + * really a PAE guest */ 105.183 + if ( !shadow_set_guest_paging_levels(v->domain, PAGING_L3) ) 105.184 + { 105.185 + printk("Unsupported guest paging levels\n"); 105.186 + domain_crash_synchronous(); 105.187 + } 105.188 + } 105.189 + else 105.190 + { 105.191 + if ( !shadow_set_guest_paging_levels(v->domain, PAGING_L2) ) 105.192 + { 105.193 + printk("Unsupported guest paging levels\n"); 105.194 + domain_crash_synchronous(); /* need to take a clean path */ 105.195 + } 105.196 } 105.197 #endif 105.198 } 105.199 @@ -1399,6 +1462,12 @@ static int vmx_set_cr0(unsigned long val 105.200 return 0; /* do not update eip! */ 105.201 } 105.202 } 105.203 + else if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PE ) 105.204 + { 105.205 + /* we should take care of this kind of situation */ 105.206 + clear_all_shadow_status(v->domain); 105.207 + __vmwrite(GUEST_CR3, pagetable_get_paddr(v->domain->arch.phys_table)); 105.208 + } 105.209 105.210 return 1; 105.211 } 105.212 @@ -1528,11 +1597,11 @@ static int mov_to_cr(int gp, int cr, str 105.213 105.214 if ( vmx_pgbit_test(v) ) 105.215 { 105.216 - /* The guest is 32 bit. */ 105.217 + /* The guest is a 32-bit PAE guest. */ 105.218 #if CONFIG_PAGING_LEVELS >= 4 105.219 unsigned long mfn, old_base_mfn; 105.220 105.221 - if( !shadow_set_guest_paging_levels(v->domain, 3) ) 105.222 + if( !shadow_set_guest_paging_levels(v->domain, PAGING_L3) ) 105.223 { 105.224 printk("Unsupported guest paging levels\n"); 105.225 domain_crash_synchronous(); /* need to take a clean path */ 105.226 @@ -1572,12 +1641,31 @@ static int mov_to_cr(int gp, int cr, str 105.227 } 105.228 else 105.229 { 105.230 - /* The guest is 64 bit. */ 105.231 + /* The guest is a 64 bit or 32-bit PAE guest. */ 105.232 #if CONFIG_PAGING_LEVELS >= 4 105.233 - if ( !shadow_set_guest_paging_levels(v->domain, 4) ) 105.234 + if ( (v->domain->arch.ops != NULL) && 105.235 + v->domain->arch.ops->guest_paging_levels == PAGING_L2) 105.236 { 105.237 - printk("Unsupported guest paging levels\n"); 105.238 - domain_crash_synchronous(); /* need to take a clean path */ 105.239 + /* Seems the guest first enables PAE without enabling PG, 105.240 + * it must enable PG after that, and it is a 32-bit PAE 105.241 + * guest */ 105.242 + 105.243 + if ( !shadow_set_guest_paging_levels(v->domain, 105.244 + PAGING_L3) ) 105.245 + { 105.246 + printk("Unsupported guest paging levels\n"); 105.247 + /* need to take a clean path */ 105.248 + domain_crash_synchronous(); 105.249 + } 105.250 + } 105.251 + else 105.252 + { 105.253 + if ( !shadow_set_guest_paging_levels(v->domain, 105.254 + PAGING_L4) ) 105.255 + { 105.256 + printk("Unsupported guest paging levels\n"); 105.257 + domain_crash_synchronous(); 105.258 + } 105.259 } 105.260 #endif 105.261 } 105.262 @@ -1827,6 +1915,7 @@ static inline void vmx_vmexit_do_extint( 105.263 105.264 vector &= 0xff; 105.265 local_irq_disable(); 105.266 + TRACE_VMEXIT(1,vector); 105.267 105.268 switch(vector) { 105.269 case LOCAL_TIMER_VECTOR: 105.270 @@ -1956,7 +2045,6 @@ asmlinkage void vmx_vmexit_handler(struc 105.271 105.272 { 105.273 __vmread(GUEST_RIP, &eip); 105.274 - TRACE_3D(TRC_VMX_VMEXIT, v->domain->domain_id, eip, exit_reason); 105.275 TRACE_VMEXIT(0,exit_reason); 105.276 } 105.277 105.278 @@ -1980,7 +2068,6 @@ asmlinkage void vmx_vmexit_handler(struc 105.279 TRACE_VMEXIT(1,vector); 105.280 perfc_incra(cause_vector, vector); 105.281