Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3293457rwa; Tue, 23 Aug 2022 02:08:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gqmc5Yq3zf7T6VATwz32UhyhhaMhK808PWp6tG5oD8E65PqvVhIbDV5Fitd58678OZPyy X-Received: by 2002:a17:907:c0d:b0:730:a85d:8300 with SMTP id ga13-20020a1709070c0d00b00730a85d8300mr15451101ejc.558.1661245738731; Tue, 23 Aug 2022 02:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661245738; cv=none; d=google.com; s=arc-20160816; b=zF7fiNrHAGkXkTGD4VtQPGzjQ6s2x/HlvMxxUr/p+/LjWCSXIeqP0/0BpVLJL9gzEt x/zKGoFc743Y+7AeAwjOehbQw2FH+6MdMU7IHSze6PVH34VUGjlhY2mUQ/ZqA7vbgLko +Lz9cweuVqw6hyyk6/YdC7uBASZ1PCE1yndHE7hdUxp7phyQ4UsTqe2BJ41cGWHxAZP+ nCGDtQywYddveJj0XDBiN1UVOsseh+MX9+hPIdesP40ORspIOiIn48xVs8G6GMpaEV14 tPwmtog9fPsIDo9w2S6niCz4xXrqh3FhFr9rpJIMkGj47yhuIAJGdeazNbmU4TDhMTPS JLow== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QRyJInBJfBtGswncXtxJi8+yPIw5MtU0VZ2PJWOURTg=; b=Jx8/15oeBS0D0jkqYClVOdEP5O6bzssJEiiR7JI8d85Q1pKeOB6H6GhwbhNpp27kHT wMr4FhMuffEbac1pcFmjlD/AylJcdDqRhSw/JtxoCHtyQ/+nIYe+xdwdO7sqw3UvOuGA 1QVbTRIFe54YRYYrdulWeFGcwvpHUiXv+Iva+FQUZYn7QRmUj2wnNSJybRZtZqbcDleS Wenga2fsY4I7SV0w/GVfdBHdv14IWnRZpxigWN5+Tgl7PIF4NZTGu53ZiV97w0fMtwEE 7zAiQ9Jo1AU8ZAUf90p493YFT6moFGEyvAHlIY1544+lErSwhxHPjKoa3gGGheXL4aoQ gqTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NL0oyUMT; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs1-20020a056402304100b0043d476f96c1si1903414edb.86.2022.08.23.02.08.31; Tue, 23 Aug 2022 02:08:58 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=NL0oyUMT; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346846AbiHWIwR (ORCPT + 99 others); Tue, 23 Aug 2022 04:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348409AbiHWIv1 (ORCPT ); Tue, 23 Aug 2022 04:51:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E354A7D1CF; Tue, 23 Aug 2022 01:23:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6A148CE1B35; Tue, 23 Aug 2022 08:17:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F69C433D6; Tue, 23 Aug 2022 08:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242657; bh=efGEspcF5pNJAi8jGCXqCYNzKEOJZR9M4Z6Xin4Qk84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NL0oyUMTEEto/3pzDJII0/HUV9OV3RULYHPHJe7/TxfZUwkaD6gVZ0hWJjf+M8aeh bxK9iLhk43ltP5cHvtUoVUhRizxABSamebcbE0vCar3hG8wqrPGmHDQV8Pg630Theo fG1LNgZS+4q4IYlmTOJV838kedmMogVnClnwJqKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Reckmann , Luca Weiss , Caleb Connolly , Konrad Dybcio , Wolfram Sang Subject: [PATCH 5.19 156/365] i2c: qcom-geni: Fix GPI DMA buffer sync-back Date: Tue, 23 Aug 2022 10:00:57 +0200 Message-Id: <20220823080124.756891054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Robin Reckmann commit 8689b80b22dbf1f5e993233370fe57f08731b14d upstream. Fix i2c transfers using GPI DMA mode for all message types that do not set the I2C_M_DMA_SAFE flag (e.g. SMBus "read byte"). In this case a bounce buffer is returned by i2c_get_dma_safe_msg_buf(), and it has to synced back to the message after the transfer is done. Add missing assignment of dma buffer in geni_i2c_gpi(). Set xferred in i2c_put_dma_safe_msg_buf() to true in case of no error to ensure the sync-back of this dma buffer to the message. Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA") Signed-off-by: Robin Reckmann Tested-by: Luca Weiss Tested-by: Caleb Connolly Reviewed-by: Konrad Dybcio Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-qcom-geni.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -484,12 +484,12 @@ static void geni_i2c_gpi_unmap(struct ge { if (tx_buf) { dma_unmap_single(gi2c->se.dev->parent, tx_addr, msg->len, DMA_TO_DEVICE); - i2c_put_dma_safe_msg_buf(tx_buf, msg, false); + i2c_put_dma_safe_msg_buf(tx_buf, msg, !gi2c->err); } if (rx_buf) { dma_unmap_single(gi2c->se.dev->parent, rx_addr, msg->len, DMA_FROM_DEVICE); - i2c_put_dma_safe_msg_buf(rx_buf, msg, false); + i2c_put_dma_safe_msg_buf(rx_buf, msg, !gi2c->err); } } @@ -553,6 +553,7 @@ static int geni_i2c_gpi(struct geni_i2c_ desc->callback_param = gi2c; dmaengine_submit(desc); + *buf = dma_buf; *dma_addr_p = addr; return 0;