* RE: [PATCH] Enter safe mode only when pins need to be reconfigured
[not found] <20220822054019.GA32363@abhijeet-NUC11PAHi5>
@ 2022-08-23 12:45 ` Khandelwal, Rajat
0 siblings, 0 replies; 4+ messages in thread
From: Khandelwal, Rajat @ 2022-08-23 12:45 UTC (permalink / raw)
To: Lee, Shawn C, heikki.krogerus@linux.intel.com, Greg KH
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
+Forgot to add Greg
-----Original Message-----
From: Lee, Shawn C <shawn.c.lee@intel.com>
Sent: Monday, August 22, 2022 11:10 AM
To: heikki.krogerus@linux.intel.com
Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Khandelwal, Rajat <rajat.khandelwal@intel.com>; Lee, Shawn C <shawn.c.lee@intel.com>
Subject: [PATCH] Enter safe mode only when pins need to be reconfigured
There is no point to enter safe mode during DP/TBT configuration
if the DP/TBT was already configured in mux. This is because safe
mode is only applicable when there is a need to reconfigure the
pins in order to avoid damage within/to port partner.
1. if HPD interrupt arrives and DP mode was already configured,
safe mode is entered again which is not desired.
2. in chrome systems, IOM/mux is already configured before OS
comes up. Thus, when driver is probed, it blindly enters safe
mode due to PD negotiations but only after gfx driver lowers
dp_phy_ownership, will the IOM complete safe mode and send
ack to PMC.
Since, that never happens, we see IPC timeout.
Hence, allow safe mode only when pin reconfiguration is not
required, which makes sense.
Signed-off-by: Rajat Khandelwal <rajat.khandelwal@intel.com>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
drivers/usb/typec/mux/intel_pmc_mux.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index d238913e996a..4bf84466d1ff 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -432,6 +432,25 @@ static int pmc_usb_connect(struct pmc_usb_port *port, enum usb_role role)
return pmc_usb_command(port, msg, sizeof(msg));
}
+static bool
+pmc_usb_mux_allow_to_enter_safe_mode(struct pmc_usb_port *port,
+ struct typec_mux_state *state)
+{
+ if ((IOM_PORT_ACTIVITY_IS(port->iom_status, DP) ||
+ IOM_PORT_ACTIVITY_IS(port->iom_status, DP_MFD)) &&
+ state->alt &&
+ state->alt->svid == USB_TYPEC_DP_SID)
+ return false;
+
+ if ((IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
+ IOM_PORT_ACTIVITY_IS(port->iom_status, ALT_MODE_TBT_USB)) &&
+ state->alt &&
+ state->alt->svid == USB_TYPEC_TBT_SID)
+ return false;
+
+ return true;
+}
+
static int
pmc_usb_mux_set(struct typec_mux *mux, struct typec_mux_state *state)
{
@@ -442,8 +461,13 @@ pmc_usb_mux_set(struct typec_mux *mux, struct typec_mux_state *state)
if (port->orientation == TYPEC_ORIENTATION_NONE || port->role == USB_ROLE_NONE)
return 0;
- if (state->mode == TYPEC_STATE_SAFE)
+ if (state->mode == TYPEC_STATE_SAFE) {
+ if (!pmc_usb_mux_allow_to_enter_safe_mode(port, state))
+ return 0;
+
return pmc_usb_mux_safe_state(port);
+ }
+
if (state->mode == TYPEC_STATE_USB)
return pmc_usb_connect(port, port->role);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] Enter safe mode only when pins need to be reconfigured
@ 2022-08-23 17:09 Rajat Khandelwal
2022-08-24 5:59 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Rajat Khandelwal @ 2022-08-23 17:09 UTC (permalink / raw)
To: heikki.krogerus, gregkh
Cc: rajat.khandelwal, shawn.c.lee, linux-usb, linux-kernel
From: Lee Shawn C <shawn.c.lee@intel.com>
There is no point to enter safe mode during DP/TBT configuration
if the DP/TBT was already configured in mux. This is because safe
mode is only applicable when there is a need to reconfigure the
pins in order to avoid damage within/to port partner.
1. if HPD interrupt arrives and DP mode was already configured,
safe mode is entered again which is not desired.
2. in chrome systems, IOM/mux is already configured before OS
comes up. Thus, when driver is probed, it blindly enters safe
mode due to PD negotiations but only after gfx driver lowers
dp_phy_ownership, will the IOM complete safe mode and send
ack to PMC.
Since, that never happens, we see IPC timeout.
Hence, allow safe mode only when pin reconfiguration is not
required, which makes sense.
Signed-off-by: Rajat Khandelwal <rajat.khandelwal@intel.com>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
drivers/usb/typec/mux/intel_pmc_mux.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index d238913e996a..4bf84466d1ff 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -432,6 +432,25 @@ static int pmc_usb_connect(struct pmc_usb_port *port, enum usb_role role)
return pmc_usb_command(port, msg, sizeof(msg));
}
+static bool
+pmc_usb_mux_allow_to_enter_safe_mode(struct pmc_usb_port *port,
+ struct typec_mux_state *state)
+{
+ if ((IOM_PORT_ACTIVITY_IS(port->iom_status, DP) ||
+ IOM_PORT_ACTIVITY_IS(port->iom_status, DP_MFD)) &&
+ state->alt &&
+ state->alt->svid == USB_TYPEC_DP_SID)
+ return false;
+
+ if ((IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
+ IOM_PORT_ACTIVITY_IS(port->iom_status, ALT_MODE_TBT_USB)) &&
+ state->alt &&
+ state->alt->svid == USB_TYPEC_TBT_SID)
+ return false;
+
+ return true;
+}
+
static int
pmc_usb_mux_set(struct typec_mux *mux, struct typec_mux_state *state)
{
@@ -442,8 +461,13 @@ pmc_usb_mux_set(struct typec_mux *mux, struct typec_mux_state *state)
if (port->orientation == TYPEC_ORIENTATION_NONE || port->role == USB_ROLE_NONE)
return 0;
- if (state->mode == TYPEC_STATE_SAFE)
+ if (state->mode == TYPEC_STATE_SAFE) {
+ if (!pmc_usb_mux_allow_to_enter_safe_mode(port, state))
+ return 0;
+
return pmc_usb_mux_safe_state(port);
+ }
+
if (state->mode == TYPEC_STATE_USB)
return pmc_usb_connect(port, port->role);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Enter safe mode only when pins need to be reconfigured
2022-08-23 17:09 [PATCH] Enter safe mode only when pins need to be reconfigured Rajat Khandelwal
@ 2022-08-24 5:59 ` Greg KH
2022-08-24 5:59 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-08-24 5:59 UTC (permalink / raw)
To: Rajat Khandelwal
Cc: heikki.krogerus, rajat.khandelwal, shawn.c.lee, linux-usb,
linux-kernel
On Tue, Aug 23, 2022 at 10:39:49PM +0530, Rajat Khandelwal wrote:
> From: Lee Shawn C <shawn.c.lee@intel.com>
>
> There is no point to enter safe mode during DP/TBT configuration
> if the DP/TBT was already configured in mux. This is because safe
> mode is only applicable when there is a need to reconfigure the
> pins in order to avoid damage within/to port partner.
>
> 1. if HPD interrupt arrives and DP mode was already configured,
> safe mode is entered again which is not desired.
> 2. in chrome systems, IOM/mux is already configured before OS
> comes up. Thus, when driver is probed, it blindly enters safe
> mode due to PD negotiations but only after gfx driver lowers
> dp_phy_ownership, will the IOM complete safe mode and send
> ack to PMC.
> Since, that never happens, we see IPC timeout.
>
> Hence, allow safe mode only when pin reconfiguration is not
> required, which makes sense.
>
> Signed-off-by: Rajat Khandelwal <rajat.khandelwal@intel.com>
> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
First off, don't use invalid "corp-partner.google.com" email addresses,
you know that's not going to work and just bounce everywhere and there's
no proof that this has any relationship to your intel address :(
And your signed-off-by chain is incorrect.
And most importantly, you did not follow the required Intel rules for
how to submit kernel patches. Please go work with your internal groups
to learn what is needed and how to do this properly. Until then, I'm
not allowed to take your changes at all, sorry.
> ---
> drivers/usb/typec/mux/intel_pmc_mux.c | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index d238913e996a..4bf84466d1ff 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -432,6 +432,25 @@ static int pmc_usb_connect(struct pmc_usb_port *port, enum usb_role role)
> return pmc_usb_command(port, msg, sizeof(msg));
> }
>
> +static bool
> +pmc_usb_mux_allow_to_enter_safe_mode(struct pmc_usb_port *port,
> + struct typec_mux_state *state)
> +{
> + if ((IOM_PORT_ACTIVITY_IS(port->iom_status, DP) ||
> + IOM_PORT_ACTIVITY_IS(port->iom_status, DP_MFD)) &&
> + state->alt &&
> + state->alt->svid == USB_TYPEC_DP_SID)
> + return false;
> +
> + if ((IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
> + IOM_PORT_ACTIVITY_IS(port->iom_status, ALT_MODE_TBT_USB)) &&
> + state->alt &&
> + state->alt->svid == USB_TYPEC_TBT_SID)
> + return false;
> +
> + return true;
Return normal 0/-ERROR for functions like this, don't mess with bool for
a return value, that's just confusing to everyone involved.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Enter safe mode only when pins need to be reconfigured
2022-08-24 5:59 ` Greg KH
@ 2022-08-24 5:59 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-08-24 5:59 UTC (permalink / raw)
To: Rajat Khandelwal
Cc: heikki.krogerus, rajat.khandelwal, shawn.c.lee, linux-usb,
linux-kernel
On Wed, Aug 24, 2022 at 07:59:08AM +0200, Greg KH wrote:
> On Tue, Aug 23, 2022 at 10:39:49PM +0530, Rajat Khandelwal wrote:
> > From: Lee Shawn C <shawn.c.lee@intel.com>
> >
> > There is no point to enter safe mode during DP/TBT configuration
> > if the DP/TBT was already configured in mux. This is because safe
> > mode is only applicable when there is a need to reconfigure the
> > pins in order to avoid damage within/to port partner.
> >
> > 1. if HPD interrupt arrives and DP mode was already configured,
> > safe mode is entered again which is not desired.
> > 2. in chrome systems, IOM/mux is already configured before OS
> > comes up. Thus, when driver is probed, it blindly enters safe
> > mode due to PD negotiations but only after gfx driver lowers
> > dp_phy_ownership, will the IOM complete safe mode and send
> > ack to PMC.
> > Since, that never happens, we see IPC timeout.
> >
> > Hence, allow safe mode only when pin reconfiguration is not
> > required, which makes sense.
> >
> > Signed-off-by: Rajat Khandelwal <rajat.khandelwal@intel.com>
> > Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
>
> First off, don't use invalid "corp-partner.google.com" email addresses,
> you know that's not going to work and just bounce everywhere and there's
> no proof that this has any relationship to your intel address :(
Also the email verification fails, so it looks like you just spoofed
this message, which also makes it impossible for me to accept.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-24 5:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 17:09 [PATCH] Enter safe mode only when pins need to be reconfigured Rajat Khandelwal
2022-08-24 5:59 ` Greg KH
2022-08-24 5:59 ` Greg KH
[not found] <20220822054019.GA32363@abhijeet-NUC11PAHi5>
2022-08-23 12:45 ` Khandelwal, Rajat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox