Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1218817ybz; Wed, 22 Apr 2020 16:08:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKAMZYNclAblpEU0XzcAs7iq3Hq+Os0sDcJ6x9eUKgkfJhuwrhpO5ttPx67GzEfLeopUq0+ X-Received: by 2002:a50:9d06:: with SMTP id v6mr746140ede.189.1587596902712; Wed, 22 Apr 2020 16:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587596902; cv=none; d=google.com; s=arc-20160816; b=ys08Sl6kkhmiIc0gMbYAcf2XY3L+61h4CD0RteE8VcEZSvGuBSmL2p4rpd+zorXlHR 9YTMlQqVdv7jmmYwKfcThpKk+5ImLKptaAv0IDPO9uu+ivYnvQrgfThpqPEsB07QRjrL 8Kp1pt7gvmX7Tc0ckeckK5hxl8WqBV+ZNI53L8ixafdWcKskjfqpabkjQaQJr5NcyW8J gsxTcX8rm+UCOGpFM/0/8UalOZZ4g27JOJmEMu/b+VwA4MDTM+s7C/we2Oite08DF01W 6oqsswOJPcvT2JB3mhw6++zDz/rMADEa327kkedox1Md0Q9n0wfmT+d23mYz9ma1MjAH ZQSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=o4qkZZo9dRFYTZqfSEGtTWHqI6O50xqTQWAvSfxE5hw=; b=ZsyXoFFT2VnNgB6Jt3TE8UR0rx032U7l3dEgYPygmYTjFswe8/4nPnXMRD285PpCBM Ph7wxOOAGryj6P/Nz98Eu/gWEeKy9rGTcdyVUwCCK5NA8KjLjCbrF6Rn1orlw0vIF5e1 lWkpINtOHUn/jtTJH1DyoPX5Bl7Vc74hrAa3mBGaB81hD9I67IzqF9HePTXm+P6NBtqv EbZRAh5HdDOsEMj224DpmCOC1PkhJgZV97vtmtl2MjYdforp58dQIpbetvkLsb0mi+8b PWkY7+o49rL12tkmOZquamGx1jEy9XvTkDRZg+KvIY9GtvHN2Mn9J+Y4VAAAgRaXneQq +RiA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si286692edq.344.2020.04.22.16.07.59; Wed, 22 Apr 2020 16:08:22 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbgDVXEY (ORCPT + 99 others); Wed, 22 Apr 2020 19:04:24 -0400 Received: from mga07.intel.com ([134.134.136.100]:7109 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbgDVXEY (ORCPT ); Wed, 22 Apr 2020 19:04:24 -0400 IronPort-SDR: 3uHv/mNBS2PuxZxmApi10iGniE4BDbo7a1FVY6YBZxfcuULMNbvrESa4GCrBdBmTmCrSKD8lnI LSbwpX6W44QQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 16:04:23 -0700 IronPort-SDR: 49PSRAP6HZ2kkUOmviJXbjwvhozsbej9LWy1KbXoOSWlD9Itl37uJJ9lcmtRvzpTqNciu0IzD/ O+hF9jv9BXmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,304,1583222400"; d="scan'208";a="247589890" Received: from meghadey-mobl1.amr.corp.intel.com (HELO [10.254.185.101]) ([10.254.185.101]) by fmsmga008.fm.intel.com with ESMTP; 22 Apr 2020 16:04:20 -0700 Subject: Re: [PATCH RFC 00/15] Add VFIO mediated device support and IMS support for the idxd driver. To: Jason Gunthorpe , Dave Jiang Cc: vkoul@kernel.org, maz@kernel.org, bhelgaas@google.com, rafael@kernel.org, gregkh@linuxfoundation.org, tglx@linutronix.de, hpa@zytor.com, alex.williamson@redhat.com, jacob.jun.pan@intel.com, ashok.raj@intel.com, yi.l.liu@intel.com, baolu.lu@intel.com, kevin.tian@intel.com, sanjay.k.kumar@intel.com, tony.luck@intel.com, jing.lin@intel.com, dan.j.williams@intel.com, kwankhede@nvidia.com, eric.auger@redhat.com, parav@mellanox.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org References: <158751095889.36773.6009825070990637468.stgit@djiang5-desk3.ch.intel.com> <20200421235442.GO11945@mellanox.com> From: "Dey, Megha" Message-ID: Date: Wed, 22 Apr 2020 16:04:20 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200421235442.GO11945@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/21/2020 4:54 PM, Jason Gunthorpe wrote: > On Tue, Apr 21, 2020 at 04:33:46PM -0700, Dave Jiang wrote: >> The actual code is independent of the stage 2 driver code submission that adds >> support for SVM, ENQCMD(S), PASID, and shared workqueues. This code series will >> support dedicated workqueue on a guest with no vIOMMU. >> >> A new device type "mdev" is introduced for the idxd driver. This allows the wq >> to be dedicated to the usage of a VFIO mediated device (mdev). Once the work >> queue (wq) is enabled, an uuid generated by the user can be added to the wq >> through the uuid sysfs attribute for the wq. After the association, a mdev can >> be created using this UUID. The mdev driver code will associate the uuid and >> setup the mdev on the driver side. When the create operation is successful, the >> uuid can be passed to qemu. When the guest boots up, it should discover a DSA >> device when doing PCI discovery. > > I'm feeling really skeptical that adding all this PCI config space and > MMIO BAR emulation to the kernel just to cram this into a VFIO > interface is a good idea, that kind of stuff is much safer in > userspace. > > Particularly since vfio is not really needed once a driver is using > the PASID stuff. We already have general code for drivers to use to > attach a PASID to a mm_struct - and using vfio while disabling all the > DMA/iommu config really seems like an abuse. > > A /dev/idxd char dev that mmaps a bar page and links it to a PASID > seems a lot simpler and saner kernel wise. > >> The mdev utilizes Interrupt Message Store or IMS[3] instead of MSIX for >> interrupts for the guest. This preserves MSIX for host usages and also allows a >> significantly larger number of interrupt vectors for guest usage. > > I never did get a reply to my earlier remarks on the IMS patches. > > The concept of a device specific addr/data table format for MSI is not > Intel specific. This should be general code. We have a device that can > use this kind of kernel capability today. > Hi Jason, I am sorry if I did not address your comments earlier. The present IMS code is quite generic, most of the code is in the drivers/ folder. We basically introduce 2 APIS: allocate and free IMS interrupts and a IMS IRQ domain to allocate these interrupts from. These APIs are architecture agnostic. We also introduce a new IMS IRQ domain which is architecture specific. This is because IMS generates interrupts only in the remappable format, hence interrupt remapping should be enabled for IMS. Currently, the interrupt remapping code is only available for Intel and AMD and I don’t see anything for ARM. If a new architecture would want to use IMS, they must simply introduce a new IMS IRQ domain. I am not sure if there is any other way around this. If you have any ideas, please let me know. Also, could you give more details on the device that could use IMS? Do you have some driver code already? We could then see if and how the current IMS code could be made more generic. > Jason >