From cdd5c088ff46ebf423c926fe4c0b12e345ae0db0 Mon Sep 17 00:00:00 2001 From: Shameer Kolothum Date: Thu, 23 Feb 2023 12:12:48 +0000 Subject: [PATCH] =?UTF-8?q?kvm:=20Translate=20MSI=20doorbell=20address?= =?UTF-8?q?=C2=A0only=20if=20it=20is=20valid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guest might have already set the MSI doorbell address to invalid and if we try to translate the address again, Guest reports, [ 26.784082] arm-smmu-v3 arm-smmu-v3.0.auto: event 0x10 received: [ 26.784088] arm-smmu-v3 arm-smmu-v3.0.auto: 0x0000001000000010 [ 26.784090] arm-smmu-v3 arm-smmu-v3.0.auto: 0x0000000000000000 [ 26.784092] arm-smmu-v3 arm-smmu-v3.0.auto: 0x0000000000000000 [ 26.784094] arm-smmu-v3 arm-smmu-v3.0.auto: 0x0000000000000000 [ 26.788082] arm-smmu-v3 arm-smmu-v3.0.auto: event 0x10 received: [ 26.788085] arm-smmu-v3 arm-smmu-v3.0.auto: 0x0000001000000010 [ 26.788087] arm-smmu-v3 arm-smmu-v3.0.auto: 0x0000000000000000 .... eg: rmmod hisi_zip.ko. The sequence seems to be, - Write 0 to MSI Message Address register - Disable MSI Hence check for address validity before we try to do the translation. Note: The fix is placed in generic code and hopefully is not a problem for other architectures. Signed-off-by: Shameer Kolothum --- accel/kvm/kvm-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index a8e29f148e..6fa97d2cbf 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2074,7 +2074,8 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg, kroute.flags = KVM_MSI_VALID_DEVID; kroute.u.msi.devid = pci_requester_id(dev); } - if (kvm_arch_fixup_msi_route(&kroute, msg.address, msg.data, dev)) { + if (msg.address && + kvm_arch_fixup_msi_route(&kroute, msg.address, msg.data, dev)) { return -EINVAL; } -- 2.41.0.windows.1