Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp354216pxb; Fri, 28 Jan 2022 00:08:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkjFj9zRGAgtIKhikCXX/5UrCp1vCGX0KFOEAS6TAoEXlEQlBcZ0Fh52O7MDRYy0i3jeMC X-Received: by 2002:a17:907:7f0d:: with SMTP id qf13mr2244893ejc.446.1643357337547; Fri, 28 Jan 2022 00:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643357337; cv=none; d=google.com; s=arc-20160816; b=jaLJC0RxZTP+gP09ojPYvEdWV4ulAeH5KZXbmRIXliAuxxZiXRi6lkcI8nD5L/+57g XzEQpnVQWOWEQXMiWc0rWiKi2PecrY/UYOBDT1g6sCC4LiiQtwoSOJEjyQt6wn3hhfyz YVKJysMwyhTlnIiJvi3nMiW/iYMHJUKW4aZxxPr63ektU6oSmDhGO0o0iaQPEU4UtLDj 4DJmFwqMeDFQ6FzYlbZ6o7kxewWayKxZaaYv1HDw1Urp5f7GTF1JlrfhreuCHsEPeMrR D2u39IvHktCdBFU5Ktw5zhPpTrWAkTLCXcjCWMz/YfYenIUR4a8Pncqk7WgOIDraBbpi uRnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ooidBRSGS+DM9eieEw3KmW5sp/aX21pMjeJzDYzoRDE=; b=kM7VGWlUb1dX0yThUjy7a09Rz7Jl2sbqe9ocDwXwnq22HttLAK0S6auqYF5N5dlKj6 RfBLjMSQIr92GnUjPTQoLkGOunSBrruGVDkfAKt2fZecqhe4MZy39FS5Y5hNge1dGZQx JCeQXPzSJ648C5C+9M+k7wmtz3PtYPZjBCd4NamSMEyRg+VjDHeeR2nz61T/4kE/bGX7 lpeD7L3wbxI18VuFFnNSFmq/w2k67gSNSUJCL6gzI/mj9Tz0F9VHLoVkbsEIjIe69hLC Cph2UiRvqrhxJYcH+8eyVST/BnN80Nxu87Cs57uBolDxdibFj8k+egnPR31UmLVSK2qN paug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Et3yLFUs; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t7si2823549edd.599.2022.01.28.00.08.32; Fri, 28 Jan 2022 00:08:57 -0800 (PST) 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=@intel.com header.s=Intel header.b=Et3yLFUs; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240201AbiA0Pin (ORCPT + 99 others); Thu, 27 Jan 2022 10:38:43 -0500 Received: from mga12.intel.com ([192.55.52.136]:51298 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237732AbiA0Pik (ORCPT ); Thu, 27 Jan 2022 10:38:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643297920; x=1674833920; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=m6hvK8EvrQklv7boMPwOjx9XYUIbfEG+A3JROTW3WAY=; b=Et3yLFUsDxh1zEgBrQCoCE2/mrc+x4rSvpAFefm3cDopXVzxDQKzg4dX tzr5SDO88H9jfwnJTpRnztvUeuQxucyk6DlY2wqPNHXM2qoTtnc72OHE0 C+Z2mBV2uSDGXVGyq5J2APf/+V9Qk89ere1y/pO0uGCMupTmyaH338Ijz SLtHT/5ZefPOMdQri3LxsyGQM8oE15wVGgWKK9Dfod2Gc2iSBODxR1QxO kC7ix0Yys/KLm3CMK90TVAweDAHfq7VXeVozn0oyhR4AH0Qygq9ztgD+r ucVoI4bNUXvbl/s7yRj0v1za1nKVNc8Ag/aUj3gUkDJknonv6YFCQwquk g==; X-IronPort-AV: E=McAfee;i="6200,9189,10239"; a="226862372" X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="226862372" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 07:38:39 -0800 X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="767547488" Received: from anithaha-mobl.amr.corp.intel.com (HELO ldmartin-desk2) ([10.212.224.126]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 07:38:39 -0800 Date: Thu, 27 Jan 2022 07:38:38 -0800 From: Lucas De Marchi To: Thomas Zimmermann Cc: intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Christian =?utf-8?B?S8O2bmln?= Subject: Re: [Intel-gfx] [PATCH 09/19] dma-buf-map: Add wrapper over memset Message-ID: <20220127153838.eefwiqkljdplyfd4@ldmartin-desk2> X-Patchwork-Hint: comment References: <20220126203702.1784589-1-lucas.demarchi@intel.com> <20220126203702.1784589-10-lucas.demarchi@intel.com> <7cb8a8a2-718d-6d5c-5de6-05bf990dd479@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7cb8a8a2-718d-6d5c-5de6-05bf990dd479@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 03:54:21PM +0100, Thomas Zimmermann wrote: >Hi > >Am 26.01.22 um 21:36 schrieb Lucas De Marchi: >>Just like memcpy_toio(), there is also need to write a direct value to a >>memory block. Add dma_buf_map_memset() to abstract memset() vs memset_io() >> >>Cc: Matt Roper >>Cc: Sumit Semwal >>Cc: Christian K?nig >>Cc: linux-media@vger.kernel.org >>Cc: dri-devel@lists.freedesktop.org >>Cc: linaro-mm-sig@lists.linaro.org >>Cc: linux-kernel@vger.kernel.org >>Signed-off-by: Lucas De Marchi >>--- >> include/linux/dma-buf-map.h | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >>diff --git a/include/linux/dma-buf-map.h b/include/linux/dma-buf-map.h >>index 3514a859f628..c9fb04264cd0 100644 >>--- a/include/linux/dma-buf-map.h >>+++ b/include/linux/dma-buf-map.h >>@@ -317,6 +317,23 @@ static inline void dma_buf_map_memcpy_to(struct dma_buf_map *dst, const void *sr >> memcpy(dst->vaddr, src, len); >> } >>+/** >>+ * dma_buf_map_memset - Memset into dma-buf mapping >>+ * @dst: The dma-buf mapping structure >>+ * @value: The value to set >>+ * @len: The number of bytes to set in dst >>+ * >>+ * Set value in dma-buf mapping. Depending on the buffer's location, the helper >>+ * picks the correct method of accessing the memory. >>+ */ >>+static inline void dma_buf_map_memset(struct dma_buf_map *dst, int value, size_t len) >>+{ >>+ if (dst->is_iomem) >>+ memset_io(dst->vaddr_iomem, value, len); >>+ else >>+ memset(dst->vaddr, value, len); >>+} > >Maybe add an offset parameter here. yep, on v2 I will have 2 APIs, one with and one without offset. thanks Lucas De Marchi > >Best regards >Thomas > >>+ >> /** >> * dma_buf_map_incr - Increments the address stored in a dma-buf mapping >> * @map: The dma-buf mapping structure > >-- >Thomas Zimmermann >Graphics Driver Developer >SUSE Software Solutions Germany GmbH >Maxfeldstr. 5, 90409 N?rnberg, Germany >(HRB 36809, AG N?rnberg) >Gesch?ftsf?hrer: Ivo Totev