Re: [PATCH v2] drm/r128: fix build for UML

From: Randy Dunlap
Date: Sun Oct 10 2021 - 16:53:44 EST


On 10/10/21 12:49 PM, Sam Ravnborg wrote:
Hi Randy,

On Sun, Oct 10, 2021 at 10:29:55AM -0700, Randy Dunlap wrote:
Fix a build error on CONFIG_UML, which does not support (provide)
wbinvd(). UML can use the generic mb() instead.

../drivers/gpu/drm/r128/ati_pcigart.c: In function ‘drm_ati_pcigart_init’:
../drivers/gpu/drm/r128/ati_pcigart.c:218:2: error: implicit declaration of function ‘wbinvd’ [-Werror=implicit-function-declaration]
wbinvd();
^~~~~~

Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver")
Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: David Airlie <airlied@xxxxxxxx>
Cc: Daniel Vetter <daniel@xxxxxxxx>
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: Jeff Dike <jdike@xxxxxxxxxxx>
Cc: Richard Weinberger <richard@xxxxxx>
Cc: Anton Ivanov <anton.ivanov@xxxxxxxxxxxxxxxxxx>
Cc: linux-um@xxxxxxxxxxxxxxxxxxx
---
v2: update Fixes: tag (thanks, Johannes)

drivers/gpu/drm/r128/ati_pcigart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20211007.orig/drivers/gpu/drm/r128/ati_pcigart.c
+++ linux-next-20211007/drivers/gpu/drm/r128/ati_pcigart.c
@@ -215,7 +215,7 @@ int drm_ati_pcigart_init(struct drm_devi
}
ret = 0;
-#if defined(__i386__) || defined(__x86_64__)
+#if (defined(__i386__) || defined(__x86_64__)) && !defined(CONFIG_UML)
wbinvd();
#else
mb();

If we look at drivers/video/fbdev/i810/i810_main.h
then it looks like we can replace the above with a simple:
#ifdef CONFIG_X86
wbinvd();
#else
mb();
#endif

If you think this would work could you try it out.
It would be nicer with the simpler variant.

Hi Sam,
Good idea, thanks.

OK, I tested it, it works fine.

Will resend the patch later...

Note: I have no clue what wbinvd() does - seems like some x86 assembler
specific thingy.


--
~Randy