Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3850680imw; Thu, 7 Jul 2022 08:31:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uYRIwk4m4tsNaeU6Xy0ls78QRZgCycUnNkvd/xrYyeH9I3fIVEqbpu7zflZOsb2bo57ZKg X-Received: by 2002:a05:6402:42d5:b0:433:1727:b31c with SMTP id i21-20020a05640242d500b004331727b31cmr54280178edc.9.1657207898174; Thu, 07 Jul 2022 08:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657207898; cv=none; d=google.com; s=arc-20160816; b=UGrJH0yu4FNyu72R/qM2UaEi5cVuiDAVMJ8J/dW4FNBtE61cI4E/DSpke1e8vfEj0m dqsBXhTZkm97vjEuYip5U89EFWlq7o9HypFnRxGixsw24OJ5Z4z+nsuonOXk1r3fQIAf 3Yz4UUCHqlhIBx1SL1ahXZaUX1JSoUO2/Cqg8rDFCdphf3BTgyQsm6Zl1kMXe4w74e0I 1Fv/fN5ij6N7fjB9H7BmglQgjG8idg5qWStopqHG/79ar78pqcTPYBsqLgHQHaRJbN8c 2B8zBfHbW78pNcp+xfF5mSIg5hrS4FXSrYRPI9CpBzrA0wzEfHBp7/hCuimXfE5nU2IO wueQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=+6Sy60GzZdCL4gbaFkwOjlViLqTe1DNdG73ttanruDk=; b=CmICyUQj9GFVYUU+hVwkFxOonGK7Ma9eFJPRouzE7woZHI49tlGR6GUH47/jT87BUK o2vYe/O7TAYdl3kO+rV2b3Aunm1beUeBhA9tiaKB8Bmfauc6M1efi1QdF7k05JTvBJwS TqQhYTE1Wv9TQEqEQ/2RA9KQWWqmHU4x37sqJRZK+wq3EqZh419Rjplz2szNFWv3esUF s5H3Llf5vuzFuxrHTGrdoBmSUb6ImwTyoA8lJJ1UV383OLQC9qPAJFdlEFw/fVR7rZio BUoNljhzbaQA4jinQX1HvOMz1EoHyofC5s+8OG49uRLdGSloasmB+q2t/sMDFcAzfmfR 9upg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a05640227c700b0043a9a96773fsi2861671ede.634.2022.07.07.08.31.08; Thu, 07 Jul 2022 08:31:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236231AbiGGO7q (ORCPT + 99 others); Thu, 7 Jul 2022 10:59:46 -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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; >  } >