Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp326687rdh; Mon, 18 Dec 2023 23:12:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGw71DhxSKUB2Rop2Y4Crbcl5AU8KIqgvHM5VLtT7GSH9pG1bg6aVR9myhElv3RGWKOZOl5 X-Received: by 2002:a05:6512:3055:b0:50b:fc8c:fb1c with SMTP id b21-20020a056512305500b0050bfc8cfb1cmr6470920lfb.103.1702969945643; Mon, 18 Dec 2023 23:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969945; cv=none; d=google.com; s=arc-20160816; b=G5MipXJinHo6GyebYCW2QizEuSj8yrEkaCyf1vi9g086BcXKSigsTlPaH9BSrUHe9s aUz88PGBEZ6yamPhKtN7Pb8pxpU5cu9FYsEaJlztqJvTG8AGPDPQAND79nlhWCVC6AUy UX5fNMceuSHGrbAYwfHYehcvU96TRb6Nq2dKVDMehQUEH9HGICv42T2GHqH6rGI9KTCR ihAjFdTiNh8BpiGl5d2waeoQSp9PqhFRY2UE0bKCWI6EmdN/hcDq0Hj1zPJK+EmhHHfO 2rJ1P3BzWKinqXr+79qhTXROVxWfEZ74XLtZsi61kKNy8sRcJmrItIob7lEWQbFBMlVl t8SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=NH1oZlm5RqSA1VdpTcesZEXhfr7jrL6PcejKvQmpAq8=; fh=Ur+JM3izw9lMYQIvSATYfBdctbcTS/lPc1oC3y+BFLQ=; b=xqiTE+Td6MEhRdhDbOGz7MCxS35OXDZ4oQedlQNTfGfnADRpfmmWo8tNsVslZYAV6y XIko1uZF7TVpb9qcnIAAr+NN5jHkUKCvrmu+pKhVIg1zhqKydNM8cpLch6Qq6oam4y44 N3BHaX/cQDCGo15Ifgj0L4wHgIASLH0VVdrij4kSX44BE5PcJ77KA6Ce/8SpJeLZUFlm 4BadgNLqCK5SLycB/c+kXjrzs2sPlZOdihpfTiQhoabXCdxtHnS6IltVU5TzlM5r+elI gyC9ev5yh97rFhB50qx97Megq6DTS4Ygxm//wylPN3fJAkXOeT2VhdPDKUTcUeeLS0Vf XJbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4778-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o7-20020a1709064f8700b00a2322e239e1si3029264eju.142.2023.12.18.23.12.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 23:12:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4778-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4778-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 57BED1F26ED7 for ; Tue, 19 Dec 2023 07:03:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 557E41BDEC; Tue, 19 Dec 2023 07:00:09 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B99DE1BDCE; Tue, 19 Dec 2023 07:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R691e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Vyq-RHH_1702969201; Received: from 30.97.48.48(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Vyq-RHH_1702969201) by smtp.aliyun-inc.com; Tue, 19 Dec 2023 15:00:01 +0800 Message-ID: <1b9a7d11-c91f-4b55-bf27-d7c703ed5c24@linux.alibaba.com> Date: Tue, 19 Dec 2023 15:00:24 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] dmaengine: sprd: delete enable opreation in probe To: liu kaiwei , Vinod Koul Cc: Kaiwei Liu , Orson Zhai , Chunyan Zhang , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Wenming Wu References: <20231102121623.31924-1-kaiwei.liu@unisoc.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/19/2023 1:21 PM, liu kaiwei wrote: > On Mon, Dec 11, 2023 at 7:41 PM Vinod Koul wrote: >> >> On 06-12-23, 17:32, liu kaiwei wrote: >>> On Fri, Nov 24, 2023 at 9:11 PM Vinod Koul wrote: >>>> >>>> On 02-11-23, 20:16, Kaiwei Liu wrote: >>>>> From: "kaiwei.liu" >>>> >>>> Typo is subject line >>>> >>>>> >>>>> In the probe of dma, it will allocate device memory and do some >>>>> initalization settings. All operations are only at the software >>>>> level and don't need the DMA hardware power on. It doesn't need >>>>> to resume the device and set the device active as well. here >>>>> delete unnecessary operation. >>>> >>>> Don't you need to read or write to the device? Without enable that wont >>>> work right? >>>> >>> >>> Yes, it doesn't need to read or write to the device in the probe of DMA. >>> We will enable the DMA when allocating the DMA channel. >> >> So you will probe even if device is not present! I think it makes sense >> to access device registers in probe! > > There is another reason why we delete enable/disable and not to access > device in probe. The current driver is applicable to two DMA devices > in different > power domain. For some scenes, one of the domain is power off and when you > probe, enable the dma with the domain power off may cause crash. > > For example, one case is for audio co-processor and DMA serves for it, > DMA's power domain is off during initialization since audio is not used > at that time, so we cannot read/write DMA's register for this kind of cases. > > @Baolin Wang > Hi baolin,what's your opinion? Please add your explanation into the commit message. Moreover, I think Vinod's concern is reasonable, so you can not move the pm_runtime_enable() after registering the devices, which means users can access the device without powering on. To solve your problem, I think you can move the pm_runtime_enable() before dma_async_device_register(), then if users want to use DMA in probe stage, the dma_chan_get()--->sprd_dma_alloc_chan_resources() will help to power on it.