From patchwork Mon Aug 25 13:27:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 4774651 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6BB44C0338 for ; Mon, 25 Aug 2014 13:29:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73F482012D for ; Mon, 25 Aug 2014 13:29:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7EF162011E for ; Mon, 25 Aug 2014 13:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932536AbaHYN25 (ORCPT ); Mon, 25 Aug 2014 09:28:57 -0400 Received: from mail-we0-f182.google.com ([74.125.82.182]:59390 "EHLO mail-we0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932490AbaHYN2z (ORCPT ); Mon, 25 Aug 2014 09:28:55 -0400 Received: by mail-we0-f182.google.com with SMTP id k48so13274776wev.41 for ; Mon, 25 Aug 2014 06:28:54 -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=HBigFtgyUYaHRiozV3/CfPEJvVdSLi0KBgRzMBNqaW0=; b=YNlXvdOQv8I5xzRfdOMsy9NNQEDJR/iDvZwHKuzVCrDPrK0Qt0Te+A/MgkiizP2Bn6 BtUROXTeQ066RNEhNkSJOD1uRGkSM90x+xbeqUddvW5hGCioqZY/rPKrP869LMG0W7ss TAVN3W9wvhfD9wtHYigW3jgQJ4XIdtyMF8dMOts1X6E1WJ+1Dgb2zqA5Cb7y/BRkWJpd UMpxojvvfH+pLqPWq8bS8zlyA8ZrwIKAceD4K+MiydLijc8Ec1tfj0sb1u/V0wLIl+SI kefR7j9Maee/nwruApCu7mtZL5lZr97TS74Sdh+80o9EA4RYXSoXO1y/NypiOhSXfhCR avZQ== X-Gm-Message-State: ALoCoQk/G4wcBD/T+TlV5Patzv58oDW1rGISWhmt0uN+ApMdT00TjvGUInF2rw0U2XlwlMVTPX4b X-Received: by 10.194.205.70 with SMTP id le6mr22519493wjc.25.1408973334406; Mon, 25 Aug 2014 06:28:54 -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 co6sm100101595wjb.31.2014.08.25.06.28.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 06:28:53 -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, joel.schopp@amd.com, kim.phillips@freescale.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, will.deacon@arm.com, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, john.liuli@huawei.com Subject: [RFC 8/9] KVM: KVM-VFIO: add kvm_vfio_arch_data and accessors Date: Mon, 25 Aug 2014 15:27:43 +0200 Message-Id: <1408973264-30384-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408973264-30384-1-git-send-email-eric.auger@linaro.org> References: <1408973264-30384-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, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 add a pointer to architecture specific data in kvm_vfio struct add accessors to keep kvm_vfio private Signed-off-by: Eric Auger --- arch/arm/include/asm/kvm_host.h | 8 ++++++++ virt/kvm/vfio.c | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 62cbf5b..4f1edbf 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -177,6 +177,14 @@ void kvm_vfio_device_put_external_user(struct vfio_device *vdev); int kvm_vfio_external_get_type(struct vfio_device *vdev); struct device *kvm_vfio_external_get_base_device(struct vfio_device *vdev); +struct kvm_vfio; +struct kvm_vfio_arch_data; +void kvm_vfio_device_set_arch_data(struct kvm_vfio *kv, + struct kvm_vfio_arch_data *ptr); +struct kvm_vfio_arch_data *kvm_vfio_device_get_arch_data(struct kvm_vfio *kv); +void kvm_vfio_lock(struct kvm_vfio *kv); +void kvm_vfio_unlock(struct kvm_vfio *kv); + /* We do not have shadow page tables, hence the empty hooks */ static inline int kvm_age_hva(struct kvm *kvm, unsigned long hva) { diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index f1c4e35..177b71e 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c @@ -28,6 +28,7 @@ struct kvm_vfio { struct list_head group_list; struct mutex lock; bool noncoherent; + struct kvm_vfio_arch_data *arch_data; }; static struct vfio_group *kvm_vfio_group_get_external_user(struct file *filep) @@ -338,6 +339,26 @@ static int kvm_vfio_create(struct kvm_device *dev, u32 type) return 0; } +void kvm_vfio_device_set_arch_data(struct kvm_vfio *kv, + struct kvm_vfio_arch_data *ptr) +{ + kv->arch_data = ptr; +} + +struct kvm_vfio_arch_data *kvm_vfio_device_get_arch_data(struct kvm_vfio *kv) +{ + return kv->arch_data; +} + +void kvm_vfio_lock(struct kvm_vfio *kv) +{ + mutex_lock(&kv->lock); +} + +void kvm_vfio_unlock(struct kvm_vfio *kv) +{ + mutex_unlock(&kv->lock); +} struct kvm_device_ops kvm_vfio_ops = { .name = "kvm-vfio",