Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2668878ybk; Tue, 12 May 2020 05:21:10 -0700 (PDT) X-Google-Smtp-Source: APiQypLT/bdrCGGMDuiFeZuJL6COtIJr2P6TUv+Xbuwbm/dZXgRpwGzh86O2Dy7fcFreqOwCJqa6 X-Received: by 2002:aa7:c608:: with SMTP id h8mr18117930edq.232.1589286070416; Tue, 12 May 2020 05:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589286070; cv=none; d=google.com; s=arc-20160816; b=LbCyr00Xvo804lJxRNUB/xoOgxkeTYLA9aLFy4y+DemZ/+HunTvIP+Ja/gY0xvQMzQ P9ud3GFKpOQqS4O+2xANJbF7nN057y7HjtoVhlxrmJB99C9BsRsD3CQ0JrD7n0S5Layd 4REXTaaCItuxIdwlui9V4IOoHn3KxWXvu0+cwt5ooS5sb5lR8UGS50LaSYAsHb+BUxTq g2HCm/pjEmEmSjHsRLdXsjMahh5d1Qg91yGYBsPChuxQyBqHlJAqkmMk/n/y1Shlro5u DJzpve5ikL4RZIaRxm17zdzZB1ZgQ0aKo8ZEQ6/1E8C4Btvao9MPSevkw/hZ+RIggzNg PlTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aN22QMSlHMq2x1uFkNkTTUFv3ZVdynuFva3ojXPgc38=; b=ysmTFk6HzNyNiPqXBt69ckEv6YDmKpGWMkBlM0EB5fSsxXp0LHFw10N4fjohbGMjQN Ta/mnd1a0f+QXRXAnS901b0ZMMGKMjkgTmLWwYSkA+6TES2ZyygM8WYjhLDWCd5ZwFxi VzZJTrvFpASbXB2uBEGucqk9Okj65lFLKbRUpGSHhFIICjN9K2E4Gm/qvMY8zM0/wQHD Vl2xTjq0Xma303oBf8K9ZN+fT/MJPZu+XBHOVTXElZyUq/oxNR5MKNhwi5eYTQaeNCTD KyvCNjKBfBdwZR53//w0pUlUNNb49PFFW0O6v6Cc0nQlO0kHL8/eNC8Ij4oc+9WN5gQx wlLg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si2289148ejv.83.2020.05.12.05.20.39; Tue, 12 May 2020 05:21:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729720AbgELMSv (ORCPT + 99 others); Tue, 12 May 2020 08:18:51 -0400 Received: from verein.lst.de ([213.95.11.211]:40918 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729437AbgELMSv (ORCPT ); Tue, 12 May 2020 08:18:51 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 543D768BEB; Tue, 12 May 2020 14:18:49 +0200 (CEST) Date: Tue, 12 May 2020 14:18:49 +0200 From: Christoph Hellwig To: Marek Szyprowski Cc: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Robin Murphy , Bartlomiej Zolnierkiewicz , linux-arm-kernel@lists.infradead.org, David Airlie , Daniel Vetter , Joerg Roedel Subject: Re: [PATCH v4 03/38] iommu: add generic helper for mapping sgtable objects Message-ID: <20200512121849.GC20393@lst.de> References: <20200512085710.14688-1-m.szyprowski@samsung.com> <20200512090058.14910-1-m.szyprowski@samsung.com> <20200512090058.14910-3-m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200512090058.14910-3-m.szyprowski@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 12, 2020 at 11:00:23AM +0200, Marek Szyprowski wrote: > struct sg_table is a common structure used for describing a memory > buffer. It consists of a scatterlist with memory pages and DMA addresses > (sgl entry), as well as the number of scatterlist entries: CPU pages > (orig_nents entry) and DMA mapped pages (nents entry). > > It turned out that it was a common mistake to misuse nents and orig_nents > entries, calling mapping functions with a wrong number of entries. > > To avoid such issues, lets introduce a common wrapper operating directly > on the struct sg_table objects, which take care of the proper use of > the nents and orig_nents entries. > > Signed-off-by: Marek Szyprowski Looks good, Reviewed-by: Christoph Hellwig