Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2942634rwb; Mon, 19 Sep 2022 12:21:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OfGd9k96R2c6nrgc3dWTD8B3nMutdYY5RtVymd4l3Y2x+Avf0zWGRv+w/LiyZUe1YcotJ X-Received: by 2002:a17:907:7209:b0:780:33b4:43a5 with SMTP id dr9-20020a170907720900b0078033b443a5mr14101392ejc.547.1663615296971; Mon, 19 Sep 2022 12:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663615296; cv=none; d=google.com; s=arc-20160816; b=pcaSO7ijyh6vLTnbOrwlfhzLvZUzlJcAxiEyesO8dxLP0C8Z5AL1mExHOj6cIWm7RB MVRIND6Q1sMjfJaHn0rCfiDJarF/l5cNv7719DKJgKHnmWXpS1g9sG/hFLqAqTfuh88+ c+IX0jLDsMWbB+YiJpIxPTxnxucaSDQ7lnD4D9A7lv8rklL24f1FIR47mNFHQJR3WsYz Or8PbtQ/JLUqaNk5Kh5/tH3M0PQIQMNG3iPC3Xp/cYVLfQVTkZm+4Aw9KqZqt4zwgG0l SuEOE5MfVHb4MbiFF302kPxraez+nRk+5x1PyOb5PA7LCYwEA0bFXUP0JE5lsjbwVEmv VoxQ== 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-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=HdxNxboerImkxps5GOcwmr/GEwk+GsTAaR1BKWoYfGQ=; b=njNC9b1BYHE/woA7RXjxJ20Sc0NJJ32SQo5XxGysvhztvV5rNF5u3Dl8vVn39rjtbe tuyDMAOyTbvI2TZHc4MSyNkmU/2YhNvoqM/4LzHgAfRfEbR1nUAsgrHTLCFXvcZMNR5U uC84+++Va+XoaTxO67IPB2mXaqT1MFmNguomub6MZzeqpqeeZvFtkR8MjsHh+rH5FzKi b8HYtU0bQX5i+Ng8PRARR/lmQuo5QZbyuP3nK0x7/zTz4DAy/Ek1XPITyoOJrXACWMCs v4Qwgh+eh0zI47m56UfjMhXsiCR0X4oZafYxV+ZSfDxK3aMhFmazfSgu2qRJS2+8q3X2 Z39g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OixGiX1z; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et5-20020a056402378500b004543cc9a998si2077013edb.76.2022.09.19.12.21.11; Mon, 19 Sep 2022 12:21:36 -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=@kernel.org header.s=k20201202 header.b=OixGiX1z; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbiISSzw (ORCPT + 99 others); Mon, 19 Sep 2022 14:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiISSzt (ORCPT ); Mon, 19 Sep 2022 14:55:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 536853206E; Mon, 19 Sep 2022 11:55:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB11661645; Mon, 19 Sep 2022 18:55:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F31F2C433C1; Mon, 19 Sep 2022 18:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663613747; bh=fxrYj+SlLB8t+pk8TjlywB7jE7G0jb9b3YEkADAG/Ec=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=OixGiX1zzOPN6mg3SiNe/k4cJRLOWMGwkieahZOLsfsrCkX4AX8ynTYtSeFmCP1YV ULh+5dCXo7x8HesmJd+khwvtQjWAazHTShDy8f39YCgtl/rRW5L4V6l2mruz8EHihR xsL5+HdBLLodjHVIqj2Wn3ae4Nq4olM2qX1YIjcab6vtMlplW3esnBDffyLnqE0BIj MrtPpt5o+Vs60Lf3i/hQh5WJ9AVw/RDuHdKNsb5nfzRrjqbhLf0d+l9UmbvdWJCrJw Q4A5+O2yy+Tc3OZj7V+NceumqmbVeFkaESP36M36Q0dDPj/+s7Uz3W3LCP17QYSiC1 43xrkM7aciy5A== Date: Mon, 19 Sep 2022 13:55:45 -0500 From: Bjorn Helgaas 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] PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint Message-ID: <20220919185545.GA1022691@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220916075651.64957-1-mie@igel.co.jp> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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 the 0 > checking before the IS_ALIGNED(). s/So this patch adds .../Check for this before IS_ALIGNED()/ > 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 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 >