All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: barebox - rk3568
From: Ahmad Fatoum @ 2022-01-05 12:08 UTC (permalink / raw)
  To: Frank Wunderlich, barebox
In-Reply-To: <trinity-c26cce2b-95ff-45dc-9d60-3a1eebfa088b-1641285545326@3c-app-gmx-bap27>

Hello Frank,

On 04.01.22 09:39, Frank Wunderlich wrote:
> Hi,
> 
> i have a prototype rk3568 board (bpi-r2-pro).
> 
> is it possible to flash only barebox instead of uboot? in documentation i found only "creating SD-card", but i dont want to break existing partitions.
> 
> https://www.barebox.org/doc/latest/boards/rockchip.html#rockchip-rk3568
> 
> says it starts from sector 32, my first block for uboot (idblock.bin=spl+raminit) starts at 64, full uboot in partition at 8M.

You probably figured it out by now, but the discrepancy is likely due to differing
block sizes. barebox documentation has `dd bs=1024`, while the default is 512.
boot firmware is a single chunk with barebox, so no separate second stage bootloader
partition.

> As it differs a bit from evb can i add new dts like in uboot?

You can check out the commit adding the EVB or the Pine64 Quartz64:
8d14f8e898b4 ("arm: rockchip: add support for the quartz64 board")

Feel free to send patches for your board along the same lines. :)

Cheers,
Ahmad

> 
> regards Frank
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply

* Re: [PATCH 1/1] scripts: sphinx-pre-install: add required ctex dependency
From: Akira Yokosawa @ 2022-01-05 12:09 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: hch, linux-doc, linux-kernel, corbet
In-Reply-To: <20220105084809.157e3f34@coco.lan>

On Wed, 5 Jan 2022 08:48:09 +0100, Mauro Carvalho Chehab wrote:
> Em Tue, 4 Jan 2022 19:26:10 +0900
> Akira Yokosawa <akiyks@gmail.com> escreveu:
> 
>> On Tue, 4 Jan 2022 09:05:48 +0100, Mauro Carvalho Chehab wrote:
>>> Em Tue, 4 Jan 2022 10:54:52 +0900
>>> Akira Yokosawa <akiyks@gmail.com> escreveu:
>>>   
>>>> Hi Mauro, see inline comments below.
>>>>
>>>> On Tue, 4 Jan 2022 09:04:30 +0900, Akira Yokosawa wrote:  
>>>>> Hi,
>>>>>
>>>>> On Mon, 03 Jan 2022 15:46:30 -0700, Jonathan Corbet <corbet@lwn.net> wrote:    
>>>>>> Mauro Carvalho Chehab <mchehab@kernel.org> writes:
>>>>>>    
>>>>>>> After a change meant to fix support for oriental characters
>>>>>>> (Chinese, Japanese, Korean), ctex stylesheet is now a requirement
>>>>>>> for PDF output.    
>>>>>
>>>>> FWIW, ctexhook.sty is a new requirement of xeCJK.sty v3.8.7 released
>>>>> in June 2021.
>>>>>
>>>>>         Thanks, Akira
>>>>>     
>>>>>>>
>>>>>>> Reported-by: Christoph Hellwig <hch@lst.de>
>>>>>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>>>>>>> ---
>>>>>>>
>>>>>>> See [PATCH 0/1] at: https://lore.kernel.org/all/cover.1641243581.git.mchehab@kernel.org/
>>>>>>>
>>>>>>>  scripts/sphinx-pre-install | 1 +
>>>>>>>  1 file changed, 1 insertion(+)
>>>>>>>
>>>>>>> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
>>>>>>> index 288e86a9d1e5..46aaab414098 100755
>>>>>>> --- a/scripts/sphinx-pre-install
>>>>>>> +++ b/scripts/sphinx-pre-install
>>>>>>> @@ -78,6 +78,7 @@ my %texlive = (
>>>>>>>  	'ucs.sty'            => 'texlive-ucs',
>>>>>>>  	'upquote.sty'        => 'texlive-upquote',
>>>>>>>  	'wrapfig.sty'        => 'texlive-wrapfig',
>>>>>>> +	'ctexhook.sty'       => 'texlive-ctex',
>>>>>>>  );    
>>>>>>    
>>>>
>>>> I'm afraid this update of the list for Fedora/openSUSE won't help
>>>> Debian Stable (bullseye) users.
>>>>
>>>> ctexhook.sty is in texlive-lang-chinese on Debian/Ubuntu.  
>>>
>>> On such case, it is needed to map it for Debian/Ubuntu.
>>> Could you please test the enclosed patch, applied on the top
>>> of the previous one?  
>>
>> Looks like we need an additional hunk.  See below.
>>
>>         Thanks, Akira
>>
>>>
>>> Thanks!
>>> Mauro
>>>
>>> -
>>>
>>> [PATCH] scripts: sphinx-pre-install: Fix ctex support on Debian
>>>
>>> The name of the package with ctexhook.sty is different on
>>> Debian/Ubuntu.
>>>
>>> Reported-by: Akira Yokosawa <akiyks@gmail.com>
>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>>>
>>> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
>>> index 46aaab414098..ea96d18ee946 100755
>>> --- a/scripts/sphinx-pre-install
>>> +++ b/scripts/sphinx-pre-install
>>> @@ -367,6 +367,7 @@ sub give_debian_hints()
>>>  		"Pod::Usage"		=> "perl-modules",
>>>  		"xelatex"		=> "texlive-xetex",
>>>  		"rsvg-convert"		=> "librsvg2-bin",
>>> +		"texlive-ctex"		=> "texlive-lang-chinese",
>>>  	);
>>>  
>>>  	if ($pdf) {
>>>   
>> @@ -380,6 +381,7 @@ sub give_debian_hints()
>>         }
>>  
>>         check_program("dvipng", 2) if ($pdf);
>> +       check_missing_tex(2) if ($pdf);
>>         check_missing(\%map);
>>  
>>         return if (!$need && !$optional);
>>
> 
> This would be more complex than that, and per-distro tests are
> required, in order to avoid the script to fail on other
> distros.

Thank you for looking into this!
I must admit I'm far from grasping how this perl script works...

> 
> Something like the following (possibly incomplete) patch.

I'll test it under various distros/setups.
It may take a while.

        Thanks, Akira

> 
> Thanks,
> Mauro
> 
> [PATCH RFC] scripts: sphinx-pre-install: better handle pdf dependencies
> 
> Not all distro hints check for missing LaTeX dependencies.
> So add a call for it for check_missing_tex() to all distros.
> 
> While here, change the parameters to pass the map hash, as
> distro-specific mapping could be needed.
> 
> Reported-by: Akira Yokosawa <akiyks@gmail.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> 
> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> index ea96d18ee946..03c252590e54 100755
> --- a/scripts/sphinx-pre-install
> +++ b/scripts/sphinx-pre-install
> @@ -227,7 +227,8 @@ sub check_pacman_missing($$)
>  
>  sub check_missing_tex($)
>  {
> -	my $is_optional = shift;
> +	my $map = %{$_[0]};
> +	my $is_optional = 2;
>  	my $kpsewhich = findprog("kpsewhich");
>  
>  	foreach my $prog(keys %texlive) {
> @@ -381,6 +382,7 @@ sub give_debian_hints()
>  	}
>  
>  	check_program("dvipng", 2) if ($pdf);
> +	check_missing_tex(\%map) if ($pdf);
>  	check_missing(\%map);
>  
>  	return if (!$need && !$optional);
> @@ -449,7 +451,7 @@ sub give_redhat_hints()
>  
>  	check_rpm_missing(\@fedora26_opt_pkgs, 2) if ($pdf && !$old);
>  	check_rpm_missing(\@fedora_tex_pkgs, 2) if ($pdf);
> -	check_missing_tex(2) if ($pdf);
> +	check_missing_tex(\%map) if ($pdf);
>  	check_missing(\%map);
>  
>  	return if (!$need && !$optional);
> @@ -503,7 +505,7 @@ sub give_opensuse_hints()
>  	# "Noto Sans CJK SC" on openSUSE
>  
>  	check_rpm_missing(\@suse_tex_pkgs, 2) if ($pdf);
> -	check_missing_tex(2) if ($pdf);
> +	check_missing_tex(\%map) if ($pdf);
>  	check_missing(\%map);
>  
>  	return if (!$need && !$optional);
> @@ -548,6 +550,7 @@ sub give_mageia_hints()
>  	}
>  
>  	check_rpm_missing(\@tex_pkgs, 2) if ($pdf);
> +	# check_missing_tex(\%map) if ($pdf);
>  	check_missing(\%map);
>  
>  	return if (!$need && !$optional);
> @@ -578,6 +581,7 @@ sub give_arch_linux_hints()
>  				   "noto-fonts-cjk", 2);
>  	}
>  
> +	check_missing_tex(\%map) if ($pdf);
>  	check_missing(\%map);
>  
>  	return if (!$need && !$optional);
> @@ -604,6 +608,8 @@ sub give_gentoo_hints()
>  				   "media-fonts/noto-cjk", 2);
>  	}
>  
> +	# Gentoo doesn't need to map tex, as there's a single package,
> +	# and extra fonts are mapped via check_missing_file()
>  	check_missing(\%map);
>  
>  	return if (!$need && !$optional);
> @@ -622,7 +628,7 @@ sub give_gentoo_hints()
>  		printf("\tsudo su -c 'echo \"$cairo\" > $portage_cairo'\n");
>  	}
>  
> -	printf("\tsudo emerge --ask $install\n");
> +	printf("\tsudo USE="-cjk" emerge --ask $install\n");
>  
>  }
>  
> @@ -685,7 +691,7 @@ sub check_distros()
>  	my %map = (
>  		"sphinx-build" => "sphinx"
>  	);
> -	check_missing_tex(2) if ($pdf);
> +	check_missing_tex(\%map) if ($pdf);
>  	check_missing(\%map);
>  	print "I don't know distro $system_release.\n";
>  	print "So, I can't provide you a hint with the install procedure.\n";
> 

^ permalink raw reply

* Re: pagefaults and hang with 5.15.11
From: Helge Deller @ 2022-01-05 12:08 UTC (permalink / raw)
  To: Rolf Eike Beer, linux-parisc
In-Reply-To: <2089338.irdbgypaU6@daneel.sf-tec.de>

On 1/5/22 08:42, Rolf Eike Beer wrote:
> Am Samstag, 1. Januar 2022, 23:12:16 CET schrieb Sven Schnelle:
>
>> Looks like you have a serial console connected? If yes, could you trigger a
>> 'TOC s' from the BMC, and post the output from 'ser x 0 toc', where x is
>> the processer number? This could help debugging this.
>
> It locked up again, but the important part is not in the mail or the wiki:
> clear the error log before :/ And even worse, the C8000 does not seem to
> support "ser clearpim". You can see the firmware commands of a C8000 here:
> https://parisc.wiki.kernel.org/index.php/BMC.

I think you mix up the BMC console (for remote management, always available) and
the BCH (boot console handler, only available on machine reboot before starting
the OS).
I'm sure the C8000 has a "ser clearpim" in the BCH.

> Fun fact: when doing a command in firmware that prints a lot of stuff, like
> "se", and then switching back to the normal system console via ESC-) seems not
> to stop the firmware from printing more of it's stuff, so you get junk on the
> serial line until the firmware is eventually finished.

Yes, I saw this once too.

> Is there a way to
> switch the C8000 firmware to more than 9600 baud?

In the BCH I assume.

> Sorry for the bad mood, but if that is what you first find after wakeup…

:-)

Helge

^ permalink raw reply

* Re: Correct stopping capture and playback substreams?
From: Pavel Hofman @ 2022-01-05 12:07 UTC (permalink / raw)
  To: John Keeping
  Cc: Julian Scheel, alsa-devel@alsa-project.org, Takashi Iwai,
	linux-usb@vger.kernel.org, Jack Pham, Ruslan Bilovol, Yunhao Tian,
	Jerome Brunet
In-Reply-To: <YdR0DeYefGFU+SVX@donbot>

Dne 04. 01. 22 v 17:21 John Keeping napsal(a):
> On Tue, Jan 04, 2022 at 03:57:09PM +0000, John Keeping wrote:
>> On Mon, Jan 03, 2022 at 01:54:13PM +0100, Pavel Hofman wrote:
>>>
>>>
>>> Dne 03. 01. 22 v 13:28 Jaroslav Kysela napsal(a):
>>>> On 03. 01. 22 13:15, Takashi Iwai wrote:
>>>>> On Mon, 03 Jan 2022 12:32:53 +0100,
>>>>> Pavel Hofman wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dne 03. 01. 22 v 10:10 Jaroslav Kysela napsal(a):
>>>>>>> On 03. 01. 22 9:22, Pavel Hofman wrote:
>>>>>>>>
>>>>>>>> Dne 23. 12. 21 v 9:18 Pavel Hofman napsal(a):
>>>>>>>>> Hi Takashi,
>>>>>>>>>
>>>>>>>>> I am working on stopping alsa streams of audio USB
>>>>>>>>> gadget when USB host
>>>>>>>>> stops capture/playback/USB cable unplugged.
>>>>>>>>>
>>>>>>>>> For capture I used code from AK4114 SPDIF receiver
>>>>>>>>> https://elixir.bootlin.com/linux/latest/source/sound/i2c/other/ak4114.c#L590:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> static void stop_substream(struct uac_rtd_params *prm)
>>>>>>>>> {
>>>>>>>>>         unsigned long _flags;
>>>>>>>>>         struct snd_pcm_substream *substream;
>>>>>>>>>
>>>>>>>>>         substream = prm->ss;
>>>>>>>>>         if (substream) {
>>>>>>>>>             snd_pcm_stream_lock_irqsave(substream, _flags);
>>>>>>>>>             if (snd_pcm_running(substream))
>>>>>>>>>                 // TODO - correct handling for playback substream?
>>>>>>>>>                 snd_pcm_stop(substream, SNDRV_PCM_STATE_DRAINING);
>>>>>>>>>             snd_pcm_stream_unlock_irqrestore(substream, _flags);
>>>>>>>>>         }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> For setup I found calling snd_pcm_stop(substream,
>>>>>>>>> SNDRV_PCM_STATE_SETUP)
>>>>>>>>> (https://elixir.bootlin.com/linux/latest/source/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c#L63)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>      Or for both capture and playback using
>>>>>>>>> SNDRV_PCM_STATE_DISCONNECTED
>>>>>>>>> (https://elixir.bootlin.com/linux/latest/source/sound/core/pcm.c#L1103).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Or perhaps using snd_pcm_dev_disconnect(dev) or
>>>>>>>>> snd_pcm_drop(substream)?
>>>>>>>>>
>>>>>>>>> Please what is the recommended way?
>>>>>>>>>
>>>>>>>>
>>>>>>>> Please can I ask for expert view on this issue? E.g. in
>>>>>>>> SoX stopping the
>>>>>>>> stream with
>>>>>>>> SNDRV_PCM_STATE_SETUP/SNDRV_PCM_STATE_DRAINING does not
>>>>>>>> stop
>>>>>>>> the application, while with SNDRV_PCM_STATE_DISCONNECTED
>>>>>>>> SoX exits with
>>>>>>>> non-recoverable status. I am considering implementing both methods and
>>>>>>>> letting users choose their suitable snd_pcm_stop operation (none
>>>>>>>> (default)/SETUP-DRAINING/DISCONNECTED) for the two events (host
>>>>>>>> playback/capture stop, cable disconnection) with a
>>>>>>>> configfs param. Would
>>>>>>>> this make sense?
>>>>>>>
>>>>>>> The disconnection state is unrecoverable. It's expected that the
>>>>>>> device will be freed and cannot be reused.
>>>>>>>
>>>>>>> If you expect to keep the PCM device, we should probably introduce a
>>>>>>> new function which puts the device to the SNDRV_PCM_STATE_OPEN
>>>>>>> state. In this state, all I/O routines will return -EBADFD for the
>>>>>>> applications, so they should close or re-initialize the PCM device
>>>>>>> completely.
>>>>>>>
>>>>>>> https://elixir.bootlin.com/linux/latest/source/sound/core/pcm_native.c#L794
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> The fact is that after closing the USB host can re-open the device
>>>>>> with different samplerate (and perhaps later on with different
>>>>>> channels count/sample size). That would hint at the need to
>>>>>> re-initialize the gadget side before opening  anyway.
>>>>>>
>>>>>> As of keeping the device - it's likely some use cases would prefer
>>>>>> keeping the device, to minimize the operations needed to react to the
>>>>>> host-side playback/capture start.
>>>>>>
>>>>>> A function you describe would make sense for this. IMO from the gadget
>>>>>> POW there is no difference  between the host stopping playback/capture
>>>>>> and cable disconnection, in both cases the data stream is stopped and
>>>>>> next stream can have entirely different parameters. Maybe the gadget
>>>>>> configfs parameter could only toggle between no action (i.e. current
>>>>>> situation) and the new alsa function stopping the stream.
>>>>>>
>>>>>> Jaroslav, please can you draft such a function? Perhaps both changes
>>>>>> could make it to 5.17.
>>>>>
>>>>> (Sorry for the delayed response, as I've been on vacation and now
>>>>> catching up the huge pile of backlogs...)
>>>>>
>>>>> About the change to keep PCM OPEN state: I'm afraid that the
>>>>> disconnection in the host side may happen at any time, and keeping the
>>>>> state OPEN would confuse the things if the host is indeed
>>>>> unrecoverable.
>>>>
>>>> I don't think so. The SNDRV_PCM_IOCTL_HW_PARAMS must be issued by the
>>>> application (in the PCM_OPEN state) and if the USB bus connection is no
>>>> longer active, it may fail. We can distinguish between host -> device
>>>> disconnection and device -> host one. It is not really a similar thing.
>>>>
>>>> I think that the idea was to avoid to re-build the whole card / device
>>>> structure for the fixed device allocation.
>>>>
>>>> Pavel, if the USB host is not connected to the gadget, where the
>>>> playback PCM device fails now ? Is the PCM device created or not ?
>>>>
>>>
>>> The gaudio PCM device is created when the gadget function is activated
>>> (module loaded), regardless whether the USB host is actually connected. The
>>> playback/capture fails after the blocking read/write times out. The data
>>> delivery/consumption method is simply not called when no usb requests get
>>> completed https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_audio.c#L147
>>> .
>>>
>>> The current code does basically nothing to the alsa pcm stream at
>>> capture/playback start/stop by the host (called when altsetting changes in
>>> the gadget) https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_audio.c#L468 https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_audio.c#L557
>>
>> Thinking about it, I think the current behaviour is probably correct.
>>
>> It's not 100% possible to detect when the host stops data transfer - we
>> can detect two scenarios:
>>
>> 	- Cable disconnected
>> 	- Interface alt 0 selected
>>
>> but it's equally possible to just leave the device configured as it was
>> and stop sending data.
>>
>> While resetting state may be necessary when the cable is disconnected,
>> if the host is just stopping and restarting the stream then I don't see
>> why the gadget application should have to reconfigure the PCM device.
>>
>> It's clearly useful to have some indication of host state, but I'm not
>> at all convinced the PCM state is the best way to provide that.
> 
> D'oh, I totally forgot about the case of changing sample rate here,
> which is the new feature in Pavel's proposed patches.
> 
> I still think the existing behaviour is correct when the sample rate
> hasn't changed.  But if the sample rate changes, maybe we have to force
> the gadget application to reconfigure the PCM as the available sample
> rate is now different.  And I guess changing the PCM state is necessary
> in that case.
> 
> But I'd really like to avoid it for a gadget with only one available
> sample rate (and ideally in the case where a gadget supporting multiple
> sample rates is stopped and re-started at the same rate).
> 

IMO there are several points:

1) Breaking the blocking wait in alsa read/write as soon as the gadget 
learns no data will arrive/be consumed by the host (altsetting to zero, 
cable disconnected). For me this is important as I do not want the app 
thread to be stuck waiting, unable to exit and especially to restart 
quickly (with new samplerate config).

2) Deciding what PCM state to set within the PCM stop call.
For the single-samplerate config we know the next open will use the same 
rate, therefore the less "intrusive" status/call can be used. But for 
multiple samplerates I do not know what samplerate the host will use for 
the next opening. Also we should consider that future patches can add 
multiple altsettings with different channel counts (and also 
corresponding different samplerate sets to fit the bandwidth).


3) Compatibility with the existing behaviour for existing installations.
I think the feature requires a dedicated configfs param. The param 
should at least disallow the PCM stop (as default). Perhaps a bitmask 
could be used to configure USB host stop (altsetting -> zero) and cable 
disconnection events separately. Maybe we could assign multiple bits to 
each event to allow configuring more reactions to each event 
(0000=default - no PCM stop, 0001 - no-reconfig PCM status, 0010 - 
reconfig PCM status, 0011 - DISCONNECTED status, etc.)

That way different requirements could be catered for.

I can prepare all currently-relevant patches should they be found 
heading in the right direction.

Thanks a lot,

Pavel.

^ permalink raw reply

* Re: Correct stopping capture and playback substreams?
From: Pavel Hofman @ 2022-01-05 12:07 UTC (permalink / raw)
  To: John Keeping
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel@alsa-project.org,
	Julian Scheel, Jack Pham, linux-usb@vger.kernel.org,
	Ruslan Bilovol, Yunhao Tian, Jerome Brunet
In-Reply-To: <YdR0DeYefGFU+SVX@donbot>

Dne 04. 01. 22 v 17:21 John Keeping napsal(a):
> On Tue, Jan 04, 2022 at 03:57:09PM +0000, John Keeping wrote:
>> On Mon, Jan 03, 2022 at 01:54:13PM +0100, Pavel Hofman wrote:
>>>
>>>
>>> Dne 03. 01. 22 v 13:28 Jaroslav Kysela napsal(a):
>>>> On 03. 01. 22 13:15, Takashi Iwai wrote:
>>>>> On Mon, 03 Jan 2022 12:32:53 +0100,
>>>>> Pavel Hofman wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dne 03. 01. 22 v 10:10 Jaroslav Kysela napsal(a):
>>>>>>> On 03. 01. 22 9:22, Pavel Hofman wrote:
>>>>>>>>
>>>>>>>> Dne 23. 12. 21 v 9:18 Pavel Hofman napsal(a):
>>>>>>>>> Hi Takashi,
>>>>>>>>>
>>>>>>>>> I am working on stopping alsa streams of audio USB
>>>>>>>>> gadget when USB host
>>>>>>>>> stops capture/playback/USB cable unplugged.
>>>>>>>>>
>>>>>>>>> For capture I used code from AK4114 SPDIF receiver
>>>>>>>>> https://elixir.bootlin.com/linux/latest/source/sound/i2c/other/ak4114.c#L590:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> static void stop_substream(struct uac_rtd_params *prm)
>>>>>>>>> {
>>>>>>>>>         unsigned long _flags;
>>>>>>>>>         struct snd_pcm_substream *substream;
>>>>>>>>>
>>>>>>>>>         substream = prm->ss;
>>>>>>>>>         if (substream) {
>>>>>>>>>             snd_pcm_stream_lock_irqsave(substream, _flags);
>>>>>>>>>             if (snd_pcm_running(substream))
>>>>>>>>>                 // TODO - correct handling for playback substream?
>>>>>>>>>                 snd_pcm_stop(substream, SNDRV_PCM_STATE_DRAINING);
>>>>>>>>>             snd_pcm_stream_unlock_irqrestore(substream, _flags);
>>>>>>>>>         }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> For setup I found calling snd_pcm_stop(substream,
>>>>>>>>> SNDRV_PCM_STATE_SETUP)
>>>>>>>>> (https://elixir.bootlin.com/linux/latest/source/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c#L63)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>      Or for both capture and playback using
>>>>>>>>> SNDRV_PCM_STATE_DISCONNECTED
>>>>>>>>> (https://elixir.bootlin.com/linux/latest/source/sound/core/pcm.c#L1103).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Or perhaps using snd_pcm_dev_disconnect(dev) or
>>>>>>>>> snd_pcm_drop(substream)?
>>>>>>>>>
>>>>>>>>> Please what is the recommended way?
>>>>>>>>>
>>>>>>>>
>>>>>>>> Please can I ask for expert view on this issue? E.g. in
>>>>>>>> SoX stopping the
>>>>>>>> stream with
>>>>>>>> SNDRV_PCM_STATE_SETUP/SNDRV_PCM_STATE_DRAINING does not
>>>>>>>> stop
>>>>>>>> the application, while with SNDRV_PCM_STATE_DISCONNECTED
>>>>>>>> SoX exits with
>>>>>>>> non-recoverable status. I am considering implementing both methods and
>>>>>>>> letting users choose their suitable snd_pcm_stop operation (none
>>>>>>>> (default)/SETUP-DRAINING/DISCONNECTED) for the two events (host
>>>>>>>> playback/capture stop, cable disconnection) with a
>>>>>>>> configfs param. Would
>>>>>>>> this make sense?
>>>>>>>
>>>>>>> The disconnection state is unrecoverable. It's expected that the
>>>>>>> device will be freed and cannot be reused.
>>>>>>>
>>>>>>> If you expect to keep the PCM device, we should probably introduce a
>>>>>>> new function which puts the device to the SNDRV_PCM_STATE_OPEN
>>>>>>> state. In this state, all I/O routines will return -EBADFD for the
>>>>>>> applications, so they should close or re-initialize the PCM device
>>>>>>> completely.
>>>>>>>
>>>>>>> https://elixir.bootlin.com/linux/latest/source/sound/core/pcm_native.c#L794
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> The fact is that after closing the USB host can re-open the device
>>>>>> with different samplerate (and perhaps later on with different
>>>>>> channels count/sample size). That would hint at the need to
>>>>>> re-initialize the gadget side before opening  anyway.
>>>>>>
>>>>>> As of keeping the device - it's likely some use cases would prefer
>>>>>> keeping the device, to minimize the operations needed to react to the
>>>>>> host-side playback/capture start.
>>>>>>
>>>>>> A function you describe would make sense for this. IMO from the gadget
>>>>>> POW there is no difference  between the host stopping playback/capture
>>>>>> and cable disconnection, in both cases the data stream is stopped and
>>>>>> next stream can have entirely different parameters. Maybe the gadget
>>>>>> configfs parameter could only toggle between no action (i.e. current
>>>>>> situation) and the new alsa function stopping the stream.
>>>>>>
>>>>>> Jaroslav, please can you draft such a function? Perhaps both changes
>>>>>> could make it to 5.17.
>>>>>
>>>>> (Sorry for the delayed response, as I've been on vacation and now
>>>>> catching up the huge pile of backlogs...)
>>>>>
>>>>> About the change to keep PCM OPEN state: I'm afraid that the
>>>>> disconnection in the host side may happen at any time, and keeping the
>>>>> state OPEN would confuse the things if the host is indeed
>>>>> unrecoverable.
>>>>
>>>> I don't think so. The SNDRV_PCM_IOCTL_HW_PARAMS must be issued by the
>>>> application (in the PCM_OPEN state) and if the USB bus connection is no
>>>> longer active, it may fail. We can distinguish between host -> device
>>>> disconnection and device -> host one. It is not really a similar thing.
>>>>
>>>> I think that the idea was to avoid to re-build the whole card / device
>>>> structure for the fixed device allocation.
>>>>
>>>> Pavel, if the USB host is not connected to the gadget, where the
>>>> playback PCM device fails now ? Is the PCM device created or not ?
>>>>
>>>
>>> The gaudio PCM device is created when the gadget function is activated
>>> (module loaded), regardless whether the USB host is actually connected. The
>>> playback/capture fails after the blocking read/write times out. The data
>>> delivery/consumption method is simply not called when no usb requests get
>>> completed https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_audio.c#L147
>>> .
>>>
>>> The current code does basically nothing to the alsa pcm stream at
>>> capture/playback start/stop by the host (called when altsetting changes in
>>> the gadget) https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_audio.c#L468 https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_audio.c#L557
>>
>> Thinking about it, I think the current behaviour is probably correct.
>>
>> It's not 100% possible to detect when the host stops data transfer - we
>> can detect two scenarios:
>>
>> 	- Cable disconnected
>> 	- Interface alt 0 selected
>>
>> but it's equally possible to just leave the device configured as it was
>> and stop sending data.
>>
>> While resetting state may be necessary when the cable is disconnected,
>> if the host is just stopping and restarting the stream then I don't see
>> why the gadget application should have to reconfigure the PCM device.
>>
>> It's clearly useful to have some indication of host state, but I'm not
>> at all convinced the PCM state is the best way to provide that.
> 
> D'oh, I totally forgot about the case of changing sample rate here,
> which is the new feature in Pavel's proposed patches.
> 
> I still think the existing behaviour is correct when the sample rate
> hasn't changed.  But if the sample rate changes, maybe we have to force
> the gadget application to reconfigure the PCM as the available sample
> rate is now different.  And I guess changing the PCM state is necessary
> in that case.
> 
> But I'd really like to avoid it for a gadget with only one available
> sample rate (and ideally in the case where a gadget supporting multiple
> sample rates is stopped and re-started at the same rate).
> 

IMO there are several points:

1) Breaking the blocking wait in alsa read/write as soon as the gadget 
learns no data will arrive/be consumed by the host (altsetting to zero, 
cable disconnected). For me this is important as I do not want the app 
thread to be stuck waiting, unable to exit and especially to restart 
quickly (with new samplerate config).

2) Deciding what PCM state to set within the PCM stop call.
For the single-samplerate config we know the next open will use the same 
rate, therefore the less "intrusive" status/call can be used. But for 
multiple samplerates I do not know what samplerate the host will use for 
the next opening. Also we should consider that future patches can add 
multiple altsettings with different channel counts (and also 
corresponding different samplerate sets to fit the bandwidth).


3) Compatibility with the existing behaviour for existing installations.
I think the feature requires a dedicated configfs param. The param 
should at least disallow the PCM stop (as default). Perhaps a bitmask 
could be used to configure USB host stop (altsetting -> zero) and cable 
disconnection events separately. Maybe we could assign multiple bits to 
each event to allow configuring more reactions to each event 
(0000=default - no PCM stop, 0001 - no-reconfig PCM status, 0010 - 
reconfig PCM status, 0011 - DISCONNECTED status, etc.)

That way different requirements could be catered for.

I can prepare all currently-relevant patches should they be found 
heading in the right direction.

Thanks a lot,

Pavel.

^ permalink raw reply

* Re: [PATCH 5/6] docs/qdev-device-use: Add CanoKey to QDEV devices examples
From: Thomas Huth @ 2022-01-05 12:02 UTC (permalink / raw)
  To: Hongren (Zenithal) Zheng, qemu-devel; +Cc: Gerd Hoffmann, contact
In-Reply-To: <YcSvRf+YjukL8Mlp@Sun>

On 23/12/2021 18.17, Hongren (Zenithal) Zheng wrote:
> Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
> ---
>   docs/qdev-device-use.txt | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt
> index 2408889334..278fb66c0a 100644
> --- a/docs/qdev-device-use.txt
> +++ b/docs/qdev-device-use.txt
> @@ -342,6 +342,7 @@ The new way is -device DEVNAME,DEV-OPTS...  Details depend on DRIVER:
>   * tablet          -device usb-tablet
>   * wacom-tablet    -device usb-wacom-tablet
>   * u2f             -device u2f-{emulated,passthru}
> +* canokey         -device canokey
>   * braille         See "Character Devices"

Please drop this patch. The list here is only about legacy USB device usage 
with the "-usbdevice" parameter, but since there never was and never will be 
a "-usbdevice canokey", there is no need to add an entry here.

  Thomas



^ permalink raw reply

* Re: iblinkinfo for Python
From: Benjamin Drung @ 2022-01-05 12:05 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma
In-Reply-To: <YdWGZggTD38xgMh6@unreal>

Am Mittwoch, dem 05.01.2022 um 13:52 +0200 schrieb Leon Romanovsky:
> On Wed, Jan 05, 2022 at 11:32:40AM +0100, Benjamin Drung wrote:
> > Hi,
> > 
> > we have an in-house Shell script that uses iblinkinfo to check if the
> > InfiniBand cabling is correct. This information can be derived from
> > the
> > node names that can be seen for the HCA port. I want to improve that
> > check and rewrite it in Python, but I failed to find an easy and
> > robust
> > way to retrieve the node names for a HCA port:
> > 
> > 1) Call "iblinkinfo --line" and parse the output. Parsing the output
> > could probably be done with a complex regular expression. This
> > solution
> > is too ugly IMO.
> > 
> > 2) Extend iblinkinfo to provide a JSON output. Then let the Python
> > script call "iblinkinfo --json" and simply use json.load for parsing.
> > This solution requires some C coding and probably a good json library
> > should be used to avoid generating bogus JSON.
> > 
> > 3) Use https://github.com/jgunthorpe/python-rdma but this library has
> > not been touched for five years and needs porting to Python 3. So
> > that
> > is probably a lot of work as well.
> > 
> > 4) Use pyverbs provided by rdma-core, but I found neither a single
> > API
> > call to query similar data to iblinkinfo, nor an example for that use
> > case.
> > 
> > What should I do?
> 
> Isn't this information available in sysfs?
> [leonro@mtl-leonro-l-vm ~]$ cat /sys/class/infiniband/ibp0s9/node_desc
> mtl-leonro-l-vm ibp0s9

The host names of the nodes connected to this port are required for
this check, not the host name of the host itself.

> Can you give an example?

```
$ sudo iblinkinfo -y 1 -C mlx5_0 -P 0 --line
0x04400C64D87A2543 "                  host1 mlx5_0"     13    [...]
0x04400C64D87A255c "                  host2 mlx5_0"     10    [...]
[...]
```

iblinkinfo would return the host names of all connected hosts (in this
example snippet "host1" and "host2"). In our inhouse case, we can
derive the topology from these host names.
> 

-- 
Benjamin Drung

Senior DevOps Engineer and Debian & Ubuntu Developer
Compute Platform Operations Cloud

IONOS SE | Revaler Str. 30 | 10245 Berlin | Deutschland
E-Mail: benjamin.drung@ionos.com | Web: www.ionos.de

Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498

Vorstand: Hüseyin Dogan, Dr. Martin Endreß, Claudia Frese, Henning
Kettler, Arthur Mai, Britta Schmidt, Achim Weiß
Aufsichtsratsvorsitzender: Markus Kadelke


Member of United Internet


^ permalink raw reply

* [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
From: Miaoqian Lin @ 2022-01-05 12:04 UTC (permalink / raw)
  Cc: linmq006, Emma Anholt, David Airlie, Daniel Vetter, Eric Anholt,
	dri-devel, linux-kernel

The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().

Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..4f293aa733b8 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	v3d_gem_destroy(drm);
 dma_free:
 	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
+pm_disable:
+	pm_runtime_disable(dev);
 	return ret;
 }
 
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH 0/8] Add low power hibernation support to cs35l41
From: Takashi Iwai @ 2022-01-05 12:03 UTC (permalink / raw)
  To: Charles Keepax
  Cc: alsa-devel, patches, tiwai, lgirdwood, david.rhodes, broonie
In-Reply-To: <20220105113026.18955-1-ckeepax@opensource.cirrus.com>

On Wed, 05 Jan 2022 12:30:18 +0100,
Charles Keepax wrote:
> 
> This patch series adds support for the low power hibernation feature
> on cs35l41. This allows the DSP memory to be retained whilst the
> device enters a very low power state.
> 
> Patches 1-6 can happily be applied straight away and are mostly bug
> fixes to set things up for the series specifically around getting the
> cache handling corrected in the driver.
> 
> Patches 7,8 specifically will cause some very minor conflicts with
> Lucas's currently outstanding work on the HDA version of cs35l41.
> Whilst things will still build, this patch adds a test key function
> his code will now have to call. If his patches are getting merged
> first I will respin this series to update his code, he is currently on
> holiday until the 12th of Jan, so if we want to wait for another spin
> of those patches I can work with him to update them at that time. Or
> alternatively we could just merge them all and I will do a quick fixup
> patch at the end, since there is no build breakage.

FWIW, the ASoC part of Lucas's patch set has been already merged in
Mark's asoc tree.  (HD-audio part isn't merged yet though).


Takashi

^ permalink raw reply

* [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
From: Miaoqian Lin @ 2022-01-05 12:04 UTC (permalink / raw)
  Cc: linmq006, Emma Anholt, David Airlie, linux-kernel, dri-devel,
	Eric Anholt

The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().

Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..4f293aa733b8 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	v3d_gem_destroy(drm);
 dma_free:
 	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
+pm_disable:
+	pm_runtime_disable(dev);
 	return ret;
 }
 
-- 
2.17.1


^ permalink raw reply related

* net/ipv6/ip6_gre.c:861:20: warning: unused function 'ip6gre_tnl_addr_conflict'
From: kernel test robot @ 2022-01-05 12:03 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: llvm, kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c9e6606c7fe92b50a02ce51dda82586ebdf99b48
commit: 919067cc845f323a80b6fe987b64238bd82d309e net: add CONFIG_PCPU_DEV_REFCNT
date:   10 months ago
config: mips-randconfig-r002-20220105 (https://download.01.org/0day-ci/archive/20220105/202201051937.PF3UZQy3-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=919067cc845f323a80b6fe987b64238bd82d309e
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 919067cc845f323a80b6fe987b64238bd82d309e
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/drm/msm/ fs/ net/ipv6/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/ipv6/ip6_gre.c:861:20: warning: unused function 'ip6gre_tnl_addr_conflict'
   static inline bool ip6gre_tnl_addr_conflict(const struct ip6_tnl
   ^
   fatal error: error in backend: Nested variants found in inline asm string: ' .set push
   .set mips64r2
   .if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/atomic.h", .line = 154, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
   1: ll $1, $2 # atomic_fetch_sub
   subu $0, $1, $3
   sc $0, $2
   beqz $0, 1b
   .set pop
   move $0, $1
   '
   clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 14.0.0 (git://gitmirror/llvm_project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
   Target: mipsel-unknown-linux
   Thread model: posix
   InstalledDir: /opt/cross/clang-d5b6e30ed3/bin
   clang-14: note: diagnostic msg:
   Makefile arch drivers fs include kernel net nr_bisected scripts sound source usr


vim +/ip6gre_tnl_addr_conflict +861 net/ipv6/ip6_gre.c

c12b395a46646b xeb@mail.ru 2012-08-10  846  
c12b395a46646b xeb@mail.ru 2012-08-10  847  /**
7ccbdff13e8df6 Sun Lianwen 2018-05-03  848   * ip6gre_tnl_addr_conflict - compare packet addresses to tunnel's own
c12b395a46646b xeb@mail.ru 2012-08-10  849   *   @t: the outgoing tunnel device
c12b395a46646b xeb@mail.ru 2012-08-10  850   *   @hdr: IPv6 header from the incoming packet
c12b395a46646b xeb@mail.ru 2012-08-10  851   *
c12b395a46646b xeb@mail.ru 2012-08-10  852   * Description:
c12b395a46646b xeb@mail.ru 2012-08-10  853   *   Avoid trivial tunneling loop by checking that tunnel exit-point
c12b395a46646b xeb@mail.ru 2012-08-10  854   *   doesn't match source of incoming packet.
c12b395a46646b xeb@mail.ru 2012-08-10  855   *
c12b395a46646b xeb@mail.ru 2012-08-10  856   * Return:
c12b395a46646b xeb@mail.ru 2012-08-10  857   *   1 if conflict,
c12b395a46646b xeb@mail.ru 2012-08-10  858   *   0 else
c12b395a46646b xeb@mail.ru 2012-08-10  859   **/
c12b395a46646b xeb@mail.ru 2012-08-10  860  
c12b395a46646b xeb@mail.ru 2012-08-10 @861  static inline bool ip6gre_tnl_addr_conflict(const struct ip6_tnl *t,
c12b395a46646b xeb@mail.ru 2012-08-10  862  	const struct ipv6hdr *hdr)
c12b395a46646b xeb@mail.ru 2012-08-10  863  {
c12b395a46646b xeb@mail.ru 2012-08-10  864  	return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr);
c12b395a46646b xeb@mail.ru 2012-08-10  865  }
c12b395a46646b xeb@mail.ru 2012-08-10  866  

:::::: The code at line 861 was first introduced by commit
:::::: c12b395a46646bab69089ce7016ac78177f6001f gre: Support GRE over IPv6

:::::: TO: xeb@mail.ru <xeb@mail.ru>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* Re: [PATCH] optionrom: Turn off -fcf-protection
From: Stefano Garzarella @ 2022-01-05 12:00 UTC (permalink / raw)
  To: Björn Töpel; +Cc: Paolo Bonzini, qemu-devel
In-Reply-To: <20220103090112.312202-1-bjorn@kernel.org>

CCing Paolo

On Mon, Jan 03, 2022 at 10:01:12AM +0100, Björn Töpel wrote:
>Ubuntu GCC enables -fcf-protection globally, which is not supported
>for x86 16-bit (realmode). This causes the build to fail.
>
>This commit turns off that option.
>
>Signed-off-by: Björn Töpel <bjorn@kernel.org>
>---
> pc-bios/optionrom/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
>index 5d55d25acca2..c5f5fa02ef06 100644
>--- a/pc-bios/optionrom/Makefile
>+++ b/pc-bios/optionrom/Makefile
>@@ -21,6 +21,7 @@ override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
> override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
> override CFLAGS += $(call cc-option, -fno-stack-protector)
> override CFLAGS += $(call cc-option, -m16)
>+override CFLAGS += $(call cc-option, -fcf-protection=none)

LGTM!

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>



^ permalink raw reply

* [syzbot] KMSAN: uninit-value in ax88178_reset
From: syzbot @ 2022-01-05 12:04 UTC (permalink / raw)
  To: andrew, davem, glider, kuba, linux-kernel, linux-usb, linux,
	netdev, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    b0a8b5053e8b kmsan: core: add dependency on DEBUG_KERNEL
git tree:       https://github.com/google/kmsan.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=159cf693b00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=46a956fc7a887c60
dashboard link: https://syzkaller.appspot.com/bug?extid=6ca9f7867b77c2d316ac
compiler:       clang version 14.0.0 (/usr/local/google/src/llvm-git-monorepo 2b554920f11c8b763cd9ed9003f4e19b919b8e1f), GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14413193b00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=127716a3b00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com

asix 1-1:0.0 eth1: Failed to read reg index 0x0000: -32
asix 1-1:0.0 eth1: Failed to read reg index 0x0000: -32
=====================================================
BUG: KMSAN: uninit-value in ax88178_reset+0xfd2/0x1590 drivers/net/usb/asix_devices.c:946 drivers/net/usb/asix_devices.c:946
 ax88178_reset+0xfd2/0x1590 drivers/net/usb/asix_devices.c:946 drivers/net/usb/asix_devices.c:946
 usbnet_open+0x16d/0x1940 drivers/net/usb/usbnet.c:894 drivers/net/usb/usbnet.c:894
 __dev_open+0x920/0xb90 net/core/dev.c:1490 net/core/dev.c:1490
 __dev_change_flags+0x4da/0xd40 net/core/dev.c:8796 net/core/dev.c:8796
 dev_change_flags+0xf5/0x280 net/core/dev.c:8867 net/core/dev.c:8867
 devinet_ioctl+0xfc1/0x3060 net/ipv4/devinet.c:1144 net/ipv4/devinet.c:1144
 inet_ioctl+0x59f/0x820 net/ipv4/af_inet.c:969 net/ipv4/af_inet.c:969
 sock_do_ioctl net/socket.c:1118 [inline]
 sock_do_ioctl net/socket.c:1118 [inline] net/socket.c:1235
 sock_ioctl+0xa3f/0x13d0 net/socket.c:1235 net/socket.c:1235
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 vfs_ioctl fs/ioctl.c:51 [inline] fs/ioctl.c:860
 __do_sys_ioctl fs/ioctl.c:874 [inline] fs/ioctl.c:860
 __se_sys_ioctl+0x2df/0x4a0 fs/ioctl.c:860 fs/ioctl.c:860
 __x64_sys_ioctl+0xd8/0x110 fs/ioctl.c:860 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
 do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Local variable status created at:
 ax88178_reset+0x69/0x1590
 usbnet_open+0x16d/0x1940 drivers/net/usb/usbnet.c:894 drivers/net/usb/usbnet.c:894

CPU: 1 PID: 3057 Comm: dhcpcd Not tainted 5.16.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
=====================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply

* Re: [RFC PATCH net v2 1/2] net/smc: Resolve the race between link group access and termination
From: Karsten Graul @ 2022-01-05 12:03 UTC (permalink / raw)
  To: Wen Gu, davem, kuba; +Cc: linux-s390, netdev, linux-kernel, dust.li, tonylu
In-Reply-To: <095c6e45-dd9e-1809-ae51-224679783241@linux.alibaba.com>

On 05/01/2022 09:27, Wen Gu wrote:
> On 2022/1/3 6:36 pm, Karsten Graul wrote:
>> On 31/12/2021 10:44, Wen Gu wrote:
>>> On 2021/12/29 8:56 pm, Karsten Graul wrote:
>>>> On 28/12/2021 16:13, Wen Gu wrote:
>>>>> We encountered some crashes caused by the race between the access
>>>>> and the termination of link groups.
> So I think checking conn->alert_token_local has the same effect with checking conn->lgr to
> identify whether the link group pointed by conn->lgr is still healthy and able to be used.

Yeah that sounds like a good solution for that! So is it now guaranteed that conn->lgr is always
set and this check can really be removed completely, or should there be a new helper that checks
conn->lgr and the alert_token, like smc_lgr_valid() ?

^ permalink raw reply

* net/ipv6/ip6_gre.c:861:20: warning: unused function 'ip6gre_tnl_addr_conflict'
From: kernel test robot @ 2022-01-05 12:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4556 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c9e6606c7fe92b50a02ce51dda82586ebdf99b48
commit: 919067cc845f323a80b6fe987b64238bd82d309e net: add CONFIG_PCPU_DEV_REFCNT
date:   10 months ago
config: mips-randconfig-r002-20220105 (https://download.01.org/0day-ci/archive/20220105/202201051937.PF3UZQy3-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=919067cc845f323a80b6fe987b64238bd82d309e
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 919067cc845f323a80b6fe987b64238bd82d309e
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/drm/msm/ fs/ net/ipv6/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/ipv6/ip6_gre.c:861:20: warning: unused function 'ip6gre_tnl_addr_conflict'
   static inline bool ip6gre_tnl_addr_conflict(const struct ip6_tnl
   ^
   fatal error: error in backend: Nested variants found in inline asm string: ' .set push
   .set mips64r2
   .if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/atomic.h", .line = 154, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
   1: ll $1, $2 # atomic_fetch_sub
   subu $0, $1, $3
   sc $0, $2
   beqz $0, 1b
   .set pop
   move $0, $1
   '
   clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 14.0.0 (git://gitmirror/llvm_project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
   Target: mipsel-unknown-linux
   Thread model: posix
   InstalledDir: /opt/cross/clang-d5b6e30ed3/bin
   clang-14: note: diagnostic msg:
   Makefile arch drivers fs include kernel net nr_bisected scripts sound source usr


vim +/ip6gre_tnl_addr_conflict +861 net/ipv6/ip6_gre.c

c12b395a46646b xeb(a)mail.ru 2012-08-10  846  
c12b395a46646b xeb(a)mail.ru 2012-08-10  847  /**
7ccbdff13e8df6 Sun Lianwen 2018-05-03  848   * ip6gre_tnl_addr_conflict - compare packet addresses to tunnel's own
c12b395a46646b xeb(a)mail.ru 2012-08-10  849   *   @t: the outgoing tunnel device
c12b395a46646b xeb(a)mail.ru 2012-08-10  850   *   @hdr: IPv6 header from the incoming packet
c12b395a46646b xeb(a)mail.ru 2012-08-10  851   *
c12b395a46646b xeb(a)mail.ru 2012-08-10  852   * Description:
c12b395a46646b xeb(a)mail.ru 2012-08-10  853   *   Avoid trivial tunneling loop by checking that tunnel exit-point
c12b395a46646b xeb(a)mail.ru 2012-08-10  854   *   doesn't match source of incoming packet.
c12b395a46646b xeb(a)mail.ru 2012-08-10  855   *
c12b395a46646b xeb(a)mail.ru 2012-08-10  856   * Return:
c12b395a46646b xeb(a)mail.ru 2012-08-10  857   *   1 if conflict,
c12b395a46646b xeb(a)mail.ru 2012-08-10  858   *   0 else
c12b395a46646b xeb(a)mail.ru 2012-08-10  859   **/
c12b395a46646b xeb(a)mail.ru 2012-08-10  860  
c12b395a46646b xeb(a)mail.ru 2012-08-10 @861  static inline bool ip6gre_tnl_addr_conflict(const struct ip6_tnl *t,
c12b395a46646b xeb(a)mail.ru 2012-08-10  862  	const struct ipv6hdr *hdr)
c12b395a46646b xeb(a)mail.ru 2012-08-10  863  {
c12b395a46646b xeb(a)mail.ru 2012-08-10  864  	return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr);
c12b395a46646b xeb(a)mail.ru 2012-08-10  865  }
c12b395a46646b xeb(a)mail.ru 2012-08-10  866  

:::::: The code at line 861 was first introduced by commit
:::::: c12b395a46646bab69089ce7016ac78177f6001f gre: Support GRE over IPv6

:::::: TO: xeb(a)mail.ru <xeb@mail.ru>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply

* Re: make pdfdocs fails on Debian stable
From: Akira Yokosawa @ 2022-01-05 12:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: corbet, linux-doc, linux-kernel, mchehab
In-Reply-To: <20220105073504.GA3524@lst.de>

On Wed, 5 Jan 2022 08:35:04 +0100, Christoph Hellwig wrote:
> On Wed, Jan 05, 2022 at 10:47:40AM +0900, Akira Yokosawa wrote:
>>> See my pending patch set at:
>>>
>>>     https://lore.kernel.org/linux-doc/e01fe9f9-f600-c2fc-c6b3-ef6395655ffe@gmail.com
>>>     [PATCH v2 0/4] docs: sphinx/kfigure.py: Improve conversion to PDF
>>>
>>> This uses Inkscape if it is available instead of ImageMagick.
>>> No imagemagick nor librsvg2-bin is required.
>>> As long as if you can trust Inkscape...
> 
> I haven't gotten to try that yet..
> 
>> Alternatively, you can avoid ImageMagick by installing
>> graphicsmagick-imagemagick-compat instead of imagemagick.
>>
>> I'm not sure what you think of GraphicsMagick, though.
>>
>> If you'd like to try, do:
>>
>>     $ sudo apt install graphicsmagick-imagemagick-compat ghostscript gsfonts-x11
>>
>> This will remove ImageMagick.
>> (You have ghostscript and gsfonts-x11 already installed, I guess.)
> 
> This works just fine, thanks.

Nice!

Glad to know I could help you.

        Thanks, Akira

> 

^ permalink raw reply

* [syzbot] KMSAN: uninit-value in cma_make_mc_event
From: syzbot @ 2022-01-05 12:03 UTC (permalink / raw)
  To: avihaih, dledford, glider, haakon.bugge, jgg, leon, linux-kernel,
	linux-rdma, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    8b936c96768e kmsan: core: remove the accidentally committe..
git tree:       https://github.com/google/kmsan.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=13420bb9b00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e00a8959fdd3f3e8
dashboard link: https://syzkaller.appspot.com/bug?extid=8fcbb77276d43cc8b693
compiler:       clang version 14.0.0 (git@github.com:llvm/llvm-project.git 0996585c8e3b3d409494eb5f1cad714b9e1f7fb5), GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: i386

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+8fcbb77276d43cc8b693@syzkaller.appspotmail.com

=====================================================
BUG: KMSAN: uninit-value in cma_set_qkey drivers/infiniband/core/cma.c:510 [inline]
BUG: KMSAN: uninit-value in cma_make_mc_event+0xb73/0xe00 drivers/infiniband/core/cma.c:4570
 cma_set_qkey drivers/infiniband/core/cma.c:510 [inline]
 cma_make_mc_event+0xb73/0xe00 drivers/infiniband/core/cma.c:4570
 cma_iboe_join_multicast drivers/infiniband/core/cma.c:4782 [inline]
 rdma_join_multicast+0x2b83/0x30a0 drivers/infiniband/core/cma.c:4814
 ucma_process_join+0xa76/0xf60 drivers/infiniband/core/ucma.c:1479
 ucma_join_multicast+0x1e3/0x250 drivers/infiniband/core/ucma.c:1546
 ucma_write+0x639/0x6d0 drivers/infiniband/core/ucma.c:1732
 vfs_write+0x8ce/0x2030 fs/read_write.c:588
 ksys_write+0x28c/0x520 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __ia32_sys_write+0xdb/0x120 fs/read_write.c:652
 do_syscall_32_irqs_on arch/x86/entry/common.c:114 [inline]
 __do_fast_syscall_32+0x96/0xf0 arch/x86/entry/common.c:180
 do_fast_syscall_32+0x34/0x70 arch/x86/entry/common.c:205
 do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:248
 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c

Local variable ib.i created at:
 cma_iboe_join_multicast drivers/infiniband/core/cma.c:4737 [inline]
 rdma_join_multicast+0x586/0x30a0 drivers/infiniband/core/cma.c:4814
 ucma_process_join+0xa76/0xf60 drivers/infiniband/core/ucma.c:1479

CPU: 0 PID: 29874 Comm: syz-executor.3 Not tainted 5.16.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
=====================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

^ permalink raw reply

* Re: [Buildroot] [git commit] package/dnsmasq: fix build with gcc 4.8
From: David Laight @ 2022-01-05 12:01 UTC (permalink / raw)
  To: 'Arnout Vandecappelle', buildroot@buildroot.org
In-Reply-To: <20220104180257.67D5282BA6@busybox.osuosl.org>

From: Arnout Vandecappelle
> Sent: 04 January 2022 17:49
> 
> commit: https://git.buildroot.net/buildroot/commit/?id=17aa836bd7a2c90da053398ce024b4113cf8b53c
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
> 
> Fix the following build failure with gcc 4.8 raised since bump to
> version 2.86 in commit 5b29096f8fcb0acd8890073a56ba9d620b1f911c:
> 
> option.c: In function 'one_opt':
> option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
>            for (char *p = arg; *p; p++) {
>            ^
> option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
> option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
>            for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
>            ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  .../0001-src-option.c-fix-build-with-gcc-4.8.patch | 52 ++++++++++++++++++++++
>  ...2909d9080ff8743133fbd52427b4b2213171-typo.patch | 36 +++++++++++++++
>  2 files changed, 88 insertions(+)
> 
> diff --git a/package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch b/package/dnsmasq/0001-
> src-option.c-fix-build-with-gcc-4.8.patch
> new file mode 100644
> index 0000000000..50ecf2f18a
> --- /dev/null
> +++ b/package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch
> @@ -0,0 +1,52 @@
> +From 46312909d9080ff8743133fbd52427b4b2213171 Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Fri, 31 Dec 2021 17:29:44 +0100
> +Subject: [PATCH] src/option.c: fix build with gcc 4.8
> +
> +Fix the following build failure with gcc 4.8 raised since version 2.86:
> +
> +option.c: In function 'one_opt':
> +option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
> +           for (char *p = arg; *p; p++) {
> +           ^
> +option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
> +option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
> +           for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
> +           ^
> +
> +Fixes:
> + - http://autobuild.buildroot.org/results/39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +[Upstream commit 46312909d9080ff8743133fbd52427b4b2213171]
> +---
> + src/option.c | 6 ++++--
> + 1 file changed, 4 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/option.c b/src/option.c
> +index ff54def..c57f6d8 100644
> +--- a/src/option.c
> ++++ b/src/option.c
> +@@ -2525,7 +2525,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int
> comma
> +           arg += 9;
> +           if (strlen(arg) != 16)
> +               ret_err(gen_err);
> +-          for (char *p = arg; *p; p++) {
> ++          char *p;
> ++          for (*p = arg; *p; p++) {

Isn't that going to get an error for mixing code and declarations?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply

* Re: [PATCH 4/4] coresight: trbe: Workaround TRBE trace data corruption
From: Suzuki K Poulose @ 2022-01-05 11:59 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Mathieu Poirier, coresight,
	linux-doc, linux-kernel
In-Reply-To: <1641359159-22726-5-git-send-email-anshuman.khandual@arm.com>

On 05/01/2022 05:05, Anshuman Khandual wrote:
> TRBE implementations affected by Arm erratum #1902691 might corrupt trace
> data or deadlock, when it's being written into the memory. Workaround this
> problem in the driver, by preventing TRBE initialization on affected cpus.
> This adds a new cpu errata in arm64 errata framework and also updates TRBE
> driver as required.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> Cc: coresight@lists.linaro.org
> Cc: linux-doc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>   Documentation/arm64/silicon-errata.rst       |  2 ++
>   arch/arm64/Kconfig                           | 16 ++++++++++++++++
>   arch/arm64/kernel/cpu_errata.c               |  9 +++++++++
>   arch/arm64/tools/cpucaps                     |  1 +
>   drivers/hwtracing/coresight/coresight-trbe.c | 12 ++++++++++++
>   5 files changed, 40 insertions(+)
> 
> diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst
> index e0ef3e9a4b8b..50018f60c4d4 100644
> --- a/Documentation/arm64/silicon-errata.rst
> +++ b/Documentation/arm64/silicon-errata.rst
> @@ -56,6 +56,8 @@ stable kernels.
>   +----------------+-----------------+-----------------+-----------------------------+
>   | ARM            | Cortex-A510     | #2038923        | ARM64_ERRATUM_2038923       |
>   +----------------+-----------------+-----------------+-----------------------------+
> +| ARM            | Cortex-A510     | #1902691        | ARM64_ERRATUM_1902691       |
> ++----------------+-----------------+-----------------+-----------------------------+
>   | ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319        |
>   +----------------+-----------------+-----------------+-----------------------------+
>   | ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319        |
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 026e34fb6fad..1ea5c3b4aac0 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -819,6 +819,22 @@ config ARM64_ERRATUM_2038923
>   
>   	  If unsure, say Y.
>   
> +config ARM64_ERRATUM_1902691
> +	bool "Cortex-A510: 1902691: workaround TRBE trace corruption"
> +	depends on CORESIGHT_TRBE
> +	default y
> +	help
> +	  This option adds the workaround for ARM Cortex-A510 erratum 1902691.
> +
> +	  Affected Cortex-A510 core might cause trace data corruption, when being written
> +	  into the memory. Effectively TRBE is broken and hence cannot be used to capture
> +	  trace data.
> +
> +	  Work around this problem in the driver by just preventing TRBE initialization on
> +	  affected cpus.
> +
> +	  If unsure, say Y.
> +

It might be better to add :

"The firmware must have disabled the access to TRBE for the kernel on 
such implementations. This will cover the kernel for any firmware that
doesn't do this already"


>   config CAVIUM_ERRATUM_22375
>   	bool "Cavium erratum 22375, 24313"
>   	default y
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 60b0c1f1d912..a3336dfb5a8a 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
> @@ -615,6 +615,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = {	
>   		/* Cortex-A510 r0p0 - r0p2 */
>   		ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2)
>   	},
> +#endif
> +#ifdef CONFIG_ARM64_ERRATUM_1902691
> +	{
> +		.desc = "ARM erratum 1902691",
> +		.capability = ARM64_WORKAROUND_1902691,
> +
> +		/* Cortex-A510 r0p0 - r0p1 */
> +		ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1)
> +	},
>   #endif
>   	{
>   	}
> diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps
> index 45a06d36d080..e7719e8f18de 100644
> --- a/arch/arm64/tools/cpucaps
> +++ b/arch/arm64/tools/cpucaps
> @@ -57,6 +57,7 @@ WORKAROUND_1508412
>   WORKAROUND_1542419
>   WORKAROUND_2064142
>   WORKAROUND_2038923
> +WORKAROUND_1902691
>   WORKAROUND_TRBE_OVERWRITE_FILL_MODE
>   WORKAROUND_TSB_FLUSH_FAILURE
>   WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 0689c6dab96d..b9b4e34fac15 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -93,12 +93,14 @@ struct trbe_buf {
>   #define TRBE_WORKAROUND_WRITE_OUT_OF_RANGE	1
>   #define TRBE_WORKAROUND_SYSREG_WRITE_FAILURE	2
>   #define TRBE_WORKAROUND_CORRUPTION_WITH_ENABLE	3
> +#define TRBE_IS_BROKEN	4
>   
>   static int trbe_errata_cpucaps[] = {
>   	[TRBE_WORKAROUND_OVERWRITE_FILL_MODE] = ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE,
>   	[TRBE_WORKAROUND_WRITE_OUT_OF_RANGE] = ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE,
>   	[TRBE_WORKAROUND_SYSREG_WRITE_FAILURE] = ARM64_WORKAROUND_2064142,
>   	[TRBE_WORKAROUND_CORRUPTION_WITH_ENABLE] = ARM64_WORKAROUND_2038923,
> +	[TRBE_IS_BROKEN] = ARM64_WORKAROUND_1902691,
>   	-1,		/* Sentinel, must be the last entry */
>   };
>   
> @@ -181,6 +183,11 @@ static inline bool trbe_may_corrupt_with_enable(struct trbe_cpudata *cpudata)
>   	return trbe_has_erratum(cpudata, TRBE_WORKAROUND_CORRUPTION_WITH_ENABLE);
>   }
>   
> +static inline bool trbe_is_broken(struct trbe_cpudata *cpudata)
> +{
> +	return trbe_has_erratum(cpudata, TRBE_IS_BROKEN);
> +}
> +
>   static int trbe_alloc_node(struct perf_event *event)
>   {
>   	if (event->cpu == -1)
> @@ -1291,6 +1298,11 @@ static void arm_trbe_probe_cpu(void *info)
>   	 */
>   	trbe_check_errata(cpudata);
>   
> +	if (trbe_is_broken(cpudata)) {
> +		pr_err("TRBE might corrupt the trace on cpu %d\n", cpu);

It may be better to say:

		"Disabling TRBE on CPU%d due to erratum"

Otherwise looks good to me.

Suzuki

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

^ permalink raw reply

* Linux kernel 5.15.13 released
From: Linux Kernel Distribution System @ 2022-01-05 12:00 UTC (permalink / raw)
  To: linux-kernel-announce

Linux kernel version 5.15.13 is now available:

Full source:    https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.13.tar.xz
Patch:          https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.15.13.xz
PGP Signature:  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.13.tar.sign

You can view the summary of the changes at the following URL:
https://git.kernel.org/stable/ds/v5.15.13/v5.15.12


^ permalink raw reply

* Linux kernel 5.10.90 released
From: Linux Kernel Distribution System @ 2022-01-05 12:00 UTC (permalink / raw)
  To: linux-kernel-announce

Linux kernel version 5.10.90 is now available:

Full source:    https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.90.tar.xz
Patch:          https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.10.90.xz
PGP Signature:  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.90.tar.sign

You can view the summary of the changes at the following URL:
https://git.kernel.org/stable/ds/v5.10.90/v5.10.89


^ permalink raw reply

* Re: [PATCH 0/2] MAINTAINERS: Update information about printk git tree
From: Andy Shevchenko @ 2022-01-05 11:57 UTC (permalink / raw)
  To: Petr Mladek
  Cc: John Ogness, Sergey Senozhatsky, Steven Rostedt, Rasmus Villemoes,
	linux-kernel
In-Reply-To: <20220105094157.26216-1-pmladek@suse.com>

On Wed, Jan 05, 2022 at 10:41:55AM +0100, Petr Mladek wrote:
> I have noticed one outdated and one missing link to the printk git tree.
> I am not sure if it is worth sending for review and having two patches.
> I just want to avoid possible complains ;-)

FWIW,
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Petr Mladek (2):
>   MAINTAINERS/vsprintf: Update link to printk git tree
>   MAINTAIERS/printk: Add link to printk git
> 
>  MAINTAINERS | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> -- 
> 2.26.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* Re: [PATCH 4/4] coresight: trbe: Workaround TRBE trace data corruption
From: Suzuki K Poulose @ 2022-01-05 11:59 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Mathieu Poirier, coresight,
	linux-doc, linux-kernel
In-Reply-To: <1641359159-22726-5-git-send-email-anshuman.khandual@arm.com>

On 05/01/2022 05:05, Anshuman Khandual wrote:
> TRBE implementations affected by Arm erratum #1902691 might corrupt trace
> data or deadlock, when it's being written into the memory. Workaround this
> problem in the driver, by preventing TRBE initialization on affected cpus.
> This adds a new cpu errata in arm64 errata framework and also updates TRBE
> driver as required.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> Cc: coresight@lists.linaro.org
> Cc: linux-doc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>   Documentation/arm64/silicon-errata.rst       |  2 ++
>   arch/arm64/Kconfig                           | 16 ++++++++++++++++
>   arch/arm64/kernel/cpu_errata.c               |  9 +++++++++
>   arch/arm64/tools/cpucaps                     |  1 +
>   drivers/hwtracing/coresight/coresight-trbe.c | 12 ++++++++++++
>   5 files changed, 40 insertions(+)
> 
> diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst
> index e0ef3e9a4b8b..50018f60c4d4 100644
> --- a/Documentation/arm64/silicon-errata.rst
> +++ b/Documentation/arm64/silicon-errata.rst
> @@ -56,6 +56,8 @@ stable kernels.
>   +----------------+-----------------+-----------------+-----------------------------+
>   | ARM            | Cortex-A510     | #2038923        | ARM64_ERRATUM_2038923       |
>   +----------------+-----------------+-----------------+-----------------------------+
> +| ARM            | Cortex-A510     | #1902691        | ARM64_ERRATUM_1902691       |
> ++----------------+-----------------+-----------------+-----------------------------+
>   | ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319        |
>   +----------------+-----------------+-----------------+-----------------------------+
>   | ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319        |
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 026e34fb6fad..1ea5c3b4aac0 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -819,6 +819,22 @@ config ARM64_ERRATUM_2038923
>   
>   	  If unsure, say Y.
>   
> +config ARM64_ERRATUM_1902691
> +	bool "Cortex-A510: 1902691: workaround TRBE trace corruption"
> +	depends on CORESIGHT_TRBE
> +	default y
> +	help
> +	  This option adds the workaround for ARM Cortex-A510 erratum 1902691.
> +
> +	  Affected Cortex-A510 core might cause trace data corruption, when being written
> +	  into the memory. Effectively TRBE is broken and hence cannot be used to capture
> +	  trace data.
> +
> +	  Work around this problem in the driver by just preventing TRBE initialization on
> +	  affected cpus.
> +
> +	  If unsure, say Y.
> +

It might be better to add :

"The firmware must have disabled the access to TRBE for the kernel on 
such implementations. This will cover the kernel for any firmware that
doesn't do this already"


>   config CAVIUM_ERRATUM_22375
>   	bool "Cavium erratum 22375, 24313"
>   	default y
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 60b0c1f1d912..a3336dfb5a8a 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
> @@ -615,6 +615,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = {	
>   		/* Cortex-A510 r0p0 - r0p2 */
>   		ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2)
>   	},
> +#endif
> +#ifdef CONFIG_ARM64_ERRATUM_1902691
> +	{
> +		.desc = "ARM erratum 1902691",
> +		.capability = ARM64_WORKAROUND_1902691,
> +
> +		/* Cortex-A510 r0p0 - r0p1 */
> +		ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1)
> +	},
>   #endif
>   	{
>   	}
> diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps
> index 45a06d36d080..e7719e8f18de 100644
> --- a/arch/arm64/tools/cpucaps
> +++ b/arch/arm64/tools/cpucaps
> @@ -57,6 +57,7 @@ WORKAROUND_1508412
>   WORKAROUND_1542419
>   WORKAROUND_2064142
>   WORKAROUND_2038923
> +WORKAROUND_1902691
>   WORKAROUND_TRBE_OVERWRITE_FILL_MODE
>   WORKAROUND_TSB_FLUSH_FAILURE
>   WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 0689c6dab96d..b9b4e34fac15 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -93,12 +93,14 @@ struct trbe_buf {
>   #define TRBE_WORKAROUND_WRITE_OUT_OF_RANGE	1
>   #define TRBE_WORKAROUND_SYSREG_WRITE_FAILURE	2
>   #define TRBE_WORKAROUND_CORRUPTION_WITH_ENABLE	3
> +#define TRBE_IS_BROKEN	4
>   
>   static int trbe_errata_cpucaps[] = {
>   	[TRBE_WORKAROUND_OVERWRITE_FILL_MODE] = ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE,
>   	[TRBE_WORKAROUND_WRITE_OUT_OF_RANGE] = ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE,
>   	[TRBE_WORKAROUND_SYSREG_WRITE_FAILURE] = ARM64_WORKAROUND_2064142,
>   	[TRBE_WORKAROUND_CORRUPTION_WITH_ENABLE] = ARM64_WORKAROUND_2038923,
> +	[TRBE_IS_BROKEN] = ARM64_WORKAROUND_1902691,
>   	-1,		/* Sentinel, must be the last entry */
>   };
>   
> @@ -181,6 +183,11 @@ static inline bool trbe_may_corrupt_with_enable(struct trbe_cpudata *cpudata)
>   	return trbe_has_erratum(cpudata, TRBE_WORKAROUND_CORRUPTION_WITH_ENABLE);
>   }
>   
> +static inline bool trbe_is_broken(struct trbe_cpudata *cpudata)
> +{
> +	return trbe_has_erratum(cpudata, TRBE_IS_BROKEN);
> +}
> +
>   static int trbe_alloc_node(struct perf_event *event)
>   {
>   	if (event->cpu == -1)
> @@ -1291,6 +1298,11 @@ static void arm_trbe_probe_cpu(void *info)
>   	 */
>   	trbe_check_errata(cpudata);
>   
> +	if (trbe_is_broken(cpudata)) {
> +		pr_err("TRBE might corrupt the trace on cpu %d\n", cpu);

It may be better to say:

		"Disabling TRBE on CPU%d due to erratum"

Otherwise looks good to me.

Suzuki

^ permalink raw reply

* Re: Linux 4.19.224
From: Greg Kroah-Hartman @ 2022-01-05 11:58 UTC (permalink / raw)
  To: linux-kernel, akpm, torvalds, stable; +Cc: lwn, jslaby, Greg Kroah-Hartman
In-Reply-To: <1641383894210192@kroah.com>

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 607db9519cfb..0ee49b4929be 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1439,6 +1439,8 @@
 			architectures force reset to be always executed
 	i8042.unlock	[HW] Unlock (ignore) the keylock
 	i8042.kbdreset	[HW] Reset device connected to KBD port
+	i8042.probe_defer
+			[HW] Allow deferred probing upon i8042 probe errors
 
 	i810=		[HW,DRM]
 
diff --git a/Makefile b/Makefile
index 6637882cb5e5..cfcecc33b4c1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 19
-SUBLEVEL = 223
+SUBLEVEL = 224
 EXTRAVERSION =
 NAME = "People's Front"
 
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 3371b986e3b4..cd845afc4880 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -630,7 +630,7 @@ static void binder_free_buf_locked(struct binder_alloc *alloc,
 	BUG_ON(buffer->data > alloc->buffer + alloc->buffer_size);
 
 	if (buffer->async_transaction) {
-		alloc->free_async_space += size + sizeof(struct binder_buffer);
+		alloc->free_async_space += buffer_size + sizeof(struct binder_buffer);
 
 		binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
 			     "%d: binder_free_buf size %zd async free %zd\n",
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 98e91e14cefd..88bb59ba58cd 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -148,6 +148,7 @@ config HID_APPLEIR
 
 config HID_ASUS
 	tristate "Asus"
+	depends on USB_HID
 	depends on LEDS_CLASS
 	---help---
 	Support for Asus notebook built-in keyboard and touchpad via i2c, and
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 57aece809841..140dd074fdee 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -544,6 +544,9 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
 				   sizeof(rdwr_arg)))
 			return -EFAULT;
 
+		if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0)
+			return -EINVAL;
+
 		if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
 			return -EINVAL;
 
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
index ffb9c1f495b6..197e0b5d5a80 100644
--- a/drivers/input/joystick/spaceball.c
+++ b/drivers/input/joystick/spaceball.c
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/input.h>
 #include <linux/serio.h>
+#include <asm/unaligned.h>
 
 #define DRIVER_DESC	"SpaceTec SpaceBall 2003/3003/4000 FLX driver"
 
@@ -87,9 +88,15 @@ static void spaceball_process_packet(struct spaceball* spaceball)
 
 		case 'D':					/* Ball data */
 			if (spaceball->idx != 15) return;
-			for (i = 0; i < 6; i++)
+			/*
+			 * Skip first three bytes; read six axes worth of data.
+			 * Axis values are signed 16-bit big-endian.
+			 */
+			data += 3;
+			for (i = 0; i < ARRAY_SIZE(spaceball_axes); i++) {
 				input_report_abs(dev, spaceball_axes[i],
-					(__s16)((data[2 * i + 3] << 8) | data[2 * i + 2]));
+					(__s16)get_unaligned_be16(&data[i * 2]));
+			}
 			break;
 
 		case 'K':					/* Button data */
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index f1e66e257cff..e305a4f2b0f0 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -930,6 +930,8 @@ static int atp_probe(struct usb_interface *iface,
 	set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
 	set_bit(BTN_LEFT, input_dev->keybit);
 
+	INIT_WORK(&dev->work, atp_reinit);
+
 	error = input_register_device(dev->input);
 	if (error)
 		goto err_free_buffer;
@@ -937,8 +939,6 @@ static int atp_probe(struct usb_interface *iface,
 	/* save our data pointer in this interface device */
 	usb_set_intfdata(iface, dev);
 
-	INIT_WORK(&dev->work, atp_reinit);
-
 	return 0;
 
  err_free_buffer:
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index c218e107c0c8..ee0b0a7237ad 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -999,6 +999,24 @@ static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
 	{ }
 };
 
+static const struct dmi_system_id i8042_dmi_probe_defer_table[] __initconst = {
+	{
+		/* ASUS ZenBook UX425UA */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"),
+		},
+	},
+	{
+		/* ASUS ZenBook UM325UA */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"),
+		},
+	},
+	{ }
+};
+
 #endif /* CONFIG_X86 */
 
 #ifdef CONFIG_PNP
@@ -1318,6 +1336,9 @@ static int __init i8042_platform_init(void)
 	if (dmi_check_system(i8042_dmi_kbdreset_table))
 		i8042_kbdreset = true;
 
+	if (dmi_check_system(i8042_dmi_probe_defer_table))
+		i8042_probe_defer = true;
+
 	/*
 	 * A20 was already enabled during early kernel init. But some buggy
 	 * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index c60593c8d2be..082afbf088d6 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -48,6 +48,10 @@ static bool i8042_unlock;
 module_param_named(unlock, i8042_unlock, bool, 0);
 MODULE_PARM_DESC(unlock, "Ignore keyboard lock.");
 
+static bool i8042_probe_defer;
+module_param_named(probe_defer, i8042_probe_defer, bool, 0);
+MODULE_PARM_DESC(probe_defer, "Allow deferred probing.");
+
 enum i8042_controller_reset_mode {
 	I8042_RESET_NEVER,
 	I8042_RESET_ALWAYS,
@@ -702,7 +706,7 @@ static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version)
  * LCS/Telegraphics.
  */
 
-static int __init i8042_check_mux(void)
+static int i8042_check_mux(void)
 {
 	unsigned char mux_version;
 
@@ -731,10 +735,10 @@ static int __init i8042_check_mux(void)
 /*
  * The following is used to test AUX IRQ delivery.
  */
-static struct completion i8042_aux_irq_delivered __initdata;
-static bool i8042_irq_being_tested __initdata;
+static struct completion i8042_aux_irq_delivered;
+static bool i8042_irq_being_tested;
 
-static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id)
+static irqreturn_t i8042_aux_test_irq(int irq, void *dev_id)
 {
 	unsigned long flags;
 	unsigned char str, data;
@@ -761,7 +765,7 @@ static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id)
  * verifies success by readinng CTR. Used when testing for presence of AUX
  * port.
  */
-static int __init i8042_toggle_aux(bool on)
+static int i8042_toggle_aux(bool on)
 {
 	unsigned char param;
 	int i;
@@ -789,7 +793,7 @@ static int __init i8042_toggle_aux(bool on)
  * the presence of an AUX interface.
  */
 
-static int __init i8042_check_aux(void)
+static int i8042_check_aux(void)
 {
 	int retval = -1;
 	bool irq_registered = false;
@@ -996,7 +1000,7 @@ static int i8042_controller_init(void)
 
 		if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) {
 			pr_err("Can't read CTR while initializing i8042\n");
-			return -EIO;
+			return i8042_probe_defer ? -EPROBE_DEFER : -EIO;
 		}
 
 	} while (n < 2 || ctr[0] != ctr[1]);
@@ -1311,7 +1315,7 @@ static void i8042_shutdown(struct platform_device *dev)
 	i8042_controller_reset(false);
 }
 
-static int __init i8042_create_kbd_port(void)
+static int i8042_create_kbd_port(void)
 {
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO];
@@ -1339,7 +1343,7 @@ static int __init i8042_create_kbd_port(void)
 	return 0;
 }
 
-static int __init i8042_create_aux_port(int idx)
+static int i8042_create_aux_port(int idx)
 {
 	struct serio *serio;
 	int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx;
@@ -1376,13 +1380,13 @@ static int __init i8042_create_aux_port(int idx)
 	return 0;
 }
 
-static void __init i8042_free_kbd_port(void)
+static void i8042_free_kbd_port(void)
 {
 	kfree(i8042_ports[I8042_KBD_PORT_NO].serio);
 	i8042_ports[I8042_KBD_PORT_NO].serio = NULL;
 }
 
-static void __init i8042_free_aux_ports(void)
+static void i8042_free_aux_ports(void)
 {
 	int i;
 
@@ -1392,7 +1396,7 @@ static void __init i8042_free_aux_ports(void)
 	}
 }
 
-static void __init i8042_register_ports(void)
+static void i8042_register_ports(void)
 {
 	int i;
 
@@ -1444,7 +1448,7 @@ static void i8042_free_irqs(void)
 	i8042_aux_irq_registered = i8042_kbd_irq_registered = false;
 }
 
-static int __init i8042_setup_aux(void)
+static int i8042_setup_aux(void)
 {
 	int (*aux_enable)(void);
 	int error;
@@ -1486,7 +1490,7 @@ static int __init i8042_setup_aux(void)
 	return error;
 }
 
-static int __init i8042_setup_kbd(void)
+static int i8042_setup_kbd(void)
 {
 	int error;
 
@@ -1536,7 +1540,7 @@ static int i8042_kbd_bind_notifier(struct notifier_block *nb,
 	return 0;
 }
 
-static int __init i8042_probe(struct platform_device *dev)
+static int i8042_probe(struct platform_device *dev)
 {
 	int error;
 
@@ -1601,6 +1605,7 @@ static struct platform_driver i8042_driver = {
 		.pm	= &i8042_pm_ops,
 #endif
 	},
+	.probe		= i8042_probe,
 	.remove		= i8042_remove,
 	.shutdown	= i8042_shutdown,
 };
@@ -1611,7 +1616,6 @@ static struct notifier_block i8042_kbd_bind_notifier_block = {
 
 static int __init i8042_init(void)
 {
-	struct platform_device *pdev;
 	int err;
 
 	dbg_init();
@@ -1627,17 +1631,29 @@ static int __init i8042_init(void)
 	/* Set this before creating the dev to allow i8042_command to work right away */
 	i8042_present = true;
 
-	pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0);
-	if (IS_ERR(pdev)) {
-		err = PTR_ERR(pdev);
+	err = platform_driver_register(&i8042_driver);
+	if (err)
 		goto err_platform_exit;
+
+	i8042_platform_device = platform_device_alloc("i8042", -1);
+	if (!i8042_platform_device) {
+		err = -ENOMEM;
+		goto err_unregister_driver;
 	}
 
+	err = platform_device_add(i8042_platform_device);
+	if (err)
+		goto err_free_device;
+
 	bus_register_notifier(&serio_bus, &i8042_kbd_bind_notifier_block);
 	panic_blink = i8042_panic_blink;
 
 	return 0;
 
+err_free_device:
+	platform_device_put(i8042_platform_device);
+err_unregister_driver:
+	platform_driver_unregister(&i8042_driver);
  err_platform_exit:
 	i8042_platform_exit();
 	return err;
diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c
index 47f6fee1f396..1812434cda84 100644
--- a/drivers/net/ethernet/freescale/fman/fman_port.c
+++ b/drivers/net/ethernet/freescale/fman/fman_port.c
@@ -1791,7 +1791,7 @@ static int fman_port_probe(struct platform_device *of_dev)
 	fman = dev_get_drvdata(&fm_pdev->dev);
 	if (!fman) {
 		err = -EINVAL;
-		goto return_err;
+		goto put_device;
 	}
 
 	err = of_property_read_u32(port_node, "cell-index", &val);
@@ -1799,7 +1799,7 @@ static int fman_port_probe(struct platform_device *of_dev)
 		dev_err(port->dev, "%s: reading cell-index for %pOF failed\n",
 			__func__, port_node);
 		err = -EINVAL;
-		goto return_err;
+		goto put_device;
 	}
 	port_id = (u8)val;
 	port->dts_params.id = port_id;
@@ -1833,7 +1833,7 @@ static int fman_port_probe(struct platform_device *of_dev)
 	}  else {
 		dev_err(port->dev, "%s: Illegal port type\n", __func__);
 		err = -EINVAL;
-		goto return_err;
+		goto put_device;
 	}
 
 	port->dts_params.type = port_type;
@@ -1847,7 +1847,7 @@ static int fman_port_probe(struct platform_device *of_dev)
 			dev_err(port->dev, "%s: incorrect qman-channel-id\n",
 				__func__);
 			err = -EINVAL;
-			goto return_err;
+			goto put_device;
 		}
 		port->dts_params.qman_channel_id = qman_channel_id;
 	}
@@ -1857,7 +1857,7 @@ static int fman_port_probe(struct platform_device *of_dev)
 		dev_err(port->dev, "%s: of_address_to_resource() failed\n",
 			__func__);
 		err = -ENOMEM;
-		goto return_err;
+		goto put_device;
 	}
 
 	port->dts_params.fman = fman;
@@ -1882,6 +1882,8 @@ static int fman_port_probe(struct platform_device *of_dev)
 
 	return 0;
 
+put_device:
+	put_device(&fm_pdev->dev);
 return_err:
 	of_node_put(port_node);
 free_port:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 9003702892cd..5979fcf124bb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3666,12 +3666,11 @@ static int set_feature_arfs(struct net_device *netdev, bool enable)
 
 static int mlx5e_handle_feature(struct net_device *netdev,
 				netdev_features_t *features,
-				netdev_features_t wanted_features,
 				netdev_features_t feature,
 				mlx5e_feature_handler feature_handler)
 {
-	netdev_features_t changes = wanted_features ^ netdev->features;
-	bool enable = !!(wanted_features & feature);
+	netdev_features_t changes = *features ^ netdev->features;
+	bool enable = !!(*features & feature);
 	int err;
 
 	if (!(changes & feature))
@@ -3679,23 +3678,23 @@ static int mlx5e_handle_feature(struct net_device *netdev,
 
 	err = feature_handler(netdev, enable);
 	if (err) {
+		MLX5E_SET_FEATURE(features, feature, !enable);
 		netdev_err(netdev, "%s feature %pNF failed, err %d\n",
 			   enable ? "Enable" : "Disable", &feature, err);
 		return err;
 	}
 
-	MLX5E_SET_FEATURE(features, feature, enable);
 	return 0;
 }
 
 static int mlx5e_set_features(struct net_device *netdev,
 			      netdev_features_t features)
 {
-	netdev_features_t oper_features = netdev->features;
+	netdev_features_t oper_features = features;
 	int err = 0;
 
 #define MLX5E_HANDLE_FEATURE(feature, handler) \
-	mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
+	mlx5e_handle_feature(netdev, &oper_features, feature, handler)
 
 	err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
 	err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 9f1777e56d7d..881468ff02bf 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -498,11 +498,11 @@ static void read_bulk_callback(struct urb *urb)
 		goto goon;
 
 	rx_status = buf[count - 2];
-	if (rx_status & 0x1e) {
+	if (rx_status & 0x1c) {
 		netif_dbg(pegasus, rx_err, net,
 			  "RX packet error %x\n", rx_status);
 		net->stats.rx_errors++;
-		if (rx_status & 0x06)	/* long or runt	*/
+		if (rx_status & 0x04)	/* runt	*/
 			net->stats.rx_length_errors++;
 		if (rx_status & 0x08)
 			net->stats.rx_crc_errors++;
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index 1b347096422f..ebea3b4dd8e1 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -544,7 +544,8 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
 	phy->gpiod_ena = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
 	if (IS_ERR(phy->gpiod_ena)) {
 		nfc_err(dev, "Unable to get ENABLE GPIO\n");
-		return PTR_ERR(phy->gpiod_ena);
+		r = PTR_ERR(phy->gpiod_ena);
+		goto out_free;
 	}
 
 	phy->se_status.is_ese_present =
@@ -555,7 +556,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
 	r = st21nfca_hci_platform_init(phy);
 	if (r < 0) {
 		nfc_err(&client->dev, "Unable to reboot st21nfca\n");
-		return r;
+		goto out_free;
 	}
 
 	r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
@@ -564,15 +565,23 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
 				ST21NFCA_HCI_DRIVER_NAME, phy);
 	if (r < 0) {
 		nfc_err(&client->dev, "Unable to register IRQ handler\n");
-		return r;
+		goto out_free;
 	}
 
-	return st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME,
-					ST21NFCA_FRAME_HEADROOM,
-					ST21NFCA_FRAME_TAILROOM,
-					ST21NFCA_HCI_LLC_MAX_PAYLOAD,
-					&phy->hdev,
-					&phy->se_status);
+	r = st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME,
+			       ST21NFCA_FRAME_HEADROOM,
+			       ST21NFCA_FRAME_TAILROOM,
+			       ST21NFCA_HCI_LLC_MAX_PAYLOAD,
+			       &phy->hdev,
+			       &phy->se_status);
+	if (r)
+		goto out_free;
+
+	return 0;
+
+out_free:
+	kfree_skb(phy->pending_skb);
+	return r;
 }
 
 static int st21nfca_hci_i2c_remove(struct i2c_client *client)
@@ -585,6 +594,8 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client)
 
 	if (phy->powered)
 		st21nfca_hci_i2c_disable(phy);
+	if (phy->pending_skb)
+		kfree_skb(phy->pending_skb);
 
 	return 0;
 }
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index fd2ffebc868f..caa03565c139 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -628,7 +628,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
 	}
 
 	gmux_data->iostart = res->start;
-	gmux_data->iolen = res->end - res->start;
+	gmux_data->iolen = resource_size(res);
 
 	if (gmux_data->iolen < GMUX_MIN_IO_LEN) {
 		pr_err("gmux I/O region too small (%lu < %u)\n",
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 2c70e311943a..0a908d1cc494 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -2267,8 +2267,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
 	char mybuf[64];
 	char *pbuf;
 
-	if (nbytes > 64)
-		nbytes = 64;
+	if (nbytes > 63)
+		nbytes = 63;
 
 	memset(mybuf, 0, sizeof(mybuf));
 
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 2c707b5c7b0b..68b5177bf09d 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -578,9 +578,12 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 			 * Commands like INQUIRY may transfer less data than
 			 * requested by the initiator via bufflen. Set residual
 			 * count to make upper layer aware of the actual amount
-			 * of data returned.
+			 * of data returned. There are cases when controller
+			 * returns zero dataLen with non zero data - do not set
+			 * residual count in that case.
 			 */
-			scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
+			if (e->dataLen && (e->dataLen < scsi_bufflen(cmd)))
+				scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
 			cmd->result = (DID_OK << 16);
 			break;
 
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index 0b9ab1d0dd45..5fd5aa5f0a1d 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Linaro Limited
+ * Copyright (c) 2015-2017, 2019-2021 Linaro Limited
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -11,25 +11,17 @@
  * GNU General Public License for more details.
  *
  */
+#include <linux/anon_inodes.h>
 #include <linux/device.h>
-#include <linux/dma-buf.h>
-#include <linux/fdtable.h>
 #include <linux/idr.h>
+#include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/tee_drv.h>
 #include "tee_private.h"
 
-static void tee_shm_release(struct tee_shm *shm)
+static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
 {
-	struct tee_device *teedev = shm->teedev;
-
-	mutex_lock(&teedev->mutex);
-	idr_remove(&teedev->idr, shm->id);
-	if (shm->ctx)
-		list_del(&shm->link);
-	mutex_unlock(&teedev->mutex);
-
 	if (shm->flags & TEE_SHM_POOL) {
 		struct tee_shm_pool_mgr *poolm;
 
@@ -61,51 +53,6 @@ static void tee_shm_release(struct tee_shm *shm)
 	tee_device_put(teedev);
 }
 
-static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment
-			*attach, enum dma_data_direction dir)
-{
-	return NULL;
-}
-
-static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach,
-				     struct sg_table *table,
-				     enum dma_data_direction dir)
-{
-}
-
-static void tee_shm_op_release(struct dma_buf *dmabuf)
-{
-	struct tee_shm *shm = dmabuf->priv;
-
-	tee_shm_release(shm);
-}
-
-static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum)
-{
-	return NULL;
-}
-
-static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
-{
-	struct tee_shm *shm = dmabuf->priv;
-	size_t size = vma->vm_end - vma->vm_start;
-
-	/* Refuse sharing shared memory provided by application */
-	if (shm->flags & TEE_SHM_REGISTER)
-		return -EINVAL;
-
-	return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
-			       size, vma->vm_page_prot);
-}
-
-static const struct dma_buf_ops tee_shm_dma_buf_ops = {
-	.map_dma_buf = tee_shm_op_map_dma_buf,
-	.unmap_dma_buf = tee_shm_op_unmap_dma_buf,
-	.release = tee_shm_op_release,
-	.map = tee_shm_op_map,
-	.mmap = tee_shm_op_mmap,
-};
-
 static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
 				       struct tee_device *teedev,
 				       size_t size, u32 flags)
@@ -146,6 +93,7 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
 		goto err_dev_put;
 	}
 
+	refcount_set(&shm->refcount, 1);
 	shm->flags = flags | TEE_SHM_POOL;
 	shm->teedev = teedev;
 	shm->ctx = ctx;
@@ -168,21 +116,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
 		goto err_pool_free;
 	}
 
-	if (flags & TEE_SHM_DMA_BUF) {
-		DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
-
-		exp_info.ops = &tee_shm_dma_buf_ops;
-		exp_info.size = shm->size;
-		exp_info.flags = O_RDWR;
-		exp_info.priv = shm;
-
-		shm->dmabuf = dma_buf_export(&exp_info);
-		if (IS_ERR(shm->dmabuf)) {
-			ret = ERR_CAST(shm->dmabuf);
-			goto err_rem;
-		}
-	}
-
 	if (ctx) {
 		teedev_ctx_get(ctx);
 		mutex_lock(&teedev->mutex);
@@ -191,10 +124,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
 	}
 
 	return shm;
-err_rem:
-	mutex_lock(&teedev->mutex);
-	idr_remove(&teedev->idr, shm->id);
-	mutex_unlock(&teedev->mutex);
 err_pool_free:
 	poolm->ops->free(poolm, shm);
 err_kfree:
@@ -259,6 +188,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
 		goto err;
 	}
 
+	refcount_set(&shm->refcount, 1);
 	shm->flags = flags | TEE_SHM_REGISTER;
 	shm->teedev = teedev;
 	shm->ctx = ctx;
@@ -299,22 +229,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
 		goto err;
 	}
 
-	if (flags & TEE_SHM_DMA_BUF) {
-		DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
-
-		exp_info.ops = &tee_shm_dma_buf_ops;
-		exp_info.size = shm->size;
-		exp_info.flags = O_RDWR;
-		exp_info.priv = shm;
-
-		shm->dmabuf = dma_buf_export(&exp_info);
-		if (IS_ERR(shm->dmabuf)) {
-			ret = ERR_CAST(shm->dmabuf);
-			teedev->desc->ops->shm_unregister(ctx, shm);
-			goto err;
-		}
-	}
-
 	mutex_lock(&teedev->mutex);
 	list_add_tail(&shm->link, &ctx->list_shm);
 	mutex_unlock(&teedev->mutex);
@@ -342,6 +256,35 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
 }
 EXPORT_SYMBOL_GPL(tee_shm_register);
 
+static int tee_shm_fop_release(struct inode *inode, struct file *filp)
+{
+	tee_shm_put(filp->private_data);
+	return 0;
+}
+
+static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+	struct tee_shm *shm = filp->private_data;
+	size_t size = vma->vm_end - vma->vm_start;
+
+	/* Refuse sharing shared memory provided by application */
+	if (shm->flags & TEE_SHM_USER_MAPPED)
+		return -EINVAL;
+
+	/* check for overflowing the buffer's size */
+	if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
+		return -EINVAL;
+
+	return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
+			       size, vma->vm_page_prot);
+}
+
+static const struct file_operations tee_shm_fops = {
+	.owner = THIS_MODULE,
+	.release = tee_shm_fop_release,
+	.mmap = tee_shm_fop_mmap,
+};
+
 /**
  * tee_shm_get_fd() - Increase reference count and return file descriptor
  * @shm:	Shared memory handle
@@ -354,10 +297,11 @@ int tee_shm_get_fd(struct tee_shm *shm)
 	if (!(shm->flags & TEE_SHM_DMA_BUF))
 		return -EINVAL;
 
-	get_dma_buf(shm->dmabuf);
-	fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC);
+	/* matched by tee_shm_put() in tee_shm_op_release() */
+	refcount_inc(&shm->refcount);
+	fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR);
 	if (fd < 0)
-		dma_buf_put(shm->dmabuf);
+		tee_shm_put(shm);
 	return fd;
 }
 
@@ -367,17 +311,7 @@ int tee_shm_get_fd(struct tee_shm *shm)
  */
 void tee_shm_free(struct tee_shm *shm)
 {
-	/*
-	 * dma_buf_put() decreases the dmabuf reference counter and will
-	 * call tee_shm_release() when the last reference is gone.
-	 *
-	 * In the case of driver private memory we call tee_shm_release
-	 * directly instead as it doesn't have a reference counter.
-	 */
-	if (shm->flags & TEE_SHM_DMA_BUF)
-		dma_buf_put(shm->dmabuf);
-	else
-		tee_shm_release(shm);
+	tee_shm_put(shm);
 }
 EXPORT_SYMBOL_GPL(tee_shm_free);
 
@@ -484,10 +418,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id)
 	teedev = ctx->teedev;
 	mutex_lock(&teedev->mutex);
 	shm = idr_find(&teedev->idr, id);
+	/*
+	 * If the tee_shm was found in the IDR it must have a refcount
+	 * larger than 0 due to the guarantee in tee_shm_put() below. So
+	 * it's safe to use refcount_inc().
+	 */
 	if (!shm || shm->ctx != ctx)
 		shm = ERR_PTR(-EINVAL);
-	else if (shm->flags & TEE_SHM_DMA_BUF)
-		get_dma_buf(shm->dmabuf);
+	else
+		refcount_inc(&shm->refcount);
 	mutex_unlock(&teedev->mutex);
 	return shm;
 }
@@ -499,7 +438,25 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id);
  */
 void tee_shm_put(struct tee_shm *shm)
 {
-	if (shm->flags & TEE_SHM_DMA_BUF)
-		dma_buf_put(shm->dmabuf);
+	struct tee_device *teedev = shm->teedev;
+	bool do_release = false;
+
+	mutex_lock(&teedev->mutex);
+	if (refcount_dec_and_test(&shm->refcount)) {
+		/*
+		 * refcount has reached 0, we must now remove it from the
+		 * IDR before releasing the mutex. This will guarantee that
+		 * the refcount_inc() in tee_shm_get_from_id() never starts
+		 * from 0.
+		 */
+		idr_remove(&teedev->idr, shm->id);
+		if (shm->ctx)
+			list_del(&shm->link);
+		do_release = true;
+	}
+	mutex_unlock(&teedev->mutex);
+
+	if (do_release)
+		tee_shm_release(teedev, shm);
 }
 EXPORT_SYMBOL_GPL(tee_shm_put);
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index e6805492409f..f07008212474 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1698,11 +1698,15 @@ static void ffs_data_clear(struct ffs_data *ffs)
 
 	BUG_ON(ffs->gadget);
 
-	if (ffs->epfiles)
+	if (ffs->epfiles) {
 		ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
+		ffs->epfiles = NULL;
+	}
 
-	if (ffs->ffs_eventfd)
+	if (ffs->ffs_eventfd) {
 		eventfd_ctx_put(ffs->ffs_eventfd);
+		ffs->ffs_eventfd = NULL;
+	}
 
 	kfree(ffs->raw_descs_data);
 	kfree(ffs->raw_strings);
@@ -1715,7 +1719,6 @@ static void ffs_data_reset(struct ffs_data *ffs)
 
 	ffs_data_clear(ffs);
 
-	ffs->epfiles = NULL;
 	ffs->raw_descs_data = NULL;
 	ffs->raw_descs = NULL;
 	ffs->raw_strings = NULL;
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index d707993ac921..e6bbb9195554 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -90,7 +90,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	/* Look for vendor-specific quirks */
 	if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
 			(pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK ||
-			 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 ||
 			 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) {
 		if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK &&
 				pdev->revision == 0x0) {
@@ -125,6 +124,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 			pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
 
+	if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
+			pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100)
+		xhci->quirks |= XHCI_TRUST_TX_LENGTH;
+
 	if (pdev->vendor == PCI_VENDOR_ID_NEC)
 		xhci->quirks |= XHCI_NEC_HOST;
 
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 270721cf229f..07a6ee8db612 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -97,6 +97,13 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
 			interval = clamp_val(interval, 1, 16) - 1;
 			mult = usb_endpoint_maxp_mult(desc) - 1;
 		}
+		break;
+	case USB_SPEED_FULL:
+		if (usb_endpoint_xfer_isoc(desc))
+			interval = clamp_val(desc->bInterval, 1, 16);
+		else if (usb_endpoint_xfer_int(desc))
+			interval = clamp_val(desc->bInterval, 1, 255);
+
 		break;
 	default:
 		break; /*others are ignored */
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index a2b3dfcee0b5..535f2ecf3c16 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -177,7 +177,7 @@ void tee_device_unregister(struct tee_device *teedev);
  * @offset:	offset of buffer in user space
  * @pages:	locked pages from userspace
  * @num_pages:	number of locked pages
- * @dmabuf:	dmabuf used to for exporting to user space
+ * @refcount:	reference counter
  * @flags:	defined by TEE_SHM_* in tee_drv.h
  * @id:		unique id of a shared memory object on this device
  *
@@ -194,7 +194,7 @@ struct tee_shm {
 	unsigned int offset;
 	struct page **pages;
 	size_t num_pages;
-	struct dma_buf *dmabuf;
+	refcount_t refcount;
 	u32 flags;
 	int id;
 };
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 2c6570e6fcfe..903b2ddde1b4 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -118,6 +118,7 @@ extern struct percpu_counter sctp_sockets_allocated;
 int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
 struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *);
 
+typedef int (*sctp_callback_t)(struct sctp_endpoint *, struct sctp_transport *, void *);
 void sctp_transport_walk_start(struct rhashtable_iter *iter);
 void sctp_transport_walk_stop(struct rhashtable_iter *iter);
 struct sctp_transport *sctp_transport_get_next(struct net *net,
@@ -128,9 +129,8 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
 				  struct net *net,
 				  const union sctp_addr *laddr,
 				  const union sctp_addr *paddr, void *p);
-int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
-			    int (*cb_done)(struct sctp_transport *, void *),
-			    struct net *net, int *pos, void *p);
+int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
+				    struct net *net, int *pos, void *p);
 int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p);
 int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
 		       struct sctp_info *info);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 2882bc7a5b4b..18f9924aa250 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1348,6 +1348,7 @@ struct sctp_endpoint {
 
 	u32 secid;
 	u32 peer_secid;
+	struct rcu_head rcu;
 };
 
 /* Recover the outter endpoint structure. */
@@ -1363,7 +1364,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
 struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
 void sctp_endpoint_free(struct sctp_endpoint *);
 void sctp_endpoint_put(struct sctp_endpoint *);
-void sctp_endpoint_hold(struct sctp_endpoint *);
+int sctp_endpoint_hold(struct sctp_endpoint *ep);
 void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *);
 struct sctp_association *sctp_endpoint_lookup_assoc(
 	const struct sctp_endpoint *ep,
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index f6e3c8c9c744..4fa4e979e948 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -263,7 +263,7 @@ enum nfc_sdp_attr {
 #define NFC_SE_ENABLED  0x1
 
 struct sockaddr_nfc {
-	sa_family_t sa_family;
+	__kernel_sa_family_t sa_family;
 	__u32 dev_idx;
 	__u32 target_idx;
 	__u32 nfc_protocol;
@@ -271,14 +271,14 @@ struct sockaddr_nfc {
 
 #define NFC_LLCP_MAX_SERVICE_NAME 63
 struct sockaddr_nfc_llcp {
-	sa_family_t sa_family;
+	__kernel_sa_family_t sa_family;
 	__u32 dev_idx;
 	__u32 target_idx;
 	__u32 nfc_protocol;
 	__u8 dsap; /* Destination SAP, if known */
 	__u8 ssap; /* Source SAP to be bound to */
 	char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
-	size_t service_name_len;
+	__kernel_size_t service_name_len;
 };
 
 /* NFC socket protocols */
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index bbf3b3daa999..713eea9affaa 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1955,6 +1955,10 @@ static int __init inet_init(void)
 
 	ip_init();
 
+	/* Initialise per-cpu ipv4 mibs */
+	if (init_ipv4_mibs())
+		panic("%s: Cannot init ipv4 mibs\n", __func__);
+
 	/* Setup TCP slab cache for open requests. */
 	tcp_init();
 
@@ -1983,12 +1987,6 @@ static int __init inet_init(void)
 
 	if (init_inet_pernet_ops())
 		pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
-	/*
-	 *	Initialise per-cpu ipv4 mibs
-	 */
-
-	if (init_ipv4_mibs())
-		pr_crit("%s: Cannot init ipv4 mibs\n", __func__);
 
 	ipv4_proc_init();
 
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 0198910c2bf2..7d3caafdf205 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1069,7 +1069,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
 			kfree_skb(skb);
 			return -EINVAL;
 		}
-		if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
+		if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) {
 			kfree_skb(skb);
 			return -EINVAL;
 		}
diff --git a/net/sctp/diag.c b/net/sctp/diag.c
index 8767405de9fa..0a9db0a7f423 100644
--- a/net/sctp/diag.c
+++ b/net/sctp/diag.c
@@ -307,9 +307,8 @@ static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p)
 	return err;
 }
 
-static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
+static int sctp_sock_dump(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p)
 {
-	struct sctp_endpoint *ep = tsp->asoc->ep;
 	struct sctp_comm_param *commp = p;
 	struct sock *sk = ep->base.sk;
 	struct sk_buff *skb = commp->skb;
@@ -319,6 +318,8 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
 	int err = 0;
 
 	lock_sock(sk);
+	if (ep != tsp->asoc->ep)
+		goto release;
 	list_for_each_entry(assoc, &ep->asocs, asocs) {
 		if (cb->args[4] < cb->args[1])
 			goto next;
@@ -361,9 +362,8 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
 	return err;
 }
 
-static int sctp_sock_filter(struct sctp_transport *tsp, void *p)
+static int sctp_sock_filter(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p)
 {
-	struct sctp_endpoint *ep = tsp->asoc->ep;
 	struct sctp_comm_param *commp = p;
 	struct sock *sk = ep->base.sk;
 	const struct inet_diag_req_v2 *r = commp->r;
@@ -521,8 +521,8 @@ static void sctp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
 	if (!(idiag_states & ~(TCPF_LISTEN | TCPF_CLOSE)))
 		goto done;
 
-	sctp_for_each_transport(sctp_sock_filter, sctp_sock_dump,
-				net, &pos, &commp);
+	sctp_transport_traverse_process(sctp_sock_filter, sctp_sock_dump,
+					net, &pos, &commp);
 	cb->args[2] = pos;
 
 done:
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 8640dedcf64f..c4068451b9c7 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -242,6 +242,18 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
 }
 
 /* Final destructor for endpoint.  */
+static void sctp_endpoint_destroy_rcu(struct rcu_head *head)
+{
+	struct sctp_endpoint *ep = container_of(head, struct sctp_endpoint, rcu);
+	struct sock *sk = ep->base.sk;
+
+	sctp_sk(sk)->ep = NULL;
+	sock_put(sk);
+
+	kfree(ep);
+	SCTP_DBG_OBJCNT_DEC(ep);
+}
+
 static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
 {
 	struct sock *sk;
@@ -275,18 +287,13 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
 	if (sctp_sk(sk)->bind_hash)
 		sctp_put_port(sk);
 
-	sctp_sk(sk)->ep = NULL;
-	/* Give up our hold on the sock */
-	sock_put(sk);
-
-	kfree(ep);
-	SCTP_DBG_OBJCNT_DEC(ep);
+	call_rcu(&ep->rcu, sctp_endpoint_destroy_rcu);
 }
 
 /* Hold a reference to an endpoint. */
-void sctp_endpoint_hold(struct sctp_endpoint *ep)
+int sctp_endpoint_hold(struct sctp_endpoint *ep)
 {
-	refcount_inc(&ep->base.refcnt);
+	return refcount_inc_not_zero(&ep->base.refcnt);
 }
 
 /* Release a reference to an endpoint and clean up if there are
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 1148f6691707..d429d5922804 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5056,11 +5056,12 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
 }
 EXPORT_SYMBOL_GPL(sctp_transport_lookup_process);
 
-int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
-			    int (*cb_done)(struct sctp_transport *, void *),
-			    struct net *net, int *pos, void *p) {
+int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
+				    struct net *net, int *pos, void *p)
+{
 	struct rhashtable_iter hti;
 	struct sctp_transport *tsp;
+	struct sctp_endpoint *ep;
 	int ret;
 
 again:
@@ -5069,26 +5070,32 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
 
 	tsp = sctp_transport_get_idx(net, &hti, *pos + 1);
 	for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) {
-		ret = cb(tsp, p);
-		if (ret)
-			break;
+		ep = tsp->asoc->ep;
+		if (sctp_endpoint_hold(ep)) { /* asoc can be peeled off */
+			ret = cb(ep, tsp, p);
+			if (ret)
+				break;
+			sctp_endpoint_put(ep);
+		}
 		(*pos)++;
 		sctp_transport_put(tsp);
 	}
 	sctp_transport_walk_stop(&hti);
 
 	if (ret) {
-		if (cb_done && !cb_done(tsp, p)) {
+		if (cb_done && !cb_done(ep, tsp, p)) {
 			(*pos)++;
+			sctp_endpoint_put(ep);
 			sctp_transport_put(tsp);
 			goto again;
 		}
+		sctp_endpoint_put(ep);
 		sctp_transport_put(tsp);
 	}
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(sctp_for_each_transport);
+EXPORT_SYMBOL_GPL(sctp_transport_traverse_process);
 
 /* 7.2.1 Association Status (SCTP_STATUS)
 
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index d8cbbedef316..ac2f9e511fc3 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -252,7 +252,7 @@ if ($arch eq "x86_64") {
 
 } elsif ($arch eq "s390" && $bits == 64) {
     if ($cc =~ /-DCC_USING_HOTPATCH/) {
-	$mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
+	$mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(brcl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
 	$mcount_adjust = 0;
     } else {
 	$mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$";
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 89dfdbb13129..41e24df986eb 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -5808,7 +5808,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
 	struct common_audit_data ad;
 	struct lsm_network_audit net = {0,};
 	char *addrp;
-	u8 proto;
+	u8 proto = 0;
 
 	if (sk == NULL)
 		return NF_ACCEPT;
diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c
index 270c17ab071e..23177b643606 100644
--- a/tools/testing/selftests/net/udpgso.c
+++ b/tools/testing/selftests/net/udpgso.c
@@ -157,13 +157,13 @@ struct testcase testcases_v4[] = {
 	},
 	{
 		/* send max number of min sized segments */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
+		.tlen = UDP_MAX_SEGMENTS,
 		.gso_len = 1,
-		.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
+		.r_num_mss = UDP_MAX_SEGMENTS,
 	},
 	{
 		/* send max number + 1 of min sized segments: fail */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1,
+		.tlen = UDP_MAX_SEGMENTS + 1,
 		.gso_len = 1,
 		.tfail = true,
 	},
@@ -260,13 +260,13 @@ struct testcase testcases_v6[] = {
 	},
 	{
 		/* send max number of min sized segments */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
+		.tlen = UDP_MAX_SEGMENTS,
 		.gso_len = 1,
-		.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
+		.r_num_mss = UDP_MAX_SEGMENTS,
 	},
 	{
 		/* send max number + 1 of min sized segments: fail */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1,
+		.tlen = UDP_MAX_SEGMENTS + 1,
 		.gso_len = 1,
 		.tfail = true,
 	},
diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
index e821564053cf..463a2cbd0261 100644
--- a/tools/testing/selftests/net/udpgso_bench_tx.c
+++ b/tools/testing/selftests/net/udpgso_bench_tx.c
@@ -247,6 +247,7 @@ static void usage(const char *filepath)
 
 static void parse_opts(int argc, char **argv)
 {
+	const char *bind_addr = NULL;
 	int max_len, hdrlen;
 	int c;
 
@@ -271,7 +272,7 @@ static void parse_opts(int argc, char **argv)
 			cfg_cpu = strtol(optarg, NULL, 0);
 			break;
 		case 'D':
-			setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
+			bind_addr = optarg;
 			break;
 		case 'l':
 			cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
@@ -300,6 +301,11 @@ static void parse_opts(int argc, char **argv)
 		}
 	}
 
+	if (!bind_addr)
+		bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
+
+	setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr);
+
 	if (optind != argc)
 		usage(argv[0]);
 

^ permalink raw reply related

* Re: [PATCH v2 0/3] fs/erofs: new filesystem
From: Gao Xiang @ 2022-01-05 11:57 UTC (permalink / raw)
  To: Huang Jianan; +Cc: Tom Rini, u-boot, linux-erofs
In-Reply-To: <20210825224042.GF858@bill-the-cat>

Hi Jianan,

On Wed, Aug 25, 2021 at 06:40:42PM -0400, Tom Rini wrote:
> On Mon, Aug 23, 2021 at 08:36:43PM +0800, Huang Jianan wrote:
> 
> > From: Huang Jianan <huangjianan@oppo.com>
> > 
> > Add erofs filesystem support.
> > 
> > The code is adapted from erofs-utils in order to reduce maintenance
> > burden and keep with the latest feature.
> > 
> > Changes since v1:
> >  - fix the inconsistency between From and SoB (Bin Meng);
> >  - add missing license header;
> > 
> > Huang Jianan (3):
> >   fs/erofs: add erofs filesystem support
> >   fs/erofs: add lz4 1.8.3 decompressor
> >   fs/erofs: add lz4 decompression support
> 
> Aside from what I've just now sent, can you please extend the existing
> py/tests/ to cover basic functionality here, ensure they run on sandbox
> and in CI?  Thanks.

Any further progress on this work? At least sync it up with erofs-utils
1.4?

Thanks,
Gao Xiang

> 
> -- 
> Tom



^ permalink raw reply


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.