Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2654042pxb; Tue, 12 Oct 2021 10:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQmhpbfjbg1N94AzWeB8qXMiuhQ1J0MTJjYPaW3OK99785ioom7XwIMoSXlKA7P+5ymcL0 X-Received: by 2002:a05:6a00:888:b0:44c:c00e:189c with SMTP id q8-20020a056a00088800b0044cc00e189cmr31736605pfj.79.1634060522410; Tue, 12 Oct 2021 10:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634060522; cv=none; d=google.com; s=arc-20160816; b=ed8f8MLIKgA/R3SUKDAP8ihAvS2evVIYiHO5fZ76b3NHMQ90TKFw6tvTBYKUine135 mg60Sp22bA7Qn9XfA9n7uRudQmQs45czc2ESZpFE5ND9PwmAKeLscGZKx5Xti64QcXle mQAPlDSXrL8H++ZJgtskiM8aJYlAOWY9ordo+cpN9y6ApAnbZE5MupcdKA4D4qmeuIx+ BvB8wjzWnX9K1mXq6gWd3ShsxYM57hfRsySLvy+CYOyfDkMPcVvd4IQNV5m9Cs8/hBbb X5pyv1RsWBk5Cgi2y189S33Yj3DOQWjTddTLFVQouc9pNujSgHIvXr3jawtRcSW8DH0V T5dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=oHNW8iAwbLiMCjrD2yZb/l/38uU1PY+XDUI9AYIgDSw=; b=ZQw4DZq3FWTS0/bmK6mIbkTEzUlKo2Qs1kGq3QPz70EMKLJ0LPzzrJyionjxNn4Uog 1nRQFynY7ihCaFkvwPF5ntcM8G2AC1kd3uPvZfG8Uxws+2Z/8K0FIpuzkguevvdqBwCE x5BskfNpzEHrrdmng1SZytwG1LyK+vYipr2TfspM0sissIq+8Unj0pF55WI/W0XN7vk3 BKu+SKkNVCEAA9ysqh7i/pUZzV+KRR/KUeDKjWBnm/1halndFovQo+oErV7jymXH2prX 6QrCCEwcyaIUUjoKwuW3NqL0qfj0HVvjZbHAA8uYGcEgvBT3euuIUjzK0KJrt1zT5CJq P17A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JvXQduYy; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d22si7007093pfv.30.2021.10.12.10.41.48; Tue, 12 Oct 2021 10:42:02 -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=@kernel.org header.s=k20201202 header.b=JvXQduYy; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231165AbhJLRmi (ORCPT + 99 others); Tue, 12 Oct 2021 13:42:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:56010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbhJLRmh (ORCPT ); Tue, 12 Oct 2021 13:42:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BF1D610C9; Tue, 12 Oct 2021 17:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634060435; bh=oHNW8iAwbLiMCjrD2yZb/l/38uU1PY+XDUI9AYIgDSw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=JvXQduYyAbXhNr5vuechmeVPWZyzChGeSQ+79iVtPuL9rzOlBZV0VAlN1v76MWzuI CpNFrsAhXr9w2S0J2n6xu1dpL/IrQVM4i3YfQuUEdkwDmxOA09dReDy1YJGT2BHLMG LD1IRF2h+YgL/N2KoP/Rvjj+FYeBnoww/jDU4HalsPKsKL5OGEZ8sVg+uzgG+MTsj6 ArjKPRNf885la5mJXmUihbKMcR9tV5zovLcDM8Lp2un6KWV1JLhYHMeBPrPYT0UIYE 5k5pGTuV+t8A1A1aYTaf9ORTDczgvJNgOSl/cX9rw8oSIF6DN67yRrKx7vCMqxZKTM FlyfyXwYTOWDg== Message-ID: Subject: Re: [PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent() From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Cai Huoqing , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Peter Huewe , linuxppc-dev@lists.ozlabs.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 12 Oct 2021 20:40:32 +0300 In-Reply-To: <20211012154325.GI2688930@ziepe.ca> References: <20211010160147.590-1-caihuoqing@baidu.com> <31619f2f192a4f1584e458f468422cf6e8f7542f.camel@kernel.org> <20211012154325.GI2688930@ziepe.ca> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-10-12 at 12:43 -0300, Jason Gunthorpe wrote: > On Tue, Oct 12, 2021 at 06:29:58PM +0300, Jarkko Sakkinen wrote: > > On Mon, 2021-10-11 at 00:01 +0800, Cai Huoqing wrote: > > > Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/ > > =C2=A0 ~~~~~~~~~ > > =C2=A0 Replace > >=20 > > > dma_unmap_single() with dma_alloc_coherent/dma_free_coherent() > > > helps to reduce code size, and simplify the code, and coherent > > > DMA will not clear the cache every time. > > >=20 > > > Signed-off-by: Cai Huoqing > >=20 > > If this does not do functionally anything useful, there's no > > reason to apply this. >=20 > At least in this case it looks like the ibmvtpm is not using the DMA > API properly. There is no sync after each data transfer. Replacing > this wrong usage with the coherent API is reasonable. Thank you. As long as this is documented to the commit message, I'm cool with the change itself. E.g. something like this would be perfectly fine replacement for the current commit message: "The current usage pattern for the DMA API is inappropriate, as data transfers are not synced. Replace the existing DMA code with the coherent DMA API." /Jarkko