Skip to content

Commit 272e4f9

Browse files
committed
iommu/amd: WARN when __[attach|detach]_device are called with irqs enabled
These functions rely on being called with IRQs disabled. Add a WARN_ON to detect early when its not. Signed-off-by: Joerg Roedel <[email protected]>
1 parent f1dd0a8 commit 272e4f9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,12 @@ static int __attach_device(struct iommu_dev_data *dev_data,
20302030
{
20312031
int ret;
20322032

2033+
/*
2034+
* Must be called with IRQs disabled. Warn here to detect early
2035+
* when its not.
2036+
*/
2037+
WARN_ON(!irqs_disabled());
2038+
20332039
/* lock domain */
20342040
spin_lock(&domain->lock);
20352041

@@ -2190,6 +2196,12 @@ static void __detach_device(struct iommu_dev_data *dev_data)
21902196
{
21912197
struct protection_domain *domain;
21922198

2199+
/*
2200+
* Must be called with IRQs disabled. Warn here to detect early
2201+
* when its not.
2202+
*/
2203+
WARN_ON(!irqs_disabled());
2204+
21932205
if (WARN_ON(!dev_data->domain))
21942206
return;
21952207

0 commit comments

Comments
 (0)