From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 303B8C433C1 for ; Mon, 22 Mar 2021 22:26:06 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B0B0F619A3 for ; Mon, 22 Mar 2021 22:26:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0B0F619A3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u8G1+VzgozPszqRZlSDcoqzc2C5g3QavboNQBNtVsVQ=; b=pD0ZD0jQtH79Ol0qiQTpYlOiw spQxl6b7764Flu8iVIVvFXJ607Pu3roFGPRDErcsT9lZBgPyz5Om4H1JWoUj3WMNzlgA6bz2F2W+W tsY7ePqXwaGOIKs7QvGjdXgag3awH0vcwM7bXt0DHINoE74VgEXFKDV5P7RnBkI4dlKoW5y2ggSOc pu2lmtIX0jpwA4aIw/GE7bhhXW6uL84r1rr1Z4O9KYdQDjfsKRDPmRS8rEoyLbgr9FZwVCB4cCg3p ZxPdCQqnBQvA4WcDudzMVuavmJsjM8F/ODNn/+Ch6W/SnmaI3RHsf2WVP00kmeQLb8+JgMA+IiTew NrcxL2htA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOSyN-00ChEz-NN; Mon, 22 Mar 2021 22:24:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOSyH-00ChE9-Bj for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 22:24:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5B0671042; Mon, 22 Mar 2021 15:24:22 -0700 (PDT) Received: from [10.57.55.187] (unknown [10.57.55.187]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CEDE83F719; Mon, 22 Mar 2021 15:24:20 -0700 (PDT) Subject: Re: [PATCH v4 05/19] kvm: arm64: Disable guest access to trace filter controls To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, anshuman.khandual@arm.com, leo.yan@linaro.org, Will Deacon , Mark Rutland , Catalin Marinas , linux-arm-kernel@lists.infradead.org References: <20210225193543.2920532-1-suzuki.poulose@arm.com> <20210225193543.2920532-6-suzuki.poulose@arm.com> From: Suzuki K Poulose Message-ID: Date: Mon, 22 Mar 2021 22:24:19 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210225193543.2920532-6-suzuki.poulose@arm.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_222427_003027_5B651672 X-CRM114-Status: GOOD ( 20.91 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, On 25/02/2021 19:35, Suzuki K Poulose wrote: > Disable guest access to the Trace Filter control registers. > We do not advertise the Trace filter feature to the guest > (ID_AA64DFR0_EL1: TRACE_FILT is cleared) already, but the guest > can still access the TRFCR_EL1 unless we trap it. > > This will also make sure that the guest cannot fiddle with > the filtering controls set by a nvhe host. > > Cc: Marc Zyngier > Cc: Will Deacon > Cc: Mark Rutland > Cc: Catalin Marinas > Signed-off-by: Suzuki K Poulose We have already have the v8.4 self hosted tracing support in 5.12-rcX. Do you think you can pick this up for this 5.12 ? Cheers Suzuki > --- > New patch > --- > arch/arm64/include/asm/kvm_arm.h | 1 + > arch/arm64/kvm/debug.c | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > index 4e90c2debf70..94d4025acc0b 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -278,6 +278,7 @@ > #define CPTR_EL2_DEFAULT CPTR_EL2_RES1 > > /* Hyp Debug Configuration Register bits */ > +#define MDCR_EL2_TTRF (1 << 19) > #define MDCR_EL2_TPMS (1 << 14) > #define MDCR_EL2_E2PB_MASK (UL(0x3)) > #define MDCR_EL2_E2PB_SHIFT (UL(12)) > diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c > index 7a7e425616b5..dbc890511631 100644 > --- a/arch/arm64/kvm/debug.c > +++ b/arch/arm64/kvm/debug.c > @@ -89,6 +89,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu) > * - Debug ROM Address (MDCR_EL2_TDRA) > * - OS related registers (MDCR_EL2_TDOSA) > * - Statistical profiler (MDCR_EL2_TPMS/MDCR_EL2_E2PB) > + * - Self-hosted Trace Filter controls (MDCR_EL2_TTRF) > * > * Additionally, KVM only traps guest accesses to the debug registers if > * the guest is not actively using them (see the KVM_ARM64_DEBUG_DIRTY > @@ -112,6 +113,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) > vcpu->arch.mdcr_el2 = __this_cpu_read(mdcr_el2) & MDCR_EL2_HPMN_MASK; > vcpu->arch.mdcr_el2 |= (MDCR_EL2_TPM | > MDCR_EL2_TPMS | > + MDCR_EL2_TTRF | > MDCR_EL2_TPMCR | > MDCR_EL2_TDRA | > MDCR_EL2_TDOSA); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel