From patchwork Mon May 15 09:15:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13241006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71D6DC77B75 for ; Mon, 15 May 2023 09:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XZRYw/E+2b1j4bf5jYTm9vXk/07k2GIkOzbRS1UjgtA=; b=ccWY+gIjEmO7C3cjgjI7fcuR9g jP6+FX3CImehNq8mrQlwMVwsYOezeW3TE+xHdwgIkoUuWLWip3CnGNl81NxQ1Iqs25DiIiXUdeAa7 arll9hvbxUmdkdPAqVrea0w5SidmY1aFfNWQameJ6EWG6bxxtMUlvsQrHWrclQAQl/HmFqfr1Gzf8 nyq1f3YJ2m7Sp4L1t8VyZyDNfaCuqcZ4SpGKvNhpsIQR9r6whRpX+BvJkIKxnXFJTyaYLIxUDIBmF hXpZEL4Xt+OnHoNtOGX80oCxwOu4db97q91+QhffkjQKjHsRqxDuMBPYM+MC2P9wV4ypJK7F1MHda 1HzSdIEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyUKJ-001WZ3-06; Mon, 15 May 2023 09:17:07 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyUKF-001WVU-05; Mon, 15 May 2023 09:17:04 +0000 Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34F8xxw7018853; Mon, 15 May 2023 09:16:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : date : subject : mime-version : content-type : content-transfer-encoding : message-id : references : in-reply-to : to : cc; s=pp1; bh=XZRYw/E+2b1j4bf5jYTm9vXk/07k2GIkOzbRS1UjgtA=; b=Kpxh7+R0SgBWRyPiR3pp43jF6E5hBwZivqH29tFryUMUh6Z9+hD0kncddL1qLQXMueuI DIK+IhEqpNtklQp0lYRX8YYP7a9ZbgsJC4I2ocrV41MEB+7eGAo6SrxE8WRBFPJCpmku HnhgEvXGdV7Eea+6wGFVrGtLydHmdlSxSG2SbVEAFyAwmPuvGMOInz7nTIXwrcpM27XO S51aNd6mJ/5mHSbYx06OOJ/TFZYZN9lQ+ywzEddL1t6KWGsIYHqJ6kibGD3ptGQl3Doi dOSXwWm1Srt0VTv7BEjqnsxmNpObmDltbwoYPvn6y7uYhJKPVbFaYXeeCSxSHavvE0mf uw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qkhma8qtf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 09:16:45 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34F9Ehv8014120; Mon, 15 May 2023 09:16:32 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qkhma8qdt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 09:16:32 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34F98HBT007926; Mon, 15 May 2023 09:16:18 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3qj2650tgj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 09:16:18 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34F9GFGL42861076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 May 2023 09:16:15 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED1CF20043; Mon, 15 May 2023 09:16:14 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 185932004B; Mon, 15 May 2023 09:16:14 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 15 May 2023 09:16:14 +0000 (GMT) From: Niklas Schnelle Date: Mon, 15 May 2023 11:15:51 +0200 Subject: [PATCH v9 1/6] s390/ism: Set DMA coherent mask MIME-Version: 1.0 Message-Id: <20230310-dma_iommu-v9-1-65bb8edd2beb@linux.ibm.com> References: <20230310-dma_iommu-v9-0-65bb8edd2beb@linux.ibm.com> In-Reply-To: <20230310-dma_iommu-v9-0-65bb8edd2beb@linux.ibm.com> To: Joerg Roedel , Matthew Rosato , Will Deacon , Wenjia Zhang , Robin Murphy , Jason Gunthorpe Cc: Gerd Bayer , Julian Ruess , Pierre Morel , Alexandra Winter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Suravee Suthikulpanit , Hector Martin , Sven Peter , Alyssa Rosenzweig , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Konrad Dybcio , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Gerald Schaefer , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Krishna Reddy , Jonathan Hunter , Niklas Schnelle , Jonathan Corbet , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1331; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=iv5rTctIVBJRkTP8lY/YEQZWLj3JMw1iilc8H5Z4idA=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGFISf0Qc5vv66xyHtOs/U5cwS9lPaSlRHmsnxXzS7Fh2f Z3N8WkPOkpZGMQ4GGTFFFkWdTn7rSuYYronqL8DZg4rE8gQBi5OAZhIcynDP5N3dkHV/LqhFcuU /jn47Vg/48kasQdStkeeBUh0l61fvISR4U2sXDZLRU0R37Lz3jf2t76WXXQrcIHat5BdDE1tMgF /mAE= X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: pJoXblQutXXgbi5m_OUSFyoV1170AFtf X-Proofpoint-ORIG-GUID: Hk-7C_dDrmWdrumF0NtHFZD0h53OyVPV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-15_06,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 spamscore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305150078 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230515_021703_183336_4DB222C0 X-CRM114-Status: GOOD ( 20.79 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org A future change will convert the DMA API implementation from the architecture specific arch/s390/pci/pci_dma.c to using the common code drivers/iommu/dma-iommu.c which the utilizes the same IOMMU hardware through the s390-iommu driver. Unlike the s390 specific DMA API this requires devices to correctly call set the coherent mask to be allowed to use IOVAs >2^32 in dma_alloc_coherent(). This was however not done for ISM devices. ISM requires such addresses since currently the DMA aperture for PCI devices starts at 2^32 and all calls to dma_alloc_coherent() would thus fail. Reviewed-by: Alexandra Winter Reviewed-by: Matthew Rosato Signed-off-by: Niklas Schnelle Reviewed-by: Pierre Morel --- drivers/s390/net/ism_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index 8acb9eba691b..1399b5dc646c 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -660,7 +660,7 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) goto err_disable; - ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (ret) goto err_resource;