From: Wei Wang2 <wei.wang2@amd.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 4 of 6] Add new ATS helper functions
Date: Fri, 21 Oct 2011 15:58:47 +0200 [thread overview]
Message-ID: <201110211558.48144.wei.wang2@amd.com> (raw)
In-Reply-To: <4EA18BAA020000780005CC15@nat28.tlf.novell.com>
On Friday 21 October 2011 15:11:38 Jan Beulich wrote:
> >>> On 21.10.11 at 14:55, Wei Wang <wei.wang2@amd.com> wrote:
> >
> > # HG changeset patch
> > # User Wei Wang <wei.wang2@amd.com>
> > # Date 1319201422 -7200
> > # Node ID f2fbc041f4a710b66f98e76ad8905dcac7920c18
> > # Parent bb1330a1f8c7149fb39578382d9f5dfeef13ffa9
> > Add new ATS helper functions
> >
> > Signed-off-by Wei Wang <wei.wang2@amd.com>
> >
> > diff -r bb1330a1f8c7 -r f2fbc041f4a7 xen/drivers/passthrough/pci.c
> > --- a/xen/drivers/passthrough/pci.c Fri Oct 21 14:50:21 2011 +0200
> > +++ b/xen/drivers/passthrough/pci.c Fri Oct 21 14:50:22 2011 +0200
> > @@ -838,6 +838,74 @@ 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;
> > +}
> > +
> > +static void parse_ats_param(char *s);
> > +custom_param("ats", parse_ats_param);
> > +
> > +bool_t __read_mostly ats_enabled = 1;
> > +
> > +static void __init parse_ats_param(char *s)
> > +{
> > + char *ss;
> > +
> > + do {
> > + ss = strchr(s, ',');
> > + if ( ss )
> > + *ss = '\0';
> > +
> > + switch ( parse_bool(s) )
> > + {
> > + case 0:
> > + ats_enabled = 0;
> > + break;
> > + case 1:
> > + ats_enabled = 1;
> > + break;
> > + }
> > +
> > + s = ss + 1;
> > + } while ( ss );
> > +}
> > +
> > +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;
> > +}
> > +
> > +struct pci_ats_dev* get_ats_device(int seg, int bus, int devfn)
> > +{
> > + 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;
> > +}
> > +
> > /*
> > * Local variables:
> > * mode: C
> > diff -r bb1330a1f8c7 -r f2fbc041f4a7
> > xen/drivers/passthrough/vtd/x86/ats.c ---
> > a/xen/drivers/passthrough/vtd/x86/ats.c Fri Oct 21 14:50:21 2011 +0200
> > +++ b/xen/drivers/passthrough/vtd/x86/ats.c Fri Oct 21 14:50:22 2011
> > +0200 @@ -29,35 +29,6 @@
> > #include "../extern.h"
> >
> > static LIST_HEAD(ats_dev_drhd_units);
> > -
> > -static void parse_ats_param(char *s);
> > -custom_param("ats", parse_ats_param);
> > -
> > -bool_t __read_mostly ats_enabled = 1;
> > -
> > -static void __init parse_ats_param(char *s)
> > -{
> > - char *ss;
> > -
> > - do {
> > - ss = strchr(s, ',');
> > - if ( ss )
> > - *ss = '\0';
> > -
> > - switch ( parse_bool(s) )
> > - {
> > - case 0:
> > - ats_enabled = 0;
> > - break;
> > - case 1:
> > - ats_enabled = 1;
> > - break;
> > - }
> > -
> > - s = ss + 1;
> > - } while ( ss );
> > -}
> > -
>
> Why don't you move this chunk together with the other movement you
> do?
Sure, this should be combined with patch 1. I will fix it in the next try.
Thanks,
Wei
> Jan
>
> > struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu)
> > {
> > struct acpi_drhd_unit *drhd;
> > diff -r bb1330a1f8c7 -r f2fbc041f4a7 xen/include/xen/pci.h
> > --- a/xen/include/xen/pci.h Fri Oct 21 14:50:21 2011 +0200
> > +++ b/xen/include/xen/pci.h Fri Oct 21 14:50:22 2011 +0200
> > @@ -152,5 +152,8 @@ void pci_enable_acs(struct pci_dev *pdev
> >
> > 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);
> >
> > #endif /* __XEN_PCI_H__ */
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2011-10-21 13:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 12:55 [PATCH 0 of 6] amd iommu: add ats device support Wei Wang
2011-10-21 12:55 ` [PATCH 1 of 6] Move some ats functions into vendor neutral directories Wei Wang
2011-10-21 13:08 ` Jan Beulich
2011-10-21 13:57 ` Wei Wang2
2011-10-21 14:07 ` [PATCH 1 of 6] Move some ats functions into vendor neutraldirectories Jan Beulich
2011-10-21 12:55 ` [PATCH 2 of 6] Remove VTD prefix from debug output Wei Wang
2011-10-21 12:55 ` [PATCH 3 of 6] Fix iommu page size encoding when page order > 0 Wei Wang
2011-10-21 12:55 ` [PATCH 4 of 6] Add new ATS helper functions Wei Wang
2011-10-21 13:11 ` Jan Beulich
2011-10-21 13:58 ` Wei Wang2 [this message]
2011-10-21 12:55 ` [PATCH 5 of 6] Add iotlb invalidation command for amd iommu Wei Wang
2011-10-21 12:55 ` [PATCH 6 of 6] Enable ats devices on amd iommu systems Wei Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201110211558.48144.wei.wang2@amd.com \
--to=wei.wang2@amd.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.