qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Eric Auger <eric.auger@linaro.org>,
	eric.auger@st.com, christoffer.dall@linaro.org,
	qemu-devel@nongnu.org, kim.phillips@freescale.com,
	a.rigo@virtualopensystems.com
Cc: peter.maydell@linaro.org, patches@linaro.org,
	Kim Phillips <kim.phillips@linaro.org>,
	stuart.yoder@freescale.com, alex.williamson@redhat.com,
	christophe.barnichon@st.com, a.motakis@virtualopensystems.com,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [Qemu-devel] [RFC v3 03/10] vfio: add vfio-platform support
Date: Thu, 26 Jun 2014 11:56:21 +0200	[thread overview]
Message-ID: <53ABEE45.8010204@suse.de> (raw)
In-Reply-To: <53ABD010.3060705@linaro.org>


On 26.06.14 09:47, Eric Auger wrote:
> On 06/25/2014 11:21 PM, Alexander Graf wrote:
>> On 02.06.14 09:49, Eric Auger wrote:
>>> From: Kim Phillips <kim.phillips@linaro.org>
>>>
>>> Functions for which PCI and platform device support share are moved
>>> into common.c.  The common vfio_{get,put}_group() get an additional
>>> argument, a pointer to a vfio_reset_handler(), for which to pass on
>>> to qemu_register_reset, but only if it exists (the platform device
>>> code currently passes a NULL as its reset_handler).
>>>
>>> For the platform device code, we basically use SysBusDevice
>>> instead of PCIDevice.  Since realize() returns void, unlike
>>> PCIDevice's initfn, error codes are moved into the
>>> error message text with %m.
>>>
>>> Currently only MMIO access is supported at this time.
>>>
>>> The perceived path for future QEMU development is:
>>>
>>> - add support for interrupts
>>> - verify and test platform dev unmap path
>>> - test existing PCI path for any regressions
>>> - add support for creating platform devices on the qemu command line
>>>     - currently device address specification is hardcoded for test
>>>       development on Calxeda Midway's fff51000.ethernet device
>>> - reset is not supported and registration of reset functions is
>>>     bypassed for platform devices.
>>>     - there is no standard means of resetting a platform device,
>>>       unsure if it suffices to be handled at device--VFIO binding time
>>>
>>> [1] http://www.spinics.net/lists/kvm-arm/msg08195.html
>>>
>>> Changes (v2 -> v3):
>>> [work done by Eric Auger]
>>>
>>> This new version introduces 2 separate VFIO Device objects:
>>> - VFIOPCIDevice
>>> - VFIOPlatformDevice
>>>
>>> Both objects share a VFIODevice struct.
>>>
>>> Also a VFIORegion shared struct was created. It is embedded in
>>> VFIOBAR struct. VFIOPlatformDevice uses VFIORegion directly.
>>>
>>> Introducing those base classes induced quite a lot of tiny
>>> changes in the PCI code. Theoretically PCI and platform
>>> devices can be supported simultaneously. PCI modifications
>>> currently are not tested.
>>>
>>> The VFIODevice is not a QOM object due to the single inheritance
>>> model limitation.
>>>
>>> The VFIODevice struct embeds an ops structure which is
>>> specialized in each VFIO leaf device. This makes possible to call
>>> device specific functions in common parts, hence achieving better
>>> factorization.
>>>
>>> Reset handling typically is handled that way where a unique
>>> generic ResetHandler (in common.c) is used for both derived
>>> classes. It calls device specific methods.
>>>
>>> As in the original contribution, only MMIO is supported in that
>>> patch file (in mmap mode). IRQ support comes in a subsequent patch.
>>>
>>> Signed-off-by: Kim Phillips <kim.phillips@linaro.org>
>>> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>>> ---
>>>    hw/vfio/Makefile.objs      |    2 +
>>>    hw/vfio/common.c           |  849 ++++++++++++++++++++++++++++
>>>    hw/vfio/pci.c              | 1316
>>> ++++++++++----------------------------------
>>>    hw/vfio/platform.c         |  267 +++++++++
>>>    hw/vfio/vfio-common.h      |  143 +++++
>>>    linux-headers/linux/vfio.h |    1 +
>>>    6 files changed, 1565 insertions(+), 1013 deletions(-)
>> This patch is impossible to review. Please split it out into a part (or
>> maybe even multiple patches) that separate pci specific VFIO support
>> into its own file and then another set of patches implementing platform
>> support.
> Hi Alex,
>
> OK I will reorganize the patch as you suggest.
>
> Alex (both of you), do you think the general split direction looks
> reasonable, ie. having this VFIODevice struct and VFIORegion struct? or
> do you think it induces too many  (and possibly cumbersome) changes in
> the PCI code?

I don't think we'll be able to tell before the implications are visible 
- and that basically means splitting the patch :(.

> wrt VFIOPlatformDevice I changed the code to inherit from PlatformDevice
> instead of SysBusDevice - maybe too early but future will say ... - .

I'll check out which way to go forward there today. But either way, the 
two aren't incredibly different.


Alex

  reply	other threads:[~2014-06-26  9:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02  7:49 [Qemu-devel] [RFC v3 00/10] KVM platform device passthrough Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 01/10] hw/arm/virt: add a xgmac device Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 02/10] vfio: move hw/misc/vfio.c to hw/vfio/pci.c Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 03/10] vfio: add vfio-platform support Eric Auger
2014-06-25 21:21   ` Alexander Graf
2014-06-26  7:47     ` Eric Auger
2014-06-26  9:56       ` Alexander Graf [this message]
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 04/10] vfio: simplifed DPRINTF calls using device name Eric Auger
2014-06-25 21:22   ` Alexander Graf
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 05/10] vfio: Add initial IRQ support in platform device Eric Auger
2014-06-25 21:28   ` Alexander Graf
2014-06-25 21:40     ` Alex Williamson
2014-06-26  8:41       ` Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 06/10] virt: Assign a VFIO platform device with -device option Eric Auger
2014-06-25 21:30   ` Alexander Graf
2014-06-26  8:53     ` Eric Auger
2014-06-26  9:25       ` Alexander Graf
2014-06-26  9:30         ` Eric Auger
2014-06-25 22:28   ` Peter Maydell
2014-06-25 22:28     ` Alexander Graf
2014-06-26  7:39       ` Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 07/10] Add EXEC_FLAG to VFIO DMA mappings Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 08/10] Add AMBA devices support to VFIO Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 09/10] Always use eventfd as notifying mechanism Eric Auger
2014-06-02  7:49 ` [Qemu-devel] [RFC v3 10/10] vfio: Add irqfd support in platform device Eric Auger
2014-06-25 21:35   ` Alexander Graf
2014-06-25 21:54     ` Alex Williamson
2014-06-25 22:02       ` Alexander Graf

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=53ABEE45.8010204@suse.de \
    --to=agraf@suse.de \
    --cc=a.motakis@virtualopensystems.com \
    --cc=a.rigo@virtualopensystems.com \
    --cc=alex.williamson@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=christophe.barnichon@st.com \
    --cc=eric.auger@linaro.org \
    --cc=eric.auger@st.com \
    --cc=kim.phillips@freescale.com \
    --cc=kim.phillips@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stuart.yoder@freescale.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).