Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3827648rwa; Tue, 23 Aug 2022 10:47:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR5o92J5mZW87L45k1heUYHP7WUOIUihL79quEX2UdQ5QujZ+jCrKCe6TI8jqPfbgZJTEdUV X-Received: by 2002:a17:907:1c8a:b0:6e9:2a0d:d7b7 with SMTP id nb10-20020a1709071c8a00b006e92a0dd7b7mr436230ejc.572.1661276867627; Tue, 23 Aug 2022 10:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661276867; cv=none; d=google.com; s=arc-20160816; b=u7CPj01q9OWcMnPrLo310JaGNY3P73trMk8Ltm49IfVnxFBXU5+cBU64oW+FnEaxHq friK/gN5HAhwa+XlXs2PbatBd0H74uqkX2N6kJjMM+ApMHeS9WbOl5aN8TW5oQbIp1zf 8YWFNiTVxKJhIjPTXwwRqCcbEtutKWnoonKJ7yQECRnFDrXqEWpzcPnTDbyzFnjf3tBQ iDY4IGSaTdQVue6fnWb+uwzdu4NUUwafvQ71tuTKWMRN4/fQ5hiZQLr9dj59SMrH3h6x nKKwOhRAOk2aUc/2wokWHpw2tyJQF/+57J2U4OlVca5vatjLYmPjITOAmAqI8ic6FH5i za+w== 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:dkim-signature; bh=VaczDVmtSoel5D8BnbdlBVdvOHXx13CLM3Bc/9QVJzA=; b=s3PClXpeuncK/wf9y3ljS1Pl8zSN+7mNp1N3yNdS07HDYiDPBMGvQ4JmZX4PNzcl7e NxMu8+CyiWecc0QX+Ro9IETNcD0CMLr/Z/FefTxWbUYp2CcgWExEVNjEf4ZSXc+0uh8s 9hVQADnzQADENN/Eb7T0MkUgtWZRtFnG7vH/7a55ggkSYLtcvSuofIQAiuhv9evjF9Ux vaxqrzmxV4mzggu+Utks9PFjusJLiI+omvLqHA/7h3E+da8P9LGmy/f2NxvNXGraKI54 xLBUp+Q61dmGWQ2QWfXvkZhL0GyqsghMgsIsKhKm2v3JZ38F9/J7l4G5+8+VftTpJRWi EHug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=awhbsSUN; 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=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a056402185500b0043dba64d40asi2374279edy.399.2022.08.23.10.47.16; Tue, 23 Aug 2022 10:47:47 -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=@collabora.com header.s=mail header.b=awhbsSUN; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343821AbiHWRCb (ORCPT + 99 others); Tue, 23 Aug 2022 13:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344367AbiHWRBO (ORCPT ); Tue, 23 Aug 2022 13:01:14 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4EAD14E13B; Tue, 23 Aug 2022 06:32:18 -0700 (PDT) Received: from [192.168.2.145] (unknown [109.252.119.13]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0D8946601DD8; Tue, 23 Aug 2022 14:32:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661261536; bh=qYAbuLUkpYt+uM+/fl7m986bAwBm8xRYbN9/9PNiiyg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=awhbsSUN/KwnvxfssZE3JauPUbX717ylMppTYN5OSSg5EkcgTbcPNTgq3FRIPUyju JngJpWUg14TdAeOVtnuLsUOT8eN/5C1B1cCcpyVZV9qknSbauELUkEI7vFuQPDwSyS Tz+6Q6oTRFK4rGZal8a54PCHxC8fGyqJMF3k5PWOPAgXkAkgeXT295N0U0FmDU/hYB P0/TYvcNkqrXpZ0eCrqCr267op1TsInXIXr624UPHHhR47lIYf5wD+VUvz7Ve74Qle EsjwpmQgN3+1gNKqBBXWDZu2tFd7m1gIczOD5rKy4MOTergFbk1nPXdw1CyJ81QQuY 7kKKttATwI1/w== Message-ID: <4f791065-e0dd-6ed5-f152-86d7be683490@collabora.com> Date: Tue, 23 Aug 2022 16:32:11 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH RESEND 1/2] i2c: tegra: Add GPCDMA support Content-Language: en-US To: Akhil R , Dmitry Osipenko , Jonathan Hunter , Laxman Dewangan , "linux-i2c@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "thierry.reding@gmail.com" , "wsa@kernel.org" Cc: "robh+dt@kernel.org" , "devicetree@vger.kernel.org" , "christian.koenig@amd.com" , "sumit.semwal@linaro.org" , "Kartik ." References: <20220819122313.40445-1-akhilrajeev@nvidia.com> <20220819122313.40445-2-akhilrajeev@nvidia.com> <20281ca7-e597-7030-4861-5f9a3594726d@gmail.com> <89a746fd-a98e-3147-7811-33c5051c2b6d@gmail.com> From: Dmitry Osipenko In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 8/23/22 15:55, Akhil R wrote: ... >>>> What I am trying for is to have a mechanism that doesn't halt the i2c >> transfers >>>> till DMA is available. Also, I do not want to drop DMA because it was >> unavailable >>>> during probe(). >>> >>> Why is it unavailable? Sounds like you're not packaging kernel properly. > Unavailable until initramfs or systemd is started since the module has to be > loaded from either of it. > >>> >>>> This situation is sure to hit if we have I2C driver as built in and DMA driver as a >>>> module. In such cases, I2C will never be able to use the DMA. >>> >>> For Tegra I2C built-in + DMA driver module you should add the dma.ko to >>> initramfs and then it will work. This is a common practice for many >>> kernel drivers. >>> >>> It's also similar to a problem with firmware files that must be >>> available to drivers during boot, > > Isn't the initramfs loaded after the driver initcalls? Wasn't very much clear for me > from the code and docs. We did try adding the module in initramfs initially, but > couldn't find much of a difference from when it is loaded by systemd in rootfs. > Will explore more on this if this really helps. It doesn't matter when initramfs is loaded. Tegra I2C should be re-probed once DMA driver is ready, that's the point of deferred probing. I'd assume that your DMA driver module isn't loading. >>>> Another option I thought about was to request and free DMA channel for >> each >>>> transfer, which many serial drivers already do. But I am a bit anxious if that >> will >>>> increase the latency of transfer. >>> >>> Perhaps all you need to do is to add MODULE_SOFTDEP to Tegra I2C driver >>> like we did it for the EMC driver [1]. >>> >>> [1] >>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux- >> next.git/commit/?id=14b43c20c283de36131da0cb44f3170b9ffa7630 >>> >> >> Although, probably MODULE_SOFTDEP won't work for a built-in driver. In >> that case, change Tegra I2C kconfig to depend on the DMA driver. > > Since I2C can work without DMA, wouldn't it limit the flexibility of I2C driver. There are kernel configurations that are not worthwhile to support because nobody use them in practice. I think this is exactly the case here. The TEGRA20_APB_DMA driver dependency created troubles for a long time. If DMA driver is enabled in kernel config, then you should provide the driver module to kernel and it will work. If DMA driver is disabled in kernel config, then Tegra I2C driver should take that into account. I'm now recalling that this was the reason of "!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)" in the code. Since all h/w gens now provide DMA support for Tegra I2C, then should be better and easier to make DMA a dependency for Tegra I2C and don't maintain kernel build configurations that nobody cares about. -- Best regards, Dmitry