public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Alex Williamson <alex.williamson@redhat.com>
Subject: [RFC][PATCH] pci-assign: Drop support for raw ioport access
Date: Mon, 28 May 2012 15:03:41 +0200	[thread overview]
Message-ID: <4FC377AD.8060201@web.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2852 bytes --]

From: Jan Kiszka <jan.kiszka@siemens.com>

If the kernel does not support ioport access via sysfs, passthrough can
only help if the unlikely case that a port <= 0x3ff is provided by the
device. So drop this to simplify the code and to allow dropping the
corresponding KVM infrastructure in preparation of upstream merge.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Does anyone recall the precise use case this was introduced for? It
exists since day #1, so commit logs do not help.

 hw/device-assignment.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 1daadb9..9ad5de5 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -245,18 +245,8 @@ static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num,
 {
     AssignedDevice *r_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
     AssignedDevRegion *region = &r_dev->v_addrs[region_num];
-    int r;
 
     region->e_size = size;
-
-    if (region->region->resource_fd < 0) {
-        r = kvm_add_ioport_region(region->u.r_baseport, region->r_size,
-                                  pci_dev->qdev.hotplugged);
-        if (r < 0) {
-            fprintf(stderr, "%s: failed to enable ioport access (%m)\n",
-                    __func__);
-        }
-    }
     memory_region_init(&region->container, "assigned-dev-container", size);
     memory_region_init_io(&region->real_iomem, &assigned_dev_ioport_ops,
                           r_dev->v_addrs + region_num,
@@ -440,10 +430,10 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
                         ret);
                 abort();
             } else if (errno != EINVAL) {
-                fprintf(stderr, "Using raw in/out ioport access (sysfs - %s)\n",
-                        strerror(errno));
+                fprintf(stderr,
+                        "Kernel doesn't support ioport resource access.\n");
                 close(pci_dev->v_addrs[i].region->resource_fd);
-                pci_dev->v_addrs[i].region->resource_fd = -1;
+                return -1;
             }
 
             pci_dev->v_addrs[i].u.r_baseport = cur_region->base_addr;
@@ -647,10 +637,6 @@ static void free_assigned_device(AssignedDevice *dev)
             continue;
         }
         if (pci_region->type & IORESOURCE_IO) {
-            if (pci_region->resource_fd < 0) {
-                kvm_remove_ioport_region(region->u.r_baseport, region->r_size,
-                                         dev->dev.qdev.hotplugged);
-            }
             memory_region_del_subregion(&region->container,
                                         &region->real_iomem);
             memory_region_destroy(&region->real_iomem);
-- 
1.7.3.4


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

             reply	other threads:[~2012-05-28 13:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-28 13:03 Jan Kiszka [this message]
2012-05-28 14:06 ` [RFC][PATCH] pci-assign: Drop support for raw ioport access Avi Kivity
2012-05-29  7:47   ` Jan Kiszka
2012-05-29  9:26     ` Avi Kivity
2012-05-29 13:47       ` Alex Williamson
2012-05-29 14:00         ` Avi Kivity
2012-05-29  9:23 ` [PATCH] qemu-kvm: " Jan Kiszka
2012-05-29 13:51 ` [RFC][PATCH] pci-assign: " Alex Williamson
2012-05-29 14:41 ` Alex Williamson
2012-05-29 15:45   ` Jan Kiszka

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=4FC377AD.8060201@web.de \
    --to=jan.kiszka@web.de \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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