]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Restore IRTE.RemapEn bit for amd_iommu_activate_guest_mode
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Wed, 16 Sep 2020 11:17:20 +0000 (11:17 +0000)
committerJoerg Roedel <jroedel@suse.de>
Fri, 18 Sep 2020 09:17:19 +0000 (11:17 +0200)
commit440a6a5d6bcab94d129e1bd20e46cb50be0dfa49
treecd93e24c8e9c84af9e8c72a5f15df21140a85acb
parentf9f45709fc52635eda78a8738192f9fb7e1ddcbb
iommu/amd: Restore IRTE.RemapEn bit for amd_iommu_activate_guest_mode

Commit e14efa5cd106 ("iommu/amd: Use cmpxchg_double() when updating
128-bit IRTE") removed an assumption that modify_irte_ga always set
the valid bit, which requires the callers to set the appropriate value
for the struct irte_ga.valid bit before calling the function.

Similar to the commit 9f3bfa7f350e ("iommu/amd: Restore IRTE.RemapEn
bit after programming IRTE"), which is for the function
amd_iommu_deactivate_guest_mode().

The same change is also needed for the amd_iommu_activate_guest_mode().
Otherwise, this could trigger IO_PAGE_FAULT for the VFIO based VMs with
AVIC enabled.

Fixes: e14efa5cd1061 ("iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE")
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Tested-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Cc: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20200916111720.43913-1-suravee.suthikulpanit@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu.c