LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH] ASoC: fsl: imx-pcm-dma: Don't request dma channel in probe
From: Robin Gong @ 2021-04-19  7:17 UTC (permalink / raw)
  To: Lucas Stach, Shengjiu Wang
  Cc: Nicolin Chen, Linux-ALSA, Liam Girdwood, s.hauer@pengutronix.de,
	Timur Tabi, Xiubo Li, shawnguo@kernel.org, S.j. Wang,
	linux-kernel, dri-devel@lists.freedesktop.org, Takashi Iwai,
	linaro-mm-sig@lists.linaro.org, Mark Brown, dl-linux-imx,
	kernel@pengutronix.de, Fabio Estevam, perex@perex.cz,
	linuxppc-dev@lists.ozlabs.org, sumit.semwal@linaro.org,
	linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org
In-Reply-To: <50ef17a2d57b022c48bbca71fd4e074cc3ca9be5.camel@pengutronix.de>

Hi Lucas,

On 2021/04/14 Lucas Stach <l.stach@pengutronix.de> wrote:
> Hi Robin,
> 
> Am Mittwoch, dem 14.04.2021 um 14:33 +0000 schrieb Robin Gong:
> > On 2020/05/20 17:43 Lucas Stach <l.stach@pengutronix.de> wrote:
> > > Am Mittwoch, den 20.05.2020, 16:20 +0800 schrieb Shengjiu Wang:
> > > > Hi
> > > >
> > > > On Tue, May 19, 2020 at 6:04 PM Lucas Stach
> > > > <l.stach@pengutronix.de>
> > > wrote:
> > > > > Am Dienstag, den 19.05.2020, 17:41 +0800 schrieb Shengjiu Wang:
> > > > > > There are two requirements that we need to move the request of
> > > > > > dma channel from probe to open.
> > > > >
> > > > > How do you handle -EPROBE_DEFER return code from the channel
> > > > > request if you don't do it in probe?
> > > >
> > > > I use the dma_request_slave_channel or dma_request_channel instead
> > > > of dmaengine_pcm_request_chan_of. so there should be not
> > > > -EPROBE_DEFER return code.
> > >
> > > This is a pretty weak argument. The dmaengine device might probe
> > > after you try to get the channel. Using a function to request the
> > > channel that doesn't allow you to handle probe deferral is IMHO a
> > > bug and should be fixed, instead of building even more assumptions on top
> of it.
> > >
> > > > > > - When dma device binds with power-domains, the power will be
> > > > > > enabled when we request dma channel. If the request of dma
> > > > > > channel happen on probe, then the power-domains will be always
> > > > > > enabled after kernel boot up,  which is not good for power
> > > > > > saving,  so we need to move the request of dma channel to
> > > > > > .open();
> > > > >
> > > > > This is certainly something which could be fixed in the
> > > > > dmaengine driver.
> > > >
> > > > Dma driver always call the pm_runtime_get_sync in
> > > > device_alloc_chan_resources, the device_alloc_chan_resources is
> > > > called when channel is requested. so power is enabled on channel
> request.
> > >
> > > So why can't you fix the dmaengine driver to do that RPM call at a
> > > later time when the channel is actually going to be used? This will
> > > allow further power savings with other slave devices than the audio PCM.
> > Hi Lucas,
> >   Thanks for your suggestion. I have tried to implement runtime
> > autosuspend in fsl-edma driver on i.mx8qm/qxp with delay time (2 sec)
> > for this feature as below (or you can refer to
> > drivers/dma/qcom/hidma.c), and pm_runtime_get_sync/
> > pm_runtime_put_autosuspend in all dmaengine driver interface like
> > device_alloc_chan_resources/device_prep_slave_sg/device_prep_dma_cycli
> > c/
> > device_tx_status...
> >
> >
> >                 pm_runtime_use_autosuspend(fsl_chan->dev);
> >                 pm_runtime_set_autosuspend_delay(fsl_chan->dev,
> 2000);
> >
> > That could resolve this audio case since the autosuspend could suspend
> > runtime after
> > 2 seconds if there is no further dma transfer but only channel
> request(device_alloc_chan_resources).
> > But unfortunately, it cause another issue. As you know, on our
> > i.mx8qm/qxp, power domain done by scfw (drivers/firmware/imx/scu-pd.c)
> over mailbox:
> >  imx_sc_pd_power()->imx_scu_call_rpc()->
> > imx_scu_ipc_write()->mbox_send_message()
> > which means have to 'waits for completion', meanwhile, some driver
> > like tty will call dmaengine interfaces in non-atomic case as below,
> >
> > static int uart_write(struct tty_struct *tty, const unsigned char
> > *buf, int count) {
> >    .......
> > 	    port = uart_port_lock(state, flags);
> >    ......
> >         __uart_start(tty);  //call start_tx()->dmaengine_prep_slave_sg...
> >         uart_port_unlock(port, flags);
> >         return ret;
> > }
> >
> > Thus dma runtime resume may happen in that timing window and cause
> kernel alarm.
> > I'm not sure whether there are similar limitations on other driver
> > subsystem. But for me, It looks like the only way to resolve the
> > contradiction between tty and scu-pd (hardware limitation on
> > i.mx8qm/qxp) is to give up autosuspend and keep pm_runtime_get_sync
> only in device_alloc_chan_resources because request channel is a safe
> non-atomic phase.
> > Do you have any idea? Thanks in advance.
> 
> If you look closely at the driver you used as an example (hidma.c) it looks like
> there is already something in there, which looks very much like what you need
> here:
> 
> In hidma_issue_pending() the driver tries to get the device to runtime resume.
> If this doesn't work, maybe due to the power domain code not being able to
> be called in atomic context, the actual work of waking up the dma hardware
> and issuing the descriptor is shunted to a tasklet.
> 
> If I'm reading this right, this is exactly what you need here to be able to call the
> dmaengine code from atomic context: try the rpm get and issue immediately
> when possible, otherwise shunt the work to a non- atomic context where you
> can deal with the requirements of scu-pd.
Yes, I can schedule_work to worker to runtime resume edma channel by calling scu-pd.
But that means all dmaengine interfaces should be taken care, not only issue_pending()
but also dmaengine_terminate_all()/dmaengine_pause()/dmaengine_resume()/
dmaengine_tx_status(). Not sure why hidma only take care issue_pending. Maybe
their user case is just for memcpy/memset so that no further complicate case as ALSA
or TTY.
Besides, for autosuspend in cyclic, we have to add pm_runtime_get_sync into interrupt
handler as qcom/bam_dma.c. but how could resolve the scu-pd's non-atmoic limitation
in interrupt handler?  

> 
> Also you don't need the runtime resume in all of the functions you mentioned.
> From a quick look into the edma driver it looks like for example the
> prep_slave_dma() function only touches data structures in memory, so you
> don't actually need the device to be awake at that point. Only later in the flow
> when you write registers in the dma hardware and actually issue the transfer
> you need to wake the device from sleep.
Yes, don't need add pm_runtime_get_sync into prep_slave_dma, only care where
HW indeed touched like issue_pending()/terminated_all()/pause()/resume..etc.
 


^ permalink raw reply

* Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems
From: Ilias Apalodimas @ 2021-04-19  7:15 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Arnd Bergmann, Grygorii Strashko, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Matthew Wilcox,
	linux-mips@vger.kernel.org, linux-mm@kvack.org, David Laight,
	Jesper Dangaard Brouer, Matteo Croce,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20210419063441.GA18787@lst.de>

Hi Christoph,

On Mon, Apr 19, 2021 at 08:34:41AM +0200, Christoph Hellwig wrote:
> On Fri, Apr 16, 2021 at 04:27:55PM +0100, Matthew Wilcox wrote:
> > On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote:
> > > See below patch.  Where I swap32 the dma address to satisfy
> > > page->compound having bit zero cleared. (It is the simplest fix I could
> > > come up with).
> > 
> > I think this is slightly simpler, and as a bonus code that assumes the
> > old layout won't compile.
> 
> So, why do we even do this crappy overlay of a dma address?  This just
> all seems like a giant hack.  Random subsystems should not just steal
> a few struct page fields as that just turns into the desasters like the
> one we've seen here or probably something worse next time.

The page pool API was using page->private in the past to store these kind of
info. That caused a problem to begin with, since it would fail  on 32-bit
systems with 64bit DMA.  We had a similar discussion on the past but decided
struct page is the right place to store that [1].

Another advantage is that we can now use the information from the networking 
subsystem and enable recycling of SKBs and SKB fragments, by using the stored 
metadata of struct page [2].

[1] https://lore.kernel.org/netdev/20190207.132519.1698007650891404763.davem@davemloft.net/
[2] https://lore.kernel.org/netdev/20210409223801.104657-1-mcroce@linux.microsoft.com/

Cheers
/Ilias

^ permalink raw reply

* [powerpc/merge] Build failure arch/powerpc/kernel/fadump.c
From: Sachin Sant @ 2021-04-19  7:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: sxwjean

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

powerpc/merge branch(commit e4361a664e) fails to build with following error:

  CC      arch/powerpc/kernel/fadump.o
arch/powerpc/kernel/fadump.c: In function 'crash_fadump':
arch/powerpc/kernel/fadump.c:731:28: error: 'INTERRUPT_SYSTEM_RESET' undeclared (first use in this function); did you mean 'EEH_PE_STATE_RESET'?
  if (TRAP(&(fdh->regs)) == INTERRUPT_SYSTEM_RESET) {
                            ^~~~~~~~~~~~~~~~~~~~~~
                            EEH_PE_STATE_RESET
arch/powerpc/kernel/fadump.c:731:28: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.build:271: arch/powerpc/kernel/fadump.o] Error 1
make[1]: *** [scripts/Makefile.build:514: arch/powerpc/kernel] Error 2
make: *** [Makefile:1851: arch/powerpc] Error 2

The macro in question was introduced by

commit 7153d4bf0b373428d0393c001019da4d0483fddb
powerpc/traps: Enhance readability for trap types

Have attached kernel config.

Thanks
- Sachin


[-- Attachment #2: config.txt.gz --]
[-- Type: application/x-gzip, Size: 42947 bytes --]

^ permalink raw reply

* Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems
From: Christoph Hellwig @ 2021-04-19  6:34 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Arnd Bergmann, Grygorii Strashko, netdev@vger.kernel.org,
	Ilias Apalodimas, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org, linux-mm@kvack.org, David Laight,
	Jesper Dangaard Brouer, Matteo Croce,
	linuxppc-dev@lists.ozlabs.org, Christoph Hellwig,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20210416152755.GL2531743@casper.infradead.org>

On Fri, Apr 16, 2021 at 04:27:55PM +0100, Matthew Wilcox wrote:
> On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote:
> > See below patch.  Where I swap32 the dma address to satisfy
> > page->compound having bit zero cleared. (It is the simplest fix I could
> > come up with).
> 
> I think this is slightly simpler, and as a bonus code that assumes the
> old layout won't compile.

So, why do we even do this crappy overlay of a dma address?  This just
all seems like a giant hack.  Random subsystems should not just steal
a few struct page fields as that just turns into the desasters like the
one we've seen here or probably something worse next time.

^ permalink raw reply

* Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match
From: Dominique MARTINET @ 2021-04-19  5:02 UTC (permalink / raw)
  To: Alice Guo (OSS)
  Cc: ulf.hansson, aymen.sghaier, geert+renesas, rafael, airlied,
	mturquette, dri-devel, linux-kernel, a.hajda, netdev, linux-phy,
	will, linux-clk, linux-renesas-soc, wim, herbert, horia.geanta,
	khilman, joro, narmstrong, linux-staging, iommu, peter.ujfalusi,
	kishon, tony, linux-omap, stern, kuba, linus.walleij, linux,
	linux-media, linux-watchdog, Roy.Pledge, linux-pm, linuxppc-dev,
	edubezval, linux-gpio, linux-mediatek, ssantosh, matthias.bgg,
	linux-amlogic, mchehab, linux-arm-kernel, balbi, tomba, sboyd,
	gregkh, linux-usb, linux-mmc, adrian.hunter, robert.foss,
	leoyang.li, linux, vkoul, linux-crypto, daniel, j-keerthy,
	dmaengine, jyri.sarha, davem
In-Reply-To: <20210419042722.27554-4-alice.guo@oss.nxp.com>

Alice Guo (OSS) wrote on Mon, Apr 19, 2021 at 12:27:22PM +0800:
> From: Alice Guo <alice.guo@nxp.com>
> 
> Update all the code that use soc_device_match

A single patch might be difficult to accept for all components, a each
maintainer will probably want to have a say on their subsystem?

I would suggest to split these for a non-RFC version; a this will really
need to be case-by-case handling.

> because add support for soc_device_match returning -EPROBE_DEFER.

(English does not parse here for me)

I've only commented a couple of places in the code itself, but this
doesn't seem to add much support for errors, just sweep the problem
under the rug.

> Signed-off-by: Alice Guo <alice.guo@nxp.com>
> ---
> 
> diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
> index 5fae60f8c135..00c59aa217c1 100644
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -2909,7 +2909,7 @@ static int sysc_init_soc(struct sysc *ddata)
>  	}
>  
>  	match = soc_device_match(sysc_soc_feat_match);
> -	if (!match)
> +	if (!match || IS_ERR(match))
>  		return 0;

This function handles errors, I would recommend returning the error as
is if soc_device_match returned one so the probe can be retried later.

>  
>  	if (match->data)
> diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> index c32d2c678046..90a18336a4c3 100644
> --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
> +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> @@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[] __initconst = {
>  
>  static int __init r8a7795_cpg_mssr_init(struct device *dev)
>  {
> +	const struct soc_device_attribute *match;
>  	const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
>  	u32 cpg_mode;
>  	int error;
> @@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev)
>  		return -EINVAL;
>  	}
>  
> -	if (soc_device_match(r8a7795es1)) {
> +	match = soc_device_match(r8a7795es1);
> +	if (!IS_ERR(match) && match) {

Same, return the error.
Assuming an error means no match will just lead to hard to debug
problems because the driver potentially assumed the wrong device when
it's just not ready yet.

>  		cpg_core_nullify_range(r8a7795_core_clks,
>  				       ARRAY_SIZE(r8a7795_core_clks),
>  				       R8A7795_CLK_S0D2, R8A7795_CLK_S0D12);
> [...]
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index eaaec0a55cc6..13a06b613379 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -757,17 +757,20 @@ static const char * const devices_allowlist[] = {
>  
>  static bool ipmmu_device_is_allowed(struct device *dev)
>  {
> +	const struct soc_device_attribute *match1, *match2;
>  	unsigned int i;
>  
>  	/*
>  	 * R-Car Gen3 and RZ/G2 use the allow list to opt-in devices.
>  	 * For Other SoCs, this returns true anyway.
>  	 */
> -	if (!soc_device_match(soc_needs_opt_in))
> +	match1 = soc_device_match(soc_needs_opt_in);
> +	if (!IS_ERR(match1) && !match1)

I'm not sure what you intended to do, but !match1 already means there is
no error so the original code is identical.

In this case ipmmu_device_is_allowed does not allow errors so this is
one of the "difficult" drivers that require slightly more thinking.
It is only called in ipmmu_of_xlate which does return errors properly,
so in this case the most straightforward approach would be to make
ipmmu_device_is_allowed return an int and forward errors as well.



...
This is going to need quite some more work to be acceptable, in my
opinion, but I think it should be possible.

Thanks,
-- 
Dominique

^ permalink raw reply

* Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match
From: Leon Romanovsky @ 2021-04-19  5:02 UTC (permalink / raw)
  To: Alice Guo (OSS)
  Cc: ulf.hansson, aymen.sghaier, geert+renesas, rafael, airlied,
	mturquette, dri-devel, linux-kernel, a.hajda, netdev, linux-phy,
	will, linux-clk, linux-renesas-soc, wim, herbert, horia.geanta,
	khilman, joro, narmstrong, linux-staging, iommu, peter.ujfalusi,
	kishon, tony, linux-omap, stern, kuba, linus.walleij, linux,
	linux-media, linux-watchdog, Roy.Pledge, linux-pm, linuxppc-dev,
	edubezval, linux-gpio, linux-mediatek, ssantosh, matthias.bgg,
	linux-amlogic, mchehab, linux-arm-kernel, balbi, tomba, sboyd,
	gregkh, linux-usb, linux-mmc, adrian.hunter, robert.foss,
	leoyang.li, linux, vkoul, linux-crypto, daniel, j-keerthy,
	dmaengine, jyri.sarha, davem
In-Reply-To: <20210419042722.27554-4-alice.guo@oss.nxp.com>

On Mon, Apr 19, 2021 at 12:27:22PM +0800, Alice Guo (OSS) wrote:
> From: Alice Guo <alice.guo@nxp.com>
> 
> Update all the code that use soc_device_match because add support for
> soc_device_match returning -EPROBE_DEFER.
> 
> Signed-off-by: Alice Guo <alice.guo@nxp.com>
> ---
>  drivers/bus/ti-sysc.c                         |  2 +-
>  drivers/clk/renesas/r8a7795-cpg-mssr.c        |  4 +++-
>  drivers/clk/renesas/rcar-gen2-cpg.c           |  2 +-
>  drivers/clk/renesas/rcar-gen3-cpg.c           |  2 +-
>  drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c       |  7 ++++++-
>  drivers/dma/ti/k3-psil.c                      |  3 +++
>  drivers/dma/ti/k3-udma.c                      |  2 +-
>  drivers/gpu/drm/bridge/nwl-dsi.c              |  2 +-
>  drivers/gpu/drm/meson/meson_drv.c             |  4 +++-
>  drivers/gpu/drm/omapdrm/dss/dispc.c           |  2 +-
>  drivers/gpu/drm/omapdrm/dss/dpi.c             |  4 +++-
>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  3 +++
>  drivers/gpu/drm/omapdrm/dss/dss.c             |  3 +++
>  drivers/gpu/drm/omapdrm/dss/hdmi4_core.c      |  3 +++
>  drivers/gpu/drm/omapdrm/dss/venc.c            |  4 +++-
>  drivers/gpu/drm/omapdrm/omap_drv.c            |  3 +++
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c        |  4 +++-
>  drivers/gpu/drm/rcar-du/rcar_lvds.c           |  2 +-
>  drivers/gpu/drm/tidss/tidss_dispc.c           |  4 +++-
>  drivers/iommu/ipmmu-vmsa.c                    |  7 +++++--
>  drivers/media/platform/rcar-vin/rcar-core.c   |  2 +-
>  drivers/media/platform/rcar-vin/rcar-csi2.c   |  2 +-
>  drivers/media/platform/vsp1/vsp1_uif.c        |  4 +++-
>  drivers/mmc/host/renesas_sdhi_core.c          |  2 +-
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c |  2 +-
>  drivers/mmc/host/sdhci-of-esdhc.c             | 21 ++++++++++++++-----
>  drivers/mmc/host/sdhci-omap.c                 |  2 +-
>  drivers/mmc/host/sdhci_am654.c                |  2 +-
>  drivers/net/ethernet/renesas/ravb_main.c      |  4 +++-
>  drivers/net/ethernet/ti/am65-cpsw-nuss.c      |  2 +-
>  drivers/net/ethernet/ti/cpsw.c                |  2 +-
>  drivers/net/ethernet/ti/cpsw_new.c            |  2 +-
>  drivers/phy/ti/phy-omap-usb2.c                |  4 +++-
>  drivers/pinctrl/renesas/core.c                |  2 +-
>  drivers/pinctrl/renesas/pfc-r8a7790.c         |  5 ++++-
>  drivers/pinctrl/renesas/pfc-r8a7794.c         |  5 ++++-
>  drivers/soc/fsl/dpio/dpio-driver.c            | 13 ++++++++----
>  drivers/soc/renesas/r8a774c0-sysc.c           |  5 ++++-
>  drivers/soc/renesas/r8a7795-sysc.c            |  2 +-
>  drivers/soc/renesas/r8a77990-sysc.c           |  5 ++++-
>  drivers/soc/ti/k3-ringacc.c                   |  2 +-
>  drivers/staging/mt7621-pci/pci-mt7621.c       |  2 +-
>  drivers/thermal/rcar_gen3_thermal.c           |  4 +++-
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c   | 10 +++++++--
>  drivers/usb/gadget/udc/renesas_usb3.c         |  2 +-
>  drivers/usb/host/ehci-platform.c              |  4 +++-
>  drivers/usb/host/xhci-rcar.c                  |  2 +-
>  drivers/watchdog/renesas_wdt.c                |  2 +-
>  48 files changed, 131 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
> index 5fae60f8c135..00c59aa217c1 100644
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -2909,7 +2909,7 @@ static int sysc_init_soc(struct sysc *ddata)
>  	}
>  
>  	match = soc_device_match(sysc_soc_feat_match);
> -	if (!match)
> +	if (!match || IS_ERR(match))
>  		return 0;
>  
>  	if (match->data)
> diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> index c32d2c678046..90a18336a4c3 100644
> --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
> +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> @@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[] __initconst = {
>  
>  static int __init r8a7795_cpg_mssr_init(struct device *dev)
>  {
> +	const struct soc_device_attribute *match;
>  	const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
>  	u32 cpg_mode;
>  	int error;
> @@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev)
>  		return -EINVAL;
>  	}
>  
> -	if (soc_device_match(r8a7795es1)) {
> +	match = soc_device_match(r8a7795es1);
> +	if (!IS_ERR(match) && match) {

"if (!IS_ERR_OR_NULL(match))" in all places.

Thanks

^ permalink raw reply

* Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER
From: Dominique MARTINET @ 2021-04-19  4:49 UTC (permalink / raw)
  To: Alice Guo (OSS)
  Cc: ulf.hansson, aymen.sghaier, geert+renesas, rafael, airlied,
	mturquette, dri-devel, linux-kernel, a.hajda, netdev, linux-phy,
	will, linux-clk, linux-renesas-soc, wim, herbert, horia.geanta,
	khilman, joro, narmstrong, linux-staging, iommu, peter.ujfalusi,
	kishon, tony, linux-omap, stern, kuba, linus.walleij, linux,
	linux-media, linux-watchdog, Roy.Pledge, linux-pm, linuxppc-dev,
	edubezval, linux-gpio, linux-mediatek, ssantosh, matthias.bgg,
	linux-amlogic, mchehab, linux-arm-kernel, balbi, tomba, sboyd,
	gregkh, linux-usb, linux-mmc, adrian.hunter, robert.foss,
	leoyang.li, linux, vkoul, linux-crypto, daniel, j-keerthy,
	dmaengine, jyri.sarha, davem
In-Reply-To: <20210419042722.27554-2-alice.guo@oss.nxp.com>

First comment overall for the whole serie:
Since it is the solution I had suggested when I reported the problem[1]
I have no qualm on the approach, comments for individual patches
follow.

[1] http://lore.kernel.org/r/YGGZJjAxA1IO+/VU@atmark-techno.com


Alice Guo (OSS) wrote on Mon, Apr 19, 2021 at 12:27:20PM +0800:
> From: Alice Guo <alice.guo@nxp.com>
> 
> In i.MX8M boards, the registration of SoC device is later than caam
> driver which needs it. Caam driver needs soc_device_match to provide
> -EPROBE_DEFER when no SoC device is registered and no
> early_soc_dev_attr.

This patch should be last in the set: you can't have soc_device_match
return an error before its callers handle it.

> Signed-off-by: Alice Guo <alice.guo@nxp.com>

As the one who reported the problem I would have been appreciated being
at least added to Ccs... I only happened to notice you posted this by
chance.

There is also not a single Fixes tag -- I believe this commit should
have Fixes: 7d981405d0fd ("soc: imx8m: change to use platform driver")
but I'm not sure how such tags should be handled in case of multiple
patches fixing something.

-- 
Dominique

^ permalink raw reply

* [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match
From: Alice Guo (OSS) @ 2021-04-19  4:27 UTC (permalink / raw)
  To: gregkh, rafael, horia.geanta, aymen.sghaier, herbert, davem, tony,
	geert+renesas, mturquette, sboyd, vkoul, peter.ujfalusi, a.hajda,
	narmstrong, robert.foss, airlied, daniel, khilman, tomba,
	jyri.sarha, joro, will, mchehab, ulf.hansson, adrian.hunter,
	kishon, kuba, linus.walleij, Roy.Pledge, leoyang.li, ssantosh,
	matthias.bgg, edubezval, j-keerthy, balbi, linux, stern, wim,
	linux
  Cc: linux-usb, linux-watchdog, linux-gpio, netdev, linux-pm,
	linux-staging, linux-mmc, linux-kernel, dri-devel,
	linux-renesas-soc, linux-phy, iommu, linux-mediatek, linux-crypto,
	dmaengine, linux-amlogic, linux-omap, linuxppc-dev, linux-clk,
	linux-arm-kernel, linux-media
In-Reply-To: <20210419042722.27554-1-alice.guo@oss.nxp.com>

From: Alice Guo <alice.guo@nxp.com>

Update all the code that use soc_device_match because add support for
soc_device_match returning -EPROBE_DEFER.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
---
 drivers/bus/ti-sysc.c                         |  2 +-
 drivers/clk/renesas/r8a7795-cpg-mssr.c        |  4 +++-
 drivers/clk/renesas/rcar-gen2-cpg.c           |  2 +-
 drivers/clk/renesas/rcar-gen3-cpg.c           |  2 +-
 drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c       |  7 ++++++-
 drivers/dma/ti/k3-psil.c                      |  3 +++
 drivers/dma/ti/k3-udma.c                      |  2 +-
 drivers/gpu/drm/bridge/nwl-dsi.c              |  2 +-
 drivers/gpu/drm/meson/meson_drv.c             |  4 +++-
 drivers/gpu/drm/omapdrm/dss/dispc.c           |  2 +-
 drivers/gpu/drm/omapdrm/dss/dpi.c             |  4 +++-
 drivers/gpu/drm/omapdrm/dss/dsi.c             |  3 +++
 drivers/gpu/drm/omapdrm/dss/dss.c             |  3 +++
 drivers/gpu/drm/omapdrm/dss/hdmi4_core.c      |  3 +++
 drivers/gpu/drm/omapdrm/dss/venc.c            |  4 +++-
 drivers/gpu/drm/omapdrm/omap_drv.c            |  3 +++
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c        |  4 +++-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  2 +-
 drivers/gpu/drm/tidss/tidss_dispc.c           |  4 +++-
 drivers/iommu/ipmmu-vmsa.c                    |  7 +++++--
 drivers/media/platform/rcar-vin/rcar-core.c   |  2 +-
 drivers/media/platform/rcar-vin/rcar-csi2.c   |  2 +-
 drivers/media/platform/vsp1/vsp1_uif.c        |  4 +++-
 drivers/mmc/host/renesas_sdhi_core.c          |  2 +-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c |  2 +-
 drivers/mmc/host/sdhci-of-esdhc.c             | 21 ++++++++++++++-----
 drivers/mmc/host/sdhci-omap.c                 |  2 +-
 drivers/mmc/host/sdhci_am654.c                |  2 +-
 drivers/net/ethernet/renesas/ravb_main.c      |  4 +++-
 drivers/net/ethernet/ti/am65-cpsw-nuss.c      |  2 +-
 drivers/net/ethernet/ti/cpsw.c                |  2 +-
 drivers/net/ethernet/ti/cpsw_new.c            |  2 +-
 drivers/phy/ti/phy-omap-usb2.c                |  4 +++-
 drivers/pinctrl/renesas/core.c                |  2 +-
 drivers/pinctrl/renesas/pfc-r8a7790.c         |  5 ++++-
 drivers/pinctrl/renesas/pfc-r8a7794.c         |  5 ++++-
 drivers/soc/fsl/dpio/dpio-driver.c            | 13 ++++++++----
 drivers/soc/renesas/r8a774c0-sysc.c           |  5 ++++-
 drivers/soc/renesas/r8a7795-sysc.c            |  2 +-
 drivers/soc/renesas/r8a77990-sysc.c           |  5 ++++-
 drivers/soc/ti/k3-ringacc.c                   |  2 +-
 drivers/staging/mt7621-pci/pci-mt7621.c       |  2 +-
 drivers/thermal/rcar_gen3_thermal.c           |  4 +++-
 drivers/thermal/ti-soc-thermal/ti-bandgap.c   | 10 +++++++--
 drivers/usb/gadget/udc/renesas_usb3.c         |  2 +-
 drivers/usb/host/ehci-platform.c              |  4 +++-
 drivers/usb/host/xhci-rcar.c                  |  2 +-
 drivers/watchdog/renesas_wdt.c                |  2 +-
 48 files changed, 131 insertions(+), 52 deletions(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 5fae60f8c135..00c59aa217c1 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -2909,7 +2909,7 @@ static int sysc_init_soc(struct sysc *ddata)
 	}
 
 	match = soc_device_match(sysc_soc_feat_match);
-	if (!match)
+	if (!match || IS_ERR(match))
 		return 0;
 
 	if (match->data)
diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index c32d2c678046..90a18336a4c3 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[] __initconst = {
 
 static int __init r8a7795_cpg_mssr_init(struct device *dev)
 {
+	const struct soc_device_attribute *match;
 	const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
 	u32 cpg_mode;
 	int error;
@@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev)
 		return -EINVAL;
 	}
 
-	if (soc_device_match(r8a7795es1)) {
+	match = soc_device_match(r8a7795es1);
+	if (!IS_ERR(match) && match) {
 		cpg_core_nullify_range(r8a7795_core_clks,
 				       ARRAY_SIZE(r8a7795_core_clks),
 				       R8A7795_CLK_S0D2, R8A7795_CLK_S0D12);
diff --git a/drivers/clk/renesas/rcar-gen2-cpg.c b/drivers/clk/renesas/rcar-gen2-cpg.c
index edae874fa2b6..946f82634d23 100644
--- a/drivers/clk/renesas/rcar-gen2-cpg.c
+++ b/drivers/clk/renesas/rcar-gen2-cpg.c
@@ -383,7 +383,7 @@ int __init rcar_gen2_cpg_init(const struct rcar_gen2_cpg_pll_config *config,
 	cpg_pll0_div = pll0_div;
 	cpg_mode = mode;
 	attr = soc_device_match(cpg_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		cpg_quirks = (uintptr_t)attr->data;
 	pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
 
diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c
index caa0f9414e45..e5c7854188cd 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.c
+++ b/drivers/clk/renesas/rcar-gen3-cpg.c
@@ -499,7 +499,7 @@ int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
 	cpg_clk_extalr = clk_extalr;
 	cpg_mode = mode;
 	attr = soc_device_match(cpg_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		cpg_quirks = (uintptr_t)attr->data;
 	pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
 
diff --git a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
index 4ec909e0b810..7c83ae86ced4 100644
--- a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
+++ b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
@@ -651,6 +651,7 @@ static int dpaa2_dpdmai_init_channels(struct dpaa2_qdma_engine *dpaa2_qdma)
 
 static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
 {
+	const struct soc_device_attribute *match;
 	struct device *dev = &dpdmai_dev->dev;
 	struct dpaa2_qdma_engine *dpaa2_qdma;
 	struct dpaa2_qdma_priv *priv;
@@ -718,7 +719,11 @@ static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
 
 	dpaa2_dpdmai_init_channels(dpaa2_qdma);
 
-	if (soc_device_match(soc_fixup_tuning))
+	match = soc_device_match(soc_fixup_tuning);
+	if (IS_ERR(match))
+		return PTR_ERR(match);
+
+	if (match)
 		dpaa2_qdma->qdma_wrtype_fixup = true;
 	else
 		dpaa2_qdma->qdma_wrtype_fixup = false;
diff --git a/drivers/dma/ti/k3-psil.c b/drivers/dma/ti/k3-psil.c
index 13ce7367d870..ae56441e5184 100644
--- a/drivers/dma/ti/k3-psil.c
+++ b/drivers/dma/ti/k3-psil.c
@@ -33,6 +33,9 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
 		const struct soc_device_attribute *soc;
 
 		soc = soc_device_match(k3_soc_devices);
+		if (IS_ERR(soc))
+			return PTR_ERR(soc);
+
 		if (soc) {
 			soc_ep_map = soc->data;
 		} else {
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 96ad21869ba7..50a4c8f0993d 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -5188,7 +5188,7 @@ static int udma_probe(struct platform_device *pdev)
 	ud->match_data = match->data;
 
 	soc = soc_device_match(k3_soc_devices);
-	if (!soc) {
+	if (!IS_ERR(soc) && !soc) {
 		dev_err(dev, "No compatible SoC found\n");
 		return -ENODEV;
 	}
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 66b67402f1ac..80fe971e359d 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -1158,7 +1158,7 @@ static int nwl_dsi_probe(struct platform_device *pdev)
 	}
 
 	attr = soc_device_match(nwl_dsi_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		dsi->quirks = (uintptr_t)attr->data;
 
 	dsi->bridge.driver_private = dsi;
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 453d8b4c5763..d409c9958f18 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -195,6 +195,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	const struct meson_drm_match_data *match;
+	const struct soc_device_attribute *attr;
 	struct meson_drm *priv;
 	struct drm_device *drm;
 	struct resource *res;
@@ -291,7 +292,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	/* Assign limits per soc revision/package */
 	for (i = 0 ; i < ARRAY_SIZE(meson_drm_soc_attrs) ; ++i) {
-		if (soc_device_match(meson_drm_soc_attrs[i].attrs)) {
+		attr = soc_device_match(meson_drm_soc_attrs[i].attrs);
+		if (!IS_ERR(attr) && attr) {
 			priv->limits = &meson_drm_soc_attrs[i].limits;
 			break;
 		}
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 5619420cc2cc..53f402d72fc4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -4741,7 +4741,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 	 * string, use SoC device matching.
 	 */
 	soc = soc_device_match(dispc_soc_devices);
-	if (soc)
+	if (!IS_ERR(soc) && soc)
 		dispc->feat = soc->data;
 	else
 		dispc->feat = of_match_device(dispc_of_match, &pdev->dev)->data;
diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 030f997eccd0..57b1c62dcdf2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -677,12 +677,14 @@ static const struct soc_device_attribute dpi_soc_devices[] = {
 static int dpi_init_regulator(struct dpi_data *dpi)
 {
 	struct regulator *vdds_dsi;
+	struct soc_device_attribute *soc;
 
 	/*
 	 * The DPI uses the DSI VDDS on OMAP34xx, OMAP35xx, OMAP36xx, AM37xx and
 	 * DM37xx only.
 	 */
-	if (!soc_device_match(dpi_soc_devices))
+	soc = soc_device_match(dpi_soc_devices);
+	if (!IS_ERR(soc) && !soc)
 		return 0;
 
 	vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 5f1722b040f4..cbef6fb85d1d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4952,6 +4952,9 @@ static int dsi_probe(struct platform_device *pdev)
 	}
 
 	soc = soc_device_match(dsi_soc_devices);
+	if (IS_ERR(soc))
+		return PTR_ERR(soc);
+
 	if (soc)
 		dsi->data = soc->data;
 	else
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index d6a5862b4dbf..1f88d25d178b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1446,6 +1446,9 @@ static int dss_probe(struct platform_device *pdev)
 	 * string, use SoC device matching.
 	 */
 	soc = soc_device_match(dss_soc_devices);
+	if (IS_ERR(soc))
+		return PTR_ERR(soc);
+
 	if (soc)
 		dss->feat = soc->data;
 	else
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
index 35faa7f028c4..53a09cfd4deb 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
@@ -874,6 +874,9 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 	const struct soc_device_attribute *soc;
 
 	soc = soc_device_match(hdmi4_soc_devices);
+	if (IS_ERR(soc))
+		return PTR_ERR(soc);
+
 	if (!soc)
 		return -ENODEV;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index e522c17955d0..df6fa3977481 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -805,6 +805,7 @@ static const struct soc_device_attribute venc_soc_devices[] = {
 
 static int venc_probe(struct platform_device *pdev)
 {
+	const struct soc_device_attribute *match;
 	struct venc_device *venc;
 	struct resource *venc_mem;
 	int r;
@@ -818,7 +819,8 @@ static int venc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, venc);
 
 	/* The OMAP34xx, OMAP35xx and AM35xx VENC require the TV DAC clock. */
-	if (soc_device_match(venc_soc_devices))
+	match = soc_device_match(venc_soc_devices);
+	if (!IS_ERR(match) && match)
 		venc->requires_tv_dac_clk = true;
 
 	venc->config = &venc_config_pal_trm;
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 8632139e0f01..8542998f5e9e 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -576,6 +576,9 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	priv->dss->mgr_ops_priv = priv;
 
 	soc = soc_device_match(omapdrm_soc_devices);
+	if (IS_ERR(soc))
+		return PTR_ERR(soc);
+
 	priv->omaprev = soc ? (unsigned int)soc->data : 0;
 	priv->wq = alloc_ordered_workqueue("omapdrm", 0);
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index ea7e39d03545..06f5fd518326 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 	const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
 	struct rcar_du_device *rcdu = rcrtc->dev;
 	unsigned long mode_clock = mode->clock * 1000;
+	const struct soc_device_attribute *match;
 	u32 dsmr;
 	u32 escr;
 
@@ -238,7 +239,8 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 		 * no post-divider when a display PLL is present (as shown by
 		 * the workaround breaking HDMI output on M3-W during testing).
 		 */
-		if (soc_device_match(rcar_du_r8a7795_es1)) {
+		match = soc_device_match(rcar_du_r8a7795_es1);
+		if (!IS_ERR(match) && match) {
 			target *= 2;
 			div = 1;
 		}
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index 70dbbe44bb23..273c812a04e0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -912,7 +912,7 @@ static int rcar_lvds_probe(struct platform_device *pdev)
 	lvds->info = of_device_get_match_data(&pdev->dev);
 
 	attr = soc_device_match(lvds_quirk_matches);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		lvds->info = attr->data;
 
 	ret = rcar_lvds_parse_dt(lvds);
diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
index 60b92df615aa..8f083604e04f 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -2643,8 +2643,10 @@ static void dispc_init_errata(struct dispc_device *dispc)
 		{ .family = "AM65X", .revision = "SR1.0" },
 		{ /* sentinel */ }
 	};
+	const struct soc_device_attribute *match;
 
-	if (soc_device_match(am65x_sr10_soc_devices)) {
+	match = soc_device_match(am65x_sr10_soc_devices);
+	if (!IS_ERR(match) && match) {
 		dispc->errata.i2000 = true;
 		dev_info(dispc->dev, "WA for erratum i2000: YUV formats disabled\n");
 	}
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index eaaec0a55cc6..13a06b613379 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -757,17 +757,20 @@ static const char * const devices_allowlist[] = {
 
 static bool ipmmu_device_is_allowed(struct device *dev)
 {
+	const struct soc_device_attribute *match1, *match2;
 	unsigned int i;
 
 	/*
 	 * R-Car Gen3 and RZ/G2 use the allow list to opt-in devices.
 	 * For Other SoCs, this returns true anyway.
 	 */
-	if (!soc_device_match(soc_needs_opt_in))
+	match1 = soc_device_match(soc_needs_opt_in);
+	if (!IS_ERR(match1) && !match1)
 		return true;
 
 	/* Check whether this SoC can use the IPMMU correctly or not */
-	if (soc_device_match(soc_denylist))
+	match2 = soc_device_match(soc_denylist);
+	if (!IS_ERR(match2) && !match2)
 		return false;
 
 	/* Check whether this device can work with the IPMMU */
diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index cb3025992817..37afc4b169c1 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -1413,7 +1413,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
 	 * uses different routing than r8a7795 ES2.0.
 	 */
 	attr = soc_device_match(r8a7795es1);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		vin->info = attr->data;
 
 	vin->base = devm_platform_ioremap_resource(pdev, 0);
diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
index e06cd512aba2..b83200e8e30d 100644
--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
@@ -1214,7 +1214,7 @@ static int rcsi2_probe(struct platform_device *pdev)
 	 * share the same compatible string.
 	 */
 	attr = soc_device_match(r8a7795);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		priv->info = attr->data;
 
 	priv->dev = &pdev->dev;
diff --git a/drivers/media/platform/vsp1/vsp1_uif.c b/drivers/media/platform/vsp1/vsp1_uif.c
index 467d1072577b..e5c5b4f50dea 100644
--- a/drivers/media/platform/vsp1/vsp1_uif.c
+++ b/drivers/media/platform/vsp1/vsp1_uif.c
@@ -240,6 +240,7 @@ static const struct soc_device_attribute vsp1_r8a7796[] = {
 struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index)
 {
 	struct vsp1_uif *uif;
+	const struct soc_device_attribute *attr;
 	char name[6];
 	int ret;
 
@@ -247,7 +248,8 @@ struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index)
 	if (!uif)
 		return ERR_PTR(-ENOMEM);
 
-	if (soc_device_match(vsp1_r8a7796))
+	attr = soc_device_match(vsp1_r8a7796);
+	if (!IS_ERR(attr) && attr)
 		uif->m3w_quirk = true;
 
 	uif->entity.ops = &uif_entity_ops;
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 635bf31a6735..71986a8bf50e 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -964,7 +964,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	of_data = of_device_get_match_data(&pdev->dev);
 
 	attr = soc_device_match(sdhi_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		quirks = attr->data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index e8f4863d8f1a..946f57b3cc48 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -408,7 +408,7 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
 	const struct soc_device_attribute *soc = soc_device_match(soc_dma_quirks);
 	struct device *dev = &pdev->dev;
 
-	if (soc)
+	if (!IS_ERR(soc) && soc)
 		global_flags |= (unsigned long)soc->data;
 
 	/* value is max of SD_SECCNT. Confirmed by HW engineers */
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index ab5ab969f711..4259553451da 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1336,6 +1336,7 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 	struct sdhci_esdhc *esdhc;
 	struct device_node *np;
 	struct clk *clk;
+	const struct soc_device_attribute *match1, *match2, *match3;
 	u32 val;
 	u16 host_ver;
 
@@ -1346,17 +1347,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 	esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
 			     SDHCI_VENDOR_VER_SHIFT;
 	esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
-	if (soc_device_match(soc_incorrect_hostver))
+	match1 = soc_device_match(soc_incorrect_hostver);
+	if (!IS_ERR(match1) && match1)
 		esdhc->quirk_incorrect_hostver = true;
 	else
 		esdhc->quirk_incorrect_hostver = false;
 
-	if (soc_device_match(soc_fixup_sdhc_clkdivs))
+	match2 = soc_device_match(soc_fixup_sdhc_clkdivs);
+	if (!IS_ERR(match2) && match2)
 		esdhc->quirk_limited_clk_division = true;
 	else
 		esdhc->quirk_limited_clk_division = false;
 
-	if (soc_device_match(soc_unreliable_pulse_detection))
+	match3 = soc_device_match(soc_unreliable_pulse_detection);
+	if (!IS_ERR(match3) && match3)
 		esdhc->quirk_unreliable_pulse_detection = true;
 	else
 		esdhc->quirk_unreliable_pulse_detection = false;
@@ -1417,6 +1421,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 	struct device_node *np;
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_esdhc *esdhc;
+	const struct soc_device_attribute *match1, *match2;
 	int ret;
 
 	np = pdev->dev.of_node;
@@ -1443,12 +1448,18 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 
 	pltfm_host = sdhci_priv(host);
 	esdhc = sdhci_pltfm_priv(pltfm_host);
-	if (soc_device_match(soc_tuning_erratum_type1))
+	match1 = soc_device_match(soc_tuning_erratum_type1);
+	if (IS_ERR(match1))
+		return PTR_ERR(match1);
+	if (match1)
 		esdhc->quirk_tuning_erratum_type1 = true;
 	else
 		esdhc->quirk_tuning_erratum_type1 = false;
 
-	if (soc_device_match(soc_tuning_erratum_type2))
+	match2 = soc_device_match(soc_tuning_erratum_type2);
+	if (IS_ERR(match2))
+		return PTR_ERR(match2);
+	if (match2)
 		esdhc->quirk_tuning_erratum_type2 = true;
 	else
 		esdhc->quirk_tuning_erratum_type2 = false;
diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 7893fd3599b6..5a6f2b22eb42 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1132,7 +1132,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
 		goto err_pltfm_free;
 
 	soc = soc_device_match(sdhci_omap_soc_devices);
-	if (soc) {
+	if (!IS_ERR(soc) && soc) {
 		omap_host->version = "rev11";
 		if (!strcmp(dev_name(dev), "4809c000.mmc"))
 			mmc->f_max = 96000000;
diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 1fad6e442688..c0d1a0eab939 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -787,7 +787,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
 
 	/* Update drvdata based on SoC revision */
 	soc = soc_device_match(sdhci_am654_devices);
-	if (soc && soc->data)
+	if (!IS_ERR(soc) && soc && soc->data)
 		drvdata = soc->data;
 
 	host = sdhci_pltfm_init(pdev, drvdata->pdata, sizeof(*sdhci_am654));
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 8c84c40ab9a0..f9e1cafe9b1a 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1016,6 +1016,7 @@ static int ravb_phy_init(struct net_device *ndev)
 	struct ravb_private *priv = netdev_priv(ndev);
 	struct phy_device *phydev;
 	struct device_node *pn;
+	const struct soc_device_attribute *soc;
 	phy_interface_t iface;
 	int err;
 
@@ -1049,7 +1050,8 @@ static int ravb_phy_init(struct net_device *ndev)
 	/* This driver only support 10/100Mbit speeds on R-Car H3 ES1.0
 	 * at this time.
 	 */
-	if (soc_device_match(r8a7795es10)) {
+	soc = soc_device_match(r8a7795es10);
+	if (!IS_ERR(soc) && soc) {
 		err = phy_set_max_speed(phydev, SPEED_100);
 		if (err) {
 			netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n");
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 6a67b026df0b..01c1e5b573fa 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -2596,7 +2596,7 @@ static void am65_cpsw_nuss_apply_socinfo(struct am65_cpsw_common *common)
 	const struct soc_device_attribute *soc;
 
 	soc = soc_device_match(am65_cpsw_socinfo);
-	if (soc && soc->data) {
+	if (!IS_ERR(soc) && soc && soc->data) {
 		const struct am65_cpsw_soc_pdata *socdata = soc->data;
 
 		/* disable quirks */
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c0cd7de88316..12bb62ed0fe9 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1579,7 +1579,7 @@ static int cpsw_probe(struct platform_device *pdev)
 		goto clean_dt_ret;
 
 	soc = soc_device_match(cpsw_soc_devices);
-	if (soc)
+	if (!IS_ERR(soc) && soc)
 		cpsw->quirk_irq = true;
 
 	data = &cpsw->data;
diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
index 69b7a4e0220a..2b82a3e4a3cc 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -1925,7 +1925,7 @@ static int cpsw_probe(struct platform_device *pdev)
 		goto clean_dt_ret;
 
 	soc = soc_device_match(cpsw_soc_devices);
-	if (soc)
+	if (!IS_ERR(soc) && soc)
 		cpsw->quirk_irq = true;
 
 	cpsw->rx_packet_max = rx_packet_max;
diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index ebceb1520ce8..d7346d0ea9ed 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -348,6 +348,7 @@ static void omap_usb2_init_errata(struct omap_usb *phy)
 		{ .family = "AM65X", .revision = "SR1.0" },
 		{ /* sentinel */ }
 	};
+	const struct soc_device_attribute *soc;
 
 	/*
 	 * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
@@ -358,7 +359,8 @@ static void omap_usb2_init_errata(struct omap_usb *phy)
 	 * Disabling the USB2_PHY Charger Detect function will put D+
 	 * into the normal state.
 	 */
-	if (soc_device_match(am65x_sr10_soc_devices))
+	soc = soc_device_match(am65x_sr10_soc_devices);
+	if (!IS_ERR(soc) && soc)
 		phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
 }
 
diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c
index 5ccc49b387f1..758444e0a620 100644
--- a/drivers/pinctrl/renesas/core.c
+++ b/drivers/pinctrl/renesas/core.c
@@ -1102,7 +1102,7 @@ static const void *sh_pfc_quirk_match(void)
 	};
 
 	match = soc_device_match(quirks);
-	if (match)
+	if (!IS_ERR(match) && match)
 		return match->data ?: ERR_PTR(-ENODEV);
 #endif /* CONFIG_PINCTRL_PFC_R8A77950 || CONFIG_PINCTRL_PFC_R8A77951 */
 
diff --git a/drivers/pinctrl/renesas/pfc-r8a7790.c b/drivers/pinctrl/renesas/pfc-r8a7790.c
index e9a64e0e2734..57044d338fd5 100644
--- a/drivers/pinctrl/renesas/pfc-r8a7790.c
+++ b/drivers/pinctrl/renesas/pfc-r8a7790.c
@@ -5999,8 +5999,11 @@ static const struct soc_device_attribute r8a7790_tdsel[] = {
 
 static int r8a7790_pinmux_soc_init(struct sh_pfc *pfc)
 {
+	const struct soc_device_attribute *match;
+
 	/* Initialize TDSEL on old revisions */
-	if (soc_device_match(r8a7790_tdsel))
+	match = soc_device_match(r8a7790_tdsel);
+	if (!IS_ERR(match) && match)
 		sh_pfc_write(pfc, 0xe6060088, 0x00155554);
 
 	return 0;
diff --git a/drivers/pinctrl/renesas/pfc-r8a7794.c b/drivers/pinctrl/renesas/pfc-r8a7794.c
index 34481b6c4328..fb9a714dec1d 100644
--- a/drivers/pinctrl/renesas/pfc-r8a7794.c
+++ b/drivers/pinctrl/renesas/pfc-r8a7794.c
@@ -5587,8 +5587,11 @@ static const struct soc_device_attribute r8a7794_tdsel[] = {
 
 static int r8a7794_pinmux_soc_init(struct sh_pfc *pfc)
 {
+	const struct soc_device_attribute *match;
+
 	/* Initialize TDSEL on old revisions */
-	if (soc_device_match(r8a7794_tdsel))
+	match = soc_device_match(r8a7794_tdsel);
+	if (!IS_ERR(match) && match)
 		sh_pfc_write(pfc, 0xe6060068, 0x55555500);
 
 	return 0;
diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c
index 7f397b4ad878..01e3d1ca54df 100644
--- a/drivers/soc/fsl/dpio/dpio-driver.c
+++ b/drivers/soc/fsl/dpio/dpio-driver.c
@@ -55,14 +55,19 @@ static const struct soc_device_attribute lx2160a_soc[] = {
 
 static int dpaa2_dpio_get_cluster_sdest(struct fsl_mc_device *dpio_dev, int cpu)
 {
+	const struct soc_device_attribute *match1, *match2, *match3, *match4;
 	int cluster_base, cluster_size;
 
-	if (soc_device_match(ls1088a_soc)) {
+	match1 = soc_device_match(ls1088a_soc);
+	match2 = soc_device_match(ls2080a_soc);
+	match3 = soc_device_match(ls2088a_soc);
+	match4 = soc_device_match(lx2160a_soc);
+	if (!IS_ERR(match1) && match1) {
 		cluster_base = 2;
 		cluster_size = 4;
-	} else if (soc_device_match(ls2080a_soc) ||
-		   soc_device_match(ls2088a_soc) ||
-		   soc_device_match(lx2160a_soc)) {
+	} else if ((!IS_ERR(match2) && match2) ||
+		   (!IS_ERR(match3) && match3) ||
+		   (!IS_ERR(match4) && match4)) {
 		cluster_base = 0;
 		cluster_size = 2;
 	} else {
diff --git a/drivers/soc/renesas/r8a774c0-sysc.c b/drivers/soc/renesas/r8a774c0-sysc.c
index c1c216f7d073..6b0b092c1b45 100644
--- a/drivers/soc/renesas/r8a774c0-sysc.c
+++ b/drivers/soc/renesas/r8a774c0-sysc.c
@@ -36,7 +36,10 @@ static const struct soc_device_attribute r8a774c0[] __initconst = {
 
 static int __init r8a774c0_sysc_init(void)
 {
-	if (soc_device_match(r8a774c0)) {
+	const struct soc_device_attribute *match;
+
+	match = soc_device_match(r8a774c0);
+	if (!IS_ERR(match) && match) {
 		/* Fix incorrect 3DG hierarchy */
 		swap(r8a774c0_areas[6], r8a774c0_areas[7]);
 		r8a774c0_areas[6].parent = R8A774C0_PD_ALWAYS_ON;
diff --git a/drivers/soc/renesas/r8a7795-sysc.c b/drivers/soc/renesas/r8a7795-sysc.c
index 91074411b8cf..7d5dcfcb1d09 100644
--- a/drivers/soc/renesas/r8a7795-sysc.c
+++ b/drivers/soc/renesas/r8a7795-sysc.c
@@ -74,7 +74,7 @@ static int __init r8a7795_sysc_init(void)
 	u32 quirks = 0;
 
 	attr = soc_device_match(r8a7795_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		quirks = (uintptr_t)attr->data;
 
 	if (!(quirks & HAS_A2VC0))
diff --git a/drivers/soc/renesas/r8a77990-sysc.c b/drivers/soc/renesas/r8a77990-sysc.c
index 9f92737dc352..10353afe061d 100644
--- a/drivers/soc/renesas/r8a77990-sysc.c
+++ b/drivers/soc/renesas/r8a77990-sysc.c
@@ -36,7 +36,10 @@ static const struct soc_device_attribute r8a77990[] __initconst = {
 
 static int __init r8a77990_sysc_init(void)
 {
-	if (soc_device_match(r8a77990)) {
+	const struct soc_device_attribute *match;
+
+	match = soc_device_match(r8a77990);
+	if (!IS_ERR(match) && match) {
 		/* Fix incorrect 3DG hierarchy */
 		swap(r8a77990_areas[7], r8a77990_areas[8]);
 		r8a77990_areas[7].parent = R8A77990_PD_ALWAYS_ON;
diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c
index 312ba0f98ad7..f4a08992e827 100644
--- a/drivers/soc/ti/k3-ringacc.c
+++ b/drivers/soc/ti/k3-ringacc.c
@@ -1368,7 +1368,7 @@ static int k3_ringacc_init(struct platform_device *pdev,
 		return ret;
 
 	soc = soc_device_match(k3_ringacc_socinfo);
-	if (soc && soc->data) {
+	if (!IS_ERR(soc) && soc && soc->data) {
 		const struct k3_ringacc_soc_data *soc_data = soc->data;
 
 		ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk;
diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
index 115250115f10..34ce3c8eb9fc 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -667,7 +667,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&pcie->ports);
 
 	attr = soc_device_match(mt7621_pci_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		pcie->resets_inverted = true;
 
 	err = mt7621_pcie_parse_dt(pcie);
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index e1e412348076..ada3cc5adc02 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -310,6 +310,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 	const int *rcar_gen3_ths_tj_1 = of_device_get_match_data(dev);
 	struct resource *res;
 	struct thermal_zone_device *zone;
+	const struct soc_device_attribute *attr;
 	int ret, i;
 
 	/* default values if FUSEs are missing */
@@ -321,7 +322,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	priv->thermal_init = rcar_gen3_thermal_init;
-	if (soc_device_match(r8a7795es1))
+	attr = soc_device_match(r8a7795es1);
+	if (!IS_ERR(attr) && attr)
 		priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1;
 
 	platform_set_drvdata(pdev, priv);
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index d81af89166d2..eb9b7bcbd934 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -886,6 +886,9 @@ static const struct soc_device_attribute soc_no_cpu_notifier[] = {
 static
 int ti_bandgap_probe(struct platform_device *pdev)
 {
+#ifdef CONFIG_PM_SLEEP
+	const struct soc_device_attribute *match;
+#endif
 	struct ti_bandgap *bgp;
 	int clk_rate, ret, i;
 
@@ -1037,7 +1040,8 @@ int ti_bandgap_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_PM_SLEEP
 	bgp->nb.notifier_call = bandgap_omap_cpu_notifier;
-	if (!soc_device_match(soc_no_cpu_notifier))
+	match = soc_device_match(soc_no_cpu_notifier);
+	if (!IS_ERR(match) && !match)
 		cpu_pm_register_notifier(&bgp->nb);
 #endif
 
@@ -1072,9 +1076,11 @@ static
 int ti_bandgap_remove(struct platform_device *pdev)
 {
 	struct ti_bandgap *bgp = platform_get_drvdata(pdev);
+	const struct soc_device_attribute *attr;
 	int i;
 
-	if (!soc_device_match(soc_no_cpu_notifier))
+	soc = soc_device_match(soc_no_cpu_notifier);
+	if (!IS_ERR(attr) && !attr)
 		cpu_pm_unregister_notifier(&bgp->nb);
 
 	/* Remove sensor interfaces */
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 0c418ce50ba0..dfc73e0187bd 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2753,7 +2753,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)
 	const struct soc_device_attribute *attr;
 
 	attr = soc_device_match(renesas_usb3_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		priv = attr->data;
 	else
 		priv = of_device_get_match_data(&pdev->dev);
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index c70f2d0b4aaf..5d9cd7797ec1 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -243,6 +243,7 @@ static int ehci_platform_probe(struct platform_device *dev)
 	struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
 	struct ehci_platform_priv *priv;
 	struct ehci_hcd *ehci;
+	const struct soc_device_attribute *match;
 	int err, irq, clk = 0;
 
 	if (usb_disabled())
@@ -297,7 +298,8 @@ static int ehci_platform_probe(struct platform_device *dev)
 					  "has-transaction-translator"))
 			hcd->has_tt = 1;
 
-		if (soc_device_match(quirk_poll_match))
+		match = soc_device_match(quirk_poll_match);
+		if (!IS_ERR(match) && match)
 			priv->quirk_poll = true;
 
 		for (clk = 0; clk < EHCI_MAX_CLKS; clk++) {
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 1bc4fe7b8c75..41bb59d0e975 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -135,7 +135,7 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
 	const char *firmware_name;
 
 	attr = soc_device_match(rcar_quirks_match);
-	if (attr)
+	if (!IS_ERR(attr) && attr)
 		quirks = (uintptr_t)attr->data;
 
 	if (quirks & RCAR_XHCI_FIRMWARE_V2)
diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
index 5791198960e6..fdc534dc4024 100644
--- a/drivers/watchdog/renesas_wdt.c
+++ b/drivers/watchdog/renesas_wdt.c
@@ -197,7 +197,7 @@ static bool rwdt_blacklisted(struct device *dev)
 	const struct soc_device_attribute *attr;
 
 	attr = soc_device_match(rwdt_quirks_match);
-	if (attr && setup_max_cpus > (uintptr_t)attr->data) {
+	if (!IS_ERR(attr) && attr && setup_max_cpus > (uintptr_t)attr->data) {
 		dev_info(dev, "Watchdog blacklisted on %s %s\n", attr->soc_id,
 			 attr->revision);
 		return true;
-- 
2.17.1


^ permalink raw reply related

* [RFC v1 PATCH 2/3] caam: add defer probe when the caam driver cannot identify SoC
From: Alice Guo (OSS) @ 2021-04-19  4:27 UTC (permalink / raw)
  To: gregkh, rafael, horia.geanta, aymen.sghaier, herbert, davem, tony,
	geert+renesas, mturquette, sboyd, vkoul, peter.ujfalusi, a.hajda,
	narmstrong, robert.foss, airlied, daniel, khilman, tomba,
	jyri.sarha, joro, will, mchehab, ulf.hansson, adrian.hunter,
	kishon, kuba, linus.walleij, Roy.Pledge, leoyang.li, ssantosh,
	matthias.bgg, edubezval, j-keerthy, balbi, linux, stern, wim,
	linux
  Cc: linux-usb, linux-watchdog, linux-gpio, netdev, linux-pm,
	linux-staging, linux-mmc, linux-kernel, dri-devel,
	linux-renesas-soc, linux-phy, iommu, linux-mediatek, linux-crypto,
	dmaengine, linux-amlogic, linux-omap, linuxppc-dev, linux-clk,
	linux-arm-kernel, linux-media
In-Reply-To: <20210419042722.27554-1-alice.guo@oss.nxp.com>

From: Alice Guo <alice.guo@nxp.com>

When imx8_soc_info_driver uses module_platform_driver() to regitser
itself, the caam driver cannot identify the SoC in the machine because
the SoC driver is probed later, so that add return -EPROBE_DEFER.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
---
 drivers/crypto/caam/ctrl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index ca0361b2dbb0..d08f8cc4131f 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -635,6 +635,9 @@ static int caam_probe(struct platform_device *pdev)
 	nprop = pdev->dev.of_node;
 
 	imx_soc_match = soc_device_match(caam_imx_soc_table);
+	if (IS_ERR(imx_soc_match))
+		return PTR_ERR(imx_soc_match);
+
 	caam_imx = (bool)imx_soc_match;
 
 	if (imx_soc_match) {
-- 
2.17.1


^ permalink raw reply related

* [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER
From: Alice Guo (OSS) @ 2021-04-19  4:27 UTC (permalink / raw)
  To: gregkh, rafael, horia.geanta, aymen.sghaier, herbert, davem, tony,
	geert+renesas, mturquette, sboyd, vkoul, peter.ujfalusi, a.hajda,
	narmstrong, robert.foss, airlied, daniel, khilman, tomba,
	jyri.sarha, joro, will, mchehab, ulf.hansson, adrian.hunter,
	kishon, kuba, linus.walleij, Roy.Pledge, leoyang.li, ssantosh,
	matthias.bgg, edubezval, j-keerthy, balbi, linux, stern, wim,
	linux
  Cc: linux-usb, linux-watchdog, linux-gpio, netdev, linux-pm,
	linux-staging, linux-mmc, linux-kernel, dri-devel,
	linux-renesas-soc, linux-phy, iommu, linux-mediatek, linux-crypto,
	dmaengine, linux-amlogic, linux-omap, linuxppc-dev, linux-clk,
	linux-arm-kernel, linux-media
In-Reply-To: <20210419042722.27554-1-alice.guo@oss.nxp.com>

From: Alice Guo <alice.guo@nxp.com>

In i.MX8M boards, the registration of SoC device is later than caam
driver which needs it. Caam driver needs soc_device_match to provide
-EPROBE_DEFER when no SoC device is registered and no
early_soc_dev_attr.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
---
 drivers/base/soc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 0af5363a582c..12a22f9cf5c8 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -110,6 +110,7 @@ static void soc_release(struct device *dev)
 }
 
 static struct soc_device_attribute *early_soc_dev_attr;
+static bool soc_dev_attr_init_done = false;
 
 struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr)
 {
@@ -157,6 +158,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
 		return ERR_PTR(ret);
 	}
 
+	soc_dev_attr_init_done = true;
 	return soc_dev;
 
 out3:
@@ -246,6 +248,9 @@ const struct soc_device_attribute *soc_device_match(
 	if (!matches)
 		return NULL;
 
+	if (!soc_dev_attr_init_done && !early_soc_dev_attr)
+		return ERR_PTR(-EPROBE_DEFER);
+
 	while (!ret) {
 		if (!(matches->machine || matches->family ||
 		      matches->revision || matches->soc_id))
-- 
2.17.1


^ permalink raw reply related

* [RFC v1 PATCH 0/3] support soc_device_match to return -EPROBE_DEFER
From: Alice Guo (OSS) @ 2021-04-19  4:27 UTC (permalink / raw)
  To: gregkh, rafael, horia.geanta, aymen.sghaier, herbert, davem, tony,
	geert+renesas, mturquette, sboyd, vkoul, peter.ujfalusi, a.hajda,
	narmstrong, robert.foss, airlied, daniel, khilman, tomba,
	jyri.sarha, joro, will, mchehab, ulf.hansson, adrian.hunter,
	kishon, kuba, linus.walleij, Roy.Pledge, leoyang.li, ssantosh,
	matthias.bgg, edubezval, j-keerthy, balbi, linux, stern, wim,
	linux
  Cc: linux-usb, linux-watchdog, linux-gpio, netdev, linux-pm,
	linux-staging, linux-mmc, linux-kernel, dri-devel,
	linux-renesas-soc, linux-phy, iommu, linux-mediatek, linux-crypto,
	dmaengine, linux-amlogic, linux-omap, linuxppc-dev, linux-clk,
	linux-arm-kernel, linux-media

From: Alice Guo <alice.guo@nxp.com>

In patch "soc: imx8m: change to use platform driver", change soc-imx8m.c to use
module platform driver and use NVMEM APIs to ocotp register, the reason is that
directly reading ocotp egister causes kexec kernel hang because kernel will
disable unused clks after kernel boots up. This patch makes the SoC driver
ready. This patch makes the SoC driver ready later than before, and causes device
depends on soc_device_match() for initialization are affected, resulting in
kernel boot error.

CAAM driver is one of these affected drivers. It uses soc_device_match() to find
the first matching entry of caam_imx_soc_table, if none of them match, the next
instruction will be executed without any processing because CAAM driver is used
not only on i.MX and LS, but also PPC and Vybrid. We hope that
soc_device_match() could support to return -EPROBE_DEFER(or some other error
code, e.g. -ENODEV, but not NULL) in case of “no SoC device registered” to SoC
bus. We tried it and updated all the code that is using soc_device_match()
throughout the tree.

Alice Guo (3):
  drivers: soc: add support for soc_device_match returning -EPROBE_DEFER
  caam: add defer probe when the caam driver cannot identify SoC
  driver: update all the code that use soc_device_match

 drivers/base/soc.c                            |  5 +++++
 drivers/bus/ti-sysc.c                         |  2 +-
 drivers/clk/renesas/r8a7795-cpg-mssr.c        |  4 +++-
 drivers/clk/renesas/rcar-gen2-cpg.c           |  2 +-
 drivers/clk/renesas/rcar-gen3-cpg.c           |  2 +-
 drivers/crypto/caam/ctrl.c                    |  3 +++
 drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c       |  7 ++++++-
 drivers/dma/ti/k3-psil.c                      |  3 +++
 drivers/dma/ti/k3-udma.c                      |  2 +-
 drivers/gpu/drm/bridge/nwl-dsi.c              |  2 +-
 drivers/gpu/drm/meson/meson_drv.c             |  4 +++-
 drivers/gpu/drm/omapdrm/dss/dispc.c           |  2 +-
 drivers/gpu/drm/omapdrm/dss/dpi.c             |  4 +++-
 drivers/gpu/drm/omapdrm/dss/dsi.c             |  3 +++
 drivers/gpu/drm/omapdrm/dss/dss.c             |  3 +++
 drivers/gpu/drm/omapdrm/dss/hdmi4_core.c      |  3 +++
 drivers/gpu/drm/omapdrm/dss/venc.c            |  4 +++-
 drivers/gpu/drm/omapdrm/omap_drv.c            |  3 +++
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c        |  4 +++-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  2 +-
 drivers/gpu/drm/tidss/tidss_dispc.c           |  4 +++-
 drivers/iommu/ipmmu-vmsa.c                    |  7 +++++--
 drivers/media/platform/rcar-vin/rcar-core.c   |  2 +-
 drivers/media/platform/rcar-vin/rcar-csi2.c   |  2 +-
 drivers/media/platform/vsp1/vsp1_uif.c        |  4 +++-
 drivers/mmc/host/renesas_sdhi_core.c          |  2 +-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c |  2 +-
 drivers/mmc/host/sdhci-of-esdhc.c             | 21 ++++++++++++++-----
 drivers/mmc/host/sdhci-omap.c                 |  2 +-
 drivers/mmc/host/sdhci_am654.c                |  2 +-
 drivers/net/ethernet/renesas/ravb_main.c      |  4 +++-
 drivers/net/ethernet/ti/am65-cpsw-nuss.c      |  2 +-
 drivers/net/ethernet/ti/cpsw.c                |  2 +-
 drivers/net/ethernet/ti/cpsw_new.c            |  2 +-
 drivers/phy/ti/phy-omap-usb2.c                |  4 +++-
 drivers/pinctrl/renesas/core.c                |  2 +-
 drivers/pinctrl/renesas/pfc-r8a7790.c         |  5 ++++-
 drivers/pinctrl/renesas/pfc-r8a7794.c         |  5 ++++-
 drivers/soc/fsl/dpio/dpio-driver.c            | 13 ++++++++----
 drivers/soc/renesas/r8a774c0-sysc.c           |  5 ++++-
 drivers/soc/renesas/r8a7795-sysc.c            |  2 +-
 drivers/soc/renesas/r8a77990-sysc.c           |  5 ++++-
 drivers/soc/ti/k3-ringacc.c                   |  2 +-
 drivers/staging/mt7621-pci/pci-mt7621.c       |  2 +-
 drivers/thermal/rcar_gen3_thermal.c           |  4 +++-
 drivers/thermal/ti-soc-thermal/ti-bandgap.c   | 10 +++++++--
 drivers/usb/gadget/udc/renesas_usb3.c         |  2 +-
 drivers/usb/host/ehci-platform.c              |  4 +++-
 drivers/usb/host/xhci-rcar.c                  |  2 +-
 drivers/watchdog/renesas_wdt.c                |  2 +-
 50 files changed, 139 insertions(+), 52 deletions(-)

-- 
2.17.1


^ permalink raw reply

* Re: [RFC/PATCH] powerpc/smp: Add SD_SHARE_PKG_RESOURCES flag to MC sched-domain
From: Gautham R Shenoy @ 2021-04-19  6:14 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Gautham R. Shenoy, Michael Neuling, Vaidyanathan Srinivasan,
	Vincent Guittot, Srikar Dronamraju, Rik van Riel, LKML,
	Nicholas Piggin, Dietmar Eggemann, Parth Shah, linuxppc-dev,
	Valentin Schneider
In-Reply-To: <20210412104819.GT3697@techsingularity.net>

Hello Mel,

On Mon, Apr 12, 2021 at 11:48:19AM +0100, Mel Gorman wrote:
> On Mon, Apr 12, 2021 at 11:06:19AM +0100, Valentin Schneider wrote:
> > On 12/04/21 10:37, Mel Gorman wrote:
> > > On Mon, Apr 12, 2021 at 11:54:36AM +0530, Srikar Dronamraju wrote:
> > >> * Gautham R. Shenoy <ego@linux.vnet.ibm.com> [2021-04-02 11:07:54]:
> > >>
> > >> >
> > >> > To remedy this, this patch proposes that the LLC be moved to the MC
> > >> > level which is a group of cores in one half of the chip.
> > >> >
> > >> >       SMT (SMT4) --> MC (Hemisphere)[LLC] --> DIE
> > >> >
> > >>
> > >> I think marking Hemisphere as a LLC in a P10 scenario is a good idea.
> > >>
> > >> > While there is no cache being shared at this level, this is still the
> > >> > level where some amount of cache-snooping takes place and it is
> > >> > relatively faster to access the data from the caches of the cores
> > >> > within this domain. With this change, we no longer see regressions on
> > >> > P10 for applications which require single threaded performance.
> > >>
> > >> Peter, Valentin, Vincent, Mel, etal
> > >>
> > >> On architectures where we have multiple levels of cache access latencies
> > >> within a DIE, (For example: one within the current LLC or SMT core and the
> > >> other at MC or Hemisphere, and finally across hemispheres), do you have any
> > >> suggestions on how we could handle the same in the core scheduler?
> > >>
> > >
> > > Minimally I think it would be worth detecting when there are multiple
> > > LLCs per node and detecting that in generic code as a static branch. In
> > > select_idle_cpu, consider taking two passes -- first on the LLC domain
> > > and if no idle CPU is found then taking a second pass if the search depth
> > > allows within the node with the LLC CPUs masked out.
> > 
> > I think that's actually a decent approach. Tying SD_SHARE_PKG_RESOURCES to
> > something other than pure cache topology in a generic manner is tough (as
> > it relies on murky, ill-defined hardware fabric properties).
> > 
> 
> Agreed. The LLC->node scan idea has been on my TODO list to try for
> a while.

If you have any patches for these, I will be happy to test them on
POWER10. Though, on POWER10, there will be an additional sd between
the LLC and the DIE domain. 




> 
> > Last I tried thinking about that, I stopped at having a core-to-core
> > latency matrix, building domains off of that, and having some knob
> > specifying the highest distance value below which we'd set
> > SD_SHARE_PKG_RESOURCES. There's a few things I 'hate' about that; for one
> > it makes cpus_share_cache() somewhat questionable.
> > 
> 
> And I thought about something like this too but worried it might get
> complex, particularly on chiplets where we do not necessarily have
> hardware info on latency depending on how it's wired up. It also might
> lead to excessive cpumask manipulation in a fast path if we have to
> traverse multiple distances with search cost exceeding gains from latency
> reduction. Hence -- keeping it simple with two level only, LLC then node
> within the allowed search depth and see what that gets us. It might be
> "good enough" in most cases and would be a basis for comparison against
> complex approaches.


> 
> At minimum, I expect IBM can evaluate the POWER10 aspect and I can run
> an evaluation on Zen generations.


> 
> -- 
> Mel Gorman
> SUSE Labs

^ permalink raw reply

* Re: [PATCH v3] powerpc/kexec_file: use current CPU info while setting up FDT
From: Hari Bathini @ 2021-04-19  5:55 UTC (permalink / raw)
  To: Sourabh Jain, mpe; +Cc: mahesh, bauerman, stable, linuxppc-dev
In-Reply-To: <20210417053805.800907-1-sourabhjain@linux.ibm.com>

Hi Sourabh,

Thanks for fixing this.

Generating an FDT based on of_root (the latest unflattened device-tree) 
should be ideal as something similar to what is done for /cpus here 
applies to /memory@* & /ibm,dynamic-reconfiguration-memory nodes too 
(probably also applies to other nodes like pci@* ?). But IIUC, there is 
no API in the kernel currently that converts an unflattened device-tree 
(struct device_node *of_root) to FDT and having one might have it's own 
challenges.

Should pursue fixing /memory@* and other nodes for kexec as follow-up to 
this patch either with the unflattened DT to FDT approach or otherwise...

On 17/04/21 11:08 am, Sourabh Jain wrote:
> kexec_file_load uses initial_boot_params in setting up the device-tree
> for the kernel to be loaded. Though initial_boot_params holds info
> about CPUs at the time of boot, it doesn't account for hot added CPUs.
> 
> So, kexec'ing with kexec_file_load syscall would leave the kexec'ed
> kernel with inaccurate CPU info. Also, if kdump kernel is loaded with
> kexec_file_load syscall and the system crashes on a hot added CPU,
> capture kernel hangs failing to identify the boot CPU.
> 
>   Kernel panic - not syncing: sysrq triggered crash
>   CPU: 24 PID: 6065 Comm: echo Kdump: loaded Not tainted 5.12.0-rc5upstream #54
>   Call Trace:
>   [c0000000e590fac0] [c0000000007b2400] dump_stack+0xc4/0x114 (unreliable)
>   [c0000000e590fb00] [c000000000145290] panic+0x16c/0x41c
>   [c0000000e590fba0] [c0000000008892e0] sysrq_handle_crash+0x30/0x40
>   [c0000000e590fc00] [c000000000889cdc] __handle_sysrq+0xcc/0x1f0
>   [c0000000e590fca0] [c00000000088a538] write_sysrq_trigger+0xd8/0x178
>   [c0000000e590fce0] [c0000000005e9b7c] proc_reg_write+0x10c/0x1b0
>   [c0000000e590fd10] [c0000000004f26d0] vfs_write+0xf0/0x330
>   [c0000000e590fd60] [c0000000004f2aec] ksys_write+0x7c/0x140
>   [c0000000e590fdb0] [c000000000031ee0] system_call_exception+0x150/0x290
>   [c0000000e590fe10] [c00000000000ca5c] system_call_common+0xec/0x278
>   --- interrupt: c00 at 0x7fff905b9664
>   NIP:  00007fff905b9664 LR: 00007fff905320c4 CTR: 0000000000000000
>   REGS: c0000000e590fe80 TRAP: 0c00   Not tainted  (5.12.0-rc5upstream)
>   MSR:  800000000280f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE>  CR: 28000242
>         XER: 00000000
>   IRQMASK: 0
>   GPR00: 0000000000000004 00007ffff5fedf30 00007fff906a7300 0000000000000001
>   GPR04: 000001002a7355b0 0000000000000002 0000000000000001 00007ffff5fef616
>   GPR08: 0000000000000001 0000000000000000 0000000000000000 0000000000000000
>   GPR12: 0000000000000000 00007fff9073a160 0000000000000000 0000000000000000
>   GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>   GPR20: 0000000000000000 00007fff906a4ee0 0000000000000002 0000000000000001
>   GPR24: 00007fff906a0898 0000000000000000 0000000000000002 000001002a7355b0
>   GPR28: 0000000000000002 00007fff906a1790 000001002a7355b0 0000000000000002
>   NIP [00007fff905b9664] 0x7fff905b9664
>   LR [00007fff905320c4] 0x7fff905320c4
>   --- interrupt: c00
> 
> To avoid this from happening, extract current CPU info from of_root
> device node and use it for setting up the fdt in kexec_file_load case.
> 
> Fixes: 6ecd0163d360 ("powerpc/kexec_file: Add appropriate regions for memory reserve map")
> 
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> Cc: <stable@vger.kernel.org>

Fow now, this should be a good stop-gap fix for /cpus node case.

Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>

> ---
>   arch/powerpc/kexec/file_load_64.c | 98 +++++++++++++++++++++++++++++++
>   1 file changed, 98 insertions(+)
> 
>   ---
> Changelog:
> 
> v1 -> v2
>    - fdt should be updated regardless of kexec type
>    - updated commit message and title
> 
> v2 -> v3
>    - Fixed warnings reported by patchwork
>      (https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210416124658.718860-1-sourabhjain@linux.ibm.com/)
>       - argument aligned to open parenthesis
>       - declared add_node_prop and update_cpus_node function static
>   ---
> 
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index 02b9e4d0dc40..878f8297fbed 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -960,6 +960,99 @@ unsigned int kexec_fdt_totalsize_ppc64(struct kimage *image)
>   	return fdt_size;
>   }
>   
> +/**
> + * add_node_prop - Read property from device node structure and add
> + *			them to fdt.
> + * @fdt:		Flattened device tree of the kernel
> + * @node_offset:	offset of the node to add a property at
> + * np:			device node pointer
> + *
> + * Returns 0 on success, negative errno on error.
> + */
> +static int add_node_prop(void *fdt, int node_offset, const struct device_node *np)
> +{
> +	int ret = 0;
> +	struct property *pp;
> +	unsigned long flags;
> +
> +	if (!np)
> +		return -EINVAL;
> +
> +	raw_spin_lock_irqsave(&devtree_lock, flags);
> +	for (pp = np->properties; pp; pp = pp->next) {
> +		ret = fdt_setprop(fdt, node_offset, pp->name,
> +				  pp->value, pp->length);
> +		if (ret < 0) {
> +			pr_err("Unable to add %s property: %s\n",
> +			       pp->name, fdt_strerror(ret));
> +			goto out;
> +		}
> +	}
> +out:
> +	raw_spin_unlock_irqrestore(&devtree_lock, flags);
> +	return ret;
> +}
> +
> +/**
> + * update_cpus_node - Update cpus node of flattened device-tree using of_root
> + *			device node.
> + * @fdt:		Flattened device tree of the kernel.
> + *
> + * Returns 0 on success, negative errno on error.
> + */
> +static int update_cpus_node(void *fdt)
> +{
> +	struct device_node *cpus_node, *dn;
> +	int cpus_offset, cpus_subnode_off, ret = 0;
> +
> +	cpus_offset = fdt_path_offset(fdt, "/cpus");
> +	if (cpus_offset == -FDT_ERR_NOTFOUND || cpus_offset > 0) {
> +		if (cpus_offset > 0) {
> +			ret = fdt_del_node(fdt, cpus_offset);
> +			if (ret < 0) {
> +				pr_err("Error deleting /cpus node: %s\n",
> +				       fdt_strerror(ret));
> +				return -EINVAL;
> +			}
> +		}
> +
> +		/* Add cpus node to fdt */
> +		cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
> +					      "cpus");
> +		if (cpus_offset < 0) {
> +			pr_err("Error creating /cpus node: %s\n",
> +			       fdt_strerror(cpus_offset));
> +			return -EINVAL;
> +		}
> +
> +		/* Add cpus node properties */
> +		cpus_node = of_find_node_by_path("/cpus");
> +		ret = add_node_prop(fdt, cpus_offset, cpus_node);
> +		if (ret < 0)
> +			return ret;
> +
> +		/* Loop through all subnodes of cpus and add them to fdt */
> +		for_each_node_by_type(dn, "cpu") {
> +			cpus_subnode_off = fdt_add_subnode(fdt,
> +							   cpus_offset,
> +							   dn->full_name);
> +			if (cpus_subnode_off < 0) {
> +				pr_err("Unable to add %s subnode: %s\n",
> +				       dn->full_name, fdt_strerror(cpus_subnode_off));
> +				return cpus_subnode_off;
> +			}
> +			ret = add_node_prop(fdt, cpus_subnode_off, dn);
> +			if (ret < 0)
> +				return ret;
> +		}
> +	} else if (cpus_offset < 0) {
> +		pr_err("Malformed device tree: error reading /cpus node: %s\n",
> +		       fdt_strerror(cpus_offset));
> +	}
> +
> +	return ret;
> +}
> +
>   /**
>    * setup_new_fdt_ppc64 - Update the flattend device-tree of the kernel
>    *                       being loaded.
> @@ -1020,6 +1113,11 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt,
>   		}
>   	}
>   
> +	/* Update cpus nodes information to account hotplug CPUs. */
> +	ret =  update_cpus_node(fdt);
> +	if (ret < 0)
> +		return ret;
> +
>   	/* Update memory reserve map */
>   	ret = get_reserved_memory_ranges(&rmem);
>   	if (ret)
> 

^ permalink raw reply

* Re: [PATCH 3/3] powerpc/mm/hash: Avoid multiple HPT resize-downs on memory hotunplug
From: David Gibson @ 2021-04-19  5:37 UTC (permalink / raw)
  To: Leonardo Bras
  Cc: Nathan Lynch, David Hildenbrand, Scott Cheloha, linux-kernel,
	linuxppc-dev, Nicholas Piggin, Bharata B Rao, Paul Mackerras,
	Sandipan Das, Aneesh Kumar K.V, Andrew Morton, Laurent Dufour,
	Logan Gunthorpe, Dan Williams, Mike Rapoport
In-Reply-To: <418f044aab385389681529b0b6057e75825b0e5f.camel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4230 bytes --]

On Fri, Apr 09, 2021 at 12:31:03AM -0300, Leonardo Bras wrote:
> Hello David, thanks for commenting.
> 
> On Tue, 2021-03-23 at 10:45 +1100, David Gibson wrote:
> > > @@ -805,6 +808,10 @@ static int resize_hpt_for_hotplug(unsigned long new_mem_size, bool shrinking)
> > >  	if (shrinking) {
> > > 
> > > +		/* When batch removing entries, only resizes HPT at the end. */
> > > +		if (atomic_read_acquire(&hpt_resize_disable))
> > > +			return 0;
> > > +
> > 
> > I'm not quite convinced by this locking.  Couldn't hpt_resize_disable
> > be set after this point, but while you're still inside
> > resize_hpt_for_hotplug()?  Probably better to use an explicit mutex
> > (and mutex_trylock()) to make the critical sections clearer.
> 
> Sure, I can do that for v2.
> 
> > Except... do we even need the fancy mechanics to suppress the resizes
> > in one place to do them elswhere.  Couldn't we just replace the
> > existing resize calls with the batched ones?
> 
> How do you think of having batched resizes-down in HPT?

I think it's a good idea.  We still have to have the loop to resize
bigger if we can't fit everything into the smallest target size, but
that still only makes the worst case as bad at the always-case is
currently.

> Other than the current approach, I could only think of a way that would
> touch a lot of generic code, and/or duplicate some functions, as
> dlpar_add_lmb() does a lot of other stuff.
> 
> > > +void hash_memory_batch_shrink_end(void)
> > > +{
> > > +	unsigned long newsize;
> > > +
> > > +	/* Re-enables HPT resize-down after hot-unplug */
> > > +	atomic_set_release(&hpt_resize_disable, 0);
> > > +
> > > +	newsize = memblock_phys_mem_size();
> > > +	/* Resize to smallest SHIFT possible */
> > > +	while (resize_hpt_for_hotplug(newsize, true) == -ENOSPC) {
> > > +		newsize *= 2;
> > 
> > As noted earlier, doing this without an explicit cap on the new hpt
> > size (of the existing size) this makes me nervous. 
> > 
> 
> I can add a stop in v2.
> 
> >  Less so, but doing
> > the calculations on memory size, rather than explictly on HPT size /
> > HPT order also seems kinda clunky.
> 
> Agree, but at this point, it would seem kind of a waste to find the
> shift from newsize, then calculate (1 << shift) for each retry of
> resize_hpt_for_hotplug() only to point that we are retrying the order
> value.

Yeah, I see your poiint.

> 
> But sure, if you think it looks better, I can change that. 
> 
> > > +void memory_batch_shrink_begin(void)
> > > +{
> > > +	if (!radix_enabled())
> > > +		hash_memory_batch_shrink_begin();
> > > +}
> > > +
> > > +void memory_batch_shrink_end(void)
> > > +{
> > > +	if (!radix_enabled())
> > > +		hash_memory_batch_shrink_end();
> > > +}
> > 
> > Again, these wrappers don't seem particularly useful to me.
> 
> Options would be add 'if (!radix_enabled())' to hotplug-memory.c
> functions or to hash* functions, which look kind of wrong.

I think the if !radix_enabled in hotplug-memory.c isn't too bad, in
fact possibly helpful as a hint that this is HPT only logic.

> 
> > > +	memory_batch_shrink_end();
> > 
> > remove_by_index only removes a single LMB, so there's no real point to
> > batching here.
> 
> Sure, will be fixed for v2.
> 
> > > @@ -700,6 +712,7 @@ static int dlpar_memory_add_by_count(u32 lmbs_to_add)
> > >  	if (lmbs_added != lmbs_to_add) {
> > >  		pr_err("Memory hot-add failed, removing any added LMBs\n");
> > > 
> > > +		memory_batch_shrink_begin();
> > 
> > 
> > The effect of these on the memory grow path is far from clear.
> > 
> 
> On hotplug, HPT is resized-up before adding LMBs.
> On hotunplug, HPT is resized-down after removing LMBs.
> And each one has it's own mechanism to batch HPT resizes...
> 
> I can't understand exactly how using it on hotplug fail path can be any
> different than using it on hotunplug.
> > 
> 
> Can you please help me understanding this?
> 
> Best regards,
> Leonardo Bras
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 2/3] powerpc/mm/hash: Avoid multiple HPT resize-ups on memory hotplug
From: David Gibson @ 2021-04-19  5:34 UTC (permalink / raw)
  To: Leonardo Bras
  Cc: Nathan Lynch, David Hildenbrand, Scott Cheloha, linux-kernel,
	linuxppc-dev, Nicholas Piggin, Bharata B Rao, Paul Mackerras,
	Sandipan Das, Aneesh Kumar K.V, Andrew Morton, Laurent Dufour,
	Logan Gunthorpe, Dan Williams, Mike Rapoport
In-Reply-To: <e5c924479839815c025de29d650d82419b18c0dc.camel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3759 bytes --]

On Thu, Apr 08, 2021 at 11:51:36PM -0300, Leonardo Bras wrote:
> Hello David, thanks for the feedback!
> 
> On Mon, 2021-03-22 at 18:55 +1100, David Gibson wrote:
> > > +void hash_memory_batch_expand_prepare(unsigned long newsize)
> > > +{
> > > +	/*
> > > +	 * Resizing-up HPT should never fail, but there are some cases system starts with higher
> > > +	 * SHIFT than required, and we go through the funny case of resizing HPT down while
> > > +	 * adding memory
> > > +	 */
> > > +
> > > +	while (resize_hpt_for_hotplug(newsize, false) == -ENOSPC) {
> > > +		newsize *= 2;
> > > +		pr_warn("Hash collision while resizing HPT\n");
> > 
> > This unbounded increase in newsize makes me nervous - we should be
> > bounded by the current size of the HPT at least.  In practice we
> > should be fine, since the resize should always succeed by the time we
> > reach our current HPT size, but that's far from obvious from this
> > point in the code.
> 
> Sure, I will add bounds in v2.
> 
> > 
> > And... you're doubling newsize which is a value which might not be a
> > power of 2.  I'm wondering if there's an edge case where this could
> > actually cause us to skip the current size and erroneously resize to
> > one bigger than we have currently.
> 
> I also though that at the start, but it seems quite reliable.
> Before using this value, htab_shift_for_mem_size() will always round it
> to next power of 2. 
> Ex.
> Any value between 0b0101 and 0b1000 will be rounded to 0b1000 for shift
> calculation. If we multiply it by 2 (same as << 1), we have that
> anything between 0b01010 and 0b10000 will be rounded to 0b10000. 

Ah, good point.

> This works just fine as long as we are multiplying. 
> Division may have the behavior you expect, as 0b0101 >> 1 would become
> 0b010 and skip a shift.
> 	
> > > +void memory_batch_expand_prepare(unsigned long newsize)
> > 
> > This wrapper doesn't seem useful.
> 
> Yeah, it does little, but I can't just jump into hash_* functions
> directly from hotplug-memory.c, without even knowing if it's using hash
> pagetables. (in case the suggestion would be test for disable_radix
> inside hash_memory_batch*)
> 
> > 
> > > +{
> > > +	if (!radix_enabled())
> > > +		hash_memory_batch_expand_prepare(newsize);
> > > +}
> > >  #endif /* CONFIG_MEMORY_HOTPLUG */
> > >  
> > > 
> > > +	memory_batch_expand_prepare(memblock_phys_mem_size() +
> > > +				     drmem_info->n_lmbs * drmem_lmb_size());
> > 
> > This doesn't look right.  memory_add_by_index() is adding a *single*
> > LMB, I think using drmem_info->n_lmbs here means you're counting this
> > as adding again as much memory as you already have hotplugged.
> 
> Yeah, my mistake. This makes sense.
> I will change it to something like 
> memblock_phys_mem_size() + drmem_lmb_size()
> 
> > > 
> > > +	memory_batch_expand_prepare(memblock_phys_mem_size() + lmbs_to_add * drmem_lmb_size());
> > > +
> > >  	for_each_drmem_lmb_in_range(lmb, start_lmb, end_lmb) {
> > >  		if (lmb->flags & DRCONF_MEM_ASSIGNED)
> > >  			continue;
> > 
> > I don't see memory_batch_expand_prepare() suppressing any existing HPT
> > resizes.  Won't this just resize to the right size for the full add,
> > then resize several times again as we perform the add?  Or.. I guess
> > that will be suppressed by patch 1/3. 
> 
> Correct.
> 
> >  That's seems kinda fragile, though.
> 
> What do you mean by fragile here?
> What would you suggest doing different?
> 
> Best regards,
> Leonardo Bras
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 1/6] powerpc/mm/64s: Add _PAGE_KERNEL_ROX
From: Michael Ellerman @ 2021-04-19  5:17 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <161806492582.1467223.8385484539752497993.b4-ty@ellerman.id.au>

Michael Ellerman <patch-notifications@ellerman.id.au> writes:

> On Fri, 12 Feb 2021 00:51:25 +1100, Michael Ellerman wrote:
>> In the past we had a fallback definition for _PAGE_KERNEL_ROX, but we
>> removed that in commit d82fd29c5a8c ("powerpc/mm: Distribute platform
>> specific PAGE and PMD flags and definitions") and added definitions
>> for each MMU family.
>> 
>> However we missed adding a definition for 64s, which was not really a
>> bug because it's currently not used.
>> 
>> [...]
>
> Applied to powerpc/next.
>
> [1/6] powerpc/mm/64s: Add _PAGE_KERNEL_ROX
>       https://git.kernel.org/powerpc/c/56bec2f9d4d05675cada96772a8a93010f4d82bf
> [2/6] powerpc/pseries: Add key to flags in pSeries_lpar_hpte_updateboltedpp()
>       https://git.kernel.org/powerpc/c/b56d55a5aa4aa9fc166595a7feb57f153ef7b555
> [3/6] powerpc/64s: Use htab_convert_pte_flags() in hash__mark_rodata_ro()
>       https://git.kernel.org/powerpc/c/2c02e656a29d5f64193eb93da92781bcf0517146
> [4/6] powerpc/mm/64s/hash: Factor out change_memory_range()
>       https://git.kernel.org/powerpc/c/6f223ebe9c3f3ed315a06cec156086f1f7f7ded1
> [5/6] powerpc/mm/64s/hash: Add real-mode change_memory_range() for hash LPAR
>       https://git.kernel.org/powerpc/c/87e65ad7bd3a84a992723753fcc23d31c2d063c2
> [6/6] powerpc/mm/64s: Allow STRICT_KERNEL_RWX again
>       https://git.kernel.org/powerpc/c/bd573a81312fd9d6520b1cc81a88fd29e670e1ff

v2 was applied.

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/64s: power4 nap fixup in C
From: Michael Ellerman @ 2021-04-19  5:16 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev, Nicholas Piggin
In-Reply-To: <161806492607.1467223.7549979604946856102.b4-ty@ellerman.id.au>

Michael Ellerman <patch-notifications@ellerman.id.au> writes:
> On Fri, 12 Mar 2021 11:20:44 +1000, Nicholas Piggin wrote:
>> There is no need for this to be in asm, use the new intrrupt entry wrapper.
>
> Applied to powerpc/next.
>
> [1/1] powerpc/64s: power4 nap fixup in C
>       https://git.kernel.org/powerpc/c/98db179a78dd8379e9d2cbfc3f00224168a9344c

Script is drunk again, v2 was applied, not this one.

cheers

^ permalink raw reply

* Re: [PATCH 1/2] powerpc/configs: Add PAPR_SCM to pseries_defconfig
From: Michael Ellerman @ 2021-04-19  4:12 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman
In-Reply-To: <20210416111209.765444-1-mpe@ellerman.id.au>

On Fri, 16 Apr 2021 21:12:08 +1000, Michael Ellerman wrote:
> This is a pseries only driver, it should be built by default as part of
> pseries_defconfig to get some build coverage.

Applied to powerpc/next.

[1/2] powerpc/configs: Add PAPR_SCM to pseries_defconfig
      https://git.kernel.org/powerpc/c/d6481a7195df4a8c828f9ee0b382f2dd36d3575c
[2/2] powerpc/papr_scm: Fix build error due to wrong printf specifier
      https://git.kernel.org/powerpc/c/7767d9ac89cee29c68f5dd278b3bb411d1c69287

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/smp: Make some symbols static
From: Michael Ellerman @ 2021-04-19  3:59 UTC (permalink / raw)
  To: Yu Kuai, mpe; +Cc: linuxppc-dev, zhangxiaoxu5, linux-kernel, yi.zhang
In-Reply-To: <20210407125903.4139663-1-yukuai3@huawei.com>

On Wed, 7 Apr 2021 20:59:03 +0800, Yu Kuai wrote:
> The sparse tool complains as follows:
> 
> arch/powerpc/kernel/smp.c:86:1: warning:
>  symbol '__pcpu_scope_cpu_coregroup_map' was not declared. Should it be static?
> arch/powerpc/kernel/smp.c:125:1: warning:
>  symbol '__pcpu_scope_thread_group_l1_cache_map' was not declared. Should it be static?
> arch/powerpc/kernel/smp.c:132:1: warning:
>  symbol '__pcpu_scope_thread_group_l2_cache_map' was not declared. Should it be static?
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/smp: Make some symbols static
      https://git.kernel.org/powerpc/c/078277acbd7c3fdb25c01a3cd5b4a1a875a1ab2f

cheers

^ permalink raw reply

* Re: [PATCH] windfarm: make symbol 'wf_thread' static
From: Michael Ellerman @ 2021-04-19  3:59 UTC (permalink / raw)
  To: Yu Kuai, benh; +Cc: linuxppc-dev, zhangxiaoxu5, linux-kernel, yi.zhang
In-Reply-To: <20210407125738.4138480-1-yukuai3@huawei.com>

On Wed, 7 Apr 2021 20:57:38 +0800, Yu Kuai wrote:
> The sparse tool complains as follows:
> 
> drivers/macintosh/windfarm_core.c:59:20: warning:
>  symbol 'wf_thread' was not declared. Should it be static?
> 
> This symbol is not used outside of windfarm_core.c, so this
> commit marks it static.

Applied to powerpc/next.

[1/1] windfarm: make symbol 'wf_thread' static
      https://git.kernel.org/powerpc/c/4204ecd598cb0a044e6fcfd48e569080955347f4

cheers

^ permalink raw reply

* Re: [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
From: Michael Ellerman @ 2021-04-19  3:59 UTC (permalink / raw)
  To: Vaibhav Jain, linux-nvdimm, linuxppc-dev; +Cc: Aneesh Kumar K . V
In-Reply-To: <20210404163148.321346-1-vaibhav@linux.ibm.com>

On Sun, 4 Apr 2021 22:01:48 +0530, Vaibhav Jain wrote:
> While removing large number of mappings from hash page tables for
> large memory systems as soft-lockup is reported because of the time
> spent inside htap_remove_mapping() like one below:
> 
>  watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
>  <snip>
>  NIP plpar_hcall+0x38/0x58
>  LR  pSeries_lpar_hpte_invalidate+0x68/0xb0
>  Call Trace:
>   0x1fffffffffff000 (unreliable)
>   pSeries_lpar_hpte_removebolted+0x9c/0x230
>   hash__remove_section_mapping+0xec/0x1c0
>   remove_section_mapping+0x28/0x3c
>   arch_remove_memory+0xfc/0x150
>   devm_memremap_pages_release+0x180/0x2f0
>   devm_action_release+0x30/0x50
>   release_nodes+0x28c/0x300
>   device_release_driver_internal+0x16c/0x280
>   unbind_store+0x124/0x170
>   drv_attr_store+0x44/0x60
>   sysfs_kf_write+0x64/0x90
>   kernfs_fop_write+0x1b0/0x290
>   __vfs_write+0x3c/0x70
>   vfs_write+0xd4/0x270
>   ksys_write+0xdc/0x130
>   system_call+0x5c/0x70
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/mm: Add cond_resched() while removing hpte mappings
      https://git.kernel.org/powerpc/c/a5d6a3e73acbd619dd5b7b831762b755f9e2db80

cheers

^ permalink raw reply

* Re: [PATCH] macintosh/windfarm: Make symbol 'pm121_sys_state' static
From: Michael Ellerman @ 2021-04-19  3:59 UTC (permalink / raw)
  To: Yu Kuai, benh; +Cc: linuxppc-dev, zhangxiaoxu5, linux-kernel, yi.zhang
In-Reply-To: <20210407125712.4138033-1-yukuai3@huawei.com>

On Wed, 7 Apr 2021 20:57:12 +0800, Yu Kuai wrote:
> The sparse tool complains as follows:
> 
> drivers/macintosh/windfarm_pm121.c:436:24: warning:
>  symbol 'pm121_sys_state' was not declared. Should it be static?
> 
> This symbol is not used outside of windfarm_pm121.c, so this
> commit marks it static.

Applied to powerpc/next.

[1/1] macintosh/windfarm: Make symbol 'pm121_sys_state' static
      https://git.kernel.org/powerpc/c/13ddd0e3acf988a98b46800178ae691640b0cd00

cheers

^ permalink raw reply

* Re: [PATCH] macintosh/via-pmu: Make some symbols static
From: Michael Ellerman @ 2021-04-19  3:59 UTC (permalink / raw)
  To: Yu Kuai, benh; +Cc: linuxppc-dev, zhangxiaoxu5, linux-kernel, yi.zhang
In-Reply-To: <20210407125803.4138837-1-yukuai3@huawei.com>

On Wed, 7 Apr 2021 20:58:03 +0800, Yu Kuai wrote:
> The sparse tool complains as follows:
> 
> drivers/macintosh/via-pmu.c:183:5: warning:
>  symbol 'pmu_cur_battery' was not declared. Should it be static?
> drivers/macintosh/via-pmu.c:190:5: warning:
>  symbol '__fake_sleep' was not declared. Should it be static?
> 
> [...]

Applied to powerpc/next.

[1/1] macintosh/via-pmu: Make some symbols static
      https://git.kernel.org/powerpc/c/95d143923379ffb0e706b064305681d44c05ec4b

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/pseries: extract host bridge from pci_bus prior to bus removal
From: Michael Ellerman @ 2021-04-19  4:00 UTC (permalink / raw)
  To: mpe, Tyrel Datwyler; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20210211182435.47968-1-tyreld@linux.ibm.com>

On Thu, 11 Feb 2021 12:24:35 -0600, Tyrel Datwyler wrote:
> The pci_bus->bridge reference may no longer be valid after
> pci_bus_remove() resulting in passing a bad value to device_unregister()
> for the associated bridge device.
> 
> Store the host_bridge reference in a separate variable prior to
> pci_bus_remove().

Applied to powerpc/next.

[1/1] powerpc/pseries: extract host bridge from pci_bus prior to bus removal
      https://git.kernel.org/powerpc/c/38d0b1c9cec71e6d0f3bddef0bbce41d05a3e796

cheers

^ permalink raw reply

* Re: [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
From: Michael Ellerman @ 2021-04-19  4:00 UTC (permalink / raw)
  To: Michael Ellerman, Tony Ambardar
  Cc: linux-arch, Tony Ambardar, Arnd Bergmann, linux-kernel, Stable,
	Paul Mackerras, Rosen Penev, bpf, linuxppc-dev
In-Reply-To: <20200917135437.1238787-1-Tony.Ambardar@gmail.com>

On Thu, 17 Sep 2020 06:54:37 -0700, Tony Ambardar wrote:
> A few archs like powerpc have different errno.h values for macros
> EDEADLOCK and EDEADLK. In code including both libc and linux versions of
> errno.h, this can result in multiple definitions of EDEADLOCK in the
> include chain. Definitions to the same value (e.g. seen with mips) do
> not raise warnings, but on powerpc there are redefinitions changing the
> value, which raise warnings and errors (if using "-Werror").
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
      https://git.kernel.org/powerpc/c/7de21e679e6a789f3729e8402bc440b623a28eae

cheers

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox