From patchwork Tue Jun 30 21:38:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Christensen X-Patchwork-Id: 72477 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ADD74A0350; Tue, 30 Jun 2020 23:38:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28C361BF75; Tue, 30 Jun 2020 23:38:30 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 3570E1BF68 for ; Tue, 30 Jun 2020 23:38:29 +0200 (CEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05ULXKbi071419; Tue, 30 Jun 2020 17:38:28 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 32083essdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jun 2020 17:38:28 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05ULZvVV012468; Tue, 30 Jun 2020 21:38:27 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma04dal.us.ibm.com with ESMTP id 31wwr91tsr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jun 2020 21:38:27 +0000 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 05ULcQYn25362798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Jun 2020 21:38:26 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A6C1C6055; Tue, 30 Jun 2020 21:38:26 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7B8AC6057; Tue, 30 Jun 2020 21:38:25 +0000 (GMT) Received: from localhost.localdomain (unknown [9.114.224.51]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 30 Jun 2020 21:38:25 +0000 (GMT) From: David Christensen To: Anatoly Burakov Cc: dev@dpdk.org, David Christensen Date: Tue, 30 Jun 2020 14:38:22 -0700 Message-Id: <20200630213823.1583764-1-drc@linux.vnet.ibm.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200429232931.87233-1-drc@linux.vnet.ibm.com> References: <20200429232931.87233-1-drc@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-06-30_06:2020-06-30, 2020-06-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 cotscore=-2147483648 impostorscore=0 priorityscore=1501 spamscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 malwarescore=0 phishscore=0 mlxlogscore=955 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006300147 Subject: [dpdk-dev] [PATCH v2 0/1] vfio: change spapr DMA window sizing operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The SPAPR v2 IOMMU used on bare-metal PowerNV systems requires that a DMA window be defined before mapping/unmapping memory. The current VFIO code dynamically resizes this DMA window every time a new memory request is made, which requires that all existing memory be unmapped/remapped. While this strategy worked in DPDK 17.11 and earlier where memory was statically allocated during startup, it is potentially dangerous in DPDK 18.11 and later where memory can be allocated during runtime, temporarily invalidating IOVA memory used by hardware. This new code statically sizes the DMA window at startup, based on the amount of memory installed in the system, avoiding the need to unmap memory during runtime. --- v2: - Drop patch to wrap ppc64 code with ifdef's - Add warning when external memory detected - Change VA memory size detection to scan memseg list when setting DMA window for IOVA=VA - Add explicit error message when attempting to map outside the DMA window David Christensen (1): vfio: modify spapr iommu support to use static window sizing lib/librte_eal/linux/eal_vfio.c | 412 ++++++++++++++------------------ 1 file changed, 186 insertions(+), 226 deletions(-) -- 2.18.2