Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3085569ybl; Sun, 2 Feb 2020 14:14:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyVwiN1CLd0SpbEsIh/oKSuT3XcSdkcBcvExmDORB8woBLULeaxnYkILJK2AsyW5iBrAK+r X-Received: by 2002:aca:1c0d:: with SMTP id c13mr12439818oic.44.1580681642772; Sun, 02 Feb 2020 14:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580681642; cv=none; d=google.com; s=arc-20160816; b=ElmWsdJurm3WgzwCPz9CJVYCz7B05iU1MTLYKGBEW2HLnOCyOD0x4+Iy/zbTsclWiX O9gx5cbujUvuuDIPOLgIkDdTAZkz34GXFoWJiay4Is4F51w/HU8bSA2qeZ5j8aEl6l9K K3tG8cZJeR2yxcwwoBEQiUPePOlsj2P9rj6DV0nbiOCW64ton+ypHVoXrUhgl4H/mKK7 mqxxY6Q9pdj0g6OpeNm0xwNg16Prgx3N3sIItlFrsOpiAESybmPOVn899fiGkMnHN4ff 7lj8fdXA0osTxnXdMn9zwUonVEr+WtQByIP/ZXeG2G73fBWP1blQV+XP8jaeILjvkyYw MIGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DGQujRAgaDCf8lJCNDZ0S36AK7TctHowW4/wCL3R4dg=; b=KVlXlG4tQwSbjg3BDWzCpacefNCIZ9rE/YEaPszFH1Z0FnXig0TvaVMiRO0zIr5aQc 4tsc+AA7xueaysMtm5qKbmgUPqY+++kT8rqhCq1m1hUt7UHSTmvMGN/a3a+WWnPheWTs JBVc3l6pX05fqWSidKaRZk5GwxVExjlVkbcJbAtm0OosGKEDgJ679ztqHnGszpQln5UT CMhEai4fhnkGHf6w9r1kBrRePMtS+AVcEUcgb7Satt0Dfeb+ACbxPu0qBQmAWS8g5W2W +DAOoczPvr/f3hoAkICP+a4eCy9KKVFoejH1nqqiYZlDUkqU++rNC5C0Ug5roksyExgO VAcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@orbital-systems-com.20150623.gappssmtp.com header.s=20150623 header.b=HdW1c905; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o18si6810945otk.80.2020.02.02.14.13.51; Sun, 02 Feb 2020 14:14:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@orbital-systems-com.20150623.gappssmtp.com header.s=20150623 header.b=HdW1c905; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727053AbgBBWMc (ORCPT + 99 others); Sun, 2 Feb 2020 17:12:32 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37181 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgBBWMc (ORCPT ); Sun, 2 Feb 2020 17:12:32 -0500 Received: by mail-pl1-f194.google.com with SMTP id c23so5061686plz.4 for ; Sun, 02 Feb 2020 14:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbital-systems-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DGQujRAgaDCf8lJCNDZ0S36AK7TctHowW4/wCL3R4dg=; b=HdW1c905Bz2Z2DS7cOn6zroCHdRDeXojwk2e0seH6xlDO6tAO/ri7zZXE05NUITROg Z0hQillklyLwxAGFOpERzghSqwKkauHgA+4Av4o/iPU0AqgIhKXz28b+QbG2x+xgDX2k 1I4s4eVPpmwb3MM1g227jrjnSGC+TqxZztqafuxzulfIHmyQ4ULJFwcr1VRp1C1MRpLz grrksSmJ2IQ5hRIQ7uc2ikk7Ni4Ra+n0Z7dPLMXR4+CdyZexJeDgRjMh36aUYT8RlHhv N75ylMhjuKI8nWiUL+JWvt4AfUCewSsMCddecKx90xuOs2Fzs99zKDzYZf6dfC2nDcoB n3BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DGQujRAgaDCf8lJCNDZ0S36AK7TctHowW4/wCL3R4dg=; b=jaTEmTZce8JPCZYeYUGiMy/SQIk/MbVZG6HRZDo2XBpCuOXuAWm2tGxGXaFRKHD4eF IW4MBqOGldMsmw+u9sJ2KMbitny7HSVUPFKcd5gUzJsWtEqh58MQAVE0qPwGHCQ5C8Db r28TtkiAjseB5mpCHDUgf5vC7sPz9OZTzb2bArVx4H10+NPwdcPRvTeMkMbyFvizDIWR 3j/7M5+putq/sqJVMApFpUuh88jFm4B24bxtvjlMLJBZvhTGJMqWA6Qi/zlQq9hcFg0g n7Aql7Yd5/0TVedjFQKFDW+7ODjKGuC1OKT0KbjUbdeKGIxSsp1ABXzqQGkY/TCk/jtu TEzQ== X-Gm-Message-State: APjAAAXfEzenf+EwgRnJYeLWo78TIn/dqFhue4WdWqKMGbp2SRjPKeIY kIERiMxEdOYiyC+F5ZGyeEx8nJTHe0NLklSPvPbxgQ== X-Received: by 2002:a17:902:8b88:: with SMTP id ay8mr20319259plb.202.1580681550270; Sun, 02 Feb 2020 14:12:30 -0800 (PST) MIME-Version: 1.0 References: <20200202150049.677553-1-jonas@threetimestwo.org> In-Reply-To: <20200202150049.677553-1-jonas@threetimestwo.org> From: Jonas Danielsson Date: Sun, 2 Feb 2020 23:12:19 +0100 Message-ID: Subject: Re: [PATCH] mmc: atmel-mci: Add error injection via debugfs To: linux-mmc@vger.kernel.org Cc: Ludovic Desroches , Ulf Hansson , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 2, 2020 at 4:01 PM Jonas Danielsson wrote: > > From: Jonas Danielsson > > This functionality was useful for us while debugging issues with > a vendor wifi-driver that misbehaved on the SDIO bus. > > This will allow you to check how SDIO clients handle mmc > command and data errors. > > Signed-off-by: Jonas Danielsson > --- > drivers/mmc/host/atmel-mci.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c > index a9dad641c..11289c8e5 100644 > --- a/drivers/mmc/host/atmel-mci.c > +++ b/drivers/mmc/host/atmel-mci.c > @@ -328,6 +328,8 @@ struct atmel_mci { > u32 data_status; > u32 stop_cmdr; > > + bool force_cmd_error; > + bool force_data_error; > struct tasklet_struct tasklet; > unsigned long pending_events; > unsigned long completed_events; > @@ -618,6 +620,14 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot) > if (!node) > goto err; > > + node = debugfs_create_bool("force_cmd_error", 644, root, &host->force_cmd_error); > + if (!node) > + goto err; > + > + node = debugfs_create_bool("force_data_error", 644, root, &host->force_data_error); > + if (!node) > + goto err; > + > node = debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state); > if (!node) > goto err; > @@ -1807,7 +1817,12 @@ static void atmci_tasklet_func(unsigned long priv) > * If there is a command error don't start > * data transfer. > */ > - if (mrq->cmd->error) { > + if (mrq->cmd->error || host->force_cmd_error) { > + if (host->force_cmd_error) { > + dev_info(&host->pdev->dev, "FSM: forced cmd error!\n"); > + host->force_cmd_error = false; > + mrq->cmd->error = -EINVAL; > + } > host->stop_transfer(host); > host->data = NULL; > atmci_writel(host, ATMCI_IDR, > @@ -1939,7 +1954,11 @@ static void atmci_tasklet_func(unsigned long priv) > atmci_writel(host, ATMCI_IDR, ATMCI_TXRDY | ATMCI_RXRDY > | ATMCI_DATA_ERROR_FLAGS); > status = host->data_status; > - if (unlikely(status)) { > + if (unlikely(status) || host->force_data_error) { > + if (data && host->force_data_error) { > + dev_info(&host->pdev->dev, "FSM: forced data error!\n"); > + host->force_data_error = false; > + } > host->stop_transfer(host); > host->data = NULL; > if (data) { > @@ -2519,6 +2538,7 @@ static int atmci_probe(struct platform_device *pdev) > return -ENOMEM; > > host->pdev = pdev; > + host->force_data_error = host->force_cmd_error = false; > spin_lock_init(&host->lock); > INIT_LIST_HEAD(&host->queue); > > -- > 2.23.0 > Haha, I just noticed that this is available from the general fault injection framework. So sorry for the noise!