[Spice-devel] [qxl] Use pci_io_write8 instead of outb
Marc-André Lureau
mlureau at redhat.com
Fri May 15 02:13:26 PDT 2015
ack
----- Original Message -----
> From: Adam Jackson <ajax at redhat.com>
>
> This ensures better portability as some arches (eg aarch64) don't have
> outb.
> On linux pci_io_* try to open the sysfs map file corresponding to the
> I/O port range, which the kernel translates arch-appropriately. If
> there is no such file then it'll try to use port instructions if that's
> a thing the architecture has. So you only need one path, pciaccess
> exists to get the portability right for you.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1201877
> ---
> Hey,
>
> This patch was suggested by Adam as a way to fix the build failure reported
> in rhbz#1201877
> It hasn't been runtime tested on aarch64, but it builds there. I've ran some
> quick tests on x86, and things are fine there.
>
> Christophe
>
>
> src/qxl.h | 3 ++-
> src/qxl_driver.c | 5 +++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/qxl.h b/src/qxl.h
> index f46bc58..ff55604 100644
> --- a/src/qxl.h
> +++ b/src/qxl.h
> @@ -273,6 +273,7 @@ struct _qxl_screen_t
> #ifndef XSPICE
> #ifdef XSERVER_LIBPCIACCESS
> struct pci_device * pci;
> + struct pci_io_handle * io;
> #else
> pciVideoPtr pci;
> PCITAG pci_tag;
> @@ -631,7 +632,7 @@ void ioport_write(qxl_screen_t *qxl, uint32_t io_port,
> uint32_t val);
> #else
> static inline void ioport_write(qxl_screen_t *qxl, int port, int val)
> {
> - outb(qxl->io_base + port, val);
> + pci_io_write8(qxl->io, port, val);
> }
> #endif
>
> diff --git a/src/qxl_driver.c b/src/qxl_driver.c
> index 942067f..ce0a88e 100644
> --- a/src/qxl_driver.c
> +++ b/src/qxl_driver.c
> @@ -219,6 +219,8 @@ unmap_memory_helper (qxl_screen_t *qxl)
> pci_device_unmap_range (qxl->pci, qxl->vram, qxl->pci->regions[1].size);
> if (qxl->rom)
> pci_device_unmap_range (qxl->pci, qxl->rom, qxl->pci->regions[2].size);
> + if (qxl->io)
> + pci_device_close_io (qxl->pci, qxl->io);
> #else
> if (qxl->ram)
> xf86UnMapVidMem (scrnIndex, qxl->ram, (1 << qxl->pci->size[0]));
> @@ -251,6 +253,9 @@ map_memory_helper (qxl_screen_t *qxl)
> qxl->pci->regions[2].size, 0,
> (void **)&qxl->rom);
>
> + qxl->io = pci_device_open_io(qxl->pci,
> + qxl->pci->regions[3].base_addr,
> + qxl->pci->regions[3].size);
> qxl->io_base = qxl->pci->regions[3].base_addr;
> #else
> qxl->ram = xf86MapPciMem (scrnIndex, VIDMEM_FRAMEBUFFER,
> --
> 2.4.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list