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: Auger Eric X-Patchwork-Id: 47107 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DD44720553 for ; Mon, 13 Apr 2015 12:32:43 +0000 (UTC) Received: by wiun10 with SMTP id n10sf9718270wiu.1 for ; Mon, 13 Apr 2015 05:32:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ERESTpEr8+j3qjtYcyOmKQ25AaFHmDfXt1y9/cURGXg=; b=WzLhL9Sab3KBk6RVjv1X53U4GQIl+NIRzDtlLhJ9+ptKIRvf4Ctb/GqdHkmWXQpVp1 bJv+CRw8N2rFOfSfg93FQrGrM8eE2ipcHBiB6Ej1wg+zM5pmZ4vCm4FXeHdu2zxwu9/E c7bd+n5OsyT93Ci9f6jxgJAE6olZX0WNeiqFNsoQ9baACtgVs84Q0ii5krMy/bW+vAqQ bf2Rj9h8YUhzzU8PEzrUCCiK0IYAxZDwp8yCiOivZ7xvuYDswGyxETR69BcVmHP/l/6J /y9V4XXOWBSVW1pP6UvISKSyygLUkrcmRYos1OF79mTaCMOOup0L8BoBYN4sbZSatAA0 lOdw== X-Gm-Message-State: ALoCoQn0Fc4+pw7+iWiG4OK5Tj9o0jXjUO42qHiDJbKAC4N/RztrI9H3uAWtm5+y9hBJrkz4gazU X-Received: by 10.112.189.131 with SMTP id gi3mr2152781lbc.6.1428928363092; Mon, 13 Apr 2015 05:32:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.172 with SMTP id p12ls716670lal.40.gmail; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) X-Received: by 10.152.22.168 with SMTP id e8mr12880421laf.27.1428928362956; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id t3si8317001lae.6.2015.04.13.05.32.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbuc2 with SMTP id uc2so57207902lbb.2 for ; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) X-Received: by 10.152.8.78 with SMTP id p14mr13183702laa.19.1428928362873; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1175001lbt; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) X-Received: by 10.194.81.104 with SMTP id z8mr27118328wjx.45.1428928362335; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com. [74.125.82.46]) by mx.google.com with ESMTPS id cs3si8167962wib.117.2015.04.13.05.32.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.46 as permitted sender) client-ip=74.125.82.46; Received: by wgsk9 with SMTP id k9so79018303wgs.3 for ; Mon, 13 Apr 2015 05:32:42 -0700 (PDT) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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,