2015-02-08 19:51:16 +01:00
|
|
|
#ifndef SYSEMU_NUMA_H
|
|
|
|
#define SYSEMU_NUMA_H
|
|
|
|
|
|
|
|
#include "qemu/bitmap.h"
|
|
|
|
#include "qemu/option.h"
|
|
|
|
#include "sysemu/sysemu.h"
|
|
|
|
#include "sysemu/hostmem.h"
|
2015-03-19 18:09:21 +01:00
|
|
|
#include "hw/boards.h"
|
2015-02-08 19:51:16 +01:00
|
|
|
|
|
|
|
extern int nb_numa_nodes; /* Number of NUMA nodes */
|
numa: Allow setting NUMA distance for different NUMA nodes
This patch is going to add SLIT table support in QEMU, and provides
additional option `dist` for command `-numa` to allow user set vNUMA
distance by QEMU command.
With this patch, when a user wants to create a guest that contains
several vNUMA nodes and also wants to set distance among those nodes,
the QEMU command would like:
```
-numa node,nodeid=0,cpus=0 \
-numa node,nodeid=1,cpus=1 \
-numa node,nodeid=2,cpus=2 \
-numa node,nodeid=3,cpus=3 \
-numa dist,src=0,dst=1,val=21 \
-numa dist,src=0,dst=2,val=31 \
-numa dist,src=0,dst=3,val=41 \
-numa dist,src=1,dst=2,val=21 \
-numa dist,src=1,dst=3,val=31 \
-numa dist,src=2,dst=3,val=21 \
```
Signed-off-by: He Chen <he.chen@linux.intel.com>
Message-Id: <1493260558-20728-1-git-send-email-he.chen@linux.intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-04-27 04:35:58 +02:00
|
|
|
extern bool have_numa_distance;
|
2015-02-08 19:51:16 +01:00
|
|
|
|
2015-06-29 10:20:25 +02:00
|
|
|
struct numa_addr_range {
|
|
|
|
ram_addr_t mem_start;
|
|
|
|
ram_addr_t mem_end;
|
|
|
|
QLIST_ENTRY(numa_addr_range) entry;
|
|
|
|
};
|
|
|
|
|
2017-05-02 18:29:55 +02:00
|
|
|
struct node_info {
|
2015-02-08 19:51:16 +01:00
|
|
|
uint64_t node_mem;
|
2016-11-18 12:02:54 +01:00
|
|
|
unsigned long *node_cpu;
|
2015-02-08 19:51:16 +01:00
|
|
|
struct HostMemoryBackend *node_memdev;
|
|
|
|
bool present;
|
2015-06-29 10:20:25 +02:00
|
|
|
QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */
|
numa: Allow setting NUMA distance for different NUMA nodes
This patch is going to add SLIT table support in QEMU, and provides
additional option `dist` for command `-numa` to allow user set vNUMA
distance by QEMU command.
With this patch, when a user wants to create a guest that contains
several vNUMA nodes and also wants to set distance among those nodes,
the QEMU command would like:
```
-numa node,nodeid=0,cpus=0 \
-numa node,nodeid=1,cpus=1 \
-numa node,nodeid=2,cpus=2 \
-numa node,nodeid=3,cpus=3 \
-numa dist,src=0,dst=1,val=21 \
-numa dist,src=0,dst=2,val=31 \
-numa dist,src=0,dst=3,val=41 \
-numa dist,src=1,dst=2,val=21 \
-numa dist,src=1,dst=3,val=31 \
-numa dist,src=2,dst=3,val=21 \
```
Signed-off-by: He Chen <he.chen@linux.intel.com>
Message-Id: <1493260558-20728-1-git-send-email-he.chen@linux.intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-04-27 04:35:58 +02:00
|
|
|
uint8_t distance[MAX_NODES];
|
2017-05-02 18:29:55 +02:00
|
|
|
};
|
2015-06-29 10:20:25 +02:00
|
|
|
|
2015-02-08 19:51:16 +01:00
|
|
|
extern NodeInfo numa_info[MAX_NODES];
|
2017-05-10 13:29:45 +02:00
|
|
|
void parse_numa_opts(MachineState *ms);
|
2015-02-08 19:51:22 +01:00
|
|
|
void numa_post_machine_init(void);
|
2015-02-08 19:51:16 +01:00
|
|
|
void query_numa_node_mem(uint64_t node_mem[]);
|
|
|
|
extern QemuOptsList qemu_numa_opts;
|
2015-06-29 10:20:25 +02:00
|
|
|
void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node);
|
|
|
|
void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node);
|
2015-06-29 10:20:27 +02:00
|
|
|
uint32_t numa_get_node(ram_addr_t addr, Error **errp);
|
2017-05-02 18:29:55 +02:00
|
|
|
void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
|
|
|
|
int nb_nodes, ram_addr_t size);
|
|
|
|
void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
|
|
|
|
int nb_nodes, ram_addr_t size);
|
|
|
|
|
2015-02-08 19:51:16 +01:00
|
|
|
|
2016-10-05 17:51:23 +02:00
|
|
|
/* on success returns node index in numa_info,
|
|
|
|
* on failure returns nb_numa_nodes */
|
|
|
|
int numa_get_node_for_cpu(int idx);
|
2015-02-08 19:51:16 +01:00
|
|
|
#endif
|