Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Change maximum number of addresable IDs according to the number of
Browse files Browse the repository at this point in the history
virtual CPUs in cpuid 4

Signed-off-by: Alexey Romko <[email protected]>
  • Loading branch information
nevilad committed Mar 10, 2020
1 parent 7f3aaab commit 6dbef99
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions core/vcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2673,8 +2673,23 @@ static void handle_cpuid_virtual(struct vcpu_t *vcpu, uint32_t a, uint32_t c)
return;
}
case 4: { // Deterministic Cache Parameters
// [31:26] cores per package - 1
// Use host cache values.
// Use host cache values, but change maximum number of addresable
// IDs according to the number of virtual CPUs (bits [31:26]).
state->_eax &= ~0xFC000000;
if (state->_eax & 31) {
struct vm_t *vm = vcpu->vm;
hax_list_head *list;
int count = 0;

hax_mutex_lock(vm->vm_lock);
hax_list_for_each(list, (hax_list_head *)(&vm->vcpu_list)) {
count++;
}
hax_mutex_unlock(vm->vm_lock);

if (count > 1)
state->_eax |= (count - 1) << 26;
}
return;
}
case 5: // MONITOR/MWAIT
Expand Down

0 comments on commit 6dbef99

Please sign in to comment.