From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMtOI-0002hO-RY for qemu-devel@nongnu.org; Fri, 30 Dec 2016 04:22:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMtOF-0000Oa-Oc for qemu-devel@nongnu.org; Fri, 30 Dec 2016 04:22:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cMtOF-0000OU-I6 for qemu-devel@nongnu.org; Fri, 30 Dec 2016 04:22:19 -0500 Date: Fri, 30 Dec 2016 17:22:09 +0800 From: Peter Xu Message-ID: <20161230092209.GE4195@pxdev.xzpeter.org> References: <1478502595-8484-1-git-send-email-jasowang@redhat.com> <1478502595-8484-3-git-send-email-jasowang@redhat.com> <20161216025345.GA5938@pxdev.xzpeter.org> <33cf0c8c-5ab2-4e11-b08e-abf193a17c94@redhat.com> <074a96e2-c248-5996-d1e7-6ca7a092254f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <074a96e2-c248-5996-d1e7-6ca7a092254f@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V3 02/10] intel_iommu: name vtd address space with devfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: Eduardo Habkost , mst@redhat.com, qemu-devel@nongnu.org, vkaplans@redhat.com, wexu@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, Richard Henderson On Fri, Dec 30, 2016 at 04:19:31PM +0800, Jason Wang wrote: >=20 >=20 > On 2016=E5=B9=B412=E6=9C=8816=E6=97=A5 11:53, Jason Wang wrote: > > > > > >On 2016=E5=B9=B412=E6=9C=8816=E6=97=A5 10:53, Peter Xu wrote: > >>On Mon, Nov 07, 2016 at 03:09:47PM +0800, Jason Wang wrote: > >>>To avoid duplicated name and ease debugging. > >>> > >>>Cc: Michael S. Tsirkin > >>>Cc: Paolo Bonzini > >>>Cc: Richard Henderson > >>>Cc: Eduardo Habkost > >>>Acked-by: Peter Xu > >>>Signed-off-by: Jason Wang > >>>--- > >>> hw/i386/intel_iommu.c | 4 +++- > >>> 1 file changed, 3 insertions(+), 1 deletion(-) > >>> > >>>diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c > >>>index 1655a65..5272c30 100644 > >>>--- a/hw/i386/intel_iommu.c > >>>+++ b/hw/i386/intel_iommu.c > >>>@@ -2323,6 +2323,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUSta= te > >>>*s, PCIBus *bus, int devfn) > >>> uintptr_t key =3D (uintptr_t)bus; > >>> VTDBus *vtd_bus =3D g_hash_table_lookup(s->vtd_as_by_busptr, &= key); > >>> VTDAddressSpace *vtd_dev_as; > >>>+ char name[128]; > >>> if (!vtd_bus) { > >>> /* No corresponding free() */ > >>>@@ -2336,6 +2337,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUSta= te > >>>*s, PCIBus *bus, int devfn) > >>> vtd_dev_as =3D vtd_bus->dev_as[devfn]; > >>> if (!vtd_dev_as) { > >>>+ snprintf(name, sizeof(name), "intel_iommu_devfn_%d", devfn)= ; > >>Better with bus number as well? ;) > >> > >>Like: "%02x:%02x.%x" for (bus, dev, fn). > >> > >>Thanks, > >> > >>-- peterx > > > >Yes, will do it in next version. > > > >Thanks > > >=20 > Actually, I choose not to bother since bus and fn number needs more cod= es to > get. Should this work? snprintf(name, sizeof(name), "intel_iommu_%02x:%02x.%x", pci_bus_num(bus), VTD_PCI_SLOT(devfn), VTD_PCI_FUNC(devfn)); Anyway, I am okay as well to keep it as it is. :) -- peterx