virtualbox.org

#19312 (Linux: kernel 5.6 - we need changes (fixed in 6.1.6, 6.0.20 and 5.2.40)) – Oracle VirtualBox

  • ️Sat Mar 28 2020

#19312 closed defect (fixed)

Linux: kernel 5.6 - we need changes (fixed in 6.1.6, 6.0.20 and 5.2.40)

Reported by: Owned by: Frank Batschulat (Oracle)
Component: other Version: VirtualBox 6.1.2
Keywords: linux 5.6 kernel Cc:
Guest type: Linux Host type: Linux

So mainline 5.6-rc1 is out and we have already 1 change required:

In file included from /home/ws/vbtrunk/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vbtrunk/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeMapKernel’:
/home/ws/vbtrunk/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1465:32: error: implicit declaration of function ‘ioremap_nocache’; did you mean ‘ioremap_cache’? [-Werror=implicit-function-declaration]
                              ? ioremap_nocache(pMemLnxToMap->Core.u.Phys.PhysBase + offSub, cbSub)
                                ^~~~~~~~~~~~~~~
                                ioremap_cache
/home/ws/vbtrunk/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1466:30: error: pointer/integer type mismatch in conditional expression [-Werror]
                              : ioremap(pMemLnxToMap->Core.u.Phys.PhysBase + offSub, cbSub);
                              ^

This is due to:

https://github.com/torvalds/linux/commit/4bdc0d676a643140bdf17dbf7eafedee3d496a3c
https://github.com/torvalds/linux/tree/master/drivers/usb/early

ioremap has provided non-cached semantics by default
since the Linux 2.6 days, so remove the additional
ioremap_nocache interface.

Merging generic-ioremap/for-next (4bdc0d676a64 remove ioremap_nocache and devm_ioremap_nocache)

https://www.spinics.net/lists/netdev/msg623588.html
https://lkml.org/lkml/2020/2/4/275

obvious fix:
=> replace use of ioremap_nocache() with ioremap_cache()

Edit:

ioremap_cache() is uncached by default since a long time.

all 5.X kernels down to version 5.0 all 4.X kernels down to version 4.0 all 3.X kernels down to version 3.0

from version 2.6.25 onwards we know for sure that ioremap_cache() has uncached semantics by default.

https://elixir.bootlin.com/linux/v2.6.25/source/include/asm-x86/io_64.h#L161

 * This one maps high address device memory and turns off caching for that area.
 * it's useful if some control registers are in such an area and write combining
 * or read caching is not desirable:
 */
extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
/*
 * The default ioremap() behavior is non-cached:
 */
static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
{
	return ioremap_nocache(offset, size);
}

That means we can and should replace ioremap_nocache() usage with ioremap_cache() and make kernel version 2.6.25 the tipping point for this.