aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/lib/cacheflush.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/tile/lib/cacheflush.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/tile/lib/cacheflush.c')
-rw-r--r--arch/tile/lib/cacheflush.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/arch/tile/lib/cacheflush.c b/arch/tile/lib/cacheflush.c
index db4fb89e12d..8928aace7a6 100644
--- a/arch/tile/lib/cacheflush.c
+++ b/arch/tile/lib/cacheflush.c
@@ -39,21 +39,7 @@ void finv_buffer_remote(void *buffer, size_t size, int hfh)
39{ 39{
40 char *p, *base; 40 char *p, *base;
41 size_t step_size, load_count; 41 size_t step_size, load_count;
42
43 /*
44 * On TILEPro the striping granularity is a fixed 8KB; on
45 * TILE-Gx it is configurable, and we rely on the fact that
46 * the hypervisor always configures maximum striping, so that
47 * bits 9 and 10 of the PA are part of the stripe function, so
48 * every 512 bytes we hit a striping boundary.
49 *
50 */
51#ifdef __tilegx__
52 const unsigned long STRIPE_WIDTH = 512;
53#else
54 const unsigned long STRIPE_WIDTH = 8192; 42 const unsigned long STRIPE_WIDTH = 8192;
55#endif
56
57#ifdef __tilegx__ 43#ifdef __tilegx__
58 /* 44 /*
59 * On TILE-Gx, we must disable the dstream prefetcher before doing 45 * On TILE-Gx, we must disable the dstream prefetcher before doing
@@ -88,7 +74,7 @@ void finv_buffer_remote(void *buffer, size_t size, int hfh)
88 * memory, that one load would be sufficient, but since we may 74 * memory, that one load would be sufficient, but since we may
89 * be, we also need to back up to the last load issued to 75 * be, we also need to back up to the last load issued to
90 * another memory controller, which would be the point where 76 * another memory controller, which would be the point where
91 * we crossed a "striping" boundary (the granularity of striping 77 * we crossed an 8KB boundary (the granularity of striping
92 * across memory controllers). Keep backing up and doing this 78 * across memory controllers). Keep backing up and doing this
93 * until we are before the beginning of the buffer, or have 79 * until we are before the beginning of the buffer, or have
94 * hit all the controllers. 80 * hit all the controllers.
@@ -102,22 +88,12 @@ void finv_buffer_remote(void *buffer, size_t size, int hfh)
102 * every cache line on a full memory stripe on each 88 * every cache line on a full memory stripe on each
103 * controller" that we simply do that, to simplify the logic. 89 * controller" that we simply do that, to simplify the logic.
104 * 90 *
105 * On TILE-Gx the hash-for-home function is much more complex, 91 * FIXME: See bug 9535 for some issues with this code.
106 * with the upshot being we can't readily guarantee we have
107 * hit both entries in the 128-entry AMT that were hit by any
108 * load in the entire range, so we just re-load them all.
109 * With larger buffers, we may want to consider using a hypervisor
110 * trap to issue loads directly to each hash-for-home tile for
111 * each controller (doing it from Linux would trash the TLB).
112 */ 92 */
113 if (hfh) { 93 if (hfh) {
114 step_size = L2_CACHE_BYTES; 94 step_size = L2_CACHE_BYTES;
115#ifdef __tilegx__
116 load_count = (size + L2_CACHE_BYTES - 1) / L2_CACHE_BYTES;
117#else
118 load_count = (STRIPE_WIDTH / L2_CACHE_BYTES) * 95 load_count = (STRIPE_WIDTH / L2_CACHE_BYTES) *
119 (1 << CHIP_LOG_NUM_MSHIMS()); 96 (1 << CHIP_LOG_NUM_MSHIMS());
120#endif
121 } else { 97 } else {
122 step_size = STRIPE_WIDTH; 98 step_size = STRIPE_WIDTH;
123 load_count = (1 << CHIP_LOG_NUM_MSHIMS()); 99 load_count = (1 << CHIP_LOG_NUM_MSHIMS());
@@ -133,7 +109,7 @@ void finv_buffer_remote(void *buffer, size_t size, int hfh)
133 109
134 /* Figure out how far back we need to go. */ 110 /* Figure out how far back we need to go. */
135 base = p - (step_size * (load_count - 2)); 111 base = p - (step_size * (load_count - 2));
136 if ((unsigned long)base < (unsigned long)buffer) 112 if ((long)base < (long)buffer)
137 base = buffer; 113 base = buffer;
138 114
139 /* 115 /*