Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp908984rwi; Thu, 27 Oct 2022 08:53:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MplElb0ycarQS8RV/mccaRpzxaZ95+YMI2Tsmqpmq97JiF35h721j96NBFzsW+FfkLrLi X-Received: by 2002:a05:6402:42c7:b0:461:bea2:8a70 with SMTP id i7-20020a05640242c700b00461bea28a70mr21875568edc.261.1666886033705; Thu, 27 Oct 2022 08:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666886033; cv=none; d=google.com; s=arc-20160816; b=vJCLQx5pe8t9JKNcSZ+aWKWQc3C8O6zgIKwheJLxxvjRrmH/Kepa4qlNk6uloSbjwv wcZb7Jcg8fUOdGxxkWPTBQ7M2e9Gf45Jjqh8zdhMMXZbaMBNaINrEKIaOrAQ4zYztd/O rQ9ZELNE4kx/3eIootVAzYlmGeBo2OzhZ7xcA8ztMG3xEruvbFrRhNSHFZPwbYnVNuwd wTW9b/2NCgMmPYsrf36kOQUIGSKg9k1RZ8uDuo5+tdHdnV2Z5dfHARzN0VRk0Xko+5wH gXfCnXj9sptvAZMTkDBpqb2QQtlbWvBE6RsqmSprQBdrpp5eNI9ZWpaLsMKdO9wgMC6T wzSg== 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=Mp2QfpZmO5rJfMt8DbZa9LapRBZkl3HjpYw0dHrk4ws=; b=XgXLbTj5DuJn5221VZ9wTXwYSqipnk45LnvLyXxydOOFcNV5gPZjKrOAgwFbgV9i2L vYlwgBcSpvg5i5jkJcQURU2trdmr9TxJVhQFwO1IJR5FrCA8UNYmlWcjnyvUjT3ZfEXP 5DD5ldw0ORlvkAU4i2lpMx9RsO90SFDHypLTHezb51v/x5ejq2euHkaZli/CDphy7TaP zKNHJD8MYlhoKhXEA/B2Swxil9WGcLM/KLP39HvMjcIcT93wAfXwcnyZRUrmC5c6b7ye iyZKseIgzEgvfirQGsJh1/WekkiTb3yhvCO/c6pJic10CyoT/rXS4Olig5jcF8CqbWbc cUxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ohViZ2E6; 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 cw17-20020a170906479100b0078d9f02b452si1769948ejc.861.2022.10.27.08.53.28; Thu, 27 Oct 2022 08:53:53 -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=ohViZ2E6; 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 S236150AbiJ0PRF (ORCPT + 99 others); Thu, 27 Oct 2022 11:17:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236430AbiJ0PQw (ORCPT ); Thu, 27 Oct 2022 11:16:52 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CAE19A23D for ; Thu, 27 Oct 2022 08:12:35 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id v4-20020a17090a088400b00212cb0ed97eso1720247pjc.5 for ; Thu, 27 Oct 2022 08:12:35 -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=Mp2QfpZmO5rJfMt8DbZa9LapRBZkl3HjpYw0dHrk4ws=; b=ohViZ2E6eRNBzkcum8lv+yv3Xb9PIK0nq6PHrcKNIfEc1x0MYgivtpDV47ZMF8QrG2 WVYqtv3yx+RfaK+A3AlGqMVIkjg7GQVOkl5fQVhLNoaIRqfLj04BcdC50DzcQe16F/8y pHTHrAvOj9QShRVlzh/elVuIHQGRWFlcirF+gIxXYzSrNEOf1lHJ9hp53xFy5W8tkf7x aWiSmGDnz1dflJ7yaKybf4mOhk6+TIpuBLUP1PCwRAWAKLBGnsgDy58U6xQ5mgui4Zku ptWePwzoa0Tjfw8Tp3vfOBOCUPTveVEIbBguvcQVPeWHztGXeqhoJiHiAHfy+Dq4HU1a hfUg== 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=Mp2QfpZmO5rJfMt8DbZa9LapRBZkl3HjpYw0dHrk4ws=; b=PLx+o25a8GV+0CoKH3SoIlzP08697MAcAd34cwkCDCyloSxmwFcizd8yheM1bnoEGr 2P+HIRCW8VxJdGCmqsXYVWqImOfGRTTi9FYpFhqPDr0NvtOUxaQf2ApvcBDa7vxaa5Vy BaKaXdcQ5ha6rDkk2B1BzReCvehsBKyBg9rBNtVsOF/Yybker7jvCrvYrdQ4PIV2tzyJ xGc43+NuAKzQNAurnHlp8njZQckDJHUwW4JCbD1Oy+50r9wJfcWUahoYiDM4VqKQwLNa WcfLYZUouGqMFB32nlnaG4nhLc/IeNXZElhXwf80NOAoYiX6cUyNu+D4oLopUBl9zd0n QlAg== X-Gm-Message-State: ACrzQf3FrmvyajPURaC1boOFtPbcVDmQfy8xHjW9kEJj9A807P2MakjE pjoWklcm8sxyff99hQrWbMCY X-Received: by 2002:a17:90a:e38b:b0:212:d42a:c0a9 with SMTP id b11-20020a17090ae38b00b00212d42ac0a9mr10566845pjz.179.1666883547265; Thu, 27 Oct 2022 08:12:27 -0700 (PDT) Received: from thinkpad ([117.202.186.162]) by smtp.gmail.com with ESMTPSA id d9-20020a621d09000000b005289a50e4c2sm1287181pfd.23.2022.10.27.08.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 08:12:26 -0700 (PDT) Date: Thu, 27 Oct 2022 20:42:20 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: Shunsuke Mie , 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: [EXT] Re: [PATCH v2] PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint Message-ID: <20221027151220.GC76627@thinkpad> References: <20220922092357.123732-1-mie@igel.co.jp> <20221025142143.GA109941@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 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, Oct 27, 2022 at 02:35:56PM +0000, Frank Li wrote: > > > > -----Original Message----- > > From: Shunsuke Mie > > Sent: Wednesday, October 26, 2022 8:43 PM > > To: Frank Li > > Cc: Manivannan Sadhasivam ; Jon > > Mason ; Dave Jiang ; Allen > > Hubbe ; Kishon Vijay Abraham I ; > > Lorenzo Pieralisi ; Krzysztof Wilczyński > > ; Bjorn Helgaas ; > > ntb@lists.linux.dev; linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: Re: [EXT] Re: [PATCH v2] PCI: endpoint: pci-epf-{,v}ntb: fix a check for > > no epc alignment constraint > > > > Caution: EXT Email > > > > Hi Frank, > > > > 2022年10月26日(水) 1:07 Frank Li : > > > > > > > > > > > > > -----Original Message----- > > > > From: Manivannan Sadhasivam > > > > Sent: Tuesday, October 25, 2022 9:22 AM > > > > To: Shunsuke Mie > > > > Cc: Jon Mason ; Dave Jiang ; > > > > Allen Hubbe ; Kishon Vijay Abraham I > > > > ; Lorenzo Pieralisi ; Krzysztof > > > > Wilczyński ; Bjorn Helgaas ; > > > > ntb@lists.linux.dev; linux-pci@vger.kernel.org; linux- > > kernel@vger.kernel.org > > > > Subject: [EXT] Re: [PATCH v2] PCI: endpoint: pci-epf-{,v}ntb: fix a check for > > no > > > > epc alignment constraint > > > > > > > > Caution: EXT Email > > > > > > > > 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 > > > > > > [Frank Li] why not set epc_features->align 1 > > > no alignment constraints should mean align to byte. > > It is one of the solutions too I think. But in that case, we need to > > write epc_features->align = 1 to all epc drivers, dwc, qcom, rcar, > > tegra, and etc. > > > > I think that my change is better. > > I think it should be based on what original term defined. > It should be fixed at where make mistake. > 1byte is the default alignment that drivers can assume, why do you want drivers to set them explicitly when they do not want any special alignment? I think this patch is fine. Thanks, Mani > Are there other place use align == 0 means no alignment in kernel? > > > > > > > > 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 > > > > > > > > > > > > > -- > > > > மணிவண்ணன் சதாசிவம் > > > > Best, > > Shunsuke -- மணிவண்ணன் சதாசிவம்