From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [RFC][PATCH] pci-assign: Drop support for raw ioport access Date: Mon, 28 May 2012 15:03:41 +0200 Message-ID: <4FC377AD.8060201@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig33DA7F82C090A9C68E8D0EA6" Cc: kvm , Alex Williamson To: Avi Kivity , Marcelo Tosatti Return-path: Received: from fmmailgate03.web.de ([217.72.192.234]:44985 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753515Ab2E1NDo (ORCPT ); Mon, 28 May 2012 09:03:44 -0400 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate03.web.de (Postfix) with ESMTP id 7F9AC1B525272 for ; Mon, 28 May 2012 15:03:43 +0200 (CEST) Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig33DA7F82C090A9C68E8D0EA6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable From: Jan Kiszka If the kernel does not support ioport access via sysfs, passthrough can only help if the unlikely case that a port <=3D 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 --- 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 =3D DO_UPCAST(AssignedDevice, dev, pci_dev); AssignedDevRegion *region =3D &r_dev->v_addrs[region_num]; - int r; =20 region->e_size =3D size; - - if (region->region->resource_fd < 0) { - r =3D 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(®ion->container, "assigned-dev-container", siz= e); memory_region_init_io(®ion->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 !=3D 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 =3D -1; + return -1; } =20 pci_dev->v_addrs[i].u.r_baseport =3D 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(®ion->container, ®ion->real_iomem); memory_region_destroy(®ion->real_iomem); --=20 1.7.3.4 --------------enig33DA7F82C090A9C68E8D0EA6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/Dd60ACgkQitSsb3rl5xQrCQCgjYWtR0GJixzravkxuRvziZB/ oCUAoJM85r2WCTBHw27Uw57WSohDs4b4 =JSPB -----END PGP SIGNATURE----- --------------enig33DA7F82C090A9C68E8D0EA6--