Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1189007rda; Mon, 23 Oct 2023 05:32:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdgazbQA4wBKcszDxVbIUUrOSZMv3EshOLeUTK3SIw7xxf0wRziv/62tO6TcTHMgHdmM0r X-Received: by 2002:a05:6a00:1817:b0:68e:3616:604a with SMTP id y23-20020a056a00181700b0068e3616604amr12960869pfa.8.1698064358598; Mon, 23 Oct 2023 05:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698064358; cv=none; d=google.com; s=arc-20160816; b=wHtEHeqDTHZLZzNK9zodQy2NGKtJ2jTLsSW+qVoZ1Nfz/+F4tcxNCpWeqePC+xDhZC WjhmsljJ63FzkJ9bOMbIEAqhWeTf3TqwXv/KZdhqZUDJiu/lSPlpWlZelXSN8feOYMCm GQsi6WJnXPcIPVcVa7bMbjM37Zzf0Y4Mdd+3tkyQ5WeaN4gWcmN4Vhc9IXz79yq1f9Xj igQtS2vqO5XNdchjLXDLEaMbjKvmi78TmKhl2IgNzSTPPcQ0N9rh5utiYmDifbVnPFXe 3icQVT2+90SObz/t1fUvNxGFo/KEK3juiAICXdm4EZcdzNScA2WU4YJTlelU1Bbwk2qB SA+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=AoCiYIeyEalPqnQyShutzx/Ogt9yQ8iWlYuMSr1HCSE=; fh=Ku8ZmUKTVWG55ERSORVSoxPUlPWm0b74FWz0vPXFypU=; b=LNKC6jgGs8P2JOD5MphYYCsTLMHIuM7f0/7GiIf1SwD7IUXPQf/nwRKCv7OesuPTDn XPd/kQkE3VmftaNQgNwA10+BOWEHY7hYZua7xNExrUMba0hVVll/zuaviURl/jgJ+BLx FR+mL9iv1VK9OlbXMEYpvppmIGhyklIfGw+CpMalM+ZX+JfCsv+e78X8QbCtV3KqxPxM //4cgGXctuJ7LXr611cVGlaSg4ANfLTDT6l+YIqIH///EfqM+zIXGgSe9LUVc8KbLtLz Z91vmCv8jsNo1dsZVQogpHh6DxIJL94r+0vE683+draU7hUgNLervs2QfEv+NtYUuLip rJCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=O7yHD1EX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d18-20020a056a0024d200b0068fcf6fe22esi3564266pfv.306.2023.10.23.05.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 05:32:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=O7yHD1EX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E9577803E782; Mon, 23 Oct 2023 05:32:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233131AbjJWMc1 (ORCPT + 99 others); Mon, 23 Oct 2023 08:32:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbjJWMcZ (ORCPT ); Mon, 23 Oct 2023 08:32:25 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECDE4FD; Mon, 23 Oct 2023 05:32:22 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6E3BC660576C; Mon, 23 Oct 2023 13:32:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698064341; bh=SIvq/58J/JQ/GQJV0oLXY3FnJr23e8bcn2ZfaD3CmaA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=O7yHD1EX1vypBDQI/NxDiFvuZ4e0IVQY3xEquFeKZIGxgYF+uug0FBoTm+nSzJy2f FttANybDeMKWUPai5H0ahBwIMEbAHjFMuIR2wKeP/XA8qb4BmvFpRYp5O7j7LaDX0Q FS7DNx37piD6OYxtS74fNFjjHuBisD9GyL9m4g6Slm/5mt1Z8z/ZFnBWrTCGwhtF8G wCgc6GjrZoYnf/C9gChbxWqgZ/M2mZnIp89/cQ82NAcOUEeBgFVu8ROCMc3srcmTux 2MAoIsFz1O29WtZryapS8eY7aNyO1yjYOdIcwitsx5l04GKD0xybdpduL2L/PsMwPK Bf869hp+djAbQ== Message-ID: <304abe7d-ab05-4190-b6e5-563525cbb756@collabora.com> Date: Mon, 23 Oct 2023 14:32:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] PCI: mediatek-gen3: Fix translation window Content-Language: en-US To: Jianjun Wang , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Matthias Brugger Cc: Ryder Lee , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jieyy.yang@mediatek.com, chuanjia.liu@mediatek.com, qizhong.cheng@mediatek.com, jian.yang@mediatek.com References: <20231023081423.18559-1-jianjun.wang@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20231023081423.18559-1-jianjun.wang@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 05:32:32 -0700 (PDT) Il 23/10/23 10:14, Jianjun Wang ha scritto: > The size of translation table should be a power of 2, using fls() > cannot get the proper value when the size is not a power of 2. For > example, fls(0x3e00000) - 1 = 25, hence the PCIe translation window > size will be set to 0x2000000 instead of the expected size 0x3e00000. > > Fix translation window by splitting the MMIO space to multiple tables if > its size is not a power of 2. > > Fixes: d3bf75b579b9 ("PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192") > Signed-off-by: Jianjun Wang > Reviewed-by: AngeloGioacchino Del Regno