ia64/xen-unstable

view xen/include/xen/iommu.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents 78962f85c562
children
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/spinlock.h>
25 #include <xen/pci.h>
26 #include <public/hvm/ioreq.h>
27 #include <public/domctl.h>
29 extern int iommu_enabled;
30 extern int iommu_pv_enabled;
31 extern int force_iommu;
32 extern int iommu_passthrough;
33 extern int iommu_snoop;
34 extern int iommu_qinval;
35 extern int iommu_intremap;
37 #define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu)
39 #define MAX_IOMMUS 32
41 #define PAGE_SHIFT_4K (12)
42 #define PAGE_SIZE_4K (1UL << PAGE_SHIFT_4K)
43 #define PAGE_MASK_4K (((u64)-1) << PAGE_SHIFT_4K)
44 #define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K)
46 struct iommu {
47 struct list_head list;
48 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
49 u32 index; /* Sequence number of iommu */
50 u32 nr_pt_levels;
51 u64 cap;
52 u64 ecap;
53 spinlock_t lock; /* protect context, domain ids */
54 spinlock_t register_lock; /* protect iommu register handling */
55 u64 root_maddr; /* root entry machine address */
56 int vector;
57 struct intel_iommu *intel;
58 };
60 int iommu_add_device(struct pci_dev *pdev);
61 int iommu_remove_device(struct pci_dev *pdev);
62 int iommu_domain_init(struct domain *d);
63 void iommu_domain_destroy(struct domain *d);
64 int device_assigned(u8 bus, u8 devfn);
65 int assign_device(struct domain *d, u8 bus, u8 devfn);
66 int deassign_device(struct domain *d, u8 bus, u8 devfn);
67 int iommu_get_device_group(struct domain *d, u8 bus, u8 devfn,
68 XEN_GUEST_HANDLE_64(uint32) buf, int max_sdevs);
69 int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn);
70 int iommu_unmap_page(struct domain *d, unsigned long gfn);
71 void iommu_domain_teardown(struct domain *d);
72 int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq);
73 int dpci_ioport_intercept(ioreq_t *p);
74 int pt_irq_create_bind_vtd(struct domain *d,
75 xen_domctl_bind_pt_irq_t *pt_irq_bind);
76 int pt_irq_destroy_bind_vtd(struct domain *d,
77 xen_domctl_bind_pt_irq_t *pt_irq_bind);
78 unsigned int io_apic_read_remap_rte(unsigned int apic, unsigned int reg);
79 void io_apic_write_remap_rte(unsigned int apic,
80 unsigned int reg, unsigned int value);
82 struct msi_desc;
83 struct msi_msg;
84 void msi_msg_read_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg);
85 void msi_msg_write_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg);
86 struct qi_ctrl *iommu_qi_ctrl(struct iommu *iommu);
87 struct ir_ctrl *iommu_ir_ctrl(struct iommu *iommu);
88 struct iommu_flush *iommu_get_flush(struct iommu *iommu);
89 void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq);
90 struct hvm_irq_dpci *domain_get_irq_dpci(struct domain *domain);
91 int domain_set_irq_dpci(struct domain *domain, struct hvm_irq_dpci *dpci);
92 void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
94 #define PT_IRQ_TIME_OUT MILLISECS(8)
95 #define VTDPREFIX "[VT-D]"
97 struct iommu_ops {
98 int (*init)(struct domain *d);
99 int (*add_device)(struct pci_dev *pdev);
100 int (*remove_device)(struct pci_dev *pdev);
101 int (*assign_device)(struct domain *d, u8 bus, u8 devfn);
102 void (*teardown)(struct domain *d);
103 int (*map_page)(struct domain *d, unsigned long gfn, unsigned long mfn);
104 int (*unmap_page)(struct domain *d, unsigned long gfn);
105 int (*reassign_device)(struct domain *s, struct domain *t,
106 u8 bus, u8 devfn);
107 int (*get_device_group_id)(u8 bus, u8 devfn);
108 void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
109 void (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
110 void (*read_msi_from_ire)(struct msi_desc *msi_desc, struct msi_msg *msg);
111 unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
112 };
114 void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned int value);
115 void iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg);
116 void iommu_read_msi_from_ire(struct msi_desc *msi_desc, struct msi_msg *msg);
117 unsigned int iommu_read_apic_from_ire(unsigned int apic, unsigned int reg);
119 void iommu_suspend(void);
120 void iommu_resume(void);
122 void iommu_set_dom0_mapping(struct domain *d);
124 #endif /* _IOMMU_H_ */