From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] Re-enable LTR/OBFF when device is owned by pciback Date: Sun, 22 Apr 2012 22:38:23 -0400 Message-ID: <20120423023823.GC13840@phenom.dumpdata.com> References: <403610A45A2B5242BD291EDAE8B37D300FD2997D@SHSMSX101.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <403610A45A2B5242BD291EDAE8B37D300FD2997D@SHSMSX101.ccr.corp.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Hao, Xudong" Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Sun, Apr 22, 2012 at 03:25:04PM +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. Shouldn't they be reset when the device is de-assigned from the guest as well? > > Signed-off-by: Xudong Hao > > diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c > index 19834d1..82aac5b 100644 > --- a/drivers/xen/xen-pciback/pci_stub.c > +++ b/drivers/xen/xen-pciback/pci_stub.c > @@ -334,6 +334,14 @@ static int __devinit pcistub_init_device(struct pci_dev *dev) > dev_dbg(&dev->dev, "reset device\n"); > xen_pcibk_reset_device(dev); > > + /* set default value */ > + unsigned long type = PCI_EXP_OBFF_SIGNAL_ALWAYS; > + int snoop_lat_ns = 1024, nosnoop_lat_ns = 1024; /* 1024ns is max value */ Please put them in the appropiate location - at the start of the function. > + > + /* 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. > + */ > + pci_enable_ltr(dev); > + pci_set_ltr(dev, snoop_lat_ns, nosnoop_lat_ns); OK, but didn't you just come with up those values? > + > + /* 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. > + */ > + pci_enable_obff(dev, type); > + > dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; > return 0;