Skip to content

Commit 91da87d

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/amd: Add lockdep asserts for domain->dev_list
Add an assertion to all the iteration points that don't obviously have the lock held already. These all take the locker higher in their call chains. Signed-off-by: Jason Gunthorpe <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4a552f7 commit 91da87d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,7 @@ static int domain_flush_pages_v2(struct protection_domain *pdom,
14151415
struct iommu_cmd cmd;
14161416
int ret = 0;
14171417

1418+
lockdep_assert_held(&pdom->lock);
14181419
list_for_each_entry(dev_data, &pdom->dev_list, list) {
14191420
struct amd_iommu *iommu = get_amd_iommu_from_dev(dev_data->dev);
14201421
u16 domid = dev_data->gcr3_info.domid;
@@ -1464,6 +1465,8 @@ static void __domain_flush_pages(struct protection_domain *domain,
14641465
ioasid_t pasid = IOMMU_NO_PASID;
14651466
bool gn = false;
14661467

1468+
lockdep_assert_held(&domain->lock);
1469+
14671470
if (pdom_is_v2_pgtbl_mode(domain)) {
14681471
gn = true;
14691472
ret = domain_flush_pages_v2(domain, address, size);
@@ -1585,6 +1588,8 @@ void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
15851588
{
15861589
struct iommu_dev_data *dev_data;
15871590

1591+
lockdep_assert_held(&domain->lock);
1592+
15881593
list_for_each_entry(dev_data, &domain->dev_list, list) {
15891594
struct amd_iommu *iommu = rlookup_amd_iommu(dev_data->dev);
15901595

0 commit comments

Comments
 (0)