All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr-pci: remove io ports workaround
@ 2013-07-15  3:24 Alexey Kardashevskiy
  2013-07-15  6:06 ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Alexey Kardashevskiy @ 2013-07-15  3:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Anthony Liguori, Alexey Kardashevskiy, Alexander Graf, qemu-ppc,
	Paul Mackerras, David Gibson

As it looks like all portio users have migrated to new portio api,
the workaround with memory access to io ports routing is no more
needed.

This also fixes a bug with byte swapping as the io region was marked
as little endian while it should not do any swapping at all.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_pci.c | 52 +++-------------------------------------------------
 1 file changed, 3 insertions(+), 49 deletions(-)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index ca588aa..8d76290 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -440,43 +440,6 @@ static void pci_spapr_set_irq(void *opaque, int irq_num, int level)
     qemu_set_irq(spapr_phb_lsi_qirq(phb, irq_num), level);
 }
 
-static uint64_t spapr_io_read(void *opaque, hwaddr addr,
-                              unsigned size)
-{
-    switch (size) {
-    case 1:
-        return cpu_inb(addr);
-    case 2:
-        return cpu_inw(addr);
-    case 4:
-        return cpu_inl(addr);
-    }
-    g_assert_not_reached();
-}
-
-static void spapr_io_write(void *opaque, hwaddr addr,
-                           uint64_t data, unsigned size)
-{
-    switch (size) {
-    case 1:
-        cpu_outb(addr, data);
-        return;
-    case 2:
-        cpu_outw(addr, data);
-        return;
-    case 4:
-        cpu_outl(addr, data);
-        return;
-    }
-    g_assert_not_reached();
-}
-
-static const MemoryRegionOps spapr_io_ops = {
-    .endianness = DEVICE_LITTLE_ENDIAN,
-    .read = spapr_io_read,
-    .write = spapr_io_write
-};
-
 /*
  * MSI/MSIX memory region implementation.
  * The handler handles both MSI and MSIX.
@@ -590,23 +553,14 @@ static int spapr_phb_init(SysBusDevice *s)
     memory_region_add_subregion(get_system_memory(), sphb->mem_win_addr,
                                 &sphb->memwindow);
 
-    /* On ppc, we only have MMIO no specific IO space from the CPU
-     * perspective.  In theory we ought to be able to embed the PCI IO
-     * memory region direction in the system memory space.  However,
-     * if any of the IO BAR subregions use the old_portio mechanism,
-     * that won't be processed properly unless accessed from the
-     * system io address space.  This hack to bounce things via
-     * system_io works around the problem until all the users of
-     * old_portion are updated */
+    /* Initialize IO regions */
     sprintf(namebuf, "%s.io", sphb->dtbusname);
     memory_region_init(&sphb->iospace, OBJECT(sphb),
                        namebuf, SPAPR_PCI_IO_WIN_SIZE);
-    /* FIXME: fix to support multiple PHBs */
-    memory_region_add_subregion(get_system_io(), 0, &sphb->iospace);
 
     sprintf(namebuf, "%s.io-alias", sphb->dtbusname);
-    memory_region_init_io(&sphb->iowindow, OBJECT(sphb), &spapr_io_ops, sphb,
-                          namebuf, SPAPR_PCI_IO_WIN_SIZE);
+    memory_region_init_alias(&sphb->iowindow, OBJECT(sphb),
+                             namebuf, &sphb->iospace, 0, SPAPR_PCI_IO_WIN_SIZE);
     memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
                                 &sphb->iowindow);
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH] spapr-pci: remove io ports workaround
@ 2014-02-07 13:44 Greg Kurz
  2014-02-07 14:06 ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Greg Kurz @ 2014-02-07 13:44 UTC (permalink / raw)
  To: aik, agraf; +Cc: qemu-ppc, qemu-devel

In the past, IO space could not be mapped into the memory address space
so we introduced a workaround for that. Nowadays it does not look
necessary so we can remove the workaround and make sPAPR PCI
configuration simplier.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---

There has been a previous post for this patch:

        http://patchwork.ozlabs.org/patch/299123/

Since then, things have evolved:
- the kvm_mem_ioeventfd_add failure was fixed by the "KVM: fix addr type 
  for KVM_IOEVENTFD" commit (584f2be).
- Alexey's NACK got addressed in SLOF:

        https://github.com/aik/SLOF/commit/020220e

Cheers.

--
Greg

 hw/ppc/spapr_pci.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 66ddf10..3b7d978 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -564,23 +564,14 @@ static int spapr_phb_init(SysBusDevice *s)
     memory_region_add_subregion(get_system_memory(), sphb->mem_win_addr,
                                 &sphb->memwindow);
 
-    /* On ppc, we only have MMIO no specific IO space from the CPU
-     * perspective.  In theory we ought to be able to embed the PCI IO
-     * memory region direction in the system memory space.  However,
-     * if any of the IO BAR subregions use the old_portio mechanism,
-     * that won't be processed properly unless accessed from the
-     * system io address space.  This hack to bounce things via
-     * system_io works around the problem until all the users of
-     * old_portion are updated */
+    /* Initialize IO regions */
     sprintf(namebuf, "%s.io", sphb->dtbusname);
     memory_region_init(&sphb->iospace, OBJECT(sphb),
                        namebuf, SPAPR_PCI_IO_WIN_SIZE);
-    /* FIXME: fix to support multiple PHBs */
-    memory_region_add_subregion(get_system_io(), 0, &sphb->iospace);
 
     sprintf(namebuf, "%s.io-alias", sphb->dtbusname);
     memory_region_init_alias(&sphb->iowindow, OBJECT(sphb), namebuf,
-                             get_system_io(), 0, SPAPR_PCI_IO_WIN_SIZE);
+                             &sphb->iospace, 0, SPAPR_PCI_IO_WIN_SIZE);
     memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
                                 &sphb->iowindow);
     /*

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2014-02-10  5:12 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15  3:24 [Qemu-devel] [PATCH] spapr-pci: remove io ports workaround Alexey Kardashevskiy
2013-07-15  6:06 ` Alexander Graf
2013-07-15  9:44   ` Alexey Kardashevskiy
2013-07-16  5:19   ` Alexey Kardashevskiy
2013-07-16  6:20     ` Paolo Bonzini
2013-07-16  8:32       ` Alexander Graf
2013-07-16  8:37         ` Alexey Kardashevskiy
2013-07-16  8:41           ` Alexander Graf
2013-07-16  8:45         ` Benjamin Herrenschmidt
2013-07-16  9:01           ` Alexander Graf
2013-07-16  9:10             ` Alexey Kardashevskiy
2013-12-09 16:33     ` Greg Kurz
2013-12-10  2:43       ` Alexey Kardashevskiy
2013-12-10  7:47         ` Greg Kurz
2013-12-11  6:47           ` Alexey Kardashevskiy
2013-12-11  7:07             ` Alexey Kardashevskiy
2013-12-17  7:52               ` Greg Kurz
2013-12-17  8:33                 ` Alexey Kardashevskiy
2014-01-02 21:04             ` Alexander Graf
2014-01-02 22:08               ` Alexey Kardashevskiy
2014-01-02 22:09                 ` Alexander Graf
2014-01-03  7:29                   ` Alexey Kardashevskiy
2014-01-06 11:12                 ` Greg Kurz
2014-01-06 23:12                   ` Alexey Kardashevskiy
2014-02-07 13:44 Greg Kurz
2014-02-07 14:06 ` Alexander Graf
2014-02-10  5:12   ` Alexey Kardashevskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.