Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp958892rwb; Mon, 26 Sep 2022 07:58:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WyZGUT8WogNqK/7QbisFcqs3NGEF9hCOLJMcEzuzO5CbuJEzre3sVYiEYELpCam4hsdCp X-Received: by 2002:a17:902:b415:b0:178:2835:29e7 with SMTP id x21-20020a170902b41500b00178283529e7mr22720552plr.86.1664204301163; Mon, 26 Sep 2022 07:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664204301; cv=none; d=google.com; s=arc-20160816; b=v9OvRkqbqOgh7EPJ32olXYg7ngYKqDa7DBYgV5Mr2Dv66Np+4xAvUQPpRoiN9bfPoq 8e7DyvbjwjNtirwVhbx5mK3Mff8EfD0T+s6KbgJcUSKHePpkMs5oxA6ppJiLlqFyiwBr 8E4Rvi8qy9l/BlxGPA5jLovDXP6uQGdeimqFVTfgfw/etxPOziNF5LcFtQpnSM+QIPQ5 7iX8TZrw56Us/I4LDw3InI2USLd3lpiMGhpUoV9tR8hpYXXBNlfh/fAUJ0RZvjGsRGqS PoFz0ZkP+Y53t5Ou4e0EBSJTK4jKDM4mwC7HC5khF2UgiQmep6/GeF8zgMgxDyWXtnZl 7XLQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=cTSVmKgvJ8AToFNBrfLCiEqb7CoKdU3Q3pO1K+iGzEw=; b=Mb77wJVBafaY3j9K3WG7NfASojPg12xl4IduXFdvJP2TZr+LBOqZqkipD3DElXsKwI /QNciOQDTuW/TGahvg/NrWJKhbE8Qzs6y5zPMorLGjab95vzRkCLgd/SzZd6sKdX1nuM IJyTwYKa/qfIQ8osFFV/tm5ruPX4klb4VR37si5/bO116DqCawWjLsOqg4oQ4uWv07sk 5WTSYEqdVhHlxX2RjR5uj+TxZIVk+2lBibFr/u0devTwfwy1xU8tbgu4nxK+bubCVjuU zUjeOpQ3Iqk3n1rca0QutEY2+3jEjxAFnBt8HLgbY7Wq8GzZ/enRhQZY+5zXPE541LWO yZQA== 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 n7-20020a634007000000b00434aeab58e8si17559053pga.545.2022.09.26.07.57.38; Mon, 26 Sep 2022 07:58:21 -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 S234616AbiIZOqn (ORCPT + 99 others); Mon, 26 Sep 2022 10:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234625AbiIZOqS (ORCPT ); Mon, 26 Sep 2022 10:46:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 401DA51405; Mon, 26 Sep 2022 06:10:07 -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 837E31042; Mon, 26 Sep 2022 06:10:13 -0700 (PDT) Received: from [10.57.65.170] (unknown [10.57.65.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 232453F66F; Mon, 26 Sep 2022 06:10:04 -0700 (PDT) Message-ID: Date: Mon, 26 Sep 2022 14:09:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v5 20/20] PCI: dwc: Add Baikal-T1 PCIe controller support To: Serge Semin Cc: Lorenzo Pieralisi , Serge Semin , Rob Herring , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Alexey Malahov , Pavel Parkhomenko , Frank Li , Manivannan Sadhasivam , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, willmcvicker@google.com References: <20220822184701.25246-1-Sergey.Semin@baikalelectronics.ru> <20220822184701.25246-21-Sergey.Semin@baikalelectronics.ru> <63a54a1b-66ba-9739-8217-13f75e602cd5@arm.com> <98179709-1ece-61ab-d43a-fc38a4fd3f67@arm.com> <20220912002522.arx4vypiv363qcni@mobilestation> Content-Language: en-GB From: Robin Murphy In-Reply-To: <20220912002522.arx4vypiv363qcni@mobilestation> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 2022-09-12 01:25, Serge Semin wrote: > On Wed, Aug 31, 2022 at 09:54:14AM +0100, Robin Murphy wrote: >> On 2022-08-31 09:36, Robin Murphy wrote: >>> On 2022-08-29 16:28, Lorenzo Pieralisi wrote: >>> [...] >>>>> +static int bt1_pcie_add_port(struct bt1_pcie *btpci) >>>>> +{ >>>>> +��� struct device *dev = &btpci->pdev->dev; >>>>> +��� int ret; >>>>> + >>>>> +��� /* >>>>> +���� * DW PCIe Root Port controller is equipped with eDMA capable of >>>>> +���� * working with the 64-bit memory addresses. >>>>> +���� */ >>>>> +��� ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); >>>>> +��� if (ret) >>>>> +������� return ret; >>>> >>>> Is this the right place to set the DMA mask for the host controller >>>> embedded DMA controller (actually, the dev pointer is the _host_ >>>> controller device) ? >>>> >>>> How this is going to play when combined with: >>>> >>>> https://lore.kernel.org/linux-pci/1e63a581-14ae-b4b5-a5bf-ca8f09c33af6@arm.com >>>> >>>> It is getting a bit confusing. I believe the code in the link >>>> above sets the mask so that through the DMA API we are capable >>>> of getting an MSI doorbell virtual address whose physical address >>>> can be addressed by the endpoint; this through the DMA API. >>>> >>>> This patch is setting the DMA mask for a different reason, namely >>>> setting the host controller embedded DMA controller addressing >>>> capabilities. >>>> >>>> AFAICS - both approaches set the mask for the same device - now >>>> the question is about which one is legitimate and how to handle >>>> the other. >>> >>> Assuming the dw-edma-pcie driver is the relevant one, that already sets >>> its own masks on its own device, so I also don't see why this is here. >> > >> Ah, I just found the patch at [1], which further implies that this is indeed >> completely bogus. > > Really? Elaborate please. What you said in the comment to that patch > has nothing to do with the change you comment here. It has everything to do with it; if the other driver did the right thing, this change wouldn't even be here. Everything you've said has implied that the DMA engine driver cares about the AXI side of the bridge, which is represented by the platform device. Thus it should set the platform device's DMA mask, and use the platform device for DMA API calls, and thus there should be no conflict with the host controller driver's use of the PCI device's DMA mask to reserve a DMA address in PCI memory space on the other side of the bridge, nor any translation across the bridge itself. Thanks, Robin.