debuggers.hg
changeset 16400:ee935d2b8a63
merge with xen-unstable.hg (staging)
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Thu Nov 08 09:37:06 2007 -0700 (2007-11-08) |
parents | d0cd18d78074 3e3b0418905f |
children | 568816a7cb0a |
files | xen/arch/ia64/vmx/mmio.c |
line diff
1.1 --- a/tools/ioemu/target-i386-dm/helper2.c Wed Nov 07 15:11:44 2007 -0700 1.2 +++ b/tools/ioemu/target-i386-dm/helper2.c Thu Nov 08 09:37:06 2007 -0700 1.3 @@ -541,27 +541,28 @@ void __handle_buffered_iopage(CPUState * 1.4 { 1.5 buf_ioreq_t *buf_req = NULL; 1.6 ioreq_t req; 1.7 - int qw = 0; 1.8 + int qw; 1.9 1.10 if (!buffered_io_page) 1.11 return; 1.12 1.13 while (buffered_io_page->read_pointer != 1.14 buffered_io_page->write_pointer) { 1.15 - memset(&req, 0, sizeof(req)); 1.16 - buf_req = &buffered_io_page->buf_ioreq[buffered_io_page->read_pointer % 1.17 - IOREQ_BUFFER_SLOT_NUM]; 1.18 + buf_req = &buffered_io_page->buf_ioreq[ 1.19 + buffered_io_page->read_pointer % IOREQ_BUFFER_SLOT_NUM]; 1.20 req.size = 1UL << buf_req->size; 1.21 req.count = 1; 1.22 req.addr = buf_req->addr; 1.23 req.data = buf_req->data; 1.24 req.state = STATE_IOREQ_READY; 1.25 - req.dir = buf_req->dir; 1.26 + req.dir = buf_req->dir; 1.27 + req.df = buf_req->df; 1.28 req.type = buf_req->type; 1.29 - qw = req.size == 8; 1.30 + req.data_is_ptr = 0; 1.31 + qw = (req.size == 8); 1.32 if (qw) { 1.33 - buf_req = &buffered_io_page->buf_ioreq[(buffered_io_page->read_pointer+1) % 1.34 - IOREQ_BUFFER_SLOT_NUM]; 1.35 + buf_req = &buffered_io_page->buf_ioreq[ 1.36 + (buffered_io_page->read_pointer+1) % IOREQ_BUFFER_SLOT_NUM]; 1.37 req.data |= ((uint64_t)buf_req->data) << 32; 1.38 } 1.39
2.1 --- a/tools/misc/xend Wed Nov 07 15:11:44 2007 -0700 2.2 +++ b/tools/misc/xend Thu Nov 08 09:37:06 2007 -0700 2.3 @@ -33,13 +33,13 @@ import signal 2.4 import time 2.5 import commands 2.6 2.7 -result = commands.getstatusoutput(os.path.join(os.path.dirname(sys.argv[0]), 2.8 - 'xen-python-path')) 2.9 -if result[0] != 0: 2.10 - print >>sys.stderr, result[1] 2.11 - sys.exit(1) 2.12 - 2.13 -sys.path.append(result[1]) 2.14 +xpp = os.path.join(os.path.dirname(sys.argv[0]), 'xen-python-path') 2.15 +if os.path.exists(xpp): 2.16 + result = commands.getstatusoutput(xpp) 2.17 + if result[0] != 0: 2.18 + print >>sys.stderr, result[1] 2.19 + sys.exit(1) 2.20 + sys.path.append(result[1]) 2.21 2.22 from xen.xend.server import SrvDaemon 2.23
3.1 --- a/tools/python/xen/xm/main.py Wed Nov 07 15:11:44 2007 -0700 3.2 +++ b/tools/python/xen/xm/main.py Thu Nov 08 09:37:06 2007 -0700 3.3 @@ -1529,11 +1529,11 @@ def xm_sched_credit(args): 3.4 cap = None 3.5 3.6 for o, a in opts: 3.7 - if o == "-d": 3.8 + if o in ["-d", "--domain"]: 3.9 domid = a 3.10 - elif o == "-w": 3.11 + elif o in ["-w", "--weight"]: 3.12 weight = int(a) 3.13 - elif o == "-c": 3.14 + elif o in ["-c", "--cap"]: 3.15 cap = int(a); 3.16 3.17 doms = filter(lambda x : domid_match(domid, x),
4.1 --- a/xen/arch/ia64/vmx/mmio.c Wed Nov 07 15:11:44 2007 -0700 4.2 +++ b/xen/arch/ia64/vmx/mmio.c Thu Nov 08 09:37:06 2007 -0700 4.3 @@ -65,7 +65,7 @@ static int hvm_buffered_io_intercept(ior 4.4 4.5 /* ignore READ ioreq_t and anything buffered io can't deal with */ 4.6 if (p->dir == IOREQ_READ || p->addr > 0xFFFFFUL || 4.7 - p->data_is_ptr || p->df || p->count != 1) 4.8 + p->data_is_ptr || p->count != 1) 4.9 return 0; 4.10 4.11 for (i = 0; i < HVM_BUFFERED_IO_RANGE_NR; i++) { 4.12 @@ -80,6 +80,7 @@ static int hvm_buffered_io_intercept(ior 4.13 4.14 bp.type = p->type; 4.15 bp.dir = p->dir; 4.16 + bp.df = p->df; 4.17 switch (p->size) { 4.18 case 1: 4.19 bp.size = 0;
5.1 --- a/xen/arch/ia64/vmx/save.c Wed Nov 07 15:11:44 2007 -0700 5.2 +++ b/xen/arch/ia64/vmx/save.c Thu Nov 08 09:37:06 2007 -0700 5.3 @@ -23,8 +23,7 @@ 5.4 #include <xen/types.h> 5.5 #include <xen/hvm/save.h> 5.6 5.7 -void 5.8 -arch_hvm_save(struct hvm_save_header *hdr) 5.9 +void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr) 5.10 { 5.11 unsigned int i; 5.12 5.13 @@ -32,8 +31,7 @@ arch_hvm_save(struct hvm_save_header *hd 5.14 hdr->cpuid[i] = ia64_get_cpuid(i); 5.15 } 5.16 5.17 -int 5.18 -arch_hvm_load(struct hvm_save_header *hdr) 5.19 +int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr) 5.20 { 5.21 unsigned int i; 5.22 if (hdr->magic != HVM_FILE_MAGIC) {
6.1 --- a/xen/arch/ia64/xen/mm.c Wed Nov 07 15:11:44 2007 -0700 6.2 +++ b/xen/arch/ia64/xen/mm.c Thu Nov 08 09:37:06 2007 -0700 6.3 @@ -2832,7 +2832,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE( 6.4 6.5 /* Remove previously mapped page if it was present. */ 6.6 if (prev_mfn && mfn_valid(prev_mfn)) { 6.7 - if (is_xen_heap_frame(mfn_to_page(prev_mfn))) 6.8 + if (is_xen_heap_mfn(prev_mfn)) 6.9 /* Xen heap frames are simply unhooked from this phys slot. */ 6.10 guest_physmap_remove_page(d, xatp.gpfn, prev_mfn); 6.11 else
7.1 --- a/xen/arch/x86/hvm/intercept.c Wed Nov 07 15:11:44 2007 -0700 7.2 +++ b/xen/arch/x86/hvm/intercept.c Thu Nov 08 09:37:06 2007 -0700 7.3 @@ -163,18 +163,20 @@ int hvm_buffered_io_send(ioreq_t *p) 7.4 /* Ensure buffered_iopage fits in a page */ 7.5 BUILD_BUG_ON(sizeof(buffered_iopage_t) > PAGE_SIZE); 7.6 7.7 - /* Return 0 for the cases we can't deal with. */ 7.8 - if ( (p->addr > 0xffffful) || p->data_is_ptr || p->df || (p->count != 1) ) 7.9 - { 7.10 - gdprintk(XENLOG_DEBUG, "slow ioreq. type:%d size:%"PRIu64" addr:0x%" 7.11 - PRIx64" dir:%d ptr:%d df:%d count:%"PRIu64"\n", 7.12 - p->type, p->size, p->addr, !!p->dir, 7.13 - !!p->data_is_ptr, !!p->df, p->count); 7.14 + /* 7.15 + * Return 0 for the cases we can't deal with: 7.16 + * - 'addr' is only a 20-bit field, so we cannot address beyond 1MB 7.17 + * - we cannot buffer accesses to guest memory buffers, as the guest 7.18 + * may expect the memory buffer to be synchronously accessed 7.19 + * - the count field is usually used with data_is_ptr and since we don't 7.20 + * support data_is_ptr we do not waste space for the count field either 7.21 + */ 7.22 + if ( (p->addr > 0xffffful) || p->data_is_ptr || (p->count != 1) ) 7.23 return 0; 7.24 - } 7.25 7.26 bp.type = p->type; 7.27 bp.dir = p->dir; 7.28 + bp.df = p->df; 7.29 switch ( p->size ) 7.30 { 7.31 case 1:
8.1 --- a/xen/arch/x86/hvm/save.c Wed Nov 07 15:11:44 2007 -0700 8.2 +++ b/xen/arch/x86/hvm/save.c Thu Nov 08 09:37:06 2007 -0700 8.3 @@ -24,8 +24,7 @@ 8.4 #include <asm/hvm/support.h> 8.5 #include <public/hvm/save.h> 8.6 8.7 -void 8.8 -arch_hvm_save(struct hvm_save_header *hdr) 8.9 +void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr) 8.10 { 8.11 uint32_t eax, ebx, ecx, edx; 8.12 8.13 @@ -36,10 +35,10 @@ arch_hvm_save(struct hvm_save_header *hd 8.14 hdr->pad0 = 0; 8.15 } 8.16 8.17 -int 8.18 -arch_hvm_load(struct hvm_save_header *hdr) 8.19 +int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr) 8.20 { 8.21 uint32_t eax, ebx, ecx, edx; 8.22 + 8.23 if ( hdr->magic != HVM_FILE_MAGIC ) 8.24 { 8.25 gdprintk(XENLOG_ERR, 8.26 @@ -55,11 +54,14 @@ arch_hvm_load(struct hvm_save_header *hd 8.27 } 8.28 8.29 cpuid(1, &eax, &ebx, &ecx, &edx); 8.30 - /*TODO: need to define how big a difference is acceptable */ 8.31 + /* TODO: need to define how big a difference is acceptable? */ 8.32 if ( hdr->cpuid != eax ) 8.33 gdprintk(XENLOG_WARNING, "HVM restore: saved CPUID (%#"PRIx32") " 8.34 "does not match host (%#"PRIx32").\n", hdr->cpuid, eax); 8.35 8.36 + /* VGA state is not saved/restored, so we nobble the cache. */ 8.37 + d->arch.hvm_domain.stdvga.cache = 0; 8.38 + 8.39 return 0; 8.40 } 8.41
9.1 --- a/xen/arch/x86/hvm/stdvga.c Wed Nov 07 15:11:44 2007 -0700 9.2 +++ b/xen/arch/x86/hvm/stdvga.c Thu Nov 08 09:37:06 2007 -0700 9.3 @@ -220,7 +220,9 @@ static void stdvga_outb(uint64_t addr, u 9.4 gdprintk(XENLOG_INFO, "entering stdvga and caching modes\n"); 9.5 } 9.6 else if ( prev_stdvga && !s->stdvga ) 9.7 + { 9.8 gdprintk(XENLOG_INFO, "leaving stdvga\n"); 9.9 + } 9.10 } 9.11 9.12 static void stdvga_outv(uint64_t addr, uint64_t data, uint32_t size) 9.13 @@ -636,7 +638,7 @@ int stdvga_intercept_mmio(ioreq_t *p) 9.14 buf = mmio_op(s, p); 9.15 break; 9.16 default: 9.17 - gdprintk(XENLOG_ERR, "unsupported mmio request type:%d " 9.18 + gdprintk(XENLOG_WARNING, "unsupported mmio request type:%d " 9.19 "addr:0x%04x data:0x%04x size:%d count:%d state:%d " 9.20 "isptr:%d dir:%d df:%d\n", 9.21 p->type, (int)p->addr, (int)p->data, (int)p->size,
10.1 --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Wed Nov 07 15:11:44 2007 -0700 10.2 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Thu Nov 08 09:37:06 2007 -0700 10.3 @@ -115,18 +115,6 @@ static int device_context_mapped(struct 10.4 return ret; 10.5 } 10.6 10.7 -/* page table handling */ 10.8 -#define LEVEL_STRIDE (9) 10.9 -#define LEVEL_MASK ((1 << LEVEL_STRIDE) - 1) 10.10 -#define agaw_to_level(val) ((val) + 2) 10.11 -#define agaw_to_width(val) (30 + val * LEVEL_STRIDE) 10.12 -#define width_to_agaw(w) ((w - 30)/LEVEL_STRIDE) 10.13 -#define level_to_offset_bits(l) (12 + (l - 1) * LEVEL_STRIDE) 10.14 -#define address_level_offset(addr, level) \ 10.15 - ((addr >> level_to_offset_bits(level)) & LEVEL_MASK) 10.16 -#define level_mask(l) (((u64)(-1)) << level_to_offset_bits(l)) 10.17 -#define level_size(l) (1 << level_to_offset_bits(l)) 10.18 -#define align_to_level(addr, l) ((addr + level_size(l) - 1) & level_mask(l)) 10.19 static struct page_info *addr_to_dma_page(struct domain *domain, u64 addr) 10.20 { 10.21 struct hvm_iommu *hd = domain_hvm_iommu(domain);
11.1 --- a/xen/arch/x86/hvm/vmx/vtd/utils.c Wed Nov 07 15:11:44 2007 -0700 11.2 +++ b/xen/arch/x86/hvm/vmx/vtd/utils.c Thu Nov 08 09:37:06 2007 -0700 11.3 @@ -32,8 +32,9 @@ 11.4 11.5 #include <xen/mm.h> 11.6 #include <xen/xmalloc.h> 11.7 +#include <xen/inttypes.h> 11.8 11.9 -#define VTDPREFIX "[VT-D]" 11.10 +#define VTDPREFIX "[VT-D]" 11.11 #define INTEL 0x8086 11.12 #define SEABURG 0x4000 11.13 #define C_STEP 2 11.14 @@ -93,47 +94,57 @@ void disable_pmr(struct iommu *iommu) 11.15 "Disabled protected memory registers\n"); 11.16 } 11.17 11.18 -#if defined(__x86_64__) 11.19 + 11.20 void print_iommu_regs(struct acpi_drhd_unit *drhd) 11.21 { 11.22 struct iommu *iommu = drhd->iommu; 11.23 - 11.24 - printk("---- print_iommu_regs ----\n"); 11.25 + 11.26 + printk("---- print_iommu_regs ----\n"); 11.27 printk("print_iommu_regs: drhd->address = %lx\n", drhd->address); 11.28 printk("print_iommu_regs: DMAR_VER_REG = %x\n", 11.29 - dmar_readl(iommu->reg,DMAR_VER_REG)); 11.30 - printk("print_iommu_regs: DMAR_CAP_REG = %lx\n", 11.31 - dmar_readq(iommu->reg,DMAR_CAP_REG)); 11.32 - printk("print_iommu_regs: n_fault_reg = %lx\n", 11.33 - cap_num_fault_regs(dmar_readq(iommu->reg, DMAR_CAP_REG))); 11.34 - printk("print_iommu_regs: fault_recording_offset_l = %lx\n", 11.35 - cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG))); 11.36 - printk("print_iommu_regs: fault_recording_offset_h = %lx\n", 11.37 - cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8); 11.38 - printk("print_iommu_regs: fault_recording_reg_l = %lx\n", 11.39 - dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)))); 11.40 - printk("print_iommu_regs: fault_recording_reg_h = %lx\n", 11.41 - dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8)); 11.42 - printk("print_iommu_regs: DMAR_ECAP_REG = %lx\n", 11.43 - dmar_readq(iommu->reg,DMAR_ECAP_REG)); 11.44 + dmar_readl(iommu->reg,DMAR_VER_REG)); 11.45 + printk("print_iommu_regs: DMAR_CAP_REG = %"PRIx64"\n", 11.46 + dmar_readq(iommu->reg,DMAR_CAP_REG)); 11.47 + printk("print_iommu_regs: n_fault_reg = %"PRIx64"\n", 11.48 + cap_num_fault_regs(dmar_readq(iommu->reg, DMAR_CAP_REG))); 11.49 + printk("print_iommu_regs: fault_recording_offset_l = %"PRIx64"\n", 11.50 + cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG))); 11.51 + printk("print_iommu_regs: fault_recording_offset_h = %"PRIx64"\n", 11.52 + cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8); 11.53 + printk("print_iommu_regs: fault_recording_reg_l = %"PRIx64"\n", 11.54 + dmar_readq(iommu->reg, 11.55 + cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)))); 11.56 + printk("print_iommu_regs: fault_recording_reg_h = %"PRIx64"\n", 11.57 + dmar_readq(iommu->reg, 11.58 + cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8)); 11.59 + printk("print_iommu_regs: DMAR_ECAP_REG = %"PRIx64"\n", 11.60 + dmar_readq(iommu->reg,DMAR_ECAP_REG)); 11.61 printk("print_iommu_regs: DMAR_GCMD_REG = %x\n", 11.62 - dmar_readl(iommu->reg,DMAR_GCMD_REG)); 11.63 + dmar_readl(iommu->reg,DMAR_GCMD_REG)); 11.64 printk("print_iommu_regs: DMAR_GSTS_REG = %x\n", 11.65 - dmar_readl(iommu->reg,DMAR_GSTS_REG)); 11.66 - printk("print_iommu_regs: DMAR_RTADDR_REG = %lx\n", 11.67 - dmar_readq(iommu->reg,DMAR_RTADDR_REG)); 11.68 - printk("print_iommu_regs: DMAR_CCMD_REG = %lx\n", 11.69 - dmar_readq(iommu->reg,DMAR_CCMD_REG)); 11.70 + dmar_readl(iommu->reg,DMAR_GSTS_REG)); 11.71 + printk("print_iommu_regs: DMAR_RTADDR_REG = %"PRIx64"\n", 11.72 + dmar_readq(iommu->reg,DMAR_RTADDR_REG)); 11.73 + printk("print_iommu_regs: DMAR_CCMD_REG = %"PRIx64"\n", 11.74 + dmar_readq(iommu->reg,DMAR_CCMD_REG)); 11.75 printk("print_iommu_regs: DMAR_FSTS_REG = %x\n", 11.76 - dmar_readl(iommu->reg,DMAR_FSTS_REG)); 11.77 + dmar_readl(iommu->reg,DMAR_FSTS_REG)); 11.78 printk("print_iommu_regs: DMAR_FECTL_REG = %x\n", 11.79 - dmar_readl(iommu->reg,DMAR_FECTL_REG)); 11.80 + dmar_readl(iommu->reg,DMAR_FECTL_REG)); 11.81 printk("print_iommu_regs: DMAR_FEDATA_REG = %x\n", 11.82 - dmar_readl(iommu->reg,DMAR_FEDATA_REG)); 11.83 + dmar_readl(iommu->reg,DMAR_FEDATA_REG)); 11.84 printk("print_iommu_regs: DMAR_FEADDR_REG = %x\n", 11.85 - dmar_readl(iommu->reg,DMAR_FEADDR_REG)); 11.86 + dmar_readl(iommu->reg,DMAR_FEADDR_REG)); 11.87 printk("print_iommu_regs: DMAR_FEUADDR_REG = %x\n", 11.88 - dmar_readl(iommu->reg,DMAR_FEUADDR_REG)); 11.89 + dmar_readl(iommu->reg,DMAR_FEUADDR_REG)); 11.90 +} 11.91 + 11.92 +u32 get_level_index(unsigned long gmfn, int level) 11.93 +{ 11.94 + while ( --level ) 11.95 + gmfn = gmfn >> LEVEL_STRIDE; 11.96 + 11.97 + return gmfn & LEVEL_MASK; 11.98 } 11.99 11.100 void print_vtd_entries(struct domain *d, int bus, int devfn, 11.101 @@ -144,219 +155,120 @@ void print_vtd_entries(struct domain *d, 11.102 struct iommu *iommu; 11.103 struct context_entry *ctxt_entry; 11.104 struct root_entry *root_entry; 11.105 - u64 *l3, *l2, *l1; 11.106 - u32 l3_index, l2_index, l1_index; 11.107 + u64 *l4 = NULL, *l3, *l2, *l1; 11.108 + u32 l4_index = 0, l3_index, l2_index, l1_index; 11.109 u32 i = 0; 11.110 + int level = agaw_to_level(hd->agaw); 11.111 11.112 - printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x devfn = %x, gmfn = %lx\n", d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), devfn, gmfn); 11.113 + printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x gmfn = %lx\n", 11.114 + d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn); 11.115 11.116 - for_each_drhd_unit(drhd) { 11.117 - printk("---- print_vtd_entries %d ----\n", i++); 11.118 + if ( hd->pgd == NULL ) 11.119 + { 11.120 + printk(" hg->pgd == NULL\n"); 11.121 + return; 11.122 + } 11.123 + printk(" d->pgd = %p virt_to_maddr(hd->pgd) = %lx\n", 11.124 + hd->pgd, virt_to_maddr(hd->pgd)); 11.125 11.126 - if (hd->pgd == NULL) { 11.127 - printk(" hg->pgd == NULL\n"); 11.128 - return; 11.129 - } 11.130 + for_each_drhd_unit ( drhd ) 11.131 + { 11.132 + printk("---- print_vtd_entries %d ----\n", i++); 11.133 11.134 iommu = drhd->iommu; 11.135 root_entry = iommu->root_entry; 11.136 - printk(" hd->pgd = %p virt_to_maddr(hd->pgd) = %lx\n", 11.137 - hd->pgd, virt_to_maddr(hd->pgd)); 11.138 - 11.139 printk(" root_entry = %p\n", root_entry); 11.140 - if (root_entry == NULL) { 11.141 + if ( root_entry == NULL ) 11.142 + { 11.143 printk(" root_entry == NULL\n"); 11.144 - return; 11.145 + continue; 11.146 } 11.147 11.148 - printk(" root_entry[%x] = %lx\n", bus, root_entry[bus].val); 11.149 + printk(" root_entry[%x] = %"PRIx64"\n", bus, root_entry[bus].val); 11.150 printk(" maddr_to_virt(root_entry[%x]) = %p\n", 11.151 - bus, maddr_to_virt(root_entry[bus].val)); 11.152 + bus, maddr_to_virt(root_entry[bus].val)); 11.153 11.154 - if (root_entry[bus].val == 0) { 11.155 + if ( root_entry[bus].val == 0 ) 11.156 + { 11.157 printk(" root_entry[%x].lo == 0\n", bus); 11.158 - return; 11.159 - } 11.160 - 11.161 - ctxt_entry = maddr_to_virt((root_entry[bus].val >> PAGE_SHIFT) << PAGE_SHIFT); 11.162 - if (ctxt_entry == NULL) { 11.163 - printk(" ctxt_entry == NULL\n"); 11.164 - return; 11.165 + continue; 11.166 } 11.167 11.168 - if (ctxt_entry[devfn].lo == 0) { 11.169 + ctxt_entry = 11.170 + maddr_to_virt((root_entry[bus].val >> PAGE_SHIFT) << PAGE_SHIFT); 11.171 + if ( ctxt_entry == NULL ) 11.172 + { 11.173 + printk(" ctxt_entry == NULL\n"); 11.174 + continue; 11.175 + } 11.176 + 11.177 + if ( ctxt_entry[devfn].lo == 0 ) 11.178 + { 11.179 printk(" ctxt_entry[%x].lo == 0\n", devfn); 11.180 - return; 11.181 + continue; 11.182 } 11.183 11.184 printk(" context = %p\n", ctxt_entry); 11.185 - printk(" context[%x] = %lx %lx\n", 11.186 + printk(" context[%x] = %"PRIx64" %"PRIx64"\n", 11.187 devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo); 11.188 printk(" maddr_to_virt(context[%x].lo) = %p\n", 11.189 devfn, maddr_to_virt(ctxt_entry[devfn].lo)); 11.190 - printk(" context[%x] = %lx\n", devfn, ctxt_entry[devfn].lo); 11.191 + printk(" context[%x] = %"PRIx64"\n", devfn, ctxt_entry[devfn].lo); 11.192 + 11.193 + switch ( level ) 11.194 + { 11.195 + case VTD_PAGE_TABLE_LEVEL_3: 11.196 + l3 = maddr_to_virt(ctxt_entry[devfn].lo); 11.197 + l3 = (u64*)(((unsigned long)l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.198 + printk(" l3 = %p\n", l3); 11.199 + if ( l3 == NULL ) 11.200 + continue; 11.201 + l3_index = get_level_index(gmfn, 3); 11.202 + printk(" l3_index = %x\n", l3_index); 11.203 + printk(" l3[%x] = %"PRIx64"\n", l3_index, l3[l3_index]); 11.204 11.205 - l3 = maddr_to_virt(ctxt_entry[devfn].lo); 11.206 - l3 = (u64*)(((u64) l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.207 - printk(" l3 = %p\n", l3); 11.208 - if (l3 == NULL) return; 11.209 + break; 11.210 + case VTD_PAGE_TABLE_LEVEL_4: 11.211 + l4 = maddr_to_virt(ctxt_entry[devfn].lo); 11.212 + l4 = (u64*)(((unsigned long)l4 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.213 + printk(" l4 = %p\n", l4); 11.214 + if ( l4 == NULL ) 11.215 + continue; 11.216 + l4_index = get_level_index(gmfn, 4); 11.217 + printk(" l4_index = %x\n", l4_index); 11.218 + printk(" l4[%x] = %"PRIx64"\n", l4_index, l4[l4_index]); 11.219 11.220 - l3_index = (gmfn >> 9 >> 9) & 0x1ff; 11.221 - printk(" l3_index = %x\n", l3_index); 11.222 - printk(" l3[%x] = %lx\n", l3_index, l3[l3_index]); 11.223 + l3 = maddr_to_virt(l4[l4_index]); 11.224 + l3 = (u64*)(((unsigned long)l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.225 + printk(" l3 = %p\n", l3); 11.226 + if ( l3 == NULL ) 11.227 + continue; 11.228 + l3_index = get_level_index(gmfn, 3); 11.229 + printk(" l3_index = %x\n", l3_index); 11.230 + printk(" l3[%x] = %"PRIx64"\n", l3_index, l3[l3_index]); 11.231 + 11.232 + break; 11.233 + default: 11.234 + printk("Unsupported VTD page table level (%d)!\n", level); 11.235 + continue; 11.236 + } 11.237 11.238 l2 = maddr_to_virt(l3[l3_index]); 11.239 - l2 = (u64*)(((u64) l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.240 - printk(" l2 = %p\n", l2); 11.241 - if (l2 == NULL) return; 11.242 - 11.243 - l2_index = (gmfn >> 9) & 0x1ff; 11.244 - printk(" gmfn = %lx\n", gmfn); 11.245 - printk(" gmfn >> 9= %lx\n", gmfn >> 9); 11.246 + l2 = (u64*)(((unsigned long)l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.247 + printk(" l2 = %p\n", l2); 11.248 + if ( l2 == NULL ) 11.249 + continue; 11.250 + l2_index = get_level_index(gmfn, 2); 11.251 printk(" l2_index = %x\n", l2_index); 11.252 - printk(" l2[%x] = %lx\n", l2_index, l2[l2_index]); 11.253 + printk(" l2[%x] = %"PRIx64"\n", l2_index, l2[l2_index]); 11.254 11.255 l1 = maddr_to_virt(l2[l2_index]); 11.256 - l1 = (u64*)(((u64) l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.257 - if (l1 == NULL) return; 11.258 - l1_index = gmfn & 0x1ff; 11.259 - printk(" l1 = %p\n", l1); 11.260 + l1 = (u64*)(((unsigned long)l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.261 + printk(" l1 = %p\n", l1); 11.262 + if ( l1 == NULL ) 11.263 + continue; 11.264 + l1_index = get_level_index(gmfn, 1); 11.265 printk(" l1_index = %x\n", l1_index); 11.266 - printk(" l1[%x] = %lx\n", l1_index, l1[l1_index]); 11.267 - } 11.268 -} 11.269 - 11.270 -#else // !m64 11.271 - 11.272 -void print_iommu_regs(struct acpi_drhd_unit *drhd) 11.273 -{ 11.274 - struct iommu *iommu = drhd->iommu; 11.275 - 11.276 - printk("---- print_iommu_regs ----\n"); 11.277 - printk("print_iommu_regs: drhd->address = %lx\n", drhd->address); 11.278 - printk("print_iommu_regs: DMAR_VER_REG = %x\n", 11.279 - dmar_readl(iommu->reg,DMAR_VER_REG)); 11.280 - printk("print_iommu_regs: DMAR_CAP_REG = %llx\n", 11.281 - dmar_readq(iommu->reg,DMAR_CAP_REG)); 11.282 - printk("print_iommu_regs: n_fault_reg = %llx\n", 11.283 - cap_num_fault_regs(dmar_readq(iommu->reg, DMAR_CAP_REG))); 11.284 - printk("print_iommu_regs: fault_recording_offset_l = %llx\n", 11.285 - cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG))); 11.286 - printk("print_iommu_regs: fault_recording_offset_h = %llx\n", 11.287 - cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8); 11.288 - printk("print_iommu_regs: fault_recording_reg_l = %llx\n", 11.289 - dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)))); 11.290 - printk("print_iommu_regs: fault_recording_reg_h = %llx\n", 11.291 - dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8)); 11.292 - printk("print_iommu_regs: DMAR_ECAP_REG = %llx\n", 11.293 - dmar_readq(iommu->reg,DMAR_ECAP_REG)); 11.294 - printk("print_iommu_regs: DMAR_GCMD_REG = %x\n", 11.295 - dmar_readl(iommu->reg,DMAR_GCMD_REG)); 11.296 - printk("print_iommu_regs: DMAR_GSTS_REG = %x\n", 11.297 - dmar_readl(iommu->reg,DMAR_GSTS_REG)); 11.298 - printk("print_iommu_regs: DMAR_RTADDR_REG = %llx\n", 11.299 - dmar_readq(iommu->reg,DMAR_RTADDR_REG)); 11.300 - printk("print_iommu_regs: DMAR_CCMD_REG = %llx\n", 11.301 - dmar_readq(iommu->reg,DMAR_CCMD_REG)); 11.302 - printk("print_iommu_regs: DMAR_FSTS_REG = %x\n", 11.303 - dmar_readl(iommu->reg,DMAR_FSTS_REG)); 11.304 - printk("print_iommu_regs: DMAR_FECTL_REG = %x\n", 11.305 - dmar_readl(iommu->reg,DMAR_FECTL_REG)); 11.306 - printk("print_iommu_regs: DMAR_FEDATA_REG = %x\n", 11.307 - dmar_readl(iommu->reg,DMAR_FEDATA_REG)); 11.308 - printk("print_iommu_regs: DMAR_FEADDR_REG = %x\n", 11.309 - dmar_readl(iommu->reg,DMAR_FEADDR_REG)); 11.310 - printk("print_iommu_regs: DMAR_FEUADDR_REG = %x\n", 11.311 - dmar_readl(iommu->reg,DMAR_FEUADDR_REG)); 11.312 + printk(" l1[%x] = %"PRIx64"\n", l1_index, l1[l1_index]); 11.313 + } 11.314 } 11.315 - 11.316 -void print_vtd_entries(struct domain *d, int bus, int devfn, 11.317 - unsigned long gmfn) 11.318 -{ 11.319 - struct hvm_iommu *hd = domain_hvm_iommu(d); 11.320 - struct acpi_drhd_unit *drhd; 11.321 - struct iommu *iommu; 11.322 - struct context_entry *ctxt_entry; 11.323 - struct root_entry *root_entry; 11.324 - u64 *l3, *l2, *l1; 11.325 - u32 l3_index, l2_index, l1_index; 11.326 - u32 i = 0; 11.327 - 11.328 - printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x devfn = %x, gmfn = %lx\n", d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), devfn, gmfn); 11.329 - 11.330 - for_each_drhd_unit(drhd) { 11.331 - printk("---- print_vtd_entries %d ----\n", i++); 11.332 - 11.333 - if (hd->pgd == NULL) { 11.334 - printk(" hg->pgd == NULL\n"); 11.335 - return; 11.336 - } 11.337 - 11.338 - iommu = drhd->iommu; 11.339 - root_entry = iommu->root_entry; 11.340 - printk(" d->pgd = %p virt_to_maddr(hd->pgd) = %lx\n", 11.341 - hd->pgd, virt_to_maddr(hd->pgd)); 11.342 - 11.343 - printk(" root_entry = %p\n", root_entry); 11.344 - if (root_entry == NULL) { 11.345 - printk(" root_entry == NULL\n"); 11.346 - return; 11.347 - } 11.348 - 11.349 - printk(" root_entry[%x] = %llx\n", bus, root_entry[bus].val); 11.350 - printk(" maddr_to_virt(root_entry[%x]) = %p\n", 11.351 - bus, maddr_to_virt(root_entry[bus].val)); 11.352 - 11.353 - if (root_entry[bus].val == 0) { 11.354 - printk(" root_entry[%x].lo == 0\n", bus); 11.355 - return; 11.356 - } 11.357 - 11.358 - ctxt_entry = maddr_to_virt((root_entry[bus].val >> PAGE_SHIFT) << PAGE_SHIFT); 11.359 - if (ctxt_entry == NULL) { 11.360 - printk(" ctxt_entry == NULL\n"); 11.361 - return; 11.362 - } 11.363 - 11.364 - if (ctxt_entry[devfn].lo == 0) { 11.365 - printk(" ctxt_entry[%x].lo == 0\n", devfn); 11.366 - return; 11.367 - } 11.368 - 11.369 - printk(" context = %p\n", ctxt_entry); 11.370 - printk(" context[%x] = %llx %llx\n", 11.371 - devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo); 11.372 - printk(" maddr_to_virt(context[%x].lo) = %p\n", 11.373 - devfn, maddr_to_virt(ctxt_entry[devfn].lo)); 11.374 - printk(" context[%x] = %llx\n", devfn, ctxt_entry[devfn].lo); 11.375 - 11.376 - l3 = maddr_to_virt(ctxt_entry[devfn].lo); 11.377 - l3 = (u64*)(((u32) l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.378 - printk(" l3 = %p\n", l3); 11.379 - if (l3 == NULL) return; 11.380 - 11.381 - l3_index = (gmfn >> 9 >> 9) & 0x1ff; 11.382 - printk(" l3_index = %x\n", l3_index); 11.383 - printk(" l3[%x] = %llx\n", l3_index, l3[l3_index]); 11.384 - 11.385 - l2 = maddr_to_virt(l3[l3_index]); 11.386 - l2 = (u64*)(((u32) l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.387 - printk(" l2 = %p\n", l2); 11.388 - if (l2 == NULL) return; 11.389 - 11.390 - l2_index = (gmfn >> 9) & 0x1ff; 11.391 - printk(" gmfn = %lx\n", gmfn); 11.392 - printk(" gmfn >> 9= %lx\n", gmfn >> 9); 11.393 - printk(" l2_index = %x\n", l2_index); 11.394 - printk(" l2[%x] = %llx\n", l2_index, l2[l2_index]); 11.395 - 11.396 - l1 = maddr_to_virt(l2[l2_index]); 11.397 - l1 = (u64*)(((u32) l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); 11.398 - if (l1 == NULL) return; 11.399 - l1_index = gmfn & 0x1ff; 11.400 - printk(" l1 = %p\n", l1); 11.401 - printk(" l1_index = %x\n", l1_index); 11.402 - printk(" l1[%x] = %llx\n", l1_index, l1[l1_index]); 11.403 - } 11.404 -} 11.405 -#endif // !m64
12.1 --- a/xen/arch/x86/hvm/vpt.c Wed Nov 07 15:11:44 2007 -0700 12.2 +++ b/xen/arch/x86/hvm/vpt.c Thu Nov 08 09:37:06 2007 -0700 12.3 @@ -56,17 +56,9 @@ static void pt_process_missed_ticks(stru 12.4 if ( missed_ticks <= 0 ) 12.5 return; 12.6 12.7 - if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) 12.8 - { 12.9 - pt->pending_intr_nr = 1; 12.10 - pt->scheduled = now + pt->period; 12.11 - } 12.12 - else 12.13 - { 12.14 - missed_ticks = missed_ticks / (s_time_t) pt->period + 1; 12.15 - pt->pending_intr_nr += missed_ticks; 12.16 - pt->scheduled += missed_ticks * pt->period; 12.17 - } 12.18 + missed_ticks = missed_ticks / (s_time_t) pt->period + 1; 12.19 + pt->pending_intr_nr += missed_ticks; 12.20 + pt->scheduled += missed_ticks * pt->period; 12.21 } 12.22 12.23 static void pt_freeze_time(struct vcpu *v) 12.24 @@ -131,10 +123,7 @@ static void pt_timer_fn(void *data) 12.25 12.26 pt_lock(pt); 12.27 12.28 - if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) 12.29 - pt->pending_intr_nr = 1; 12.30 - else 12.31 - pt->pending_intr_nr++; 12.32 + pt->pending_intr_nr++; 12.33 12.34 if ( !pt->one_shot ) 12.35 { 12.36 @@ -235,11 +224,16 @@ void pt_intr_post(struct vcpu *v, struct 12.37 } 12.38 else 12.39 { 12.40 - pt->pending_intr_nr--; 12.41 if ( mode_is(v->domain, no_missed_tick_accounting) ) 12.42 + { 12.43 pt->last_plt_gtime = hvm_get_guest_time(v); 12.44 + pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */ 12.45 + } 12.46 else 12.47 + { 12.48 pt->last_plt_gtime += pt->period_cycles; 12.49 + pt->pending_intr_nr--; 12.50 + } 12.51 } 12.52 12.53 if ( mode_is(v->domain, delay_for_missed_ticks) &&
13.1 --- a/xen/arch/x86/mm.c Wed Nov 07 15:11:44 2007 -0700 13.2 +++ b/xen/arch/x86/mm.c Thu Nov 08 09:37:06 2007 -0700 13.3 @@ -674,7 +674,7 @@ get_page_from_l1e( 13.4 uint32_t x, nx, y = page->count_info; 13.5 uint32_t cacheattr = pte_flags_to_cacheattr(l1f); 13.6 13.7 - if ( is_xen_heap_frame(page) ) 13.8 + if ( is_xen_heap_page(page) ) 13.9 { 13.10 if ( (l1f & _PAGE_RW) && 13.11 !(unlikely(paging_mode_external(d) && 13.12 @@ -1866,7 +1866,7 @@ void cleanup_page_cacheattr(struct page_ 13.13 13.14 page->count_info &= ~PGC_cacheattr_mask; 13.15 13.16 - BUG_ON(is_xen_heap_frame(page)); 13.17 + BUG_ON(is_xen_heap_page(page)); 13.18 13.19 #ifdef __x86_64__ 13.20 map_pages_to_xen((unsigned long)page_to_virt(page), page_to_mfn(page), 13.21 @@ -3200,7 +3200,7 @@ long arch_memory_op(int op, XEN_GUEST_HA 13.22 prev_mfn = gmfn_to_mfn(d, xatp.gpfn); 13.23 if ( mfn_valid(prev_mfn) ) 13.24 { 13.25 - if ( is_xen_heap_frame(mfn_to_page(prev_mfn)) ) 13.26 + if ( is_xen_heap_mfn(prev_mfn) ) 13.27 /* Xen heap frames are simply unhooked from this phys slot. */ 13.28 guest_physmap_remove_page(d, xatp.gpfn, prev_mfn); 13.29 else 13.30 @@ -3583,7 +3583,7 @@ void free_xen_pagetable(void *v) 13.31 13.32 BUG_ON(early_boot); 13.33 13.34 - if ( is_xen_heap_frame(virt_to_page(v)) ) 13.35 + if ( is_xen_heap_page(virt_to_page(v)) ) 13.36 free_xenheap_page(v); 13.37 else 13.38 free_domheap_page(virt_to_page(v));
14.1 --- a/xen/arch/x86/mm/shadow/multi.c Wed Nov 07 15:11:44 2007 -0700 14.2 +++ b/xen/arch/x86/mm/shadow/multi.c Thu Nov 08 09:37:06 2007 -0700 14.3 @@ -745,10 +745,11 @@ static always_inline void 14.4 14.5 /* 14.6 * For HVM domains with direct access to MMIO areas, set the correct 14.7 - * caching attributes in the shadows to match what was asked for 14.8 + * caching attributes in the shadows to match what was asked for. 14.9 */ 14.10 if ( (level == 1) && is_hvm_domain(d) && 14.11 - !list_empty(&(domain_hvm_iommu(d)->pdev_list)) ) 14.12 + !list_empty(&(domain_hvm_iommu(d)->pdev_list)) && 14.13 + !is_xen_heap_mfn(mfn_x(target_mfn)) ) 14.14 { 14.15 unsigned int type; 14.16 if ( hvm_get_mem_pinned_cacheattr(d, gfn_x(target_gfn), &type) )
15.1 --- a/xen/common/grant_table.c Wed Nov 07 15:11:44 2007 -0700 15.2 +++ b/xen/common/grant_table.c Thu Nov 08 09:37:06 2007 -0700 15.3 @@ -1057,7 +1057,7 @@ gnttab_transfer( 15.4 } 15.5 15.6 page = mfn_to_page(mfn); 15.7 - if ( unlikely(is_xen_heap_frame(page)) ) 15.8 + if ( unlikely(is_xen_heap_page(page)) ) 15.9 { 15.10 gdprintk(XENLOG_INFO, "gnttab_transfer: xen frame %lx\n", 15.11 (unsigned long)gop.mfn);
16.1 --- a/xen/common/hvm/save.c Wed Nov 07 15:11:44 2007 -0700 16.2 +++ b/xen/common/hvm/save.c Thu Nov 08 09:37:06 2007 -0700 16.3 @@ -94,7 +94,7 @@ int hvm_save(struct domain *d, hvm_domai 16.4 else 16.5 hdr.changeset = -1ULL; /* Unknown */ 16.6 16.7 - arch_hvm_save(&hdr); 16.8 + arch_hvm_save(d, &hdr); 16.9 16.10 if ( hvm_save_entry(HEADER, 0, h, &hdr) != 0 ) 16.11 { 16.12 @@ -144,7 +144,7 @@ int hvm_load(struct domain *d, hvm_domai 16.13 if ( hvm_load_entry(HEADER, h, &hdr) != 0 ) 16.14 return -1; 16.15 16.16 - if ( arch_hvm_load(&hdr) ) 16.17 + if ( arch_hvm_load(d, &hdr) ) 16.18 return -1; 16.19 16.20 c = strrchr(xen_changeset(), ':');
17.1 --- a/xen/common/page_alloc.c Wed Nov 07 15:11:44 2007 -0700 17.2 +++ b/xen/common/page_alloc.c Thu Nov 08 09:37:06 2007 -0700 17.3 @@ -559,8 +559,7 @@ static unsigned long avail_heap_pages( 17.4 return free_pages; 17.5 } 17.6 17.7 -#define avail_for_domheap(mfn) \ 17.8 - (!allocated_in_map(mfn) && !is_xen_heap_frame(mfn_to_page(mfn))) 17.9 +#define avail_for_domheap(mfn) !(allocated_in_map(mfn) || is_xen_heap_mfn(mfn)) 17.10 void __init end_boot_allocator(void) 17.11 { 17.12 unsigned long i; 17.13 @@ -615,7 +614,7 @@ void __init scrub_heap_pages(void) 17.14 /* Re-check page status with lock held. */ 17.15 if ( !allocated_in_map(mfn) ) 17.16 { 17.17 - if ( is_xen_heap_frame(mfn_to_page(mfn)) ) 17.18 + if ( is_xen_heap_mfn(mfn) ) 17.19 { 17.20 p = page_to_virt(mfn_to_page(mfn)); 17.21 memguard_unguard_range(p, PAGE_SIZE); 17.22 @@ -655,9 +654,9 @@ void init_xenheap_pages(paddr_t ps, padd 17.23 * Yuk! Ensure there is a one-page buffer between Xen and Dom zones, to 17.24 * prevent merging of power-of-two blocks across the zone boundary. 17.25 */ 17.26 - if ( ps && !is_xen_heap_frame(maddr_to_page(ps)-1) ) 17.27 + if ( ps && !is_xen_heap_mfn(paddr_to_pfn(ps)-1) ) 17.28 ps += PAGE_SIZE; 17.29 - if ( !is_xen_heap_frame(maddr_to_page(pe)) ) 17.30 + if ( !is_xen_heap_mfn(paddr_to_pfn(pe)) ) 17.31 pe -= PAGE_SIZE; 17.32 17.33 init_heap_pages(MEMZONE_XEN, maddr_to_page(ps), (pe - ps) >> PAGE_SHIFT); 17.34 @@ -838,7 +837,7 @@ void free_domheap_pages(struct page_info 17.35 17.36 ASSERT(!in_irq()); 17.37 17.38 - if ( unlikely(is_xen_heap_frame(pg)) ) 17.39 + if ( unlikely(is_xen_heap_page(pg)) ) 17.40 { 17.41 /* NB. May recursively lock from relinquish_memory(). */ 17.42 spin_lock_recursive(&d->page_alloc_lock);
18.1 --- a/xen/include/asm-ia64/mm.h Wed Nov 07 15:11:44 2007 -0700 18.2 +++ b/xen/include/asm-ia64/mm.h Thu Nov 08 09:37:06 2007 -0700 18.3 @@ -115,8 +115,9 @@ struct page_info 18.4 /* 29-bit count of references to this frame. */ 18.5 #define PGC_count_mask ((1UL<<29)-1) 18.6 18.7 -#define is_xen_heap_frame(pfn) ((page_to_maddr(pfn) < xenheap_phys_end) \ 18.8 - && (page_to_maddr(pfn) >= xen_pstart)) 18.9 +#define is_xen_heap_mfn(mfn) (((mfn) < paddr_to_pfn(xenheap_phys_end)) \ 18.10 + && ((mfn) >= paddr_to_pfn(xen_pstart))) 18.11 +#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page)) 18.12 18.13 extern void* xen_pickle_offset; 18.14 #define __pickle(a) ((unsigned long)a - (unsigned long)xen_pickle_offset)
19.1 --- a/xen/include/asm-powerpc/mm.h Wed Nov 07 15:11:44 2007 -0700 19.2 +++ b/xen/include/asm-powerpc/mm.h Thu Nov 08 09:37:06 2007 -0700 19.3 @@ -111,7 +111,8 @@ struct page_info 19.4 /* 29-bit count of references to this frame. */ 19.5 #define PGC_count_mask ((1UL<<28)-1) 19.6 19.7 -#define is_xen_heap_frame(pfn) (page_to_maddr(pfn) < xenheap_phys_end) 19.8 +#define is_xen_heap_mfn(mfn) ((mfn) < paddr_to_pfn(xenheap_phys_end)) 19.9 +#define is_xen_heap_page(page) (page_to_maddr(page) < xenheap_phys_end) 19.10 19.11 static inline struct domain *unpickle_domptr(u32 _domain) 19.12 { return ((_domain == 0) || (_domain & 1)) ? NULL : __va(_domain); }
20.1 --- a/xen/include/asm-x86/hvm/vmx/intel-iommu.h Wed Nov 07 15:11:44 2007 -0700 20.2 +++ b/xen/include/asm-x86/hvm/vmx/intel-iommu.h Thu Nov 08 09:37:06 2007 -0700 20.3 @@ -230,6 +230,19 @@ struct context_entry { 20.4 do {(c).hi &= 0xff; (c).hi |= ((val + 1) & ((1 << 16) - 1)) << 8;} while(0) 20.5 #define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while(0) 20.6 20.7 +/* page table handling */ 20.8 +#define LEVEL_STRIDE (9) 20.9 +#define LEVEL_MASK ((1 << LEVEL_STRIDE) - 1) 20.10 +#define agaw_to_level(val) ((val) + 2) 20.11 +#define agaw_to_width(val) (30 + val * LEVEL_STRIDE) 20.12 +#define width_to_agaw(w) ((w - 30)/LEVEL_STRIDE) 20.13 +#define level_to_offset_bits(l) (12 + (l - 1) * LEVEL_STRIDE) 20.14 +#define address_level_offset(addr, level) \ 20.15 + ((addr >> level_to_offset_bits(level)) & LEVEL_MASK) 20.16 +#define level_mask(l) (((u64)(-1)) << level_to_offset_bits(l)) 20.17 +#define level_size(l) (1 << level_to_offset_bits(l)) 20.18 +#define align_to_level(addr, l) ((addr + level_size(l) - 1) & level_mask(l)) 20.19 + 20.20 /* 20.21 * 0: readable 20.22 * 1: writable
21.1 --- a/xen/include/asm-x86/mm.h Wed Nov 07 15:11:44 2007 -0700 21.2 +++ b/xen/include/asm-x86/mm.h Thu Nov 08 09:37:06 2007 -0700 21.3 @@ -102,9 +102,11 @@ struct page_info 21.4 /* 26-bit count of references to this frame. */ 21.5 #define PGC_count_mask ((1U<<26)-1) 21.6 21.7 -#define is_xen_heap_frame(pfn) ({ \ 21.8 - paddr_t maddr = page_to_maddr(pfn); \ 21.9 - ((maddr >= xenheap_phys_start) && (maddr < xenheap_phys_end)); \ 21.10 +#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page)) 21.11 +#define is_xen_heap_mfn(mfn) ({ \ 21.12 + unsigned long _mfn = (mfn); \ 21.13 + ((_mfn >= paddr_to_pfn(xenheap_phys_start)) && \ 21.14 + (_mfn < paddr_to_pfn(xenheap_phys_end))); \ 21.15 }) 21.16 21.17 #if defined(__i386__)
22.1 --- a/xen/include/public/hvm/ioreq.h Wed Nov 07 15:11:44 2007 -0700 22.2 +++ b/xen/include/public/hvm/ioreq.h Thu Nov 08 09:37:06 2007 -0700 22.3 @@ -78,11 +78,12 @@ struct shared_iopage { 22.4 typedef struct shared_iopage shared_iopage_t; 22.5 22.6 struct buf_ioreq { 22.7 - uint8_t type; /* I/O type */ 22.8 - uint8_t dir:1; /* 1=read, 0=write */ 22.9 - uint8_t size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */ 22.10 - uint32_t addr:20;/* physical address */ 22.11 - uint32_t data; /* data */ 22.12 + uint8_t type; /* I/O type */ 22.13 + uint8_t df:1; /* EFLAGS.DF */ 22.14 + uint8_t dir:1; /* 1=read, 0=write */ 22.15 + uint8_t size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */ 22.16 + uint32_t addr:20;/* physical address */ 22.17 + uint32_t data; /* data */ 22.18 }; 22.19 typedef struct buf_ioreq buf_ioreq_t; 22.20
23.1 --- a/xen/include/xen/hvm/save.h Wed Nov 07 15:11:44 2007 -0700 23.2 +++ b/xen/include/xen/hvm/save.h Thu Nov 08 09:37:06 2007 -0700 23.3 @@ -155,7 +155,7 @@ int hvm_load(struct domain *d, hvm_domai 23.4 23.5 /* Arch-specific definitions. */ 23.6 struct hvm_save_header; 23.7 -void arch_hvm_save(struct hvm_save_header *hdr); 23.8 -int arch_hvm_load(struct hvm_save_header *hdr); 23.9 +void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr); 23.10 +int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr); 23.11 23.12 #endif /* __XEN_HVM_SAVE_H__ */