From patchwork Mon Jan 9 06:24:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 90342 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp707113qgi; Sun, 8 Jan 2017 22:28:09 -0800 (PST) X-Received: by 10.84.176.100 with SMTP id u91mr188328042plb.7.1483943289907; Sun, 08 Jan 2017 22:28:09 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z40si59933083plh.114.2017.01.08.22.28.09; Sun, 08 Jan 2017 22:28:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940090AbdAIG1K (ORCPT + 25 others); Mon, 9 Jan 2017 01:27:10 -0500 Received: from outprodmail02.cc.columbia.edu ([128.59.72.51]:52109 "EHLO outprodmail02.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939713AbdAIG0J (ORCPT ); Mon, 9 Jan 2017 01:26:09 -0500 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail02.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Q5Nt006199 for ; Mon, 9 Jan 2017 01:26:06 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id 8E5CC81 for ; Mon, 9 Jan 2017 01:26:06 -0500 (EST) Received: from sendprodmail02.cc.columbia.edu (sendprodmail02.cc.columbia.edu [128.59.72.14]) by hazelnut (Postfix) with ESMTP id 6A4AF82 for ; Mon, 9 Jan 2017 01:26:06 -0500 (EST) Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by sendprodmail02.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Q62s042363 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:26:06 -0500 Received: by mail-qk0-f200.google.com with SMTP id t84so100994255qke.7 for ; Sun, 08 Jan 2017 22:26:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KL0P3Lmr2YP3l7NNfpmZ0y1XZFp4TdiNNgvHuc0AUKk=; b=b6PkaQ48FSqlbPmnVlPprotQDlx6iw9cd4b+2QHgBR3Zf7Uti5jQ/hOsTtFAhrLDj8 sCESMxNniMbIe04QtSMy9TQvdXX+KhtgOKBeNz+hD5ND4XMXMd2xLHS8novy/Jt/wIAF x2k1O+LCwO3a7M1gKuY6tBlUumMZx3Acf76FE7tgFI2DMBpldkwgGYSBessd8R294qvr auucoQxSVVXwtzSZh+A1UOU+7E7w7EnhFtHO+N+kKy2q73c2bJo6N9OTsSJyJrfkIf7V Sl+71+IfW6FEx2ypV0xv3DggWnvowrM0cWki7lmUCh8LtwCUR35AvOUZ9Rb7UmgP4ZDS 4aog== X-Gm-Message-State: AIkVDXKKiAqHZtFSxg8+CeXHpXlQGtfaACaJWVvW1iPbmAb1ryF5tBozRQMCS7Bc/FgboMmrTIqV9tRiDzxuVSScYw5AtXAt6becfopSYRk8bmlELh/oqSgF+pPF0dsoSk14v6302QSiNjtM73iPzEi1JVU= X-Received: by 10.55.135.197 with SMTP id j188mr85501139qkd.71.1483943165695; Sun, 08 Jan 2017 22:26:05 -0800 (PST) X-Received: by 10.55.135.197 with SMTP id j188mr85501108qkd.71.1483943165553; Sun, 08 Jan 2017 22:26:05 -0800 (PST) Received: from jintack.cs.columbia.edu ([2001:18d8:ffff:16:21a:4aff:feaa:f900]) by smtp.gmail.com with ESMTPSA id h3sm8623257qtc.6.2017.01.08.22.26.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 22:26:04 -0800 (PST) From: Jintack Lim To: christoffer.dall@linaro.org, marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, vladimir.murzin@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, james.morse@arm.com, lorenzo.pieralisi@arm.com, kevin.brodsky@arm.com, wcohen@redhat.com, shankerd@codeaurora.org, geoff@infradead.org, andre.przywara@arm.com, eric.auger@redhat.com, anna-maria@linutronix.de, shihwei@cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jintack@cs.columbia.edu Subject: [RFC 26/55] KVM: arm/arm64: Add VGIC data structures for the nesting Date: Mon, 9 Jan 2017 01:24:22 -0500 Message-Id: <1483943091-1364-27-git-send-email-jintack@cs.columbia.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu> References: <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu> X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.78 on 128.59.72.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoffer Dall This adds a couple of extra data structures: The nested_vgic_vX structures contain the data manipulated by the guest hypervisor when it faults/traps on accesses to the GICH_ interface. The shadow_vgic_vX arrays contain the shadow copies of the LRs. That is, it is a modified version of the nested_vgic_vX->vgic_lr. The reason why we need a modified version is that for interrupts with the HW bit set (those for the timer) the interrupt number must be that of the host hardware number, and not the virtual one programmed by the guest hypervisor. The hw_vX_cpu_if pointers point to the registers that the lowvisor (EL2) code actually copied into hardware when switching to the guest, so at init time we set: vgic_cpu->hw_v2_cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; And we should change the vgic-sr function to read the LRs from the hw_v2_lr pointer. Signed-off-by: Christoffer Dall Signed-off-by: Jintack Lim --- include/kvm/arm_vgic.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 1.9.1 diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 002f092..9a9cb27 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -246,6 +246,26 @@ struct vgic_cpu { unsigned int used_lrs; struct vgic_irq private_irqs[VGIC_NR_PRIVATE_IRQS]; + /* CPU vif control registers for the virtual GICH interface */ + union { + struct vgic_v2_cpu_if nested_vgic_v2; + struct vgic_v3_cpu_if nested_vgic_v3; + }; + + /* + * The shadow vif control register loaded to the hardware when + * running a sted L2 guest with the virtual IMO bit set. + */ + union { + struct vgic_v2_cpu_if shadow_vgic_v2; + struct vgic_v3_cpu_if shadow_vgic_v3; + }; + + union { + struct vgic_v2_cpu_if *hw_v2_cpu_if; + struct vgic_v3_cpu_if *hw_v3_cpu_if; + }; + spinlock_t ap_list_lock; /* Protects the ap_list */ /*