Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1527491lqz; Mon, 1 Apr 2024 08:52:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSTarWODAnakizUTtM00XG/9yBue4+ol2yBuByoFmovkfO6m1T+euBmRbSZRCRsSuWTVViWPLUX7rwRLpmkiB4BVmrHhgE7XzSp9yhSQ== X-Google-Smtp-Source: AGHT+IETExo2v6bmRfbXT9b/V3hGCSycSNCU9pwv6xga2L8QGeNF9w1gl530SAHB1g/MNLyR0hhl X-Received: by 2002:a05:6214:2cce:b0:696:b114:5da9 with SMTP id lf14-20020a0562142cce00b00696b1145da9mr9535513qvb.21.1711986769487; Mon, 01 Apr 2024 08:52:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711986769; cv=pass; d=google.com; s=arc-20160816; b=iZwdT4CEW495yt2XUbgWMuXWD1dk3xWQSYXJGsNSgojH+ts5CrPzy2SSmQWT7Rz0/F Ue4eBFYoo0q+HPTNrhBVuSKzzmf+tmcmTBKUD+FThjHbqjN0H3aqNLHYPkh7K00n3Ni2 cqShUC8TFPOcd11KpV5NVdqTZZ7XuIBHttZYq09gjBzQIx6JPCE+FIjJ8AjxUlii/VQp FA7TfhmJST5oRuuwOOJ+rDNopRWjBr19AKGSJ2MiH2slguFUIT9ivO1hbJTxiN7/ml8i p9Npw9xMhitNeDG6RW/2Y7dfzaVdDf9ENBbgwsE8B/iT2zaiicJRR4p/kie4LHcTk2BI 9D5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=wf5qp3kEMFhsDeZa+NERTddlDqgA0B9PoJGogDWVdDU=; fh=BUcCWARNGgACmZjhH8I9akLBpUcZ3TuZqcarPwFKi+E=; b=wNq6482klkdCLOoZGtbHke4K2tGF5+rbgxTCEwLCojFYYDa8yPp+z91WtIRSGyZw3+ tOipy1ZqQzuGhLab+2en1q4iTPOMarq21ssPJodQq0ibTBru/vAuqYU8DQHx/zSSDpdT eZiIcgEOjwzQP+8nMsBXyPyflJYQb91V82dWHjlLkUpfuH8OajScIimiZrMqMrCsZfTd 7Zui3oBNovqJzFaH4pMl6n9vSGg0glCESfqmc7PQHR2PPhT/TbpZTPz6VDdaUGL/zZtm t8qedU0VZHAPoDgD0RNIKRfzw7C5wbk9ihgZ/WgG3j203qOBadyMTbgaYbCPXZC3529B Wy4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wy82DoZu; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-126829-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126829-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jh15-20020a0562141fcf00b00696b2cb961asi9652269qvb.495.2024.04.01.08.52.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 08:52:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126829-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wy82DoZu; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-126829-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126829-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2A0031C21493 for ; Mon, 1 Apr 2024 15:52:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89EC750A8F; Mon, 1 Apr 2024 15:51:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wy82DoZu" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F100450A9D for ; Mon, 1 Apr 2024 15:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711986673; cv=none; b=Che4S+B+wtzWW/pMzt69V/Twm1U/DV4fQ9kLatl4YSVQLBDnc+C4K6ciXO9SWk++LASWaFIaHoBn/6j0KdgRWlp8js/6ORbzlgija8L+YB2+mUolFCvDVm9NuOwwEFrv94gqJEMyK4LbLuu3tUpHeVmHWVH3mfO0Web8so2yWaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711986673; c=relaxed/simple; bh=zRqM7O4QJ9QR9QAQtoYpWdK8RL4rvRClmGOwhFTCtKY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tscS6OgreW/kpQeSwHSCxVraMv4sk0oWOqQpCaxoH3WuDN7Ue+JImhpfcK949jWMw0wVZdx+/Eq/cwtbE9K2dciySwBao108k4MVc9jOWuwG8bZc1J28Nlz/WLTJbk/8VW0r6rilH5ZS6dAp+PL7A+utlfzDhDDtBLMN+IUqDqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wy82DoZu; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1def3340682so36292145ad.1 for ; Mon, 01 Apr 2024 08:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711986671; x=1712591471; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wf5qp3kEMFhsDeZa+NERTddlDqgA0B9PoJGogDWVdDU=; b=wy82DoZu1rhH4ilu2uYsNkxp0uOOFpJ4Hk1zJ1cq2r/8qHxygfwdXJK1D3LDUcxuzs OtWI+14VSlwBqC9dTfxa0EAu/m7+Rc+UQCqLyHh2QpoODBXtbEwZB2jRwG9xGu5a3V/r 2+5jjHK+JoU8ISgvkMl9cIgSjuYWJZVgppDQgqMOKSuZ7lM09bsXrQJ2MTwdMwxZnl+A ADhqCj13h3i0nUPgHrnYOpO8JNjsvDH4BpZNwyNrzH87ZkrfbkKwS8es329jArIxpvYi gHeYVrzRMk3hPYcXqiDTQu49HL4p6upYeCnJ8cbdWDGOd9vtKlplymLtznoMcqCtZwgb WB4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711986671; x=1712591471; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wf5qp3kEMFhsDeZa+NERTddlDqgA0B9PoJGogDWVdDU=; b=leZtFOItwYsvLSQ5kYcIR086rQaqdJX2zPezEtygoJgtrxt9T+INeIyJATc6oY0a8z n/xEuk5qR3vGbHW981ofytmGHCI4IfXGvy091i+nwcY1iY0DA2nZF6WX4r7SdoDyX6+o Dt7y+zZ05+SAbOL9HV9sq/44dFTV+tusT7mIXi4Y3Afm6Syfwnv2y5I9Luu6lPBBFHp3 kcDphMW/mgUA+aPv3yvDKgjP9P2ZR18E0WiEmqzFj8+hviZAat6lOXT0k+yrxFB+mwh/ GUdDJkPqZ+oaWqmzsFmAgmy30CSymKM3vdnT1kDs0crxNc4PKbABcIMNBhz6O1l9N+O3 UNXg== X-Forwarded-Encrypted: i=1; AJvYcCUjkDLjtBp7l4LMUWTzG2m7KwKCY8wvXXxMrFtI+G13Q0Kt+WU3Laigqfidf+cxRVN6qGd+sapdezd49ZNHxrC9Hn7556C5NbDya3TD X-Gm-Message-State: AOJu0Yxz8Sa5rGNrUWy+lsppbenppt1LeuB0lV90Fe7UDNfjrqJrKb2e nngSYakC7wqKWcd+Q+3T1qB4aNvi12VUhyys8rVCof/vAN4IFD/+4Bvw4lfcmg== X-Received: by 2002:a17:903:41d1:b0:1e0:b73c:e879 with SMTP id u17-20020a17090341d100b001e0b73ce879mr12930947ple.68.1711986671258; Mon, 01 Apr 2024 08:51:11 -0700 (PDT) Received: from [127.0.1.1] ([103.28.246.102]) by smtp.gmail.com with ESMTPSA id kh6-20020a170903064600b001e21957fecdsm8949076plb.246.2024.04.01.08.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 08:51:10 -0700 (PDT) From: Manivannan Sadhasivam Date: Mon, 01 Apr 2024 21:20:31 +0530 Subject: [PATCH v2 05/10] PCI: epf-{mhi/test}: Move DMA initialization to EPC init callback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240401-pci-epf-rework-v2-5-970dbe90b99d@linaro.org> References: <20240401-pci-epf-rework-v2-0-970dbe90b99d@linaro.org> In-Reply-To: <20240401-pci-epf-rework-v2-0-970dbe90b99d@linaro.org> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter , Jingoo Han Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, mhi@lists.linux.dev, linux-tegra@vger.kernel.org, Niklas Cassel , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2516; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=zRqM7O4QJ9QR9QAQtoYpWdK8RL4rvRClmGOwhFTCtKY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmCtfUGdMnXrY09ZBOL8F9lt+fV4bkGmqX4yzHv JEDRzakX82JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZgrX1AAKCRBVnxHm/pHO 9e16CACpQKDNhpv2wVnXQuSo7FipwYiAPFw7B7IkFye9w0aKDK/a24rCFtQHwiS3d7bWb725nId 5ZSgMIVacTO/tja/ih53qDSvseRRb65btJyC/QEeYKG004HySoO/LbdnndI7EYB5dMSR4JT4sG6 O7nPXkKN5CQwv6H8dK5UZpn5A+/QXasxJmDJGVV4UgifGVSZLNiMnScp8Cif5wsRcyTUvJv+Q5K TJyKhT6SarbQza3iZ4ShaNbctSOrEfMxQprdKAjI5021kfz2jcU14qb2siHXfSZfFkM90mlW0iE WJl6Pztv0Dt8R4sD2Q7Fcg/HiMsAonnbkPeOAuzaoLaVGj7V X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 To maintain uniformity across EPF drivers, let's move the DMA initialization to EPC init callback. This will also allow us to deinit DMA during PERST# assert in the further commits. For EPC drivers without PERST#, DMA deinit will only happen during driver unbind. Reviewed-by: Niklas Cassel Signed-off-by: Manivannan Sadhasivam --- drivers/pci/endpoint/functions/pci-epf-mhi.c | 16 ++++++++-------- drivers/pci/endpoint/functions/pci-epf-test.c | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index b3c26ffd29a5..4d5c638744a1 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -753,6 +753,14 @@ static int pci_epf_mhi_epc_init(struct pci_epf *epf) if (!epf_mhi->epc_features) return -ENODATA; + if (info->flags & MHI_EPF_USE_DMA) { + ret = pci_epf_mhi_dma_init(epf_mhi); + if (ret) { + dev_err(dev, "Failed to initialize DMA: %d\n", ret); + return ret; + } + } + return 0; } @@ -765,14 +773,6 @@ static int pci_epf_mhi_link_up(struct pci_epf *epf) struct device *dev = &epf->dev; int ret; - if (info->flags & MHI_EPF_USE_DMA) { - ret = pci_epf_mhi_dma_init(epf_mhi); - if (ret) { - dev_err(dev, "Failed to initialize DMA: %d\n", ret); - return ret; - } - } - mhi_cntrl->mmio = epf_mhi->mmio; mhi_cntrl->irq = epf_mhi->irq; mhi_cntrl->mru = info->mru; diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 1a4a35e7bf94..8756ffc5977b 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -739,6 +739,12 @@ static int pci_epf_test_epc_init(struct pci_epf *epf) bool msi_capable = true; int ret; + epf_test->dma_supported = true; + + ret = pci_epf_test_init_dma_chan(epf_test); + if (ret) + epf_test->dma_supported = false; + epc_features = pci_epc_get_features(epc, epf->func_no, epf->vfunc_no); if (epc_features) { msix_capable = epc_features->msix_capable; @@ -898,12 +904,6 @@ static int pci_epf_test_bind(struct pci_epf *epf) if (ret) return ret; - epf_test->dma_supported = true; - - ret = pci_epf_test_init_dma_chan(epf_test); - if (ret) - epf_test->dma_supported = false; - return 0; } -- 2.25.1