Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2105181imu; Thu, 17 Jan 2019 08:28:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN5DwZd2+NcyN2m67L9UgT/K+naD3tdXK4q9K8J/f47zkukQYr78Y0rOgMZ9mIQ3KYWm9gCq X-Received: by 2002:a17:902:45:: with SMTP id 63mr15069075pla.272.1547742493975; Thu, 17 Jan 2019 08:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547742493; cv=none; d=google.com; s=arc-20160816; b=n2R3uaw8awz0XCvXAZmDWAJzKTPwcE/FeTP7rWXDDFItyVlaBMaX3VvYc61GCx/N12 Un2r3LnGmjFVnYpvBKL7mHMO8Uph5JcEeS5XrI3AWENllScRp6ckL9xi/CodRFiqYIAA MdZXDW/4Q6zT67FMaUNWxvb4C/qDSfjsCflTEwGat3IQpS8DrtwpCO4YZhmhZxiM2+Ap QNRzrYTKt3Apn9fPkrGWhcQWtP5kCbMnx6JGmG8ziJN3TQBIifUxvdrrVoVTJ6uLSzmI LsPd5iH8tnpRThBr/LqmEzLBA+KusEfsPzCA6Kxv/QdGNhrh1N50m/PvGAtK+oZ6wLPO 6lKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZlxTqt4lmqj59IwDAHDcYTUbA8fY4gNqgSXqgRAKINY=; b=ylYXZaj+Q8NezVHmjryaus/KH4vaeUg8KVmbMm0qtDygpcI6lKKacVPTp7CoFa2obN x7z47krqQYXHv+Rvew/QDDtW1f3EXzJFBn+kngBMKFyMp5+oe7R5Rop2ECpuJ+3DpgHS ASMXgNFypgnrPWi5GJ1uYQu6R8BZnzakAz0EBSgBb2NQ/3bMYYJ8py6aMpQLkWaTnNDd nOOxRbcRLL7DDEbX1iw4Xm+w1rRebZJm+vxuDk1ZZjeEoTzJcYFZMUDKX+jrLxfre5+N nVkfzN5V0cIYP0sVdZv85cmxaW8XDyrH7xmszJX5P/fEwHz0RF/LR2N7SG0KEQ9I4juM KO6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si1903895pgg.382.2019.01.17.08.27.57; Thu, 17 Jan 2019 08:28:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728946AbfAQQ0I (ORCPT + 99 others); Thu, 17 Jan 2019 11:26:08 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:57947 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbfAQQ0I (ORCPT ); Thu, 17 Jan 2019 11:26:08 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 9FEA518539; Thu, 17 Jan 2019 17:26:04 +0100 (CET) X-Axis-User: NO X-Axis-NonUser: YES X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id elemmEWAGOdJ; Thu, 17 Jan 2019 17:26:03 +0100 (CET) Received: from boulder02.se.axis.com (boulder02.se.axis.com [10.0.8.16]) by bastet.se.axis.com (Postfix) with ESMTPS id 9E9F318572; Thu, 17 Jan 2019 17:26:02 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37DDC1A084; Thu, 17 Jan 2019 17:26:02 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B7551A082; Thu, 17 Jan 2019 17:26:02 +0100 (CET) Received: from seth.se.axis.com (unknown [10.0.2.172]) by boulder02.se.axis.com (Postfix) with ESMTP; Thu, 17 Jan 2019 17:26:02 +0100 (CET) Received: from lnxartpec.se.axis.com (lnxartpec.se.axis.com [10.88.4.9]) by seth.se.axis.com (Postfix) with ESMTP id 1E700313C; Thu, 17 Jan 2019 17:26:02 +0100 (CET) Received: by lnxartpec.se.axis.com (Postfix, from userid 10564) id 1542B80B46; Thu, 17 Jan 2019 17:26:02 +0100 (CET) Date: Thu, 17 Jan 2019 17:26:01 +0100 From: Vincent Whitchurch To: Arnd Bergmann Cc: sudeep.dutt@intel.com, ashutosh.dixit@intel.com, gregkh , Linux Kernel Mailing List , Kishon Vijay Abraham I , Lorenzo Pieralisi , linux-pci , linux-ntb@googlegroups.com, Jon Mason , Dave Jiang , Allen Hubbe Subject: Re: [PATCH 0/8] Virtio-over-PCIe on non-MIC Message-ID: <20190117162601.tbmi4ounrnktzjga@axis.com> References: <20190116163253.23780-1-vincent.whitchurch@axis.com> <20190117105441.eqediwlekofp2srg@axis.com> <20190117151906.odvozs6kz3uvx32y@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 17, 2019 at 04:53:25PM +0100, Arnd Bergmann wrote: > On Thu, Jan 17, 2019 at 4:19 PM Vincent Whitchurch > wrote: > > On Thu, Jan 17, 2019 at 01:39:27PM +0100, Arnd Bergmann wrote: > > > Can you describe how you expect a VOP device over NTB or > > > PCIe-endpoint would get created, configured and used? > > > > Assuming PCIe-endpoint: > > > > On the RC, a vop-host-backend driver (PCI driver) sets up some shared > > memory area which the RC and the endpoint can use to communicate the > > location of the MIC device descriptors and other information such as the > > MSI address. It implements vop callbacks to allow the vop framework to > > obtain the address of the MIC descriptors and send/receive interrupts > > to/from the guest. > > > > On the endpoint, the PCIe endpoint driver sets up (hardcoded) BARs and > > memory regions as required to allow the endpoint and the root complex to > > access each other's memory. > > > > On the endpoint, the vop-guest-backend, via the shared memory set up by > > the vop-host-backend, obtains the address of the MIC device page and the > > MSI address, and a method to receive vop interrupts from the host. This > > information is used to implement the vop callbacks allowing the vop > > framework to access to the MIC device page and send/receive interrupts > > from/to the host. > > Ok, this seems fine so far. So the vop-host-backend is a regular PCI > driver that implements the VOP protocol from the host side, and it > can talk to either a MIC, or another guest-backend written for the PCI-EP > framework to implement the same protocol, right? Yes, but just to clarify: the placement of the device page and the way to communicate the location of the device page address and any other information needed by the guest-backend are hardware-specific so there is no generic vop-host-backend implementation which can talk to both a MIC and to something else. > > vop (despite its name) doesn't care about PCIe. The vop-guest-backend > > doesn't actually need to talk to the PCIe endpoint driver. The > > vop-guest-backend can be probed via any means, such as via a device tree > > on the endpoint. > > > > On the RC, userspace opens the vop device and adds the virtio devices, > > which end up in the MIC device page set up by the vop-host-backend. > > > > On the endpoint, when the vop framework (via the vop-guest-backend) sees > > these devices, it registers devices on the virtio bus and the virtio > > drivers are probed. > > Ah, so the direction is fixed, and it's the opposite of what Christoph > and I were expecting. This is probably something we need to discuss > a bit. From what I understand, there is no technical requirement why > it has to be this direction, right? I don't think the vop framework itself has any such requirement. The MIC uses it in this way (see Documentation/mic/mic_overview.txt) and it also makes sense (to me, at least) if one wants to treat the endpoint like one would treat a virtualized guest. > What I mean is that the same vop framework could work with > a PCI-EP driver implementing the vop-host-backend and > a PCI driver implementing the vop-guest-backend? In order > to do this, the PCI-EP configuration would need to pick whether > it wants the EP to be the vop host or guest, but having more > flexibility in it (letting each side add virtio devices) would be > harder to do. Correct, this is my understanding also. > > On the RC, userspace implements the device end of the virtio > > communication in userspace, using the MIC_VIRTIO_COPY_DESC ioctl. I > > also have patches to support vhost. > > This is a part I don't understand yet. Does this mean that the > normal operation is between a user space process on the vop-host > talking to the kernel on the vop-guest? Yes. For example, the guest mounts a 9p filesystem with virtio-9p and the 9p server is implemented in a userspace process on the host. This is again similar to virtualization. > I'm a bit worried about the ioctl interface here, as this combines the > configuration side with the actual data transfer, and that seems > a bit inflexible. > > > > Is there always one master side that is responsible for creating > > > virtio devices on it, with the slave side automatically attaching to > > > them, or can either side create virtio devices? > > > > Only the master can create virtio devices. The virtio drivers run on > > the slave. > > Ok. > > > > Is there any limit on > > > the number of virtio devices or queues within a VOP device? > > > > The virtio device information (mic_device_desc) is put into the MIC > > device page whose size is limited by the ABI header in > > include/uapi/linux/mic_ioctl.h (MIC_DP_SIZE, 4096 bytes). So the number > > of devices is limited by the limit of the number of device descriptors > > that can fit in that size. There is also a per-device limit on the > > number of vrings (MIC_VRING_ENTRIES) and vring entries > > (MIC_VRING_ENTRIES) in the ABI header. > > Ok, so you can have multiple virtio devices (e.g. a virtio-net and > virtio-console) but not an arbitrary number? I suppose we can always > extend it later if that becomes a problem. Yes.