Skip to content

Commit

Permalink
xen: domain_build: Integration of the SCMI mediator to Domain-0
Browse files Browse the repository at this point in the history
Integration of the SCMI-Mediator feature to the Domain-0 construction
process. It includes shared memory node creation and mapping with
phandle update on the scmi node.

Signed-off-by: Oleksii Moisieiev <[email protected]>
  • Loading branch information
oleksiimoisieiev committed Sep 30, 2024
1 parent 222379a commit 4a28169
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
27 changes: 26 additions & 1 deletion xen/arch/arm/domain_build.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <xen/irq.h>
#include <xen/grant_table.h>
#include <asm/grant_table.h>
#include <xen/scmi_dt_maker.h>
#include <xen/serial.h>

static unsigned int __initdata opt_dom0_max_vcpus;
Expand Down Expand Up @@ -1627,7 +1628,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
DT_MATCH_TYPE("memory"),
/* The memory mapped timer is not supported by Xen. */
DT_MATCH_COMPATIBLE("arm,armv7-timer-mem"),
/* SCPI shared memory is handled by Xen */
/* SCMI shared memory is handled by Xen */
DT_MATCH_COMPATIBLE("arm,scmi-shmem"),
{ /* sentinel */ },
};
Expand All @@ -1643,6 +1644,13 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
DT_MATCH_PATH("/hypervisor"),
{ /* sentinel */ },
};
#ifdef CONFIG_SCMI_SMC
static const struct dt_device_match scmi_matches[] __initconst =
{
DT_MATCH_PATH("/firmware/scmi"),
{ /* sentinel */ },
};
#endif /* CONFIG_SCMI_SMC */
struct dt_device_node *child;
int res, i, nirq, irq_id;
const char *name;
Expand Down Expand Up @@ -1756,6 +1764,10 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
evtchn_allocate(d);

#ifdef CONFIG_SCMI_SMC
res = scmi_dt_make_shmem_node(kinfo);
if ( res )
return res;

res = mem_permit_access(kinfo->d, kinfo->d->arch.sci_channel.paddr,
0x1000);
if ( res )
Expand Down Expand Up @@ -1799,6 +1811,15 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
return res;
}

#ifdef CONFIG_SCMI_SMC
if ( dt_match_node(scmi_matches, node) )
{
res = scmi_dt_set_phandle(kinfo, dt_node_full_name(node));
if ( res )
return res;
}
#endif

res = fdt_end_node(kinfo->fdt);

return res;
Expand All @@ -1814,6 +1835,8 @@ static int __init prepare_dtb_hwdom(struct domain *d, struct kernel_info *kinfo)
ASSERT(dt_host && (dt_host->sibling == NULL));

kinfo->phandle_gic = dt_interrupt_controller->phandle;
kinfo->phandle_sci_shmem = GUEST_PHANDLE_SCMI;

fdt = device_tree_flattened;

new_size = fdt_totalsize(fdt) + DOM0_FDT_EXTRA_SIZE;
Expand Down Expand Up @@ -2112,9 +2135,11 @@ static int __init construct_dom0(struct domain *d)
if ( rc < 0 )
return rc;

#if CONFIG_ARM_SCI
rc = sci_domain_init(d, sci_get_type(), NULL);
if ( rc < 0 )
return rc;
#endif

if ( acpi_disabled )
{
Expand Down
5 changes: 5 additions & 0 deletions xen/drivers/passthrough/device_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* GNU General Public License for more details.
*/

#include <xen/access_controller.h>
#include <xen/device_tree.h>
#include <xen/guest_access.h>
#include <xen/iommu.h>
Expand Down Expand Up @@ -318,6 +319,10 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
break;
}

ret = ac_assign_dt_device(dev, d);
if ( ret < 0 )
return ret;

ret = iommu_assign_dt_device(d, dev);

if ( ret )
Expand Down

0 comments on commit 4a28169

Please sign in to comment.