GNU Linux-libre 4.14.262-gnu1
[releases.git] / drivers / staging / lustre / include / linux / libcfs / linux / linux-cpu.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * GPL HEADER END
17  */
18 /*
19  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
20  * Copyright (c) 2012, Intel Corporation.
21  */
22 /*
23  * This file is part of Lustre, http://www.lustre.org/
24  * Lustre is a trademark of Sun Microsystems, Inc.
25  *
26  * libcfs/include/libcfs/linux/linux-cpu.h
27  *
28  * Basic library routines.
29  *
30  * Author: liang@whamcloud.com
31  */
32
33 #ifndef __LIBCFS_LINUX_CPU_H__
34 #define __LIBCFS_LINUX_CPU_H__
35
36 #ifndef __LIBCFS_LIBCFS_H__
37 #error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead
38 #endif
39
40 #include <linux/cpu.h>
41 #include <linux/cpuset.h>
42 #include <linux/topology.h>
43
44 #ifdef CONFIG_SMP
45
46 #define HAVE_LIBCFS_CPT
47
48 /** virtual processing unit */
49 struct cfs_cpu_partition {
50         /* CPUs mask for this partition */
51         cpumask_t                       *cpt_cpumask;
52         /* nodes mask for this partition */
53         nodemask_t                      *cpt_nodemask;
54         /* spread rotor for NUMA allocator */
55         unsigned int                    cpt_spread_rotor;
56 };
57
58 /** descriptor for CPU partitions */
59 struct cfs_cpt_table {
60         /* version, reserved for hotplug */
61         unsigned int                    ctb_version;
62         /* spread rotor for NUMA allocator */
63         unsigned int                    ctb_spread_rotor;
64         /* # of CPU partitions */
65         unsigned int                    ctb_nparts;
66         /* partitions tables */
67         struct cfs_cpu_partition        *ctb_parts;
68         /* shadow HW CPU to CPU partition ID */
69         int                             *ctb_cpu2cpt;
70         /* all cpus in this partition table */
71         cpumask_t                       *ctb_cpumask;
72         /* all nodes in this partition table */
73         nodemask_t                      *ctb_nodemask;
74 };
75
76 #endif /* CONFIG_SMP */
77 #endif /* __LIBCFS_LINUX_CPU_H__ */