diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 12:16:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 12:16:56 -0500 |
commit | a26be149facb22d30cd92cadb26f651d6fe802c9 (patch) | |
tree | c467bd0cae818ef793e9a694b4cd2bdc88d9ff6b /drivers/iommu/amd_iommu_v2.c | |
parent | cdd305454ebd181fa35b648c0921fe7df27d6f3b (diff) | |
parent | a20cc76b9efae10c20123049df361adcd7f0e0b3 (diff) |
Merge tag 'iommu-updates-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU updates from Joerg Roedel:
"This time with:
- Generic page-table framework for ARM IOMMUs using the LPAE
page-table format, ARM-SMMU and Renesas IPMMU make use of it
already.
- Break out the IO virtual address allocator from the Intel IOMMU so
that it can be used by other DMA-API implementations too. The
first user will be the ARM64 common DMA-API implementation for
IOMMUs
- Device tree support for Renesas IPMMU
- Various fixes and cleanups all over the place"
* tag 'iommu-updates-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (36 commits)
iommu/amd: Convert non-returned local variable to boolean when relevant
iommu: Update my email address
iommu/amd: Use wait_event in put_pasid_state_wait
iommu/amd: Fix amd_iommu_free_device()
iommu/arm-smmu: Avoid build warning
iommu/fsl: Various cleanups
iommu/fsl: Use %pa to print phys_addr_t
iommu/omap: Print phys_addr_t using %pa
iommu: Make more drivers depend on COMPILE_TEST
iommu/ipmmu-vmsa: Fix IOMMU lookup when multiple IOMMUs are registered
iommu: Disable on !MMU builds
iommu/fsl: Remove unused fsl_of_pamu_ids[]
iommu/fsl: Fix section mismatch
iommu/ipmmu-vmsa: Use the ARM LPAE page table allocator
iommu: Fix trace_map() to report original iova and original size
iommu/arm-smmu: add support for iova_to_phys through ATS1PR
iopoll: Introduce memory-mapped IO polling macros
iommu/arm-smmu: don't touch the secure STLBIALL register
iommu/arm-smmu: make use of generic LPAE allocator
iommu: io-pgtable-arm: add non-secure quirk
...
Diffstat (limited to 'drivers/iommu/amd_iommu_v2.c')
-rw-r--r-- | drivers/iommu/amd_iommu_v2.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index 90f70d0e1141..6d5a5c44453b 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010-2012 Advanced Micro Devices, Inc. | 2 | * Copyright (C) 2010-2012 Advanced Micro Devices, Inc. |
3 | * Author: Joerg Roedel <joerg.roedel@amd.com> | 3 | * Author: Joerg Roedel <jroedel@suse.de> |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License version 2 as published | 6 | * under the terms of the GNU General Public License version 2 as published |
@@ -31,7 +31,7 @@ | |||
31 | #include "amd_iommu_proto.h" | 31 | #include "amd_iommu_proto.h" |
32 | 32 | ||
33 | MODULE_LICENSE("GPL v2"); | 33 | MODULE_LICENSE("GPL v2"); |
34 | MODULE_AUTHOR("Joerg Roedel <joerg.roedel@amd.com>"); | 34 | MODULE_AUTHOR("Joerg Roedel <jroedel@suse.de>"); |
35 | 35 | ||
36 | #define MAX_DEVICES 0x10000 | 36 | #define MAX_DEVICES 0x10000 |
37 | #define PRI_QUEUE_SIZE 512 | 37 | #define PRI_QUEUE_SIZE 512 |
@@ -151,18 +151,6 @@ static void put_device_state(struct device_state *dev_state) | |||
151 | wake_up(&dev_state->wq); | 151 | wake_up(&dev_state->wq); |
152 | } | 152 | } |
153 | 153 | ||
154 | static void put_device_state_wait(struct device_state *dev_state) | ||
155 | { | ||
156 | DEFINE_WAIT(wait); | ||
157 | |||
158 | prepare_to_wait(&dev_state->wq, &wait, TASK_UNINTERRUPTIBLE); | ||
159 | if (!atomic_dec_and_test(&dev_state->count)) | ||
160 | schedule(); | ||
161 | finish_wait(&dev_state->wq, &wait); | ||
162 | |||
163 | free_device_state(dev_state); | ||
164 | } | ||
165 | |||
166 | /* Must be called under dev_state->lock */ | 154 | /* Must be called under dev_state->lock */ |
167 | static struct pasid_state **__get_pasid_state_ptr(struct device_state *dev_state, | 155 | static struct pasid_state **__get_pasid_state_ptr(struct device_state *dev_state, |
168 | int pasid, bool alloc) | 156 | int pasid, bool alloc) |
@@ -278,14 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state) | |||
278 | 266 | ||
279 | static void put_pasid_state_wait(struct pasid_state *pasid_state) | 267 | static void put_pasid_state_wait(struct pasid_state *pasid_state) |
280 | { | 268 | { |
281 | DEFINE_WAIT(wait); | 269 | wait_event(pasid_state->wq, !atomic_read(&pasid_state->count)); |
282 | |||
283 | prepare_to_wait(&pasid_state->wq, &wait, TASK_UNINTERRUPTIBLE); | ||
284 | |||
285 | if (!atomic_dec_and_test(&pasid_state->count)) | ||
286 | schedule(); | ||
287 | |||
288 | finish_wait(&pasid_state->wq, &wait); | ||
289 | free_pasid_state(pasid_state); | 270 | free_pasid_state(pasid_state); |
290 | } | 271 | } |
291 | 272 | ||
@@ -851,7 +832,13 @@ void amd_iommu_free_device(struct pci_dev *pdev) | |||
851 | /* Get rid of any remaining pasid states */ | 832 | /* Get rid of any remaining pasid states */ |
852 | free_pasid_states(dev_state); | 833 | free_pasid_states(dev_state); |
853 | 834 | ||
854 | put_device_state_wait(dev_state); | 835 | put_device_state(dev_state); |
836 | /* | ||
837 | * Wait until the last reference is dropped before freeing | ||
838 | * the device state. | ||
839 | */ | ||
840 | wait_event(dev_state->wq, !atomic_read(&dev_state->count)); | ||
841 | free_device_state(dev_state); | ||
855 | } | 842 | } |
856 | EXPORT_SYMBOL(amd_iommu_free_device); | 843 | EXPORT_SYMBOL(amd_iommu_free_device); |
857 | 844 | ||
@@ -921,7 +908,7 @@ static int __init amd_iommu_v2_init(void) | |||
921 | { | 908 | { |
922 | int ret; | 909 | int ret; |
923 | 910 | ||
924 | pr_info("AMD IOMMUv2 driver by Joerg Roedel <joerg.roedel@amd.com>\n"); | 911 | pr_info("AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>\n"); |
925 | 912 | ||
926 | if (!amd_iommu_v2_supported()) { | 913 | if (!amd_iommu_v2_supported()) { |
927 | pr_info("AMD IOMMUv2 functionality not available on this system\n"); | 914 | pr_info("AMD IOMMUv2 functionality not available on this system\n"); |