From: Marc Zyngier <marc.zyngier@arm.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
sudeep.holla@arm.com, tglx@linutronix.de, jason@lakedaemon.net
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
rnayak@codeaurora.org, bjorn.andersson@linaro.org,
sboyd@kernel.org, nicolas.dechesne@linaro.org
Subject: Re: [RFC PATCH] irqchip/gic-v3: Add quirk for msm8996 secured registers
Date: Wed, 13 Jun 2018 13:59:40 +0100 [thread overview]
Message-ID: <2d866cd1-59a4-befb-b2de-b91f9e56804a@arm.com> (raw)
In-Reply-To: <20180613114340.32550-1-srinivas.kandagatla@linaro.org>
On 13/06/18 12:43, Srinivas Kandagatla wrote:
> Access to GICR_WAKER is restricted on msm8996 SoC. Its been more
Restricted by what? Firmware? Hypervisor? (most likely the later).
> than 2 years of wait for this to be fixed in firmware which is
This surely bodes very well in this day and age, where firmware update
are becoming just as important as updating your kernel and your
userspace to fix security problems. I'm impressed.
> not going anywhere. So add a quirk to not write to this register.
> With this quirk MSM8996 can atleast boot out of mainline,
at least
> which can help community to work with boards based on MSM8996.
>
> Without this patch Qualcomm DB820c board reboots when GICR_WAKER
> is written to.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> drivers/irqchip/irq-gic-v3.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index 76ea56d779a1..d1bb2c0cce02 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -47,6 +47,8 @@ struct redist_region {
> bool single_redist;
> };
>
> +#define GICV3_FLAGS_WORKAROUND_IW_GICR_WAKER (1ULL << 0)
Drop the GICV3 prefix. What does IW means here? Please provide an
erratum number for this, and add a description to
Documentation/arm64/silicon-errata.txt.
> +
> struct gic_chip_data {
> struct fwnode_handle *fwnode;
> void __iomem *dist_base;
> @@ -55,6 +57,7 @@ struct gic_chip_data {
> struct irq_domain *domain;
> u64 redist_stride;
> u32 nr_redist_regions;
> + u64 flags;
> bool has_rss;
> unsigned int irq_nr;
> struct partition_desc *ppi_descs[16];
> @@ -139,6 +142,9 @@ static void gic_enable_redist(bool enable)
> u32 count = 1000000; /* 1s! */
> u32 val;
>
> + if (gic_data.flags & GICV3_FLAGS_WORKAROUND_IW_GICR_WAKER)
> + return;
> +
> rbase = gic_data_rdist_rd_base();
>
> val = readl_relaxed(rbase + GICR_WAKER);
> @@ -1064,6 +1070,31 @@ static const struct irq_domain_ops partition_domain_ops = {
> .select = gic_irq_domain_select,
> };
>
> +static bool __maybe_unused gicv3_enable_quirk_msm8996(void *data)
All the functions are prefixed with gic, not gicv3. The function name
should reflect the erratum number.
> +{
> + struct gic_chip_data *d = data;
> +
> + d->flags |= GICV3_FLAGS_WORKAROUND_IW_GICR_WAKER;
> +
> + return true;
> +}
> +
> +static const struct gic_quirk gicv3_quirks[] = {
> + {
> + .desc = "GICV3: Qualcomm MSM8996 WAKER IW",
Please the erratum number in the message. It should read something like:
"GICv3: Qualcomm erratum BIGNUMBERHERE"
> + .iidr = 0x00001070, /* MSM8996 */
> + .mask = 0x0000ffff,
Please match the full GICD_IIDR register, not just the implementer and
the revision. Unless you expect all the QC systems to have the same
behaviour?
> + .init = gicv3_enable_quirk_msm8996,
> + },
> +};
> +
> +static void gic_v3_enable_quirks(struct gic_chip_data *gic_data)
gic, not gic_v3.
> +{
> + u32 iidr = readl_relaxed(gic_data->dist_base + GICD_IIDR);
> +
> + gic_enable_quirks(iidr, gicv3_quirks, gic_data);
> +}
> +
> static int __init gic_init_bases(void __iomem *dist_base,
> struct redist_region *rdist_regs,
> u32 nr_redist_regions,
> @@ -1126,6 +1157,7 @@ static int __init gic_init_bases(void __iomem *dist_base,
> if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis())
> its_init(handle, &gic_data.rdists, gic_data.domain);
>
> + gic_v3_enable_quirks(&gic_data);
> gic_smp_init();
> gic_dist_init();
> gic_cpu_init();
>
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2018-06-13 12:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 11:43 [RFC PATCH] irqchip/gic-v3: Add quirk for msm8996 secured registers Srinivas Kandagatla
2018-06-13 12:59 ` Marc Zyngier [this message]
2018-06-14 17:54 ` Srinivas Kandagatla
2018-06-14 20:33 ` Stephen Boyd
2018-06-15 8:16 ` Marc Zyngier
2018-06-15 17:53 ` Stephen Boyd
2018-06-26 20:28 ` Bjorn Andersson
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=2d866cd1-59a4-befb-b2de-b91f9e56804a@arm.com \
--to=marc.zyngier@arm.com \
--cc=bjorn.andersson@linaro.org \
--cc=jason@lakedaemon.net \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.dechesne@linaro.org \
--cc=rnayak@codeaurora.org \
--cc=sboyd@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
/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