Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp587336ybz; Wed, 15 Apr 2020 14:36:59 -0700 (PDT) X-Google-Smtp-Source: APiQypJBe5M2S1kPOOV25sUpddOlmp9yKC+O8jeRsRNz+calYRURHwM1QAUJBv8L49udEDVtUJEg X-Received: by 2002:a05:6402:1116:: with SMTP id u22mr27852309edv.336.1586986619818; Wed, 15 Apr 2020 14:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986619; cv=none; d=google.com; s=arc-20160816; b=MSohZ2/vpfS2hYsBWF18yYDFZbSHD6hAOycQWDLkurBSKApGVXsdGPUYzI0mGYbHs1 3Vh+pgOFWB7jNaBrfH40NwjNbRLj132cS3F6jh0b3oDMDwXn3JY3GwrEoy1q/nhmQ/pc rU7FNakOnWx/rrw4mxpxCfc0APqVdgZM3ToynTXiM4ktZitb/KjkDJegbsTCuaxTrBLn snkDxTjcWNUjqTFlhl9+Si7z3gQIqGMoWdbzcjJ7HWqroMHuzR27AcdHa4HIEVUGPljt wq1qe3Z3WKlxk9b9eJERRHouKZT7enVZ8lsYNjeZS7MGTwztvJYpVxWYplaY78RbtKYt sBsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=FiTc7XWB0gCYWmJpnfSlcFVC5gLR3gnpk4+5aDNnX5A=; b=OvXUqCBEBEomnl6p25sX6cffi9brPiSIxMM66BJQFDJTIwiWNODtV8hyLYPFbhpN0v 0kMbO83EkEG1fcIJaCoMlFoJGmp93LcsOZQhR8fdet4arHp+x6IkYHQp9tta7Lx5R5rj efxt0F4GmQjB+fvfdP/leB+K5CjHABlFUVVZRXt7f35ibPj9PoVBRu2wOaOgK0nvwFs3 Mo0i61lLU4vXpn8lgfvGTK6uyY55gYl0eVeCxK5MaoM01QEXbyepDU5an0gn91MJzXCY W90TRup0lPjDHmjuFE7Lsr+fPoyHmY0Sm2xvfWe1tKH3iIvw/JYOOaAw9yoU2MPzxJR1 uDKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si9983398eds.295.2020.04.15.14.36.36; Wed, 15 Apr 2020 14:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732147AbgDNN30 (ORCPT + 99 others); Tue, 14 Apr 2020 09:29:26 -0400 Received: from 8bytes.org ([81.169.241.247]:34802 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502867AbgDNNQA (ORCPT ); Tue, 14 Apr 2020 09:16:00 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 6FC18495; Tue, 14 Apr 2020 15:15:52 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: [PATCH v2 06/33] iommu/amd: Return -ENODEV in add_device when device is not handled by IOMMU Date: Tue, 14 Apr 2020 15:15:15 +0200 Message-Id: <20200414131542.25608-7-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414131542.25608-1-joro@8bytes.org> References: <20200414131542.25608-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel When check_device() fails on the device, it is not handled by the IOMMU and amd_iommu_add_device() needs to return -ENODEV. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 504f2db75eda..3e0d27f7622e 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2157,9 +2157,12 @@ static int amd_iommu_add_device(struct device *dev) struct amd_iommu *iommu; int ret, devid; - if (!check_device(dev) || get_dev_data(dev)) + if (get_dev_data(dev)) return 0; + if (!check_device(dev)) + return -ENODEV; + devid = get_device_id(dev); if (devid < 0) return devid; -- 2.17.1