lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 4 Aug 2022 10:42:05 +0800
From:   Macpaul Lin <macpaul.lin@...iatek.com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
CC:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>,
        Bear Wang <bear.wang@...iatek.com>,
        Pablo Sun <pablo.sun@...iatek.com>,
        Mediatek WSD Upstream <wsd_upstream@...iatek.com>,
        Macpaul Lin <macpaul@...il.com>, <stable@...r.kernel.org>
Subject: Re: [PATCH] usb: typec: altmodes/displayport: correct pin assignment
 for UFP receptacles

On 8/2/22 3:28 PM, Heikki Krogerus wrote:
> Hi guys,
> 
> On Wed, Jul 27, 2022 at 07:05:03PM +0800, Macpaul Lin wrote:
>> From: Pablo Sun <pablo.sun@...iatek.com>
>>
>> From: Pablo Sun <pablo.sun@...iatek.com>
> 
> Looks like there's something wrong with the formating of the patch
> here?

The duplicated line will be removed in patch v2.

>> Fix incorrect pin assignment values when connecting to a monitor with
>> Type-C receptacle instead of a plug.
>>
>> According to specification, an UFP_D receptacle's pin assignment
>> should came from the UFP_D pin assignments field (bit 23:16), while
>> an UFP_D plug's assignments are described in the DFP_D pin assignments
>> (bit 15:8) during Mode Discovery.
>>
>> For example the LG 27 UL850-W is a monitor with Type-C receptacle.
>> The monitor responds to MODE DISCOVERY command with following
>> DisplayPort Capability flag:
>>
>>          dp->alt->vdo=0x140045
>>
>> The existing logic only take cares of UPF_D plug case,
>> and would take the bit 15:8 for this 0x140045 case.
>>
>> This results in an non-existing pin assignment 0x0 in
>> dp_altmode_configure.
>>
>> To fix this problem a new set of macros are introduced
>> to take plug/receptacle differences into consideration.
>>
>> Co-developed-by: Pablo Sun <pablo.sun@...iatek.com>
>> Signed-off-by: Pablo Sun <pablo.sun@...iatek.com>
>> Co-developed-by: Macpaul Lin <macpaul.lin@...iatek.com>
>> Signed-off-by: Macpaul Lin <macpaul.lin@...iatek.com>
>> Reviewed-by: Guillaume Ranquet <granquet@...libre.com>
>> Cc: stable@...r.kernel.org
> 
> If this is a fix, then you need to have the "Fixes" tag that tells
> which commit the patch is fixing.

Thanks for the review.
Will add "Fixes" tag and "Reviewed-by" tags in patch v2.

>> ---
>>   drivers/usb/typec/altmodes/displayport.c | 4 ++--
>>   include/linux/usb/typec_dp.h             | 5 +++++
>>   2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/typec/altmodes/displayport.c
 b/drivers/usb/typec/altmodes/displayport.c
>> index 9360ca177c7d..8dd0e505ef99 100644
>> --- a/drivers/usb/typec/altmodes/displayport.c
>> +++ b/drivers/usb/typec/altmodes/displayport.c
>> @@ -98,8 +98,8 @@ static int dp_altmode_configure(struct dp_altmode *dp,
 u8 con)
>>   	case DP_STATUS_CON_UFP_D:
>>   	case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */
>>   		conf |= DP_CONF_UFP_U_AS_UFP_D;
>> -		pin_assign = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo) &
>> -			     DP_CAP_UFP_D_PIN_ASSIGN(dp->port->vdo);
>> +		pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) &
>> +				 DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo);
>>   		break;
>>   	default:
>>   		break;
>> diff --git a/include/linux/usb/typec_dp.h b/include/linux/usb/typec_dp.h
>> index cfb916cccd31..8d09c2f0a9b8 100644
>> --- a/include/linux/usb/typec_dp.h
>> +++ b/include/linux/usb/typec_dp.h
>> @@ -73,6 +73,11 @@ enum {
>>   #define DP_CAP_USB			BIT(7)
>>   #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_)	(((_cap_) & GENMASK(15, 8)) >>
 8)
>>   #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_)	(((_cap_) & GENMASK(23, 16)) >>
 16)
>> +/* Get pin assignment taking plug & receptacle into consideration */
>> +#define DP_CAP_PIN_ASSIGN_UFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
>> +			DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_))
>> +#define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
>> +			DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_))
>>   
>>   /* DisplayPort Status Update VDO bits */
>>   #define DP_STATUS_CONNECTION(_status_)	((_status_) & 3)
>> -- 
>> 2.18.0
> 
> thanks,
> 

Thanks.
Macpaul Lin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ