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