From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03044C38A29 for ; Tue, 14 Apr 2020 15:28:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD247206D5 for ; Tue, 14 Apr 2020 15:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2440396AbgDNP2B (ORCPT ); Tue, 14 Apr 2020 11:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729746AbgDNP14 (ORCPT ); Tue, 14 Apr 2020 11:27:56 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3409CC061A0C; Tue, 14 Apr 2020 08:27:56 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id 3493E2A4; Tue, 14 Apr 2020 17:27:54 +0200 (CEST) Date: Tue, 14 Apr 2020 17:27:52 +0200 From: "joro@8bytes.org" To: "Derrick, Jonathan" Cc: "heiko@sntech.de" , "kgene@kernel.org" , "jonathanh@nvidia.com" , "robin.murphy@arm.com" , "baolu.lu@linux.intel.com" , "thierry.reding@gmail.com" , "bjorn.andersson@linaro.org" , "dwmw2@infradead.org" , "m.szyprowski@samsung.com" , "will@kernel.org" , "jean-philippe@linaro.org" , "krzk@kernel.org" , "robdclark@gmail.com" , "matthias.bgg@gmail.com" , "gerald.schaefer@de.ibm.com" , "agross@kernel.org" , "linux-s390@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-tegra@vger.kernel.org" , "linux-samsung-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "linux-rockchip@lists.infradead.org" , "linux-arm-msm@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "jroedel@suse.de" Subject: Re: [RFC PATCH 11/34] iommu: Split off default domain allocation from group assignment Message-ID: <20200414152752.GC14731@8bytes.org> References: <20200407183742.4344-1-joro@8bytes.org> <20200407183742.4344-12-joro@8bytes.org> <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Hi Jonathan, On Mon, Apr 13, 2020 at 10:10:50PM +0000, Derrick, Jonathan wrote: > I had to add the following for initial VMD support. The new PCIe domain > added on VMD endpoint probe didn't have the dev_iommu member set on the > VMD subdevices, which I'm guessing is due to probe_iommu_group already > having been run on the VMD endpoint's group prior to those subdevices > being added. > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 8a5e1ac328dd..ac1e4fb9bf48 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1577,6 +1577,9 @@ static int iommu_bus_notifier(struct notifier_block *nb, > if (action == BUS_NOTIFY_ADD_DEVICE) { > int ret; > > + if (!dev_iommu_get(dev)) > + return -ENOMEM; > + > ret = iommu_probe_device(dev); > return (ret) ? NOTIFY_DONE : NOTIFY_OK; > } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { Right, thanks for catching this. The hotplug path does not allocate the dev->iommu structure yet. I'll have to figure out if the above patch adds it at the right place, but I'll fix it in the next version. Thanks again, Joerg From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 248DDC2BA19 for ; Tue, 14 Apr 2020 15:28:00 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB6BB206A2 for ; Tue, 14 Apr 2020 15:27:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB6BB206A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=8bytes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9E2C120796; Tue, 14 Apr 2020 15:27:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ymniNl4bH-B2; Tue, 14 Apr 2020 15:27:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id EAC64204ED; Tue, 14 Apr 2020 15:27:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D5E0AC1D7D; Tue, 14 Apr 2020 15:27:58 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id D150EC0172; Tue, 14 Apr 2020 15:27:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B3EFE2078B; Tue, 14 Apr 2020 15:27:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UtVs77IFnUK2; Tue, 14 Apr 2020 15:27:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from theia.8bytes.org (8bytes.org [81.169.241.247]) by silver.osuosl.org (Postfix) with ESMTPS id E8FAB204ED; Tue, 14 Apr 2020 15:27:56 +0000 (UTC) Received: by theia.8bytes.org (Postfix, from userid 1000) id 3493E2A4; Tue, 14 Apr 2020 17:27:54 +0200 (CEST) Date: Tue, 14 Apr 2020 17:27:52 +0200 From: "joro@8bytes.org" To: "Derrick, Jonathan" Subject: Re: [RFC PATCH 11/34] iommu: Split off default domain allocation from group assignment Message-ID: <20200414152752.GC14731@8bytes.org> References: <20200407183742.4344-1-joro@8bytes.org> <20200407183742.4344-12-joro@8bytes.org> <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> Cc: "heiko@sntech.de" , "virtualization@lists.linux-foundation.org" , "matthias.bgg@gmail.com" , "thierry.reding@gmail.com" , "will@kernel.org" , "jean-philippe@linaro.org" , "linux-samsung-soc@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "krzk@kernel.org" , "jonathanh@nvidia.com" , "linux-rockchip@lists.infradead.org" , "agross@kernel.org" , "jroedel@suse.de" , "linux-s390@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "linux-tegra@vger.kernel.org" , "bjorn.andersson@linaro.org" , "gerald.schaefer@de.ibm.com" , "robin.murphy@arm.com" , "linux-kernel@vger.kernel.org" , "kgene@kernel.org" , "dwmw2@infradead.org" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" Hi Jonathan, On Mon, Apr 13, 2020 at 10:10:50PM +0000, Derrick, Jonathan wrote: > I had to add the following for initial VMD support. The new PCIe domain > added on VMD endpoint probe didn't have the dev_iommu member set on the > VMD subdevices, which I'm guessing is due to probe_iommu_group already > having been run on the VMD endpoint's group prior to those subdevices > being added. > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 8a5e1ac328dd..ac1e4fb9bf48 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1577,6 +1577,9 @@ static int iommu_bus_notifier(struct notifier_block *nb, > if (action == BUS_NOTIFY_ADD_DEVICE) { > int ret; > > + if (!dev_iommu_get(dev)) > + return -ENOMEM; > + > ret = iommu_probe_device(dev); > return (ret) ? NOTIFY_DONE : NOTIFY_OK; > } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { Right, thanks for catching this. The hotplug path does not allocate the dev->iommu structure yet. I'll have to figure out if the above patch adds it at the right place, but I'll fix it in the next version. Thanks again, Joerg _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C86F7C2BA19 for ; Tue, 14 Apr 2020 15:28:10 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 97880206A2 for ; Tue, 14 Apr 2020 15:28:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y25zjQTo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97880206A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=8bytes.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0Hofi79CJ6wq/2EGTiyPBvkaerdmotEaaC/I5igmWYA=; b=Y25zjQToCk2qKS MFpbFWRzGE3kD4Us1+r2hfQDlWCYQx5xI++RTw+dLIMcFXxU3k5euSaET4m/uKjymZUUWJcLHNdDm cwUZVIvV2UHwgwOvlpdksLeJ7PK20/iHrCEABeMJzicupWjTq3uVCyMPejLqwtEhaVPCw7ozNDh6E 1DSAAUhRhxcEeyg+KqWjO72DfUOWop4WdbjZQ02rKhYr85Ykdw6Z4kCSSOeZ9btkgfczd+vtGhkwm UA+94Kt6omBqfuyjnQ/uOmO120Vn0IMMmVrDw9H6w4hWXJ1+MS+6rNqjWdBH9EIsE7DLTs7xud+EU mwP65Z/rGcQ2wK8zMyXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jONTl-0002st-D3; Tue, 14 Apr 2020 15:28:01 +0000 Received: from 8bytes.org ([2a01:238:4383:600:38bc:a715:4b6d:a889] helo=theia.8bytes.org) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jONTi-0002rb-EZ; Tue, 14 Apr 2020 15:28:00 +0000 Received: by theia.8bytes.org (Postfix, from userid 1000) id 3493E2A4; Tue, 14 Apr 2020 17:27:54 +0200 (CEST) Date: Tue, 14 Apr 2020 17:27:52 +0200 From: "joro@8bytes.org" To: "Derrick, Jonathan" Subject: Re: [RFC PATCH 11/34] iommu: Split off default domain allocation from group assignment Message-ID: <20200414152752.GC14731@8bytes.org> References: <20200407183742.4344-1-joro@8bytes.org> <20200407183742.4344-12-joro@8bytes.org> <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200414_082758_639277_7CE31C12 X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "heiko@sntech.de" , "virtualization@lists.linux-foundation.org" , "matthias.bgg@gmail.com" , "thierry.reding@gmail.com" , "will@kernel.org" , "m.szyprowski@samsung.com" , "jean-philippe@linaro.org" , "linux-samsung-soc@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "krzk@kernel.org" , "jonathanh@nvidia.com" , "linux-rockchip@lists.infradead.org" , "agross@kernel.org" , "jroedel@suse.de" , "linux-s390@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "linux-tegra@vger.kernel.org" , "bjorn.andersson@linaro.org" , "gerald.schaefer@de.ibm.com" , "robin.murphy@arm.com" , "linux-kernel@vger.kernel.org" , "robdclark@gmail.com" , "kgene@kernel.org" , "dwmw2@infradead.org" , "baolu.lu@linux.intel.com" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Hi Jonathan, On Mon, Apr 13, 2020 at 10:10:50PM +0000, Derrick, Jonathan wrote: > I had to add the following for initial VMD support. The new PCIe domain > added on VMD endpoint probe didn't have the dev_iommu member set on the > VMD subdevices, which I'm guessing is due to probe_iommu_group already > having been run on the VMD endpoint's group prior to those subdevices > being added. > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 8a5e1ac328dd..ac1e4fb9bf48 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1577,6 +1577,9 @@ static int iommu_bus_notifier(struct notifier_block *nb, > if (action == BUS_NOTIFY_ADD_DEVICE) { > int ret; > > + if (!dev_iommu_get(dev)) > + return -ENOMEM; > + > ret = iommu_probe_device(dev); > return (ret) ? NOTIFY_DONE : NOTIFY_OK; > } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { Right, thanks for catching this. The hotplug path does not allocate the dev->iommu structure yet. I'll have to figure out if the above patch adds it at the right place, but I'll fix it in the next version. Thanks again, Joerg _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 From: "joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org" Subject: Re: [RFC PATCH 11/34] iommu: Split off default domain allocation from group assignment Date: Tue, 14 Apr 2020 17:27:52 +0200 Message-ID: <20200414152752.GC14731@8bytes.org> References: <20200407183742.4344-1-joro@8bytes.org> <20200407183742.4344-12-joro@8bytes.org> <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Sender: "iommu" To: "Derrick, Jonathan" Cc: "heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org" , "virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , "jean-philippe-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org" , "linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , "jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org" , "linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "agross-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , "jroedel-l3A5Bk7waGM@public.gmane.org" , "linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: linux-rockchip.vger.kernel.org Hi Jonathan, On Mon, Apr 13, 2020 at 10:10:50PM +0000, Derrick, Jonathan wrote: > I had to add the following for initial VMD support. The new PCIe domain > added on VMD endpoint probe didn't have the dev_iommu member set on the > VMD subdevices, which I'm guessing is due to probe_iommu_group already > having been run on the VMD endpoint's group prior to those subdevices > being added. > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 8a5e1ac328dd..ac1e4fb9bf48 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1577,6 +1577,9 @@ static int iommu_bus_notifier(struct notifier_block *nb, > if (action == BUS_NOTIFY_ADD_DEVICE) { > int ret; > > + if (!dev_iommu_get(dev)) > + return -ENOMEM; > + > ret = iommu_probe_device(dev); > return (ret) ? NOTIFY_DONE : NOTIFY_OK; > } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { Right, thanks for catching this. The hotplug path does not allocate the dev->iommu structure yet. I'll have to figure out if the above patch adds it at the right place, but I'll fix it in the next version. Thanks again, Joerg