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
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Wed Aug 24 22:22:11 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Wed Aug 24 22:24:10 2005 +0000
     1.3 @@ -674,10 +674,10 @@ CONFIG_EXT2_FS=y
     1.4  CONFIG_EXT2_FS_XATTR=y
     1.5  CONFIG_EXT2_FS_POSIX_ACL=y
     1.6  CONFIG_EXT2_FS_SECURITY=y
     1.7 -CONFIG_EXT3_FS=m
     1.8 +CONFIG_EXT3_FS=y
     1.9  CONFIG_EXT3_FS_XATTR=y
    1.10 -CONFIG_EXT3_FS_POSIX_ACL=y
    1.11 -CONFIG_EXT3_FS_SECURITY=y
    1.12 +# CONFIG_EXT3_FS_POSIX_ACL is not set
    1.13 +# CONFIG_EXT3_FS_SECURITY is not set
    1.14  CONFIG_JBD=m
    1.15  # CONFIG_JBD_DEBUG is not set
    1.16  CONFIG_FS_MBCACHE=y
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c	Wed Aug 24 22:22:11 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c	Wed Aug 24 22:24:10 2005 +0000
     2.3 @@ -128,8 +128,12 @@ static int __init init_syscall32(void)
     2.4  #endif
     2.5  	return 0;
     2.6  } 
     2.7 -	
     2.8 -__initcall(init_syscall32); 
     2.9 +
    2.10 +/*
    2.11 + * This must be done early in case we have an initrd containing 32-bit
    2.12 + * binaries (e.g., hotplug). This could be pushed upstream to arch/x86_64.
    2.13 + */	
    2.14 +core_initcall(init_syscall32); 
    2.15  
    2.16  /* May not be __init: called during resume */
    2.17  void syscall32_cpu_init(void)
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Wed Aug 24 22:22:11 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Wed Aug 24 22:24:10 2005 +0000
     3.3 @@ -43,7 +43,7 @@ ENTRY(_start)
     3.4          cld                
     3.5  	/* Copy the necessary stuff from xen_start_info structure. */
     3.6  	movq  $xen_start_info_union,%rdi
     3.7 -	movq  $64,%rcx          /* sizeof (union xen_start_info_union) / sizeof (long) */
     3.8 +	movq  $256,%rcx
     3.9  	rep movsq
    3.10  
    3.11  #ifdef CONFIG_SMP
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Aug 24 22:22:11 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Aug 24 22:24:10 2005 +0000
     4.3 @@ -428,8 +428,9 @@ static void __init contig_initmem_init(v
     4.4  {
     4.5          unsigned long bootmap_size = init_bootmem(start_pfn, end_pfn);
     4.6          free_bootmem(0, end_pfn << PAGE_SHIFT);   
     4.7 -        /* XXX KAF: Why can't we leave low 1MB of memory free? */
     4.8 -        reserve_bootmem(0, (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE-1));
     4.9 +        reserve_bootmem(HIGH_MEMORY,
    4.10 +                        (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE-1)
    4.11 +                        - HIGH_MEMORY);
    4.12  }
    4.13  #else
    4.14  static void __init contig_initmem_init(void)
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Wed Aug 24 22:22:11 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Wed Aug 24 22:24:10 2005 +0000
     5.3 @@ -441,6 +441,31 @@ static inline void __set_pte(pte_t *dst,
     5.4  	*dst = val;
     5.5  }
     5.6  
     5.7 +static inline int make_readonly(unsigned long paddr)
     5.8 +{
     5.9 +    int readonly = 0;
    5.10 +
    5.11 +    /* Make new page tables read-only. */
    5.12 +    if ((paddr < ((table_start << PAGE_SHIFT) + tables_space)) &&
    5.13 +        (paddr >= (table_start << PAGE_SHIFT)))
    5.14 +        readonly = 1;
    5.15 +
    5.16 +    /* Make old page tables read-only. */
    5.17 +    if ((paddr < ((xen_start_info.pt_base - __START_KERNEL_map) +
    5.18 +                  (xen_start_info.nr_pt_frames << PAGE_SHIFT))) &&
    5.19 +        (paddr >= (xen_start_info.pt_base - __START_KERNEL_map)))
    5.20 +        readonly = 1;
    5.21 +
    5.22 +    /*
    5.23 +     * No need for writable mapping of kernel image. This also ensures that
    5.24 +     * page and descriptor tables embedded inside don't have writable mappings.
    5.25 +     */
    5.26 +    if ((paddr >= __pa_symbol(&_text)) && (paddr < __pa_symbol(&_end)))
    5.27 +        readonly = 1;
    5.28 +
    5.29 +    return readonly;
    5.30 +}
    5.31 +
    5.32  void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
    5.33  { 
    5.34          long i, j, k; 
    5.35 @@ -477,9 +502,7 @@ void __init phys_pud_init(pud_t *pud, un
    5.36                          pte = alloc_low_page(&pte_phys);
    5.37                          pte_save = pte;
    5.38                          for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
    5.39 -                                if (paddr < (table_start << PAGE_SHIFT) 
    5.40 -                                    + tables_space)
    5.41 -                                {
    5.42 +                                if (make_readonly(paddr)) {
    5.43                                          __set_pte(pte, 
    5.44                                                  __pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
    5.45                                          continue;
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed Aug 24 22:22:11 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed Aug 24 22:24:10 2005 +0000
     6.3 @@ -57,26 +57,26 @@ static int blkback_remove(struct xenbus_
     6.4  /* Front end tells us frame. */
     6.5  static void frontend_changed(struct xenbus_watch *watch, const char *node)
     6.6  {
     6.7 -	unsigned long sharedmfn;
     6.8 +	unsigned long ring_ref;
     6.9  	unsigned int evtchn;
    6.10  	int err;
    6.11  	struct backend_info *be
    6.12  		= container_of(watch, struct backend_info, watch);
    6.13  
    6.14  	/* If other end is gone, delete ourself. */
    6.15 -	if (!xenbus_exists(be->frontpath, "")) {
    6.16 +	if (node && !xenbus_exists(be->frontpath, "")) {
    6.17  		xenbus_rm(be->dev->nodename, "");
    6.18  		device_unregister(&be->dev->dev);
    6.19  		return;
    6.20  	}
    6.21 -	if (be->blkif->status == CONNECTED)
    6.22 +	if (be->blkif == NULL || be->blkif->status == CONNECTED)
    6.23  		return;
    6.24  
    6.25 -	err = xenbus_gather(be->frontpath, "grant-id", "%lu", &sharedmfn,
    6.26 +	err = xenbus_gather(be->frontpath, "ring-ref", "%lu", &ring_ref,
    6.27  			    "event-channel", "%u", &evtchn, NULL);
    6.28  	if (err) {
    6.29  		xenbus_dev_error(be->dev, err,
    6.30 -				 "reading %s/grant-id and event-channel",
    6.31 +				 "reading %s/ring-ref and event-channel",
    6.32  				 be->frontpath);
    6.33  		return;
    6.34  	}
    6.35 @@ -113,11 +113,10 @@ static void frontend_changed(struct xenb
    6.36  	}
    6.37  
    6.38  	/* Map the shared frame, irq etc. */
    6.39 -	err = blkif_map(be->blkif, sharedmfn, evtchn);
    6.40 +	err = blkif_map(be->blkif, ring_ref, evtchn);
    6.41  	if (err) {
    6.42 -		xenbus_dev_error(be->dev, err,
    6.43 -				 "mapping shared-frame %lu port %u",
    6.44 -				 sharedmfn, evtchn);
    6.45 +		xenbus_dev_error(be->dev, err, "mapping ring-ref %lu port %u",
    6.46 +				 ring_ref, evtchn);
    6.47  		goto abort;
    6.48  	}
    6.49  
    6.50 @@ -139,62 +138,22 @@ static void backend_changed(struct xenbu
    6.51  {
    6.52  	int err;
    6.53  	char *p;
    6.54 -	char *frontend;
    6.55  	long int handle, pdev;
    6.56  	struct backend_info *be
    6.57  		= container_of(watch, struct backend_info, backend_watch);
    6.58  	struct xenbus_device *dev = be->dev;
    6.59  
    6.60 -	frontend = NULL;
    6.61 -	err = xenbus_gather(dev->nodename,
    6.62 -			    "frontend-id", "%li", &be->frontend_id,
    6.63 -			    "frontend", NULL, &frontend,
    6.64 -			    NULL);
    6.65 -	if (XENBUS_EXIST_ERR(err) ||
    6.66 -	    strlen(frontend) == 0 || !xenbus_exists(frontend, "")) {
    6.67 -		/* If we can't get a frontend path and a frontend-id,
    6.68 -		 * then our bus-id is no longer valid and we need to
    6.69 -		 * destroy the backend device.
    6.70 -		 */
    6.71 -		goto device_fail;
    6.72 -	}
    6.73 -	if (err < 0) {
    6.74 -		xenbus_dev_error(dev, err,
    6.75 -				 "reading %s/frontend or frontend-id",
    6.76 -				 dev->nodename);
    6.77 -		goto device_fail;
    6.78 -	}
    6.79 -
    6.80 -	if (!be->frontpath || strcmp(frontend, be->frontpath)) {
    6.81 -		if (be->watch.node)
    6.82 -			unregister_xenbus_watch(&be->watch);
    6.83 -		if (be->frontpath)
    6.84 -			kfree(be->frontpath);
    6.85 -		be->frontpath = frontend;
    6.86 -		frontend = NULL;
    6.87 -		be->watch.node = be->frontpath;
    6.88 -		be->watch.callback = frontend_changed;
    6.89 -		err = register_xenbus_watch(&be->watch);
    6.90 -		if (err) {
    6.91 -			be->watch.node = NULL;
    6.92 -			xenbus_dev_error(dev, err,
    6.93 -					 "adding frontend watch on %s",
    6.94 -					 be->frontpath);
    6.95 -			goto device_fail;
    6.96 -		}
    6.97 -	}
    6.98 -
    6.99  	err = xenbus_scanf(dev->nodename, "physical-device", "%li", &pdev);
   6.100  	if (XENBUS_EXIST_ERR(err))
   6.101 -		goto out;
   6.102 +		return;
   6.103  	if (err < 0) {
   6.104  		xenbus_dev_error(dev, err, "reading physical-device");
   6.105 -		goto device_fail;
   6.106 +		return;
   6.107  	}
   6.108  	if (be->pdev && be->pdev != pdev) {
   6.109  		printk(KERN_WARNING
   6.110  		       "changing physical-device not supported\n");
   6.111 -		goto device_fail;
   6.112 +		return;
   6.113  	}
   6.114  	be->pdev = pdev;
   6.115  
   6.116 @@ -215,32 +174,25 @@ static void backend_changed(struct xenbu
   6.117  			err = PTR_ERR(be->blkif);
   6.118  			be->blkif = NULL;
   6.119  			xenbus_dev_error(dev, err, "creating block interface");
   6.120 -			goto device_fail;
   6.121 +			return;
   6.122  		}
   6.123  
   6.124  		err = vbd_create(be->blkif, handle, be->pdev, be->readonly);
   6.125  		if (err) {
   6.126  			xenbus_dev_error(dev, err, "creating vbd structure");
   6.127 -			goto device_fail;
   6.128 +			return;
   6.129  		}
   6.130  
   6.131 -		frontend_changed(&be->watch, be->frontpath);
   6.132 +		/* Pass in NULL node to skip exist test. */
   6.133 +		frontend_changed(&be->watch, NULL);
   6.134  	}
   6.135 -
   6.136 - out:
   6.137 -	if (frontend)
   6.138 -		kfree(frontend);
   6.139 -	return;
   6.140 -
   6.141 - device_fail:
   6.142 -	device_unregister(&be->dev->dev);
   6.143 -	goto out;
   6.144  }
   6.145  
   6.146  static int blkback_probe(struct xenbus_device *dev,
   6.147  			 const struct xenbus_device_id *id)
   6.148  {
   6.149  	struct backend_info *be;
   6.150 +	char *frontend;
   6.151  	int err;
   6.152  
   6.153  	be = kmalloc(sizeof(*be), GFP_KERNEL);
   6.154 @@ -248,24 +200,63 @@ static int blkback_probe(struct xenbus_d
   6.155  		xenbus_dev_error(dev, -ENOMEM, "allocating backend structure");
   6.156  		return -ENOMEM;
   6.157  	}
   6.158 +	memset(be, 0, sizeof(*be));
   6.159  
   6.160 -	memset(be, 0, sizeof(*be));
   6.161 +	frontend = NULL;
   6.162 +	err = xenbus_gather(dev->nodename,
   6.163 +			    "frontend-id", "%li", &be->frontend_id,
   6.164 +			    "frontend", NULL, &frontend,
   6.165 +			    NULL);
   6.166 +	if (XENBUS_EXIST_ERR(err))
   6.167 +		goto free_be;
   6.168 +	if (err < 0) {
   6.169 +		xenbus_dev_error(dev, err,
   6.170 +				 "reading %s/frontend or frontend-id",
   6.171 +				 dev->nodename);
   6.172 +		goto free_be;
   6.173 +	}
   6.174 +	if (strlen(frontend) == 0 || !xenbus_exists(frontend, "")) {
   6.175 +		/* If we can't get a frontend path and a frontend-id,
   6.176 +		 * then our bus-id is no longer valid and we need to
   6.177 +		 * destroy the backend device.
   6.178 +		 */
   6.179 +		err = -ENOENT;
   6.180 +		goto free_be;
   6.181 +	}
   6.182  
   6.183  	be->dev = dev;
   6.184  	be->backend_watch.node = dev->nodename;
   6.185  	be->backend_watch.callback = backend_changed;
   6.186  	err = register_xenbus_watch(&be->backend_watch);
   6.187  	if (err) {
   6.188 +		be->backend_watch.node = NULL;
   6.189  		xenbus_dev_error(dev, err, "adding backend watch on %s",
   6.190  				 dev->nodename);
   6.191  		goto free_be;
   6.192  	}
   6.193  
   6.194 +	be->frontpath = frontend;
   6.195 +	be->watch.node = be->frontpath;
   6.196 +	be->watch.callback = frontend_changed;
   6.197 +	err = register_xenbus_watch(&be->watch);
   6.198 +	if (err) {
   6.199 +		be->watch.node = NULL;
   6.200 +		xenbus_dev_error(dev, err,
   6.201 +				 "adding frontend watch on %s",
   6.202 +				 be->frontpath);
   6.203 +		goto free_be;
   6.204 +	}
   6.205 +
   6.206  	dev->data = be;
   6.207  
   6.208  	backend_changed(&be->backend_watch, dev->nodename);
   6.209 -	return err;
   6.210 +	return 0;
   6.211 +
   6.212   free_be:
   6.213 +	if (be->backend_watch.node)
   6.214 +		unregister_xenbus_watch(&be->backend_watch);
   6.215 +	if (frontend)
   6.216 +		kfree(frontend);
   6.217  	kfree(be);
   6.218  	return err;
   6.219  }
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Aug 24 22:22:11 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Aug 24 22:24:10 2005 +0000
     7.3 @@ -1124,12 +1124,12 @@ static int setup_blkring(struct xenbus_d
     7.4  		xenbus_dev_error(dev, err, "granting access to ring page");
     7.5  		return err;
     7.6  	}
     7.7 -	info->grant_id = err;
     7.8 +	info->ring_ref = err;
     7.9  
    7.10  	op.u.alloc_unbound.dom = info->backend_id;
    7.11  	err = HYPERVISOR_event_channel_op(&op);
    7.12  	if (err) {
    7.13 -		gnttab_end_foreign_access(info->grant_id, 0);
    7.14 +		gnttab_end_foreign_access(info->ring_ref, 0);
    7.15  		free_page((unsigned long)info->ring.sring);
    7.16  		info->ring.sring = 0;
    7.17  		xenbus_dev_error(dev, err, "allocating event channel");
    7.18 @@ -1177,9 +1177,9 @@ static int talk_to_backend(struct xenbus
    7.19  		goto destroy_blkring;
    7.20  	}
    7.21  
    7.22 -	err = xenbus_printf(dev->nodename, "grant-id","%u", info->grant_id);
    7.23 +	err = xenbus_printf(dev->nodename, "ring-ref","%u", info->ring_ref);
    7.24  	if (err) {
    7.25 -		message = "writing grant-id";
    7.26 +		message = "writing ring-ref";
    7.27  		goto abort_transaction;
    7.28  	}
    7.29  	err = xenbus_printf(dev->nodename,
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h	Wed Aug 24 22:22:11 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h	Wed Aug 24 22:24:10 2005 +0000
     8.3 @@ -112,7 +112,7 @@ struct blkfront_info
     8.4  	int connected;
     8.5  	char *backend;
     8.6  	int backend_id;
     8.7 -	int grant_id;
     8.8 +	int ring_ref;
     8.9  	blkif_front_ring_t ring;
    8.10  	unsigned int evtchn;
    8.11  	struct xlbd_major_info *mi;
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Aug 24 22:22:11 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Aug 24 22:24:10 2005 +0000
     9.3 @@ -201,7 +201,6 @@ static char *be_state_name[] = {
     9.4      [BEST_CONNECTED]    = "connected",
     9.5  };
     9.6  
     9.7 -#define DEBUG
     9.8  #ifdef DEBUG
     9.9  #define DPRINTK(fmt, args...) \
    9.10      printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Aug 24 22:22:11 2005 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Aug 24 22:24:10 2005 +0000
    10.3 @@ -639,7 +639,7 @@ static int __init xenbus_probe_init(void
    10.4  	bus_register(&xenbus_backend.bus);
    10.5  	device_register(&xenbus_frontend.dev);
    10.6  	device_register(&xenbus_backend.dev);
    10.7 -	
    10.8 +
    10.9  	if (!xen_start_info.store_evtchn)
   10.10  		return 0;
   10.11  
    11.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
    11.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
    11.3 @@ -8,23 +8,12 @@
    11.4  
    11.5  static char * __init machine_specific_memory_setup(void)
    11.6  {
    11.7 -	char *who;
    11.8 -	unsigned long start_pfn, max_pfn;
    11.9 -
   11.10 -	who = "Xen";
   11.11 -
   11.12 -	/* In dom0, we have to start the fake e820 map above the first
   11.13 -	 * 1MB, in other domains, it can start at 0. */
   11.14 -	if (xen_start_info.flags & SIF_INITDOMAIN)
   11.15 -		start_pfn = 0x100;
   11.16 -	else
   11.17 -		start_pfn = 0;
   11.18 -	max_pfn = xen_start_info.nr_pages;
   11.19 +	unsigned long max_pfn = xen_start_info.nr_pages;
   11.20  
   11.21  	e820.nr_map = 0;
   11.22 -	add_memory_region(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn) - PFN_PHYS(start_pfn), E820_RAM);
   11.23 +	add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
   11.24  
   11.25 -	return who;
   11.26 +	return "Xen";
   11.27  }
   11.28  
   11.29  void __init machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
    12.1 --- a/tools/python/xen/xm/main.py	Wed Aug 24 22:22:11 2005 +0000
    12.2 +++ b/tools/python/xen/xm/main.py	Wed Aug 24 22:24:10 2005 +0000
    12.3 @@ -666,7 +666,7 @@ def main(argv=sys.argv):
    12.4              sys.exit(1)
    12.5          except XendError, ex:
    12.6              if len(args) > 0:
    12.7 -                handle_xend_error(argv[1], args[0], ex)
    12.8 +                handle_xend_error(argv[1], args[1], ex)
    12.9              else:
   12.10                  print "Unexpected error:", sys.exc_info()[0]
   12.11                  print
    13.1 --- a/xen/arch/x86/cpu/amd.c	Wed Aug 24 22:22:11 2005 +0000
    13.2 +++ b/xen/arch/x86/cpu/amd.c	Wed Aug 24 22:24:10 2005 +0000
    13.3 @@ -9,6 +9,20 @@
    13.4  
    13.5  #include "cpu.h"
    13.6  
    13.7 +/*
    13.8 + * amd_flush_filter={on,off}. Forcibly Enable or disable the TLB flush
    13.9 + * filter on AMD 64-bit processors.
   13.10 + */
   13.11 +static int flush_filter_force;
   13.12 +static void flush_filter(char *s)
   13.13 +{
   13.14 +	if (!strcmp(s, "off"))
   13.15 +		flush_filter_force = -1;
   13.16 +	if (!strcmp(s, "on"))
   13.17 +		flush_filter_force = 1;
   13.18 +}
   13.19 +custom_param("amd_flush_filter", flush_filter);
   13.20 +
   13.21  #define num_physpages 0
   13.22  
   13.23  /*
   13.24 @@ -192,6 +206,21 @@ static void __init init_amd(struct cpuin
   13.25  		break;
   13.26  	}
   13.27  
   13.28 +	if (c->x86 == 15) {
   13.29 +		rdmsr(MSR_K7_HWCR, l, h);
   13.30 +		printk(KERN_INFO "CPU%d: AMD Flush Filter %sabled",
   13.31 +		       smp_processor_id(), (l & (1<<6)) ? "dis" : "en");
   13.32 +		if ((flush_filter_force > 0) && (l & (1<<6))) {
   13.33 +			l &= ~(1<<6);
   13.34 +			printk(" -> Forcibly enabled");
   13.35 +		} else if ((flush_filter_force < 0) && !(l & (1<<6))) {
   13.36 +			l |= 1<<6;
   13.37 +			printk(" -> Forcibly disabled");
   13.38 +		}
   13.39 +		wrmsr(MSR_K7_HWCR, l, h);
   13.40 +		printk("\n");
   13.41 +	}
   13.42 +
   13.43  	display_cacheinfo(c);
   13.44  
   13.45  	if (cpuid_eax(0x80000000) >= 0x80000008) {
    14.1 --- a/xen/arch/x86/mm.c	Wed Aug 24 22:22:11 2005 +0000
    14.2 +++ b/xen/arch/x86/mm.c	Wed Aug 24 22:24:10 2005 +0000
    14.3 @@ -1449,8 +1449,10 @@ int get_page_type(struct pfn_info *page,
    14.4                      if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
    14.5                           ((type & PGT_type_mask) != PGT_l1_page_table) )
    14.6                          MEM_LOG("Bad type (saw %" PRtype_info
    14.7 -                                "!= exp %" PRtype_info ") for pfn %lx",
    14.8 -                                x, type, page_to_pfn(page));
    14.9 +                                "!= exp %" PRtype_info ") "
   14.10 +                                "for mfn %lx (pfn %x)",
   14.11 +                                x, type, page_to_pfn(page),
   14.12 +                                machine_to_phys_mapping[page_to_pfn(page)]);
   14.13                      return 0;
   14.14                  }
   14.15                  else if ( (x & PGT_va_mask) == PGT_va_mutable )