ia64/xen-unstable

view xen/include/asm-x86/iommu.h @ 16830:cc5bb500df5f

vtd: Enable queued invalidation method if such HW support is
detected. Otherwise, register invalidation method is used.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 22 09:48:51 2008 +0000 (2008-01-22)
parents 8ae3f083490a
children faefbf2c4840
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 _IOMMU_H_
21 #define _IOMMU_H_
23 #include <xen/init.h>
24 #include <xen/list.h>
25 #include <xen/spinlock.h>
26 #include <asm/hvm/vmx/intel-iommu.h>
27 #include <public/hvm/ioreq.h>
28 #include <public/domctl.h>
30 extern int vtd_enabled;
32 #define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu)
33 #define domain_vmx_iommu(d) (&d->arch.hvm_domain.hvm_iommu.vmx_iommu)
34 #define iommu_qi_ctrl(iommu) (&(iommu->intel.qi_ctrl));
35 #define iommu_ir_ctrl(iommu) (&(iommu->intel.ir_ctrl));
36 #define iommu_get_flush(iommu) (&(iommu->intel.flush));
38 /*
39 * The PCI interface treats multi-function devices as independent
40 * devices. The slot/function address of each device is encoded
41 * in a single byte as follows:
42 *
43 * 15:8 = bus
44 * 7:3 = slot
45 * 2:0 = function
46 */
47 #define PCI_DEVFN(slot,func) (((slot & 0x1f) << 3) | (func & 0x07))
48 #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
49 #define PCI_FUNC(devfn) ((devfn) & 0x07)
51 struct pci_dev {
52 struct list_head list;
53 u8 bus;
54 u8 devfn;
55 };
57 struct iommu {
58 struct list_head list;
59 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
60 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
61 u64 cap;
62 u64 ecap;
63 spinlock_t lock; /* protect context, domain ids */
64 spinlock_t register_lock; /* protect iommu register handling */
65 struct root_entry *root_entry; /* virtual address */
66 unsigned int vector;
67 struct intel_iommu intel;
68 };
70 int iommu_setup(void);
71 int iommu_domain_init(struct domain *d);
72 void iommu_domain_destroy(struct domain *d);
73 int device_assigned(u8 bus, u8 devfn);
74 int assign_device(struct domain *d, u8 bus, u8 devfn);
75 int iommu_map_page(struct domain *d, dma_addr_t gfn, dma_addr_t mfn);
76 int iommu_unmap_page(struct domain *d, dma_addr_t gfn);
77 void iommu_flush(struct domain *d, dma_addr_t gfn, u64 *p2m_entry);
78 void iommu_set_pgd(struct domain *d);
79 void iommu_domain_teardown(struct domain *d);
80 int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq);
81 int dpci_ioport_intercept(ioreq_t *p);
82 int pt_irq_create_bind_vtd(struct domain *d,
83 xen_domctl_bind_pt_irq_t *pt_irq_bind);
85 #define PT_IRQ_TIME_OUT MILLISECS(8)
86 #define VTDPREFIX "[VT-D]"
88 #endif /* _IOMMU_H_ */