PCI: cadence: respond to received PTM Requests
PATCH 1/1 PCI: cadence: respond to received PTM Requests
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
--- drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++ drivers/pci/controller/cadence/pcie-cadence.h | 4 ++++ 2 files changed, 14 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-host.c +10 -0
@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)return ret; } +static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN ); +} +static int cdns_pcie_host_start_link (struct cdns_pcie_rc *rc) {struct cdns_pcie *pcie = &rc->pcie;
@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)if (rc->quirk_detect_quiet_flag)cdns_pcie_detect_quiet_min_delay_set (&rc->pcie); +cdns_pcie_host_enable_ptm_response (pcie); + ret =cdns_pcie_start_link (pcie);if (ret) {dev_err (dev,"Failed to start link\n" );
drivers/pci/controller/cadence/pcie-cadence.h +4 -0
@@ -116,6 +116,10 @@#define LM_RC_BAR_CFG_APERTURE (bar, aperture) \ (((aperture) - 2) << ((bar) * 8)) +/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8) +#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN BIT(17) +/* * Endpoint Function Registers (PCI configuration space for endpoint functions) */
Signature · 1 line
2.34.1
Update subject line to match previous conventions ("git log --oneline drivers/pci/controller/cadence/pcie-cadence-host.c" to see).
Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Update to imperative mood, e.g., "Enable Controller to ...":
https://chris.beams.io/posts/git-commit/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-tip.rst?id=v5.16#n134
Quoted 11 lines
Signed-off-by Christian Gmeiner <[email protected]>--- drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++ drivers/pci/controller/cadence/pcie-cadence.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/pci/controller/cadence/pcie-cadence-host.c +0
-0
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 9 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)return ret; } +static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );
I assume this is some device-specific enable bit that is effectively ANDed with PCI_PTM_CTRL_ENABLE in the Precision Time Measurement Capability?
Quoted 32 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +4
-0+} +static int cdns_pcie_host_start_link (struct cdns_pcie_rc *rc) {struct cdns_pcie *pcie = &rc->pcie;@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)if (rc->quirk_detect_quiet_flag)cdns_pcie_detect_quiet_min_delay_set (&rc->pcie); +cdns_pcie_host_enable_ptm_response (pcie); + ret =cdns_pcie_start_link (pcie);if (ret) {dev_err (dev,"Failed to start link\n" );drivers/pci/controller/cadence/pcie-cadence.h +4
-0@@ -116,6 +116,10 @@#define LM_RC_BAR_CFG_APERTURE (bar, aperture) \ (((aperture) - 2) << ((bar) * 8)) +/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8) +#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN BIT(17) +/* * Endpoint Function Registers (PCI configuration space for endpoint functions) */ Signature · 1 line
2.34.1
Hi
Am Mo., 31. Jan. 2022 um 23:05 Uhr schrieb Bjorn Helgaas <[email protected]>:
Quoted 4 lines
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).
Sure
Quoted 9 lines · Christian Gmeiner
Quoted 2 lines
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Update to imperative mood, e.g., "Enable Controller to ...":
https://chris.beams.io/posts/git-commit/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-tip.rst?id=v5.16#n134
Sure
Quoted 14 lines
Quoted 14 lines
Signed-off-by Christian Gmeiner <[email protected]>--- drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++ drivers/pci/controller/cadence/pcie-cadence.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/pci/controller/cadence/pcie-cadence-host.c +0
-0@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)return ret; }
Quoted 11 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?
That is a great question to which I have no answer yet. All I have is a PCIe based FPGA that wants a working PTM.
My target platform is an TI AM642 and I do not have a full picture of the pci layering used (cadence, pci-j721e and pci-keystone). All I have is the AM64x Technical Reference Manual (SPRUIM2C – SEPTEMBER 2021): https://www.ti.com/lit/pdf/SPRUIM2
There I found this register and the meaning of that bit.
I think it is a good idea to get some people with knowledge on board. So I will add Kishon Vijay Abraham I and Swapnil Jakhade to CC.
Quoted 22 lines
Quoted 22 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +4
-0+} +static int cdns_pcie_host_start_link (struct cdns_pcie_rc *rc) {struct cdns_pcie *pcie = &rc->pcie;@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)if (rc->quirk_detect_quiet_flag)cdns_pcie_detect_quiet_min_delay_set (&rc->pcie); +cdns_pcie_host_enable_ptm_response (pcie); + ret =cdns_pcie_start_link (pcie);if (ret) {dev_err (dev,"Failed to start link\n" );drivers/pci/controller/cadence/pcie-cadence.h +0
-0@@ -116,6 +116,10 @@#define LM_RC_BAR_CFG_APERTURE (bar, aperture) \ (((aperture) - 2) << ((bar) * 8))
Quoted 10 lines
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence.h +4
-1+/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8) +#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN BIT(17) +/* * Endpoint Function Registers (PCI configuration space for endpoint functions) */ --2.34.1
--
greets
--
Christian Gmeiner, MSc
Hi Bjorn,
Quoted 26 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Update to imperative mood, e.g., "Enable Controller to ...":
https://chris.beams.io/posts/git-commit/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-tip.rst?id=v5.16#n134Quoted 14 lines
Signed-off-by Christian Gmeiner <[email protected]>--- drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++ drivers/pci/controller/cadence/pcie-cadence.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/pci/controller/cadence/pcie-cadence-host.c +0
-0@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)return ret; }
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Thanks,
Kishon
Quoted 33 lines
Quoted 33 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +4
-0+} +static int cdns_pcie_host_start_link (struct cdns_pcie_rc *rc) {struct cdns_pcie *pcie = &rc->pcie;@@ -501,6 +509,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)if (rc->quirk_detect_quiet_flag)cdns_pcie_detect_quiet_min_delay_set (&rc->pcie); +cdns_pcie_host_enable_ptm_response (pcie); + ret =cdns_pcie_start_link (pcie);if (ret) {dev_err (dev,"Failed to start link\n" );drivers/pci/controller/cadence/pcie-cadence.h +4
-0@@ -116,6 +116,10 @@#define LM_RC_BAR_CFG_APERTURE (bar, aperture) \ (((aperture) - 2) << ((bar) * 8)) +/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8) +#define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN BIT(17) +/* * Endpoint Function Registers (PCI configuration space for endpoint functions) */ Signature · 1 line
2.34.1
Hi Bjorn,
Am Fr., 18. Feb. 2022 um 11:56 Uhr schrieb Kishon Vijay Abraham I <[email protected]>:
Quoted 41 lines
Hi Bjorn,
Quoted 26 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Update to imperative mood, e.g., "Enable Controller to ...":
https://chris.beams.io/posts/git-commit/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-tip.rst?id=v5.16#n134Quoted 14 lines
Signed-off-by Christian Gmeiner <[email protected]>--- drivers/pci/controller/cadence/pcie-cadence-host.c | 10 ++++++++++ drivers/pci/controller/cadence/pcie-cadence.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/pci/controller/cadence/pcie-cadence-host.c +0
-0@@ -123,6 +123,14 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)return ret; }Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?
Quoted 3 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
With that information is it okay for you that I send a V2 of this patch with an improved commit message or do
you see any other problems that I need to take into account?
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
Quoted 22 lines · Kishon Vijay Abraham I
Hi Bjorn,
Quoted 8 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?
Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Great! Christian, can you update the commit log to reflect that both this bit *and* PCI_PTM_CTRL_ENABLE must be set for the RP to respond to received PTM Requests?
When CDNS_PCIE_LM_TPM_CTRL_PTMRSEN is cleared, do PCI_PTM_CAP_ROOT and the PTM Responder Capable bit (for which we don't have a #define) read as zero?
I think that would be the correct behavior per PCIe r6.0, sec 7.9.15.2, and it would avoid the confusion of having the PTM Capability register advertise functionality that cannot be enabled via the PTM Control register.
Quoted 2 lines
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h line 120
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h +2
-0+/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8)
Other #defines in this file use lower-case hex.
Bjorn
Hi Bjorn,
Am Fr., 18. Feb. 2022 um 14:20 Uhr schrieb Bjorn Helgaas <[email protected]>:
Quoted 24 lines · Kishon Vijay Abraham I
Quoted 22 lines
Hi Bjorn,
Quoted 18 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 10 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?
Quoted 7 lines
Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Great! Christian, can you update the commit log to reflect that both this bit *and*
PCI_PTM_CTRL_ENABLEmust be set for the RP to respond to received PTM Requests?
Would something like this work for you?
---8<---
PCI: cadence: Enable Controller to respond to received PTM Requests
This enables the Controller [RP] to automatically respond with Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN and PCI_PTM_CTRL_ENABLE bits are both set.
---8<---
Quoted 4 lines
When
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared, doPCI_PTM_CAP_ROOTand the PTM Responder Capable bit (for which we don't have a #define) read as zero?
I can test this out if needed for this change.. but that won't happen before Monday.
Quoted 9 lines
I think that would be the correct behavior per PCIe r6.0, sec 7.9.15.2, and it would avoid the confusion of having the PTM Capability register advertise functionality that cannot be enabled via the PTM Control register.
Quoted 2 lines
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h line 120
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h +2
-0+/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8)Other #defines in this file use lower-case hex.
I changed this in V2.
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
Hi Bjorn,
Quoted 26 lines · Bjorn Helgaas
Quoted 22 lines · Kishon Vijay Abraham I
Hi Bjorn,
Quoted 8 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Quoted 7 lines
Great! Christian, can you update the commit log to reflect that both this bit *and*
PCI_PTM_CTRL_ENABLEmust be set for the RP to respond to received PTM Requests?When
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared, doPCI_PTM_CAP_ROOTand the PTM Responder Capable bit (for which we don't have a #define) read as zero?
I see both PTM Responder Capable bit and PTM Root Capable is by-default set to '1'.
root@am64xx-evm:~# devmem2 0xD000A24
/dev/mem opened.
Memory mapped at address 0xffffa8980000.
Read at address 0x0D000A24 (0xffffa8980a24): 0x00000406
And this bit can be programmed through the local management APB interface if required.
But with this patch which enables PTM by default for RC, it wouldn't be required to clear those bits.
Thanks,
Kishon
Quoted 13 lines
I think that would be the correct behavior per PCIe r6.0, sec 7.9.15.2, and it would avoid the confusion of having the PTM Capability register advertise functionality that cannot be enabled via the PTM Control register.
Quoted 2 lines
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h line 120
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h +2
-0+/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8)Other #defines in this file use lower-case hex.
Bjorn
Quoted 33 lines · Kishon Vijay Abraham I
Hi Bjorn,
Quoted 30 lines · Bjorn Helgaas
Quoted 22 lines · Kishon Vijay Abraham I
Hi Bjorn,
Quoted 8 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Great! Christian, can you update the commit log to reflect that both this bit *and*
PCI_PTM_CTRL_ENABLEmust be set for the RP to respond to received PTM Requests?
Quoted 5 lines
Quoted 3 lines
When
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared, doPCI_PTM_CAP_ROOTand the PTM Responder Capable bit (for which we don't have a #define) read as zero?I see both PTM Responder Capable bit and PTM Root Capable is by-default set to '1'.
Without this patch applied and with no other SW setting CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, correct ?
Quoted 10 lines
root@am64xx-evm:~# devmem2 0xD000A24
/dev/memopened.
Memory mapped at address0xffffa8980000.
Read at address0x0D000A24(0xffffa8980a24):0x00000406And this bit can be programmed through the local management APB interface if required.
Which bit ? CDNS_PCIE_LM_TPM_CTRL_PTMRSEN ?
Quoted 2 lines
But with this patch which enables PTM by default for RC, it wouldn't be required to clear those bits.
Yes but that does not comply with the specifications as Bjorn pointed out below.
We can merge this patch but it would be good to investigate on this point.
Thanks,
Lorenzo
Quoted 15 lines
Thanks,
KishonQuoted 13 lines
I think that would be the correct behavior per PCIe r6.0, sec 7.9.15.2, and it would avoid the confusion of having the PTM Capability register advertise functionality that cannot be enabled via the PTM Control register.
Quoted 2 lines
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h line 120
Quoted 2 lines
drivers/pci/controller/cadence/pcie-cadence.h +2
-0+/* PTM Control Register */ +#define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0DA8)Other #defines in this file use lower-case hex.
Bjorn
Quoted 50 lines · Lorenzo Pieralisi
Quoted 28 lines · Kishon Vijay Abraham I
Quoted 27 lines · Bjorn Helgaas
Quoted 19 lines · Kishon Vijay Abraham I
Quoted 7 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Quoted 10 lines
drivers/pci/controller/cadence/pcie-cadence-host.c static int cdns_pcie_retrain(struct cdns_pcie *pcie) · line 131
Quoted 6 lines
drivers/pci/controller/cadence/pcie-cadence-host.c +6
-0+static void cdns_pcie_host_enable_ptm_response (struct cdns_pcie *pcie) +{ +u32 val; + + val =cdns_pcie_readl (pcie,CDNS_PCIE_LM_PTM_CTRL ); +cdns_pcie_writel (pcie,CDNS_PCIE_LM_PTM_CTRL , val |CDNS_PCIE_LM_TPM_CTRL_PTMRSEN );I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Great! Christian, can you update the commit log to reflect that both this bit *and*
PCI_PTM_CTRL_ENABLEmust be set for the RP to respond to received PTM Requests?Quoted 6 lines
Quoted 3 lines
When
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared, doPCI_PTM_CAP_ROOTand the PTM Responder Capable bit (for which we don't have a #define) read as zero?I see both PTM Responder Capable bit and PTM Root Capable is by-default set to '1'.
Without this patch applied and with no other SW setting
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, correct ?Quoted 8 lines
root@am64xx-evm:~# devmem2 0xD000A24
/dev/memopened.
Memory mapped at address0xffffa8980000.
Read at address0x0D000A24(0xffffa8980a24):0x00000406And this bit can be programmed through the local management APB interface if required.
Which bit ?
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN?
Quoted 8 lines
Quoted 2 lines
But with this patch which enables PTM by default for RC, it wouldn't be required to clear those bits.
Yes but that does not comply with the specifications as Bjorn pointed out below.
We can merge this patch but it would be good to investigate on this point.
I *think* this is OK. Correct me if I'm wrong:
- We're talking about a Root Port.
- The Root Port's PTM Capability reads as 0x00000406 (PTM Responder Capable and PTM Root Capable set).
- Without this patch, setting PTM Enable does nothing, and the Root Port does not send PTM Responses.
This is the non-conforming situation because the Port claims that it implements the PTM Responder role, but it can't actually be enabled.
- With this patch that sets CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, the PTM Enable bit still powers up as zero, so the Port does not send PTM Responses, but setting PTM Enable enables PTM Responses from the Root Port.
So I think that after setting CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, the PTM capability works as per spec.
I think the proposed subject of "Enable Controller to respond to received PTM Requests" is somewhat misleading, though, because PTM responses still aren't enabled until we set PTM Enable. I suggest something like:
PCI: cadence: Allow PTM Responder to be enabled
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I think that would be the correct behavior per PCIe r6.0, sec 7.9.15.2, and it would avoid the confusion of having the PTM Capability register advertise functionality that cannot be enabled via the PTM Control register.
Quoted 34 lines · Bjorn Helgaas
Quoted 33 lines · Lorenzo Pieralisi
Quoted 32 lines · Kishon Vijay Abraham I
Quoted 30 lines · Bjorn Helgaas
Quoted 19 lines · Kishon Vijay Abraham I
Quoted 7 lines · Bjorn Helgaas
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Quoted 10 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie) +{ + u32 val; + + val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL); + cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN);I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Great! Christian, can you update the commit log to reflect that both this bit *and*
PCI_PTM_CTRL_ENABLEmust be set for the RP to respond to received PTM Requests?When
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared, doPCI_PTM_CAP_ROOTand the PTM Responder Capable bit (for which we don't have a #define) read as zero?
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
I see both PTM Responder Capable bit and PTM Root Capable is by-default set to '1'.
Without this patch applied and with no other SW setting
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, correct ?
Yes. The capability bits default to '1', even if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN is cleared. Strictly speaking the current behavior is wrong, and the capability bits should be cleared instead.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
root@am64xx-evm:~# devmem2 0xD000A24
/dev/memopened.
Memory mapped at address0xffffa8980000.
Read at address0x0D000A24(0xffffa8980a24):0x00000406And this bit can be programmed through the local management APB interface if required.
Which bit ?
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN?
I believe "these bits" would have been more correct. Since these are capability bits, the AM64* TRM lists them as read-only, but of course they can be modified. To write them, you need to set bit [21], e.g. you can write the PTM capability register at address 0xD200A24. At the TRM address 0xD000A24 it is read-only.
Quoted 20 lines
Quoted 9 lines
Quoted 3 lines
But with this patch which enables PTM by default for RC, it wouldn't be required to clear those bits.
Yes but that does not comply with the specifications as Bjorn pointed out below.
We can merge this patch but it would be good to investigate on this point.
I *think* this is OK. Correct me if I'm wrong:
- We're talking about a Root Port.
- The Root Port's PTM Capability reads as
0x00000406(PTM Responder Capable and PTM Root Capable set).- Without this patch, setting PTM Enable does nothing, and the Root Port does not send PTM Responses.
Quoted 8 lines
This is the non-conforming situation because the Port claims that it implements the PTM Responder role, but it can't actually be enabled.
- With this patch that sets
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, the PTM Enable bit still powers up as zero, so the Port does not send PTM Responses, but setting PTM Enable enables PTM Responses from the Root Port.
This is correct.
Quoted 10 lines
So I think that after setting
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, the PTM capability works as per spec.I think the proposed subject of "Enable Controller to respond to received PTM Requests" is somewhat misleading, though, because PTM responses still aren't enabled until we set PTM Enable. I suggest something like:
PCI: cadence: Allow PTM Responder to be enabled
I'll ask Christian for permission to resend his patch with the subject changed.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I think that would be the correct behavior per PCIe r6.0, sec 7.9.15.2, and it would avoid the confusion of having the PTM Capability register advertise functionality that cannot be enabled via the PTM Control register.
Am Do., 5. Mai 2022 um 16:43 Uhr schrieb Dominic Rath <[email protected]>:
Quoted 103 lines · Bjorn Helgaas
Quoted 34 lines · Lorenzo Pieralisi
Quoted 33 lines · Kishon Vijay Abraham I
Quoted 32 lines · Bjorn Helgaas
Quoted 30 lines · Kishon Vijay Abraham I
Quoted 19 lines · Bjorn Helgaas
Quoted 7 lines
Update subject line to match previous conventions ("git log --oneline
drivers/pci/controller/cadence/pcie-cadence-host.c" to see).Quoted 2 lines · Christian Gmeiner
This enables the Controller [RP] to automatically respond with Response/ResponseD messages.
Quoted 10 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie) +{ + u32 val; + + val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL); + cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN);I assume this is some device-specific enable bit that is effectively ANDed with
PCI_PTM_CTRL_ENABLEin the Precision Time Measurement Capability?Quoted 2 lines
That's correct. This bit enables Controller [RP] to respond to the received PTM Requests.
Great! Christian, can you update the commit log to reflect that both this bit *and*
PCI_PTM_CTRL_ENABLEmust be set for the RP to respond to received PTM Requests?When
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared, doPCI_PTM_CAP_ROOTand the PTM Responder Capable bit (for which we don't have a #define) read as zero?Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
I see both PTM Responder Capable bit and PTM Root Capable is by-default set to '1'.
Without this patch applied and with no other SW setting
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, correct ?Yes. The capability bits default to '1', even if
CDNS_PCIE_LM_TPM_CTRL_PTMRSENis cleared. Strictly speaking the current behavior is wrong, and the capability bits should be cleared instead.Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
root@am64xx-evm:~# devmem2 0xD000A24
/dev/memopened.
Memory mapped at address0xffffa8980000.
Read at address0x0D000A24(0xffffa8980a24):0x00000406And this bit can be programmed through the local management APB interface if required.
Which bit ?
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN?I believe "these bits" would have been more correct. Since these are capability bits, the AM64* TRM lists them as read-only, but of course they can be modified. To write them, you need to set bit [21], e.g. you can write the PTM capability register at address
0xD200A24. At the TRM address0xD000A24it is read-only.Quoted 20 lines
Quoted 9 lines
Quoted 3 lines
But with this patch which enables PTM by default for RC, it wouldn't be required to clear those bits.
Yes but that does not comply with the specifications as Bjorn pointed out below.
We can merge this patch but it would be good to investigate on this point.
I *think* this is OK. Correct me if I'm wrong:
- We're talking about a Root Port.
- The Root Port's PTM Capability reads as
0x00000406(PTM Responder Capable and PTM Root Capable set).- Without this patch, setting PTM Enable does nothing, and the Root Port does not send PTM Responses.
Quoted 8 lines
This is the non-conforming situation because the Port claims that it implements the PTM Responder role, but it can't actually be enabled.
- With this patch that sets
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, the PTM Enable bit still powers up as zero, so the Port does not send PTM Responses, but setting PTM Enable enables PTM Responses from the Root Port.This is correct.
Quoted 9 lines
So I think that after setting
CDNS_PCIE_LM_TPM_CTRL_PTMRSEN, the PTM capability works as per spec.I think the proposed subject of "Enable Controller to respond to received PTM Requests" is somewhat misleading, though, because PTM responses still aren't enabled until we set PTM Enable. I suggest something like:
Quoted 5 lines
Quoted 1 line
PCI: cadence: Allow PTM Responder to be enabled
I'll ask Christian for permission to resend his patch with the subject changed.
I will send a new version tomorrow with an improved subject line.
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
On Thu, May 05, 2022 at 04:48:17PM +0200, Christian Gmeiner wrote:
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I think the proposed subject of "Enable Controller to respond to received PTM Requests" is somewhat misleading, though, because PTM responses still aren't enabled until we set PTM Enable. I suggest something like:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
PCI: cadence: Allow PTM Responder to be enabled
I'll ask Christian for permission to resend his patch with the subject changed.
I will send a new version tomorrow with an improved subject line.
Hi Christian,
just asking if you are about to post a new version to pick it up.
Thanks,
Lorenzo
Am Mi., 11. Mai 2022 um 14:37 Uhr schrieb Lorenzo Pieralisi <[email protected]>:
Quoted 12 lines · Christian Gmeiner
[...]
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I think the proposed subject of "Enable Controller to respond to received PTM Requests" is somewhat misleading, though, because PTM responses still aren't enabled until we set PTM Enable. I suggest something like:
PCI: cadence: Allow PTM Responder to be enabled
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
I'll ask Christian for permission to resend his patch with the subject changed.
I will send a new version tomorrow with an improved subject line.
Hi Christian,
Hi Lorenzo
Quoted 3 lines
just asking if you are about to post a new version to pick it up.
Sorry for the delay .. send out V3:
https://lore.kernel.org/lkml/[email protected]/
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy