blob: 5f2db0f8aaaf97b9e6640858e97e9fa4c7c35a6e [file] [log] [blame]
Georgios Katsikas740d3282020-03-18 12:05:03 +01001/*
2 * Copyright 2020-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.drivers.server.devices.cpu;
18
19/**
20 * Represents an abstraction of a CPU cache.
21 */
22public interface BasicCpuCacheDevice {
23
24 /**
25 * Returns the ID of this cache.
26 * A CPU cache ID is a pair of CPU cache level and type.
27 *
28 * @return cache ID
29 */
30 CpuCacheId cacheId();
31
32 /**
33 * Returns the placement policy of this cache.
34 *
35 * @return cache placement policy
36 */
37 CpuCachePlacementPolicy policy();
38
39 /**
40 * Returns the vendor of this cache.
41 * Typically, a cache is part of a CPU,
42 * therefore shares the same vendor.
43 *
44 * @return cache vendor
45 */
46 CpuVendor vendor();
47
48 /**
49 * Returns the capacity of this cache in kilo bytes.
50 *
51 * @return cache capacity in kilo bytes
52 */
53 long capacity();
54
55 /**
56 * Returns the number of sets this cache is split across.
57 *
58 * @return number of cache sets
59 */
60 int sets();
61
62 /**
63 * Returns the ways of associativity of this cache.
64 *
65 * @return ways of associativity
66 */
67 int associativityWays();
68
69 /**
70 * Returns the cache line's length in bytes.
71 *
72 * @return cache line's length in bytes
73 */
74 int lineLength();
75
76 /**
77 * Returns whether this CPU cache is shared among multiple cores
78 * or dedicated to a specific core.
79 *
80 * @return sharing status of the CPU cache
81 */
82 boolean isShared();
83
84}