ia64/xen-unstable

changeset 6420:630feabe7ed6

merge?
author cl349@firebug.cl.cam.ac.uk
date Wed Aug 24 22:24:10 2005 +0000 (2005-08-24)
parents b402e77aac46 be5c24f2709c
children 2f20c2fce2c5
files Config.mk linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/block.h linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/netback/Makefile linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py xen/arch/x86/cpu/amd.c xen/arch/x86/mm.c
line diff
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Wed Aug 24 22:22:11 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Wed Aug 24 22:24:10 2005 +0000
     2.3 @@ -674,10 +674,10 @@ CONFIG_EXT2_FS=y
     2.4  CONFIG_EXT2_FS_XATTR=y
     2.5  CONFIG_EXT2_FS_POSIX_ACL=y
     2.6  CONFIG_EXT2_FS_SECURITY=y
     2.7 -CONFIG_EXT3_FS=m
     2.8 +CONFIG_EXT3_FS=y
     2.9  CONFIG_EXT3_FS_XATTR=y
    2.10 -CONFIG_EXT3_FS_POSIX_ACL=y
    2.11 -CONFIG_EXT3_FS_SECURITY=y
    2.12 +# CONFIG_EXT3_FS_POSIX_ACL is not set
    2.13 +# CONFIG_EXT3_FS_SECURITY is not set
    2.14  CONFIG_JBD=m
    2.15  # CONFIG_JBD_DEBUG is not set
    2.16  CONFIG_FS_MBCACHE=y
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c	Wed Aug 24 22:22:11 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c	Wed Aug 24 22:24:10 2005 +0000
     4.3 @@ -128,8 +128,12 @@ static int __init init_syscall32(void)
     4.4  #endif
     4.5  	return 0;
     4.6  } 
     4.7 -	
     4.8 -__initcall(init_syscall32); 
     4.9 +
    4.10 +/*
    4.11 + * This must be done early in case we have an initrd containing 32-bit
    4.12 + * binaries (e.g., hotplug). This could be pushed upstream to arch/x86_64.
    4.13 + */	
    4.14 +core_initcall(init_syscall32); 
    4.15  
    4.16  /* May not be __init: called during resume */
    4.17  void syscall32_cpu_init(void)
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Wed Aug 24 22:22:11 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Wed Aug 24 22:24:10 2005 +0000
     5.3 @@ -43,7 +43,7 @@ ENTRY(_start)
     5.4          cld                
     5.5  	/* Copy the necessary stuff from xen_start_info structure. */
     5.6  	movq  $xen_start_info_union,%rdi
     5.7 -	movq  $64,%rcx          /* sizeof (union xen_start_info_union) / sizeof (long) */
     5.8 +	movq  $256,%rcx
     5.9  	rep movsq
    5.10  
    5.11  #ifdef CONFIG_SMP
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Aug 24 22:22:11 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Aug 24 22:24:10 2005 +0000
     7.3 @@ -428,8 +428,9 @@ static void __init contig_initmem_init(v
     7.4  {
     7.5          unsigned long bootmap_size = init_bootmem(start_pfn, end_pfn);
     7.6          free_bootmem(0, end_pfn << PAGE_SHIFT);   
     7.7 -        /* XXX KAF: Why can't we leave low 1MB of memory free? */
     7.8 -        reserve_bootmem(0, (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE-1));
     7.9 +        reserve_bootmem(HIGH_MEMORY,
    7.10 +                        (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE-1)
    7.11 +                        - HIGH_MEMORY);
    7.12  }
    7.13  #else
    7.14  static void __init contig_initmem_init(void)
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Wed Aug 24 22:22:11 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Wed Aug 24 22:24:10 2005 +0000
     8.3 @@ -441,6 +441,31 @@ static inline void __set_pte(pte_t *dst,
     8.4  	*dst = val;
     8.5  }
     8.6  
     8.7 +static inline int make_readonly(unsigned long paddr)
     8.8 +{
     8.9 +    int readonly = 0;
    8.10 +
    8.11 +    /* Make new page tables read-only. */
    8.12 +    if ((paddr < ((table_start << PAGE_SHIFT) + tables_space)) &&
    8.13 +        (paddr >= (table_start << PAGE_SHIFT)))
    8.14 +        readonly = 1;
    8.15 +
    8.16 +    /* Make old page tables read-only. */
    8.17 +    if ((paddr < ((xen_start_info.pt_base - __START_KERNEL_map) +
    8.18 +                  (xen_start_info.nr_pt_frames << PAGE_SHIFT))) &&
    8.19 +        (paddr >= (xen_start_info.pt_base - __START_KERNEL_map)))
    8.20 +        readonly = 1;
    8.21 +
    8.22 +    /*
    8.23 +     * No need for writable mapping of kernel image. This also ensures that
    8.24 +     * page and descriptor tables embedded inside don't have writable mappings.
    8.25 +     */
    8.26 +    if ((paddr >= __pa_symbol(&_text)) && (paddr < __pa_symbol(&_end)))
    8.27 +        readonly = 1;
    8.28 +
    8.29 +    return readonly;
    8.30 +}
    8.31 +
    8.32  void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
    8.33  { 
    8.34          long i, j, k; 
    8.35 @@ -477,9 +502,7 @@ void __init phys_pud_init(pud_t *pud, un
    8.36                          pte = alloc_low_page(&pte_phys);
    8.37                          pte_save = pte;
    8.38                          for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
    8.39 -                                if (paddr < (table_start << PAGE_SHIFT) 
    8.40 -                                    + tables_space)
    8.41 -                                {
    8.42 +                                if (make_readonly(paddr)) {
    8.43                                          __set_pte(pte, 
    8.44                                                  __pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
    8.45                                          continue;
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed Aug 24 22:22:11 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed Aug 24 22:24:10 2005 +0000
     9.3 @@ -57,26 +57,26 @@ static int blkback_remove(struct xenbus_
     9.4  /* Front end tells us frame. */
     9.5  static void frontend_changed(struct xenbus_watch *watch, const char *node)
     9.6  {
     9.7 -	unsigned long sharedmfn;
     9.8 +	unsigned long ring_ref;
     9.9  	unsigned int evtchn;
    9.10  	int err;
    9.11  	struct backend_info *be
    9.12  		= container_of(watch, struct backend_info, watch);
    9.13  
    9.14  	/* If other end is gone, delete ourself. */
    9.15 -	if (!xenbus_exists(be->frontpath, "")) {
    9.16 +	if (node && !xenbus_exists(be->frontpath, "")) {
    9.17  		xenbus_rm(be->dev->nodename, "");
    9.18  		device_unregister(&be->dev->dev);
    9.19  		return;
    9.20  	}
    9.21 -	if (be->blkif->status == CONNECTED)
    9.22 +	if (be->blkif == NULL || be->blkif->status == CONNECTED)
    9.23  		return;
    9.24  
    9.25 -	err = xenbus_gather(be->frontpath, "grant-id", "%lu", &sharedmfn,
    9.26 +	err = xenbus_gather(be->frontpath, "ring-ref", "%lu", &ring_ref,
    9.27  			    "event-channel", "%u", &evtchn, NULL);
    9.28  	if (err) {
    9.29  		xenbus_dev_error(be->dev, err,
    9.30 -				 "reading %s/grant-id and event-channel",
    9.31 +				 "reading %s/ring-ref and event-channel",
    9.32  				 be->frontpath);
    9.33  		return;
    9.34  	}
    9.35 @@ -113,11 +113,10 @@ static void frontend_changed(struct xenb
    9.36  	}
    9.37  
    9.38  	/* Map the shared frame, irq etc. */
    9.39 -	err = blkif_map(be->blkif, sharedmfn, evtchn);
    9.40 +	err = blkif_map(be->blkif, ring_ref, evtchn);
    9.41  	if (err) {
    9.42 -		xenbus_dev_error(be->dev, err,
    9.43 -				 "mapping shared-frame %lu port %u",
    9.44 -				 sharedmfn, evtchn);
    9.45 +		xenbus_dev_error(be->dev, err, "mapping ring-ref %lu port %u",
    9.46 +				 ring_ref, evtchn);
    9.47  		goto abort;
    9.48  	}
    9.49  
    9.50 @@ -139,62 +138,22 @@ static void backend_changed(struct xenbu
    9.51  {
    9.52  	int err;
    9.53  	char *p;
    9.54 -	char *frontend;
    9.55  	long int handle, pdev;
    9.56  	struct backend_info *be
    9.57  		= container_of(watch, struct backend_info, backend_watch);
    9.58  	struct xenbus_device *dev = be->dev;
    9.59  
    9.60 -	frontend = NULL;
    9.61 -	err = xenbus_gather(dev->nodename,
    9.62 -			    "frontend-id", "%li", &be->frontend_id,
    9.63 -			    "frontend", NULL, &frontend,
    9.64 -			    NULL);
    9.65 -	if (XENBUS_EXIST_ERR(err) ||
    9.66 -	    strlen(frontend) == 0 || !xenbus_exists(frontend, "")) {
    9.67 -		/* If we can't get a frontend path and a frontend-id,
    9.68 -		 * then our bus-id is no longer valid and we need to
    9.69 -		 * destroy the backend device.
    9.70 -		 */
    9.71 -		goto device_fail;
    9.72 -	}
    9.73 -	if (err < 0) {
    9.74 -		xenbus_dev_error(dev, err,
    9.75 -				 "reading %s/frontend or frontend-id",
    9.76 -				 dev->nodename);
    9.77 -		goto device_fail;
    9.78 -	}
    9.79 -
    9.80 -	if (!be->frontpath || strcmp(frontend, be->frontpath)) {
    9.81 -		if (be->watch.node)
    9.82 -			unregister_xenbus_watch(&be->watch);
    9.83 -		if (be->frontpath)
    9.84 -			kfree(be->frontpath);
    9.85 -		be->frontpath = frontend;
    9.86 -		frontend = NULL;
    9.87 -		be->watch.node = be->frontpath;
    9.88 -		be->watch.callback = frontend_changed;
    9.89 -		err = register_xenbus_watch(&be->watch);
    9.90 -		if (err) {
    9.91 -			be->watch.node = NULL;
    9.92 -			xenbus_dev_error(dev, err,
    9.93 -					 "adding frontend watch on %s",
    9.94 -					 be->frontpath);
    9.95 -			goto device_fail;
    9.96 -		}
    9.97 -	}
    9.98 -
    9.99  	err = xenbus_scanf(dev->nodename, "physical-device", "%li", &pdev);
   9.100  	if (XENBUS_EXIST_ERR(err))
   9.101 -		goto out;
   9.102 +		return;
   9.103  	if (err < 0) {
   9.104  		xenbus_dev_error(dev, err, "reading physical-device");
   9.105 -		goto device_fail;
   9.106 +		return;
   9.107  	}
   9.108  	if (be->pdev && be->pdev != pdev) {
   9.109  		printk(KERN_WARNING
   9.110  		       "changing physical-device not supported\n");
   9.111 -		goto device_fail;
   9.112 +		return;
   9.113  	}
   9.114  	be->pdev = pdev;
   9.115  
   9.116 @@ -215,32 +174,25 @@ static void backend_changed(struct xenbu
   9.117  			err = PTR_ERR(be->blkif);
   9.118  			be->blkif = NULL;
   9.119  			xenbus_dev_error(dev, err, "creating block interface");
   9.120 -			goto device_fail;
   9.121 +			return;
   9.122  		}
   9.123  
   9.124  		err = vbd_create(be->blkif, handle, be->pdev, be->readonly);
   9.125  		if (err) {
   9.126  			xenbus_dev_error(dev, err, "creating vbd structure");
   9.127 -			goto device_fail;
   9.128 +			return;
   9.129  		}
   9.130  
   9.131 -		frontend_changed(&be->watch, be->frontpath);
   9.132 +		/* Pass in NULL node to skip exist test. */
   9.133 +		frontend_changed(&be->watch, NULL);
   9.134  	}
   9.135 -
   9.136 - out:
   9.137 -	if (frontend)
   9.138 -		kfree(frontend);
   9.139 -	return;
   9.140 -
   9.141 - device_fail:
   9.142 -	device_unregister(&be->dev->dev);
   9.143 -	goto out;
   9.144  }
   9.145  
   9.146  static int blkback_probe(struct xenbus_device *dev,
   9.147  			 const struct xenbus_device_id *id)
   9.148  {
   9.149  	struct backend_info *be;
   9.150 +	char *frontend;
   9.151  	int err;
   9.152  
   9.153  	be = kmalloc(sizeof(*be), GFP_KERNEL);
   9.154 @@ -248,24 +200,63 @@ static int blkback_probe(struct xenbus_d
   9.155  		xenbus_dev_error(dev, -ENOMEM, "allocating backend structure");
   9.156  		return -ENOMEM;
   9.157  	}
   9.158 +	memset(be, 0, sizeof(*be));
   9.159  
   9.160 -	memset(be, 0, sizeof(*be));
   9.161 +	frontend = NULL;
   9.162 +	err = xenbus_gather(dev->nodename,
   9.163 +			    "frontend-id", "%li", &be->frontend_id,
   9.164 +			    "frontend", NULL, &frontend,
   9.165 +			    NULL);
   9.166 +	if (XENBUS_EXIST_ERR(err))
   9.167 +		goto free_be;
   9.168 +	if (err < 0) {
   9.169 +		xenbus_dev_error(dev, err,
   9.170 +				 "reading %s/frontend or frontend-id",
   9.171 +				 dev->nodename);
   9.172 +		goto free_be;
   9.173 +	}
   9.174 +	if (strlen(frontend) == 0 || !xenbus_exists(frontend, "")) {
   9.175 +		/* If we can't get a frontend path and a frontend-id,
   9.176 +		 * then our bus-id is no longer valid and we need to
   9.177 +		 * destroy the backend device.
   9.178 +		 */
   9.179 +		err = -ENOENT;
   9.180 +		goto free_be;
   9.181 +	}
   9.182  
   9.183  	be->dev = dev;
   9.184  	be->backend_watch.node = dev->nodename;
   9.185  	be->backend_watch.callback = backend_changed;
   9.186  	err = register_xenbus_watch(&be->backend_watch);
   9.187  	if (err) {
   9.188 +		be->backend_watch.node = NULL;
   9.189  		xenbus_dev_error(dev, err, "adding backend watch on %s",
   9.190  				 dev->nodename);
   9.191  		goto free_be;
   9.192  	}
   9.193  
   9.194 +	be->frontpath = frontend;
   9.195 +	be->watch.node = be->frontpath;
   9.196 +	be->watch.callback = frontend_changed;
   9.197 +	err = register_xenbus_watch(&be->watch);
   9.198 +	if (err) {
   9.199 +		be->watch.node = NULL;
   9.200 +		xenbus_dev_error(dev, err,
   9.201 +				 "adding frontend watch on %s",
   9.202 +				 be->frontpath);
   9.203 +		goto free_be;
   9.204 +	}
   9.205 +
   9.206  	dev->data = be;
   9.207  
   9.208  	backend_changed(&be->backend_watch, dev->nodename);
   9.209 -	return err;
   9.210 +	return 0;
   9.211 +
   9.212   free_be:
   9.213 +	if (be->backend_watch.node)
   9.214 +		unregister_xenbus_watch(&be->backend_watch);
   9.215 +	if (frontend)
   9.216 +		kfree(frontend);
   9.217  	kfree(be);
   9.218  	return err;
   9.219  }
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Aug 24 22:22:11 2005 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Aug 24 22:24:10 2005 +0000
    10.3 @@ -1124,12 +1124,12 @@ static int setup_blkring(struct xenbus_d
    10.4  		xenbus_dev_error(dev, err, "granting access to ring page");
    10.5  		return err;
    10.6  	}
    10.7 -	info->grant_id = err;
    10.8 +	info->ring_ref = err;
    10.9  
   10.10  	op.u.alloc_unbound.dom = info->backend_id;
   10.11  	err = HYPERVISOR_event_channel_op(&op);
   10.12  	if (err) {
   10.13 -		gnttab_end_foreign_access(info->grant_id, 0);
   10.14 +		gnttab_end_foreign_access(info->ring_ref, 0);
   10.15  		free_page((unsigned long)info->ring.sring);
   10.16  		info->ring.sring = 0;
   10.17  		xenbus_dev_error(dev, err, "allocating event channel");
   10.18 @@ -1177,9 +1177,9 @@ static int talk_to_backend(struct xenbus
   10.19  		goto destroy_blkring;
   10.20  	}
   10.21  
   10.22 -	err = xenbus_printf(dev->nodename, "grant-id","%u", info->grant_id);
   10.23 +	err = xenbus_printf(dev->nodename, "ring-ref","%u", info->ring_ref);
   10.24  	if (err) {
   10.25 -		message = "writing grant-id";
   10.26 +		message = "writing ring-ref";
   10.27  		goto abort_transaction;
   10.28  	}
   10.29  	err = xenbus_printf(dev->nodename,
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h	Wed Aug 24 22:22:11 2005 +0000
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h	Wed Aug 24 22:24:10 2005 +0000
    11.3 @@ -112,7 +112,7 @@ struct blkfront_info
    11.4  	int connected;
    11.5  	char *backend;
    11.6  	int backend_id;
    11.7 -	int grant_id;
    11.8 +	int ring_ref;
    11.9  	blkif_front_ring_t ring;
   11.10  	unsigned int evtchn;
   11.11  	struct xlbd_major_info *mi;
    17.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Aug 24 22:22:11 2005 +0000
    17.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Aug 24 22:24:10 2005 +0000
    17.3 @@ -201,7 +201,6 @@ static char *be_state_name[] = {
    17.4      [BEST_CONNECTED]    = "connected",
    17.5  };
    17.6  
    17.7 -#define DEBUG
    17.8  #ifdef DEBUG
    17.9  #define DPRINTK(fmt, args...) \
   17.10      printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
    18.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Aug 24 22:22:11 2005 +0000
    18.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Aug 24 22:24:10 2005 +0000
    18.3 @@ -639,7 +639,7 @@ static int __init xenbus_probe_init(void
    18.4  	bus_register(&xenbus_backend.bus);
    18.5  	device_register(&xenbus_frontend.dev);
    18.6  	device_register(&xenbus_backend.dev);
    18.7 -	
    18.8 +
    18.9  	if (!xen_start_info.store_evtchn)
   18.10  		return 0;
   18.11  
    19.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Wed Aug 24 22:22:11 2005 +0000
    19.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Wed Aug 24 22:24:10 2005 +0000
    19.3 @@ -8,23 +8,12 @@
    19.4  
    19.5  static char * __init machine_specific_memory_setup(void)
    19.6  {
    19.7 -	char *who;
    19.8 -	unsigned long start_pfn, max_pfn;
    19.9 -
   19.10 -	who = "Xen";
   19.11 -
   19.12 -	/* In dom0, we have to start the fake e820 map above the first
   19.13 -	 * 1MB, in other domains, it can start at 0. */
   19.14 -	if (xen_start_info.flags & SIF_INITDOMAIN)
   19.15 -		start_pfn = 0x100;
   19.16 -	else
   19.17 -		start_pfn = 0;
   19.18 -	max_pfn = xen_start_info.nr_pages;
   19.19 +	unsigned long max_pfn = xen_start_info.nr_pages;
   19.20  
   19.21  	e820.nr_map = 0;
   19.22 -	add_memory_region(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn) - PFN_PHYS(start_pfn), E820_RAM);
   19.23 +	add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
   19.24  
   19.25 -	return who;
   19.26 +	return "Xen";
   19.27  }
   19.28  
   19.29  void __init machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
    21.1 --- a/tools/python/xen/xm/main.py	Wed Aug 24 22:22:11 2005 +0000
    21.2 +++ b/tools/python/xen/xm/main.py	Wed Aug 24 22:24:10 2005 +0000
    21.3 @@ -666,7 +666,7 @@ def main(argv=sys.argv):
    21.4              sys.exit(1)
    21.5          except XendError, ex:
    21.6              if len(args) > 0:
    21.7 -                handle_xend_error(argv[1], args[0], ex)
    21.8 +                handle_xend_error(argv[1], args[1], ex)
    21.9              else:
   21.10                  print "Unexpected error:", sys.exc_info()[0]
   21.11                  print
    22.1 --- a/xen/arch/x86/cpu/amd.c	Wed Aug 24 22:22:11 2005 +0000
    22.2 +++ b/xen/arch/x86/cpu/amd.c	Wed Aug 24 22:24:10 2005 +0000
    22.3 @@ -9,6 +9,20 @@
    22.4  
    22.5  #include "cpu.h"
    22.6  
    22.7 +/*
    22.8 + * amd_flush_filter={on,off}. Forcibly Enable or disable the TLB flush
    22.9 + * filter on AMD 64-bit processors.
   22.10 + */
   22.11 +static int flush_filter_force;
   22.12 +static void flush_filter(char *s)
   22.13 +{
   22.14 +	if (!strcmp(s, "off"))
   22.15 +		flush_filter_force = -1;
   22.16 +	if (!strcmp(s, "on"))
   22.17 +		flush_filter_force = 1;
   22.18 +}
   22.19 +custom_param("amd_flush_filter", flush_filter);
   22.20 +
   22.21  #define num_physpages 0
   22.22  
   22.23  /*
   22.24 @@ -192,6 +206,21 @@ static void __init init_amd(struct cpuin
   22.25  		break;
   22.26  	}
   22.27  
   22.28 +	if (c->x86 == 15) {
   22.29 +		rdmsr(MSR_K7_HWCR, l, h);
   22.30 +		printk(KERN_INFO "CPU%d: AMD Flush Filter %sabled",
   22.31 +		       smp_processor_id(), (l & (1<<6)) ? "dis" : "en");
   22.32 +		if ((flush_filter_force > 0) && (l & (1<<6))) {
   22.33 +			l &= ~(1<<6);
   22.34 +			printk(" -> Forcibly enabled");
   22.35 +		} else if ((flush_filter_force < 0) && !(l & (1<<6))) {
   22.36 +			l |= 1<<6;
   22.37 +			printk(" -> Forcibly disabled");
   22.38 +		}
   22.39 +		wrmsr(MSR_K7_HWCR, l, h);
   22.40 +		printk("\n");
   22.41 +	}
   22.42 +
   22.43  	display_cacheinfo(c);
   22.44  
   22.45  	if (cpuid_eax(0x80000000) >= 0x80000008) {
    23.1 --- a/xen/arch/x86/mm.c	Wed Aug 24 22:22:11 2005 +0000
    23.2 +++ b/xen/arch/x86/mm.c	Wed Aug 24 22:24:10 2005 +0000
    23.3 @@ -1449,8 +1449,10 @@ int get_page_type(struct pfn_info *page,
    23.4                      if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
    23.5                           ((type & PGT_type_mask) != PGT_l1_page_table) )
    23.6                          MEM_LOG("Bad type (saw %" PRtype_info
    23.7 -                                "!= exp %" PRtype_info ") for pfn %lx",
    23.8 -                                x, type, page_to_pfn(page));
    23.9 +                                "!= exp %" PRtype_info ") "
   23.10 +                                "for mfn %lx (pfn %x)",
   23.11 +                                x, type, page_to_pfn(page),
   23.12 +                                machine_to_phys_mapping[page_to_pfn(page)]);
   23.13                      return 0;
   23.14                  }
   23.15                  else if ( (x & PGT_va_mask) == PGT_va_mutable )