Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp519259ybm; Mon, 20 May 2019 21:55:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqygowPBmB0q5V6AjzqLPvGi3xXyNAhADXc7YFM/YeG+qLLyW7laAhnEn3nqC7snKwuvIIcP X-Received: by 2002:a63:c203:: with SMTP id b3mr49402915pgd.398.1558414543438; Mon, 20 May 2019 21:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558414543; cv=none; d=google.com; s=arc-20160816; b=hke3S5GyB3X3kEGvRy+pjjyJXoxs1lKUZw67nxtwTeWtfT2MyTQr6zkdCNldki9nhz Jwwtsv+L4kbioL40dj1hiO/9MMXXH+KkSo6ULk6umeCv3JMyh0QU/8eSJ1x5ilKOZsYC vAc9X+81NJXyS0fI6G7Im7Su0RWZDB9BojPDmOLZQTp0lSz8koJDaW7xEaADFd5ruF6Z zvrVFLpQUetXe6uedN3SNrMqh5x5W86YgRNmDqLe9ASA1eozVb/5NLXmLU/YaJOJdWeX f4PfwHsLZeTkRsA5ZX3/D/GiDThQVwiJ1tqp0idVGf/IxHV5dlYOCerZzGbC/Yj066Hh chgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=mwP2hKYaYIrBhwYsKal56EXyo7iU5lzqyXSltfl+6MI=; b=enT4hGp6gZ9QxWPGCd2x2NllibvM2KEevZhtMUByizmNj30dtsUiRP9txt0L3i+8vD fvrfZa7DcIB1kwQU+IihDRGk99twZDBnL4ZsArF5xMBRb5usU+vhL/kOSF8tTzx2r6b1 zCc8vwTPIGa0m3jiYO3s6nvDvv+N9X51yuJq+GlsUVr0FUu2rHvpQjmyBxGBuCgGcq51 x947Vg9F74wi6Dn5LZF0nu3YaHHPClsONIGuq5ozuCZwZf8aUjkItxKvk4W+OlgeD162 Q/mQ8wN9oCFgkIYiQgPhFuTaPDnWN3r2fvWwl9wKZqnfL427BVqDanlb1GVLv7WYr3ib ae/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si16920537pga.225.2019.05.20.21.55.28; Mon, 20 May 2019 21:55:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbfEUEx5 (ORCPT + 99 others); Tue, 21 May 2019 00:53:57 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53438 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727931AbfEUExw (ORCPT ); Tue, 21 May 2019 00:53:52 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4L4qs8O082135 for ; Tue, 21 May 2019 00:53:51 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sma1g1540-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 21 May 2019 00:53:51 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 May 2019 05:53:51 +0100 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 21 May 2019 05:53:48 +0100 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4L4rlZH10682868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2019 04:53:47 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DB6FC6057; Tue, 21 May 2019 04:53:47 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E6320C605A; Tue, 21 May 2019 04:53:29 +0000 (GMT) Received: from morokweng.localdomain.com (unknown [9.80.203.157]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 21 May 2019 04:53:29 +0000 (GMT) From: Thiago Jung Bauermann To: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Alexey Kardashevskiy , Anshuman Khandual , Benjamin Herrenschmidt , Christoph Hellwig , Michael Ellerman , Mike Anderson , Paul Mackerras , Ram Pai , Claudio Carvalho , Thiago Jung Bauermann Subject: [PATCH 10/12] powerpc/pseries/iommu: Don't use dma_iommu_ops on secure guests Date: Tue, 21 May 2019 01:49:10 -0300 X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190521044912.1375-1-bauerman@linux.ibm.com> References: <20190521044912.1375-1-bauerman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19052104-0036-0000-0000-00000AC00A2D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011134; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01206343; UDB=6.00633450; IPR=6.00987311; MB=3.00026980; MTD=3.00000008; XFM=3.00000015; UTC=2019-05-21 04:53:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19052104-0037-0000-0000-00004BE14B58 Message-Id: <20190521044912.1375-11-bauerman@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-20_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=553 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905210031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Secure guest memory is inacessible to devices so regular DMA isn't possible. In that case set devices' dma_map_ops to NULL so that the generic DMA code path will use SWIOTLB and DMA to bounce buffers. Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/platforms/pseries/iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 03bbb299320e..7d9550edb700 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "pseries.h" @@ -1332,7 +1333,10 @@ void iommu_init_early_pSeries(void) of_reconfig_notifier_register(&iommu_reconfig_nb); register_memory_notifier(&iommu_mem_nb); - set_pci_dma_ops(&dma_iommu_ops); + if (is_secure_guest()) + set_pci_dma_ops(NULL); + else + set_pci_dma_ops(&dma_iommu_ops); } static int __init disable_multitce(char *str)