qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] hw/pci: Introduce msi_device_id()


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 2/3] hw/pci: Introduce msi_device_id()
Date: Tue, 13 Oct 2015 15:56:38 +0300

On Tue, Oct 13, 2015 at 03:12:01PM +0300, Pavel Fedin wrote:
> 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>

What make this specific format an msi id?
I think this is some kvm specific hack.
If true it belongs there.

> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]