From: Sean Christopherson Date: Fri, 4 Apr 2025 19:38:20 +0000 (-0700) Subject: iommu/amd: Return an error if vCPU affinity is set for non-vCPU IRTE X-Git-Tag: v5.10.237~50 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2eac0a7ec1da47495e61654d4098be929fafc8c0;p=thirdparty%2Fkernel%2Fstable.git iommu/amd: Return an error if vCPU affinity is set for non-vCPU IRTE [ Upstream commit 07172206a26dcf3f0bf7c3ecaadd4242b008ea54 ] Return -EINVAL instead of success if amd_ir_set_vcpu_affinity() is invoked without use_vapic; lying to KVM about whether or not the IRTE was configured to post IRQs is all kinds of bad. Fixes: d98de49a53e4 ("iommu/amd: Enable vAPIC interrupt remapping mode by default") Signed-off-by: Sean Christopherson Message-ID: <20250404193923.1413163-6-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 0a061a196b531..a9a3f9c649c7e 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -3979,7 +3979,7 @@ static int amd_ir_set_vcpu_affinity(struct irq_data *data, void *vcpu_info) * we should not modify the IRTE */ if (!dev_data || !dev_data->use_vapic) - return 0; + return -EINVAL; ir_data->cfg = irqd_cfg(data); pi_data->ir_data = ir_data;