From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Ykr-0003M7-U4 for qemu-devel@nongnu.org; Tue, 17 May 2016 02:45:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2Ykm-000308-Af for qemu-devel@nongnu.org; Tue, 17 May 2016 02:45:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Ykm-0002zx-4m for qemu-devel@nongnu.org; Tue, 17 May 2016 02:45:16 -0400 From: Peter Xu Date: Tue, 17 May 2016 14:45:06 +0800 Message-Id: <1463467507-13358-1-git-send-email-peterx@redhat.com> Subject: [Qemu-devel] [PATCH v3] fix pci_requester_id() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com, pbonzini@redhat.com, jan.kiszka@web.de, rkrcmar@redhat.com, alex.williamson@redhat.com, peterx@redhat.com This is v3 to fix pci_requester_id() issue. I avoided detecting root bus type since it seems not matter much if we will directly drop them for non-pcie cases. Also, I used zero to indicate uncached requester_id (assuming that BDF 0x0000 is never used by any device). v3 changes: - add empty line after local var defines - enhance comments to explain reason than what is done, also fix some english errors in comments - add requester_id cache: Here I didn't cache the PCI device but requester ID directly, since for pcie-to-pci case we are not returning BDF but (secondary bus num, 0) pair. So if to cache with device, we need one more field, which is complicated. This is based on the assumption that requester_id will not change for a device lifecycle (is it possible that guest kernel modify bus number during runtime?). Anyway, please let me know if I am wrong. Test done: IOMMU IR v7 (not yet posted) work with pci-pci bridges. Thanks, Peter Xu (1): pci: fix pci_requester_id() hw/i386/kvm/pci-assign.c | 2 +- hw/pci/pci.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci.h | 11 +++++++++-- 3 files changed, 56 insertions(+), 3 deletions(-) -- 2.4.11