From patchwork Fri Oct 29 00:32:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12591363 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 ADBDFC433F5 for ; Fri, 29 Oct 2021 00:34:35 +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 785D6610CF for ; Fri, 29 Oct 2021 00:34:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 785D6610CF 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=9DPGwLP3gv/pmw3EXzEZKs4g3vf5GyvJ9TGyfwzFKRM=; b=DjJ8At9VfAT/48uI8OTmmYyyV1 dzQPVhIosd/ybRELEVGgM8afxButJ3WTCaKA/z/Obk/u14hTrr63b+7D6W1dRkCGkFkrHv1Jf3FZ9 fDZfo94saEBDB3ujD8562JHzu6HLuevaTQI95vyaCDpq2XYsCMgvpQbgJUZuW8H/XRefVlTUbE0xh CkVFhcTLDjczDPMyf9WOPG2wL9wudfq8PsnzbN4A+qT6MZnvL8HdSaG3JM4OE2uJcFSwXisgq6BTq tR+ZXeBr0dR/qLVnGjxVKKRBHZoQit76TaefZIgaU1/Fu86XMmZimE7ZsoBiZaVsGUj6O8hogqyTJ frP4hxiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgFpj-009Nsg-14; Fri, 29 Oct 2021 00:33:23 +0000 Received: from mail-il1-x149.google.com ([2607:f8b0:4864:20::149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgFp8-009Nkx-Fi for linux-arm-kernel@lists.infradead.org; Fri, 29 Oct 2021 00:32:47 +0000 Received: by mail-il1-x149.google.com with SMTP id j8-20020a056e02154800b0025ac677b446so4989042ilu.1 for ; Thu, 28 Oct 2021 17:32:44 -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=Oy01IknDRFVJKLSnWHmExcfPSXKDoq8nS6BDKnDz0O8=; b=i4SQt8b1AkstVV8CAePyo55dLl6VOqR1QVAiVbqgmCto/zYMwI9p6BgIoTIFAPZXvC RYV9R9Ieg85IjpWwhQ80iBwhSdmiRXDjZ4Cn6EKwvCQ4VFzULIRTbQVedU4MI34xHFpE knIqoBIrFOrTTrlhR63X91EXWeHBrqc8Wy44sc0gQ2InrMkPC7POadxyO/T73FTHi0Uz U1XBNc8ODIfe3BJS4+JTlNavF3j1xjXWmuzWnVVrW+KmGUeZemgl6ZxQKNUlvzmsAt2S XJRivugCqYaiWWIKtuyQlzaOJghDbN2iENFoRYExbkDSbvRJj/hVa65/XRo4FEamT4QT hQHA== 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=Oy01IknDRFVJKLSnWHmExcfPSXKDoq8nS6BDKnDz0O8=; b=1q2YOiis4rAfj3DKPliOQVzAhVpie6sDFrmS07t57p8ed1/aCIg8Th8fopkvp2F+88 HBjesRpx5SPPWlfFSVixAsCi5iDhghZUlYu9vZPwjDlfsFBkgc+5Yvn+fzDLiEnzcokN 8EDa1utuorqmygAUEa1jAjV43vApycFZS8S9KvwGnP10Kmv/UlU3LZpPB0b713WEG4Kl tHZkj00Hiv2/cKTdoNuC8M3BTyj67tapQzFNM4S62cl84rrswvNgH+TyXSZ173lPr27X Sm4PT/CC/OEMofFnFvsu3fkisex0tWObpW7mWq8IAhwynZUwK7GIHbHt9oeUhOXD7fva nM3g== X-Gm-Message-State: AOAM532x0MqWntuvnDdUZ7ULBOD5X1QOzt+FRc5+bdyFFnnSfvaGz3Bk UDDzEm3h+12MtyxhAykj6TFufm5Ca8U= X-Google-Smtp-Source: ABdhPJyxXD1Yuus5/OHrCt1h6LMDXta7JdKp3vcZcLarAByoLzOk+GrzMDSQpNSt9IwjFcgVU85NVKnra50= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a05:6638:329e:: with SMTP id f30mr4310865jav.63.1635467564021; Thu, 28 Oct 2021 17:32:44 -0700 (PDT) Date: Fri, 29 Oct 2021 00:32:02 +0000 In-Reply-To: <20211029003202.158161-1-oupton@google.com> Message-Id: <20211029003202.158161-4-oupton@google.com> Mime-Version: 1.0 References: <20211029003202.158161-1-oupton@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH 3/3] KVM: arm64: Raise KVM's reported debug architecture to v8.2 From: Oliver Upton To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Andrew Jones , Peter Shier , Ricardo Koller , Reiji Watanabe , Oliver Upton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_173246_578443_C3694AA5 X-CRM114-Status: GOOD ( 11.47 ) 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 The additions made to the Debug architecture between v8.0 and v8.2 are only applicable to external debug. KVM does not (and likely will never) support external debug, so KVM can proudly report support for v8.2 to its guests. Raise the reported Debug architecture to v8.2. Additionally, v8.2 makes FEAT_DoubleLock optional. Even though KVM never supported it in the first place, report DoubleLock as not implemented now as the architecture permits it for v8.2. Cc: Reiji Watanabe Cc: Ricardo Koller Suggested-by: Marc Zyngier Signed-off-by: Oliver Upton --- arch/arm64/kvm/sys_regs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 0840ae081290..f56ee5830d18 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1109,9 +1109,14 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, ARM64_FEATURE_MASK(ID_AA64ISAR1_GPI)); break; case SYS_ID_AA64DFR0_EL1: - /* Limit debug to ARMv8.0 */ + /* Limit debug to ARMv8.2 */ val &= ~ARM64_FEATURE_MASK(ID_AA64DFR0_DEBUGVER); - val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_DEBUGVER), 6); + val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_DEBUGVER), 8); + + /* Hide DoubleLock from guests */ + val &= ~ARM64_FEATURE_MASK(ID_AA64DFR0_DOUBLELOCK); + val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_DOUBLELOCK), 0xf); + /* Limit guests to PMUv3 for ARMv8.4 */ val = cpuid_feature_cap_perfmon_field(val, ID_AA64DFR0_PMUVER_SHIFT,