zephyr/drivers/xen/hvm.c
Dmytro Firsov 74b271bc2a xen: change HVM functions signature to run it for other domains
This commit adds possibility to call hypervisor HVM parameter functions
for specified domain (instead of only DOMID_SELF). It is needed for
configuring domains, that were created from Zephyr control domain.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00

41 lines
728 B
C

/*
* Copyright (c) 2021 EPAM Systems
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/arch/arm64/hypercall.h>
#include <zephyr/xen/hvm.h>
#include <zephyr/xen/public/hvm/hvm_op.h>
#include <zephyr/xen/public/hvm/params.h>
#include <zephyr/kernel.h>
int hvm_set_parameter(int idx, int domid, uint64_t value)
{
struct xen_hvm_param xhv;
xhv.domid = domid;
xhv.index = idx;
xhv.value = value;
return HYPERVISOR_hvm_op(HVMOP_set_param, &xhv);
}
int hvm_get_parameter(int idx, int domid, uint64_t *value)
{
int ret = 0;
struct xen_hvm_param xhv;
xhv.domid = domid;
xhv.index = idx;
ret = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
if (ret < 0) {
return ret;
}
*value = xhv.value;
return ret;
}