From patchwork Wed Feb 11 08:32:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 44564 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 41E1C21527 for ; Wed, 11 Feb 2015 08:35:30 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf1752412wiv.0 for ; Wed, 11 Feb 2015 00:35:29 -0800 (PST) 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=RMaylED7orN/pedawcqDmWdaYZq4BGmkuiTLfqrxTaU=; b=cBmtKrAk0HLa46XJ6KICQYYycnKMxcfE3vRtw9HX4/qRBqVC+YFQEHlfA6H4gZR+ol nsnUYd+5f7vloBZNbHyEYwH9g/Tj/SwhP0UgRCnWM0WBG9KzOqoCXV7N+vbgRJV2KCMr Sub3IaFoz4tYFfZonSCSU4nXUKA2Y6aapMS8B4dz6FdKkPQUUJCj+3OSYN+6CoFhJ1PL UjgBwtluaC3Vxoc70OeKdaV8qk8URMxIl63dUwcp7enyTSGObNeG15TV4KEJHaMsCHNm JlJ7iaqrrk5N28XdUk83u0omSCoNW3pXINnqE6TKV/32XkHwlDB5U7mNU0PWcpSG2jwR gDOw== X-Gm-Message-State: ALoCoQnn/GDdD0/8JftSS1dbc/sYNxtjsaZ9GkdfvdptM5Q7HfrSND++2zOHgavMug0LrGMdqQlq X-Received: by 10.194.142.174 with SMTP id rx14mr3252499wjb.4.1423643729584; Wed, 11 Feb 2015 00:35:29 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.42 with SMTP id a10ls32323laf.71.gmail; Wed, 11 Feb 2015 00:35:29 -0800 (PST) X-Received: by 10.112.184.198 with SMTP id ew6mr7955802lbc.71.1423643729434; Wed, 11 Feb 2015 00:35:29 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id qj10si27596lbb.130.2015.02.11.00.35.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 00:35:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labpv20 with SMTP id pv20so1844891lab.8 for ; Wed, 11 Feb 2015 00:35:29 -0800 (PST) X-Received: by 10.152.28.227 with SMTP id e3mr26465106lah.117.1423643729365; Wed, 11 Feb 2015 00:35:29 -0800 (PST) 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.35.133 with SMTP id h5csp1110288lbj; Wed, 11 Feb 2015 00:35:28 -0800 (PST) X-Received: by 10.50.124.73 with SMTP id mg9mr2250719igb.38.1423643727896; Wed, 11 Feb 2015 00:35:27 -0800 (PST) Received: from mail-ig0-f180.google.com (mail-ig0-f180.google.com. [209.85.213.180]) by mx.google.com with ESMTPS id gy3si1249783icc.56.2015.02.11.00.35.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 00:35:27 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.213.180 as permitted sender) client-ip=209.85.213.180; Received: by mail-ig0-f180.google.com with SMTP id b16so2963730igk.1 for ; Wed, 11 Feb 2015 00:35:27 -0800 (PST) X-Received: by 10.107.161.75 with SMTP id k72mr37354263ioe.46.1423643727162; Wed, 11 Feb 2015 00:35:27 -0800 (PST) Received: from gnx2579.solutionip.com ([113.28.134.59]) by mx.google.com with ESMTPSA id m38sm62189ioi.39.2015.02.11.00.35.22 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Feb 2015 00:35:26 -0800 (PST) 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, feng.wu@intel.com Cc: andre.przywara@arm.com, patches@linaro.org, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, b.reynal@virtualopensystems.com, gleb@kernel.org, pbonzini@redhat.com Subject: [RFC v4 08/13] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked} Date: Wed, 11 Feb 2015 09:32:18 +0100 Message-Id: <1423643543-24409-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423643543-24409-1-git-send-email-eric.auger@linaro.org> References: <1423643543-24409-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.215.42 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: , Those 3 new wrapper functions call the respective VFIO external functions. Signed-off-by: Eric Auger --- v4: creation --- include/linux/vfio.h | 8 +++----- virt/kvm/vfio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/include/linux/vfio.h b/include/linux/vfio.h index e04ca93..565f5f7 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -106,14 +106,12 @@ extern struct device *vfio_external_base_device(struct vfio_device *vdev); struct vfio_platform_device; extern void vfio_external_mask(struct vfio_platform_device *vdev, int index); /* - * returns whether the VFIO IRQ is active: - * true if not yet deactivated at interrupt controller level or if - * automasked (level sensitive IRQ). Unfortunately there is no way to - * discriminate between handler auto-masking and user-space masking + * returns whether the VFIO IRQ is active at interrupt controller level + * or VFIO-masked. Note that if the use-space masked the IRQ index it + * cannot be discriminated from automasked handler situation. */ extern bool vfio_external_is_active(struct vfio_platform_device *vdev, int index); - extern void vfio_external_set_automasked(struct vfio_platform_device *vdev, int index, bool automasked); diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index 80a45e4..c995e51 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c @@ -134,6 +134,50 @@ static void kvm_vfio_put_vfio_device(struct vfio_device *vdev) kvm_vfio_device_put_external_user(vdev); } +bool kvm_vfio_external_is_active(struct vfio_platform_device *vpdev, + int index) +{ + bool (*fn)(struct vfio_platform_device *, int index); + bool active; + + fn = symbol_get(vfio_external_is_active); + if (!fn) + return -1; + + active = fn(vpdev, index); + + symbol_put(vfio_external_is_active); + return active; +} + +void kvm_vfio_external_mask(struct vfio_platform_device *vpdev, + int index) +{ + void (*fn)(struct vfio_platform_device *, int index); + + fn = symbol_get(vfio_external_mask); + if (!fn) + return; + + fn(vpdev, index); + + symbol_put(vfio_external_mask); +} + +void kvm_vfio_external_set_automasked(struct vfio_platform_device *vpdev, + int index, bool automasked) +{ + void (*fn)(struct vfio_platform_device *, int index, bool automasked); + + fn = symbol_get(vfio_external_set_automasked); + if (!fn) + return; + + fn(vpdev, index, automasked); + + symbol_put(vfio_external_set_automasked); +} + static bool kvm_vfio_group_is_coherent(struct vfio_group *vfio_group) { long (*fn)(struct vfio_group *, unsigned long);