Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4020632pxb; Tue, 19 Apr 2022 15:08:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsUmRl1B61WK0mYaXCR5m9oHJ6ygcV55fXQzf61ostIPmsZol5bNEFzPRCukQhnbWps9Qm X-Received: by 2002:a17:903:240f:b0:156:8e81:a0a3 with SMTP id e15-20020a170903240f00b001568e81a0a3mr17445847plo.13.1650406132656; Tue, 19 Apr 2022 15:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650406132; cv=none; d=google.com; s=arc-20160816; b=KZ1Zdt3KnR+JP3OnWY41MAPVT1wXyVQGlPawVdlJ5/4odXN6W4KwcNOinHH+zzg761 Ev7VhwXN9rTKImpI0TxDDdyjE6oh2mjGaKvEiEGzwcM3WTdx+NtRdkaQ0kNXBMrj0KGo Z+iHkFwekIccATjkKt4vLwvRIyFjHsYd0UwCm6hgD5gOi8EuIkHfjqfXECKhnkkR0emL GbheyxyuWyKNnsDzy4g32DaN/V7LUe9Okfuf7sLtUyPWpbyjHiQelNHBecLzHoI2QtFV Q8gJbos0Z2WGJo4Vo8EpAIcNmAGgGMZGyDWCQYK0eux34+KhXDJZs75JYeNDbK2lVvSl dXWg== 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=SLIhpSNpVzkuobCGmQShgKiUkgRdEA8kG9m2OPUZa6A=; b=0uFq3xrqCe2guDBYSDjIxTOcHORG5rJp48UzQuHxd66en05h1bR86d9dIOdthMn5cm U0Ggiw53SIuYNnrACdXTgaEBmsJ4GV26gQF4MAfYBnwrn0bf4FyeutzDqeKKH/L1fdtx k0S4xB8IyPhzqk6/k8vT/icad40+h8HPnlV3HQbWyv9DXoWgGxMN4HXECoRJoPqlk3jQ BiA+hMlLKgTxeewVzIHtmmC6q9ufqV8s9hQkehQuzuDaTFv+q2M3vWv7NlvjBaVPG7LQ iX106Aw1LF34ayXZqIVa7VnkfZylUS3NexVF+qxlqG/Hh10pXN4LgA0j7Yk70JEHRBTn VpZA== 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 w23-20020a63fb57000000b003aa30706009si500639pgj.459.2022.04.19.15.08.25; Tue, 19 Apr 2022 15:08:52 -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 S230388AbiDRWMv (ORCPT + 99 others); Mon, 18 Apr 2022 18:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiDRWMc (ORCPT ); Mon, 18 Apr 2022 18:12:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71CB320F43 for ; Mon, 18 Apr 2022 15:09:43 -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 CD81D1042; Mon, 18 Apr 2022 15:09:42 -0700 (PDT) Received: from [10.57.41.251] (unknown [10.57.41.251]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A92383F766; Mon, 18 Apr 2022 15:09:39 -0700 (PDT) Message-ID: <1d9a2146-9e48-ba97-d049-5d2332ebbd3a@arm.com> Date: Mon, 18 Apr 2022 23:09:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 02/13] iommu: Move bus setup to IOMMU device registration Content-Language: en-GB To: Lu Baolu , joro@8bytes.org, will@kernel.org Cc: 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 References: From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,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-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. Thanks, Robin.