Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp241789lqp; Mon, 10 Jun 2024 02:36:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNaoKGZYZwb5Nasnk+CG4nylm/I5h2hRwrtvisrf7rXzN46SgEG+HQj7grjqZ5IMVFa1GhAocyC9rTGtxrQSrqgDuNJ+OueI3BZtC2iQ== X-Google-Smtp-Source: AGHT+IEiFJtmHjcoSu8Ry74iA2bszXrkNyJKorrQFvon+a2peeXVf8fKQb47SA0ByUzU8o8zpvn7 X-Received: by 2002:a50:d7ca:0:b0:578:638e:3683 with SMTP id 4fb4d7f45d1cf-57c50861ae8mr7058981a12.5.1718012177502; Mon, 10 Jun 2024 02:36:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718012177; cv=pass; d=google.com; s=arc-20160816; b=WEjkq2AlbngRIQPpsYti23DbvVGlZfcGilD4iREAv82VZthbIwRXqhlJvgN/6MJvzY +hxRU/L0jjssLxpwbWXvrCgiExknb3maAgP6P3/b2BUzbIzC9cIgwr2fH/8TSVK4X4P7 4Cirk7f4FUQvot5Cewh2DelP4i3+KO3tXEHty9gn+HW1xieaZzWT/jZcVa7MCyI1j8/E n7ZVbk2jGkPEijPV+Koxh1/eDIEYlmIYi0eGAGNZoTGAX2EDC6nZqfcZsXO50F4nAdIH hNRqBpDEWOg+fN+tXe36HKjIQB7xtbG63nYZxDCbCPcA5LtJZeQtpv38ZoASX++O2xTw zFHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=JfyZWlscKr9Yqn9KGPRWZidB/h/j24q5WeuU1z+bRpQ=; fh=9rZJQuGQx7sUZr3e2RXCqJk5sNxEENfzGNtaar0VSYQ=; b=to+K6Bi20FIzkF3FcJSZ9Qp2BLcPiJZsE3VEcDGjJ0S3piC2FBRJsPqEUXt2EFjFJ/ +OC9v8RXOWzUl+s7D09nwHoNRypEuWJTK1eELoJ3y7W8m8/1j39GcqyDnesN0HbSvP57 5JacHEfPhd9QrsxjoGIkXyWOJCZ0NN/sawTQ18Nn81CCIPVZvn0rntMqGyvV4eb8Cnhp 82mJJaqb1+XB4iyL9Rduo7WydLH92Vn6p+4Vxckl4pxY0nJOKAe967wQKBBEKlUnBnx2 poKOshXpWGisuIP9UVxCUQA6Zwn4wV14idZwLIwvu78BKWVmE66VCWLSW4WaqgT7Jh9P OJlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ax/Mf6sL"; 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-207955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c77c82d67si1400624a12.244.2024.06.10.02.36.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:36:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ax/Mf6sL"; 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-207955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207955-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0F19A1F22060 for ; Mon, 10 Jun 2024 09:36:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E26E678B60; Mon, 10 Jun 2024 09:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ax/Mf6sL" Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 9C1C174E0A for ; Mon, 10 Jun 2024 09:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718012037; cv=none; b=cIFmHBtHLy8l0BiugfXGpUMaU+Dmm0x/QUCp4sRnOIWJcfe/T0vBKBSKdm16Y5XAzJWWlkVqzIi/DNb5dJ+V9kZYZEiGIEtxKP4IwfMrt2676ufz5j0R106Y7zEKEMvMQ2fh8DDpmzgszOYEqHYsxnajm1Kpid9oWlK/MmL7no0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718012037; c=relaxed/simple; bh=Y4u8UCZ3N7F3nxprunHyg90+5gvVlDurQflxxTdao7w=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=RV0rfDFFqXRwF0pgRrSy4dzp7MBO41Q8BDcgCasTD5jotSKT/yDrXsw1/Q4/5W3RyO40KyrFQAvtVQAnXm3Z2E/9QNW235pgFn4xhROSm9Hj5YEXY83Tplxhsvy21OtPfJG8++0FxcB8oWAv9to9fxL23qEHchPcP68w4Zc4ka4= 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=Ax/Mf6sL; arc=none smtp.client-ip=209.85.128.44 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-wm1-f44.google.com with SMTP id 5b1f17b1804b1-421757d217aso22420805e9.3 for ; Mon, 10 Jun 2024 02:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718012034; x=1718616834; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JfyZWlscKr9Yqn9KGPRWZidB/h/j24q5WeuU1z+bRpQ=; b=Ax/Mf6sLHu5jOpJbfna2GjAKKyTeZlVxGKt9vqDmcPFxgHzmMdUGuRTeOn83du+Jrn NAwsgmrhIjc70Fj1RoJuX9gvm2E3bGDsniWdFEa5ysGYETq7gvLwQ65pT2A+3BOyol3z dB4G+R8TSoBEFeO7AQvoOtGRWHryUBFEKOhDXwy82D/Jo/PyQb34soDNfEe5enHOki3A v0rnokt/IqPZEbaASx9rShbaLZZkLXew5yi12On6MZ9+kocUk2Z4pa9ew48212Ikkl7c EsB8CKDT8aUwcAcevdMJmnu0ed9rlj/idmM3vRse096a538WU4bmfXL0+w1BSWFnG6UQ RFrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718012034; x=1718616834; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JfyZWlscKr9Yqn9KGPRWZidB/h/j24q5WeuU1z+bRpQ=; b=iuRugtR5B0jU6g6eMfuYX1sY7xMORSQWILiP7068tkGSbyY7ka7Z0X8qnJZjW8qV6M RsCyRUrCH9+Wl+8i2j50YQuUWBUPCAT++RxUZVxnlfltjxzbeeTQuGnJb6xuPTv0evMk 19YdwQU+nFIoe4IBpfPkjN64R8ggtE8UnEcNlBcsWRGq/CMrIw8V6B+k0ni0/KbjSynp 2huMClAE3sLztxDcG6RWu4z68+TGgaBDV355JZDF5ZLHV3TfRiqlt0GNOYdTkNLzfoPf GLP0QFmUGqkY4dXPBrhKuTDiGW12YryVfTfG2egIzInCx9XiyZT4NgN9d6RaQdCJ3GZI aQLg== X-Forwarded-Encrypted: i=1; AJvYcCXmYFifs1/L7Se+ebBEVeXLe67D3ur6c2YkND465DZRlWHPYb/OpN/jfdcCxJmUh7kyao3wyuOmPJrlGVoI4KTxbsQhJB5bkvnsiGZL X-Gm-Message-State: AOJu0YwqjqaDWntUJb805/mSosnVGN+TbchiYSnwgqXpMXy3NIaWY3wa +EO9sR5sO1W7hRyW0sYG/pnn2NpHozvMaVlBWIZTxLP3zytJrySSCHm01Ig9QXA= X-Received: by 2002:a05:600c:4748:b0:421:edf4:1e89 with SMTP id 5b1f17b1804b1-421edf42181mr16200015e9.4.1718012033827; Mon, 10 Jun 2024 02:33:53 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c2c7e8fsm136565045e9.38.2024.06.10.02.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:33:53 -0700 (PDT) Date: Mon, 10 Jun 2024 12:33:49 +0300 From: Dan Carpenter To: Frank Li Cc: Jon Mason , Dave Jiang , Allen Hubbe , Manivannan Sadhasivam , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , ntb@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] PCI: endpoint: Fix epf_ntb_epc_cleanup() a bit Message-ID: 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=us-ascii Content-Disposition: inline In-Reply-To: <6eacdf8e-bb07-4e01-8726-c53a9a508945@moroto.mountain> X-Mailer: git-send-email haha only kidding There are two issues related to epf_ntb_epc_cleanup(). 1) It should call epf_ntb_config_sspad_bar_clear(). 2) The epf_ntb_bind() function should call epf_ntb_epc_cleanup() to cleanup. I also changed the ordering a bit. Unwinding should be done in the mirror order from how they are allocated. Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP") Signed-off-by: Dan Carpenter --- drivers/pci/endpoint/functions/pci-epf-vntb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c index 7f05a44e9a9f..874cb097b093 100644 --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c @@ -799,8 +799,9 @@ static int epf_ntb_epc_init(struct epf_ntb *ntb) */ static void epf_ntb_epc_cleanup(struct epf_ntb *ntb) { - epf_ntb_db_bar_clear(ntb); epf_ntb_mw_bar_clear(ntb, ntb->num_mws); + epf_ntb_db_bar_clear(ntb); + epf_ntb_config_sspad_bar_clear(ntb); } #define EPF_NTB_R(_name) \ @@ -1337,7 +1338,7 @@ static int epf_ntb_bind(struct pci_epf *epf) ret = pci_register_driver(&vntb_pci_driver); if (ret) { dev_err(dev, "failure register vntb pci driver\n"); - goto err_bar_alloc; + goto err_epc_cleanup; } ret = vpci_scan_bus(ntb); @@ -1348,6 +1349,8 @@ static int epf_ntb_bind(struct pci_epf *epf) err_unregister: pci_unregister_driver(&vntb_pci_driver); +err_epc_cleanup: + epf_ntb_epc_cleanup(ntb); err_bar_alloc: epf_ntb_config_spad_bar_free(ntb); -- 2.43.0