Re: [PATCH 2/2] irqchip: irq-qcom-mpm: Support passing a slice of SRAM as reg space

From: Shawn Guo
Date: Wed Mar 29 2023 - 21:35:02 EST


On Wed, Mar 29, 2023 at 03:30:12PM +0200, Konrad Dybcio wrote:
> >>>> @@ -374,9 +377,21 @@ static int qcom_mpm_init(struct device_node *np, struct device_node *parent)
> >>>>
> >>>> raw_spin_lock_init(&priv->lock);
> >>>>
> >>>> - priv->base = devm_platform_ioremap_resource(pdev, 0);
> >>>> - if (IS_ERR(priv->base))
> >>>> - return PTR_ERR(priv->base);
> >>>> + /* If we have a handle to an RPM message ram partition, use it. */
> >>>> + msgram_np = of_parse_phandle(np, "qcom,rpm-msg-ram", 0);
> >>>> + if (msgram_np) {
> >>>> + ret = of_address_to_resource(msgram_np, 0, &res);
> >>>> + /* Don't use devm_ioremap_resource, as we're accessing a shared region. */
> >>>> + priv->base = ioremap(res.start, resource_size(&res));
> >>>
> >>> Are you suggesting that other cores/drivers will also need to access
> >>> the mpm slice below?
> >>>
> >>> apss_mpm: sram@1b8 {
> >>> reg = <0x1b8 0x48>;
> >>> };
> >> Yes, the RPM M3 core. Other slices may be accessed
> >> by any core at any time.
> >
> > Hmm, let me reword my question. Other than irq-qcom-mpm, is there any
> > other Linux drivers that also need to request this slice region?
> No.
>
> > Otherwise, I do not understand why devm_ioremap_resource() cannot be
> > used.
> drivers/rpmsg/qcom_glink_rpm.c calls devm_ioremap on the entire
> RPM MSG RAM.

Can we use devm_ioremap() too instead of ioremap() here?

Shawn