All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Alex Williamson <alex.williamson@redhat.com>
Subject: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
Date: Tue, 29 May 2012 19:04:58 +0200	[thread overview]
Message-ID: <4FC501BA.5010105@siemens.com> (raw)

As suggested by Alex: Instead of failing if the kernel does not allow us
to speak to an ioport region, warn the user but, hide the region and
continue.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/device-assignment.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 9ad5de5..e47a23c 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -429,11 +429,12 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
                 fprintf(stderr, "Unexpected return from I/O port read: %d\n",
                         ret);
                 abort();
-            } else if (errno != EINVAL) {
-                fprintf(stderr,
-                        "Kernel doesn't support ioport resource access.\n");
+            } else if (errno != EINVAL || 1) {
+                fprintf(stderr, "Kernel doesn't support ioport resource "
+                                "access, hiding this region.\n");
                 close(pci_dev->v_addrs[i].region->resource_fd);
-                return -1;
+                cur_region->valid = 0;
+                continue;
             }
 
             pci_dev->v_addrs[i].u.r_baseport = cur_region->base_addr;
-- 
1.7.3.4

             reply	other threads:[~2012-05-29 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 17:04 Jan Kiszka [this message]
2012-05-29 17:11 ` [PATCH] pci-assign: Hide ioport regions on lacking sysfs support Alex Williamson
2012-05-29 17:13 ` Avi Kivity
2012-05-29 17:28   ` Alex Williamson
2012-05-30  8:21     ` Avi Kivity
2012-05-30  8:47       ` Jan Kiszka
2012-05-30  8:50         ` Avi Kivity
2012-05-30  9:01           ` 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=4FC501BA.5010105@siemens.com \
    --to=jan.kiszka@siemens.com \
    --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 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.