From patchwork Wed Nov 3 06:25:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12600277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5485C433F5 for ; Wed, 3 Nov 2021 06:49:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AAFC610E8 for ; Wed, 3 Nov 2021 06:49:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9AAFC610E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mfTEE+z90Vi6FzYYHWhMZV/e7GCzobYA+5tQLlVWHLQ=; b=xtdru7bS3OlVoNW+/LbB2RmOnK qK8EGMwfiUTPLaQUkACI4GkcSEWtchFX2X5KeKWLgxbfUwqxoaud2A7VVfHg7OUpTLVcA3oXjbVa7 AZX51Lzz7oS/NDloA9FtXiBrBCVDp4bKWeFcU7TYvea1a8VZny7o+iod2dF4vKGjrH3uV5TE+unhV KA+aXqIaU1hRHvt2jOyP6TtYETPvQD6pYpfwtoPMsIuYxM3y2mc/xeKVktYHa75sR5X2awtPcUj6S LFUrMJ9Vk6mgE2Lb4eWjleiUZ+DZG4WW3qSQO57QGatDJTSFflEhOdHLBEQmy3U+k0je36yJTXob0 pFJaSbxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miA3J-004Jqf-DW; Wed, 03 Nov 2021 06:47:18 +0000 Received: from mail-pg1-x54a.google.com ([2607:f8b0:4864:20::54a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mi9lI-004Cen-JQ for linux-arm-kernel@lists.infradead.org; Wed, 03 Nov 2021 06:28:41 +0000 Received: by mail-pg1-x54a.google.com with SMTP id o1-20020a635d41000000b002bd97c0a03dso1044960pgm.4 for ; Tue, 02 Nov 2021 23:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=ugTp3pj0zYJHc3RiE+6osaY4VwnihaeWletwlGqcNzU=; b=R3uU4a/mva3/sHp7C4ovXEbTpY7IYU6h/nzYCMUJp+ghGJCGhatLHR1IKqI10LJdsq metLBMGZYNoR04MfVYDKXlUey3kGDSwo0EjdTYks9XJKbommPpi8BgxoxZsCJFWVn+FH suf/FuoQtsLvDHUgsMRQSKYW6N1T76XjKMIT5Nofnr4EqXt5x9/XND18vMR8omRCh86s lmj2LyQP8xjLWfKoCds4tFt8KtCS6W5Xvnfb9Ast3913Gm3/3W7g9o2hEZ70yRhH9PIb d85b0EGtsmqV1k28mIcfQVqisSh3ApCaLI0unMYmbjVQtkJP9vVP6MdUcTHer2id1sPz 46RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=ugTp3pj0zYJHc3RiE+6osaY4VwnihaeWletwlGqcNzU=; b=itu/g/+4LxJnG9G4dzB5q5dmJKOmYGvsB4Zrk3lv4VydkLGZQcoIQSnKYg+tuu8pSQ wG8bPoVd5LZY9YZoxHA5ZI0DkdKtk8Ip+pZyLtOLiZHZC9/gBLoZEC8J6HxySpd1Gc7j px4fgWiSiSioUWtrhca5T/Nxk0wpYd0/pQTwVNRjdLzeugEQlcdJTkaqjUT/QiaukcAF tFMvFOpyncKRGzqqdFTHNqJoSa6ikJtfIBlzC3OnLy+4bNPq40qpfvEUVkZz2dcSwXiJ CLMapPt6OPfhri6UqVe1SO0EBuIImkMhgoCi9Aa2Hht4TB3U18TyLCouMgoKiaFMLtkp JBsA== X-Gm-Message-State: AOAM533qRVBaeobfegI2IqmZU2WgeVObLb2aGju2BKNShKpEvwR70NfC c7mI1GfGaRRFgMrLYE0YyJWBOVoOy5M= X-Google-Smtp-Source: ABdhPJxwjlhoTqnj4E9V//tM6ijYmQGHJIKCJ/YZeqcBnm3mpZgLE3LmRBu6b58jjITFPpnfBiYA1pEZdDg= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a17:90a:353:: with SMTP id 19mr12674037pjf.83.1635920918981; Tue, 02 Nov 2021 23:28:38 -0700 (PDT) Date: Tue, 2 Nov 2021 23:25:19 -0700 In-Reply-To: <20211103062520.1445832-1-reijiw@google.com> Message-Id: <20211103062520.1445832-28-reijiw@google.com> Mime-Version: 1.0 References: <20211103062520.1445832-1-reijiw@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [RFC PATCH v2 27/28] KVM: arm64: Activate trapping of disabled CPU features for the guest From: Reiji Watanabe To: Marc Zyngier , kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Will Deacon , Andrew Jones , Peng Liang , Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata , Reiji Watanabe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211102_232840_705491_86B533D3 X-CRM114-Status: GOOD ( 10.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Call kvm_vcpu_id_regs_trap_activate() at the first KVM_RUN to activate trapping of disabled CPU features. Signed-off-by: Reiji Watanabe --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/arm.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 691cb6ee0f5c..41f785fdc2e6 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -743,6 +743,7 @@ long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, struct kvm_arm_copy_mte_tags *copy_tags); int kvm_id_regs_consistency_check(const struct kvm_vcpu *vcpu); +void kvm_vcpu_id_regs_trap_activate(struct kvm_vcpu *vcpu); /* Guest/host FPSIMD coordination helpers */ int kvm_arch_vcpu_run_map_fp(struct kvm_vcpu *vcpu); diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index afc49d2faa9a..330a35217987 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -583,6 +583,8 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) return -EPERM; } + kvm_vcpu_id_regs_trap_activate(vcpu); + kvm_arm_vcpu_init_debug(vcpu); if (likely(irqchip_in_kernel(kvm))) {