[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 45/60] Add stream ID to MSI write
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 45/60] Add stream ID to MSI write |
Date: |
Mon, 1 Jun 2015 14:25:04 +0200 |
From: Pavel Fedin <address@hidden>
GICv3 ITS distinguishes between devices by using hardwired device IDs passed on
the bus.
This patch implements passing these IDs in qemu.
SMMU is also known to use stream IDs, therefore this addition can also be
useful for
implementing platforms with SMMU.
Signed-off-by: Pavel Fedin <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Changes from v1:
- Added bus number to the stream ID
- Added stream ID not only to MSI-X, but also to plain MSI. Some common code
was made into
msi_send_message() function.
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/exec/memattrs.h | 2 ++
include/hw/pci/msi.h | 1 +
hw/pci/msi.c | 10 +++++++++-
hw/pci/msix.c | 3 +--
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
index 1389b4b..96dc440 100644
--- a/include/exec/memattrs.h
+++ b/include/exec/memattrs.h
@@ -33,6 +33,8 @@ typedef struct MemTxAttrs {
unsigned int secure:1;
/* Memory access is usermode (unprivileged) */
unsigned int user:1;
+ /* Stream ID (for MSI for example) */
+ unsigned int stream_id:16;
} MemTxAttrs;
/* Bus masters which don't specify any attributes will get this,
diff --git a/include/hw/pci/msi.h b/include/hw/pci/msi.h
index 81a3848..50e452b 100644
--- a/include/hw/pci/msi.h
+++ b/include/hw/pci/msi.h
@@ -39,6 +39,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
void msi_uninit(struct PCIDevice *dev);
void msi_reset(PCIDevice *dev);
void msi_notify(PCIDevice *dev, unsigned int vector);
+void msi_send_message(PCIDevice *dev, MSIMessage msg);
void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len);
unsigned int msi_nr_vectors_allocated(const PCIDevice *dev);
diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index 2949938..c111dba 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -291,8 +291,16 @@ void msi_notify(PCIDevice *dev, unsigned int vector)
"notify vector 0x%x"
" address: 0x%"PRIx64" data: 0x%"PRIx32"\n",
vector, msg.address, msg.data);
+ msi_send_message(dev, msg);
+}
+
+void msi_send_message(PCIDevice *dev, MSIMessage msg)
+{
+ MemTxAttrs attrs = {};
+
+ attrs.stream_id = (pci_bus_num(dev->bus) << 8) | dev->devfn;
address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
- MEMTXATTRS_UNSPECIFIED, NULL);
+ attrs, NULL);
}
/* Normally called by pci_default_write_config(). */
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 9935f98..7716bf3 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -443,8 +443,7 @@ void msix_notify(PCIDevice *dev, unsigned vector)
msg = msix_get_message(dev, vector);
- address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
- MEMTXATTRS_UNSPECIFIED, NULL);
+ msi_send_message(dev, msg);
}
void msix_reset(PCIDevice *dev)
--
MST
- [Qemu-devel] [PULL v2 38/60] virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX, (continued)
- [Qemu-devel] [PULL v2 38/60] virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 39/60] virtio: increase the queue limit to 1024, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 40/60] i386/pc: pc_basic_device_init(): delegate FDC creation request, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 41/60] i386/pc: '-drive if=floppy' should imply a board-default FDC, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 43/60] i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 42/60] i386/pc_q35: don't insist on board FDC if there's no default floppy, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 44/60] acpi: Simplify printing to dynamic string, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 45/60] Add stream ID to MSI write,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 46/60] Extend TPM TIS interface to support TPM 2, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 47/60] tpm: Probe for connected TPM 1.2 or TPM 2, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 48/60] TPM2 ACPI table support, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 49/60] acpi: add aml_add() term, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 50/60] acpi: add aml_lless() term, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 51/60] acpi: add aml_index() term, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 53/60] acpi: add aml_shiftright() term, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 52/60] acpi: add aml_shiftleft() term, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 54/60] acpi: add aml_increment() term, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 55/60] acpi: add aml_while() term, Michael S. Tsirkin, 2015/06/01