mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-17 00:41:30 +00:00
DM: Get max vcpu per vm from HV instead of hardcode
This patch tries to fetch max vcpu per vm from HV instead of hardcode in DM. Tracked-On: #3116 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
86f5993bc9
commit
356bf18491
@ -38,6 +38,7 @@
|
|||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "vmmapi.h"
|
#include "vmmapi.h"
|
||||||
#include "sw_load.h"
|
#include "sw_load.h"
|
||||||
@ -695,10 +696,20 @@ vm_loop(struct vmctx *ctx)
|
|||||||
static int
|
static int
|
||||||
num_vcpus_allowed(struct vmctx *ctx)
|
num_vcpus_allowed(struct vmctx *ctx)
|
||||||
{
|
{
|
||||||
/* TODO: add ioctl to get gerneric information including
|
int err;
|
||||||
* virtual cpus, now hardcode
|
uint16_t max_cpu;
|
||||||
*/
|
struct platform_info info;
|
||||||
return VM_MAXCPU;
|
|
||||||
|
err = ioctl(ctx->fd, IC_GET_PLATFORM_INFO, &info);
|
||||||
|
if (err != 0) {
|
||||||
|
/* Use VM_MAXCPU as default */
|
||||||
|
max_cpu = VM_MAXCPU;
|
||||||
|
printf("Failed to get max vcpu from HV, use default: %d. errno(%d)\n", max_cpu, err);
|
||||||
|
} else {
|
||||||
|
max_cpu = info.max_vcpus_per_vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return max_cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user