mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/libs/ctrl: Implement new xc interfaces for dt overlay
xc_dt_overlay() sends the device tree binary overlay, size of .dtbo and overlay operation type i.e. add or remove to xen. Signed-off-by: Vikram Garhwal <vikram.garhwal@amd.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
1 parent
0c0facdab6
commit
f61243530e
3 files changed
+56
No files matched your search
@@ -2653,6 +2653,11 @@ int xc_livepatch_replace(xc_interface *xch, char *name, uint32_t timeout, uint32
|
||||
int xc_domain_cacheflush(xc_interface *xch, uint32_t domid,
|
||||
xen_pfn_t start_pfn, xen_pfn_t nr_pfns);
|
||||
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
int xc_dt_overlay(xc_interface *xch, void *overlay_fdt,
|
||||
uint32_t overlay_fdt_size, uint8_t overlay_op);
|
||||
#endif
|
||||
|
||||
/* Compat shims */
|
||||
#include "xenctrl_compat.h"
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ OBJS-y += xc_hcall_buf.o
|
||||
OBJS-y += xc_foreign_memory.o
|
||||
OBJS-y += xc_kexec.o
|
||||
OBJS-y += xc_resource.o
|
||||
OBJS-$(CONFIG_ARM) += xc_dt_overlay.o
|
||||
OBJS-$(CONFIG_X86) += xc_psr.o
|
||||
OBJS-$(CONFIG_X86) += xc_pagetab.o
|
||||
OBJS-$(CONFIG_Linux) += xc_linux.o
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
*
|
||||
* Device Tree Overlay functions.
|
||||
* Copyright (C) 2021 Xilinx Inc.
|
||||
* Author Vikram Garhwal <fnu.vikram@xilinx.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "xc_private.h"
|
||||
|
||||
int xc_dt_overlay(xc_interface *xch, void *overlay_fdt,
|
||||
uint32_t overlay_fdt_size, uint8_t overlay_op)
|
||||
{
|
||||
int err;
|
||||
struct xen_sysctl sysctl = {
|
||||
.cmd = XEN_SYSCTL_dt_overlay,
|
||||
.u.dt_overlay = {
|
||||
.overlay_op = overlay_op,
|
||||
.overlay_fdt_size = overlay_fdt_size,
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_HYPERCALL_BOUNCE(overlay_fdt, overlay_fdt_size,
|
||||
XC_HYPERCALL_BUFFER_BOUNCE_IN);
|
||||
|
||||
if ( (err = xc_hypercall_bounce_pre(xch, overlay_fdt)) )
|
||||
goto err;
|
||||
|
||||
set_xen_guest_handle(sysctl.u.dt_overlay.overlay_fdt, overlay_fdt);
|
||||
|
||||
if ( (err = do_sysctl(xch, &sysctl)) != 0 )
|
||||
PERROR("%s failed", __func__);
|
||||
|
||||
err:
|
||||
xc_hypercall_bounce_post(xch, overlay_fdt);
|
||||
|
||||
return err;
|
||||
}
|
||||