Skip to content

Commit

Permalink
Implement NVMM_IOC_CAPABILITY ioctl op
Browse files Browse the repository at this point in the history
  • Loading branch information
dalmemail committed Jun 3, 2024
1 parent 4063902 commit f840ed6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
11 changes: 5 additions & 6 deletions src/add-ons/kernel/drivers/nvmm/nvmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ nvmm_kill_machines(struct nvmm_owner *owner)

/* -------------------------------------------------------------------------- */

#if 0
static int
nvmm_capability(struct nvmm_owner *owner, struct nvmm_ioc_capability *args)
{
Expand All @@ -261,6 +260,7 @@ nvmm_capability(struct nvmm_owner *owner, struct nvmm_ioc_capability *args)
return 0;
}

# if 0
static int
nvmm_machine_create(struct nvmm_owner *owner,
struct nvmm_ioc_machine_create *args)
Expand Down Expand Up @@ -1026,10 +1026,10 @@ nvmm_fini(void)
int
nvmm_ioctl(struct nvmm_owner *owner, unsigned long cmd, void *data)
{
/* switch (cmd) {
switch (cmd) {
case NVMM_IOC_CAPABILITY:
return nvmm_capability(owner, data);
case NVMM_IOC_MACHINE_CREATE:
/* case NVMM_IOC_MACHINE_CREATE:
return nvmm_machine_create(owner, data);
case NVMM_IOC_MACHINE_DESTROY:
return nvmm_machine_destroy(owner, data);
Expand Down Expand Up @@ -1058,9 +1058,8 @@ nvmm_ioctl(struct nvmm_owner *owner, unsigned long cmd, void *data)
case NVMM_IOC_HVA_UNMAP:
return nvmm_hva_unmap(owner, data);
case NVMM_IOC_CTL:
return nvmm_ctl(owner, data);
return nvmm_ctl(owner, data);*/
default:
return EINVAL;
}*/
return EINVAL;
}
}
2 changes: 0 additions & 2 deletions src/add-ons/kernel/drivers/nvmm/nvmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ struct nvmm_capability {
uint32_t max_machines;
uint32_t max_vcpus;
uint64_t max_ram;
#ifndef __HAIKU__ // We only support a toy x86 backend so far
struct nvmm_cap_md arch;
#endif
};

/* Machine configuration slots. */
Expand Down
2 changes: 1 addition & 1 deletion src/add-ons/kernel/drivers/nvmm/nvmm_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#elif defined(__DragonFly__)
#define NVMM_MAX_RAM (127ULL * 1024ULL * (1 << 30))
#elif defined(__HAIKU__)
/* Empty for now */
#define NVMM_MAX_RAM (128ULL * (1 << 30))
#else
#error "OS dependency for NVMM_MAX_RAM required"
#endif
Expand Down
1 change: 1 addition & 0 deletions src/add-ons/kernel/drivers/nvmm/x86/nvmm_x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ x86_set_xcr(uint32_t xcr, uint64_t val)
#define x86_fpu_mxcsr_mask npx_mxcsr_mask
#elif defined(__HAIKU__)
#define x86_xsave_features haiku_get_xsave_mask()
#define x86_fpu_mxcsr_mask gFPUMXCSRDefault
#endif

#endif /* _KERNEL */
Expand Down
6 changes: 2 additions & 4 deletions src/add-ons/kernel/drivers/nvmm/x86/nvmm_x86_svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,6 @@ svm_fini(void)
#endif
}

#if 0
static void
svm_capability(struct nvmm_capability *cap)
{
Expand All @@ -2723,14 +2722,13 @@ svm_capability(struct nvmm_capability *cap)
cap->arch.mxcsr_mask = x86_fpu_mxcsr_mask;
cap->arch.conf_cpuid_maxops = SVM_NCPUIDS;
}
#endif

const struct nvmm_impl nvmm_x86_svm = {
.name = "x86-svm",
.ident = svm_ident,
.init = svm_init,
.fini = svm_fini/*,
.capability = svm_capability,
.fini = svm_fini,
.capability = svm_capability/*,
.mach_conf_max = NVMM_X86_MACH_NCONF,
.mach_conf_sizes = NULL,
.vcpu_conf_max = NVMM_X86_VCPU_NCONF,
Expand Down
6 changes: 2 additions & 4 deletions src/add-ons/kernel/drivers/nvmm/x86/nvmm_x86_vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3679,7 +3679,6 @@ vmx_fini(void)
#endif
}

#if 0
static void
vmx_capability(struct nvmm_capability *cap)
{
Expand All @@ -3691,14 +3690,13 @@ vmx_capability(struct nvmm_capability *cap)
cap->arch.mxcsr_mask = x86_fpu_mxcsr_mask;
cap->arch.conf_cpuid_maxops = VMX_NCPUIDS;
}
#endif

const struct nvmm_impl nvmm_x86_vmx = {
.name = "x86-vmx",
.ident = vmx_ident,
.init = vmx_init,
.fini = vmx_fini/*,
.capability = vmx_capability,
.fini = vmx_fini,
.capability = vmx_capability/*,
.mach_conf_max = NVMM_X86_MACH_NCONF,
.mach_conf_sizes = NULL,
.vcpu_conf_max = NVMM_X86_VCPU_NCONF,
Expand Down

0 comments on commit f840ed6

Please sign in to comment.