Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp64776rdb; Wed, 20 Dec 2023 06:27:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGt1XgSXVgy7PMj+awZGmH3epYaRPSFUg5DSiPCj4aafc9UzzV6Z5ls4o6LudegmCZ93MgX X-Received: by 2002:a50:d0c9:0:b0:553:e1d3:e7d1 with SMTP id g9-20020a50d0c9000000b00553e1d3e7d1mr477239edf.59.1703082479092; Wed, 20 Dec 2023 06:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703082479; cv=none; d=google.com; s=arc-20160816; b=msEWOWmOhkO7oJCUeS5Yq+AvltrB+LlUeO2JYSoLvz+ypSsTCT4Z6MO0Do/lEkbfyI uNny8b58Qm4NVMeLC/hdaj0TmgiL4VXQoKOlpopLuuL87u/IyfulxgCUBQJ0oGZuxJIx r/wqoxzyReHOrwdy6er1kpsVH7HeVs42DEtLjyIYx6bcx7V2+ErNuXfvj0NnhIDST06N +GpQ6+r1GlVYcRCl6V2mtBdV9UWVR4XQ2Rm2dV1Nko9l5PoHBuyLA0BYAmg7c0VQOXKO sfNd70LpMty6keUyMOd9HFgGxOTuItxllypbWB0pU96YEum2/qi565rwdim6BTA5JJmh jqjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=anozzRC8G2A8WV/scuVzvNAseryTn/U/UDcjP3yv2s4=; fh=si4+oiMq1rce/KZyapJjWEipXAH0KuA3j3g3vjIQsmQ=; b=m/jiknTrrbrv0s/R8glcv0lPX+12Dmk0BT+UNWkeFuNKodxUTtN4874LKKTIxr/ccD pbVviKSFbtheBF7vDtZ8HgK/fP5u9q2uVS3ulvA+5q/uWgvEBNTbKPlM6y10KCAnpqc1 N/+ZbD68U4gUsNGaQhMeW0fI9vmeUwLdniTIdJwC04E0/CjeZRFlIj3mjwcflu3C3hKc kndZ4Yy3REOfPjCC8Oe2ly3cl0hI+T5Mu0x6r/aufl0/7aB87KmCTy6Dk109FI7tcurW Zc8PI5JcxxHGD+2kLe6hyqeABWvXW7YfqccgsCqg5nFMoY1xIEX50yU+5NpJ7JuWrRHg BfIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DDfvNxqA; spf=pass (google.com: domain of linux-kernel+bounces-7060-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7060-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d35-20020a056402402300b005533c998ed9si3165004eda.116.2023.12.20.06.27.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:27:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7060-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DDfvNxqA; spf=pass (google.com: domain of linux-kernel+bounces-7060-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7060-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 AFAB11F22B73 for ; Wed, 20 Dec 2023 14:27:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02E1C38FA2; Wed, 20 Dec 2023 14:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DDfvNxqA" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2DE8D39844; Wed, 20 Dec 2023 14:27:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEDCBC433C8; Wed, 20 Dec 2023 14:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703082471; bh=PbcxQV3R6UY1YiVESDyUAZnHxABvldU4o8NABOycW5w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DDfvNxqA3zIdDySbm5xkjXyQfU8gaioIQGX7Onsvm+18RPBIMmPHqsnzhroowCaxP GM8ItdV12YVb1Ofb529JKKfRm/d0T5pd0jxqNSBjCOdUiATvV5u0Gu+/2tMiIEJLuu iLt3iuXef33QSdBpI7ocxnQqeujPjc0SCXsuuD/iuL2FeP9AAbTb+d2Ypb54uJK8Tv l3i2WZGBBbcGZqq9N9gLGDz/UdehgvxEj38E5xvNH4sntP42I3vLnw/Ljsr31MKpYo lX68MUxZ7ao58sv4V40eOSnB4HZmIVmaMG/JY6+JseBim4ry3sDno36lsO+mBrh7LD 4ehwxFc8cBPdQ== Date: Wed, 20 Dec 2023 19:57:36 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: allenbh@gmail.com, bhelgaas@google.com, dave.jiang@intel.com, imx@lists.linux.dev, jdmason@kudzu.us, kishon@kernel.org, kw@linux.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, ntb@lists.linux.dev Subject: Re: [PATCH v2 1/1] PCI: endpoint: pci-epf-vntb: Fix transfer fail when BAR1 is fixed size Message-ID: <20231220142736.GE3544@thinkpad> References: <20231219142403.1223873-1-Frank.Li@nxp.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231219142403.1223873-1-Frank.Li@nxp.com> On Tue, Dec 19, 2023 at 09:24:03AM -0500, Frank Li wrote: > ntb_netdev transfer is failing when epc controller's BAR1 is fix size, such > as 64K. Certain controller(like dwc) require memory address must be align > with the fixed bar size. > > For example: > If BAR1's fix size is 64K, and other size programmable BAR's > alignment is 4K. > vntb call pci_epf_alloc_space() get 4K aligned address, like > 0x104E31000. But root complex actually write to address 0x104E30000 when > write BAR1. > > Adds bar_fixed_size check and sets correct alignment for fixed-size BAR. > Change looks fine by me, but I have a hard time understanding this commit message. The change just checks the size of the doorbell BAR if a fixed size BAR is used by the controller and uses the fixed size. In the commit message you are talking about alignment and root complex writing to the BAR which are just confusing. Please reword this commit message to make it understandable. > Signed-off-by: Frank Li > --- > > Notes: > Change from v1 to v2 > - Remove unnessary set align when fix_bar_size. > > drivers/pci/endpoint/functions/pci-epf-vntb.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c > index 3f60128560ed0..ec3922f404efe 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c > +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c > @@ -550,6 +550,14 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb) > > barno = ntb->epf_ntb_bar[BAR_DB]; > > + if (epc_features->bar_fixed_size[barno]) { > + if (size > epc_features->bar_fixed_size[barno]) { > + dev_err(dev, "Fixed BAR%d is too small for doorbell\n", barno); > + return -EINVAL; -ENOMEM? - Mani > + } > + size = epc_features->bar_fixed_size[barno]; > + } > + > mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0); > if (!mw_addr) { > dev_err(dev, "Failed to allocate OB address\n"); > -- > 2.34.1 > -- மணிவண்ணன் சதாசிவம்