qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] RFC: vfio-powerpc: added VFIO support (v2)
Date: Thu, 12 Jul 2012 15:37:20 -0600	[thread overview]
Message-ID: <1342129040.10815.31.camel@ul30vt> (raw)
In-Reply-To: <CAAu8pHskSJuVpW0K9bkoEfcQLKWiJTGQOO2ofjQPpEgu=FoG5Q@mail.gmail.com>

On Thu, 2012-07-12 at 20:54 +0000, Blue Swirl wrote:
> On Thu, Jul 12, 2012 at 8:52 AM, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> > It literally does the following:
> >
> > 1. POWERPC IOMMU support (the kernel counterpart is required)
> >
> > 2. The patch assumes that IOAPIC calls are going to be replaced
> > with something generic. I have something in my local git but it's
> > too early, we need to extend PCIINTxRoute first.
> >
> > 3. vfio_get_group() made public. I want to open IOMMU group from
> > the sPAPR code to have everything I need for VFIO on sPAPR and
> > avoid ugly workarounds with finilizing PHB setup on sPAPR.
> >
> > 4. Change sPAPR PHB to scan the PCI bus which is used for
> > the IOMMU-VFIO group. Now it is enough to add the following to
> > the QEMU command line to get VFIO up with all the devices from
> > IOMMU group with id=3:
> > -device spapr-pci-host-bridge,busname=E1000E,buid=0x3,iommu=3,\
> > mem_win_addr=0x230000000000,io_win_addr=0x240000000000,msi_win_addr=0x250000000000
> >
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > ---
> >  hw/ppc/Makefile.objs |    3 ++
> >  hw/spapr.h           |    4 ++
> >  hw/spapr_iommu.c     |   87 ++++++++++++++++++++++++++++++++++++++
> >  hw/spapr_pci.c       |  115 +++++++++++++++++++++++++++++++++++++++++++++++---
> >  hw/spapr_pci.h       |    5 +++
> >  hw/vfio_pci.c        |   28 +++++++++++-
> >  hw/vfio_pci.h        |    2 +
> >  7 files changed, 237 insertions(+), 7 deletions(-)
> >
> > diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
> > index f573a95..c46a049 100644
> > --- a/hw/ppc/Makefile.objs
> > +++ b/hw/ppc/Makefile.objs
> > @@ -25,4 +25,7 @@ obj-$(CONFIG_FDT) += ../device_tree.o
> >  # Xilinx PPC peripherals
> >  obj-y += xilinx_ethlite.o
> >
> > +# VFIO PCI device assignment
> > +obj-$(CONFIG_VFIO_PCI) += vfio_pci.o
> > +
> >  obj-y := $(addprefix ../,$(obj-y))
> > diff --git a/hw/spapr.h b/hw/spapr.h
> > index b37f337..9dca704 100644
> > --- a/hw/spapr.h
> > +++ b/hw/spapr.h
> > @@ -340,4 +340,8 @@ int spapr_dma_dt(void *fdt, int node_off, const char *propname,
> >  int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
> >                        DMAContext *dma);
> >
> > +void spapr_vfio_init_dma(int fd, uint32_t liobn,
> > +                         uint64_t *dma32_window_start,
> > +                         uint64_t *dma32_window_size);
> > +
> >  #endif /* !defined (__HW_SPAPR_H__) */
> > diff --git a/hw/spapr_iommu.c b/hw/spapr_iommu.c
> > index 50c288d..0a194e8 100644
> > --- a/hw/spapr_iommu.c
> > +++ b/hw/spapr_iommu.c
> > @@ -16,6 +16,8 @@
> >   * You should have received a copy of the GNU Lesser General Public
> >   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> >   */
> > +#include <sys/ioctl.h>
> > +
> >  #include "hw.h"
> >  #include "kvm.h"
> >  #include "qdev.h"
> > @@ -23,6 +25,7 @@
> >  #include "dma.h"
> >
> >  #include "hw/spapr.h"
> > +#include "hw/linux-vfio.h"
> >
> >  #include <libfdt.h>
> >
> > @@ -183,6 +186,86 @@ static int put_tce_emu(target_ulong liobn, target_ulong ioba, target_ulong tce)
> >      return 0;
> >  }
> >
> > +/* -------- API for POWERPC IOMMU -------- */
> > +
> > +#define POWERPC_IOMMU           2
> > +
> > +struct tce_iommu_info {
> 
> CamelCase.
> 
> > +    __u32 argsz;
> > +    __u32 dma32_window_start;
> > +    __u32 dma32_window_size;
> 
> Please use uint32_t.

These should eventually be included from a kernel header file.  I assume
that's the reason for the non-qemu-isms.

> > +};
> > +
> > +#define POWERPC_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
> > +
> > +struct tce_iommu_dma_map {
> > +    __u32 argsz;
> 
> The structure may or may not be padded here since there's no
> QEMU_PACKED attribute. If possible, just rearrange the fields.

I'm hoping Alexey adds a __u32 flags here, which solves that problem as
well.  Thanks,

Alex

  reply	other threads:[~2012-07-12 21:37 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10  5:51 [Qemu-devel] [PATCH 0/2] RFC: powerpc-vfio: adding support Alexey Kardashevskiy
2012-07-10  5:51 ` [Qemu-devel] [PATCH 1/2] pseries pci: spapr_finalize_pci_setup introduced Alexey Kardashevskiy
2012-07-10  5:51 ` [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support Alexey Kardashevskiy
2012-07-10 16:55   ` Alex Williamson
2012-07-10 21:32     ` Benjamin Herrenschmidt
2012-07-10 21:48       ` Alex Williamson
2012-07-10 21:53         ` Benjamin Herrenschmidt
2012-07-11  2:54     ` Alexey Kardashevskiy
2012-07-11  3:10       ` Benjamin Herrenschmidt
2012-07-12  3:11       ` Alex Williamson
2012-07-12  8:47         ` Alexey Kardashevskiy
2012-07-10 22:26   ` Scott Wood
2012-07-10 23:55     ` Alexey Kardashevskiy
2012-07-11  0:04       ` Benjamin Herrenschmidt
2012-07-11  0:17         ` Alexey Kardashevskiy
2012-07-11  0:26           ` Benjamin Herrenschmidt
2012-07-10 16:57 ` [Qemu-devel] [PATCH 0/2] RFC: powerpc-vfio: adding support Alex Williamson
2012-07-11  2:25   ` Alexey Kardashevskiy
2012-07-12  2:54     ` Alex Williamson
2012-07-12  4:16       ` Alexey Kardashevskiy
2012-07-12  4:31         ` Alex Williamson
2012-07-12  4:38           ` Alexey Kardashevskiy
2012-07-12  4:43             ` Alex Williamson
2012-07-12  4:58               ` Alexey Kardashevskiy
2012-07-12  5:29                 ` Alex Williamson
2012-07-12  5:47                   ` Alexey Kardashevskiy
2012-07-16  3:51                     ` Alexey Kardashevskiy
2012-07-23  5:32                   ` [Qemu-devel] [PATCH 0/3] vfio-pci: reworking end-of-interrupt Alexey Kardashevskiy
2012-07-23  5:32                     ` [Qemu-devel] [PATCH 1/3] xics: added end-of-interrupt (EOI) handlers Alexey Kardashevskiy
2012-07-23  5:32                     ` [Qemu-devel] [PATCH 2/3] ioapic: removed obsolete ioapic_remove_gsi_eoi_notifier Alexey Kardashevskiy
2012-07-23  5:32                     ` [Qemu-devel] [PATCH 3/3] vfio-pci: rework of EOI Alexey Kardashevskiy
2012-07-12  8:52 ` [Qemu-devel] [PATCH] RFC: vfio-powerpc: added VFIO support (v2) Alexey Kardashevskiy
2012-07-12 20:54   ` [Qemu-devel] [Qemu-ppc] " Blue Swirl
2012-07-12 21:37     ` Alex Williamson [this message]
2012-07-13  5:24     ` Alexey Kardashevskiy
2012-07-13 14:33       ` Blue Swirl
2012-07-12 22:35   ` Scott Wood
2012-07-13  5:31     ` Alexey Kardashevskiy
2012-07-13  3:47   ` [Qemu-devel] " Alex Williamson
2012-07-13  5:03     ` Alexey Kardashevskiy
2012-07-13  7:26 ` [Qemu-devel] [PATCH] RFC: vfio-powerpc: added VFIO support (v3) Alexey Kardashevskiy
2012-07-13 14:38   ` Blue Swirl
2012-07-13 15:07   ` Alex Williamson
2012-07-14  2:34     ` Alexey Kardashevskiy
2012-07-16 14:21       ` Alex Williamson
2012-07-16 21:17         ` Alex Williamson
2012-07-17  7:53         ` Alexey Kardashevskiy
2012-07-17 14:11           ` Alex Williamson
2012-07-18 11:09 ` [Qemu-devel] [PATCH] vfio-powerpc: added VFIO support (v4) Alexey Kardashevskiy
2012-07-18 14:14   ` Alex Williamson
2012-07-19  4:01     ` Alexey Kardashevskiy
2012-07-19  4:04 ` [Qemu-devel] [PATCH] vfio-powerpc: added VFIO support (v5) Alexey Kardashevskiy

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=1342129040.10815.31.camel@ul30vt \
    --to=alex.williamson@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=blauwirbel@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).