linux-stable/drivers
Lad Prabhakar d34599bcd2
cache: Add L2 cache management for Andes AX45MP RISC-V core
I/O Coherence Port (IOCP) provides an AXI interface for connecting
external non-caching masters, such as DMA controllers. The accesses
from IOCP are coherent with D-Caches and L2 Cache.

IOCP is a specification option and is disabled on the Renesas RZ/Five
SoC due to this reason IP blocks using DMA will fail.

The Andes AX45MP core has a Programmable Physical Memory Attributes (PMA)
block that allows dynamic adjustment of memory attributes in the runtime.
It contains a configurable amount of PMA entries implemented as CSR
registers to control the attributes of memory locations in interest.
Below are the memory attributes supported:
* Device, Non-bufferable
* Device, bufferable
* Memory, Non-cacheable, Non-bufferable
* Memory, Non-cacheable, Bufferable
* Memory, Write-back, No-allocate
* Memory, Write-back, Read-allocate
* Memory, Write-back, Write-allocate
* Memory, Write-back, Read and Write-allocate

More info about PMA (section 10.3):
Link: http://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf

As a workaround for SoCs with IOCP disabled CMO needs to be handled by
software. Firstly OpenSBI configures the memory region as
"Memory, Non-cacheable, Bufferable" and passes this region as a global
shared dma pool as a DT node. With DMA_GLOBAL_POOL enabled all DMA
allocations happen from this region and synchronization callbacks are
implemented to synchronize when doing DMA transactions.

Example PMA region passes as a DT node from OpenSBI:
    reserved-memory {
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;

        pma_resv0@58000000 {
            compatible = "shared-dma-pool";
            reg = <0x0 0x58000000 0x0 0x08000000>;
            no-map;
            linux,dma-default;
        };
    };

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com> # tyre-kicking on a d1
Link: https://lore.kernel.org/r/20230818135723.80612-6-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-09-01 09:08:59 -07:00
..
accel drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
accessibility
acpi More ACPI updates for 6.5-rc1 2023-07-06 22:25:06 -07:00
amba
android
ata driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
atm
auxdisplay drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
base driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
bcma
block Networking changes for 6.5. 2023-06-28 16:43:10 -07:00
bluetooth Including fixes from bluetooth, bpf and wireguard. 2023-07-05 15:44:45 -07:00
bus SoC fixes for 6.5, part 1 2023-07-06 09:56:53 -07:00
cache cache: Add L2 cache management for Andes AX45MP RISC-V core 2023-09-01 09:08:59 -07:00
cdrom cdrom/gdrom: Fix build error 2023-06-29 08:09:31 -06:00
cdx
char virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00
clk Another set of clk driver updates and fixes for the merge window. The 2023-07-04 11:07:45 -07:00
clocksource RISC-V Patches for the 6.5 Merge Window, Part 1 2023-06-30 09:37:26 -07:00
comedi
connector
counter
cpufreq More power management updates for 6.5-rc1 2023-07-04 11:22:50 -07:00
cpuidle
crypto s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
cxl cxl: Fix one kernel-doc comment 2023-06-29 16:03:58 -07:00
dax
dca
devfreq
dio
dma dmaengine updates for v6.5 2023-07-06 09:48:31 -07:00
dma-buf drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
edac
eisa
extcon
firewire
firmware Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
fpga Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
fsi
gnss
gpio Pin control changes for the v6.5 kernel cycle: 2023-06-30 14:57:19 -07:00
gpu drm fixes for 6.5-rc1 2023-07-06 22:42:54 -07:00
greybus
hid drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
hsi
hte
hv
hwmon driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
hwspinlock
hwtracing Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
i2c Part 2 of I2C patches for 6.5 2023-07-08 12:28:00 -07:00
i3c
idle intel_idle: Add __init annotation to matchup_vm_state_with_baremetal() 2023-06-28 19:09:55 +02:00
iio driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
infiniband v6.5 merge window RDMA pull request 2023-06-29 21:01:17 -07:00
input ARM: SoC changes for 6.5 2023-06-29 15:28:33 -07:00
interconnect
iommu iommufd for 6.5 2023-06-29 20:57:27 -07:00
ipack
irqchip RISC-V Patches for the 6.5 Merge Window, Part 1 2023-06-30 09:37:26 -07:00
isdn
leds - New Drivers 2023-07-03 11:26:05 -07:00
macintosh
mailbox mailbox: ti-msgmgr: Fill non-message tx data fields with 0x0 2023-06-30 17:35:45 -05:00
mcb
md hardening fixes for v6.5-rc1 2023-07-08 12:08:39 -07:00
media media updates for v6.5-rc1 2023-07-05 10:42:32 -07:00
memory asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
memstick
message
mfd - New Drivers 2023-07-03 10:55:04 -07:00
misc Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
mmc mmc: Revert "mmc: core: Allow mmc_start_host() synchronously detect a card" 2023-06-30 14:06:51 +02:00
most
mtd Core MTD changes: 2023-06-28 14:02:03 -07:00
mux
net Fixes for pci_clean_master, error handling in driver inits, and various 2023-07-09 09:35:51 -07:00
nfc
ntb ntb: hw: amd: Fix debugfs_create_dir error checking 2023-07-08 13:55:44 -04:00
nubus
nvdimm
nvme Including fixes from bluetooth, bpf and wireguard. 2023-07-05 15:44:45 -07:00
nvmem
of Devicetree updates for v6.5: 2023-06-29 14:58:26 -07:00
opp
parisc parisc: Move init function declarations into header file 2023-06-30 17:14:15 +02:00
parport Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
pci Fixes for pci_clean_master, error handling in driver inits, and various 2023-07-09 09:35:51 -07:00
pcmcia
peci
perf cxl for v6.5 2023-07-01 08:58:41 -07:00
phy phy-for-6.5-v2 2023-07-05 21:38:13 -07:00
pinctrl Pin control changes for the v6.5 kernel cycle: 2023-06-30 14:57:19 -07:00
platform USB / Thunderbolt driver updates for 6.5-rc1 2023-07-03 13:23:10 -07:00
pnp
power power supply and reset changes for the 6.5 series 2023-07-03 17:23:16 -07:00
powercap ARM: SoC drivers for 6.5 2023-06-29 15:22:19 -07:00
pps
ps3
ptp ptp: Make max_phase_adjustment sysfs device attribute invisible when not supported 2023-07-03 13:17:25 -07:00
pwm pwm: Changes for v6.5-rc1 2023-07-05 12:55:06 -07:00
rapidio
ras
regulator regulator: Fix for v6.5 2023-07-06 19:20:23 -07:00
remoteproc remoteproc updates for v6.5 2023-07-03 17:03:05 -07:00
reset ARM: SoC drivers for 6.5 2023-06-29 15:22:19 -07:00
rpmsg
rtc RTC for 6.5 2023-07-03 10:43:10 -07:00
s390 s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
sbus
scsi SCSI misc on 20230708 2023-07-08 12:35:18 -07:00
sh
siox
slimbus
soc USB / Thunderbolt driver updates for 6.5-rc1 2023-07-03 13:23:10 -07:00
soundwire
spi spi: Fixes for v6.5 2023-07-06 19:24:11 -07:00
spmi
ssb
staging media updates for v6.5-rc1 2023-07-05 10:42:32 -07:00
target SCSI misc on 20230708 2023-07-08 12:35:18 -07:00
tc
tee ARM: SoC drivers for 6.5 2023-06-29 15:22:19 -07:00
thermal Thermal control updates for 6.5-rc1 2023-06-26 19:41:26 -07:00
thunderbolt
tty TTY/Serial driver updates for 6.5-rc1. 2023-07-03 13:14:58 -07:00
ufs SCSI misc on 20230708 2023-07-08 12:35:18 -07:00
uio
usb USB / Thunderbolt driver updates for 6.5-rc1 2023-07-03 13:23:10 -07:00
vdpa virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00
vfio VFIO updates for v6.5-rc1 2023-06-30 15:22:09 -07:00
vhost virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00
video - New Functionality 2023-07-03 11:31:01 -07:00
virt workqueue: Ordered workqueue creation cleanups 2023-06-27 16:46:06 -07:00
virtio virtio: allow caller to override device DMA mask in vp_modern 2023-06-27 10:47:08 -04:00
vlynq
w1
watchdog
xen - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
zorro
Kconfig cache: Add L2 cache management for Andes AX45MP RISC-V core 2023-09-01 09:08:59 -07:00
Makefile cache: Add L2 cache management for Andes AX45MP RISC-V core 2023-09-01 09:08:59 -07:00