Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2429837rwb; Fri, 16 Dec 2022 01:48:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6OnoJbW854u0wMuOad6PVnnLKrWAziFVQE4mIXoL2WOOAT0ivbLXB0z5uesDTWEgww2oRf X-Received: by 2002:a17:906:15c2:b0:7b0:8617:2ce7 with SMTP id l2-20020a17090615c200b007b086172ce7mr20036931ejd.19.1671184100956; Fri, 16 Dec 2022 01:48:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671184100; cv=none; d=google.com; s=arc-20160816; b=VBV4f7l04tqTzkpVn3qs2Aq/LHqUav7Kp9/1lQBfpLXyiBBW4pqRl2bN2CKVGoDELt 2TaZzkFk8Fr/7kMfQXdAsbI0OxMpcNFaiB6IYeFGxPYQdH9PHpikzwVU8GWl+esD18rR GXC71G+xFOpCg/MEziU3uAAojcF1i6qRecqXDmD3cX+FuACsjLhamaduIUARq+QlYLfl Q8Lq0Z6uwUL4I2F4a2mNSlLfw6gyC9KCDK7cQvErAKcqohGePn0OUIVA6+dqQ5GFJJk0 PgJWUWFlsJIz4rtIGnh6hIq920gP5qH0B504mb26T2T6otxB7Oo8QFvXwrWdJRFpMZWo oe4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ajS60FHCOraRSy8GVeM0KvjRVHlpoPWjTxbDEzWh1vs=; b=v5BdsqcJNYY1hJLXdE9W2Td/pNQ7d2s0e1uRj87RGi9WN6Z9Y5xwUVJapcNeuT2Gi0 i669RrHOh8OZYoylbXE67ddbPdeIuB9pGu2O5Q3Zy4Va3Rf+a6hpY7Xpb+JvFI7H7PfJ YNaZRWjJdM2cjqH8+eaFM/omTKCactZ0iomQD+LyVL3OH57kZ7nbd0dOBWZS8ZfRGVLc +hzJ8jryIdKWBX3Vwb3Gwzs0UEMp/uQXNZwFOyfw6Qi5PLcw54DAAuSJR/CZefd8v04C ZkPCJvUBPKuO4miqZ1Td0YvGCJYNvYzr+x4GArr8ZfjegZZHyi5S4GucdyTP0wjwFA9t c4Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eL9aRNvc; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a1709066bd000b0078d9be7f100si1654552ejs.852.2022.12.16.01.48.04; Fri, 16 Dec 2022 01:48:20 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eL9aRNvc; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230158AbiLPJeg (ORCPT + 69 others); Fri, 16 Dec 2022 04:34:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbiLPJeb (ORCPT ); Fri, 16 Dec 2022 04:34:31 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A163527B16; Fri, 16 Dec 2022 01:34:28 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id g14so1536829ljh.10; Fri, 16 Dec 2022 01:34:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ajS60FHCOraRSy8GVeM0KvjRVHlpoPWjTxbDEzWh1vs=; b=eL9aRNvcRFyAvtODMuo8DH3M6KHRE3k7BVK4DcKbTnv3i+zndzEpu0+f4FOs+QtMfT xxCuOQa2fRmo3BjQgl8UQFKCY3CWR0MWISiG40LgWuF1HKTdLqURz0SP7NJ0OIB6H8u2 3l+38eLpf5vEN1o9YOq2OCr0qGYfsd340mxszFMYwZQy/aWcvwmdZxW/YXYvO/TQDV9s AIKxz1FHytsy06LGH+fWsECA09lwk3c5hCWEk9n45fm22+ebtFgERO3I3VaUS6zRsgsZ Avy5AwOAg+LygYI1D1OWEElF6S2ItA+L4BIeUrBiyZlKvtHekMwLbF/ZY3ZIVQd2JJba fKyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ajS60FHCOraRSy8GVeM0KvjRVHlpoPWjTxbDEzWh1vs=; b=iacemoKEQ62fgJ5QD7LMaQSGjU7RrerFB5jNtqdeSr7t/J2QgXKoigCo/NH+BIwEjg tzk8zmZyXA8W+ixwssJ0O9389O1J9Q1jAIiZ/o91SEZJJKK10j/FNp9Oui5mAvfd4D0w uUzkIR4Xsv3k94bLXmETiJBC6J2H8AZ9epQzbwZWFpVak8OLWINbaAvf3Us6YLpGhXIj vEcCNJEZdQiYs2XtpRGEzYQjdJZ5bDLOEInfmysNgl8LKPJFfsONovmQQwhWB/Qm2kkz Wep6QF17/Hoq5dryhIqJ8QbOg593d0YXZ+zaQ3LMJ2eBgp9ceEMjOMAdsFv7wTlIq9kr ha6g== X-Gm-Message-State: ANoB5pl5xcslIqRvy+2wPokkHX/S64CPBVWvoeRS+eR9RyajjFg+JAM5 4+zixG/Lli+jKM20eNLNXfI= X-Received: by 2002:a2e:a90c:0:b0:26f:db35:2e93 with SMTP id j12-20020a2ea90c000000b0026fdb352e93mr13448674ljq.5.1671183266880; Fri, 16 Dec 2022 01:34:26 -0800 (PST) Received: from mobilestation ([95.79.133.202]) by smtp.gmail.com with ESMTPSA id f26-20020a05651c03da00b0026c42f67eb8sm109335ljp.7.2022.12.16.01.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 01:34:26 -0800 (PST) Date: Fri, 16 Dec 2022 12:34:23 +0300 From: Serge Semin To: Christoph Hellwig Cc: Robin Murphy , Serge Semin , Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Cai Huoqing , Jingoo Han , Frank Li , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Alexey Malahov , Pavel Parkhomenko , caihuoqing , Yoshihiro Shimoda , linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 23/25] PCI: dwc: Restore DMA-mask after MSI-data allocation Message-ID: <20221216093423.4bettdxisserdzsh@mobilestation> References: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> <20221214235305.31744-24-Sergey.Semin@baikalelectronics.ru> <20221215092721.tvz3hpaql3kotgnu@mobilestation> <07ec7610-f1be-9b5c-416d-17781a22427d@arm.com> <20221215235218.wsuwy5uckqfxjnb6@mobilestation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Thu, Dec 15, 2022 at 11:39:41PM -0800, Christoph Hellwig wrote: > On Fri, Dec 16, 2022 at 02:52:18AM +0300, Serge Semin wrote: > > Got it. Thanks for clarification. I'll resubmit the series with only > > the streaming DMA mask restoration. > > Note that even for that we need to make sure there are no outstanding > mappings when you change the mask. > What about instead of save/restore pattern I'll just change the dma_set_mask_and_coherent() method with the dma_set_coherent_mask() function call? It seems cleaner. Like this: < --- a/drivers/pci/controller/dwc/pcie-designware-host.c < +++ b/drivers/pci/controller/dwc/pcie-designware-host.c < @@ -366,10 +366,10 @@ 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)); < + 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"); < < msi_vaddr = dmam_alloc_coherent(dev, sizeof(u64), &pp->msi_data, < GFP_KERNEL); Thus the platform-specific streaming DMA mask would be preserved. Since it's PCIe then having the streaming DMA-mask less than 32-bits wide is very much improbable. Moreover DW PCIe AXI-interface can be synthesize only with one out of two address bus widths: 32 and 64. -Serge(y)