From a05f686ff39c373384772b01f1b7fc71e7eb2500 Mon Sep 17 00:00:00 2001 From: Pavel Fedin Date: Thu, 15 Oct 2015 16:44:51 +0300 Subject: hw/pci: Introduce pci_requester_id() For GICv3 ITS implementation we are going to use requester IDs in KVM IRQ routing code. This patch introduces reusable convenient way to obtain this ID from the device pointer. The new function is now used in some places, where the same calculation was used. MemTxAttrs.stream_id also renamed to requester_id in order to better reflect semantics of the field. Signed-off-by: Pavel Fedin Reviewed-by: Michael S. Tsirkin Acked-by: Michael S. Tsirkin Message-Id: <5814bcb03a297f198e796b13ed9c35059c52f89b.1444916432.git.p.fedin@samsung.com> Signed-off-by: Paolo Bonzini --- include/hw/pci/pci.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/hw') diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 551cb3d..f5e7fd8 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -677,6 +677,11 @@ static inline uint32_t pci_config_size(const PCIDevice *d) return pci_is_express(d) ? PCIE_CONFIG_SPACE_SIZE : PCI_CONFIG_SPACE_SIZE; } +static inline uint16_t pci_requester_id(PCIDevice *dev) +{ + return (pci_bus_num(dev->bus) << 8) | dev->devfn; +} + /* DMA access functions */ static inline AddressSpace *pci_get_address_space(PCIDevice *dev) { -- cgit v1.1