linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/test/shmem: set a DMA mask for the mock device
@ 2024-02-26 11:00 Marco Pagani
  2024-02-26 11:26 ` Maxime Ripard
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Pagani @ 2024-02-26 11:00 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter
  Cc: Marco Pagani, Guenter Roeck, dri-devel, linux-kernel

Set a DMA mask for the mock device to avoid warnings generated in
dma_map_sgtable().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Marco Pagani <marpagan@redhat.com>
---
 drivers/gpu/drm/tests/drm_gem_shmem_test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/tests/drm_gem_shmem_test.c b/drivers/gpu/drm/tests/drm_gem_shmem_test.c
index 91202e40cde9..d691b29a4312 100644
--- a/drivers/gpu/drm/tests/drm_gem_shmem_test.c
+++ b/drivers/gpu/drm/tests/drm_gem_shmem_test.c
@@ -341,11 +341,15 @@ static int drm_gem_shmem_test_init(struct kunit *test)
 {
 	struct device *dev;
 	struct drm_device *drm_dev;
+	int ret;
 
 	/* Allocate a parent device */
 	dev = drm_kunit_helper_alloc_device(test);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
 
+	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+	KUNIT_EXPECT_EQ(test, ret, 0);
+
 	/*
 	 * The DRM core will automatically initialize the GEM core and create
 	 * a DRM Memory Manager object which provides an address space pool
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/test/shmem: set a DMA mask for the mock device
  2024-02-26 11:00 [PATCH] drm/test/shmem: set a DMA mask for the mock device Marco Pagani
@ 2024-02-26 11:26 ` Maxime Ripard
  2024-02-26 15:48   ` Marco Pagani
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2024-02-26 11:26 UTC (permalink / raw)
  To: Marco Pagani
  Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Guenter Roeck, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

Hi,

On Mon, Feb 26, 2024 at 12:00:27PM +0100, Marco Pagani wrote:
> Set a DMA mask for the mock device to avoid warnings generated in
> dma_map_sgtable().
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Marco Pagani <marpagan@redhat.com>

I've submitted last week this patch:
https://lore.kernel.org/all/20240221125324.718192-1-mripard@kernel.org/

Which should be equivalent, but fixes the issue for all users in the
tree.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/test/shmem: set a DMA mask for the mock device
  2024-02-26 11:26 ` Maxime Ripard
@ 2024-02-26 15:48   ` Marco Pagani
  2024-02-27 16:25     ` Maxime Ripard
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Pagani @ 2024-02-26 15:48 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Guenter Roeck, dri-devel, linux-kernel


On 2024-02-26 12:26, Maxime Ripard wrote:
> Hi,
> 
> On Mon, Feb 26, 2024 at 12:00:27PM +0100, Marco Pagani wrote:
>> Set a DMA mask for the mock device to avoid warnings generated in
>> dma_map_sgtable().
>>
>> Reported-by: Guenter Roeck <linux@roeck-us.net>
>> Signed-off-by: Marco Pagani <marpagan@redhat.com>
> 
> I've submitted last week this patch:
> https://lore.kernel.org/all/20240221125324.718192-1-mripard@kernel.org/
> 
> Which should be equivalent, but fixes the issue for all users in the
> tree.

Hi, thanks for letting me know. Fixing this issue for all DRM tests that were
using platform devices through the helpers makes perfect sense to me. I'm a
little more thoughtful about setting the mask for all KUnit tests that use fake
devices since there may be specific use cases. Just one curiosity: why setting
the default mask manually instead of using one of the dma_set_*() functions?

Thanks,
Marco


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/test/shmem: set a DMA mask for the mock device
  2024-02-26 15:48   ` Marco Pagani
@ 2024-02-27 16:25     ` Maxime Ripard
  0 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2024-02-27 16:25 UTC (permalink / raw)
  To: Marco Pagani
  Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Guenter Roeck, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]

Hi,

On Mon, Feb 26, 2024 at 04:48:51PM +0100, Marco Pagani wrote:
> 
> On 2024-02-26 12:26, Maxime Ripard wrote:
> > Hi,
> > 
> > On Mon, Feb 26, 2024 at 12:00:27PM +0100, Marco Pagani wrote:
> >> Set a DMA mask for the mock device to avoid warnings generated in
> >> dma_map_sgtable().
> >>
> >> Reported-by: Guenter Roeck <linux@roeck-us.net>
> >> Signed-off-by: Marco Pagani <marpagan@redhat.com>
> > 
> > I've submitted last week this patch:
> > https://lore.kernel.org/all/20240221125324.718192-1-mripard@kernel.org/
> > 
> > Which should be equivalent, but fixes the issue for all users in the
> > tree.
> 
> Hi, thanks for letting me know. Fixing this issue for all DRM tests that were
> using platform devices through the helpers makes perfect sense to me. I'm a
> little more thoughtful about setting the mask for all KUnit tests that use fake
> devices since there may be specific use cases. Just one curiosity: why setting
> the default mask manually instead of using one of the dma_set_*() functions?

I think the (well, mine at least) expectation is that a kunit device is
a device that can be used in all reasonable contexts. Setting up the
device to be able to use any DMA-related function (or functions that use
a DMA-related function) makes total sense to me.

But it's a discussion worth having I think, so it would make sense to
raise this point with the kunit maintainers if you feel like it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-27 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26 11:00 [PATCH] drm/test/shmem: set a DMA mask for the mock device Marco Pagani
2024-02-26 11:26 ` Maxime Ripard
2024-02-26 15:48   ` Marco Pagani
2024-02-27 16:25     ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).