Received: by 10.213.65.68 with SMTP id h4csp3906imn; Thu, 15 Mar 2018 14:32:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELvklF/GxI2y+npbJO91GnjB8DEF6Q+eC72JUiKh4rNNshHhKlwxcHJjx02t8evoEYz83FOd X-Received: by 10.101.90.10 with SMTP id y10mr7813320pgs.34.1521149571232; Thu, 15 Mar 2018 14:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521149571; cv=none; d=google.com; s=arc-20160816; b=tCrcuzF1QgfJGtd7GN0QSPHt78GO2zJylf7//rIb98PeWDLKcN5mrQD3Y3CAX9Nylw Y36Mtb8ur5ACARaIAfouCm/qi/iKarEn/bG1JrLRXtU9CKsXp6Mnr0/WRqHY0dkqkZiw gqMffUuaTiLbw66WbfnZWhYu8C/QZMzSQHn97K4FxI5uhtfeMDPQJQ8zKNygRPVN0cbw b2yEjdM/d6ygmn4BLtzU5f+2d4p8R66esOKDfU8BnTub05nV9PaoYnvSar2FkuMvBlzV W1VX9mgSdtCGRT0JktbQ//ppD0fvfeI6pYwUFuTXYoendIteT2oIBV/io6sidEx18A6O K1Dw== 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:mime-version :user-agent:message-id:date:cc:to:from:subject :arc-authentication-results; bh=9rY8RbtMLUOuK8/6a4Tw2qJDbZt+e/QZzm0VaJ3o+z0=; b=j7Wt0HLZb9chVgS0OYcpFsvhB3lVmZA141/h4vc+4h+xMz+lRbL355ZrScT/5IVCC0 VeYoPIER9WfwYurl9gkF+JK6jDxkZkdKoIF9xbeNHOYFamnPcRHyU5UCXKAVTxZhvRj5 itukX/TxR7U03CFkuOQpm5jFYvALcqN4jn/9kCshV3oSXbaJGMGeuhgudMFkZowRQTLA JAWU76EUtcINGfYxBiQvE8YnoEs+32uDhv3mKH8jB6rqz3dXWhvxRFV0JSpy+/nLsuQg Jusg/wM3tOq/80Drf2kldDY3dbFlfztkSga18wkJkDxoL45RcBsqHy4xbZQmjYhTDLYE t3hg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si3950062pgn.298.2018.03.15.14.32.34; Thu, 15 Mar 2018 14:32:51 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbeCOVbh (ORCPT + 99 others); Thu, 15 Mar 2018 17:31:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50196 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751774AbeCOVbf (ORCPT ); Thu, 15 Mar 2018 17:31:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 718D5272AC; Thu, 15 Mar 2018 21:31:35 +0000 (UTC) Received: from gimli.home (ovpn-117-203.phx2.redhat.com [10.3.117.203]) by smtp.corp.redhat.com (Postfix) with ESMTP id C109560BE5; Thu, 15 Mar 2018 21:31:27 +0000 (UTC) Subject: [PATCH v2 0/3] vfio/pci: ioeventfd support From: Alex Williamson To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, alex.williamson@redhat.com, peterx@redhat.com, eric.auger@redhat.com, aik@ozlabs.ru Date: Thu, 15 Mar 2018 15:31:27 -0600 Message-ID: <20180315212634.15150.88094.stgit@gimli.home> User-Agent: StGit/0.18-102-gdf9f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 15 Mar 2018 21:31:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A vfio ioeventfd will perform the pre-specified device write on triggering of an eventfd. When coupled with KVM ioeventfds, this feature allows a VM to trap a device page for virtualization, while also registering targeted ioeventfds to maintain performance of high frequency register writes within the trapped range. Much like the existing interrupt eventfd/irqfd coupling, such writes can be handled entirely in the host kernel. The new VFIO device ioctl may be supported by any vfio bus driver, including mdev drivers, but the implementation here only enables vfio-pci. This is intended as an acceleration path, bus drivers may choose which regions to support and userspace should always intend to fall back to non-accelerated handling when unavailable. v1->v2: * Peter & Eric Sign-offs on 1/3 * mutex_destroy() in 3/3 * Slight enhancement to uapi description * sparse clean - Sparse didn't like that we dropped the __iomem address space when calling iowriteXX, re-adding it via the opaque and data pointers of the virq was crude, and that was not a 32-bit friendly soluion anyway, so add the iomem address to our ioeventfd struct, pass that, and use a more simple, common handler. RFC->v1: * An arbitrary limit is added for the number of ioeventfds supported per device. The intention is to set this high enough to allow any reasonable use case, but limit malicious user behavior. * Split patches, including adding a patch for endian neutral io reads and writes. This should be a nop for little-endian and avoid redundant swap on big-endian, and hopefully resolves Alexey's comments regarding the endian nature of this interface. * Rebase to v4.16-rc3 Thanks, Alex --- Alex Williamson (3): vfio/pci: Pull BAR mapping setup from read-write path vfio/pci: Use endian neutral helpers vfio/pci: Add ioeventfd support drivers/vfio/pci/vfio_pci.c | 35 +++++++ drivers/vfio/pci/vfio_pci_private.h | 19 ++++ drivers/vfio/pci/vfio_pci_rdwr.c | 184 +++++++++++++++++++++++++++++++---- include/uapi/linux/vfio.h | 27 +++++ 4 files changed, 245 insertions(+), 20 deletions(-)