2 * QEMU RISC-V NUMA Helper
4 * Copyright (c) 2020 Western Digital Corporation or its affiliates.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2 or later, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "hw/sysbus.h"
23 #include "sysemu/numa.h"
27 * @ms: pointer to machine state
29 * Returns: number of sockets for a numa system and 1 for a non-numa system
31 int riscv_socket_count(const MachineState
*ms
);
34 * riscv_socket_first_hartid:
35 * @ms: pointer to machine state
36 * @socket_id: socket index
38 * Returns: first hartid for a valid socket and -1 for an invalid socket
40 int riscv_socket_first_hartid(const MachineState
*ms
, int socket_id
);
43 * riscv_socket_last_hartid:
44 * @ms: pointer to machine state
45 * @socket_id: socket index
47 * Returns: last hartid for a valid socket and -1 for an invalid socket
49 int riscv_socket_last_hartid(const MachineState
*ms
, int socket_id
);
52 * riscv_socket_hart_count:
53 * @ms: pointer to machine state
54 * @socket_id: socket index
56 * Returns: number of harts for a valid socket and -1 for an invalid socket
58 int riscv_socket_hart_count(const MachineState
*ms
, int socket_id
);
61 * riscv_socket_mem_offset:
62 * @ms: pointer to machine state
63 * @socket_id: socket index
65 * Returns: offset of ram belonging to given socket
67 uint64_t riscv_socket_mem_offset(const MachineState
*ms
, int socket_id
);
70 * riscv_socket_mem_size:
71 * @ms: pointer to machine state
72 * @socket_id: socket index
74 * Returns: size of ram belonging to given socket
76 uint64_t riscv_socket_mem_size(const MachineState
*ms
, int socket_id
);
79 * riscv_socket_check_hartids:
80 * @ms: pointer to machine state
81 * @socket_id: socket index
83 * Returns: true if hardids belonging to given socket are contiguous else false
85 bool riscv_socket_check_hartids(const MachineState
*ms
, int socket_id
);
88 * riscv_socket_fdt_write_id:
89 * @ms: pointer to machine state
90 * @socket_id: socket index
92 * Write NUMA node-id FDT property for given FDT node
94 void riscv_socket_fdt_write_id(const MachineState
*ms
, void *fdt
,
95 const char *node_name
, int socket_id
);
98 * riscv_socket_fdt_write_distance_matrix:
99 * @ms: pointer to machine state
100 * @socket_id: socket index
102 * Write NUMA distance matrix in FDT for given machine
104 void riscv_socket_fdt_write_distance_matrix(const MachineState
*ms
, void *fdt
);
106 CpuInstanceProperties
107 riscv_numa_cpu_index_to_props(MachineState
*ms
, unsigned cpu_index
);
109 int64_t riscv_numa_get_default_cpu_node_id(const MachineState
*ms
, int idx
);
111 const CPUArchIdList
*riscv_numa_possible_cpu_arch_ids(MachineState
*ms
);
113 #endif /* RISCV_NUMA_H */