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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F365BC433EF for ; Thu, 7 Jul 2022 14:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236373AbiGGO7p (ORCPT ); Thu, 7 Jul 2022 10:59:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235817AbiGGO7Z (ORCPT ); Thu, 7 Jul 2022 10:59:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69A6159258; Thu, 7 Jul 2022 07:58:46 -0700 (PDT) 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 34AA71063; Thu, 7 Jul 2022 07:58:46 -0700 (PDT) Received: from [10.57.85.108] (unknown [10.57.85.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EFB303F792; Thu, 7 Jul 2022 07:58:43 -0700 (PDT) Message-ID: <8ad2fec1-8a51-dc35-39bb-a05a0d837ad9@arm.com> Date: Thu, 7 Jul 2022 15:58:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v3 15/15] iommu: Clean up bus_set_iommu() Content-Language: en-GB To: Matthew Rosato , 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, gerald.schaefer@linux.ibm.com, schnelle@linux.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org References: <4c25e3ad-0eb6-5c41-48b2-7c10e745bd5d@linux.ibm.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On 2022-07-07 13:54, Matthew Rosato wrote: > On 7/7/22 8:49 AM, Matthew Rosato wrote: >> On 7/5/22 1:08 PM, Robin Murphy wrote: >>> Clean up the remaining trivial bus_set_iommu() callsites along >>> with the implementation. Now drivers only have to know and care >>> about iommu_device instances, phew! >>> >>> Signed-off-by: Robin Murphy >>> --- >>> >>> v3: Also catch Intel's cheeky open-coded assignment >>> >> >> ... >> >>> diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c >>> index c898bcbbce11..dd957145fb81 100644 >>> --- a/drivers/iommu/s390-iommu.c >>> +++ b/drivers/iommu/s390-iommu.c >>> @@ -385,9 +385,3 @@ static const struct iommu_ops s390_iommu_ops = { >>>           .free        = s390_domain_free, >>>       } >>>   }; >>> - >>> -static int __init s390_iommu_init(void) >>> -{ >>> -    return bus_set_iommu(&pci_bus_type, &s390_iommu_ops); >>> -} >>> -subsys_initcall(s390_iommu_init); >> >> Previously s390_iommu_ops was only being set for pci_bus_type, but >> with this series it will now also be set for platform_bus_type. Ah, indeed I hadn't got as far as fully appreciating that to_zpci_dev() isn't robust enough on its own. Thanks for the patch, I've pulled it in and will include it in v4. Do I take it that all else works OK with this fixed? Cheers, Robin. >> >> To tolerate that, this series needs a change along the lines of: >> > > ...  Sorry, let's try that again without a mangled diff: > > From: Matthew Rosato > Date: Thu, 7 Jul 2022 08:45:44 -0400 > Subject: [PATCH] iommu/s390: fail probe for non-pci device > > > s390-iommu only supports pci_bus_type today > > > Signed-off-by: Matthew Rosato > --- >  drivers/iommu/s390-iommu.c | 7 ++++++- >  1 file changed, 6 insertions(+), 1 deletion(-) > > > diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c > index dd957145fb81..762f892b4ec3 100644 > --- a/drivers/iommu/s390-iommu.c > +++ b/drivers/iommu/s390-iommu.c > @@ -185,7 +185,12 @@ static void s390_iommu_detach_device(struct > iommu_domain *domain, > > >  static struct iommu_device *s390_iommu_probe_device(struct device *dev) >  { > -       struct zpci_dev *zdev = to_zpci_dev(dev); > +       struct zpci_dev *zdev; > + > +       if (!dev_is_pci(dev)) > +               return ERR_PTR(-ENODEV); > + > +       zdev = to_zpci_dev(dev); > > >         return &zdev->iommu_dev; >  } >