Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3687643rwb; Tue, 20 Sep 2022 03:19:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7opOi8sD+jIcY/v4HKyXGG2fuW4NR0R8Tf91v9ilNGh2yq2TPj2EYwYToBLCRRzTP4wL2P X-Received: by 2002:a17:906:4792:b0:780:d58a:6aa0 with SMTP id cw18-20020a170906479200b00780d58a6aa0mr12355492ejc.104.1663669167665; Tue, 20 Sep 2022 03:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663669167; cv=none; d=google.com; s=arc-20160816; b=leHsrdB5JSrMMDsMd2TajwNmX9vrlqgZ6ZiqFN9efEeSZKYbMwoozEdpVEMkDTKNc3 jzCHBWl/OdZhYx0Fm5xlCdYJ/pafSZlRNmXBdudrcq5B0cpRgoBcMDwPpqvO/iQ3U01P CHWPDvi6M2ESVH1jr7RVwdBAEY66PQ1y7RmeHKy9cChobeplkLpf96mKom1kxZdywJi8 G2Hziu7sktMmkShFSb+jxEUhNGytsQNqYEmYLNSkWcIkLdHiWUqcm+RBrUhBjowXHPcG 1oDjEBDtx7ooNhu9sSRm/oAMB9VxPow50n+T7P6pAM7Rq5oQJLLoScF3fW69GSpxxYct KS1A== 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=Kj8G7tQXp3dB2CskDYDfYJI+6PpZ7oU+0ic/ZP4IQy4=; b=nYfpxw421ph0lcZn0W6r2zyNjAr2oqPFyQE1BE07oNvwjZgC22d3lEyPNLzUsIL7Ot 25f6FRDjUclWO4O+H8biTXt6+8GtgvwzT3T1b1pjYyxOw7/5NDSFWUT1nE00Hzk9g8Sw 5LsnXrjnvSzuBqk5wfJ9kug49SY94OkpdilXS0HiyIhxYl4uNiL557xs+/B6r3OCC4hl pTbqkmeYV8tCnVqi6mgh/ijqUl3yUsaqbBWCsllGY2PQQdJIl15Jcf1A+v7oSkI+fe0z ZZg5EaxmcoUtYi1LyrhZZRrBGx99f9azoF30WHShRrtLPUNpCs0W7BBlHdH+74wNPg/R KxhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=VTTlqqsA; 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 i3-20020a056402054300b004480a02d5f5si1172877edx.252.2022.09.20.03.18.58; Tue, 20 Sep 2022 03:19:27 -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=VTTlqqsA; 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 S230142AbiITKOF (ORCPT + 99 others); Tue, 20 Sep 2022 06:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231228AbiITKNq (ORCPT ); Tue, 20 Sep 2022 06:13:46 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C51B6B8FA for ; Tue, 20 Sep 2022 03:13:17 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id o2so2902708lfc.10 for ; Tue, 20 Sep 2022 03:13:17 -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; bh=Kj8G7tQXp3dB2CskDYDfYJI+6PpZ7oU+0ic/ZP4IQy4=; b=VTTlqqsAIS6WArmTLHA68hWn7TJ4vlFNMWzhSyFGAYhOfla3D27i4EMKgcppiv4eO2 fnXiXx5JyOSyxf8pZa11wyl0A1bZaIlby15dkwXlzbTaRD7i1YMKKo8PUdVDVvvkdh1e mZhQgEj3rT4OGkPhmf85Dwla6Fsts7du69InDTEpiqcC43HftCmXlF545MstqA0/+dQF hZ05hv0ZUkGOO7Ul+VpjE+0ULdV41Jv99aqtPz0RXwmDV74ZItMF5v1onlDmb82AQsLO uJzfhh3l8GhpWSM6LkaSo02AhRVIUjQ66ghKx+WCL3vXLVX22CEKJAh2Sp//c3JHE/st 6HbQ== 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; bh=Kj8G7tQXp3dB2CskDYDfYJI+6PpZ7oU+0ic/ZP4IQy4=; b=TqiOlQGwAbEADU0H0yJQ2sZQdZPm1T+flUe6V3AMpG4Q/O/vuaEGGXcQM8jyDEVwdV gCRuSavvYIOwNkLOlFYNcFpzEsimf0AMP5UPwBbCi6qDGT9GgJgBRTnmDGsVJtY7Gw4M ZOLjHxvzEKlL5ySdHwTzC0XgZxyvlZqkCdDygf5bqoQ3qg3HtX+S/HHlaJUGbXIWx4Bd NIm7ZStRv7YwWp61st6GrTBgFdXCjnen9PvZ9CmRbu2DaU3JnOJsmJy41StmQMkRLbOx kVgJxAvGYyJLpidI0gPbGJz0q4eVgX6C1yrBJrVmzvcsZszhs7/B6Tpr+yuweuFjhrYb DAtA== X-Gm-Message-State: ACrzQf39fTn2sueo9su3kAZAGHf+Uhw7G9ys4E5YCcmdbcjkD1tFTBIh p5HYlEjYxOcKYlo3FOPFpJiJsUpk2v/iPjcHjPcDcA== X-Received: by 2002:a05:6512:3183:b0:498:fa29:35fe with SMTP id i3-20020a056512318300b00498fa2935femr7658789lfe.523.1663668778693; Tue, 20 Sep 2022 03:12:58 -0700 (PDT) MIME-Version: 1.0 References: <20220916075651.64957-1-mie@igel.co.jp> <20220919185545.GA1022691@bhelgaas> In-Reply-To: <20220919185545.GA1022691@bhelgaas> From: Shunsuke Mie Date: Tue, 20 Sep 2022 19:12:47 +0900 Message-ID: Subject: Re: [PATCH] PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint To: Bjorn Helgaas Cc: 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 Mailing List 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 2022=E5=B9=B49=E6=9C=8820=E6=97=A5(=E7=81=AB) 3:55 Bjorn Helgaas : > > On Fri, Sep 16, 2022 at 04:56:51PM +0900, Shunsuke Mie wrote: > > Some pci endpoint controllers has not alignment constraint, and the > > s/pci/PCI/ > s/has not/have no/ > s/constraint/constraints/ > > > epc_features->align becomes 0. In this case, IS_ALIGNED() in > > epf_ntb_config_spad_bar_alloc() doesn't work well. So this patch adds t= he 0 > > checking before the IS_ALIGNED(). > > s/So this patch adds .../Check for this before IS_ALIGNED()/ Thank you. I'll fix these. > > > Signed-off-by: Shunsuke Mie > > --- > > 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 e= pf_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/pc= i/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 > > Best, Shunsuke