Message ID | e56c8da801ff5757d14a97c4b49c28e43f449c14.1657034828.git.robin.murphy@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9F31C43334 for <linux-arm-kernel@archiver.kernel.org>; Tue, 5 Jul 2022 17:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B9a/P23Qs/oRHu6E8eQ4/zOLhU1fQ48k47oAt0AMkW8=; b=eoQm5weJi7OD+t QRkITAXpqbWT89Ok13w3p6C2rb5nfZaYwet7ecHB4Hu7lBGOxtQ8W/sLHlOk6pU63AzVH3DK+plCG cBCrlbzT77duYurY+YOHjwnqXM7MpiVMGN4qFi1A080iBRCCWSRnvFxmqQ6Fnmr6WCrrOXhfp1g+G z7aieyphLSbMn61zXmPME4LyEXxfZI8HXrmHwgf5wJwVK/KWlgU5Mq2V3bvyzl5OFKnK/s1K+vYAA lTuH9dcUfWPLweV9hTgL/1WAiZcprdWF7qGtMa/WR/8dfwsa7y2BcOf533L2667RK476ujfZkHTbT cnn7vc7EFCP/tHdsmAVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8m34-001gev-HP; Tue, 05 Jul 2022 17:09:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8m2b-001gJN-TS for linux-arm-kernel@lists.infradead.org; Tue, 05 Jul 2022 17:08:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 605E61576; Tue, 5 Jul 2022 10:08:47 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 781B03F66F; Tue, 5 Jul 2022 10:08:45 -0700 (PDT) From: Robin Murphy <robin.murphy@arm.com> To: joro@8bytes.org Cc: will@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, baolu.lu@linux.intel.com, suravee.suthikulpanit@amd.com, vasant.hegde@amd.com, mjrosato@linux.ibm.com, gerald.schaefer@linux.ibm.com, schnelle@linux.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 02/15] iommu/amd: Handle race between registration and device probe Date: Tue, 5 Jul 2022 18:08:25 +0100 Message-Id: <e56c8da801ff5757d14a97c4b49c28e43f449c14.1657034828.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.36.1.dirty In-Reply-To: <cover.1657034827.git.robin.murphy@arm.com> References: <cover.1657034827.git.robin.murphy@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220705_100850_032955_1F81D9B7 X-CRM114-Status: UNSURE ( 9.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
iommu: Retire bus_set_iommu()
|
expand
|
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 840831d5d2ad..2f8e8f818a6c 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1757,6 +1757,10 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev) devid = get_device_id(dev); iommu = amd_iommu_rlookup_table[devid]; + /* Not registered yet? */ + if (!iommu->iommu.ops) + return ERR_PTR(-ENODEV); + if (dev_iommu_priv_get(dev)) return &iommu->iommu;
As for the Intel driver, make sure the AMD driver can cope with seeing .probe_device calls without having to wait for all known instances to register first. Signed-off-by: Robin Murphy <robin.murphy@arm.com> --- v3: New drivers/iommu/amd/iommu.c | 4 ++++ 1 file changed, 4 insertions(+)