From patchwork Tue Apr 16 18:32:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10903777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1387F13B5 for ; Tue, 16 Apr 2019 18:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 033D0288F4 for ; Tue, 16 Apr 2019 18:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB83A289E2; Tue, 16 Apr 2019 18:33:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 931F0288F4 for ; Tue, 16 Apr 2019 18:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730192AbfDPSdM (ORCPT ); Tue, 16 Apr 2019 14:33:12 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:50369 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729764AbfDPSdK (ORCPT ); Tue, 16 Apr 2019 14:33:10 -0400 Received: by mail-it1-f194.google.com with SMTP id q14so394771itk.0 for ; Tue, 16 Apr 2019 11:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bSTW7AqOpoUcz9Hrx03r2HNEdf+rvps0TZy7dgoXit4=; b=dWPzuqsYZ0A9aJIn+T09ptu3fGP9572YWbPHuDZDO5nqkUIoC/Lh9WC/BmHzQeOMcB Ynq3LHCSlrYYdhmf8Ca0xu0yvfIsC/SP9zpoMOd/dGucCqx4dCab5XoRIVhM7899xuON SXHslIOYI5Kut/yf/VAgb/lQ6QuZdQesAmSLY= 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=bSTW7AqOpoUcz9Hrx03r2HNEdf+rvps0TZy7dgoXit4=; b=Ltxnf2oYXcb6UGQYsXeOvoNvwBR+dwlUBDrBoW6LWJQUA1p6PczVcB8B7Chnjn89FX PaduT/mUed7dz3haVgyXX14TWNQlgXwD5+3R6/T/EeqAg0//8Xn2HJIkg/BzR7lmyIk2 oLDruiW3RNsg3W8vAN9GeYugAbddLgJbBmsWR4Ww1ctjQB80hDKTYc/ooSW1DSzPjhI6 0u+0LVDBvEwkYdlnFoaTkrz63xBAOm1KAw2JaQyBoC48KSvgrPEFJ3Qil8RJF98yI9jc Nvib0F9sCBQtk4eAAxS021DAZZQ3T6s4EU2FMM2is5Bbp2y9xU+ukkC2RVHaYqK/6gws etxg== X-Gm-Message-State: APjAAAVQvpx2m0cqiS6UBWq/WwyxcKj7C+dSKMMrisy0CEMiIhM1PLp+ 8fSXwA4qU8m6uJtvMk0Pia8tCGqe+OcMpQ== X-Google-Smtp-Source: APXvYqzRn8nV7EtohhwA6QeNt4cwOH1U/CXrYp7eE+jbOyuOoGHMbrK2k+Hi/Uce9AqyTkDiZF6NzA== X-Received: by 2002:a24:89c3:: with SMTP id s186mr32815901itd.112.1555439590031; Tue, 16 Apr 2019 11:33:10 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id f126sm80256ita.31.2019.04.16.11.33.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 11:33:09 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org, linux-trace-devel@vger.kernel.org Cc: djkurtz@chromium.org, zwisler@chromium.org, Raul E Rangel , Steven Rostedt , hongjiefang , Ingo Molnar , linux-kernel@vger.kernel.org, Shawn Lin , Kyle Roeschley , Avri Altman , Ulf Hansson Subject: [PATCH v2 1/4] mmc: core: Add trace event for SD SCR response Date: Tue, 16 Apr 2019 12:32:54 -0600 Message-Id: <20190416183257.247902-2-rrangel@chromium.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190416183257.247902-1-rrangel@chromium.org> References: <20190416183257.247902-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Example: sd_scr: mmc0: version: 2, spec3: 1, width: [1-BIT | 4-BIT], cmds: [], raw: {0x2b58000,0x0} */ Signed-off-by: Raul E Rangel --- drivers/mmc/core/sd.c | 6 +++++ include/trace/events/mmc.h | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 265e1aeeb9d8..f1772972d6a3 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -21,6 +21,8 @@ #include #include +#include + #include "core.h" #include "card.h" #include "host.h" @@ -200,6 +202,7 @@ static int mmc_decode_scr(struct mmc_card *card) if (scr_struct != 0) { pr_err("%s: unrecognised SCR structure version %d\n", mmc_hostname(card->host), scr_struct); + trace_sd_scr(card, NULL); return -EINVAL; } @@ -221,6 +224,9 @@ static int mmc_decode_scr(struct mmc_card *card) if (scr->sda_spec3) scr->cmds = UNSTUFF_BITS(resp, 32, 2); + + trace_sd_scr(card, scr); + return 0; } diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h index 7b706ff21335..9761d3db16db 100644 --- a/include/trace/events/mmc.h +++ b/include/trace/events/mmc.h @@ -10,6 +10,57 @@ #include #include +#define SD_SCR_WIDTH_FLAGS \ + {SD_SCR_BUS_WIDTH_1, "1-BIT"}, \ + {SD_SCR_BUS_WIDTH_4, "4-BIT"} + +#define SD_SCR_CMD_FLAGS \ + {SD_SCR_CMD20_SUPPORT, "CMD20"},\ + {SD_SCR_CMD23_SUPPORT, "CMD23"} + +TRACE_EVENT(sd_scr, + + TP_PROTO(struct mmc_card *card, struct sd_scr *scr), + + TP_ARGS(card, scr), + + TP_STRUCT__entry( + __array(u32, raw, 2) + __field(unsigned char, sda_vsn) + __field(unsigned char, sda_spec3) + __field(unsigned char, bus_widths) + __field(unsigned char, cmds) + __string(name, mmc_hostname(card->host)) + ), + + TP_fast_assign( + BUILD_BUG_ON(sizeof(card->raw_scr) != sizeof(__entry->raw)); + memcpy(__entry->raw, card->raw_scr, sizeof(__entry->raw)); + if (scr) { + __entry->sda_vsn = scr->sda_vsn; + __entry->sda_spec3 = scr->sda_spec3; + __entry->bus_widths = scr->bus_widths; + __entry->cmds = scr->cmds; + } else { + __entry->sda_vsn = 0; + __entry->sda_spec3 = 0; + __entry->bus_widths = 0; + __entry->cmds = 0; + } + __assign_str(name, mmc_hostname(card->host)); + ), + + TP_printk("%s: version: %d, spec3: %d, width: [%s], cmds: [%s], " + "raw: %s", + __get_str(name), + __entry->sda_vsn, + __entry->sda_spec3, + __print_flags(__entry->bus_widths, " | ", SD_SCR_WIDTH_FLAGS), + __print_flags(__entry->cmds, " | ", SD_SCR_CMD_FLAGS), + __print_array(__entry->raw, 2, sizeof(u32)) + ) +); + TRACE_EVENT(mmc_request_start, TP_PROTO(struct mmc_host *host, struct mmc_request *mrq), From patchwork Tue Apr 16 18:32:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10903767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF1CD161F for ; Tue, 16 Apr 2019 18:33:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AED62288F4 for ; Tue, 16 Apr 2019 18:33:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A842289D7; Tue, 16 Apr 2019 18:33:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F76E288F4 for ; Tue, 16 Apr 2019 18:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730249AbfDPSdP (ORCPT ); Tue, 16 Apr 2019 14:33:15 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:52367 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730248AbfDPSdO (ORCPT ); Tue, 16 Apr 2019 14:33:14 -0400 Received: by mail-it1-f193.google.com with SMTP id x132so374686itf.2 for ; Tue, 16 Apr 2019 11:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TIDqxxqztE2jOgZOgI8qrgI9gmHi2GmWCm0V06l/nB4=; b=CUt74S70/N1xpKsCTnqgFUJlJf8322fRk0pGHzVvVRn4Qv2APnTP2H6nvTQnyhonY7 HlOPEne5p8nDJkvSsL8FNmWkuHODyXn7C7Smm5P97HSXfE39EbihL5+9+kVl0ZrGdFkn Q03tlXUZ23xxqwOKAO5jcZyfBPymoG7vINi30= 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=TIDqxxqztE2jOgZOgI8qrgI9gmHi2GmWCm0V06l/nB4=; b=EzZsyN6NFaOcVWjj02++aJ375zwvSOOfnrEK3b9UTxMZByVf2XqJaAuZMLEnLQPMtj 65Sw1nKadQVWPja6gsO1c7OM8U8BvfZaMeB4kx+vyIDgerGjJkqQNa9ubKI1QDdojPuF WTzpcyn4uM5g8aqSbqUbXLynksdkobAzVdDBBM4GYGzBCcRWs1TDldZ1ZGNVTkNFmmah YrxRisFojjP65JaweRKqwS15pkIKdxwi5zOhmKh7SwWeSDkWtaYU2dpWUzWWDcxS5MMf PzLoyQYqBra/psKseiodAgMGu7PaEl+lNBy1/9rsthXCfD9jBRN2QS7FXGBt1heRsgfW z9zw== X-Gm-Message-State: APjAAAWM+Vha1XX1yOwcqQSaoI98Lp0ftZnY7a0iaSAVdUYZ4Fqjsq+d eGgDPb00mMdwKVEnx1BwX3hkOtB/nbIrbw== X-Google-Smtp-Source: APXvYqxnB/KycclqM0AuhAq3iK59bz4PqOUVtPK2s9yABsRN20ILC34p4x3ITbTV7bRxO/Zn8yeX1A== X-Received: by 2002:a24:bd08:: with SMTP id x8mr26681438ite.46.1555439593029; Tue, 16 Apr 2019 11:33:13 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id z24sm19096762ioi.67.2019.04.16.11.33.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 11:33:12 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org, linux-trace-devel@vger.kernel.org Cc: djkurtz@chromium.org, zwisler@chromium.org, Raul E Rangel , Steven Rostedt , hongjiefang , Ingo Molnar , linux-kernel@vger.kernel.org, Kyle Roeschley , Avri Altman , Ulf Hansson Subject: [PATCH v2 2/4] mmc: core: Add trace event for SD SSR response Date: Tue, 16 Apr 2019 12:32:55 -0600 Message-Id: <20190416183257.247902-3-rrangel@chromium.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190416183257.247902-1-rrangel@chromium.org> References: <20190416183257.247902-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Example: sd_ssr: mmc0: au: 8192, erase time: 0, erase offset: 0x0, raw: {0x0,0x3000000,0x1019000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} Signed-off-by: Raul E Rangel --- drivers/mmc/core/sd.c | 2 ++ include/trace/events/mmc.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index f1772972d6a3..908c3087cdcd 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -292,6 +292,8 @@ static int mmc_read_ssr(struct mmc_card *card) card->erase_arg = (card->scr.sda_specx && discard_support) ? SD_DISCARD_ARG : SD_ERASE_ARG; + trace_sd_ssr(card); + return 0; } diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h index 9761d3db16db..463cf318d762 100644 --- a/include/trace/events/mmc.h +++ b/include/trace/events/mmc.h @@ -61,6 +61,38 @@ TRACE_EVENT(sd_scr, ) ); +TRACE_EVENT(sd_ssr, + + TP_PROTO(struct mmc_card *card), + + TP_ARGS(card), + + TP_STRUCT__entry( + __array(u32, raw, 16) + __field(unsigned int, au) + __field(unsigned int, erase_timeout) + __field(unsigned int, erase_offset) + __string(name, mmc_hostname(card->host)) + ), + + TP_fast_assign( + BUILD_BUG_ON(sizeof(card->raw_ssr) != sizeof(__entry->raw)); + memcpy(__entry->raw, card->raw_ssr, sizeof(__entry->raw)); + __entry->au = card->ssr.au; + __entry->erase_timeout = card->ssr.erase_timeout; + __entry->erase_offset = card->ssr.erase_offset; + __assign_str(name, mmc_hostname(card->host)); + ), + + TP_printk("%s: au: %d, erase time: %d, erase offset: %#x, raw: %s", + __get_str(name), + __entry->au, + __entry->erase_timeout, + __entry->erase_offset, + __print_array(__entry->raw, 16, sizeof(u32)) + ) +); + TRACE_EVENT(mmc_request_start, TP_PROTO(struct mmc_host *host, struct mmc_request *mrq), From patchwork Tue Apr 16 18:32:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10903779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A33ED1850 for ; Tue, 16 Apr 2019 18:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94B41288F4 for ; Tue, 16 Apr 2019 18:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88DC7289D7; Tue, 16 Apr 2019 18:33:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1165A289C4 for ; Tue, 16 Apr 2019 18:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730254AbfDPSdR (ORCPT ); Tue, 16 Apr 2019 14:33:17 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:38403 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730258AbfDPSdQ (ORCPT ); Tue, 16 Apr 2019 14:33:16 -0400 Received: by mail-io1-f66.google.com with SMTP id v4so18495086ioj.5 for ; Tue, 16 Apr 2019 11:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sCg1+4C/3BXdYjyRhbyWaAnGRGTGFQ1Fry4WA2G26j8=; b=PU7Tpr+zhZjEs++hYXr1ScD7vT5qTwF4iKMM54vbh1iAZj7lEoQcejtgtaQhzuS/m4 7ph6PU9mzpswJ/0piM1OfkTxjZEVdYXDUIgk6FJAXXqyk2er7UyajgIrCgY5CTodvohj Vs2f+81sG2Dt4EU5tnveamavMeTdrPSwmOM4c= 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=sCg1+4C/3BXdYjyRhbyWaAnGRGTGFQ1Fry4WA2G26j8=; b=BXKdffZWv8Ut5M17IpIO2ghuokO42lXfp7R3sQ3xIVtGVA1C3Ba5ZOM8dI3/JBDU9I 0DI2FpAEGKKXgZPBTDtbMqPKzvHVDi12w/czlIH6cOhr3ojOZUtWFeSdaD3GkCtzL6Cx zR3ffcdamuEQ3JX3D927hZWVtJZFfyf/FWdhBUrgUY9QzuyI5sBrQZyosKqRp1IDaSWy Bygr+NGOUJBof27Sh/CG/kem1ZJUaDt/N3bN+sv+sokWvik7gYwLy31ooregbIud0per g0jeM5wk4HI14r0Uw639+umK/Wag0lgYv+n+oCERO1osWcBS/lYw3S+gcdB4hEtoBO0A fJ5w== X-Gm-Message-State: APjAAAU2RisvjKOUoB/o2d5M6dLhD8oKQqD5up0NJBtBK0n7EYC/cfsQ CWkGRvO5C2rjeHmfNq7mkVfdZzn+bQ1gUA== X-Google-Smtp-Source: APXvYqxe51A2j3HQNDba4Y1SRCrfzq3onNi4ynJVohVbf4X4syGAVuNhE3mopOvgQvF7pjvzYVE5iw== X-Received: by 2002:a6b:4e10:: with SMTP id c16mr9806791iob.18.1555439595207; Tue, 16 Apr 2019 11:33:15 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id k18sm19887735iob.60.2019.04.16.11.33.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 11:33:14 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org, linux-trace-devel@vger.kernel.org Cc: djkurtz@chromium.org, zwisler@chromium.org, Raul E Rangel , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 3/4] mmc: core: Add trace event for SD OCR response Date: Tue, 16 Apr 2019 12:32:56 -0600 Message-Id: <20190416183257.247902-4-rrangel@chromium.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190416183257.247902-1-rrangel@chromium.org> References: <20190416183257.247902-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Example: sd_ocr_request: mmc0: 0x0 [] sd_ocr_request: mmc0: 0x51200000 [SDHC or SDXC Supported (HCS) | Maximum Performance (XPC) | Switch to 1.8V (S18R) | 3.3 ~ 3.4] sd_ocr_response: mmc0: 0xff8000 [2.7 ~ 2.8 | 2.8 ~ 2.9 | 2.9 ~ 3.0 | 3.0 ~ 3.1 | 3.1 ~ 3.2 | 3.2 ~ 3.3 | 3.3 ~ 3.4 | 3.4 ~ 3.5 | 3.5 ~ 3.6] Signed-off-by: Raul E Rangel --- drivers/mmc/core/sd_ops.c | 6 +++ include/trace/events/mmc.h | 92 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 0bb0b8419016..4cf0f040f896 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -19,6 +19,8 @@ #include #include +#include + #include "core.h" #include "sd_ops.h" @@ -130,11 +132,15 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) cmd.arg = ocr; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; + trace_sd_ocr_request(host, ocr); + for (i = 100; i; i--) { err = mmc_wait_for_app_cmd(host, NULL, &cmd); if (err) break; + trace_sd_ocr_response(host, cmd.resp[0]); + /* if we're just probing, do a single pass */ if (ocr == 0) break; diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h index 463cf318d762..8d97810221cd 100644 --- a/include/trace/events/mmc.h +++ b/include/trace/events/mmc.h @@ -10,6 +10,98 @@ #include #include + +#define SD_OCR_REQUEST \ + {SD_OCR_CCS, "SDHC or SDXC Supported (HCS)"}, \ + {SD_OCR_XPC, "Maximum Performance (XPC)"}, \ + {SD_ROCR_S18A, "Switch to 1.8V (S18R)"}, \ + {MMC_VDD_165_195, "1.65 - 1.95"}, \ + {MMC_VDD_20_21, "2.0 ~ 2.1"}, \ + {MMC_VDD_21_22, "2.1 ~ 2.2"}, \ + {MMC_VDD_22_23, "2.2 ~ 2.3"}, \ + {MMC_VDD_23_24, "2.3 ~ 2.4"}, \ + {MMC_VDD_24_25, "2.4 ~ 2.5"}, \ + {MMC_VDD_25_26, "2.5 ~ 2.6"}, \ + {MMC_VDD_26_27, "2.6 ~ 2.7"}, \ + {MMC_VDD_27_28, "2.7 ~ 2.8"}, \ + {MMC_VDD_28_29, "2.8 ~ 2.9"}, \ + {MMC_VDD_29_30, "2.9 ~ 3.0"}, \ + {MMC_VDD_30_31, "3.0 ~ 3.1"}, \ + {MMC_VDD_31_32, "3.1 ~ 3.2"}, \ + {MMC_VDD_32_33, "3.2 ~ 3.3"}, \ + {MMC_VDD_33_34, "3.3 ~ 3.4"}, \ + {MMC_VDD_34_35, "3.4 ~ 3.5"}, \ + {MMC_VDD_35_36, "3.5 ~ 3.6"} \ + +TRACE_EVENT(sd_ocr_request, + + TP_PROTO(struct mmc_host *host, u32 ocr), + + TP_ARGS(host, ocr), + + TP_STRUCT__entry( + __field(u32, ocr) + __string(name, mmc_hostname(host)) + ), + + TP_fast_assign( + __entry->ocr = ocr; + __assign_str(name, mmc_hostname(host)); + ), + + TP_printk("%s: %#x [%s]", + __get_str(name), + __entry->ocr, + __print_flags(__entry->ocr, " | ", SD_OCR_REQUEST) + ) +); + +#define SD_OCR_RESPONSE \ + {MMC_CARD_BUSY, "Ready"}, \ + {SD_OCR_CCS, "SDHC or SDXC (CCS)"}, \ + {(1<<29), "UHS-II Card"}, \ + {SD_ROCR_S18A, "1.8V Accepted (S18A)"}, \ + {MMC_VDD_165_195, "1.65 - 1.95"}, \ + {MMC_VDD_20_21, "2.0 ~ 2.1"}, \ + {MMC_VDD_21_22, "2.1 ~ 2.2"}, \ + {MMC_VDD_22_23, "2.2 ~ 2.3"}, \ + {MMC_VDD_23_24, "2.3 ~ 2.4"}, \ + {MMC_VDD_24_25, "2.4 ~ 2.5"}, \ + {MMC_VDD_25_26, "2.5 ~ 2.6"}, \ + {MMC_VDD_26_27, "2.6 ~ 2.7"}, \ + {MMC_VDD_27_28, "2.7 ~ 2.8"}, \ + {MMC_VDD_28_29, "2.8 ~ 2.9"}, \ + {MMC_VDD_29_30, "2.9 ~ 3.0"}, \ + {MMC_VDD_30_31, "3.0 ~ 3.1"}, \ + {MMC_VDD_31_32, "3.1 ~ 3.2"}, \ + {MMC_VDD_32_33, "3.2 ~ 3.3"}, \ + {MMC_VDD_33_34, "3.3 ~ 3.4"}, \ + {MMC_VDD_34_35, "3.4 ~ 3.5"}, \ + {MMC_VDD_35_36, "3.5 ~ 3.6"} + +TRACE_EVENT(sd_ocr_response, + + TP_PROTO(struct mmc_host *host, u32 ocr), + + TP_ARGS(host, ocr), + + TP_STRUCT__entry( + __field(u32, ocr) + __string(name, mmc_hostname(host)) + ), + + TP_fast_assign( + __entry->ocr = ocr; + __assign_str(name, mmc_hostname(host)); + ), + + TP_printk("%s: %#x [%s]", + __get_str(name), + __entry->ocr, + __print_flags(__entry->ocr, " | ", SD_OCR_RESPONSE) + ) +); + #define SD_SCR_WIDTH_FLAGS \ {SD_SCR_BUS_WIDTH_1, "1-BIT"}, \ {SD_SCR_BUS_WIDTH_4, "4-BIT"} From patchwork Tue Apr 16 18:32:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10903771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63EA5161F for ; Tue, 16 Apr 2019 18:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EB20289C4 for ; Tue, 16 Apr 2019 18:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42460289E5; Tue, 16 Apr 2019 18:33:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46EC289C4 for ; Tue, 16 Apr 2019 18:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728373AbfDPSd1 (ORCPT ); Tue, 16 Apr 2019 14:33:27 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:55453 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730289AbfDPSdT (ORCPT ); Tue, 16 Apr 2019 14:33:19 -0400 Received: by mail-it1-f196.google.com with SMTP id y134so341779itc.5 for ; Tue, 16 Apr 2019 11:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F3GPaWxyQHkj77z2s2eVPCGI01KnC8ViCHmTdyBvcOU=; b=TYgdyooDOXKuuhaht5S5dTCrXIc6mB+6oviKJo14tF4ChMKI0wLDdf3QmJW8ZscNB+ fKSjrQSrEV81py88vVUlJlbjxUy7eMW0FJBjzq8t9voUlRuPpiM7Crpp2tjMjKfEyOe1 4qsbNscB/a3xXglB+tPSE78EmnwpZY50JeAh0= 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=F3GPaWxyQHkj77z2s2eVPCGI01KnC8ViCHmTdyBvcOU=; b=tSzjvXJhg5igH+ad9sBO6JnLqmERm1PFuvth+kxUJKkoT6n+jbGxcCBPsNqV9q74jw sZmTnBsGkeE5mi/18u4o7ssCNeahjfEPjnLXQeRo6+V0qJpRaAqA8lNpRYa127QLJ8xR 1HGCN7leXYHMnK5uDYPPYagZuZJ4hbEn3vpmHy08lQPqUe8LHyLNc2lDfDaS+s5bsMEJ pXR86efJFcndk3XEIT+RD6dcWVGnG98jSfyRnU/IBtszPtU8j1AYm2nrx9nnmK83FX/U KJfoVuuCGoN5UQmAdNGR5+xhg/Bi/fBnDR5Cfcdgd6bCzOACNGzyCIO6MzZKTKq3ZrUx Ef9A== X-Gm-Message-State: APjAAAWF2yLbAKwLh8cunJa8EMg1Yw5ougnBlqGA+A3q77Ef7jg1jKU1 HSwuumesv/xSrMV0z/2FrbC2Ud5WNRDblA== X-Google-Smtp-Source: APXvYqyUEAIZVeWfBmzRRg9tdYk+hBJwi3c2BMG1LanJailJTOvWT5vm8VLN+5bDqavqhvrdcAMEOA== X-Received: by 2002:a24:4161:: with SMTP id x94mr31426514ita.83.1555439598146; Tue, 16 Apr 2019 11:33:18 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id m25sm92094iti.24.2019.04.16.11.33.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 11:33:17 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org, linux-trace-devel@vger.kernel.org Cc: djkurtz@chromium.org, zwisler@chromium.org, Raul E Rangel , Steven Rostedt , hongjiefang , Jennifer Dahm , linux-kernel@vger.kernel.org, Shawn Lin , Kyle Roeschley , Ingo Molnar , Avri Altman , Ulf Hansson , Simon Horman Subject: [PATCH v2 4/4] mmc: core: Add trace event for CSD response Date: Tue, 16 Apr 2019 12:32:57 -0600 Message-Id: <20190416183257.247902-5-rrangel@chromium.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190416183257.247902-1-rrangel@chromium.org> References: <20190416183257.247902-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Example: mmc_csd: mmc0: struct: 0, cmdclass: 0x5b5, raw: {0x400e0032,0x5b590000,0x3b4b7f80,0xa404000} Signed-off-by: Raul E Rangel --- drivers/mmc/core/mmc.c | 4 ++++ drivers/mmc/core/sd.c | 2 ++ include/trace/events/mmc.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3e786ba204c3..46ce894f7c03 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -20,6 +20,8 @@ #include #include +#include + #include "core.h" #include "card.h" #include "host.h" @@ -182,6 +184,8 @@ static int mmc_decode_csd(struct mmc_card *card) csd->erase_size <<= csd->write_blkbits - 9; } + trace_mmc_csd(card); + return 0; } diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 908c3087cdcd..3b2e09fa72c5 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -183,6 +183,8 @@ static int mmc_decode_csd(struct mmc_card *card) card->erase_size = csd->erase_size; + trace_mmc_csd(card); + return 0; } diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h index 8d97810221cd..46fd918bcae3 100644 --- a/include/trace/events/mmc.h +++ b/include/trace/events/mmc.h @@ -185,6 +185,35 @@ TRACE_EVENT(sd_ssr, ) ); +TRACE_EVENT(mmc_csd, + + TP_PROTO(struct mmc_card *card), + + TP_ARGS(card), + + TP_STRUCT__entry( + __array(u32, raw, 4) + __field(unsigned char, structure) + __field(unsigned short, cmdclass) + __string(name, mmc_hostname(card->host)) + ), + + TP_fast_assign( + BUILD_BUG_ON(sizeof(card->raw_csd) != sizeof(__entry->raw)); + memcpy(__entry->raw, card->raw_csd, sizeof(__entry->raw)); + __entry->structure = card->csd.structure; + __entry->cmdclass = card->csd.cmdclass; + __assign_str(name, mmc_hostname(card->host)); + ), + + TP_printk("%s: struct: %d, cmdclass: %#x, raw: %s", + __get_str(name), + __entry->structure, + __entry->cmdclass, + __print_array(__entry->raw, 4, sizeof(u32)) + ) +); + TRACE_EVENT(mmc_request_start, TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),