2 * Copyright (c) 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #include "brw_context.h"
25 #include "brw_defines.h"
26 #include "brw_state.h"
27 #include "intel_batchbuffer.h"
30 * Chunk of L3 cache reserved for some specific purpose.
32 enum brw_l3_partition
{
33 /** Shared local memory. */
35 /** Unified return buffer. */
37 /** Union of DC and RO. */
39 /** Data cluster RW partition. */
41 /** Union of IS, C and T. */
43 /** Instruction and state cache. */
45 /** Constant cache. */
49 /** Number of supported L3 partitions. */
54 * L3 configuration represented as the number of ways allocated for each
55 * partition. \sa get_l3_way_size().
57 struct brw_l3_config
{
62 * IVB/HSW validated L3 configurations.
64 static const struct brw_l3_config ivb_l3_configs
[] = {
65 /* SLM URB ALL DC RO IS C T */
66 {{ 0, 32, 0, 0, 32, 0, 0, 0 }},
67 {{ 0, 32, 0, 16, 16, 0, 0, 0 }},
68 {{ 0, 32, 0, 4, 0, 8, 4, 16 }},
69 {{ 0, 28, 0, 8, 0, 8, 4, 16 }},
70 {{ 0, 28, 0, 16, 0, 8, 4, 8 }},
71 {{ 0, 28, 0, 8, 0, 16, 4, 8 }},
72 {{ 0, 28, 0, 0, 0, 16, 4, 16 }},
73 {{ 0, 32, 0, 0, 0, 16, 0, 16 }},
74 {{ 0, 28, 0, 4, 32, 0, 0, 0 }},
75 {{ 16, 16, 0, 16, 16, 0, 0, 0 }},
76 {{ 16, 16, 0, 8, 0, 8, 8, 8 }},
77 {{ 16, 16, 0, 4, 0, 8, 4, 16 }},
78 {{ 16, 16, 0, 4, 0, 16, 4, 8 }},
79 {{ 16, 16, 0, 0, 32, 0, 0, 0 }},
84 * VLV validated L3 configurations.
86 static const struct brw_l3_config vlv_l3_configs
[] = {
87 /* SLM URB ALL DC RO IS C T */
88 {{ 0, 64, 0, 0, 32, 0, 0, 0 }},
89 {{ 0, 80, 0, 0, 16, 0, 0, 0 }},
90 {{ 0, 80, 0, 8, 8, 0, 0, 0 }},
91 {{ 0, 64, 0, 16, 16, 0, 0, 0 }},
92 {{ 0, 60, 0, 4, 32, 0, 0, 0 }},
93 {{ 32, 32, 0, 16, 16, 0, 0, 0 }},
94 {{ 32, 40, 0, 8, 16, 0, 0, 0 }},
95 {{ 32, 40, 0, 16, 8, 0, 0, 0 }},
100 * BDW validated L3 configurations.
102 static const struct brw_l3_config bdw_l3_configs
[] = {
103 /* SLM URB ALL DC RO IS C T */
104 {{ 0, 48, 48, 0, 0, 0, 0, 0 }},
105 {{ 0, 48, 0, 16, 32, 0, 0, 0 }},
106 {{ 0, 32, 0, 16, 48, 0, 0, 0 }},
107 {{ 0, 32, 0, 0, 64, 0, 0, 0 }},
108 {{ 0, 32, 64, 0, 0, 0, 0, 0 }},
109 {{ 24, 16, 48, 0, 0, 0, 0, 0 }},
110 {{ 24, 16, 0, 16, 32, 0, 0, 0 }},
111 {{ 24, 16, 0, 32, 16, 0, 0, 0 }},
116 * CHV/SKL validated L3 configurations.
118 static const struct brw_l3_config chv_l3_configs
[] = {
119 /* SLM URB ALL DC RO IS C T */
120 {{ 0, 48, 48, 0, 0, 0, 0, 0 }},
121 {{ 0, 48, 0, 16, 32, 0, 0, 0 }},
122 {{ 0, 32, 0, 16, 48, 0, 0, 0 }},
123 {{ 0, 32, 0, 0, 64, 0, 0, 0 }},
124 {{ 0, 32, 64, 0, 0, 0, 0, 0 }},
125 {{ 32, 16, 48, 0, 0, 0, 0, 0 }},
126 {{ 32, 16, 0, 16, 32, 0, 0, 0 }},
127 {{ 32, 16, 0, 32, 16, 0, 0, 0 }},
132 * Return a zero-terminated array of validated L3 configurations for the
135 static const struct brw_l3_config
*
136 get_l3_configs(const struct brw_device_info
*devinfo
)
138 switch (devinfo
->gen
) {
140 return (devinfo
->is_baytrail
? vlv_l3_configs
: ivb_l3_configs
);
143 return (devinfo
->is_cherryview
? chv_l3_configs
: bdw_l3_configs
);
146 return chv_l3_configs
;
149 unreachable("Not implemented");
154 * Return the size of an L3 way in KB.
157 get_l3_way_size(const struct brw_device_info
*devinfo
)
159 if (devinfo
->is_baytrail
)
162 else if (devinfo
->is_cherryview
|| devinfo
->gt
== 1)
166 return 8 * devinfo
->num_slices
;