Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1720357lqg; Mon, 4 Mar 2024 01:23:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgjNbaI1CXnz6PU6Ns4LvC7cDuoatAs8iiwIqUYIrkpNe575fFi2pnweNP//bAEpuCGyoR6QeV9G0WROXtsJgGB1/4YOjIT+qhkhv+yw== X-Google-Smtp-Source: AGHT+IGu0cJV1b4YznW/qTE0HqJCEVzdZ+S2me7549g5pp34Et+PxISOr+XtSNfVIUw5LlZ2EV9D X-Received: by 2002:ac8:5a0d:0:b0:42e:f890:1175 with SMTP id n13-20020ac85a0d000000b0042ef8901175mr218610qta.41.1709544196857; Mon, 04 Mar 2024 01:23:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709544196; cv=pass; d=google.com; s=arc-20160816; b=G4WSTkgayZ1THwtyYaGitB8BDS8yhlr/sLwqHuW8bpJl7ztXsalx0TQWljiYmyFy0z wYb2YMDJtogxQcZreV+u8mqveoxLpMMy7dDEXDUwDv7ZrX0x2ftl03zvcQgnP6wYcyvT nkrgYX9pjS2GF5Vzz92r57FdTGFWoTJk6lJE0YHOoaZmxmCLVtKR2JVj4fkz5eNki1pW UqVjIysFWI85ncYeX7UeDusnsQjg862siPc70gacUsAD8SDBP5FCAklNMotfOK4+0YWl 5cGr1RYuPE1X46d9//NIm9wDiWN3xT/xtHOHnD+tFQEIlkttv/b0WhN5nXzGBEDUaExL VvaQ== 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=ek1Qy4Ek2Nyv1vPfoJh/C4U3d/HEVvBzxEIXrGxKmxc=; fh=ooZUU09hRF6+xkkHzWBZwQX8pe7myhuMlwQXHDZi8qM=; b=NLZdnkBJyvZYUEfRa3ckBCOPeMQACD3StvOIyaKQpXmZrsl5QSwM7jO+cg1hTcyRH6 jPBE1jmxPIKzTiX7QiHMqHMaoyvtQ74OMd2QC4sbrZwysDA/xH9wRr97yilPv/GuDOSY 1OUNKS0iqNV3g4k4IjcCYCDMWTnmPpG7KZiQJbrIWtbv4+s4AtphwX0FlbKTYJFqA8p0 JCnGp/bGBu2elB3mJ9skN7jWhQ6ax52E1s3yVYD5/cLNlRTv+hHlsLHCmwYTptfTnfIB ivIqrP2x2UyTqRpsZp2lrYEMlzU+oMf+IEY7hhY9CvvUM1iVhG3tkxAGW6DbD0ztQkGJ +cvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w/rzCx+Z"; 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-90303-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90303-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f7-20020ac85d07000000b0042e9941cd1fsi9854747qtx.628.2024.03.04.01.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:23:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90303-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w/rzCx+Z"; 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-90303-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90303-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 896061C22045 for ; Mon, 4 Mar 2024 09:23:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23FBB1B802; Mon, 4 Mar 2024 09:22:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w/rzCx+Z" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 717E1224D5 for ; Mon, 4 Mar 2024 09:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709544178; cv=none; b=rpCplqe+9rrcmrUYwWRjGzRNdl0RSVqqlUdqzn0ZcZJ6O5r2u1hwOHec/5fhY6ruHXeykQ6iWBLS7/PSSYPirC6BIJZoZij7U5eeobcpgq76MlsMcNGqUQoK2cAqUp+dm/SNB+hQCgHlbl2IfklK5/GF7PRijV+TJHqlUDOcCvg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709544178; c=relaxed/simple; bh=WU0wk1/K+4QF56nwGb7DSq5p2Pb40SPuCM19CB+TfJ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gtR9lsuT2UmpOqW0sj/moIlhWJPQayslI/svc5aAOinAzFYW7pueqDXYv/6IAF4EiUJyXOfFaXPnN4yRyEQx6MCqIhNRMBMgvuixNZq+ZLW/4lijefQDFQ64hs6GiRCQ07/nE3E7GLuqEO4n3cqbXQtDquIrNhZYTvhoUxHyMJY= 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=w/rzCx+Z; arc=none smtp.client-ip=209.85.214.177 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-f177.google.com with SMTP id d9443c01a7336-1dccb2edc6dso34427325ad.3 for ; Mon, 04 Mar 2024 01:22:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709544176; x=1710148976; 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=ek1Qy4Ek2Nyv1vPfoJh/C4U3d/HEVvBzxEIXrGxKmxc=; b=w/rzCx+Z0ULiB65rQrmtQZSQOS+85egWtBDKSLxXeDOznBq1KVQtOGo2fdPdbL897V LTdMB9m4uAFh7+QxtSltcH9P8aINSyFusGcBLcA3RNUC8DKrwRKBltCvspuZ41wnx2Ne TBlqb7db8ZvigCLn2/r3mgbfgVqusZ00TjG8C2Yyxfrk1I2f02cTgOsxotJo4bSTk4Xu BHidToIXOY/GwRTN3YY5vWZi1rIti7rFs/P7DHo2juDbzLWucgvvk02TMionThtiItt2 9OSObC7HhGOpFct5kLtlKl/JRnWlzON5vR3iImKezWeoA+Y2pPABoJQ6x7CtqqSgGHbN Wnmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709544176; x=1710148976; 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=ek1Qy4Ek2Nyv1vPfoJh/C4U3d/HEVvBzxEIXrGxKmxc=; b=Lxr++SJMhOjYD+oz5RRwf7jmY6Z01RpLGx3vVCwV/T0P0F6b2UxEEEdIxBK4XmdvC0 eBcBWd0nzUichR/bg68fiCoM7vCJ0/Ve+MKiqk3ckMnY3lAGDHsIUfANqc9dhohb95xw 3E5lWLgykAw7CfBjVFMkpdXqcT7n5/0seBE/jwytLv+vjR8VRl8CygUk+kf5tiTyNwzo WVfymGksGAcR+A/hjQzxX95yvBeCUFbmAJneCtHBUkrCBVFt7WkmZZwz3wZhbjMgHRZq ykPZlJivjOKA1F1qykZEMCWWDuytzS6xPb1GqXCVSgWwlA13utMoOoeAnXzF+UCGU9Xz c7XQ== X-Forwarded-Encrypted: i=1; AJvYcCXMhSyEf5fEMq8zWZlmL8ng30fx1SElJDnekk3MLDPNTM1WCsxfgFSfmwgb163g/S0aQ3VIIyxfkM8V8e4KyW9HQphgx/A3wPJaN1Do X-Gm-Message-State: AOJu0Yz57eTB82JFFeezjkgLOfgSHiCSLPg7CRymB6rHxepVLw7ddL8a eup/+KxzCyy2PUte8uMRaxK+eCzix2glpqZGuooSjaQCHWSaELeY4giGHrUyaw== X-Received: by 2002:a17:902:6841:b0:1dd:1b3e:cfd8 with SMTP id f1-20020a170902684100b001dd1b3ecfd8mr872464pln.40.1709544175757; Mon, 04 Mar 2024 01:22:55 -0800 (PST) Received: from [127.0.1.1] ([117.202.187.165]) by smtp.gmail.com with ESMTPSA id c5-20020a170902c1c500b001dbb06b6138sm7996648plc.252.2024.03.04.01.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:22:55 -0800 (PST) From: Manivannan Sadhasivam Date: Mon, 04 Mar 2024 14:52:13 +0530 Subject: [PATCH v9 01/10] PCI: dwc: ep: Remove deinit() callback from struct dw_pcie_ep_ops 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: <20240304-pci-dbi-rework-v9-1-29d433d99cda@linaro.org> References: <20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org> In-Reply-To: <20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org> To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , Jesper Nilsson , Srikanth Thokala Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Niklas Cassel , linux-arm-kernel@axis.com, Manivannan Sadhasivam , Frank Li X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4282; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=WU0wk1/K+4QF56nwGb7DSq5p2Pb40SPuCM19CB+TfJ8=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl5ZLWoeNHSgA3rdqm72xsW1XNv2ieGm8j3IInJ 5hT8/Iv0UKJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZeWS1gAKCRBVnxHm/pHO 9c2SCACm976tchHMTt/tn8F/AS6v2O73nB0OB//kHmXjK8Jn3dfXDmZjIpVZr8j0DxyISYzhi2C sJTjZmLM38wDS56xlP3Or1uXfTZrE5dsGWZxIf4W+IasJqwc1/isS8HtMzXFj2bXi9RBxuci9f4 pQdKqCBOvoXfBcaL4Lm+pDULbbZ87a86TB4iuhxR4ZaUB3YXgQ6JvroMza6GuleNqCUAZiMacnd 1sX8TC59fSUnKdPYwhInIMyNFv0ISnTgomJMX2p23WPV70SzHIXGbQ1XFwGX/DzkPq0IJbEdcOJ z5khpdo/K6BXwXL9nxH/IsW4yhMERMdaMSziwfE6NKGtsisA X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 deinit() callback was solely introduced for the pcie-rcar-gen4 driver where it is used to do platform specific resource deallocation. And this callback is called right at the end of the dw_pcie_ep_exit() API. So it doesn't matter whether it is called within or outside of dw_pcie_ep_exit() API. So let's remove this callback and directly call rcar_gen4_pcie_ep_deinit() in pcie-rcar-gen4 driver to do resource deallocation after the completion of dw_pcie_ep_exit() API in rcar_gen4_remove_dw_pcie_ep(). This simplifies the DWC layer. Reviewed-by: Frank Li Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-designware-ep.c | 9 +-------- drivers/pci/controller/dwc/pcie-designware.h | 1 - drivers/pci/controller/dwc/pcie-rcar-gen4.c | 14 ++++++++------ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 5befed2dc02b..d305f9b4cdfe 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -575,9 +575,6 @@ void dw_pcie_ep_exit(struct dw_pcie_ep *ep) epc->mem->window.page_size); pci_epc_mem_exit(epc); - - if (ep->ops->deinit) - ep->ops->deinit(ep); } EXPORT_SYMBOL_GPL(dw_pcie_ep_exit); @@ -738,7 +735,7 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) ep->page_size); if (ret < 0) { dev_err(dev, "Failed to initialize address space\n"); - goto err_ep_deinit; + return ret; } ep->msi_mem = pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, @@ -775,10 +772,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) err_exit_epc_mem: pci_epc_mem_exit(epc); -err_ep_deinit: - if (ep->ops->deinit) - ep->ops->deinit(ep); - return ret; } EXPORT_SYMBOL_GPL(dw_pcie_ep_init); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 26dae4837462..ab7431a37209 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -333,7 +333,6 @@ struct dw_pcie_rp { struct dw_pcie_ep_ops { void (*pre_init)(struct dw_pcie_ep *ep); void (*init)(struct dw_pcie_ep *ep); - void (*deinit)(struct dw_pcie_ep *ep); int (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no, unsigned int type, u16 interrupt_num); const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep); diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c index e9166619b1f9..ac97d594ea47 100644 --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c @@ -352,11 +352,8 @@ static void rcar_gen4_pcie_ep_init(struct dw_pcie_ep *ep) dw_pcie_ep_reset_bar(pci, bar); } -static void rcar_gen4_pcie_ep_deinit(struct dw_pcie_ep *ep) +static void rcar_gen4_pcie_ep_deinit(struct rcar_gen4_pcie *rcar) { - struct dw_pcie *dw = to_dw_pcie_from_ep(ep); - struct rcar_gen4_pcie *rcar = to_rcar_gen4_pcie(dw); - writel(0, rcar->base + PCIEDMAINTSTSEN); rcar_gen4_pcie_common_deinit(rcar); } @@ -408,7 +405,6 @@ static unsigned int rcar_gen4_pcie_ep_get_dbi2_offset(struct dw_pcie_ep *ep, static const struct dw_pcie_ep_ops pcie_ep_ops = { .pre_init = rcar_gen4_pcie_ep_pre_init, .init = rcar_gen4_pcie_ep_init, - .deinit = rcar_gen4_pcie_ep_deinit, .raise_irq = rcar_gen4_pcie_ep_raise_irq, .get_features = rcar_gen4_pcie_ep_get_features, .get_dbi_offset = rcar_gen4_pcie_ep_get_dbi_offset, @@ -418,18 +414,24 @@ static const struct dw_pcie_ep_ops pcie_ep_ops = { static int rcar_gen4_add_dw_pcie_ep(struct rcar_gen4_pcie *rcar) { struct dw_pcie_ep *ep = &rcar->dw.ep; + int ret; if (!IS_ENABLED(CONFIG_PCIE_RCAR_GEN4_EP)) return -ENODEV; ep->ops = &pcie_ep_ops; - return dw_pcie_ep_init(ep); + ret = dw_pcie_ep_init(ep); + if (ret) + rcar_gen4_pcie_ep_deinit(rcar); + + return ret; } static void rcar_gen4_remove_dw_pcie_ep(struct rcar_gen4_pcie *rcar) { dw_pcie_ep_exit(&rcar->dw.ep); + rcar_gen4_pcie_ep_deinit(rcar); } /* Common */ -- 2.25.1