From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DCB4C4363A for ; Sat, 24 Oct 2020 01:30:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 422D924248 for ; Sat, 24 Oct 2020 01:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603503055; bh=x5Z3BxJamZWJHbN/ae8iRgL3C6hpakpG7U7uZIwqix0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=oAEzg116bXldeZwerxIN3vEBgEeuD203oXxcBSjR0NFOcpIyajqQrzsZ2qhJFL/GJ DrQFLkG+Re1HVXdEaR81euqQXB4OCLt39SApErQztNBetg4q908uVJTBElwkaSEaMu rH3PIJ6OFiBd2vI5+8JS/wq1zpNcCfLhb49ZoB5o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759106AbgJXBaf (ORCPT ); Fri, 23 Oct 2020 21:30:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:34616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758374AbgJXBaf (ORCPT ); Fri, 23 Oct 2020 21:30:35 -0400 Received: from kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E759F24248; Sat, 24 Oct 2020 01:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603503048; bh=x5Z3BxJamZWJHbN/ae8iRgL3C6hpakpG7U7uZIwqix0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=K/ghEOJzPZajtixQ73DFYy7GPpMcaNqLOAm7LvdLGVLgLDpUWePbJ+PIJurvgeOx2 g4YiAcDGht7T0jWlQEyJinlHPJ65v38eHRJjw06ZmwkCmoai/vEj4MFUdFJGGigN4C R/Bc5RFzgjsjwdAbPXHoUEiDgqx6nxVYtAxB8ZV4= Date: Fri, 23 Oct 2020 18:30:47 -0700 From: Jakub Kicinski To: Alex Elder Cc: davem@davemloft.net, evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, swboyd@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: ipa: command payloads already mapped Message-ID: <20201023183047.42e315c1@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20201022010029.11877-1-elder@linaro.org> References: <20201022010029.11877-1-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 21 Oct 2020 20:00:29 -0500 Alex Elder wrote: > IPA transactions describe actions to be performed by the IPA > hardware. Three cases use IPA transactions: transmitting a socket > buffer; providing a page to receive packet data; and issuing an IPA > immediate command. An IPA transaction contains a scatter/gather > list (SGL) to hold the set of actions to be performed. > > We map buffers in the SGL for DMA at the time they are added to the > transaction. For skb TX transactions, we fill the SGL with a call > to skb_to_sgvec(). Page RX transactions involve a single page > pointer, and that is recorded in the SGL with sg_set_page(). In > both of these cases we then map the SGL for DMA with a call to > dma_map_sg(). > > Immediate commands are different. The payload for an immediate > command comes from a region of coherent DMA memory, which must > *not* be mapped for DMA. For that reason, gsi_trans_cmd_add() > sort of hand-crafts each SGL entry added to a command transaction. > > This patch fixes a problem with the code that crafts the SGL entry > for an immediate command. Previously a portion of the SGL entry was > updated using sg_set_buf(). However this is not valid because it > includes a call to virt_to_page() on the buffer, but the command > buffer pointer is not a linear address. > > Since we never actually map the SGL for command transactions, there > are very few fields in the SGL we need to fill. Specifically, we > only need to record the DMA address and the length, so they can be > used by __gsi_trans_commit() to fill a TRE. We additionally need to > preserve the SGL flags so for_each_sg() still works. For that we > can simply assign a null page pointer for command SGL entries. > > Fixes: 9dd441e4ed575 ("soc: qcom: ipa: GSI transactions") > Reported-by: Stephen Boyd > Tested-by: Stephen Boyd > Signed-off-by: Alex Elder Applied, thanks!