All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
@ 2018-01-22 20:12 ` Sinan Kaya
  0 siblings, 0 replies; 7+ messages in thread
From: Sinan Kaya @ 2018-01-22 20:12 UTC (permalink / raw)
  To: linux-pci, timur
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya, Bjorn Helgaas,
	Rajat Jain, Vidya Sagar, Yinghai Lu, Ard Biesheuvel, Kees Cook,
	Greg Kroah-Hartman, open list

Code is emitting warnings when it tries to set the common clock mode for
ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
Let's bail out silently in such a case.

pci 0004:00:00.0: ASPM: Could not configure common clock

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 9783e10..913b90d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
 	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
 		same_clock = 0;
 
+	/* Port might be already in common clock mode */
+	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
+	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
+		bool consistent = true;
+
+		list_for_each_entry(child, &linkbus->devices, bus_list) {
+			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
+						  &reg16);
+			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
+				consistent = false;
+				break;
+			}
+		}
+		if (consistent)
+			return;
+		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
+	}
+
 	/* Configure downstream component, all functions */
 	list_for_each_entry(child, &linkbus->devices, bus_list) {
 		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
@ 2018-01-22 20:12 ` Sinan Kaya
  0 siblings, 0 replies; 7+ messages in thread
From: Sinan Kaya @ 2018-01-22 20:12 UTC (permalink / raw)
  To: linux-pci, timur
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya, Bjorn Helgaas,
	Rajat Jain, Vidya Sagar, Yinghai Lu, Ard Biesheuvel, Kees Cook,
	Greg Kroah-Hartman, open list

Code is emitting warnings when it tries to set the common clock mode for
ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
Let's bail out silently in such a case.

pci 0004:00:00.0: ASPM: Could not configure common clock

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 9783e10..913b90d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
 	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
 		same_clock = 0;
 
+	/* Port might be already in common clock mode */
+	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
+	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
+		bool consistent = true;
+
+		list_for_each_entry(child, &linkbus->devices, bus_list) {
+			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
+						  &reg16);
+			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
+				consistent = false;
+				break;
+			}
+		}
+		if (consistent)
+			return;
+		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
+	}
+
 	/* Configure downstream component, all functions */
 	list_for_each_entry(child, &linkbus->devices, bus_list) {
 		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
@ 2018-01-22 20:12 ` Sinan Kaya
  0 siblings, 0 replies; 7+ messages in thread
From: Sinan Kaya @ 2018-01-22 20:12 UTC (permalink / raw)
  To: linux-pci, timur
  Cc: Kees Cook, Ard Biesheuvel, linux-arm-msm, open list, Vidya Sagar,
	Sinan Kaya, Greg Kroah-Hartman, Bjorn Helgaas, Rajat Jain,
	Yinghai Lu, linux-arm-kernel

Code is emitting warnings when it tries to set the common clock mode for
ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
Let's bail out silently in such a case.

pci 0004:00:00.0: ASPM: Could not configure common clock

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 9783e10..913b90d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
 	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
 		same_clock = 0;
 
+	/* Port might be already in common clock mode */
+	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
+	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
+		bool consistent = true;
+
+		list_for_each_entry(child, &linkbus->devices, bus_list) {
+			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
+						  &reg16);
+			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
+				consistent = false;
+				break;
+			}
+		}
+		if (consistent)
+			return;
+		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
+	}
+
 	/* Configure downstream component, all functions */
 	list_for_each_entry(child, &linkbus->devices, bus_list) {
 		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
-- 
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
@ 2018-01-22 20:12 ` Sinan Kaya
  0 siblings, 0 replies; 7+ messages in thread
From: Sinan Kaya @ 2018-01-22 20:12 UTC (permalink / raw)
  To: linux-arm-kernel

Code is emitting warnings when it tries to set the common clock mode for
ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
Let's bail out silently in such a case.

pci 0004:00:00.0: ASPM: Could not configure common clock

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 9783e10..913b90d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
 	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
 		same_clock = 0;
 
+	/* Port might be already in common clock mode */
+	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
+	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
+		bool consistent = true;
+
+		list_for_each_entry(child, &linkbus->devices, bus_list) {
+			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
+						  &reg16);
+			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
+				consistent = false;
+				break;
+			}
+		}
+		if (consistent)
+			return;
+		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
+	}
+
 	/* Configure downstream component, all functions */
 	list_for_each_entry(child, &linkbus->devices, bus_list) {
 		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
  2018-01-22 20:12 ` Sinan Kaya
  (?)
@ 2018-02-28 21:24   ` Bjorn Helgaas
  -1 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2018-02-28 21:24 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: linux-pci, timur, Kees Cook, Ard Biesheuvel, linux-arm-msm,
	open list, Vidya Sagar, Greg Kroah-Hartman, Bjorn Helgaas,
	Rajat Jain, Yinghai Lu, linux-arm-kernel

On Mon, Jan 22, 2018 at 03:12:01PM -0500, Sinan Kaya wrote:
> Code is emitting warnings when it tries to set the common clock mode for
> ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
> Let's bail out silently in such a case.
> 
> pci 0004:00:00.0: ASPM: Could not configure common clock
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>

Applied to pci/aspm for v4.17, thanks!

> ---
>  drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 9783e10..913b90d 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
>  	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
>  		same_clock = 0;
>  
> +	/* Port might be already in common clock mode */
> +	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
> +	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
> +		bool consistent = true;
> +
> +		list_for_each_entry(child, &linkbus->devices, bus_list) {
> +			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
> +						  &reg16);
> +			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
> +				consistent = false;
> +				break;
> +			}
> +		}
> +		if (consistent)
> +			return;
> +		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
> +	}
> +
>  	/* Configure downstream component, all functions */
>  	list_for_each_entry(child, &linkbus->devices, bus_list) {
>  		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
@ 2018-02-28 21:24   ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2018-02-28 21:24 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: Kees Cook, Ard Biesheuvel, linux-pci, timur, open list,
	Vidya Sagar, Greg Kroah-Hartman, linux-arm-msm, Bjorn Helgaas,
	Rajat Jain, Yinghai Lu, linux-arm-kernel

On Mon, Jan 22, 2018 at 03:12:01PM -0500, Sinan Kaya wrote:
> Code is emitting warnings when it tries to set the common clock mode for
> ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
> Let's bail out silently in such a case.
> 
> pci 0004:00:00.0: ASPM: Could not configure common clock
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>

Applied to pci/aspm for v4.17, thanks!

> ---
>  drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 9783e10..913b90d 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
>  	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
>  		same_clock = 0;
>  
> +	/* Port might be already in common clock mode */
> +	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
> +	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
> +		bool consistent = true;
> +
> +		list_for_each_entry(child, &linkbus->devices, bus_list) {
> +			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
> +						  &reg16);
> +			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
> +				consistent = false;
> +				break;
> +			}
> +		}
> +		if (consistent)
> +			return;
> +		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
> +	}
> +
>  	/* Configure downstream component, all functions */
>  	list_for_each_entry(child, &linkbus->devices, bus_list) {
>  		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure
@ 2018-02-28 21:24   ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2018-02-28 21:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 22, 2018 at 03:12:01PM -0500, Sinan Kaya wrote:
> Code is emitting warnings when it tries to set the common clock mode for
> ASPM and ASPM is already configured to common clock mode by the UEFI BIOS.
> Let's bail out silently in such a case.
> 
> pci 0004:00:00.0: ASPM: Could not configure common clock
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>

Applied to pci/aspm for v4.17, thanks!

> ---
>  drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 9783e10..913b90d 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
>  	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
>  		same_clock = 0;
>  
> +	/* Port might be already in common clock mode */
> +	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
> +	if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
> +		bool consistent = true;
> +
> +		list_for_each_entry(child, &linkbus->devices, bus_list) {
> +			pcie_capability_read_word(child, PCI_EXP_LNKCTL,
> +						  &reg16);
> +			if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
> +				consistent = false;
> +				break;
> +			}
> +		}
> +		if (consistent)
> +			return;
> +		dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n");
> +	}
> +
>  	/* Configure downstream component, all functions */
>  	list_for_each_entry(child, &linkbus->devices, bus_list) {
>  		pcie_capability_read_word(child, PCI_EXP_LNKCTL, &reg16);
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-28 21:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 20:12 [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure Sinan Kaya
2018-01-22 20:12 ` Sinan Kaya
2018-01-22 20:12 ` Sinan Kaya
2018-01-22 20:12 ` Sinan Kaya
2018-02-28 21:24 ` Bjorn Helgaas
2018-02-28 21:24   ` Bjorn Helgaas
2018-02-28 21:24   ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.