From: Lecopzer Chen <lecopzer.chen@mediatek.com>
To: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <tglx@linutronix.de>,
<maz@kernel.org>
Cc: <julien.thierry@arm.com>, <lecopzer@gmail.com>,
<yj.chiang@mediatek.com>,
Lecopzer Chen <lecopzer.chen@mediatek.com>
Subject: [PATCH] irqchip/gic-v3: Fix IPRIORITYR can't perform byte operations in GIC-600
Date: Tue, 30 Mar 2021 18:06:19 +0800 [thread overview]
Message-ID: <20210330100619.24747-1-lecopzer.chen@mediatek.com> (raw)
When pseudo-NMI enabled, register_nmi() set priority of specific IRQ
by byte ops, and this doesn't work in GIC-600.
We have asked ARM Support [1]:
> Please refer to following description in
> "2.1.2 Distributor ACE-Lite slave interface" of GIC-600 TRM for
> the GIC600 ACE-lite slave interface supported sizes:
> "The GIC-600 only accepts single beat accesses of the sizes for
> each register that are shown in the Programmers model,
> see Chapter 4 Programmer's model on page 4-102.
> All other accesses are rejected and given either an
> OKAY or SLVERR response that is based on the GICT_ERR0CTLR.UE bit.".
Thus the register needs to be written by double word operation and
the step will be: read 32bit, set byte and write it back.
[1] https://services.arm.com/support/s/case/5003t00001L4Pba
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
---
drivers/irqchip/irq-gic-v3.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index eb0ee356a629..cfc5a6ad30dc 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -440,10 +440,21 @@ static void gic_irq_set_prio(struct irq_data *d, u8 prio)
{
void __iomem *base = gic_dist_base(d);
u32 offset, index;
+ u32 val, prio_offset_mask, prio_offset_shift;
offset = convert_offset_index(d, GICD_IPRIORITYR, &index);
- writeb_relaxed(prio, base + offset + index);
+ /*
+ * GIC-600 memory mapping register doesn't support byte opteration,
+ * thus read 32-bits from register, set bytes and wtire back to it.
+ */
+ prio_offset_shift = (index & 0x3) * 8;
+ prio_offset_mask = GENMASK(prio_offset_shift + 7, prio_offset_shift);
+ index &= ~0x3;
+ val = readl_relaxed(base + offset + index);
+ val &= ~prio_offset_mask;
+ val |= prio << prio_offset_shift;
+ writel_relaxed(val, base + offset + index);
}
static u32 gic_get_ppi_index(struct irq_data *d)
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2021-03-30 10:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 10:06 Lecopzer Chen [this message]
2021-03-30 10:33 ` [PATCH] irqchip/gic-v3: Fix IPRIORITYR can't perform byte operations in GIC-600 Marc Zyngier
2021-03-30 11:05 ` Lorenzo Pieralisi
2021-03-30 13:06 ` Lorenzo Pieralisi
2021-03-30 14:11 ` Marc Zyngier
2021-03-30 14:24 ` Lecopzer Chen
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=20210330100619.24747-1-lecopzer.chen@mediatek.com \
--to=lecopzer.chen@mediatek.com \
--cc=julien.thierry@arm.com \
--cc=lecopzer@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
--cc=yj.chiang@mediatek.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;
as well as URLs for NNTP newsgroup(s).