Getting processor and cache details

I work on software that needs to know the processor and cache details. On x86 systems it uses the CPUID instruction to know about the processor family/model (Skylake, Icelake etc) and cache details (total size, line size, associativity etc). I am trying to do the same on ARM systems.Is there an instruction or non-privileged registers than can be used to get these details?

I am using RedHat Linux. I noticed that the dmidecode command has an entry called ID.

# dmidecode -t processor | grep ID:
                 ID: 00 00 00 00 02 00 3F 50

dmidecode reads the SMBIOS files, The SMBIOS spec says that the value of ID is taken from the MIDR_EL1 register of ARM. So, can the value of ID be used to distinguish between different ARM processors?

dmidecode also gives cache details (with “-t cache”) but only total size and associativity. Cache line size is not given.

The ARMv8 spec mentions a register called CTR_EL0. It has the following field

DminLine, bits [19:16]
Log2 of the number of words in the smallest cache line of all the data caches and unified caches that
are controlled by the PE.

This seems to only give the smallest possible line size. I am interested in the actual line size (and other details) of the caches.