Commit Graph

993216 Commits

Author SHA1 Message Date
Michael Grzeschik
f64a2b78d7 UPSTREAM: usb: gadget: uvc: also use try_format in set_format
Since e219a712bc (usb: gadget: uvc: add v4l2 try_format api call) the
try_format function is available. With this function includes checks for
valid configurations programmed in the configfs. We use this function to
ensure to return valid values on the set_format callback.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Fixes: e219a712bc ("usb: gadget: uvc: add v4l2 try_format api call")
Link: https://lore.kernel.org/r/20221026182240.363055-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 181babf7b4)
Bug: 259171206
Change-Id: I404c8d01dc53dcf3b400c0f9e1888992d9f65db8
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:17 -08:00
Michael Grzeschik
044c3865c6 UPSTREAM: usb: gadget: uvc: default the ctrl request interface offsets
For the userspace it is needed to distinguish between requests for the
control or streaming interface. The userspace would have to parse the
configfs to know which interface index it has to compare the ctrl
requests against. Since the interface numbers are not fixed, e.g. for
composite gadgets, the interface offset depends on the setup.

The kernel has this information when handing over the ctrl request to
the userspace. This patch removes the offset from the interface numbers
and expose the default interface defines in the uapi g_uvc.h.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20221011075348.1786897-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit d182bf156c)
Bug: 259171206
Change-Id: Ie5978ef268731e67ca72940ce6fbc7f980cb4419
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:17 -08:00
Jeff Vanhoof
dfa0ad4a5d UPSTREAM: usb: gadget: uvc: fix sg handling during video encode
In uvc_video_encode_isoc_sg, the uvc_request's sg list is
incorrectly being populated leading to corrupt video being
received by the remote end. When building the sg list the
usage of buf->sg's 'dma_length' field is not correct and
instead its 'length' field should be used.

Fixes: e81e7f9a0e ("usb: gadget: uvc: add scatter gather support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jeff Vanhoof <qjv001@motorola.com>
Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20221018215044.765044-5-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit b57b08e6f4)
Bug: 259171206
Change-Id: I6b6ee215676592e44dc1a12081efc049c3d50d4b
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:17 -08:00
Dan Vacura
6505cd47e1 UPSTREAM: usb: gadget: uvc: fix sg handling in error case
If there is a transmission error the buffer will be returned too early,
causing a memory fault as subsequent requests for that buffer are still
queued up to be sent. Refactor the error handling to wait for the final
request to come in before reporting back the buffer to userspace for all
transfer types (bulk/isoc/isoc_sg). This ensures userspace knows if the
frame was successfully sent.

Fixes: e81e7f9a0e ("usb: gadget: uvc: add scatter gather support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20221018215044.765044-4-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 0a0a2760b0)
Bug: 259171206
Change-Id: I9fa41c05a26c3118c6af609d18e1e447a5e4b304
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:17 -08:00
Dan Vacura
b6ebfbf5a1 UPSTREAM: usb: gadget: uvc: fix dropped frame after missed isoc
With the re-use of the previous completion status in 0d1c407b1a
("usb: dwc3: gadget: Return proper request status") it could be possible
that the next frame would also get dropped if the current frame has a
missed isoc error. Ensure that an interrupt is requested for the start
of a new frame.

Fixes: fc78941d81 ("usb: gadget: uvc: decrease the interrupt load to a quarter")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20221018215044.765044-2-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 8e8e923a49)
Bug: 259171206
Change-Id: I7d1b9243b788d2fb3593c52f4fb49ba195720af6
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:17 -08:00
Michael Grzeschik
ed87044a78 UPSTREAM: usb: gadget: uvc: don't put item still in use
With the patch "588b9e85609b (usb: gadget: uvc: add v4l2 enumeration api
calls)" the driver is keeping a list of configfs entries currently
configured. The list is used in uvc_v4l2 on runtime.

The driver now is giving back the list item just after it was referenced
with config_item_put. It also calls config_item_put on uvc_free, which
is the only and right place to give back the reference. This patch fixes
the issue by removing the extra config_item_put in uvc_alloc.

Fixes: 588b9e8560 (usb: gadget: uvc: add v4l2 enumeration api calls)
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220930122839.1747279-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 3180d827c8)
Bug: 259171206
Change-Id: Idf19d732cc5b90f09311a94d5d07c6e1805043f5
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:17 -08:00
Nathan Chancellor
2f15312ac4 UPSTREAM: usb: gadget: uvc: Fix argument to sizeof() in uvc_register_video()
When building s390 allmodconfig after commit 9b91a65230 ("usb: gadget:
uvc: increase worker prio to WQ_HIGHPRI"), the following error occurs:

  In file included from ../include/linux/string.h:253,
                   from ../include/linux/bitmap.h:11,
                   from ../include/linux/cpumask.h:12,
                   from ../include/linux/smp.h:13,
                   from ../include/linux/lockdep.h:14,
                   from ../include/linux/rcupdate.h:29,
                   from ../include/linux/rculist.h:11,
                   from ../include/linux/pid.h:5,
                   from ../include/linux/sched.h:14,
                   from ../include/linux/ratelimit.h:6,
                   from ../include/linux/dev_printk.h:16,
                   from ../include/linux/device.h:15,
                   from ../drivers/usb/gadget/function/f_uvc.c:9:
  In function ‘fortify_memset_chk’,
      inlined from ‘uvc_register_video’ at ../drivers/usb/gadget/function/f_uvc.c:424:2:
  ../include/linux/fortify-string.h:301:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
    301 |                         __write_overflow_field(p_size_field, size);
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This points to the memset() in uvc_register_video(). It is clear that
the argument to sizeof() is incorrect, as uvc->vdev (a 'struct
video_device') is being zeroed out but the size of uvc->video (a 'struct
uvc_video') is being used as the third arugment to memset().

pahole shows that prior to commit 9b91a65230 ("usb: gadget: uvc:
increase worker prio to WQ_HIGHPRI"), 'struct video_device' and
'struct ucv_video' had the same size, meaning that the argument to
sizeof() is incorrect semantically but there is no visible issue:

  $ pahole -s build/drivers/usb/gadget/function/f_uvc.o | grep -E "(uvc_video|video_device)\s+"
  video_device    1400    4
  uvc_video       1400    3

After that change, uvc_video becomes slightly larger, meaning that the
memset() will overwrite by 8 bytes:

  $ pahole -s build/drivers/usb/gadget/function/f_uvc.o | grep -E "(uvc_video|video_device)\s+"
  video_device    1400    4
  uvc_video       1408    3

Fix the arugment to sizeof() so that there is no overwrite.

Cc: stable@vger.kernel.org
Fixes: e4ce9ed835 ("usb: gadget: uvc: ensure the vdev is unset")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220928201921.3152163-1-nathan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit a15e17acce)
Bug: 259171206
Change-Id: Id48717e01c36fa2ace9570b97553f371e5743fc3
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:16 -08:00
Michael Grzeschik
7941866918 UPSTREAM: usb: gadget: uvc: add v4l2 try_format api call
This patch adds the uvc_v4l2_try_format api call to validate
the setting of v4l2_format. It will fallback to the nearest
allowed framesize.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220909221335.15033-5-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit e219a712bc)
Bug: 259171206
Change-Id: Ic83d90252ec07372470906d7f6259bde131d1a8a
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:16 -08:00
Michael Grzeschik
55c758d518 UPSTREAM: usb: gadget: uvc: add v4l2 enumeration api calls
This patch adds support to the v4l2 VIDIOCs for enum_format,
enum_framesizes and enum_frameintervals. This way, the userspace
application can use these VIDIOCS to query the via configfs exported
frame capabilities. With thes callbacks the userspace doesn't have to
bring its own configfs parser.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220909221335.15033-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 588b9e8560)
Bug: 259171206
Change-Id: I26bf3a509158da6f521c2e62076ef014cf0235b8
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:55:04 -08:00
Michael Grzeschik
73879990eb BACKPORT: media: uvcvideo: move uvc_format_desc to common header
The uvc_format_desc, GUID defines and the uvc_format_by_guid helper is
also useful for the uvc gadget stack. This patch moves them to a common
header.

Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220909221335.15033-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 6b028df7d4)
arakesh: resolved minor conflicts in drivers/media/usb/uvc/uvc_driver.c
         and drivers/media/usb/uvc/uvcvideo.h
Bug: 259171206
Change-Id: I37b839850896fff279159fca93a50f4788184354
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:44:20 -08:00
Michael Grzeschik
38131c2b2f BACKPORT: media: v4l: move helper functions for fractions from uvc to v4l2-common
The functions uvc_simplify_fraction and uvc_fraction_to_interval are
generic helpers which are also useful for other v4l2 drivers. This patch
moves them to v4l2-common.

Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220909221335.15033-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 6ba8b8d453)
arakesh: resolved minor conflicts in include/media/v4l2-common.h and
         drivers/media/v4l2-core/v4l2-common.c
Bug: 259171206
Change-Id: I17eea1ef6788ba98599b1d8a12499147ebef7d60
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-11 17:43:13 -08:00
Michael Grzeschik
7b529581b9 UPSTREAM: usb: gadget: uvc: increase worker prio to WQ_HIGHPRI
This patch is changing the simple workqueue in the gadget driver to be
allocated as async_wq with a higher priority. The pump worker, that is
filling the usb requests, will have a higher priority and will not be
scheduled away so often while the video stream is handled. This will
lead to fewer streaming underruns.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220907215818.2670097-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 9b91a65230)
Bug: 242344221
Change-Id: I91ffbc93e8769c3b2674134679d5f9d48b566dbd
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Wolfram Sang
b9626fe49c UPSTREAM: usb: move from strlcpy with unused retval to strscpy
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Reviewed-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220818210116.7517-1-wsa+renesas@sang-engineering.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit b7db5733a5)
Bug: 242344221
Change-Id: Id0c3b164fa1f493905a17c04828455c6959eb0b5
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
a43fb03462 UPSTREAM: usb: gadget: uvc: fix changing interface name via configfs
When setting the function name, it is always truncated by one char since
snprintf is always including the null-termination in the len parameter.
We use strscpy and fix the size setting to use len + 1 instead.

Fixes: 324e4f8507 ("usb: gadget: uvc: allow changing interface name via configfs")
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220707115612.2760569-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 3d0dc53902)
Bug: 242344221
Change-Id: I9a138af30c0628b1ec127f7986ace12df77b2d00
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Dan Vacura
121bf203f8 UPSTREAM: usb: gadget: uvc: fix list double add in uvcg_video_pump
A panic can occur if the endpoint becomes disabled and the
uvcg_video_pump adds the request back to the req_free list after it has
already been queued to the endpoint. The endpoint complete will add the
request back to the req_free list. Invalidate the local request handle
once it's been queued.

<6>[  246.796704][T13726] configfs-gadget gadget: uvc: uvc_function_set_alt(1, 0)
<3>[  246.797078][   T26] list_add double add: new=ffffff878bee5c40, prev=ffffff878bee5c40, next=ffffff878b0f0a90.
<6>[  246.797213][   T26] ------------[ cut here ]------------
<2>[  246.797224][   T26] kernel BUG at lib/list_debug.c:31!
<6>[  246.807073][   T26] Call trace:
<6>[  246.807180][   T26]  uvcg_video_pump+0x364/0x38c
<6>[  246.807366][   T26]  process_one_work+0x2a4/0x544
<6>[  246.807394][   T26]  worker_thread+0x350/0x784
<6>[  246.807442][   T26]  kthread+0x2ac/0x320

Fixes: f9897ec0f6 ("usb: gadget: uvc: only pump video data if necessary")
Cc: stable@vger.kernel.org
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20220617163154.16621-1-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 96163f835e)
Bug: 242344221
Change-Id: Ib3181d5965281318619c7b78da2c334701750e14
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
c6f77b441c UPSTREAM: usb: gadget: uvc: calculate the number of request depending on framesize
The current limitation of possible number of requests being handled is
dependent on the gadget speed. It makes more sense to depend on the
typical frame size when calculating the number of requests. This patch
is changing this and is using the previous limits as boundaries for
reasonable minimum and maximum number of requests.

For a 1080p jpeg encoded video stream with a maximum imagesize of
e.g. 800kB with a maxburst of 8 and an multiplier of 1 the resulting
number of requests is calculated to 49.

        800768         1
nreqs = ------ * -------------- ~= 49
          2      (1024 * 8 * 1)

Tested-by: Dan Vacura <w36195@motorola.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220529223848.105914-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 87d76b5f1d)
Bug: 242344221
Change-Id: I3cf760340c9c2cde32f1c8ca9023735d0639c5fb
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Laurent Pinchart
6a2b46f5cc UPSTREAM: usb: gadget: uvc: Fix comment blocks style
The UVC gadget driver historically uses the

/* Comment
 * style
 */

for multi-line block comments, which is frowned upon. Patches for the
driver are required to use the more standard

/*
 * Comment
 * style
 */

style. This result in inconsistencies. Fix it by converting all
remaining instances of the old style.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20220608174918.14656-1-laurent.pinchart@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit c5d337a358)
Bug: 242344221
Change-Id: I7bf64ebabf9f5d9ad4434cba36200d6edd925e73
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
f58be91ef2 UPSTREAM: usb: gadget: uvc: track frames in format entries
Just like the header is tracking the formats in a linked list, in this
patch we track the frames in a linked list of the formats. It
simplifies the parsing of the configfs structure.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Link: https://lore.kernel.org/r/20220421211427.3400834-6-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit a2673d570b)
Bug: 242344221
Change-Id: I8d3e4ba5b13cad2f195400ef4de5c8e196e25a8a
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
391080e7bc UPSTREAM: usb: gadget: uvc: move structs to common header
The functions and structs of the configfs interface should also be used
by the uvc gadget driver. This patch prepares the stack by moving the
common structs and functions to the common header file.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Link: https://lore.kernel.org/r/20220421211427.3400834-5-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit e2fa7b36de)
Bug: 242344221
Change-Id: I682ca939d2f6092868c75aa73ca3a98713ffca84
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
fc33d1de5c UPSTREAM: usb: gadget: uvc: prevent index variables to start from 0
Some configfs variables like bDefaultFrameIndex are always starting by
1. This patch adds a check to prevent setting those variables to 0.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Link: https://lore.kernel.org/r/20220421211427.3400834-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit a350cfb653)
Bug: 242344221
Change-Id: Ieb800223fe0071c7a3650b146a1d0c6f5f7ad8a2
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
da9de7cbf5 UPSTREAM: usb: gadget: uvc: improve sg exit condition
The exit condition to quit iterating over the sg_list, while encoding
the sg entries, has to consider the case that the dma_len of the entry
could be zero. This patch takes this condition to account.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220402232744.3622565-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit aef1127988)
Bug: 242344221
Change-Id: I7eddc039ec0c54982fd6bae95af2f73f4ce04ef6
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
474eabbb17 UPSTREAM: usb: gadget: uvc: giveback vb2 buffer on req complete
On uvc_video_encode_isoc_sg the mapped vb2 buffer is returned
to early. Only after the last usb_request worked with the buffer
it is allowed to give it back to vb2. This patch fixes that.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220402232744.3622565-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 9b969f93bc)
Bug: 242344221
Change-Id: If2dbb1ec5ca6a2b5f11153cec4db76cbcc1065c3
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
e60b62c1ae UPSTREAM: usb: gadget: uvc: rework uvcg_queue_next_buffer to uvcg_complete_buffer
The function uvcg_queue_next_buffer is used different than its name
suggests. The return value nextbuf is never used by any caller. This
patch reworks the function to its actual purpose, by removing the unused
code and renaming it. The function name uvcg_complete_buffer makes it
more clear that it is actually marking the current video buffer as
complete.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220402232744.3622565-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 61aa709ca5)
Bug: 242344221
Change-Id: I50f0995acabff20b36721d368aa9691a713381d7
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Dan Vacura
0889895826 UPSTREAM: usb: gadget: uvc: remove pause flag use
The pause flag doesn't appear to serve a purpose as it is possible for
the pump worker thread to not be running when new buffers are queued.
Before the following change was introduced: "43cd0023872e usb: gadget:
uvc_video: add worker to handle the frame pumping", the pause flag
status was discarded and never returned. This masked a current issues of
the userspace receiving non-zero values (considered unsuccessful) and
prevents trace_v4l2_qbuf() from being called.

Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20220413192402.26063-1-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit be30e35027)
Bug: 242344221
Change-Id: I5c2a67641d8a0af7a11ac43ad57b76b69bba26fc
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Dan Vacura
be90188351 UPSTREAM: usb: gadget: uvc: allow changing interface name via configfs
Add a configfs entry, "function_name", to change the iInterface field
for VideoControl. This name is used on host devices for user selection,
useful when multiple cameras are present. The default will remain "UVC
Camera".

Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20220401160447.5919-1-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 324e4f8507)
Bug: 242344221
Change-Id: I5b4666156ce2300ae902bca2ff380560d19d3f0a
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Olbrich
88ffebe891 UPSTREAM: usb: gadget: uvc: implement dwPresentationTime and scrSourceClock
This patch adds the fields UVC_STREAM_PTS and UVC_STREAM_SCR to the uvc
header, in case this data is available. It also enables the copy of the
timestamp to the vb2_v4l2_buffer by setting V4L2_BUF_FLAG_TIMESTAMP_COPY
in the queue.timestamp_flags.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211022093223.26493-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit fd03af27c3)
Bug: 242344221
Change-Id: Icccbf2d453f58e05984d995c572524ec3d9f577b
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
009b462fb3 UPSTREAM: usb: gadget: uvc: use on returned header len in video_encode_isoc_sg
The function uvc_video_encode_header function returns the number of
bytes used for the header. We change the video_encode_isoc_sg function
to use the returned header_len rather than UVCG_REQUEST_HEADER_LEN and
make the encode function more flexible.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211022093223.26493-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit f262ce66d4)
Bug: 242344221
Change-Id: I3f3fe1deb42ca9a3c559968ef324af3e850d073f
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
c59078421b UPSTREAM: usb: gadget: uvc: ensure the vdev is unset
Since the uvc video device is created on demand, we have to ensure
that the struct is always zeroed. Otherwise the previous settings
might collide with the new values.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211017215017.18392-7-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit e4ce9ed835)
Bug: 242344221
Change-Id: Iff680809310e34b0341a902250f208be4e6cdb6e
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
6a53e7b6a4 UPSTREAM: usb: gadget: uvc: only pump video data if necessary
If the streaming endpoint is not enabled, the worker has nothing to do.
In the case buffers are still queued, this patch ensures that it will bail
out without handling any data.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211017215017.18392-6-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit f9897ec0f6)
Bug: 242344221
Change-Id: I1d43fb5b45f209ec98ac5ca335a04c88d536075f
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
d8b55ca86d UPSTREAM: usb: gadget: uvc: only schedule stream in streaming state
This patch ensures that the video pump thread will only be scheduled if
the uvc is really in streaming state. This way the worker will not have
to run on an empty queue.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211017215017.18392-5-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 5fc49d8bee)
Bug: 242344221
Change-Id: I9b38b336d69e1840de6c557ad52d5f0c5e2afc96
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
5c5e45ee7b UPSTREAM: usb: gadget: uvc: test if ep->desc is valid on ep_queue
The reason that the ep_queue has failed could be a disabled endpoint.
In that case it is not guaranteed that the ep->desc is still valid.
This patch adds a check for NULL.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211017215017.18392-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 38db3716a5)
Bug: 242344221
Change-Id: I0165b6ad67056d875020500d7d47ebc3ee73c5a7
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
071bf7bf20 UPSTREAM: usb: gadget: uvc: consistently use define for headerlen
The uvc request headerlen of 2 was defined as UVCG_REQUEST_HEADER_LEN
in commit e81e7f9a0e ("usb: gadget: uvc: add scatter gather support").
We missed to use it consistently. This patch fixes that.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20211018072059.11465-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

(cherry picked from commit 859c675d84)
Bug: 242344221
Change-Id: I8e54d5919142646bdc61b7c6e6b58269987b9b4d
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
4ea3a805ea UPSTREAM: usb: gadget: uvc: decrease the interrupt load to a quarter
With usb3 we handle many more requests. Decrease the interrupt load by
only enabling the interrupt every quarter of the allocated requests.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

--
v1 -> v2: - edited patch description
	  - removed extra parantheses
	  - added a comment for the logic
	  - using unsigned int instead of int
	  - reinitializing req_int_count in uvcg_video_enable
v2 -> v3: -
Link: https://lore.kernel.org/r/20210628155311.16762-6-m.grzeschik@pengutronix.de

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit fc78941d81)
Bug: 242344221
Change-Id: I4b40c4bbd90b9b8ad85957a77589fb304e00a876
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
000cbb7d4b UPSTREAM: usb: gadget: uvc: add scatter gather support
This patch adds support for scatter gather transfers. If the underlying
gadgets sg_supported == true, then the videeobuf2-dma-sg is used and the
encode routine maps all scatter entries to separate scatterlists for the
usb gadget.

When streaming 1080p with request size of 1024 times 3 bytes top shows a
difference of about 6.4% CPU load applying this patch:

 PID USER      PR  NI    VIRT    RES  %CPU  %MEM     TIME+ S COMMAND

  64 root       0 -20    0.0m   0.0m   7.7   0.0   0:01.25 I [kworker/u5:0-uvcvideo]
  83 root       0 -20    0.0m   0.0m   4.5   0.0   0:03.71 I [kworker/u5:3-uvcvideo]
 307 root     -51   0    0.0m   0.0m   3.8   0.0   0:01.05 S [irq/51-dwc3]

vs.

  64 root       0 -20    0.0m   0.0m   5.8   0.0   0:01.79 I [kworker/u5:0-uvcvideo]
 306 root     -51   0    0.0m   0.0m   3.2   0.0   0:01.97 S [irq/51-dwc3]
  82 root       0 -20    0.0m   0.0m   0.6   0.0   0:01.86 I [kworker/u5:1-uvcvideo]

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20210628155311.16762-5-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit e81e7f9a0e)
Bug: 242344221
Change-Id: I466e3aaac60ffee4439ecf2b4583dae543e373f4
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
29cd732e9a UPSTREAM: usb: gadget: uvc: set v4l2_dev->dev in f_uvc
The v4l2_dev has no corresponding device to it. We will
point it to the gadget's dev.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20210628155311.16762-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit b9b82d3d0d)
Bug: 242344221
Change-Id: Ic4af4e164a2bb01578b10dd3c478a142c244c9ad
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
Michael Grzeschik
b9cfdaa0e1 UPSTREAM: usb: gadget: uvc: make uvc_num_requests depend on gadget speed
While sending bigger images is possible with USB_SPEED_SUPER it is
better to use more isochronous requests in flight. This patch makes the
number uvc_num_requests dynamic by changing it depending on the gadget
speed.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20210628155311.16762-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 9973772dbb)
Bug: 242344221
Change-Id: Ie3757dde02125eaa0e28b6181c475726cb344742
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2023-01-10 23:32:31 +00:00
davidchiang
6a2b747210 ANDROID: Update the ABI symbol list and xml
Add symbols find_vm_area.

1 function symbol(s) added
  'struct vm_struct * find_vm_area(void *)'

Bug: 263839332
Change-Id: I1c1298fe8d2bbdba323a7990c58c2eae2e9b5610
Signed-off-by: davidchiang <davidchiang@google.com>
2023-01-10 04:21:27 +00:00
davidchiang
41b027695f ANDROID: mm: Export find_vm_area
Export find_vm_area for obtaining pages of vmalloc'ed memory, which is
required for both GXP and TPU modules.

Bug: 263839332
Change-Id: I1d6c37a5abb6012c3ff295120dd2d3cb2871c820
Signed-off-by: davidchiang <davidchiang@google.com>
2023-01-10 02:52:23 +00:00
Greg Kroah-Hartman
c82a7304de ANDROID: allmodconfig: disable WERROR
-Werror still fails on some arm and arm64 code due to clang issues
(works on gcc!), so disable it when building allmodconfig builds for
now.

Hopefully the clang developers will work on this...

Bug: 199872592
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6ccc856773c40e3c0f541a1316b20e9ae3de4380
(cherry picked from commit eb57c31115)
Signed-off-by: Alistair Delva <adelva@google.com>
2023-01-10 00:54:47 +00:00
Linus Torvalds
0697ad7f44 UPSTREAM: Enable '-Werror' by default for all kernel builds
... but make it a config option so that broken environments can disable
it when required.

We really should always have a clean build, and will disable specific
over-eager warnings as required, if we can't fix them.  But while I
fairly religiously enforce that in my own tree, it doesn't get enforced
by various build robots that don't necessarily report warnings.

So this just makes '-Werror' a default compiler flag, but allows people
to disable it for their configuration if they have some particular
issues.

Occasionally, new compiler versions end up enabling new warnings, and it
can take a while before we have them fixed (or the warnings disabled if
that is what it takes), so the config option allows for that situation.

Hopefully this will mean that I get fewer pull requests that have new
warnings that were not noticed by various automation we have in place.

Knock wood.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 3fe617ccaf)
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: If981f26ebe668be7c727661fede10215c4ee5bc5
2023-01-10 00:54:47 +00:00
Sangmoon Kim
c66fc69f33 ANDROID: ABI: update galaxy allowed list for trace hook
Bug: 263703180

Change-Id: Ie26dfae4b8340ae7ccc977e8ac308a5cd7284374
Signed-off-by: Woogeun Lee <woogeun.lee@samsung.com>
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
2023-01-09 20:02:44 +00:00
Sangmoon Kim
b42eddeb28 Revert "Revert "ANDROID: workqueue: add vendor hook for wq lockup information""
This reverts commit 7a6ea55aa0.

This hook was removed because there is no user.
But the new project needs this hook.

Bug: 263703180

Change-Id: I14e286fd6d426d4ffdb4cb440477f0fae65e980e
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
2023-01-09 20:02:44 +00:00
Eric Biggers
f2a236c7ae ANDROID: fips140: add crypto_memneq() back to the module
crypto_memneq() is one of the utility functions that was intentionally
included in the fips140 module, out of concerns that it would be seen as
"cryptographic" and thus would be required to be included the module for
the FIPS certification.  It should not have been removed from the
module, so add it back.

Bug: 188620248
Fixes: 29c427664a ("Merge tag 'android13-5.10.149_r00' into android13-5.10")
Change-Id: I8a19dfd73390f8c1348885f97fa42d900e47b82b
Signed-off-by: Eric Biggers <ebiggers@google.com>
2023-01-09 10:55:56 +00:00
Jens Axboe
4f1eb203c6 UPSTREAM: io_uring: kill goto error handling in io_sqpoll_wait_sq()
Hunk extracted from commit 70aacfe661
upstream.

If the sqpoll thread has died, the out condition doesn't remove the
waiting task from the waitqueue. The goto and check are not needed, just
make it a break condition after setting the error value. That ensures
that we always remove ourselves from sqo_sq_wait waitqueue.

Bug: 259534862
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0f544353fe)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I453c3e23a2f0c5ce6a8dd73dac020ec6f32994ca
2023-01-09 09:01:31 +00:00
Woogeun Lee
f7ea55aee6 ANDROID: ABI: initial add allowed list for galaxy
80 function symbol(s) added
  'int __blk_mq_debugfs_rq_show(struct seq_file *, struct request *)'
  'ktime_t __hrtimer_get_remaining(const struct hrtimer *, bool)'
  'void __kfree_skb(struct sk_buff *)'
  'bool __percpu_down_read(struct percpu_rw_semaphore *, bool)'
  'int __traceiter_android_rvh_dequeue_task_idle(void *, struct task_struct *)'
  'int __traceiter_android_rvh_report_bug(void *, const char *, unsigned int, unsigned long int)'
  'int __traceiter_android_rvh_schedule_bug(void *, struct task_struct *)'
  'int __traceiter_android_vh_mutex_wait_finish(void *, struct mutex *)'
  'int __traceiter_android_vh_mutex_wait_start(void *, struct mutex *)'
  'int __traceiter_android_vh_ptype_head(void *, const struct packet_type *, struct list_head *)'
  'int __traceiter_android_vh_rtmutex_wait_finish(void *, struct rt_mutex *)'
  'int __traceiter_android_vh_rtmutex_wait_start(void *, struct rt_mutex *)'
  'int __traceiter_android_vh_rwsem_read_wait_finish(void *, struct rw_semaphore *)'
  'int __traceiter_android_vh_rwsem_read_wait_start(void *, struct rw_semaphore *)'
  'int __traceiter_android_vh_rwsem_write_wait_finish(void *, struct rw_semaphore *)'
  'int __traceiter_android_vh_rwsem_write_wait_start(void *, struct rw_semaphore *)'
  'int __traceiter_android_vh_sched_show_task(void *, struct task_struct *)'
  'int __traceiter_android_vh_try_to_freeze_todo(void *, unsigned int, unsigned int, bool)'
  'int __traceiter_android_vh_try_to_freeze_todo_unfrozen(void *, struct task_struct *)'
  'int __traceiter_android_vh_watchdog_timer_softlockup(void *, int, struct pt_regs *, bool)'
  'int __traceiter_kfree_skb(void *, struct sk_buff *, void *)'
  'void alarm_start(struct alarm *, ktime_t)'
  'int blk_mq_debugfs_rq_show(struct seq_file *, void *)'
  'void blk_mq_sched_request_inserted(struct request *)'
  'bool blk_mq_sched_try_insert_merge(struct request_queue *, struct request *)'
  'bool blk_mq_sched_try_merge(struct request_queue *, struct bio *, unsigned int, struct request * *)'
  'struct blkcg_gq * blkg_lookup_slowpath(struct blkcg *, struct request_queue *, bool)'
  'void * bsearch(void *, void *, size_t, size_t, cmp_func_t)'
  'struct device * create_function_device(char *)'
  'struct device_driver * driver_find(const char *, struct bus_type *)'
  'int dump_align(struct coredump_params *, int)'
  'int dump_emit(struct coredump_params *, void *, int)'
  'struct elevator_queue * elevator_alloc(struct request_queue *, struct elevator_type *)'
  'bool elv_bio_merge_ok(struct request *, struct bio *)'
  'void elv_rb_add(struct rb_root *, struct request *)'
  'void elv_rb_del(struct rb_root *, struct request *)'
  'struct request * elv_rb_find(struct rb_root *, sector_t)'
  'struct request * elv_rb_former_request(struct request_queue *, struct request *)'
  'struct request * elv_rb_latter_request(struct request_queue *, struct request *)'
  'int elv_register(struct elevator_type *)'
  'void elv_rqhash_add(struct request_queue *, struct request *)'
  'void elv_rqhash_del(struct request_queue *, struct request *)'
  'void elv_unregister(struct elevator_type *)'
  'void file_ra_state_init(struct file_ra_state *, struct address_space *)'
  'ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *)'
  'struct file * get_mm_exe_file(struct mm_struct *)'
  'struct kernfs_node * kernfs_find_and_get_ns(struct kernfs_node *, const char *, void *)'
  'void kernfs_put(struct kernfs_node *)'
  'int kstrtos16(const char *, unsigned int, s16 *)'
  'struct cgroup_subsys_state * kthread_blkcg()'
  'int kthread_park(struct task_struct *)'
  'bool kthread_should_park()'
  'dev_t name_to_dev_t(const char *)'
  'int of_add_property(struct device_node *, struct property *)'
  'void pm_get_active_wakeup_sources(char *, size_t)'
  'int rcuwait_wake_up(struct rcuwait *)'
  'int register_kretprobe(struct kretprobe *)'
  'struct ctl_table_header * register_net_sysctl(struct net *, const char *, struct ctl_table *)'
  'void regulator_bulk_free(int, struct regulator_bulk_data *)'
  'void sbitmap_queue_min_shallow_depth(struct sbitmap_queue *, unsigned int)'
  'struct list_head * seq_list_next(void *, struct list_head *, loff_t *)'
  'struct list_head * seq_list_start(struct list_head *, loff_t)'
  'int skb_copy_ubufs(struct sk_buff *, gfp_t)'
  'int smp_call_function_single_async(int, struct __call_single_data *)'
  'int smpboot_register_percpu_thread(struct smp_hotplug_thread *)'
  'void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *)'
  'int snd_soc_add_card_controls(struct snd_soc_card *, const struct snd_kcontrol_new *, int)'
  'int snd_soc_dai_set_tristate(struct snd_soc_dai *, int)'
  'unsigned int stack_trace_save(unsigned long int *, unsigned int, unsigned int)'
  'unsigned int stack_trace_save_regs(struct pt_regs *, unsigned long int *, unsigned int, unsigned int)'
  'unsigned int stack_trace_save_tsk(struct task_struct *, unsigned long int *, unsigned int, unsigned int)'
  'int tcp_register_congestion_control(struct tcp_congestion_ops *)'
  'void tcp_reno_cong_avoid(struct sock *, u32, u32)'
  'u32 tcp_reno_ssthresh(struct sock *)'
  'u32 tcp_reno_undo_cwnd(struct sock *)'
  'u32 tcp_slow_start(struct tcp_sock *, u32)'
  'void tcp_unregister_congestion_control(struct tcp_congestion_ops *)'
  'void unregister_kretprobe(struct kretprobe *)'
  'struct usb_device * usb_alloc_dev(struct usb_device *, struct usb_bus *, unsigned int)'
  'void usb_set_device_state(struct usb_device *, enum usb_device_state)'

19 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_dequeue_task_idle'
  'struct tracepoint __tracepoint_android_rvh_report_bug'
  'struct tracepoint __tracepoint_android_rvh_schedule_bug'
  'struct tracepoint __tracepoint_android_vh_mutex_wait_finish'
  'struct tracepoint __tracepoint_android_vh_mutex_wait_start'
  'struct tracepoint __tracepoint_android_vh_ptype_head'
  'struct tracepoint __tracepoint_android_vh_rtmutex_wait_finish'
  'struct tracepoint __tracepoint_android_vh_rtmutex_wait_start'
  'struct tracepoint __tracepoint_android_vh_rwsem_read_wait_finish'
  'struct tracepoint __tracepoint_android_vh_rwsem_read_wait_start'
  'struct tracepoint __tracepoint_android_vh_rwsem_write_wait_finish'
  'struct tracepoint __tracepoint_android_vh_rwsem_write_wait_start'
  'struct tracepoint __tracepoint_android_vh_sched_show_task'
  'struct tracepoint __tracepoint_android_vh_try_to_freeze_todo'
  'struct tracepoint __tracepoint_android_vh_try_to_freeze_todo_unfrozen'
  'struct tracepoint __tracepoint_android_vh_watchdog_timer_softlockup'
  'struct tracepoint __tracepoint_kfree_skb'
  'struct blkcg blkcg_root'
  'kimage_vaddr'

Bug: 263211890
Change-Id: If90d89ca7b94620c0dd3dbd43d50c07cab8070bb
Signed-off-by: Woogeun Lee <woogeun.lee@samsung.com>
2023-01-07 14:03:03 +00:00
Kalesh Singh
a19efee97a ANDROID: Re-enable fast mremap and fix UAF with SPF
SPF attempts page faults without taking the mmap lock, but takes the
PTL. If there is a concurrent fast mremap (at PMD/PUD level), this
can lead to a UAF as fast mremap will only take the PTL locks at the
PMD/PUD level. SPF cannot take the PTL locks at the larger subtree
granularity since this introduces much contention in the page fault
paths.

To address the race:
  1) Only try fast mremaps if there are no users of the VMA. Android
     is concerned with this optimization in the context of
     GC stop-the-world pause. So there are no other threads active
     and this should almost always succeed.
  2) Speculative faults detect ongoing fast mremaps and fallback
     to conventional fault handling (taking mmap read lock).

Bug: 263177905
Change-Id: I23917e493ddc8576de19883cac053dfde9982b7f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-01-07 01:21:30 +00:00
Kalesh Singh
f610378ca2 Revert "ANDROID: Make SPF aware of fast mremaps"
This reverts commit 206a66b5c4.

Reason for revert: vts_linux_kselftest_arm_64 timeout

Bug: 263479421
Bug: 263177905
Change-Id: I123c56741c982d1539ceebd8bfde2443871aa1de
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-01-07 01:21:30 +00:00
Bing-Jhong Billy Jheng
03c04a7cba UPSTREAM: io_uring: add missing item types for splice request
Splice is like read/write and should grab current->nsproxy, denoted by
IO_WQ_WORK_FILES as it refers to current->files as well

Change-Id: I94a99fdef5764e7eda5da778b5b52a150b9fe5eb
Signed-off-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 75454b4bbf)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-01-06 09:36:26 +00:00
Kyle Tso
8bd021e7f2 ANDROID: Update the ABI representation
1 function symbol(s) added
  'int extcon_set_property_sync(struct extcon_dev *, unsigned int, unsigned int, union extcon_property_value)'

Bug: 257490462
Change-Id: I616c041604a84ef869fa818f3a0244b80f281656
Signed-off-by: Kyle Tso <kyletso@google.com>
2023-01-05 21:38:59 +00:00
Bian Jin chen
fa957a5de4 ANDROID: GKI: Enable symbols for bcmdhd-pcie
1 function symbol(s) added
  'int netif_set_xps_queue(struct net_device *, const struct cpumask *, u16)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I7dea5ae556484e15394fe5ec5c3446b7692758eb
2022-12-28 11:42:23 +08:00