ia64/xen-unstable

view xen/drivers/passthrough/vtd/dmar.h @ 17265:70f9a2110421

Intel VTD: Ignore USB RMRR for HVM guest

USB controller RMRR (0xed000 - 0xeffff) conflicts with HVM guest bios
region. Setting identity mapping for it will cover the guest bios
region in p2m table. This causes system crash.

As VT-d spec says, USB controller RMRR is used in case of DMA
performed by a USB controller under BIOS SMM control for legacy
keyboard emulation. Whereas, current guest BIOS doesn't support
emulating stardand Keyboard/mouse, and it also doesn't support SMM
mode. Actually it is no chance to use USB controller RMRR now.

This patch ignores the USB controller RMRR for HVM guest.

Signed-off-by: Weidong Han <weidong.han@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 19 10:22:49 2008 +0000 (2008-03-19)
parents bf8a3fc79093
children 5b7a3e040683
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) Ashok Raj <ashok.raj@intel.com>
18 * Copyright (C) Shaohua Li <shaohua.li@intel.com>
19 */
21 #ifndef _DMAR_H_
22 #define _DMAR_H_
24 #include <xen/list.h>
25 #include <xen/iommu.h>
27 extern u8 dmar_host_address_width;
29 /* This one is for interrupt remapping */
30 struct acpi_ioapic_unit {
31 struct list_head list;
32 int apic_id;
33 union {
34 u16 info;
35 struct {
36 u16 func: 3,
37 dev: 5,
38 bus: 8;
39 }bdf;
40 }ioapic;
41 };
43 struct acpi_drhd_unit {
44 struct list_head list;
45 unsigned long address; /* register base address of the unit */
46 struct pci_dev *devices; /* target devices */
47 int devices_cnt;
48 u8 include_all:1;
49 struct iommu *iommu;
50 struct list_head ioapic_list;
51 };
53 struct acpi_rmrr_unit {
54 struct list_head list;
55 unsigned long base_address;
56 unsigned long end_address;
57 struct pci_dev *devices; /* target devices */
58 int devices_cnt;
59 u8 allow_all:1;
60 };
62 struct acpi_atsr_unit {
63 struct list_head list;
64 struct pci_dev *devices; /* target devices */
65 int devices_cnt;
66 u8 all_ports:1;
67 };
69 #define for_each_iommu(domain, iommu) \
70 list_for_each_entry(iommu, \
71 &(domain->arch.hvm_domain.hvm_iommu.iommu_list), list)
73 #define for_each_pdev(domain, pdev) \
74 list_for_each_entry(pdev, \
75 &(domain->arch.hvm_domain.hvm_iommu.pdev_list), list)
77 #define for_each_drhd_unit(drhd) \
78 list_for_each_entry(drhd, &acpi_drhd_units, list)
79 #define for_each_rmrr_device(rmrr, pdev) \
80 list_for_each_entry(rmrr, &acpi_rmrr_units, list) { \
81 int _i; \
82 for (_i = 0; _i < rmrr->devices_cnt; _i++) { \
83 pdev = &(rmrr->devices[_i]);
84 #define end_for_each_rmrr_device(rmrr, pdev) \
85 } \
86 }
88 struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *dev);
89 struct acpi_rmrr_unit * acpi_find_matched_rmrr_unit(struct pci_dev *dev);
91 #define DMAR_TYPE 1
92 #define RMRR_TYPE 2
93 #define ATSR_TYPE 3
95 #define DMAR_OPERATION_TIMEOUT (HZ*60) /* 1m */
96 #define time_after(a,b) \
97 (typecheck(unsigned long, a) && \
98 typecheck(unsigned long, b) && \
99 ((long)(b) - (long)(a) < 0))
101 int vtd_hw_check(void);
102 void disable_pmr(struct iommu *iommu);
103 int is_usb_device(struct pci_dev *pdev);
105 #endif // _DMAR_H_