qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [V12 1/4] hw/pci: Prepare for AMD IOMMU


From: Jan Kiszka
Subject: Re: [Qemu-devel] [V12 1/4] hw/pci: Prepare for AMD IOMMU
Date: Wed, 22 Jun 2016 21:53:52 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2016-06-15 14:21, David Kiarie wrote:
> Introduce PCI macros from linux headers for use by AMD IOMMU
> 
> Signed-off-by: David Kiarie <address@hidden>
> ---
>  include/hw/pci/pci.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 4420f47..ac376c5 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -12,6 +12,8 @@
>  
>  /* PCI bus */
>  
> +#define PCI_BUS_NUM(x)          (((x) >> 8) & 0xff)

Minor: should probably come after PCI_DEVFN and before PCI_SLOT to have
some logical grouping.

> +#define PCI_DEVID(bus, devfn)   ((((uint16_t)(bus)) << 8) | (devfn))

That's often called "BDF" (bus-device-function). At least for me clearer
than "device ID".

>  #define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
>  #define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
>  #define PCI_FUNC(devfn)         ((devfn) & 0x07)
> 

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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