Skip to content

Commit

Permalink
Merge tag 'irq-urgent-2022-08-21' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/tip/tip

Pull irq fixes from Ingo Molnar:
 "Misc irqchip fixes: LoongArch driver fixes and a Hyper-V IOMMU fix"

* tag 'irq-urgent-2022-08-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/loongson-liointc: Fix an error handling path in liointc_init()
  irqchip/loongarch: Fix irq_domain_alloc_fwnode() abuse
  irqchip/loongson-pch-pic: Move find_pch_pic() into CONFIG_ACPI
  irqchip/loongson-eiointc: Fix a build warning
  irqchip/loongson-eiointc: Fix irq affinity setting
  iommu/hyper-v: Use helper instead of directly accessing affinity
  • Loading branch information
torvalds committed Aug 21, 2022
2 parents 4f61f84 + 57646d6 commit 4daa6a8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 32 deletions.
1 change: 0 additions & 1 deletion arch/loongarch/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ extern struct acpi_vector_group msi_group[MAX_IO_PICS];
#define GSI_MIN_PCH_IRQ LOONGSON_PCH_IRQ_BASE
#define GSI_MAX_PCH_IRQ (LOONGSON_PCH_IRQ_BASE + 256 - 1)

extern int find_pch_pic(u32 gsi);
struct acpi_madt_lio_pic;
struct acpi_madt_eio_pic;
struct acpi_madt_ht_pic;
Expand Down
4 changes: 1 addition & 3 deletions drivers/iommu/hyperv-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
{
struct irq_alloc_info *info = arg;
struct irq_data *irq_data;
struct irq_desc *desc;
int ret = 0;

if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
Expand All @@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
* Hypver-V IO APIC irq affinity should be in the scope of
* ioapic_max_cpumask because no irq remapping support.
*/
desc = irq_data_to_desc(irq_data);
cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
irq_data_update_affinity(irq_data, &ioapic_max_cpumask);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-loongarch-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int __init cpuintc_acpi_init(union acpi_subtable_headers *header,
clear_csr_ecfg(ECFG0_IM);
clear_csr_estat(ESTATF_IP);

cpuintc_handle = irq_domain_alloc_fwnode(NULL);
cpuintc_handle = irq_domain_alloc_named_fwnode("CPUINTC");
irq_domain = irq_domain_create_linear(cpuintc_handle, EXCCODE_INT_NUM,
&loongarch_cpu_intc_irq_domain_ops, NULL);

Expand Down
13 changes: 9 additions & 4 deletions drivers/irqchip/irq-loongson-eiointc.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@ static int eiointc_set_irq_affinity(struct irq_data *d, const struct cpumask *af
regaddr = EIOINTC_REG_ENABLE + ((vector >> 5) << 2);

/* Mask target vector */
csr_any_send(regaddr, EIOINTC_ALL_ENABLE & (~BIT(vector & 0x1F)), 0x0, 0);
csr_any_send(regaddr, EIOINTC_ALL_ENABLE & (~BIT(vector & 0x1F)),
0x0, priv->node * CORES_PER_EIO_NODE);

/* Set route for target vector */
eiointc_set_irq_route(vector, cpu, priv->node, &priv->node_map);

/* Unmask target vector */
csr_any_send(regaddr, EIOINTC_ALL_ENABLE, 0x0, 0);
csr_any_send(regaddr, EIOINTC_ALL_ENABLE,
0x0, priv->node * CORES_PER_EIO_NODE);

irq_data_update_effective_affinity(d, cpumask_of(cpu));

Expand Down Expand Up @@ -286,7 +290,7 @@ static void acpi_set_vec_parent(int node, struct irq_domain *parent, struct acpi
}
}

struct irq_domain *acpi_get_vec_parent(int node, struct acpi_vector_group *vec_group)
static struct irq_domain *acpi_get_vec_parent(int node, struct acpi_vector_group *vec_group)
{
int i;

Expand Down Expand Up @@ -344,7 +348,8 @@ int __init eiointc_acpi_init(struct irq_domain *parent,
if (!priv)
return -ENOMEM;

priv->domain_handle = irq_domain_alloc_fwnode((phys_addr_t *)acpi_eiointc);
priv->domain_handle = irq_domain_alloc_named_id_fwnode("EIOPIC",
acpi_eiointc->node);
if (!priv->domain_handle) {
pr_err("Unable to allocate domain handle\n");
goto out_free_priv;
Expand Down
4 changes: 2 additions & 2 deletions drivers/irqchip/irq-loongson-liointc.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision,
"reg-names", core_reg_names[i]);

if (index < 0)
return -EINVAL;
goto out_iounmap;

priv->core_isr[i] = of_iomap(node, index);
}
Expand Down Expand Up @@ -360,7 +360,7 @@ int __init liointc_acpi_init(struct irq_domain *parent, struct acpi_madt_lio_pic
parent_irq[0] = irq_create_mapping(parent, acpi_liointc->cascade[0]);
parent_irq[1] = irq_create_mapping(parent, acpi_liointc->cascade[1]);

domain_handle = irq_domain_alloc_fwnode((phys_addr_t *)acpi_liointc);
domain_handle = irq_domain_alloc_fwnode(&acpi_liointc->address);
if (!domain_handle) {
pr_err("Unable to allocate domain handle\n");
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-loongson-pch-msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ int __init pch_msi_acpi_init(struct irq_domain *parent,
int ret;
struct fwnode_handle *domain_handle;

domain_handle = irq_domain_alloc_fwnode((phys_addr_t *)acpi_pchmsi);
domain_handle = irq_domain_alloc_fwnode(&acpi_pchmsi->msg_address);
ret = pch_msi_init(acpi_pchmsi->msg_address, acpi_pchmsi->start,
acpi_pchmsi->count, parent, domain_handle);
if (ret < 0)
Expand Down
40 changes: 20 additions & 20 deletions drivers/irqchip/irq-loongson-pch-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,6 @@ static struct pch_pic *pch_pic_priv[MAX_IO_PICS];

struct fwnode_handle *pch_pic_handle[MAX_IO_PICS];

int find_pch_pic(u32 gsi)
{
int i;

/* Find the PCH_PIC that manages this GSI. */
for (i = 0; i < MAX_IO_PICS; i++) {
struct pch_pic *priv = pch_pic_priv[i];

if (!priv)
return -1;

if (gsi >= priv->gsi_base && gsi < (priv->gsi_base + priv->vec_count))
return i;
}

pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
return -1;
}

static void pch_pic_bitset(struct pch_pic *priv, int offset, int bit)
{
u32 reg;
Expand Down Expand Up @@ -325,6 +306,25 @@ IRQCHIP_DECLARE(pch_pic, "loongson,pch-pic-1.0", pch_pic_of_init);
#endif

#ifdef CONFIG_ACPI
int find_pch_pic(u32 gsi)
{
int i;

/* Find the PCH_PIC that manages this GSI. */
for (i = 0; i < MAX_IO_PICS; i++) {
struct pch_pic *priv = pch_pic_priv[i];

if (!priv)
return -1;

if (gsi >= priv->gsi_base && gsi < (priv->gsi_base + priv->vec_count))
return i;
}

pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
return -1;
}

static int __init
pch_lpc_parse_madt(union acpi_subtable_headers *header,
const unsigned long end)
Expand All @@ -349,7 +349,7 @@ int __init pch_pic_acpi_init(struct irq_domain *parent,

vec_base = acpi_pchpic->gsi_base - GSI_MIN_PCH_IRQ;

domain_handle = irq_domain_alloc_fwnode((phys_addr_t *)acpi_pchpic);
domain_handle = irq_domain_alloc_fwnode(&acpi_pchpic->address);
if (!domain_handle) {
pr_err("Unable to allocate domain handle\n");
return -ENOMEM;
Expand Down

0 comments on commit 4daa6a8

Please sign in to comment.