From patchwork Wed Oct 19 14:44:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 5607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp370419wrs; Wed, 19 Oct 2022 07:54:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C4kT9S8BDmgEEzSHyvob+SlA03jOsjTzTmBvC0NHAuuAFVobTJ08n01Ax8XOMvfSYuHhi X-Received: by 2002:a17:902:e552:b0:179:e795:71c5 with SMTP id n18-20020a170902e55200b00179e79571c5mr8786572plf.57.1666191265895; Wed, 19 Oct 2022 07:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666191265; cv=none; d=google.com; s=arc-20160816; b=NvSl6ff4dUpV3brsJhHmoN/KAhwzqbmbJW0eUI0wthYedu0VK1K7rEdLwmglTGAdFF zitu/ILYHrLL8WddQN7vQyaVxh9+DiCS1K0lojr6+jl15oLnaKJHkhysQhR3xJj1BfsX 5kbZJrIhUR3tYXgcCITJnxZPbf9voHTGfuhJIRZfNmLKvfqdRarDukGqBjy+yjrrTork d7MwCxs7moXMkqS2g5xhmhQpPPuay5euIxrnGvjLo1s3LHvRh7Lr9700Dm1gLypOygdQ iVxJmN99DDk0LUqY+pXzB02aQ89U2k4LHBhIadZBSWWJupkCD5InvcQCehdHakEg9ut8 r86A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LKkV5K5rNGundAibUGPmtOynU0ETPEYcazy0gCFkFf4=; b=cn3E6wAQHWIyz3gYystQUtP0Zy5cw+NZyyDhnZ2EF28Mv7gf+7U3YiOVrsBbAAN13X n0BRbYcWo5IY1UMOJhnQdX2wkE4nmHwoHMnYkjKnTlDDh3D8FsbjYb2QZpRmQb9XWIKe mWgzSpBNHLGmkasvl7zT45P977ye55qxARXC1fBwqTNi6zK92I/JSL+VdAuBLKQmdBNq GNTyQSIVQSbIxvrIHRC12vu9GK14dIn50SgNM20gs+D826iQcxLCi+tQqRZs6iz08vrz DIgGAnw+J7n14OCp6U8lYG+Re++AnJbLA6i4eibx06yQ0OM7LAB/55T8wKLay3r34pCJ 7SCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=my7ASZfV; 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=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a170902dac600b0017f8dfb2308si23574716plx.473.2022.10.19.07.54.10; Wed, 19 Oct 2022 07:54:25 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=my7ASZfV; 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=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231631AbiJSOxk (ORCPT + 99 others); Wed, 19 Oct 2022 10:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbiJSOxD (ORCPT ); Wed, 19 Oct 2022 10:53:03 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1DBCA3AA2; Wed, 19 Oct 2022 07:44:56 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29JEgcHD001063; Wed, 19 Oct 2022 14:44:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=LKkV5K5rNGundAibUGPmtOynU0ETPEYcazy0gCFkFf4=; b=my7ASZfVmUtWVWX8Jc55M6UHT6LOJW0gPM1/u2dl8OOivGT90TIBCEYIf+A69tuOx1wH uFwDB3Q1HqDKr+49ypOhB6BsxadY/XKpWJDsxwYZS8VbauAmP8bz7hvP4lmUZts2ES3f nKyPkY0RrGvlbLX+kuQrNIW3woaWXFNlFSFD7yVIvhIQ095ZxntgbivjFJw2SUifDzxM wfA8Zn6WPeTXUBvOh79ELAolvFCWpeaeTDbFz93n5UjnlWTMn9AaM1lZBRRzHWPQudLl KeKpWqDFO3FqIvVI9Kelk+Oj9RE7XxQ/kb9oJpr0R65rMIeMFyIeZqj9QV9CrT70w7Jq 6g== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kak7yg1wk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 14:44:42 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29JEaXtV012198; Wed, 19 Oct 2022 14:44:40 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3kajmrr1uw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 14:44:40 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29JEjAWe41877924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Oct 2022 14:45:10 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12D9D4C044; Wed, 19 Oct 2022 14:44:37 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 884854C046; Wed, 19 Oct 2022 14:44:36 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 19 Oct 2022 14:44:36 +0000 (GMT) From: Niklas Schnelle To: Matthew Rosato , iommu@lists.linux.dev, Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe Cc: Gerd Bayer , Pierre Morel , linux-s390@vger.kernel.org, borntraeger@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com, linux-kernel@vger.kernel.org, Wenjia Zhang , Julian Ruess Subject: [RFC 1/6] s390/ism: Set DMA coherent mask Date: Wed, 19 Oct 2022 16:44:30 +0200 Message-Id: <20221019144435.369902-2-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221019144435.369902-1-schnelle@linux.ibm.com> References: <20221019144435.369902-1-schnelle@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: kgIwSg_7thUhemU_Qkr748Yhx-njvXWG X-Proofpoint-ORIG-GUID: kgIwSg_7thUhemU_Qkr748Yhx-njvXWG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-19_08,2022-10-19_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 malwarescore=0 impostorscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxlogscore=929 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210190081 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747128172879078978?= X-GMAIL-MSGID: =?utf-8?q?1747128172879078978?= 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 dma_set_coherent_mask() to be allowed to use IOVAs >2^32 in dma_alloc_coherent(). This was however not done for ISM devices which require such addresses since currently the DMA aperture for PCI devices starts a 2^32 and all calls to dma_alloc_coherent() would thus fail. Signed-off-by: Niklas Schnelle --- drivers/s390/net/ism_drv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index d34bb6ec1490..5890c32a9e1f 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -560,6 +560,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) goto err_resource; + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); + if (ret) + goto err_resource; + dma_set_seg_boundary(&pdev->dev, SZ_1M - 1); dma_set_max_seg_size(&pdev->dev, SZ_1M); pci_set_master(pdev);