From patchwork Fri Dec 4 18:37:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 11952107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EDD6C433FE for ; Fri, 4 Dec 2020 18:39:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 F3096224BE for ; Fri, 4 Dec 2020 18:39:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3096224BE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=OKk4/meH7jGfhDjIZIdxFMXYBtdz+A/FfkUfN6XigPc=; b=t85N08DXhbBTL7VMRyRF1jxe3u kAvmyiL4t4s3rpXm8pWMNAE/8sPqI7Sc9wbZDXV8wX0B/ZxTEKYpSimVWF5lngr1aVtDxFiHy1rx2 GrhCNjM2Ax1HFbWNVWxkKW8cCB3VSHZH8GLG1BEq5pyg0Niucmn9wBR3diQHlw6U7X2dMiPq/Vx9L aMGZRAiXOiC65rhQR8WoXwMz0RpcsRtXoQKxJyq4WjUSoyNJI5c8yAWD16y8ypFWniqdi6QcFiRcT ZkTVMogJKoNtI4ix3MoI8lGKvJ2vAHyLqxYut+NZJ0pFoED2tE+gGNAsR7g6POCtNolE2Q4AFvc7b 3cwqIqIQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klFxm-00033n-TJ; Fri, 04 Dec 2020 18:37:50 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klFxj-00032i-L0 for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 18:37:48 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B3FE22AAB; Fri, 4 Dec 2020 18:37:46 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1klFxg-00G3Uh-30; Fri, 04 Dec 2020 18:37:44 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v2 0/2] KVM: arm64: Expose CSV3 to guests on running on Meltdown-safe HW Date: Fri, 4 Dec 2020 18:37:07 +0000 Message-Id: <20201204183709.784533-1-maz@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, will@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, dbarzdil@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_133747_776267_C6597108 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Suzuki K Poulose , Will Deacon , David Brazdil , James Morse , kernel-team@android.com, Julien Thierry Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Will recently pointed out that when running on big-little systems that are known not to be vulnerable to Metldown, guests are not presented with the CSV3 property if the physical HW include a core that doesn't have CSV3, despite being known to be safe (it is on the kpti_safe_list). Since this is valuable information that can be cheaply given to the guest, let's just do that. The scheme is the same as what we do for CSV2, allowing userspace to change the default setting if this doesn't advertise a safer setting than what the kernel thinks it is. * From v1: - Fix the clearing of ID_AA64PFR0_EL1.CSV3 on update from userspace - Actually store the userspace value Marc Zyngier (2): arm64: Make the Meltdown mitigation state available KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV3=1 if the CPUs are Meltdown-safe arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/spectre.h | 2 ++ arch/arm64/kernel/cpufeature.c | 20 +++++++++++++++++--- arch/arm64/kvm/arm.c | 6 ++++-- arch/arm64/kvm/sys_regs.c | 16 +++++++++++++--- 5 files changed, 37 insertions(+), 8 deletions(-) Acked-by: Will Deacon