From patchwork Mon Jun 30 15:01:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 32757 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C0B35203F4 for ; Mon, 30 Jun 2014 15:08:46 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id id10sf17134668vcb.11 for ; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=EQlRey2/42RVjyIj+bbBtwlXCkxYd1OV+3aA9HnK7k0=; b=jBWuQetNbpoZqF4R1trQ5h+CPuvWbqK9r0Ze0T3vPek2PL0ODJiurnbJ9UoNcfoxYW /rrQv9FjfP+J82ZUj3fWGiC+1B8Am200RCeA+2PcUoxXfStJkUTtADTsy/87Sk+OUcuH JNKlNIjXUQPBrSt3mKMQRbNtJB4qu7J8Zunrm/MWVDucG6Qshc70StRD2xIZwTsSlU5a h8STVqa442K9cgyuxZMPCbXeo4rcuGWiTlKSd1FO5Rt27uST7bRmcFV7BmV0bAqsJGPA fQIUDrFo5gyabFTMQ/8axLBw6M1zDjuuaGDsVt3qYDUrD2eBUHSAvaCMt6GJ80/SNBDz qI4Q== X-Gm-Message-State: ALoCoQmLAZSVpXChY0MaTyKfD3SReXd8uaasHccjSF/UBEWEvmjrEN4dtVBERGlCq+k4zYLxcOx4 X-Received: by 10.236.216.5 with SMTP id f5mr723337yhp.10.1404140926607; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.229 with SMTP id p92ls1510713qgp.92.gmail; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) X-Received: by 10.52.17.129 with SMTP id o1mr32360171vdd.0.1404140926494; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id yx7si10138904vdb.9.2014.06.30.08.08.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 08:08:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so7634785vcb.31 for ; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) X-Received: by 10.58.220.230 with SMTP id pz6mr38598713vec.9.1404140926416; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp147003vcb; Mon, 30 Jun 2014 08:08:46 -0700 (PDT) X-Received: by 10.66.66.199 with SMTP id h7mr53802396pat.30.1404140925465; Mon, 30 Jun 2014 08:08:45 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ot3si8764110pbb.111.2014.06.30.08.08.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jun 2014 08:08:45 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1d9b-0007aV-W1; Mon, 30 Jun 2014 15:05:59 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1d6R-0003pO-UG for linux-arm-kernel@lists.infradead.org; Mon, 30 Jun 2014 15:02:47 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.143]) by collaborate-mta1.arm.com (Postfix) with ESMTP id BF2A713FC66; Mon, 30 Jun 2014 10:02:11 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v6 15/21] KVM: ARM: vgic: revisit implementation of irqchip_in_kernel Date: Mon, 30 Jun 2014 16:01:44 +0100 Message-Id: <1404140510-5382-16-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1404140510-5382-1-git-send-email-marc.zyngier@arm.com> References: <1404140510-5382-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140630_080244_082368_4117854C X-CRM114-Status: UNSURE ( 8.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: mark.rutland@arm.com, Catalin Marinas , Will Deacon , Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 So far, irqchip_in_kernel() was implemented by testing the value of vctrl_base, which worked fine with GICv2. With GICv3, this field is useless, as we're using system registers instead of a emmory mapped interface. To solve this, add a boolean flag indicating if the we're using a vgic or not. Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 3 ++- virt/kvm/arm/vgic.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index d8d52a9..f6b9fec 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -117,6 +117,7 @@ struct vgic_params { struct vgic_dist { #ifdef CONFIG_KVM_ARM_VGIC spinlock_t lock; + bool in_kernel; bool ready; /* Virtual control interface mapping */ @@ -212,7 +213,7 @@ int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu); bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run, struct kvm_exit_mmio *mmio); -#define irqchip_in_kernel(k) (!!((k)->arch.vgic.vctrl_base)) +#define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel)) #define vgic_initialized(k) ((k)->arch.vgic.ready) int vgic_v2_probe(struct device_node *vgic_node, diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index e4b9cbb..1348e74 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1650,6 +1650,7 @@ int kvm_vgic_create(struct kvm *kvm) } spin_lock_init(&kvm->arch.vgic.lock); + kvm->arch.vgic.in_kernel = true; kvm->arch.vgic.vctrl_base = vgic->vctrl_base; kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF; kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;