X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_hvm.c;h=4225d28d5ac4816d9aad2d13763c74539b04f76b;hp=20c2408836faf4f947e4fb2fd58db12a8bded570;hb=c5ba903ae97ea49bbac5b660f76d2031c5302a3d;hpb=3586c3bd6260bf79c57baebf66a26d7e8158d411 diff --git a/palacios/src/palacios/vmm_hvm.c b/palacios/src/palacios/vmm_hvm.c index 20c2408..4225d28 100644 --- a/palacios/src/palacios/vmm_hvm.c +++ b/palacios/src/palacios/vmm_hvm.c @@ -256,3 +256,44 @@ int v3_is_hvm_ros_core(struct guest_info *core) return !core->hvm_state.is_hrt; } +int v3_hvm_should_deliver_ipi(struct guest_info *src, struct guest_info *dest) +{ + if (!src) { + // ioapic or msi to apic + return !dest->hvm_state.is_hrt; + } else { + // apic to apic + return src->hvm_state.is_hrt || (!src->hvm_state.is_hrt && !dest->hvm_state.is_hrt) ; + } +} + +void v3_hvm_find_apics_seen_by_core(struct guest_info *core, struct v3_vm_info *vm, + uint32_t *start_apic, uint32_t *num_apics) +{ + if (!core) { + // Seen from ioapic, msi, etc: + if (vm->hvm_state.is_hvm) { + // HVM VM shows only the ROS cores/apics to ioapic, msi, etc + *start_apic = 0; + *num_apics = vm->hvm_state.first_hrt_core; + } else { + // Non-HVM shows all cores/APICs to apic, msi, etc. + *start_apic = 0; + *num_apics = vm->num_cores; + } + } else { + // Seen from apic + if (core->hvm_state.is_hrt) { + // HRT core/apic sees all apics + // (this policy may change...) + *start_apic = 0; + *num_apics = vm->num_cores; + } else { + // non-HRT core/apic sees only non-HRT cores/apics + *start_apic = 0 ; + *num_apics = vm->hvm_state.first_hrt_core; + } + } +} + +