Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp2839553pxb; Sun, 20 Feb 2022 02:03:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJylvztdePC1HnGEEKJFnoVc4elMnmzDPxxY3gPO0jPnovll+m08pJHQK7Tu+J2cz80hTc0q X-Received: by 2002:a63:b60:0:b0:363:a273:42da with SMTP id a32-20020a630b60000000b00363a27342damr12258187pgl.239.1645351397477; Sun, 20 Feb 2022 02:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645351397; cv=none; d=google.com; s=arc-20160816; b=w+UOPnyRpFREPGl2ykVmaD84EmIwDDvRJFAreDVG/pI6n5sjYDrpcaWLUHtGgzyGIO FjaJ8yDTQ2IhoVxZI+ff6BJ/hXMV1wUfmFq/o8oU/R8jJCR5UEn+AJxhzmNwWLAb1zzq ikAkab7O6/8EWQeRUMNTF/wBOzHSZKfezA39Qq8RXRI1D10x5NjngeWSqA997BmnqkFi /AROxuNTzOCo2aTsImRd5+AVbaiV2EinzCP48UDTcdffEJBuDGskQftkH/Hq9pHCYjKv GU+c28VnJPwgXWUlX8VFIylZabfhH2N9M37wgBEFBG+y8QpvbEDirw8lNyHxEQ7w4EZM rehw== 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=6Ggq3SqfGscu+ZpHjDwdnBN3gZDaaQ5tABqfXHOFvdc=; b=Cs9+mNNbnslpGiNPhR+wILYrPCxOmHZf2bb982p1z1kZ2Ss3G/+53DZjnezkaQgNwv SA9RBA/KdbWuPBx/PrY7xkiOcJWrdxTu4rJ4x4bW3xxC405zPxBOHdsb0jt3M2AFF+Gq gLnCm5a0rx2xwbD8Bxv6+1HWG0jniyhGWjUlOh5ctbvIIUwKnUTGZW5DRcOcmKN119iC O3pZLOGPzR0lyyH045egZl6HB4ZfW7gFfxatqpkZ4nhNskkKuN8ruC197WTZ+k2C3XVO /glVgbvtqacahX2NC2n38edDHRCUoFvy7EPawhnpj0ZJIscpWcD04EQxrJpwLi5WPJMc VK6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cd9JYNwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15si3703084pjl.141.2022.02.20.02.03.03; Sun, 20 Feb 2022 02:03:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cd9JYNwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S242223AbiBTE2q (ORCPT + 99 others); Sat, 19 Feb 2022 23:28:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbiBTE2o (ORCPT ); Sat, 19 Feb 2022 23:28:44 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B53733A3A for ; Sat, 19 Feb 2022 20:28:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645331304; x=1676867304; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=l+EmiiMIOR0USYv8YGyxgTzcWOgHATrl7GtHHEr4F50=; b=cd9JYNwgnXv0KrhfplSGjChQcE+yq9r2cykn1isSU9h9EuzSQ3w8m/4Y /fOMSiHanzdECedoCnoAIeO0+q/9ZcDqxLoxy/zYZmiZcfilQ0NmL+JDJ 5XGONsyAjh2LVnpa6JvXNTnngQ5ma7fzx+i4TOP4egAAbSFCb6TXwT2qm T9c2aRjwb1Y3wg2t92tuePI/yVC8cndY/Jwvf42gq7Niip8W4RjnYFgEM PDQFw31yByjWlrhpCDJxowEp4osvle6I1nDqvXLgg6Kgep3Yog5RyTL+o pNNBf9Lcqj9j52riGitHiHGa8apvy+45TGazRncukQCXcZQsb2DgXJzkI g==; X-IronPort-AV: E=McAfee;i="6200,9189,10263"; a="231966339" X-IronPort-AV: E=Sophos;i="5.88,382,1635231600"; d="scan'208";a="231966339" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2022 20:28:23 -0800 X-IronPort-AV: E=Sophos;i="5.88,382,1635231600"; d="scan'208";a="490081953" Received: from penglin1-mobl.amr.corp.intel.com (HELO ldmartin-desk2) ([10.209.88.150]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2022 20:28:22 -0800 Date: Sat, 19 Feb 2022 20:28:26 -0800 From: Lucas De Marchi To: Thomas Zimmermann Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Matthew Brost , Thomas =?utf-8?Q?Hellstr=C3=B6m?= , Matt Atwood , linux-kernel@vger.kernel.org, Sumit Semwal , Daniele Ceraolo Spurio , Mauro Carvalho Chehab , Christian =?utf-8?B?S8O2bmln?= , John Harrison Subject: Re: [PATCH v3 02/16] iosys-map: Add a few more helpers Message-ID: <20220220042826.ftqf2l7tuegoktoc@ldmartin-desk2> X-Patchwork-Hint: comment References: <20220216174147.3073235-1-lucas.demarchi@intel.com> <20220216174147.3073235-3-lucas.demarchi@intel.com> <06e6035e-bbba-f158-63b7-7d10327b7a80@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: <06e6035e-bbba-f158-63b7-7d10327b7a80@suse.de> X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 17, 2022 at 09:42:08AM +0100, Thomas Zimmermann wrote: >Hi > >Am 16.02.22 um 18:41 schrieb Lucas De Marchi: >>First the simplest ones: >> >> - iosys_map_memset(): when abstracting system and I/O memory, >> just like the memcpy() use case, memset() also has dedicated >> functions to be called for using IO memory. >> - iosys_map_memcpy_from(): we may need to copy data from I/O >> memory, not only to. >> >>In certain situations it's useful to be able to read or write to an >>offset that is calculated by having the memory layout given by a struct >>declaration. Usually we are going to read/write a u8, u16, u32 or u64. >> >>As a pre-requisite for the implementation, add iosys_map_memcpy_from() >>to be the equivalent of iosys_map_memcpy_to(), but in the other >>direction. Then add 2 pairs of macros: >> >> - iosys_map_rd() / iosys_map_wr() >> - iosys_map_rd_field() / iosys_map_wr_field() >> >>The first pair takes the C-type and offset to read/write. The second >>pair uses a struct describing the layout of the mapping in order to >>calculate the offset and size being read/written. >> >>We could use readb, readw, readl, readq and the write* counterparts, >>however due to alignment issues this may not work on all architectures. >>If alignment needs to be checked to call the right function, it's not >>possible to decide at compile-time which function to call: so just leave >>the decision to the memcpy function that will do exactly that. >> >>Finally, in order to use the above macros with a map derived from >>another, add another initializer: IOSYS_MAP_INIT_OFFSET(). >> >>v2: >> - Rework IOSYS_MAP_INIT_OFFSET() so it doesn't rely on aliasing rules >> within the union >> - Add offset to both iosys_map_rd_field() and iosys_map_wr_field() to >> allow the struct itself to be at an offset from the mapping >> - Add documentation to iosys_map_rd_field() with example and expected >> memory layout >>v3: >> - Drop kernel.h include as it's not needed anymore >> >>Cc: Sumit Semwal >>Cc: Christian K?nig >>Cc: Thomas Zimmermann >>Cc: Mauro Carvalho Chehab >>Cc: dri-devel@lists.freedesktop.org >>Cc: linux-kernel@vger.kernel.org >>Signed-off-by: Lucas De Marchi >>Reviewed-by: Mauro Carvalho Chehab >>Reviewed-by: Matt Atwood > >Reviewed-by: Thomas Zimmermann Thanks. I applied the first 2 patches to drm-intel-next. The rest can't be applied as there are conflicts between drm-intel-next and drm-intel-gt-next. I should have merged the rename to drm-intel-gt-next since the guc patches need to be applied there. I guess the rest will have to wait some tree propagation. Lucas De Marchi