Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp939704pxb; Fri, 22 Apr 2022 14:53:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2PAEB5tSUNCAX+p/DY14/74g3jtzAct5CrSpUIcJxHb9Akyc5hAzfJ/ZbBAlxXSioDrRQ X-Received: by 2002:a63:8943:0:b0:3aa:f1ce:4f24 with SMTP id v64-20020a638943000000b003aaf1ce4f24mr712528pgd.34.1650664419874; Fri, 22 Apr 2022 14:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650664419; cv=none; d=google.com; s=arc-20160816; b=H+VObBcq5HRky2AhhtXZZQa7DuxG7/Wu06I/7y77Zkhxye0R7Y/DNxzt/nfzj3d47X TqPqOmeBYbsQhC6P900m6aPyuGWWABsBe3i3MJ+5Eaf5tHSDKt/CEMPIkGGsdwYZbO17 U4UdS/10OVB0fsZP74yU7y/6KPLWADSi6GH+YH708v0gG0uvoRXuTTrEm20mn7izrWR+ PHXVyuymksYkwp8k/WwewqBR0YJc/qz30XM/L++YVmlEF8fLllHU9RGmstqVOP7bJJ4e bZAiCfqY1EAR7KZWPnToTVcOrMbJiEkghzV/4dEvG/Q9ZbAYCTmXh8TJFsZkDSApPi4d 7X4A== 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:subject :from:references:to:content-language:cc:user-agent:mime-version:date :message-id:dkim-signature; bh=hLEd97U35AG6EXwLbZ1fUw5j1LgsdlmR18F0lmZltQQ=; b=UwxWRPtFsRAK3tlTLzwJNS0BRW1A4ktbt/bERuua6rqrDOY3JpaaU9Q2mTZVnynrnu bJ72D0dezk+ZD4qYFUfbU0I6YsetRelP//sGHi8CSeF9W9cg6nnS5aG4P4d0aKHu0+gr s7v3D0DoMMwOzvFAqQKvKQ+gSciNhBZEptjFGY6/1HdGm2k8ukHPPxT39s2Yyd0J9X0L oXJ+HsFAX9E63rATUEuI9aRitO/a8hmVBTgzdidbyOnBmzoreAOzlkzy17ntZalnvEiF 4RWOEbpUQzJn4GVNeTWgcXZiwfmTcTc2TnsP5RbuMw68bvG26p/i680KvXUZ+QI46q16 v84w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KYEfJhc0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p17-20020a63c151000000b003aa81281527si7321583pgi.775.2022.04.22.14.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:53:39 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=KYEfJhc0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C36C2352A5; Fri, 22 Apr 2022 13:01:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235552AbiDRXkr (ORCPT + 99 others); Mon, 18 Apr 2022 19:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235517AbiDRXkq (ORCPT ); Mon, 18 Apr 2022 19:40:46 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1521A286CF for ; Mon, 18 Apr 2022 16:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650325085; x=1681861085; h=message-id:date:mime-version:cc:to:references:from: subject:in-reply-to:content-transfer-encoding; bh=460hG8CIIcm3gtmEox+OkQvY/ODX0b4z0I02OexvBno=; b=KYEfJhc0Rs5ZkE7ubb2Gz1Cw3zGSMQp1ezHiNqAMmE29R3UoqPFc/HfV W/gak8I5K/gK0rJfmemIV2EyoLwfLByoNfEDoyaRd47FnL2Xq9mxAHG2O 0kg0Be1aBg+J1ECM9z2PFHOeZWC28UmWaJNnGDC4gP2K/TCDXoIkcUd/u v+7DCyrEnIr6aEi+U/8p/i/v5smtyzm4mWB7LZ+df7bKS4Ox44zcVDdfG 3vHyUaXhQoJdsTgzMcX2Fou1kH47+Y9em6DpmKK4Dwi6sn/NtOwA29szb BeeDqmbJhWakhX56aKDCVmhhbHXuMYwFmGtiVZ+3oVbKXh4cA2uHJszEm Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="261236733" X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="261236733" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 16:38:04 -0700 X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="575804958" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.214.32]) ([10.254.214.32]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 16:38:00 -0700 Message-ID: Date: Tue, 19 Apr 2022 07:37:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org, sven@svenpeter.dev, robdclark@gmail.com, m.szyprowski@samsung.com, yong.wu@mediatek.com, mjrosato@linux.ibm.com, gerald.schaefer@linux.ibm.com, zhang.lyra@gmail.com, thierry.reding@gmail.com, vdumpa@nvidia.com, jean-philippe@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Language: en-US To: Robin Murphy , joro@8bytes.org, will@kernel.org References: <1d9a2146-9e48-ba97-d049-5d2332ebbd3a@arm.com> From: Lu Baolu Subject: Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration In-Reply-To: <1d9a2146-9e48-ba97-d049-5d2332ebbd3a@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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/4/19 6:09, Robin Murphy wrote: > On 2022-04-16 01:04, Lu Baolu wrote: >> On 2022/4/14 20:42, Robin Murphy wrote: >>> @@ -1883,27 +1900,12 @@ static int iommu_bus_init(struct bus_type *bus) >>>    */ >>>   int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops) >>>   { >>> -    int err; >>> - >>> -    if (ops == NULL) { >>> -        bus->iommu_ops = NULL; >>> -        return 0; >>> -    } >>> - >>> -    if (bus->iommu_ops != NULL) >>> +    if (bus->iommu_ops && ops && bus->iommu_ops != ops) >>>           return -EBUSY; >>>       bus->iommu_ops = ops; >> >> Do we still need to keep above lines in bus_set_iommu()? > > It preserves the existing behaviour until each callsite and its > associated error handling are removed later on, which seems like as good > a thing to do as any. Since I'm already relaxing iommu_device_register() > to a warn-but-continue behaviour while it keeps the bus ops on > life-support internally, I figured not changing too much at once would > make it easier to bisect any potential issues arising from this first step. Fair enough. Thank you for the explanation. Do you have a public tree that I could pull these patches and try them on an Intel hardware? Or perhaps you have done this? I like the whole idea of this series, but it's better to try it with a real hardware. Best regards, baolu