From patchwork Thu Jul 2 13:17:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6709671 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8AC07C05AD for ; Thu, 2 Jul 2015 13:25:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B44202041E for ; Thu, 2 Jul 2015 13:25:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C22AC206EC for ; Thu, 2 Jul 2015 13:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753533AbbGBNY7 (ORCPT ); Thu, 2 Jul 2015 09:24:59 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:33191 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751698AbbGBNSC (ORCPT ); Thu, 2 Jul 2015 09:18:02 -0400 Received: by wgck11 with SMTP id k11so63122513wgc.0 for ; Thu, 02 Jul 2015 06:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vKrjpiko5jw0r1PSqsQKNdvTBdWZZLjfnY77tjBKPzs=; b=JU05nYn8mBrmi0YTnAYie25YsoGLaxMM3w2n40NqiMMwXcJzMOEUrMlSLMav2Zusao ky9C2QwntPR1y9byq6bDunC4ITRtGP0WEzrnavgNnzEhaiYqakFMudkqibsiadKkRcPn rLpFrU10eDQjSMMLxYqZ3y6s7VRcL6tjrQAkC0osQy0H5PDjW/1lDmJ5K5m9OIkSsIez +54Oyz7iOkZQj/r/+GRue5RnMvwV7/nON/L5bX1k4qmra7us/8V2EncZTSAWo5x3383E Xm6tx7jdXTgVqIIdzcwMyRYUeD/YthI8gP9mNQ/5s9Ux1zYqx+q67V31cD2AUGSPixOG Ofvw== X-Gm-Message-State: ALoCoQnD+fy1Qwhu9k3I6u12rjXQu0Bl9dbBLNV0r/kSFzJYZdPtCki7tqK3zD7WbJltZpFXsMIv X-Received: by 10.180.99.132 with SMTP id eq4mr23956649wib.88.1435843081316; Thu, 02 Jul 2015 06:18:01 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id tl3sm8157099wjc.20.2015.07.02.06.17.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:18:00 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, alex.williamson@redhat.com, pbonzini@redhat.com, avi.kivity@gmail.com, mtosatti@redhat.com, feng.wu@intel.com, joro@8bytes.org, b.reynal@virtualopensystems.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org Subject: [RFC 03/17] VFIO: Introduce vfio_device_external_ops Date: Thu, 2 Jul 2015 15:17:13 +0200 Message-Id: <1435843047-6327-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435843047-6327-1-git-send-email-eric.auger@linaro.org> References: <1435843047-6327-1-git-send-email-eric.auger@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP New bus callbacks are introduced. They correspond to external functions. To avoid messing up the main vfio_device_ops struct, a new vfio_device_external_ops struct is introduced. Signed-off-by: Eric Auger --- v6: creation --- include/linux/vfio.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/vfio.h b/include/linux/vfio.h index ddb4409..d79e8a9 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -19,6 +19,23 @@ #include /** + * struct vfio_device_external_ops - VFIO bus driver device callbacks + * used as external API + * @mask: mask any IRQ defined by triplet + * @is_active: returns whether any IRQ defined by triplet is active + * @set_automasked: sets the automasked flag of triplet's IRQ + */ +struct vfio_device_external_ops { + int (*mask)(void *device_data, unsigned index, unsigned start, + unsigned count); + int (*is_active)(void *device_data, unsigned index, unsigned start, + unsigned count); + int (*set_automasked)(void *device_data, unsigned index, + unsigned start, unsigned count, + bool automasked); +}; + +/** * struct vfio_device_ops - VFIO bus driver device callbacks * * @open: Called when userspace creates new file descriptor for device @@ -42,6 +59,7 @@ struct vfio_device_ops { unsigned long arg); int (*mmap)(void *device_data, struct vm_area_struct *vma); void (*request)(void *device_data, unsigned int count); + struct vfio_device_external_ops *external_ops; }; extern int vfio_add_group_dev(struct device *dev,