From patchwork Mon Aug 10 21:07:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Christensen X-Patchwork-Id: 75339 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 68325A04CC; Mon, 10 Aug 2020 23:07:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B0E1511A2; Mon, 10 Aug 2020 23:07:27 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id C8DAEF90 for ; Mon, 10 Aug 2020 23:07:25 +0200 (CEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07AL2SpQ157651; Mon, 10 Aug 2020 17:07:24 -0400 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; s=pp1; bh=cwmL60q9SYRomUegEM9LSmhZSIMujurc4MGiX6VenD0=; b=nwbXTyuReVGL/U//BCm2449m4WmmoFzr1XQOzYjpY4olDtQQr464OZFc41mJPA/vgVqN X+omLBsBKp1o6JagDjfWksWOzaJbeZOjIO0tdkGOLOMNeXDYpgZz/dCOrqZhsRaRhWGw X2rSCpVw9dYaTCaGQKD8HXmqmylmvWeO70rTzZYq2xYvaFkwpZX7VrWZjQVmCHea270H URerCC8J1zItWFbpOG9J7IjD0tqzZI0WA0YnLEW6aARhMMiy+ugW9riqG24LG8kWijap /z+OdQkPuufSYh92ec4h2wQ0sHcwKRM04+d9j6YxSpFtj0s0FEDpY+mFKPTf9TQpGp69 KA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32sr7v0ypm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Aug 2020 17:07:24 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07AL2Vqj158036; Mon, 10 Aug 2020 17:07:24 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0b-001b2d01.pphosted.com with ESMTP id 32sr7v0ypd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Aug 2020 17:07:24 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07AKxpS6020970; Mon, 10 Aug 2020 21:07:23 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma02wdc.us.ibm.com with ESMTP id 32skp8vh49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Aug 2020 21:07:23 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07AL7JSl22479252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Aug 2020 21:07:19 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58C09C6067; Mon, 10 Aug 2020 21:07:22 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02FE8C6059; Mon, 10 Aug 2020 21:07:21 +0000 (GMT) Received: from localhost.localdomain (unknown [9.114.224.51]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 10 Aug 2020 21:07:21 +0000 (GMT) From: David Christensen To: anatoly.burakov@intel.com, david.marchand@redhat.com Cc: dev@dpdk.org, David Christensen Date: Mon, 10 Aug 2020 14:07:06 -0700 Message-Id: <20200810210707.745083-1-drc@linux.vnet.ibm.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200630213823.1583764-1-drc@linux.vnet.ibm.com> References: <20200630213823.1583764-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-08-10_20:2020-08-06, 2020-08-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=986 impostorscore=0 malwarescore=0 bulkscore=0 mlxscore=0 adultscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008100141 Subject: [dpdk-dev] [PATCH v3 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. --- 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 | 412 ++++++++++++++------------------ 1 file changed, 186 insertions(+), 226 deletions(-)