PCI: rcar: Add missing COMMON_CLK dependency
Subsystems (3)
PATCH 1/1 PCI: rcar: Add missing COMMON_CLK dependency
From: Marek Vasut <[email protected]>
Add COMMON_CLK dependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld: drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This should be OK, since all platforms shipping this controller also
need COMMON_CLK enabled for their clock driver.
---
+CC Stephen, please double-check whether this is the right approach or
whether there is some better option
--- drivers/pci/controller/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/Kconfig +2 -0
@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLK depends on PCI_MSI_IRQ_DOMAIN help Say Y here if you want PCIe controller support on R-Car SoCs in host
@@ -74,6 +75,7 @@ config PCIE_RCAR_HOST config PCIE_RCAR_EP bool "Renesas R-Car PCIe endpoint controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLK depends on PCI_ENDPOINT help Say Y here if you want PCIe controller support on R-Car SoCs in
Signature · 1 line
2.33.0
Quoted 17 lines · On Tue, Sep 07, 2021 at 04:45:12PM +0200, [email protected] wrote:
From: Marek Vasut <[email protected]>
Add
COMMON_CLKdependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld:drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This should be OK, since all platforms shipping this controller also
needCOMMON_CLKenabled for their clock driver.Fixes a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")Signed-off-by Marek Vasut <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Stephen Boyd <[email protected]>Cc Wolfram Sang <[email protected]>Cc Yoshihiro Shimoda <[email protected]>
Quoted 3 lines
---
+CC Stephen, please double-check whether this is the right approach or
whether there is some better option
Hi Stephen,
can you please have a look into this please to see if there is a better way of fixing this breakage ? We should aim for one of the upcoming rcX, thank you very much.
Lorenzo
Quoted 27 lines
--- drivers/pci/controller/Kconfig | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/controller/Kconfig +2
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLK depends on PCI_MSI_IRQ_DOMAIN help Say Y here if you want PCIe controller support on R-Car SoCs in host@@ -74,6 +75,7 @@ config PCIE_RCAR_HOST config PCIE_RCAR_EP bool "Renesas R-Car PCIe endpoint controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLK depends on PCI_ENDPOINT help Say Y here if you want PCIe controller support on R-Car SoCs inSignature · 1 line
2.33.0
Hi Marek,
Thanks for your patch!
Quoted 5 lines · On Tue, Sep 7, 2021 at 4:45 PM <[email protected]> wrote:
From: Marek Vasut <[email protected]>
Add
COMMON_CLKdependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld:drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This is a link failure for the host driver...
Quoted 24 lines
This should be OK, since all platforms shipping this controller also need
COMMON_CLKenabled for their clock driver.Fixes a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")Signed-off-by Marek Vasut <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Stephen Boyd <[email protected]>Cc Wolfram Sang <[email protected]>Cc Yoshihiro Shimoda <[email protected]>---
(quoted diff) +1
-1+CC Stephen, please double-check whether this is the right approach or whether there is some better option --- drivers/pci/controller/Kconfig | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/controller/Kconfig +0
-0
drivers/pci/controller/Kconfig config PCI_RCAR_GEN2 · line 69
Quoted 4 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLK
This part is OK.
drivers/pci/controller/Kconfig config PCIE_RCAR_HOST · line 78
Quoted 8 lines
drivers/pci/controller/Kconfig +1
-0depends on PCI_MSI_IRQ_DOMAIN help Say Y here if you want PCIe controller support on R-Car SoCs in host@@ -74,6 +75,7 @@ config PCIE_RCAR_HOST config PCIE_RCAR_EP bool "Renesas R-Car PCIe endpoint controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLK
... so why did you add a dependency to the endpoint driver, too?
drivers/pci/controller/Kconfig config PCIE_RCAR_HOST · line 81
Quoted 3 lines
drivers/pci/controller/Kconfig +0
-0depends on PCI_ENDPOINT help Say Y here if you want PCIe controller support on R-Car SoCs in
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On 9/21/21 6:08 PM, Geert Uytterhoeven wrote:
[...]
Quoted 11 lines
drivers/pci/controller/Kconfig config PCI_RCAR_GEN2 · line 69
Quoted 9 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLKThis part is OK.
This part is also identical in the patch from Arnd, so you can just pick that one as a fix and be done with it:
[PATCH] PCI: rcar: add COMMON_CLK dependency
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
Quoted 16 lines · Marek Vasut
On 9/21/21 6:08 PM, Geert Uytterhoeven wrote:
[...]
Quoted 11 lines
drivers/pci/controller/Kconfig config PCI_RCAR_GEN2 · line 69
Quoted 9 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLKThis part is OK.
Quoted 5 lines
This part is also identical in the patch from Arnd, so you can just pick that one as a fix and be done with it:
[PATCH] PCI: rcar: add
COMMON_CLKdependency
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
It is not strictly identical (Arnd's patch only touches the COMPILE_TEST option).
Bjorn, shall we pick Arnd's patch up then ? We should be fixing this in one of the upcoming -rcs since we introduced it in the last merge window.
Thanks,
Lorenzo
Quoted 23 lines · Lorenzo Pieralisi
Quoted 16 lines · Marek Vasut
On 9/21/21 6:08 PM, Geert Uytterhoeven wrote:
[...]
Quoted 11 lines
drivers/pci/controller/Kconfig config PCI_RCAR_GEN2 · line 69
Quoted 9 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLKThis part is OK.
Quoted 5 lines
This part is also identical in the patch from Arnd, so you can just pick that one as a fix and be done with it:
[PATCH] PCI: rcar: add
COMMON_CLKdependency
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
Quoted 6 lines
It is not strictly identical (Arnd's patch only touches the
COMPILE_TESToption).Bjorn, shall we pick Arnd's patch up then ? We should be fixing this in one of the upcoming -rcs since we introduced it in the last merge window.
IIUC, a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook") appeared in v5.15-rc1 and added a use of __clk_is_enabled(), which is only available when COMMON_CLK=y.
PCIE_RCAR_HOST depends on ARCH_RENESAS || COMPILE_TEST. ARCH_RENESAS is an ARM64 platform, so when COMPILE_TEST is not set, I think we get COMMON_CLK=y via this:
config ARM64
select COMMON_CLK
But when ARCH_RENESAS is not set and COMPILE_TEST=y, there's nothing that enforces the dependency on COMMON_CLK. Personally I like the first hunk of Marek's patch at [1] because the dependency on COMMON_CLK is explicit:
config PCIE_RCAR_HOST
depends on ARCH_RENESAS || COMPILE_TEST
depends on COMMON_CLKWhereas Arnd's patch [2] implicitly depends on the fact that the platform selects COMMON_CLK:
config PCIE_RCAR_HOST
depends on ARCH_RENESAS || (COMMON_CLK && COMPILE_TEST)But either is fine and I agree we should fix it soonish.
Bjorn
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Quoted 32 lines · Bjorn Helgaas
Quoted 16 lines · Lorenzo Pieralisi
Quoted 14 lines · Marek Vasut
On 9/21/21 6:08 PM, Geert Uytterhoeven wrote:
[...]
Quoted 10 lines
Quoted 9 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLKQuoted 3 lines
Bjorn, shall we pick Arnd's patch up then ? We should be fixing this in one of the upcoming -rcs since we introduced it in the last merge window.
IIUC,
a115b1bd3af0("PCI: rcar: Add L1 link state fix into data abort hook") appeared in v5.15-rc1 and added a use of__clk_is_enabled(), which is only available when COMMON_CLK=y.
PCIE_RCAR_HOSTdepends onARCH_RENESAS||COMPILE_TEST.ARCH_RENESASis an ARM64 platform, so whenCOMPILE_TESTis not set, I think we get COMMON_CLK=y via this:config ARM64
selectCOMMON_CLK
Quoted 8 lines
But when
ARCH_RENESASis not set and COMPILE_TEST=y, there's nothing that enforces the dependency onCOMMON_CLK. Personally I like the first hunk of Marek's patch at [1] because the dependency onCOMMON_CLKis explicit:config PCIE_RCAR_HOST depends on ARCH_RENESAS || COMPILE_TEST depends on COMMON_CLK
Agreed, Marek's version is clearer than mine, please use that.
Arnd
Quoted 38 lines · Arnd Bergmann
Quoted 37 lines · Bjorn Helgaas
Quoted 16 lines · Lorenzo Pieralisi
Quoted 14 lines · Marek Vasut
On 9/21/21 6:08 PM, Geert Uytterhoeven wrote:
[...]
Quoted 10 lines
Quoted 9 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLKQuoted 3 lines
Bjorn, shall we pick Arnd's patch up then ? We should be fixing this in one of the upcoming -rcs since we introduced it in the last merge window.
IIUC,
a115b1bd3af0("PCI: rcar: Add L1 link state fix into data abort hook") appeared in v5.15-rc1 and added a use of__clk_is_enabled(), which is only available when COMMON_CLK=y.
PCIE_RCAR_HOSTdepends onARCH_RENESAS||COMPILE_TEST.ARCH_RENESASis an ARM64 platform, so whenCOMPILE_TESTis not set, I think we get COMMON_CLK=y via this:config ARM64
selectCOMMON_CLKBut when
ARCH_RENESASis not set and COMPILE_TEST=y, there's nothing that enforces the dependency onCOMMON_CLK. Personally I like the first hunk of Marek's patch at [1] because the dependency onCOMMON_CLKis explicit:
Quoted 5 lines
Quoted 3 lines
config PCIE_RCAR_HOST depends on ARCH_RENESAS || COMPILE_TEST depends on COMMON_CLKAgreed, Marek's version is clearer than mine, please use that.
But PCIE_RCAR_EP does not need the dependency.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 39 lines · Geert Uytterhoeven
Quoted 38 lines · Arnd Bergmann
Quoted 37 lines · Bjorn Helgaas
Quoted 16 lines · Lorenzo Pieralisi
Quoted 14 lines · Marek Vasut
On 9/21/21 6:08 PM, Geert Uytterhoeven wrote:
[...]
Quoted 10 lines
Quoted 9 lines
drivers/pci/controller/Kconfig +1
-0@@ -66,6 +66,7 @@ config PCI_RCAR_GEN2 config PCIE_RCAR_HOST bool "Renesas R-Car PCIe host controller" depends on ARCH_RENESAS || COMPILE_TEST + depends on COMMON_CLKQuoted 3 lines
Bjorn, shall we pick Arnd's patch up then ? We should be fixing this in one of the upcoming -rcs since we introduced it in the last merge window.
IIUC,
a115b1bd3af0("PCI: rcar: Add L1 link state fix into data abort hook") appeared in v5.15-rc1 and added a use of__clk_is_enabled(), which is only available when COMMON_CLK=y.
PCIE_RCAR_HOSTdepends onARCH_RENESAS||COMPILE_TEST.ARCH_RENESASis an ARM64 platform, so whenCOMPILE_TESTis not set, I think we get COMMON_CLK=y via this:config ARM64
selectCOMMON_CLKBut when
ARCH_RENESASis not set and COMPILE_TEST=y, there's nothing that enforces the dependency onCOMMON_CLK. Personally I like the first hunk of Marek's patch at [1] because the dependency onCOMMON_CLKis explicit:
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
config PCIE_RCAR_HOST depends on ARCH_RENESAS || COMPILE_TEST depends on COMMON_CLKAgreed, Marek's version is clearer than mine, please use that.
But
PCIE_RCAR_EPdoes not need the dependency.
Right, that's why I said the *first* hunk of Marek's patch. I would apply that and skip the second one.
Stephen Boyd
maintainer+linux-clk as I don't regularly read my inbox :/
Quoting [email protected] (2021-09-07 07:45:12)
Quoted 17 lines
From: Marek Vasut <[email protected]>
Add
COMMON_CLKdependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld:drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This should be OK, since all platforms shipping this controller also
needCOMMON_CLKenabled for their clock driver.Fixes a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")Signed-off-by Marek Vasut <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Stephen Boyd <[email protected]>Cc Wolfram Sang <[email protected]>Cc Yoshihiro Shimoda <[email protected]>
Quoted 3 lines
---
+CC Stephen, please double-check whether this is the right approach or
whether there is some better option
Stop using __clk_is_enabled()? I don't quite understand what's going on in the code but __clk_is_enabled() should really go away. I thought we were close to doing that but now I see a handful of calls have come up. The API should be replaced by clk_hw_is_enabled() and then removed. We move it to clk_hw API so that only clk providers can look at it.
Sigh!
Anyway, fixing the dependency is "ok" but really the long term fix would be to not use a "is this clk enabled" sort of API. If I'm reading the code correctly, this is some sort of fault handler that's trying to avoid hanging the bus while handling the fault so it tries to make sure the clk is enabled first? Is it a problem if the clk is not actually enabled here? Would runtime PM enable state of the device work just as well?
Hi Stephen,
Quoted 24 lines · Stephen Boyd
+linux-clk as I don't regularly read my inbox :/
Quoting [email protected] (2021-09-07 07:45:12)
Quoted 17 lines
From: Marek Vasut <[email protected]>
Add
COMMON_CLKdependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld:drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This should be OK, since all platforms shipping this controller also
needCOMMON_CLKenabled for their clock driver.Fixes a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")Signed-off-by Marek Vasut <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Stephen Boyd <[email protected]>Cc Wolfram Sang <[email protected]>Cc Yoshihiro Shimoda <[email protected]>Quoted 3 lines
---
+CC Stephen, please double-check whether this is the right approach or
whether there is some better option
Quoted 5 lines
Stop using
__clk_is_enabled()? I don't quite understand what's going on in the code but__clk_is_enabled()should really go away. I thought we were close to doing that but now I see a handful of calls have come up. The API should be replaced byclk_hw_is_enabled()and then removed. We move it toclk_hwAPI so that only clk providers can look at it.
But this is not a clk provider...
Quoted 1 line
Sigh!
;-)
Quoted 7 lines
Anyway, fixing the dependency is "ok" but really the long term fix would be to not use a "is this clk enabled" sort of API. If I'm reading the code correctly, this is some sort of fault handler that's trying to avoid hanging the bus while handling the fault so it tries to make sure the clk is enabled first? Is it a problem if the clk is not actually enabled here? Would runtime PM enable state of the device work just as well?
Thanks, checking Runtime PM state is a good suggestion. Doing so would require caching a pointer to the PCIe struct device instead of the struct clk.
However, pcie_bus_clk is not the module clock, which is managed by Runtime PM, but the PCIe bus clock, which is managed explicitly by the driver.
However, I believe that we are checking the wrong clock, as register access needs the module clock to be enabled, not the PCIe bus clock? As the driver just calls pm_runtime_get_sync() and clk_prepare_enable() in .probe(), and never touches Runtime PM status or the PCIe bus clock during the further lifetime of the driver (it cannot be unloaded), both the module clock and the PCIe bus clock should always[*] be enabled when the static copy of the remapped PCIe controller address is valid. [*] Modulo system-wide power transitions like s2ram. Does
pm_runtime_suspended() reflect that state, too?
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Stephen Boyd
maintainerQuoting Geert Uytterhoeven (2021-09-30 01:01:24)
Quoted 33 lines
Hi Stephen,
Quoted 24 lines · Stephen Boyd
+linux-clk as I don't regularly read my inbox :/
Quoting [email protected] (2021-09-07 07:45:12)
Quoted 17 lines
From: Marek Vasut <[email protected]>
Add
COMMON_CLKdependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld:drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This should be OK, since all platforms shipping this controller also
needCOMMON_CLKenabled for their clock driver.Fixes a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")Signed-off-by Marek Vasut <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Stephen Boyd <[email protected]>Cc Wolfram Sang <[email protected]>Cc Yoshihiro Shimoda <[email protected]>Quoted 3 lines
---
+CC Stephen, please double-check whether this is the right approach or
whether there is some better optionQuoted 5 lines
Stop using
__clk_is_enabled()? I don't quite understand what's going on in the code but__clk_is_enabled()should really go away. I thought we were close to doing that but now I see a handful of calls have come up. The API should be replaced byclk_hw_is_enabled()and then removed. We move it toclk_hwAPI so that only clk providers can look at it.
Quoted 5 lines
But this is not a clk provider...
Quoted 1 line
Sigh!
;-)
Exactly!
Quoted 9 lines
Quoted 8 lines
Anyway, fixing the dependency is "ok" but really the long term fix would be to not use a "is this clk enabled" sort of API. If I'm reading the code correctly, this is some sort of fault handler that's trying to avoid hanging the bus while handling the fault so it tries to make sure the clk is enabled first? Is it a problem if the clk is not actually enabled here? Would runtime PM enable state of the device work just as well?
Quoted 16 lines
Thanks, checking Runtime PM state is a good suggestion. Doing so would require caching a pointer to the PCIe struct device instead of the struct clk.
However,pcie_bus_clkis not the module clock, which is managed by Runtime PM, but the PCIe bus clock, which is managed explicitly by the driver.
However, I believe that we are checking the wrong clock, as register access needs the module clock to be enabled, not the PCIe bus clock? As the driver just callspm_runtime_get_sync()andclk_prepare_enable()in .probe(), and never touches Runtime PM status or the PCIe bus clock during the further lifetime of the driver (it cannot be unloaded), both the module clock and the PCIe bus clock should always[*] be enabled when the static copy of the remapped PCIe controller address is valid. [*] Modulo system-wide power transitions like s2ram. Does
pm_runtime_suspended()reflect that state, too?
Great! If that's all correct then simply removing the call to __clk_is_enabled() should work. Can we do that?
Hi Stephen,
Quoted 66 lines · Stephen Boyd
Quoting Geert Uytterhoeven (2021-09-30 01:01:24)
Quoted 31 lines · Stephen Boyd
Quoted 24 lines
+linux-clk as I don't regularly read my inbox :/
Quoting [email protected] (2021-09-07 07:45:12)
Quoted 17 lines
From: Marek Vasut <[email protected]>
Add
COMMON_CLKdependency, otherwise the following build error occurs:
arm-linux-gnueabi-ld:drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
This should be OK, since all platforms shipping this controller also
needCOMMON_CLKenabled for their clock driver.Fixes a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")Signed-off-by Marek Vasut <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Stephen Boyd <[email protected]>Cc Wolfram Sang <[email protected]>Cc Yoshihiro Shimoda <[email protected]>Quoted 3 lines
---
+CC Stephen, please double-check whether this is the right approach or
whether there is some better optionQuoted 5 lines
Stop using
__clk_is_enabled()? I don't quite understand what's going on in the code but__clk_is_enabled()should really go away. I thought we were close to doing that but now I see a handful of calls have come up. The API should be replaced byclk_hw_is_enabled()and then removed. We move it toclk_hwAPI so that only clk providers can look at it.Quoted 5 lines
But this is not a clk provider...
Quoted 1 line
Sigh!
;-)
Exactly!
Quoted 9 lines
Quoted 8 lines
Anyway, fixing the dependency is "ok" but really the long term fix would be to not use a "is this clk enabled" sort of API. If I'm reading the code correctly, this is some sort of fault handler that's trying to avoid hanging the bus while handling the fault so it tries to make sure the clk is enabled first? Is it a problem if the clk is not actually enabled here? Would runtime PM enable state of the device work just as well?
Quoted 16 lines
Thanks, checking Runtime PM state is a good suggestion. Doing so would require caching a pointer to the PCIe struct device instead of the struct clk.
However,pcie_bus_clkis not the module clock, which is managed by Runtime PM, but the PCIe bus clock, which is managed explicitly by the driver.
However, I believe that we are checking the wrong clock, as register access needs the module clock to be enabled, not the PCIe bus clock? As the driver just callspm_runtime_get_sync()andclk_prepare_enable()in .probe(), and never touches Runtime PM status or the PCIe bus clock during the further lifetime of the driver (it cannot be unloaded), both the module clock and the PCIe bus clock should always[*] be enabled when the static copy of the remapped PCIe controller address is valid. [*] Modulo system-wide power transitions like s2ram. Does
pm_runtime_suspended()reflect that state, too?
Quoted 2 lines
Great! If that's all correct then simply removing the call to
__clk_is_enabled()should work. Can we do that?
We first have to double-check that pm_runtime_suspended() reflects the state, as the reason behind the fault handler is to fix lock-ups during system-wide power transitions.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds