#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/errno.h>
#include <linux/percpu.h>
#include <linux/fs.h>
MODULE_LICENSE("GPL");
+// Module parameter
+int cpu_list[NR_CPUS] = {};
+int cpu_list_len = 0;
+module_param_array(cpu_list, int, &cpu_list_len, 0644);
+MODULE_PARM_DESC(cpu_list, "Comma-delimited list of CPUs that Palacios will run on");
+
int mod_allocs = 0;
int mod_frees = 0;
palacios_init_mm();
-
// Initialize Palacios
-
palacios_vmm_init();
extern unsigned int cpu_khz;
+extern int cpu_list[NR_CPUS];
+extern int cpu_list_len;
+
/**
* Prints a message to the console.
int palacios_vmm_init( void )
{
+ int num_cpus = num_online_cpus();
+ char * cpu_mask = NULL;
+
+ if (cpu_list_len > 0) {
+ int major = 0;
+ int minor = 0;
+ int i = 0;
+
+ cpu_mask = kmalloc((num_cpus / 8) + 1, GFP_KERNEL);
+ memset(cpu_mask, 0, (num_cpus / 8) + 1);
+
+ for (i = 0; i < cpu_list_len; i++) {
+ if (cpu_list[i] >= num_cpus) {
+ printk("CPU (%d) exceeds number of available CPUs. Ignoring...\n", cpu_list[i]);
+ continue;
+ }
+
+ major = cpu_list[i] / 8;
+ minor = cpu_list[i] % 8;
+ *(cpu_mask + major) |= (0x1 << minor);
+ }
+ }
+
memset(irq_to_guest_map, 0, sizeof(struct v3_vm_info *) * 256);
-
+
printk("palacios_init starting - calling init_v3\n");
- Init_V3(&palacios_os_hooks, num_online_cpus());
+ Init_V3(&palacios_os_hooks, cpu_mask, num_cpus);
return 0;
-void Init_V3(struct v3_os_hooks * hooks, int num_cpus);
+void Init_V3(struct v3_os_hooks * hooks, char * cpus, int num_cpus);
void Shutdown_V3( void );
}
-
-void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
- int i;
+void Init_V3(struct v3_os_hooks * hooks, char * cpu_mask, int num_cpus) {
+ int i = 0;
+ int minor = 0;
+ int major = 0;
V3_Print("V3 Print statement to fix a Kitten page fault bug\n");
V3_init_checkpoint();
#endif
-
-
-
if ((hooks) && (hooks->call_on_cpu)) {
- for (i = 0; i < num_cpus; i++) {
- V3_Print("Initializing VMM extensions on cpu %d\n", i);
- hooks->call_on_cpu(i, &init_cpu, (void *)(addr_t)i);
+ for (i = 0; i < num_cpus; i++) {
+ major = i / 8;
+ minor = i % 8;
- if (v3_mach_type == V3_INVALID_CPU) {
- v3_mach_type = v3_cpu_types[i];
- }
+ if ((cpu_mask == NULL) || (*(cpu_mask + major) & (0x1 << minor))) {
+ V3_Print("Initializing VMM extensions on cpu %d\n", i);
+ hooks->call_on_cpu(i, &init_cpu, (void *)(addr_t)i);
- }
+ if (v3_mach_type == V3_INVALID_CPU) {
+ v3_mach_type = v3_cpu_types[i];
+ }
+ }
+ }
}
-
-
}
+
void Shutdown_V3() {
int i;