Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp992201pxb; Fri, 22 Apr 2022 16:10:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR/ca8qYy+rFx9teVkG/MuBzK+7/AUYsi0vlUy7rUtjjUZq7ahggVcKH04SRdq+UlXXtYo X-Received: by 2002:a17:903:1212:b0:156:3ddc:84bd with SMTP id l18-20020a170903121200b001563ddc84bdmr6797338plh.70.1650669049023; Fri, 22 Apr 2022 16:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650669049; cv=none; d=google.com; s=arc-20160816; b=g25j06ISK+A78yI/gPDEdwbNDDYCuWUmR8ESWL/fR4OJcLmRNZ5mkKNKhGtIx5Yl6w 53c48LWW0SDHP4DCXbiL/UXJu/wckonHcoWAbzaxbQDFSrccvnMtLNKhLHrJIXXAQkKn U8Pvjws5WEpTHiSDcudwUEuu+Kmw37nRmZbxBnUrc/Z6c4eVYNN2rPS5CGF/AVjyjLyW GsnfC/KehiAYY857Wbc5C4MfyeoVc4tgwO+iLjxYw+yg4Mk5JPfIM82+D42M8xyeVTxV 8A4EROD0Pxrpqv4nBX/fllTPl+o3eVzPpY9YzBT4DsnQaDbaZvpp/7zy8OzvH6D1JjKm BZ+Q== 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=VX3dHXYszsUqoPT7Gv2s41BCI9OgoUseKSpJefBPTLU=; b=RYkUVeR6xh9eJexbAcGLGy6WDzg68Bs4fSrQP/QF3rZL6RpZ0DcnbEtsfZrgoLA+oq BBq09X2jmsIzvy78Xn+2x/ynT3fKfEEbmaA34wtcv36rbstDpSvU7ouQK3mwxAVPyIdl Tbxk3o6FT/4cDXQBl3q2sM16GCkt65da0gTcLLTkDPWnuGBtFhDsbIWJrbWmPIVIJfU6 gewN9jXUnmvtz0qBDc9Hem4u2Qg4BwPtxc2gqdiOClR2iOkws8VVhCWV2AqqqdrXOs4d 2UT1qJFkUB79yroVB98SfToufV0re5VF+HRycbnraCk0Tdd4ii8573f6drsX82Xsq7QH r36Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g193-20020a636bca000000b003aa36a97803si9679456pgc.517.2022.04.22.16.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 16:10:49 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 078B1389979; Fri, 22 Apr 2022 15:11:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232096AbiDVWNh (ORCPT + 99 others); Fri, 22 Apr 2022 18:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbiDVWNF (ORCPT ); Fri, 22 Apr 2022 18:13:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AAEEB30A430 for ; Fri, 22 Apr 2022 14:00:45 -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 3D2B21FB; Fri, 22 Apr 2022 12:02:21 -0700 (PDT) Received: from [10.57.80.98] (unknown [10.57.80.98]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6CDF43F73B; Fri, 22 Apr 2022 12:02:18 -0700 (PDT) Message-ID: <9da468bc-e6fd-1d7c-a6ce-69be87a7472a@arm.com> Date: Fri, 22 Apr 2022 20:02:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration Content-Language: en-GB To: Krishna Reddy , "joro@8bytes.org" , "will@kernel.org" Cc: "iommu@lists.linux-foundation.org" , "sven@svenpeter.dev" , "robdclark@gmail.com" , "m.szyprowski@samsung.com" , "baolu.lu@linux.intel.com" , "yong.wu@mediatek.com" , "mjrosato@linux.ibm.com" , "gerald.schaefer@linux.ibm.com" , "zhang.lyra@gmail.com" , "thierry.reding@gmail.com" , "jean-philippe@linaro.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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-04-22 19:37, Krishna Reddy wrote: > Good effort to isolate bus config from smmu drivers. > Reviewed-By: Krishna Reddy Thanks! > I have an orthogonal question here. > Can the following code handle the case, where different buses have different type of SMMU instances(like one bus has SMMUv2 and another bus has SMMUv3)? > If it need to handle the above case, can the smmu device bus be matched with specific bus here and ops set only for that bus? Not yet, but that is one of the end goals that this is all working towards. I think the stuff that I've added to the dev branch[1] today should have reached the point where that becomes viable, but I'll need to rig up a system to test it next week. Intermediate solutions aren't worth it because in practice you inevitably end up needing both IOMMU drivers to share the platform "bus" anyway. Cheers, Robin. [1] https://gitlab.arm.com/linux-arm/linux-rm/-/commits/iommu/bus > > >> + for (int i = 0; i < ARRAY_SIZE(iommu_buses); i++) { >> + struct bus_type *bus = iommu_buses[i]; >> + const struct iommu_ops *bus_ops = bus->iommu_ops; >> + int err; >> + >> + WARN_ON(bus_ops && bus_ops != ops); >> + bus->iommu_ops = ops; >> + err = bus_iommu_probe(bus); >> + if (err) { >> + bus_for_each_dev(bus, NULL, iommu, >> remove_iommu_group); >> + bus->iommu_ops = bus_ops; >> + return err; >> + } >> + } > > > -KR