xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: "Hao, Xudong" <xudong.hao@intel.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH v2] Re-enable LTR/OBFF when device is owned by pciback
Date: Fri, 4 May 2012 09:20:46 -0400	[thread overview]
Message-ID: <20120504132046.GD26418@phenom.dumpdata.com> (raw)
In-Reply-To: <403610A45A2B5242BD291EDAE8B37D300FDAD88C@SHSMSX102.ccr.corp.intel.com>

On Fri, May 04, 2012 at 07:49:21AM +0000, Hao, Xudong wrote:
> When PCIE device which has LTR/OBFF capabilities is owned by pciback, LTR/OBFF feature may be disabled. This patch re-enable LTR and OBFF, so that guest with device assigned can be benefitted.
> 
> Changes from v1:
> - put the variable definition at the start of function
> - add error log report
> 

Don't you need to disable this when the device is un-assigned from the guest?

> Signed-off-by: Xudong Hao <xudong.hao@intel.com>
> 
> diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
> index 097e536..74fbf23 100644
> --- a/drivers/xen/xen-pciback/pci_stub.c
> +++ b/drivers/xen/xen-pciback/pci_stub.c
> @@ -313,6 +313,10 @@ static int __devinit pcistub_init_device(struct pci_dev *dev)
>  	struct xen_pcibk_dev_data *dev_data;
>  	int err = 0;
>  
> +	/* set default value */
> +	unsigned long type = PCI_EXP_OBFF_SIGNAL_ALWAYS;
> +	int snoop_lat_ns = 1024, nosnoop_lat_ns = 1024;

Why these values? Is there a way to fetch optimal values?
> +
>  	dev_dbg(&dev->dev, "initializing...\n");
>  
>  	/* The PCI backend is not intended to be a module (or to work with
> @@ -369,6 +373,28 @@ static int __devinit pcistub_init_device(struct pci_dev *dev)
>  	dev_dbg(&dev->dev, "reset device\n");
>  	xen_pcibk_reset_device(dev);
>  
> +	/* Enable LTR and OBFF before do device assignment */
> +	/* LTR(Latency tolerance reporting) allows devices to send
> +	 * messages to the root complex indicating their latency tolerance
> +	 * for snooped & unsnooped memory transactions.
> +	 */
> +	err = pci_enable_ltr(dev);
> +	if (err)
> +		dev_err(&dev->dev, "Counld not enalbe LTR for device!\n");
> +
> +	err = pci_set_ltr(dev, snoop_lat_ns, nosnoop_lat_ns);
> +	if (err)
> +		dev_err(&dev->dev, "Set LTR latency values failed.\n");
> +
> +	/* OBFF (optimized buffer flush/fill), where supported, can help
> +	 * improve energy efficiency by giving devices information about
> +	 * when interrupts and other activity will have a reduced power
> +	 * impact.
> +	 */
> +	err = pci_enable_obff(dev, type);
> +	if (err)
> +		dev_err(&dev->dev, "Counld not enalbe OBFF for device!\n");
> +
>  	dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
>  	return 0;
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  parent reply	other threads:[~2012-05-04 13:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04  7:49 [PATCH v2] Re-enable LTR/OBFF when device is owned by pciback Hao, Xudong
2012-05-04  8:07 ` Jan Beulich
2012-05-06  8:10   ` Hao, Xudong
2012-05-07  7:24     ` Jan Beulich
2012-05-07  7:39       ` Hao, Xudong
2012-05-04 13:20 ` Konrad Rzeszutek Wilk [this message]
2012-05-06  7:35   ` Hao, Xudong
2012-05-07 13:54     ` Konrad Rzeszutek Wilk
2012-05-08  9:05       ` Hao, Xudong
2012-05-08  9:41         ` Jan Beulich
2012-05-09  6:25           ` Hao, Xudong
2012-05-22  1:57             ` Zhang, Xiantao
2012-05-22  7:21               ` Jan Beulich
2012-05-23 14:45                 ` Zhang, Xiantao
2012-05-23 15:07                   ` Jan Beulich
2012-05-25  3:42                     ` Zhang, Xiantao
2012-05-22 20:34               ` Konrad Rzeszutek Wilk
2012-05-23 14:50                 ` Zhang, Xiantao

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=20120504132046.GD26418@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xudong.hao@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).