From: Alex Williamson Subject: Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support Date: Tue, 29 May 2012 11:11:45 -0600 Message-ID: <1338311505.4714.137.camel@ul30vt> References: <4FC501BA.5010105@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , kvm To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54953 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754559Ab2E2RLs (ORCPT ); Tue, 29 May 2012 13:11:48 -0400 In-Reply-To: <4FC501BA.5010105@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2012-05-29 at 19:04 +0200, Jan Kiszka wrote: > 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 > --- > hw/device-assignment.c | 9 +++++---- > 1 files changed, 5 insertions(+), 4 deletions(-) Thanks! Acked-by: Alex Williamson > 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;