Skip to content

Commit 0370a5e

Browse files
chenhuacaiThomas Gleixner
authored andcommitted
irqchip/loongson-pch-pic: Adjust irqchip driver for 32BIT/64BIT
irq_domain_alloc_fwnode() takes a parameter with the phys_addr_t type. Currently we pass acpi_pchpic->address to it. This can only work on 64BIT platform because its type is u64, so cast it to phys_addr_t and then the driver works on both 32BIT and 64BIT platforms. Also use readl() to read vec_count because readq() is only available on 64BIT platform. [ tglx: Make the cast explicit and use the casted address as argument for pch_pic_init() which takes a phys_addr_t as well. Fixup coding style. More sigh... ] Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260113085940.3344837-7-chenhuacai@loongson.cn
1 parent 4093b0e commit 0370a5e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/irqchip/irq-loongson-pch-pic.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static int pch_pic_init(phys_addr_t addr, unsigned long size, int vec_base,
343343
priv->table[i] = PIC_UNDEF_VECTOR;
344344

345345
priv->ht_vec_base = vec_base;
346-
priv->vec_count = ((readq(priv->base) >> 48) & 0xff) + 1;
346+
priv->vec_count = ((readl(priv->base + 4) >> 16) & 0xff) + 1;
347347
priv->gsi_base = gsi_base;
348348

349349
priv->pic_domain = irq_domain_create_hierarchy(parent_domain, 0,
@@ -446,23 +446,23 @@ static int __init acpi_cascade_irqdomain_init(void)
446446
return 0;
447447
}
448448

449-
int __init pch_pic_acpi_init(struct irq_domain *parent,
450-
struct acpi_madt_bio_pic *acpi_pchpic)
449+
int __init pch_pic_acpi_init(struct irq_domain *parent, struct acpi_madt_bio_pic *acpi_pchpic)
451450
{
452-
int ret;
451+
phys_addr_t addr = (phys_addr_t)acpi_pchpic->address;
453452
struct fwnode_handle *domain_handle;
453+
int ret;
454454

455455
if (find_pch_pic(acpi_pchpic->gsi_base) >= 0)
456456
return 0;
457457

458-
domain_handle = irq_domain_alloc_fwnode(&acpi_pchpic->address);
458+
domain_handle = irq_domain_alloc_fwnode(&addr);
459459
if (!domain_handle) {
460460
pr_err("Unable to allocate domain handle\n");
461461
return -ENOMEM;
462462
}
463463

464-
ret = pch_pic_init(acpi_pchpic->address, acpi_pchpic->size,
465-
0, parent, domain_handle, acpi_pchpic->gsi_base);
464+
ret = pch_pic_init(addr, acpi_pchpic->size, 0, parent,
465+
domain_handle, acpi_pchpic->gsi_base);
466466

467467
if (ret < 0) {
468468
irq_domain_free_fwnode(domain_handle);

0 commit comments

Comments
 (0)