diff options
-rw-r--r-- | hw/pci/msi.c | 10 | ||||
-rw-r--r-- | hw/pci/msix.c | 3 | ||||
-rw-r--r-- | include/exec/memattrs.h | 2 | ||||
-rw-r--r-- | include/hw/pci/msi.h | 1 |
4 files changed, 13 insertions, 3 deletions
diff --git a/hw/pci/msi.c b/hw/pci/msi.c index 2949938223..c111dbaff6 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 9935f98ae5..7716bf3649 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) diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h index 1389b4b01d..96dc440423 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 81a3848a31..50e452bd05 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); |