5.18.3-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 253/879 drm: fix EDID struct for old ARM OABI format
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ]
When building the kernel for arm with the "-mabi=apcs-gnu" option, gcc will force alignment of all structures and unions to a word boundary (see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=XX" option if you're a gcc person), even when the members of said structures do not want or need said alignment.
This completely messes up the structure alignment of 'struct edid' on those targets, because even though all the embedded structures are marked with "__attribute__((packed))", the unions that contain them are not.
This was exposed by commit f1e4c916f97f ("drm/edid: add EDID block count and size helpers"), but the bug is pre-existing. That commit just made the structure layout problem cause a build failure due to the addition of the
BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);
sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data().
This legacy union alignment should probably not be used in the first place, but we can fix the layout by adding the packed attribute to the union entries even when each member is already packed and it shouldn't matter in a sane build environment.
You can see this issue with a trivial test program:
union {
struct {
char c[5];
};
struct {
char d;
unsigned e;
} __attribute__((packed));} a = { "1234" };
where building this with a normal "gcc -S" will result in the expected 5-byte size of said union:
.type a, @object .size a, 5
but with an ARM compiler and the old ABI:
arm-linux-gnu-gcc -mabi=apcs-gnu -mfloat-abi=soft -S t.c
you get
.type a, %object .size a, 8
instead, because even though each member of the union is packed, the union itself still gets aligned.
This was reported by Sudip for the spear3xx_defconfig target.
--- include/drm/drm_edid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/drm/drm_edid.h +3 -3
@@ -121,7 +121,7 @@ struct detailed_data_monitor_range {u8 supported_scalings;u8 preferred_refresh; } __attribute__((packed)) cvt; - } formula; + } __attribute__((packed)) formula; } __attribute__((packed));struct detailed_data_wpindex {
@@ -154,7 +154,7 @@ struct detailed_non_pixel {struct detailed_data_wpindex color;struct std_timing timings[6 ];struct cvt_timing cvt[4 ]; - } data; + } __attribute__((packed)) data; } __attribute__((packed));#define EDID_DETAIL_EST_TIMINGS 0xf7
@@ -172,7 +172,7 @@ struct detailed_timing {union {struct detailed_pixel_timing pixel_data;struct detailed_non_pixel other_data; - } data; + } __attribute__((packed)) data; } __attribute__((packed));#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 254/879 drm/bridge_connector: enable HPD by default if supported
In reply to Greg Kroah-HartmanFrom: Nikita Yushchenko <[email protected]>
[ Upstream commit 09077bc3116581f4d1cb961ec359ad56586e370b ]
Hotplug events reported by bridge drivers over drm_bridge_hpd_notify() get ignored unless somebody calls drm_bridge_hpd_enable(). When the connector for the bridge is bridge_connector, such a call is done from drm_bridge_connector_enable_hpd().
However drm_bridge_connector_enable_hpd() is never called on init paths, documentation suggests that it is intended for suspend/resume paths.
In result, once encoders are switched to bridge_connector, bridge-detected HPD stops working.
This patch adds a call to that API on init path.
This fixes HDMI HPD with rcar-du + adv7513 case when adv7513 reports HPD events via interrupts.
--- drivers/gpu/drm/drm_bridge_connector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_bridge_connector.c +3 -1
@@ -384,8 +384,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector_type, ddc);drm_connector_helper_add (connector, &drm_bridge_connector_helper_funcs); -if (bridge_connector->bridge_hpd) +if (bridge_connector->bridge_hpd) { connector->polled =DRM_CONNECTOR_POLL_HPD ; +drm_bridge_connector_enable_hpd (connector); + }else if (bridge_connector->bridge_detect) connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 255/879 drm/selftests: missing error code in igt_buddy_alloc_smoke()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 016d1ca3f6ad05676fd9e418715ddce1f4ab5a73 ]
Set the error code to -ENOMEM if drm_random_order() fails.
--- drivers/gpu/drm/selftests/test-drm_buddy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/selftests/test-drm_buddy.c +3 -1
@@ -488,8 +488,10 @@ static int igt_buddy_alloc_smoke(void *arg) } order =drm_random_order (mm.max_order +1 , &prng); -if (!order) +if (!order) { + err = -ENOMEM ; goto out_fini; + }for (i =0 ; i <= mm.max_order; ++i) {struct drm_buddy_block *block;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 256/879 drm/omap: fix NULL but dereferenced coccicheck error
In reply to Greg Kroah-HartmanFrom: Wan Jiabing <[email protected]>
[ Upstream commit 8f2a3970c969d0d8d7289a4c65edcedafc16fd92 ]
Fix the following coccicheck warning:
./drivers/gpu/drm/omapdrm/omap_overlay.c:89:22-25: ERROR: r_ovl is NULL but dereferenced.
Here should be ovl->idx rather than r_ovl->idx.
--- drivers/gpu/drm/omapdrm/omap_overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_overlay.c +1 -1
@@ -86,7 +86,7 @@ int omap_overlay_assign(struct drm_atomic_state *s, struct drm_plane *plane, r_ovl =omap_plane_find_free_overlay (s->dev, overlay_map, caps, fourcc);if (!r_ovl) { - overlay_map[r_ovl->idx] =NULL ; + overlay_map[ovl->idx] =NULL ; *overlay =NULL ;return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 257/879 dt-bindings: display: sitronix, st7735r: Fix backlight in example
In reply to Greg Kroah-HartmanFrom: Noralf Trønnes <[email protected]>
[ Upstream commit 471e201f543559e2cb19b182b680ebf04d80ee31 ]
The backlight property was lost during conversion to yaml in commit abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema"). Put it back.
--- Documentation/devicetree/bindings/display/sitronix,st7735r.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +1 -0
@@ -72,6 +72,7 @@ examples: dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>; reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>; rotation = <270>; + backlight = <&backlight>; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 258/879 drm/bridge: anx7625: check the return on anx7625_aux_trans
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit d583e752732421b26fef0d65020565f3bef12248 ]
Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is
a garbage value
if (!(bcap & 0xOA01)) {
~~~~ ^bcap is only set by a successful call toanx7625_aux_trans(). So check.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +4 -1
@@ -874,7 +874,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx) }/* Read downstream capability */ -anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); +if (ret <0 ) +return ret; +if (!(bcap &0x01 )) {pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 259/879 drm: ssd130x: Fix COM scan direction register mask
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit efb37e66b7572ce4696aa0ac21675e17d6b9a17d ]
The SSD130x's command to toggle COM scan direction uses bit 3 and only bit 3 to set the direction of the scanout. The driver has an incorrect GENMASK(3, 2), causing the setting to be set on bit 2, rendering it ineffective.
Fix the mask to only bit 3, so that the requested setting is applied correctly.
--- drivers/gpu/drm/solomon/ssd130x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/solomon/ssd130x.c +1 -1
@@ -61,7 +61,7 @@#define SSD130X_SET_COM_PINS_CONFIG 0xda#define SSD130X_SET_VCOMH 0xdb -#define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 2) +#define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 3)#define SSD130X_SET_COM_SCAN_DIR_SET (val) FIELD_PREP(SSD130X_SET_COM_SCAN_DIR_MASK, (val))#define SSD130X_SET_CLOCK_DIV_MASK GENMASK(3, 0)#define SSD130X_SET_CLOCK_DIV_SET (val) FIELD_PREP(SSD130X_SET_CLOCK_DIV_MASK, (val))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 260/879 drm: ssd130x: Always apply segment remap setting
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit a134109c301736ea2ac5054ba3c29c30c87f6ba7 ]
Currently the ssd130x driver only sets the segment remap setting when the device tree requests it; it however does not clear the setting if it is not requested. This leads to the setting incorrectly persisting if the hardware is always on and has no reset GPIO wired. This might happen when a developer is trying to find the correct settings for an unknown module, and cause the developer to get confused because the settings from the device tree are not consistently applied.
Make the driver apply the segment remap setting consistently, setting the value correctly based on the device tree setting. This also makes this setting's behavior consistent with the other settings, which are always applied.
--- drivers/gpu/drm/solomon/ssd130x.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +9 -7
@@ -48,7 +48,7 @@#define SSD130X_CONTRAST 0x81#define SSD130X_SET_LOOKUP_TABLE 0x91#define SSD130X_CHARGE_PUMP 0x8d -#define SSD130X_SEG_REMAP_ON 0xa1 +#define SSD130X_SET_SEG_REMAP 0xa0#define SSD130X_DISPLAY_OFF 0xae#define SSD130X_SET_MULTIPLEX_RATIO 0xa8#define SSD130X_DISPLAY_ON 0xaf
@@ -61,6 +61,8 @@#define SSD130X_SET_COM_PINS_CONFIG 0xda#define SSD130X_SET_VCOMH 0xdb +#define SSD130X_SET_SEG_REMAP_MASK GENMASK(0, 0) +#define SSD130X_SET_SEG_REMAP_SET (val) FIELD_PREP(SSD130X_SET_SEG_REMAP_MASK, (val))#define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 3)#define SSD130X_SET_COM_SCAN_DIR_SET (val) FIELD_PREP(SSD130X_SET_COM_SCAN_DIR_MASK, (val))#define SSD130X_SET_CLOCK_DIV_MASK GENMASK(3, 0)
@@ -235,7 +237,7 @@ static void ssd130x_power_off(struct ssd130x_device *ssd130x)static int ssd130x_init (struct ssd130x_device *ssd130x) { -u32 precharge, dclk, com_invdir, compins, chargepump; +u32 precharge, dclk, com_invdir, compins, chargepump, seg_remap;int ret;/* Set initial contrast */
@@ -244,11 +246,11 @@ static int ssd130x_init(struct ssd130x_device *ssd130x)return ret;/* Set segment re-map */ -if (ssd130x->seg_remap) { - ret =ssd130x_write_cmd (ssd130x,1 ,SSD130X_SEG_REMAP_ON ); -if (ret <0 ) -return ret; - } + seg_remap = (SSD130X_SET_SEG_REMAP | +SSD130X_SET_SEG_REMAP_SET (ssd130x->seg_remap)); + ret =ssd130x_write_cmd (ssd130x,1 , seg_remap); +if (ret <0 ) +return ret;/* Set COM direction */ com_invdir = (SSD130X_SET_COM_SCAN_DIR |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 261/879 drm/solomon: Make DRM_SSD130X depends on MMU
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 47042e0ddd218f100292cebc5208cb1eff7473b6 ]
WARNING: unmet direct dependencies detected for DRM_GEM_SHMEM_HELPER
Depends on [n]: HAS_IOMEM [=y] && DRM [=m] && MMU [=n] Selected by [m]:
- DRM_SSD130X [=m] && HAS_IOMEM [=y] && DRM [=m]
DRM_GEM_SHMEM_HELPER depends on MMU, DRM_SSD130X should also depends on MMU.
--- drivers/gpu/drm/solomon/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/solomon/Kconfig +1 -1
@@ -1,6 +1,6 @@ config DRM_SSD130X tristate "DRM support for Solomon SSD130x OLED displays" - depends on DRM + depends on DRM && MMU select BACKLIGHT_CLASS_DEVICE select DRM_GEM_SHMEM_HELPER select DRM_KMS_HELPER
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 262/879 drm/format-helper: Rename drm_fb_xrgb8888_to_mono_reversed()
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9b13a3fcd35fc24045d2fd0f0e13ddd8d7985b4b ]
There is no "reversed" handling in drm_fb_xrgb8888_to_mono_reversed():
the function just converts from color to grayscale, and reduces the number of grayscale levels from 256 to 2 (i.e. brightness 0-127 is mapped to 0, 128-255 to 1). All "reversed" handling is done in the repaper driver, where this function originated.
Hence make this clear by renaming drm_fb_xrgb8888_to_mono_reversed() to drm_fb_xrgb8888_to_mono(), and documenting the black/white pixel mapping.
--- drivers/gpu/drm/drm_format_helper.c | 31 ++++++++++++++--------------- drivers/gpu/drm/solomon/ssd130x.c | 2 +- drivers/gpu/drm/tiny/repaper.c | 2 +- include/drm/drm_format_helper.h | 5 ++--- 4 files changed, 19 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_format_helper.c +15 -16
@@ -594,8 +594,8 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_pitch, uint32_t dst_for }EXPORT_SYMBOL (drm_fb_blit_toio); -static void drm_fb_gray8_to_mono_reversed_line (u8 *dst,const u8 *src,unsigned int pixels, -unsigned int start_offset,unsigned int end_len) +static void drm_fb_gray8_to_mono_line (u8 *dst,const u8 *src,unsigned int pixels, +unsigned int start_offset,unsigned int end_len) {unsigned int xb, i;
@@ -621,8 +621,8 @@ static void drm_fb_gray8_to_mono_reversed_line(u8 *dst, const u8 *src, unsigned }/** -* drm_fb_xrgb8888_to_mono_reversed - Convert XRGB8888 to reversed monochrome -* @dst: reversed monochrome destination buffer +* drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome +* @dst: monochrome destination buffer (0=black, 1=white) * @dst_pitch: Number of bytes between two consecutive scanlines within dst * @src: XRGB8888 source buffer * @fb: DRM framebuffer
@@ -633,10 +633,10 @@ static void drm_fb_gray8_to_mono_reversed_line(u8 *dst, const u8 *src, unsigned* and use this function to convert to the native format. * * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale and -* then the result is converted from grayscale to reversed monohrome. +* then the result is converted from grayscale to monochrome. */ -void drm_fb_xrgb8888_to_mono_reversed (void *dst,unsigned int dst_pitch,const void *vaddr, -const struct drm_framebuffer *fb,const struct drm_rect *clip) +void drm_fb_xrgb8888_to_mono (void *dst,unsigned int dst_pitch,const void *vaddr, +const struct drm_framebuffer *fb,const struct drm_rect *clip) {unsigned int linepixels =drm_rect_width (clip);unsigned int lines = clip->y2 - clip->y1;
@@ -652,8 +652,8 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const vreturn ;/* -* The reversed mono destination buffer contains 1 bit per pixel -* and destination scanlines have to be in multiple of 8 pixels. +* The mono destination buffer contains 1 bit per pixel and +* destination scanlines have to be in multiple of 8 pixels. */ if (!dst_pitch) dst_pitch =DIV_ROUND_UP (linepixels,8 );
@@ -664,9 +664,9 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const v* The cma memory is write-combined so reads are uncached. * Speed up by fetching one line at a time. * -* Also, format conversion from XR24 to reversed monochrome -* are done line-by-line but are converted to 8-bit grayscale -* as an intermediate step. +* Also, format conversion from XR24 to monochrome are done +* line-by-line but are converted to 8-bit grayscale as an +* intermediate step. * * Allocate a buffer to be used for both copying from the cma * memory and to store the intermediate grayscale line pixels.
@@ -683,7 +683,7 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const v* are not aligned to multiple of 8. * * Calculate if the start and end pixels are not aligned and set the -* offsets for the reversed mono line conversion function to adjust. +* offsets for the mono line conversion function to adjust. */ start_offset = clip->x1 %8 ; end_len = clip->x2 %8 ;
@@ -692,12 +692,11 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const vfor (y =0 ; y < lines; y++) { src32 =memcpy (src32, vaddr, len_src32);drm_fb_xrgb8888_to_gray8_line (gray8, src32, linepixels); -drm_fb_gray8_to_mono_reversed_line (mono, gray8, dst_pitch, - start_offset, end_len); +drm_fb_gray8_to_mono_line (mono, gray8, dst_pitch, start_offset, end_len); vaddr += fb->pitches[0 ]; mono += dst_pitch; }kfree (src32); } -EXPORT_SYMBOL (drm_fb_xrgb8888_to_mono_reversed); +EXPORT_SYMBOL (drm_fb_xrgb8888_to_mono);
drivers/gpu/drm/solomon/ssd130x.c +1 -1
@@ -458,7 +458,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_mif (!buf)return -ENOMEM ; -drm_fb_xrgb8888_to_mono_reversed (buf,0 , vmap, fb, rect); +drm_fb_xrgb8888_to_mono (buf,0 , vmap, fb, rect);ssd130x_update_rect (ssd130x, buf, rect);
drivers/gpu/drm/tiny/repaper.c +1 -1
@@ -540,7 +540,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb)if (ret) goto out_free; -drm_fb_xrgb8888_to_mono_reversed (buf,0 , cma_obj->vaddr, fb, &clip); +drm_fb_xrgb8888_to_mono (buf,0 , cma_obj->vaddr, fb, &clip);drm_gem_fb_end_cpu_access (fb,DMA_FROM_DEVICE );
include/drm/drm_format_helper.h +2 -3
@@ -43,8 +43,7 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_pitch, uint32_t dst_for const void *vmap, const struct drm_framebuffer *fb, const struct drm_rect *rect); -void drm_fb_xrgb8888_to_mono_reversed (void *dst,unsigned int dst_pitch,const void *src, -const struct drm_framebuffer *fb, -const struct drm_rect *clip); +void drm_fb_xrgb8888_to_mono (void *dst,unsigned int dst_pitch,const void *src, +const struct drm_framebuffer *fb,const struct drm_rect *clip);#endif /* __LINUX_DRM_FORMAT_HELPER_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 263/879 drm/format-helper: Fix XRGB888 to monochrome conversion
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 7392f2459eefcdab1d998af002d2b8b16fe4a2fd ]
The conversion functions drm_fb_xrgb8888_to_mono() and drm_fb_gray8_to_mono_line() do not behave correctly when the horizontal boundaries of the clip rectangle are not multiples of 8:
a. When x1 % 8 != 0, the calculated pitch is not correct, b. When x2 % 8 != 0, the pixel data for the last byte is wrong.
Simplify the code and fix (a) by:
1. Removing start_offset, and always storing the first pixel in the first bit of the monochrome destination buffer.
Drivers that require the first pixel in a byte to be located at an x-coordinate that is a multiple of 8 can always align the clip rectangle before calling drm_fb_xrgb8888_to_mono(). Note that:
- The ssd130x driver does not need the alignment, as the monochrome buffer is a temporary format,
- The repaper driver always updates the full screen, so the clip rectangle is always aligned.
2. Passing the number of pixels to drm_fb_gray8_to_mono_line(), instead of the number of bytes, and the number of pixels in the last byte.
Fix (b) by explicitly setting the target bit, instead of always setting bit 7 and shifting the value in each loop iteration.
Remove the bogus pitch check, which operates on bytes instead of pixels, and triggers when e.g. flashing the cursor on a text console with a font that is 8 pixels wide.
Drop the confusing comment about scanlines, as a pitch in bytes always contains a multiple of 8 pixels.
While at it, use the drm_rect_height() helper instead of open-coding the same operation.
Update the comments accordingly.
--- drivers/gpu/drm/drm_format_helper.c | 55 ++++++++++------------------- 1 file changed, 18 insertions(+), 37 deletions(-)
drivers/gpu/drm/drm_format_helper.c +18 -37
@@ -594,27 +594,16 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_pitch, uint32_t dst_for }EXPORT_SYMBOL (drm_fb_blit_toio); -static void drm_fb_gray8_to_mono_line (u8 *dst,const u8 *src,unsigned int pixels, -unsigned int start_offset,unsigned int end_len) -{ -unsigned int xb, i; - -for (xb =0 ; xb < pixels; xb++) { -unsigned int start =0 , end =8 ; -u8 byte =0x00 ; - -if (xb ==0 && start_offset) - start = start_offset; -if (xb == pixels -1 && end_len) - end = end_len; - -for (i = start; i < end; i++) { -unsigned int x = xb *8 + i; +static void drm_fb_gray8_to_mono_line (u8 *dst,const u8 *src,unsigned int pixels) +{ +while (pixels) { +unsigned int i, bits =min (pixels,8U ); +u8 byte =0 ; - byte >>=1 ; -if (src[x] >>7 ) - byte |=BIT (7 ); +for (i =0 ; i < bits; i++, pixels--) { +if (*src++ >=128 ) + byte |=BIT (i); } *dst++ = byte; }
@@ -634,16 +623,22 @@ static void drm_fb_gray8_to_mono_line(u8 *dst, const u8 *src, unsigned int pixel* * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale and * then the result is converted from grayscale to monochrome. +* +* The first pixel (upper left corner of the clip rectangle) will be converted +* and copied to the first bit (LSB) in the first byte of the monochrome +* destination buffer. +* If the caller requires that the first pixel in a byte must be located at an +* x-coordinate that is a multiple of 8, then the caller must take care itself +* of supplying a suitable clip rectangle. */ void drm_fb_xrgb8888_to_mono (void *dst,unsigned int dst_pitch,const void *vaddr,const struct drm_framebuffer *fb,const struct drm_rect *clip) {unsigned int linepixels =drm_rect_width (clip); -unsigned int lines = clip->y2 - clip->y1; +unsigned int lines =drm_rect_height (clip);unsigned int cpp = fb->format->cpp[0 ];unsigned int len_src32 = linepixels * cpp;struct drm_device *dev = fb->dev; -unsigned int start_offset, end_len;unsigned int y;u8 *mono = dst, *gray8;u32 *src32;
@@ -652,14 +647,11 @@ void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *vaddreturn ;/* -* The mono destination buffer contains 1 bit per pixel and -* destination scanlines have to be in multiple of 8 pixels. +* The mono destination buffer contains 1 bit per pixel */ if (!dst_pitch) dst_pitch =DIV_ROUND_UP (linepixels,8 ); -drm_WARN_ONCE (dev, dst_pitch %8 !=0 ,"dst_pitch is not a multiple of 8\n" ); -/* * The cma memory is write-combined so reads are uncached. * Speed up by fetching one line at a time.
@@ -677,22 +669,11 @@ void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *vadd gray8 = (u8 *)src32 + len_src32; -/* -* For damage handling, it is possible that only parts of the source -* buffer is copied and this could lead to start and end pixels that -* are not aligned to multiple of 8. -* -* Calculate if the start and end pixels are not aligned and set the -* offsets for the mono line conversion function to adjust. -*/ - start_offset = clip->x1 %8 ; - end_len = clip->x2 %8 ; - vaddr +=clip_offset (clip, fb->pitches[0 ], cpp);for (y =0 ; y < lines; y++) { src32 =memcpy (src32, vaddr, len_src32);drm_fb_xrgb8888_to_gray8_line (gray8, src32, linepixels); -drm_fb_gray8_to_mono_line (mono, gray8, dst_pitch, start_offset, end_len); +drm_fb_gray8_to_mono_line (mono, gray8, linepixels); vaddr += fb->pitches[0 ]; mono += dst_pitch; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 264/879 drm/ssd130x: Fix rectangle updates
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit a97e753fd358e23155ae42c61292dfd57eb54c4a ]
The rectangle update functions ssd130x_fb_blit_rect() and ssd130x_update_rect() do not behave correctly when x1 != 0 or y1 != 0, or when y1 or y2 are not aligned to display page boundaries. E.g. when used as a text console, only the first line of text is shown on the display.
1. The buffer passed by ssd130x_fb_blit_rect() points to the first byte of monochrome bitmap data, and thus has its origin at (x1, y1), while ssd130x_update_rect() assumes it is at (0, 0). Fix ssd130x_update_rect() by changing the vertical and horizontal loop ranges, and adding the offsets only when needed.
2. In ssd130x_fb_blit_rect(), align y1 and y2 to the display page boundaries before doing the color conversion, so the full page is converted and updated.
Remove the correction for an unaligned y1 from ssd130x_update_rect(), and add a check to make sure y1 is aligned.
--- drivers/gpu/drm/solomon/ssd130x.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +11 -4
@@ -355,11 +355,14 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf,unsigned int width =drm_rect_width (rect);unsigned int height =drm_rect_height (rect);unsigned int line_length =DIV_ROUND_UP (width,8 ); -unsigned int pages =DIV_ROUND_UP (y %8 + height,8 ); +unsigned int pages =DIV_ROUND_UP (height,8 ); +struct drm_device *drm = &ssd130x->drm;u32 array_idx =0 ;int ret, i, j, k;u8 *data_array =NULL ; +drm_WARN_ONCE (drm, y %8 !=0 ,"y must be aligned to screen page\n" ); + data_array =kcalloc (width, pages,GFP_KERNEL );if (!data_array)return -ENOMEM ;
@@ -401,13 +404,13 @@ static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf,if (ret <0 ) goto out_free; -for (i = y /8 ; i < y /8 + pages; i++) { +for (i =0 ; i < pages; i++) {int m =8 ;/* Last page may be partial */ -if (8 * (i +1 ) > ssd130x->height) +if (8 * (y /8 + i +1 ) > ssd130x->height) m = ssd130x->height %8 ; -for (j = x; j < x + width; j++) { +for (j =0 ; j < width; j++) {u8 data =0 ;for (k =0 ; k < m; k++) {
@@ -454,6 +457,10 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_mint ret =0 ;u8 *buf =NULL ; +/* Align y to display page boundaries */ + rect->y1 =round_down (rect->y1,8 ); + rect->y2 = min_t(unsigned int, round_up(rect->y2, 8), ssd130x->height); + buf =kcalloc (fb->width, fb->height,GFP_KERNEL );if (!buf)return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 265/879 drm/ssd130x: Reduce temporary buffer sizes
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 4442ac1af10442d6e7e824fdc226f89ed94d5b53 ]
ssd130x_clear_screen() allocates a temporary buffer sized to hold one byte per pixel, while it only needs to hold one bit per pixel.
ssd130x_fb_blit_rect() allocates a temporary buffer sized to hold one byte per pixel for the whole frame buffer, while it only needs to hold one bit per pixel for the part that is to be updated.
Pass dst_pitch to drm_fb_xrgb8888_to_mono(), as we have already calculated it anyway.
--- drivers/gpu/drm/solomon/ssd130x.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +6 -3
@@ -440,7 +440,8 @@ static void ssd130x_clear_screen(struct ssd130x_device *ssd130x) .y2 = ssd130x->height, }; - buf =kcalloc (ssd130x->width, ssd130x->height,GFP_KERNEL ); + buf =kcalloc (DIV_ROUND_UP (ssd130x->width,8 ), ssd130x->height, +GFP_KERNEL );if (!buf)return ;
@@ -454,6 +455,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m {struct ssd130x_device *ssd130x =drm_to_ssd130x (fb->dev);void *vmap = map->vaddr;/* TODO: Use mapping abstraction properly */ +unsigned int dst_pitch;int ret =0 ;u8 *buf =NULL ;
@@ -461,11 +463,12 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m rect->y1 =round_down (rect->y1,8 ); rect->y2 = min_t(unsigned int, round_up(rect->y2, 8), ssd130x->height); - buf =kcalloc (fb->width, fb->height,GFP_KERNEL ); + dst_pitch =DIV_ROUND_UP (drm_rect_width (rect),8 ); + buf =kcalloc (dst_pitch,drm_rect_height (rect),GFP_KERNEL );if (!buf)return -ENOMEM ; -drm_fb_xrgb8888_to_mono (buf,0 , vmap, fb, rect); +drm_fb_xrgb8888_to_mono (buf, dst_pitch, vmap, fb, rect);ssd130x_update_rect (ssd130x, buf, rect);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 266/879 fbdev: defio: fix the pagelist corruption
In reply to Greg Kroah-HartmanFrom: Chuansheng Liu <[email protected]>
[ Upstream commit 856082f021a28221db2c32bd0531614a8382be67 ]
Easily hit the below list corruption:
==list_add corruption. prev->next should be next (ffffffffc0ceb090), but was ffffec604507edc8. (prev=ffffec604507edc8).
WARNING: CPU: 65 PID: 3959 at lib/list_debug.c:26 __list_add_valid+0x53/0x80 CPU: 65 PID: 3959 Comm: fbdev Tainted: G U RIP: 0010:__list_add_valid+0x53/0x80 Call Trace: <TASK> fb_deferred_io_mkwrite+0xea/0x150 do_page_mkwrite+0x57/0xc0 do_wp_page+0x278/0x2f0 __handle_mm_fault+0xdc2/0x1590 handle_mm_fault+0xdd/0x2c0 do_user_addr_fault+0x1d3/0x650 exc_page_fault+0x77/0x180 ? asm_exc_page_fault+0x8/0x30 asm_exc_page_fault+0x1e/0x30 RIP: 0033:0x7fd98fc8fad1
==
Figure out the race happens when one process is adding &page->lru into the pagelist tail in fb_deferred_io_mkwrite(), another process is re-initializing the same &page->lru in fb_deferred_io_fault(), which is not protected by the lock.
This fix is to init all the page lists one time during initialization, it not only fixes the list corruption, but also avoids INIT_LIST_HEAD() redundantly.
V2: change "int i" to "unsigned int i" (Geert Uytterhoeven)
--- drivers/video/fbdev/core/fb_defio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/fb_defio.c +8 -1
@@ -59,7 +59,6 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)printk (KERN_ERR "no mapping available\n" );BUG_ON (!page->mapping); -INIT_LIST_HEAD (&page->lru); page->index = vmf->pgoff; vmf->page = page;
@@ -213,6 +212,8 @@ static void fb_deferred_io_work(struct work_struct *work)void fb_deferred_io_init (struct fb_info *info) {struct fb_deferred_io *fbdefio = info->fbdefio; +struct page *page; +unsigned int i;BUG_ON (!fbdefio);mutex_init (&fbdefio->lock);
@@ -220,6 +221,12 @@ void fb_deferred_io_init(struct fb_info *info)INIT_LIST_HEAD (&fbdefio->pagelist);if (fbdefio->delay ==0 )/* set a default of 1 s */ fbdefio->delay =HZ ; + +/* initialize all the page lists one time */ +for (i =0 ; i < info->fix.smem_len; i +=PAGE_SIZE ) { + page =fb_deferred_io_page (info, i); +INIT_LIST_HEAD (&page->lru); + } }EXPORT_SYMBOL_GPL (fb_deferred_io_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 267/879 drm/vmwgfx: Fix an invalid read
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
[ Upstream commit 10a26e0d5fc3574f63ce8a6cf28381b126317f40 ]
vmw_move assumed that buffers to be moved would always be vmw_buffer_object's but after introduction of new placement for mob pages that's no longer the case.
The resulting invalid read didn't have any practical consequences because the memory isn't used unless the object actually is a vmw_buffer_object.
Fix it by moving the cast to the spot where the results are used.
--- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +6 -8
@@ -859,22 +859,21 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo,struct ttm_device *bdev = bo->bdev;struct vmw_private *dev_priv; - dev_priv = container_of(bdev, struct vmw_private, bdev);mutex_lock (&dev_priv->binding_mutex); - dx_query_mob = container_of(bo, struct vmw_buffer_object, base); -if (!dx_query_mob || !dx_query_mob->dx_query_ctx) { -mutex_unlock (&dev_priv->binding_mutex); -return ; - } -/* If BO is being moved from MOB to system memory */ if (new_mem->mem_type ==TTM_PL_SYSTEM && old_mem->mem_type ==VMW_PL_MOB ) {struct vmw_fence_obj *fence; + dx_query_mob = container_of(bo, struct vmw_buffer_object, base); +if (!dx_query_mob || !dx_query_mob->dx_query_ctx) { +mutex_unlock (&dev_priv->binding_mutex); +return ; + } + (void )vmw_query_readback_all (dx_query_mob);mutex_unlock (&dev_priv->binding_mutex);
@@ -888,7 +887,6 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo, (void )ttm_bo_wait (bo, false, false); }else mutex_unlock (&dev_priv->binding_mutex); - }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 268/879 ath11k: acquire ab->base_lock in unassign when finding the peer by addr
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 2db80f93869d491be57cbc2b36f30d0d3a0e5bde ]
ath11k_peer_find_by_addr states via lockdep that ab->base_lock must be held when calling that function in order to protect the list. All callers except ath11k_mac_op_unassign_vif_chanctx have that lock acquired when calling ath11k_peer_find_by_addr. That lock is also not transitively held by a path towards ath11k_mac_op_unassign_vif_chanctx. The solution is to acquire the lock when calling ath11k_peer_find_by_addr inside ath11k_mac_op_unassign_vif_chanctx.
I am currently working on a static analyser to detect missing locks and this was a reported case. I manually verified the report by looking at the code, but I do not have real hardware so this is compile tested only.
--- drivers/net/wireless/ath/ath11k/mac.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +8 -3
@@ -7114,6 +7114,7 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,struct ath11k *ar = hw->priv;struct ath11k_base *ab = ar->ab;struct ath11k_vif *arvif = (void *)vif->drv_priv; +struct ath11k_peer *peer;int ret;mutex_lock (&ar->conf_mutex);
@@ -7125,9 +7126,13 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,WARN_ON (!arvif->is_started);if (ab->hw_params.vdev_start_delay && - arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR && -ath11k_peer_find_by_addr (ab, ar->mac_addr)) -ath11k_peer_delete (ar, arvif->vdev_id, ar->mac_addr); + arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR ) { +spin_lock_bh (&ab->base_lock); + peer =ath11k_peer_find_by_addr (ab, ar->mac_addr); +spin_unlock_bh (&ab->base_lock); +if (peer) +ath11k_peer_delete (ar, arvif->vdev_id, ar->mac_addr); + }if (arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR ) { ret =ath11k_mac_monitor_stop (ar);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 269/879 drm: bridge: it66121: Fix the register page length
In reply to Greg Kroah-HartmanFrom: Nicolas Belin <[email protected]>
[ Upstream commit 003a1bd6a2a55c16cb2451153533dbedb12bebec ]
Set the register page length or window length to 0x100 according to the documentation.
--- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it66121.c +1 -1
@@ -227,7 +227,7 @@ static const struct regmap_range_cfg it66121_regmap_banks[] = { .selector_mask = 0x1, .selector_shift = 0, .window_start = 0x00, - .window_len = 0x130, + .window_len = 0x100, }, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 270/879 drm/bridge: it6505: Fix build error
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 3dd4834a6efe4eb3c086526e1870bb768776d86a ]
If DRM_ITE_IT6505 is y but DRM_DP_HELPER is m, building failed:
drivers/gpu/drm/bridge/ite-it6505.o: In function `it6505_i2c_remove':
ite-it6505.c:(.text+0x35c): undefined reference to drm_dp_aux_unregister' drivers/gpu/drm/bridge/ite-it6505.o: In function it6505_dpcd_read':
ite-it6505.c:(.text+0x420): undefined reference to drm_dp_dpcd_read' drivers/gpu/drm/bridge/ite-it6505.o: In function it6505_get_dpcd':
ite-it6505.c:(.text+0x4a4): undefined reference to drm_dp_dpcd_read' drivers/gpu/drm/bridge/ite-it6505.o: In function it6505_dpcd_write':
ite-it6505.c:(.text+0x52c): undefined reference to `drm_dp_dpcd_write'
Select DRM_DP_HELPER for DRM_ITE_IT6505 to fix this.
--- drivers/gpu/drm/bridge/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/Kconfig +1 -0
@@ -77,6 +77,7 @@ config DRM_DISPLAY_CONNECTOR config DRM_ITE_IT6505 tristate "ITE IT6505 DisplayPort bridge" depends on OF + select DRM_DP_HELPER select DRM_KMS_HELPER select DRM_DP_HELPER select EXTCON
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 271/879 ath9k: fix ar9003_get_eepmisc
In reply to Greg Kroah-HartmanFrom: Wenli Looi <[email protected]>
[ Upstream commit 9aaff3864b603408c02c629957ae8d8ff5d5a4f2 ]
The current implementation is reading the wrong eeprom type.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
@@ -5615,7 +5615,7 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,static u8 ar9003_get_eepmisc (struct ath_hw *ah) { -return ah->eeprom.map4k.baseEepHeader.eepMisc; +return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc; }const struct eeprom_ops eep_ar9300_ops = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 272/879 drm/edid: fix invalid EDID extension block filtering
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 3aefc722ff52076407203b6af9713de567993adf ]
The invalid EDID block filtering uses the number of valid EDID extensions instead of all EDID extensions for looping the extensions in the copy. This is fine, by coincidence, if all the invalid blocks are at the end of the EDID. However, it's completely broken if there are invalid extensions in the middle; the invalid blocks are included and valid blocks are excluded.
Fix it by modifying the base block after, not before, the copy.
--- drivers/gpu/drm/drm_edid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -3
@@ -2031,9 +2031,6 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,connector_bad_edid (connector, edid, edid[0x7e ] +1 ); - edid[EDID_LENGTH -1 ] += edid[0x7e ] - valid_extensions; - edid[0x7e ] = valid_extensions; - new =kmalloc_array (valid_extensions +1 ,EDID_LENGTH ,GFP_KERNEL );if (!new)
@@ -2050,6 +2047,9 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, base +=EDID_LENGTH ; } + new[EDID_LENGTH -1 ] += new[0x7e ] - valid_extensions; + new[0x7e ] = valid_extensions; +kfree (edid); edid = new; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 273/879 drm/bridge: anx7625: add missing destroy_workqueue() in anx7625_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 6f5efd118efafa22139e8670a4e4b506ba757dfd ]
Add the missing destroy_workqueue() before return from anx7625_i2c_probe() in the error handling case.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
@@ -2657,7 +2657,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,if (ret) {if (ret != -EPROBE_DEFER )DRM_DEV_ERROR (dev,"fail to parse DT : %d\n" , ret); -return ret; + goto free_wq; }if (anx7625_register_i2c_dummy_clients (platform, client) !=0 ) {
@@ -2672,7 +2672,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,pm_suspend_ignore_children (dev, true); ret =devm_add_action_or_reset (dev, anx7625_runtime_disable, dev);if (ret) -return ret; + goto free_wq;if (!platform->pdata.low_power_mode) {anx7625_disable_pd_protocol (platform);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 274/879 drm/bridge: adv7511: clean up CEC adapter when probe fails
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit 7ed2b0dabf7a22874cb30f8878df239ef638eb53 ]
When the probe routine fails we also need to clean up the CEC adapter registered in adv7511_cec_init().
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -0
@@ -1313,6 +1313,7 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)adv7511_audio_exit (adv7511);drm_bridge_remove (&adv7511->bridge); err_unregister_cec: +cec_unregister_adapter (adv7511->cec_adap);i2c_unregister_device (adv7511->i2c_cec);clk_disable_unprepare (adv7511->cec_clk); err_i2c_unregister_packet:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 275/879 drm: bridge: icn6211: Fix register layout
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 2dcec57b3734029cc1adc5cb872f61e21609eed4 ]
The chip register layout has nothing to do with MIPI DCS, the registers incorrectly marked as MIPI DCS in the driver are regular chip registers often with completely different function.
Fill in the actual register names and bits from [1] and [2] and add the entire register layout, since the documentation for this chip is hard to come by.
[1] https://github.com/rockchip-linux/kernel/blob/develop-4.19/drivers/gpu/drm/bridge/icn6211.c
[2] https://github.com/tdjastrzebski/ICN6211-Configurator
--- drivers/gpu/drm/bridge/chipone-icn6211.c | 134 ++++++++++++++++++++--- 1 file changed, 117 insertions(+), 17 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +117 -17
@@ -15,8 +15,19 @@#include <linux/of_device.h> #include <linux/regulator/consumer.h> -#include <video/mipi_display.h> - +#define VENDOR_ID 0x00 +#define DEVICE_ID_H 0x01 +#define DEVICE_ID_L 0x02 +#define VERSION_ID 0x03 +#define FIRMWARE_VERSION 0x08 +#define CONFIG_FINISH 0x09 +#define PD_CTRL (n) (0x0a + ((n) & 0x3))/* 0..3 */ +#define RST_CTRL (n) (0x0e + ((n) & 0x1))/* 0..1 */ +#define SYS_CTRL (n) (0x10 + ((n) & 0x7))/* 0..4 */ +#define RGB_DRV (n) (0x18 + ((n) & 0x3))/* 0..3 */ +#define RGB_DLY (n) (0x1c + ((n) & 0x1))/* 0..1 */ +#define RGB_TEST_CTRL 0x1e +#define ATE_PLL_EN 0x1f#define HACTIVE_LI 0x20#define VACTIVE_LI 0x21#define VACTIVE_HACTIVE_HI 0x22
@@ -27,6 +38,95 @@#define VFP 0x27#define VSYNC 0x28#define VBP 0x29 +#define BIST_POL 0x2a +#define BIST_POL_BIST_MODE (n) (((n) & 0xf) << 4) +#define BIST_POL_BIST_GEN BIT(3) +#define BIST_POL_HSYNC_POL BIT(2) +#define BIST_POL_VSYNC_POL BIT(1) +#define BIST_POL_DE_POL BIT(0) +#define BIST_RED 0x2b +#define BIST_GREEN 0x2c +#define BIST_BLUE 0x2d +#define BIST_CHESS_X 0x2e +#define BIST_CHESS_Y 0x2f +#define BIST_CHESS_XY_H 0x30 +#define BIST_FRAME_TIME_L 0x31 +#define BIST_FRAME_TIME_H 0x32 +#define FIFO_MAX_ADDR_LOW 0x33 +#define SYNC_EVENT_DLY 0x34 +#define HSW_MIN 0x35 +#define HFP_MIN 0x36 +#define LOGIC_RST_NUM 0x37 +#define OSC_CTRL (n) (0x48 + ((n) & 0x7))/* 0..5 */ +#define BG_CTRL 0x4e +#define LDO_PLL 0x4f +#define PLL_CTRL (n) (0x50 + ((n) & 0xf))/* 0..15 */ +#define PLL_CTRL_6_EXTERNAL 0x90 +#define PLL_CTRL_6_MIPI_CLK 0x92 +#define PLL_CTRL_6_INTERNAL 0x93 +#define PLL_REM (n) (0x60 + ((n) & 0x3))/* 0..2 */ +#define PLL_DIV (n) (0x63 + ((n) & 0x3))/* 0..2 */ +#define PLL_FRAC (n) (0x66 + ((n) & 0x3))/* 0..2 */ +#define PLL_INT (n) (0x69 + ((n) & 0x1))/* 0..1 */ +#define PLL_REF_DIV 0x6b +#define PLL_REF_DIV_P (n) ((n) & 0xf) +#define PLL_REF_DIV_Pe BIT(4) +#define PLL_REF_DIV_S (n) (((n) & 0x7) << 5) +#define PLL_SSC_P (n) (0x6c + ((n) & 0x3))/* 0..2 */ +#define PLL_SSC_STEP (n) (0x6f + ((n) & 0x3))/* 0..2 */ +#define PLL_SSC_OFFSET (n) (0x72 + ((n) & 0x3))/* 0..3 */ +#define GPIO_OEN 0x79 +#define MIPI_CFG_PW 0x7a +#define MIPI_CFG_PW_CONFIG_DSI 0xc1 +#define MIPI_CFG_PW_CONFIG_I2C 0x3e +#define GPIO_SEL (n) (0x7b + ((n) & 0x1))/* 0..1 */ +#define IRQ_SEL 0x7d +#define DBG_SEL 0x7e +#define DBG_SIGNAL 0x7f +#define MIPI_ERR_VECTOR_L 0x80 +#define MIPI_ERR_VECTOR_H 0x81 +#define MIPI_ERR_VECTOR_EN_L 0x82 +#define MIPI_ERR_VECTOR_EN_H 0x83 +#define MIPI_MAX_SIZE_L 0x84 +#define MIPI_MAX_SIZE_H 0x85 +#define DSI_CTRL 0x86 +#define DSI_CTRL_UNKNOWN 0x28 +#define DSI_CTRL_DSI_LANES (n) ((n) & 0x3) +#define MIPI_PN_SWAP 0x87 +#define MIPI_PN_SWAP_CLK BIT(4) +#define MIPI_PN_SWAP_D (n) BIT((n) & 0x3) +#define MIPI_SOT_SYNC_BIT_ (n) (0x88 + ((n) & 0x1))/* 0..1 */ +#define MIPI_ULPS_CTRL 0x8a +#define MIPI_CLK_CHK_VAR 0x8e +#define MIPI_CLK_CHK_INI 0x8f +#define MIPI_T_TERM_EN 0x90 +#define MIPI_T_HS_SETTLE 0x91 +#define MIPI_T_TA_SURE_PRE 0x92 +#define MIPI_T_LPX_SET 0x94 +#define MIPI_T_CLK_MISS 0x95 +#define MIPI_INIT_TIME_L 0x96 +#define MIPI_INIT_TIME_H 0x97 +#define MIPI_T_CLK_TERM_EN 0x99 +#define MIPI_T_CLK_SETTLE 0x9a +#define MIPI_TO_HS_RX_L 0x9e +#define MIPI_TO_HS_RX_H 0x9f +#define MIPI_PHY_ (n) (0xa0 + ((n) & 0x7))/* 0..5 */ +#define MIPI_PD_RX 0xb0 +#define MIPI_PD_TERM 0xb1 +#define MIPI_PD_HSRX 0xb2 +#define MIPI_PD_LPTX 0xb3 +#define MIPI_PD_LPRX 0xb4 +#define MIPI_PD_CK_LANE 0xb5 +#define MIPI_FORCE_0 0xb6 +#define MIPI_RST_CTRL 0xb7 +#define MIPI_RST_NUM 0xb8 +#define MIPI_DBG_SET_ (n) (0xc0 + ((n) & 0xf))/* 0..9 */ +#define MIPI_DBG_SEL 0xe0 +#define MIPI_DBG_DATA 0xe1 +#define MIPI_ATE_TEST_SEL 0xe2 +#define MIPI_ATE_STATUS_ (n) (0xe3 + ((n) & 0x1))/* 0..1 */ +#define MIPI_ATE_STATUS_1 0xe4 +#define ICN6211_MAX_REGISTER MIPI_ATE_STATUS(1)struct chipone {struct device *dev;
@@ -64,13 +164,13 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,struct chipone *icn =bridge_to_chipone (bridge);struct drm_display_mode *mode = &icn->mode; -ICN6211_DSI (icn,0x7a ,0xc1 ); +ICN6211_DSI (icn,MIPI_CFG_PW ,MIPI_CFG_PW_CONFIG_DSI );ICN6211_DSI (icn,HACTIVE_LI , mode->hdisplay &0xff );ICN6211_DSI (icn,VACTIVE_LI , mode->vdisplay &0xff ); -/** +/* * lsb nibble: 2nd nibble of hdisplay * msb nibble: 2nd nibble of vdisplay */
@@ -93,21 +193,21 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,ICN6211_DSI (icn,VBP , mode->vtotal - mode->vsync_end);/* dsi specific sequence */ -ICN6211_DSI (icn,MIPI_DCS_SET_TEAR_OFF ,0x80 ); -ICN6211_DSI (icn,MIPI_DCS_SET_ADDRESS_MODE ,0x28 ); -ICN6211_DSI (icn,0xb5 ,0xa0 ); -ICN6211_DSI (icn,0x5c ,0xff ); -ICN6211_DSI (icn,MIPI_DCS_SET_COLUMN_ADDRESS ,0x01 ); -ICN6211_DSI (icn,MIPI_DCS_GET_POWER_SAVE ,0x92 ); -ICN6211_DSI (icn,0x6b ,0x71 ); -ICN6211_DSI (icn,0x69 ,0x2b ); -ICN6211_DSI (icn,MIPI_DCS_ENTER_SLEEP_MODE ,0x40 ); -ICN6211_DSI (icn,MIPI_DCS_EXIT_SLEEP_MODE ,0x98 ); +ICN6211_DSI (icn,SYNC_EVENT_DLY ,0x80 ); +ICN6211_DSI (icn,HFP_MIN ,0x28 ); +ICN6211_DSI (icn,MIPI_PD_CK_LANE ,0xa0 ); +ICN6211_DSI (icn,PLL_CTRL (12 ),0xff ); +ICN6211_DSI (icn,BIST_POL ,BIST_POL_DE_POL ); +ICN6211_DSI (icn,PLL_CTRL (6 ),PLL_CTRL_6_MIPI_CLK ); +ICN6211_DSI (icn,PLL_REF_DIV ,0x71 ); +ICN6211_DSI (icn,PLL_INT (0 ),0x2b ); +ICN6211_DSI (icn,SYS_CTRL (0 ),0x40 ); +ICN6211_DSI (icn,SYS_CTRL (1 ),0x98 );/* icn6211 specific sequence */ -ICN6211_DSI (icn,0xb6 ,0x20 ); -ICN6211_DSI (icn,0x51 ,0x20 ); -ICN6211_DSI (icn,0x09 ,0x10 ); +ICN6211_DSI (icn,MIPI_FORCE_0 ,0x20 ); +ICN6211_DSI (icn,PLL_CTRL (1 ),0x20 ); +ICN6211_DSI (icn,CONFIG_FINISH ,0x10 );usleep_range (10000 ,11000 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 276/879 drm: bridge: icn6211: Fix HFP_HSW_HBP_HI and HFP_MIN handling
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit c0ff7a649d62105a9308cc3ac36e52a4669d9cb4 ]
The HFP_HSW_HBP_HI register must be programmed with 2 LSbits of each Horizontal Front Porch/Sync/Back Porch. Currently the driver programs this register to 0, which breaks displays with either value above 255.
The HFP_MIN register must be set to the same value as HFP_LI, otherwise there is visible image distortion, usually in the form of missing lines at the bottom of the panel.
Fix this by correctly programming the HFP_HSW_HBP_HI and HFP_MIN registers.
--- drivers/gpu/drm/bridge/chipone-icn6211.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +16 -7
@@ -35,6 +35,9 @@#define HSYNC_LI 0x24#define HBP_LI 0x25#define HFP_HSW_HBP_HI 0x26 +#define HFP_HSW_HBP_HI_HFP (n) (((n) & 0x300) >> 4) +#define HFP_HSW_HBP_HI_HS (n) (((n) & 0x300) >> 6) +#define HFP_HSW_HBP_HI_HBP (n) (((n) & 0x300) >> 8)#define VFP 0x27#define VSYNC 0x28#define VBP 0x29
@@ -163,6 +166,7 @@ static void chipone_atomic_enable(struct drm_bridge *bridge, {struct chipone *icn =bridge_to_chipone (bridge);struct drm_display_mode *mode = &icn->mode; +u16 hfp, hbp, hsync;ICN6211_DSI (icn,MIPI_CFG_PW ,MIPI_CFG_PW_CONFIG_DSI );
@@ -178,13 +182,18 @@ static void chipone_atomic_enable(struct drm_bridge *bridge, ((mode->hdisplay >>8 ) &0xf ) | (((mode->vdisplay >> 8) & 0xf) << 4)); -ICN6211_DSI (icn,HFP_LI , mode->hsync_start - mode->hdisplay); + hfp = mode->hsync_start - mode->hdisplay; + hsync = mode->hsync_end - mode->hsync_start; + hbp = mode->htotal - mode->hsync_end; -ICN6211_DSI (icn,HSYNC_LI , mode->hsync_end - mode->hsync_start); - -ICN6211_DSI (icn,HBP_LI , mode->htotal - mode->hsync_end); - -ICN6211_DSI (icn,HFP_HSW_HBP_HI ,0x00 ); +ICN6211_DSI (icn,HFP_LI , hfp &0xff ); +ICN6211_DSI (icn,HSYNC_LI , hsync &0xff ); +ICN6211_DSI (icn,HBP_LI , hbp &0xff ); +/* Top two bits of Horizontal Front porch/Sync/Back porch */ +ICN6211_DSI (icn,HFP_HSW_HBP_HI , +HFP_HSW_HBP_HI_HFP (hfp) | +HFP_HSW_HBP_HI_HS (hsync) | +HFP_HSW_HBP_HI_HBP (hbp));ICN6211_DSI (icn,VFP , mode->vsync_start - mode->vdisplay);
@@ -194,7 +203,7 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,/* dsi specific sequence */ ICN6211_DSI (icn,SYNC_EVENT_DLY ,0x80 ); -ICN6211_DSI (icn,HFP_MIN ,0x28 ); +ICN6211_DSI (icn,HFP_MIN , hfp &0xff );ICN6211_DSI (icn,MIPI_PD_CK_LANE ,0xa0 );ICN6211_DSI (icn,PLL_CTRL (12 ),0xff );ICN6211_DSI (icn,BIST_POL ,BIST_POL_DE_POL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 277/879 mtd: spinand: gigadevice: fix Quad IO for GD5F1GQ5UExxG
In reply to Greg Kroah-HartmanFrom: Chuanhong Guo <[email protected]>
[ Upstream commit a4f9dd55c5e1bb951db6f1dee20e62e0103f3438 ]
Read From Cache Quad IO (EBH) uses 2 dummy bytes on this chip according to page 23 of the datasheet[0].
[0]: https://www.gigadevice.com/datasheet/gd5f1gq5xexxg/
--- drivers/mtd/nand/spi/gigadevice.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mtd/nand/spi/gigadevice.c +9 -1
@@ -39,6 +39,14 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f,SPINAND_PAGE_READ_FROM_CACHE_OP_3A (true,0 ,1 ,NULL ,0 ), SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0)); +static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +SPINAND_PAGE_READ_FROM_CACHE_X4_OP (0 ,1 ,NULL ,0 ), +SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP (0 ,1 ,NULL ,0 ), +SPINAND_PAGE_READ_FROM_CACHE_X2_OP (0 ,1 ,NULL ,0 ), +SPINAND_PAGE_READ_FROM_CACHE_OP (true,0 ,1 ,NULL ,0 ), + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); + static SPINAND_OP_VARIANTS(write_cache_variants, SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), SPINAND_PROG_LOAD(true, 0, NULL, 0));
@@ -339,7 +347,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {SPINAND_ID (SPINAND_READID_METHOD_OPCODE_DUMMY ,0x51 ),NAND_MEMORG (1 ,2048 ,128 ,64 ,1024 ,20 ,1 ,1 ,1 ),NAND_ECCREQ (4 ,512 ), -SPINAND_INFO_OP_VARIANTS (&read_cache_variants, +SPINAND_INFO_OP_VARIANTS (&read_cache_variants_1gq5, &write_cache_variants, &update_cache_variants), SPINAND_HAS_QE_BIT,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 278/879 spi: qcom-qspi: Add minItems to interconnect-names
In reply to Greg Kroah-HartmanFrom: Kuldeep Singh <[email protected]>
[ Upstream commit e23d86c49a9c78e8dbe3abff20b30812b26ab427 ]
Add minItems constraint to interconnect-names as well. The schema currently tries to match 2 names and fail for DTs with single entry.
With the change applied, below interconnect-names values are possible:
['qspi-config'], ['qspi-config', 'qspi-memory']
--- Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.yaml +1 -0
@@ -49,6 +49,7 @@ properties: maxItems: 2 interconnect-names: + minItems: 1 items: - const: qspi-config - const: qspi-memory
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 279/879 ASoC: codecs: Fix error handling in power domain init and exit handlers
In reply to Greg Kroah-HartmanFrom: Srinivasa Rao Mandadapu <[email protected]>
[ Upstream commit 1a8ee4cf84187bce17c76886eb6dd9389c3b99a8 ]
Update error handling in power domain init and exit handlers, as existing handling may cause issues in device remove function.
Use appropriate pm core api for power domain get and sync to avoid redundant code.
--- sound/soc/codecs/lpass-macro-common.c | 35 +++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-)
sound/soc/codecs/lpass-macro-common.c +19 -16
@@ -24,42 +24,45 @@ struct lpass_macro *lpass_macro_pds_init(struct device *dev)return ERR_PTR (-ENOMEM ); l_pds->macro_pd =dev_pm_domain_attach_by_name (dev,"macro" ); -if (IS_ERR_OR_NULL (l_pds->macro_pd)) -return NULL ; - - ret =pm_runtime_get_sync (l_pds->macro_pd); -if (ret <0 ) { -pm_runtime_put_noidle (l_pds->macro_pd); +if (IS_ERR_OR_NULL (l_pds->macro_pd)) { + ret =PTR_ERR (l_pds->macro_pd); goto macro_err; } + ret =pm_runtime_resume_and_get (l_pds->macro_pd); +if (ret <0 ) + goto macro_sync_err; + l_pds->dcodec_pd =dev_pm_domain_attach_by_name (dev,"dcodec" ); -if (IS_ERR_OR_NULL (l_pds->dcodec_pd)) +if (IS_ERR_OR_NULL (l_pds->dcodec_pd)) { + ret =PTR_ERR (l_pds->dcodec_pd); goto dcodec_err; + } - ret =pm_runtime_get_sync (l_pds->dcodec_pd); -if (ret <0 ) { -pm_runtime_put_noidle (l_pds->dcodec_pd); + ret =pm_runtime_resume_and_get (l_pds->dcodec_pd); +if (ret <0 ) goto dcodec_sync_err; - }return l_pds; dcodec_sync_err:dev_pm_domain_detach (l_pds->dcodec_pd, false); dcodec_err:pm_runtime_put (l_pds->macro_pd); -macro_err: +macro_sync_err:dev_pm_domain_detach (l_pds->macro_pd, false); +macro_err:return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (lpass_macro_pds_init);void lpass_macro_pds_exit (struct lpass_macro *pds) { -pm_runtime_put (pds->macro_pd); -dev_pm_domain_detach (pds->macro_pd, false); -pm_runtime_put (pds->dcodec_pd); -dev_pm_domain_detach (pds->dcodec_pd, false); +if (pds) { +pm_runtime_put (pds->macro_pd); +dev_pm_domain_detach (pds->macro_pd, false); +pm_runtime_put (pds->dcodec_pd); +dev_pm_domain_detach (pds->dcodec_pd, false); + } }EXPORT_SYMBOL_GPL (lpass_macro_pds_exit);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 280/879 ASoC: cs35l41: Fix an out-of-bounds access in otp_packed_element_t
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit 9f342904216f378e88008bb0ce1ae200a4b99fe8 ]
The CS35L41_NUM_OTP_ELEM is 100, but only 99 entries are defined in the array otp_map_1/2[CS35L41_NUM_OTP_ELEM], this will trigger UBSAN to report a shift-out-of-bounds warning in the cs35l41_otp_unpack() since the last entry in the array will result in GENMASK(-1, 0).
UBSAN reports this problem:
UBSAN: shift-out-of-bounds in /home/hwang4/build/jammy/jammy/sound/soc/codecs/cs35l41-lib.c:836:8 shift exponent 64 is too large for 64-bit type 'long unsigned int' CPU: 10 PID: 595 Comm: systemd-udevd Not tainted 5.15.0-23-generic #23 Hardware name: LENOVO \x02MFG_IN_GO/\x02MFG_IN_GO, BIOS N3GET19W (1.00 ) 03/11/2022 Call Trace: <TASK> show_stack+0x52/0x58 dump_stack_lvl+0x4a/0x5f dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x45 __ubsan_handle_shift_out_of_bounds.cold+0x61/0xef ? regmap_unlock_mutex+0xe/0x10 cs35l41_otp_unpack.cold+0x1c6/0x2b2 [snd_soc_cs35l41_lib] cs35l41_hda_probe+0x24f/0x33a [snd_hda_scodec_cs35l41] cs35l41_hda_i2c_probe+0x65/0x90 [snd_hda_scodec_cs35l41_i2c] ? cs35l41_hda_i2c_remove+0x20/0x20 [snd_hda_scodec_cs35l41_i2c] i2c_device_probe+0x252/0x2b0
--- include/sound/cs35l41.h | 1 - sound/soc/codecs/cs35l41-lib.c | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-)
include/sound/cs35l41.h +0 -1
@@ -536,7 +536,6 @@#define CS35L41_MAX_CACHE_REG 36#define CS35L41_OTP_SIZE_WORDS 32 -#define CS35L41_NUM_OTP_ELEM 100#define CS35L41_VALID_PDATA 0x80000000#define CS35L41_NUM_SUPPLIES 2
sound/soc/codecs/cs35l41-lib.c +7 -7
@@ -422,7 +422,7 @@ static bool cs35l41_volatile_reg(struct device *dev, unsigned int reg) } } -static const struct cs35l41_otp_packed_element_t otp_map_1[CS35L41_NUM_OTP_ELEM ] = { +static const struct cs35l41_otp_packed_element_t otp_map_1[] = {/* addr shift size */ {0x00002030 ,0 ,4 },/*TRIM_OSC_FREQ_TRIM*/ {0x00002030 ,7 ,1 },/*TRIM_OSC_TRIM_DONE*/
@@ -525,7 +525,7 @@ static const struct cs35l41_otp_packed_element_t otp_map_1[CS35L41_NUM_OTP_ELEM] { 0x00017044, 0, 24 }, /*LOT_NUMBER*/ }; -static const struct cs35l41_otp_packed_element_t otp_map_2[CS35L41_NUM_OTP_ELEM ] = { +static const struct cs35l41_otp_packed_element_t otp_map_2[] = {/* addr shift size */ {0x00002030 ,0 ,4 },/*TRIM_OSC_FREQ_TRIM*/ { 0x00002030, 7, 1 }, /*TRIM_OSC_TRIM_DONE*/
@@ -671,35 +671,35 @@ static const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[] = { { .id = 0x01, .map = otp_map_1, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_1), .bit_offset = 16, .word_offset = 2, }, { .id = 0x02, .map = otp_map_2, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_2), .bit_offset = 16, .word_offset = 2, }, { .id = 0x03, .map = otp_map_2, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_2), .bit_offset = 16, .word_offset = 2, }, { .id = 0x06, .map = otp_map_2, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_2), .bit_offset = 16, .word_offset = 2, }, { .id = 0x08, .map = otp_map_1, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_1), .bit_offset = 16, .word_offset = 2, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 281/879 ASoC: SOF: ipc3-topology: Set scontrol->priv to NULL after freeing it
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit a403993ce98fb401f696da7c4f374739a7609cff ]
Since the scontrol->priv is freed up during load operation it should be set to NULL to be safe against double freeing attempt.
--- sound/soc/sof/ipc3-topology.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/ipc3-topology.c +1 -0
@@ -1605,6 +1605,7 @@ static int sof_ipc3_control_load_bytes(struct snd_sof_dev *sdev, struct snd_sof_if (scontrol->priv_size >0 ) {memcpy (cdata->data, scontrol->priv, scontrol->priv_size);kfree (scontrol->priv); + scontrol->priv =NULL ;if (cdata->data->magic !=SOF_ABI_MAGIC ) {dev_err (sdev->dev,"Wrong ABI magic 0x%08x.\n" , cdata->data->magic);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 282/879 ASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4f4e0454e226de3bf4efd7e7924d1edc571c52d5 ]
Call of_node_put(platform_node) to avoid refcount leak in the error path.
--- sound/soc/mediatek/mt8173/mt8173-max98090.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8173/mt8173-max98090.c +4 -1
@@ -167,7 +167,8 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)if (!codec_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_platform_node; }for_each_card_prelinks (card, i, dai_link) {if (dai_link->codecs->name)
@@ -179,6 +180,8 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) ret =devm_snd_soc_register_card (&pdev->dev, card);of_node_put (codec_node); + +put_platform_node:of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 283/879 ASoC: mediatek: Fix missing of_node_put in mt2701_wm8960_machine_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 05654431a18fe24e5e46a375d98904134628a102 ]
This node pointer is returned by of_parse_phandle() with refcount incremented in this function.
Calling of_node_put() to avoid the refcount leak.
--- sound/soc/mediatek/mt2701/mt2701-wm8960.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt2701/mt2701-wm8960.c +7 -2
@@ -129,7 +129,8 @@ static int mt2701_wm8960_machine_probe(struct platform_device *pdev)if (!codec_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_platform_node; }for_each_card_prelinks (card, i, dai_link) {if (dai_link->codecs->name)
@@ -140,7 +141,7 @@ static int mt2701_wm8960_machine_probe(struct platform_device *pdev) ret =snd_soc_of_parse_audio_routing (card,"audio-routing" );if (ret) {dev_err (&pdev->dev,"failed to parse audio-routing: %d\n" , ret); -return ret; + goto put_codec_node; } ret =devm_snd_soc_register_card (&pdev->dev, card);
@@ -148,6 +149,10 @@ static int mt2701_wm8960_machine_probe(struct platform_device *pdev)dev_err (&pdev->dev,"%s snd_soc_register_card fail %d\n" , __func__, ret); +put_codec_node: +of_node_put (codec_node); +put_platform_node: +of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 284/879 docs: driver-api/thermal/intel_dptf: Use copyright symbol
In reply to Greg Kroah-HartmanFrom: Akira Yokosawa <[email protected]>
[ Upstream commit 2c2de6f2e2bc444eed65eaa949b4fdadab93f6b3 ]
Using a substitution pattern of "|copy|" without including isonum.txt causes a doc build warning.
Using the symbol "©" itself is a better choice for those who read .rst sources.
Reported by: Randy Dunlap <[email protected]>
--- Documentation/driver-api/thermal/intel_dptf.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/driver-api/thermal/intel_dptf.rst +1 -1
@@ -4,7 +4,7 @@ Intel(R) Dynamic Platform and Thermal Framework Sysfs Interface =============================================================== -:Copyright: |copy| 2022 Intel Corporation +:Copyright: © 2022 Intel Corporation :Author: Srinivas Pandruvada <[email protected]>
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 285/879 x86/delay: Fix the wrong asm constraint in delay_loop()
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
[ Upstream commit b86eb74098a92afd789da02699b4b0dd3f73b889 ]
The asm constraint does not reflect the fact that the asm statement can modify the value of the local variable loops. Which it does.
Specifying the wrong constraint may lead to undefined behavior, it may clobber random stuff (e.g. local variable, important temporary value in regs, etc.). This is especially dangerous when the compiler decides to inline the function and since it doesn't know that the value gets modified, it might decide to use it from a register directly without reloading it.
Change the constraint to "+a" to denote that the first argument is an input and an output argument.
[ bp: Fix typo, massage commit message. ]
--- arch/x86/lib/delay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/lib/delay.c +2 -2
@@ -54,8 +54,8 @@ static void delay_loop(u64 __loops)" jnz 2b \n" "3: dec %0 \n" - : /* we don't need output */ - :"a" (loops) + : "+a" (loops) + : ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 286/879 drm/mediatek: Add vblank register/unregister callback functions
In reply to Greg Kroah-HartmanFrom: Rex-BC Chen <[email protected]>
[ Upstream commit b74d921b900b6ce38c6247c0a1c86be9f3746493 ]
We encountered a kernel panic issue that callback data will be NULL when it's using in ovl irq handler. There is a timing issue between mtk_disp_ovl_irq_handler() and mtk_ovl_disable_vblank().
To resolve this issue, we use the flow to register/unregister vblank cb:
- Register callback function and callback data when crtc creates.
- Unregister callback function and callback data when crtc destroies.
With this solution, we can assure callback data will not be NULL when vblank is disable.
--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 16 +++++++----- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 22 ++++++++++++---- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 20 +++++++++----- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 14 +++++++++- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 4 +++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 29 ++++++++++++++++----- 6 files changed, 80 insertions(+), 25 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_drv.h +10 -6
@@ -76,9 +76,11 @@ void mtk_ovl_layer_off(struct device *dev, unsigned int idx,void mtk_ovl_start (struct device *dev);void mtk_ovl_stop (struct device *dev);unsigned int mtk_ovl_supported_rotations (struct device *dev); -void mtk_ovl_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data); +void mtk_ovl_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data); +void mtk_ovl_unregister_vblank_cb (struct device *dev); +void mtk_ovl_enable_vblank (struct device *dev);void mtk_ovl_disable_vblank (struct device *dev);void mtk_rdma_bypass_shadow (struct device *dev);
@@ -93,9 +95,11 @@ void mtk_rdma_layer_config(struct device *dev, unsigned int idx, struct cmdq_pkt *cmdq_pkt);void mtk_rdma_start (struct device *dev);void mtk_rdma_stop (struct device *dev); -void mtk_rdma_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data); +void mtk_rdma_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data); +void mtk_rdma_unregister_vblank_cb (struct device *dev); +void mtk_rdma_enable_vblank (struct device *dev);void mtk_rdma_disable_vblank (struct device *dev);#endif
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +17 -5
@@ -97,14 +97,28 @@ static irqreturn_t mtk_disp_ovl_irq_handler(int irq, void *dev_id)return IRQ_HANDLED ; } -void mtk_ovl_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data) +void mtk_ovl_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data) {struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); ovl->vblank_cb = vblank_cb; ovl->vblank_cb_data = vblank_cb_data; +} + +void mtk_ovl_unregister_vblank_cb (struct device *dev) +{ +struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); + + ovl->vblank_cb =NULL ; + ovl->vblank_cb_data =NULL ; +} + +void mtk_ovl_enable_vblank (struct device *dev) +{ +struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); +writel (0x0 , ovl->regs +DISP_REG_OVL_INTSTA );writel_relaxed (OVL_FME_CPL_INT , ovl->regs +DISP_REG_OVL_INTEN ); }
@@ -113,8 +127,6 @@ void mtk_ovl_disable_vblank(struct device *dev) {struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); - ovl->vblank_cb =NULL ; - ovl->vblank_cb_data =NULL ;writel_relaxed (0x0 , ovl->regs +DISP_REG_OVL_INTEN ); }
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +14 -6
@@ -95,24 +95,32 @@ static void rdma_update_bits(struct device *dev, unsigned int reg,writel (tmp, rdma->regs + reg); } -void mtk_rdma_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data) +void mtk_rdma_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data) {struct mtk_disp_rdma *rdma =dev_get_drvdata (dev); rdma->vblank_cb = vblank_cb; rdma->vblank_cb_data = vblank_cb_data; -rdma_update_bits (dev,DISP_REG_RDMA_INT_ENABLE ,RDMA_FRAME_END_INT , -RDMA_FRAME_END_INT ); } -void mtk_rdma_disable_vblank (struct device *dev) +void mtk_rdma_unregister_vblank_cb (struct device *dev) {struct mtk_disp_rdma *rdma =dev_get_drvdata (dev); rdma->vblank_cb =NULL ; rdma->vblank_cb_data =NULL ; +} + +void mtk_rdma_enable_vblank (struct device *dev) +{ +rdma_update_bits (dev,DISP_REG_RDMA_INT_ENABLE ,RDMA_FRAME_END_INT , +RDMA_FRAME_END_INT ); +} + +void mtk_rdma_disable_vblank (struct device *dev) +{rdma_update_bits (dev,DISP_REG_RDMA_INT_ENABLE ,RDMA_FRAME_END_INT ,0 ); }
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +13 -1
@@ -152,6 +152,7 @@ static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)static void mtk_drm_crtc_destroy (struct drm_crtc *crtc) {struct mtk_drm_crtc *mtk_crtc =to_mtk_crtc (crtc); +int i;mtk_mutex_put (mtk_crtc->mutex);#if IS_REACHABLE (CONFIG_MTK_CMDQ )
@@ -162,6 +163,14 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc) mtk_crtc->cmdq_client.chan = NULL; }#endif + +for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++) { +struct mtk_ddp_comp *comp; + + comp = mtk_crtc->ddp_comp[i]; +mtk_ddp_comp_unregister_vblank_cb (comp); + } +drm_crtc_cleanup (crtc); }
@@ -617,7 +626,7 @@ static int mtk_drm_crtc_enable_vblank(struct drm_crtc *crtc)struct mtk_drm_crtc *mtk_crtc =to_mtk_crtc (crtc);struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0 ]; -mtk_ddp_comp_enable_vblank (comp, mtk_crtc_ddp_irq, &mtk_crtc->base); +mtk_ddp_comp_enable_vblank (comp);return 0 ; }
@@ -926,6 +935,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,if (comp->funcs->ctm_set) has_ctm = true; } + +mtk_ddp_comp_register_vblank_cb (comp, mtk_crtc_ddp_irq, + &mtk_crtc->base); }for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4 -0
@@ -297,6 +297,8 @@ static const struct mtk_ddp_comp_funcs ddp_ovl = { .config = mtk_ovl_config, .start = mtk_ovl_start, .stop = mtk_ovl_stop, + .register_vblank_cb = mtk_ovl_register_vblank_cb, + .unregister_vblank_cb = mtk_ovl_unregister_vblank_cb, .enable_vblank = mtk_ovl_enable_vblank, .disable_vblank = mtk_ovl_disable_vblank, .supported_rotations = mtk_ovl_supported_rotations,
@@ -321,6 +323,8 @@ static const struct mtk_ddp_comp_funcs ddp_rdma = { .config = mtk_rdma_config, .start = mtk_rdma_start, .stop = mtk_rdma_stop, + .register_vblank_cb = mtk_rdma_register_vblank_cb, + .unregister_vblank_cb = mtk_rdma_unregister_vblank_cb, .enable_vblank = mtk_rdma_enable_vblank, .disable_vblank = mtk_rdma_disable_vblank, .layer_nr = mtk_rdma_layer_nr,
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +22 -7
@@ -48,9 +48,11 @@ struct mtk_ddp_comp_funcs { unsigned int bpc, struct cmdq_pkt *cmdq_pkt);void (*start)(struct device *dev);void (*stop)(struct device *dev); -void (*enable_vblank)(struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data); +void (*register_vblank_cb)(struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data); +void (*unregister_vblank_cb)(struct device *dev); +void (*enable_vblank)(struct device *dev);void (*disable_vblank)(struct device *dev);unsigned int (*supported_rotations)(struct device *dev);unsigned int (*layer_nr)(struct device *dev);
@@ -110,12 +112,25 @@ static inline void mtk_ddp_comp_stop(struct mtk_ddp_comp *comp) comp->funcs->stop (comp->dev); } -static inline void mtk_ddp_comp_enable_vblank (struct mtk_ddp_comp *comp, -void (*vblank_cb)(void *), -void *vblank_cb_data) +static inline void mtk_ddp_comp_register_vblank_cb (struct mtk_ddp_comp *comp, +void (*vblank_cb)(void *), +void *vblank_cb_data) +{ +if (comp->funcs && comp->funcs->register_vblank_cb) + comp->funcs->register_vblank_cb (comp->dev, vblank_cb, + vblank_cb_data); +} + +static inline void mtk_ddp_comp_unregister_vblank_cb (struct mtk_ddp_comp *comp) +{ +if (comp->funcs && comp->funcs->unregister_vblank_cb) + comp->funcs->unregister_vblank_cb (comp->dev); +} + +static inline void mtk_ddp_comp_enable_vblank (struct mtk_ddp_comp *comp) {if (comp->funcs && comp->funcs->enable_vblank) - comp->funcs->enable_vblank (comp->dev, vblank_cb, vblank_cb_data); + comp->funcs->enable_vblank (comp->dev); }static inline void mtk_ddp_comp_disable_vblank (struct mtk_ddp_comp *comp)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 287/879 drm/mediatek: Fix DPI component detection for MT8192
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit cfab37ff31afcd0f99f3cccbff1f8ffa11e44c00 ]
When support for MT8192 was added, the DPI device was not added to the list of components to look for. This causes the secondary display pipeline to not be able to fully bind, and the DRM driver subsequently defers probing.
Add the DPI device compatible to list of DPI components to fix this.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -0
@@ -509,6 +509,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt8183-dpi", .data = (void *)MTK_DPI }, + { .compatible = "mediatek,mt8192-dpi", + .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt2701-dsi", .data = (void *)MTK_DSI }, { .compatible = "mediatek,mt8173-dsi",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 288/879 drm/vc4: kms: Take old state core clock rate into account
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 748acfc98adab21a93ae7a1b5bed0f048463e873 ]
During a commit, the core clock, which feeds the HVS, needs to run at a minimum of 500MHz.
While doing that commit, we can also change the mode to one that requires a higher core clock, so we take the core clock rate associated to that new state into account for that boost.
However, the old state also needs to be taken into account if it requires a core clock higher that the new one and our 500MHz limit, since it's still live in hardware at the beginning of our commit.
--- drivers/gpu/drm/vc4/vc4_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_kms.c +3 -2
@@ -385,9 +385,10 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) }if (vc4->hvs->hvs5) { +unsigned long state_rate =max (old_hvs_state->core_clock_rate, + new_hvs_state->core_clock_rate); unsigned long core_rate = max_t(unsigned long, -500000000 , - new_hvs_state->core_clock_rate); +500000000 , state_rate);clk_set_min_rate (hvs->core_clk, core_rate); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 289/879 drm/vc4: hvs: Fix frame count register readout
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit b51cd7ad143d2eb31a6df81c2183128920e47c2b ]
In order to get the field currently being output, the driver has been using the display FIFO frame count in the HVS, reading a 6-bit field at the offset 12 in the DISPSTATx register.
While that field is indeed at that location for the FIFO 1 and 2, the one for the FIFO0 is actually in the DISPSTAT1 register, at the offset 18.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_hvs.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_regs.h | 12 ++++++++++-- 4 files changed, 35 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +1 -1
@@ -123,7 +123,7 @@ static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc, *vpos /=2 ;/* Use hpos to correct for field offset in interlaced mode. */ -if (VC4_GET_FIELD (val,SCALER_DISPSTATX_FRAME_COUNT ) %2 ) +if (vc4_hvs_get_fifo_frame_count (dev, vc4_crtc_state->assigned_channel) %2 ) *hpos += mode->crtc_htotal /2 ; }
drivers/gpu/drm/vc4/vc4_drv.h +1 -0
@@ -935,6 +935,7 @@ void vc4_irq_reset(struct drm_device *dev);extern struct platform_driver vc4_hvs_driver;void vc4_hvs_stop_channel (struct drm_device *dev,unsigned int output);int vc4_hvs_get_fifo_from_output (struct drm_device *dev,unsigned int output); +u8 vc4_hvs_get_fifo_frame_count (struct drm_device *dev,unsigned int fifo);int vc4_hvs_atomic_check (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_begin (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state);
drivers/gpu/drm/vc4/vc4_hvs.c +23 -0
@@ -197,6 +197,29 @@ static void vc4_hvs_update_gamma_lut(struct drm_crtc *crtc)vc4_hvs_lut_load (crtc); } +u8 vc4_hvs_get_fifo_frame_count (struct drm_device *dev,unsigned int fifo) +{ +struct vc4_dev *vc4 =to_vc4_dev (dev); +u8 field =0 ; + +switch (fifo) { +case 0 : + field =VC4_GET_FIELD (HVS_READ (SCALER_DISPSTAT1 ), +SCALER_DISPSTAT1_FRCNT0 ); +break ; +case 1 : + field =VC4_GET_FIELD (HVS_READ (SCALER_DISPSTAT1 ), +SCALER_DISPSTAT1_FRCNT1 ); +break ; +case 2 : + field =VC4_GET_FIELD (HVS_READ (SCALER_DISPSTAT2 ), +SCALER_DISPSTAT2_FRCNT2 ); +break ; + } + +return field; +} +int vc4_hvs_get_fifo_from_output (struct drm_device *dev,unsigned int output) {struct vc4_dev *vc4 =to_vc4_dev (dev);
drivers/gpu/drm/vc4/vc4_regs.h +10 -2
@@ -379,8 +379,6 @@# define SCALER_DISPSTATX_MODE_EOF 3# define SCALER_DISPSTATX_FULL BIT(29)# define SCALER_DISPSTATX_EMPTY BIT(28) -# define SCALER_DISPSTATX_FRAME_COUNT_MASK VC4_MASK(17, 12) -# define SCALER_DISPSTATX_FRAME_COUNT_SHIFT 12# define SCALER_DISPSTATX_LINE_MASK VC4_MASK(11, 0)# define SCALER_DISPSTATX_LINE_SHIFT 0
@@ -403,9 +401,15 @@ (x) * (SCALER_DISPBKGND1 - \ SCALER_DISPBKGND0))#define SCALER_DISPSTAT1 0x00000058 +# define SCALER_DISPSTAT1_FRCNT0_MASK VC4_MASK(23, 18) +# define SCALER_DISPSTAT1_FRCNT0_SHIFT 18 +# define SCALER_DISPSTAT1_FRCNT1_MASK VC4_MASK(17, 12) +# define SCALER_DISPSTAT1_FRCNT1_SHIFT 12 +#define SCALER_DISPSTATX (x) (SCALER_DISPSTAT0 + \ (x) * (SCALER_DISPSTAT1 - \ SCALER_DISPSTAT0)) +#define SCALER_DISPBASE1 0x0000005c#define SCALER_DISPBASEX (x) (SCALER_DISPBASE0 + \ (x) * (SCALER_DISPBASE1 - \
@@ -415,7 +419,11 @@ (x) * (SCALER_DISPCTRL1 - \ SCALER_DISPCTRL0))#define SCALER_DISPBKGND2 0x00000064 +#define SCALER_DISPSTAT2 0x00000068 +# define SCALER_DISPSTAT2_FRCNT2_MASK VC4_MASK(17, 12) +# define SCALER_DISPSTAT2_FRCNT2_SHIFT 12 +#define SCALER_DISPBASE2 0x0000006c#define SCALER_DISPALPHA2 0x00000070#define SCALER_GAMADDR 0x00000078
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 290/879 drm/mediatek: Fix mtk_cec_mask()
In reply to Greg Kroah-HartmanFrom: Miles Chen <[email protected]>
[ Upstream commit 2c5d69b0a141e1e98febe3111e6f4fd8420493a5 ]
In current implementation, mtk_cec_mask() writes val into target register and ignores the mask. After talking to our hdmi experts, mtk_cec_mask() should read a register, clean only mask bits, and update (val | mask) bits to the register.
--- drivers/gpu/drm/mediatek/mtk_cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_cec.c +1 -1
@@ -85,7 +85,7 @@ static void mtk_cec_mask(struct mtk_cec *cec, unsigned int offset,u32 tmp =readl (cec->regs + offset) & ~mask; tmp |= val & mask; -writel (val, cec->regs + offset); +writel (tmp, cec->regs + offset); } void mtk_cec_set_hpd_event(struct device *dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 291/879 drm/amd/amdgpu: Only reserve vram for firmware with vega9 MS_HYPERV host.
In reply to Greg Kroah-HartmanFrom: Yongqiang Sun <[email protected]>
[ Upstream commit 49aa98ca30cd186ab33fc5802066e2024d3bfa39 ]
driver loading failed on VEGA10 SRIOV VF with linux host due to a wide range of stolen reserved vram.
Since VEGA10 SRIOV VF need to reserve vram for firmware with windows Hyper_V host specifically, check hypervisor type to only reserve memory for it, and the range of the reserved vram can be limited to between 5M-7M area.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +5 -4
@@ -25,6 +25,7 @@*/ #include <linux/io-64-nonatomic-lo-hi.h> +#include <asm/hypervisor.h> #include "amdgpu.h" #include "amdgpu_gmc.h"
@@ -647,11 +648,11 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)case CHIP_VEGA10 : adev->mman.keep_stolen_vga_memory = true;/* -* VEGA10 SRIOV VF needs some firmware reserved area. +* VEGA10 SRIOV VF with MS_HYPERV host needs some firmware reserved area. */ -if (amdgpu_sriov_vf (adev)) { - adev->mman.stolen_reserved_offset =0x100000 ; - adev->mman.stolen_reserved_size =0x600000 ; +if (amdgpu_sriov_vf (adev) &&hypervisor_is_type (X86_HYPER_MS_HYPERV )) { + adev->mman.stolen_reserved_offset =0x500000 ; + adev->mman.stolen_reserved_size =0x200000 ; }break ;case CHIP_RAVEN :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 292/879 drm/vc4: hvs: Reset muxes at probe time
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 8514e6b1f40319e31ac4aa3fbf606796786366c9 ]
By default, the HVS driver will force the HVS output 3 to be muxed to the HVS channel 2. However, the Transposer can only be assigned to the HVS channel 2, so whenever we try to use the writeback connector, we'll mux its associated output (Output 2) to the channel 2.
This leads to both the output 2 and 3 feeding from the same channel, which is explicitly discouraged in the documentation.
In order to avoid this, let's reset all the output muxes to their reset value.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/vc4/vc4_hvs.c +21 -5
@@ -605,6 +605,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)struct vc4_hvs *hvs =NULL ;int ret;u32 dispctrl; +u32 reg; hvs =devm_kzalloc (&pdev->dev,sizeof (*hvs),GFP_KERNEL );if (!hvs)
@@ -676,6 +677,26 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) vc4->hvs = hvs; + reg =HVS_READ (SCALER_DISPECTRL ); + reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK ; +HVS_WRITE (SCALER_DISPECTRL , + reg |VC4_SET_FIELD (0 ,SCALER_DISPECTRL_DSP2_MUX )); + + reg =HVS_READ (SCALER_DISPCTRL ); + reg &= ~SCALER_DISPCTRL_DSP3_MUX_MASK ; +HVS_WRITE (SCALER_DISPCTRL , + reg |VC4_SET_FIELD (3 ,SCALER_DISPCTRL_DSP3_MUX )); + + reg =HVS_READ (SCALER_DISPEOLN ); + reg &= ~SCALER_DISPEOLN_DSP4_MUX_MASK ; +HVS_WRITE (SCALER_DISPEOLN , + reg |VC4_SET_FIELD (3 ,SCALER_DISPEOLN_DSP4_MUX )); + + reg =HVS_READ (SCALER_DISPDITHER ); + reg &= ~SCALER_DISPDITHER_DSP5_MUX_MASK ; +HVS_WRITE (SCALER_DISPDITHER , + reg |VC4_SET_FIELD (3 ,SCALER_DISPDITHER_DSP5_MUX )); + dispctrl =HVS_READ (SCALER_DISPCTRL ); dispctrl |=SCALER_DISPCTRL_ENABLE ;
@@ -683,10 +704,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)SCALER_DISPCTRL_DISPEIRQ (1 ) |SCALER_DISPCTRL_DISPEIRQ (2 ); -/* Set DSP3 (PV1) to use HVS channel 2, which would otherwise -* be unused. -*/ - dispctrl &= ~SCALER_DISPCTRL_DSP3_MUX_MASK ; dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | SCALER_DISPCTRL_SLVWREIRQ | SCALER_DISPCTRL_SLVRDEIRQ |
@@ -700,7 +717,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)SCALER_DISPCTRL_DSPEISLUR (1 ) |SCALER_DISPCTRL_DSPEISLUR (2 ) | SCALER_DISPCTRL_SCLEIRQ); - dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_DSP3_MUX );HVS_WRITE (SCALER_DISPCTRL , dispctrl);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 293/879 drm/vc4: txp: Dont set TXP_VSTART_AT_EOF
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 234998df929f14d00cbf2f1e81a7facb69fd9266 ]
The TXP_VSTART_AT_EOF will generate a second VSTART signal to the HVS. However, the HVS waits for VSTART to enable the FIFO and will thus start filling the FIFO before the start of the frame.
This leads to corruption at the beginning of the first frame, and content from the previous frame at the beginning of the next frames.
Since one VSTART is enough, let's get rid of it.
--- drivers/gpu/drm/vc4/vc4_txp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_txp.c +1 -1
@@ -298,7 +298,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,if (WARN_ON (i ==ARRAY_SIZE (drm_fmts)))return ; - ctrl =TXP_GO |TXP_VSTART_AT_EOF |TXP_EI | + ctrl =TXP_GO |TXP_EI |VC4_SET_FIELD (0xf ,TXP_BYTE_ENABLE ) |VC4_SET_FIELD (txp_fmts[i],TXP_FORMAT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 294/879 drm/vc4: txp: Force alpha to be 0xff if its disabled
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 5453343a88ede8b12812fced81ecd24cb888ccc3 ]
If we use a format that has padding instead of the alpha component (such as XRGB8888), it appears that the Transposer will fill the padding to 0, disregarding what was stored in the input buffer padding.
This leads to issues with IGT, since it will set the padding to 0xff, but will then compare the CRC of the two frames which will thus fail. Another nice side effect is that it is now possible to just use the buffer as ARGB.
--- drivers/gpu/drm/vc4/vc4_txp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/vc4/vc4_txp.c +6 -0
@@ -304,6 +304,12 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,if (fb->format->has_alpha) ctrl |=TXP_ALPHA_ENABLE ; +else +/* +* If TXP_ALPHA_ENABLE isn't set and TXP_ALPHA_INVERT is, the +* hardware will force the output padding to be 0xff. +*/ + ctrl |=TXP_ALPHA_INVERT ; gem =drm_fb_cma_get_gem_obj (fb,0 );TXP_WRITE (TXP_DST_PTR , gem->paddr + fb->offsets[0 ]);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 295/879 libbpf: Dont error out on CO-RE relos for overriden weak subprogs
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit e89d57d938c8fa80c457982154ed6110804814fe ]
During BPF static linking, all the ELF relocations and .BTF.ext information (including CO-RE relocations) are preserved for __weak subprograms that were logically overriden by either previous weak subprogram instance or by corresponding "strong" (non-weak) subprogram. This is just how native user-space linkers work, nothing new.
But libbpf is over-zealous when processing CO-RE relocation to error out when CO-RE relocation belonging to such eliminated weak subprogram is encountered. Instead of erroring out on this expected situation, log debug-level message and skip the relocation.
--- tools/lib/bpf/libbpf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
tools/lib/bpf/libbpf.c +11 -4
@@ -5665,10 +5665,17 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path) insn_idx = rec->insn_off /BPF_INSN_SZ ; prog =find_prog_by_sec_insn (obj, sec_idx, insn_idx);if (!prog) { -pr_warn ("sec '%s': failed to find program at insn #%d for CO-RE offset relocation #%d\n" , - sec_name, insn_idx, i); - err = -EINVAL ; - goto out; +/* When __weak subprog is "overridden" by another instance +* of the subprog from a different object file, linker still +* appends all the .BTF.ext info that used to belong to that +* eliminated subprogram. +* This is similar to what x86-64 linker does for relocations. +* So just ignore such relocations just like we ignore +* subprog instructions when discovering subprograms. +*/ +pr_debug ("sec '%s': skipping CO-RE relocation #%d for insn #%d belonging to eliminated weak subprogram\n" , + sec_name, i, insn_idx); +continue ; }/* no need to apply CO-RE relocation if the program is * not going to be loaded
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 296/879 x86/PCI: Fix ALi M1487 (IBC) PIRQ router link value interpretation
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
[ Upstream commit 4969e223b109754c2340a26bba9b1cf44f0cba9b ]
Fix an issue with commit 1ce849c75534 ("x86/PCI: Add support for the ALi M1487 (IBC) PIRQ router") and correct ALi M1487 (IBC) PIRQ router link value (`pirq' cookie) interpretation according to findings in the BIOS.
Credit to Nikolai Zhubr for the detective work as to the bit layout.
--- arch/x86/pci/irq.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
arch/x86/pci/irq.c +16 -3
@@ -253,6 +253,15 @@ static void write_pc_conf_nybble(u8 base, u8 index, u8 val)pc_conf_set (reg, x); } +/* +* FinALi pirq rules are as follows: +* +* - bit 0 selects between INTx Routing Table Mapping Registers, +* +* - bit 3 selects the nibble within the INTx Routing Table Mapping Register, +* +* - bits 7:4 map to bits 3:0 of the PCI INTx Sensitivity Register. +*/ static int pirq_finali_get (struct pci_dev *router,struct pci_dev *dev,int pirq) {
@@ -260,11 +269,13 @@ static int pirq_finali_get(struct pci_dev *router, struct pci_dev *dev,0 ,9 ,3 ,10 ,4 ,5 ,7 ,6 ,0 ,11 ,0 ,12 ,0 ,14 ,0 ,15 };unsigned long flags; +u8 index;u8 x; + index = (pirq &1 ) <<1 | (pirq &8 ) >>3 ;raw_spin_lock_irqsave (&pc_conf_lock, flags);pc_conf_set (PC_CONF_FINALI_LOCK ,PC_CONF_FINALI_LOCK_KEY ); - x = irqmap[read_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , pirq -1 )]; + x = irqmap[read_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , index)];pc_conf_set (PC_CONF_FINALI_LOCK ,0 );raw_spin_unlock_irqrestore (&pc_conf_lock, flags);return x;
@@ -278,13 +289,15 @@ static int pirq_finali_set(struct pci_dev *router, struct pci_dev *dev, };u8 val = irqmap[irq];unsigned long flags; +u8 index;if (!val)return 0 ; + index = (pirq &1 ) <<1 | (pirq &8 ) >>3 ;raw_spin_lock_irqsave (&pc_conf_lock, flags);pc_conf_set (PC_CONF_FINALI_LOCK ,PC_CONF_FINALI_LOCK_KEY ); -write_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , pirq -1 , val); +write_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , index, val);pc_conf_set (PC_CONF_FINALI_LOCK ,0 );raw_spin_unlock_irqrestore (&pc_conf_lock, flags);return 1 ;
@@ -293,7 +306,7 @@ static int pirq_finali_set(struct pci_dev *router, struct pci_dev *dev,static int pirq_finali_lvl (struct pci_dev *router,struct pci_dev *dev,int pirq,int irq) { -u8 mask = ~(1u << (pirq -1 )); +u8 mask = ~((pirq &0xf0u ) >>4 );unsigned long flags;u8 trig;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 297/879 mptcp: optimize release_cb for the common case
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 65a569b03ca832ebc93ce45a7466137e2bb62254 ]
The mptcp release callback checks several flags in atomic context, but only MPTCP_CLEAN_UNA can be up frequently.
Reorganize the code to avoid multiple conditionals in the most common scenarios.
Additional clarify a related comment.
--- net/mptcp/protocol.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +9 -7
@@ -3092,15 +3092,17 @@ static void mptcp_release_cb(struct sock *sk)spin_lock_bh (&sk->sk_lock.slock); } -/* be sure to set the current sk state before tacking actions -* depending on sk_state -*/ -if (__test_and_clear_bit (MPTCP_CONNECTED , &msk->cb_flags)) -__mptcp_set_connected (sk);if (__test_and_clear_bit (MPTCP_CLEAN_UNA , &msk->cb_flags))__mptcp_clean_una_wakeup (sk); -if (__test_and_clear_bit (MPTCP_ERROR_REPORT , &msk->cb_flags)) -__mptcp_error_report (sk); +if (unlikely (&msk->cb_flags)) { +/* be sure to set the current sk state before tacking actions +* depending on sk_state, that is processing MPTCP_ERROR_REPORT +*/ +if (__test_and_clear_bit (MPTCP_CONNECTED , &msk->cb_flags)) +__mptcp_set_connected (sk); +if (__test_and_clear_bit (MPTCP_ERROR_REPORT , &msk->cb_flags)) +__mptcp_error_report (sk); + }__mptcp_update_rmem (sk); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 298/879 mptcp: reset the packet scheduler on incoming MP_PRIO
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 43f5b111d1ff16161ce60e19aeddb999cb6f0b01 ]
When an incoming MP_PRIO option changes the backup status of any subflow, we need to reset the packet scheduler status, or the next send could keep using the previously selected subflow, without taking in account the new priorities.
--- net/mptcp/pm.c | 19 +++++++++++++++---- net/mptcp/protocol.c | 2 ++ net/mptcp/protocol.h | 1 + 3 files changed, 18 insertions(+), 4 deletions(-)
net/mptcp/pm.c +15 -4
@@ -261,14 +261,25 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,spin_unlock_bh (&pm->lock); } -void mptcp_pm_mp_prio_received (struct sock *sk,u8 bkup) +void mptcp_pm_mp_prio_received (struct sock *ssk,u8 bkup) { -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk); +struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk); +struct sock *sk = subflow->conn; +struct mptcp_sock *msk;pr_debug ("subflow->backup=%d, bkup=%d\n" , subflow->backup, bkup); - subflow->backup = bkup; + msk =mptcp_sk (sk); +if (subflow->backup != bkup) { + subflow->backup = bkup; +mptcp_data_lock (sk); +if (!sock_owned_by_user (sk)) + msk->last_snd =NULL ; +else +__set_bit (MPTCP_RESET_SCHEDULER , &msk->cb_flags); +mptcp_data_unlock (sk); + } -mptcp_event (MPTCP_EVENT_SUB_PRIORITY ,mptcp_sk (subflow->conn), sk,GFP_ATOMIC ); +mptcp_event (MPTCP_EVENT_SUB_PRIORITY , msk, ssk,GFP_ATOMIC ); }void mptcp_pm_mp_fail_received (struct sock *sk,u64 fail_seq)
net/mptcp/protocol.c +2 -0
@@ -3102,6 +3102,8 @@ static void mptcp_release_cb(struct sock *sk)__mptcp_set_connected (sk);if (__test_and_clear_bit (MPTCP_ERROR_REPORT , &msk->cb_flags))__mptcp_error_report (sk); +if (__test_and_clear_bit (MPTCP_RESET_SCHEDULER , &msk->cb_flags)) + msk->last_snd =NULL ; }__mptcp_update_rmem (sk);
net/mptcp/protocol.h +1 -0
@@ -124,6 +124,7 @@#define MPTCP_RETRANSMIT 4#define MPTCP_FLUSH_JOIN_LIST 5#define MPTCP_CONNECTED 6 +#define MPTCP_RESET_SCHEDULER 7static inline bool before64 (__u64 seq1,__u64 seq2) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 299/879 mptcp: reset the packet scheduler on PRIO change
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 0e203c324752e13d22624ab7ffafe934fa06ab50 ]
Similar to the previous patch, for priority changes requested by the local PM.
--- net/mptcp/pm_netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/mptcp/pm_netlink.c +2 -0
@@ -727,6 +727,8 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,if (!addresses_equal (&local, addr, addr->port))continue ; +if (subflow->backup != bkup) + msk->last_snd =NULL ; subflow->backup = bkup; subflow->send_mp_prio =1 ; subflow->request_bkup = bkup;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 300/879 nl80211: show SSID for P2P_GO interfaces
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit a75971bc2b8453630e9f85e0beaa4da8db8277a3 ]
There's no real reason not to send the SSID to userspace when it requests information about P2P_GO, it is, in that respect, exactly the same as AP interfaces. Fix that.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -3719,6 +3719,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flagwdev_lock (wdev);switch (wdev->iftype) {case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_P2P_GO :if (wdev->ssid_len &&nla_put (msg,NL80211_ATTR_SSID , wdev->ssid_len, wdev->ssid)) goto nla_put_failure_locked;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 301/879 drm/komeda: Fix an undefined behavior bug in komeda_plane_add()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit f5e284bb74ab296f98122673c7ecd22028b2c200 ]
In komeda_plane_add(), komeda_get_layer_fourcc_list() is assigned to formats and used in drm_universal_plane_init(). drm_universal_plane_init() passes formats to __drm_universal_plane_init(). __drm_universal_plane_init() further passes formats to memcpy() as src parameter, which could lead to an undefined behavior bug on failure of komeda_get_layer_fourcc_list().
Fix this bug by adding a check of formats.
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_DRM_KOMEDA=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/arm/display/komeda/komeda_plane.c +4 -0
@@ -265,6 +265,10 @@ static int komeda_plane_add(struct komeda_kms_dev *kms, formats =komeda_get_layer_fourcc_list (&mdev->fmt_tbl, layer->layer_type, &n_formats); +if (!formats) { +kfree (kplane); +return -ENOMEM ; + } err = drm_universal_plane_init(&kms->base, plane, get_possible_crtcs(kms, c->pipeline),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 302/879 drm: mali-dp: potential dereference of null pointer
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 73c3ed7495c67b8fbdc31cf58e6ca8757df31a33 ]
The return value of kzalloc() needs to be checked. To avoid use of null pointer '&state->base' in case of the failure of alloc.
--- drivers/gpu/drm/arm/malidp_crtc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_crtc.c +4 -1
@@ -487,7 +487,10 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)if (crtc->state)malidp_crtc_destroy_state (crtc, crtc->state); -__drm_atomic_helper_crtc_reset (crtc, &state->base); +if (state) +__drm_atomic_helper_crtc_reset (crtc, &state->base); +else +__drm_atomic_helper_crtc_reset (crtc,NULL ); }static int malidp_crtc_enable_vblank (struct drm_crtc *crtc)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 303/879 drm/amd/amdgpu: Fix asm/hypervisor.h build error.
In reply to Greg Kroah-HartmanFrom: Yongqiang Sun <[email protected]>
[ Upstream commit d9e50239a9611b9a1759e007e9a810c8d178da28 ]
Add CONFIG_X86 check to fix the build error.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +4 -0
@@ -25,7 +25,9 @@*/ #include <linux/io-64-nonatomic-lo-hi.h> +#ifdef CONFIG_X86 #include <asm/hypervisor.h> +#endif #include "amdgpu.h" #include "amdgpu_gmc.h"
@@ -650,10 +652,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)/* * VEGA10 SRIOV VF with MS_HYPERV host needs some firmware reserved area. */ +#ifdef CONFIG_X86 if (amdgpu_sriov_vf (adev) &&hypervisor_is_type (X86_HYPER_MS_HYPERV )) { adev->mman.stolen_reserved_offset =0x500000 ; adev->mman.stolen_reserved_size =0x200000 ; } +#endif break ;case CHIP_RAVEN :case CHIP_RENOIR :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 304/879 spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 8b1ea69a63eb62f97cef63e6d816b64ed84e8760 ]
wait_for_completion_timeout() returns unsigned long not int. It returns 0 if timed out, and positive if completed. The check for <= 0 is ambiguous and should be == 0 here indicating timeout which is the only error case.
--- drivers/spi/spi-ti-qspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-ti-qspi.c +3 -2
@@ -448,6 +448,7 @@ static int ti_qspi_dma_xfer(struct ti_qspi *qspi, dma_addr_t dma_dst,enum dma_ctrl_flags flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ;struct dma_async_tx_descriptor *tx;int ret; +unsigned long time_left; tx =dmaengine_prep_dma_memcpy (chan, dma_dst, dma_src, len, flags);if (!tx) {
@@ -467,9 +468,9 @@ static int ti_qspi_dma_xfer(struct ti_qspi *qspi, dma_addr_t dma_dst, }dma_async_issue_pending (chan); - ret =wait_for_completion_timeout (&qspi->transfer_complete, + time_left =wait_for_completion_timeout (&qspi->transfer_complete,msecs_to_jiffies (len)); -if (ret <=0 ) { +if (time_left ==0 ) {dmaengine_terminate_sync (chan);dev_err (qspi->dev,"DMA wait_for_completion_timeout\n" );return -ETIMEDOUT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 305/879 scftorture: Fix distribution of short handler delays
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 8106bddbab5f0ba180e6d693c7c1fc6926d57caa ]
The scftorture test module's scf_handler() function is supposed to provide three different distributions of short delays (including "no delay") and one distribution of long delays, if specified by the scftorture.longwait module parameter. However, the second of the two non-zero-wait short delays is disabled due to the first such delay's "goto out" not being enclosed in the "then" clause with the "udelay()".
This commit therefore adjusts the code to provide the intended set of delays.
--- kernel/scftorture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/scftorture.c +3 -2
@@ -267,9 +267,10 @@ static void scf_handler(void *scfc_in) }this_cpu_inc (scf_invoked_count);if (longwait <=0 ) { -if (!(r &0xffc0 )) +if (!(r &0xffc0 )) {udelay (r &0x3f ); - goto out; + goto out; + } }if (r &0xfff ) goto out;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 306/879 net: ethernet: ti: am65-cpsw: Fix build error without PHYLINK
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit bfa323c659b1016c8e896920ba08cd6914cc3b0c ]
If PHYLINK is n, build fails:
drivers/net/ethernet/ti/am65-cpsw-ethtool.o: In function `am65_cpsw_set_link_ksettings':
am65-cpsw-ethtool.c:(.text+0x118): undefined reference to phylink_ethtool_ksettings_set' drivers/net/ethernet/ti/am65-cpsw-ethtool.o: In function am65_cpsw_get_link_ksettings':
am65-cpsw-ethtool.c:(.text+0x138): undefined reference to phylink_ethtool_ksettings_get' drivers/net/ethernet/ti/am65-cpsw-ethtool.o: In function am65_cpsw_set_eee':
am65-cpsw-ethtool.c:(.text+0x158): undefined reference to `phylink_ethtool_set_eee'
Select PHYLINK for TI_K3_AM65_CPSW_NUSS to fix this.
--- drivers/net/ethernet/ti/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/Kconfig +1 -0
@@ -94,6 +94,7 @@ config TI_K3_AM65_CPSW_NUSS depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER select NET_DEVLINK select TI_DAVINCI_MDIO + select PHYLINK imply PHY_TI_GMII_SEL depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS help
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 307/879 net: dsa: mt7530: 1G can also support 1000BASE-X link mode
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit 66f862563ed68717dfd84e808ca12705ed275ced ]
When using an external PHY connected using RGMII to mt7531 port 5, the PHY can be used to used support 1000BASE-X connections. Moreover, if 1000BASE-T is supported, then we should allow 1000BASE-X as well, since which are supported is a property of the PHY.
Therefore, it makes no sense to exclude this from the linkmodes when 1000BASE-T is supported.
--- drivers/net/dsa/mt7530.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/net/dsa/mt7530.c +4 -10
@@ -2540,13 +2540,7 @@ static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port,/* Port5 supports ethier RGMII or SGMII. * Port6 supports SGMII only. */ -switch (port) { -case 5 : -if (mt7531_is_rgmii_port (priv, port)) -break ; - fallthrough; -case 6 : - phylink_set(supported, 1000baseX_Full); +if (port ==6 ) { phylink_set(supported, 2500baseX_Full); phylink_set(supported, 2500baseT_Full); }
@@ -2914,8 +2908,6 @@ static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, unsigned long *supported) { - if (port == 5) - phylink_set(supported, 1000baseX_Full); } static void mt7531_mac_port_validate(struct dsa_switch *ds, int port,
@@ -2952,8 +2944,10 @@ mt753x_phylink_validate(struct dsa_switch *ds, int port, }/* This switch only supports 1G full-duplex. */ -if (state->interface !=PHY_INTERFACE_MODE_MII ) +if (state->interface !=PHY_INTERFACE_MODE_MII ) { phylink_set(mask, 1000baseT_Full); + phylink_set(mask, 1000baseX_Full); + } priv->info->mac_port_validate (ds, port, mask);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 308/879 ixp4xx_eth: fix error check return value of platform_get_irq()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit f45ba67eb74ab4b775616af731bdf8944afce3f1 ]
platform_get_irq() return negative value on failure, so null check of return value is incorrect. Fix it by comparing whether it is less than zero.
--- drivers/net/ethernet/xscale/ptp_ixp46x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xscale/ptp_ixp46x.c +1 -1
@@ -271,7 +271,7 @@ static int ptp_ixp_probe(struct platform_device *pdev) ixp_clock.master_irq =platform_get_irq (pdev,0 ); ixp_clock.slave_irq =platform_get_irq (pdev,1 );if (IS_ERR (ixp_clock.regs) || - !ixp_clock.master_irq || !ixp_clock.slave_irq) + ixp_clock.master_irq <0 || ixp_clock.slave_irq <0 )return -ENXIO ; ixp_clock.caps = ptp_ixp_caps;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 309/879 NFC: NULL out the dev->rfkill to prevent UAF
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 1b0e81416a24d6e9b8c2341e22e8bf48f8b8bfc9 ]
Commit 3e3b5dfcd16a ("NFC: reorder the logic in nfc_{un,}register_device") assumes the device_is_registered() in function nfc_dev_up() will help to check when the rfkill is unregistered. However, this check only take effect when device_del(&dev->dev) is done in nfc_unregister_device(). Hence, the rfkill object is still possible be dereferenced.
The crash trace in latest kernel (5.18-rc2):
[ 68.760105] ================================================================== [ 68.760330] BUG: KASAN: use-after-free in __lock_acquire+0x3ec1/0x6750 [ 68.760756] Read of size 8 at addr ffff888009c93018 by task fuzz/313 [ 68.760756] [ 68.760756] CPU: 0 PID: 313 Comm: fuzz Not tainted 5.18.0-rc2 #4 [ 68.760756] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 68.760756] Call Trace: [ 68.760756] <TASK> [ 68.760756] dump_stack_lvl+0x57/0x7d [ 68.760756] print_report.cold+0x5e/0x5db [ 68.760756] ? __lock_acquire+0x3ec1/0x6750 [ 68.760756] kasan_report+0xbe/0x1c0 [ 68.760756] ? __lock_acquire+0x3ec1/0x6750 [ 68.760756] __lock_acquire+0x3ec1/0x6750 [ 68.760756] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 68.760756] ? register_lock_class+0x18d0/0x18d0 [ 68.760756] lock_acquire+0x1ac/0x4f0 [ 68.760756] ? rfkill_blocked+0xe/0x60 [ 68.760756] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 68.760756] ? mutex_lock_io_nested+0x12c0/0x12c0 [ 68.760756] ? nla_get_range_signed+0x540/0x540 [ 68.760756] ? _raw_spin_lock_irqsave+0x4e/0x50 [ 68.760756] _raw_spin_lock_irqsave+0x39/0x50 [ 68.760756] ? rfkill_blocked+0xe/0x60 [ 68.760756] rfkill_blocked+0xe/0x60 [ 68.760756] nfc_dev_up+0x84/0x260 [ 68.760756] nfc_genl_dev_up+0x90/0xe0 [ 68.760756] genl_family_rcv_msg_doit+0x1f4/0x2f0 [ 68.760756] ? genl_family_rcv_msg_attrs_parse.constprop.0+0x230/0x230 [ 68.760756] ? security_capable+0x51/0x90 [ 68.760756] genl_rcv_msg+0x280/0x500 [ 68.760756] ? genl_get_cmd+0x3c0/0x3c0 [ 68.760756] ? lock_acquire+0x1ac/0x4f0 [ 68.760756] ? nfc_genl_dev_down+0xe0/0xe0 [ 68.760756] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 68.760756] netlink_rcv_skb+0x11b/0x340 [ 68.760756] ? genl_get_cmd+0x3c0/0x3c0 [ 68.760756] ? netlink_ack+0x9c0/0x9c0 [ 68.760756] ? netlink_deliver_tap+0x136/0xb00 [ 68.760756] genl_rcv+0x1f/0x30 [ 68.760756] netlink_unicast+0x430/0x710 [ 68.760756] ? memset+0x20/0x40 [ 68.760756] ? netlink_attachskb+0x740/0x740 [ 68.760756] ? __build_skb_around+0x1f4/0x2a0 [ 68.760756] netlink_sendmsg+0x75d/0xc00 [ 68.760756] ? netlink_unicast+0x710/0x710 [ 68.760756] ? netlink_unicast+0x710/0x710 [ 68.760756] sock_sendmsg+0xdf/0x110 [ 68.760756] __sys_sendto+0x19e/0x270 [ 68.760756] ? __ia32_sys_getpeername+0xa0/0xa0 [ 68.760756] ? fd_install+0x178/0x4c0 [ 68.760756] ? fd_install+0x195/0x4c0 [ 68.760756] ? kernel_fpu_begin_mask+0x1c0/0x1c0 [ 68.760756] __x64_sys_sendto+0xd8/0x1b0 [ 68.760756] ? lockdep_hardirqs_on+0xbf/0x130 [ 68.760756] ? syscall_enter_from_user_mode+0x1d/0x50 [ 68.760756] do_syscall_64+0x3b/0x90 [ 68.760756] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 68.760756] RIP: 0033:0x7f67fb50e6b3 ... [ 68.760756] RSP: 002b:00007f67fa91fe90 EFLAGS: 00000293 ORIG_RAX: 000000000000002c [ 68.760756] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f67fb50e6b3 [ 68.760756] RDX: 000000000000001c RSI: 0000559354603090 RDI: 0000000000000003 [ 68.760756] RBP: 00007f67fa91ff00 R08: 00007f67fa91fedc R09: 000000000000000c [ 68.760756] R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffe824d496e [ 68.760756] R13: 00007ffe824d496f R14: 00007f67fa120000 R15: 0000000000000003
[ 68.760756] </TASK> [ 68.760756] [ 68.760756] Allocated by task 279: [ 68.760756] kasan_save_stack+0x1e/0x40 [ 68.760756] __kasan_kmalloc+0x81/0xa0 [ 68.760756] rfkill_alloc+0x7f/0x280 [ 68.760756] nfc_register_device+0xa3/0x1a0 [ 68.760756] nci_register_device+0x77a/0xad0 [ 68.760756] nfcmrvl_nci_register_dev+0x20b/0x2c0 [ 68.760756] nfcmrvl_nci_uart_open+0xf2/0x1dd [ 68.760756] nci_uart_tty_ioctl+0x2c3/0x4a0 [ 68.760756] tty_ioctl+0x764/0x1310 [ 68.760756] __x64_sys_ioctl+0x122/0x190 [ 68.760756] do_syscall_64+0x3b/0x90 [ 68.760756] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 68.760756] [ 68.760756] Freed by task 314: [ 68.760756] kasan_save_stack+0x1e/0x40 [ 68.760756] kasan_set_track+0x21/0x30 [ 68.760756] kasan_set_free_info+0x20/0x30 [ 68.760756] __kasan_slab_free+0x108/0x170 [ 68.760756] kfree+0xb0/0x330 [ 68.760756] device_release+0x96/0x200 [ 68.760756] kobject_put+0xf9/0x1d0 [ 68.760756] nfc_unregister_device+0x77/0x190 [ 68.760756] nfcmrvl_nci_unregister_dev+0x88/0xd0 [ 68.760756] nci_uart_tty_close+0xdf/0x180 [ 68.760756] tty_ldisc_kill+0x73/0x110 [ 68.760756] tty_ldisc_hangup+0x281/0x5b0 [ 68.760756] __tty_hangup.part.0+0x431/0x890 [ 68.760756] tty_release+0x3a8/0xc80 [ 68.760756] __fput+0x1f0/0x8c0 [ 68.760756] task_work_run+0xc9/0x170 [ 68.760756] exit_to_user_mode_prepare+0x194/0x1a0 [ 68.760756] syscall_exit_to_user_mode+0x19/0x50 [ 68.760756] do_syscall_64+0x48/0x90 [ 68.760756] entry_SYSCALL_64_after_hwframe+0x44/0xae
This patch just add the null out of dev->rfkill to make sure such dereference cannot happen. This is safe since the device_lock() already protect the check/write from data race.
--- net/nfc/core.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/core.c +1 -0
@@ -1166,6 +1166,7 @@ void nfc_unregister_device(struct nfc_dev *dev)if (dev->rfkill) {rfkill_unregister (dev->rfkill);rfkill_destroy (dev->rfkill); + dev->rfkill =NULL ; } dev->shutting_down = true;device_unlock (&dev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 310/879 cpufreq: governor: Use kobject release() method to free dbs_data
In reply to Greg Kroah-HartmanFrom: Kevin Hao <[email protected]>
[ Upstream commit a85ee6401a47ae3fc64ba506cacb3e7873823c65 ]
The struct dbs_data embeds a struct gov_attr_set and
the struct gov_attr_set embeds a kobject. Since every kobject must have a release() method and we can't use kfree() to free it directly, so introduce cpufreq_dbs_data_release() to release the dbs_data via the kobject::release() method. This fixes the calltrace like below:
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x34
WARNING: CPU: 12 PID: 810 at lib/debugobjects.c:505 debug_print_object+0xb8/0x100 Modules linked in: CPU: 12 PID: 810 Comm: sh Not tainted 5.16.0-next-20220120-yocto-standard+ #536 Hardware name: Marvell OcteonTX CN96XX board (DT) pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : debug_print_object+0xb8/0x100 lr : debug_print_object+0xb8/0x100 sp : ffff80001dfcf9a0 x29: ffff80001dfcf9a0 x28: 0000000000000001 x27: ffff0001464f0000 x26: 0000000000000000 x25: ffff8000090e3f00 x24: ffff80000af60210 x23: ffff8000094dfb78 x22: ffff8000090e3f00 x21: ffff0001080b7118 x20: ffff80000aeb2430 x19: ffff800009e8f5e0 x18: 0000000000000000 x17: 0000000000000002 x16: 00004d62e58be040 x15: 013590470523aff8 x14: ffff8000090e1828 x13: 0000000001359047 x12: 00000000f5257d14 x11: 0000000000040591 x10: 0000000066c1ffea x9 : ffff8000080d15e0 x8 : ffff80000a1765a8 x7 : 0000000000000000 x6 : 0000000000000001 x5 : ffff800009e8c000 x4 : ffff800009e8c760 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0001474ed040 Call trace: debug_print_object+0xb8/0x100 __debug_check_no_obj_freed+0x1d0/0x25c debug_check_no_obj_freed+0x24/0xa0 kfree+0x11c/0x440 cpufreq_dbs_governor_exit+0xa8/0xac cpufreq_exit_governor+0x44/0x90 cpufreq_set_policy+0x29c/0x570 store_scaling_governor+0x110/0x154 store+0xb0/0xe0 sysfs_kf_write+0x58/0x84 kernfs_fop_write_iter+0x12c/0x1c0 new_sync_write+0xf0/0x18c vfs_write+0x1cc/0x220 ksys_write+0x74/0x100 __arm64_sys_write+0x28/0x3c invoke_syscall.constprop.0+0x58/0xf0 do_el0_svc+0x70/0x170 el0_svc+0x54/0x190 el0t_64_sync_handler+0xa4/0x130 el0t_64_sync+0x1a0/0x1a4 irq event stamp: 189006 hardirqs last enabled at (189005): [<ffff8000080849d0>] finish_task_switch.isra.0+0xe0/0x2c0 hardirqs last disabled at (189006): [<ffff8000090667a4>] el1_dbg+0x24/0xa0 softirqs last enabled at (188966): [<ffff8000080106d0>] __do_softirq+0x4b0/0x6a0 softirqs last disabled at (188957): [<ffff80000804a618>] __irq_exit_rcu+0x108/0x1a4
[ rjw: Because can be freed by the gov_attr_set_put() in
cpufreq_dbs_governor_exit() now, it is also necessary to put the invocation of the governor ->exit() callback into the new cpufreq_dbs_data_release() function. ]
--- drivers/cpufreq/cpufreq_governor.c | 20 +++++++++++++------- drivers/cpufreq/cpufreq_governor.h | 1 + 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/cpufreq/cpufreq_governor.c +13 -7
@@ -388,6 +388,15 @@ static void free_policy_dbs_info(struct policy_dbs_info *policy_dbs, gov->free (policy_dbs); } +static void cpufreq_dbs_data_release (struct kobject *kobj) +{ +struct dbs_data *dbs_data =to_dbs_data (to_gov_attr_set (kobj)); +struct dbs_governor *gov = dbs_data->gov; + + gov->exit (dbs_data); +kfree (dbs_data); +} +int cpufreq_dbs_governor_init (struct cpufreq_policy *policy) {struct dbs_governor *gov =dbs_governor_of (policy);
@@ -425,6 +434,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) goto free_policy_dbs_info; } + dbs_data->gov = gov;gov_attr_set_init (&dbs_data->attr_set, &policy_dbs->list); ret = gov->init (dbs_data);
@@ -447,6 +457,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) policy->governor_data = policy_dbs; gov->kobj_type.sysfs_ops = &governor_sysfs_ops; + gov->kobj_type.release = cpufreq_dbs_data_release; ret =kobject_init_and_add (&dbs_data->attr_set.kobj, &gov->kobj_type,get_governor_parent_kobj (policy),"%s" , gov->gov.name);
@@ -488,13 +499,8 @@ void cpufreq_dbs_governor_exit(struct cpufreq_policy *policy) policy->governor_data =NULL ; -if (!count) { -if (!have_governor_per_policy ()) - gov->gdbs_data =NULL ; - - gov->exit (dbs_data); -kfree (dbs_data); - } +if (!count && !have_governor_per_policy ()) + gov->gdbs_data =NULL ;free_policy_dbs_info (policy_dbs, gov);
drivers/cpufreq/cpufreq_governor.h +1 -0
@@ -37,6 +37,7 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE};/* Governor demand based switching data (per-policy or global). */ struct dbs_data {struct gov_attr_set attr_set; +struct dbs_governor *gov;void *tuners;unsigned int ignore_nice_load;unsigned int sampling_rate;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 311/879 efi: Allow to enable EFI runtime services by default on RT
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit a031651ff2144a3d81d4916856c093bc1ea0a413 ]
Commit d9f283ae71af ("efi: Disable runtime services on RT") disabled EFI runtime services by default when the CONFIG_PREEMPT_RT option is enabled.
The rationale for that commit is that some EFI calls could take too much time, leading to large latencies which is an issue for Real-Time kernels.
But a side effect of that change was that now is not possible anymore to enable the EFI runtime services by default when CONFIG_PREEMPT_RT is set, without passing an efi=runtime command line parameter to the kernel.
Instead, let's add a new EFI_DISABLE_RUNTIME boolean Kconfig option, that would be set to n by default but to y if CONFIG_PREEMPT_RT is enabled.
That way, the current behaviour is preserved but gives users a mechanism to enable the EFI runtimes services in their kernels if that is required. For example, if the firmware could guarantee bounded time for EFI calls.
Also, having a separate boolean config could allow users to disable the EFI runtime services by default even when CONFIG_PREEMPT_RT is not set.
--- drivers/firmware/efi/Kconfig | 15 +++++++++++++++ drivers/firmware/efi/efi.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/firmware/efi/Kconfig +15 -0
@@ -284,3 +284,18 @@ config EFI_CUSTOM_SSDT_OVERLAYS See Documentation/admin-guide/acpi/ssdt-overlays.rst for more information. + +config EFI_DISABLE_RUNTIME + bool "Disable EFI runtime services support by default" + default y if PREEMPT_RT + help + Allow to disable the EFI runtime services support by default. This can + already be achieved by using the efi=noruntime option, but it could be + useful to have this default without any kernel command line parameter. + + The EFI runtime services are disabled by default when PREEMPT_RT is + enabled, because measurements have shown that some EFI functions calls + might take too much time to complete, causing large latencies which is + an issue for Real-Time kernels. + + This default can be overridden by using the efi=runtime option.
drivers/firmware/efi/efi.c +1 -1
@@ -66,7 +66,7 @@ struct mm_struct efi_mm = {struct workqueue_struct *efi_rts_wq; -static bool disable_runtime =IS_ENABLED (CONFIG_PREEMPT_RT ); +static bool disable_runtime =IS_ENABLED (CONFIG_EFI_DISABLE_RUNTIME );static int __init setup_noefi (char *arg) { disable_runtime = true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 312/879 efi: Add missing prototype for efi_capsule_setup_info
In reply to Greg Kroah-HartmanFrom: Jan Kiszka <[email protected]>
[ Upstream commit aa480379d8bdb33920d68acfd90f823c8af32578 ]
Fixes "no previous declaration for 'efi_capsule_setup_info'" warnings under W=1.
--- include/linux/efi.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/efi.h +2 -0
@@ -213,6 +213,8 @@ struct capsule_info {size_t page_bytes_remain; }; +int efi_capsule_setup_info (struct capsule_info *cap_info,void *kbuff, +size_t hdr_bytes);int __efi_capsule_setup_info (struct capsule_info *cap_info);/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 313/879 device property: Allow error pointer to be passed to fwnode APIs
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 002752af7b89b74c64fe6bec8c5fde3d3a7810d8 ]
Some of the fwnode APIs might return an error pointer instead of NULL or valid fwnode handle. The result of such API call may be considered optional and hence the test for it is usually done in a form of
fwnode = fwnode_find_reference(...); if (IS_ERR(fwnode)) ...error handling...
Nevertheless the resulting fwnode may have bumped the reference count and hence caller of the above API is obliged to call fwnode_handle_put(). Since fwnode may be not valid either as NULL or error pointer the check has to be performed there. This approach uglifies the code and adds a point of making a mistake, i.e. forgetting about error point case.
To prevent this, allow an error pointer to be passed to the fwnode APIs.
--- drivers/base/property.c | 89 +++++++++++++++++++++++------------------ include/linux/fwnode.h | 10 ++--- 2 files changed, 56 insertions(+), 43 deletions(-)
drivers/base/property.c +51 -38
@@ -47,12 +47,14 @@ bool fwnode_property_present(const struct fwnode_handle *fwnode, {bool ret; +if (IS_ERR_OR_NULL (fwnode)) +return false; + ret =fwnode_call_bool_op (fwnode, property_present, propname); -if (ret == false && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_bool_op (fwnode->secondary, property_present, - propname); -return ret; +if (ret) +return ret; + +return fwnode_call_bool_op (fwnode->secondary, property_present, propname); }EXPORT_SYMBOL_GPL (fwnode_property_present);
@@ -232,15 +234,16 @@ static int fwnode_property_read_int_array(const struct fwnode_handle *fwnode, {int ret; +if (IS_ERR_OR_NULL (fwnode)) +return -EINVAL ; + ret =fwnode_call_int_op (fwnode, property_read_int_array, propname, elem_size, val, nval); -if (ret == -EINVAL && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_int_op ( - fwnode->secondary, property_read_int_array, propname, - elem_size, val, nval); +if (ret != -EINVAL ) +return ret; -return ret; +return fwnode_call_int_op (fwnode->secondary, property_read_int_array, propname, + elem_size, val, nval); }/**
@@ -371,14 +374,16 @@ int fwnode_property_read_string_array(const struct fwnode_handle *fwnode, {int ret; +if (IS_ERR_OR_NULL (fwnode)) +return -EINVAL ; + ret =fwnode_call_int_op (fwnode, property_read_string_array, propname, val, nval); -if (ret == -EINVAL && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_int_op (fwnode->secondary, - property_read_string_array, propname, - val, nval); -return ret; +if (ret != -EINVAL ) +return ret; + +return fwnode_call_int_op (fwnode->secondary, property_read_string_array, propname, + val, nval); }EXPORT_SYMBOL_GPL (fwnode_property_read_string_array);
@@ -480,15 +485,19 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, {int ret; +if (IS_ERR_OR_NULL (fwnode)) +return -ENOENT ; + ret =fwnode_call_int_op (fwnode, get_reference_args, prop, nargs_prop, nargs, index, args); +if (ret ==0 ) +return ret; -if (ret <0 && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_int_op (fwnode->secondary, get_reference_args, - prop, nargs_prop, nargs, index, args); +if (IS_ERR_OR_NULL (fwnode->secondary)) +return ret; -return ret; +return fwnode_call_int_op (fwnode->secondary, get_reference_args, prop, nargs_prop, + nargs, index, args); }EXPORT_SYMBOL_GPL (fwnode_property_get_reference_args);
@@ -635,12 +644,13 @@ EXPORT_SYMBOL_GPL(fwnode_count_parents);struct fwnode_handle *fwnode_get_nth_parent (struct fwnode_handle *fwnode,unsigned int depth) { -unsigned int i; -fwnode_handle_get (fwnode); -for (i =0 ; i < depth && fwnode; i++) +do { +if (depth-- ==0 ) +break ; fwnode =fwnode_get_next_parent (fwnode); + }while (fwnode);return fwnode; }
@@ -659,17 +669,17 @@ EXPORT_SYMBOL_GPL(fwnode_get_nth_parent);bool fwnode_is_ancestor_of (struct fwnode_handle *test_ancestor,struct fwnode_handle *test_child) { -if (!test_ancestor) +if (IS_ERR_OR_NULL (test_ancestor))return false;fwnode_handle_get (test_child); -while (test_child) { +do {if (test_child == test_ancestor) {fwnode_handle_put (test_child);return true; } test_child =fwnode_get_next_parent (test_child); - } + }while (test_child);return false; }
@@ -698,7 +708,7 @@ fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode, {struct fwnode_handle *next_child = child; -if (!fwnode) +if (IS_ERR_OR_NULL (fwnode))return NULL ; do {
@@ -722,16 +732,16 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,const struct fwnode_handle *fwnode =dev_fwnode (dev);struct fwnode_handle *next; +if (IS_ERR_OR_NULL (fwnode)) +return NULL ; +/* Try to find a child in primary fwnode */ next =fwnode_get_next_child_node (fwnode, child);if (next)return next;/* When no more children in primary, continue with secondary */ -if (fwnode && !IS_ERR_OR_NULL (fwnode->secondary)) - next =fwnode_get_next_child_node (fwnode->secondary, child); - -return next; +return fwnode_get_next_child_node (fwnode->secondary, child); }EXPORT_SYMBOL_GPL (device_get_next_child_node);
@@ -798,6 +808,9 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put);*/ bool fwnode_device_is_available (const struct fwnode_handle *fwnode) { +if (IS_ERR_OR_NULL (fwnode)) +return false; +if (!fwnode_has_op (fwnode, device_is_available))return true;
@@ -988,14 +1001,14 @@ fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, parent =fwnode_graph_get_port_parent (prev); else parent = fwnode; +if (IS_ERR_OR_NULL (parent)) +return NULL ; ep =fwnode_call_ptr_op (parent, graph_get_next_endpoint, prev); +if (ep) +return ep; -if (IS_ERR_OR_NULL (ep) && - !IS_ERR_OR_NULL (parent) && !IS_ERR_OR_NULL (parent->secondary)) - ep =fwnode_graph_get_next_endpoint (parent->secondary,NULL ); - -return ep; +return fwnode_graph_get_next_endpoint (parent->secondary,NULL ); }EXPORT_SYMBOL_GPL (fwnode_graph_get_next_endpoint);
include/linux/fwnode.h +5 -5
@@ -148,12 +148,12 @@ struct fwnode_operations {int (*add_links)(struct fwnode_handle *fwnode); }; -#define fwnode_has_op (fwnode, op) \ - ((fwnode) && (fwnode)->ops && (fwnode)->ops->op) +#define fwnode_has_op (fwnode, op) \ + (!IS_ERR_OR_NULL(fwnode) && (fwnode)->ops && (fwnode)->ops->op) +#define fwnode_call_int_op (fwnode, op, ...) \ - (fwnode ? (fwnode_has_op(fwnode, op) ? \ - (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \ - -EINVAL) + (fwnode_has_op(fwnode, op) ? \ + (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : (IS_ERR_OR_NULL(fwnode) ? -EINVAL : -ENXIO))#define fwnode_call_bool_op (fwnode, op, ...) \ (fwnode_has_op(fwnode, op) ? \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 314/879 drm/amd/amdgpu: Remove static from variable in RLCG Reg RW
In reply to Greg Kroah-HartmanFrom: Gavin Wan <[email protected]>
[ Upstream commit d68cf992ded575928cf4ddf7c64faff0d8dcce14 ]
[why]
These static variables save the RLC Scratch registers address. When we install multiple GPUs (for example: XGMI setting) and multiple GPUs call the function at same time. The RLC Scratch registers address are changed each other. Then it caused reading/writing from/to wrong GPU.
[how]
Removed the static from the variables. The variables are on the stack.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -5
@@ -864,11 +864,11 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 vuint32_t timeout =50000 ;uint32_t i, tmp;uint32_t ret =0 ; -static void *scratch_reg0; -static void *scratch_reg1; -static void *scratch_reg2; -static void *scratch_reg3; -static void *spare_int; +void *scratch_reg0; +void *scratch_reg1; +void *scratch_reg2; +void *scratch_reg3; +void *spare_int;if (!adev->gfx.rlc.rlcg_reg_access_supported) { dev_err(adev->dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 315/879 net: dsa: qca8k: correctly handle mdio read error
In reply to Greg Kroah-HartmanFrom: Ansuel Smith <[email protected]>
[ Upstream commit 6cfc03b602200c5cbbd8d906fd905547814e83df ]
Restore original way to handle mdio read error by returning 0xffff. This was wrongly changed when the internal_mdio_read was introduced, now that both legacy and internal use the same function, make sure that they behave the same way.
--- drivers/net/dsa/qca8k.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/dsa/qca8k.c +6 -1
@@ -1287,7 +1287,12 @@ qca8k_internal_mdio_read(struct mii_bus *slave_bus, int phy, int regnum)if (ret >=0 )return ret; -return qca8k_mdio_read (priv, phy, regnum); + ret =qca8k_mdio_read (priv, phy, regnum); + +if (ret <0 ) +return 0xffff ; + +return ret; } static int
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 316/879 target: remove an incorrect unmap zeroes data deduction
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 179d8609d8424529e95021df939ed7b0b82b37f1 ]
For block devices, the SCSI target drivers implements UNMAP as calls to blkdev_issue_discard, which does not guarantee zeroing just because Write Zeroes is supported.
Note that this does not affect the file backed path which uses fallocate to punch holes.
--- drivers/target/target_core_device.c | 1 - 1 file changed, 1 deletion(-)
drivers/target/target_core_device.c +0 -1
@@ -850,7 +850,6 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, attrib->unmap_granularity = q->limits.discard_granularity / block_size; attrib->unmap_granularity_alignment = q->limits.discard_alignment / block_size; - attrib->unmap_zeroes_data = !!(q->limits.max_write_zeroes_sectors);return true; }EXPORT_SYMBOL (target_configure_unmap_from_queue);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 317/879 drbd: remove assign_p_sizes_qlim
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 40349d0e16cedd0de561f59752c3249780fb749b ]
Fold each branch into its only caller.
--- drivers/block/drbd/drbd_main.c | 47 +++++++++++++++------------------- 1 file changed, 20 insertions(+), 27 deletions(-)
drivers/block/drbd/drbd_main.c +20 -27
@@ -903,31 +903,6 @@ void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *peer_device) } } -/* communicated if (agreed_features & DRBD_FF_WSAME) */ -static void -assign_p_sizes_qlim (struct drbd_device *device,struct p_sizes *p, -struct request_queue *q) -{ -if (q) { - p->qlim->physical_block_size =cpu_to_be32 (queue_physical_block_size (q)); - p->qlim->logical_block_size =cpu_to_be32 (queue_logical_block_size (q)); - p->qlim->alignment_offset =cpu_to_be32 (queue_alignment_offset (q)); - p->qlim->io_min =cpu_to_be32 (queue_io_min (q)); - p->qlim->io_opt =cpu_to_be32 (queue_io_opt (q)); - p->qlim->discard_enabled =blk_queue_discard (q); - p->qlim->write_same_capable =0 ; - }else { - q = device->rq_queue; - p->qlim->physical_block_size =cpu_to_be32 (queue_physical_block_size (q)); - p->qlim->logical_block_size =cpu_to_be32 (queue_logical_block_size (q)); - p->qlim->alignment_offset =0 ; - p->qlim->io_min =cpu_to_be32 (queue_io_min (q)); - p->qlim->io_opt =cpu_to_be32 (queue_io_opt (q)); - p->qlim->discard_enabled =0 ; - p->qlim->write_same_capable =0 ; - } -} -int drbd_send_sizes (struct drbd_peer_device *peer_device,int trigger_reply,enum dds_flags flags) {struct drbd_device *device = peer_device->device;
@@ -957,14 +932,32 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu q_order_type =drbd_queue_order_type (device); max_bio_size =queue_max_hw_sectors (q) <<9 ; max_bio_size =min (max_bio_size,DRBD_MAX_BIO_SIZE ); -assign_p_sizes_qlim (device, p, q); + p->qlim->physical_block_size = +cpu_to_be32 (queue_physical_block_size (q)); + p->qlim->logical_block_size = +cpu_to_be32 (queue_logical_block_size (q)); + p->qlim->alignment_offset = +cpu_to_be32 (queue_alignment_offset (q)); + p->qlim->io_min =cpu_to_be32 (queue_io_min (q)); + p->qlim->io_opt =cpu_to_be32 (queue_io_opt (q)); + p->qlim->discard_enabled =blk_queue_discard (q);put_ldev (device); }else { +struct request_queue *q = device->rq_queue; + + p->qlim->physical_block_size = +cpu_to_be32 (queue_physical_block_size (q)); + p->qlim->logical_block_size = +cpu_to_be32 (queue_logical_block_size (q)); + p->qlim->alignment_offset =0 ; + p->qlim->io_min =cpu_to_be32 (queue_io_min (q)); + p->qlim->io_opt =cpu_to_be32 (queue_io_opt (q)); + p->qlim->discard_enabled =0 ; + d_size =0 ; u_size =0 ; q_order_type =QUEUE_ORDERED_NONE ; max_bio_size =DRBD_MAX_BIO_SIZE ;/* ... multiple BIOs per peer_request */ -assign_p_sizes_qlim (device, p,NULL ); }if (peer_device->connection->agreed_pro_version <=94 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 318/879 drbd: use bdev based limit helpers in drbd_send_sizes
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 7a38acce229685968b770d1d9e64e01396b93643 ]
Use the bdev based limits helpers where they exist.
--- drivers/block/drbd/drbd_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/drbd/drbd_main.c +7 -5
@@ -924,7 +924,9 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enumemset (p,0 , packet_size);if (get_ldev_if_state (device,D_NEGOTIATING )) { -struct request_queue *q =bdev_get_queue (device->ldev->backing_bdev); +struct block_device *bdev = device->ldev->backing_bdev; +struct request_queue *q =bdev_get_queue (bdev); + d_size =drbd_get_max_capacity (device->ldev);rcu_read_lock (); u_size =rcu_dereference (device->ldev->disk_conf)->disk_size;
@@ -933,13 +935,13 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu max_bio_size =queue_max_hw_sectors (q) <<9 ; max_bio_size =min (max_bio_size,DRBD_MAX_BIO_SIZE ); p->qlim->physical_block_size = -cpu_to_be32 (queue_physical_block_size (q)); +cpu_to_be32 (bdev_physical_block_size (bdev)); p->qlim->logical_block_size = -cpu_to_be32 (queue_logical_block_size (q)); +cpu_to_be32 (bdev_logical_block_size (bdev)); p->qlim->alignment_offset =cpu_to_be32 (queue_alignment_offset (q)); - p->qlim->io_min =cpu_to_be32 (queue_io_min (q)); - p->qlim->io_opt =cpu_to_be32 (queue_io_opt (q)); + p->qlim->io_min =cpu_to_be32 (bdev_io_min (bdev)); + p->qlim->io_opt =cpu_to_be32 (bdev_io_opt (bdev)); p->qlim->discard_enabled =blk_queue_discard (q);put_ldev (device); }else {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 319/879 drbd: use bdev_alignment_offset instead of queue_alignment_offset
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit c6f23b1a05441a26f765e59dd95e8ba7354f9388 ]
The bdev version does the right thing for partitions, so use that.
--- drivers/block/drbd/drbd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/drbd/drbd_main.c +1 -1
@@ -939,7 +939,7 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu p->qlim->logical_block_size =cpu_to_be32 (bdev_logical_block_size (bdev)); p->qlim->alignment_offset = -cpu_to_be32 (queue_alignment_offset (q)); +cpu_to_be32 (bdev_alignment_offset (bdev)); p->qlim->io_min =cpu_to_be32 (bdev_io_min (bdev)); p->qlim->io_opt =cpu_to_be32 (bdev_io_opt (bdev)); p->qlim->discard_enabled =blk_queue_discard (q);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 320/879 drbd: fix duplicate array initializer
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 33cb0917bbe241dd17a2b87ead63514c1b7e5615 ]
There are two initializers for P_RETRY_WRITE:
drivers/block/drbd/drbd_main.c:3676:22: warning: initialized field overwritten [-Woverride-init]
Remove the first one since it was already ignored by the compiler and reorder the list to match the enum definition. As P_ZEROES had no entry, add that one instead.
--- drivers/block/drbd/drbd_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/block/drbd/drbd_main.c +6 -5
@@ -3581,9 +3581,8 @@ const char *cmdname(enum drbd_packet cmd)* when we want to support more than * one PRO_VERSION */ static const char *cmdnames[] = { + [P_DATA ] ="Data" , - [P_WSAME ] ="WriteSame" , - [P_TRIM ] ="Trim" , [P_DATA_REPLY ] ="DataReply" , [P_RS_DATA_REPLY ] ="RSDataReply" , [P_BARRIER ] ="Barrier" ,
@@ -3594,7 +3593,6 @@ const char *cmdname(enum drbd_packet cmd) [P_DATA_REQUEST] = "DataRequest", [P_RS_DATA_REQUEST] = "RSDataRequest", [P_SYNC_PARAM] = "SyncParam", - [P_SYNC_PARAM89] = "SyncParam89", [P_PROTOCOL] = "ReportProtocol", [P_UUIDS] = "ReportUUIDs", [P_SIZES] = "ReportSizes",
@@ -3602,6 +3600,7 @@ const char *cmdname(enum drbd_packet cmd) [P_SYNC_UUID] = "ReportSyncUUID", [P_AUTH_CHALLENGE] = "AuthChallenge", [P_AUTH_RESPONSE] = "AuthResponse", + [P_STATE_CHG_REQ] = "StateChgRequest", [P_PING] = "Ping", [P_PING_ACK] = "PingAck", [P_RECV_ACK] = "RecvAck",
@@ -3612,23 +3611,25 @@ const char *cmdname(enum drbd_packet cmd) [P_NEG_DREPLY] = "NegDReply", [P_NEG_RS_DREPLY] = "NegRSDReply", [P_BARRIER_ACK] = "BarrierAck", - [P_STATE_CHG_REQ] = "StateChgRequest", [P_STATE_CHG_REPLY] = "StateChgReply", [P_OV_REQUEST] = "OVRequest", [P_OV_REPLY] = "OVReply", [P_OV_RESULT] = "OVResult", [P_CSUM_RS_REQUEST] = "CsumRSRequest", [P_RS_IS_IN_SYNC] = "CsumRSIsInSync", + [P_SYNC_PARAM89] = "SyncParam89", [P_COMPRESSED_BITMAP] = "CBitmap", [P_DELAY_PROBE] = "DelayProbe", [P_OUT_OF_SYNC] = "OutOfSync", - [P_RETRY_WRITE] = "RetryWrite", [P_RS_CANCEL] = "RSCancel", [P_CONN_ST_CHG_REQ] = "conn_st_chg_req", [P_CONN_ST_CHG_REPLY] = "conn_st_chg_reply", [P_PROTOCOL_UPDATE] = "protocol_update", + [P_TRIM] = "Trim", [P_RS_THIN_REQ] = "rs_thin_req", [P_RS_DEALLOCATED] = "rs_deallocated", + [P_WSAME] = "WriteSame", + [P_ZEROES] = "Zeroes",/* enum drbd_packet, but not commands - obsoleted flags: * P_MAY_IGNORE
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 321/879 EDAC/dmc520: Dont print an error for each unconfigured interrupt line
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
[ Upstream commit ad2df24732e8956a45a00894d2163c4ee8fb0e1f ]
The dmc520 driver requires that at least one interrupt line, out of the ten possible, is configured. The driver prints an error and returns -EINVAL from its .probe function if there are no interrupt lines configured.
Don't print a KERN_ERR level message for each interrupt line that's unconfigured as that can confuse users into thinking that there is an error condition.
Before this change, the following KERN_ERR level messages would be reported if only dram_ecc_errc and dram_ecc_errd were configured in the device tree:
dmc520 68000000.dmc: IRQ ram_ecc_errc not found dmc520 68000000.dmc: IRQ ram_ecc_errd not found dmc520 68000000.dmc: IRQ failed_access not found dmc520 68000000.dmc: IRQ failed_prog not found dmc520 68000000.dmc: IRQ link_err not dmc520 68000000.dmc: IRQ temperature_event not found dmc520 68000000.dmc: IRQ arch_fsm not found dmc520 68000000.dmc: IRQ phy_request not found
--- drivers/edac/dmc520_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/dmc520_edac.c +1 -1
@@ -489,7 +489,7 @@ static int dmc520_edac_probe(struct platform_device *pdev) dev = &pdev->dev;for (idx =0 ; idx <NUMBER_OF_IRQS ; idx++) { - irq =platform_get_irq_byname (pdev, dmc520_irq_configs[idx].name); + irq =platform_get_irq_byname_optional (pdev, dmc520_irq_configs[idx].name); irqs[idx] = irq; masks[idx] = dmc520_irq_configs[idx].mask;if (irq >=0 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 322/879 bpf: Move rcu lock management out of BPF_PROG_RUN routines
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 055eb95533273bc334794dbc598400d10800528f ]
Commit 7d08c2c91171 ("bpf: Refactor BPF_PROG_RUN_ARRAY family of macros into functions") switched a bunch of BPF_PROG_RUN macros to inline routines. This changed the semantic a bit. Due to arguments expansion of macros, it used to be:
rcu_read_lock(); array = rcu_dereference(cgrp->bpf.effective[atype]); ...
Now, with with inline routines, we have:
array_rcu = rcu_dereference(cgrp->bpf.effective[atype]); /* array_rcu can be kfree'd here */ rcu_read_lock(); array = rcu_dereference(array_rcu);
I'm assuming in practice rcu subsystem isn't fast enough to trigger this but let's use rcu API properly.
Also, rename to lower caps to not confuse with macros. Additionally, drop and expand BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY.
See [1] for more context.
[1] https://lore.kernel.org/bpf/CAKH8qBs60fOinFdxiiQikK_q0EcVxGvNTQoWvHLEUGbgcj1UYg@mail.gmail.com/T/#u
v2
- keep rcu locks inside by passing cgroup_bpf
--- drivers/media/rc/bpf-lirc.c | 8 ++- include/linux/bpf.h | 115 ++------------------------------- kernel/bpf/cgroup.c | 124 +++++++++++++++++++++++++++++++----- kernel/trace/bpf_trace.c | 5 +- 4 files changed, 124 insertions(+), 128 deletions(-)
drivers/media/rc/bpf-lirc.c +6 -2
@@ -216,8 +216,12 @@ void lirc_bpf_run(struct rc_dev *rcdev, u32 sample) raw->bpf_sample = sample; -if (raw->progs) -BPF_PROG_RUN_ARRAY (raw->progs, &raw->bpf_sample, bpf_prog_run); +if (raw->progs) { +rcu_read_lock (); +bpf_prog_run_array (rcu_dereference (raw->progs), + &raw->bpf_sample, bpf_prog_run); +rcu_read_unlock (); + } }/*
include/linux/bpf.h +7 -108
147 lines not on this page · raw message
kernel/bpf/cgroup.c +107 -17
185 lines not on this page · raw message
kernel/trace/bpf_trace.c +4 -1
@@ -129,7 +129,10 @@ unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)* out of events when it was updated in between this and the * rcu_dereference() which is accepted risk. */ - ret =BPF_PROG_RUN_ARRAY (call->prog_array, ctx, bpf_prog_run); +rcu_read_lock (); + ret =bpf_prog_run_array (rcu_dereference (call->prog_array), + ctx, bpf_prog_run); +rcu_read_unlock (); out:__this_cpu_dec (bpf_prog_active);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 323/879 drm/bridge: anx7625: Use uint8 for lane-swing arrays
In reply to Greg Kroah-HartmanFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit fb8da7f3111ab500606960bef1bb32450c664750 ]
As defined in the anx7625 dt-binding, the analogix,lane0-swing and analogix,lane1-swing properties are uint8 arrays. Yet, the driver was reading the array as if it were of uint32 and masking to 8-bit before writing to the registers. This means that a devicetree written in accordance to the dt-binding would have its values incorrectly parsed.
Fix the issue by reading the array as uint8 and storing them as uint8 internally, so that we can also drop the masking when writing the registers.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------ drivers/gpu/drm/bridge/analogix/anx7625.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +6 -6
@@ -1478,12 +1478,12 @@ static void anx7625_dp_adjust_swing(struct anx7625_data *ctx)for (i =0 ; i < ctx->pdata.dp_lane0_swing_reg_cnt; i++)anx7625_reg_write (ctx, ctx->i2c.tx_p1_client,DP_TX_LANE0_SWING_REG0 + i, - ctx->pdata.lane0_reg_data[i] &0xFF ); + ctx->pdata.lane0_reg_data[i]);for (i =0 ; i < ctx->pdata.dp_lane1_swing_reg_cnt; i++)anx7625_reg_write (ctx, ctx->i2c.tx_p1_client,DP_TX_LANE1_SWING_REG0 + i, - ctx->pdata.lane1_reg_data[i] &0xFF ); + ctx->pdata.lane1_reg_data[i]); }static void dp_hpd_change_handler (struct anx7625_data *ctx,bool on)
@@ -1590,8 +1590,8 @@ static int anx7625_get_swing_setting(struct device *dev, num_regs =DP_TX_SWING_REG_CNT ; pdata->dp_lane0_swing_reg_cnt = num_regs; -of_property_read_u32_array (dev->of_node,"analogix,lane0-swing" , - pdata->lane0_reg_data, num_regs); +of_property_read_u8_array (dev->of_node,"analogix,lane0-swing" , + pdata->lane0_reg_data, num_regs); } if (of_get_property(dev->of_node,
@@ -1600,8 +1600,8 @@ static int anx7625_get_swing_setting(struct device *dev, num_regs =DP_TX_SWING_REG_CNT ; pdata->dp_lane1_swing_reg_cnt = num_regs; -of_property_read_u32_array (dev->of_node,"analogix,lane1-swing" , - pdata->lane1_reg_data, num_regs); +of_property_read_u8_array (dev->of_node,"analogix,lane1-swing" , + pdata->lane1_reg_data, num_regs); }return 0 ;
drivers/gpu/drm/bridge/analogix/anx7625.h +2 -2
@@ -426,9 +426,9 @@ struct anx7625_platform_data {int mipi_lanes;int audio_en;int dp_lane0_swing_reg_cnt; -int lane0_reg_data[DP_TX_SWING_REG_CNT ]; +u8 lane0_reg_data[DP_TX_SWING_REG_CNT ];int dp_lane1_swing_reg_cnt; -int lane1_reg_data[DP_TX_SWING_REG_CNT ]; +u8 lane1_reg_data[DP_TX_SWING_REG_CNT ];u32 low_power_mode;struct device_node *mipi_host_node; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 324/879 mtd: rawnand: denali: Use managed device resources
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 3a745b51cddafade99aaea1b93aad31e9614e230 ]
All of the resources used by this driver has managed interfaces, so use them. Otherwise we will get the following splat:
[ 4.472703] denali-nand-pci 0000:00:05.0: timeout while waiting for irq 0x1000 [ 4.474071] denali-nand-pci: probe of 0000:00:05.0 failed with error -5 [ 4.473538] nand: No NAND device found [ 4.474068] BUG: unable to handle page fault for address: ffffc90005000410 [ 4.475169] #PF: supervisor write access in kernel mode [ 4.475579] #PF: error_code(0x0002) - not-present page [ 4.478362] RIP: 0010:iowrite32+0x9/0x50 [ 4.486068] Call Trace: [ 4.486269] <IRQ> [ 4.486443] denali_isr+0x15b/0x300 [denali] [ 4.486788] ? denali_direct_write+0x50/0x50 [denali] [ 4.487189] __handle_irq_event_percpu+0x161/0x3b0 [ 4.487571] handle_irq_event+0x7d/0x1b0 [ 4.487884] handle_fasteoi_irq+0x2b0/0x770 [ 4.488219] __common_interrupt+0xc8/0x1b0 [ 4.488549] common_interrupt+0x9a/0xc0
--- drivers/mtd/nand/raw/denali_pci.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/mtd/nand/raw/denali_pci.c +4 -11
@@ -74,22 +74,21 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)return ret; } - denali->reg =ioremap (csr_base, csr_len); + denali->reg =devm_ioremap (denali->dev, csr_base, csr_len);if (!denali->reg) {dev_err (&dev->dev,"Spectra: Unable to remap memory region\n" );return -ENOMEM ; } - denali->host =ioremap (mem_base, mem_len); + denali->host =devm_ioremap (denali->dev, mem_base, mem_len);if (!denali->host) {dev_err (&dev->dev,"Spectra: ioremap failed!" ); - ret = -ENOMEM ; - goto out_unmap_reg; +return -ENOMEM ; } ret =denali_init (denali);if (ret) - goto out_unmap_host; +return ret; nsels = denali->nbanks;
@@ -117,10 +116,6 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) out_remove_denali:denali_remove (denali); -out_unmap_host: -iounmap (denali->host); -out_unmap_reg: -iounmap (denali->reg);return ret; }
@@ -129,8 +124,6 @@ static void denali_pci_remove(struct pci_dev *dev)struct denali_controller *denali =pci_get_drvdata (dev);denali_remove (denali); -iounmap (denali->reg); -iounmap (denali->host); }static struct pci_driver denali_pci_driver = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 325/879 HID: hid-led: fix maximum brightness for Dream Cheeky
In reply to Greg Kroah-HartmanFrom: Jonathan Teh <[email protected]>
[ Upstream commit 116c3f4a78ebe478d5ad5a038baf931e93e7d748 ]
Increase maximum brightness for Dream Cheeky to 63. Emperically determined based on testing in kernel 4.4 on this device:
Bus 003 Device 002: ID 1d34:0004 Dream Cheeky Webmail Notifier
--- drivers/hid/hid-led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-led.c +1 -1
@@ -366,7 +366,7 @@ static const struct hidled_config hidled_configs[] = { .type = DREAM_CHEEKY, .name = "Dream Cheeky Webmail Notifier", .short_name = "dream_cheeky", - .max_brightness = 31, + .max_brightness = 63, .num_leds = 1, .report_size = 9, .report_type = RAW_REQUEST,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 326/879 HID: elan: Fix potential double free in elan_input_configured
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 1af20714fedad238362571620be0bd690ded05b6 ]
'input' is a managed resource allocated with devm_input_allocate_device(), so there is no need to call input_free_device() explicitly or there will be a double free.
According to the doc of devm_input_allocate_device():
* Managed input devices do not need to be explicitly unregistered or
* freed as it will be done automatically when owner device unbinds from
* its driver (or binding fails).
--- drivers/hid/hid-elan.c | 2 -- 1 file changed, 2 deletions(-)
drivers/hid/hid-elan.c +0 -2
@@ -188,7 +188,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) ret =input_mt_init_slots (input,ELAN_MAX_FINGERS ,INPUT_MT_POINTER );if (ret) {hid_err (hdev,"Failed to init elan MT slots: %d\n" , ret); -input_free_device (input);return ret; }
@@ -200,7 +199,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)hid_err (hdev,"Failed to register elan input device: %d\n" , ret);input_mt_destroy_slots (input); -input_free_device (input);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 327/879 drm/bridge: Fix error handling in analogix_dp_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9f15930bb2ef9f031d62ffc49629cbae89137733 ]
In the error handling path, the clk_prepare_enable() function call should be balanced by a corresponding 'clk_disable_unprepare()' call, as already done in the remove function.
--- .../gpu/drm/bridge/analogix/analogix_dp_core.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +13 -5
@@ -1698,8 +1698,10 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); dp->reg_base =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (dp->reg_base)) -return ERR_CAST (dp->reg_base); +if (IS_ERR (dp->reg_base)) { + ret =PTR_ERR (dp->reg_base); + goto err_disable_clk; + } dp->force_hpd =of_property_read_bool (dev->of_node,"force-hpd" );
@@ -1711,7 +1713,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)if (IS_ERR (dp->hpd_gpiod)) {dev_err (dev,"error getting HDP GPIO: %ld\n" ,PTR_ERR (dp->hpd_gpiod)); -return ERR_CAST (dp->hpd_gpiod); + ret =PTR_ERR (dp->hpd_gpiod); + goto err_disable_clk; }if (dp->hpd_gpiod) {
@@ -1731,7 +1734,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)if (dp->irq == -ENXIO ) {dev_err (&pdev->dev,"failed to get irq\n" ); -return ERR_PTR (-ENODEV ); + ret = -ENODEV ; + goto err_disable_clk; } ret = devm_request_threaded_irq(&pdev->dev, dp->irq,
@@ -1740,11 +1744,15 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) irq_flags, "analogix-dp", dp);if (ret) {dev_err (&pdev->dev,"failed to request irq\n" ); -return ERR_PTR (ret); + goto err_disable_clk; }disable_irq (dp->irq);return dp; + +err_disable_clk: +clk_disable_unprepare (dp->clock); +return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (analogix_dp_probe);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 328/879 regulator: da9121: Fix uninit-value in da9121_assign_chip_model()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit bab76514aca36bc513224525d5598da676938218 ]
KASAN report slab-out-of-bounds in __regmap_init as follows:
BUG: KASAN: slab-out-of-bounds in __regmap_init drivers/base/regmap/regmap.c:841 Read of size 1 at addr ffff88803678cdf1 by task xrun/9137 CPU: 0 PID: 9137 Comm: xrun Tainted: G W 5.18.0-rc2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0xe8/0x15a lib/dump_stack.c:88 print_report.cold+0xcd/0x69b mm/kasan/report.c:313 kasan_report+0x8e/0xc0 mm/kasan/report.c:491 __regmap_init+0x4540/0x4ba0 drivers/base/regmap/regmap.c:841 __devm_regmap_init+0x7a/0x100 drivers/base/regmap/regmap.c:1266 __devm_regmap_init_i2c+0x65/0x80 drivers/base/regmap/regmap-i2c.c:394 da9121_i2c_probe+0x386/0x6d1 drivers/regulator/da9121-regulator.c:1039 i2c_device_probe+0x959/0xac0 drivers/i2c/i2c-core-base.c:563
This happend when da9121 device is probe by da9121_i2c_id, but with invalid dts. Thus, chip->subvariant_id is set to -EINVAL, and later da9121_assign_chip_model() will access 'regmap' without init it.
Fix it by return -EINVAL from da9121_assign_chip_model() if 'chip->subvariant_id' is invalid.
--- drivers/regulator/da9121-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/da9121-regulator.c +2 -0
@@ -1030,6 +1030,8 @@ static int da9121_assign_chip_model(struct i2c_client *i2c, chip->variant_id =DA9121_TYPE_DA9142 ; regmap = &da9121_2ch_regmap_config;break ; +default : +return -EINVAL ; }/* Set these up for of_regulator_match call which may want .of_map_modes */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 329/879 drm/mediatek: dpi: Use mt8183 output formats for mt8192
In reply to Greg Kroah-HartmanFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 7112e0b0a58be8575547eba6596c42710922674f ]
The configuration for mt8192 was incorrectly using the output formats from mt8173. Since the output formats for mt8192 are instead the same ones as for mt8183, which require two bus samples per pixel, the pixelclock and DDR edge setting were misconfigured. This made external displays unable to show the image.
Fix the issue by correcting the output format for mt8192 to be the same as for mt8183, fixing the usage of external displays for mt8192.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +2 -2
@@ -819,8 +819,8 @@ static const struct mtk_dpi_conf mt8192_conf = { .cal_factor = mt8183_calculate_factor, .reg_h_fre_con = 0xe0, .max_clock_khz = 150000, - .output_fmts = mt8173_output_fmts, - .num_output_fmts = ARRAY_SIZE(mt8173_output_fmts), + .output_fmts = mt8183_output_fmts, + .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts), };static int mtk_dpi_probe (struct platform_device *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 330/879 signal: Deliver SIGTRAP on perf event asynchronously if blocked
In reply to Greg Kroah-HartmanFrom: Marco Elver <[email protected]>
[ Upstream commit 78ed93d72ded679e3caf0758357209887bda885f ]
With SIGTRAP on perf events, we have encountered termination of processes due to user space attempting to block delivery of SIGTRAP. Consider this case:
<set up SIGTRAP on a perf event>
...
sigset_t s;
sigemptyset(&s);
sigaddset(&s, SIGTRAP | <and others>);
sigprocmask(SIG_BLOCK, &s, ...);
...
<perf event triggers>When the perf event triggers, while SIGTRAP is blocked, force_sig_perf() will force the signal, but revert back to the default handler, thus terminating the task.
This makes sense for error conditions, but not so much for explicitly requested monitoring. However, the expectation is still that signals generated by perf events are synchronous, which will no longer be the case if the signal is blocked and delivered later.
To give user space the ability to clearly distinguish synchronous from asynchronous signals, introduce siginfo_t::si_perf_flags and TRAP_PERF_FLAG_ASYNC (opted for flags in case more binary information is required in future).
The resolution to the problem is then to (a) no longer force the signal (avoiding the terminations), but (b) tell user space via si_perf_flags if the signal was synchronous or not, so that such signals can be handled differently (e.g. let user space decide to ignore or consider the data imprecise).
The alternative of making the kernel ignore SIGTRAP on perf events if the signal is blocked may work for some usecases, but likely causes issues in others that then have to revert back to interception of sigprocmask() (which we want to avoid). [ A concrete example: when using breakpoint perf events to track data-flow, in a region of code where signals are blocked, data-flow can no longer be tracked accurately. When a relevant asynchronous signal is received after unblocking the signal, the data-flow tracking logic needs to know its state is imprecise. ]
--- arch/arm/kernel/signal.c | 1 + arch/arm64/kernel/signal.c | 1 + arch/arm64/kernel/signal32.c | 1 + arch/m68k/kernel/signal.c | 1 + arch/sparc/kernel/signal32.c | 1 + arch/sparc/kernel/signal_64.c | 1 + arch/x86/kernel/signal_compat.c | 2 ++ include/linux/compat.h | 1 + include/linux/sched/signal.h | 2 +- include/uapi/asm-generic/siginfo.h | 7 +++++++ kernel/events/core.c | 4 ++-- kernel/signal.c | 18 ++++++++++++++++-- 12 files changed, 35 insertions(+), 5 deletions(-)
arch/arm/kernel/signal.c +1 -0
@@ -708,6 +708,7 @@ static_assert(offsetof(siginfo_t, si_upper) == 0x18);static_assert (offsetof(siginfo_t , si_pkey) ==0x14 );static_assert (offsetof(siginfo_t , si_perf_data) ==0x10 );static_assert (offsetof(siginfo_t , si_perf_type) ==0x14 ); +static_assert (offsetof(siginfo_t , si_perf_flags) ==0x18 );static_assert (offsetof(siginfo_t , si_band) ==0x0c );static_assert (offsetof(siginfo_t , si_fd) ==0x10 );static_assert (offsetof(siginfo_t , si_call_addr) ==0x0c );
arch/arm64/kernel/signal.c +1 -0
@@ -1011,6 +1011,7 @@ static_assert(offsetof(siginfo_t, si_upper) == 0x28);static_assert (offsetof(siginfo_t , si_pkey) ==0x20 );static_assert (offsetof(siginfo_t , si_perf_data) ==0x18 );static_assert (offsetof(siginfo_t , si_perf_type) ==0x20 ); +static_assert (offsetof(siginfo_t , si_perf_flags) ==0x24 );static_assert (offsetof(siginfo_t , si_band) ==0x10 );static_assert (offsetof(siginfo_t , si_fd) ==0x18 );static_assert (offsetof(siginfo_t , si_call_addr) ==0x10 );
arch/arm64/kernel/signal32.c +1 -0
@@ -487,6 +487,7 @@ static_assert(offsetof(compat_siginfo_t, si_upper) == 0x18);static_assert (offsetof(compat_siginfo_t , si_pkey) ==0x14 );static_assert (offsetof(compat_siginfo_t , si_perf_data) ==0x10 );static_assert (offsetof(compat_siginfo_t , si_perf_type) ==0x14 ); +static_assert (offsetof(compat_siginfo_t , si_perf_flags) ==0x18 );static_assert (offsetof(compat_siginfo_t , si_band) ==0x0c );static_assert (offsetof(compat_siginfo_t , si_fd) ==0x10 );static_assert (offsetof(compat_siginfo_t , si_call_addr) ==0x0c );
arch/m68k/kernel/signal.c +1 -0
@@ -625,6 +625,7 @@ static inline void siginfo_build_tests(void)/* _sigfault._perf */ BUILD_BUG_ON (offsetof(siginfo_t , si_perf_data) !=0x10 );BUILD_BUG_ON (offsetof(siginfo_t , si_perf_type) !=0x14 ); +BUILD_BUG_ON (offsetof(siginfo_t , si_perf_flags) !=0x18 );/* _sigpoll */ BUILD_BUG_ON (offsetof(siginfo_t , si_band) !=0x0c );
arch/sparc/kernel/signal32.c +1 -0
@@ -779,5 +779,6 @@ static_assert(offsetof(compat_siginfo_t, si_upper) == 0x18);static_assert (offsetof(compat_siginfo_t , si_pkey) ==0x14 );static_assert (offsetof(compat_siginfo_t , si_perf_data) ==0x10 );static_assert (offsetof(compat_siginfo_t , si_perf_type) ==0x14 ); +static_assert (offsetof(compat_siginfo_t , si_perf_flags) ==0x18 );static_assert (offsetof(compat_siginfo_t , si_band) ==0x0c );static_assert (offsetof(compat_siginfo_t , si_fd) ==0x10 );
arch/sparc/kernel/signal_64.c +1 -0
@@ -590,5 +590,6 @@ static_assert(offsetof(siginfo_t, si_upper) == 0x28);static_assert (offsetof(siginfo_t , si_pkey) ==0x20 );static_assert (offsetof(siginfo_t , si_perf_data) ==0x18 );static_assert (offsetof(siginfo_t , si_perf_type) ==0x20 ); +static_assert (offsetof(siginfo_t , si_perf_flags) ==0x24 );static_assert (offsetof(siginfo_t , si_band) ==0x10 );static_assert (offsetof(siginfo_t , si_fd) ==0x14 );
arch/x86/kernel/signal_compat.c +2 -0
@@ -149,8 +149,10 @@ static inline void signal_compat_build_tests(void)BUILD_BUG_ON (offsetof(siginfo_t , si_perf_data) !=0x18 );BUILD_BUG_ON (offsetof(siginfo_t , si_perf_type) !=0x20 ); +BUILD_BUG_ON (offsetof(siginfo_t , si_perf_flags) !=0x24 );BUILD_BUG_ON (offsetof(compat_siginfo_t , si_perf_data) !=0x10 );BUILD_BUG_ON (offsetof(compat_siginfo_t , si_perf_type) !=0x14 ); +BUILD_BUG_ON (offsetof(compat_siginfo_t , si_perf_flags) !=0x18 );CHECK_CSI_OFFSET (_sigpoll);CHECK_CSI_SIZE (_sigpoll,2 *sizeof (int ));
include/linux/compat.h +1 -0
@@ -235,6 +235,7 @@ typedef struct compat_siginfo {struct {compat_ulong_t _data;u32 _type; +u32 _flags; } _perf; }; } _sigfault;
include/linux/sched/signal.h +1 -1
@@ -320,7 +320,7 @@ int send_sig_mceerr(int code, void __user *, short, struct task_struct *);int force_sig_bnderr (void __user *addr,void __user *lower,void __user *upper);int force_sig_pkuerr (void __user *addr,u32 pkey); -int force_sig_perf (void __user *addr,u32 type,u64 sig_data); +int send_sig_perf (void __user *addr,u32 type,u64 sig_data);int force_sig_ptrace_errno_trap (int errno,void __user *addr);int force_sig_fault_trapno (int sig,int code,void __user *addr,int trapno);
include/uapi/asm-generic/siginfo.h +7 -0
@@ -99,6 +99,7 @@ union __sifields {struct {unsigned long _data;__u32 _type; +__u32 _flags; } _perf; }; } _sigfault;
@@ -164,6 +165,7 @@ typedef struct siginfo {#define si_pkey _sifields._sigfault._addr_pkey._pkey#define si_perf_data _sifields._sigfault._perf._data#define si_perf_type _sifields._sigfault._perf._type +#define si_perf_flags _sifields._sigfault._perf._flags#define si_band _sifields._sigpoll._band#define si_fd _sifields._sigpoll._fd#define si_call_addr _sifields._sigsys._call_addr
@@ -270,6 +272,11 @@ typedef struct siginfo {* that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP) */ +/* +* Flags for si_perf_flags if SIGTRAP si_code is TRAP_PERF. +*/ +#define TRAP_PERF_FLAG_ASYNC (1u << 0) +/* * SIGCHLD si_codes */
kernel/events/core.c +2 -2
@@ -6428,8 +6428,8 @@ static void perf_sigtrap(struct perf_event *event)if (current->flags &PF_EXITING )return ; -force_sig_perf ((void __user *)event->pending_addr, - event->attr.type, event->attr.sig_data); +send_sig_perf ((void __user *)event->pending_addr, + event->attr.type, event->attr.sig_data); }static void perf_pending_event_disable (struct perf_event *event)
kernel/signal.c +16 -2
@@ -1805,7 +1805,7 @@ int force_sig_pkuerr(void __user *addr, u32 pkey) }#endif -int force_sig_perf (void __user *addr,u32 type,u64 sig_data) +int send_sig_perf (void __user *addr,u32 type,u64 sig_data) {struct kernel_siginfo info;
@@ -1817,7 +1817,18 @@ int force_sig_perf(void __user *addr, u32 type, u64 sig_data) info.si_perf_data = sig_data; info.si_perf_type = type; -return force_sig_info (&info); +/* +* Signals generated by perf events should not terminate the whole +* process if SIGTRAP is blocked, however, delivering the signal +* asynchronously is better than not delivering at all. But tell user +* space if the signal was asynchronous, so it can clearly be +* distinguished from normal synchronous ones. +*/ + info.si_perf_flags =sigismember (¤t->blocked, info.si_signo) ? +TRAP_PERF_FLAG_ASYNC : +0 ; + +return send_sig_info (info.si_signo, &info, current); }/**
@@ -3432,6 +3443,7 @@ void copy_siginfo_to_external32(struct compat_siginfo *to, to->si_addr =ptr_to_compat (from->si_addr); to->si_perf_data = from->si_perf_data; to->si_perf_type = from->si_perf_type; + to->si_perf_flags = from->si_perf_flags;break ;case SIL_CHLD : to->si_pid = from->si_pid;
@@ -3509,6 +3521,7 @@ static int post_copy_siginfo_from_user32(kernel_siginfo_t *to, to->si_addr =compat_ptr (from->si_addr); to->si_perf_data = from->si_perf_data; to->si_perf_type = from->si_perf_type; + to->si_perf_flags = from->si_perf_flags;break ;case SIL_CHLD : to->si_pid = from->si_pid;
@@ -4722,6 +4735,7 @@ static inline void siginfo_buildtime_checks(void)CHECK_OFFSET (si_pkey);CHECK_OFFSET (si_perf_data);CHECK_OFFSET (si_perf_type); +CHECK_OFFSET (si_perf_flags);/* sigpoll */ CHECK_OFFSET (si_band);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 331/879 sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
In reply to Greg Kroah-HartmanFrom: Chengming Zhou <[email protected]>
[ Upstream commit 64eaf50731ac0a8c76ce2fedd50ef6652aabc5ff ]
Since commit 23127296889f ("sched/fair: Update scale invariance of PELT") change to use rq_clock_pelt() instead of rq_clock_task(), we should also use rq_clock_pelt() for throttled_clock_task_time and throttled_clock_task accounting to get correct cfs_rq_clock_pelt() of throttled cfs_rq. And rename throttled_clock_task(_time) to be clock_pelt rather than clock_task.
--- kernel/sched/fair.c | 8 ++++---- kernel/sched/pelt.h | 4 ++-- kernel/sched/sched.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
kernel/sched/fair.c +4 -4
@@ -4846,8 +4846,8 @@ static int tg_unthrottle_up(struct task_group *tg, void *data) cfs_rq->throttle_count--;if (!cfs_rq->throttle_count) { - cfs_rq->throttled_clock_task_time +=rq_clock_task (rq) - - cfs_rq->throttled_clock_task; + cfs_rq->throttled_clock_pelt_time +=rq_clock_pelt (rq) - + cfs_rq->throttled_clock_pelt;/* Add cfs_rq with load or one or more already running entities to the list */ if (!cfs_rq_is_decayed (cfs_rq) || cfs_rq->nr_running)
@@ -4864,7 +4864,7 @@ static int tg_throttle_down(struct task_group *tg, void *data)/* group is entering throttled state, stop time */ if (!cfs_rq->throttle_count) { - cfs_rq->throttled_clock_task =rq_clock_task (rq); + cfs_rq->throttled_clock_pelt =rq_clock_pelt (rq);list_del_leaf_cfs_rq (cfs_rq); } cfs_rq->throttle_count++;
@@ -5308,7 +5308,7 @@ static void sync_throttle(struct task_group *tg, int cpu) pcfs_rq = tg->parent->cfs_rq[cpu]; cfs_rq->throttle_count = pcfs_rq->throttle_count; - cfs_rq->throttled_clock_task =rq_clock_task (cpu_rq (cpu)); + cfs_rq->throttled_clock_pelt =rq_clock_pelt (cpu_rq (cpu)); }/* conditionally throttle active cfs_rq's from put_prev_entity() */
kernel/sched/pelt.h +2 -2
@@ -145,9 +145,9 @@ static inline u64 rq_clock_pelt(struct rq *rq)static inline u64 cfs_rq_clock_pelt (struct cfs_rq *cfs_rq) {if (unlikely (cfs_rq->throttle_count)) -return cfs_rq->throttled_clock_task - cfs_rq->throttled_clock_task_time; +return cfs_rq->throttled_clock_pelt - cfs_rq->throttled_clock_pelt_time; -return rq_clock_pelt (rq_of (cfs_rq)) - cfs_rq->throttled_clock_task_time; +return rq_clock_pelt (rq_of (cfs_rq)) - cfs_rq->throttled_clock_pelt_time; }#else static inline u64 cfs_rq_clock_pelt (struct cfs_rq *cfs_rq)
kernel/sched/sched.h +2 -2
@@ -603,8 +603,8 @@ struct cfs_rq {s64 runtime_remaining;u64 throttled_clock; -u64 throttled_clock_task; -u64 throttled_clock_task_time; +u64 throttled_clock_pelt; +u64 throttled_clock_pelt_time;int throttled;int throttle_count;struct list_head throttled_list;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 332/879 sched/psi: report zeroes for CPU full at the system level
In reply to Greg Kroah-HartmanFrom: Chengming Zhou <[email protected]>
[ Upstream commit 890d550d7dbac7a31ecaa78732aa22be282bb6b8 ]
Martin find it confusing when look at the /proc/pressure/cpu output, and found no hint about that CPU "full" line in psi Documentation.
% cat /proc/pressure/cpu
some avg10=0.92 avg60=0.91 avg300=0.73 total=933490489 full avg10=0.22 avg60=0.23 avg300=0.16 total=358783277
The PSI_CPU_FULL state is introduced by commit e7fcd7622823 ("psi: Add PSI_CPU_FULL state"), which mainly for cgroup level, but also counted at the system level as a side effect.
Naturally, the FULL state doesn't exist for the CPU resource at the system level. These "full" numbers can come from CPU idle schedule latency. For example, t1 is the time when task wakeup on an idle CPU, t2 is the time when CPU pick and switch to it. The delta of (t2 - t1) will be in CPU_FULL state.
Another case all processes can be stalled is when all cgroups have been throttled at the same time, which unlikely to happen.
Anyway, CPU_FULL metric is meaningless and confusing at the system level. So this patch will report zeroes for CPU full at the system level, and update psi Documentation accordingly.
--- Documentation/accounting/psi.rst | 9 ++++----- kernel/sched/psi.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-)
Documentation/accounting/psi.rst +4 -5
@@ -37,11 +37,7 @@ Pressure interface Pressure information for each resource is exported through the respective file in /proc/pressure/ -- cpu, memory, and io. -The format for CPU is as such:: - - some avg10=0.00 avg60=0.00 avg300=0.00 total=0 - -and for memory and IO:: +The format is as such:: some avg10=0.00 avg60=0.00 avg300=0.00 total=0 full avg10=0.00 avg60=0.00 avg300=0.00 total=0
@@ -58,6 +54,9 @@ situation from a state where some tasks are stalled but the CPU is still doing productive work. As such, time spent in this subset of the stall state is tracked separately and exported in the "full" averages. +CPU full is undefined at the system level, but has been reported +since 5.13, so it is set to zero for backward compatibility. + The ratios (in %) are tracked as recent trends over ten, sixty, and three hundred second windows, which gives insight into short term events as well as medium and long term trends. The total absolute stall time
kernel/sched/psi.c +9 -6
@@ -1060,14 +1060,17 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)mutex_unlock (&group->avgs_lock);for (full =0 ; full <2 ; full++) { -unsigned long avg[3 ]; -u64 total; +unsigned long avg[3 ] = {0 , }; +u64 total =0 ;int w; -for (w =0 ; w <3 ; w++) - avg[w] = group->avg[res *2 + full][w]; - total =div_u64 (group->total[PSI_AVGS ][res *2 + full], -NSEC_PER_USEC ); +/* CPU FULL is undefined at the system level */ +if (!(group == &psi_system && res ==PSI_CPU && full)) { +for (w =0 ; w <3 ; w++) + avg[w] = group->avg[res *2 + full][w]; + total =div_u64 (group->total[PSI_AVGS ][res *2 + full], +NSEC_PER_USEC ); + } seq_printf(m, "%s avg10=%lu.%02lu avg60=%lu.%02lu avg300=%lu.%02lu total=%llu\n", full ? "full" : "some",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 333/879 spi: img-spfi: Fix pm_runtime_get_sync() error checking
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit cc470d55343056d6b2a5c32e10e0aad06f324078 ]
If the device is already in a runtime PM enabled state pm_runtime_get_sync() will return 1, so a test for negative value should be used to check for errors.
--- drivers/spi/spi-img-spfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-img-spfi.c +1 -1
@@ -731,7 +731,7 @@ static int img_spfi_resume(struct device *dev)int ret; ret =pm_runtime_get_sync (dev); -if (ret) { +if (ret <0 ) {pm_runtime_put_noidle (dev);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 334/879 drm/bridge: Fix it6505 Kconfig DRM_DP_AUX_BUS dependency
In reply to Greg Kroah-HartmanFrom: Robert Foss <[email protected]>
[ Upstream commit c5060b09f460fc83846d361018a124fcade1b9e9 ]
it6505 depends on DRM_DP_AUX_BUS, the kconfig for it6505 should reflect this dependency using 'select'.
--- drivers/gpu/drm/bridge/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/Kconfig +1 -0
@@ -77,6 +77,7 @@ config DRM_DISPLAY_CONNECTOR config DRM_ITE_IT6505 tristate "ITE IT6505 DisplayPort bridge" depends on OF + select DRM_DP_AUX_BUS select DRM_DP_HELPER select DRM_KMS_HELPER select DRM_DP_HELPER
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 335/879 cpufreq: Fix possible race in cpufreq online error path
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
[ Upstream commit f346e96267cd76175d6c201b40f770c0116a8a04 ]
When cpufreq online fails, the policy->cpus mask is not cleared and policy->rwsem is released too early, so the driver can be invoked via the cpuinfo_cur_freq sysfs attribute while its ->offline() or ->exit() callbacks are being run.
Take policy->clk as an example:
static int cpufreq_online(unsigned int cpu)
{
...
// policy->cpus != 0 at this time
down_write(&policy->rwsem);
ret = cpufreq_add_dev_interface(policy);
up_write(&policy->rwsem);
return 0;
out_destroy_policy:
for_each_cpu(j, policy->real_cpus)
remove_cpu_dev_symlink(policy, get_cpu_device(j));
up_write(&policy->rwsem);
...
out_exit_policy:
if (cpufreq_driver->exit)
cpufreq_driver->exit(policy);
clk_put(policy->clk);
// policy->clk is a wild pointer
...
^
|
Another process access
__cpufreq_get
cpufreq_verify_current_freq
cpufreq_generic_get
// acces wild pointer of policy->clk;
|
|
out_offline_policy: |
cpufreq_policy_free(policy); |
// deleted here, and will wait for no body reference
cpufreq_policy_put_kobj(policy);
}Address this by modifying cpufreq_online() to release policy->rwsem in the error path after the driver callbacks have run and to clear policy->cpus before releasing the semaphore.
--- drivers/cpufreq/cpufreq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +3 -2
@@ -1534,8 +1534,6 @@ static int cpufreq_online(unsigned int cpu)for_each_cpu (j, policy->real_cpus)remove_cpu_dev_symlink (policy,get_cpu_device (j)); -up_write (&policy->rwsem); - out_offline_policy:if (cpufreq_driver->offline) cpufreq_driver->offline (policy);
@@ -1544,6 +1542,9 @@ static int cpufreq_online(unsigned int cpu)if (cpufreq_driver->exit) cpufreq_driver->exit (policy); +cpumask_clear (policy->cpus); +up_write (&policy->rwsem); + out_free_policy:cpufreq_policy_free (policy);return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 336/879 printk: add missing memory barrier to wake_up_klogd()
In reply to Greg Kroah-HartmanFrom: John Ogness <[email protected]>
[ Upstream commit 1f5d783094cf28b4905f51cad846eb5d1db6673e ]
It is important that any new records are visible to preparing waiters before the waker checks if the wait queue is empty. Otherwise it is possible that:
- there are new records available
- the waker sees an empty wait queue and does not wake
- the preparing waiter sees no new records and begins to wait
This is exactly the problem that the function description of waitqueue_active() warns about.
Use wq_has_sleeper() instead of waitqueue_active() because it includes the necessary full memory barrier.
--- kernel/printk/printk.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-)
kernel/printk/printk.c +36 -3
@@ -746,8 +746,19 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, goto out; } +/* +* Guarantee this task is visible on the waitqueue before +* checking the wake condition. +* +* The full memory barrier within set_current_state() of +* prepare_to_wait_event() pairs with the full memory barrier +* within wq_has_sleeper(). +* +* This pairs with wake_up_klogd:A. +*/ ret =wait_event_interruptible (log_wait, -prb_read_valid (prb,atomic64_read (&user->seq), r)); +prb_read_valid (prb, +atomic64_read (&user->seq), r));/* LMM(devkmsg_read:A) */ if (ret) goto out; }
@@ -1513,7 +1524,18 @@ static int syslog_print(char __user *buf, int size) seq = syslog_seq;mutex_unlock (&syslog_lock); - len =wait_event_interruptible (log_wait,prb_read_valid (prb, seq,NULL )); +/* +* Guarantee this task is visible on the waitqueue before +* checking the wake condition. +* +* The full memory barrier within set_current_state() of +* prepare_to_wait_event() pairs with the full memory barrier +* within wq_has_sleeper(). +* +* This pairs with wake_up_klogd:A. +*/ + len =wait_event_interruptible (log_wait, +prb_read_valid (prb, seq,NULL ));/* LMM(syslog_print:A) */ mutex_lock (&syslog_lock);if (len)
@@ -3316,7 +3338,18 @@ void wake_up_klogd(void)return ;preempt_disable (); -if (waitqueue_active (&log_wait)) { +/* +* Guarantee any new records can be seen by tasks preparing to wait +* before this context checks if the wait queue is empty. +* +* The full memory barrier within wq_has_sleeper() pairs with the full +* memory barrier within set_current_state() of +* prepare_to_wait_event(), which is called after ___wait_event() adds +* the waiter but before it has checked the wait condition. +* +* This pairs with devkmsg_read:A and syslog_print:A. +*/ +if (wq_has_sleeper (&log_wait)) {/* LMM(wake_up_klogd:A) */ this_cpu_or (printk_pending,PRINTK_PENDING_WAKEUP );irq_work_queue (this_cpu_ptr (&wake_up_klogd_work)); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 337/879 printk: wake waiters for safe and NMI contexts
In reply to Greg Kroah-HartmanFrom: John Ogness <[email protected]>
[ Upstream commit 5341b93dea8c39d7612f7a227015d4b1d5cf30db ]
When printk() is called from safe or NMI contexts, it will directly store the record (vprintk_store()) and then defer the console output. However, defer_console_output() only causes console printing and does not wake any waiters of new records.
Wake waiters from defer_console_output() so that they also are aware of the new records from safe and NMI contexts.
--- kernel/printk/printk.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
kernel/printk/printk.c +16 -12
@@ -754,7 +754,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,* prepare_to_wait_event() pairs with the full memory barrier * within wq_has_sleeper(). * -* This pairs with wake_up_klogd:A. +* This pairs with __wake_up_klogd:A. */ ret = wait_event_interruptible(log_wait, prb_read_valid(prb,
@@ -1532,7 +1532,7 @@ static int syslog_print(char __user *buf, int size)* prepare_to_wait_event() pairs with the full memory barrier * within wq_has_sleeper(). * -* This pairs with wake_up_klogd:A. +* This pairs with __wake_up_klogd:A. */ len =wait_event_interruptible (log_wait,prb_read_valid (prb, seq,NULL ));/* LMM(syslog_print:A) */
@@ -3332,7 +3332,7 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work) static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) =IRQ_WORK_INIT_LAZY (wake_up_klogd_work_func); -void wake_up_klogd (void ) +static void __wake_up_klogd (int val) {if (!printk_percpu_data_ready ())return ;
@@ -3349,22 +3349,26 @@ void wake_up_klogd(void)* * This pairs with devkmsg_read:A and syslog_print:A. */ -if (wq_has_sleeper (&log_wait)) {/* LMM(wake_up_klogd:A) */ -this_cpu_or (printk_pending,PRINTK_PENDING_WAKEUP ); +if (wq_has_sleeper (&log_wait) ||/* LMM(__wake_up_klogd:A) */ + (val &PRINTK_PENDING_OUTPUT )) { +this_cpu_or (printk_pending, val);irq_work_queue (this_cpu_ptr (&wake_up_klogd_work)); }preempt_enable (); } -void defer_console_output (void ) +void wake_up_klogd (void ) { -if (!printk_percpu_data_ready ()) -return ; +__wake_up_klogd (PRINTK_PENDING_WAKEUP ); +} -preempt_disable (); -this_cpu_or (printk_pending,PRINTK_PENDING_OUTPUT ); -irq_work_queue (this_cpu_ptr (&wake_up_klogd_work)); -preempt_enable (); +void defer_console_output (void ) +{ +/* +* New messages may have been added directly to the ringbuffer +* using vprintk_store(), so wake any waiters as well. +*/ +__wake_up_klogd (PRINTK_PENDING_WAKEUP |PRINTK_PENDING_OUTPUT ); }void printk_trigger_flush (void )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 338/879 ath9k_htc: fix potential out of bounds access with invalid rxstatus->rs_keyix
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2dc509305cf956381532792cb8dceef2b1504765 ]
The "rxstatus->rs_keyix" eventually gets passed to test_bit() so we need to ensure that it is within the bitmap.
drivers/net/wireless/ath/ath9k/common.c:46 ath9k_cmn_rx_accept()
error: passing untrusted data 'rx_stats->rs_keyix' to 'test_bit()'
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +8 -0
@@ -1016,6 +1016,14 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, goto rx_next; } +if (rxstatus->rs_keyix >=ATH_KEYMAX && + rxstatus->rs_keyix !=ATH9K_RXKEYIX_INVALID ) { +ath_dbg (common,ANY , +"Invalid keyix, dropping (keyix: %d)\n" , + rxstatus->rs_keyix); + goto rx_next; + } +/* Get the RX status information */ memset (rx_status,0 ,sizeof (struct ieee80211_rx_status ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 339/879 media: i2c: max9286: fix kernel oops when removing module
In reply to Greg Kroah-HartmanFrom: Laurentiu Palcu <[email protected]>
[ Upstream commit 365ab7ebc24eebb42b9e020aeb440d51af8960cd ]
When removing the max9286 module we get a kernel oops:
Unable to handle kernel paging request at virtual address 000000aa00000094
Mem abort info:
ESR = 0x96000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000880d85000 [000000aa00000094] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: fsl_jr_uio caam_jr rng_core libdes caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine max9271 authenc crct10dif_ce mxc_jpeg_encdec CPU: 2 PID: 713 Comm: rmmod Tainted: G C 5.15.5-00057-gaebcd29c8ed7-dirty #5 Hardware name: Freescale i.MX8QXP MEK (DT) pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : i2c_mux_del_adapters+0x24/0xf0 lr : max9286_remove+0x28/0xd0 [max9286]
sp : ffff800013a9bbf0
x29: ffff800013a9bbf0 x28: ffff00080b6da940 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
x23: ffff000801a5b970 x22: ffff0008048b0890 x21: ffff800009297000
x20: ffff0008048b0f70 x19: 000000aa00000064 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000014 x13: 0000000000000000 x12: ffff000802da49e8
x11: ffff000802051918 x10: ffff000802da4920 x9 : ffff000800030098 x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : fefefeff6364626d x5 : 8080808000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffffffffffffffff x1 : ffff00080b6da940 x0 : 0000000000000000
Call trace: i2c_mux_del_adapters+0x24/0xf0 max9286_remove+0x28/0xd0 [max9286] i2c_device_remove+0x40/0x110 __device_release_driver+0x188/0x234 driver_detach+0xc4/0x150 bus_remove_driver+0x60/0xe0 driver_unregister+0x34/0x64 i2c_del_driver+0x58/0xa0 max9286_i2c_driver_exit+0x1c/0x490 [max9286] __arm64_sys_delete_module+0x194/0x260 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0xd4/0xfc do_el0_svc+0x2c/0x94 el0_svc+0x28/0x80 el0t_64_sync_handler+0xa8/0x130 el0t_64_sync+0x1a0/0x1a4
The Oops happens because the I2C client data does not point to max9286_priv anymore but to v4l2_subdev. The change happened in max9286_init() which calls v4l2_i2c_subdev_init() later on...
Besides fixing the max9286_remove() function, remove the call to i2c_set_clientdata() in max9286_probe(), to avoid confusion, and make the necessary changes to max9286_init() so that it doesn't have to use i2c_get_clientdata() in order to fetch the pointer to priv.
--- drivers/media/i2c/max9286.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/media/i2c/max9286.c +7 -12
@@ -1147,22 +1147,18 @@ static int max9286_poc_enable(struct max9286_priv *priv, bool enable)return ret; } -static int max9286_init (struct device *dev) +static int max9286_init (struct max9286_priv *priv) { -struct max9286_priv *priv; -struct i2c_client *client; +struct i2c_client *client = priv->client;int ret; - client =to_i2c_client (dev); - priv =i2c_get_clientdata (client); - ret =max9286_poc_enable (priv, true);if (ret)return ret; ret =max9286_setup (priv);if (ret) { -dev_err (dev,"Unable to setup max9286\n" ); +dev_err (&client->dev,"Unable to setup max9286\n" ); goto err_poc_disable; }
@@ -1172,13 +1168,13 @@ static int max9286_init(struct device *dev)*/ ret =max9286_v4l2_register (priv);if (ret) { -dev_err (dev,"Failed to register with V4L2\n" ); +dev_err (&client->dev,"Failed to register with V4L2\n" ); goto err_poc_disable; } ret =max9286_i2c_mux_init (priv);if (ret) { -dev_err (dev,"Unable to initialize I2C multiplexer\n" ); +dev_err (&client->dev,"Unable to initialize I2C multiplexer\n" ); goto err_v4l2_register; }
@@ -1333,7 +1329,6 @@ static int max9286_probe(struct i2c_client *client)mutex_init (&priv->mutex); priv->client = client; -i2c_set_clientdata (client, priv); priv->gpiod_pwdn =devm_gpiod_get_optional (&client->dev,"enable" ,GPIOD_OUT_HIGH );
@@ -1369,7 +1364,7 @@ static int max9286_probe(struct i2c_client *client)if (ret) goto err_powerdown; - ret =max9286_init (&client->dev); + ret =max9286_init (priv);if (ret <0 ) goto err_cleanup_dt;
@@ -1385,7 +1380,7 @@ static int max9286_probe(struct i2c_client *client)static int max9286_remove (struct i2c_client *client) { -struct max9286_priv *priv =i2c_get_clientdata (client); +struct max9286_priv *priv =sd_to_max9286 (i2c_get_clientdata (client));i2c_mux_del_adapters (priv->mux);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 340/879 media: amphion: fix decoders interlaced field
In reply to Greg Kroah-HartmanFrom: Ming Qian <[email protected]>
[ Upstream commit d9a6a70d65cd7d25bad00580157ad660330023d8 ]
For interlaced frame, the amphion vpu will store the two fields sequential into one buffer, top-bottom order so the field should be set to V4L2_FIELD_SEQ_TB.
fix the previous bug that set it to V4L2_FIELD_SEQ_BT wrongly.
--- drivers/media/platform/amphion/vdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/amphion/vdec.c +1 -1
@@ -782,7 +782,7 @@ static void vdec_init_fmt(struct vpu_inst *inst)if (vdec->codec_info.progressive) inst->cap_format.field =V4L2_FIELD_NONE ;else - inst->cap_format.field =V4L2_FIELD_SEQ_BT ; + inst->cap_format.field =V4L2_FIELD_SEQ_TB ;if (vdec->codec_info.color_primaries ==V4L2_COLORSPACE_DEFAULT ) vdec->codec_info.color_primaries =V4L2_COLORSPACE_REC709 ;if (vdec->codec_info.transfer_chars ==V4L2_XFER_FUNC_DEFAULT )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 341/879 media: hantro: Implement support for encoder commands
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit daf3999c12dcef14151710052fca9adfbc3967bc ]
The V4L2 stateful encoder uAPI specification requires that drivers support the ENCODER_CMD ioctl to allow draining of buffers. This however was not implemented, and causes issues for some userspace applications.
Implement support for the ENCODER_CMD ioctl using v4l2-mem2mem helpers. This is entirely based on existing code found in the vicodec test driver.
--- drivers/staging/media/hantro/hantro_drv.c | 17 ++++++- drivers/staging/media/hantro/hantro_v4l2.c | 59 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-)
drivers/staging/media/hantro/hantro_drv.c +15 -2
@@ -56,6 +56,10 @@ dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts)return hantro_get_dec_buf_addr (ctx, buf); } +static const struct v4l2_event hantro_eos_event = { + .type =V4L2_EVENT_EOS +}; +static void hantro_job_finish_no_pm (struct hantro_dev *vpu,struct hantro_ctx *ctx,enum vb2_buffer_state result)
@@ -73,6 +77,12 @@ static void hantro_job_finish_no_pm(struct hantro_dev *vpu, src->sequence = ctx->sequence_out++; dst->sequence = ctx->sequence_cap++; +if (v4l2_m2m_is_last_draining_src_buf (ctx->fh.m2m_ctx, src)) { + dst->flags |=V4L2_BUF_FLAG_LAST ; +v4l2_event_queue_fh (&ctx->fh, &hantro_eos_event); +v4l2_m2m_mark_stopped (ctx->fh.m2m_ctx); + } +v4l2_m2m_buf_done_and_job_finish (ctx->dev->m2m_dev, ctx->fh.m2m_ctx, result); }
@@ -809,10 +819,13 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)snprintf (vfd->name,sizeof (vfd->name),"%s-%s" , match->compatible, funcid ==MEDIA_ENT_F_PROC_VIDEO_ENCODER ?"enc" :"dec" ); -if (funcid ==MEDIA_ENT_F_PROC_VIDEO_ENCODER ) +if (funcid ==MEDIA_ENT_F_PROC_VIDEO_ENCODER ) { vpu->encoder = func; -else + }else { vpu->decoder = func; +v4l2_disable_ioctl (vfd,VIDIOC_TRY_ENCODER_CMD ); +v4l2_disable_ioctl (vfd,VIDIOC_ENCODER_CMD ); + }video_set_drvdata (vfd, vpu);
drivers/staging/media/hantro/hantro_v4l2.c +59 -0
89 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 342/879 media: hantro: Empty encoder capture buffers by default
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 309373a3571ef7175bd9da0c9b13476a718e8478 ]
The payload size for encoder capture buffers is set by the driver upon finishing encoding each frame, based on the encoded length returned from hardware, and whatever header and padding length used. Setting a non-zero default serves no real purpose, and also causes issues if the capture buffer is returned to userspace unused, confusing the application.
Instead, always set the payload size to 0 for encoder capture buffers when preparing them.
--- drivers/staging/media/hantro/hantro_v4l2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/media/hantro/hantro_v4l2.c +6 -2
@@ -768,8 +768,12 @@ static int hantro_buf_prepare(struct vb2_buffer *vb)* (for OUTPUT buffers, if userspace passes 0 bytesused, v4l2-core sets * it to buffer length). */ -if (V4L2_TYPE_IS_CAPTURE (vq->type)) -vb2_set_plane_payload (vb,0 , pix_fmt->plane_fmt[0 ].sizeimage); +if (V4L2_TYPE_IS_CAPTURE (vq->type)) { +if (ctx->is_encoder) +vb2_set_plane_payload (vb,0 ,0 ); +else +vb2_set_plane_payload (vb,0 , pix_fmt->plane_fmt[0 ].sizeimage); + }return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 343/879 media: imx: imx-mipi-csis: Rename csi_state to mipi_csis_device
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit c1cc03eafd319369075dd66b091bd8d309a5b726 ]
Usage of "state" for the device-specific data structure is confusing, as it can also refer to the subdev state. Rename the structure to mipi_csis_device, and the corresponding state variables to csis.
--- drivers/media/platform/nxp/imx-mipi-csis.c | 553 +++++++++++---------- 1 file changed, 277 insertions(+), 276 deletions(-)
drivers/media/platform/nxp/imx-mipi-csis.c +277 -276
@@ -310,7 +310,7 @@ struct mipi_csis_info {unsigned int num_clocks; }; -struct csi_state { +struct mipi_csis_device {struct device *dev;void __iomem *regs;struct clk_bulk_data *clks;
@@ -487,59 +487,60 @@ static const struct csis_pix_format *find_csis_format(u32 code)* Hardware configuration */ -static inline u32 mipi_csis_read (struct csi_state *state,u32 reg) +static inline u32 mipi_csis_read (struct mipi_csis_device *csis,u32 reg) { -return readl (state->regs + reg); +return readl (csis->regs + reg); } -static inline void mipi_csis_write (struct csi_state *state,u32 reg,u32 val) +static inline void mipi_csis_write (struct mipi_csis_device *csis,u32 reg, +u32 val) { -writel (val, state->regs + reg); +writel (val, csis->regs + reg); } -static void mipi_csis_enable_interrupts (struct csi_state *state,bool on) +static void mipi_csis_enable_interrupts (struct mipi_csis_device *csis,bool on) { -mipi_csis_write (state,MIPI_CSIS_INT_MSK , on ?0xffffffff :0 ); -mipi_csis_write (state,MIPI_CSIS_DBG_INTR_MSK , on ?0xffffffff :0 ); +mipi_csis_write (csis,MIPI_CSIS_INT_MSK , on ?0xffffffff :0 ); +mipi_csis_write (csis,MIPI_CSIS_DBG_INTR_MSK , on ?0xffffffff :0 ); } -static void mipi_csis_sw_reset (struct csi_state *state) +static void mipi_csis_sw_reset (struct mipi_csis_device *csis) { -u32 val =mipi_csis_read (state,MIPI_CSIS_CMN_CTRL ); +u32 val =mipi_csis_read (csis,MIPI_CSIS_CMN_CTRL ); -mipi_csis_write (state,MIPI_CSIS_CMN_CTRL , +mipi_csis_write (csis,MIPI_CSIS_CMN_CTRL , val |MIPI_CSIS_CMN_CTRL_RESET );usleep_range (10 ,20 ); } -static void mipi_csis_system_enable (struct csi_state *state,int on) +static void mipi_csis_system_enable (struct mipi_csis_device *csis,int on) {u32 val, mask; - val =mipi_csis_read (state,MIPI_CSIS_CMN_CTRL ); + val =mipi_csis_read (csis,MIPI_CSIS_CMN_CTRL );if (on) val |=MIPI_CSIS_CMN_CTRL_ENABLE ;else val &= ~MIPI_CSIS_CMN_CTRL_ENABLE ; -mipi_csis_write (state,MIPI_CSIS_CMN_CTRL , val); +mipi_csis_write (csis,MIPI_CSIS_CMN_CTRL , val); - val =mipi_csis_read (state,MIPI_CSIS_DPHY_CMN_CTRL ); + val =mipi_csis_read (csis,MIPI_CSIS_DPHY_CMN_CTRL ); val &= ~MIPI_CSIS_DPHY_CMN_CTRL_ENABLE ;if (on) { - mask = (1 << (state->bus.num_data_lanes +1 )) -1 ; + mask = (1 << (csis->bus.num_data_lanes +1 )) -1 ; val |= (mask &MIPI_CSIS_DPHY_CMN_CTRL_ENABLE ); } -mipi_csis_write (state,MIPI_CSIS_DPHY_CMN_CTRL , val); +mipi_csis_write (csis,MIPI_CSIS_DPHY_CMN_CTRL , val); } -/* Called with the state.lock mutex held */ -static void __mipi_csis_set_format (struct csi_state *state) +/* Called with the csis.lock mutex held */ +static void __mipi_csis_set_format (struct mipi_csis_device *csis) { -struct v4l2_mbus_framefmt *mf = &state->format_mbus[CSIS_PAD_SINK ]; +struct v4l2_mbus_framefmt *mf = &csis->format_mbus[CSIS_PAD_SINK ];u32 val;/* Color format */ - val =mipi_csis_read (state,MIPI_CSIS_ISP_CONFIG_CH (0 )); + val =mipi_csis_read (csis,MIPI_CSIS_ISP_CONFIG_CH (0 )); val &= ~(MIPI_CSIS_ISPCFG_ALIGN_32BIT |MIPI_CSIS_ISPCFG_FMT_MASK |MIPI_CSIS_ISPCFG_PIXEL_MASK );
@@ -556,28 +557,28 @@ static void __mipi_csis_set_format(struct csi_state *state)* * TODO: Verify which other formats require DUAL (or QUAD) modes. */ -if (state->csis_fmt->data_type ==MIPI_CSI2_DATA_TYPE_YUV422_8 ) +if (csis->csis_fmt->data_type ==MIPI_CSI2_DATA_TYPE_YUV422_8 ) val |=MIPI_CSIS_ISPCFG_PIXEL_MODE_DUAL ; - val |=MIPI_CSIS_ISPCFG_FMT (state->csis_fmt->data_type); -mipi_csis_write (state,MIPI_CSIS_ISP_CONFIG_CH (0 ), val); + val |=MIPI_CSIS_ISPCFG_FMT (csis->csis_fmt->data_type); +mipi_csis_write (csis,MIPI_CSIS_ISP_CONFIG_CH (0 ), val);/* Pixel resolution */ val = mf->width | (mf->height <<16 ); -mipi_csis_write (state,MIPI_CSIS_ISP_RESOL_CH (0 ), val); +mipi_csis_write (csis,MIPI_CSIS_ISP_RESOL_CH (0 ), val); } -static int mipi_csis_calculate_params (struct csi_state *state) +static int mipi_csis_calculate_params (struct mipi_csis_device *csis) {s64 link_freq;u32 lane_rate;/* Calculate the line rate from the pixel rate. */ - link_freq =v4l2_get_link_freq (state->src_sd->ctrl_handler, - state->csis_fmt->width, - state->bus.num_data_lanes *2 ); + link_freq =v4l2_get_link_freq (csis->src_sd->ctrl_handler, + csis->csis_fmt->width, + csis->bus.num_data_lanes *2 );if (link_freq <0 ) { -dev_err (state->dev,"Unable to obtain link frequency: %d\n" , +dev_err (csis->dev,"Unable to obtain link frequency: %d\n" , (int )link_freq);return link_freq; }
@@ -585,7 +586,7 @@ static int mipi_csis_calculate_params(struct csi_state *state) lane_rate = link_freq *2 ;if (lane_rate <80000000 || lane_rate >1500000000 ) { -dev_dbg (state->dev,"Out-of-bound lane rate %u\n" , lane_rate); +dev_dbg (csis->dev,"Out-of-bound lane rate %u\n" , lane_rate);return -EINVAL ; }
@@ -595,57 +596,57 @@ static int mipi_csis_calculate_params(struct csi_state *state)* (which is documented as corresponding to CSI-2 v0.87 to v1.00) until * we figure out how to compute it correctly. */ - state->hs_settle = (lane_rate -5000000 ) /45000000 ; - state->clk_settle =0 ; + csis->hs_settle = (lane_rate -5000000 ) /45000000 ; + csis->clk_settle =0 ; -dev_dbg (state->dev,"lane rate %u, Tclk_settle %u, Ths_settle %u\n" , - lane_rate, state->clk_settle, state->hs_settle); +dev_dbg (csis->dev,"lane rate %u, Tclk_settle %u, Ths_settle %u\n" , + lane_rate, csis->clk_settle, csis->hs_settle); -if (state->debug.hs_settle <0xff ) { -dev_dbg (state->dev,"overriding Ths_settle with %u\n" , - state->debug.hs_settle); - state->hs_settle = state->debug.hs_settle; +if (csis->debug.hs_settle <0xff ) { +dev_dbg (csis->dev,"overriding Ths_settle with %u\n" , + csis->debug.hs_settle); + csis->hs_settle = csis->debug.hs_settle; } -if (state->debug.clk_settle <4 ) { -dev_dbg (state->dev,"overriding Tclk_settle with %u\n" , - state->debug.clk_settle); - state->clk_settle = state->debug.clk_settle; +if (csis->debug.clk_settle <4 ) { +dev_dbg (csis->dev,"overriding Tclk_settle with %u\n" , + csis->debug.clk_settle); + csis->clk_settle = csis->debug.clk_settle; }return 0 ; } -static void mipi_csis_set_params (struct csi_state *state) +static void mipi_csis_set_params (struct mipi_csis_device *csis) { -int lanes = state->bus.num_data_lanes; +int lanes = csis->bus.num_data_lanes;u32 val; - val =mipi_csis_read (state,MIPI_CSIS_CMN_CTRL ); + val =mipi_csis_read (csis,MIPI_CSIS_CMN_CTRL ); val &= ~MIPI_CSIS_CMN_CTRL_LANE_NR_MASK ; val |= (lanes -1 ) <<MIPI_CSIS_CMN_CTRL_LANE_NR_OFFSET ; -if (state->info->version ==MIPI_CSIS_V3_3 ) +if (csis->info->version ==MIPI_CSIS_V3_3 ) val |=MIPI_CSIS_CMN_CTRL_INTER_MODE ; -mipi_csis_write (state,MIPI_CSIS_CMN_CTRL , val); +mipi_csis_write (csis,MIPI_CSIS_CMN_CTRL , val); -__mipi_csis_set_format (state); +__mipi_csis_set_format (csis); -mipi_csis_write (state,MIPI_CSIS_DPHY_CMN_CTRL , -MIPI_CSIS_DPHY_CMN_CTRL_HSSETTLE (state->hs_settle) | -MIPI_CSIS_DPHY_CMN_CTRL_CLKSETTLE (state->clk_settle)); +mipi_csis_write (csis,MIPI_CSIS_DPHY_CMN_CTRL , +MIPI_CSIS_DPHY_CMN_CTRL_HSSETTLE (csis->hs_settle) | +MIPI_CSIS_DPHY_CMN_CTRL_CLKSETTLE (csis->clk_settle)); val = (0 <<MIPI_CSIS_ISP_SYNC_HSYNC_LINTV_OFFSET ) | (0 <<MIPI_CSIS_ISP_SYNC_VSYNC_SINTV_OFFSET ) | (0 <<MIPI_CSIS_ISP_SYNC_VSYNC_EINTV_OFFSET ); -mipi_csis_write (state,MIPI_CSIS_ISP_SYNC_CH (0 ), val); +mipi_csis_write (csis,MIPI_CSIS_ISP_SYNC_CH (0 ), val); - val =mipi_csis_read (state,MIPI_CSIS_CLK_CTRL ); + val =mipi_csis_read (csis,MIPI_CSIS_CLK_CTRL ); val |=MIPI_CSIS_CLK_CTRL_WCLK_SRC ; val |=MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH0 (15 ); val &= ~MIPI_CSIS_CLK_CTRL_CLKGATE_EN_MSK ; -mipi_csis_write (state,MIPI_CSIS_CLK_CTRL , val); +mipi_csis_write (csis,MIPI_CSIS_CLK_CTRL , val); - mipi_csis_write(state, MIPI_CSIS_DPHY_BCTRL_L, + mipi_csis_write(csis, MIPI_CSIS_DPHY_BCTRL_L, MIPI_CSIS_DPHY_BCTRL_L_BIAS_REF_VOLT_715MV | MIPI_CSIS_DPHY_BCTRL_L_BGR_CHOPPER_FREQ_3MHZ | MIPI_CSIS_DPHY_BCTRL_L_REG_12P_LVL_CTL_1_2V |
@@ -653,95 +654,95 @@ static void mipi_csis_set_params(struct csi_state *state)MIPI_CSIS_DPHY_BCTRL_L_LP_RX_VREF_LVL_715MV |MIPI_CSIS_DPHY_BCTRL_L_LP_CD_HYS_60MV | MIPI_CSIS_DPHY_BCTRL_L_B_DPHYCTRL(20000000)); -mipi_csis_write (state,MIPI_CSIS_DPHY_BCTRL_H ,0 ); +mipi_csis_write (csis,MIPI_CSIS_DPHY_BCTRL_H ,0 );/* Update the shadow register. */ - val =mipi_csis_read (state,MIPI_CSIS_CMN_CTRL ); -mipi_csis_write (state,MIPI_CSIS_CMN_CTRL , + val =mipi_csis_read (csis,MIPI_CSIS_CMN_CTRL ); +mipi_csis_write (csis,MIPI_CSIS_CMN_CTRL , val |MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW |MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW_CTRL ); } -static int mipi_csis_clk_enable (struct csi_state *state) +static int mipi_csis_clk_enable (struct mipi_csis_device *csis) { -return clk_bulk_prepare_enable (state->info->num_clocks, state->clks); +return clk_bulk_prepare_enable (csis->info->num_clocks, csis->clks); } -static void mipi_csis_clk_disable (struct csi_state *state) +static void mipi_csis_clk_disable (struct mipi_csis_device *csis) { -clk_bulk_disable_unprepare (state->info->num_clocks, state->clks); +clk_bulk_disable_unprepare (csis->info->num_clocks, csis->clks); } -static int mipi_csis_clk_get (struct csi_state *state) +static int mipi_csis_clk_get (struct mipi_csis_device *csis) {unsigned int i;int ret; - state->clks =devm_kcalloc (state->dev, state->info->num_clocks, -sizeof (*state->clks),GFP_KERNEL ); + csis->clks =devm_kcalloc (csis->dev, csis->info->num_clocks, +sizeof (*csis->clks),GFP_KERNEL ); -if (!state->clks) +if (!csis->clks)return -ENOMEM ; -for (i =0 ; i < state->info->num_clocks; i++) - state->clks[i].id = mipi_csis_clk_id[i]; +for (i =0 ; i < csis->info->num_clocks; i++) + csis->clks[i].id = mipi_csis_clk_id[i]; - ret =devm_clk_bulk_get (state->dev, state->info->num_clocks, - state->clks); + ret =devm_clk_bulk_get (csis->dev, csis->info->num_clocks, + csis->clks);if (ret <0 )return ret;/* Set clock rate */ - ret =clk_set_rate (state->clks[MIPI_CSIS_CLK_WRAP ].clk, - state->clk_frequency); + ret =clk_set_rate (csis->clks[MIPI_CSIS_CLK_WRAP ].clk, + csis->clk_frequency);if (ret <0 ) -dev_err (state->dev,"set rate=%d failed: %d\n" , - state->clk_frequency, ret); +dev_err (csis->dev,"set rate=%d failed: %d\n" , + csis->clk_frequency, ret);return ret; } -static void mipi_csis_start_stream (struct csi_state *state) +static void mipi_csis_start_stream (struct mipi_csis_device *csis) { -mipi_csis_sw_reset (state); -mipi_csis_set_params (state); -mipi_csis_system_enable (state, true); -mipi_csis_enable_interrupts (state, true); +mipi_csis_sw_reset (csis); +mipi_csis_set_params (csis); +mipi_csis_system_enable (csis, true); +mipi_csis_enable_interrupts (csis, true); } -static void mipi_csis_stop_stream (struct csi_state *state) +static void mipi_csis_stop_stream (struct mipi_csis_device *csis) { -mipi_csis_enable_interrupts (state, false); -mipi_csis_system_enable (state, false); +mipi_csis_enable_interrupts (csis, false); +mipi_csis_system_enable (csis, false); }static irqreturn_t mipi_csis_irq_handler (int irq,void *dev_id) { -struct csi_state *state = dev_id; +struct mipi_csis_device *csis = dev_id;unsigned long flags;unsigned int i;u32 status;u32 dbg_status; - status =mipi_csis_read (state,MIPI_CSIS_INT_SRC ); - dbg_status =mipi_csis_read (state,MIPI_CSIS_DBG_INTR_SRC ); + status =mipi_csis_read (csis,MIPI_CSIS_INT_SRC ); + dbg_status =mipi_csis_read (csis,MIPI_CSIS_DBG_INTR_SRC ); -spin_lock_irqsave (&state->slock, flags); +spin_lock_irqsave (&csis->slock, flags);/* Update the event/error counters */ -if ((status &MIPI_CSIS_INT_SRC_ERRORS ) || state->debug.enable) { +if ((status &MIPI_CSIS_INT_SRC_ERRORS ) || csis->debug.enable) {for (i =0 ; i <MIPI_CSIS_NUM_EVENTS ; i++) { -struct mipi_csis_event *event = &state->events[i]; +struct mipi_csis_event *event = &csis->events[i];if ((!event->debug && (status & event->mask)) || (event->debug && (dbg_status & event->mask))) event->counter++; } } -spin_unlock_irqrestore (&state->slock, flags); +spin_unlock_irqrestore (&csis->slock, flags); -mipi_csis_write (state,MIPI_CSIS_INT_SRC , status); -mipi_csis_write (state,MIPI_CSIS_DBG_INTR_SRC , dbg_status); +mipi_csis_write (csis,MIPI_CSIS_INT_SRC , status); +mipi_csis_write (csis,MIPI_CSIS_DBG_INTR_SRC , dbg_status);return IRQ_HANDLED ; }
@@ -750,47 +751,47 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)* PHY regulator and reset */ -static int mipi_csis_phy_enable (struct csi_state *state) +static int mipi_csis_phy_enable (struct mipi_csis_device *csis) { -if (state->info->version !=MIPI_CSIS_V3_3 ) +if (csis->info->version !=MIPI_CSIS_V3_3 )return 0 ; -return regulator_enable (state->mipi_phy_regulator); +return regulator_enable (csis->mipi_phy_regulator); } -static int mipi_csis_phy_disable (struct csi_state *state) +static int mipi_csis_phy_disable (struct mipi_csis_device *csis) { -if (state->info->version !=MIPI_CSIS_V3_3 ) +if (csis->info->version !=MIPI_CSIS_V3_3 )return 0 ; -return regulator_disable (state->mipi_phy_regulator); +return regulator_disable (csis->mipi_phy_regulator); } -static void mipi_csis_phy_reset (struct csi_state *state) +static void mipi_csis_phy_reset (struct mipi_csis_device *csis) { -if (state->info->version !=MIPI_CSIS_V3_3 ) +if (csis->info->version !=MIPI_CSIS_V3_3 )return ; -reset_control_assert (state->mrst); +reset_control_assert (csis->mrst);msleep (20 ); -reset_control_deassert (state->mrst); +reset_control_deassert (csis->mrst); } -static int mipi_csis_phy_init (struct csi_state *state) +static int mipi_csis_phy_init (struct mipi_csis_device *csis) { -if (state->info->version !=MIPI_CSIS_V3_3 ) +if (csis->info->version !=MIPI_CSIS_V3_3 )return 0 ;/* Get MIPI PHY reset and regulator. */ - state->mrst =devm_reset_control_get_exclusive (state->dev,NULL ); -if (IS_ERR (state->mrst)) -return PTR_ERR (state->mrst); + csis->mrst =devm_reset_control_get_exclusive (csis->dev,NULL ); +if (IS_ERR (csis->mrst)) +return PTR_ERR (csis->mrst); - state->mipi_phy_regulator =devm_regulator_get (state->dev,"phy" ); -if (IS_ERR (state->mipi_phy_regulator)) -return PTR_ERR (state->mipi_phy_regulator); + csis->mipi_phy_regulator =devm_regulator_get (csis->dev,"phy" ); +if (IS_ERR (csis->mipi_phy_regulator)) +return PTR_ERR (csis->mipi_phy_regulator); -return regulator_set_voltage (state->mipi_phy_regulator,1000000 , +return regulator_set_voltage (csis->mipi_phy_regulator,1000000 ,1000000 ); }
@@ -798,36 +799,36 @@ static int mipi_csis_phy_init(struct csi_state *state)* Debug */ -static void mipi_csis_clear_counters (struct csi_state *state) +static void mipi_csis_clear_counters (struct mipi_csis_device *csis) {unsigned long flags;unsigned int i; -spin_lock_irqsave (&state->slock, flags); +spin_lock_irqsave (&csis->slock, flags);for (i =0 ; i <MIPI_CSIS_NUM_EVENTS ; i++) - state->events[i].counter =0 ; -spin_unlock_irqrestore (&state->slock, flags); + csis->events[i].counter =0 ; +spin_unlock_irqrestore (&csis->slock, flags); } -static void mipi_csis_log_counters (struct csi_state *state,bool non_errors) +static void mipi_csis_log_counters (struct mipi_csis_device *csis,bool non_errors) {unsigned int num_events = non_errors ?MIPI_CSIS_NUM_EVENTS :MIPI_CSIS_NUM_EVENTS -8 ;unsigned long flags;unsigned int i; -spin_lock_irqsave (&state->slock, flags); +spin_lock_irqsave (&csis->slock, flags);for (i =0 ; i < num_events; ++i) { -if (state->events[i].counter >0 || state->debug.enable) -dev_info (state->dev,"%s events: %d\n" , - state->events[i].name, - state->events[i].counter); +if (csis->events[i].counter >0 || csis->debug.enable) +dev_info (csis->dev,"%s events: %d\n" , + csis->events[i].name, + csis->events[i].counter); } -spin_unlock_irqrestore (&state->slock, flags); +spin_unlock_irqrestore (&csis->slock, flags); } -static int mipi_csis_dump_regs (struct csi_state *state) +static int mipi_csis_dump_regs (struct mipi_csis_device *csis) { static const struct { u32 offset;
@@ -851,11 +852,11 @@ static int mipi_csis_dump_regs(struct csi_state *state)unsigned int i;u32 cfg; -dev_info (state->dev,"--- REGISTERS ---\n" ); +dev_info (csis->dev,"--- REGISTERS ---\n" );for (i =0 ; i <ARRAY_SIZE (registers); i++) { - cfg =mipi_csis_read (state, registers[i].offset); -dev_info (state->dev,"%14s: 0x%08x\n" , registers[i].name, cfg); + cfg =mipi_csis_read (csis, registers[i].offset); +dev_info (csis->dev,"%14s: 0x%08x\n" , registers[i].name, cfg); }return 0 ;
@@ -863,123 +864,123 @@ static int mipi_csis_dump_regs(struct csi_state *state)static int mipi_csis_dump_regs_show (struct seq_file *m,void *private) { -struct csi_state *state = m->private; +struct mipi_csis_device *csis = m->private; -return mipi_csis_dump_regs (state); +return mipi_csis_dump_regs (csis); }DEFINE_SHOW_ATTRIBUTE (mipi_csis_dump_regs); -static void mipi_csis_debugfs_init (struct csi_state *state) +static void mipi_csis_debugfs_init (struct mipi_csis_device *csis) { - state->debug.hs_settle =UINT_MAX ; - state->debug.clk_settle =UINT_MAX ; + csis->debug.hs_settle =UINT_MAX ; + csis->debug.clk_settle =UINT_MAX ; - state->debugfs_root =debugfs_create_dir (dev_name (state->dev),NULL ); + csis->debugfs_root =debugfs_create_dir (dev_name (csis->dev),NULL ); -debugfs_create_bool ("debug_enable" ,0600 , state->debugfs_root, - &state->debug.enable); -debugfs_create_file ("dump_regs" ,0600 , state->debugfs_root, state, +debugfs_create_bool ("debug_enable" ,0600 , csis->debugfs_root, + &csis->debug.enable); +debugfs_create_file ("dump_regs" ,0600 , csis->debugfs_root, csis, &mipi_csis_dump_regs_fops); -debugfs_create_u32 ("tclk_settle" ,0600 , state->debugfs_root, - &state->debug.clk_settle); -debugfs_create_u32 ("ths_settle" ,0600 , state->debugfs_root, - &state->debug.hs_settle); +debugfs_create_u32 ("tclk_settle" ,0600 , csis->debugfs_root, + &csis->debug.clk_settle); +debugfs_create_u32 ("ths_settle" ,0600 , csis->debugfs_root, + &csis->debug.hs_settle); } -static void mipi_csis_debugfs_exit (struct csi_state *state) +static void mipi_csis_debugfs_exit (struct mipi_csis_device *csis) { -debugfs_remove_recursive (state->debugfs_root); +debugfs_remove_recursive (csis->debugfs_root); }/* ----------------------------------------------------------------------------- * V4L2 subdev operations */ -static struct csi_state *mipi_sd_to_csis_state (struct v4l2_subdev *sdev) +static struct mipi_csis_device *sd_to_mipi_csis_device (struct v4l2_subdev *sdev) { - return container_of(sdev, struct csi_state, sd); + return container_of(sdev, struct mipi_csis_device, sd); }static int mipi_csis_s_stream (struct v4l2_subdev *sd,int enable) { -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd);int ret;if (enable) { - ret =mipi_csis_calculate_params (state); + ret =mipi_csis_calculate_params (csis);if (ret <0 )return ret; -mipi_csis_clear_counters (state); +mipi_csis_clear_counters (csis); - ret =pm_runtime_resume_and_get (state->dev); + ret =pm_runtime_resume_and_get (csis->dev);if (ret <0 )return ret; - ret =v4l2_subdev_call (state->src_sd, core, s_power,1 ); + ret =v4l2_subdev_call (csis->src_sd, core, s_power,1 );if (ret <0 && ret != -ENOIOCTLCMD ) goto done; } -mutex_lock (&state->lock); +mutex_lock (&csis->lock);if (enable) { -if (state->state &ST_SUSPENDED ) { +if (csis->state &ST_SUSPENDED ) { ret = -EBUSY ; goto unlock; } -mipi_csis_start_stream (state); - ret =v4l2_subdev_call (state->src_sd, video, s_stream,1 ); +mipi_csis_start_stream (csis); + ret =v4l2_subdev_call (csis->src_sd, video, s_stream,1 );if (ret <0 ) goto unlock; -mipi_csis_log_counters (state, true); +mipi_csis_log_counters (csis, true); - state->state |=ST_STREAMING ; + csis->state |=ST_STREAMING ; }else { -v4l2_subdev_call (state->src_sd, video, s_stream,0 ); - ret =v4l2_subdev_call (state->src_sd, core, s_power,0 ); +v4l2_subdev_call (csis->src_sd, video, s_stream,0 ); + ret =v4l2_subdev_call (csis->src_sd, core, s_power,0 );if (ret == -ENOIOCTLCMD ) ret =0 ; -mipi_csis_stop_stream (state); - state->state &= ~ST_STREAMING ; -if (state->debug.enable) -mipi_csis_log_counters (state, true); +mipi_csis_stop_stream (csis); + csis->state &= ~ST_STREAMING ; +if (csis->debug.enable) +mipi_csis_log_counters (csis, true); } unlock: -mutex_unlock (&state->lock); +mutex_unlock (&csis->lock); done:if (!enable || ret <0 ) -pm_runtime_put (state->dev); +pm_runtime_put (csis->dev);return ret; }static struct v4l2_mbus_framefmt * -mipi_csis_get_format (struct csi_state *state, +mipi_csis_get_format (struct mipi_csis_device *csis,struct v4l2_subdev_state *sd_state,enum v4l2_subdev_format_whence which,unsigned int pad) {if (which ==V4L2_SUBDEV_FORMAT_TRY ) -return v4l2_subdev_get_try_format (&state->sd, sd_state, pad); +return v4l2_subdev_get_try_format (&csis->sd, sd_state, pad); -return &state->format_mbus[pad]; +return &csis->format_mbus[pad]; }static int mipi_csis_init_cfg (struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state) { -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd);struct v4l2_mbus_framefmt *fmt_sink;struct v4l2_mbus_framefmt *fmt_source;enum v4l2_subdev_format_whence which; which = sd_state ?V4L2_SUBDEV_FORMAT_TRY :V4L2_SUBDEV_FORMAT_ACTIVE ; - fmt_sink =mipi_csis_get_format (state, sd_state, which,CSIS_PAD_SINK ); + fmt_sink =mipi_csis_get_format (csis, sd_state, which,CSIS_PAD_SINK ); fmt_sink->code =MEDIA_BUS_FMT_UYVY8_1X16 ; fmt_sink->width =MIPI_CSIS_DEF_PIX_WIDTH ;
@@ -1001,7 +1002,7 @@ static int mipi_csis_init_cfg(struct v4l2_subdev *sd,if (!sd_state)return 0 ; - fmt_source =mipi_csis_get_format (state, sd_state, which, + fmt_source =mipi_csis_get_format (csis, sd_state, which,CSIS_PAD_SOURCE ); *fmt_source = *fmt_sink;
@@ -1012,15 +1013,15 @@ static int mipi_csis_get_fmt(struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *sdformat) { - struct csi_state *state = mipi_sd_to_csis_state(sd); + struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);struct v4l2_mbus_framefmt *fmt; - fmt =mipi_csis_get_format (state, sd_state, sdformat->which, + fmt =mipi_csis_get_format (csis, sd_state, sdformat->which, sdformat->pad); -mutex_lock (&state->lock); +mutex_lock (&csis->lock); sdformat->format = *fmt; -mutex_unlock (&state->lock); +mutex_unlock (&csis->lock);return 0 ; }
@@ -1029,7 +1030,7 @@ static int mipi_csis_enum_mbus_code(struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { - struct csi_state *state = mipi_sd_to_csis_state(sd); + struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);/* * The CSIS can't transcode in any way, the source format is identical
@@ -1041,7 +1042,7 @@ static int mipi_csis_enum_mbus_code(struct v4l2_subdev *sd,if (code->index >0 )return -EINVAL ; - fmt =mipi_csis_get_format (state, sd_state, code->which, + fmt =mipi_csis_get_format (csis, sd_state, code->which, code->pad); code->code = fmt->code;return 0 ;
@@ -1062,7 +1063,7 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *sdformat) { - struct csi_state *state = mipi_sd_to_csis_state(sd); + struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);struct csis_pix_format const *csis_fmt;struct v4l2_mbus_framefmt *fmt;unsigned int align;
@@ -1110,10 +1111,10 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd, &sdformat->format.height,1 , CSIS_MAX_PIX_HEIGHT, 0, 0); - fmt =mipi_csis_get_format (state, sd_state, sdformat->which, + fmt =mipi_csis_get_format (csis, sd_state, sdformat->which, sdformat->pad); -mutex_lock (&state->lock); +mutex_lock (&csis->lock); fmt->code = csis_fmt->code; fmt->width = sdformat->format.width;
@@ -1126,7 +1127,7 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd, sdformat->format = *fmt;/* Propagate the format from sink to source. */ - fmt =mipi_csis_get_format (state, sd_state, sdformat->which, + fmt =mipi_csis_get_format (csis, sd_state, sdformat->which,CSIS_PAD_SOURCE ); *fmt = sdformat->format;
@@ -1135,22 +1136,22 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd,/* Store the CSIS format descriptor for active formats. */ if (sdformat->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) - state->csis_fmt = csis_fmt; + csis->csis_fmt = csis_fmt; -mutex_unlock (&state->lock); +mutex_unlock (&csis->lock);return 0 ; }static int mipi_csis_log_status (struct v4l2_subdev *sd) { -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd); -mutex_lock (&state->lock); -mipi_csis_log_counters (state, true); -if (state->debug.enable && (state->state &ST_POWERED )) -mipi_csis_dump_regs (state); -mutex_unlock (&state->lock); +mutex_lock (&csis->lock); +mipi_csis_log_counters (csis, true); +if (csis->debug.enable && (csis->state &ST_POWERED )) +mipi_csis_dump_regs (csis); +mutex_unlock (&csis->lock);return 0 ; }
@@ -1185,10 +1186,10 @@ static int mipi_csis_link_setup(struct media_entity *entity, const struct media_pad *remote_pad, u32 flags) {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity); -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd);struct v4l2_subdev *remote_sd; -dev_dbg (state->dev,"link setup %s -> %s" , remote_pad->entity->name, +dev_dbg (csis->dev,"link setup %s -> %s" , remote_pad->entity->name, local_pad->entity->name);/* We only care about the link to the source. */
@@ -1198,12 +1199,12 @@ static int mipi_csis_link_setup(struct media_entity *entity, remote_sd =media_entity_to_v4l2_subdev (remote_pad->entity);if (flags &MEDIA_LNK_FL_ENABLED ) { -if (state->src_sd) +if (csis->src_sd)return -EBUSY ; - state->src_sd = remote_sd; + csis->src_sd = remote_sd; }else { - state->src_sd =NULL ; + csis->src_sd =NULL ; }return 0 ;
@@ -1219,18 +1220,18 @@ static const struct media_entity_operations mipi_csis_entity_ops = {* Async subdev notifier */ -static struct csi_state * +static struct mipi_csis_device *mipi_notifier_to_csis_state (struct v4l2_async_notifier *n) { - return container_of(n, struct csi_state, notifier); + return container_of(n, struct mipi_csis_device, notifier); }static int mipi_csis_notify_bound (struct v4l2_async_notifier *notifier,struct v4l2_subdev *sd,struct v4l2_async_subdev *asd) { -struct csi_state *state =mipi_notifier_to_csis_state (notifier); -struct media_pad *sink = &state->sd.entity.pads[CSIS_PAD_SINK ]; +struct mipi_csis_device *csis =mipi_notifier_to_csis_state (notifier); +struct media_pad *sink = &csis->sd.entity.pads[CSIS_PAD_SINK ];return v4l2_create_fwnode_links_to_pad (sd, sink,0 ); }
@@ -1239,7 +1240,7 @@ static const struct v4l2_async_notifier_operations mipi_csis_notify_ops = { .bound = mipi_csis_notify_bound, }; -static int mipi_csis_async_register (struct csi_state *state) +static int mipi_csis_async_register (struct mipi_csis_device *csis) {struct v4l2_fwnode_endpoint vep = { .bus_type =V4L2_MBUS_CSI2_DPHY ,
@@ -1249,9 +1250,9 @@ static int mipi_csis_async_register(struct csi_state *state)unsigned int i;int ret; -v4l2_async_nf_init (&state->notifier); +v4l2_async_nf_init (&csis->notifier); - ep =fwnode_graph_get_endpoint_by_id (dev_fwnode (state->dev),0 ,0 , + ep =fwnode_graph_get_endpoint_by_id (dev_fwnode (csis->dev),0 ,0 ,FWNODE_GRAPH_ENDPOINT_NEXT );if (!ep)return -ENOTCONN ;
@@ -1262,19 +1263,19 @@ static int mipi_csis_async_register(struct csi_state *state)for (i =0 ; i < vep.bus.mipi_csi2.num_data_lanes; ++i) {if (vep.bus.mipi_csi2.data_lanes[i] != i +1 ) { -dev_err (state->dev, +dev_err (csis->dev,"data lanes reordering is not supported" ); ret = -EINVAL ; goto err_parse; } } - state->bus = vep.bus.mipi_csi2; + csis->bus = vep.bus.mipi_csi2; -dev_dbg (state->dev,"data lanes: %d\n" , state->bus.num_data_lanes); -dev_dbg (state->dev,"flags: 0x%08x\n" , state->bus.flags); +dev_dbg (csis->dev,"data lanes: %d\n" , csis->bus.num_data_lanes); +dev_dbg (csis->dev,"flags: 0x%08x\n" , csis->bus.flags); - asd =v4l2_async_nf_add_fwnode_remote (&state->notifier, ep, + asd =v4l2_async_nf_add_fwnode_remote (&csis->notifier, ep, struct v4l2_async_subdev);if (IS_ERR (asd)) { ret =PTR_ERR (asd);
@@ -1283,13 +1284,13 @@ static int mipi_csis_async_register(struct csi_state *state)fwnode_handle_put (ep); - state->notifier.ops = &mipi_csis_notify_ops; + csis->notifier.ops = &mipi_csis_notify_ops; - ret =v4l2_async_subdev_nf_register (&state->sd, &state->notifier); + ret =v4l2_async_subdev_nf_register (&csis->sd, &csis->notifier);if (ret)return ret; -return v4l2_async_register_subdev (&state->sd); +return v4l2_async_register_subdev (&csis->sd); err_parse:fwnode_handle_put (ep);
@@ -1304,23 +1305,23 @@ static int mipi_csis_async_register(struct csi_state *state)static int mipi_csis_pm_suspend (struct device *dev,bool runtime) {struct v4l2_subdev *sd =dev_get_drvdata (dev); -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd);int ret =0 ; -mutex_lock (&state->lock); -if (state->state &ST_POWERED ) { -mipi_csis_stop_stream (state); - ret =mipi_csis_phy_disable (state); +mutex_lock (&csis->lock); +if (csis->state &ST_POWERED ) { +mipi_csis_stop_stream (csis); + ret =mipi_csis_phy_disable (csis);if (ret) goto unlock; -mipi_csis_clk_disable (state); - state->state &= ~ST_POWERED ; +mipi_csis_clk_disable (csis); + csis->state &= ~ST_POWERED ;if (!runtime) - state->state |=ST_SUSPENDED ; + csis->state |=ST_SUSPENDED ; } unlock: -mutex_unlock (&state->lock); +mutex_unlock (&csis->lock);return ret ? -EAGAIN :0 ; }
@@ -1328,28 +1329,28 @@ static int mipi_csis_pm_suspend(struct device *dev, bool runtime)static int mipi_csis_pm_resume (struct device *dev,bool runtime) {struct v4l2_subdev *sd =dev_get_drvdata (dev); -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd);int ret =0 ; -mutex_lock (&state->lock); -if (!runtime && !(state->state &ST_SUSPENDED )) +mutex_lock (&csis->lock); +if (!runtime && !(csis->state &ST_SUSPENDED )) goto unlock; -if (!(state->state &ST_POWERED )) { - ret =mipi_csis_phy_enable (state); +if (!(csis->state &ST_POWERED )) { + ret =mipi_csis_phy_enable (csis);if (ret) goto unlock; - state->state |=ST_POWERED ; -mipi_csis_clk_enable (state); + csis->state |=ST_POWERED ; +mipi_csis_clk_enable (csis); } -if (state->state &ST_STREAMING ) -mipi_csis_start_stream (state); +if (csis->state &ST_STREAMING ) +mipi_csis_start_stream (csis); - state->state &= ~ST_SUSPENDED ; + csis->state &= ~ST_SUSPENDED ; unlock: -mutex_unlock (&state->lock); +mutex_unlock (&csis->lock);return ret ? -EAGAIN :0 ; }
@@ -1384,14 +1385,14 @@ static const struct dev_pm_ops mipi_csis_pm_ops = {* Probe/remove & platform driver */ -static int mipi_csis_subdev_init (struct csi_state *state) +static int mipi_csis_subdev_init (struct mipi_csis_device *csis) { -struct v4l2_subdev *sd = &state->sd; +struct v4l2_subdev *sd = &csis->sd;v4l2_subdev_init (sd, &mipi_csis_subdev_ops); sd->owner =THIS_MODULE ;snprintf (sd->name,sizeof (sd->name),"csis-%s" , -dev_name (state->dev)); +dev_name (csis->dev)); sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; sd->ctrl_handler =NULL ;
@@ -1399,26 +1400,26 @@ static int mipi_csis_subdev_init(struct csi_state *state) sd->entity.function =MEDIA_ENT_F_VID_IF_BRIDGE ; sd->entity.ops = &mipi_csis_entity_ops; - sd->dev = state->dev; + sd->dev = csis->dev; - state->csis_fmt = &mipi_csis_formats[0 ]; + csis->csis_fmt = &mipi_csis_formats[0 ];mipi_csis_init_cfg (sd,NULL ); - state->pads[CSIS_PAD_SINK ].flags =MEDIA_PAD_FL_SINK + csis->pads[CSIS_PAD_SINK ].flags =MEDIA_PAD_FL_SINK |MEDIA_PAD_FL_MUST_CONNECT ; - state->pads[CSIS_PAD_SOURCE ].flags =MEDIA_PAD_FL_SOURCE + csis->pads[CSIS_PAD_SOURCE ].flags =MEDIA_PAD_FL_SOURCE |MEDIA_PAD_FL_MUST_CONNECT ;return media_entity_pads_init (&sd->entity,CSIS_PADS_NUM , - state->pads); + csis->pads); } -static int mipi_csis_parse_dt (struct csi_state *state) +static int mipi_csis_parse_dt (struct mipi_csis_device *csis) { -struct device_node *node = state->dev->of_node; +struct device_node *node = csis->dev->of_node;if (of_property_read_u32 (node,"clock-frequency" , - &state->clk_frequency)) - state->clk_frequency =DEFAULT_SCLK_CSIS_FREQ ; + &csis->clk_frequency)) + csis->clk_frequency =DEFAULT_SCLK_CSIS_FREQ ;return 0 ; }
@@ -1426,78 +1427,78 @@ static int mipi_csis_parse_dt(struct csi_state *state)static int mipi_csis_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct csi_state *state; +struct mipi_csis_device *csis;int irq;int ret; - state =devm_kzalloc (dev,sizeof (*state),GFP_KERNEL ); -if (!state) + csis =devm_kzalloc (dev,sizeof (*csis),GFP_KERNEL ); +if (!csis)return -ENOMEM ; -mutex_init (&state->lock); -spin_lock_init (&state->slock); +mutex_init (&csis->lock); +spin_lock_init (&csis->slock); - state->dev = dev; - state->info =of_device_get_match_data (dev); + csis->dev = dev; + csis->info =of_device_get_match_data (dev); -memcpy (state->events, mipi_csis_events,sizeof (state->events)); +memcpy (csis->events, mipi_csis_events,sizeof (csis->events));/* Parse DT properties. */ - ret =mipi_csis_parse_dt (state); + ret =mipi_csis_parse_dt (csis);if (ret <0 ) {dev_err (dev,"Failed to parse device tree: %d\n" , ret);return ret; }/* Acquire resources. */ - state->regs =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (state->regs)) -return PTR_ERR (state->regs); + csis->regs =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (csis->regs)) +return PTR_ERR (csis->regs); irq =platform_get_irq (pdev,0 );if (irq <0 )return irq; - ret =mipi_csis_phy_init (state); + ret =mipi_csis_phy_init (csis);if (ret <0 )return ret; - ret =mipi_csis_clk_get (state); + ret =mipi_csis_clk_get (csis);if (ret <0 )return ret;/* Reset PHY and enable the clocks. */ -mipi_csis_phy_reset (state); +mipi_csis_phy_reset (csis); - ret =mipi_csis_clk_enable (state); + ret =mipi_csis_clk_enable (csis);if (ret <0 ) { -dev_err (state->dev,"failed to enable clocks: %d\n" , ret); +dev_err (csis->dev,"failed to enable clocks: %d\n" , ret);return ret; }/* Now that the hardware is initialized, request the interrupt. */ ret =devm_request_irq (dev, irq, mipi_csis_irq_handler,0 , -dev_name (dev), state); +dev_name (dev), csis);if (ret) {dev_err (dev,"Interrupt request failed\n" ); goto disable_clock; }/* Initialize and register the subdev. */ - ret =mipi_csis_subdev_init (state); + ret =mipi_csis_subdev_init (csis);if (ret <0 ) goto disable_clock; -platform_set_drvdata (pdev, &state->sd); +platform_set_drvdata (pdev, &csis->sd); - ret =mipi_csis_async_register (state); + ret =mipi_csis_async_register (csis);if (ret <0 ) {dev_err (dev,"async register failed: %d\n" , ret); goto cleanup; }/* Initialize debugfs. */ -mipi_csis_debugfs_init (state); +mipi_csis_debugfs_init (csis);/* Enable runtime PM. */ pm_runtime_enable (dev);
@@ -1508,20 +1509,20 @@ static int mipi_csis_probe(struct platform_device *pdev) }dev_info (dev,"lanes: %d, freq: %u\n" , - state->bus.num_data_lanes, state->clk_frequency); + csis->bus.num_data_lanes, csis->clk_frequency);return 0 ; unregister_all: -mipi_csis_debugfs_exit (state); +mipi_csis_debugfs_exit (csis); cleanup: -media_entity_cleanup (&state->sd.entity); -v4l2_async_nf_unregister (&state->notifier); -v4l2_async_nf_cleanup (&state->notifier); -v4l2_async_unregister_subdev (&state->sd); +media_entity_cleanup (&csis->sd.entity); +v4l2_async_nf_unregister (&csis->notifier); +v4l2_async_nf_cleanup (&csis->notifier); +v4l2_async_unregister_subdev (&csis->sd); disable_clock: -mipi_csis_clk_disable (state); -mutex_destroy (&state->lock); +mipi_csis_clk_disable (csis); +mutex_destroy (&csis->lock);return ret; }
@@ -1529,18 +1530,18 @@ static int mipi_csis_probe(struct platform_device *pdev)static int mipi_csis_remove (struct platform_device *pdev) {struct v4l2_subdev *sd =platform_get_drvdata (pdev); -struct csi_state *state =mipi_sd_to_csis_state (sd); +struct mipi_csis_device *csis =sd_to_mipi_csis_device (sd); -mipi_csis_debugfs_exit (state); -v4l2_async_nf_unregister (&state->notifier); -v4l2_async_nf_cleanup (&state->notifier); -v4l2_async_unregister_subdev (&state->sd); +mipi_csis_debugfs_exit (csis); +v4l2_async_nf_unregister (&csis->notifier); +v4l2_async_nf_cleanup (&csis->notifier); +v4l2_async_unregister_subdev (&csis->sd);pm_runtime_disable (&pdev->dev);mipi_csis_pm_suspend (&pdev->dev, true); -mipi_csis_clk_disable (state); -media_entity_cleanup (&state->sd.entity); -mutex_destroy (&state->lock); +mipi_csis_clk_disable (csis); +media_entity_cleanup (&csis->sd.entity); +mutex_destroy (&csis->lock);pm_runtime_set_suspended (&pdev->dev);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 344/879 media: imx: imx-mipi-csis: Fix active format initialization on source pad
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit fe14b546d6e57542dbd4f5ccdb5a382904d26c5a ]
Commit 5c0701a0e791 ("media: imx: csis: Store pads format separately") broke initialization of the active format on the source pad, as it forgot to update the .init_cfg() handler. Fix it.
--- drivers/media/platform/nxp/imx-mipi-csis.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/media/platform/nxp/imx-mipi-csis.c +0 -8
@@ -994,14 +994,6 @@ static int mipi_csis_init_cfg(struct v4l2_subdev *sd,V4L2_MAP_QUANTIZATION_DEFAULT (false, fmt_sink->colorspace, fmt_sink->ycbcr_enc); -/* -* When called from mipi_csis_subdev_init() to initialize the active -* configuration, cfg is NULL, which indicates there's no source pad -* configuration to set. -*/ -if (!sd_state) -return 0 ; - fmt_source =mipi_csis_get_format (csis, sd_state, which,CSIS_PAD_SOURCE ); *fmt_source = *fmt_sink;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 345/879 drm/panel: simple: Add missing bus flags for Innolux G070Y2-L01
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 0f73a559f916b618c0c05186bd644c90cc9e9695 ]
The DE signal is active high on this display, fill in the missing bus_flags. This aligns panel_desc with its display_timing .
--- drivers/gpu/drm/panel/panel-simple.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-simple.c +1 -0
@@ -2029,6 +2029,7 @@ static const struct panel_desc innolux_g070y2_l01 = { .unprepare = 800, }, .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, + .bus_flags = DRM_BUS_FLAG_DE_HIGH, .connector_type = DRM_MODE_CONNECTOR_LVDS, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 346/879 ALSA: pcm: Check for null pointer of pointer substream before dereferencing it
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 011b559be832194f992f73d6c0d5485f5925a10b ]
Pointer substream is being dereferenced on the assignment of pointer card before substream is being null checked with the macro PCM_RUNTIME_CHECK. Although PCM_RUNTIME_CHECK calls BUG_ON, it still is useful to perform the the pointer check before card is assigned.
--- sound/core/pcm_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_memory.c +2 -1
@@ -453,7 +453,6 @@ EXPORT_SYMBOL(snd_pcm_lib_malloc_pages);*/ int snd_pcm_lib_free_pages (struct snd_pcm_substream *substream) { -struct snd_card *card = substream->pcm->card;struct snd_pcm_runtime *runtime;if (PCM_RUNTIME_CHECK (substream))
@@ -462,6 +461,8 @@ int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)if (runtime->dma_area ==NULL )return 0 ;if (runtime->dma_buffer_p != &substream->dma_buffer) { +struct snd_card *card = substream->pcm->card; +/* it's a newly allocated buffer. release it now. */ do_free_pages (card, runtime->dma_buffer_p);kfree (runtime->dma_buffer_p);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 347/879 mtdblock: warn if opened on NAND
In reply to Greg Kroah-HartmanFrom: Bjørn Mork <[email protected]>
[ Upstream commit 96a3295c351da82d7af99b2fc004a3cf9f4716a9 ]
Warning on every translated mtd partition results in excessive log noise if this driver is loaded:
nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
nand: Macronix MX30LF1G18AC
nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
read_bbt: found bbt at block 1023
10 fixed-partitions partitions found on MTD device mt7621-nand
Creating 10 MTD partitions on "mt7621-nand":
0x000000000000-0x000000080000 : "Bootloader"
mtdblock: MTD device 'Bootloader' is NAND, please consider using UBI block devices instead. 0x000000080000-0x000000100000 : "Config"
mtdblock: MTD device 'Config' is NAND, please consider using UBI block devices instead. 0x000000100000-0x000000140000 : "Factory"
mtdblock: MTD device 'Factory' is NAND, please consider using UBI block devices instead. 0x000000140000-0x000002000000 : "Kernel"
mtdblock: MTD device 'Kernel' is NAND, please consider using UBI block devices instead. 0x000000540000-0x000002000000 : "ubi"
mtdblock: MTD device 'ubi' is NAND, please consider using UBI block devices instead. 0x000002140000-0x000004000000 : "Kernel2"
mtdblock: MTD device 'Kernel2' is NAND, please consider using UBI block devices instead. 0x000004000000-0x000004100000 : "wwan"
mtdblock: MTD device 'wwan' is NAND, please consider using UBI block devices instead. 0x000004100000-0x000005100000 : "data"
mtdblock: MTD device 'data' is NAND, please consider using UBI block devices instead. 0x000005100000-0x000005200000 : "rom-d"
mtdblock: MTD device 'rom-d' is NAND, please consider using UBI block devices instead. 0x000005200000-0x000005280000 : "reserve"
mtdblock: MTD device 'reserve' is NAND, please consider using UBI block devices instead. mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 21
This is more likely to annoy than to help users of embedded distros where this driver is enabled by default. Making the blockdevs available does not imply that they are in use, and warning about bootloader partitions or other devices which obviously never will be mounted is more confusing than helpful.
Move the warning to open(), where it will be of more use - actually warning anyone who mounts a file system on NAND using mtdblock.
--- drivers/mtd/mtdblock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/mtdblock.c +4 -4
@@ -257,6 +257,10 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)return 0 ; } +if (mtd_type_is_nand (mbd->mtd)) +pr_warn ("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n" , + mbd->tr->name, mbd->mtd->name); +/* OK, it's not open. Create cache info for it */ mtdblk->count =1 ;mutex_init (&mtdblk->cache_mutex);
@@ -322,10 +326,6 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)if (!(mtd->flags &MTD_WRITEABLE )) dev->mbd.readonly =1 ; -if (mtd_type_is_nand (mtd)) -pr_warn ("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n" , - tr->name, mtd->name); -if (add_mtd_blktrans_dev (&dev->mbd))kfree (dev); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 348/879 inotify: show inotify mask flags in proc fdinfo
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
[ Upstream commit a32e697cda27679a0327ae2cafdad8c7170f548f ]
The inotify mask flags IN_ONESHOT and IN_EXCL_UNLINK are not "internal to kernel" and should be exposed in procfs fdinfo so CRIU can restore them.
--- fs/notify/fdinfo.c | 11 ++--------- fs/notify/inotify/inotify.h | 12 ++++++++++++ fs/notify/inotify/inotify_user.c | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-)
fs/notify/fdinfo.c +2 -9
@@ -83,16 +83,9 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark); inode =igrab (fsnotify_conn_inode (mark->connector));if (inode) { -/* -* IN_ALL_EVENTS represents all of the mask bits -* that we expose to userspace. There is at -* least one bit (FS_EVENT_ON_CHILD) which is -* used only internally to the kernel. -*/ -u32 mask = mark->mask &IN_ALL_EVENTS ; -seq_printf (m,"inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x " , +seq_printf (m,"inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:0 " , inode_mark->wd, inode->i_ino, inode->i_sb->s_dev, - mask, mark->ignored_mask); +inotify_mark_user_mask (mark));show_mark_fhandle (m, inode);seq_putc (m,'\n' );iput (inode);
fs/notify/inotify/inotify.h +12 -0
@@ -22,6 +22,18 @@ static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse) return container_of(fse, struct inotify_event_info, fse); } +/* +* INOTIFY_USER_FLAGS represents all of the mask bits that we expose to +* userspace. There is at least one bit (FS_EVENT_ON_CHILD) which is +* used only internally to the kernel. +*/ +#define INOTIFY_USER_MASK (IN_ALL_EVENTS | IN_ONESHOT | IN_EXCL_UNLINK) + +static inline __u32 inotify_mark_user_mask (struct fsnotify_mark *fsn_mark) +{ +return fsn_mark->mask &INOTIFY_USER_MASK ; +} +extern void inotify_ignored_and_remove_idr (struct fsnotify_mark *fsn_mark,struct fsnotify_group *group); extern int inotify_handle_inode_event(struct fsnotify_mark *inode_mark,
fs/notify/inotify/inotify_user.c +1 -1
@@ -110,7 +110,7 @@ static inline __u32 inotify_arg_to_mask(struct inode *inode, u32 arg) mask |=FS_EVENT_ON_CHILD ;/* mask off the flags used to open the fd */ - mask |= (arg & (IN_ALL_EVENTS |IN_ONESHOT |IN_EXCL_UNLINK )); + mask |= (arg &INOTIFY_USER_MASK );return mask; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 349/879 fsnotify: fix wrong lockdep annotations
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
[ Upstream commit 623af4f538b5df9b416e1b82f720af7371b4c771 ]
Commit 6960b0d909cd ("fsnotify: change locking order") changed some of the mark_mutex locks in direct reclaim path to use:
mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
This change is explained:
"...It uses nested locking to avoid deadlock in case we do the final
iput() on an inode which still holds marks and thus would take the mutex again when calling fsnotify_inode_delete() in destroy_inode()."
The problem is that the mutex_lock_nested() is not a nested lock at all. In fact, it has the opposite effect of preventing lockdep from warning about a very possible deadlock.
Due to these wrong annotations, a deadlock that was introduced with nfsd filecache in kernel v5.4 went unnoticed in v5.4.y for over two years until it was reported recently by Khazhismel Kumykov, only to find out that the deadlock was already fixed in kernel v5.5.
Fix the wrong lockdep annotations.
--- fs/notify/mark.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/notify/mark.c +3 -3
@@ -452,7 +452,7 @@ void fsnotify_free_mark(struct fsnotify_mark *mark)void fsnotify_destroy_mark (struct fsnotify_mark *mark,struct fsnotify_group *group) { -mutex_lock_nested (&group->mark_mutex,SINGLE_DEPTH_NESTING ); +mutex_lock (&group->mark_mutex);fsnotify_detach_mark (mark);mutex_unlock (&group->mark_mutex);fsnotify_free_mark (mark);
@@ -770,7 +770,7 @@ void fsnotify_clear_marks_by_group(struct fsnotify_group *group,* move marks to free to to_free list in one go and then free marks in * to_free list one by one. */ -mutex_lock_nested (&group->mark_mutex,SINGLE_DEPTH_NESTING ); +mutex_lock (&group->mark_mutex);list_for_each_entry_safe (mark, lmark, &group->marks_list, g_list) {if (mark->connector->type == obj_type)list_move (&mark->g_list, &to_free);
@@ -779,7 +779,7 @@ void fsnotify_clear_marks_by_group(struct fsnotify_group *group, clear:while (1 ) { -mutex_lock_nested (&group->mark_mutex,SINGLE_DEPTH_NESTING ); +mutex_lock (&group->mark_mutex);if (list_empty (head)) {mutex_unlock (&group->mark_mutex);break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 350/879 spi: rockchip: fix missing error on unsupported SPI_CS_HIGH
In reply to Greg Kroah-HartmanFrom: Luca Ceresoli <[email protected]>
[ Upstream commit d5d933f09ac326aebad85bfb787cc786ad477711 ]
The hardware (except for the ROCKCHIP_SPI_VER2_TYPE2 version) does not support active-high native chip selects. However if such a CS is configured the core does not error as it normally should, because the 'ctlr->use_gpio_descriptors = true' line in rockchip_spi_probe() makes the core set SPI_CS_HIGH in ctlr->mode_bits.
In such a case the spi-rockchip driver operates normally but produces an active-low chip select signal without notice.
There is no provision in the current core code to handle this situation. Fix by adding a check in the ctlr->setup function (similarly to what spi-atmel.c does).
This cannot be done reading the SPI_CS_HIGH but in ctlr->mode_bits because that bit gets always set by the core for master mode (see above).
--- drivers/spi/spi-rockchip.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/spi/spi-rockchip.c +8 -0
@@ -196,6 +196,8 @@ struct rockchip_spi {bool slave_abort;bool cs_inactive;/* spi slave tansmition stop when cs inactive */ +bool cs_high_supported;/* native CS supports active-high polarity */ +struct spi_transfer *xfer;/* Store xfer temporarily */ };
@@ -719,6 +721,11 @@ static int rockchip_spi_setup(struct spi_device *spi)struct rockchip_spi *rs =spi_controller_get_devdata (spi->controller);u32 cr0; +if (!spi->cs_gpiod && (spi->mode &SPI_CS_HIGH ) && !rs->cs_high_supported) { +dev_warn (&spi->dev,"setup: non GPIO CS can't be active-high\n" ); +return -EINVAL ; + } +pm_runtime_get_sync (rs->dev); cr0 =readl_relaxed (rs->regs +ROCKCHIP_SPI_CTRLR0 );
@@ -899,6 +906,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)switch (readl_relaxed (rs->regs +ROCKCHIP_SPI_VERSION )) {case ROCKCHIP_SPI_VER2_TYPE2 : + rs->cs_high_supported = true; ctlr->mode_bits |=SPI_CS_HIGH ;if (ctlr->can_dma && slave_mode) rs->cs_inactive = true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 351/879 of: overlay: do not break notify on NOTIFY_{OK|STOP}
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
[ Upstream commit 5f756a2eaa4436d7d3dc1e040147f5e992ae34b5 ]
We should not break overlay notifications on NOTIFY_{OK|STOP} otherwise we might break on the first fragment. We should only stop notifications if a *real* errno is returned by one of the listeners.
--- drivers/of/overlay.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/of/overlay.c +1 -3
@@ -170,9 +170,7 @@ static int overlay_notify(struct overlay_changeset *ovcs, ret =blocking_notifier_call_chain (&overlay_notify_chain, action, &nd); -if (ret ==NOTIFY_OK || ret ==NOTIFY_STOP ) -return 0 ; -if (ret) { +if (notifier_to_errno (ret)) { ret =notifier_to_errno (ret);pr_err ("overlay changeset %s notifier error %d, target: %pOF\n" , of_overlay_action_name[action], ret, nd.target);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 352/879 selftests/damon: add damon to selftests root Makefile
In reply to Greg Kroah-HartmanFrom: Yuanchu Xie <[email protected]>
[ Upstream commit 678f0cdc572c5fda940cb038d70eebb8d818adc8 ]
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
@@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 353/879 drm/msm: properly add and remove internal bridges
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d28ea556267c4f2ec7264ab49f1b1296834321ec ]
Add calls to drm_bridge_add()/drm_bridge_remove() DRM bridges created by the driver. This fixes the following warning.
WARNING: CPU: 0 PID: 1 at kernel/locking/mutex.c:579 __mutex_lock+0x840/0x9f4 DEBUG_LOCKS_WARN_ON(lock->magic != lock) Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.18.0-rc1-00002-g3054695a0d27-dirty #55 Hardware name: Generic DT based system unwind_backtrace from show_stack+0x10/0x14 show_stack from dump_stack_lvl+0x58/0x70 dump_stack_lvl from __warn+0xc8/0x1e8 __warn from warn_slowpath_fmt+0x78/0xa8 warn_slowpath_fmt from __mutex_lock+0x840/0x9f4 __mutex_lock from mutex_lock_nested+0x1c/0x24 mutex_lock_nested from drm_bridge_hpd_enable+0x2c/0x84 drm_bridge_hpd_enable from msm_hdmi_modeset_init+0xc0/0x21c msm_hdmi_modeset_init from mdp4_kms_init+0x53c/0x90c mdp4_kms_init from msm_drm_bind+0x514/0x698 msm_drm_bind from try_to_bring_up_aggregate_device+0x160/0x1bc try_to_bring_up_aggregate_device from component_master_add_with_match+0xc4/0xf8 component_master_add_with_match from msm_pdev_probe+0x274/0x350 msm_pdev_probe from platform_probe+0x5c/0xbc platform_probe from really_probe.part.0+0x9c/0x290 really_probe.part.0 from __driver_probe_device+0xa8/0x13c __driver_probe_device from driver_probe_device+0x34/0x10c driver_probe_device from __driver_attach+0xbc/0x178 __driver_attach from bus_for_each_dev+0x74/0xc0 bus_for_each_dev from bus_add_driver+0x160/0x1e4 bus_add_driver from driver_register+0x88/0x118 driver_register from do_one_initcall+0x6c/0x334 do_one_initcall from kernel_init_freeable+0x1bc/0x220 kernel_init_freeable from kernel_init+0x18/0x12c kernel_init from ret_from_fork+0x14/0x2c
Patchwork: https://patchwork.freedesktop.org/patch/481778/
--- drivers/gpu/drm/msm/dp/dp_drm.c | 4 ++++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 3 +++ drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 3 +++ drivers/gpu/drm/msm/msm_drv.c | 3 +++ 4 files changed, 13 insertions(+)
drivers/gpu/drm/msm/dp/dp_drm.c +4 -0
@@ -230,9 +230,13 @@ struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_devi bridge->funcs = &dp_bridge_ops; bridge->encoder = encoder; +drm_bridge_add (bridge); + rc =drm_bridge_attach (encoder, bridge,NULL ,DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (rc) {DRM_ERROR ("failed to attach bridge, rc=%d\n" , rc); +drm_bridge_remove (bridge); +return ERR_PTR (rc); }
drivers/gpu/drm/msm/dsi/dsi_manager.c +3 -0
@@ -665,6 +665,8 @@ struct drm_bridge *msm_dsi_manager_bridge_init(u8 id) bridge = &dsi_bridge->base; bridge->funcs = &dsi_mgr_bridge_funcs; +drm_bridge_add (bridge); + ret =drm_bridge_attach (encoder, bridge,NULL ,0 );if (ret) goto fail;
@@ -735,6 +737,7 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id)void msm_dsi_manager_bridge_destroy (struct drm_bridge *bridge) { +drm_bridge_remove (bridge); }int msm_dsi_manager_cmd_xfer (int id,const struct mipi_dsi_msg *msg)
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +3 -0
@@ -15,6 +15,7 @@ void msm_hdmi_bridge_destroy(struct drm_bridge *bridge)struct hdmi_bridge *hdmi_bridge =to_hdmi_bridge (bridge);msm_hdmi_hpd_disable (hdmi_bridge); +drm_bridge_remove (bridge); }static void msm_hdmi_power_on (struct drm_bridge *bridge)
@@ -349,6 +350,8 @@ struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi)DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID ; +drm_bridge_add (bridge); + ret =drm_bridge_attach (hdmi->encoder, bridge,NULL ,DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret) goto fail;
drivers/gpu/drm/msm/msm_drv.c +3 -0
@@ -232,6 +232,9 @@ static int msm_drm_uninit(struct device *dev)drm_mode_config_cleanup (ddev); +for (i =0 ; i < priv->num_bridges; i++) +drm_bridge_remove (priv->bridges[i]); +pm_runtime_get_sync (dev);msm_irq_uninstall (ddev);pm_runtime_put_sync (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 354/879 drm/msm/dpu: adjust display_v_end for eDP and DP
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit e18aeea7f5efb9508722c8c7fd4d32e6f8cdfe50 ]
The “DP timing” requires the active region to be defined in the bottom-right corner of the frame dimensions which is different with DSI. Therefore both display_h_end and display_v_end need to be adjusted accordingly. However current implementation has only display_h_end adjusted.
Patchwork: https://patchwork.freedesktop.org/patch/476277/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1 -0
@@ -148,6 +148,7 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, active_v_end = active_v_start + (p->yres * hsync_period) -1 ; display_v_start += p->hsync_pulse_width + p->h_back_porch; + display_v_end -= p->h_front_porch; active_hctl = (active_h_end <<16 ) | active_h_start; display_hctl = active_hctl;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 355/879 scsi: iscsi: Fix harmless double shift bug
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 565138ac5f8a5330669a20e5f94759764e9165ec ]
These flags are supposed to be bit numbers. Right now they cause a double shift bug where we use BIT(BIT(2)) instead of BIT(2). Fortunately, the bit numbers are small and it's done consistently so it does not cause an issue at run time.
--- include/scsi/libiscsi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/scsi/libiscsi.h +3 -3
@@ -54,9 +54,9 @@ enum {#define ISID_SIZE 6/* Connection flags */ -#define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0) -#define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1) -#define ISCSI_CONN_FLAG_BOUND BIT(2) +#define ISCSI_CONN_FLAG_SUSPEND_TX 0 +#define ISCSI_CONN_FLAG_SUSPEND_RX 1 +#define ISCSI_CONN_FLAG_BOUND 2#define ISCSI_ITT_MASK 0x1fff#define ISCSI_TOTAL_CMDS_MAX 4096
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 356/879 scsi: ufs: qcom: Fix ufs_qcom_resume()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit bee40dc167da159ea5b939c074e1da258610a3d6 ]
Clearing hba->is_sys_suspended if ufs_qcom_resume() succeeds is wrong. That variable must only be cleared if all actions involved in a resume succeed. Hence remove the statement that clears hba->is_sys_suspended from ufs_qcom_resume().
--- drivers/scsi/ufs/ufs-qcom.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +1 -6
@@ -641,12 +641,7 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)return err; } - err =ufs_qcom_ice_resume (host); -if (err) -return err; - - hba->is_sys_suspended = false; -return 0 ; +return ufs_qcom_ice_resume (host); }static void ufs_qcom_dev_ref_clk_ctrl (struct ufs_qcom_host *host,bool enable)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 357/879 scsi: ufs: core: Exclude UECxx from SFR dump list
In reply to Greg Kroah-HartmanFrom: Kiwoong Kim <[email protected]>
[ Upstream commit ef60031022eb6d972aac86ca26c98c33e1289436 ]
Some devices may return invalid or zeroed data during an UIC error condition. In addition, reading these SFRs will clear them. This means the subsequent error handling will not be able to see them and therefore no error handling will be scheduled.
Skip reading these SFRs in ufshcd_dump_regs().
--- drivers/scsi/ufs/ufshcd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +6 -1
@@ -113,8 +113,13 @@ int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,if (!regs)return -ENOMEM ; -for (pos =0 ; pos < len; pos +=4 ) +for (pos =0 ; pos < len; pos +=4 ) { +if (offset ==0 && + pos >=REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER && + pos <=REG_UIC_ERROR_CODE_DME ) +continue ; regs[pos /4 ] =ufshcd_readl (hba, offset + pos); + }ufshcd_hex_dump (prefix, regs, len);kfree (regs);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 358/879 drm/v3d: Fix null pointer dereference of pointer perfmon
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit ce7a1ecf3f9f1fccaf67295307614511d8e11b13 ]
In the unlikely event that pointer perfmon is null the WARN_ON return path occurs after the pointer has already been deferenced. Fix this by only dereferencing perfmon after it has been null checked.
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/v3d/v3d_perfmon.c +2 -1
@@ -25,11 +25,12 @@ void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon) {unsigned int i;u32 mask; -u8 ncounters = perfmon->ncounters; +u8 ncounters;if (WARN_ON_ONCE (!perfmon || v3d->active_perfmon))return ; + ncounters = perfmon->ncounters; mask =GENMASK (ncounters -1 ,0 );for (i =0 ; i < ncounters; i++) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 359/879 selftests/resctrl: Fix null pointer dereference on open failed
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit c7b607fa9325ccc94982774c505176677117689c ]
Currently if opening /dev/null fails to open then file pointer fp is null and further access to fp via fprintf will cause a null pointer dereference. Fix this by returning a negative error value when a null fp is detected.
Detected using cppcheck static analysis:tools/testing/selftests/resctrl/fill_buf.c:124:6: note: Assuming that condition '!fp' is not redundant
if (!fp)
^
tools/testing/selftests/resctrl/fill_buf.c:126:10: note: Null pointer dereference
fprintf(fp, "Sum: %d ", ret);
--- tools/testing/selftests/resctrl/fill_buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/resctrl/fill_buf.c +3 -1
@@ -121,8 +121,10 @@ static int fill_cache_read(unsigned char *start_ptr, unsigned char *end_ptr,/* Consume read result so that reading memory is not optimized out. */ fp =fopen ("/dev/null" ,"w" ); -if (!fp) +if (!fp) {perror ("Unable to write to /dev/null" ); +return -1 ; + }fprintf (fp,"Sum: %d " , ret);fclose (fp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 360/879 libbpf: Fix logic for finding matching program for CO-RE relocation
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 966a7509325395c51c5f6d89e7352b0585e4804b ]
Fix the bug in bpf_object__relocate_core() which can lead to finding invalid matching BPF program when processing CO-RE relocation. IF matching program is not found, last encountered program will be assumed to be correct program and thus error detection won't detect the problem.
--- tools/lib/bpf/libbpf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/libbpf.c +3 -2
@@ -5646,9 +5646,10 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path)*/ prog =NULL ;for (i =0 ; i < obj->nr_programs; i++) { - prog = &obj->programs[i]; -if (strcmp (prog->sec_name, sec_name) ==0 ) +if (strcmp (obj->programs[i].sec_name, sec_name) ==0 ) { + prog = &obj->programs[i];break ; + } }if (!prog) {pr_warn ("sec '%s': failed to find a BPF program\n" , sec_name);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 361/879 mtd: spi-nor: core: Check written SR value in spi_nor_write_16bit_sr_and_check()
In reply to Greg Kroah-HartmanFrom: Chen-Tsung Hsieh <[email protected]>
[ Upstream commit 70dd83d737d8900b2d98db6dc6b928c596334d37 ]
Read back Status Register 1 to ensure that the written byte match the received value and return -EIO if read back test failed.
Without this patch, spi_nor_write_16bit_sr_and_check() only check the second half of the 16bit. It causes errors like spi_nor_sr_unlock() return success incorrectly when spi_nor_write_16bit_sr_and_check() doesn't write SR successfully.
--- drivers/mtd/spi-nor/core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/mtd/spi-nor/core.c +9 -0
@@ -788,6 +788,15 @@ static int spi_nor_write_16bit_sr_and_check(struct spi_nor *nor, u8 sr1)if (ret)return ret; + ret =spi_nor_read_sr (nor, sr_cr); +if (ret) +return ret; + +if (sr1 != sr_cr[0 ]) { +dev_dbg (nor->dev,"SR: Read back test failed\n" ); +return -EIO ; + } +if (nor->flags &SNOR_F_NO_READ_CR )return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 362/879 x86/pm: Fix false positive kmemleak report in msr_build_context()
In reply to Greg Kroah-HartmanFrom: Matthieu Baerts <[email protected]>
[ Upstream commit b0b592cf08367719e1d1ef07c9f136e8c17f7ec3 ]
Since
e2a1256b17b1 ("x86/speculation: Restore speculation related MSRs during S3 resume")
kmemleak reports this issue:
unreferenced object 0xffff888009cedc00 (size 256):
comm "swapper/0", pid 1, jiffies 4294693823 (age 73.764s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 ........H.......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
msr_build_context (include/linux/slab.h:621)
pm_check_save_msr (arch/x86/power/cpu.c:520)
do_one_initcall (init/main.c:1298)
kernel_init_freeable (init/main.c:1370)
kernel_init (init/main.c:1504)
ret_from_fork (arch/x86/entry/entry_64.S:304)Reproducer:
- boot the VM with a debug kernel config (see
https://github.com/multipath-tcp/mptcp_net-next/issues/268)
- wait ~1 minute
- start a kmemleak scan
The root cause here is alignment within the packed struct saved_context (from suspend_64.h). Kmemleak only searches for pointers that are aligned (see how pointers are scanned in kmemleak.c), but pahole shows that the saved_msrs struct member and all members after it in the structure are unaligned:
struct saved_context {
struct pt_regs regs; /* 0 168 */
/* --- cacheline 2 boundary (128 bytes) was 40 bytes ago --- */
u16 ds; /* 168 2 */...
u64 misc_enable; /* 232 8 */
bool misc_enable_saved; /* 240 1 */
/* Note below odd offset values for the remainder of this struct */
struct saved_msrs saved_msrs; /* 241 16 */
/* --- cacheline 4 boundary (256 bytes) was 1 bytes ago --- */
long unsigned int efer; /* 257 8 */
u16 gdt_pad; /* 265 2 */
struct desc_ptr gdt_desc; /* 267 10 */
u16 idt_pad; /* 277 2 */
struct desc_ptr idt; /* 279 10 */
u16 ldt; /* 289 2 */
u16 tss; /* 291 2 */
long unsigned int tr; /* 293 8 */
long unsigned int safety; /* 301 8 */
long unsigned int return_address; /* 309 8 */
/* size: 317, cachelines: 5, members: 25 */
/* last cacheline: 61 bytes */
} __attribute__((__packed__));
Move misc_enable_saved to the end of the struct declaration so that saved_msrs fits in before the cacheline 4 boundary.
The comment above the saved_context declaration says to fix wakeup_64.S file and __save/__restore_processor_state() if the struct is modified:
it looks like all the accesses in wakeup_64.S are done through offsets which are computed at build-time. Update that comment accordingly.
At the end, the false positive kmemleak report is due to a limitation from kmemleak but it is always good to avoid unaligned members for optimisation purposes.
Please note that it looks like this issue is not new, e.g.
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
[ bp: Massage + cleanup commit message. ]
--- arch/x86/include/asm/suspend_32.h | 2 +- arch/x86/include/asm/suspend_64.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-)
arch/x86/include/asm/suspend_32.h +1 -1
@@ -19,7 +19,6 @@ struct saved_context {u16 gs;unsigned long cr0, cr2, cr3, cr4;u64 misc_enable; -bool misc_enable_saved;struct saved_msrs saved_msrs;struct desc_ptr gdt_desc;struct desc_ptr idt;
@@ -28,6 +27,7 @@ struct saved_context {unsigned long tr;unsigned long safety;unsigned long return_address; +bool misc_enable_saved; } __attribute__((packed));/* routines for saving/restoring kernel state */
arch/x86/include/asm/suspend_64.h +8 -4
@@ -14,9 +14,13 @@* Image of the saved processor state, used by the low level ACPI suspend to * RAM code and by the low level hibernation code. * -* If you modify it, fix arch/x86/kernel/acpi/wakeup_64.S and make sure that -* __save/__restore_processor_state(), defined in arch/x86/kernel/suspend_64.c, -* still work as required. +* If you modify it, check how it is used in arch/x86/kernel/acpi/wakeup_64.S +* and make sure that __save/__restore_processor_state(), defined in +* arch/x86/power/cpu.c, still work as required. +* +* Because the structure is packed, make sure to avoid unaligned members. For +* optimisation purposes but also because tools like kmemleak only search for +* pointers that are aligned. */ struct saved_context {struct pt_regs regs;
@@ -36,7 +40,6 @@ struct saved_context {unsigned long cr0, cr2, cr3, cr4;u64 misc_enable; -bool misc_enable_saved;struct saved_msrs saved_msrs;unsigned long efer;u16 gdt_pad;/* Unused */
@@ -48,6 +51,7 @@ struct saved_context {unsigned long tr;unsigned long safety;unsigned long return_address; +bool misc_enable_saved; } __attribute__((packed));#define loaddebug (thread,register) \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 363/879 mtd: rawnand: cadence: fix possible null-ptr-deref in cadence_nand_dt_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit a28ed09dafee20da51eb26452950839633afd824 ]
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.
--- drivers/mtd/nand/raw/cadence-nand-controller.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +2 -3
@@ -2983,11 +2983,10 @@ static int cadence_nand_dt_probe(struct platform_device *ofdev)if (IS_ERR (cdns_ctrl->reg))return PTR_ERR (cdns_ctrl->reg); - res =platform_get_resource (ofdev,IORESOURCE_MEM ,1 ); - cdns_ctrl->io.dma = res->start; - cdns_ctrl->io.virt =devm_ioremap_resource (&ofdev->dev, res); + cdns_ctrl->io.virt =devm_platform_get_and_ioremap_resource (ofdev,1 , &res);if (IS_ERR (cdns_ctrl->io.virt))return PTR_ERR (cdns_ctrl->io.virt); + cdns_ctrl->io.dma = res->start; dt->clk =devm_clk_get (cdns_ctrl->dev,"nf_clk" );if (IS_ERR (dt->clk))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 364/879 mtd: rawnand: intel: fix possible null-ptr-deref in ebu_nand_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ddf66aefd685fd46500b9917333e1b1e118276dc ]
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref.
--- drivers/mtd/nand/raw/intel-nand-controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/intel-nand-controller.c +1 -1
@@ -619,9 +619,9 @@ static int ebu_nand_probe(struct platform_device *pdev) resname =devm_kasprintf (dev,GFP_KERNEL ,"nand_cs%d" , cs); res =platform_get_resource_byname (pdev,IORESOURCE_MEM , resname); ebu_host->cs[cs].chipaddr =devm_ioremap_resource (dev, res); - ebu_host->cs[cs].nand_pa = res->start;if (IS_ERR (ebu_host->cs[cs].chipaddr))return PTR_ERR (ebu_host->cs[cs].chipaddr); + ebu_host->cs[cs].nand_pa = res->start; ebu_host->clk =devm_clk_get (dev,NULL );if (IS_ERR (ebu_host->clk))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 365/879 x86/speculation: Add missing prototype for unpriv_ebpf_notify()
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 2147c438fde135d6c145a96e373d9348e7076f7f ]
Fix the following warnings seen with "make W=1":
kernel/sysctl.c:183:13: warning: no previous prototype for ‘unpriv_ebpf_notify’ [-Wmissing-prototypes]
183 | void __weak unpriv_ebpf_notify(int new_state)
| ^~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/bugs.c:659:6: warning: no previous prototype for ‘unpriv_ebpf_notify’ [-Wmissing-prototypes]
659 | void unpriv_ebpf_notify(int new_state)
| ^~~~~~~~~~~~~~~~~~
--- include/linux/bpf.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/bpf.h +2 -0
@@ -1984,6 +1984,8 @@ void bpf_offload_dev_netdev_unregister(struct bpf_offload_dev *offdev, struct net_device *netdev);bool bpf_offload_dev_match (struct bpf_prog *prog,struct net_device *netdev); +void unpriv_ebpf_notify (int new_state); +#if defined(CONFIG_NET ) && defined(CONFIG_BPF_SYSCALL )int bpf_prog_offload_init (struct bpf_prog *prog,union bpf_attr *attr);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 366/879 ASoC: rk3328: fix disabling mclk on pclk probe failure
In reply to Greg Kroah-HartmanFrom: Nicolas Frattaroli <[email protected]>
[ Upstream commit dd508e324cdde1c06ace08a8143fa50333a90703 ]
If preparing/enabling the pclk fails, the probe function should unprepare and disable the previously prepared and enabled mclk, which it doesn't do. This commit rectifies this.
--- sound/soc/codecs/rk3328_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rk3328_codec.c +1 -1
@@ -481,7 +481,7 @@ static int rk3328_platform_probe(struct platform_device *pdev) ret =clk_prepare_enable (rk3328->pclk);if (ret <0 ) {dev_err (&pdev->dev,"failed to enable acodec pclk\n" ); -return ret; + goto err_unprepare_mclk; } base =devm_platform_ioremap_resource (pdev,0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 367/879 perf tools: Add missing headers needed by util/data.h
In reply to Greg Kroah-HartmanFrom: Yang Jihong <[email protected]>
[ Upstream commit 4d27cf1d9de5becfa4d1efb2ea54dba1b9fc962a ]
'struct perf_data' in util/data.h uses the "u64" data type, which is defined in "linux/types.h".
If we only include util/data.h, the following compilation error occurs:
util/data.h:38:3: error: unknown type name ‘u64’
u64 version;
^~~Solution: include "linux/types.h." to add the needed type definitions.
--- tools/perf/util/data.h | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/data.h +1 -0
@@ -4,6 +4,7 @@#include <stdio.h> #include <stdbool.h> +#include <linux/types.h> enum perf_data_mode {PERF_DATA_MODE_WRITE ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 368/879 drm/msm/disp/dpu1: set vbif hw config to NULL to avoid use after memory free during pm runtime resume
In reply to Greg Kroah-HartmanFrom: Vinod Polimera <[email protected]>
[ Upstream commit fa5186b279ecf44b14fb435540d2065be91cb1ed ]
BUG: Unable to handle kernel paging request at virtual address 006b6b6b6b6b6be3 Call trace: dpu_vbif_init_memtypes+0x40/0xb8 dpu_runtime_resume+0xcc/0x1c0 pm_generic_runtime_resume+0x30/0x44 __genpd_runtime_resume+0x68/0x7c genpd_runtime_resume+0x134/0x258 __rpm_callback+0x98/0x138 rpm_callback+0x30/0x88 rpm_resume+0x36c/0x49c __pm_runtime_resume+0x80/0xb0 dpu_core_irq_uninstall+0x30/0xb0 dpu_irq_uninstall+0x18/0x24 msm_drm_uninit+0xd8/0x16c
Patchwork: https://patchwork.freedesktop.org/patch/483255/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -1
@@ -793,8 +793,10 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)for (i =0 ; i < dpu_kms->catalog->vbif_count; i++) {u32 vbif_idx = dpu_kms->catalog->vbif[i].id; -if ((vbif_idx <VBIF_MAX ) && dpu_kms->hw_vbif[vbif_idx]) +if ((vbif_idx <VBIF_MAX ) && dpu_kms->hw_vbif[vbif_idx]) {dpu_hw_vbif_destroy (dpu_kms->hw_vbif[vbif_idx]); + dpu_kms->hw_vbif[vbif_idx] =NULL ; + } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 369/879 drm/msm/dp: stop event kernel thread when DP unbind
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 570d3e5d28db7a94557fa179167a9fb8642fb8a1 ]
Current DP driver implementation, event thread is kept running after DP display is unbind. This patch fix this problem by disabling DP irq and stop event thread to exit gracefully at dp_display_unbind().
Changes in v2:
-- start event thread at dp_display_bind()
Changes in v3:
-- disable all HDP interrupts at unbind
-- replace dp_hpd_event_setup() with dp_hpd_event_thread_start() -- replace dp_hpd_event_stop() with dp_hpd_event_thread_stop() -- move init_waitqueue_head(&dp->event_q) to probe() -- move spin_lock_init(&dp->event_lock) to probe()
Changes in v4:
-- relocate both dp_display_bind() and dp_display_unbind() to bottom of file
Changes in v5:
-- cancel relocation of both dp_display_bind() and dp_display_unbind()
Changes in v6:
-- move empty event q to dp_event_thread_start()
Changes in v7:
-- call ktheread_stop() directly instead of dp_hpd_event_thread_stop() function
Changes in v8:
-- return error immediately if audio registration failed.
Changes in v9:
-- return error immediately if event thread create failed.
Changes in v10:
-- delete extra DRM_ERROR("failed to create DP event thread\n");
Patchwork: https://patchwork.freedesktop.org/patch/482399/
--- drivers/gpu/drm/msm/dp/dp_display.c | 39 +++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +31 -8
@@ -113,6 +113,7 @@ struct dp_display_private {u32 hpd_state;u32 event_pndx;u32 event_gndx; +struct task_struct *ev_tsk;struct dp_event event_list[DP_EVENT_Q_MAX ];spinlock_t event_lock;
@@ -249,6 +250,8 @@ void dp_display_signal_audio_complete(struct msm_dp *dp_display)complete_all (&dp->audio_comp); } +static int dp_hpd_event_thread_start (struct dp_display_private *dp_priv); +static int dp_display_bind (struct device *dev,struct device *master,void *data) {
@@ -282,9 +285,18 @@ static int dp_display_bind(struct device *dev, struct device *master, } rc =dp_register_audio_driver (dev, dp->audio); -if (rc) +if (rc) {DRM_ERROR ("Audio registration Dp failed\n" ); + goto end; + } + rc =dp_hpd_event_thread_start (dp); +if (rc) { +DRM_ERROR ("Event thread create failed\n" ); + goto end; + } + +return 0 ; end:return rc; }
@@ -295,6 +307,11 @@ static void dp_display_unbind(struct device *dev, struct device *master,struct dp_display_private *dp =dev_get_dp_display_private (dev);struct msm_drm_private *priv =dev_get_drvdata (master); +/* disable all HPD interrupts */ +dp_catalog_hpd_config_intr (dp->catalog,DP_DP_HPD_INT_MASK , false); + +kthread_stop (dp->ev_tsk); +dp_power_client_deinit (dp->power);dp_aux_unregister (dp->aux); priv->dp[dp->id] =NULL ;
@@ -1090,7 +1107,7 @@ static int hpd_event_thread(void *data) dp_priv = (struct dp_display_private *)data; -while (1 ) { +while (!kthread_should_stop ()) {if (timeout_mode) { wait_event_timeout(dp_priv->event_q, (dp_priv->event_pndx == dp_priv->event_gndx),
@@ -1168,12 +1185,17 @@ static int hpd_event_thread(void *data)return 0 ; } -static void dp_hpd_event_setup (struct dp_display_private *dp_priv) +static int dp_hpd_event_thread_start (struct dp_display_private *dp_priv) { -init_waitqueue_head (&dp_priv->event_q); -spin_lock_init (&dp_priv->event_lock); +/* set event q to empty */ + dp_priv->event_gndx =0 ; + dp_priv->event_pndx =0 ; -kthread_run (hpd_event_thread, dp_priv,"dp_hpd_handler" ); + dp_priv->ev_tsk =kthread_run (hpd_event_thread, dp_priv,"dp_hpd_handler" ); +if (IS_ERR (dp_priv->ev_tsk)) +return PTR_ERR (dp_priv->ev_tsk); + +return 0 ; }static irqreturn_t dp_display_irq_handler (int irq,void *dev_id)
@@ -1303,7 +1325,10 @@ static int dp_display_probe(struct platform_device *pdev)return -EPROBE_DEFER ; } +/* setup event q */ mutex_init (&dp->event_mutex); +init_waitqueue_head (&dp->event_q); +spin_lock_init (&dp->event_lock);/* Store DP audio handle inside DP display */ dp->dp_display.dp_audio = dp->audio;
@@ -1483,8 +1508,6 @@ void msm_dp_irq_postinstall(struct msm_dp *dp_display) dp = container_of(dp_display, struct dp_display_private, dp_display); -dp_hpd_event_setup (dp); -dp_add_event (dp,EV_HPD_INIT_SETUP ,0 ,100 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 370/879 drm/msm/dp: fix error check return value of irq_of_parse_and_map()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit e92d0d93f86699b7b25c7906613fdc374d66c8ca ]
The irq_of_parse_and_map() function returns 0 on failure, and does not return an negative value.
Patchwork: https://patchwork.freedesktop.org/patch/483176/
--- drivers/gpu/drm/msm/dp/dp_display.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +3 -4
@@ -1255,10 +1255,9 @@ int dp_display_request_irq(struct msm_dp *dp_display) dp = container_of(dp_display, struct dp_display_private, dp_display); dp->irq =irq_of_parse_and_map (dp->pdev->dev.of_node,0 ); -if (dp->irq <0 ) { - rc = dp->irq; -DRM_ERROR ("failed to get irq: %d\n" , rc); -return rc; +if (!dp->irq) { +DRM_ERROR ("failed to get irq\n" ); +return -EINVAL ; } rc = devm_request_irq(&dp->pdev->dev, dp->irq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 371/879 drm/msm/dp: reset DP controller before transmit phy test pattern
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 581d69981159b00f0443d171a4b900089f34ccfe ]
DP controller state can not switch from video ready state to transmit phy pattern state at run time. DP mainlink has to be teared down followed by reset controller to default state to have DP controller switch to transmit phy test pattern state and start generate specified phy test pattern to sinker once main link setup again.
Changes in v2:
-- correct Fixes's commit id
Patchwork: https://patchwork.freedesktop.org/patch/483563/
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dp/dp_ctrl.c +1 -1
@@ -1532,7 +1532,7 @@ static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl)* running. Add the global reset just before disabling the * link clocks and core clocks. */ - ret =dp_ctrl_off_link_stream (&ctrl->dp_ctrl); + ret =dp_ctrl_off (&ctrl->dp_ctrl);if (ret) {DRM_ERROR ("failed to disable DP controller\n" );return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 372/879 drm/msm/dp: do not stop transmitting phy test pattern during DP phy compliance test
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 2788b4efa60c1e03ac10a156f3fdbd3be0f9198c ]
At normal operation, transmit phy test pattern has to be terminated before DP controller switch to video ready state. However during phy compliance testing, transmit phy test pattern should not be terminated until end of compliance test which usually indicated by unplugged interrupt.
Only stop sending the train pattern in dp_ctrl_on_stream() if we're not doing compliance testing. We also no longer reset 'p_level' and 'v_level' within dp_ctrl_on_link() due to both 'p_level' and 'v_level' are acquired from link status at previous dpcd read and we like to use those level to start link training.
Changes in v2:
-- add more details commit text
-- correct Fixes
Changes in v3:
-- drop unnecessary braces
Patchwork: https://patchwork.freedesktop.org/patch/483564/
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/dp/dp_ctrl.c +6 -8
@@ -1699,8 +1699,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) ctrl->link->link_params.rate, ctrl->link->link_params.num_lanes, ctrl->dp_ctrl.pixel_rate); - ctrl->link->phy_params.p_level =0 ; - ctrl->link->phy_params.v_level =0 ; rc =dp_ctrl_enable_mainlink_clocks (ctrl);if (rc)
@@ -1822,12 +1820,6 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl) } } -if (!dp_ctrl_channel_eq_ok (ctrl)) -dp_ctrl_link_retrain (ctrl); - -/* stop txing train pattern to end link training */ -dp_ctrl_clear_training_pattern (ctrl); - ret =dp_ctrl_enable_stream_clocks (ctrl);if (ret) {DRM_ERROR ("Failed to start pixel clocks. ret=%d\n" , ret);
@@ -1839,6 +1831,12 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)return 0 ; } +if (!dp_ctrl_channel_eq_ok (ctrl)) +dp_ctrl_link_retrain (ctrl); + +/* stop txing train pattern to end link training */ +dp_ctrl_clear_training_pattern (ctrl); +/* * Set up transfer unit values and set controller state to send * video.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 373/879 drm/msm/dsi: fix error checks and return values for DSI xmit functions
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit f0e7e9ed379c012c4d6b09a09b868accc426223c ]
As noticed by Dan ([1] an the followup thread) there are multiple issues with the return values for MSM DSI command transmission callback. In the error case it can easily return a positive value when it should have returned a proper error code.
This commits attempts to fix these issues both in TX and in RX paths.
[1]: https://lore.kernel.org/linux-arm-msm/20211001123617.GH2283@kili/
Patchwork: https://patchwork.freedesktop.org/patch/480501/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +14 -7
@@ -1341,10 +1341,10 @@ static int dsi_cmds2buf_tx(struct msm_dsi_host *msm_host,dsi_get_bpp (msm_host->format) /8 ; len =dsi_cmd_dma_add (msm_host, msg); -if (!len) { +if (len <0 ) {pr_err ("%s: failed to add cmd type = 0x%x\n" , __func__, msg->type); -return -EINVAL ; +return len; }/* for video mode, do not send cmds more than
@@ -1363,10 +1363,14 @@ static int dsi_cmds2buf_tx(struct msm_dsi_host *msm_host, } ret =dsi_cmd_dma_tx (msm_host, len); -if (ret < len) { -pr_err ("%s: cmd dma tx failed, type=0x%x, data0=0x%x, len=%d\n" , - __func__, msg->type, (*(u8 *)(msg->tx_buf)), len); -return -ECOMM ; +if (ret <0 ) { +pr_err ("%s: cmd dma tx failed, type=0x%x, data0=0x%x, len=%d, ret=%d\n" , + __func__, msg->type, (*(u8 *)(msg->tx_buf)), len, ret); +return ret; + }else if (ret < len) { +pr_err ("%s: cmd dma tx failed, type=0x%x, data0=0x%x, ret=%d len=%d\n" , + __func__, msg->type, (*(u8 *)(msg->tx_buf)), ret, len); +return -EIO ; }return len;
@@ -2092,9 +2096,12 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host, } ret =dsi_cmds2buf_tx (msm_host, msg); -if (ret < msg->tx_len) { +if (ret <0 ) {pr_err ("%s: Read cmd Tx failed, %d\n" , __func__, ret);return ret; + }else if (ret < msg->tx_len) { +pr_err ("%s: Read cmd Tx failed, too short: %d\n" , __func__, ret); +return -ECOMM ; }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 374/879 drm/msm/hdmi: check return value after calling platform_get_resource_byname()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit a36e506711548df923ceb7ec9f6001375be799a5 ]
It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value.
Patchwork: https://patchwork.freedesktop.org/patch/482992/
--- drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/hdmi/hdmi.c +4 -0
@@ -142,6 +142,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)/* HDCP needs physical address of hdmi register */ res =platform_get_resource_byname (pdev,IORESOURCE_MEM , config->mmio_name); +if (!res) { + ret = -EINVAL ; + goto fail; + } hdmi->mmio_phy_addr = res->start; hdmi->qfprom_mmio =msm_ioremap (pdev, config->qfprom_mmio_name);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 375/879 drm/msm/hdmi: fix error check return value of irq_of_parse_and_map()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 03371e4fbdeb7f596cbceacb59e474248b6d95ac ]
The irq_of_parse_and_map() function returns 0 on failure, and does not return a negative value anyhow, so never enter this conditional branch.
Patchwork: https://patchwork.freedesktop.org/patch/483294/
--- drivers/gpu/drm/msm/hdmi/hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi.c +3 -3
@@ -302,9 +302,9 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,drm_connector_attach_encoder (hdmi->connector, hdmi->encoder); hdmi->irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -if (hdmi->irq <0 ) { - ret = hdmi->irq; -DRM_DEV_ERROR (dev->dev,"failed to get irq: %d\n" , ret); +if (!hdmi->irq) { + ret = -EINVAL ; +DRM_DEV_ERROR (dev->dev,"failed to get irq\n" ); goto fail; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 376/879 drm/msm: add missing include to msm_drv.c
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 8123fe83c3a3448bbfa5b5b1cacfdfe7d076fca6 ]
Add explicit include of drm_bridge.h to the msm_drv.c to fix the following warning:
drivers/gpu/drm/msm/msm_drv.c:236:17: error: implicit declaration of function 'drm_bridge_remove'; did you mean 'drm_bridge_detach'? [-Werror=implicit-function-declaration]
Patchwork: https://patchwork.freedesktop.org/patch/484310/
--- drivers/gpu/drm/msm/msm_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_drv.c +1 -0
@@ -11,6 +11,7 @@#include <linux/uaccess.h> #include <uapi/linux/sched/types.h> +#include <drm/drm_bridge.h> #include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h>
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 377/879 drm/panel: panel-simple: Fix proper bpc for AM-1280800N3TZQW-T00H
In reply to Greg Kroah-HartmanFrom: Jagan Teki <[email protected]>
[ Upstream commit 7eafbecd2288c542ea15ea20cf1a7e64a25c21bc ]
AM-1280800N3TZQW-T00H panel support 8 bpc not 6 bpc as per recent testing in i.MX8MM platform.
Fix it.
--- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +1 -1
@@ -720,7 +720,7 @@ static const struct drm_display_mode ampire_am_1280800n3tzqw_t00h_mode = {static const struct panel_desc ampire_am_1280800n3tzqw_t00h = { .modes = &ire_am_1280800n3tzqw_t00h_mode, .num_modes =1 , - .bpc =6 , + .bpc =8 , .size = { .width =217 , .height =136 ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 378/879 drm/bridge: it6505: Send DPCD SET_POWER to downstream
In reply to Greg Kroah-HartmanFrom: Pin-Yen Lin <[email protected]>
[ Upstream commit 46ca7da7f1e8592af6059419176dd58c10dcdb5b ]
Send DPCD SET_POWER command to downstream in .atomic_disable to make the downstream monitor enter the power down mode, so the device suspend won't be affected.
--- drivers/gpu/drm/bridge/ite-it6505.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +18 -11
@@ -737,8 +737,9 @@ static int it6505_drm_dp_link_probe(struct drm_dp_aux *aux,return 0 ; } -static int it6505_drm_dp_link_power_up (struct drm_dp_aux *aux, -struct it6505_drm_dp_link *link) +static int it6505_drm_dp_link_set_power (struct drm_dp_aux *aux, +struct it6505_drm_dp_link *link, +u8 mode) {u8 value;int err;
@@ -752,18 +753,20 @@ static int it6505_drm_dp_link_power_up(struct drm_dp_aux *aux,return err; value &= ~DP_SET_POWER_MASK ; - value |=DP_SET_POWER_D0 ; + value |= mode; err =drm_dp_dpcd_writeb (aux,DP_SET_POWER , value);if (err <0 )return err; -/* -* According to the DP 1.1 specification, a "Sink Device must exit the -* power saving state within 1 ms" (Section 2.5.3.1, Table 5-52, "Sink -* Control Field" (register 0x600). -*/ -usleep_range (1000 ,2000 ); +if (mode ==DP_SET_POWER_D0 ) { +/* +* According to the DP 1.1 specification, a "Sink Device must +* exit the power saving state within 1 ms" (Section 2.5.3.1, +* Table 5-52, "Sink Control Field" (register 0x600). +*/ +usleep_range (1000 ,2000 ); + }return 0 ; }
@@ -2624,7 +2627,8 @@ static enum drm_connector_status it6505_detect(struct it6505 *it6505)if (it6505_get_sink_hpd_status (it6505)) {it6505_aux_on (it6505);it6505_drm_dp_link_probe (&it6505->aux, &it6505->link); -it6505_drm_dp_link_power_up (&it6505->aux, &it6505->link); +it6505_drm_dp_link_set_power (&it6505->aux, &it6505->link, +DP_SET_POWER_D0 ); it6505->auto_train_retry =AUTO_TRAIN_RETRY ;if (it6505->dpcd[0 ] ==0 ) {
@@ -2960,8 +2964,11 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge,DRM_DEV_DEBUG_DRIVER (dev,"start" ); -if (it6505->powered) +if (it6505->powered) {it6505_video_disable (it6505); +it6505_drm_dp_link_set_power (&it6505->aux, &it6505->link, +DP_SET_POWER_D3 ); + } } static enum drm_connector_status
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 379/879 drm/msm: Fix null pointer dereferences without iommu
In reply to Greg Kroah-HartmanFrom: Luca Weiss <[email protected]>
[ Upstream commit 36a1d1bda77e1851bddfa9cf4e8ada94476dbaff ]
Check if 'aspace' is set before using it as it will stay null without IOMMU, such as on msm8974.
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 ++++- drivers/gpu/drm/msm/msm_gpu.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +4 -1
@@ -272,7 +272,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx, *value =0 ;return 0 ;case MSM_PARAM_FAULTS : - *value = gpu->global_faults + ctx->aspace->faults; +if (ctx->aspace) + *value = gpu->global_faults + ctx->aspace->faults; +else + *value = gpu->global_faults;return 0 ;case MSM_PARAM_SUSPENDS : *value = gpu->suspend_count;
drivers/gpu/drm/msm/msm_gpu.c +2 -1
@@ -371,7 +371,8 @@ static void recover_worker(struct kthread_work *work)/* Increment the fault counts */ submit->queue->faults++; - submit->aspace->faults++; +if (submit->aspace) + submit->aspace->faults++; task =get_pid_task (submit->pid,PIDTYPE_PID );if (task) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 380/879 kunit: fix debugfs code to use enum kunit_status, not bool
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit 38289a26e1b8a37755f3e07056ca416c1ee2a2e8 ]
Commit 6d2426b2f258 ("kunit: Support skipped tests") switched to using enum kunit_status to track the result of running a test/suite since we now have more than just pass/fail.
This callsite wasn't updated, silently converting to enum to a bool and then back.
--- lib/kunit/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/kunit/debugfs.c +1 -1
@@ -52,7 +52,7 @@ static void debugfs_print_result(struct seq_file *seq,static int debugfs_print_results (struct seq_file *seq,void *v) {struct kunit_suite *suite = (struct kunit_suite *)seq->private; -bool success =kunit_suite_has_succeeded (suite); +enum kunit_status success =kunit_suite_has_succeeded (suite);struct kunit_case *test_case;if (!suite || !suite->log)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 381/879 drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f8c242908ad15bbd604d3bcb54961b7d454c43f8 ]
It will cause null-ptr-deref in resource_size(), if platform_get_resource() returns NULL, move calling resource_size() after devm_ioremap_resource() that will check 'res' to avoid null-ptr-deref.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
@@ -2118,10 +2118,10 @@ static int vop_bind(struct device *dev, struct device *master, void *data)vop_win_init (vop); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - vop->len =resource_size (res); vop->regs =devm_ioremap_resource (dev, res);if (IS_ERR (vop->regs))return PTR_ERR (vop->regs); + vop->len =resource_size (res); res =platform_get_resource (pdev,IORESOURCE_MEM ,1 );if (res) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 382/879 spi: cadence-quadspi: fix Direct Access Mode disable for SoCFPGA
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
[ Upstream commit f724c296f2f2cc3f9342b0fc26239635cbed856e ]
The Cadence QSPI compatible string required for the SoCFPGA platform changed from the default "cdns,qspi-nor" to "intel,socfpga-qspi" with the introduction of an additional quirk in
commit 98d948eb8331 ("spi: cadence-quadspi: fix write completion support"). However, that change did not preserve the previously used
quirk for this platform. Reinstate the CQSPI_DISABLE_DAC_MODE quirk for the SoCFPGA platform.
--- drivers/spi/spi-cadence-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-cadence-quadspi.c +1 -1
@@ -1865,7 +1865,7 @@ static const struct cqspi_driver_platdata intel_lgm_qspi = { };static const struct cqspi_driver_platdata socfpga_qspi = { - .quirks =CQSPI_NO_SUPPORT_WR_COMPLETION , + .quirks =CQSPI_DISABLE_DAC_MODE |CQSPI_NO_SUPPORT_WR_COMPLETION , };static const struct cqspi_driver_platdata versal_ospi = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 383/879 perf tools: Use Python devtools for version autodetection rather than runtime
In reply to Greg Kroah-HartmanFrom: James Clark <[email protected]>
[ Upstream commit 630af16eee495f583db5202c3613d1b191f10694 ]
This fixes the issue where the build will fail if only the Python2 runtime is installed but the Python3 devtools are installed. Currently the workaround is 'make PYTHON=python3'.
Fix it by autodetecting Python based on whether python[x]-config exists rather than just python[x] because both are needed for the build. Then -config is stripped to find the Python runtime.
Testing
=======
* Auto detect links with Python3 when the v3 devtools are installed and only Python 2 runtime is installed
* Auto detect links with Python2 when both devtools are installed
* Sensible warning is printed if no Python devtools are installed
* 'make PYTHON=x' still automatically sets PYTHON_CONFIG=x-config
* 'make PYTHON=x' fails if x-config doesn't exist
* 'make PYTHON=python3' overrides Python2 devtools
* 'make PYTHON=python2' overrides Python3 devtools
* 'make PYTHON_CONFIG=x-config' works
* 'make PYTHON=x PYTHON_CONFIG=x' works
* 'make PYTHON=missing' reports an error
* 'make PYTHON_CONFIG=missing' reports an error
--- tools/perf/Makefile.config | 39 ++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-)
tools/perf/Makefile.config +27 -12
@@ -239,18 +239,33 @@ ifdef PARSER_DEBUG endif # Try different combinations to accommodate systems that only have -# python[2][-config] in weird combinations but always preferring -# python2 and python2-config as per pep-0394. If python2 or python -# aren't found, then python3 is used. -PYTHON_AUTO := python -PYTHON_AUTO := $(if $(call get-executable,python3),python3,$(PYTHON_AUTO)) -PYTHON_AUTO := $(if $(call get-executable,python),python,$(PYTHON_AUTO)) -PYTHON_AUTO := $(if $(call get-executable,python2),python2,$(PYTHON_AUTO)) -override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO)) -PYTHON_AUTO_CONFIG := \ - $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) -override PYTHON_CONFIG := \ - $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO_CONFIG)) +# python[2][3]-config in weird combinations in the following order of +# priority from lowest to highest: +# * python3-config +# * python-config +# * python2-config as per pep-0394. +# * $(PYTHON)-config (If PYTHON is user supplied but PYTHON_CONFIG isn't) +# +PYTHON_AUTO := python-config +PYTHON_AUTO := $(if $(call get-executable,python3-config),python3-config,$(PYTHON_AUTO)) +PYTHON_AUTO := $(if $(call get-executable,python-config),python-config,$(PYTHON_AUTO)) +PYTHON_AUTO := $(if $(call get-executable,python2-config),python2-config,$(PYTHON_AUTO)) + +# If PYTHON is defined but PYTHON_CONFIG isn't, then take $(PYTHON)-config as if it was the user +# supplied value for PYTHON_CONFIG. Because it's "user supplied", error out if it doesn't exist. +ifdef PYTHON + ifndef PYTHON_CONFIG + PYTHON_CONFIG_AUTO := $(call get-executable,$(PYTHON)-config) + PYTHON_CONFIG := $(if $(PYTHON_CONFIG_AUTO),$(PYTHON_CONFIG_AUTO),\ + $(call $(error $(PYTHON)-config not found))) + endif +endif + +# Select either auto detected python and python-config or use user supplied values if they are +# defined. get-executable-or-default fails with an error if the first argument is supplied but +# doesn't exist. +override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO)) +override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_AUTO))) grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 384/879 virtio_blk: fix the discard_granularity and discard_alignment queue limits
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 62952cc5bccd89b76d710de1d0b43244af0f2903 ]
The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts.
On the other hand the discard_sector_alignment from the virtio 1.1 looks similar to what Linux uses as discard granularity (even if not very well described):
"discard_sector_alignment can be used by OS when splitting a request
based on alignment. "
And at least qemu does set it to the discard granularity.
So stop setting the discard_alignment and use the virtio discard_sector_alignment to set the discard granularity.
--- drivers/block/virtio_blk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/block/virtio_blk.c +4 -3
@@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev)blk_queue_io_opt (q, blk_size * opt_io_size);if (virtio_has_feature (vdev,VIRTIO_BLK_F_DISCARD )) { - q->limits.discard_granularity = blk_size; - virtio_cread(vdev, struct virtio_blk_config, discard_sector_alignment, &v); - q->limits.discard_alignment = v ? v <<SECTOR_SHIFT :0 ; +if (v) + q->limits.discard_granularity = v <<SECTOR_SHIFT ; +else + q->limits.discard_granularity = blk_size; virtio_cread(vdev, struct virtio_blk_config, max_discard_sectors, &v);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 385/879 nl80211: dont hold RTNL in color change request
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 1b550a0bebfc0b69d6ec08fe6eb58953a8aec48a ]
It's not necessary to hold the RTNL across color change requests, since all the inner locking needs only the wiphy mutex which we already hold as well.
--- net/wireless/nl80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/wireless/nl80211.c +1 -2
@@ -16287,8 +16287,7 @@ static const struct genl_small_ops nl80211_small_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = nl80211_color_change, .flags = GENL_UNS_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP, }, { .cmd = NL80211_CMD_SET_FILS_AAD,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 386/879 x86: Fix return value of __setup handlers
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 12441ccdf5e2f5a01a46e344976cbbd3d46845c9 ]
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument (no '=') or environment (with '=') strings. So return 1 from these x86 __setup handlers.
Examples:
Unknown kernel command line parameters "apicpmtimer
BOOT_IMAGE=/boot/bzImage-517rc8 vdso=1 ring3mwait=disable", will be passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
apicpmtimer
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc8
vdso=1
ring3mwait=disable--- arch/x86/entry/vdso/vma.c | 2 +- arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/cpu/intel.c | 2 +- arch/x86/mm/pat/memtype.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/entry/vdso/vma.c +1 -1
@@ -438,7 +438,7 @@ bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)static __init int vdso_setup (char *s) { vdso64_enabled =simple_strtoul (s,NULL ,0 ); -return 0 ; +return 1 ; }__setup ("vdso=" , vdso_setup);
arch/x86/kernel/apic/apic.c +1 -1
@@ -170,7 +170,7 @@ static __init int setup_apicpmtimer(char *s) { apic_calibrate_pmtmr =1 ;notsc_setup (NULL ); -return 0 ; +return 1 ; }__setup ("apicpmtimer" , setup_apicpmtimer);#endif
arch/x86/kernel/cpu/intel.c +1 -1
@@ -91,7 +91,7 @@ static bool ring3mwait_disabled __read_mostly;static int __init ring3mwait_disable (char *__unused) { ring3mwait_disabled = true; -return 0 ; +return 1 ; }__setup ("ring3mwait=disable" , ring3mwait_disable);
arch/x86/mm/pat/memtype.c +1 -1
@@ -101,7 +101,7 @@ int pat_debug_enable;static int __init pat_debug_setup (char *str) { pat_debug_enable =1 ; -return 0 ; +return 1 ; }__setup ("debugpat" , pat_debug_setup);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 387/879 irqchip/exiu: Fix acknowledgment of edge triggered interrupts
In reply to Greg Kroah-HartmanFrom: Daniel Thompson <[email protected]>
[ Upstream commit 4efc851c36e389f7ed432edac0149acc5f94b0c7 ]
Currently the EXIU uses the fasteoi interrupt flow that is configured by it's parent (irq-gic-v3.c). With this flow the only chance to clear the interrupt request happens during .irq_eoi() and (obviously) this happens after the interrupt handler has run. EXIU requires edge triggered interrupts to be acked prior to interrupt handling. Without this we risk incorrect interrupt dismissal when a new interrupt is delivered after the handler reads and acknowledges the peripheral but before the irq_eoi() takes place.
Fix this by clearing the interrupt request from .irq_ack() if we are configured for edge triggered interrupts. This requires adopting the fasteoi-ack flow instead of the fasteoi to ensure the ack gets called.
These changes have been tested using the power button on a Developerbox/SC2A11 combined with some hackery in gpio-keys so I can play with the different trigger mode [and an mdelay(500) so I can can check what happens on a double click in both modes].
--- arch/arm64/Kconfig.platforms | 1 + drivers/irqchip/irq-sni-exiu.c | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)
arch/arm64/Kconfig.platforms +1 -0
@@ -253,6 +253,7 @@ config ARCH_INTEL_SOCFPGA config ARCH_SYNQUACER bool "Socionext SynQuacer SoC Family" + select IRQ_FASTEOI_HIERARCHY_HANDLERS config ARCH_TEGRA bool "NVIDIA Tegra SoC Family"
drivers/irqchip/irq-sni-exiu.c +22 -3
@@ -37,11 +37,26 @@ struct exiu_irq_data {u32 spi_base; }; -static void exiu_irq_eoi (struct irq_data *d) +static void exiu_irq_ack (struct irq_data *d) {struct exiu_irq_data *data =irq_data_get_irq_chip_data (d);writel (BIT (d->hwirq), data->base +EIREQCLR ); +} + +static void exiu_irq_eoi (struct irq_data *d) +{ +struct exiu_irq_data *data =irq_data_get_irq_chip_data (d); + +/* +* Level triggered interrupts are latched and must be cleared during +* EOI or the interrupt will be jammed on. Of course if a level +* triggered interrupt is still asserted then the write will not clear +* the interrupt. +*/ +if (irqd_is_level_type (d)) +writel (BIT (d->hwirq), data->base +EIREQCLR ); +irq_chip_eoi_parent (d); }
@@ -91,10 +106,13 @@ static int exiu_irq_set_type(struct irq_data *d, unsigned int type)writel_relaxed (val, data->base +EILVL ); val =readl_relaxed (data->base +EIEDG ); -if (type ==IRQ_TYPE_LEVEL_LOW || type ==IRQ_TYPE_LEVEL_HIGH ) +if (type ==IRQ_TYPE_LEVEL_LOW || type ==IRQ_TYPE_LEVEL_HIGH ) { val &= ~BIT (d->hwirq); -else +irq_set_handler_locked (d, handle_fasteoi_irq); + }else { val |=BIT (d->hwirq); +irq_set_handler_locked (d, handle_fasteoi_ack_irq); + }writel_relaxed (val, data->base +EIEDG );writel_relaxed (BIT (d->hwirq), data->base +EIREQCLR );
@@ -104,6 +122,7 @@ static int exiu_irq_set_type(struct irq_data *d, unsigned int type)static struct irq_chip exiu_irq_chip = { .name ="EXIU" , + .irq_ack = exiu_irq_ack, .irq_eoi = exiu_irq_eoi, .irq_enable = exiu_irq_enable, .irq_mask = exiu_irq_mask,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 388/879 irqchip/aspeed-i2c-ic: Fix irq_of_parse_and_map() return value
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 50f0f26e7c8665763d0d7d3372dbcf191f94d077 ]
The irq_of_parse_and_map() returns 0 on failure, not a negative ERRNO.
--- drivers/irqchip/irq-aspeed-i2c-ic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-aspeed-i2c-ic.c +2 -2
@@ -77,8 +77,8 @@ static int __init aspeed_i2c_ic_of_init(struct device_node *node, } i2c_ic->parent_irq =irq_of_parse_and_map (node,0 ); -if (i2c_ic->parent_irq <0 ) { - ret = i2c_ic->parent_irq; +if (!i2c_ic->parent_irq) { + ret = -EINVAL ; goto err_iounmap; }
Signature · 1 line
2.35.1