WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 4 of 6] ats: Add new ATS helper functions

To: "Wei Wang" <wei.wang2@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH 4 of 6] ats: Add new ATS helper functions
From: "Jan Beulich" <JBeulich@xxxxxxxx>
Date: Wed, 02 Nov 2011 13:50:09 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 02 Nov 2011 06:50:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <3dc5e805d9142cbe1074.1319548056@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1319548052@xxxxxxxxxxxx> <3dc5e805d9142cbe1074.1319548056@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 25.10.11 at 15:07, Wei Wang <wei.wang2@xxxxxxx> wrote:
> # HG changeset patch
> # User Wei Wang <wei.wang2@xxxxxxx>
> # Date 1319472696 -7200
> # Node ID 3dc5e805d9142cbe1074610879e258b6fab43409
> # Parent  18088bd3e8f6c16b7aef3d8652f2b9878117fcd5
> ats: Add new ATS helper functions
> 
> Signed-off-by Wei Wang <wei.wang2@xxxxxxx>
> 
> diff -r 18088bd3e8f6 -r 3dc5e805d914 xen/drivers/passthrough/x86/ats.c
> --- a/xen/drivers/passthrough/x86/ats.c       Mon Oct 24 18:11:32 2011 +0200
> +++ b/xen/drivers/passthrough/x86/ats.c       Mon Oct 24 18:11:36 2011 +0200
> @@ -138,3 +138,42 @@ void disable_ats_device(int seg, int bus
>                  seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
>  }
>  
> +int pci_ats_enabled(int seg, int bus, int devfn)
> +{
> +    u32 value;
> +    int pos;
> +
> +    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
> +    BUG_ON(!pos);
> +
> +    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
> +                            PCI_FUNC(devfn), pos + ATS_REG_CTL);
> +    return value & ATS_ENABLE;
> +}
> +
> +int pci_ats_device(int seg, int bus, int devfn)
> +{
> +    if ( !ats_enabled )
> +        return 0;
> +
> +    if ( !pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS) )
> +        return 0;
> +
> +    return 1;
> +}

At least this one would certainly be a candidate for inlining.

> +
> +struct pci_ats_dev* get_ats_device(int seg, int bus, int devfn)

Formatting (asterisk and space should switch places).

> +{
> +    struct pci_ats_dev *pdev;
> +
> +    if ( !pci_ats_device(seg, bus, devfn) )
> +        return NULL;
> +
> +    list_for_each_entry ( pdev, &ats_devices, list )
> +    {
> +        if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
> +            return pdev;
> +    }
> +
> +    return NULL;
> +}
> diff -r 18088bd3e8f6 -r 3dc5e805d914 xen/drivers/passthrough/x86/ats.h
> --- a/xen/drivers/passthrough/x86/ats.h       Mon Oct 24 18:11:32 2011 +0200
> +++ b/xen/drivers/passthrough/x86/ats.h       Mon Oct 24 18:11:36 2011 +0200
> @@ -34,5 +34,8 @@ extern bool_t ats_enabled;
>  
>  int enable_ats_device(int seg, int bus, int devfn);
>  void disable_ats_device(int seg, int bus, int devfn);
> +int pci_ats_enabled(int seg, int bus, int devfn);
> +int pci_ats_device(int seg, int bus, int devfn);
> +struct pci_ats_dev* get_ats_device(int seg, int bus, int devfn);

Formatting again.

Jan

>  
>  #endif /* _X86_ATS_H_ */
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx 
> http://lists.xensource.com/xen-devel 




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Xen-devel] [PATCH 4 of 6] ats: Add new ATS helper functions, Jan Beulich <=