Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4004618pxb; Tue, 17 Nov 2020 08:56:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYaTXh8vj8XDT5xn7z9kvXiKA1p4C62FK0WMwXGEtnATLzkVRX+E91btLTLKv7W50bo3Bb X-Received: by 2002:a17:906:854b:: with SMTP id h11mr20661182ejy.273.1605632165781; Tue, 17 Nov 2020 08:56:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605632165; cv=none; d=google.com; s=arc-20160816; b=zU9xATmjZBF0k6PZA+3KmB5vpPZx8E9aqKk9GyArlvS1FZoMk8QDW7NjAB23GzLOaL 4f91MmtQ3KAEI4q6UHDl3ysKcZSnoGp0+soSQ19NzeMoZlT2cUKNBRFm/FmvbEPj0qMY ubuw3LuFcQpANwHepyilJuLXVAqYJVVXTNp+EdRqVe5W1kI6tegDiKxL0RiZrjlCrdaE y1DRYWnhBLt7QuStR577rZqvotikyS77kJR88fiRQHHyGTniZsrfe4BF0wPIvyi57B8l au1dGv3wD3fC627x/Dl/FT6VP70C/NeVMTAqxqwCvC4K/OAFU0iXvb2wRic8WFHFwLRw XDxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version:message-id:date :subject:cc:to:from; bh=y6GQXycgh+Z2dqDNkgy3czX9p4aDC7PVHnEjFtMGryM=; b=XqtSVDSM7WgSfUiQVs84Dshs82JHysWdwFog77BL3bTBFkhMyJF2DvE8fVMLTdBw1V AvehHQUVOGRJNQoA6t6Y3ouFsSuVeyp2FD9K/N1O7azienxfatdcBe71Kowcvj60rKwt B+5SgduQ6OJ+9i8RPLTfDKD3UbP5JdFkvZgCGz8bIr8nY9ZAKLepOlGbPpq9zb26JlfX Tf1COriYKJVicEXY3Xl2afzsbJBDYojf4b01G8ykQB/rdIuxDQ6CRcrrtGU8OyeEOKEm DEXIbA3R7zVbZycp7WId86U9fsCKB4sCG659+3kwJXaLe72GDZ3eYtt4Hl1reeBGNz9D WzCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=CRsFpVop; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si3513257ejy.381.2020.11.17.08.55.39; Tue, 17 Nov 2020 08:56:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=CRsFpVop; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727070AbgKQQxV (ORCPT + 99 others); Tue, 17 Nov 2020 11:53:21 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:9542 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgKQQxV (ORCPT ); Tue, 17 Nov 2020 11:53:21 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 17 Nov 2020 08:53:12 -0800 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 17 Nov 2020 16:53:18 +0000 Received: from vidyas-desktop.nvidia.com (172.20.13.39) by mail.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Tue, 17 Nov 2020 16:53:15 +0000 From: Vidya Sagar To: , , , , , , CC: , , , , , Subject: [PATCH] PCI: dwc: Set 32-bit DMA mask for MSI target address allocation Date: Tue, 17 Nov 2020 22:23:12 +0530 Message-ID: <20201117165312.25847-1-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1605631992; bh=y6GQXycgh+Z2dqDNkgy3czX9p4aDC7PVHnEjFtMGryM=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:X-NVConfidentiality: MIME-Version:Content-Type; b=CRsFpVopn+0hALteMxwuECRqtiLtDbdmWOYD4hAcrZbKZzyq8yYio9Dun6pjhs0Zq bZ+UgAxLlC2YG3SdulHPCYhzgBkGAfR1PQ8wHG1d/DbckIZdHDM6g7UrwhS/ICtuNZ LG/Z4/ECFnEPHjlRwgE5Pu+2+bynVsEkpWFVe1o2RTOIuyA6VITsvBYTnPhFodTI/A rmj1LZ+Cvm4hfss7hYzmudbq4Re1xQpeRWZQuz9C0sRnhScNnJUveiRiJf3lBvYrk2 b+OyJKDG2+lG0thbfK87/8lYuh8QW3SgH083ac6gH8+kD8WLpgI70AHoCd+o4bfa5+ MARqaQKyfLLHA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set DMA mask to 32-bit while allocating the MSI target address so that the address is usable for both 32-bit and 64-bit MSI capable devices. Throw a warning if it fails to set the mask to 32-bit to alert that devices that are only 32-bit MSI capable may not work properly. Signed-off-by: Vidya Sagar --- Given the other patch that I've pushed to the MSI sub-system http://patchwork.ozlabs.org/project/linux-pci/patch/20201117145728.4516-1-vidyas@nvidia.com/ which is going to catch any mismatch between MSI capability (32-bit) of the device and system's inability to allocate the required MSI target address, I'm not sure how much sense is this patch going to be make. But, I can certainly say that if the memory allocation mechanism gives the addresses from 64-bit pool by default, this patch at least makes sure that MSI target address is allocated from 32-bit pool. drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 44c2a6572199..e6a230eddf66 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -388,6 +388,14 @@ int dw_pcie_host_init(struct pcie_port *pp) dw_chained_msi_isr, pp); + ret = dma_set_mask(pci->dev, DMA_BIT_MASK(32)); + if (!ret) { + dev_warn(pci->dev, + "Failed to set DMA mask to 32-bit. " + "Devices with only 32-bit MSI support" + " may not work properly\n"); + } + pp->msi_data = dma_map_single_attrs(pci->dev, &pp->msi_msg, sizeof(pp->msi_msg), DMA_FROM_DEVICE, -- 2.17.1