From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6C47A04E7; Sun, 15 Nov 2020 19:29:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E0E2F493D; Sun, 15 Nov 2020 19:29:33 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id BEDE2F90 for ; Tue, 10 Nov 2020 18:41:17 +0100 (CET) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AAHXx1E009842; Tue, 10 Nov 2020 12:41:15 -0500 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=n+QymAQ5g9ZOTfym+M/8PSdq6WK3tixY6lsdAYJW1MQ=; b=Go4M5jPb3o1lERyc0oSVYROFZySl3ojB+t38+Ioue+7MEdCDMQvql29WdhFDiYmewpis YsgZFfEJjwvqRrjhWHGu0J+lA0/wvliYWEOMVjwKHvRA0/W9pm8DzvywpwzKvvDDYd+4 vkDJpjU6gReuFYbPu8Z96PKwDj3+vlx7OYYMog7eLViSwvEiPBZFBUZ0EZxTIskxgc0O 700UW0a3O6VuxhtimyfIvo2s7Ah+BxKJiS5l2ZMAbDxBZTZyq9a4UTdJM3S90H5jxIqh jLgnKSlpRHlCe1EyVRvVw2iyJUF2+Mp3KjN4Joyd1swDc1guQ0xnn902FZWYgDiwBsdM Pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 34qksyq1cg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Nov 2020 12:41:15 -0500 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0AAHYA6C010811; Tue, 10 Nov 2020 12:41:15 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 34qksyq1c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Nov 2020 12:41:15 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AAHbO66009699; Tue, 10 Nov 2020 17:41:14 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma03dal.us.ibm.com with ESMTP id 34nk79hd0p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Nov 2020 17:41:14 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AAHfDDC6029926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Nov 2020 17:41:13 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59838C6059; Tue, 10 Nov 2020 17:41:13 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0BBEAC6057; Tue, 10 Nov 2020 17:41:12 +0000 (GMT) Received: from localhost.localdomain (unknown [9.114.224.51]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 10 Nov 2020 17:41:12 +0000 (GMT) From: David Christensen To: dev@dpdk.org, anatoly.burakov@intel.com, david.marchand@redhat.com Cc: David Christensen Date: Tue, 10 Nov 2020 09:41:09 -0800 Message-Id: <20201110174110.12223-1-drc@ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109203528.132797-1-drc@linux.vnet.ibm.com> References: <20201109203528.132797-1-drc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-10_07:2020-11-10, 2020-11-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 suspectscore=0 clxscore=1011 bulkscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011100124 X-Mailman-Approved-At: Sun, 15 Nov 2020 19:29:32 +0100 Subject: [dpdk-dev] [PATCH v7 0/1] vfio: modify spapr iommu support to use static window sizing 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" From: David Christensen 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. --- v7: - No patch changes, fixed email patch description v6: - Fix build error on Linux kernels prior to 4.2.0 - Rebased on 20.11-rc3 v5: - Modify get_highest_mem_addr to return error, not address - Add comment regarding sPAPR v1/v2 default window and why it needs to be removed - Added indent to second line of vfio_spapr_dma_mem_map() definition v4: - Move file reading code out of vfio_spapr_window_size_walk() v3: - Rebase for 20.08 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 | 430 +++++++++++++++----------------- 1 file changed, 207 insertions(+), 223 deletions(-) -- 2.18.4