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: Auger Eric X-Patchwork-Id: 50577 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4A2E7214B3 for ; Thu, 2 Jul 2015 13:18:05 +0000 (UTC) Received: by laer2 with SMTP id r2sf19951306lae.3 for ; Thu, 02 Jul 2015 06:18:04 -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=vKrjpiko5jw0r1PSqsQKNdvTBdWZZLjfnY77tjBKPzs=; b=CbdBT2yn3wMVJ1jnEOdeXkfkRJpx2A0WdfMs70aCJWvB4KxrXeWeB72LyyWYEqD1gt JWNqhwSSSMLoB9Zg4R5ry/+Lo/rLxthXwbraq66SqpCOR10EVCqedzimW9PjhGHNaEpe kLjxJyEwXsIkrkW1aMymazQ8GhAlftK3IXfSguCUqJIDzonyVPAK/CPAW7n9sC3uRLa5 ADsEPNDUtzaS4O4Ig4UC3qrecAb5X2eavb56Qre03zwAtYG8SPviVS0lzy/XnvOxmSO+ JcH6rEDOGX14rIXho/nzVGjTI84G5AHMf1JhQIhmEXuonoQIVTow4CCyAVFXeVa260Ep EtMQ== X-Gm-Message-State: ALoCoQkg3mL3mDRtUQdotMbpa+rS2SUf6FUx47o0BX1qY7terGM7yG0KrDb9zFqltX3OeXhIl8pl X-Received: by 10.112.40.45 with SMTP id u13mr19956889lbk.0.1435843084249; Thu, 02 Jul 2015 06:18:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.10 with SMTP id j10ls357015lae.6.gmail; Thu, 02 Jul 2015 06:18:04 -0700 (PDT) X-Received: by 10.152.20.228 with SMTP id q4mr31216218lae.12.1435843084109; Thu, 02 Jul 2015 06:18:04 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id le10si4427138lac.158.2015.07.02.06.18.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:18:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbcui10 with SMTP id ui10so31705350lbc.0 for ; Thu, 02 Jul 2015 06:18:04 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr30504032laj.19.1435843084012; Thu, 02 Jul 2015 06:18:04 -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.108.230 with SMTP id hn6csp476059lbb; Thu, 2 Jul 2015 06:18:03 -0700 (PDT) X-Received: by 10.181.13.230 with SMTP id fb6mr15740309wid.47.1435843081606; Thu, 02 Jul 2015 06:18:01 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com. [209.85.212.182]) by mx.google.com with ESMTPS id v2si8810196wjy.60.2015.07.02.06.18.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:18:01 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; Received: by wiga1 with SMTP id a1so152627845wig.0 for ; Thu, 02 Jul 2015 06:18:01 -0700 (PDT) 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> 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.176 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 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,