1. 26 May, 2021 2 commits
  2. 14 May, 2021 12 commits
    • Chao Yu's avatar
      f2fs: compress: clean up parameter of __f2fs_cluster_blocks() · 91f0fb69
      Chao Yu authored
      Previously, in order to reuse __f2fs_cluster_blocks(),
      f2fs_is_compressed_cluster() assigned a compress_ctx type variable,
      which is used to pass few parameters (cc.inode, cc.cluster_size,
      cc.cluster_idx), it's wasteful to allocate such large space in stack.
      
      Let's clean up parameters of __f2fs_cluster_blocks() to avoid that.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      91f0fb69
    • Chao Yu's avatar
      f2fs: compress: remove unneeded f2fs_put_dnode() · fbec3b96
      Chao Yu authored
      If we don't initialize dn.inode_page for f2fs_get_block(),
      f2fs_get_block() will call f2fs_put_dnode() itself, so let's
      remove unneeded f2fs_put_dnode() in f2fs_vm_page_mkwrite().
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      fbec3b96
    • Chao Yu's avatar
      f2fs: atgc: fix to set default age threshold · 89e53ff1
      Chao Yu authored
      Default age threshold value is missed to set, fix it.
      
      Fixes: 093749e2 ("f2fs: support age threshold based garbage collection")
      Reported-by: default avatarSahitya Tummala <stummala@codeaurora.org>
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      89e53ff1
    • Shin'ichiro Kawasaki's avatar
      f2fs: Prevent swap file in LFS mode · d927ccfc
      Shin'ichiro Kawasaki authored
      The kernel writes to swap files on f2fs directly without the assistance
      of the filesystem. This direct write by kernel can be non-sequential
      even when the f2fs is in LFS mode. Such non-sequential write conflicts
      with the LFS semantics. Especially when f2fs is set up on zoned block
      devices, the non-sequential write causes unaligned write command errors.
      
      To avoid the non-sequential writes to swap files, prevent swap file
      activation when the filesystem is in LFS mode.
      
      Fixes: 4969c06a ("f2fs: support swap file w/ DIO")
      Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Cc: stable@vger.kernel.org # v5.10+
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      d927ccfc
    • Chao Yu's avatar
      f2fs: fix to avoid racing on fsync_entry_slab by multi filesystem instances · cad83c96
      Chao Yu authored
      As syzbot reported, there is an use-after-free issue during f2fs recovery:
      
      Use-after-free write at 0xffff88823bc16040 (in kfence-#10):
       kmem_cache_destroy+0x1f/0x120 mm/slab_common.c:486
       f2fs_recover_fsync_data+0x75b0/0x8380 fs/f2fs/recovery.c:869
       f2fs_fill_super+0x9393/0xa420 fs/f2fs/super.c:3945
       mount_bdev+0x26c/0x3a0 fs/super.c:1367
       legacy_get_tree+0xea/0x180 fs/fs_context.c:592
       vfs_get_tree+0x86/0x270 fs/super.c:1497
       do_new_mount fs/namespace.c:2905 [inline]
       path_mount+0x196f/0x2be0 fs/namespace.c:3235
       do_mount fs/namespace.c:3248 [inline]
       __do_sys_mount fs/namespace.c:3456 [inline]
       __se_sys_mount+0x2f9/0x3b0 fs/namespace.c:3433
       do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      The root cause is multi f2fs filesystem instances can race on accessing
      global fsync_entry_slab pointer, result in use-after-free issue of slab
      cache, fixes to init/destroy this slab cache only once during module
      init/destroy procedure to avoid this issue.
      
      Reported-by: syzbot+9d90dad32dd9727ed084@syzkaller.appspotmail.com
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      cad83c96
    • Chao Yu's avatar
      f2fs: restructure f2fs page.private layout · b763f3be
      Chao Yu authored
      Restruct f2fs page private layout for below reasons:
      
      There are some cases that f2fs wants to set a flag in a page to
      indicate a specified status of page:
      a) page is in transaction list for atomic write
      b) page contains dummy data for aligned write
      c) page is migrating for GC
      d) page contains inline data for inline inode flush
      e) page belongs to merkle tree, and is verified for fsverity
      f) page is dirty and has filesystem/inode reference count for writeback
      g) page is temporary and has decompress io context reference for compression
      
      There are existed places in page structure we can use to store
      f2fs private status/data:
      - page.flags: PG_checked, PG_private
      - page.private
      
      However it was a mess when we using them, which may cause potential
      confliction:
      		page.private	PG_private	PG_checked	page._refcount (+1 at most)
      a)		-1		set				+1
      b)		-2		set
      c), d), e)					set
      f)		0		set				+1
      g)		pointer		set
      
      The other problem is page.flags has no free slot, if we can avoid set
      zero to page.private and set PG_private flag, then we use non-zero value
      to indicate PG_private status, so that we may have chance to reclaim
      PG_private slot for other usage. [1]
      
      The other concern is f2fs has bad scalability in aspect of indicating
      more page status.
      
      So in this patch, let's restructure f2fs' page.private as below to
      solve above issues:
      
      Layout A: lowest bit should be 1
      | bit0 = 1 | bit1 | bit2 | ... | bit MAX | private data .... |
       bit 0	PAGE_PRIVATE_NOT_POINTER
       bit 1	PAGE_PRIVATE_ATOMIC_WRITE
       bit 2	PAGE_PRIVATE_DUMMY_WRITE
       bit 3	PAGE_PRIVATE_ONGOING_MIGRATION
       bit 4	PAGE_PRIVATE_INLINE_INODE
       bit 5	PAGE_PRIVATE_REF_RESOURCE
       bit 6-	f2fs private data
      
      Layout B: lowest bit should be 0
       page.private is a wrapped pointer.
      
      After the change:
      		page.private	PG_private	PG_checked	page._refcount (+1 at most)
      a)		11		set				+1
      b)		101		set				+1
      c)		1001		set				+1
      d)		10001		set				+1
      e)						set
      f)		100001		set				+1
      g)		pointer		set				+1
      
      [1] https://lore.kernel.org/linux-f2fs-devel/20210422154705.GO3596236@casper.infradead.org/T/#u
      
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      b763f3be
    • Chao Yu's avatar
      f2fs: add cp_error check in f2fs_write_compressed_pages · ee68d271
      Chao Yu authored
      This patch adds cp_error check in f2fs_write_compressed_pages() like we did
      in f2fs_write_single_data_page()
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      ee68d271
    • Chao Yu's avatar
      f2fs: compress: rename __cluster_may_compress · 5db479f0
      Chao Yu authored
      This patch renames __cluster_may_compress() to cluster_has_invalid_data() for
      better readability.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      5db479f0
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · bd3c9cdb
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
       "Fixes and cpucaps.h automatic generation:
      
         - Generate cpucaps.h at build time rather than carrying lots of
           #defines. Merged at -rc1 to avoid some conflicts during the merge
           window.
      
         - Initialise RGSR_EL1.SEED in __cpu_setup() as it may be left as 0
           out of reset and the IRG instruction would not function as expected
           if only the architected pseudorandom number generator is
           implemented.
      
         - Fix potential race condition in __sync_icache_dcache() where the
           PG_dcache_clean page flag is set before the actual cache
           maintenance.
      
         - Fix header include in BTI kselftests"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: Fix race condition on PG_dcache_clean in __sync_icache_dcache()
        arm64: tools: Add __ASM_CPUCAPS_H to the endif in cpucaps.h
        arm64: mte: initialize RGSR_EL1.SEED in __cpu_setup
        kselftest/arm64: Add missing stddef.h include to BTI tests
        arm64: Generate cpucaps.h
      bd3c9cdb
    • Linus Torvalds's avatar
      Merge tag 'f2fs-5.13-rc1-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · ac524ece
      Linus Torvalds authored
      Pull f2fs fixes from Jaegeuk Kim:
       "This fixes some critical bugs such as memory leak in compression
        flows, kernel panic when handling errors, and swapon failure due to
        newly added condition check"
      
      * tag 'f2fs-5.13-rc1-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
        f2fs: return EINVAL for hole cases in swap file
        f2fs: avoid swapon failure by giving a warning first
        f2fs: compress: fix to assign cc.cluster_idx correctly
        f2fs: compress: fix race condition of overwrite vs truncate
        f2fs: compress: fix to free compress page correctly
        f2fs: support iflag change given the mask
        f2fs: avoid null pointer access when handling IPU error
      ac524ece
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2021-05-14' of git://anongit.freedesktop.org/drm/drm · b5304a4f
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Not much here, mostly amdgpu fixes, with a couple of radeon, and a
        cosmetic vc4.
      
        Two MAINTAINERS file updates also.
      
        amdgpu:
         - Fixes for flexible array conversions
         - Fix sysfs attribute init
         - Harvesting fixes
         - VCN CG/PG fixes for Picasso
      
        radeon:
         - Fixes for flexible array conversions
         - Fix for flickering on Oland with multiple 4K displays
      
        vc4:
         - drop unused function"
      
      * tag 'drm-fixes-2021-05-14' of git://anongit.freedesktop.org/drm/drm:
        drm/amdgpu: update vcn1.0 Non-DPG suspend sequence
        drm/amdgpu: set vcn mgcg flag for picasso
        drm/radeon/dpm: Disable sclk switching on Oland when two 4K 60Hz monitors are connected
        drm/amdgpu: update the method for harvest IP for specific SKU
        drm/amdgpu: add judgement when add ip blocks (v2)
        drm/amd/display: Initialize attribute for hdcp_srm sysfs file
        drm/amd/pm: Fix out-of-bounds bug
        drm/radeon/si_dpm: Fix SMU power state load
        drm/radeon/ni_dpm: Fix booting bug
        MAINTAINERS: Update address for Emma Anholt
        MAINTAINERS: Update my e-mail
        drm/vc4: remove unused function
        drm/ttm: Do not add non-system domain BO into swap list
      b5304a4f
    • Catalin Marinas's avatar
      arm64: Fix race condition on PG_dcache_clean in __sync_icache_dcache() · 588a513d
      Catalin Marinas authored
      To ensure that instructions are observable in a new mapping, the arm64
      set_pte_at() implementation cleans the D-cache and invalidates the
      I-cache to the PoU. As an optimisation, this is only done on executable
      mappings and the PG_dcache_clean page flag is set to avoid future cache
      maintenance on the same page.
      
      When two different processes map the same page (e.g. private executable
      file or shared mapping) there's a potential race on checking and setting
      PG_dcache_clean via set_pte_at() -> __sync_icache_dcache(). While on the
      fault paths the page is locked (PG_locked), mprotect() does not take the
      page lock. The result is that one process may see the PG_dcache_clean
      flag set but the I/D cache maintenance not yet performed.
      
      Avoid test_and_set_bit(PG_dcache_clean) in favour of separate test_bit()
      and set_bit(). In the rare event of a race, the cache maintenance is
      done twice.
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: <stable@vger.kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Steven Price <steven.price@arm.com>
      Reviewed-by: default avatarSteven Price <steven.price@arm.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20210514095001.13236-1-catalin.marinas@arm.comSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      588a513d
  3. 13 May, 2021 22 commits
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-5.13-2021-05-13' of... · 08f0cfbf
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-5.13-2021-05-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-5.13-2021-05-13:
      
      amdgpu:
      - Fixes for flexible array conversions
      - Fix sysfs attribute init
      - Harvesting fixes
      - VCN CG/PG fixes for Picasso
      
      radeon:
      - Fixes for flexible array conversions
      - Fix for flickering on Oland with multiple 4K displays
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210513163228.3963-1-alexander.deucher@amd.com
      08f0cfbf
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2021-05-13' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · 1db7aa26
      Dave Airlie authored
      Remove an unused function and a MAINTAINERS update.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210513133617.xq77wwrehpuh7yn2@hendrix
      1db7aa26
    • Linus Torvalds's avatar
      Merge tag 'pm-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 315d9931
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These close a coverage gap in the intel_pstate driver and fix runtime
        PM child count imbalance related to interactions with system-wide
        suspend.
      
        Specifics:
      
         - Make intel_pstate work as expected on systems where the platform
           firmware enables HWP even though the HWP EPP support is not
           advertised (Rafael Wysocki).
      
         - Fix possible runtime PM child count imbalance that may occur if
           other runtime PM functions are called after invoking
           pm_runtime_force_suspend() and before pm_runtime_force_resume()
           is called (Tony Lindgren)"
      
      * tag 'pm-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        PM: runtime: Fix unpaired parent child_count for force_resume
        cpufreq: intel_pstate: Use HWP if enabled by platform firmware
      315d9931
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2df38a8e
      Linus Torvalds authored
      Pull ACPI fixes from Rafael Wysocki:
       "These revert an unnecessary revert of an ACPI power management commit,
        add a missing device ID to one of the lists and fix a possible memory
        leak in an error path.
      
        Specifics:
      
         - Revert a revert of a recent ACPI power management change that does
           not need to be reverted after all (Rafael Wysocki).
      
         - Add missing fan device ID to the list of device IDs for which the
           devices should not be put into the ACPI PM domain (Sumeet
           Pawnikar).
      
         - Fix possible memory leak in an error path in the ACPI device
           enumeration code (Christophe JAILLET)"
      
      * tag 'acpi-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: PM: Add ACPI ID of Alder Lake Fan
        ACPI: scan: Fix a memory leak in an error handling path
        Revert "Revert "ACPI: scan: Turn off unused power resources during initialization""
      2df38a8e
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-pm' · fd386517
      Rafael J. Wysocki authored
      * acpi-pm:
        ACPI: PM: Add ACPI ID of Alder Lake Fan
        Revert "Revert "ACPI: scan: Turn off unused power resources during initialization""
      fd386517
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-core' · 78a6948b
      Rafael J. Wysocki authored
      * pm-core:
        PM: runtime: Fix unpaired parent child_count for force_resume
      78a6948b
    • Linus Torvalds's avatar
      Merge branch 'resizex' (patches from Maciej) · adc12a74
      Linus Torvalds authored
      Merge VT_RESIZEX fixes from Maciej Rozycki:
       "I got to the bottom of the issue with VT_RESIZEX recently discussed
        and came up with this small patch series, fixing an additional issue
        that I originally thought might be broken VGA hardware emulation with
        my laptop, which however turned out to be intertwined with the
        original problem and also a regression introduced somewhat later.
      
        The fix for that because the first patch, and then to make backporting
        feasible I had to put a revert of the offending change from last
        September next, followed by a proper fix for the framebuffer issue
        that change had tried to address.
      
        See individual change descriptions for details.
      
        These have been verified with true VGA hardware (a Trident TVGA8900
        ISA video adapter) using various combinations of `svgatextmode' and
        `setfont' command invocations to change both the VT size and the font
        size, and also switching between the text console and X11, both by
        starting/stopping the X server and by switching between VTs.
      
        All this to ensure bringing the behaviour of VGA text console back to
        correct operation as it used to be with Linux 2.6.18"
      
      * emailed patches from Maciej W. Rozycki <macro@orcam.me.uk>:
        vt: Fix character height handling with VT_RESIZEX
        vt_ioctl: Revert VT_RESIZEX parameter handling removal
        vgacon: Record video mode changes with VT_RESIZEX
      adc12a74
    • Maciej W. Rozycki's avatar
      vt: Fix character height handling with VT_RESIZEX · 860dafa9
      Maciej W. Rozycki authored
      Restore the original intent of the VT_RESIZEX ioctl's `v_clin' parameter
      which is the number of pixel rows per character (cell) rather than the
      height of the font used.
      
      For framebuffer devices the two values are always the same, because the
      former is inferred from the latter one.  For VGA used as a true text
      mode device these two parameters are independent from each other: the
      number of pixel rows per character is set in the CRT controller, while
      font height is in fact hardwired to 32 pixel rows and fonts of heights
      below that value are handled by padding their data with blanks when
      loaded to hardware for use by the character generator.  One can change
      the setting in the CRT controller and it will update the screen contents
      accordingly regardless of the font loaded.
      
      The `v_clin' parameter is used by the `vgacon' driver to set the height
      of the character cell and then the cursor position within.  Make the
      parameter explicit then, by defining a new `vc_cell_height' struct
      member of `vc_data', set it instead of `vc_font.height' from `v_clin' in
      the VT_RESIZEX ioctl, and then use it throughout the `vgacon' driver
      except where actual font data is accessed which as noted above is
      independent from the CRTC setting.
      
      This way the framebuffer console driver is free to ignore the `v_clin'
      parameter as irrelevant, as it always should have, avoiding any issues
      attempts to give the parameter a meaning there could have caused, such
      as one that has led to commit 988d0763 ("vt_ioctl: make VT_RESIZEX
      behave like VT_RESIZE"):
      
       "syzbot is reporting UAF/OOB read at bit_putcs()/soft_cursor() [1][2],
        for vt_resizex() from ioctl(VT_RESIZEX) allows setting font height
        larger than actual font height calculated by con_font_set() from
        ioctl(PIO_FONT). Since fbcon_set_font() from con_font_set() allocates
        minimal amount of memory based on actual font height calculated by
        con_font_set(), use of vt_resizex() can cause UAF/OOB read for font
        data."
      
      The problem first appeared around Linux 2.5.66 which predates our repo
      history, but the origin could be identified with the old MIPS/Linux repo
      also at: <git://git.kernel.org/pub/scm/linux/kernel/git/ralf/linux.git>
      as commit 9736a3546de7 ("Merge with Linux 2.5.66."), where VT_RESIZEX
      code in `vt_ioctl' was updated as follows:
      
       		if (clin)
      -			video_font_height = clin;
      +			vc->vc_font.height = clin;
      
      making the parameter apply to framebuffer devices as well, perhaps due
      to the use of "font" in the name of the original `video_font_height'
      variable.  Use "cell" in the new struct member then to avoid ambiguity.
      
      References:
      
      [1] https://syzkaller.appspot.com/bug?id=32577e96d88447ded2d3b76d71254fb855245837
      [2] https://syzkaller.appspot.com/bug?id=6b8355d27b2b94fb5cedf4655e3a59162d9e48e3Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable@vger.kernel.org # v2.6.12+
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      860dafa9
    • Maciej W. Rozycki's avatar
      vt_ioctl: Revert VT_RESIZEX parameter handling removal · a90c275e
      Maciej W. Rozycki authored
      Revert the removal of code handling extra VT_RESIZEX ioctl's parameters
      beyond those that VT_RESIZE supports, fixing a functional regression
      causing `svgatextmode' not to resize the VT anymore.
      
      As a consequence of the reverted change when the video adapter is
      reprogrammed from the original say 80x25 text mode using a 9x16
      character cell (720x400 pixel resolution) to say 80x37 text mode and the
      same character cell (720x592 pixel resolution), the VT geometry does not
      get updated and only upper two thirds of the screen are used for the VT,
      and the lower part remains blank.  The proportions change according to
      text mode geometries chosen.
      
      Revert the change verbatim then, bringing back previous VT resizing.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Fixes: 988d0763 ("vt_ioctl: make VT_RESIZEX behave like VT_RESIZE")
      Cc: stable@vger.kernel.org # v5.10+
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a90c275e
    • Maciej W. Rozycki's avatar
      vgacon: Record video mode changes with VT_RESIZEX · d4d0ad57
      Maciej W. Rozycki authored
      Fix an issue with VGA console font size changes made after the initial
      video text mode has been changed with a user tool like `svgatextmode'
      calling the VT_RESIZEX ioctl.  As it stands in that case the original
      screen geometry continues being used to validate further VT resizing.
      
      Consequently when the video adapter is firstly reprogrammed from the
      original say 80x25 text mode using a 9x16 character cell (720x400 pixel
      resolution) to say 80x37 text mode and the same character cell (720x592
      pixel resolution), and secondly the CRTC character cell updated to 9x8
      (by loading a suitable font with the KD_FONT_OP_SET request of the
      KDFONTOP ioctl), the VT geometry does not get further updated from 80x37
      and only upper half of the screen is used for the VT, with the lower
      half showing rubbish corresponding to whatever happens to be there in
      the video memory that maps to that part of the screen.  Of course the
      proportions change according to text mode geometries and font sizes
      chosen.
      
      Address the problem then, by updating the text mode geometry defaults
      rather than checking against them whenever the VT is resized via a user
      ioctl.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Fixes: e400b6ec ("vt/vgacon: Check if screen resize request comes from userspace")
      Cc: stable@vger.kernel.org # v2.6.24+
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d4d0ad57
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v5.13-rc2' of... · d1e7c13a
      Linus Torvalds authored
      Merge tag 'hwmon-for-v5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
       "Fix bugs/regressions in adm9240, ltc2992, pmbus/fsp-3y, and occ
        drivers, plus a minor cleanup in the corsair-psu driver"
      
      * tag 'hwmon-for-v5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (adm9240) Fix writes into inX_max attributes
        hwmon: (ltc2992) Put fwnode in error case during ->probe()
        hwmon: (pmbus/fsp-3y) Fix FSP-3Y YH-5151E non-compliant vout encoding
        hwmon: (occ) Fix poll rate limiting
        hwmon: (corsair-psu) Remove unneeded semicolons
      d1e7c13a
    • Mark Brown's avatar
    • Sathishkumar S's avatar
      drm/amdgpu: update vcn1.0 Non-DPG suspend sequence · 5c1efb5f
      Sathishkumar S authored
      update suspend register settings in Non-DPG mode.
      Signed-off-by: default avatarSathishkumar S <sathishkumar.sundararaju@amd.com>
      Reviewed-by: default avatarLeo Liu <leo.liu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5c1efb5f
    • Sathishkumar S's avatar
      drm/amdgpu: set vcn mgcg flag for picasso · 3666f83a
      Sathishkumar S authored
      enable vcn mgcg flag for picasso.
      Signed-off-by: default avatarSathishkumar S <sathishkumar.sundararaju@amd.com>
      Reviewed-by: default avatarLeo Liu <leo.liu@amd.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      3666f83a
    • Kai-Heng Feng's avatar
      drm/radeon/dpm: Disable sclk switching on Oland when two 4K 60Hz monitors are connected · 227545b9
      Kai-Heng Feng authored
      Screen flickers rapidly when two 4K 60Hz monitors are in use. This issue
      doesn't happen when one monitor is 4K 60Hz (pixelclock 594MHz) and
      another one is 4K 30Hz (pixelclock 297MHz).
      
      The issue is gone after setting "power_dpm_force_performance_level" to
      "high". Following the indication, we found that the issue occurs when
      sclk is too low.
      
      So resolve the issue by disabling sclk switching when there are two
      monitors requires high pixelclock (> 297MHz).
      
      v2:
       - Only apply the fix to Oland.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      227545b9
    • Likun Gao's avatar
      drm/amdgpu: update the method for harvest IP for specific SKU · 5c1a3768
      Likun Gao authored
      Update the method of disabling VCN IP for specific SKU for navi1x ASIC,
      it will judge whether should add the related IP at the function of
      amdgpu_device_ip_block_add().
      Signed-off-by: default avatarLikun Gao <Likun.Gao@amd.com>
      Reviewed-by: default avatarGuchun Chen <guchun.chen@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5c1a3768
    • Likun GAO's avatar
      drm/amdgpu: add judgement when add ip blocks (v2) · 83a0b863
      Likun GAO authored
      Judgement whether to add an sw ip according to the harvest info.
      
      v2: fix indentation (Alex)
      Signed-off-by: default avatarLikun Gao <Likun.Gao@amd.com>
      Reviewed-by: default avatarGuchun Chen <guchun.chen@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      83a0b863
    • David Ward's avatar
      drm/amd/display: Initialize attribute for hdcp_srm sysfs file · fe1c97d0
      David Ward authored
      It is stored in dynamically allocated memory, so sysfs_bin_attr_init() must
      be called to initialize it. (Note: "initialization" only sets the .attr.key
      member in this struct; it does not change the value of any other members.)
      
      Otherwise, when CONFIG_DEBUG_LOCK_ALLOC=y this message appears during boot:
      
          BUG: key ffff9248900cd148 has not been registered!
      
      Fixes: 9037246b ("drm/amd/display: Add sysfs interface for set/get srm")
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1586Reported-by: default avatarMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
      Signed-off-by: default avatarDavid Ward <david.ward@gatech.edu>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      fe1c97d0
    • Gustavo A. R. Silva's avatar
      drm/amd/pm: Fix out-of-bounds bug · 939baec9
      Gustavo A. R. Silva authored
      Create new structure SISLANDS_SMC_SWSTATE_SINGLE, as initialState.levels
      and ACPIState.levels are never actually used as flexible arrays. Those
      arrays can be used as simple objects of type
      SISLANDS_SMC_HW_PERFORMANCE_LEVEL, instead.
      
      Currently, the code fails because flexible array _levels_ in
      struct SISLANDS_SMC_SWSTATE doesn't allow for code that accesses
      the first element of initialState.levels and ACPIState.levels
      arrays:
      
      drivers/gpu/drm/amd/pm/powerplay/si_dpm.c:
      4820: table->initialState.levels[0].mclk.vDLL_CNTL =
      4821:         cpu_to_be32(si_pi->clock_registers.dll_cntl);
      ...
      5021: table->ACPIState.levels[0].mclk.vDLL_CNTL =
      5022:         cpu_to_be32(dll_cntl);
      
      because such element cannot be accessed without previously allocating
      enough dynamic memory for it to exist (which never actually happens).
      So, there is an out-of-bounds bug in this case.
      
      That's why struct SISLANDS_SMC_SWSTATE should only be used as type
      for object driverState and new struct SISLANDS_SMC_SWSTATE_SINGLE is
      created as type for objects initialState, ACPIState and ULVState.
      
      Also, with the change from one-element array to flexible-array member
      in commit 0e1aa13c ("drm/amd/pm: Replace one-element array with
      flexible-array in struct SISLANDS_SMC_SWSTATE"), the size of
      dpmLevels in struct SISLANDS_SMC_STATETABLE should be fixed to be
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE instead of
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1.
      
      Fixes: 0e1aa13c ("drm/amd/pm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      939baec9
    • Gustavo A. R. Silva's avatar
      drm/radeon/si_dpm: Fix SMU power state load · 1ddeedaa
      Gustavo A. R. Silva authored
      Create new structure SISLANDS_SMC_SWSTATE_SINGLE, as initialState.levels
      and ACPIState.levels are never actually used as flexible arrays. Those
      arrays can be used as simple objects of type
      SISLANDS_SMC_HW_PERFORMANCE_LEVEL, instead.
      
      Currently, the code fails because flexible array _levels_ in
      struct SISLANDS_SMC_SWSTATE doesn't allow for code that access
      the first element of initialState.levels and ACPIState.levels
      arrays:
      
      4353         table->initialState.levels[0].mclk.vDLL_CNTL =
      4354                 cpu_to_be32(si_pi->clock_registers.dll_cntl);
      ...
      4555         table->ACPIState.levels[0].mclk.vDLL_CNTL =
      4556                 cpu_to_be32(dll_cntl);
      
      because such element cannot exist without previously allocating
      any dynamic memory for it (which never actually happens).
      
      That's why struct SISLANDS_SMC_SWSTATE should only be used as type
      for object driverState and new struct SISLANDS_SMC_SWSTATE_SINGLE is
      created as type for objects initialState, ACPIState and ULVState.
      
      Also, with the change from one-element array to flexible-array member
      in commit 96e27e8d ("drm/radeon/si_dpm: Replace one-element array
      with flexible-array in struct SISLANDS_SMC_SWSTATE"), the size of
      dpmLevels in struct SISLANDS_SMC_STATETABLE should be fixed to be
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE instead of
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1.
      
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1583
      Fixes: 96e27e8d ("drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      1ddeedaa
    • Gustavo A. R. Silva's avatar
      drm/radeon/ni_dpm: Fix booting bug · 5d31950a
      Gustavo A. R. Silva authored
      Create new structure NISLANDS_SMC_SWSTATE_SINGLE, as initialState.levels
      and ACPIState.levels are never actually used as flexible arrays. Those
      arrays can be used as simple objects of type
      NISLANDS_SMC_HW_PERFORMANCE_LEVEL, instead.
      
      Currently, the code fails because flexible array _levels_ in
      struct NISLANDS_SMC_SWSTATE doesn't allow for code that access
      the first element of initialState.levels and ACPIState.levels
      arrays:
      
      drivers/gpu/drm/radeon/ni_dpm.c:
      1690         table->initialState.levels[0].mclk.vMPLL_AD_FUNC_CNTL =
      1691                 cpu_to_be32(ni_pi->clock_registers.mpll_ad_func_cntl);
      ...
      1903:   table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL = cpu_to_be32(mpll_ad_func_cntl);
      1904:   table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL_2 = cpu_to_be32(mpll_ad_func_cntl_2);
      
      because such element cannot exist without previously allocating
      any dynamic memory for it (which never actually happens).
      
      That's why struct NISLANDS_SMC_SWSTATE should only be used as type
      for object driverState and new struct SISLANDS_SMC_SWSTATE_SINGLE is
      created as type for objects initialState, ACPIState and ULVState.
      
      Also, with the change from one-element array to flexible-array member
      in commit 434fb1e7 ("drm/radeon/nislands_smc.h: Replace one-element
      array with flexible-array member in struct NISLANDS_SMC_SWSTATE"), the
      size of dpmLevels in struct NISLANDS_SMC_STATETABLE should be fixed to
      be NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE instead of
      NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1.
      
      Bug: https://lore.kernel.org/dri-devel/3eedbe78-1fbd-4763-a7f3-ac5665e76a4a@xenosoft.de/
      Fixes: 434fb1e7 ("drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in struct NISLANDS_SMC_SWSTATE")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
      Tested-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
      Link: https://lore.kernel.org/dri-devel/9bb5fcbd-daf5-1669-b3e7-b8624b3c36f9@xenosoft.de/Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5d31950a
    • Guenter Roeck's avatar
      hwmon: (adm9240) Fix writes into inX_max attributes · 3b5169c2
      Guenter Roeck authored
      When converting the driver to use the devm_hwmon_device_register_with_info
      API, the wrong register was selected when writing into inX_max attributes.
      Fix it.
      
      Fixes: 124b7e34 ("hwmon: (adm9240) Convert to devm_hwmon_device_register_with_info API")
      Reported-by: default avatarChris Packham <Chris.Packham@alliedtelesis.co.nz>
      Tested-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      3b5169c2
  4. 12 May, 2021 4 commits