]> www.infradead.org Git - users/dwmw2/linux.git/commit
iommu/amd: Move allocation of the top table into v1_alloc_pgtable
authorJason Gunthorpe <jgg@nvidia.com>
Fri, 30 Aug 2024 00:06:10 +0000 (21:06 -0300)
committerJoerg Roedel <jroedel@suse.de>
Wed, 4 Sep 2024 09:37:41 +0000 (11:37 +0200)
commit8d00b77a52ef4b2091696ca25753d0ab95e4d839
tree489666e46dc42ca6f868d410cd8f8fa25c561b30
parent89ffb2c3c2a1d0bff5515fc53f93de86fb6753c0
iommu/amd: Move allocation of the top table into v1_alloc_pgtable

All the page table memory should be allocated/free within the io_pgtable
struct. The v2 path is already doing this, make it consistent.

It is hard to see but the free of the root in protection_domain_free() is
a NOP on the success path because v1_free_pgtable() does
amd_iommu_domain_clr_pt_root().

The root memory is already freed because free_sub_pt() put it on the
freelist. The free path in protection_domain_free() is only used during
error unwind of protection_domain_alloc().

Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/1-v2-831cdc4d00f3+1a315-amd_iopgtbl_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/io_pgtable.c
drivers/iommu/amd/iommu.c