Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1636259lql; Wed, 13 Mar 2024 04:10:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVy8zC9LRM/LY8YxzTcWc+yEcITlhhHI4JogXvLsQnk+xFAEiBXrg7EKthC5bNSdMKorL46k4Xi9tAi5aRrFCPU7jcqSSm+g+yDlcJzHw== X-Google-Smtp-Source: AGHT+IEiRzhBLHI2NK8h411zrEMGjvgPRyNnYi6WQXlzPFrlp0FTRG9qX2GB4gZuQlKKZ5TIMj/9 X-Received: by 2002:a4a:d285:0:b0:5a4:2042:969c with SMTP id h5-20020a4ad285000000b005a42042969cmr1025061oos.2.1710328243795; Wed, 13 Mar 2024 04:10:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710328243; cv=pass; d=google.com; s=arc-20160816; b=aDwT/ndfTb8kDy2tBeYdawRxYxCMVFMNhjkdBvkRuXFV8xHj6j3YCEdr17tUNHNrUi w3ygw8+v3CY3bYb9ttFAMAcXLq2JpoY3XwmwDEn3myG2X++CC/GlHNzj2LiZgHj46q+O H/RXEMjyxXx39waFSEteKECtByYUEN2IiF070tRK9VL4Mi2Blclk4C4rylBQDtTs6jKQ sxxrbVxfRA2xxq4s3+eTRYkESpLEsq5DAltKFjeB108sWgUo5r9KJkFhTuecm99ERM22 8wv2rYIM7BFtKheZjKiDaA6y8aAk+Te/T0ayDbNAwUipVV9ThnxE7j4bV9PK5amF3ev+ 6S/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2cmo23fkk99zl8FV2GzgInag6OESLA8OTm/1P1yUfQM=; fh=djbmGzfhOIBiEuIjiKixjllJVwXQyvxW0/7rVR/Ty4o=; b=PnaFtWm8bFNv5uxmPC5A+sa/EBTXZsWohAAGxZWR47huAFnu5oiqnOe6EfZAM2OOGW rIwiuyWte6L5nBVn6yweLDSak0+raoRvyfmFkUPnotCZnUOZo9Ma9lPxtdwbGpEcUc8i 9vjf2FXuKUoX/qAcQ2CobEZnlKOJPVdlUpM1p4IRYtRPt7q81PLjCr0SxTt1xIwJUktz M8r/t4dUSpUn9l+JCZGqBYM6R8DHeBf9dBZB1yqPE16XQR+LiasvaSGTg1F9h+6R0tHp HAaVOiw7li/sUoTCjf0rNvaC2L6pO7KnT/6Fz3P5dUymY2Bc2l3YJlLE5l6aoG2UCmK5 GUwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="N/Ctlpie"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d8-20020a05620a158800b00788279f0097si9448868qkk.626.2024.03.13.04.10.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 04:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="N/Ctlpie"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 81EB61C22B52 for ; Wed, 13 Mar 2024 11:10:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8664F4644E; Wed, 13 Mar 2024 11:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N/Ctlpie" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 902DF3FB28; Wed, 13 Mar 2024 11:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710328150; cv=none; b=EQQvhpd8vxU08M43rU62MZMEcCWONhsH6hFgXgm4sPi99NMaWY6OBl0WfgWiIJVXwQv2e9pNDGCk46ACNOCsLw7dyzBGBCfdvx0wBH0nIWmo62ko441FoxtLjKNjcpHit33M6dnbxJf2aERvQV5Jte88Xsg2sCjBjuwsGLzCnnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710328150; c=relaxed/simple; bh=+7KhbQ0r4aTSlFz/9H9ebVTA5rD0wSrH9ITpUsZtlHY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J8iWNqhkQgyAY44/FT48955Nhwj44Hdl38RoqQCCZaQvT6s7JJrgMGQYbuNUBajHYa6lJa9AkHr6x2/moZi3IYMaGNs+mWxfQLVTsOPkePSGScVC3E3RyesRKAIHeuBOyoROQq3X2t74Em92igY9YbQ8cNCGrKtJLcEqz2O+lqE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N/Ctlpie; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B5F8C433C7; Wed, 13 Mar 2024 11:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710328150; bh=+7KhbQ0r4aTSlFz/9H9ebVTA5rD0wSrH9ITpUsZtlHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N/CtlpieknVFQYr4x2MZ3ye177KlniREQXVlwK8NkYauHntJt+8KndE+A0q9c0oh1 OiyApAA9yuQJU0b410kl3Mxp1LDyqdaE97Ba/iD4JzeB1y/309LtwffLJPFqDy4VhI 6hHlAST9iBjsNn5+aO/SnGOFeBgCtR4j8kh62DzImjig9hmBJL1GRQAgrRlhxuNayU NoJ8oMUmRDtvPwSEg6rF1VI/ex1LrEKi6hNMZ6nu62jL015I/g80xOUcQ82H5As1kJ M6vG9juryrDQlkF8LevmX4oEVzatxs+gzKCW5RKfR0I5+52iitsQZgikBDyXx3nPGy L2/9UrwmAEH/A== Date: Wed, 13 Mar 2024 12:09:04 +0100 From: Niklas Cassel To: mani@kernel.org, kw@linux.com Cc: niklas.cassel@wdc.com, bhelgaas@google.com, gustavo.pimentel@synopsys.com, imx@lists.linux.dev, jdmason@kudzu.us, jingoohan1@gmail.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, Frank Li Subject: Re: [PATCH v2 1/1] PCI: dwc: Fix index 0 incorrectly being interpreted as a free ATU slot Message-ID: References: <20240304224616.1238966-1-Frank.Li@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240304224616.1238966-1-Frank.Li@nxp.com> On Mon, Mar 04, 2024 at 05:46:16PM -0500, Frank Li wrote: > dw_pcie_ep_inbound_atu() > { > ... > if (!ep->bar_to_atu[bar]) > free_win = find_first_zero_bit(ep->ib_window_map, pci->num_ib_windows); > else > free_win = ep->bar_to_atu[bar]; > ... > } > > The atu index 0 is valid case for atu number. The find_first_zero_bit() > will return 6 when second time call into this function if atu is 0. Suppose > it should use branch 'free_win = ep->bar_to_atu[bar]'. > > Change 'bar_to_atu' to free_win + 1. Initialize bar_to_atu as 0 to indicate > it have not allocate atu to the bar. > > Reported-by: Niklas Cassel > Closes: https://lore.kernel.org/linux-pci/ZXt2A+Fusfz3luQV@x1-carbon/T/#u > Fixes: 4284c88fff0e ("PCI: designware-ep: Allow pci_epc_set_bar() update inbound map address") > Reviewed-by: Niklas Cassel > Signed-off-by: Frank Li > --- Any chance of this fix being picked up? Kind regards, Niklas