Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp154712pxa; Wed, 26 Aug 2020 07:16:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykU5PiSsB7Xd8OGNsMVePkoBwnXr9k5VBHQlc2dG4tn9izb6znaOEw2/vsyoIj8DgGsrCL X-Received: by 2002:aa7:d44d:: with SMTP id q13mr6581850edr.246.1598451407237; Wed, 26 Aug 2020 07:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598451407; cv=none; d=google.com; s=arc-20160816; b=BJGJLEhof8cgeJmygFjCDMX4jsmS+fc5V2TtZoqpwNjeBp2LAe/RbDL3Niun5KZ4ZI /NNBSgAsbxragY6qcFhpnt3+W/q8l0hg/3Tjsw25aIYsDVAvv2WmLPjLiGTMQFTfCKJq GztAzDzuySCC4/dGas7xQbjo8GjTSki9bTtrSlSjDOdQf+G3CDu3GXgRivpxZRKK221Y hz4ZWfqphVSycCsAIRmjcapXcXYbv+6fLMgAlc5Bvk7unfLCOpEYVtaiAaa1ULSjH+fl V3ug38Lv40NKND2x6Y55CS5GR4LsIOGgk/lVSQpq00l9cKAQZ7RLnEpLbebjzA9exQRq bayQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=sH77k2MxcWewrnCfADb48HZx7w+baM5bYmjqMybddOw=; b=GhoxotOdU9S0/cAbQ5W4GmzcNItQi7qVZMrzsgBtE6vzxbO3mNzyDvAzaTx4OmmKkV Wt3spoFPPXOeEFxYJwo3Wa06ZBFpKyl6XaGM2HecGZOkiTtr9lGFm/XUJbe58ADaGsDt BXJv2oteO7uzkAuHHzTW3Gl3BkrB8pEEHP6+3pYUs5PB894o9Wlrf1O35CxMvMOF80rT ufjT2czTtHhLsvlkg5m0iOkuvYir0DGx7+IHDcCYw+n/Z5gJ0irD2ywt6XSzQJzZt8Yk wOLJChU7W0RhB0DBAreYvUZrsBX7fATkWSMIjcBY7E3k+uNjYCm6w3xjrFvGbW14kCZq 7HXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si1632834edc.174.2020.08.26.07.16.24; Wed, 26 Aug 2020 07:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728092AbgHZJdy (ORCPT + 99 others); Wed, 26 Aug 2020 05:33:54 -0400 Received: from inva021.nxp.com ([92.121.34.21]:56362 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727956AbgHZJdx (ORCPT ); Wed, 26 Aug 2020 05:33:53 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C231D2005B7; Wed, 26 Aug 2020 11:33:51 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B5EF92003AC; Wed, 26 Aug 2020 11:33:51 +0200 (CEST) Received: from fsr-ub1864-111.ea.freescale.net (fsr-ub1864-111.ea.freescale.net [10.171.82.141]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 71C442030A; Wed, 26 Aug 2020 11:33:51 +0200 (CEST) From: Diana Craciun To: alex.williamson@redhat.com, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bharatb.linux@gmail.com, laurentiu.tudor@nxp.com, Diana Craciun Subject: [PATCH v4 00/10] vfio/fsl-mc: VFIO support for FSL-MC device Date: Wed, 26 Aug 2020 12:33:05 +0300 Message-Id: <20200826093315.5279-1-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DPAA2 (Data Path Acceleration Architecture) consists in mechanisms for processing Ethernet packets, queue management, accelerators, etc. The Management Complex (mc) is a hardware entity that manages the DPAA2 hardware resources. It provides an object-based abstraction for software drivers to use the DPAA2 hardware. The MC mediates operations such as create, discover, destroy of DPAA2 objects. The MC provides memory-mapped I/O command interfaces (MC portals) which DPAA2 software drivers use to operate on DPAA2 objects. A DPRC is a container object that holds other types of DPAA2 objects. Each object in the DPRC is a Linux device and bound to a driver. The MC-bus driver is a platform driver (different from PCI or platform bus). The DPRC driver does runtime management of a bus instance. It performs the initial scan of the DPRC and handles changes in the DPRC configuration (adding/removing objects). All objects inside a container share the same hardware isolation context, meaning that only an entire DPRC can be assigned to a virtual machine. When a container is assigned to a virtual machine, all the objects within that container are assigned to that virtual machine. The DPRC container assigned to the virtual machine is not allowed to change contents (add/remove objects) by the guest. The restriction is set by the host and enforced by the mc hardware. The DPAA2 objects can be directly assigned to the guest. However the MC portals (the memory mapped command interface to the MC) need to be emulated because there are commands that configure the interrupts and the isolation IDs which are virtual in the guest. Example: echo vfio-fsl-mc > /sys/bus/fsl-mc/devices/dprc.2/driver_override echo dprc.2 > /sys/bus/fsl-mc/drivers/vfio-fsl-mc/bind The dprc.2 is bound to the VFIO driver and all the objects within dprc.2 are going to be bound to the VFIO driver. More details about the DPAA2 objects can be found here: Documentation/networking/device_drivers/freescale/dpaa2/overview.rst The patches are dependent on some changes in the mc-bus (bus/fsl-mc) driver. The changes were needed in order to re-use code and to export some more functions that are needed by the VFIO driver. Currenlty the mc-bus patches are under review: https://www.spinics.net/lists/kernel/msg3639226.html v3 --> v4 - use bus provided functions to tear down the DPRC - added reset support v2 --> v3 - There is no need to align region size to page size - read/write implemented for all DPAA2 objects - review fixes v1 --> v2 - Fixed the container reset, a new flag added to the firmware command - Implement a bus notifier for setting driver_override Bharat Bhushan (1): vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices Diana Craciun (9): vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions vfio/fsl-mc: Added lock support in preparation for interrupt handling vfio/fsl-mc: Add irq infrastructure for fsl-mc devices vfio/fsl-mc: trigger an interrupt via eventfd vfio/fsl-mc: Add read/write support for fsl-mc devices vfio/fsl-mc: Add support for device reset MAINTAINERS | 6 + drivers/vfio/Kconfig | 1 + drivers/vfio/Makefile | 1 + drivers/vfio/fsl-mc/Kconfig | 9 + drivers/vfio/fsl-mc/Makefile | 4 + drivers/vfio/fsl-mc/vfio_fsl_mc.c | 684 ++++++++++++++++++++++ drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c | 221 +++++++ drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 56 ++ include/uapi/linux/vfio.h | 1 + 9 files changed, 983 insertions(+) create mode 100644 drivers/vfio/fsl-mc/Kconfig create mode 100644 drivers/vfio/fsl-mc/Makefile create mode 100644 drivers/vfio/fsl-mc/vfio_fsl_mc.c create mode 100644 drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c create mode 100644 drivers/vfio/fsl-mc/vfio_fsl_mc_private.h -- 2.17.1