Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7678042rwl; Fri, 30 Dec 2022 12:23:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXt4N6JFvQALuQrjaU6vZxxkOZ/87VFeI9D5p2GFHWwRlixdMp8bvkdRU2IVmOR7lqiLtQAm X-Received: by 2002:a17:906:958:b0:7c0:be4d:46d6 with SMTP id j24-20020a170906095800b007c0be4d46d6mr25473879ejd.59.1672431820616; Fri, 30 Dec 2022 12:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672431820; cv=none; d=google.com; s=arc-20160816; b=Jw4jG2auTTfUlm4K3WWYLf7VLRq9/2y223oZDDfvZjsbsdES0FsP1l/GTv5Oy5e/Vl HYfWBiA+cHzBqKykIaQCa4U/KEuAv+VpUpT0gnAGCuY8c5NOw7k3pFfNPccPAZT42J7h 7llswzQRLvs0PHAwCYANpgFIBlMDZwe5ezpMfZGulls1/3v1D9NbJMMh7o40qgKfISzZ WftvR/O5FM3BhjV6PpWGvD7A344fMBsSUlb9qM+zfJByLi94t3vij0UShNvBh1UbqDur gfQtm2NQDRczhGILXRnQoq3TRroFkZV4RLLihS1Qlp3iTyC53/foWe4k+5ARe/QP0nUc rDzQ== 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:dkim-signature:from; bh=d8V7YmZwWJpm8TzWMitR9ZGRxdywLzRjThlY+/tGnc8=; b=EGVvtyqAsOIni0miBGSXfKoqzKQJ4qpU2e1lldg0yggIf8RWbsX2n0dWWYOnjIrh/D Q74z45wXllyLQTGAeqO4x2tFO0+CrnKIBfzy0WD2BjQAmEkruEr1JvnDdAXVe8eYz4B/ KPU7nSZ/AIWtEYnCSGzKchY2yrK02cJZyW2S8dyXQ2DotaV8wMSZPXYozdLFObWrvCZm SQjdPB6+yNwwn9jq1DvQ4CV5HSEP1G9NxJZJ4QnyF/ChbbP8d74nY7Zb/2WFKlotMHyx y780Aj87KYZhvz5iGJz/LRE4mTBuc7yHf9grAl53ulnaE7BMGPd7l3CapMMmXl0fNHca FHmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@manjaro.org header.s=2021 header.b=nBBkXSFd; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manjaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc29-20020a1709078a1d00b007c1705dded9si18345629ejc.415.2022.12.30.12.23.26; Fri, 30 Dec 2022 12:23:40 -0800 (PST) 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; dkim=pass header.i=@manjaro.org header.s=2021 header.b=nBBkXSFd; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manjaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235195AbiL3TuK (ORCPT + 62 others); Fri, 30 Dec 2022 14:50:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbiL3TuH (ORCPT ); Fri, 30 Dec 2022 14:50:07 -0500 X-Greylist: delayed 399 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 30 Dec 2022 11:50:05 PST Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ADA42A1; Fri, 30 Dec 2022 11:50:05 -0800 (PST) From: Tobias Schramm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1672429402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=d8V7YmZwWJpm8TzWMitR9ZGRxdywLzRjThlY+/tGnc8=; b=nBBkXSFdnCavEO16vCwMBve9ViRiXreXlB2xHJF6mWU3v2ImVYz43oMQTNqOcJI4s+DFht ko4fX1zKTeiiWcnvE8mJLH3B6Yw96Tj75/XS1d+m4kTlzD46zW3L3Yx/VW6qUInsV4SwFd +UaRPmhX5VeKc+w+sBTmozvZNbOem5XsgGjslb1GaMq4t3fdPTn6qMZAd7ct4O6AYz+qRo xf396sG4wxYJK5i3UTc3AQAZpEkX/a9PADQZyfKso8bf9NCgBY40uUVIRO4INOFVPZ7B/U d5LHgtBgutbeAhABB92eaXHwCyUL/hqlN59LJkP/5Vzx6LVlu9ITsNPBYt5UOw== To: Ludovic Desroches Cc: Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Tobias Schramm Subject: [PATCH 0/1] Fix race between stop command and start of next command in atmel-mci Date: Fri, 30 Dec 2022 20:43:14 +0100 Message-Id: <20221230194315.809903-1-t.schramm@manjaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=t.schramm@manjaro.org smtp.mailfrom=t.schramm@manjaro.org X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 Hey, while using both slots on controller version 0x210 I noticed a race condition in atmel-mci. When sending a stop command the command ready interrupt is enabled before writing to the command register. This causes the associated interrupt to fire immediately, making the state machine believe that the stop command has completed already. Usually this does not seem to cause a problem. I suspect the roudtrip of mmc command completion through the kernel simply takes long enough that the stop command has usually completed once a new command is queued. However when using both slots a command might be queued for the other slot already, causing immediate dispatch of that command to the controller. This then interrupts the stop command still being sent and also corrupts the new command. I have only tested this patch with controller version 0x210, but from documentation it seems like this should be a correct fix also for other controller versions. Cheers, Tobias Tobias Schramm (1): mmc: atmel-mci: fix race between stop command and start of next command drivers/mmc/host/atmel-mci.c | 3 --- 1 file changed, 3 deletions(-) -- 2.30.2