From patchwork Sun Nov 23 17:57:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 41382 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE48C2036A for ; Sun, 23 Nov 2014 17:58:43 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf4595884lab.4 for ; Sun, 23 Nov 2014 09:58:42 -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=HUprM28M7jFgQ3cKFiwnR4M1qOB5eONnUxJ0VgzseQ4=; b=TeliAfq6V9/6FwB9ExW3fBrwjwNzUMHdb7N0ralHINR6UXvY7fyk/hef/d4MdQYorF CdhlHb6Cbp3POalm6PGZqD6ZwBvI9Az0QYxxc/gwLi4gHP+U7eux/P4JJyFla6YqalOz mKsYQl4nbH+kg0DxEFX42ooMTKnmSceM4A34qPtIJImy8bBoaDbKskAEiVs8cRVrWZHL FW2nkNgpd2eqChL4g+oBmCZYtP7F+8QK3HjjWtOyPORfJiwGgaWV+1yjpvqt2wKKpSAW g11E3MQWG4u2o+Q12fbSE36tBdqFr025ZMkWbJ3qR3Eqq/23sQHoRAHP99TBElcD/vni fGsA== X-Gm-Message-State: ALoCoQmJoLbMP2k8NmGFS+TowB1B+l2ZvjFWzZi3cwBun+c5w3tzzpbCZYz3170sFqY5GNPJqOL+ X-Received: by 10.112.17.65 with SMTP id m1mr22204lbd.16.1416765522754; Sun, 23 Nov 2014 09:58:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.226 with SMTP id b2ls333779lak.36.gmail; Sun, 23 Nov 2014 09:58:42 -0800 (PST) X-Received: by 10.112.135.229 with SMTP id pv5mr16333399lbb.52.1416765522447; Sun, 23 Nov 2014 09:58:42 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id ky4si12822226lbc.28.2014.11.23.09.58.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 09:58:42 -0800 (PST) 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 mail-lb0-f176.google.com with SMTP id p9so5232059lbv.21 for ; Sun, 23 Nov 2014 09:58:42 -0800 (PST) X-Received: by 10.112.38.4 with SMTP id c4mr636064lbk.46.1416765522369; Sun, 23 Nov 2014 09:58:42 -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.184.201 with SMTP id ew9csp153031lbc; Sun, 23 Nov 2014 09:58:41 -0800 (PST) X-Received: by 10.194.174.40 with SMTP id bp8mr26231814wjc.104.1416765521707; Sun, 23 Nov 2014 09:58:41 -0800 (PST) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com. [74.125.82.51]) by mx.google.com with ESMTPS id on10si19423368wjc.63.2014.11.23.09.58.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 09:58:41 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.51 as permitted sender) client-ip=74.125.82.51; Received: by mail-wg0-f51.google.com with SMTP id k14so10337291wgh.38 for ; Sun, 23 Nov 2014 09:58:41 -0800 (PST) X-Received: by 10.194.193.38 with SMTP id hl6mr26942964wjc.38.1416765521474; Sun, 23 Nov 2014 09:58:41 -0800 (PST) Received: from gnx2579.gnb.st.com (weg38-3-78-232-41-119.fbx.proxad.net. [78.232.41.119]) by mx.google.com with ESMTPSA id vy7sm17407686wjc.27.2014.11.23.09.58.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 09:58:40 -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, joel.schopp@amd.com, kim.phillips@freescale.com, paulus@samba.org, gleb@kernel.org, pbonzini@redhat.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, ming.lei@canonical.com, feng.wu@intel.com Subject: [PATCH v4 3/3] KVM: arm64: add irqfd support Date: Sun, 23 Nov 2014 18:57:00 +0100 Message-Id: <1416765420-12057-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416765420-12057-1-git-send-email-eric.auger@linaro.org> References: <1416765420-12057-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: , From: Joel Schopp This patch enables irqfd for arm64. Signed-off-by: Joel Schopp Signed-off-by: Eric Auger --- [Eric Auger] - originates from Joel's [RFC PATCH] arm64: KVM: add irqfd support http://www.spinics.net/lists/kvm-arm/msg10798.html - isolates modifications really related to irqfd --- Documentation/virtual/kvm/api.txt | 4 ++-- arch/arm64/include/uapi/asm/kvm.h | 3 +++ arch/arm64/kvm/Kconfig | 2 ++ arch/arm64/kvm/Makefile | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 4deccc0..c76ce04 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2206,7 +2206,7 @@ into the hash PTE second double word). 4.75 KVM_IRQFD Capability: KVM_CAP_IRQFD -Architectures: x86 s390 arm +Architectures: x86 s390 arm arm64 Type: vm ioctl Parameters: struct kvm_irqfd (in) Returns: 0 on success, -1 on error @@ -2232,7 +2232,7 @@ Note that closing the resamplefd is not sufficient to disable the irqfd. The KVM_IRQFD_FLAG_RESAMPLE is only necessary on assignment and need not be specified with KVM_IRQFD_FLAG_DEASSIGN. -On arm, the gsi must be a shared peripheral interrupt (SPI). +On arm/arm64, the gsi must be a shared peripheral interrupt (SPI). This means the corresponding programmed GIC interrupt ID is gsi+32. 4.76 KVM_PPC_ALLOCATE_HTAB diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 8e38878..1ed4417 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -182,6 +182,9 @@ struct kvm_arch_memory_slot { /* Highest supported SPI, from VGIC_NR_IRQS */ #define KVM_ARM_IRQ_GIC_MAX 127 +/* One single KVM irqchip, ie. the VGIC */ +#define KVM_NR_IRQCHIPS 1 + /* PSCI interface */ #define KVM_PSCI_FN_BASE 0x95c1ba5e #define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index 279e1a0..09c25c2 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -26,6 +26,7 @@ config KVM select KVM_ARM_HOST select KVM_ARM_VGIC select KVM_ARM_TIMER + select HAVE_KVM_EVENTFD ---help--- Support hosting virtualized guest machines. @@ -50,6 +51,7 @@ config KVM_ARM_MAX_VCPUS config KVM_ARM_VGIC bool depends on KVM_ARM_HOST && OF + select HAVE_KVM_IRQFD ---help--- Adds support for a hardware assisted, in-kernel GIC emulation. diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile index 32a0961..2e6b827 100644 --- a/arch/arm64/kvm/Makefile +++ b/arch/arm64/kvm/Makefile @@ -11,7 +11,7 @@ ARM=../../../arch/arm/kvm obj-$(CONFIG_KVM_ARM_HOST) += kvm.o -kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o +kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o kvm-$(CONFIG_KVM_ARM_HOST) += $(ARM)/arm.o $(ARM)/mmu.o $(ARM)/mmio.o kvm-$(CONFIG_KVM_ARM_HOST) += $(ARM)/psci.o $(ARM)/perf.o