]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
KVM: extend struct kvm_msi to hold a 32-bit device ID
authorTirumalesh Chalamarla <tchalamarla@caviumnetworks.com>
Mon, 27 Jul 2015 17:46:29 +0000 (10:46 -0700)
committerJulien Grall <julien.grall@citrix.com>
Mon, 28 Sep 2015 11:05:11 +0000 (12:05 +0100)
The ARM GICv3 ITS MSI controller requires a device ID to be able to
assign the proper interrupt vector. On real hardware, this ID is
sampled from the bus. To be able to emulate an ITS controller, extend
the KVM MSI interface to let userspace provide such a device ID. For
PCI devices, the device ID is simply the 16-bit bus-device-function
triplet, which should be easily available to the userland tool.

Also there is a new KVM capability which advertises whether the
current VM requires a device ID to be set along with the MSI data.
This flag is still reported as not available everywhere, later we will
enable it when ITS emulation is used.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Tirumalesh Chalamarla <tchalamarla@caviumnetworks.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
Documentation/virtual/kvm/api.txt
include/uapi/linux/kvm.h

index a7926a90156f64172897ca5a9ae562f7975701a7..cb0409563ae9c95bf68bb30dda58df08cc03d249 100644 (file)
@@ -2147,10 +2147,18 @@ struct kvm_msi {
        __u32 address_hi;
        __u32 data;
        __u32 flags;
-       __u8  pad[16];
+       __u32 devid;
+       __u8  pad[12];
 };
 
-No flags are defined so far. The corresponding field must be 0.
+flags: KVM_MSI_VALID_DEVID: devid contains a valid value
+devid: If KVM_MSI_VALID_DEVID is set, contains a unique device identifier
+       for the device that wrote the MSI message.
+       For PCI, this is usually a BFD identifier in the lower 16 bits.
+
+The per-VM KVM_CAP_MSI_DEVID capability advertises the need to provide
+the device ID. If this capability is not set, userland cannot rely on
+the kernel to allow the KVM_MSI_VALID_DEVID flag being set.
 
 
 4.71 KVM_CREATE_PIT2
index 716ad4ae4d4b10443f4618bd96e86a71fa521d78..1c48defb66de6cd913f80d0b2f36e88fffc05b00 100644 (file)
@@ -817,6 +817,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_DISABLE_QUIRKS 116
 #define KVM_CAP_X86_SMM 117
 #define KVM_CAP_MULTI_ADDRESS_SPACE 118
+#define KVM_CAP_MSI_DEVID 119
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -968,12 +969,14 @@ struct kvm_one_reg {
        __u64 addr;
 };
 
+#define KVM_MSI_VALID_DEVID    (1U << 0)
 struct kvm_msi {
        __u32 address_lo;
        __u32 address_hi;
        __u32 data;
        __u32 flags;
-       __u8  pad[16];
+       __u32 devid;
+       __u8  pad[12];
 };
 
 struct kvm_arm_device_addr {