History log of /openbsd-current/sys/arch/mips64/mips64/cache_octeon.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.13 04-Dec-2018 visa

Add processor IDs for several OCTEON II and III SoCs.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.12 11-Oct-2017 visa

Try to make CPU cache size values more correct, especially on OCTEON II
and III. The logic does not look nice, but the parameters do not follow
the standard config register layout anyway.

Remove unnecessary default values, and assume that the Config1
and Config2 registers are available on every CPU.

Tested on CN5020, CN6120, CN7130 and CN7360.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.11 21-Dec-2016 visa

Add a driver for OCTEON MMC host controller.

Tested on EdgeRouter Pro, and Shasta.

OK mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 05-Jan-2016 visa

Some implementations of HitSyncDCache() call pmap_extract() for va->pa
conversion. Because pmap_extract() acquires the PTE mutex, a "locking
against myself" panic is triggered if the cache routine gets called in
a context where the mutex is already held.

In the pmap, all calls to HitSyncDCache() are for a whole page. Add a
new cache routine, HitSyncDCachePage(), which gets both the va and the
pa of a page. This removes the need of the va->pa conversion. The new
routine has the same signature as SyncDCachePage(), allowing reuse of
the same routine for cache implementations that do not need differences
between "Hit" and non-"Hit" routines.

With the diff, POWER Indigo2 R8000 boots multiuser again. Tested on sgi
GENERIC-IP27.MP and octeon GENERIC.MP, too.

Diff from miod@, ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.9 12-Aug-2014 miod

Better cache information gathering. Only affects information put in dmesg.


Revision tags: OPENBSD_5_6_BASE
# 1.8 31-Mar-2014 miod

Due the virtually indexed nature of the L1 instruction cache on most mips
processors, every time a new text page is mapped in a pmap, the L1 I$ is
flushed for the va spanned by this page.

Since we map pages of our binaries upon demand, as they get faulted in, but
uvm_fault() tries to map the few neighbour pages, this can end up in a
bunch of pmap_enter() calls in a row, for executable mappings. If the L1
I$ is small enough, this can cause the whole L1 I$ cache to be flushed
several times.

Change pmap_enter() to postpone these flushes by only registering the
pending flushes, and have pmap_update() perform them. The cpu-specific
cache code can then optimize this to avoid unnecessary operations.

Tested on R4000SC, R4600SC, R5000SC, RM7000, R10000 with 4KB and 16KB
page sizes (coherent and non-coherent designs), and Loongson 2F by mikeb@ and
me. Should not affect anything on Octeon since there is no way to flush a
subset of I$ anyway.


# 1.7 09-Mar-2014 miod

Rework the per-cpu cache information. Use a common struct to store the line
size, the number of sets, and the total size (and the set size, for convenience)
per cache (I$, D$, L2, L3).
This allows cpu.c to print the number of ways (sets) of L2 and L3 caches from
the cache information, rather than hardcoding this from the processor type.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 29-Sep-2012 miod

Proide a mips_sync() macro to wrap asm("sync"), and replace gazillions of
such statements with it.


Revision tags: OPENBSD_5_2_BASE
# 1.5 24-Jun-2012 miod

Add cache operation functions pointers to struct cpu_info; the various
cache lines and sizes are already there, after all.

The ConfigCache cache routine is responsible for filling these function
pointers; cache routine invocation macros are updated to use the cpu_info
fields, but may still be overriden in <machine/cpu.h> on platforms where
only one set of cache routines is used.


# 1.4 21-Apr-2012 miod

Rework the signature of the cache handling routines again. It makes more sense
to pass both the virtual and physical addresses of the page to clean to
SyncDCachePage, which is the only routine using `Index' operations on the data
cache, which might be virtually indexed at some levels but physically indexed
at others. On the other hand, it does not make any sense to pass a physical
address to routines using `Hit' operations (and they were discarding them
anyway).

In addition to making things cleaner, this fixes sporadic userland misbehaviour
(read: SIGSGEV) on RM7000 O2 systems.


# 1.3 25-Mar-2012 miod

Move cache handling routines related definitions to a dedicated header file,
rather than abusing <machine/cpu.h>.


# 1.2 24-Mar-2012 miod

The various ConfigCache() functions actually return void, not int.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.1 20-Sep-2010 syuu

cache operations for octeon. ok miod@


# 1.12 11-Oct-2017 visa

Try to make CPU cache size values more correct, especially on OCTEON II
and III. The logic does not look nice, but the parameters do not follow
the standard config register layout anyway.

Remove unnecessary default values, and assume that the Config1
and Config2 registers are available on every CPU.

Tested on CN5020, CN6120, CN7130 and CN7360.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.11 21-Dec-2016 visa

Add a driver for OCTEON MMC host controller.

Tested on EdgeRouter Pro, and Shasta.

OK mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.10 05-Jan-2016 visa

Some implementations of HitSyncDCache() call pmap_extract() for va->pa
conversion. Because pmap_extract() acquires the PTE mutex, a "locking
against myself" panic is triggered if the cache routine gets called in
a context where the mutex is already held.

In the pmap, all calls to HitSyncDCache() are for a whole page. Add a
new cache routine, HitSyncDCachePage(), which gets both the va and the
pa of a page. This removes the need of the va->pa conversion. The new
routine has the same signature as SyncDCachePage(), allowing reuse of
the same routine for cache implementations that do not need differences
between "Hit" and non-"Hit" routines.

With the diff, POWER Indigo2 R8000 boots multiuser again. Tested on sgi
GENERIC-IP27.MP and octeon GENERIC.MP, too.

Diff from miod@, ok kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.9 12-Aug-2014 miod

Better cache information gathering. Only affects information put in dmesg.


Revision tags: OPENBSD_5_6_BASE
# 1.8 31-Mar-2014 miod

Due the virtually indexed nature of the L1 instruction cache on most mips
processors, every time a new text page is mapped in a pmap, the L1 I$ is
flushed for the va spanned by this page.

Since we map pages of our binaries upon demand, as they get faulted in, but
uvm_fault() tries to map the few neighbour pages, this can end up in a
bunch of pmap_enter() calls in a row, for executable mappings. If the L1
I$ is small enough, this can cause the whole L1 I$ cache to be flushed
several times.

Change pmap_enter() to postpone these flushes by only registering the
pending flushes, and have pmap_update() perform them. The cpu-specific
cache code can then optimize this to avoid unnecessary operations.

Tested on R4000SC, R4600SC, R5000SC, RM7000, R10000 with 4KB and 16KB
page sizes (coherent and non-coherent designs), and Loongson 2F by mikeb@ and
me. Should not affect anything on Octeon since there is no way to flush a
subset of I$ anyway.


# 1.7 09-Mar-2014 miod

Rework the per-cpu cache information. Use a common struct to store the line
size, the number of sets, and the total size (and the set size, for convenience)
per cache (I$, D$, L2, L3).
This allows cpu.c to print the number of ways (sets) of L2 and L3 caches from
the cache information, rather than hardcoding this from the processor type.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 29-Sep-2012 miod

Proide a mips_sync() macro to wrap asm("sync"), and replace gazillions of
such statements with it.


Revision tags: OPENBSD_5_2_BASE
# 1.5 24-Jun-2012 miod

Add cache operation functions pointers to struct cpu_info; the various
cache lines and sizes are already there, after all.

The ConfigCache cache routine is responsible for filling these function
pointers; cache routine invocation macros are updated to use the cpu_info
fields, but may still be overriden in <machine/cpu.h> on platforms where
only one set of cache routines is used.


# 1.4 21-Apr-2012 miod

Rework the signature of the cache handling routines again. It makes more sense
to pass both the virtual and physical addresses of the page to clean to
SyncDCachePage, which is the only routine using `Index' operations on the data
cache, which might be virtually indexed at some levels but physically indexed
at others. On the other hand, it does not make any sense to pass a physical
address to routines using `Hit' operations (and they were discarding them
anyway).

In addition to making things cleaner, this fixes sporadic userland misbehaviour
(read: SIGSGEV) on RM7000 O2 systems.


# 1.3 25-Mar-2012 miod

Move cache handling routines related definitions to a dedicated header file,
rather than abusing <machine/cpu.h>.


# 1.2 24-Mar-2012 miod

The various ConfigCache() functions actually return void, not int.


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.1 20-Sep-2010 syuu

cache operations for octeon. ok miod@