[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] hw/pci: Introduce msi_device_id()
From: |
Pavel Fedin |
Subject: |
[Qemu-devel] [PATCH 2/3] hw/pci: Introduce msi_device_id() |
Date: |
Tue, 13 Oct 2015 15:12:01 +0300 |
We will need to get device IDs in KVM IRQ routing code too. This patch
introduces reusable convenient way to obtain it from the device pointer.
Signed-off-by: Pavel Fedin <address@hidden>
---
hw/pci/msi.c | 2 +-
include/hw/pci/msi.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index f9c0484..f18bb56 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -294,7 +294,7 @@ void msi_send_message(PCIDevice *dev, MSIMessage msg)
{
MemTxAttrs attrs = {};
- attrs.stream_id = (pci_bus_num(dev->bus) << 8) | dev->devfn;
+ attrs.stream_id = msi_device_id(dev);
address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
attrs, NULL);
}
diff --git a/include/hw/pci/msi.h b/include/hw/pci/msi.h
index 50e452b..748bca1 100644
--- a/include/hw/pci/msi.h
+++ b/include/hw/pci/msi.h
@@ -43,6 +43,11 @@ 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);
+static inline uint16_t msi_device_id(PCIDevice *dev)
+{
+ return (pci_bus_num(dev->bus) << 8) | dev->devfn;
+}
+
static inline bool msi_present(const PCIDevice *dev)
{
return dev->cap_present & QEMU_PCI_CAP_MSI;
--
2.4.4
[Qemu-devel] [PATCH 3/3] kvm: Pass PCI device pointer to MSI routing functions, Pavel Fedin, 2015/10/15