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
|
|
|
|
|
|
|
int hvm_set_parameter(int idx, uint64_t value)
|
|
|
|
{
|
|
|
|
struct xen_hvm_param xhv;
|
|
|
|
|
|
|
|
xhv.domid = DOMID_SELF;
|
|
|
|
xhv.index = idx;
|
|
|
|
xhv.value = value;
|
|
|
|
|
|
|
|
return HYPERVISOR_hvm_op(HVMOP_set_param, &xhv);
|
|
|
|
}
|
|
|
|
|
|
|
|
int hvm_get_parameter(int idx, uint64_t *value)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct xen_hvm_param xhv;
|
|
|
|
|
|
|
|
xhv.domid = DOMID_SELF;
|
|
|
|
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;
|
|
|
|
}
|