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>
This commit is contained in:
Dmytro Firsov 2023-02-02 14:38:23 +02:00 committed by Fabio Baltieri
parent 3581527b53
commit 74b271bc2a
3 changed files with 8 additions and 8 deletions

View file

@ -233,14 +233,14 @@ int xen_console_init(const struct device *dev)
data->dev = dev;
ret = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &data->evtchn);
ret = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, DOMID_SELF, &data->evtchn);
if (ret) {
LOG_ERR("%s: failed to get Xen console evtchn, ret = %d\n",
__func__, ret);
return ret;
}
ret = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &console_pfn);
ret = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, DOMID_SELF, &console_pfn);
if (ret) {
LOG_ERR("%s: failed to get Xen console PFN, ret = %d\n",
__func__, ret);

View file

@ -11,23 +11,23 @@
#include <zephyr/kernel.h>
int hvm_set_parameter(int idx, uint64_t value)
int hvm_set_parameter(int idx, int domid, uint64_t value)
{
struct xen_hvm_param xhv;
xhv.domid = DOMID_SELF;
xhv.domid = domid;
xhv.index = idx;
xhv.value = value;
return HYPERVISOR_hvm_op(HVMOP_set_param, &xhv);
}
int hvm_get_parameter(int idx, uint64_t *value)
int hvm_get_parameter(int idx, int domid, uint64_t *value)
{
int ret = 0;
struct xen_hvm_param xhv;
xhv.domid = DOMID_SELF;
xhv.domid = domid;
xhv.index = idx;
ret = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);

View file

@ -11,7 +11,7 @@
#include <zephyr/kernel.h>
int hvm_set_parameter(int idx, uint64_t value);
int hvm_get_parameter(int idx, uint64_t *value);
int hvm_set_parameter(int idx, int domid, uint64_t value);
int hvm_get_parameter(int idx, int domid, uint64_t *value);
#endif /* __XEN_HVM_H__ */