From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: geert@linux-m68k.org, tglx@kernel.org, miodrag.dinic@mips.com
Cc: radu@rendec.net, zewenchen@google.com, jamiechen@google.com,
edwardwchen@google.com, marscheng@google.com,
eleanor15x@gmail.com, jserv@ccns.ncku.edu.tw,
linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: [PATCH 1/6] irqchip/goldfish-pic: Use gf_ioread32/gf_iowrite32 for MMIO access
Date: Tue, 8 Sep 2026 09:40:11 +0000 [thread overview]
Message-ID: <20260908094016.1997918-2-visitorckw@gmail.com> (raw)
In-Reply-To: <20260908094016.1997918-1-visitorckw@gmail.com>
The goldfish PIC driver uses readl() and writel() directly for register
accesses. On big endian architectures, goldfish devices require big
endian MMIO accessors [1].
Switch to gf_ioread32() and gf_iowrite32() to make MMIO accesses endian
safe.
Link: https://gitlab.com/qemu-project/qemu/-/blob/stable-11.1/hw/intc/goldfish_pic.c#L130 [1]
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
drivers/irqchip/irq-goldfish-pic.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-goldfish-pic.c b/drivers/irqchip/irq-goldfish-pic.c
index d458cf898f8e..c3c33f066140 100644
--- a/drivers/irqchip/irq-goldfish-pic.c
+++ b/drivers/irqchip/irq-goldfish-pic.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/goldfish.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqchip.h>
@@ -38,7 +39,7 @@ static void goldfish_pic_cascade(struct irq_desc *desc)
chained_irq_enter(host_chip, desc);
- pending = readl(gfpic->base + GFPIC_REG_IRQ_PENDING);
+ pending = gf_ioread32(gfpic->base + GFPIC_REG_IRQ_PENDING);
while (pending) {
hwirq = __fls(pending);
generic_handle_domain_irq(gfpic->irq_domain, hwirq);
@@ -52,6 +53,16 @@ static const struct irq_domain_ops goldfish_irq_domain_ops = {
.xlate = irq_domain_xlate_onecell,
};
+static u32 gfpic_read(void __iomem *addr)
+{
+ return gf_ioread32(addr);
+}
+
+static void gfpic_write(u32 val, void __iomem *addr)
+{
+ gf_iowrite32(val, addr);
+}
+
static int __init goldfish_pic_of_init(struct device_node *of_node,
struct device_node *parent)
{
@@ -82,7 +93,7 @@ static int __init goldfish_pic_of_init(struct device_node *of_node,
}
/* Mask interrupts. */
- writel(1, gfpic->base + GFPIC_REG_IRQ_DISABLE_ALL);
+ gf_iowrite32(1, gfpic->base + GFPIC_REG_IRQ_DISABLE_ALL);
gc = irq_alloc_generic_chip("GFPIC", 1, GFPIC_IRQ_BASE, gfpic->base,
handle_level_irq);
@@ -92,6 +103,9 @@ static int __init goldfish_pic_of_init(struct device_node *of_node,
goto out_iounmap;
}
+ gc->reg_readl = gfpic_read;
+ gc->reg_writel = gfpic_write;
+
ct = gc->chip_types;
ct->regs.enable = GFPIC_REG_IRQ_ENABLE;
ct->regs.disable = GFPIC_REG_IRQ_DISABLE;
--
2.55.0.979.g7e5102b832-goog
next prev parent reply other threads:[~2026-09-08 9:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 9:40 [PATCH 0/6] m68k: virt: Switch to generic goldfish PIC driver Kuan-Wei Chiu
2026-09-08 9:40 ` Kuan-Wei Chiu [this message]
2026-09-08 9:40 ` [PATCH 2/6] irqchip/goldfish-pic: Use for_each_set_bit() to iterate pending IRQ Kuan-Wei Chiu
2026-09-08 9:40 ` [PATCH 3/6] irqchip/goldfish-pic: Allow selecting CONFIG_GOLDFISH_PIC on other architectures Kuan-Wei Chiu
2026-09-08 9:40 ` [PATCH 4/6] irqchip/goldfish-pic: Add goldfish_pic_init() for non DT platforms Kuan-Wei Chiu
2026-09-08 9:40 ` [PATCH 5/6] m68k/irq: Add empty irq_eoi callback to auto/user IRQ chips Kuan-Wei Chiu
2026-09-08 9:40 ` [PATCH 6/6] m68k: virt: Switch to generic goldfish-pic driver Kuan-Wei Chiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908094016.1997918-2-visitorckw@gmail.com \
--to=visitorckw@gmail.com \
--cc=edwardwchen@google.com \
--cc=eleanor15x@gmail.com \
--cc=geert@linux-m68k.org \
--cc=jamiechen@google.com \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=marscheng@google.com \
--cc=miodrag.dinic@mips.com \
--cc=radu@rendec.net \
--cc=tglx@kernel.org \
--cc=zewenchen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®