Skip to content

Commit 26e495f

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Restore IRTE.RemapEn bit after programming IRTE
Currently, the RemapEn (valid) bit is accidentally cleared when programming IRTE w/ guestMode=0. It should be restored to the prior state. Fixes: b9fc6b5 ("iommu/amd: Implements irq_set_vcpu_affinity() hook to setup vapic mode for pass-through devices") Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Reviewed-by: Joao Martins <joao.m.martins@oracle.com> Link: https://lore.kernel.org/r/20200903093822.52012-2-suravee.suthikulpanit@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 2d33b7d commit 26e495f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,6 +3850,7 @@ int amd_iommu_deactivate_guest_mode(void *data)
38503850
struct amd_ir_data *ir_data = (struct amd_ir_data *)data;
38513851
struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
38523852
struct irq_cfg *cfg = ir_data->cfg;
3853+
u64 valid = entry->lo.fields_remap.valid;
38533854

38543855
if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
38553856
!entry || !entry->lo.fields_vapic.guest_mode)
@@ -3858,6 +3859,7 @@ int amd_iommu_deactivate_guest_mode(void *data)
38583859
entry->lo.val = 0;
38593860
entry->hi.val = 0;
38603861

3862+
entry->lo.fields_remap.valid = valid;
38613863
entry->lo.fields_remap.dm = apic->irq_dest_mode;
38623864
entry->lo.fields_remap.int_type = apic->irq_delivery_mode;
38633865
entry->hi.fields.vector = cfg->vector;

0 commit comments

Comments
 (0)