From patchwork Mon Jun 3 16:00:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10973131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC67576 for ; Mon, 3 Jun 2019 16:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA985205F8 for ; Mon, 3 Jun 2019 16:02:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEABE28710; Mon, 3 Jun 2019 16:02:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58870205F8 for ; Mon, 3 Jun 2019 16:02:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXpOP-0001kZ-Ql; Mon, 03 Jun 2019 16:01:01 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXpOO-0001kS-DW for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 16:01:00 +0000 X-Inumbo-ID: c6f7e9d9-8618-11e9-8980-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c6f7e9d9-8618-11e9-8980-bc764e045a96; Mon, 03 Jun 2019 16:00:59 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Mon, 03 Jun 2019 10:00:58 -0600 Message-Id: <5CF544330200007800234BAB@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.1 Date: Mon, 03 Jun 2019 10:00:51 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] AMD/IOMMU: don't "add" IOMMUs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Brian Woods , Suravee Suthikulpanit Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP While amd_iommu_add_device() won't be called for IOMMUs from pci_add_device(), as IOMMUs have got marked r/o, _setup_hwdom_pci_devices() calls there nevertheless. Avoid issuing the bogus debugging only "No iommu for ...; cannot be handed to ..." log message as well as the non-debugging "setup ... for ... failed (-19)" one. Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -424,6 +424,11 @@ static int amd_iommu_add_device(u8 devfn return -EINVAL; bdf = PCI_BDF2(pdev->bus, pdev->devfn); + + for_each_amd_iommu(iommu) + if ( pdev->seg == iommu->seg && bdf == iommu->bdf ) + return 0; + iommu = find_iommu_for_device(pdev->seg, bdf); if ( unlikely(!iommu) ) {