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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88A3FC433FE for ; Fri, 21 Jan 2022 12:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380431AbiAUMmr (ORCPT ); Fri, 21 Jan 2022 07:42:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350560AbiAUMmq (ORCPT ); Fri, 21 Jan 2022 07:42:46 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A75C061401 for ; Fri, 21 Jan 2022 04:42:46 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id n12-20020a05600c3b8c00b0034eb13edb8eso293017wms.0 for ; Fri, 21 Jan 2022 04:42:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FbauWvjEFr0VEys9tznLWPTDHaU2uug5P4EDNWbJ8+E=; b=uoPJ8mn9Kan1V+k3BDZDa7RTh/3CLdpRfMvVa7WsJ/gKSaS8pvkj5NERpKxKYq5GPz 3mx5xTgJyma8/Ei4cpOGwy6BbvmD9lRqGLiyNJiBT8Kqxbjr26bM8058UvKMiFlNhQLA UlEM4cLyLjyIxUzHjwt5IM37pvGKvDt2SQw8m2Twh6MuwGQhhI5CPDdhyBRj8gEEkQeh 7FGYa11oLjNOK19Yso7Ha8I9sK4eoaK9Qvuz2RBuDXW9wDhe2L6xgZSzO+gFDNXgA0ru /Yu7Ft9nMIkwk7QKYbKt9BMZBtLLQ4266yGPeTvUjAihNy5Vt9TjYDfCNcYmCjMaL4QX HNGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FbauWvjEFr0VEys9tznLWPTDHaU2uug5P4EDNWbJ8+E=; b=kAwgaoS9QO+7PoKgWUe8y8zXVSzIdYNwyuBqq7uBw8nrFOBgaENlFatlLzkm7csFOj IA5914NoSYYuaPEAH7lR3Iofox6xrqZaNKkSGlpBvCQFfqDYxOABONGoNP7epdvg/9Oy 2mYFvaZBqe2oU11Djck4em/kdCUUF3pncVWF25wgtef7PP4ieinf1XwM8spN8ocJX5p8 D67iOAPuS2DEME2bd40noFeSTLGWB1wMjvr3SlucktmAIE4ry0wWvZVX3aEcqVhMwjtX Z73yJBUxoZ574mO0QAbAw8lj//npko/7l3VKhg4GumMyaNyInXY9xlngGKezrnNxCFRU ONvw== X-Gm-Message-State: AOAM532fB3lyspeHvZgB/8vRek0G/qkmjRuBYQ56RaCBWN0nuSNbKtQQ gUO/JKhMMXWUcPEtRQXG9NJ7Leq8llIRHe2AdDrMPQ== X-Google-Smtp-Source: ABdhPJzLeZ7R7NMebRJM4vVfNZ690JvgI0zhKpWeLaP9Flzk3MULTYtYTkX5Voxns4JCqEDfY804I3cDD+Zgel9ktWE= X-Received: by 2002:a05:6000:1c1e:: with SMTP id ba30mr3898662wrb.699.1642768964790; Fri, 21 Jan 2022 04:42:44 -0800 (PST) MIME-Version: 1.0 References: <20220113091056.1297982-1-james.clark@arm.com> <20220113091056.1297982-3-james.clark@arm.com> In-Reply-To: <20220113091056.1297982-3-james.clark@arm.com> From: Mike Leach Date: Fri, 21 Jan 2022 12:42:34 +0000 Message-ID: Subject: Re: [PATCH v2 2/6] coresight: Fail to open with return stacks if they are unavailable To: James Clark Cc: suzuki.poulose@arm.com, mathieu.poirier@linaro.org, coresight@lists.linaro.org, leo.yan@linaro.com, Leo Yan , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reviewed-by: Mike Leach On Thu, 13 Jan 2022 at 09:11, James Clark wrote: > > Maintain consistency with the other options by failing to open when they > aren't supported. For example ETM_OPT_TS, ETM_OPT_CTXTID2 and the newly > added ETM_OPT_BRANCH_BROADCAST all return with -EINVAL if they are > requested but not supported by hardware. > > The consequence of not doing this is that the user may not be > aware that they are not enabling the feature as it is silently disabled. > > Signed-off-by: James Clark > --- > drivers/hwtracing/coresight/coresight-etm4x-core.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index 04669ecc0efa..a93c1a5fe045 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -674,10 +674,15 @@ static int etm4_parse_event_config(struct coresight_device *csdev, > } > > /* return stack - enable if selected and supported */ > - if ((attr->config & BIT(ETM_OPT_RETSTK)) && drvdata->retstack) > - /* bit[12], Return stack enable bit */ > - config->cfg |= BIT(12); > - > + if (attr->config & BIT(ETM_OPT_RETSTK)) { > + if (!drvdata->retstack) { > + ret = -EINVAL; > + goto out; > + } else { > + /* bit[12], Return stack enable bit */ > + config->cfg |= BIT(12); > + } > + } > /* > * Set any selected configuration and preset. > * > -- > 2.28.0 > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK 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 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 58F46C433F5 for ; Fri, 21 Jan 2022 12:44:03 +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:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xyaDBRzj4C29G2XBtPfdqIoACHImpbeR4pScJDpFki0=; b=YUtJpCVenLHqOA ZtVmU52tpPKdeMbUXZK4sXaDAvP5FCKQ9gOpixavd713BFkuftNeeDadFwDZofq0ragWj3u4vqZqM 1I8wi1NAOmsuoiNdIXp85MQlRn2QPR22ab6ps3eEde+A9fcHazp50/GH4cluEPwTEgM8WHAH/5Jgb wHOpUzU2Z7ahCs4AFBqgSqB1nJ97HSz4KizgAGTw8BSiB7RzTnc/RMB9fMS5CdOkajHdmQv+x8H54 WjfhKrBhB+G5PrSmqPPaPBcnODL3s03EovHWQRrEDBkqZwkA3905yEs8Qdwsiagcadx+C2yKnZ7h2 3KhFwVo7M4LTxcHEgORQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAtFh-00EyMz-JN; Fri, 21 Jan 2022 12:42:49 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAtFe-00EyM0-0L for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 12:42:47 +0000 Received: by mail-wm1-x32b.google.com with SMTP id e9-20020a05600c4e4900b0034d23cae3f0so22143593wmq.2 for ; Fri, 21 Jan 2022 04:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FbauWvjEFr0VEys9tznLWPTDHaU2uug5P4EDNWbJ8+E=; b=uoPJ8mn9Kan1V+k3BDZDa7RTh/3CLdpRfMvVa7WsJ/gKSaS8pvkj5NERpKxKYq5GPz 3mx5xTgJyma8/Ei4cpOGwy6BbvmD9lRqGLiyNJiBT8Kqxbjr26bM8058UvKMiFlNhQLA UlEM4cLyLjyIxUzHjwt5IM37pvGKvDt2SQw8m2Twh6MuwGQhhI5CPDdhyBRj8gEEkQeh 7FGYa11oLjNOK19Yso7Ha8I9sK4eoaK9Qvuz2RBuDXW9wDhe2L6xgZSzO+gFDNXgA0ru /Yu7Ft9nMIkwk7QKYbKt9BMZBtLLQ4266yGPeTvUjAihNy5Vt9TjYDfCNcYmCjMaL4QX HNGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FbauWvjEFr0VEys9tznLWPTDHaU2uug5P4EDNWbJ8+E=; b=LqrBNS6TaVfQy1K+5QIFSgs4vUEtE2MgLzT2EtaQW7HBsWP+/vDoRsZU1FyCZlBWs0 NQis4h2oVVgH0i6OapuBTyR7pzXsm01KiyIEf2Q7Q2HA+EYKNXS801EQqvyl7HbZ6vxQ owecMfRdFBPH/zT28WDYUgJ+DWyOIU7hMzOSCI/rRWO7QaQcxeHgBXFlAS2T6qHmZ0d7 zg3cnc08TkQPrdeVaurqDgtu+sFTOelM/MmeE8h1qlQkXJtD1pLroQ9JzAocSCWVDiXa 4SxKpx9NBzXZuMnBrtQrtdlx/O6lEWVjpksFYYS/EL68MTvtmcqhzHOQf7K3rHj+8dor lTOg== X-Gm-Message-State: AOAM533x35+Il/4aFGGXMMHaCMBOm3k3ru7KgvzpXNf0SqHiR0Y0fpUM WLZMWTGHr/9M2xsh/Mi+ZMH8jC/LtHkYBhu+r0G3Xw== X-Google-Smtp-Source: ABdhPJzLeZ7R7NMebRJM4vVfNZ690JvgI0zhKpWeLaP9Flzk3MULTYtYTkX5Voxns4JCqEDfY804I3cDD+Zgel9ktWE= X-Received: by 2002:a05:6000:1c1e:: with SMTP id ba30mr3898662wrb.699.1642768964790; Fri, 21 Jan 2022 04:42:44 -0800 (PST) MIME-Version: 1.0 References: <20220113091056.1297982-1-james.clark@arm.com> <20220113091056.1297982-3-james.clark@arm.com> In-Reply-To: <20220113091056.1297982-3-james.clark@arm.com> From: Mike Leach Date: Fri, 21 Jan 2022 12:42:34 +0000 Message-ID: Subject: Re: [PATCH v2 2/6] coresight: Fail to open with return stacks if they are unavailable To: James Clark Cc: suzuki.poulose@arm.com, mathieu.poirier@linaro.org, coresight@lists.linaro.org, leo.yan@linaro.com, Leo Yan , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_044246_083263_E9A5ED3C X-CRM114-Status: GOOD ( 21.23 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reviewed-by: Mike Leach On Thu, 13 Jan 2022 at 09:11, James Clark wrote: > > Maintain consistency with the other options by failing to open when they > aren't supported. For example ETM_OPT_TS, ETM_OPT_CTXTID2 and the newly > added ETM_OPT_BRANCH_BROADCAST all return with -EINVAL if they are > requested but not supported by hardware. > > The consequence of not doing this is that the user may not be > aware that they are not enabling the feature as it is silently disabled. > > Signed-off-by: James Clark > --- > drivers/hwtracing/coresight/coresight-etm4x-core.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index 04669ecc0efa..a93c1a5fe045 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -674,10 +674,15 @@ static int etm4_parse_event_config(struct coresight_device *csdev, > } > > /* return stack - enable if selected and supported */ > - if ((attr->config & BIT(ETM_OPT_RETSTK)) && drvdata->retstack) > - /* bit[12], Return stack enable bit */ > - config->cfg |= BIT(12); > - > + if (attr->config & BIT(ETM_OPT_RETSTK)) { > + if (!drvdata->retstack) { > + ret = -EINVAL; > + goto out; > + } else { > + /* bit[12], Return stack enable bit */ > + config->cfg |= BIT(12); > + } > + } > /* > * Set any selected configuration and preset. > * > -- > 2.28.0 > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel