From: Andre Przywara <andre.przywara@arm.com>
To: Marc Zyngier <marc.zyngier@arm.com>,
Christoffer Dall <christoffer.dall@linaro.org>,
Eric Auger <eric.auger@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: [PATCH v10 03/17] KVM: extend struct kvm_msi to hold a 32-bit device ID
Date: Fri, 15 Jul 2016 12:43:24 +0100 [thread overview]
Message-ID: <20160715114338.10484-4-andre.przywara@arm.com> (raw)
In-Reply-To: <20160715114338.10484-1-andre.przywara@arm.com>
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>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
---
Documentation/virtual/kvm/api.txt | 12 ++++++++++--
include/uapi/linux/kvm.h | 5 ++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 09efa9e..6551311 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2175,10 +2175,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
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 05ebf47..7de96f5 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -866,6 +866,7 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_ARM_PMU_V3 126
#define KVM_CAP_VCPU_ATTRIBUTES 127
#define KVM_CAP_MAX_VCPU_ID 128
+#define KVM_CAP_MSI_DEVID 129
#ifdef KVM_CAP_IRQ_ROUTING
@@ -1024,12 +1025,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 {
--
2.9.0
next prev parent reply other threads:[~2016-07-15 11:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 11:43 [PATCH v10 00/17] KVM: arm64: GICv3 ITS emulation Andre Przywara
2016-07-15 11:43 ` [PATCH v10 01/17] KVM: arm/arm64: move redistributor kvm_io_devices Andre Przywara
2016-07-15 11:43 ` [PATCH v10 02/17] KVM: arm/arm64: check return value for kvm_register_vgic_device Andre Przywara
2016-07-15 11:43 ` Andre Przywara [this message]
2016-07-15 11:43 ` [PATCH v10 04/17] KVM: arm/arm64: extend arch CAP checks to allow per-VM capabilities Andre Przywara
2016-07-15 11:43 ` [PATCH v10 05/17] KVM: kvm_io_bus: add kvm_io_bus_get_dev() call Andre Przywara
2016-07-15 11:43 ` [PATCH v10 06/17] KVM: arm/arm64: VGIC: add refcounting for IRQs Andre Przywara
2016-07-15 11:43 ` [PATCH v10 07/17] irqchip: refactor and add GICv3 definitions Andre Przywara
2016-07-15 11:43 ` [PATCH v10 08/17] KVM: arm64: handle ITS related GICv3 redistributor registers Andre Przywara
2016-07-15 11:43 ` [PATCH v10 09/17] KVM: arm64: introduce ITS emulation file with MMIO framework Andre Przywara
2016-07-18 9:18 ` Auger Eric
2016-07-18 9:43 ` Marc Zyngier
2016-07-18 10:06 ` Auger Eric
2016-07-18 16:34 ` Andre Przywara
2016-07-18 16:36 ` Auger Eric
2016-07-15 11:43 ` [PATCH v10 10/17] KVM: arm64: introduce new KVM ITS device Andre Przywara
2016-07-15 11:43 ` [PATCH v10 11/17] KVM: arm64: implement basic ITS register handlers Andre Przywara
2016-07-15 11:43 ` [PATCH v10 12/17] KVM: arm64: connect LPIs to the VGIC emulation Andre Przywara
2016-07-15 11:43 ` [PATCH v10 13/17] KVM: arm64: read initial LPI pending table Andre Przywara
2016-07-15 11:43 ` [PATCH v10 14/17] KVM: arm64: allow updates of LPI configuration table Andre Przywara
2016-07-15 11:43 ` [PATCH v10 15/17] KVM: arm64: implement ITS command queue command handlers Andre Przywara
2016-07-16 10:08 ` Marc Zyngier
2016-07-17 23:23 ` André Przywara
2016-07-18 7:46 ` Marc Zyngier
2016-07-18 7:45 ` André Przywara
2016-07-15 11:43 ` [PATCH v10 16/17] KVM: arm64: implement MSI injection in ITS emulation Andre Przywara
2016-07-15 11:43 ` [PATCH v10 17/17] KVM: arm64: enable ITS emulation as a virtual MSI controller Andre Przywara
2016-07-18 13:12 ` [PATCH v10 00/17] KVM: arm64: GICv3 ITS emulation Auger Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160715114338.10484-4-andre.przywara@arm.com \
--to=andre.przywara@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox