Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1979597imw; Tue, 5 Jul 2022 20:11:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v88v7u0KkwZxI7KZiqIay0LdTij30qrOhv4QKrynK5AMya+uoo7sQcfN0MD3rnf9p2Dmtr X-Received: by 2002:a17:902:e741:b0:16a:351f:d029 with SMTP id p1-20020a170902e74100b0016a351fd029mr44182952plf.0.1657077115533; Tue, 05 Jul 2022 20:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657077115; cv=none; d=google.com; s=arc-20160816; b=XDRx/nZxbL3jO9c9v/JYcjlbTkNE9bbzVETg/HI1QFtLsE9/Rn+xGf3putdVZK7aq/ h1Vh7afX9GX1hmMRgh0shKAjTg69pCDXfVFgdQEoIWr3rAdXyGGdwB5x6vC5J2mxFW46 /5by/TV6NTAFatVJlnBHSzod/P6YFV314R2QSEcvqtodJdfD5z7daS7uH3Dmd+vN/nr6 hSZIJxD+Rjk4423H8ToXFDPizl0R/VdUKgQbhz7bu06MKPQI6wWv87Z3h3uOlP7Fm9ep nJPH80YiMJkohU1+0KjZUkocLZd6/d/+v18Foh0cRtYE3g/wa8RfnCM+exHq+7N5Xlo1 DY0w== 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:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=90na4Gc/7zrRgRwJ/rO39JMEbwfB8vLQ4lI110kPLNM=; b=S5mmjF6Uh1CKg4s6077AiqzA+QEkggNfCuaho7rqTNp8kH5NaDvXU/JVfbc9H4BQoV 96nffm1WQufFt4dFsRq37l8hw82CIUBgzyar4n/vV3QzcTPX9XcAu5eut0wvmlWTh0Au 1JZXwwfrnsezR/Sa4ivBSRaBp6D9l+2YQ3Cn+s4SCSrOBVsxPn8BJUO98AGN9kNdiAIp SmyA4b4HBwCuoHqK66K5nOMEZ4XIElWbW9Wso+C8fbp6BPmzUU7WpITAqxULPWBk/lEN DXGQnvOwL4/oCbZOR3NCazTtZaDGBfu6aLnyqWJRvmSMrY1krJo87Yza0wn69HoQ1B2p 0clQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IrVja+pQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gp21-20020a17090adf1500b001ef8f7f3de3si947939pjb.156.2022.07.05.20.11.43; Tue, 05 Jul 2022 20:11:55 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=IrVja+pQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbiGFCfs (ORCPT + 99 others); Tue, 5 Jul 2022 22:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiGFCf3 (ORCPT ); Tue, 5 Jul 2022 22:35:29 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB3CC1A056; Tue, 5 Jul 2022 19:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657074927; x=1688610927; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=/qKfGncLBodraY8iG9SYn0Nbai2B5nyW3PrxStAGttw=; b=IrVja+pQ+SYzyjNCom8dci9YVBvC5Oqh8IATeihSDOBajnpP51NBg58T ZEFg5thziC8bmw1a4E23VjjBkv1PCSBvYgXeJ3i7tGbDIxTDNMMBxbuKO 7cqBxgspkb9zrxvEB3B6BQGZqipMrucptT9dZhqjl8/8q54gpv3qRDynT a6Lj9rjqlH3tZ4bCfsNtJV/BiYA8L0aUcnj87hX0pdoVEdbthLe7ZPyTw +Bft9W8qW8qsV8Y9ny+I/CgcsVCbaitB4sXYZ8jMzBIF+5u6VbKsfPAfj PkYA3LGS1/rWiHsFGoa3k5YxXToRuxCXL6vK75tbv1x2hJsMIl+awNIxa Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10399"; a="369941008" X-IronPort-AV: E=Sophos;i="5.92,248,1650956400"; d="scan'208";a="369941008" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 19:35:27 -0700 X-IronPort-AV: E=Sophos;i="5.92,248,1650956400"; d="scan'208";a="650447066" Received: from zhuoliu-mobl1.ccr.corp.intel.com (HELO [10.249.174.206]) ([10.249.174.206]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 19:35:24 -0700 Message-ID: Date: Wed, 6 Jul 2022 10:35:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: baolu.lu@linux.intel.com, will@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, 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: Re: [PATCH v3 04/15] iommu: Move bus setup to IOMMU device registration Content-Language: en-US To: Robin Murphy , joro@8bytes.org References: <5b9b608af21b3c4353af042355973bac55397962.1657034828.git.robin.murphy@arm.com> From: Baolu Lu In-Reply-To: <5b9b608af21b3c4353af042355973bac55397962.1657034828.git.robin.murphy@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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/7/6 01:08, Robin Murphy wrote: > @@ -202,12 +210,32 @@ int iommu_device_register(struct iommu_device *iommu, > spin_lock(&iommu_device_lock); > list_add_tail(&iommu->list, &iommu_device_list); > spin_unlock(&iommu_device_lock); > + > + for (int i = 0; i < ARRAY_SIZE(iommu_buses); i++) { > + struct bus_type *bus = iommu_buses[i]; > + int err; > + > + if (bus->iommu_ops && bus->iommu_ops != ops) { > + err = -EBUSY; > + } else { > + bus->iommu_ops = ops; > + err = bus_iommu_probe(bus); > + } > + if (err) { > + iommu_device_unregister(iommu); > + return err; > + } > + } > + > return 0; > } > EXPORT_SYMBOL_GPL(iommu_device_register); With bus_set_iommu() retired, my understanding is that now we embrace the first-come-first-serve policy for bus->iommu_ops setting. This will lead to problem in different iommu_ops for different bus case. Did I overlook anything? Best regards, baolu