From patchwork Fri Jun 9 22:01:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 13274599 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 E8470C7EE25 for ; Fri, 9 Jun 2023 22:01:37 +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:MIME-Version:Message-ID:Date:Subject:Cc :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=s3+e6IRzk6URCMzk79B9vGtU00eq0I3N2CV41ug4hPY=; b=DL+LkoPdovhgfO k1H7SQ3tkrsgKE5gB4GYYLTJkcG6lsCq17SDlHNE5dP/4vgyW/GHfIMzLJ/NHkC9R+1Xi6msTHTXO vVabZY9bWv3EiY0MO7zbz4T/rkPfF15fKYlNKLaKIlI5rF5OYYkAH4w6W6EZAFpaTRVC1hX4TwoRt 6Y4UHq0NKUIjZnTOpDy5ILChTkZcWojCcY/GgeacqN07RLDlHca43dU5cKiQHjtkOgKX0ECA+gnt4 e5RZ1ALTICSu7nDjwwX8fI3OiYFSwsP2pV4U8UVhjhanm2gc7C5fA3mSkrO2TGy3X9QSdZ/Ze4P42 tfKhrYVQ60+iuoJAH1/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7kAZ-00ENR4-0m; Fri, 09 Jun 2023 22:01:19 +0000 Received: from out-21.mta0.migadu.com ([91.218.175.21]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7kAW-00ENOB-0K for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2023 22:01:17 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1686348072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5iBfoHKW/WQ0K23XQQEoJJQTBbnOdvyZj0RT3bSYgCk=; b=YQtv1QG4MESi/kbwWrWuxpzWnCvJwOV3gky+Of5VmzRUyTqAJv69LRvmW5jEHgWzkJIVMz lLsuQIdayrScJsfYsYZN6Ghh5VI3gcT64F1g9kcVIu/nGigCAXT7fjFJK2SgSSXFlOHhOV muAUJX0NWoTcsFhRHP0IXKOIHZuRC9w= From: Oliver Upton To: kvmarm@lists.linux.dev Cc: Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , Will Deacon , Catalin Marinas , linux-arm-kernel@lists.infradead.org, Darren Hart , D Scott Phillips , Oliver Upton Subject: [PATCH 0/3] KVM: arm64: Work around Ampere1 erratum AC03_CPU_38 Date: Fri, 9 Jun 2023 22:01:01 +0000 Message-ID: <20230609220104.1836988-1-oliver.upton@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_150116_567940_A41DDE1D X-CRM114-Status: UNSURE ( 7.02 ) X-CRM114-Notice: Please train this message. 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 Hi folks, Small series to work around a CPU erratum on AmpereOne. While the implementation does not advertise support for FEAT_HAFDBS (due to another erratum), the associated control bits do not have RES0 behavior as required by the architecture. Usage of HAFDBS at stage-1 is unaffected, since HA and HD are only enabled on implementations that advertise the feature. However, KVM relies on HA having RES0 semantics if the feature isn't implemented. The end result is that KVM enables a broken hardware access flag implementation that could lead to correctness issues. Applies to 6.4-rc1. Tested with access_tracking_perf_test, verifying that KVM is indeed taking Access Flag faults. Oliver Upton (3): arm64: errata: Mitigate Ampere1 erratum AC03_CPU_38 at stage-2 KVM: arm64: Refactor HFGxTR configuration into separate helpers KVM: arm64: Prevent guests from enabling HA/HD on Ampere1 Documentation/arm64/silicon-errata.rst | 3 + arch/arm64/Kconfig | 17 +++++ arch/arm64/kernel/cpu_errata.c | 7 ++ arch/arm64/kvm/hyp/include/hyp/switch.h | 99 ++++++++++++++++++++----- arch/arm64/kvm/hyp/pgtable.c | 14 +++- arch/arm64/tools/cpucaps | 1 + 6 files changed, 120 insertions(+), 21 deletions(-) base-commit: ac9a78681b921877518763ba0e89202254349d1b Reviewed-by: Marc Zyngier