public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
@ 2024-09-04 14:52 Krzysztof Kozlowski
  2024-09-05  6:11 ` Liao, Bard
  2024-09-09 14:36 ` Charles Keepax
  0 siblings, 2 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-04 14:52 UTC (permalink / raw)
  To: Vinod Koul, Bard Liao, Pierre-Louis Bossart, Sanyog Kale,
	Krzysztof Kozlowski, alsa-devel, linux-kernel

This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
breaks codecs using non-continuous masks in source and sink ports.  The
commit missed the point that port numbers are not used as indices for
iterating over prop.sink_ports or prop.source_ports.

Soundwire core and existing codecs expect that the array passed as
prop.sink_ports and prop.source_ports is continuous.  The port mask still
might be non-continuous, but that's unrelated.

Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

I will need to fix my codec drivers, but that's independent.
---
 drivers/soundwire/stream.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index f275143d7b18..7aa4900dcf31 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1291,18 +1291,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,
 					    unsigned int port_num)
 {
 	struct sdw_dpn_prop *dpn_prop;
-	unsigned long mask;
+	u8 num_ports;
 	int i;
 
 	if (direction == SDW_DATA_DIR_TX) {
-		mask = slave->prop.source_ports;
+		num_ports = hweight32(slave->prop.source_ports);
 		dpn_prop = slave->prop.src_dpn_prop;
 	} else {
-		mask = slave->prop.sink_ports;
+		num_ports = hweight32(slave->prop.sink_ports);
 		dpn_prop = slave->prop.sink_dpn_prop;
 	}
 
-	for_each_set_bit(i, &mask, 32) {
+	for (i = 0; i < num_ports; i++) {
 		if (dpn_prop[i].num == port_num)
 			return &dpn_prop[i];
 	}
-- 
2.43.0


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

* Re: [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
  2024-09-04 14:52 [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps" Krzysztof Kozlowski
@ 2024-09-05  6:11 ` Liao, Bard
  2024-09-09 14:36 ` Charles Keepax
  1 sibling, 0 replies; 7+ messages in thread
From: Liao, Bard @ 2024-09-05  6:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Vinod Koul, Pierre-Louis Bossart,
	Sanyog Kale, alsa-devel, linux-kernel


On 9/4/2024 10:52 PM, Krzysztof Kozlowski wrote:
> This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
> breaks codecs using non-continuous masks in source and sink ports.  The
> commit missed the point that port numbers are not used as indices for
> iterating over prop.sink_ports or prop.source_ports.
>
> Soundwire core and existing codecs expect that the array passed as
> prop.sink_ports and prop.source_ports is continuous.  The port mask still
> might be non-continuous, but that's unrelated.
>
> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
> Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Acked-by: Bard Liao <yung-chuan.liao@linux.intel.com>

> ---
>
> I will need to fix my codec drivers, but that's independent.
> ---
>   drivers/soundwire/stream.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index f275143d7b18..7aa4900dcf31 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -1291,18 +1291,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,
>   					    unsigned int port_num)
>   {
>   	struct sdw_dpn_prop *dpn_prop;
> -	unsigned long mask;
> +	u8 num_ports;
>   	int i;
>   
>   	if (direction == SDW_DATA_DIR_TX) {
> -		mask = slave->prop.source_ports;
> +		num_ports = hweight32(slave->prop.source_ports);
>   		dpn_prop = slave->prop.src_dpn_prop;
>   	} else {
> -		mask = slave->prop.sink_ports;
> +		num_ports = hweight32(slave->prop.sink_ports);
>   		dpn_prop = slave->prop.sink_dpn_prop;
>   	}
>   
> -	for_each_set_bit(i, &mask, 32) {
> +	for (i = 0; i < num_ports; i++) {
>   		if (dpn_prop[i].num == port_num)
>   			return &dpn_prop[i];
>   	}

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

* Re: [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
  2024-09-04 14:52 [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps" Krzysztof Kozlowski
  2024-09-05  6:11 ` Liao, Bard
@ 2024-09-09 14:36 ` Charles Keepax
  2024-09-09 15:45   ` Pierre-Louis Bossart
  1 sibling, 1 reply; 7+ messages in thread
From: Charles Keepax @ 2024-09-09 14:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Vinod Koul, Bard Liao, Pierre-Louis Bossart, Sanyog Kale,
	alsa-devel, linux-kernel

On Wed, Sep 04, 2024 at 04:52:28PM +0200, Krzysztof Kozlowski wrote:
> This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
> breaks codecs using non-continuous masks in source and sink ports.  The
> commit missed the point that port numbers are not used as indices for
> iterating over prop.sink_ports or prop.source_ports.
> 
> Soundwire core and existing codecs expect that the array passed as
> prop.sink_ports and prop.source_ports is continuous.  The port mask still
> might be non-continuous, but that's unrelated.
> 
> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
> Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---

Would be good to merge this as soon as we can, this is causing
soundwire regressions from rc6 onwards.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
  2024-09-09 14:36 ` Charles Keepax
@ 2024-09-09 15:45   ` Pierre-Louis Bossart
  2024-09-09 16:08     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre-Louis Bossart @ 2024-09-09 15:45 UTC (permalink / raw)
  To: Charles Keepax, Krzysztof Kozlowski
  Cc: Vinod Koul, Bard Liao, Sanyog Kale, alsa-devel, linux-kernel,
	stable@vger.kernel.org



On 9/9/24 16:36, Charles Keepax wrote:
> On Wed, Sep 04, 2024 at 04:52:28PM +0200, Krzysztof Kozlowski wrote:
>> This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
>> breaks codecs using non-continuous masks in source and sink ports.  The
>> commit missed the point that port numbers are not used as indices for
>> iterating over prop.sink_ports or prop.source_ports.
>>
>> Soundwire core and existing codecs expect that the array passed as
>> prop.sink_ports and prop.source_ports is continuous.  The port mask still
>> might be non-continuous, but that's unrelated.
>>
>> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
>> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
>> Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
> 
> Would be good to merge this as soon as we can, this is causing
> soundwire regressions from rc6 onwards.

the revert also needs to happen in -stable. 6.10.8 is broken as well.

https://github.com/thesofproject/linux/issues/5168



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

* Re: [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
  2024-09-09 15:45   ` Pierre-Louis Bossart
@ 2024-09-09 16:08     ` Krzysztof Kozlowski
  2024-09-09 16:23       ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-09 16:08 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Charles Keepax
  Cc: Vinod Koul, Bard Liao, Sanyog Kale, alsa-devel, linux-kernel,
	stable@vger.kernel.org

On 09/09/2024 17:45, Pierre-Louis Bossart wrote:
> 
> 
> On 9/9/24 16:36, Charles Keepax wrote:
>> On Wed, Sep 04, 2024 at 04:52:28PM +0200, Krzysztof Kozlowski wrote:
>>> This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
>>> breaks codecs using non-continuous masks in source and sink ports.  The
>>> commit missed the point that port numbers are not used as indices for
>>> iterating over prop.sink_ports or prop.source_ports.
>>>
>>> Soundwire core and existing codecs expect that the array passed as
>>> prop.sink_ports and prop.source_ports is continuous.  The port mask still
>>> might be non-continuous, but that's unrelated.
>>>
>>> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
>>> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
>>> Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>
>>> ---
>>
>> Would be good to merge this as soon as we can, this is causing
>> soundwire regressions from rc6 onwards.
> 
> the revert also needs to happen in -stable. 6.10.8 is broken as well.

It will happen. You do not need to Cc-stable (and it will not help, will
not be picked), because this is marked as fix for existing commit.

Best regards,
Krzysztof


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

* Re: [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
  2024-09-09 16:08     ` Krzysztof Kozlowski
@ 2024-09-09 16:23       ` Greg KH
  2024-09-09 16:45         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2024-09-09 16:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Pierre-Louis Bossart, Charles Keepax, Vinod Koul, Bard Liao,
	Sanyog Kale, alsa-devel, linux-kernel, stable@vger.kernel.org

On Mon, Sep 09, 2024 at 06:08:14PM +0200, Krzysztof Kozlowski wrote:
> On 09/09/2024 17:45, Pierre-Louis Bossart wrote:
> > 
> > 
> > On 9/9/24 16:36, Charles Keepax wrote:
> >> On Wed, Sep 04, 2024 at 04:52:28PM +0200, Krzysztof Kozlowski wrote:
> >>> This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
> >>> breaks codecs using non-continuous masks in source and sink ports.  The
> >>> commit missed the point that port numbers are not used as indices for
> >>> iterating over prop.sink_ports or prop.source_ports.
> >>>
> >>> Soundwire core and existing codecs expect that the array passed as
> >>> prop.sink_ports and prop.source_ports is continuous.  The port mask still
> >>> might be non-continuous, but that's unrelated.
> >>>
> >>> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> >>> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
> >>> Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
> >>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >>>
> >>> ---
> >>
> >> Would be good to merge this as soon as we can, this is causing
> >> soundwire regressions from rc6 onwards.
> > 
> > the revert also needs to happen in -stable. 6.10.8 is broken as well.
> 
> It will happen. You do not need to Cc-stable (and it will not help, will
> not be picked), because this is marked as fix for existing commit.

No, "Fixes:" tags only do not guarantee anything going to stable, you
have to explicitly tag it Cc: stable to do so, as per the documentation.

Yes, we often pick up "Fixes:" only tags, when we have the time, but
again, never guaranteed at all.

thanks,

greg k-h

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

* Re: [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
  2024-09-09 16:23       ` Greg KH
@ 2024-09-09 16:45         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-09 16:45 UTC (permalink / raw)
  To: Greg KH
  Cc: Pierre-Louis Bossart, Charles Keepax, Vinod Koul, Bard Liao,
	Sanyog Kale, alsa-devel, linux-kernel, stable@vger.kernel.org

On 09/09/2024 18:23, Greg KH wrote:
>>>>> Soundwire core and existing codecs expect that the array passed as
>>>>> prop.sink_ports and prop.source_ports is continuous.  The port mask still
>>>>> might be non-continuous, but that's unrelated.
>>>>>
>>>>> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
>>>>> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
>>>>> Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
>>>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>>>
>>>>> ---
>>>>
>>>> Would be good to merge this as soon as we can, this is causing
>>>> soundwire regressions from rc6 onwards.
>>>
>>> the revert also needs to happen in -stable. 6.10.8 is broken as well.
>>
>> It will happen. You do not need to Cc-stable (and it will not help, will
>> not be picked), because this is marked as fix for existing commit.
> 
> No, "Fixes:" tags only do not guarantee anything going to stable, you
> have to explicitly tag it Cc: stable to do so, as per the documentation.

Then anyway cc-stable not in body won't work.

> 
> Yes, we often pick up "Fixes:" only tags, when we have the time, but
> again, never guaranteed at all.

Hm, I assumed you are still taking fixes for the fixes automatically.
That's the case here. I will resend with cc-stable in such case.

Best regards,
Krzysztof


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

end of thread, other threads:[~2024-09-09 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 14:52 [PATCH] soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps" Krzysztof Kozlowski
2024-09-05  6:11 ` Liao, Bard
2024-09-09 14:36 ` Charles Keepax
2024-09-09 15:45   ` Pierre-Louis Bossart
2024-09-09 16:08     ` Krzysztof Kozlowski
2024-09-09 16:23       ` Greg KH
2024-09-09 16:45         ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox