From: Lucas De Marchi <lucas.demarchi@intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
"Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Matt Atwood" <matthew.s.atwood@intel.com>,
linux-kernel@vger.kernel.org,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Daniele Ceraolo Spurio" <daniele.ceraolospurio@intel.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"John Harrison" <John.C.Harrison@intel.com>
Subject: Re: [PATCH v3 02/16] iosys-map: Add a few more helpers
Date: Sat, 19 Feb 2022 20:28:26 -0800 [thread overview]
Message-ID: <20220220042826.ftqf2l7tuegoktoc@ldmartin-desk2> (raw)
In-Reply-To: <06e6035e-bbba-f158-63b7-7d10327b7a80@suse.de>
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 <sumit.semwal@linaro.org>
>>Cc: Christian König <christian.koenig@amd.com>
>>Cc: Thomas Zimmermann <tzimmermann@suse.de>
>>Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>>Cc: dri-devel@lists.freedesktop.org
>>Cc: linux-kernel@vger.kernel.org
>>Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>>Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>>Reviewed-by: Matt Atwood <matthew.s.atwood@intel.com>
>
>Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
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
prev parent reply other threads:[~2022-02-20 4:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220216174147.3073235-1-lucas.demarchi@intel.com>
2022-02-16 17:41 ` [PATCH v3 01/16] iosys-map: Add offset to iosys_map_memcpy_to() Lucas De Marchi
2022-02-16 17:41 ` [PATCH v3 02/16] iosys-map: Add a few more helpers Lucas De Marchi
2022-02-17 8:42 ` Thomas Zimmermann
2022-02-20 4:28 ` Lucas De Marchi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220220042826.ftqf2l7tuegoktoc@ldmartin-desk2 \
--to=lucas.demarchi@intel.com \
--cc=John.C.Harrison@intel.com \
--cc=christian.koenig@amd.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=matthew.s.atwood@intel.com \
--cc=mchehab@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®