diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2018-03-22 11:22:36 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2018-03-29 04:38:15 -0400 |
commit | ea6166f4b83e9cfba1c18f46a764d50045682fe5 (patch) | |
tree | 89e549e2897afcdbf09ea31831744b1a55b27315 | |
parent | 2bc00180890427dcc092b2f2b0d03c904bcade29 (diff) |
iommu/amd: Split irq_lookup_table out of the amd_iommu_devtable_lock
The function get_irq_table() reads/writes irq_lookup_table while holding
the amd_iommu_devtable_lock. It also modifies
amd_iommu_dev_table[].data[2].
set_dte_entry() is using amd_iommu_dev_table[].data[0|1] (under the
domain->lock) so it should be okay. The access to the iommu is
serialized with its own (iommu's) lock.
So split out get_irq_table() out of amd_iommu_devtable_lock's lock.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/amd_iommu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index fcfdce70707d..a87d2fee68db 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -82,6 +82,7 @@ | |||
82 | 82 | ||
83 | static DEFINE_RWLOCK(amd_iommu_devtable_lock); | 83 | static DEFINE_RWLOCK(amd_iommu_devtable_lock); |
84 | static DEFINE_SPINLOCK(pd_bitmap_lock); | 84 | static DEFINE_SPINLOCK(pd_bitmap_lock); |
85 | static DEFINE_SPINLOCK(iommu_table_lock); | ||
85 | 86 | ||
86 | /* List of all available dev_data structures */ | 87 | /* List of all available dev_data structures */ |
87 | static LLIST_HEAD(dev_data_list); | 88 | static LLIST_HEAD(dev_data_list); |
@@ -3623,7 +3624,7 @@ static struct irq_remap_table *alloc_irq_table(u16 devid, bool ioapic) | |||
3623 | unsigned long flags; | 3624 | unsigned long flags; |
3624 | u16 alias; | 3625 | u16 alias; |
3625 | 3626 | ||
3626 | write_lock_irqsave(&amd_iommu_devtable_lock, flags); | 3627 | spin_lock_irqsave(&iommu_table_lock, flags); |
3627 | 3628 | ||
3628 | iommu = amd_iommu_rlookup_table[devid]; | 3629 | iommu = amd_iommu_rlookup_table[devid]; |
3629 | if (!iommu) | 3630 | if (!iommu) |
@@ -3688,7 +3689,7 @@ out: | |||
3688 | iommu_completion_wait(iommu); | 3689 | iommu_completion_wait(iommu); |
3689 | 3690 | ||
3690 | out_unlock: | 3691 | out_unlock: |
3691 | write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); | 3692 | spin_unlock_irqrestore(&iommu_table_lock, flags); |
3692 | 3693 | ||
3693 | return table; | 3694 | return table; |
3694 | } | 3695 | } |