Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-31 Thread Benjamin Herrenschmidt
On Tue, 2012-07-31 at 18:44 +1000, ronnie sahlberg wrote: I use lots of guests that will never ever get virtio drivers. So for those guests, any work on making sure bog standard vga keeps working or even improving it gets two thumbs up from me! So I've been essentially restarting my work to

[Qemu-devel] virtio-blk: Something bizarre with VIRTIO_BLK_T_GET_ID

2012-07-31 Thread Benjamin Herrenschmidt
Hi Anthony ! I was looking at virtio-blk.c as an example of some details regarding the use of virtio queues. One thing I'm implementing is a request/reponse model similar to what it does. One thing I noticed that sounds off to me but I might have missed something is the handling of the GET_ID

[Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
So I got cirrus working on ppc with cirrusdrmfb... The fun part is that it works :-) Basically, the issue is that normally, for it to work, one would have to access the framebuffer using the appropriate aperture for byteswapping based on the bpp. However, qemu doesn't emulate those apertures

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 13:08 +0300, Avi Kivity wrote: So we end up with what is effectively a BE framebuffer thanks to qemu hard coding what it thinks the guest endian is (btw, this is quite busted in theory as well since PPC can be bi-endian for example). Anyways, it works today,

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 14:25 +0300, Avi Kivity wrote: Right. Cirrus on ppc was used on PReP and Amiga for example though not many people really care about those platforms anymore. I'm not too worried at this point with that possibility but we shall know about it. Emulating something

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 14:58 +0300, Avi Kivity wrote: Let's balkanize some more then? No, qxl is our paravirt vga, we should improve it instead of spawning new ones (which will be horrible in the eyes of the next person to look at them). You should also be getting the drm driver for free.

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 15:15 +0300, Avi Kivity wrote: Something tells me that getting that spice/qxl gunk will be more than a trivial effort (but I might be wrong) and I'm reluctant to start committing effort on it since so far I yet have to see it being actually picked up by people. I

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 16:55 +0300, Avi Kivity wrote: The trouble is predicting which guests have drivers and which guests don't. Having a VGA model that could be enabled universally with good VBE support for guests without drivers would be a very nice default model. I agree. Hopefully

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 18:24 +0200, Alon Levy wrote: On Mon, Jul 30, 2012 at 10:08:07PM +1000, Benjamin Herrenschmidt wrote: On Mon, 2012-07-30 at 14:58 +0300, Avi Kivity wrote: Let's balkanize some more then? No, qxl is our paravirt vga, we should improve it instead of spawning new

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Tue, 2012-07-31 at 09:17 +0930, Rusty Russell wrote: Shared memory is an efficiency thing, not a requirement. If the virtio side-channel tells the device about the location of framebuffer changes, it could still be quite efficient. But potentially tricky to get things like BIOSes

Re: [Qemu-devel] Cirrus bugs vs endian: how two bugs cancel each other out

2012-07-30 Thread Benjamin Herrenschmidt
On Mon, 2012-07-30 at 19:17 -0500, Anthony Liguori wrote: This is a detail of how Spice/QXL works. It is not a framebuffer protocol. Spice sends a series of rendering commands. It not rendering to a flat framebuffer but rather to window-like objects. It maintains a list of these

Re: [Qemu-devel] vga-pci and MMIO BAR

2012-07-25 Thread Benjamin Herrenschmidt
On Wed, 2012-07-25 at 13:27 +0300, Avi Kivity wrote: On 07/25/2012 06:57 AM, Benjamin Herrenschmidt wrote: Hi folks ! Would there be any objection to adding a second MMIO BAR to qemu-vga which mirrors the bochs magic VBE ports ? Support for IO space is optional in PCIe and can

Re: [Qemu-devel] vga-pci and MMIO BAR

2012-07-25 Thread Benjamin Herrenschmidt
On Wed, 2012-07-25 at 15:48 +0300, Avi Kivity wrote: If not, we can add a second BAR, but it should disappear when running an older machine type. Well, the IO ports in legacy space are still there. We can also make the register BAR exist in both mode or we can add a second BAR and have

Re: [Qemu-devel] vga-pci and MMIO BAR

2012-07-25 Thread Benjamin Herrenschmidt
On Wed, 2012-07-25 at 16:59 +0300, Avi Kivity wrote: Why ? Who cares ? Especially with vga -std which nobody uses in practice on x86... We'll find out who cares when we break it. Chances are pretty much close to 0, especially adding a BAR ... do we even use vga std on anything ? We have

Re: [Qemu-devel] vga-pci and MMIO BAR

2012-07-25 Thread Benjamin Herrenschmidt
On Thu, 2012-07-26 at 08:01 +1000, Benjamin Herrenschmidt wrote: On Wed, 2012-07-25 at 16:59 +0300, Avi Kivity wrote: Why ? Who cares ? Especially with vga -std which nobody uses in practice on x86... We'll find out who cares when we break it. Chances are pretty much close to 0

Re: [Qemu-devel] vga-pci and MMIO BAR

2012-07-25 Thread Benjamin Herrenschmidt
On Wed, 2012-07-25 at 20:08 -0500, Anthony Liguori wrote: For the benefit of the list, Ben didn't know that we could just add a qdev property to control whether the MMIO BAR was visible making it just a tiny bit of global magic in the old PC machine models. PPC still doesn't do versioning

[Qemu-devel] Possible bug in cirrus_vga.c vs. HDR handling

2012-07-24 Thread Benjamin Herrenschmidt
Hi folks ! I was debugging a problem with 16bpp support, when I found out that my attempts at writing to the Hidden DAC Register were not working. The reason was that I (well, cirrusdrmfb really) was doing the sequence READ, READ, READ, READ, WRITE (to the DAC mask register), which should have

[Qemu-devel] vga-pci and MMIO BAR

2012-07-24 Thread Benjamin Herrenschmidt
Hi folks ! Would there be any objection to adding a second MMIO BAR to qemu-vga which mirrors the bochs magic VBE ports ? Support for IO space is optional in PCIe and can be problematic on some architectures, it would be nice to be able to program the card entirely using mmio. Once done, I'd

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] spapr: Add support for -vga option

2012-07-23 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 17:25 -0500, Anthony Liguori wrote: If a user asks for something and we can't make it work, we should fail. Note that QEMU's cirrus works fine with the new kernel cirrusdrmfb, so I say we should allow it (needs to be able to the powerpc device .mak as well tho. It

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] spapr: Add support for -vga option

2012-07-23 Thread Benjamin Herrenschmidt
On Mon, 2012-07-23 at 16:40 +1000, Benjamin Herrenschmidt wrote: Note to Matthew: cirrusdrmfb is a LOT SLOWER than offb for a similar SW only dumb framebuffer, probably has to do with the way it does the dirty stuff, not sure ... Why not draw directly into the emulated vram ? More note

Re: [Qemu-devel] [PATCH] pseries: Add support for new KVM hash table control call

2012-07-10 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 22:10 +1000, Benjamin Herrenschmidt wrote: From: David Gibson da...@gibson.dropbear.id.au This adds support for then new reset htab ioctl which allows qemu to properly cleanup the MMU hash table when the guest is reset. With the corresponding kernel support, reset

Re: [Qemu-devel] [PATCH] pseries: Add support for new KVM hash table control call

2012-07-10 Thread Benjamin Herrenschmidt
On Tue, 2012-07-10 at 17:25 +1000, Benjamin Herrenschmidt wrote: On Wed, 2012-06-27 at 22:10 +1000, Benjamin Herrenschmidt wrote: From: David Gibson da...@gibson.dropbear.id.au This adds support for then new reset htab ioctl which allows qemu to properly cleanup the MMU hash table when

Re: [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support

2012-07-10 Thread Benjamin Herrenschmidt
On Tue, 2012-07-10 at 10:55 -0600, Alex Williamson wrote: I wish you could do this through a MemoryListener like we do on x86. Can you elaborate ? TCE (iommu) manipulation on PAPR is done via specific hypervisor calls, not sure what a MemoryListener would do here ... Cheers, Ben.

Re: [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support

2012-07-10 Thread Benjamin Herrenschmidt
On Tue, 2012-07-10 at 15:48 -0600, Alex Williamson wrote: specific hypervisor calls, not sure what a MemoryListener would do here ... Hmm, the guest directed iommu updates via hypercalls may not really fit the MemoryListener model. I'm just trying to think of ways to avoid having an

Re: [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support

2012-07-10 Thread Benjamin Herrenschmidt
On Wed, 2012-07-11 at 09:55 +1000, Alexey Kardashevskiy wrote: On 11/07/12 08:26, Scott Wood wrote: On 07/10/2012 12:51 AM, Alexey Kardashevskiy wrote: The patch enables VFIO on POWER. It literally does the following: 1. POWERPC IOMMU support (the kernel counterpart is required)

Re: [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support

2012-07-10 Thread Benjamin Herrenschmidt
On Wed, 2012-07-11 at 10:17 +1000, Alexey Kardashevskiy wrote: So the current one would be SPAPR_TCE_32? No, the iommu type is SPAPR_TCE, but the *window* info you get here is the 32-bit window. My thinking is add some versionning and a bunch of reserved fields to that info struct so we can

Re: [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support

2012-07-10 Thread Benjamin Herrenschmidt
On Wed, 2012-07-11 at 12:54 +1000, Alexey Kardashevskiy wrote: Why do you need this, aren't the extension checks sufficient for this to be a nop for you? It uses ioapic_remove_gsi_eoi_notifier() so it needs some #ifdef anyway. And as we do not support kvm_irqchip_in_kernel(), there is

Re: [Qemu-devel] [Qemu-ppc][PATCH v5 4/4] spapr: Add support for -vga option

2012-07-08 Thread Benjamin Herrenschmidt
On Sun, 2012-07-08 at 23:08 +0800, Li Zhang wrote: Are you sure we want to set these in -nographic or -vga none mode as well? I am not sure about this. Ben, would you please give more information about this? Doesn't matter much. They are only useful when there is a vga adapter, they

Re: [Qemu-devel] QEMU question: is eventfd not thread safe?

2012-07-01 Thread Benjamin Herrenschmidt
Doesn't qemu remove an fd handler before closing the fd? If not that's the bug right there. No, it's just marked deleted, removal is deferred. But that doesn't change the fact that you need to wake up select. Ie. What happens is: - eventfd gets you fd #x - thread 1 selects() on it which

Re: [Qemu-devel] QEMU question: is eventfd not thread safe?

2012-07-01 Thread Benjamin Herrenschmidt
diff --git a/iohandler.c b/iohandler.c index 3c74de6..54f4c48 100644 --- a/iohandler.c +++ b/iohandler.c @@ -77,6 +77,7 @@ int qemu_set_fd_handler2(int fd, ioh-fd_write = fd_write; ioh-opaque = opaque; ioh-deleted = 0; +kill(getpid(), SIGUSR2);

Re: [Qemu-devel] QEMU question: is eventfd not thread safe?

2012-07-01 Thread Benjamin Herrenschmidt
On Mon, 2012-07-02 at 10:06 +1000, Alexey Kardashevskiy wrote: Won't that conflict with the business in coroutine-sigaltstack.c ? The code which touches SIGUSR2 does not compile on power. Oh, we don't get the altstack coroutine stuff ? interesting... Hrm... looking at it, it looks like it

Re: [Qemu-devel] QEMU question: is eventfd not thread safe?

2012-07-01 Thread Benjamin Herrenschmidt
On Mon, 2012-07-02 at 10:42 +1000, ronnie sahlberg wrote: Would it be possible to change the set-event-handlers functions to automatically call qemu_notify_event() when the descriptos change? To eliminate the need to call this function at all ? That definitely sounds like the right thing to

Re: [Qemu-devel] QEMU question: is eventfd not thread safe?

2012-07-01 Thread Benjamin Herrenschmidt
On Mon, 2012-07-02 at 10:06 +1000, Alexey Kardashevskiy wrote: I already posted another patch with qemu_notify_event() in this mail thread later :) Yup, just saw that, for some reason I got dropped from the CC list. BTW. I told you there must be an existing mechanism for that :-) Cheers, Ben.

[Qemu-devel] [PATCH] pseries: Add support for new KVM hash table control call

2012-06-27 Thread Benjamin Herrenschmidt
a different size hash table to the kernel and for the kernel to be able to impose limits on the requested size. Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/spapr.c | 88

Re: [Qemu-devel] [PATCH] pseries: Add support for new KVM hash table control call

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 22:10 +1000, Benjamin Herrenschmidt wrote: From: David Gibson da...@gibson.dropbear.id.au This adds support for then new reset htab ioctl which allows qemu to properly cleanup the MMU hash table when the guest is reset. With the corresponding kernel support, reset

Re: [Qemu-devel] [PATCH] pseries: Add support for new KVM hash table control call

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 14:30 +0200, Alexander Graf wrote: Thanks, applied to ppc-next. Next time, please base on top of a newer git base - I had to manually fix the patch to apply. It was based on top of qemu master from yesterday. As you know that's what I work on top of. Did you make sure you

Re: [Qemu-devel] [PATCH 0/3] adding MSI/MSIX for PCI on POWER

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 16:43 +0200, Alexander Graf wrote: On 14.06.2012, at 06:29, Alexey Kardashevskiy wrote: The following patches add MSIX support for PCI on POWER. The first aim is virtio-pci so it was tested. It will also support VFIO when it becomes available in public. Wrong CC

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] spapr: Add support for -vga option

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 14:08 +0200, Alexander Graf wrote: Ben, mind to push a working SLOF, we we can just enable all of it in one go and don't have to commit #if 0'ed code? Rest looks reasonable to me. Sure, SLOF was gated by the memop patch but we can push it now. However I'd rather leave

Re: [Qemu-devel] [PATCH 2/2] spapr: Add support for -vga option

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 16:32 +0200, Andreas Färber wrote: Did you test whether all those paths actually work with ppc? SPICE didn't support ppc host last time I checked. Does it work on x86 host? Currently, I test -vga std, it works well. SPICE and curris are not supported on pcc. :)

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] spapr: Add support for -vga option

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 23:42 +0200, Alexander Graf wrote: It shouldn't be an #if 0 but an if (cirrus) hw_abort() then though. Otherwise we'd just silently ignore the option. You guys love aborts too much. For a high level option like -vga I'd rather just fallback to std (like afaik some other

Re: [Qemu-devel] Request VFIO inclusion in linux-next

2012-06-26 Thread Benjamin Herrenschmidt
On Mon, 2012-06-25 at 22:55 -0600, Alex Williamson wrote: Hi, VFIO has been kicking around for well over a year now and has been posted numerous times for review. The pre-requirements are finally available in linux-next (or will be in the 20120626 build) so I'd like to request a new branch

[Qemu-devel] [PATCH 00/11] iommu series

2012-06-26 Thread Benjamin Herrenschmidt
Only difference (appart from being rebased) is the memory barrier patch getting a couple of curly braces where they were missing. Cheers, Ben.

[Qemu-devel] [PATCH 01/11] Better support for dma_addr_t variables

2012-06-26 Thread Benjamin Herrenschmidt
(#if) based on the size of dma_addr_t. * We add a new helper macro to create device properties which take a dma_addr_t, currently an alias to DEFINE_PROP_TADDR(). Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma.h

[Qemu-devel] [PATCH 03/11] usb-ohci: Use universal DMA helper functions

2012-06-26 Thread Benjamin Herrenschmidt
...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/usb/hcd-ohci.c | 93 + 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 1a1cc88..844e7ed 100644 --- a/hw/usb/hcd

[Qemu-devel] [PATCH 06/11] usb: Convert usb_packet_{map, unmap} to universal DMA helpers

2012-06-26 Thread Benjamin Herrenschmidt
. Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/usb.h |2 +- hw/usb/hcd-ehci.c |4 ++-- hw/usb/hcd-uhci.c |2 +- hw/usb/libhw.c| 21 +++-- 4 files changed, 15 insertions(+), 14

[Qemu-devel] [PATCH 07/11] iommu: Introduce IOMMU emulation infrastructure

2012-06-26 Thread Benjamin Herrenschmidt
perform IOMMU translation using this callback. Cc: Michael S. Tsirkin m...@redhat.com Cc: Richard Henderson r...@twiddle.net Signed-off-by: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b

[Qemu-devel] [PATCH 08/11] pseries: Convert sPAPR TCEs to use generic IOMMU infrastructure

2012-06-26 Thread Benjamin Herrenschmidt
-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/ppc/Makefile.objs |2 +- hw/spapr.c |3 + hw/spapr.h | 17 +++ hw/spapr_iommu.c | 242 +++ hw/spapr_llan.c

[Qemu-devel] [PATCH 04/11] iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers

2012-06-26 Thread Benjamin Herrenschmidt
...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c | 24 dma.h |3 ++- hw/ide/ahci.c |3 ++- hw/ide/macio.c |4 ++-- hw/pci.h |2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git

[Qemu-devel] [PATCH 11/11] Add a memory barrier to DMA functions

2012-06-26 Thread Benjamin Herrenschmidt
-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c |2 ++ dma.h | 53 +++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/dma-helpers.c b/dma-helpers.c index 2e09ceb..35cb500 100644 --- a/dma-helpers.c +++ b/dma

[Qemu-devel] [PATCH 10/11] pseries: Implement IOMMU and DMA for PAPR PCI devices

2012-06-26 Thread Benjamin Herrenschmidt
Graf ag...@suse.de Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/spapr.h |1 + hw/spapr_iommu.c | 40 ++-- hw

[Qemu-devel] [PATCH 09/11] iommu: Allow PCI to use IOMMU infrastructure

2012-06-26 Thread Benjamin Herrenschmidt
Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/pci.c |9 + hw/pci.h |9 +++-- hw/pci_internals.h |2 ++ 3

[Qemu-devel] [PATCH 02/11] iommu: Add universal DMA helper functions

2012-06-26 Thread Benjamin Herrenschmidt
- Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c | 16 ++ dma.h | 95

[Qemu-devel] [PATCH 05/11] ide/ahci: Use universal DMA helper functions

2012-06-26 Thread Benjamin Herrenschmidt
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/ide/ahci.c | 34 -- hw/ide/ahci.h |3 ++- hw/ide/ich.c |2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 6c4226d..efea93f 100644

Re: [Qemu-devel] [PATCH 11/11] Add a memory barrier to DMA functions

2012-06-24 Thread Benjamin Herrenschmidt
On Sun, 2012-06-24 at 06:03 +, Blue Swirl wrote: + * A smarter implementation can be devised if needed to + * use lighter barriers based on the direction of the + * transfer, the DMA context, etc... + */ +if (kvm_enabled()) +smp_mb(); Missing braces.

Re: [Qemu-devel] [PATCH 01/13] Better support for dma_addr_t variables

2012-06-21 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:14 -0500, Anthony Liguori wrote: diff --git a/hw/qdev-dma.h b/hw/qdev-dma.h new file mode 100644 index 000..f0ff558 --- /dev/null +++ b/hw/qdev-dma.h @@ -0,0 +1,12 @@ +/* + * Support for dma_addr_t typed properties + * + * Copyright (C) 2012 David

Re: [Qemu-devel] [PATCH 02/13] Implement cpu_physical_memory_set()

2012-06-21 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:15 -0500, Anthony Liguori wrote: On 06/19/2012 01:39 AM, Benjamin Herrenschmidt wrote: From: David Gibsonda...@gibson.dropbear.id.au This patch adds cpu_physical_memory_set() function. This is equivalent to calling cpu_physical_memory_write() with a buffer filled

Re: [Qemu-devel] [PATCH 1/3] iommu: remove extra 'typedef struct DMAContext'

2012-06-21 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:11 -0400, Jason Baron wrote: There are several instances of 'typedef struct DMAContext DMAContext'. Remove them all except for the one in qemu-common.h. Actually, the other way around :-) I'm removing the one in qemu-common.h in favor of the one in dma.h (at Anthony's

Re: [Qemu-devel] [PATCH 03/13] iommu: Add universal DMA helper functions

2012-06-21 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:16 -0500, Anthony Liguori wrote: diff --git a/qemu-common.h b/qemu-common.h index 8f87e41..80026af 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -264,6 +264,7 @@ typedef struct EventNotifier EventNotifier; typedef struct VirtIODevice VirtIODevice;

Re: [Qemu-devel] [PATCH 04/13] usb-ohci: Use universal DMA helper functions

2012-06-21 Thread Benjamin Herrenschmidt
On Thu, 2012-06-21 at 07:55 -0500, Anthony Liguori wrote: As long as we scrub the buffers, returning an unhandled error seems okay to me. I've long thought we should have some sort of generic way to throw an error and effectively pause a single device. I'm not sure how it would work in

Re: [Qemu-devel] [PATCH 09/13] iommu: Add facility to cancel in-use dma memory maps

2012-06-21 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:25 -0500, Anthony Liguori wrote: +static void dma_aio_cancel(BlockDriverAIOCB *acb) +{ +DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common); + +trace_dma_aio_cancel(dbs); + +if (dbs-acb) { +BlockDriverAIOCB *acb = dbs-acb; +

[Qemu-devel] [PATCH 00/11] iommu series

2012-06-21 Thread Benjamin Herrenschmidt
Here's the latest drop as discussed on the list. 2 patches are gone, the _set variant is folded in the DMA helpers and I ditched all the broken cancellation bits.

[Qemu-devel] [PATCH 01/11] Better support for dma_addr_t variables

2012-06-21 Thread Benjamin Herrenschmidt
(#if) based on the size of dma_addr_t. * We add a new helper macro to create device properties which take a dma_addr_t, currently an alias to DEFINE_PROP_TADDR(). Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma.h

[Qemu-devel] [PATCH 04/11] iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers

2012-06-21 Thread Benjamin Herrenschmidt
...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c | 24 dma.h |3 ++- hw/ide/ahci.c |3 ++- hw/ide/macio.c |4 ++-- hw/pci.h |2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git

[Qemu-devel] [PATCH 03/11] usb-ohci: Use universal DMA helper functions

2012-06-21 Thread Benjamin Herrenschmidt
...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/usb/hcd-ohci.c | 93 + 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 1a1cc88..844e7ed 100644 --- a/hw/usb/hcd

[Qemu-devel] [PATCH 11/11] Add a memory barrier to DMA functions

2012-06-21 Thread Benjamin Herrenschmidt
-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c |2 ++ dma.h | 52 ++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dma-helpers.c b/dma-helpers.c index 2e09ceb..35cb500 100644 --- a/dma-helpers.c +++ b/dma

[Qemu-devel] [PATCH 10/11] pseries: Implement IOMMU and DMA for PAPR PCI devices

2012-06-21 Thread Benjamin Herrenschmidt
Graf ag...@suse.de Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/spapr.h |1 + hw/spapr_iommu.c | 40 ++-- hw

[Qemu-devel] [PATCH 09/11] iommu: Allow PCI to use IOMMU infrastructure

2012-06-21 Thread Benjamin Herrenschmidt
Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/pci.c |9 + hw/pci.h |9 +++-- hw/pci_internals.h |2 ++ 3

[Qemu-devel] [PATCH 06/11] usb: Convert usb_packet_{map, unmap} to universal DMA helpers

2012-06-21 Thread Benjamin Herrenschmidt
. Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/usb.h |2 +- hw/usb/hcd-ehci.c |4 ++-- hw/usb/hcd-uhci.c |2 +- hw/usb/libhw.c| 21 +++-- 4 files changed, 15 insertions(+), 14

[Qemu-devel] [PATCH 05/11] ide/ahci: Use universal DMA helper functions

2012-06-21 Thread Benjamin Herrenschmidt
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/ide/ahci.c | 34 -- hw/ide/ahci.h |3 ++- hw/ide/ich.c |2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 6c4226d..efea93f 100644

[Qemu-devel] [PATCH 08/11] pseries: Convert sPAPR TCEs to use generic IOMMU infrastructure

2012-06-21 Thread Benjamin Herrenschmidt
-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/ppc/Makefile.objs |2 +- hw/spapr.c |3 + hw/spapr.h | 17 +++ hw/spapr_iommu.c | 242 +++ hw/spapr_llan.c

[Qemu-devel] [PATCH 07/11] iommu: Introduce IOMMU emulation infrastructure

2012-06-21 Thread Benjamin Herrenschmidt
perform IOMMU translation using this callback. Cc: Michael S. Tsirkin m...@redhat.com Cc: Richard Henderson r...@twiddle.net Signed-off-by: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b

[Qemu-devel] [PATCH 02/11] iommu: Add universal DMA helper functions

2012-06-21 Thread Benjamin Herrenschmidt
- Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c | 16 ++ dma.h | 95

Re: [Qemu-devel] [PATCH 07/13] usb: Convert usb_packet_{map, unmap} to universal DMA helpers

2012-06-20 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 08:25 +0200, Gerd Hoffmann wrote: Hi, Like with any other device, it's hard ... what would happen on real hardware is that the USB controller will get a target abort, which will result in the controller reporting an error (typically in the PCI status register) and

Re: [Qemu-devel] [PATCH 01/13] Better support for dma_addr_t variables

2012-06-20 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:14 -0500, Anthony Liguori wrote: Why not make life easy and fix dma_addr_t to 64-bit? No opinion on my side, that's from the original patch series, I suppose the goal was to avoid the overhead/bloat on 32-bit only platforms/targets. Cheers, Ben.

Re: [Qemu-devel] [PATCH 02/13] Implement cpu_physical_memory_set()

2012-06-20 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:15 -0500, Anthony Liguori wrote: On 06/19/2012 01:39 AM, Benjamin Herrenschmidt wrote: From: David Gibsonda...@gibson.dropbear.id.au This patch adds cpu_physical_memory_set() function. This is equivalent to calling cpu_physical_memory_write() with a buffer filled

Re: [Qemu-devel] [PATCH 03/13] iommu: Add universal DMA helper functions

2012-06-20 Thread Benjamin Herrenschmidt
/* DMA access functions */ +static inline DMAContext *pci_dma_context(PCIDevice *dev) +{ +/* Stub for when we have no PCI iommu support */ +return NULL; +} Why is all of this stuff static inline? Why not ? Not doing so is gratuitous bloat overhead static inline

Re: [Qemu-devel] [PATCH 04/13] usb-ohci: Use universal DMA helper functions

2012-06-20 Thread Benjamin Herrenschmidt
Cc: Gerd Hoffmannkra...@redhat.com Cc: Michael S. Tsirkinm...@redhat.com Signed-off-by: David Gibsonda...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidtb...@kernel.crashing.org So... the DMA api is designed to allow for partial result returns which I presume an

Re: [Qemu-devel] [PATCH 05/13] iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers

2012-06-20 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:21 -0500, Anthony Liguori wrote: Again, you return an error but ignore it now. In the very least, on error you should scrub the passed in buffer to avoid leaking data to the guest. You can imagine a malicious guest programming the IOMMU with invalid mappings

Re: [Qemu-devel] [PATCH 09/13] iommu: Add facility to cancel in-use dma memory maps

2012-06-20 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:25 -0500, Anthony Liguori wrote: So this cancellation stuff is hopelessly broken It's simply not possible to fully cancel pending DMA in a synchronous callback. Well, at least for PAPR H_PUT_TCE, cancellation must be synchronous, ie the hypercall must not return

Re: [Qemu-devel] [PATCH 04/13] usb-ohci: Use universal DMA helper functions

2012-06-20 Thread Benjamin Herrenschmidt
On Wed, 2012-06-20 at 16:40 -0500, Anthony Liguori wrote: Well let's return void in the DMA methods and let the IOMMUs assert on error. At least that will avoid surprises until someone decides they care enough about errors to touch all callers. I think silently failing a memcpy() can

Re: [Qemu-devel] [PATCH 02/13] Implement cpu_physical_memory_set()

2012-06-20 Thread Benjamin Herrenschmidt
On Thu, 2012-06-21 at 11:45 +1000, David Gibson wrote: Why should this be in the core API? Shouldn't this be a helper on top of the DMA API? Well, I was hoping to avoid having to allocate a temporary buffer of zeroes, which is necessary to do this in terms of the existing

[Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes

2012-06-19 Thread Benjamin Herrenschmidt
We were incorrectly g_free'ing an object that isn't allocated in one error path and failed to release it completely in another This fixes qemu crashes with some cases of IO errors. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/spapr_vscsi.c |4 +++- 1 file changed, 3

[Qemu-devel] [PATCH v3] spapr: Add memop hypercall

2012-06-19 Thread Benjamin Herrenschmidt
internally calls H_RTAS. We might in the future implement part (or even all) of RTAS inside the guest like IBM's firmware does and replace H_RTAS with some finer grained set of private hypercalls. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- This should address all your

[Qemu-devel] [PATCH 00/13] iommu series

2012-06-19 Thread Benjamin Herrenschmidt
This is a rebase of the iommu series and the barrier patch together on top of current qemu. As for our discussions about doing things with Memory Regions etc I eventually came to the conclusion that we should just apply this first :-) My reasons (other than it makes my life much easier which it

[Qemu-devel] [PATCH 04/13] usb-ohci: Use universal DMA helper functions

2012-06-19 Thread Benjamin Herrenschmidt
...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/usb/hcd-ohci.c | 93 + 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 1a1cc88..844e7ed 100644 --- a/hw/usb/hcd

[Qemu-devel] [PATCH 12/13] pseries: Implement IOMMU and DMA for PAPR PCI devices

2012-06-19 Thread Benjamin Herrenschmidt
Graf ag...@suse.de Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/spapr.h |1 + hw/spapr_iommu.c | 40 ++-- hw

[Qemu-devel] [PATCH 08/13] iommu: Introduce IOMMU emulation infrastructure

2012-06-19 Thread Benjamin Herrenschmidt
perform IOMMU translation using this callback. Cc: Michael S. Tsirkin m...@redhat.com Cc: Richard Henderson r...@twiddle.net Signed-off-by: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b

[Qemu-devel] [PATCH 06/13] ide/ahci: Use universal DMA helper functions

2012-06-19 Thread Benjamin Herrenschmidt
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/ide/ahci.c | 34 -- hw/ide/ahci.h |3 ++- hw/ide/ich.c |2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 6c4226d..efea93f 100644

[Qemu-devel] [PATCH 02/13] Implement cpu_physical_memory_set()

2012-06-19 Thread Benjamin Herrenschmidt
Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- cpu-common.h |1 + exec.c | 15 +++ 2 files changed, 16 insertions(+) diff --git a/cpu-common.h b/cpu-common.h index 1fe3280..8d3596a 100644 --- a/cpu-common.h +++ b/cpu

[Qemu-devel] [PATCH 01/13] Better support for dma_addr_t variables

2012-06-19 Thread Benjamin Herrenschmidt
(#if) based on the size of dma_addr_t. * We add a new helper macro to create device properties which take a dma_addr_t, currently an alias to DEFINE_PROP_TADDR(). Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma.h

[Qemu-devel] [PATCH 07/13] usb: Convert usb_packet_{map, unmap} to universal DMA helpers

2012-06-19 Thread Benjamin Herrenschmidt
. Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/usb.h |2 +- hw/usb/hcd-ehci.c |4 ++-- hw/usb/hcd-uhci.c |2 +- hw/usb/libhw.c| 21 +++-- 4 files changed, 15 insertions(+), 14

[Qemu-devel] [PATCH 11/13] iommu: Allow PCI to use IOMMU infrastructure

2012-06-19 Thread Benjamin Herrenschmidt
Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/pci.c |9 + hw/pci.h |9 +++-- hw/pci_internals.h |2 ++ 3

[Qemu-devel] [PATCH 10/13] pseries: Convert sPAPR TCEs to use generic IOMMU infrastructure

2012-06-19 Thread Benjamin Herrenschmidt
-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- hw/ppc/Makefile.objs |2 +- hw/spapr.c |3 + hw/spapr.h | 16 +++ hw/spapr_iommu.c | 242 +++ hw/spapr_llan.c

[Qemu-devel] [PATCH 13/13] Add a memory barrier to DMA functions

2012-06-19 Thread Benjamin Herrenschmidt
-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma.h | 54 -- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/dma.h b/dma.h index f1fcb71..0d57e50 100644 --- a/dma.h +++ b/dma.h @@ -13,6 +13,7 @@ #include stdio.h #include hw/hw.h

[Qemu-devel] [PATCH 09/13] iommu: Add facility to cancel in-use dma memory maps

2012-06-19 Thread Benjamin Herrenschmidt
backend implementation may choose to keep track of maps and call the respective cancel callback whenever a translation within a map is removed, allowing the driver to do things like cancel async IOs etc. Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b

[Qemu-devel] [PATCH 05/13] iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers

2012-06-19 Thread Benjamin Herrenschmidt
...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma-helpers.c | 24 dma.h |3 ++- hw/ide/ahci.c |3 ++- hw/ide/macio.c |4 ++-- hw/pci.h |2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git

[Qemu-devel] [PATCH 03/13] iommu: Add universal DMA helper functions

2012-06-19 Thread Benjamin Herrenschmidt
- Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- dma.h | 100 + hw/pci.h

Re: [Qemu-devel] [Bug 1013241] Re: qemu-system-ppc64 hanging occasionally in disk writes

2012-06-19 Thread Benjamin Herrenschmidt
On Tue, 2012-06-19 at 10:16 +, Richard W.M. Jones wrote: I switched to using virtio-scsi (instead of virtio-blk). This appears to have solved this problem, although it brings another problem. I also tried vscsi, which fixes both problems. Therefore I will (not definitively) claim

Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes

2012-06-19 Thread Benjamin Herrenschmidt
On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote: Tab alert. :) Argh :-) Gotta get an emacs config for use with qemu :-) Cheers, Ben.

Re: [Qemu-devel] [PATCH 07/13] usb: Convert usb_packet_{map, unmap} to universal DMA helpers

2012-06-19 Thread Benjamin Herrenschmidt
On Tue, 2012-06-19 at 15:42 +0200, Gerd Hoffmann wrote: Well, that isn't guaranteed ... - otherwise the guest might invalidate IOMMU mappings while they are still in use by the device code. Guest tearing down mapping while usb packets using them are still in flight would be a guest

<    5   6   7   8   9   10   11   12   13   >