Tom Lyon | 1 Nov 2010 22:22
Picon
Favicon

Re: [PATCH 0/5] Fixes, non-PCI-2.3 support, EOI enhancements

I've applied all your patches. Thanks!

On Saturday, October 30, 2010 09:58:55 am Alex Williamson wrote:
> Hi Tom,
> 
> I've updated some patches I've been working on to v5 and wanted to
> see what you think.  I also found a couple minor bugs, fixed in this
> series.
> 
> The main idea is that since the VFIO interface defines that the INTx
> interrupt is disabled when it fires, we should provide an interface
> to re-enable it.  We currently have to do a read-modify-write to PCI
> config space, requring two ioctls.  I introduce an ioctl to do this
> for us.  An important aspect of this is that now we can support
> non-PCI-2.3 devices since re-enabling the interrupt is abstracted
> (with the same caveat as current KVM device assignment, that they
> must get an exclusive interrupt).  The real trick though is that we
> can then also create an irqfd-like mechanism to trigger re-enabling
> interrupts from and eventfd.  This allows qemu to do all the setup
> for connecting interrupts from VFIO into KVM and EOIs from KVM to
> VFIO, then lets userspace get completely out of the way.
> 
> Hope you like it.  Thanks,
> 
> Alex
> ---
> 
> Alex Williamson (5):
>       vfio: Add a new ioctl to support EOI via eventfd
>       vfio: Add support for non-PCI 2.3 compliant devices
(Continue reading)

Uwe Kleine-König | 2 Nov 2010 11:41
Picon
Favicon
Gravatar

Re: should struct device.dma_mask still be a pointer?

Hello,

I'm picking up this old thread because I'm currently faced again with
this problem ... and I'm really annoyed about it.

On Thu, Jul 01, 2010 at 10:35:58AM +0900, FUJITA Tomonori wrote:
> > IMHO it's strange that struct device.dma_mask is a pointer instead of a
> > plain u64.  The reason this was done back then is described in
> > 8ab1bc19e974fdebe76c065fe444979c84ba2f74[1]:
> > 
> > 	Attached is a patch which moves dma_mask into struct device and cleans up the
> > 	scsi mid-layer to use it (instead of using struct pci_dev).  The advantage to
> > 	doing this is probably most apparent on non-pci bus architectures where
> > 	currently you have to construct a fake pci_dev just so you can get the bounce
> > 	buffers to work correctly.
> > 
> > 	The patch tries to perturb the minimum amount of code, so dma_mask in struct
> > 	device is simply a pointer to the one in pci_dev.  However, it will make it
> > 	easy for me now to add generic device to MCA without having to go the fake pci
> > 	route.
> 
> Yeah, that's a strange design. As the commit log said, it's due to the
> historical reason. We invented the pci dma model first then moved to
> the generic dma model.
> 
> 
> > As I work on such a non-pci bus architecture it's still ugly that this
> > is a pointer because I have to allocate extra memory for that.
> 
> The popular trick to avoid allocating the extra memory for that is:
(Continue reading)

FUJITA Tomonori | 2 Nov 2010 14:03
Picon
Gravatar

Re: should struct device.dma_mask still be a pointer?

On Tue, 2 Nov 2010 11:41:04 +0100
Uwe Kleine-König <u.kleine-koenig <at> pengutronix.de> wrote:

> > > As I work on such a non-pci bus architecture it's still ugly that this
> > > is a pointer because I have to allocate extra memory for that.
> > 
> > The popular trick to avoid allocating the extra memory for that is:
> > 
> > device.dma_mask = &device.coherent_dma_mask;
> Does this work in general?  Or are there any corner cases that make this
> trick fail?

It doesn't work if the coherent dma mask of a device is not same as
the dma mask of the device.

> > > Is there a reason not to get rid of struct pci_dev.dma_mask and use
> > > struct pci_dev.dev.dma_mask instead?  (Well apart from the needed
> > > effort of course.)
> > > 
> > > If not, the following would be needed:
> > > 
> > > 	- remove struct pci.dma_mask
> > > 	- make struct device.dma_mask an u64 (instead of u64*)
> > > 	- substitue var.dma_mask by var.dev.dma_mask for all
> > > 	  struct pci_dev var
> > > 	- substitue var.dma_mask by &(var.dma_mask) for all
> > > 	  struct device var
> > > 
> > > and note that there are statically initialized struct device (and maybe
> > > struct pci_dev?) that need fixing, too.  (e.g.
(Continue reading)

Uwe Kleine-König | 2 Nov 2010 14:45
Picon
Favicon
Gravatar

Re: should struct device.dma_mask still be a pointer?

Hello,

On Tue, Nov 02, 2010 at 10:03:32PM +0900, FUJITA Tomonori wrote:
> On Tue, 2 Nov 2010 11:41:04 +0100
> Uwe Kleine-König <u.kleine-koenig <at> pengutronix.de> wrote:
> 
> > > > As I work on such a non-pci bus architecture it's still ugly that this
> > > > is a pointer because I have to allocate extra memory for that.
> > > 
> > > The popular trick to avoid allocating the extra memory for that is:
> > > 
> > > device.dma_mask = &device.coherent_dma_mask;
> > Does this work in general?  Or are there any corner cases that make this
> > trick fail?
> 
> It doesn't work if the coherent dma mask of a device is not same as
> the dma mask of the device.
> 
> 
> > > > Is there a reason not to get rid of struct pci_dev.dma_mask and use
> > > > struct pci_dev.dev.dma_mask instead?  (Well apart from the needed
> > > > effort of course.)
> > > > 
> > > > If not, the following would be needed:
> > > > 
> > > > 	- remove struct pci.dma_mask
> > > > 	- make struct device.dma_mask an u64 (instead of u64*)
> > > > 	- substitue var.dma_mask by var.dev.dma_mask for all
> > > > 	  struct pci_dev var
> > > > 	- substitue var.dma_mask by &(var.dma_mask) for all
(Continue reading)

FUJITA Tomonori | 2 Nov 2010 15:43
Picon
Gravatar

Re: should struct device.dma_mask still be a pointer?

On Tue, 2 Nov 2010 14:45:11 +0100
Uwe Kleine-König <u.kleine-koenig <at> pengutronix.de> wrote:

> Hello,
> 
> On Tue, Nov 02, 2010 at 10:03:32PM +0900, FUJITA Tomonori wrote:
> > On Tue, 2 Nov 2010 11:41:04 +0100
> > Uwe Kleine-König <u.kleine-koenig <at> pengutronix.de> wrote:
> > 
> > > > > As I work on such a non-pci bus architecture it's still ugly that this
> > > > > is a pointer because I have to allocate extra memory for that.
> > > > 
> > > > The popular trick to avoid allocating the extra memory for that is:
> > > > 
> > > > device.dma_mask = &device.coherent_dma_mask;
> > > Does this work in general?  Or are there any corner cases that make this
> > > trick fail?
> > 
> > It doesn't work if the coherent dma mask of a device is not same as
> > the dma mask of the device.
> > 
> > 
> > > > > Is there a reason not to get rid of struct pci_dev.dma_mask and use
> > > > > struct pci_dev.dev.dma_mask instead?  (Well apart from the needed
> > > > > effort of course.)
> > > > > 
> > > > > If not, the following would be needed:
> > > > > 
> > > > > 	- remove struct pci.dma_mask
> > > > > 	- make struct device.dma_mask an u64 (instead of u64*)
(Continue reading)

Michael S. Tsirkin | 2 Nov 2010 20:11
Picon
Favicon

Re: [PATCH] vfio: Extended capability fixes

On Mon, Nov 01, 2010 at 11:08:35PM -0600, Alex Williamson wrote:
> - Virtual channel position gets truncated as a u8
>  - Print the ecap that's unknown, not the last cap we saw
>  - Print actual config offset, which provides enough info to make
>    some sense of the error.
> 
> Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
> ---
> 
>  drivers/vfio/vfio_pci_config.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_pci_config.c b/drivers/vfio/vfio_pci_config.c
> index 8af995d..8304316 100644
> --- a/drivers/vfio/vfio_pci_config.c
> +++ b/drivers/vfio/vfio_pci_config.c
>  <at>  <at>  -410,7 +410,7  <at>  <at>  static int vfio_msi_cap_len(struct vfio_dev *vdev, u8 pos)
>   * Determine extended capability length for VC (2 & 9) and
>   * MFVC capabilities
>   */
> -static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
> +static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)
>  {
>  	struct pci_dev *pdev = vdev->pdev;
>  	u32 dw;
>  <at>  <at>  -580,7 +580,7  <at>  <at>  int vfio_build_config_map(struct vfio_dev *vdev)
>  				printk(KERN_WARNING
>  					"%s: pci config conflict at %x, "
>  					"caps %x %x\n",
> -					__func__, i, map[pos+i], cap);
(Continue reading)

Tom Lyon | 2 Nov 2010 23:18
Picon
Favicon

Re: [PATCH] vfio: Extended capability fixes

Applied. Thanks!

On Monday, November 01, 2010 10:08:35 pm Alex Williamson wrote:
> - Virtual channel position gets truncated as a u8
>  - Print the ecap that's unknown, not the last cap we saw
>  - Print actual config offset, which provides enough info to make
>    some sense of the error.
> 
> Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
> ---
> 
>  drivers/vfio/vfio_pci_config.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_pci_config.c
> b/drivers/vfio/vfio_pci_config.c index 8af995d..8304316 100644
> --- a/drivers/vfio/vfio_pci_config.c
> +++ b/drivers/vfio/vfio_pci_config.c
>  <at>  <at>  -410,7 +410,7  <at>  <at>  static int vfio_msi_cap_len(struct vfio_dev *vdev, u8
> pos) * Determine extended capability length for VC (2 & 9) and
>   * MFVC capabilities
>   */
> -static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
> +static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)
>  {
>  	struct pci_dev *pdev = vdev->pdev;
>  	u32 dw;
>  <at>  <at>  -580,7 +580,7  <at>  <at>  int vfio_build_config_map(struct vfio_dev *vdev)
>  				printk(KERN_WARNING
>  					"%s: pci config conflict at %x, "
(Continue reading)

Tom Lyon | 2 Nov 2010 23:19
Picon
Favicon

Re: [PATCH] vfio: Extended capability fixes

On Tuesday, November 02, 2010 12:11:08 pm Michael S. Tsirkin wrote:
> On Mon, Nov 01, 2010 at 11:08:35PM -0600, Alex Williamson wrote:
> > - Virtual channel position gets truncated as a u8
> > 
> >  - Print the ecap that's unknown, not the last cap we saw
> >  - Print actual config offset, which provides enough info to make
> >  
> >    some sense of the error.
> > 
> > Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
> > ---
> > 
> >  drivers/vfio/vfio_pci_config.c |    8 ++++----
> >  1 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/vfio/vfio_pci_config.c
> > b/drivers/vfio/vfio_pci_config.c index 8af995d..8304316 100644
> > --- a/drivers/vfio/vfio_pci_config.c
> > +++ b/drivers/vfio/vfio_pci_config.c
> >  <at>  <at>  -410,7 +410,7  <at>  <at>  static int vfio_msi_cap_len(struct vfio_dev *vdev, u8
> > pos)
> > 
> >   * Determine extended capability length for VC (2 & 9) and
> >   * MFVC capabilities
> >   */
> > 
> > -static int vfio_vc_cap_len(struct vfio_dev *vdev, u8 pos)
> > +static int vfio_vc_cap_len(struct vfio_dev *vdev, u16 pos)
> > 
> >  {
(Continue reading)

Bjorn Helgaas | 3 Nov 2010 03:28
Picon
Favicon

Re: [PATCH] x86/PCI: coalesce overlapping host bridge windows

On Fri, Sep 24, 2010 at 10:07:49AM -0700, Jesse Barnes wrote:
> On Wed, 22 Sep 2010 11:09:19 -0600
> Bjorn Helgaas <bjorn.helgaas <at> hp.com> wrote:
> 
> > 
> > Some BIOSes provide PCI host bridge windows that overlap, e.g.,
> > 
> >     pci_root PNP0A03:00: host bridge window [mem 0xb0000000-0xffffffff]
> >     pci_root PNP0A03:00: host bridge window [mem 0xafffffff-0xdfffffff]
> >     pci_root PNP0A03:00: host bridge window [mem 0xf0000000-0xffffffff]
> > 
> > If we simply insert these as children of iomem_resource, the second window
> > fails because it conflicts with the first, and the third is inserted as a
> > child of the first, i.e.,
> > 
> >     b0000000-ffffffff PCI Bus 0000:00
> >       f0000000-ffffffff PCI Bus 0000:00
> > 
> > When we claim PCI device resources, this can cause collisions like this
> > if we put them in the first window:
> > 
> >     pci 0000:00:01.0: address space collision: [mem 0xff300000-0xff4fffff] conflicts with PCI Bus
0000:00 [mem 0xf0000000-0xffffffff]
> > 
> > Host bridge windows are top-level resources by definition, so it doesn't
> > make sense to make the third window a child of the first.  This patch
> > coalesces any host bridge windows that overlap.  For the example above,
> > the result is this single window:
> > 
> >     pci_root PNP0A03:00: host bridge window [mem 0xafffffff-0xffffffff]
(Continue reading)

Michael Ellerman | 3 Nov 2010 13:45
Picon
Gravatar

Re: [PATCH net-next-2.6 1/2] be2net: Adding an option to use INTx instead of MSI-X

On Sat, 2010-10-30 at 17:21 -0600, Matthew Wilcox wrote:
> On Tue, Oct 26, 2010 at 05:52:08PM +1100, Michael Ellerman wrote:
> > That horse has really really bolted, it's gawn.
> > 
> > I count 26 drivers with "disable MSI/X" parameters. Some even have more
> > than one.
> 
> That's 26 patches someone needs to write, then.  You can put my Acked-by
> on all of them.

Bah, come on it's hardly the most horrendous sin committed by driver
writers. And removing them risks breaking someone's system, even if they
are clueless, should RTFM etc.

> > I agree it's a mess for users, but it's probably preferable to a
> > non-working driver.
> 
> What more drivers need is an automatic detection of a non-working
> interrupt situation, great big warning messages, and fallback to an
> alternate interrupt mechanism.  Doing it for one driver, then generalising
> as much of it into the core as possible would be nice.

More detection would be good.

I don't see much potential for generalising it though. Looking at e1000e
and tg3 there is really not much in common except the very basic idea.

cheers

(Continue reading)


Gmane