foss-for-synopsys-dwc-arc-processors / linux

Helpful resources for users & developers of Linux kernel for ARC
22 stars 13 forks source link

ARCv3: Add support L2$ flush/invalidate operations #122

Closed xxkent closed 1 year ago

xxkent commented 1 year ago

dma_cache_wback_inv(), dma_cache_inv() and dma_cache_wback() functions now invalidate/flush L1$ and L2$.

Added 'cacheflush' syscall to get acces for L1$ and L2$ flush/invalidate operations from userspace.

pavelvkozlov commented 1 year ago

Can you also add EXPORT_SYMBOL(flush_dcache_page), I see link error in some modules.

ERROR: modpost: "flush_dcache_page" [fs/fuse/fuse.ko] undefined!
ERROR: modpost: "flush_dcache_page" [fs/btrfs/btrfs.ko] undefined!

Please check. maybe additional symbol exports also required.

pavelvkozlov commented 1 year ago

It seems that write to some AUX registers to manage caches cause QEMU to crash. QEMU doesn't support some AUXes.

**
ERROR:../qemu/target/arc/op_helper.c:245:helper_sr: assertion failed: (aux_reg_detail != NULL)
Bail out! ERROR:../qemu/target/arc/op_helper.c:245:helper_sr: assertion failed: (aux_reg_detail != NULL)
./qemu-arc32-run.sh: line 22: 32558 Aborted                 $ARC_QEMU_PATH/qemu-system-arc -cpu hs5x -M virt -m 2048 -display none -kernel $IMAGE -netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 -drive file=$SWAP,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 --global cpu.freq_hz=30000000 -nographic

It will be an issue and prevent use of QEMU after merge to arc64, or we can disable caches support in config for QEMU?

xxkent commented 1 year ago

@pavelvkozlov I exported also the following symbols: EXPORT_SYMBOL(flush_dcache_page); EXPORT_SYMBOL(flush_icache_range); EXPORT_SYMBOL(clear_user_page); Now for ARCv3 we export the same set of symbols as for ARCv2