From patchwork Sun Oct 14 00:04:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1589331 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B36CEDF24C for ; Sun, 14 Oct 2012 00:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753230Ab2JNAEu (ORCPT ); Sat, 13 Oct 2012 20:04:50 -0400 Received: from mail-qa0-f46.google.com ([209.85.216.46]:45943 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752771Ab2JNAEt (ORCPT ); Sat, 13 Oct 2012 20:04:49 -0400 Received: by mail-qa0-f46.google.com with SMTP id c26so452957qad.19 for ; Sat, 13 Oct 2012 17:04:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=AVsr7XVtnYJY+PfA18oBMosKf8VkNhorQvmygWgsffI=; b=beJffaEUJAfyPNQIGUq+TX/dsOUJIFY73ZuiRPYcwUmKUsFN+0+y2AcwyPi3tXHh7A 4+1ImpUr08aN+bGLDrjvi+qXwe2E0GiLAgn8+jZ878085CNd0scK5isgsyKBobmYIKh0 aQ+/eXDI6grex+3xj3t1eHrl7LSvk6bB/z6Oo42efUtRD5tt1qsqODFBlK/MDyPN8EPf 4qwId6WvUtvxSmDd0E/TqLI0/lpLXowCP97ByZaVzqLH0lG/C5kF1G8E2KP7f7AvIRxJ GUQBUOujqe8q3lsxsBrS7iNN5eVoWnjvI6+Vn3+9mIxjT/xH4/afkff4mvaIE1nir7aA GY+Q== Received: by 10.229.197.204 with SMTP id el12mr3903280qcb.24.1350173088336; Sat, 13 Oct 2012 17:04:48 -0700 (PDT) Received: from localhost.localdomain (pool-72-80-83-148.nycmny.fios.verizon.net. [72.80.83.148]) by mx.google.com with ESMTPS id x19sm10228199qeq.12.2012.10.13.17.04.47 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 13 Oct 2012 17:04:48 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: peter.maydell@linaro.org, marc.zyngier@arm.com, Christoffer Dall Subject: [RFC PATCH 1/3] KVM: ARM: Introduce KVM_INIT_IRQCHIP ioctl Date: Sat, 13 Oct 2012 20:04:23 -0400 Message-Id: <1350173065-35350-2-git-send-email-c.dall@virtualopensystems.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350173065-35350-1-git-send-email-c.dall@virtualopensystems.com> References: <1350173065-35350-1-git-send-email-c.dall@virtualopensystems.com> X-Gm-Message-State: ALoCoQlx+wXZDKqsk+Ykjjdt9SfyI6sg4/iBXXNUR5agLLaKAXfJ+4m2lZ+ht9EtuWz6E+ld/nvk Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Used to initialize the in-kernel interrupt controller. On ARM we need to map the virtual generic interrupt controller (vGIC) into Hyp the guest's physicall address space so the guest can access the virtual cpu interface. This must be done after the IRQ chips is create and after a base address has been provided for the emulated platform (patch is following), but before the CPU is initally run. Signed-off-by: Christoffer Dall --- Documentation/virtual/kvm/api.txt | 16 ++++++++++++++++ arch/arm/kvm/arm.c | 1 + include/linux/kvm.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 25eacc6..26e953d 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2102,6 +2102,22 @@ This ioctl returns the guest registers that are supported for the KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. +4.79 KVM_INIT_IRQCHIP + +Capability: KVM_CAP_INIT_IRQCHIP +Architectures: arm +Type: vm ioctl +Parameters: none +Returns: 0 on success, -1 on error + +Initialize the in-kernel interrupt controller. On ARM we need to map the +virtual generic interrupt controller (vGIC) into Hyp the guest's physicall +address space so the guest can access the virtual cpu interface. This must be +done after the IRQ chips is create and after a base address has been provided +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is +initally run. + + 5. The kvm_run structure ------------------------ diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index f8c377b..85c76e4 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -195,6 +195,7 @@ int kvm_dev_ioctl_check_extension(long ext) switch (ext) { #ifdef CONFIG_KVM_ARM_VGIC case KVM_CAP_IRQCHIP: + case KVM_CAP_INIT_IRQCHIP: r = vgic_present; break; #endif diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 8091b1d..90ee023 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -626,6 +626,7 @@ struct kvm_ppc_smmu_info { #ifdef __KVM_HAVE_READONLY_MEM #define KVM_CAP_READONLY_MEM 81 #endif +#define KVM_CAP_INIT_IRQCHIP 82 #ifdef KVM_CAP_IRQ_ROUTING @@ -839,6 +840,8 @@ struct kvm_s390_ucas_mapping { #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) /* Available with KVM_CAP_PPC_ALLOC_HTAB */ #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) +/* Available with KVM_CAP_INIT_IRQCHIP */ +#define KVM_INIT_IRQCHIP _IO(KVMIO, 0xa8) /* * ioctls for vcpu fds