diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-01-27 05:04:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-27 05:04:40 -0500 |
commit | e0b5f80dd4226a920257c91a3b9070e81149060b (patch) | |
tree | 34ceb6fbebb7ba3cda95dc6ca623084daf141b51 /arch/x86 | |
parent | b7a0afb0b4649d9b43488d5f5b1660bc9cffcff6 (diff) | |
parent | a02b11937a6e1079fdf386833129cd86a3576196 (diff) |
Merge branch 'iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into x86/urgent
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/amd_iommu_proto.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 23 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 3 |
3 files changed, 20 insertions, 7 deletions
diff --git a/arch/x86/include/asm/amd_iommu_proto.h b/arch/x86/include/asm/amd_iommu_proto.h index 4d817f9e6e77..d2544f1d705d 100644 --- a/arch/x86/include/asm/amd_iommu_proto.h +++ b/arch/x86/include/asm/amd_iommu_proto.h | |||
@@ -31,6 +31,7 @@ extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu); | |||
31 | extern int amd_iommu_init_devices(void); | 31 | extern int amd_iommu_init_devices(void); |
32 | extern void amd_iommu_uninit_devices(void); | 32 | extern void amd_iommu_uninit_devices(void); |
33 | extern void amd_iommu_init_notifier(void); | 33 | extern void amd_iommu_init_notifier(void); |
34 | extern void amd_iommu_init_api(void); | ||
34 | #ifndef CONFIG_AMD_IOMMU_STATS | 35 | #ifndef CONFIG_AMD_IOMMU_STATS |
35 | 36 | ||
36 | static inline void amd_iommu_stats_init(void) { } | 37 | static inline void amd_iommu_stats_init(void) { } |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 23824fef789c..adb0ba025702 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -980,7 +980,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom, | |||
980 | { | 980 | { |
981 | int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; | 981 | int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT; |
982 | struct amd_iommu *iommu; | 982 | struct amd_iommu *iommu; |
983 | int i; | 983 | unsigned long i; |
984 | 984 | ||
985 | #ifdef CONFIG_IOMMU_STRESS | 985 | #ifdef CONFIG_IOMMU_STRESS |
986 | populate = false; | 986 | populate = false; |
@@ -1489,11 +1489,14 @@ static void __detach_device(struct device *dev) | |||
1489 | { | 1489 | { |
1490 | struct iommu_dev_data *dev_data = get_dev_data(dev); | 1490 | struct iommu_dev_data *dev_data = get_dev_data(dev); |
1491 | struct iommu_dev_data *alias_data; | 1491 | struct iommu_dev_data *alias_data; |
1492 | struct protection_domain *domain; | ||
1492 | unsigned long flags; | 1493 | unsigned long flags; |
1493 | 1494 | ||
1494 | BUG_ON(!dev_data->domain); | 1495 | BUG_ON(!dev_data->domain); |
1495 | 1496 | ||
1496 | spin_lock_irqsave(&dev_data->domain->lock, flags); | 1497 | domain = dev_data->domain; |
1498 | |||
1499 | spin_lock_irqsave(&domain->lock, flags); | ||
1497 | 1500 | ||
1498 | if (dev_data->alias != dev) { | 1501 | if (dev_data->alias != dev) { |
1499 | alias_data = get_dev_data(dev_data->alias); | 1502 | alias_data = get_dev_data(dev_data->alias); |
@@ -1504,13 +1507,15 @@ static void __detach_device(struct device *dev) | |||
1504 | if (atomic_dec_and_test(&dev_data->bind)) | 1507 | if (atomic_dec_and_test(&dev_data->bind)) |
1505 | do_detach(dev); | 1508 | do_detach(dev); |
1506 | 1509 | ||
1507 | spin_unlock_irqrestore(&dev_data->domain->lock, flags); | 1510 | spin_unlock_irqrestore(&domain->lock, flags); |
1508 | 1511 | ||
1509 | /* | 1512 | /* |
1510 | * If we run in passthrough mode the device must be assigned to the | 1513 | * If we run in passthrough mode the device must be assigned to the |
1511 | * passthrough domain if it is detached from any other domain | 1514 | * passthrough domain if it is detached from any other domain. |
1515 | * Make sure we can deassign from the pt_domain itself. | ||
1512 | */ | 1516 | */ |
1513 | if (iommu_pass_through && dev_data->domain == NULL) | 1517 | if (iommu_pass_through && |
1518 | (dev_data->domain == NULL && domain != pt_domain)) | ||
1514 | __attach_device(dev, pt_domain); | 1519 | __attach_device(dev, pt_domain); |
1515 | } | 1520 | } |
1516 | 1521 | ||
@@ -2218,6 +2223,12 @@ static struct dma_map_ops amd_iommu_dma_ops = { | |||
2218 | /* | 2223 | /* |
2219 | * The function which clues the AMD IOMMU driver into dma_ops. | 2224 | * The function which clues the AMD IOMMU driver into dma_ops. |
2220 | */ | 2225 | */ |
2226 | |||
2227 | void __init amd_iommu_init_api(void) | ||
2228 | { | ||
2229 | register_iommu(&amd_iommu_ops); | ||
2230 | } | ||
2231 | |||
2221 | int __init amd_iommu_init_dma_ops(void) | 2232 | int __init amd_iommu_init_dma_ops(void) |
2222 | { | 2233 | { |
2223 | struct amd_iommu *iommu; | 2234 | struct amd_iommu *iommu; |
@@ -2253,8 +2264,6 @@ int __init amd_iommu_init_dma_ops(void) | |||
2253 | /* Make the driver finally visible to the drivers */ | 2264 | /* Make the driver finally visible to the drivers */ |
2254 | dma_ops = &amd_iommu_dma_ops; | 2265 | dma_ops = &amd_iommu_dma_ops; |
2255 | 2266 | ||
2256 | register_iommu(&amd_iommu_ops); | ||
2257 | |||
2258 | amd_iommu_stats_init(); | 2267 | amd_iommu_stats_init(); |
2259 | 2268 | ||
2260 | return 0; | 2269 | return 0; |
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index fb490ce7dd55..9dc91b431470 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -1292,9 +1292,12 @@ static int __init amd_iommu_init(void) | |||
1292 | ret = amd_iommu_init_passthrough(); | 1292 | ret = amd_iommu_init_passthrough(); |
1293 | else | 1293 | else |
1294 | ret = amd_iommu_init_dma_ops(); | 1294 | ret = amd_iommu_init_dma_ops(); |
1295 | |||
1295 | if (ret) | 1296 | if (ret) |
1296 | goto free; | 1297 | goto free; |
1297 | 1298 | ||
1299 | amd_iommu_init_api(); | ||
1300 | |||
1298 | amd_iommu_init_notifier(); | 1301 | amd_iommu_init_notifier(); |
1299 | 1302 | ||
1300 | enable_iommus(); | 1303 | enable_iommus(); |