direct-io.hg

changeset 3201:2e64fe4ea360

bitkeeper revision 1.1159.183.30 (41ab4536IueE3ZCgGZUr5ralwtj52A)

Merge scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
author kaf24@scramble.cl.cam.ac.uk
date Mon Nov 29 15:50:14 2004 +0000 (2004-11-29)
parents a31bdfb8d4ea 842780fc6584
children c23dd7ec1f54 004841e0659d
files .rootkeys linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.9-xen-sparse/arch/xen/i386/Kconfig linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/Makefile linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h netbsd-2.0-xen-sparse/nbconfig-xen netbsd-2.0-xen-sparse/nbmake-xen xen/arch/x86/dom0_ops.c xen/include/public/dom0_ops.h
line diff
     1.1 --- a/.rootkeys	Mon Nov 29 10:10:30 2004 +0000
     1.2 +++ b/.rootkeys	Mon Nov 29 15:50:14 2004 +0000
     1.3 @@ -138,6 +138,8 @@ 40f56238u2CJdXNpjsZgHBxeVyY-2g linux-2.6
     1.4  40f56238eczveJ86k_4hNxCLRQIF-g linux-2.6.9-xen-sparse/arch/xen/i386/kernel/Makefile
     1.5  40f56238rXVTJQKbBuXXLH52qEArcg linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/Makefile
     1.6  40f562385s4lr6Zg92gExe7UQ4A76Q linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/common.c
     1.7 +41ab440bnpxZdWShZrGgM9pPaz5rmA linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile
     1.8 +41ab440bBKWz-aEOEojU4PAMXe3Ppg linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c
     1.9  40f56238XDtHSijkAFlbv1PT8Bhw_Q linux-2.6.9-xen-sparse/arch/xen/i386/kernel/entry.S
    1.10  40f56238bnvciAuyzAiMkdzGErYt1A linux-2.6.9-xen-sparse/arch/xen/i386/kernel/head.S
    1.11  40f58a0d31M2EkuPbG94ns_nOi0PVA linux-2.6.9-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Mon Nov 29 10:10:30 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Mon Nov 29 15:50:14 2004 +0000
     2.3 @@ -112,6 +112,7 @@ CONFIG_X86_CPUID=y
     2.4  # CONFIG_EDD is not set
     2.5  CONFIG_NOHIGHMEM=y
     2.6  # CONFIG_HIGHMEM4G is not set
     2.7 +CONFIG_MTRR=y
     2.8  CONFIG_HAVE_DEC_LOCK=y
     2.9  # CONFIG_REGPARM is not set
    2.10  
     3.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/Kconfig	Mon Nov 29 10:10:30 2004 +0000
     3.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/Kconfig	Mon Nov 29 15:50:14 2004 +0000
     3.3 @@ -564,6 +564,11 @@ config HAVE_ARCH_BOOTMEM_NODE
     3.4  #	  low memory.  Setting this option will put user-space page table
     3.5  #	  entries in high memory.
     3.6  
     3.7 +config MTRR
     3.8 +	bool
     3.9 +	depends on XEN_PRIVILEGED_GUEST
    3.10 +	default y
    3.11 +
    3.12  #config MTRR
    3.13  #	 bool "MTRR (Memory Type Range Register) support"
    3.14  #	 ---help---
     4.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/Makefile	Mon Nov 29 10:10:30 2004 +0000
     4.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/Makefile	Mon Nov 29 15:50:14 2004 +0000
     4.3 @@ -18,7 +18,7 @@ c-obj-y	+=	umc.o
     4.4  
     4.5  #obj-$(CONFIG_X86_MCE)	+=	../../../../i386/kernel/cpu/mcheck/
     4.6  
     4.7 -#obj-$(CONFIG_MTRR)	+= 	../../../../i386/kernel/cpu/mtrr/
     4.8 +obj-$(CONFIG_MTRR)	+= 	mtrr/
     4.9  #obj-$(CONFIG_CPU_FREQ)	+=	../../../../i386/kernel/cpu/cpufreq/
    4.10  
    4.11  c-link	:=
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile	Mon Nov 29 15:50:14 2004 +0000
     5.3 @@ -0,0 +1,16 @@
     5.4 +obj-y	:= main.o
     5.5 +c-obj-y	:= if.o
     5.6 +
     5.7 +c-link	:=
     5.8 +
     5.9 +$(patsubst %.o,$(obj)/%.c,$(c-obj-y) $(c-link)): $(obj)/mtrr.h
    5.10 +	@ln -fsn $(srctree)/arch/i386/kernel/cpu/mtrr/$(notdir $@) $@
    5.11 +
    5.12 +$(patsubst %.o,$(obj)/%.c,$(obj-y)): $(obj)/mtrr.h
    5.13 +
    5.14 +$(obj)/mtrr.h:
    5.15 +	@ln -fsn $(srctree)/arch/i386/kernel/cpu/mtrr/mtrr.h $@
    5.16 +
    5.17 +obj-y	+= $(c-obj-y)
    5.18 +
    5.19 +clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link))
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c	Mon Nov 29 15:50:14 2004 +0000
     6.3 @@ -0,0 +1,165 @@
     6.4 +#include <linux/init.h>
     6.5 +#include <linux/proc_fs.h>
     6.6 +#include <linux/ctype.h>
     6.7 +#include <linux/module.h>
     6.8 +#include <linux/seq_file.h>
     6.9 +#include <asm/uaccess.h>
    6.10 +
    6.11 +#include <asm/mtrr.h>
    6.12 +#include "mtrr.h"
    6.13 +
    6.14 +void generic_get_mtrr(unsigned int reg, unsigned long *base,
    6.15 +		      unsigned int *size, mtrr_type * type)
    6.16 +{
    6.17 +	dom0_op_t op;
    6.18 +
    6.19 +	op.cmd = DOM0_READ_MEMTYPE;
    6.20 +	op.u.read_memtype.reg = reg;
    6.21 +	(void)HYPERVISOR_dom0_op(&op);
    6.22 +
    6.23 +	*size = op.u.read_memtype.nr_pfns;
    6.24 +	*base = op.u.read_memtype.pfn;
    6.25 +	*type = op.u.read_memtype.type;
    6.26 +}
    6.27 +
    6.28 +struct mtrr_ops generic_mtrr_ops = {
    6.29 +	.use_intel_if      = 1,
    6.30 +	.get               = generic_get_mtrr,
    6.31 +};
    6.32 +
    6.33 +struct mtrr_ops *mtrr_if = &generic_mtrr_ops;
    6.34 +unsigned int num_var_ranges;
    6.35 +unsigned int *usage_table;
    6.36 +
    6.37 +void __init set_num_var_ranges(void)
    6.38 +{
    6.39 +	dom0_op_t op;
    6.40 +
    6.41 +	for (num_var_ranges = 0; ; num_var_ranges++) {
    6.42 +		op.cmd = DOM0_READ_MEMTYPE;
    6.43 +		op.u.read_memtype.reg = num_var_ranges;
    6.44 +		if (HYPERVISOR_dom0_op(&op) != 0)
    6.45 +			break;
    6.46 +	}
    6.47 +}
    6.48 +
    6.49 +static void __init init_table(void)
    6.50 +{
    6.51 +	int i, max;
    6.52 +
    6.53 +	max = num_var_ranges;
    6.54 +	if ((usage_table = kmalloc(max * sizeof *usage_table, GFP_KERNEL))
    6.55 +	    == NULL) {
    6.56 +		printk(KERN_ERR "mtrr: could not allocate\n");
    6.57 +		return;
    6.58 +	}
    6.59 +	for (i = 0; i < max; i++)
    6.60 +		usage_table[i] = 0;
    6.61 +}
    6.62 +
    6.63 +int mtrr_add_page(unsigned long base, unsigned long size, 
    6.64 +		  unsigned int type, char increment)
    6.65 +{
    6.66 +	int error;
    6.67 +	dom0_op_t op;
    6.68 +
    6.69 +	op.cmd = DOM0_ADD_MEMTYPE;
    6.70 +	op.u.add_memtype.pfn     = base;
    6.71 +	op.u.add_memtype.nr_pfns = size;
    6.72 +	op.u.add_memtype.type    = type;
    6.73 +	if ((error = HYPERVISOR_dom0_op(&op)))
    6.74 +		return error;
    6.75 +
    6.76 +	if (increment)
    6.77 +		++usage_table[op.u.add_memtype.reg];
    6.78 +
    6.79 +	return op.u.add_memtype.reg;
    6.80 +}
    6.81 +
    6.82 +int
    6.83 +mtrr_add(unsigned long base, unsigned long size, unsigned int type,
    6.84 +	 char increment)
    6.85 +{
    6.86 +	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
    6.87 +		printk(KERN_WARNING "mtrr: size and base must be multiples of 4 kiB\n");
    6.88 +		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
    6.89 +		return -EINVAL;
    6.90 +	}
    6.91 +	return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
    6.92 +			     increment);
    6.93 +}
    6.94 +
    6.95 +int mtrr_del_page(int reg, unsigned long base, unsigned long size)
    6.96 +{
    6.97 +	int i, max;
    6.98 +	mtrr_type ltype;
    6.99 +	unsigned long lbase;
   6.100 +	unsigned int lsize;
   6.101 +	int error = -EINVAL;
   6.102 +	dom0_op_t op;
   6.103 +
   6.104 +	max = num_var_ranges;
   6.105 +	if (reg < 0) {
   6.106 +		/*  Search for existing MTRR  */
   6.107 +		for (i = 0; i < max; ++i) {
   6.108 +			mtrr_if->get(i, &lbase, &lsize, &ltype);
   6.109 +			if (lbase == base && lsize == size) {
   6.110 +				reg = i;
   6.111 +				break;
   6.112 +			}
   6.113 +		}
   6.114 +		if (reg < 0) {
   6.115 +			printk(KERN_DEBUG "mtrr: no MTRR for %lx000,%lx000 found\n", base,
   6.116 +			       size);
   6.117 +			goto out;
   6.118 +		}
   6.119 +	}
   6.120 +	if (usage_table[reg] < 1) {
   6.121 +		printk(KERN_WARNING "mtrr: reg: %d has count=0\n", reg);
   6.122 +		goto out;
   6.123 +	}
   6.124 +	if (--usage_table[reg] < 1) {
   6.125 +		op.cmd = DOM0_DEL_MEMTYPE;
   6.126 +		op.u.del_memtype.handle = 0;
   6.127 +		op.u.add_memtype.reg    = reg;
   6.128 +		(void)HYPERVISOR_dom0_op(&op);
   6.129 +	}
   6.130 +	error = reg;
   6.131 + out:
   6.132 +	return error;
   6.133 +}
   6.134 +
   6.135 +int
   6.136 +mtrr_del(int reg, unsigned long base, unsigned long size)
   6.137 +{
   6.138 +	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
   6.139 +		printk(KERN_INFO "mtrr: size and base must be multiples of 4 kiB\n");
   6.140 +		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
   6.141 +		return -EINVAL;
   6.142 +	}
   6.143 +	return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
   6.144 +}
   6.145 +
   6.146 +EXPORT_SYMBOL(mtrr_add);
   6.147 +EXPORT_SYMBOL(mtrr_del);
   6.148 +
   6.149 +static int __init mtrr_init(void)
   6.150 +{
   6.151 +	struct cpuinfo_x86 *c = &boot_cpu_data;
   6.152 +
   6.153 +	if (!(xen_start_info.flags & SIF_PRIVILEGED))
   6.154 +		return -ENODEV;
   6.155 +
   6.156 +	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
   6.157 +	    (!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
   6.158 +	    (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
   6.159 +	    (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
   6.160 +		return -ENODEV;
   6.161 +
   6.162 +	set_num_var_ranges();
   6.163 +	init_table();
   6.164 +
   6.165 +	return 0;
   6.166 +}
   6.167 +
   6.168 +subsys_initcall(mtrr_init);
     7.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c	Mon Nov 29 10:10:30 2004 +0000
     7.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c	Mon Nov 29 15:50:14 2004 +0000
     7.3 @@ -154,11 +154,13 @@ void __iomem * __ioremap(unsigned long p
     7.4  	if (!size || last_addr < phys_addr)
     7.5  		return NULL;
     7.6  
     7.7 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     7.8  	/*
     7.9  	 * Don't remap the low PCI/ISA area, it's always mapped..
    7.10  	 */
    7.11  	if (phys_addr >= 0x0 && last_addr < 0x100000)
    7.12  		return isa_bus_to_virt(phys_addr);
    7.13 +#endif
    7.14  
    7.15  	/*
    7.16  	 * Don't allow anybody to remap normal RAM that we're using..
    7.17 @@ -287,11 +289,13 @@ void __init *bt_ioremap(unsigned long ph
    7.18  	if (!size || last_addr < phys_addr)
    7.19  		return NULL;
    7.20  
    7.21 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
    7.22  	/*
    7.23  	 * Don't remap the low PCI/ISA area, it's always mapped..
    7.24  	 */
    7.25  	if (phys_addr >= 0x0 && last_addr < 0x100000)
    7.26  		return isa_bus_to_virt(phys_addr);
    7.27 +#endif
    7.28  
    7.29  	/*
    7.30  	 * Mappings have to be page-aligned
     8.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Mon Nov 29 10:10:30 2004 +0000
     8.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Mon Nov 29 15:50:14 2004 +0000
     8.3 @@ -28,8 +28,9 @@ void __init machine_specific_modify_cpu_
     8.4  	clear_bit(X86_FEATURE_DE, c->x86_capability);
     8.5  	clear_bit(X86_FEATURE_PSE, c->x86_capability);
     8.6  	clear_bit(X86_FEATURE_PGE, c->x86_capability);
     8.7 -	clear_bit(X86_FEATURE_MTRR, c->x86_capability);
     8.8  	clear_bit(X86_FEATURE_FXSR, c->x86_capability);
     8.9 +	if (!(xen_start_info.flags & SIF_PRIVILEGED))
    8.10 +		clear_bit(X86_FEATURE_MTRR, c->x86_capability);
    8.11  }
    8.12  
    8.13  extern void hypervisor_callback(void);
     9.1 --- a/netbsd-2.0-xen-sparse/nbconfig-xen	Mon Nov 29 10:10:30 2004 +0000
     9.2 +++ b/netbsd-2.0-xen-sparse/nbconfig-xen	Mon Nov 29 15:50:14 2004 +0000
     9.3 @@ -2,11 +2,17 @@
     9.4  #
     9.5  
     9.6  : ${HOS:=$(uname -s | tr /A-Z/ /a-z/)}
     9.7 -: ${HARCH:=$(uname -i 2>/dev/null || echo i386)}
     9.8 +: ${HARCH:=$(uname -m 2>/dev/null || echo i386)}
     9.9  : ${NETBSD_RELEASE:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+\).*/\1/')}
    9.10  : ${NETBSD_VERSION:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+.*\)-xen.*/\1/')}
    9.11  : ${TOPDIR:=$(cd $(dirname $0) && pwd | sed 's/\(netbsd-[0-9]\+\.[0-9]\+.*-xen[^/]*\)/\1/')}
    9.12  
    9.13 +case "$HARCH" in
    9.14 +i586|i686)
    9.15 +  HARCH=i386
    9.16 +  ;;
    9.17 +esac
    9.18 +
    9.19  TOOLDIR="$TOPDIR/../netbsd-${NETBSD_RELEASE}-tools/$HOS-$HARCH"; export TOOLDIR
    9.20  
    9.21  CONF="$1"
    10.1 --- a/netbsd-2.0-xen-sparse/nbmake-xen	Mon Nov 29 10:10:30 2004 +0000
    10.2 +++ b/netbsd-2.0-xen-sparse/nbmake-xen	Mon Nov 29 15:50:14 2004 +0000
    10.3 @@ -4,11 +4,17 @@
    10.4  #
    10.5  
    10.6  : ${HOS:=$(uname -s | tr /A-Z/ /a-z/)}
    10.7 -: ${HARCH:=$(uname -i 2>/dev/null || echo i386)}
    10.8 +: ${HARCH:=$(uname -m 2>/dev/null || echo i386)}
    10.9  : ${NETBSD_RELEASE:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+\).*/\1/')}
   10.10  : ${NETBSD_VERSION:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+.*\)-xen.*/\1/')}
   10.11  : ${TOPDIR:=$(cd $(dirname $0) && pwd | sed 's/\(netbsd-[0-9]\+\.[0-9]\+.*-xen[^/]*\)/\1/')}
   10.12  
   10.13 +case "$HARCH" in
   10.14 +i586|i686)
   10.15 +  HARCH=i386
   10.16 +  ;;
   10.17 +esac
   10.18 +
   10.19  NETBSDSRCDIR="$TOPDIR"; export NETBSDSRCDIR
   10.20  DESTDIR="$TOPDIR/root"; export DESTDIR
   10.21  unset MAKEOBJDIRPREFIX
    11.1 --- a/xen/arch/x86/dom0_ops.c	Mon Nov 29 10:10:30 2004 +0000
    11.2 +++ b/xen/arch/x86/dom0_ops.c	Mon Nov 29 15:50:14 2004 +0000
    11.3 @@ -21,6 +21,9 @@
    11.4  #include <asm/shadow.h>
    11.5  #include <public/sched_ctl.h>
    11.6  
    11.7 +#include <asm/mtrr.h>
    11.8 +#include "mtrr/mtrr.h"
    11.9 +
   11.10  #define TRC_DOM0OP_ENTER_BASE  0x00020000
   11.11  #define TRC_DOM0OP_LEAVE_BASE  0x00030000
   11.12  
   11.13 @@ -93,6 +96,40 @@ long arch_do_dom0_op(dom0_op_t *op, dom0
   11.14      }
   11.15      break;
   11.16  
   11.17 +    case DOM0_ADD_MEMTYPE:
   11.18 +    {
   11.19 +        ret = mtrr_add_page(
   11.20 +            op->u.add_memtype.pfn,
   11.21 +            op->u.add_memtype.nr_pfns,
   11.22 +            op->u.add_memtype.type,
   11.23 +            1);
   11.24 +    }
   11.25 +    break;
   11.26 +
   11.27 +    case DOM0_DEL_MEMTYPE:
   11.28 +    {
   11.29 +        ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
   11.30 +    }
   11.31 +    break;
   11.32 +
   11.33 +    case DOM0_READ_MEMTYPE:
   11.34 +    {
   11.35 +        unsigned long pfn;
   11.36 +        unsigned int  nr_pfns;
   11.37 +        mtrr_type     type;
   11.38 +
   11.39 +        ret = -EINVAL;
   11.40 +        if ( op->u.read_memtype.reg < num_var_ranges )
   11.41 +        {
   11.42 +            mtrr_if->get(op->u.read_memtype.reg, &pfn, &nr_pfns, &type);
   11.43 +            (void)__put_user(pfn, &u_dom0_op->u.read_memtype.pfn);
   11.44 +            (void)__put_user(nr_pfns, &u_dom0_op->u.read_memtype.nr_pfns);
   11.45 +            (void)__put_user(type, &u_dom0_op->u.read_memtype.type);
   11.46 +            ret = 0;
   11.47 +        }
   11.48 +    }
   11.49 +    break;
   11.50 +
   11.51      default:
   11.52          ret = -ENOSYS;
   11.53  
    12.1 --- a/xen/include/public/dom0_ops.h	Mon Nov 29 10:10:30 2004 +0000
    12.2 +++ b/xen/include/public/dom0_ops.h	Mon Nov 29 15:50:14 2004 +0000
    12.3 @@ -336,6 +336,56 @@ typedef struct {
    12.4      u32          type;                /*  8: vm_assist cmd */
    12.5  } PACKED dom0_setdomainvmassist_t; /* 12 bytes */
    12.6  
    12.7 +/*
    12.8 + * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
    12.9 + * On x86, @type is an architecture-defined MTRR memory type.
   12.10 + * On success, returns the MTRR that was used (@reg) and a handle that can
   12.11 + * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
   12.12 + * (x86-specific).
   12.13 + */
   12.14 +#define DOM0_ADD_MEMTYPE         31
   12.15 +typedef struct {
   12.16 +    /* IN variables. */
   12.17 +    memory_t pfn;                     /*  0 */
   12.18 +    MEMORY_PADDING;
   12.19 +    memory_t nr_pfns;                 /*  8 */
   12.20 +    MEMORY_PADDING;
   12.21 +    u32      type;                    /* 16 */
   12.22 +    u32      __pad0;
   12.23 +    /* OUT variables. */
   12.24 +    u32      handle;                  /* 24 */
   12.25 +    u32      reg;                     /* 28 */
   12.26 +} PACKED dom0_add_memtype_t; /* 32 bytes */
   12.27 +
   12.28 +/*
   12.29 + * Tear down an existing memory-range type. If @handle is remembered then it
   12.30 + * should be passed in to accurately tear down the correct setting (in case
   12.31 + * of overlapping memory regions with differing types). If it is not known
   12.32 + * then @handle should be set to zero. In all cases @reg must be set.
   12.33 + * (x86-specific).
   12.34 + */
   12.35 +#define DOM0_DEL_MEMTYPE         32
   12.36 +typedef struct {
   12.37 +    /* IN variables. */
   12.38 +    u32      handle;                  /*  0 */
   12.39 +    u32      reg;                     /*  4 */
   12.40 +} PACKED dom0_del_memtype_t; /* 8 bytes */
   12.41 +
   12.42 +/* Read current type of an MTRR (x86-specific). */
   12.43 +#define DOM0_READ_MEMTYPE        33
   12.44 +typedef struct {
   12.45 +    /* IN variables. */
   12.46 +    u32      reg;                     /*  0 */
   12.47 +    u32      __pad0;
   12.48 +    /* OUT variables. */
   12.49 +    memory_t pfn;                     /*  8 */
   12.50 +    MEMORY_PADDING;
   12.51 +    memory_t nr_pfns;                 /* 16 */
   12.52 +    MEMORY_PADDING;
   12.53 +    u32      type;                    /* 24 */
   12.54 +    u32      __pad1;
   12.55 +} PACKED dom0_read_memtype_t; /* 32 bytes */
   12.56 +
   12.57  typedef struct {
   12.58      u32 cmd;                          /* 0 */
   12.59      u32 interface_version;            /* 4 */ /* DOM0_INTERFACE_VERSION */
   12.60 @@ -366,6 +416,9 @@ typedef struct {
   12.61  	dom0_setdomainmaxmem_t   setdomainmaxmem;
   12.62  	dom0_getpageframeinfo2_t getpageframeinfo2;
   12.63  	dom0_setdomainvmassist_t setdomainvmassist;
   12.64 +        dom0_add_memtype_t       add_memtype;
   12.65 +        dom0_del_memtype_t       del_memtype;
   12.66 +        dom0_read_memtype_t      read_memtype;
   12.67      } PACKED u;
   12.68  } PACKED dom0_op_t; /* 80 bytes */
   12.69