Skip to content

Commit

Permalink
plat/xen: Introduce an implementation of uk_intctlr_plat_probe
Browse files Browse the repository at this point in the history
uk_intctlr_plat_probe is platform specific initialization for GIC
drivers. It maps destributor/redistributor address to the page table
so system can access registers and returns mapped addresses to
GIC driver.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
  • Loading branch information
oleksiimoisieiev authored and razvand committed Jan 25, 2024
1 parent 503f82a commit f6f028e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions plat/xen/arm/setup64.c
Expand Up @@ -34,6 +34,7 @@
#include <uk/plat/memory.h>
#include <xen/memory.h>
#include <uk/intctlr.h>
#include <uk/intctlr/gic.h>
#include <xen/hvm/params.h>
#include <libfdt.h>
#include <xen-arm/setup.h>
Expand Down Expand Up @@ -204,6 +205,28 @@ static inline void _get_cmdline(struct ukplat_bootinfo *bi)
bi->cmdline_len = cmdline_len;
}

int uk_intctlr_plat_probe(void *in, void *out)
{
struct uk_intctlr_plat_data *dout = (struct uk_intctlr_plat_data *)out;
struct uk_intctlr_plat_data *din = (struct uk_intctlr_plat_data *)in;

if (!in || !out)
return -EINVAL;

#if defined(__arm__)
dout->dist_addr = to_virt((long)fdt64_ld(din->dist_addr));
dout->rdist_addr = to_virt((long)fdt64_ld(din->rdist_addr));
#else
set_pgt_entry(&fixmap_pgtable[l2_pgt_idx(FIX_GIC_START)],
((din->dist_addr & L2_MASK) | BLOCK_DEV_ATTR | L2_BLOCK));
dout->dist_addr = (FIX_GIC_START + (din->dist_addr & L2_OFFSET));
dout->rdist_addr = (FIX_GIC_START + (din->rdist_addr & L2_OFFSET));
#endif
/* Setting memory barrier to get access to mapped pages */
wmb();
return 0;
}

static int _init_mem(struct ukplat_bootinfo *const bi, paddr_t physical_offset)
{
int rc;
Expand Down

0 comments on commit f6f028e

Please sign in to comment.