All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
@ 2013-11-04 13:42 ` Jan Kiszka
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2013-11-04 13:42 UTC (permalink / raw)
  To: Paolo Bonzini, Gleb Natapov; +Cc: Alex Williamson, qemu-devel, kvm

This feature was already deprecated back then in qemu-kvm, ie. before
pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
with resource_fd < 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
 1 file changed, 10 insertions(+), 46 deletions(-)

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 011764f..4e65110 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
     uint64_t val = 0;
     int fd = dev_region->region->resource_fd;
 
-    if (fd >= 0) {
-        if (data) {
-            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
-            if (pwrite(fd, data, size, addr) != size) {
-                error_report("%s - pwrite failed %s",
-                             __func__, strerror(errno));
-            }
-        } else {
-            if (pread(fd, &val, size, addr) != size) {
-                error_report("%s - pread failed %s",
-                             __func__, strerror(errno));
-                val = (1UL << (size * 8)) - 1;
-            }
-            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
+    if (data) {
+        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
+              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
+        if (pwrite(fd, data, size, addr) != size) {
+            error_report("%s - pwrite failed %s", __func__, strerror(errno));
         }
     } else {
-        uint32_t port = addr + dev_region->u.r_baseport;
-
-        if (data) {
-            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", host=%x\n", *data, size, addr, port);
-            switch (size) {
-            case 1:
-                outb(*data, port);
-                break;
-            case 2:
-                outw(*data, port);
-                break;
-            case 4:
-                outl(*data, port);
-                break;
-            }
-        } else {
-            switch (size) {
-            case 1:
-                val = inb(port);
-                break;
-            case 2:
-                val = inw(port);
-                break;
-            case 4:
-                val = inl(port);
-                break;
-            }
-            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", host=%x\n", val, size, addr, port);
+        if (pread(fd, &val, size, addr) != size) {
+            error_report("%s - pread failed %s", __func__, strerror(errno));
+            val = (1UL << (size * 8)) - 1;
         }
+        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
+              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
     }
     return val;
 }
-- 
1.8.1.1.298.ge7eed54

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

* [Qemu-devel] [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
@ 2013-11-04 13:42 ` Jan Kiszka
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2013-11-04 13:42 UTC (permalink / raw)
  To: Paolo Bonzini, Gleb Natapov; +Cc: Alex Williamson, qemu-devel, kvm

This feature was already deprecated back then in qemu-kvm, ie. before
pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
with resource_fd < 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
 1 file changed, 10 insertions(+), 46 deletions(-)

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 011764f..4e65110 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
     uint64_t val = 0;
     int fd = dev_region->region->resource_fd;
 
-    if (fd >= 0) {
-        if (data) {
-            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
-            if (pwrite(fd, data, size, addr) != size) {
-                error_report("%s - pwrite failed %s",
-                             __func__, strerror(errno));
-            }
-        } else {
-            if (pread(fd, &val, size, addr) != size) {
-                error_report("%s - pread failed %s",
-                             __func__, strerror(errno));
-                val = (1UL << (size * 8)) - 1;
-            }
-            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
+    if (data) {
+        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
+              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
+        if (pwrite(fd, data, size, addr) != size) {
+            error_report("%s - pwrite failed %s", __func__, strerror(errno));
         }
     } else {
-        uint32_t port = addr + dev_region->u.r_baseport;
-
-        if (data) {
-            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", host=%x\n", *data, size, addr, port);
-            switch (size) {
-            case 1:
-                outb(*data, port);
-                break;
-            case 2:
-                outw(*data, port);
-                break;
-            case 4:
-                outl(*data, port);
-                break;
-            }
-        } else {
-            switch (size) {
-            case 1:
-                val = inb(port);
-                break;
-            case 2:
-                val = inw(port);
-                break;
-            case 4:
-                val = inl(port);
-                break;
-            }
-            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
-                  ", host=%x\n", val, size, addr, port);
+        if (pread(fd, &val, size, addr) != size) {
+            error_report("%s - pread failed %s", __func__, strerror(errno));
+            val = (1UL << (size * 8)) - 1;
         }
+        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
+              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
     }
     return val;
 }
-- 
1.8.1.1.298.ge7eed54

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

* Re: [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
  2013-11-04 13:42 ` [Qemu-devel] " Jan Kiszka
@ 2013-11-06  7:34   ` Gleb Natapov
  -1 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2013-11-06  7:34 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Paolo Bonzini, kvm, qemu-devel, Alex Williamson

Alex can you review please?

On Mon, Nov 04, 2013 at 02:42:55PM +0100, Jan Kiszka wrote:
> This feature was already deprecated back then in qemu-kvm, ie. before
> pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
> with resource_fd < 0.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
>  1 file changed, 10 insertions(+), 46 deletions(-)
> 
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 011764f..4e65110 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
>      uint64_t val = 0;
>      int fd = dev_region->region->resource_fd;
>  
> -    if (fd >= 0) {
> -        if (data) {
> -            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> -            if (pwrite(fd, data, size, addr) != size) {
> -                error_report("%s - pwrite failed %s",
> -                             __func__, strerror(errno));
> -            }
> -        } else {
> -            if (pread(fd, &val, size, addr) != size) {
> -                error_report("%s - pread failed %s",
> -                             __func__, strerror(errno));
> -                val = (1UL << (size * 8)) - 1;
> -            }
> -            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> +    if (data) {
> +        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> +        if (pwrite(fd, data, size, addr) != size) {
> +            error_report("%s - pwrite failed %s", __func__, strerror(errno));
>          }
>      } else {
> -        uint32_t port = addr + dev_region->u.r_baseport;
> -
> -        if (data) {
> -            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", *data, size, addr, port);
> -            switch (size) {
> -            case 1:
> -                outb(*data, port);
> -                break;
> -            case 2:
> -                outw(*data, port);
> -                break;
> -            case 4:
> -                outl(*data, port);
> -                break;
> -            }
> -        } else {
> -            switch (size) {
> -            case 1:
> -                val = inb(port);
> -                break;
> -            case 2:
> -                val = inw(port);
> -                break;
> -            case 4:
> -                val = inl(port);
> -                break;
> -            }
> -            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", val, size, addr, port);
> +        if (pread(fd, &val, size, addr) != size) {
> +            error_report("%s - pread failed %s", __func__, strerror(errno));
> +            val = (1UL << (size * 8)) - 1;
>          }
> +        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
>      }
>      return val;
>  }
> -- 
> 1.8.1.1.298.ge7eed54

--
			Gleb.

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

* Re: [Qemu-devel] [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
@ 2013-11-06  7:34   ` Gleb Natapov
  0 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2013-11-06  7:34 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Paolo Bonzini, Alex Williamson, qemu-devel, kvm

Alex can you review please?

On Mon, Nov 04, 2013 at 02:42:55PM +0100, Jan Kiszka wrote:
> This feature was already deprecated back then in qemu-kvm, ie. before
> pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
> with resource_fd < 0.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
>  1 file changed, 10 insertions(+), 46 deletions(-)
> 
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 011764f..4e65110 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
>      uint64_t val = 0;
>      int fd = dev_region->region->resource_fd;
>  
> -    if (fd >= 0) {
> -        if (data) {
> -            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> -            if (pwrite(fd, data, size, addr) != size) {
> -                error_report("%s - pwrite failed %s",
> -                             __func__, strerror(errno));
> -            }
> -        } else {
> -            if (pread(fd, &val, size, addr) != size) {
> -                error_report("%s - pread failed %s",
> -                             __func__, strerror(errno));
> -                val = (1UL << (size * 8)) - 1;
> -            }
> -            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> +    if (data) {
> +        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> +        if (pwrite(fd, data, size, addr) != size) {
> +            error_report("%s - pwrite failed %s", __func__, strerror(errno));
>          }
>      } else {
> -        uint32_t port = addr + dev_region->u.r_baseport;
> -
> -        if (data) {
> -            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", *data, size, addr, port);
> -            switch (size) {
> -            case 1:
> -                outb(*data, port);
> -                break;
> -            case 2:
> -                outw(*data, port);
> -                break;
> -            case 4:
> -                outl(*data, port);
> -                break;
> -            }
> -        } else {
> -            switch (size) {
> -            case 1:
> -                val = inb(port);
> -                break;
> -            case 2:
> -                val = inw(port);
> -                break;
> -            case 4:
> -                val = inl(port);
> -                break;
> -            }
> -            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", val, size, addr, port);
> +        if (pread(fd, &val, size, addr) != size) {
> +            error_report("%s - pread failed %s", __func__, strerror(errno));
> +            val = (1UL << (size * 8)) - 1;
>          }
> +        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
>      }
>      return val;
>  }
> -- 
> 1.8.1.1.298.ge7eed54

--
			Gleb.

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

* Re: [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
  2013-11-06  7:34   ` [Qemu-devel] " Gleb Natapov
@ 2013-11-06 18:06     ` Alex Williamson
  -1 siblings, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2013-11-06 18:06 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Jan Kiszka, Paolo Bonzini, kvm, qemu-devel

On Wed, 2013-11-06 at 09:34 +0200, Gleb Natapov wrote:
> Alex can you review please?

Yep, looks fine.

Acked-by: Alex Williamson <alex.williamson@redhat.com>

> On Mon, Nov 04, 2013 at 02:42:55PM +0100, Jan Kiszka wrote:
> > This feature was already deprecated back then in qemu-kvm, ie. before
> > pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
> > with resource_fd < 0.
> > 
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > ---
> >  hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
> >  1 file changed, 10 insertions(+), 46 deletions(-)
> > 
> > diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> > index 011764f..4e65110 100644
> > --- a/hw/i386/kvm/pci-assign.c
> > +++ b/hw/i386/kvm/pci-assign.c
> > @@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
> >      uint64_t val = 0;
> >      int fd = dev_region->region->resource_fd;
> >  
> > -    if (fd >= 0) {
> > -        if (data) {
> > -            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> > -            if (pwrite(fd, data, size, addr) != size) {
> > -                error_report("%s - pwrite failed %s",
> > -                             __func__, strerror(errno));
> > -            }
> > -        } else {
> > -            if (pread(fd, &val, size, addr) != size) {
> > -                error_report("%s - pread failed %s",
> > -                             __func__, strerror(errno));
> > -                val = (1UL << (size * 8)) - 1;
> > -            }
> > -            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> > +    if (data) {
> > +        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > +              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> > +        if (pwrite(fd, data, size, addr) != size) {
> > +            error_report("%s - pwrite failed %s", __func__, strerror(errno));
> >          }
> >      } else {
> > -        uint32_t port = addr + dev_region->u.r_baseport;
> > -
> > -        if (data) {
> > -            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", host=%x\n", *data, size, addr, port);
> > -            switch (size) {
> > -            case 1:
> > -                outb(*data, port);
> > -                break;
> > -            case 2:
> > -                outw(*data, port);
> > -                break;
> > -            case 4:
> > -                outl(*data, port);
> > -                break;
> > -            }
> > -        } else {
> > -            switch (size) {
> > -            case 1:
> > -                val = inb(port);
> > -                break;
> > -            case 2:
> > -                val = inw(port);
> > -                break;
> > -            case 4:
> > -                val = inl(port);
> > -                break;
> > -            }
> > -            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", host=%x\n", val, size, addr, port);
> > +        if (pread(fd, &val, size, addr) != size) {
> > +            error_report("%s - pread failed %s", __func__, strerror(errno));
> > +            val = (1UL << (size * 8)) - 1;
> >          }
> > +        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > +              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> >      }
> >      return val;
> >  }
> > -- 
> > 1.8.1.1.298.ge7eed54
> 
> --
> 			Gleb.




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

* Re: [Qemu-devel] [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
@ 2013-11-06 18:06     ` Alex Williamson
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2013-11-06 18:06 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Jan Kiszka, qemu-devel, kvm, Paolo Bonzini

On Wed, 2013-11-06 at 09:34 +0200, Gleb Natapov wrote:
> Alex can you review please?

Yep, looks fine.

Acked-by: Alex Williamson <alex.williamson@redhat.com>

> On Mon, Nov 04, 2013 at 02:42:55PM +0100, Jan Kiszka wrote:
> > This feature was already deprecated back then in qemu-kvm, ie. before
> > pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
> > with resource_fd < 0.
> > 
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > ---
> >  hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
> >  1 file changed, 10 insertions(+), 46 deletions(-)
> > 
> > diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> > index 011764f..4e65110 100644
> > --- a/hw/i386/kvm/pci-assign.c
> > +++ b/hw/i386/kvm/pci-assign.c
> > @@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
> >      uint64_t val = 0;
> >      int fd = dev_region->region->resource_fd;
> >  
> > -    if (fd >= 0) {
> > -        if (data) {
> > -            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> > -            if (pwrite(fd, data, size, addr) != size) {
> > -                error_report("%s - pwrite failed %s",
> > -                             __func__, strerror(errno));
> > -            }
> > -        } else {
> > -            if (pread(fd, &val, size, addr) != size) {
> > -                error_report("%s - pread failed %s",
> > -                             __func__, strerror(errno));
> > -                val = (1UL << (size * 8)) - 1;
> > -            }
> > -            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> > +    if (data) {
> > +        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > +              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> > +        if (pwrite(fd, data, size, addr) != size) {
> > +            error_report("%s - pwrite failed %s", __func__, strerror(errno));
> >          }
> >      } else {
> > -        uint32_t port = addr + dev_region->u.r_baseport;
> > -
> > -        if (data) {
> > -            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", host=%x\n", *data, size, addr, port);
> > -            switch (size) {
> > -            case 1:
> > -                outb(*data, port);
> > -                break;
> > -            case 2:
> > -                outw(*data, port);
> > -                break;
> > -            case 4:
> > -                outl(*data, port);
> > -                break;
> > -            }
> > -        } else {
> > -            switch (size) {
> > -            case 1:
> > -                val = inb(port);
> > -                break;
> > -            case 2:
> > -                val = inw(port);
> > -                break;
> > -            case 4:
> > -                val = inl(port);
> > -                break;
> > -            }
> > -            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > -                  ", host=%x\n", val, size, addr, port);
> > +        if (pread(fd, &val, size, addr) != size) {
> > +            error_report("%s - pread failed %s", __func__, strerror(errno));
> > +            val = (1UL << (size * 8)) - 1;
> >          }
> > +        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> > +              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> >      }
> >      return val;
> >  }
> > -- 
> > 1.8.1.1.298.ge7eed54
> 
> --
> 			Gleb.

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

* Re: [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
  2013-11-04 13:42 ` [Qemu-devel] " Jan Kiszka
@ 2013-11-07 11:11   ` Gleb Natapov
  -1 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2013-11-07 11:11 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Paolo Bonzini, kvm, qemu-devel, Alex Williamson

On Mon, Nov 04, 2013 at 02:42:55PM +0100, Jan Kiszka wrote:
> This feature was already deprecated back then in qemu-kvm, ie. before
> pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
> with resource_fd < 0.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, thanks.

> ---
>  hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
>  1 file changed, 10 insertions(+), 46 deletions(-)
> 
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 011764f..4e65110 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
>      uint64_t val = 0;
>      int fd = dev_region->region->resource_fd;
>  
> -    if (fd >= 0) {
> -        if (data) {
> -            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> -            if (pwrite(fd, data, size, addr) != size) {
> -                error_report("%s - pwrite failed %s",
> -                             __func__, strerror(errno));
> -            }
> -        } else {
> -            if (pread(fd, &val, size, addr) != size) {
> -                error_report("%s - pread failed %s",
> -                             __func__, strerror(errno));
> -                val = (1UL << (size * 8)) - 1;
> -            }
> -            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> +    if (data) {
> +        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> +        if (pwrite(fd, data, size, addr) != size) {
> +            error_report("%s - pwrite failed %s", __func__, strerror(errno));
>          }
>      } else {
> -        uint32_t port = addr + dev_region->u.r_baseport;
> -
> -        if (data) {
> -            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", *data, size, addr, port);
> -            switch (size) {
> -            case 1:
> -                outb(*data, port);
> -                break;
> -            case 2:
> -                outw(*data, port);
> -                break;
> -            case 4:
> -                outl(*data, port);
> -                break;
> -            }
> -        } else {
> -            switch (size) {
> -            case 1:
> -                val = inb(port);
> -                break;
> -            case 2:
> -                val = inw(port);
> -                break;
> -            case 4:
> -                val = inl(port);
> -                break;
> -            }
> -            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", val, size, addr, port);
> +        if (pread(fd, &val, size, addr) != size) {
> +            error_report("%s - pread failed %s", __func__, strerror(errno));
> +            val = (1UL << (size * 8)) - 1;
>          }
> +        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
>      }
>      return val;
>  }
> -- 
> 1.8.1.1.298.ge7eed54

--
			Gleb.

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

* Re: [Qemu-devel] [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace
@ 2013-11-07 11:11   ` Gleb Natapov
  0 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2013-11-07 11:11 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Paolo Bonzini, Alex Williamson, qemu-devel, kvm

On Mon, Nov 04, 2013 at 02:42:55PM +0100, Jan Kiszka wrote:
> This feature was already deprecated back then in qemu-kvm, ie. before
> pci-assign went upstream. assigned_dev_ioport_rw will never be invoked
> with resource_fd < 0.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, thanks.

> ---
>  hw/i386/kvm/pci-assign.c | 56 +++++++++---------------------------------------
>  1 file changed, 10 insertions(+), 46 deletions(-)
> 
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 011764f..4e65110 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
>      uint64_t val = 0;
>      int fd = dev_region->region->resource_fd;
>  
> -    if (fd >= 0) {
> -        if (data) {
> -            DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> -            if (pwrite(fd, data, size, addr) != size) {
> -                error_report("%s - pwrite failed %s",
> -                             __func__, strerror(errno));
> -            }
> -        } else {
> -            if (pread(fd, &val, size, addr) != size) {
> -                error_report("%s - pread failed %s",
> -                             __func__, strerror(errno));
> -                val = (1UL << (size * 8)) - 1;
> -            }
> -            DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
> +    if (data) {
> +        DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
> +        if (pwrite(fd, data, size, addr) != size) {
> +            error_report("%s - pwrite failed %s", __func__, strerror(errno));
>          }
>      } else {
> -        uint32_t port = addr + dev_region->u.r_baseport;
> -
> -        if (data) {
> -            DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", *data, size, addr, port);
> -            switch (size) {
> -            case 1:
> -                outb(*data, port);
> -                break;
> -            case 2:
> -                outw(*data, port);
> -                break;
> -            case 4:
> -                outl(*data, port);
> -                break;
> -            }
> -        } else {
> -            switch (size) {
> -            case 1:
> -                val = inb(port);
> -                break;
> -            case 2:
> -                val = inw(port);
> -                break;
> -            case 4:
> -                val = inl(port);
> -                break;
> -            }
> -            DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> -                  ", host=%x\n", val, size, addr, port);
> +        if (pread(fd, &val, size, addr) != size) {
> +            error_report("%s - pread failed %s", __func__, strerror(errno));
> +            val = (1UL << (size * 8)) - 1;
>          }
> +        DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
> +              ", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
>      }
>      return val;
>  }
> -- 
> 1.8.1.1.298.ge7eed54

--
			Gleb.

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

end of thread, other threads:[~2013-11-07 11:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 13:42 [PATCH uq/master] pci-assign: Remove dead code for direct I/O region access from userspace Jan Kiszka
2013-11-04 13:42 ` [Qemu-devel] " Jan Kiszka
2013-11-06  7:34 ` Gleb Natapov
2013-11-06  7:34   ` [Qemu-devel] " Gleb Natapov
2013-11-06 18:06   ` Alex Williamson
2013-11-06 18:06     ` [Qemu-devel] " Alex Williamson
2013-11-07 11:11 ` Gleb Natapov
2013-11-07 11:11   ` [Qemu-devel] " Gleb Natapov

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.