Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.159 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795523379; b=f6euDkGO2eIEpo1othOpLGdf9zq8dIoRP0a0iG5NrHA3I/x0B4b6CIB9mgRRyX2uIz9S SGZDPjpaS36lu7kMJPmSgO0tkoVfl8TVooY8IK4nkbGfa0gN8XVqXKVLwhpN5epZfBe3z 6cg0CCU0Ld4ByF9rymtOVtK/p2oUACjOfrad97Aw+lB9exQ05jo14eZQszZ3NkGMdWal+ jNZSJ+yCKJzucNVKG4EwsOJacGwebrK1/tvrn+BWvpR9/OtnGz1+TQrZEVwOZR47sl9ta QFsvhVFcDy1gpu7HuQs5/8c+7D1i8NtqDVKCYnEbn0gHnUf1iUzPbsXy6WajIrczNSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795523379; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer: MIME-Version:X-ThreadId:Date:From:To:Cc:Message-Id:In-Reply-To: References:Subject:Content-Type:Content-Transfer-Encoding; bh=J+iQqSqFu8ueiPUdhw6/IPHt38Wy3NcZWlRtWxtshi8=; b=H6sndlGD/8SJAqfTfeb4kX6650/ViMXj9ejNXxCC3hBxvrB1lSn0xWD1TfBlJ0tmce4k fJaQInkj7/3OfIWp7Sn4kuMs51BKDdCJmPVGxLULHigI6aasNT0a52kD6eL+rRJmIk7OC p/NOiLZL0f//3cRCSJwXtttoFPi4K2Cp3JlbZLdfUl9q2xyTYguPU+60Ao2243TSykJTd c2nCb8HINvkxseoToudNMC9f0L7+IdRd33gQm1wACANpn/tZdFEOCHs9oKTxQhJl0Vfq+ Co5yy13Z5thPge2T8iO6/Q6dh/0T4MFuneReXvbcx5kfSTLq/Njbe8KdTQN9XpnNGrg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass header.d=arndb.de header.i=@arndb.de header.a=rsa-sha256 header.s=fm2 header.b=TWEelBMh; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=KUDv68Fo; arc=none smtp.remote-ip=103.168.172.159 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B61C606A31E for ; Tue, 24 Nov 2026 12:29:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9B61C606A31E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=arndb.de header.i=@arndb.de header.a=rsa-sha256 header.s=fm2 header.b=TWEelBMh; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=KUDv68Fo Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfhigh.phl.internal (Postfix) with ESMTP id 7CC7C140026F for ; Tue, 24 Nov 2026 07:29:37 -0500 (EST) Received: from ams-imap-03 ([10.64.2.23]) by ams-compute-02.internal (MEProxy); Tue, 24 Nov 2026 07:29:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1795523373; x=1795609773; bh=J+iQqSqFu8ueiPUdhw6/IPHt38Wy3NcZWlRtWxtshi8=; b= TWEelBMh0FTDWndXG9h99WCIweikG7I9a64OdBJD6D8p6rTFf++aZEzYjoSAxRPM T5M5H/csms73IsuXbHLTt69hYF/+iY1k7GUIN+MiQt5+xVZAH//bdBsdwUlr7mcz KelIFq4lj+hgJ0ejjXl7rk7bQtHr5+3IyEJzP5e/nF+zV9vk2U5iQkoD3+jBxX5U xjjEMzzSVv4A/XtfzUQbhIcwO3v5PwbcM4t3zztayQGAzIqHXeLIjF+6pu4l95HW jkvLHTcA/cPSaat4jdUrs3Obbf3r3nf6V38fmLC9w04o4nqr4Byv5oFfCHVKiR/V +aYCqD+AZ/gXfUYk3Ldtug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1795523373; x= 1795609773; bh=J+iQqSqFu8ueiPUdhw6/IPHt38Wy3NcZWlRtWxtshi8=; b=K UDv68Fod38e+iYYgw8toeJiJUuw4XjFHfwHGTR+pdrsB8yGySCsv1zfspHUbT62T /uzAusTwehz/G0rZ3aMw/sGrvO+4pQs2TGeDcAXzbo7te8ifjZ3CJBJZCvkZFqgR OsjFpkmJG5sIpb+WX1e59OO1rgpj089a8u3sOGS0nE1XXFR5tj6T+Y2cog3Q4DHn WTT5rEEeQpEDykibCaAQPio/9jLuQzWy43kHa1EjIzxzmaWozj5OPkcqNdNER6EE 99Q33YtcI+jb95ruYbrA0oV7gpxr26NLcYsXmm1gvdMa2zXQy6t59VlbS+L4zpZy xqWogkW6uYQwIQu4d5Flw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=arndb.de a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1795523373; d=arndb.de; mf=PGFybmRAYXJuZGIuZGU+; rt=PGxpbnV4LWFybS1tc21Admdlci5rZXJuZWwub3JnPg==; s=fm2:rsa-sha256:N3VAMvkiACpe+qRZpJZhjypYc3nYvq5SPcG9p+NU3Up2KfE Fozws5JE4I8f64qztpCZ3OMjrtnnBg2R58au/TarB/A5DGIEZ0YjbwL5HLUS4Qi9 sLqSiVaTDY9UIu5cP7EjM/4+WMBt4o3R+kicfYlThs4yWabOLAH0tE5FyFgAg8uT /Z6+Hcl6S+RtbaNL9sRDYdagr7wS0hCN37YZ4XGZFksmanTicvZKJEWq2zMQohU5 O87jrH7Rls4e0JZWAR+q2fvlHkqDRH1y9Jet8L1dSuhzK+bpZib1r32P81aC2QNu 7dkqH45F/s32R5dcBd8uUw3vMOBDjv2gJ8i2Hxg==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-transfer-encoding,content-type,date,feedback-id, from,in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:WklWg/MW8eQ2MC5Fb5620cULF/sXGGKTHSpZE+gN7+E=:1G/CnskwFv+RglCFqnhH6hTuGBmU+PO8HsO4U9eyme8=; X-ME-Sender: X-ME-Proxy-Cause: dmFkZTE5BLTcSGrx6CgjWnbPMN13rozf/SDKrWFoLpRqU+yKgbciJ0ge7kBDE2fY2sfQN+ dYqCoarEUp+JyTD1ThRBIffIKGasaCVL7hzDEcyDhYkPOPaJR9DavnqIQMMEoZRB5/t5Fo XuWHcIxMMntMm68AfbFfebl+haspdDOvLCj+e10OH62hXQ8wKlt1LmoFCNyCp6Y0woAsWM 8k1aKOe+FQKKC2dtACH17kAvr2/gbwjJeL6gGo+QsEeA2YuZK2Rehx03jsZZDjVQJZCWT8 1fCchFq5COOwPV89clN8+uQH9+qfeaELGEoAHYpUaNFZwJ+cABoVdBOCYq8zEBayScEPIL xFGcfASXsTVIDaTnXK8ub2eSv8N3ybby1JA1P25GPGK/MxxAXu9sgxcfudTnK1R5fMNzgU jkoLfl1BktkCU3HsStjfvdpc2+v6a6hESwZV1Fw6hWLeJ6Vnc7wPFQr/V3dxeR20rEEIoa ninV5aKR1tzLJfdAjRW+V4z/yS9tYurBgBWRtLbXKpijFt7tKvyQv0h44cnOZM7w8ktIFR ztku7545OaSmYa/Ut/V8taN0bPe1Pp9PAExn+g6XCZF3hZ1yLMaKQEPLR26Z9J4ANuba+C NJ7okr7oitgeTH1RXnVrm0/POgYM7J2CCDUMzAC+bmtvVFbj9PLhPrK4lN3A X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id E7AD832A009E; Tue, 24 Nov 2026 07:29:29 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-ThreadId: AthCWVl4bt_o Date: Tue, 24 Nov 2026 13:29:09 +0100 From: "Arnd Bergmann" To: "Abhinav Parihar" , "Srinivas Kandagatla" , linux-arm-msm@vger.kernel.org Cc: "Greg Kroah-Hartman" , quic_bkumar@quicinc.com, "Ekansh Gupta" , linux-kernel@vger.kernel.org, quic_chennak@quicinc.com, dri-devel@lists.freedesktop.org Message-Id: <6db57a38-ddf9-4345-996b-82db8a790b7a@app.fastmail.com> In-Reply-To: <20261124120604.2640046-1-abhinav.parihar@oss.qualcomm.com> References: <20261124120604.2640046-1-abhinav.parihar@oss.qualcomm.com> Subject: Re: [PATCH v3] misc: fastrpc: Add cache maintenance for non-coherent platforms Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, Nov 24, 2026, at 13:06, Abhinav Parihar wrote: > Some platforms using fastrpc do not support DMA coherency on > HLOS. On such systems, explicit cache maintenance is > required to ensure data consistency for RPC argument buffers. > > Add cache maintenance for argument buffers when operating on > non-coherent platforms: > - Flush input buffers before invoking RPC to ensure CPU writes are > visible to the DSP > - Invalidate output buffers after RPC completion to ensure DSP > writes are visible to the CPU > > Introduce helper functions fastrpc_flush_args() and > fastrpc_inv_args() to perform the required dma-buf cache > operations. These are invoked only when the device is not marked > as DMA coherent. > > The coherency capability is determined using the "dma-coherent" > device tree property and stored per session context. The dma-mapping abstraction is meant to hide this from drivers, why does this driver need to know? > @@ -1078,6 +1086,54 @@ static int fastrpc_create_maps(struct > fastrpc_invoke_ctx *ctx) > return 0; > } > > +static void fastrpc_flush_args(struct fastrpc_invoke_ctx *ctx) > +{ > + union fastrpc_remote_arg *rpra = ctx->rpra; > + int i, inbufs; > + > + inbufs = REMOTE_SCALARS_INBUFS(ctx->sc); > + > + for (i = 0; i < ctx->nbufs; ++i) { > + int raix = ctx->olaps[i].raix; > + struct fastrpc_map *map = ctx->maps[raix]; > + > + if (raix + 1 > inbufs) > + continue; > + if (!map || !map->buf) > + continue; > + > + if (rpra[raix].buf.len && (ctx->olaps[i].mstart || > ctx->olaps[i].do_cmo)) { > + dma_buf_begin_cpu_access(map->buf, DMA_TO_DEVICE); > + dma_buf_end_cpu_access(map->buf, DMA_TO_DEVICE); > + } > + } > +} This does not look like an appropriate interface: the driver should not have to worry about platform specific details of 'flush' or 'invalidate' and only access the data between 'begin' and 'end' here. E.g. if there is an iommu or swiotlb, the buffer may become inaccessible again after 'end'. Can you change this to have separate loops to manage ownership before and after the access? Arnd