2021-07-02 16:31:56 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021 EPAM Systems
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2022-05-06 16:25:46 +08:00
|
|
|
#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>
|
2021-07-02 16:31:56 +08:00
|
|
|
|
2022-05-06 16:25:46 +08:00
|
|
|
#include <zephyr/kernel.h>
|
2021-07-02 16:31:56 +08:00
|
|
|
|
2023-02-02 20:38:23 +08:00
|
|
|
int hvm_set_parameter(int idx, int domid, uint64_t value)
|
2021-07-02 16:31:56 +08:00
|
|
|
{
|
|
|
|
struct xen_hvm_param xhv;
|
|
|
|
|
2023-02-02 20:38:23 +08:00
|
|
|
xhv.domid = domid;
|
2021-07-02 16:31:56 +08:00
|
|
|
xhv.index = idx;
|
|
|
|
xhv.value = value;
|
|
|
|
|
|
|
|
return HYPERVISOR_hvm_op(HVMOP_set_param, &xhv);
|
|
|
|
}
|
|
|
|
|
2023-02-02 20:38:23 +08:00
|
|
|
int hvm_get_parameter(int idx, int domid, uint64_t *value)
|
2021-07-02 16:31:56 +08:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct xen_hvm_param xhv;
|
|
|
|
|
2023-02-02 20:38:23 +08:00
|
|
|
xhv.domid = domid;
|
2021-07-02 16:31:56 +08:00
|
|
|
xhv.index = idx;
|
|
|
|
|
|
|
|
ret = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
|
2022-07-06 19:34:50 +08:00
|
|
|
if (ret < 0) {
|
2021-07-02 16:31:56 +08:00
|
|
|
return ret;
|
2022-07-06 19:34:50 +08:00
|
|
|
}
|
2021-07-02 16:31:56 +08:00
|
|
|
|
|
|
|
*value = xhv.value;
|
|
|
|
return ret;
|
|
|
|
}
|