Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1413998ybl; Fri, 6 Dec 2019 17:14:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyTfgHeJCEGM86wa3zn6BXSq4noX5xatkNO2Pf3ANygBWs/kSGQVoj0O3wKh5IYxs9Pzfa9 X-Received: by 2002:a9d:4789:: with SMTP id b9mr12780989otf.247.1575681298254; Fri, 06 Dec 2019 17:14:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575681298; cv=none; d=google.com; s=arc-20160816; b=yJeat3wXUK0+IrKZO285JxQ6MDrfDQczJuC7ZMkqdZwYwfn1gaMBkm2cAz9pTv486Z vymSHpA4+70JGnjB9A82OjOJxBG82wuflJG1yoofzum2r52yDEiM3V4jc7BcJ1vh4PCe siMolyF0nV3mFMZGIyjNik5JAVPsQ4+CPTeVY8xPYBea6F845CuGKMoByeyLmHFoxlvP L+6doG2ho2KuUd7lUThTW6Y8DoJFJJ3lXIwJnYLf5KCutUlykSK/7Q/SZM6U+YdL07Wp Q5pfY1DyYT6AayBYcySFSQ4gJKzsUIaqN7VvR5FaTzkJ/4RlX7sxeKdMPrEBNw9ptkkN n49g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=j+MZtRqM2ErdK2/aswE89EfyJ3BwAV/SppiO5OWcGo4=; b=n6k4Lbv7C1Gn8I8zyxQOOy1twNXW5dpelLgvpqXk14JVgtd1jn0b4HwM3zsUOqLAc8 mpi5yVtky5ZSWYtBJt7ShIY8L5HB9bK5xM9AQu+Q6ysMRf7eNJDrQO2ZQM2Qep7lSogL ZCTHxSoEbvVjSDyATwq9CsLx/KQe7TVHSQXzJoi65lAQqVMqMQ5RWJ/ai5fjzKsmWT0S 0FP6DMWtPXO3ym8KwzZGq3KWbHiWsMh051xTTpiKxHy80ffxSLIiEnCZlCc6CCexyKfX 9YwS4+Oo7F0jzhB0roFckwo9kWkztad4MHY8LtUL7pNaFrf7PT/fR33df8fnIHEWagnR 8NsQ== 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 w23si8231199oti.39.2019.12.06.17.14.46; Fri, 06 Dec 2019 17:14:58 -0800 (PST) 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 S1726527AbfLGBNR (ORCPT + 99 others); Fri, 6 Dec 2019 20:13:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37922 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbfLGBNP (ORCPT ); Fri, 6 Dec 2019 20:13:15 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB71CRGn080803 for ; Fri, 6 Dec 2019 20:13:15 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wq9gnstds-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 06 Dec 2019 20:13:14 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 7 Dec 2019 01:13:12 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 7 Dec 2019 01:13:08 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB71D7X430474474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Dec 2019 01:13:07 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 108264C04A; Sat, 7 Dec 2019 01:13:07 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A4104C040; Sat, 7 Dec 2019 01:13:03 +0000 (GMT) Received: from oc0525413822.ibm.com (unknown [9.80.215.155]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Dec 2019 01:13:02 +0000 (GMT) From: Ram Pai To: mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, benh@kernel.crashing.org, david@gibson.dropbear.id.au, paulus@ozlabs.org, mdroth@linux.vnet.ibm.com, hch@lst.de, linuxram@us.ibm.com, andmike@us.ibm.com, sukadev@linux.vnet.ibm.com, mst@redhat.com, ram.n.pai@gmail.com, aik@ozlabs.ru, cai@lca.pw, tglx@linutronix.de, bauerman@linux.ibm.com, linux-kernel@vger.kernel.org, leonardo@linux.ibm.com Subject: [PATCH v5 2/2] powerpc/pseries/iommu: Use dma_iommu_ops for Secure VM. Date: Fri, 6 Dec 2019 17:12:39 -0800 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1575681159-30356-2-git-send-email-linuxram@us.ibm.com> References: <1575681159-30356-1-git-send-email-linuxram@us.ibm.com> <1575681159-30356-2-git-send-email-linuxram@us.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19120701-0020-0000-0000-000003952448 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120701-0021-0000-0000-000021EC59A3 Message-Id: <1575681159-30356-3-git-send-email-linuxram@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-06_08:2019-12-05,2019-12-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 adultscore=0 clxscore=1015 mlxscore=0 suspectscore=1 bulkscore=0 impostorscore=0 spamscore=0 mlxlogscore=520 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912070004 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit edea902c1c1e ("powerpc/pseries/iommu: Don't use dma_iommu_ops on secure guests") disabled dma_iommu_ops path, for secure VMs. Disabling dma_iommu_ops path for secure VMs, helped enable dma_direct path. This enabled support for bounce-buffering through SWIOTLB. However it fails to operate when IOMMU is enabled, since I/O pages are not TCE mapped. Renable dma_iommu_ops path for pseries Secure VMs. It handles all cases including, TCE mapping I/O pages, in the presence of a IOMMU. Signed-off-by: Ram Pai --- arch/powerpc/platforms/pseries/iommu.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 67b5009..4e27d66 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include "pseries.h" @@ -1346,15 +1345,7 @@ void iommu_init_early_pSeries(void) of_reconfig_notifier_register(&iommu_reconfig_nb); register_memory_notifier(&iommu_mem_nb); - /* - * Secure guest memory is inacessible to devices so regular DMA isn't - * possible. - * - * In that case keep devices' dma_map_ops as NULL so that the generic - * DMA code path will use SWIOTLB to bounce buffers for DMA. - */ - if (!is_secure_guest()) - set_pci_dma_ops(&dma_iommu_ops); + set_pci_dma_ops(&dma_iommu_ops); } static int __init disable_multitce(char *str) -- 1.8.3.1