* [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination
@ 2023-10-18 20:34 RD Babiera
2023-10-18 22:29 ` Prashant Malani
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: RD Babiera @ 2023-10-18 20:34 UTC (permalink / raw)
To: heikki.krogerus, gregkh
Cc: linux-usb, linux-kernel, badhri, RD Babiera, stable
DisplayPort Alt Mode CTS test 10.3.8 states that both sides of the
connection shall be compatible with one another such that the connection
is not Source to Source or Sink to Sink.
The DisplayPort driver currently checks for a compatible pin configuration
that resolves into a source and sink combination. The CTS test is designed
to send a Discover Modes message that has a compatible pin configuration
but advertises the same port capability as the device; the current check
fails this.
Verify that the port and port partner resolve into a valid source and sink
combination before checking for a compatible pin configuration.
---
Changes since v1:
* Fixed styling errors
* Added DP_CAP_IS_UFP_D and DP_CAP_IS_DFP_D as macros to typec_dp.h
---
Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
Cc: stable@vger.kernel.org
Signed-off-by: RD Babiera <rdbabiera@google.com>
---
drivers/usb/typec/altmodes/displayport.c | 5 +++++
include/linux/usb/typec_dp.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 718da02036d8..9c17955da570 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -578,6 +578,11 @@ int dp_altmode_probe(struct typec_altmode *alt)
/* FIXME: Port can only be DFP_U. */
+ /* Make sure that the port and partner can resolve into source and sink */
+ if (!(DP_CAP_IS_DFP_D(port->vdo) && DP_CAP_IS_UFP_D(alt->vdo)) &&
+ !(DP_CAP_IS_UFP_D(port->vdo) && DP_CAP_IS_DFP_D(alt->vdo)))
+ return -ENODEV;
+
/* Make sure we have compatiple pin configurations */
if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
diff --git a/include/linux/usb/typec_dp.h b/include/linux/usb/typec_dp.h
index 1f358098522d..4e6c0479307f 100644
--- a/include/linux/usb/typec_dp.h
+++ b/include/linux/usb/typec_dp.h
@@ -67,6 +67,8 @@ enum {
#define DP_CAP_UFP_D 1
#define DP_CAP_DFP_D 2
#define DP_CAP_DFP_D_AND_UFP_D 3
+#define DP_CAP_IS_UFP_D(_cap_) (!!(DP_CAP_CAPABILITY(_cap_) & DP_CAP_UFP_D))
+#define DP_CAP_IS_DFP_D(_cap_) (!!(DP_CAP_CAPABILITY(_cap_) & DP_CAP_DFP_D))
#define DP_CAP_DP_SIGNALLING(_cap_) (((_cap_) & GENMASK(5, 2)) >> 2)
#define DP_CAP_SIGNALLING_HBR3 1
#define DP_CAP_SIGNALLING_UHBR10 2
base-commit: 5220d8b04a840fa09434072c866d032b163419e3
--
2.42.0.655.g421f12c284-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination
2023-10-18 20:34 [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination RD Babiera
@ 2023-10-18 22:29 ` Prashant Malani
2023-10-19 8:19 ` Heikki Krogerus
2023-10-21 10:51 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Prashant Malani @ 2023-10-18 22:29 UTC (permalink / raw)
To: RD Babiera
Cc: heikki.krogerus, gregkh, linux-usb, linux-kernel, badhri, stable
Hi RD,
On Oct 18 20:34, RD Babiera wrote:
> DisplayPort Alt Mode CTS test 10.3.8 states that both sides of the
> connection shall be compatible with one another such that the connection
> is not Source to Source or Sink to Sink.
>
> The DisplayPort driver currently checks for a compatible pin configuration
> that resolves into a source and sink combination. The CTS test is designed
> to send a Discover Modes message that has a compatible pin configuration
> but advertises the same port capability as the device; the current check
> fails this.
>
> Verify that the port and port partner resolve into a valid source and sink
> combination before checking for a compatible pin configuration.
>
> ---
> Changes since v1:
> * Fixed styling errors
> * Added DP_CAP_IS_UFP_D and DP_CAP_IS_DFP_D as macros to typec_dp.h
> ---
>
FWIW,
Reviewed-by: Prashant Malani <pmalani@chromium.org>
> Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: RD Babiera <rdbabiera@google.com>
BR,
-Prashant
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination
2023-10-18 20:34 [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination RD Babiera
2023-10-18 22:29 ` Prashant Malani
@ 2023-10-19 8:19 ` Heikki Krogerus
2023-10-21 10:51 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2023-10-19 8:19 UTC (permalink / raw)
To: RD Babiera; +Cc: gregkh, linux-usb, linux-kernel, badhri, stable
On Wed, Oct 18, 2023 at 08:34:09PM +0000, RD Babiera wrote:
> DisplayPort Alt Mode CTS test 10.3.8 states that both sides of the
> connection shall be compatible with one another such that the connection
> is not Source to Source or Sink to Sink.
>
> The DisplayPort driver currently checks for a compatible pin configuration
> that resolves into a source and sink combination. The CTS test is designed
> to send a Discover Modes message that has a compatible pin configuration
> but advertises the same port capability as the device; the current check
> fails this.
>
> Verify that the port and port partner resolve into a valid source and sink
> combination before checking for a compatible pin configuration.
>
> ---
> Changes since v1:
> * Fixed styling errors
> * Added DP_CAP_IS_UFP_D and DP_CAP_IS_DFP_D as macros to typec_dp.h
> ---
>
> Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: RD Babiera <rdbabiera@google.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/altmodes/displayport.c | 5 +++++
> include/linux/usb/typec_dp.h | 2 ++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index 718da02036d8..9c17955da570 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -578,6 +578,11 @@ int dp_altmode_probe(struct typec_altmode *alt)
>
> /* FIXME: Port can only be DFP_U. */
>
> + /* Make sure that the port and partner can resolve into source and sink */
> + if (!(DP_CAP_IS_DFP_D(port->vdo) && DP_CAP_IS_UFP_D(alt->vdo)) &&
> + !(DP_CAP_IS_UFP_D(port->vdo) && DP_CAP_IS_DFP_D(alt->vdo)))
> + return -ENODEV;
> +
> /* Make sure we have compatiple pin configurations */
> if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
> DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
> diff --git a/include/linux/usb/typec_dp.h b/include/linux/usb/typec_dp.h
> index 1f358098522d..4e6c0479307f 100644
> --- a/include/linux/usb/typec_dp.h
> +++ b/include/linux/usb/typec_dp.h
> @@ -67,6 +67,8 @@ enum {
> #define DP_CAP_UFP_D 1
> #define DP_CAP_DFP_D 2
> #define DP_CAP_DFP_D_AND_UFP_D 3
> +#define DP_CAP_IS_UFP_D(_cap_) (!!(DP_CAP_CAPABILITY(_cap_) & DP_CAP_UFP_D))
> +#define DP_CAP_IS_DFP_D(_cap_) (!!(DP_CAP_CAPABILITY(_cap_) & DP_CAP_DFP_D))
> #define DP_CAP_DP_SIGNALLING(_cap_) (((_cap_) & GENMASK(5, 2)) >> 2)
> #define DP_CAP_SIGNALLING_HBR3 1
> #define DP_CAP_SIGNALLING_UHBR10 2
>
> base-commit: 5220d8b04a840fa09434072c866d032b163419e3
> --
> 2.42.0.655.g421f12c284-goog
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination
2023-10-18 20:34 [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination RD Babiera
2023-10-18 22:29 ` Prashant Malani
2023-10-19 8:19 ` Heikki Krogerus
@ 2023-10-21 10:51 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2023-10-21 10:51 UTC (permalink / raw)
To: RD Babiera; +Cc: heikki.krogerus, linux-usb, linux-kernel, badhri, stable
On Wed, Oct 18, 2023 at 08:34:09PM +0000, RD Babiera wrote:
> DisplayPort Alt Mode CTS test 10.3.8 states that both sides of the
> connection shall be compatible with one another such that the connection
> is not Source to Source or Sink to Sink.
>
> The DisplayPort driver currently checks for a compatible pin configuration
> that resolves into a source and sink combination. The CTS test is designed
> to send a Discover Modes message that has a compatible pin configuration
> but advertises the same port capability as the device; the current check
> fails this.
>
> Verify that the port and port partner resolve into a valid source and sink
> combination before checking for a compatible pin configuration.
>
> ---
> Changes since v1:
> * Fixed styling errors
> * Added DP_CAP_IS_UFP_D and DP_CAP_IS_DFP_D as macros to typec_dp.h
> ---
Git stops the changelog at the first "---", so everything below:
> Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: RD Babiera <rdbabiera@google.com>
Is dropped, which is not what you want (did you try applying this
yourself?)
As the documentation describes, please put the change information that
you have here below this line:
> ---
So that it will not show up in the changelog.
Please fix up, add the reviews that you got, and submit a v3, as I can't
take this one as-is :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-21 10:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 20:34 [PATCH v2] usb: typec: altmodes/displayport: verify compatible source/sink role combination RD Babiera
2023-10-18 22:29 ` Prashant Malani
2023-10-19 8:19 ` Heikki Krogerus
2023-10-21 10:51 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).