irqchip/riscv-imsic: Expose the fwnode via the global config

The fwnode describes a global property of the IMSIC interrupt
controller that is equally relevant to external consumers of
imsic_global_config as it is to the imsic_priv itself.

Keeping it in imsic_priv forces the external drivers to access
the private structure rather than using the already exported
imsic_get_global_config() interface.

Moving the fwnode into imsic_global_config makes the public
API self-contained and eliminates the need for callers to
access imsic_priv internals directly.

Signed-off-by: Prajwal N <prajwal.n@oss.qualcomm.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20261002120417.2708979-1-prajwal.n@oss.qualcomm.com
This commit is contained in:
Prajwal N 2026-10-02 17:34:17 +05:30 committed by Thomas Gleixner
parent 5b6e2a46b8
commit ff6f8cd291
5 changed files with 14 additions and 14 deletions

View File

@ -75,7 +75,7 @@ static int __init imsic_ipi_domain_init(void)
riscv_ipi_set_virq_range(virq, IPI_MAX);
/* Announce that IMSIC is providing IPIs */
pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);
pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->global.fwnode, IMSIC_IPI_ID);
return 0;
}

View File

@ -313,40 +313,40 @@ int imsic_irqdomain_init(void)
};
struct imsic_global_config *global;
if (!imsic || !imsic->fwnode) {
if (!imsic || !imsic->global.fwnode) {
pr_err("early driver not probed\n");
return -ENODEV;
}
if (imsic->base_domain) {
pr_err("%pfwP: irq domain already created\n", imsic->fwnode);
pr_err("%pfwP: irq domain already created\n", imsic->global.fwnode);
return -ENODEV;
}
/* Create Base IRQ domain */
info.fwnode = imsic->fwnode,
info.fwnode = imsic->global.fwnode,
imsic->base_domain = msi_create_parent_irq_domain(&info, &imsic_msi_parent_ops);
if (!imsic->base_domain) {
pr_err("%pfwP: failed to create IMSIC base domain\n", imsic->fwnode);
pr_err("%pfwP: failed to create IMSIC base domain\n", imsic->global.fwnode);
return -ENOMEM;
}
global = &imsic->global;
pr_info("%pfwP: hart-index-bits: %d, guest-index-bits: %d\n",
imsic->fwnode, global->hart_index_bits, global->guest_index_bits);
imsic->global.fwnode, global->hart_index_bits, global->guest_index_bits);
pr_info("%pfwP: group-index-bits: %d, group-index-shift: %d\n",
imsic->fwnode, global->group_index_bits, global->group_index_shift);
imsic->global.fwnode, global->group_index_bits, global->group_index_shift);
pr_info("%pfwP: per-CPU IDs %d at base address %pa\n",
imsic->fwnode, global->nr_ids, &global->base_addr);
imsic->global.fwnode, global->nr_ids, &global->base_addr);
pr_info("%pfwP: total %d interrupts available\n",
imsic->fwnode, num_possible_cpus() * (global->nr_ids - 1));
imsic->global.fwnode, num_possible_cpus() * (global->nr_ids - 1));
return 0;
}
static int imsic_platform_probe_common(struct fwnode_handle *fwnode)
{
if (imsic && imsic->fwnode != fwnode) {
if (imsic && imsic->global.fwnode != fwnode) {
pr_err("%pfwP: fwnode mismatch\n", fwnode);
return -ENODEV;
}

View File

@ -822,9 +822,9 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
imsic = kzalloc_obj(*imsic);
if (!imsic)
return -ENOMEM;
imsic->fwnode = fwnode;
global = &imsic->global;
global->fwnode = fwnode;
global->local = alloc_percpu(typeof(*global->local));
if (!global->local) {
rc = -ENOMEM;

View File

@ -43,9 +43,6 @@ struct imsic_local_priv {
};
struct imsic_priv {
/* Device details */
struct fwnode_handle *fwnode;
/* Global configuration common for all HARTs */
struct imsic_global_config global;

View File

@ -46,6 +46,9 @@ struct imsic_local_config {
};
struct imsic_global_config {
/* Device details */
struct fwnode_handle *fwnode;
/*
* MSI Target Address Scheme
*