Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3165276rwl; Mon, 27 Mar 2023 10:04:48 -0700 (PDT) X-Google-Smtp-Source: AK7set9D3bE5ebiO63e/vyp3JDUpdwTbwpPueVYsEVnKk6gj/zANgKXvCKmP/cKm94qL+lq6F5aL X-Received: by 2002:a05:6a20:3a89:b0:d9:b59c:d09e with SMTP id d9-20020a056a203a8900b000d9b59cd09emr11934156pzh.11.1679936688536; Mon, 27 Mar 2023 10:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679936688; cv=none; d=google.com; s=arc-20160816; b=SaMX8wTCwTRfmY2ShgKpLuTB8D10UTZrZjk9mJ45i4F+H42h51E+utBlIg/QxTmrp8 gH3N6wQ4rJy2dRPytHUk9+zeRBAKklrT7hioyyuOa3s5t2aCzaZkM+boaTLy1NJZTOgi ryAgxLvX0qQbAVylZyesHapYsKB1cPJ0Q5aka0EdFNcAxNJqwGYDJXVC4nYvIMDAGrk2 osy/bkbhBIxrwvvKNQspSFZKORRXlNY0sc8hWh9MAPEzPEAyfMggmY5ouy+3IPjYnvEO p9hPDLgtGssl5eG1m6m5e9vopDOTVs1C3+F+1DgTnI/rHnmu57oMerQIunHwRW+5g2Ge SFjg== 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; bh=+BgwsCUs7RbP8zBZYVR2rrZnBtf0tymNnZGWk0b3YHc=; b=pX9FFGrwGcVCg0U5YKrUXhhwG52LdLnVIHA6EpsFGteayFQ+hKLlISr+RW53OccKZR QtsS9Js2HySUHFeZZix+zJWwSfL/rWPjQIxA1I1NstsxhqyxsmFZJeIovgFEshhJyJ6k QscpK0D/CnMAUkdW1elOGHz0sz3FwwB+VdRUGLuA1jHOTAUSL85+ZjgcAqSDhRUdSyTC ZVXC9r6zxKNuWTg1LdzjHUyO8+UzT03VlFM/xQxgeV8jmZ8d0u47DKKrVhhjx6cB7xvD tjhg9/YZPYPSaWvVSAjqrSzQNHKeCSgbf0ffMmfvCwVY1pQrKkwxAZfniyjzQX9xDoGJ VLPQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c124-20020a621c82000000b0062ae6345c77si8014730pfc.402.2023.03.27.10.04.13; Mon, 27 Mar 2023 10:04:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232731AbjC0RCZ (ORCPT + 99 others); Mon, 27 Mar 2023 13:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232766AbjC0RCH (ORCPT ); Mon, 27 Mar 2023 13:02:07 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C753F3A92; Mon, 27 Mar 2023 10:01:55 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D6142F4; Mon, 27 Mar 2023 10:02:38 -0700 (PDT) Received: from [10.57.53.238] (unknown [10.57.53.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 932F03F6C4; Mon, 27 Mar 2023 10:01:52 -0700 (PDT) Message-ID: <15102094-10d3-b160-59cc-d5b9b93ae1b3@arm.com> Date: Mon, 27 Mar 2023 18:01:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v4 7/8] PCI: dwc: Introduce configurable DMA mask Content-Language: en-GB To: Rob Herring , Elad Nachman Cc: thomas.petazzoni@bootlin.com, bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com, krzysztof.kozlowski+dt@linaro.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230313124016.17102-1-enachman@marvell.com> <20230313124016.17102-8-enachman@marvell.com> <20230317182323.GA2445959-robh@kernel.org> From: Robin Murphy In-Reply-To: <20230317182323.GA2445959-robh@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 2023-03-17 18:23, Rob Herring wrote: > +Robin > > On Mon, Mar 13, 2023 at 02:40:15PM +0200, Elad Nachman wrote: >> From: Elad Nachman >> >> Some devices, such as AC5 and AC5X have their physical DDR memory >> start at address 0x2_0000_0000. In order to have the DMA coherent >> allocation succeed later, a different DMA mask is required, as >> defined in the DT file for such SOCs, using dma-ranges. > > I'm afraid this is not right. 'dma-ranges' in the PCI host bridge node > applies to PCI devices (i.e. child node), not the host bridge itself. > It's 'dma-ranges' in the parent node of the host bridge that applies > here. The core code will set masks (ranges really now) based on bus > restrictions. The mask for the device should only be based on the > device's limits (i.e. the device is 32-bit only). > > I think you will need whatever solution comes out of this thread[1]. Right, "make the allocation succeed later" is entirely missing the point of this code. The only reason we're doing that allocation at all is to reserve a 32-bit bus address. If it fails, it means we can't reliably support endpoints with only a 32-bit MSI capability. Using a bigger mask in order to successfully reserve a >32-bit bus address basically *guarantees* that you can't support endpoints with only a 32-bit MSI capability. Thanks Rob for digging up that thread; the original idea there should still be fine, but the alternative suggestion from Serge at the end is potentially even better for this situation where it's down to the SoC's memory map rather than the kernel config. It just needs somebody with sufficient motivation and resources to write and test a patch :) Robin. > > Rob > > [1] https://lore.kernel.org/all/c014b074-6d7f-773b-533a-c0500e239ab8@arm.com/