Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4418030rwb; Mon, 8 Aug 2022 00:04:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR46QyxysdK6L/8bQ73VndgOsiGxlX5SARJah+KYDS6XdeIkEfUYpLn819cAlP6R3wmql4Nc X-Received: by 2002:a63:d012:0:b0:41c:5f9f:9ab8 with SMTP id z18-20020a63d012000000b0041c5f9f9ab8mr14795670pgf.213.1659942265767; Mon, 08 Aug 2022 00:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659942265; cv=none; d=google.com; s=arc-20160816; b=Z4Ea8Kn2AgNbDpR5yt5PMfOug8c9pOlheRbqmyGZM3puqySAjAD2dgk8d5gCgvTYq+ ZfL9tXMrRwYK8hQP7agsaP0uJSSR3XWYgyQgSCy5wPf+MYjwOsyGTaq0PqIYiojCdfwn 5kW+AZmEeU+p2et2Sx1qzZJQQykz3p73zAm9Jpt86ctlzjlLaJWLEoDfCz9yKvaIiBUF zjCcfit4q7dlH7suFTSI46k+DMGKHuUv/UAqlDlHEIbmwTy52hHNsIcAPchifYa7FVLZ +C5pzLZBjeLUyJsmRQHkuPFwZ9iQxyXuiDxXUW5HrjJlXcJ6ZDHW1LTeLyMYdbWz6Oea niSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:to:from:subject:cc :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=2/N6mFP+TYpvLhr23ybFH/UP8B6EWzbXHA/jkbBuIoc=; b=PPhXSU+YTL84ZyjEHCYDQ7bowpsRuvP4sLRChoJjlbbqL3xwH7Giy2UxUnCsBCqSMC h9hx1gNpMLZhkWdguMu1RQdzW1R0tzKViO7WO1CnH+twAOTgo7OtPtl7WHE39m/x/DWh N2sBMcMrlZYXfDFYNJ8IoeIqu/KhT5j9GqKJzu75TtrXxTU0+QuM4KVEN6CwOjGksKui C4/cjvXRvi7dD1QDC6aDrsBPyI9Qx/Xmf8JRIe9Bpi+w6UCJ7q8l7QuocgD7ViNNm3tx fYNSW5eNm9KRGcAz3kuhuT1NcOOBU8oFB99i/5NpPNnMxTd+uD9ew/J1VFm38e5E0veJ BFpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fairphone.com header.s=fair header.b=lkU29Ua4; 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=fairphone.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a655a4a000000b004197e33daf5si9980457pgs.863.2022.08.08.00.04.11; Mon, 08 Aug 2022 00:04:25 -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=@fairphone.com header.s=fair header.b=lkU29Ua4; 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=fairphone.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbiHHHAL (ORCPT + 99 others); Mon, 8 Aug 2022 03:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbiHHHAF (ORCPT ); Mon, 8 Aug 2022 03:00:05 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23A78DFB7 for ; Mon, 8 Aug 2022 00:00:03 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id i14so14873245ejg.6 for ; Mon, 08 Aug 2022 00:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc; bh=2/N6mFP+TYpvLhr23ybFH/UP8B6EWzbXHA/jkbBuIoc=; b=lkU29Ua428YWYVoXEMmDC0UaKbp+MGrvym2etqoPjNHVD2NL3tW0LF47PkXL04Ez3I vvDnB0EtThz40r8LCfeh+Mi4sLOX5jf8l3WCEzdsZk29I34a9O4PwXXIdG1oZTobtiTS Pr8yAIQcboCA7RWA0WoPC/lm1iMyf/gbxHMWKW/BfGmB15dsR2/tcpYYVI1egrVLe5QD n4sJi1Cd7mLiUIbqcvP7KLtQx9ydpy1/5chSsTH6oupCLjJMhZSlmioLlr6BVSn6QEkW RVhYK9yeeUKGculzGgFZU/b7kaWseSpXzQZagr+e3yArPV0ouWvwmyQdyF8oANNnxi7k zzOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc; bh=2/N6mFP+TYpvLhr23ybFH/UP8B6EWzbXHA/jkbBuIoc=; b=LOOqJm+a/9iXqTBD2UDv3G3rOpfd+oAwdXamj+0cyMJ9o/OgcnAT/59v/sifZz+wBz OzgY+TlZNSX00fqPM0Oi+bZL3ydfFjRY6+EHQKdU99LJMcO1R4fnPdAFU3ofgMa0Br2y 2dUOrN6phpgknlzD2kcr42cEChGtIG8domn0GNOrTl66jiuT0Y/+3ztjQzLIC6Mh7RHo doHGyVv/l3JsfwPgOZ/04RXBvQ+jXIUzlDb5AUWzGoiQIGMbyXeCDmgpp8h1QVXKO8T6 EDxqpcGkZx1rqzygHz88+NoXVcHrKzzQ/FCOK1GIZhyrcZXuMOKCx9evfpOcIhekAYWS l2eg== X-Gm-Message-State: ACgBeo0nse3KDaxnN+ZOG4QT/ykz5ViBfwowUaQcs7RD28bVeuqRvKY6 5S/qQ1VxqRIijSp9V+CDa012ZA== X-Received: by 2002:a17:907:2721:b0:731:2aeb:7940 with SMTP id d1-20020a170907272100b007312aeb7940mr6385812ejl.448.1659942001700; Mon, 08 Aug 2022 00:00:01 -0700 (PDT) Received: from localhost (144-178-202-138.static.ef-service.nl. [144.178.202.138]) by smtp.gmail.com with ESMTPSA id zk19-20020a17090733d300b0072aadbd48c7sm4512240ejb.84.2022.08.08.00.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Aug 2022 00:00:01 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 08 Aug 2022 08:59:59 +0200 Message-Id: Cc: "Robin Reckmann" , , , , , , Subject: Re: [PATCH] i2c: qcom-geni: Fix GPI DMA buffer sync-back From: "Luca Weiss" To: "Robin Reckmann" , "Andy Gross" , "Bjorn Andersson" , "Konrad Dybcio" , "Sumit Semwal" , =?utf-8?q?Christian_K=C3=B6nig?= X-Mailer: aerc 0.11.0 References: <20220807140455.409417-1-robin.reckmann@gmail.com> In-Reply-To: <20220807140455.409417-1-robin.reckmann@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi Robin, On Sun Aug 7, 2022 at 4:04 PM CEST, Robin Reckmann wrote: > Fix i2c transfers using GPI DMA mode for all message types that do not se= t > 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. > > Signed-off-by: Robin Reckmann This makes I2C with GPI DMA work on sm6350/sm7725 fairphone-fp4! Thanks for fixing this! Tested-by: Luca Weiss Regards Luca > --- > drivers/i2c/busses/i2c-qcom-geni.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-= qcom-geni.c > index 6ac402ea58fb..d3541e94794e 100644 > --- 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 geni_i2c_dev = *gi2c, struct i2c_msg *msg, > { > if (tx_buf) { > dma_unmap_single(gi2c->se.dev->parent, tx_addr, msg->len, DMA_TO_DEVIC= E); > - i2c_put_dma_safe_msg_buf(tx_buf, msg, false); > + i2c_put_dma_safe_msg_buf(tx_buf, msg, !gi2c->err); > } > =20 > if (rx_buf) { > dma_unmap_single(gi2c->se.dev->parent, rx_addr, msg->len, DMA_FROM_DEV= ICE); > - i2c_put_dma_safe_msg_buf(rx_buf, msg, false); > + i2c_put_dma_safe_msg_buf(rx_buf, msg, !gi2c->err); > } > } > =20 > @@ -553,6 +553,7 @@ static int geni_i2c_gpi(struct geni_i2c_dev *gi2c, st= ruct i2c_msg *msg, > desc->callback_param =3D gi2c; > =20 > dmaengine_submit(desc); > + *buf =3D dma_buf; > *dma_addr_p =3D addr; > =20 > return 0; > --=20 > 2.25.1