From patchwork Tue Dec 5 10:22:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 13479884 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 4A739C10DCE for ; Tue, 5 Dec 2023 10:23:29 +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: Mime-Version:Date: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=liCmawNb2Euinz3gTRudRs1cGE+Nrjg7WbGnLatSZ98=; b=zhn llwWdJ9DqwjQb2+GBeFRri0A/kFzmx6infGU02S4RWkyxPCexu7/MBH2OvcOC5Jn3LsY8g36+AUxa EAon/LwmrbFN28vJOklh16dVeV4HRLrY72QVrLegNCHNPT3U/0LrpBv7+/wY9+gHCDrC/Yf3dMyM/ yd8uDjWWkz8zj4Ak5SnNJONL2MrRfZ5GwHj7wOMk22wBK7p43brXQPt0J7GcJ4YqrkE3PZhLm2xr/ Mk5VA4z83kh+hz8nhkRvMLkAoTdwLbwXOJIUuV0JhfJOg/1zZatNy7gMVnb8HiEKT40loXw0Rq8XR 0eEjmTSEQTvL1ULW9Bbf4YCnPd1GurQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rASZt-006xP8-0Q; Tue, 05 Dec 2023 10:22:57 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rASZp-006xN3-1v for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 10:22:55 +0000 Received: by mail-wr1-x449.google.com with SMTP id ffacd0b85a97d-33349915da5so1786904f8f.3 for ; Tue, 05 Dec 2023 02:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701771770; x=1702376570; darn=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=9t18tGFYr+sidi4j7S8LuvInz9BurB3PbtEfB1rEvz4=; b=f8G2FHntGBgW5weqrqJdirkk9WHx4nS5YempMczvxxTGZBIK3D8oQ65IZrhtwbQl0h TVapoQYaKiO/GCUGuZNSUtysmhcZN9upe028iMDN1D8SvcEMNxaByXHMyJIm4tAXdVxo XQw6WbC+kpAAhSC8zB8g4m0LmtvtRrUNKkiKSx6dxvqEwt0dFb6erKicxEAicsLfr/HR PxQVnNrXQzzGdcFWH12/G1IVYc6/tmSNWgvJogJUG6RlJsSRsD47kap3a9HAewq6NdQ1 BpaU3zlmZ4gTQVbXCCAYqrJmgyPyc0knPzU7Ae/Eb3LFkpxMQPOLpdMJPOCnpyOyHnSV Gmzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701771770; x=1702376570; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9t18tGFYr+sidi4j7S8LuvInz9BurB3PbtEfB1rEvz4=; b=I1mvEAg8u+KCgfBvJKahyuiEqzEuQFZsd4gRBjNJxPnFUbsSOoWyTX3cdJ2COSs5Of hrac0pgJIMfVGB5dAnPFqJJdk2563927+4OW3iTepd9H1AkeV7gcdgoFji5B4/lehbhy Y4yo7NMlxxIQivALXceONvF0lKHyDXNwqjU+ORJc41krRkimWW9PQBvbBggoFE3Z/GDJ QyXYtbM3BLzaqsvyiSTWetzopOZgc65WQfWtj4+ou3kqUHhDDiyAb4ykHSWhz1IpVU6t mfnUhlGuSnKVGD1M+QW2cK2UT5CPlY6ulysQFNKRfhyY1JfG9q8k966icFcvAKa79PVB koSw== X-Gm-Message-State: AOJu0YwA0oCMNZ3F12r5lERWxiwfkgOJxc6XYz0GSTdf2Vpsn1kntuL8 oWVtbH7NzifPjg81GbZkeUdNeKO8eA== X-Google-Smtp-Source: AGHT+IHBNt8mVY9BRjxlPkPSAlByF0bIpNxxBtLE8A9fq7bJa4dCdkcUDDFks8BIN3A4T8cIC2aHLMudew== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a5d:4d04:0:b0:333:3175:5afa with SMTP id z4-20020a5d4d04000000b0033331755afamr134491wrt.14.1701771770646; Tue, 05 Dec 2023 02:22:50 -0800 (PST) Date: Tue, 5 Dec 2023 10:22:42 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231205102248.1915895-1-tabba@google.com> Subject: [PATCH v1 0/6] KVM: arm64: Fixes to fine grain traps and pKVM traps From: Fuad Tabba To: kvmarm@lists.linux.dev Cc: maz@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, eric.auger@redhat.com, jingzhangos@google.com, joey.gouly@arm.com, tabba@google.com, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_022253_638652_8C8D4EC2 X-CRM114-Status: GOOD ( 10.46 ) 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 This patch series has fixes, updates, and code for validating fine grain trap register masks, as well as some fixes to feature trapping in pKVM. New fine grain trap (FGT) bits have been defined in the latest Arm Architecture System Registers xml specification (2023-09) [*], so the code is updated to reflect them. Moreover, some of the already-defined masks overlap with res0, which this series fixes. It also adds FGT register masks that weren't defined earlier, as well as build time validation that the bits of the various masks are all accounted for and without overlap. Based on 6.7-rc4. Cheers, /fuad [*] https://developer.arm.com/downloads/-/exploration-tools Fuad Tabba (6): KVM: arm64: Update and fix FGT register masks KVM: arm64: Add bit masks for HAFGRTR_EL2 KVM: arm64: Add build validation for trap mask values KVM: arm64: Calculate FGT RES0 Bits KVM: arm64: Trap external trace for protected VMs KVM: arm64: Mark features as supported for protected VMs arch/arm64/include/asm/kvm_arm.h | 56 +++++++++++-------- arch/arm64/kvm/hyp/include/hyp/switch.h | 16 ++++++ .../arm64/kvm/hyp/include/nvhe/fixed_config.h | 4 +- arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++ arch/arm64/tools/sysreg | 5 +- 5 files changed, 59 insertions(+), 26 deletions(-) base-commit: 33cc938e65a98f1d29d0a18403dbbee050dcad9a