Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3366072rwo; Fri, 4 Aug 2023 03:59:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE76DHJj5NpaQuM5qDzUd+7+HQiRlai3qZjYQXdkETBYEBpMB2LXt6W3tbgi5w3J0ge1nRz X-Received: by 2002:a05:6512:2809:b0:4fb:9129:705b with SMTP id cf9-20020a056512280900b004fb9129705bmr1370819lfb.6.1691146743224; Fri, 04 Aug 2023 03:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691146743; cv=none; d=google.com; s=arc-20160816; b=B4eKI+xeVqlVAZj4X4s8cdYuVB/iG0P/s/QS1l7jYWJ0KrVVmKoOCTvivmxC9ZaadK FiULLqxpmDuQ1Kk5VwbeAjMlI7zkr4+xJ3Vv1aX8n2g6PXgrFyMECGKl0Tku2NMTlmxS zueBatJWWvBxXQgQv059bNogWdIRuzNhaqWj6jJzb2+ZGG9JAf0F50VLd5dW2R4agy+R RNF/cEqf+0jXMXA/Iokeo0uSygfnvvkzZQNnMPystrIAOYZxokfcqqInaQlXCBZNsUEn XSkP8KBbEwulaa42ln2PYiWnGyHCCkH1Lm25CxmkmSWxs887GR1QDVG3WztJdwPsBO4i etRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=VQqZ1eUZapjANiyYUq42U8w/yxWhFavyVPK/TS301X4=; fh=2aTzhFOtuTAUox/fryuGjv4i69lxVLnRHInQo3XCKBw=; b=rJ68ad5RkRDu6rTQrFLNAhL59pNv0zg/J8HPo7j4B5341raHkk1e4Rtcfdb9Z6iYEM bnjazCAZ9tLoHDIYFeWE1wDGJQia12L9UMqldmq35MnwF6o4AJ9LiBTf+QedidyXBLeR h6GFXhVrxxQVn+PYe1b3D+tS1fmmEphSKnHm9pbkpYFWfS7g4m7mr/QFgA8xAQjuyeR3 s9C54X8NaZk5dHL10Bo50mXO0WRBhDex4KHpZuteoT1VJ2BYxy2xMRTSfBkKUrJGjTwb 2YI7XEwTqpi5kdVvwsWKcMpuSB180LDUg7qtS5awbZHsPp4DLGpfW03yUarSPsToL6L5 Glrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a170906260600b0099bcf34927fsi1499810ejc.640.2023.08.04.03.58.37; Fri, 04 Aug 2023 03:59:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbjHDKOU (ORCPT + 99 others); Fri, 4 Aug 2023 06:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjHDKNv (ORCPT ); Fri, 4 Aug 2023 06:13:51 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9F15A4C18 for ; Fri, 4 Aug 2023 03:13:39 -0700 (PDT) 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 16EF41007; Fri, 4 Aug 2023 03:14:22 -0700 (PDT) Received: from e127643.arm.com (unknown [10.57.3.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 93C723F6C4; Fri, 4 Aug 2023 03:13:36 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Cc: James Clark , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mike Leach , Leo Yan , Alexander Shishkin , Anshuman Khandual , Rob Herring , linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/3] coresight: Support exclude_guest with Feat_TRF and nVHE Date: Fri, 4 Aug 2023 11:13:10 +0100 Message-Id: <20230804101317.460697-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm looking for help in testing this and for feedback on whether it's useful to anyone. Testing it requires hardware that has Feat_TRF (v8.4) but no TRBE. This is because TRBE usage is disabled in nVHE guests. I don't currently have any access to any hardware, and the FVP model can only do self hosted trace using TRBE. Currently with nVHE you would always get trace from guests, and filtering out isn't possible without this patchset. In comparison, with VHE guests, they never generate guest trace without [1]. I think the existence of trace rather than lack of could suggest that this change is less useful than [1]. Also the restricted set of hardware that it works on supports that too. Apart from compilation and checking that the exclude guest settings are correctly programmed on guest switch, this is untested by me. Applies to kvmarm/next (3b4e3afb2032) [1]: https://lore.kernel.org/linux-arm-kernel/20230804085219.260790-3-james.clark@arm.com/ James Clark (3): arm64: KVM: Add support for exclude_guest and exclude_host for ETM arm64: KVM: Support exclude_guest for Coresight trace in nVHE coresight: Support exclude_guest with Feat_TRF and nVHE arch/arm64/include/asm/kvm_host.h | 10 +++- arch/arm64/kvm/Makefile | 1 + arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/debug.c | 7 +++ arch/arm64/kvm/etm.c | 48 ++++++++++++++++ arch/arm64/kvm/hyp/nvhe/debug-sr.c | 56 +++++++++++++++++-- .../hwtracing/coresight/coresight-etm-perf.c | 4 ++ include/kvm/etm.h | 43 ++++++++++++++ 8 files changed, 165 insertions(+), 5 deletions(-) create mode 100644 arch/arm64/kvm/etm.c create mode 100644 include/kvm/etm.h -- 2.34.1