Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9437684rwl; Wed, 11 Jan 2023 05:49:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXuuj6VaG4rwSGBeRhrR4435/Jsa5zNrmkB0HJbEA4D6a//C09zwj17Vvdo48ZRXXstvGvu9 X-Received: by 2002:a05:6a21:e307:b0:af:7a88:f752 with SMTP id cb7-20020a056a21e30700b000af7a88f752mr90039329pzc.48.1673444998869; Wed, 11 Jan 2023 05:49:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673444998; cv=none; d=google.com; s=arc-20160816; b=icVJLTOGTSYyilrYfIacUTzL5LG0wD07l2qTn3w6LO9QZa26VX6zaDdvnfxtEXvnW4 p01U/0lYFM8TYx8i169a8zeTgp36iLYqpUzRW7GzfAKIj1umMMA1/fsMxbp5Bv/1QIea 3cS+MGfBKBd5y61cYsn4n/NOO5J3+PU3rCg7S2FxK+0OmiWmnQ8piCLESQSQI8zET3lR 4mPlcFuF7rFkzwlm4O2sPSXtsYZ+eF5BGXRhaxLwCfgYJDkn1Tc45RMUWO9/qnlf4I/T 6gi5w7cL796CfzoNOr6rW9fd9Q/fdvSsa8No9rU2tEv0OW58X0FJUCvrfOZHj+myj2JO 5c3A== 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=NM3rCOLLCgonwSoDiJq7t2oEfZVS3WGaVxdvAvEozRc=; b=xUnWNYaPcbz8opDz42P6aTX77VrKS1ZYHNNYCPlzm+7p9ev/LK6FWM2okaxIRpOrdz bjOkPl2sEeymDsHer0U4f+S2J+WgySHeV9E9aOZnGG9wxoC8hvHM13dc6lWRcq/xgGyx 5y0xnCyyOrdz+clbW9zWS3bVtEU+um/9kCWXAED0SmHKvuNPpzyJucMG5iSSaZjH19HT B2PY0P48EJyRiI7xSEI23KiLSq6/6wL/XvsxWeF/Qy2zog+jsgIKNDIkdtAC9Qv8JC7q NOXUHm8kWVH9PW8vLgGiT12AuMJxWk48A+zh9p2p8k/dufen8yC8euPeEsjgh7IGYpmI tsKQ== 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 n1-20020a63e041000000b00477cd382329si14841387pgj.56.2023.01.11.05.49.52; Wed, 11 Jan 2023 05:49:58 -0800 (PST) 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 S232824AbjAKNlX (ORCPT + 53 others); Wed, 11 Jan 2023 08:41:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235719AbjAKNku (ORCPT ); Wed, 11 Jan 2023 08:40:50 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 39EBB11A37; Wed, 11 Jan 2023 05:39:44 -0800 (PST) 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 00C9C13D5; Wed, 11 Jan 2023 05:40:26 -0800 (PST) Received: from [10.57.68.138] (unknown [10.57.68.138]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 067423F71A; Wed, 11 Jan 2023 05:39:40 -0800 (PST) Message-ID: Date: Wed, 11 Jan 2023 13:39:35 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v8 24/26] PCI: dwc: Set coherent DMA-mask on MSI-address allocation Content-Language: en-GB To: Serge Semin , Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Cai Huoqing , Jingoo Han , Frank Li , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= Cc: Serge Semin , Alexey Malahov , Pavel Parkhomenko , caihuoqing , Yoshihiro Shimoda , linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221219144658.26620-1-Sergey.Semin@baikalelectronics.ru> <20221219144658.26620-25-Sergey.Semin@baikalelectronics.ru> From: Robin Murphy In-Reply-To: <20221219144658.26620-25-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 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-12-19 14:46, Serge Semin wrote: > The MSI target address requires to be reserved within the lowest 4GB > memory in order to support the PCIe peripherals with no 64-bit MSI TLPs > support. Since the allocation is done from the DMA-coherent memory let's > modify the allocation procedure to setting the coherent DMA-mask only and > avoiding the streaming DMA-mask modification. Thus at least the streaming > DMA operations would work with no artificial limitations. It will be > specifically useful for the eDMA-capable controllers so the corresponding > DMA-engine clients would map the DMA buffers with no need in the SWIOTLB > intervention for the buffers allocated above the 4GB memory region. > > While at it let's add a brief comment about the reason of having the MSI > target address allocated from the DMA-coherent memory limited with the 4GB > upper bound. Reviewed-by: Robin Murphy > Signed-off-by: Serge Semin > > --- > > Changelog v8: > - This is a new patch added on v8 stage of the series. > (@Robin, @Christoph) > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index 3ab6ae3712c4..e10608af39b4 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -366,7 +366,16 @@ static int dw_pcie_msi_host_init(struct dw_pcie_rp *pp) > dw_chained_msi_isr, pp); > } > > - ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); > + /* > + * Even though the iMSI-RX Module supports 64-bit addresses some > + * peripheral PCIe devices may lack the 64-bit messages support. In > + * order not to miss MSI TLPs from those devices the MSI target address > + * has to be reserved within the lowest 4GB. > + * Note until there is a better alternative found the reservation is > + * done by allocating from the artificially limited DMA-coherent > + * memory. > + */ > + ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); > if (ret) > dev_warn(dev, "Failed to set DMA mask to 32-bit. Devices with only 32-bit MSI support may not work properly\n"); >