[PATCH v3 01/13] drm/msm: Docs and misc cleanup

2021-07-27 Thread Rob Clark
From: Rob Clark Fix a couple incorrect or misspelt comments, and add submitqueue doc comment. Signed-off-by: Rob Clark Acked-by: Christian König --- drivers/gpu/drm/msm/msm_gem.h | 3 +-- drivers/gpu/drm/msm/msm_gem_submit.c | 1 + drivers/gpu/drm/msm/msm_gpu.h | 15 +++

[PATCH v3 02/13] drm/msm: Small submitqueue creation cleanup

2021-07-27 Thread Rob Clark
From: Rob Clark If we don't have a gpu, there is no need to create a submitqueue, which lets us simplify the error handling and submitqueue creation. Signed-off-by: Rob Clark Acked-by: Christian König --- drivers/gpu/drm/msm/msm_submitqueue.c | 22 +++--- 1 file changed, 11 in

[PATCH v3 03/13] drm/msm: drop drm_gem_object_put_locked()

2021-07-27 Thread Rob Clark
From: Rob Clark No idea why we were still using this. It certainly hasn't been needed for some time. So drop the pointless twin codepaths. Signed-off-by: Rob Clark Acked-by: Christian König --- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c

[PATCH v3 05/13] drm/msm/submit: Simplify out-fence-fd handling

2021-07-27 Thread Rob Clark
From: Rob Clark No need for this to be split in two parts. Signed-off-by: Rob Clark Acked-by: Christian König --- drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm

[PATCH v3 04/13] drm: Drop drm_gem_object_put_locked()

2021-07-27 Thread Rob Clark
From: Rob Clark Now that no one is using it, remove it. Signed-off-by: Rob Clark Acked-by: Christian König Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_gem.c | 22 -- include/drm/drm_gem.h | 2 -- 2 files changed, 24 deletions(-) diff --git a/drivers/gpu/drm/d

[PATCH v3 06/13] drm/msm: Consolidate submit bo state

2021-07-27 Thread Rob Clark
From: Rob Clark Move all the locked/active/pinned state handling to msm_gem_submit.c. In particular, for drm/scheduler, we'll need to do all this before pushing the submit job to the scheduler. But while we're at it we can get rid of the dupicate pin and refcnt. Signed-off-by: Rob Clark Acked-

[PATCH v3 07/13] drm/msm: Track "seqno" fences by idr

2021-07-27 Thread Rob Clark
From: Rob Clark Previously the (non-fd) fence returned from submit ioctl was a raw seqno, which is scoped to the ring. But from UABI standpoint, the ioctls related to seqno fences all specify a submitqueue. We can take advantage of that to replace the seqno fences with a cyclic idr handle. Thi

[PATCH v3 08/13] drm/msm: Return ERR_PTR() from submit_create()

2021-07-27 Thread Rob Clark
From: Rob Clark In the next patch, we start having more than a single potential failure reason. Signed-off-by: Rob Clark Acked-by: Christian König --- drivers/gpu/drm/msm/msm_gem_submit.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/dr

[PATCH v3 10/13] drm/msm: Drop submit bo_list

2021-07-27 Thread Rob Clark
From: Rob Clark This was only used to detect userspace including the same bo multiple times in a submit. But ww_mutex can already tell us this. When we drop struct_mutex around the submit ioctl, we'd otherwise need to lock the bo before adding it to the bo_list. But since ww_mutex can already

[PATCH v3 11/13] drm/msm: Drop struct_mutex in submit path

2021-07-27 Thread Rob Clark
From: Rob Clark It is sufficient to serialize on the submit queue now. Signed-off-by: Rob Clark Acked-by: Christian König --- drivers/gpu/drm/msm/msm_gem_submit.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/g

[PATCH v3 09/13] drm/msm: Conversion to drm scheduler

2021-07-27 Thread Rob Clark
From: Rob Clark For existing adrenos, there is one or more ringbuffer, depending on whether preemption is supported. When preemption is supported, each ringbuffer has it's own priority. A submitqueue (which maps to a gl context or vk queue in userspace) is mapped to a specific ring- buffer at c

[PATCH v3 12/13] drm/msm: Utilize gpu scheduler priorities

2021-07-27 Thread Rob Clark
From: Rob Clark The drm/scheduler provides additional prioritization on top of that provided by however many number of ringbuffers (each with their own priority level) is supported on a given generation. Expose the additional levels of priority to userspace and map the userspace priority back to

[PATCH v3 13/13] drm/msm/gem: Mark active before pinning

2021-07-27 Thread Rob Clark
From: Rob Clark Mark all the bos in the submit as active, before pinning, to prevent evicting a buffer in the same submit to make room for a buffer earlier in the table. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem.c| 2 -- drivers/gpu/drm/msm/msm_gem_submit.c | 28 +++

[PATCH 1/1] drm/i915: dgfx cards need to wait on pcode's uncore init done

2021-07-27 Thread badal . nilawar
From: Badal Nilawar In discrete cards, the graphics driver shouldn't proceed with the probe or resume unless PCODE indicated everything is done, including memory training and gt bring up. For this reason, the driver probe and resume paths needs to be blocked until PCODE indicates it is done. Als

Re: [PATCH v3 1/3] drm/loongson: Add DRM Driver for Loongson 7A1000 bridge chip

2021-07-27 Thread Sam Ravnborg
Hi Chenyang, I browsed the code on lore and noticed a few things and thought it better to bring it to your attention now. The general structure of the drivers seems good and coding style is fine. The feedback is mostly stuff we have decided to do different over time, so likely because you based t

Re: [PATCH] drm/msm/dp: Initialize dp->aux->drm_dev before registration

2021-07-27 Thread Dmitry Baryshkov
On 14/07/2021 18:28, Sean Paul wrote: From: Sean Paul Avoids the following WARN: [3.009556] [ cut here ] [3.014306] WARNING: CPU: 7 PID: 109 at drivers/gpu/drm/drm_dp_helper.c:1796 drm_dp_aux_register+0xa4/0xac [3.024209] Modules linked in: [3.027351] CPU

Re: [PATCH v6] drm/msm/dp: add logs across DP driver for ease of debugging

2021-07-27 Thread Stephen Boyd
Quoting maitreye (2021-07-26 17:38:18) > From: Maitreyee Rao > > Add trace points across the MSM DP driver to help debug > interop issues. > > Changes in v2: > - Got rid of redundant log messages. > - Added %#x instead of 0x%x wherever required. > - Got rid of __func__ calls in debug messages.

Re: [PATCH 1/5] drm/msm/dp: Remove global g_dp_display variable

2021-07-27 Thread Dmitry Baryshkov
On 25/07/2021 07:24, Bjorn Andersson wrote: As the Qualcomm DisplayPort driver only supports a single instance of the driver the commonly used struct dp_display is kept in a global variable. As we introduce additional instances this obviously doesn't work. Replace this with a combination of exis

Re: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition

2021-07-27 Thread Felix Kuehling
Hi Huoqing, Your patch is technically correct. However, I don't think it fixes any actual bug, and it changes a code path that has no performance implications. Therefore I would just leave it as it is. Regards,   Felix Am 2021-07-20 um 2:34 a.m. schrieb Cai Huoqing: > no need to get error code

Re: [PATCH v2 11/11] drm/i915: Extract i915_module.c

2021-07-27 Thread Jason Ekstrand
On Tue, Jul 27, 2021 at 9:44 AM Tvrtko Ursulin wrote: > > > On 27/07/2021 13:10, Daniel Vetter wrote: > > The module init code is somewhat misplaced in i915_pci.c, since it > > needs to pull in init/exit functions from every part of the driver and > > pollutes the include list a lot. > > > > Extra

[PATCH 00/14] drm: Make DRM's IRQ helpers legacy

2021-07-27 Thread Thomas Zimmermann
DRM's IRQ helpers are only helpful for old, non-KMS drivers. Move the code behind CONFIG_DRM_LEGACY. Convert KMS drivers to Linux IRQ interfaces. DRM provides IRQ helpers for setting up, receiving and removing IRQ handlers. It's an abstraction over plain Linux functions. The code is mid-layerish w

[PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcd

[PATCH 04/14] drm/fsl-dcu: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_dr

[PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. The interrupt number returned by pci_msi_vector() is now stored in struct am

[PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/tidss/tidss_drv.c | 1

[PATCH 05/14] drm/gma500: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/gma500/power.c | 1

[PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/radeon/radeon_drv.c

[PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Calls to platform_get_irq() can fail with a negative errno code. Abort initi

[PATCH 08/14] drm/mxsfb: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Calls to platform_get_irq() can fail with a negative errno code. Abort initi

[PATCH 06/14] drm/kmb: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/kmb/kmb_drv.c | 26 ++

[PATCH 07/14] drm/msm: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/msm/msm_drv.c | 113 +

[PATCH 11/14] drm/tilcdc: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Calls to platform_get_irq() can fail with a negative errno code. Abort initi

[PATCH 12/14] drm/vc4: Convert to Linux IRQ interfaces

2021-07-27 Thread Thomas Zimmermann
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Calls to platform_get_irq() can fail with a negative errno code. Abort initi

[PATCH 13/14] drm: Remove unused devm_drm_irq_install()

2021-07-27 Thread Thomas Zimmermann
DRM IRQ helpers will become legacy. The function devm_drm_irq_install() is unused and won't be required later. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_irq.c | 32 include/drm/drm_irq.h | 1 - 2 files changed, 33 deletions(-) diff --git a/dr

[PATCH 14/14] drm: IRQ midlayer is now legacy

2021-07-27 Thread Thomas Zimmermann
Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use the prefix drm_legacy_, and move declarations to drm_legacy.h. In struct drm_device, move the fields irq and irq_enabled behind CONFIG_DRM_LEGACY. All callers have been updated. Signed-off-by: Thomas Zimmermann --- drivers/gpu/d

Re: [Intel-gfx] [PATCH 31/47] drm/i915/guc: Reset implementation for new GuC interface

2021-07-27 Thread Matthew Brost
On Tue, Jul 27, 2021 at 09:56:06AM +0100, Tvrtko Ursulin wrote: > > On 26/07/2021 23:48, Matthew Brost wrote: > > On Thu, Jul 15, 2021 at 10:36:51AM +0100, Tvrtko Ursulin wrote: > > > > > > On 24/06/2021 08:05, Matthew Brost wrote: > > > > Reset implementation for new GuC interface. This is the l

Re: [PATCH 2/5] drm/msm/dp: Modify prototype of encoder based API

2021-07-27 Thread Dmitry Baryshkov
On 25/07/2021 07:24, Bjorn Andersson wrote: Functions in the DisplayPort code that relates to individual instances (encoders) are passed both the struct msm_dp and the struct drm_encoder. But in a situation where multiple DP instances would exist this means that the caller need to resolve which s

Re: [PATCH 0/2] Add support for querying hw info that UMDs need

2021-07-27 Thread John Harrison
On 7/27/2021 02:49, Daniel Vetter wrote: On Mon, Jul 26, 2021 at 07:21:43PM -0700, john.c.harri...@intel.com wrote: From: John Harrison Various UMDs require hardware configuration information about the current platform. A bunch of static information is available in a fixed table that can be re

Re: [PATCH 02/15] drm/i915/guc/slpc: Initial definitions for SLPC

2021-07-27 Thread Belgaumkar, Vinay
On 7/27/2021 6:43 AM, Michal Wajdeczko wrote: On 26.07.2021 21:07, Vinay Belgaumkar wrote: Add macros to check for SLPC support. This feature is currently supported for Gen12+ and enabled whenever GuC submission is enabled/selected. Include templates for SLPC init/fini and enable. v2: Mov

Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy

2021-07-27 Thread Sam Ravnborg
Hi Thomas, On Tue, Jul 27, 2021 at 08:27:07PM +0200, Thomas Zimmermann wrote: > DRM's IRQ helpers are only helpful for old, non-KMS drivers. Move > the code behind CONFIG_DRM_LEGACY. Convert KMS drivers to Linux > IRQ interfaces. > > DRM provides IRQ helpers for setting up, receiving and removing

Re: [PATCH 04/15] drm/i915/guc/slpc: Adding SLPC communication interfaces

2021-07-27 Thread Belgaumkar, Vinay
On 7/27/2021 6:59 AM, Michal Wajdeczko wrote: On 26.07.2021 21:07, Vinay Belgaumkar wrote: Add constants and params that are needed to configure SLPC. v2: Add a new abi header for SLPC. Replace bitfields with genmasks. Address other comments from Michal W. v3: Add slpc H2G format in abi,

Re: [PATCH 25/33] drm/i915/guc: Support request cancellation

2021-07-27 Thread Daniele Ceraolo Spurio
On 7/26/2021 5:23 PM, Matthew Brost wrote: This adds GuC backend support for i915_request_cancel(), which in turn makes CONFIG_DRM_I915_REQUEST_TIMEOUT work. This implementation makes use of fence while there are likely simplier options. A fence was chosen because of another feature coming so

Re: [PATCH 14/15] drm/i915/guc/slpc: Add SLPC selftest

2021-07-27 Thread Matthew Brost
On Mon, Jul 26, 2021 at 12:07:59PM -0700, Vinay Belgaumkar wrote: > Tests that exercise the SLPC get/set frequency interfaces. > > Clamp_max will set max frequency to multiple levels and check > that SLPC requests frequency lower than or equal to it. > > Clamp_min will set min frequency to differ

Re: [PATCH v3] drm/dp_mst: Fix return code on sideband message failure

2021-07-27 Thread Lyude Paul
On Thu, 2021-07-22 at 15:28 -0700, khs...@codeaurora.org wrote: > > It looks like this patch is good to go (mainlined). > Anything needed from me to do? > Thanks, Do you have access for pushing this patch? If not let me know and I can go ahead and push it to drm-misc-next for you. -- Cheers, L

Re: [PATCH 29/33] drm/i915/selftest: Increase some timeouts in live_requests

2021-07-27 Thread John Harrison
On 7/26/2021 17:23, Matthew Brost wrote: Requests may take slightly longer with GuC submission, let's increase the timeouts in live_requests. Signed-off-by: Matthew Brost Was already reviewed in previous series. Repeating here for patchwork: Reviewed-by: John Harrison --- drivers/gpu/drm/

Re: [RESEND PATCH v6 11/14] drm/mst: Convert debug printers to debug category printers

2021-07-27 Thread Lyude Paul
Reviewed-by: Lyude Paul On Wed, 2021-07-21 at 13:55 -0400, Sean Paul wrote: > From: Sean Paul > > The printers in dp_mst are meant to be gated on DRM_UT_DP, so use the > debug category printer to avoid dumping mst transactions to the wrong > place. > > Signed-off-by: Sean Paul > Link: > https

Re: [PATCH V2] drm: mxsfb: Use bus_format from the nearest bridge if present

2021-07-27 Thread Sam Ravnborg
On Mon, Jul 26, 2021 at 09:44:57PM +0200, Marek Vasut wrote: > In case there is a bridge connected to the LCDIF, use bus_format > from the bridge, otherwise behave as before and use bus_format > from the connector. This way, even if there are multiple bridges > in the display pipeline, the LCDIF wi

Re: [PATCH 15/15] drm/i915/guc/rc: Setup and enable GUCRC feature

2021-07-27 Thread Matt Roper
On Tue, Jul 27, 2021 at 09:18:08AM -0700, Belgaumkar, Vinay wrote: > > > On 7/27/2021 8:37 AM, Matt Roper wrote: > > On Mon, Jul 26, 2021 at 12:08:00PM -0700, Vinay Belgaumkar wrote: > > > This feature hands over the control of HW RC6 to the GuC. > > > GuC decides when to put HW into RC6 based on

Re: [Intel-gfx] [PATCH 06/15] drm/i915/guc/slpc: Enable SLPC and add related H2G events

2021-07-27 Thread Belgaumkar, Vinay
On 7/27/2021 8:12 AM, Michal Wajdeczko wrote: On 26.07.2021 21:07, Vinay Belgaumkar wrote: Add methods for interacting with GuC for enabling SLPC. Enable SLPC after GuC submission has been established. GuC load will fail if SLPC cannot be successfully initialized. Add various helper methods

Re: [PATCH v2 1/3] drm/msm: Split out devfreq handling

2021-07-27 Thread Dmitry Baryshkov
On 26/07/2021 17:46, Rob Clark wrote: From: Rob Clark Before we start adding more cleverness, split it into it's own file. Signed-off-by: Rob Clark Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 +- drivers

Re: [PATCH v2 2/3] drm/msm: Split out get_freq() helper

2021-07-27 Thread Dmitry Baryshkov
On 26/07/2021 17:46, Rob Clark wrote: From: Rob Clark In the next patch, it grows a bit more, so lets not duplicate the logic in multiple places. Signed-off-by: Rob Clark Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 21 ++--- 1 file changed

Re: [Intel-gfx] [PATCH 06/15] drm/i915/guc/slpc: Enable SLPC and add related H2G events

2021-07-27 Thread Michal Wajdeczko
On 27.07.2021 22:00, Belgaumkar, Vinay wrote: > > > On 7/27/2021 8:12 AM, Michal Wajdeczko wrote: >> >> >> On 26.07.2021 21:07, Vinay Belgaumkar wrote: >>> Add methods for interacting with GuC for enabling SLPC. Enable >>> SLPC after GuC submission has been established. GuC load will >>> fail

Re: [Intel-gfx] [PATCH 06/15] drm/i915/guc/slpc: Enable SLPC and add related H2G events

2021-07-27 Thread Belgaumkar, Vinay
On 7/27/2021 1:19 PM, Michal Wajdeczko wrote: On 27.07.2021 22:00, Belgaumkar, Vinay wrote: On 7/27/2021 8:12 AM, Michal Wajdeczko wrote: On 26.07.2021 21:07, Vinay Belgaumkar wrote: Add methods for interacting with GuC for enabling SLPC. Enable SLPC after GuC submission has been esta

[PATCH 03/64] rpmsg: glink: Replace strncpy() with strscpy_pad()

2021-07-27 Thread Kees Cook
The use of strncpy() is considered deprecated for NUL-terminated strings[1]. Replace strncpy() with strscpy_pad() (as it seems this case expects the NUL padding to fill the allocation following the flexible array). This additionally silences a warning seen when building under -Warray-bounds: ./inc

[PATCH 00/64] Introduce strict memcpy() bounds checking

2021-07-27 Thread Kees Cook
Hi, This patch series (based on next-20210726) implements stricter (no struct member overflows) bounds checking for memcpy(), memmove(), and memset() under CONFIG_FORTIFY_SOURCE. To quote a later patch in the series: tl;dr: In order to eliminate a large class of common buffer overflow fla

[PATCH 01/64] media: omap3isp: Extract struct group for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Wrap the target region in a common named structure. This additionally fixes a theoretical misalignment of the c

[PATCH 02/64] mac80211: Use flex-array for radiotap header bitmap

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. The it_present member of struct ieee80211_radiotap_header is treated as a flexible array (multiple u32s can be

[PATCH 04/64] stddef: Introduce struct_group() helper macro

2021-07-27 Thread Kees Cook
Kernel code has a regular need to describe groups of members within a structure usually when they need to be copied or initialized separately from the rest of the surrounding structure. The generally accepted design pattern in C is to use a named sub-struct: struct foo { in

[PATCH 10/64] lib80211: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() around members addr1, addr2, and addr3 in struct ieee80211_hdr so they can be referenced tog

[PATCH 15/64] ipw2x00: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field array bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct libipw_qos_information_element around members qui, qui_type, qui_subtype, ve

[PATCH 14/64] libertas_tf: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field array bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct txpd around members tx_dest_addr_high and tx_dest_addr_low so they can be re

[PATCH 12/64] mwl8k: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct mwl8k_cmd_set_key around members key_material, tkip_tx_mic_key, and tkip_rx_mic_ke

[PATCH 11/64] net/mlx5e: Avoid field-overflowing memcpy()

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use flexible arrays instead of zero-element arrays (which look like they are always overflowing) and split the

[PATCH 08/64] staging: rtl8192u: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() around members addr1, addr2, and addr3 in struct rtl_80211_hdr_4addr, and members qui, qui_t

[PATCH 31/64] fortify: Explicitly disable Clang support

2021-07-27 Thread Kees Cook
Clang has never correctly compiled the FORTIFY_SOURCE defenses due to a couple bugs: Eliding inlines with matching __builtin_* names https://bugs.llvm.org/show_bug.cgi?id=50322 Incorrect __builtin_constant_p() of some globals https://bugs.llvm.org/show_bug.cgi?id=4

[PATCH 29/64] lib/string: Move helper functions out of string.c

2021-07-27 Thread Kees Cook
The core functions of string.c are those that may be implemented by per-architecture functions, or overloaded by FORTIFY_SOURCE. As a result, it needs to be built with __NO_FORTIFY. Without this, macros will collide with function declarations. This was accidentally working due to -ffreestanding (on

[PATCH 18/64] cxgb3: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct rss_hdr around members imm_data and intr_gen, so they can be referenced together.

[PATCH 30/64] fortify: Move remaining fortify helpers into fortify-string.h

2021-07-27 Thread Kees Cook
When commit a28a6e860c6c ("string.h: move fortified functions definitions in a dedicated header.") moved the fortify-specific code, some helpers were left behind. Moves the remaining fortify-specific helpers into fortify-string.h so they're together where they're used. This requires that any FORTIF

[PATCH 27/64] HID: cp2112: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct cp2112_string_report around members report, length, type, and string, so they can

[PATCH 28/64] compiler_types.h: Remove __compiletime_object_size()

2021-07-27 Thread Kees Cook
Since all compilers support __builtin_object_size(), and there is only one user of __compiletime_object_size, remove it to avoid the needless indirection. This lets Clang reason about check_copy_size() correctly. Link: https://github.com/ClangBuiltLinux/linux/issues/1179 Suggested-by: Nick Desauln

[PATCH 06/64] bnxt_en: Use struct_group_attr() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() around members queue_id, min_bw, max_bw, tsa, pri_lvl, and bw_weight so they can be referenc

[PATCH 09/64] staging: rtl8723bs: Avoid field-overflowing memcpy()

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Adjust memcpy() destination to be the named structure itself, rather than the first member, allowing memcpy() t

[PATCH 32/64] fortify: Add compile-time FORTIFY_SOURCE tests

2021-07-27 Thread Kees Cook
While the run-time testing of FORTIFY_SOURCE is already present in LKDTM, there is no testing of the expected compile-time detections. In preparation for correctly supporting FORTIFY_SOURCE under Clang, adding additional FORTIFY_SOURCE defenses, and making sure FORTIFY_SOURCE doesn't silently regre

[PATCH 07/64] staging: rtl8192e: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() around members addr1, addr2, and addr3 in struct rtllib_hdr_4addr, and members qui, qui_type

[PATCH 22/64] bnx2x: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct nig_stats around members egress_mac_pkt0_lo, egress_mac_pkt0_hi, egress_mac_pkt1_l

[PATCH 47/64] btrfs: Use memset_after() to clear end of struct

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 05/64] skbuff: Switch structure bounds to struct_group()

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Replace the existing empty member position markers "headers_start" and "headers_end" with a struct_group(). Thi

[PATCH 13/64] libertas: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct txpd around members tx_dest_addr_high and tx_dest_addr_low so they can be referenc

[PATCH 26/64] net/mlx5e: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct vlan_ethhdr around members h_dest and h_source, so they can be referenced together

[PATCH 64/64] fortify: Add run-time WARN for cross-field memcpy()

2021-07-27 Thread Kees Cook
This enables the run-time checking of dynamic memcpy() and memmove() lengths, issuing a WARN when a write would exceed the size of the target field. Signed-off-by: Kees Cook --- include/linux/fortify-string.h | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a

[PATCH 25/64] drm/mga/mga_ioc32: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct drm32_mga_init around members chipset, sgram, maccess, fb_cpp, front_offset, front

[PATCH 40/64] net: 802: Use memset_after() to clear struct fields

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 19/64] ip: Use struct_group() for memcpy() regions

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct flowi4, struct ipv4hdr, and struct ipv6hdr around members saddr and daddr, so they

[PATCH 17/64] iommu/amd: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct ivhd_entry around members ext and hidh, so they can be referenced together. This w

[PATCH 16/64] thermal: intel: int340x_thermal: Use struct_group() for memcpy() region

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), avoid intentionally writing across neighboring fields. Use struct_group() in struct art around members weight, and ac[0-9]_max, so they can be referenced together. This will allow memcpy() an

[PATCH 55/64] RDMA/mlx5: Use struct_group() to zero struct mlx5_ib_mr

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct mlx5_ib_mr that should be initialized to zero. Signed-off-by: Kees Cook --- drivers/infin

[PATCH 42/64] net: qede: Use memset_after() for counters

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 41/64] net: dccp: Use memset_after() for TP zeroing

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 44/64] iw_cxgb4: Use memset_after() for cpl_t5_pass_accept_rpl

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 38/64] xfrm: Use memset_after() to clear padding

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Clear trailing padding bytes using the new helper so that memset() doesn't get confused about writing "past the end" of the last struct

[PATCH 39/64] mac80211: Use memset_after() to clear tx status

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 43/64] ath11k: Use memset_after() for clearing queue descriptors

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Use memset_after() so memset() doesn't get confused about writing beyond the destination member that is intended to be the starting poin

[PATCH 63/64] iwlwifi: dbg_ini: Split memcpy() to avoid multi-field write

2021-07-27 Thread Kees Cook
To avoid a run-time false positive in the stricter FORTIFY_SOURCE memcpy() checks, split the memcpy() into the struct and the data. Additionally switch the data member to a flexible array to follow modern language conventions. Signed-off-by: Kees Cook --- drivers/net/wireless/intel/iwlwifi/fw/fi

[PATCH 54/64] ipv6: Use struct_group() to zero rt6_info

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct rt6_info that should be initialized to zero. Signed-off-by: Kees Cook --- include/net/ip6

[PATCH 53/64] HID: roccat: Use struct_group() to zero kone_mouse_event

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct kone_mouse_event that should be initialized to zero. Signed-off-by: Kees Cook --- drivers

[PATCH 61/64] Makefile: Enable -Warray-bounds

2021-07-27 Thread Kees Cook
With the recent fixes for flexible arrays and expanded FORTIFY_SOURCE coverage, it is now possible to enable -Warray-bounds. Since both GCC and Clang include -Warray-bounds in -Wall, we just need to stop disabling it. Co-developed-by: Gustavo A. R. Silva Signed-off-by: Gustavo A. R. Silva Signed

[PATCH 56/64] ethtool: stats: Use struct_group() to clear all stats at once

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct stats_reply_data that should be initialized, which can now be done in a single memset() call

[PATCH 50/64] KVM: x86: Use struct_group() to zero decode cache

2021-07-27 Thread Kees Cook
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memset(), avoid intentionally writing across neighboring fields. Add struct_group() to mark region of struct x86_emulate_ctxt that should be initialized to zero. Signed-off-by: Kees Cook --- arch/x8

[RFC 5/4] drm/msm: Add deadline based boost support

2021-07-27 Thread Rob Clark
From: Rob Clark Signed-off-by: Rob Clark --- This is a quick implementation of what I had in mind for driver side of deadline boost. For a couple games with bad gpu devfreq behavior this boosts "Render quality" from ~35% to ~95%. (The "Render quality" metric in chrome://arc-overview-tracing is

[PATCH 37/64] string.h: Introduce memset_after() for wiping trailing members/padding

2021-07-27 Thread Kees Cook
A common idiom in kernel code is to wipe the contents of a structure after a given member. This includes places where there is trailing struct padding. These open-coded cases are usually difficult to read and very sensitive to struct layout changes. Introduce a new helper, memset_after() that takes

<    1   2   3   4   >