Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1155150rwb; Thu, 6 Oct 2022 09:06:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7E9Q8SmRw3orGcoTcAG2sMEQG34unPPSu/50x0c/sj/FofPjC9FGNHQE/smnZy988sUcxW X-Received: by 2002:a05:6402:35d2:b0:450:be1b:d7cf with SMTP id z18-20020a05640235d200b00450be1bd7cfmr494519edc.51.1665072403463; Thu, 06 Oct 2022 09:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665072403; cv=none; d=google.com; s=arc-20160816; b=LZr6iVhfJ+OOg7s957saDopXYa7EHrarFqmZjELb7VOSnlrXS6cCANWq53pv9oPXxj z62Qx1IUrxTba+ClvKceU+ePnkvnLoFYsB2U1g0XNC46HHc/Gu5m6IkcSsC2RzOUSk0m +bPfqENvJy276nxzMC3jVvgMtqoLRwr+87ChqBGjPGekp46T6fo3Jqwkkifbrys/pIsj S9I1PcliQYELaad+Q9O/Q7pUUni4jK/zXitzdByfD2sWLkFA9HCg5E7cH7/kYFdYuubz a5Zdu0naxShNnetdnKma25rCFOZlsax92n4EyOOCkNDbsoBFPy5xcWMaZLUC/ohX4kVa tEyg== 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=f412pqg551+n6vjP1nmGsDf4NDzj1m2OexkwJftesPs=; b=hwGx0O6EH2N0vSXXKPY7f2hd0E2/YuWB0dfIQ/jLCNF0u1PhtkFqRuS5pD7b4MTJO/ 3QHpKAIQ/JdEf8zEXquYxxTI+aTbG5IZSWfIkPzYNFEu3wcpj0WL7CByCPohu+FEVoW4 /PwmxD8t7xUZfYKP/MA1dQ253fToVbKv6QtPtt4Duu0EpntE2W7GFC+4SZxmIEfr/PnV G/6LOqeBHjSLuXxOpr3+syVB7+to79rEfDI0ZQfjP35VOcF5TRboT8NXbpUg9CZ55Btj 0ZxPTa/u1sF0bw4v1Jau5pQ3vrMOaEK6ddLE9hZXUu0XwJVHRHyT5AuBVZJSY0AL5W52 w0ew== 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 c24-20020a056402121800b00458cb82d176si12064472edw.317.2022.10.06.09.06.03; Thu, 06 Oct 2022 09:06:43 -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 S231853AbiJFP1t (ORCPT + 99 others); Thu, 6 Oct 2022 11:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbiJFP1r (ORCPT ); Thu, 6 Oct 2022 11:27:47 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2CB5BBC454; Thu, 6 Oct 2022 08:27: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 28A00106F; Thu, 6 Oct 2022 08:27:52 -0700 (PDT) Received: from [10.57.65.170] (unknown [10.57.65.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CC4623F67D; Thu, 6 Oct 2022 08:27:43 -0700 (PDT) Message-ID: <583c4689-844d-2ae2-79fb-4750b21c4304@arm.com> Date: Thu, 6 Oct 2022 16:27:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v4 05/16] iommu: Move bus setup to IOMMU device registration Content-Language: en-GB To: Jon Hunter , joro@8bytes.org Cc: will@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, baolu.lu@linux.intel.com, kevin.tian@intel.com, suravee.suthikulpanit@amd.com, vasant.hegde@amd.com, mjrosato@linux.ibm.com, schnelle@linux.ibm.com, linux-kernel@vger.kernel.org, "linux-tegra@vger.kernel.org" , Thierry Reding References: <89d873fc-9f0a-156e-dcf2-48a2b9f93dcc@nvidia.com> From: Robin Murphy In-Reply-To: <89d873fc-9f0a-156e-dcf2-48a2b9f93dcc@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE 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-10-06 15:01, Jon Hunter wrote: > Hi Robin, > > On 15/08/2022 17:20, Robin Murphy wrote: >> Move the bus setup to iommu_device_register(). This should allow >> bus_iommu_probe() to be correctly replayed for multiple IOMMU instances, >> and leaves bus_set_iommu() as a glorified no-op to be cleaned up next. >> >> At this point we can also handle cleanup better than just rolling back >> the most-recently-touched bus upon failure - which may release devices >> owned by other already-registered instances, and still leave devices on >> other buses with dangling pointers to the failed instance. Now it's easy >> to clean up the exact footprint of a given instance, no more, no less. > > > Since this change, I have noticed that the DRM driver on Tegra20 is > failing to probe and I am seeing ... > >  tegra-gr2d 54140000.gr2d: failed to attach to domain: -19 >  drm drm: failed to initialize 54140000.gr2d: -19 > > Bisect points to this change and reverting it fixes it. Let me know if > you have any thoughts. Oh, apparently what's happened is that I've inadvertently enabled the tegra-gart driver, since it seems that *wasn't* calling bus_set_iommu() before. Looking at the history, it appears to have been that way since c7e3ca515e78 ("iommu/tegra: gart: Do not register with bus"), so essentially that driver has been broken and useless for close to 8 years now :( Given that, I'd be inclined to "fix" it as below, or just give up and delete the whole thing. Thanks, Robin. ----->8----- diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 5c5cb5bee8b6..7b3f7fd6e527 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -230,6 +230,7 @@ config TEGRA_IOMMU_GART bool "Tegra GART IOMMU Support" depends on ARCH_TEGRA_2x_SOC depends on TEGRA_MC + depends on BROKEN select IOMMU_API help Enables support for remapping discontiguous physical memory