Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1636351pxu; Thu, 8 Oct 2020 17:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5boOghisQxaJPbEv/bGAcIUm4CzLz4FEujh2p9KOyEVYCdjETawSWLUJbGwWQxcgOINE6 X-Received: by 2002:a17:906:118f:: with SMTP id n15mr11901568eja.394.1602203334188; Thu, 08 Oct 2020 17:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602203334; cv=none; d=google.com; s=arc-20160816; b=agtwUnI8i7DLPiJ4WaRntXozNAgIbjx4nV3r7n5bb5bEM0Ax/375RcdnXZEoHlcdD4 zAyYSy2D8JIotsYd4ijiGa8nR4xBAuWLY8NQ5O1JhmY8hv0KMNX+cl2eYGSknDAi7b8Y HBjtuyOzRmGf+tB0YzntnMcRuWq/90/kEOsIq5f19OOvkBiBr/2pczhrtkwBVEuIGZAN anKX7fd246fz2PeGmC7yPZStW/5aimIhFge8jjWgDNT9k8N6Y0qRBnvFc9fZV6DHlxvc wL+6JUp/Q1gs0yzGphObxGCRBI7sI1ZRYMpSa29WyMJbUVAtNrBpMAMm6oON12v87Bda +k8w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JqHlvYS/nUyuuUVkp5zanpXouWo0jl8ps/632AK5Tl4=; b=0xICCCfHKRPLRGjoT7l4jYKjVSGbsUxJ/bkLNUD0zWF63euyvVEXmtWHFslMLko/Tz ApHVEBDHtNt1vy9IKa5A2EEKbJ1BxfgchuQtoYlPwGOUTA1WXEWbKPm+Hzq1yqbVxQ9l bibjond736kAjTZwFdOF96Sb+jpYmmD6vrWgO0M5jZLeE3u6gQhcfGi2uzRCkROKzO7Q Hspzzi/XY7ZHZgI6RuTW4wRl3cEnIk3qbQq60QuLIjKmrlbn8CtWcLlP3PQe22GQJxkM ipixDoe7fmw+JnDPTNkBDZV+JFVcYdx7pY54DypWy0FiRmG74bByFpdGoetELJTnOTAO +lhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YOE0Wl3P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j1si49101ejx.446.2020.10.08.17.28.30; Thu, 08 Oct 2020 17:28:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YOE0Wl3P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730807AbgJHWxJ (ORCPT + 99 others); Thu, 8 Oct 2020 18:53:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbgJHWw7 (ORCPT ); Thu, 8 Oct 2020 18:52:59 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F043BC0613D5 for ; Thu, 8 Oct 2020 15:52:58 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id g10so5210169pfc.8 for ; Thu, 08 Oct 2020 15:52:58 -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=JqHlvYS/nUyuuUVkp5zanpXouWo0jl8ps/632AK5Tl4=; b=YOE0Wl3PeOp/Btq95AWsudLkZhaYipMAqAe17Y6oLaTjaqlL2QCzfBTTeD20EdMvoL fXLPpqXgsiF5aRQD8FwAuI82R+k5kZf/R8dPcPli2/VIZu9ZAlyK4df7MGZVev521chQ gdibFwzbcjksBBNG4J6EMOpv6+wiccx1P0PaQ= 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=JqHlvYS/nUyuuUVkp5zanpXouWo0jl8ps/632AK5Tl4=; b=fRCWsfEe5GrssAmpWBxGa18HPnYi9fJJi5YCMzPf1AXB1qo3BVTRGI7xkHS9qK/vA4 E3C/Ttie6IYW0ECCtzXYc6FVEAG2IUXV1uoRlo3/8BXHjxUh7eQOKbiZx33ca3rJ86Jk oAEyq/vkbDP0GgL6Pb7Ftu3oBhowslhlDS9ICvXucmQx2JsTQicJbu2MyO9aM3FaM5Dg IgkSlPmzV4VEc5JKWzPOTRQp4mCaSGs06LLU70Qi8B7bbWMzG1y7HosuQn9OFoOj03Ex eLviK7k9cYY69+cYaIbkOJGbC4bBRSNkf3asVXAhIOty/FTHqrj74YBJ7kft7bJguBC0 t29g== X-Gm-Message-State: AOAM531kD7TPBcoKZCm2T4KAb7QlUdx/ev+9Rwcun0+K6QLne8XHdI3b 1IBYuA+jXNk7fENtyTkGtK1cnQ== X-Received: by 2002:a62:d10b:0:b029:152:56c0:df72 with SMTP id z11-20020a62d10b0000b029015256c0df72mr9933786pfg.10.1602197578485; Thu, 08 Oct 2020 15:52:58 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:42b0:34ff:fe3d:58e6]) by smtp.gmail.com with ESMTPSA id jx17sm8386369pjb.10.2020.10.08.15.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 15:52:57 -0700 (PDT) From: Douglas Anderson To: Bjorn Andersson , Wolfram Sang , Akash Asthana Cc: linux-arm-msm@vger.kernel.org, Stephen Boyd , linux-i2c@vger.kernel.org, Douglas Anderson , Andy Gross , Mukesh Savaliya , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] Revert "i2c: i2c-qcom-geni: Fix DMA transfer race" Date: Thu, 8 Oct 2020 15:52:34 -0700 Message-Id: <20201008155154.2.I7b22281453b8a18ab16ef2bfd4c641fb1cc6a92c@changeid> X-Mailer: git-send-email 2.28.0.1011.ga647a8990f-goog In-Reply-To: <20201008225235.2035820-1-dianders@chromium.org> References: <20201008225235.2035820-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 02b9aec59243c6240fc42884acc958602146ddf6. As talked about in the patch ("soc: qcom: geni: More properly switch to DMA mode"), swapping the order of geni_se_setup_m_cmd() and geni_se_xx_dma_prep() can sometimes cause corrupted transfers. Thus we traded one problem for another. Now that we've debugged the problem further and fixed the geni helper functions to more disable FIFO interrupts when we move to DMA mode we can revert it and end up with (hopefully) zero problems! To be explicit, the patch ("soc: qcom: geni: More properly switch to DMA mode") is a prerequisite for this one. Fixes: 02b9aec59243 ("i2c: i2c-qcom-geni: Fix DMA transfer race") Signed-off-by: Douglas Anderson --- drivers/i2c/busses/i2c-qcom-geni.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index dead5db3315a..32b2a9921b14 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -367,6 +367,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, geni_se_select_mode(se, GENI_SE_FIFO); writel_relaxed(len, se->base + SE_I2C_RX_TRANS_LEN); + geni_se_setup_m_cmd(se, I2C_READ, m_param); if (dma_buf && geni_se_rx_dma_prep(se, dma_buf, len, &rx_dma)) { geni_se_select_mode(se, GENI_SE_FIFO); @@ -374,8 +375,6 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, dma_buf = NULL; } - geni_se_setup_m_cmd(se, I2C_READ, m_param); - time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); if (!time_left) geni_i2c_abort_xfer(gi2c); @@ -409,6 +408,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, geni_se_select_mode(se, GENI_SE_FIFO); writel_relaxed(len, se->base + SE_I2C_TX_TRANS_LEN); + geni_se_setup_m_cmd(se, I2C_WRITE, m_param); if (dma_buf && geni_se_tx_dma_prep(se, dma_buf, len, &tx_dma)) { geni_se_select_mode(se, GENI_SE_FIFO); @@ -416,8 +416,6 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, dma_buf = NULL; } - geni_se_setup_m_cmd(se, I2C_WRITE, m_param); - if (!dma_buf) /* Get FIFO IRQ */ writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG); -- 2.28.0.1011.ga647a8990f-goog