From patchwork Mon Jan 9 06:24:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9503877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD63660757 for ; Mon, 9 Jan 2017 06:29:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD2A2280D0 for ; Mon, 9 Jan 2017 06:29:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0A582815E; Mon, 9 Jan 2017 06:29:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 694B0280D0 for ; Mon, 9 Jan 2017 06:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942282AbdAIG2d (ORCPT ); Mon, 9 Jan 2017 01:28:33 -0500 Received: from outprodmail01.cc.columbia.edu ([128.59.72.39]:38651 "EHLO outprodmail01.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939848AbdAIG0l (ORCPT ); Mon, 9 Jan 2017 01:26:41 -0500 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail01.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096PWAc017317 for ; Mon, 9 Jan 2017 01:26:33 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id 0CB298A for ; Mon, 9 Jan 2017 01:26:33 -0500 (EST) Received: from sendprodmail01.cc.columbia.edu (sendprodmail01.cc.columbia.edu [128.59.72.13]) by hazelnut (Postfix) with ESMTP id D274A86 for ; Mon, 9 Jan 2017 01:26:32 -0500 (EST) Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by sendprodmail01.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096QWa1041749 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:26:32 -0500 Received: by mail-qt0-f199.google.com with SMTP id f4so58601172qte.1 for ; Sun, 08 Jan 2017 22:26:32 -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=HgoeRbscYA5QdpEOsNpIhgRmeOCICYzHfcarNNNUqJI=; b=NUxCoC+rPN3Gu2ZMBmgANJe6AY5LStESSQQHPbet4Cfc9RwwWFA7DVxf1n3SR69RY+ HIFq2F7gGW22kO6l91zrglYo8H471TLzWFhQEjNVuy4Bg3g3A+NMbdUb7eIETrNYpTiQ z50I7czWU05C5jxP0DqiNmSHagK3878GEPoORMK4JzgPbYxuoq9vA4QJGFY3r2UBg5lp uRB5vnbS4hDP9h8rim/iD0MQOneZI3aoI/et73z8andSTYbLR0+0aJoRGsoo3rFXL+No q9Mxeu4oMxsR0gbablrUzO2HBZTxSUFho4rN3WBHilxnL4FjZYUDjhsrQ/OgZWZoK9bx 9gWg== X-Gm-Message-State: AIkVDXJQOIX2ceHIlSJAbAvyor+utBOR4Uj9bXy+WDZ85u8/PhOuax1Zk42ch7HpkMFZ7K8jAOI1iJgWDHUFCKicPoQZjXeCnyf716E7S1cB+T48/3eC9UmiprSSn+aHLhchlf+yCsTwcWE= X-Received: by 10.55.127.129 with SMTP id a123mr83632600qkd.129.1483943192151; Sun, 08 Jan 2017 22:26:32 -0800 (PST) X-Received: by 10.55.127.129 with SMTP id a123mr83632575qkd.129.1483943192019; Sun, 08 Jan 2017 22:26:32 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 22:26:31 -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 48/55] KVM: arm64: Emulate TLBI instruction Date: Mon, 9 Jan 2017 01:24:44 -0500 Message-Id: <1483943091-1364-49-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.13 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christoffer Dall Currently, we flush ALL shadow stage-2 page tables on the tlbi instruction execution. We may be able to do this more efficiently by considering the vttbr_el2 value of the guest hypervisor, but leave it for now. Signed-off-by: Christoffer Dall Signed-off-by: Jintack Lim --- arch/arm64/kvm/sys_regs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index ddb641c..b0a057d 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -2013,8 +2013,14 @@ static int emulate_sys_reg(struct kvm_vcpu *vcpu, static int emulate_tlbi(struct kvm_vcpu *vcpu, struct sys_reg_params *params) { - /* TODO: support tlbi instruction emulation*/ - kvm_inject_undefined(vcpu); + /* + * We unmap ALL stage-2 page tables on tlbi instruction. + * We may make it more efficient by looking at the exact tlbi + * instruction. + */ + stage2_unmap_vm(vcpu->kvm); + kvm_nested_s2_unmap(vcpu); + return 1; }