From patchwork Wed Feb 1 10:37:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 13124131 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 39ABDC636D3 for ; Wed, 1 Feb 2023 10:39:16 +0000 (UTC) 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:Message-ID: References:Mime-Version: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=ismEiaCtbFMUfADi6WtZZuyuBDAEKWbXjZJnFdDmeFw=; b=Nukpmifx+9uvEy6f9Wuu5ZIRL3 zRWyv3RAxWvzoB2WnqzB7PGRRuvgBVVFJzn9rbF1zndI2mLXQGiWlSfmmg06nqRxiW61muw8V0Ap8 YrXczbjmY1eLju11Wny3ijKQH/VBHKNs/nIE4hrqJAnn56GrVJS63z2xTJKy8dyYknqVEhJKZ5mvH VSpq/q/q5R51ZuPTcXEWIwLKdp/qDGgYhHknDtfLUUpggSb+tS0GCPtiwE+oFaa4SaciONMGLMXaP 2k3ZFXJ3U3AVxpPMOamQEUtBVlfuz9k6ctLuwgD0B+AK8SV1gqfnGZ5ZV8ULr/QAe+Mv0phxCh5aV zGdVkbRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNAVR-00BHHi-Cf; Wed, 01 Feb 2023 10:38:21 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNAVC-00BHEP-1b for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 10:38:07 +0000 Received: by mail-wr1-x449.google.com with SMTP id q18-20020adff512000000b002bfc49c299dso2874363wro.5 for ; Wed, 01 Feb 2023 02:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LkxKzYtJyLBnk6YaWLdXcrP+huEFDCptixA8sQJDrTA=; b=Cgj3iAnktqlF5j/X2Zs/AvWwSuC377hgw3vsTJuLls35Ku4dcC9GOC8s5WkGAsylPx 8AD2/jIoyM8KmqnlJl59pnaJQeBFva/t4Qkup7aDeVurYyMFaO8bHtgpv6AV3plLPdQ4 VCLJ7+3S1j2wHgTZcZVoLoIOnxREru4FkIT04NnLjyfs2ZAI+CoC22iK7KKmdYDbZBEZ A7JU0AkOvPaLeskvPozEUdct2hwGx13diIFSZTkyz7MbnZCeqMX5U/yK5A59yhC5ukaQ Ho7EhcjY2SG2hUizVbhCRUNeOMprPoAbyuf60umZEht/F//XRPeLdP5kQyxywilKLbBP xWfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LkxKzYtJyLBnk6YaWLdXcrP+huEFDCptixA8sQJDrTA=; b=w6fz2zOSfLIUi7fwc47Qv0W/a0/NIcUt6LKhhxC3fZbHVTuUFYJ+dyfOAV0UmpMjld 2sqH2rRa6PwdN/rG8eJOGhvVrG5VaiBFG4c7r7pWNbd6d3YSuAcEhiTRedspbfs6l5wO xunNOMTI1JqkHgRQwRiTBA7nm5cUM1XPGdMTF8Q47QpyfLoC5xXNchvHhMnxIbGH+DN7 V07whahqruxQGDDJtBWMfWXQn5oK5iFdoKABzByZguCdVYhR3j5UyccH/UnEgLjk1/6P Aq6wxQVtIi1hr8mMZiPLjAor2uBEQgchksXcGwPOJX6zBDEqHLSXkke3r6DeWWmfmhrN oXcw== X-Gm-Message-State: AO0yUKXzLemigNZQ4FRbKd2k6fi4F4Keaw0GW4OvjvjvbCXYmCVeK2Rf FHelN49/NLvHb84WAlWoP8Kdq2++q+Cm X-Google-Smtp-Source: AK7set+4dyT64Ybcc5I/aCMrcw8Vd3S+aCXtsLCGbugPPvCPuVOfo5Ea5wI/nh9/m6q+UBsRN/El5Os2d/wi X-Received: from big-boi.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:129]) (user=qperret job=sendgmr) by 2002:a05:600c:4f0e:b0:3dd:f488:4a87 with SMTP id l14-20020a05600c4f0e00b003ddf4884a87mr67576wmq.54.1675247882739; Wed, 01 Feb 2023 02:38:02 -0800 (PST) Date: Wed, 1 Feb 2023 10:37:51 +0000 In-Reply-To: <20230201103755.1398086-1-qperret@google.com> Mime-Version: 1.0 References: <20230201103755.1398086-1-qperret@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230201103755.1398086-2-qperret@google.com> Subject: [PATCH 1/4] KVM: arm64: Provide sanitized SYS_ID_AA64SMFR0_EL1 to nVHE From: Quentin Perret To: Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, Quentin Perret X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_023806_109686_82362F32 X-CRM114-Status: GOOD ( 11.10 ) 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 We will need a sanitized copy of SYS_ID_AA64SMFR0_EL1 from the nVHE EL2 code shortly, so make sure to provide it with a copy. Signed-off-by: Quentin Perret Acked-by: Mark Brown --- arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/nvhe/sys_regs.c | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/kvm_hyp.h b/arch/arm64/include/asm/kvm_hyp.h index 6797eafe7890..bdd9cf546d95 100644 --- a/arch/arm64/include/asm/kvm_hyp.h +++ b/arch/arm64/include/asm/kvm_hyp.h @@ -122,6 +122,7 @@ extern u64 kvm_nvhe_sym(id_aa64isar2_el1_sys_val); extern u64 kvm_nvhe_sym(id_aa64mmfr0_el1_sys_val); extern u64 kvm_nvhe_sym(id_aa64mmfr1_el1_sys_val); extern u64 kvm_nvhe_sym(id_aa64mmfr2_el1_sys_val); +extern u64 kvm_nvhe_sym(id_aa64smfr0_el1_sys_val); extern unsigned long kvm_nvhe_sym(__icache_flags); extern unsigned int kvm_nvhe_sym(kvm_arm_vmid_bits); diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 9c5573bc4614..d9c6ec650b42 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1887,6 +1887,7 @@ static void kvm_hyp_init_symbols(void) kvm_nvhe_sym(id_aa64mmfr0_el1_sys_val) = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); kvm_nvhe_sym(id_aa64mmfr1_el1_sys_val) = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); kvm_nvhe_sym(id_aa64mmfr2_el1_sys_val) = read_sanitised_ftr_reg(SYS_ID_AA64MMFR2_EL1); + kvm_nvhe_sym(id_aa64smfr0_el1_sys_val) = read_sanitised_ftr_reg(SYS_ID_AA64SMFR0_EL1); kvm_nvhe_sym(__icache_flags) = __icache_flags; kvm_nvhe_sym(kvm_arm_vmid_bits) = kvm_arm_vmid_bits; } diff --git a/arch/arm64/kvm/hyp/nvhe/sys_regs.c b/arch/arm64/kvm/hyp/nvhe/sys_regs.c index 0f9ac25afdf4..08d2b004f4b7 100644 --- a/arch/arm64/kvm/hyp/nvhe/sys_regs.c +++ b/arch/arm64/kvm/hyp/nvhe/sys_regs.c @@ -26,6 +26,7 @@ u64 id_aa64isar2_el1_sys_val; u64 id_aa64mmfr0_el1_sys_val; u64 id_aa64mmfr1_el1_sys_val; u64 id_aa64mmfr2_el1_sys_val; +u64 id_aa64smfr0_el1_sys_val; /* * Inject an unknown/undefined exception to an AArch64 guest while most of its