From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52F7B42BEB; Wed, 31 May 2023 07:37:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA23D40ED7; Wed, 31 May 2023 07:37:56 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id E062A40A87 for ; Wed, 31 May 2023 07:37:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685511475; x=1717047475; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dryoy+PfvW7KRtDoUdOXVhUYCQKnPWu1H9bNfTv4KA0=; b=eMLLcHMPgNTHKJXoTkXcRLa0tERlbmamlxCo7o/85DgPpFaY383vO/T1 vqiCfxo58lQEVr1OdmortqMNgFmh5lKobELFEw6g1msFPAxW8gO1F5SU2 2KpySRvqGnHkuZeunaSstUnG6ubuL01iZNDyyPK8iP5oqSVuCpopffvMt S/j7M3EPSwbBd0PArRith9RhKcPrzrOeGxhgi0nAXQk/TocoU2VvbWcSA ipp4ME9n+6AxlG49nhRZx9dJpneyASSxXXrJMkRCZoGV9JaxfSJZ1FAhD XQelHEkesuU3YEcvwlkaYQt7pJt8Maqi7H3+RBawzGb6vqt+UoPqedBVT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="335489250" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="335489250" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 22:37:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="684273515" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="684273515" Received: from dpdk-limiao-icelake.sh.intel.com ([10.67.111.26]) by orsmga006.jf.intel.com with ESMTP; 30 May 2023 22:37:51 -0700 From: Miao Li To: dev@dpdk.org Cc: skori@marvell.com, thomas@monjalon.net, david.marchand@redhat.com, ferruh.yigit@amd.com, chenbo.xia@intel.com, yahui.cao@intel.com Subject: [PATCH v4 0/4] Support VFIO sparse mmap in PCI bus Date: Wed, 31 May 2023 05:37:38 +0000 Message-Id: <20230531053743.129442-1-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525163116.682000-1-miao.li@intel.com> References: <20230525163116.682000-1-miao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This series introduces a VFIO standard capability, called sparse mmap to PCI bus. In linux kernel, it's defined as VFIO_REGION_INFO_CAP_SPARSE_MMAP. Sparse mmap means instead of mmap whole BAR region into DPDK process, only mmap part of the BAR region after getting sparse mmap information from kernel. For the rest of BAR region that is not mmap-ed, DPDK process can use pread/pwrite system calls to access. Sparse mmap is useful when kernel does not want userspace to mmap whole BAR region, or kernel wants to control over access to specific BAR region. Vendors can choose to enable this feature or not for their devices in their specific kernel modules. In this patchset: Patch 1-3 is mainly for introducing BAR access APIs so that driver could use them to access specific BAR using pread/pwrite system calls when part of the BAR is not mmap-able. Patch 4 adds the VFIO sparse mmap support finally. v4: 1. add sparse mmap information allocation and release 2. add release note for BAR access APIs v3: fix variable 'pdev' and 'info' uninitialized error v2: 1. add PCI device internal structure in bus/pci/windows/pci.c 2. fix parameter type error Chenbo Xia (3): bus/pci: introduce an internal representation of PCI device bus/pci: avoid depending on private value in kernel source bus/pci: introduce helper for MMIO read and write Miao Li (1): bus/pci: add VFIO sparse mmap support doc/guides/rel_notes/release_23_07.rst | 5 + drivers/bus/pci/bsd/pci.c | 35 ++- drivers/bus/pci/linux/pci.c | 78 +++++- drivers/bus/pci/linux/pci_init.h | 14 +- drivers/bus/pci/linux/pci_uio.c | 22 ++ drivers/bus/pci/linux/pci_vfio.c | 371 ++++++++++++++++++++----- drivers/bus/pci/pci_common.c | 12 +- drivers/bus/pci/private.h | 25 +- drivers/bus/pci/rte_bus_pci.h | 48 ++++ drivers/bus/pci/version.map | 3 + drivers/bus/pci/windows/pci.c | 14 +- lib/eal/include/rte_vfio.h | 1 - 12 files changed, 525 insertions(+), 103 deletions(-) -- 2.25.1