Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8545684rwi; Tue, 25 Oct 2022 08:00:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LCGSEd4q76ZOX0R5dRI6bSy/sFhih/rDUxtddcc11ZG8AUisQKJhJgfetWA6TDX7aDYik X-Received: by 2002:a17:902:8f91:b0:184:d3ed:afd8 with SMTP id z17-20020a1709028f9100b00184d3edafd8mr38810730plo.15.1666710037069; Tue, 25 Oct 2022 08:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666710037; cv=none; d=google.com; s=arc-20160816; b=kwh7ezeR0bw4Wc7ucFywuYxD+7MBYyZd+hf4zxbyyCWicH6VxKr1AZenNs8Qagwltr tOpbgGASzmSXEOD+cTvXxRM2qid0g4/0R2P3SpNIjlg3vJ0FtuoJUSvFIONi6n3Lqfz/ Lje3H/jD2s3rOFh7OO0EGPZqDI4qybeQb3krGMmUmXh/yMAOnhhkFmvHKoI0CsxuJ0zj t2xO2tOT2u+aankMsr7ku7dMciKRwZBWwbLc3FzClh9JZ6YhEAuUZuQZlCdAga8rKXby wHzpXhYY1dPja5nBpngH/VqAMOHun5pSPLKr8Xt1XjL+DzRC1/2szTcdeD4RA7FBxfOT R+MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vZVnPGsAheVchMmW+27sKWAExzhNFnjGwmynQxqPwGo=; b=kXLHU41OOuGLv5IcVTlire+MA/vfqakkQfEj3hNTHKY2c27Ru97EleAk23rz0MrE/M YFb5HKwcQcD2vkj3D0pPyH8wz1fvN7dirDo6RVSJNxJbZqNQNY+Xozz6bzbAaEOg2v+9 o3SoXHt8G3ct6iu3/FMe2iyn4Nt2+1cG8GRHiZNckwdaLesdPRWBbORyPwS4UwvPqjJm Ggy2kFg3f6i7nARI0Klf5BjNEnvffXX7VsJgtPr0qEB4RtfPInQkxjvKZykmxau9Vzff hBdUgn99pNp9bDRm+D4xsVTcrg94KNpfi6kYyytL5PHRNDWmpgGsOgNFtnChB1YLxPOF o/hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ICUkuoio; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a656897000000b0045b1d6c87cfsi3464316pgt.432.2022.10.25.08.00.23; Tue, 25 Oct 2022 08:00:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ICUkuoio; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232348AbiJYOWa (ORCPT + 99 others); Tue, 25 Oct 2022 10:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233053AbiJYOWK (ORCPT ); Tue, 25 Oct 2022 10:22:10 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EC668E787 for ; Tue, 25 Oct 2022 07:22:04 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so16470276pji.1 for ; Tue, 25 Oct 2022 07:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=vZVnPGsAheVchMmW+27sKWAExzhNFnjGwmynQxqPwGo=; b=ICUkuoioTTbT4J3PQNG+F2mm8o+HTAEkYCXtGoXB2o+mCQfo7DmlBXq9deAQi2YA0d DXO1h6CakTsqFcctttj6fLpfnlvnTCU+vbdOY2r7v6GpUAQchYPKU9hmtIauunE10RLa urTKrDuq7mYXhbP5CTE4YzU8j3SlzXpGnWLrlFzHk/sJ4mkKIaubrfsvc016XlPIL+MT KtlHDsb1hOofH3vZ0cEhh7FUuXRh/TllJxI4pXhtEcHn0OEuxxCS6UHZ+vzlVniYtvg4 WQ74Ev0UEg5iRVT9eFFBJhkOmoUuRR+b83dOxu3w3AoKFoQlC6DRm2d/Usk8gRsb9Hip RxhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vZVnPGsAheVchMmW+27sKWAExzhNFnjGwmynQxqPwGo=; b=CM3G3WXhh0TrnrkpQTOOdlJCDz3ORWc7YJaeK41A4lwO5amJUKIfhkDviAhgnnsq8c Adty56IQkPjTjdlUYGoZGu6cpsYHlhAOk3sYGgoNLIsghvABMvBUpGF/N0USgX6VNxkG 9rMOGUIDEOLn+m3cZ/resmf+betgCVZl3ZZhIpOpr5HpLpfMCBH7ZjlOme7lN5mDMD3i 9qX7Z05FrSzPqRH2cr5a+9FROrO2sVbEOYU50TskwAqfyciYL9egwEPUg3xnviz+JL19 Wv5e7ZKANT+8i41E0sRfOTvmwmTC3yPdBozLWf7SbuWA5fWXRIRG8AfnyWU1UV+r2evP aELg== X-Gm-Message-State: ACrzQf3GJ29uZ+GNg6eGLSGTuIHObj9uCsWbbXKj48nDi2+y8mrYCsF3 e9JkOarVC7FvHXJ5E7zo0p29R+HT96rIjRVxcQ== X-Received: by 2002:a17:902:9684:b0:17e:71b2:bd16 with SMTP id n4-20020a170902968400b0017e71b2bd16mr38661973plp.163.1666707713299; Tue, 25 Oct 2022 07:21:53 -0700 (PDT) Received: from thinkpad ([117.193.208.236]) by smtp.gmail.com with ESMTPSA id r17-20020a63ce51000000b0041a6638b357sm1322578pgi.72.2022.10.25.07.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 07:21:52 -0700 (PDT) Date: Tue, 25 Oct 2022 19:51:43 +0530 From: Manivannan Sadhasivam To: Shunsuke Mie Cc: Jon Mason , Dave Jiang , Allen Hubbe , Kishon Vijay Abraham I , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , ntb@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint Message-ID: <20221025142143.GA109941@thinkpad> References: <20220922092357.123732-1-mie@igel.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220922092357.123732-1-mie@igel.co.jp> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 22, 2022 at 06:23:57PM +0900, Shunsuke Mie wrote: > Some PCI endpoint controllers have no alignment constraints, and the > epc_features->align becomes 0. In this case, IS_ALIGNED() in > epf_ntb_config_spad_bar_alloc() doesn't work well. Check for this before > IS_ALIGNED(). > > Signed-off-by: Shunsuke Mie Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > Changes in v2: > * Fix the commit message in phrasings and words. > --- > --- > drivers/pci/endpoint/functions/pci-epf-ntb.c | 2 +- > drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/endpoint/functions/pci-epf-ntb.c b/drivers/pci/endpoint/functions/pci-epf-ntb.c > index 9a00448c7e61..f74155ee8d72 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-ntb.c > +++ b/drivers/pci/endpoint/functions/pci-epf-ntb.c > @@ -1021,7 +1021,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb, > peer_size = peer_epc_features->bar_fixed_size[peer_barno]; > > /* Check if epc_features is populated incorrectly */ > - if ((!IS_ALIGNED(size, align))) > + if (align && (!IS_ALIGNED(size, align))) > return -EINVAL; > > spad_count = ntb->spad_count; > diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c > index 0ea85e1d292e..5e346c0a0f05 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c > +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c > @@ -418,7 +418,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) > size = epc_features->bar_fixed_size[barno]; > align = epc_features->align; > > - if ((!IS_ALIGNED(size, align))) > + if (align && !IS_ALIGNED(size, align)) > return -EINVAL; > > spad_count = ntb->spad_count; > -- > 2.17.1 > -- மணிவண்ணன் சதாசிவம்