Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1494453rdb; Mon, 8 Jan 2024 00:23:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXaDeVMmTYFKijN1Atf38u43tOKqUMnKCAKZZzUSAt7G1yiF0y124gi1TKkkzH6vX8XQPA X-Received: by 2002:a05:622a:1a13:b0:429:97b0:6096 with SMTP id f19-20020a05622a1a1300b0042997b06096mr1338763qtb.69.1704702203328; Mon, 08 Jan 2024 00:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704702203; cv=none; d=google.com; s=arc-20160816; b=tt9sRAIxowQnSvLzldTAne7XrMT6ViLfo/6QRIgaqfJSGpMeqfcrk3fAlQmJBsrL1Q sNuAZLyUuXwupXneI4yAt0WiASa1Ma1KIcyH8VS1oCMuYgb9t/nXFCgpNafje7cZmZ7O EOUoJp8EMdezwB/AbuY41K4yXZ4OrcCj+BGO8v6rcgESI2pFdEiZAjwA2A0sVg6aWtKv Ha9capdRyZ/x478DL/enScA7ET/ineDhG15dkBIw4WMZgkb9TMzPFMZQgE5ll/ESZv2B kUYD+TTCjg2mlTGPBf9KJvfviCvabzOmR1zoKG66MK/2iKHaPfzEHShuM4OCedLtqZK2 mQ4w== 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=/m1DR3MP5ThPnVS+qEgPyNXeSvObaMCy+3zYWtQ3g6I=; fh=ghzpLdN2509s4RlVdpSR35Rv588N/tFskKsw0yoBJOc=; b=PyqYw3eMrDW/e+HdO9ANVZATgAxLwrlxmcVwIEoI9O5HZObbsrPcR/HwAwBy4r8iaf Fpkp0TyFZXQXaYRwHG764G5KsA5HfonqdAawYpTkcRVQ9uf6m7vRZLj8WThjPCU8D0zm oIDcuObbjtbOKUYByc+Y1jJhaciaLSZT4jhgiFvv2IDlOCGKZ6YkVtqGdnhr3gzknCNn wCfvGpLHklibC1LUIV4TMwW/BAmCymGQY/YvX49YOAF+4OW38DSf2gh1uTuKypgxwSb7 rFi0O3A+26hai+BUvIrV1GmD2JTRVXvj2BCiauor3ldAKmnH5w2emLvA0Zo2K0/WmTw2 Ygzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B8FEl4Z7; spf=pass (google.com: domain of linux-kernel+bounces-19180-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19180-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v10-20020a05622a188a00b0042993589a33si2033421qtc.388.2024.01.08.00.23.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 00:23:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19180-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=@kernel.org header.s=k20201202 header.b=B8FEl4Z7; spf=pass (google.com: domain of linux-kernel+bounces-19180-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19180-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D338D1C21BB3 for ; Mon, 8 Jan 2024 08:23:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55AD2B672; Mon, 8 Jan 2024 08:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B8FEl4Z7" 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 67D9DBA26; Mon, 8 Jan 2024 08:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 869DEC433C8; Mon, 8 Jan 2024 08:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704702192; bh=sGlJgmVOxVh6ippUhDlfe1wCgtRXM0YVORxzm413Vxo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B8FEl4Z7GfBpsZxVgdIhM+X0opu5GWfsYS8/otvCH/54exflFykvjgAo91xAm/UtC WV4a0d7BMh1ypEDytbpxlIzhMeQKXz7iT3xnjPTH7spscqmBwZRHz/bzZQap01G5kT bfrjAFo0rJfy/VsK3iEqWlhugn7ZM8qt9jRjhjYOJLKWKnIkNCU0+87x3HeqCTXoJl 6e8Sr1R+x6eoqOJIBSZk4fW4dSP+gI0iP0jw20Odf/981c1TfHbZ8sjMkxurb8EA25 UXzoP2wdIiSd9NTm6drq55RMBqZjTV7TTqjFrUxGFlKSEMPMpNa2dlhPHFxkoLrH8e jt/RL/gDoY67A== Date: Mon, 8 Jan 2024 13:53:03 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: mani@kernel.org, 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 v3 1/1] PCI: endpoint: pci-epf-vntb: Fix transfer failure for fixed size BARs Message-ID: <20240108082303.GA12822@thinkpad> References: <20231220192427.1530460-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: <20231220192427.1530460-1-Frank.Li@nxp.com> On Wed, Dec 20, 2023 at 02:24:27PM -0500, Frank Li wrote: > For the inbound MEM/IO TLPs, iATU on the endpoint expects the target > address to be aligned to the size of the BAR. For configurable BARs, there > is no issue because both host and endpoint will know the exact size of the > BAR region. But for fixed size BARs available in some controllers, if the > BAR size advertised by the endpoint is not same as of the actual BAR size > used in the controller, then the MEM/IO TLPs generated by the host will not > be translated properly by the endpoint iATU. > > So if the fixed size BARs are available in endpoint controllers, always use > the actual BAR size. > You should add a note saying that you are fixing the issue only for DB BAR and a similar fix is needed for other MW BARs. > Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP") > Cc: stable@vger.kernel.org > Signed-off-by: Frank Li With that, Reviewed-by: Manivannan Sadhasivam - Mani > --- > > Notes: > Change from v2 to v3 > - rework commti message > - add fixes and cc stable > - return -ENOMEN when request size > fix bar size > 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..85120978fb8c9 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 -ENOMEM; > + } > + 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 > > -- மணிவண்ணன் சதாசிவம்