debuggers.hg

view xen/include/asm-x86/hvm/iommu.h @ 16569:32237d8517b1

vt-d: Use bitmap to solve domain-id limitation issue.

The Capability register reports the domain-id width supported by
hardware. For implementations supporting less than 16-bit domainids,
unused bits of domain identifier field(87:72) in Context entry are
treated as reserved by hardware. For example, for an implementation
supporting 4-bit domain-ids, bits 87:76 of this field are treated as
reserved. 16 is a small number, overflow is easy to happen. What's
more,
context-entries programmed with the same domain identifier must always
reference the same address translation structure (through the ASR
field). So Dom16 will conflict with Dom0, and device assignment fails.

This patch implements a domaid id bitmap to solve above issue.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 05 10:53:47 2007 +0000 (2007-12-05)
parents 844e507d56b8
children 72f52dd2dba8
line source
1 /*
2 * Copyright (c) 2006, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Copyright (C) Allen Kay <allen.m.kay@intel.com>
18 */
20 #ifndef __ASM_X86_HVM_IOMMU_H__
21 #define __ASM_X86_HVM_IOMMU_H__
23 #include <asm/iommu.h>
24 #include <asm/hvm/irq.h>
25 #include <asm/hvm/vpt.h>
26 #include <asm/hvm/vlapic.h>
27 #include <asm/hvm/io.h>
28 #include <public/hvm/params.h>
29 #include <public/hvm/save.h>
31 struct g2m_ioport {
32 struct list_head list;
33 unsigned int gport;
34 unsigned int mport;
35 unsigned int np;
36 };
38 struct hvm_iommu {
39 spinlock_t iommu_list_lock; /* protect iommu specific lists */
40 struct list_head pdev_list; /* direct accessed pci devices */
41 struct dma_pte *pgd; /* io page directory root */
42 spinlock_t mapping_lock; /* io page table lock */
43 int agaw; /* adjusted guest address width, 0 is level 2 30-bit */
44 struct list_head g2m_ioport_list; /* guest to machine ioport mapping */
45 domid_t iommu_domid; /* domain id stored in iommu */
47 /* amd iommu support */
48 int domain_id;
49 int paging_mode;
50 void *root_table;
51 };
53 #endif // __ASM_X86_HVM_IOMMU_H__