qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "mihai.caraman@freescale.com" <mihai.caraman@freescale.com>,
	"bogdan.purcareata@freescale.com"
	<bogdan.purcareata@freescale.com>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/2] PPC: kvm: Fix incorrect remapping of in-kernel MPIC
Date: Wed, 10 Sep 2014 14:49:04 +0200	[thread overview]
Message-ID: <541048C0.4010405@suse.de> (raw)
In-Reply-To: <8ac9c7d41cf6454fb14cd450e725031a@BY2PR03MB508.namprd03.prod.outlook.com>



On 05.09.14 16:31, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: qemu-devel-bounces+mihai.caraman=freescale.com@nongnu.org
>> [mailto:qemu-devel-bounces+mihai.caraman=freescale.com@nongnu.org] On
>> Behalf Of Alexander Graf
>> Sent: Friday, September 05, 2014 12:08 PM
>> To: Purcareata Bogdan-B43198; qemu-ppc@nongnu.org
>> Cc: qemu-devel@nongnu.org
>> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/2] PPC: kvm: Fix incorrect
>> remapping of in-kernel MPIC
>>
>>
>>
>> On 03.09.14 20:36, Bogdan Purcareata wrote:
>>> On target-ppc, the kvm-openpic memory region is part of the E500-CCSR
>> memory
>>> region. On the kernel side, the MPIC is mapped at the same offset as
>> the
>>> kvm-openpic within the address space.
>>>
>>> When adding the PCI BAR0 memory region, an alias is created to point to
>> the
>>> E500-CCSR memory region. This results in firing the
>> kvm_openpic_region_add once
>>> more, since kvm-openpic is part of the latter. Only this time, the
>> offset is
>>> wrong - it's part of the PCI memory region. This leads to the in-kernel
>> MPIC to
>>> be remapped at a wrong address, and thus all traps to the kvm-openpic
>>> address to be emulated in userspace.
>>>
>>> The fix consists in an additional filter in
>> kvm_openpic_region_{add,del} to
>>> consider only addresses matching the start of the kvm-openpic memory
>> region.
>>
>> If this is true, wouldn't vfio and host be broken too?
> 
> You should have put the same question for 87d8354d "PPC: openpic_kvm: Filter
> memory events properly". I think vhost and vfio (except for peer to peer PCI)
> use region_add memory listener because they need to access the _RAM_ memory
> for DMA, so they skip BAR notifications (at least in FSL SDK version of qemu).
> Openpic on the other hand uses region_add as a trigger for KVM_SET_DEVICE_ATTR
> ioctl (the device base address) so it takes into account non-RAM memory regions.
> 
> Vhost uses another memory listener, eventfd_add that follows a slightly
> different path then region_add, as a trigger to call KVM_IOEVENTFD ioctl.
> Though vhost seems to work properly we can further trace the ioctl to double
> check.
> 
> Peer to peer PCI might reveal the issue on vfio but this feature is not
> supported by the current FSL PAMU driver. If you think of another platform
> which supports peer to peer PCI and registers a memory region alias like
> this patch do 3eddc1be "Adding BAR0 for e500 PCI controller", then it worth
> validating it.
> 
> I see that vfio_listener_skipped_section() changed upstream so vfio may not
> skip BAR notifications anymore. What qemu version are you using on FSL boards
> like T424QDS, are you using top of the tree? If it works we would like to try
> it to validate vfio and vhost.

Yes I'm running pure upstream code. However, I haven't tried to use VFIO
on e500 at all yet.


Alex

      reply	other threads:[~2014-09-10 12:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 18:36 [Qemu-devel] [PATCH 0/2] PPC: kvm: Fix incorrect remapping of in-kernel MPIC Bogdan Purcareata
2014-09-03 18:36 ` [Qemu-devel] [PATCH 1/2] memory: Add MemoryRegion get address space offset helper function Bogdan Purcareata
2014-09-05 15:31   ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2014-09-03 18:36 ` [Qemu-devel] [PATCH 2/2] PPC: openpic_kvm: Filter region callbacks based on memory region offset Bogdan Purcareata
2014-09-05 15:47   ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2014-09-10 11:40     ` bogdan.purcareata
2014-09-10 13:56       ` Alexander Graf
2014-09-11 10:14         ` bogdan.purcareata
2014-09-11 10:27           ` Alexander Graf
2014-09-05  9:07 ` [Qemu-devel] [Qemu-ppc] [PATCH 0/2] PPC: kvm: Fix incorrect remapping of in-kernel MPIC Alexander Graf
2014-09-05  9:08 ` Alexander Graf
2014-09-05 12:59   ` mihai.caraman
2014-09-05 14:31   ` mihai.caraman
2014-09-10 12:49     ` Alexander Graf [this message]

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=541048C0.4010405@suse.de \
    --to=agraf@suse.de \
    --cc=bogdan.purcareata@freescale.com \
    --cc=mihai.caraman@freescale.com \
    --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).