Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1629185rwi; Wed, 26 Oct 2022 18:48:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bqaHyETCVomErSXEQIg090RtXp2E3PoAuAmxiu4CvNpQxjzM7l6CNN7DqXP2Bk/6vmcuq X-Received: by 2002:a17:902:7b91:b0:185:4548:3a96 with SMTP id w17-20020a1709027b9100b0018545483a96mr7166210pll.130.1666835294630; Wed, 26 Oct 2022 18:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666835294; cv=none; d=google.com; s=arc-20160816; b=NXkDBvXDEwJff35dywCGh3iOpQx/A+vdFZtzwyo5jl1bFxbtKgT07hCvKUh9Q1Gk+c LGREGTHCEm/bNo16sXJZrWSPQ6CGOCbwIfbd3aNYgjuzc/ic/y0xu2XY/AqYqPr60T7r iNu/OGZ9uTejAsgT55Nsy2RZGo5WO3JXD7ftjk5vkJ3LKYu7hoe1U+oNhI37js3tmZ5l u8i58lgtCTwYXUp0RGy0XYc7DyHtYiQnypKOrwUOHXERMhlP/9e5j9fuvjbv0GfmQXVk Bq42mO95TSJ8dMPhZp05iS0LG7nbagX7r4RC7wp5JulYduk1ifIqui0ZM+MSEZKRZ/Ig Rirw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=tbk0eEYbnn7UKEVn0VjxKM1ZNInMpSiFCIPCtUXFOvs=; b=yKXdS9pWb2EBRxN45I3653AbZ7uhRLIkI6MgV9IHVgezge9uksEg8ljpyMDW2eYYRM 9qQqJsIO5l1ecYKM3+US2z1FeFb7LQqkyVkW/ApGZ56oaJ+B4Bns+l3DZDskBUYRJ2JD aUEwct9wpB+66Nt+aOwaa8Pdd7a5sKyJW7cgnUaoi3u4J8uqGtWDynLvReBuvAA3T9HG gV1rXbD/doXBsRd2Xuk9z3CzzvU48XYGkAHsyzSloJ3Qjg6Xc9e/jAlm3iO4BGNeBs4c 7OWMb/atbqlPDKDskk7MuG1W44Pnq0SK0skBarrFEiV7ldO3HfUN3KqwTFlsxx0zM26z EjTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=vcuEklMw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm11-20020a17090b3ecb00b00200acd39846si144541pjb.63.2022.10.26.18.48.02; Wed, 26 Oct 2022 18:48:14 -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=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=vcuEklMw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbiJ0Bnb (ORCPT + 99 others); Wed, 26 Oct 2022 21:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233648AbiJ0Bn3 (ORCPT ); Wed, 26 Oct 2022 21:43:29 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF64C12B36F for ; Wed, 26 Oct 2022 18:43:27 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id z24so183859ljn.4 for ; Wed, 26 Oct 2022 18:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tbk0eEYbnn7UKEVn0VjxKM1ZNInMpSiFCIPCtUXFOvs=; b=vcuEklMwyzYukZhXgOEh3NEm2Y2yZpbE0LQpHdGh6ef/G/JA5hh4MOdbOtCXt2HIez N4efK9tWJruDjEfO7wdMeQGUlPR0aZxqq+A7QySZgCJwHnN8UgMK8M6cK+zhfvVEsgPB 6Au7w+PZgloWRtYIORIzvH/fQV0XKsXGe6qOkDNtmekbGDTjW30ZUYXFHsBO6uEtunk8 u9By8xMiIfnkI35rw2zP10T1RGbNczd7Aie6P65nEjGBC98vkNTdjhGcc9x/7eiz6+xd brNmpfHoVTPQdUpjYUSuujMNaErYgMsI6V+Kf37Rx/6vAVxcj5X3uTwaAxPGU7PMZEaG PXxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tbk0eEYbnn7UKEVn0VjxKM1ZNInMpSiFCIPCtUXFOvs=; b=VjCBufDE2lHcgwTKyIj97h0NgFd1KSu/EZTTmQTCQ7SNF6VcLTvOqPWUjc+Q8xh3Jj YR4FLawWAmVuqtJQlObcvoPu4iM8h2BzjNJ+7OmX8juBwC/u0NarcMTpuGQ5BxCo4Nc5 kfHYiXfpAP9wD13yhlPrKeqWUYJlqRdYzplHJlUdyfltp7AVnkCaLEDrOXraTkFGD6Dq IAEVEGDmYznCmPd4+4DzcUuRMl1WdPEsloppdXUxZ5enPvBf0xCuxcUS1ELJpP7QHLyq epano10QgLaz4Qw5f58vxyp0KcimWh15tS1bQP5BJCu4nlIcDJq9FqTezXNgkAVVyeHl ku7g== X-Gm-Message-State: ACrzQf0bJJEz6IBCes8SZDftZ//824dXyY77QnqK6E8BfhGXHAqaSNWj eoOQJZOEjL7xaED6qwW9TXvnyJgWAk2B9FPRCD/f8g== X-Received: by 2002:a2e:8881:0:b0:255:7790:25e6 with SMTP id k1-20020a2e8881000000b00255779025e6mr17440388lji.525.1666835006300; Wed, 26 Oct 2022 18:43:26 -0700 (PDT) MIME-Version: 1.0 References: <20220922092357.123732-1-mie@igel.co.jp> <20221025142143.GA109941@thinkpad> In-Reply-To: From: Shunsuke Mie Date: Thu, 27 Oct 2022 10:43:15 +0900 Message-ID: Subject: Re: [EXT] Re: [PATCH v2] PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint To: Frank Li Cc: Manivannan Sadhasivam , Jon Mason , Dave Jiang , Allen Hubbe , Kishon Vijay Abraham I , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , "ntb@lists.linux.dev" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 Hi Frank, 2022=E5=B9=B410=E6=9C=8826=E6=97=A5(=E6=B0=B4) 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=C5=84ski ; Bjorn Helgaas ; > > ntb@lists.linux.dev; linux-pci@vger.kernel.org; linux-kernel@vger.kerne= l.org > > Subject: [EXT] Re: [PATCH v2] PCI: endpoint: pci-epf-{,v}ntb: fix a che= ck 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 =3D 1 to all epc drivers, dwc, qcom, rcar, tegra, and etc. I think that my change is better. > > > epf_ntb_config_spad_bar_alloc() doesn't work well. Check for this bef= ore > > > 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 =3D 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 =3D 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 =3D epc_features->bar_fixed_size[barno]; > > > align =3D epc_features->align; > > > > > > - if ((!IS_ALIGNED(size, align))) > > > + if (align && !IS_ALIGNED(size, align)) > > > return -EINVAL; > > > > > > spad_count =3D ntb->spad_count; > > > -- > > > 2.17.1 > > > > > > > -- > > =E0=AE=AE=E0=AE=A3=E0=AE=BF=E0=AE=B5=E0=AE=A3=E0=AF=8D=E0=AE=A3=E0=AE= =A9=E0=AF=8D =E0=AE=9A=E0=AE=A4=E0=AE=BE=E0=AE=9A=E0=AE=BF=E0=AE=B5=E0=AE= =AE=E0=AF=8D Best, Shunsuke