From patchwork Mon Apr 13 12:29:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6208681 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 972DDBF4A6 for ; Mon, 13 Apr 2015 12:41:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA1B9202D1 for ; Mon, 13 Apr 2015 12:41:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD8C820340 for ; Mon, 13 Apr 2015 12:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932602AbbDMMkx (ORCPT ); Mon, 13 Apr 2015 08:40:53 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:32992 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932085AbbDMMcn (ORCPT ); Mon, 13 Apr 2015 08:32:43 -0400 Received: by wiax7 with SMTP id x7so63535709wia.0 for ; Mon, 13 Apr 2015 05:32:42 -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=ERESTpEr8+j3qjtYcyOmKQ25AaFHmDfXt1y9/cURGXg=; b=JE9V7mIWUETT7AlvW3j0v6TnKljfpzWoLzaPoLg95S1FtrWW+TNc63o4aPVCyOD91i jZByaK2U60qwNFRdkEvrnZwYHEP6656O9k1QQk8rbJHUwnOMBWe7MKs1GT5VRm6X/c7L /fcfXUok7pjYErr7CL86tdbEI1V5jkGz8az0a2NDSZSqhF3R7jX0dJo3PsjV31fvneSW L7EkPV4R//btuMPXZPwr459UKNAGBM0JwPYc5hVfalkjwrGLR8EnMA/kd8r8NMQw+0HY w8YX4u5Nt5bR55f8dzzcOkK9aERibF6ss+B+thkexJ83rMsLsxWlkVsE7EaFRV0FwPTb x1cQ== X-Gm-Message-State: ALoCoQmG6CvQ0QIWC2QTrk2PxI7Z1jWJxjk3QHoJCGmOAmRrZnoNxYh1+ANQctLN6ObS3FSIGBbr X-Received: by 10.180.97.225 with SMTP id ed1mr20822953wib.17.1428928362059; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id fl14sm2879910wjc.11.2015.04.13.05.32.40 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Apr 2015 05:32:41 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, feng.wu@intel.com, b.reynal@virtualopensystems.com Subject: [RFC v6 06/16] VFIO: Introduce vfio_device_external_ops Date: Mon, 13 Apr 2015 14:29:21 +0200 Message-Id: <1428928171-18884-7-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428928171-18884-1-git-send-email-eric.auger@linaro.org> References: <1428928171-18884-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 b18c38f..b0ec474 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,