From patchwork Mon Feb 1 18:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12059677 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=-17.1 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,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 1F161C433E0 for ; Mon, 1 Feb 2021 18:19:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B947464EA8 for ; Mon, 1 Feb 2021 18:19:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B947464EA8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=d2EDUXpVduabrIMSzRMu2ItHr/EeSkwPB5Gtb1pug9M=; b=P+AAV3QeHYLlCJKgTkfdWor1k bt+pHkRi01nMhBShUgGDIMXM242yl0vlWat8zAn0HOL5mQHqf2TlPcq4OnocDxMmZP5a+YqMeLo6s 6dMzubL6YCnvXiLs2ohvUAOBwDqZ2w2EfAWwsYV3f7H1J9Y4qxXjmOB6hF0DoOdPHk46ayTsUqp8M tGlTC5+FzUW0vJqclBr5xwpZTQ/pmzG6JCj2FcRG98Sotb3sf1DJ+N0UcvkcNkSMNXLonqgzYVp0K LcUVjUCBo6ux1UaTfl5832+ueDI8XH07n66bQfSEfa1zml6/U4yjbyqjUrwGdR2me+hKjt6ME7l+1 VjqGIdHeA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6dky-0004Zy-Mv; Mon, 01 Feb 2021 18:17:00 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6diI-00033Z-0G for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2021 18:14:31 +0000 Received: by mail-pl1-x62d.google.com with SMTP id b8so10456105plh.12 for ; Mon, 01 Feb 2021 10:14:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Nkl7K2vw3TX4frhQPmfegkQUMEyqX+IThipL7KY2uDo=; b=iIgmVpOKir7028W23vrGXUNsAxqqcr87Dah8tG6OvnNYIf24c+MTPaS8nMFxSxLlqW v6nXnmm1Gom//iRpRbv8tXFt4hNGfMuFOoeUHNLn/p8Qt48PBym3QJsVk8u1o+nXNQSo oQu/JtFFOMWLV9XEwqVIlPxd9orDLyTXN5LFOs4W39L9SjFHV9mfPXjdECylXiVnUk4s NdgLABs71iWl2y9wFn2KEWLU5S0P6a9DBQNVgfV6pN5A+Goh+3wxTNufMsWM8wpSVfpz /sbOlIa0QvqueF4iIuvieYMI2uvMs3hLhdHVoRN2kNozOw8AKJoqohXsC+iTu5ATu1Nx Ie+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Nkl7K2vw3TX4frhQPmfegkQUMEyqX+IThipL7KY2uDo=; b=Kbov8OYOTqshaOtBI5d97k7hpJgmus5Bx74jW8e33bVEKUNXLyO8cmP2hKQ9RyhLAM NH0UGVehaeaZ+y+hXIAXncxcXkqT6wkDQyRm8CLW8u5dhPexLnbW9yz4kSaB+iW711hk fFJp2tpn/WcJwjOdBOKTPDOWrUPIbWdv4nz7oFvq4S0DzarCxUle75zHzGq4hTrG0tNA +0MKqzsxMrTO+Gg+gcXF1AIm4UHvinNK+2jpet7Dsh4bEYISwR6MKJ+QjU12ZyXNpJNz ivst3H/gmphCdD1nLBEnprOISvf51meirXCPWputBLercSvbkjR7Z0o279wHYmQY7AQw 6tFg== X-Gm-Message-State: AOAM533v+j5Wo31t+dKTIvMaVUtDW0Vdd03fJhZmqZ4bk79mIXdCmDEY XrlXj2tLTb7yJAYBlJMTpQsLMg== X-Google-Smtp-Source: ABdhPJzuIgvytfBVtpkA2FJ9wHNHdDAGigkR/PxPydd4F18Pek1Eo61VNMxbJwmCpy5rOUXZGyoTLA== X-Received: by 2002:a17:902:c40b:b029:de:2f1e:825c with SMTP id k11-20020a170902c40bb02900de2f1e825cmr18945101plk.64.1612203251771; Mon, 01 Feb 2021 10:14:11 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e12sm75784pjj.23.2021.02.01.10.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 10:14:11 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/31] coresight: etm4x: Cleanup secure exception level masks Date: Mon, 1 Feb 2021 11:13:37 -0700 Message-Id: <20210201181351.1475223-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210201181351.1475223-1-mathieu.poirier@linaro.org> References: <20210201181351.1475223-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210201_131414_986412_FCA29956 X-CRM114-Status: GOOD ( 15.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Suzuki K Poulose We rely on the ETM architecture version to decide whether Secure EL2 is available on the CPU for excluding the level for address comparators and viewinst main control register. We must instead use the TRCDIDR3.EXLEVEL_S field to detect the supported levels. Signed-off-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20210110224850.1880240-16-suzuki.poulose@arm.com Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 13 +++---------- drivers/hwtracing/coresight/coresight-etm4x.h | 6 ++++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index f095ab9949d9..d91b259a4334 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -840,7 +840,6 @@ static void etm4_init_arch_data(void *info) * TRCARCHMAJ, bits[11:8] architecture major versin number */ drvdata->arch = BMVAL(etmidr1, 4, 11); - drvdata->config.arch = drvdata->arch; /* maximum size of resources */ etmidr2 = etm4x_relaxed_read32(csa, TRCIDR2); @@ -856,6 +855,7 @@ static void etm4_init_arch_data(void *info) drvdata->ccitmin = BMVAL(etmidr3, 0, 11); /* EXLEVEL_S, bits[19:16] Secure state instruction tracing */ drvdata->s_ex_level = BMVAL(etmidr3, 16, 19); + drvdata->config.s_ex_level = drvdata->s_ex_level; /* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */ drvdata->ns_ex_level = BMVAL(etmidr3, 20, 23); @@ -1027,16 +1027,9 @@ static u64 etm4_get_ns_access_type(struct etmv4_config *config) static u64 etm4_get_access_type(struct etmv4_config *config) { u64 access_type = etm4_get_ns_access_type(config); - u64 s_hyp = (config->arch & 0x0f) >= 0x4 ? ETM_EXLEVEL_S_HYP : 0; - /* - * EXLEVEL_S, bits[11:8], don't trace anything happening - * in secure state. - */ - access_type |= (ETM_EXLEVEL_S_APP | - ETM_EXLEVEL_S_OS | - s_hyp | - ETM_EXLEVEL_S_MON); + /* All supported secure ELs are excluded */ + access_type |= (u64)config->s_ex_level << TRCACATR_EXLEVEL_SHIFT; return access_type; } diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index fba3c02eea0b..29cd27f53e72 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -557,6 +557,8 @@ /* PowerDown Control Register bits */ #define TRCPDCR_PU BIT(3) +#define TRCACATR_EXLEVEL_SHIFT 8 + /* secure state access levels - TRCACATRn */ #define ETM_EXLEVEL_S_APP BIT(8) #define ETM_EXLEVEL_S_OS BIT(9) @@ -631,7 +633,7 @@ enum etm_impdef_type { * @vmid_mask0: VM ID comparator mask for comparator 0-3. * @vmid_mask1: VM ID comparator mask for comparator 4-7. * @ext_inp: External input selection. - * @arch: ETM architecture version (for arch dependent config). + * @s_ex_level: Secure ELs where tracing is supported. */ struct etmv4_config { u32 mode; @@ -675,7 +677,7 @@ struct etmv4_config { u32 vmid_mask0; u32 vmid_mask1; u32 ext_inp; - u8 arch; + u8 s_ex_level; }; /**