Skip to content
  1. Jul 25, 2020
    • Phillip Lougher's avatar
      squashfs: fix length field overlap check in metadata reading · 2910c59f
      Phillip Lougher authored
      This is a regression introduced by the "migrate from ll_rw_block usage
      to BIO" patch.
      
      Squashfs packs structures on byte boundaries, and due to that the length
      field (of the metadata block) may not be fully in the current block.
      The new code rewrote and introduced a faulty check for that edge case.
      
      Fixes: 93e72b3c
      
       ("squashfs: migrate from ll_rw_block usage to BIO")
      Reported-by: default avatarBernd Amend <bernd.amend@gmail.com>
      Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Adrien Schildknecht <adrien+dev@schischi.me>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Daniel Rosenberg <drosen@google.com>
      Link: http://lkml.kernel.org/r/20200717195536.16069-1-phillip@squashfs.org.uk
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2910c59f
    • Mike Rapoport's avatar
      mailmap: add entry for Mike Rapoport · e57942c5
      Mike Rapoport authored
      
      
      Add an entry to correct my email addresses.
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20200708095414.12275-1-rppt@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e57942c5
    • Kirill A. Shutemov's avatar
      khugepaged: fix null-pointer dereference due to race · 594cced1
      Kirill A. Shutemov authored
      khugepaged has to drop mmap lock several times while collapsing a page.
      The situation can change while the lock is dropped and we need to
      re-validate that the VMA is still in place and the PMD is still subject
      for collapse.
      
      But we miss one corner case: while collapsing an anonymous pages the VMA
      could be replaced with file VMA.  If the file VMA doesn't have any
      private pages we get NULL pointer dereference:
      
      	general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
      	KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
      	anon_vma_lock_write include/linux/rmap.h:120 [inline]
      	collapse_huge_page mm/khugepaged.c:1110 [inline]
      	khugepaged_scan_pmd mm/khugepaged.c:1349 [inline]
      	khugepaged_scan_mm_slot mm/khugepaged.c:2110 [inline]
      	khugepaged_do_scan mm/khugepaged.c:2193 [inline]
      	khugepaged+0x3bba/0x5a10 mm/khugepaged.c:2238
      
      The fix is to make sure that the VMA is anonymous in
      hugepage_v...
      594cced1
    • Barry Song's avatar
      mm/hugetlb: avoid hardcoding while checking if cma is enabled · dbda8fea
      Barry Song authored
      hugetlb_cma[0] can be NULL due to various reasons, for example, node0
      has no memory.  so NULL hugetlb_cma[0] doesn't necessarily mean cma is
      not enabled.  gigantic pages might have been reserved on other nodes.
      This patch fixes possible double reservation and CMA leak.
      
      [akpm@linux-foundation.org: fix CONFIG_CMA=n warning]
      [sfr@canb.auug.org.au: better checks before using hugetlb_cma]
        Link: http://lkml.kernel.org/r/20200721205716.6dbaa56b@canb.auug.org.au
      
      Fixes: cf11e85f
      
       ("mm: hugetlb: optionally allocate gigantic hugepages using cma")
      Signed-off-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200710005726.36068-1-song.bao.hua@hisilicon.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dbda8fea
    • Muchun Song's avatar
      mm: memcg/slab: fix memory leak at non-root kmem_cache destroy · d38a2b7a
      Muchun Song authored
      If the kmem_cache refcount is greater than one, we should not mark the
      root kmem_cache as dying.  If we mark the root kmem_cache dying
      incorrectly, the non-root kmem_cache can never be destroyed.  It
      resulted in memory leak when memcg was destroyed.  We can use the
      following steps to reproduce.
      
        1) Use kmem_cache_create() to create a new kmem_cache named A.
        2) Coincidentally, the kmem_cache A is an alias for kmem_cache B,
           so the refcount of B is just increased.
        3) Use kmem_cache_destroy() to destroy the kmem_cache A, just
           decrease the B's refcount but mark the B as dying.
        4) Create a new memory cgroup and alloc memory from the kmem_cache
           B. It leads to create a non-root kmem_cache for allocating memory.
        5) When destroy the memory cgroup created in the step 4), the
           non-root kmem_cache can never be destroyed.
      
      If we repeat steps 4) and 5), this will cause a lot of memory leak.  So
      only when refcount reach zero, we mark the root kmem_cache as dying.
      
      Fixes: 92ee383f
      
       ("mm: fix race between kmem_cache destroy, create and deactivate")
      Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200716165103.83462-1-songmuchun@bytedance.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d38a2b7a
    • Hugh Dickins's avatar
      mm/memcg: fix refcount error while moving and swapping · 8d22a935
      Hugh Dickins authored
      It was hard to keep a test running, moving tasks between memcgs with
      move_charge_at_immigrate, while swapping: mem_cgroup_id_get_many()'s
      refcount is discovered to be 0 (supposedly impossible), so it is then
      forced to REFCOUNT_SATURATED, and after thousands of warnings in quick
      succession, the test is at last put out of misery by being OOM killed.
      
      This is because of the way moved_swap accounting was saved up until the
      task move gets completed in __mem_cgroup_clear_mc(), deferred from when
      mem_cgroup_move_swap_account() actually exchanged old and new ids.
      Concurrent activity can free up swap quicker than the task is scanned,
      bringing id refcount down 0 (which should only be possible when
      offlining).
      
      Just skip that optimization: do that part of the accounting immediately.
      
      Fixes: 615d66c3
      
       ("mm: memcontrol: fix memcg id ref counter on swap charge move")
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2007071431050.4726@eggly.anvils
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8d22a935
    • Bhupesh Sharma's avatar
      mm/memcontrol: fix OOPS inside mem_cgroup_get_nr_swap_pages() · 82ff165c
      Bhupesh Sharma authored
      Prabhakar reported an OOPS inside mem_cgroup_get_nr_swap_pages()
      function in a corner case seen on some arm64 boards when kdump kernel
      runs with "cgroup_disable=memory" passed to the kdump kernel via
      bootargs.
      
      The root-cause behind the same is that currently mem_cgroup_swap_init()
      function is implemented as a subsys_initcall() call instead of a
      core_initcall(), this means 'cgroup_memory_noswap' still remains set to
      the default value (false) even when memcg is disabled via
      "cgroup_disable=memory" boot parameter.
      
      This may result in premature OOPS inside mem_cgroup_get_nr_swap_pages()
      function in corner cases:
      
        Unable to handle kernel NULL pointer dereference at virtual address 0000000000000188
        Mem abort info:
          ESR = 0x96000006
          EC = 0x25: DABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
        Data abort info:
          ISV = 0, ISS = 0x00000006
          CM = 0, WnR = 0
        [0000000000000188] user address but active_mm is swapper
        Internal error: Oops: 96000006 [#1] SMP
        Modules linked in:
        <..snip..>
        Call trace:
          mem_cgroup_get_nr_swap_pages+0x9c/0xf4
          shrink_lruvec+0x404/0x4f8
          shrink_node+0x1a8/0x688
          do_try_to_free_pages+0xe8/0x448
          try_to_free_pages+0x110/0x230
          __alloc_pages_slowpath.constprop.106+0x2b8/0xb48
          __alloc_pages_nodemask+0x2ac/0x2f8
          alloc_page_interleave+0x20/0x90
          alloc_pages_current+0xdc/0xf8
          atomic_pool_expand+0x60/0x210
          __dma_atomic_pool_init+0x50/0xa4
          dma_atomic_pool_init+0xac/0x158
          do_one_initcall+0x50/0x218
          kernel_init_freeable+0x22c/0x2d0
          kernel_init+0x18/0x110
          ret_from_fork+0x10/0x18
        Code: aa1403e3 91106000 97f82a27 14000011 (f940c663)
        ---[ end trace 9795948475817de4 ]---
        Kernel panic - not syncing: Fatal exception
        Rebooting in 10 seconds..
      
      Fixes: eccb52e7
      
       ("mm: memcontrol: prepare swap controller setup for integration")
      Reported-by: default avatarPrabhakar Kushwaha <pkushwaha@marvell.com>
      Signed-off-by: default avatarBhupesh Sharma <bhsharma@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Link: http://lkml.kernel.org/r/1593641660-13254-2-git-send-email-bhsharma@redhat.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      82ff165c
    • Tom Rix's avatar
      mm: initialize return of vm_insert_pages · 45779b03
      Tom Rix authored
      
      
      clang static analysis reports a garbage return
      
        In file included from mm/memory.c:84:
        mm/memory.c:1612:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
                return err;
                ^~~~~~~~~~
      
      The setting of err depends on a loop executing.  So initialize err.
      
      Signed-off-by: default avatarTom Rix <trix@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20200703155354.29132-1-trix@redhat.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      45779b03
    • Chengguang Xu's avatar
      vfs/xattr: mm/shmem: kernfs: release simple xattr entry in a right way · 3bef735a
      Chengguang Xu authored
      After commit fdc85222 ("kernfs: kvmalloc xattr value instead of
      kmalloc"), simple xattr entry is allocated with kvmalloc() instead of
      kmalloc(), so we should release it with kvfree() instead of kfree().
      
      Fixes: fdc85222
      
       ("kernfs: kvmalloc xattr value instead of kmalloc")
      Signed-off-by: default avatarChengguang Xu <cgxu519@mykernel.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Daniel Xu <dxu@dxuuu.xyz>
      Cc: Chris Down <chris@chrisdown.name>
      Cc: Andreas Dilger <adilger@dilger.ca>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: <stable@vger.kernel.org>	[5.7]
      Link: http://lkml.kernel.org/r/20200704051608.15043-1-cgxu519@mykernel.net
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3bef735a
    • Kirill A. Shutemov's avatar
      mm/mmap.c: close race between munmap() and expand_upwards()/downwards() · 246c320a
      Kirill A. Shutemov authored
      VMA with VM_GROWSDOWN or VM_GROWSUP flag set can change their size under
      mmap_read_lock().  It can lead to race with __do_munmap():
      
      	Thread A			Thread B
      __do_munmap()
        detach_vmas_to_be_unmapped()
        mmap_write_downgrade()
      				expand_downwards()
      				  vma->vm_start = address;
      				  // The VMA now overlaps with
      				  // VMAs detached by the Thread A
      				// page fault populates expanded part
      				// of the VMA
        unmap_region()
          // Zaps pagetables partly
          // populated by Thread B
      
      Similar race exists for expand_upwards().
      
      The fix is to avoid downgrading mmap_lock in __do_munmap() if detached
      VMAs are next to VM_GROWSDOWN or VM_GROWSUP VMA.
      
      [akpm@linux-foundation.org: s/mmap_sem/mmap_lock/ in comment]
      
      Fixes: dd2283f2
      
       ("mm: mmap: zap pages with read mmap_sem in munmap")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: <stable@vger.kernel.org>	[4.20+]
      Link: http://lkml.kernel.org/r/20200709105309.42495-1-kirill.shutemov@linux.intel.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      246c320a
  2. Jul 24, 2020
    • Linus Torvalds's avatar
      Merge tag 's390-5.8-6' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux into master · f37e99ac
      Linus Torvalds authored
      Pull s390 fixes from Heiko Carstens:
      
       - Change cpum_cf/perf counter name from DFLT_CCERROR to DFLT_CCFINISH
         to reflect reality and avoid further confusion. This is a user space
         visible change therefore the commit has also a stable tag for 5.7,
         where this counter was introduced.
      
       - Add Matthew Rosato as s390 IOMMU maintainer.
      
      * tag 's390-5.8-6' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        MAINTAINERS: add Matthew for s390 IOMMU
        s390/cpum_cf,perf: change DFLT_CCERROR counter name
      f37e99ac
  3. Jul 23, 2020
    • Linus Torvalds's avatar
      Merge tag 'media/v5.8-3' of... · d15be546
      Linus Torvalds authored
      Merge tag 'media/v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media into master
      
      Pull media fixes from Mauro Carvalho Chehab:
       "A series of fixes for the upcoming atomisp driver. They solve issues
        when probing atomisp on devices with multiple cameras and get rid of
        warnings when built with W=1.
      
        The diffstat is a bit long, as this driver has several abstractions.
        The patches that solved the issues with W=1 had to get rid of some
        duplicated code (there used to have 2 versions of the same code, one
        for ISP2401 and another one for ISP2400).
      
        As this driver is not in 5.7, such changes won't cause regressions"
      
      * tag 'media/v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (38 commits)
        Revert "media: atomisp: keep the ISP powered on when setting it"
        media: atomisp: fix mask and shift operation on ISPSSPM0
        media: atomisp: move system_local consts into a C file
        media: atomisp: get rid of version-specific system_local.h
        media: atomisp: move global stuff into a common header
        media: atomisp: remove non-used 32-bits consts at system_local
        media: atomisp: get rid of some unused static vars
        media: atomisp: Fix error code in ov5693_probe()
        media: atomisp: Replace trace_printk by pr_info
        media: atomisp: Fix __func__ style warnings
        media: atomisp: fix help message for ISP2401 selection
        media: atomisp: i2c: atomisp-ov2680.c: fixed a brace coding style issue.
        media: atomisp: make const arrays static, makes object smaller
        media: atomisp: Clean up non-existing folders from Makefile
        media: atomisp: Get rid of ACPI specifics in gmin_subdev_add()
        media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()
        media: atomisp: Use temporary variable for device in gmin_subdev_add()
        media: atomisp: Refactor PMIC detection to a separate function
        media: atomisp: Deduplicate return ret in gmin_i2c_write()
        media: atomisp: Make pointer to PMIC client global
        ...
      d15be546
    • Linus Torvalds's avatar
      Merge tag 'exfat-for-5.8-rc7' of... · 071fb1bc
      Linus Torvalds authored
      Merge tag 'exfat-for-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat into master
      
      Pull exfat fixes from Namjae Jeon:
      
       - fix overflow issue at sector calculation
      
       - fix wrong hint_stat initialization
      
       - fix wrong size update of stream entry
      
       - fix endianness of upname in name_hash computation
      
      * tag 'exfat-for-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
        exfat: fix name_hash computation on big endian systems
        exfat: fix wrong size update of stream entry by typo
        exfat: fix wrong hint_stat initialization in exfat_find_dir_entry()
        exfat: fix overflow issue in exfat_cluster_to_sector()
      071fb1bc
  4. Jul 22, 2020
  5. Jul 21, 2020
  6. Jul 20, 2020
    • Kevin Buettner's avatar
      copy_xstate_to_kernel: Fix typo which caused GDB regression · 5714ee50
      Kevin Buettner authored
      
      
      This fixes a regression encountered while running the
      gdb.base/corefile.exp test in GDB's test suite.
      
      In my testing, the typo prevented the sw_reserved field of struct
      fxregs_state from being output to the kernel XSAVES area.  Thus the
      correct mask corresponding to XCR0 was not present in the core file for
      GDB to interrogate, resulting in the following behavior:
      
         [kev@f32-1 gdb]$ ./gdb -q testsuite/outputs/gdb.base/corefile/corefile testsuite/outputs/gdb.base/corefile/corefile.core
         Reading symbols from testsuite/outputs/gdb.base/corefile/corefile...
         [New LWP 232880]
      
         warning: Unexpected size of section `.reg-xstate/232880' in core file.
      
      With the typo fixed, the test works again as expected.
      
      Signed-off-by: default avatarKevin Buettner <kevinb@redhat.com>
      Fixes: 9e463654
      
       ("copy_xstate_to_kernel(): don't leave parts of destination uninitialized")
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Dave Airlie <airlied@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5714ee50
    • Linus Torvalds's avatar
      Linux 5.8-rc6 · ba47d845
      Linus Torvalds authored
      ba47d845
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-2020-07-19' of... · 92188b41
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into master
      
      Pull perf tooling fixes from Arnaldo Carvalho de Melo:
      
       - Update hashmap.h from libbpf and kvm.h from x86's kernel UAPI.
      
       - Set opt->set in libsubcmd's OPT_CALLBACK_SET(). This fixes
         'perf record --switch-output-event event-name' usage"
      
      * tag 'perf-tools-fixes-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        tools arch kvm: Sync kvm headers with the kernel sources
        perf tools: Sync hashmap.h with libbpf's
        libsubcmd: Fix OPT_CALLBACK_SET()
      92188b41
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-07-19' of... · efb9666e
      Linus Torvalds authored
      Merge tag 'x86-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into master
      
      Pull x86 fixes from Thomas Gleixner:
       "A pile of fixes for x86:
      
         - Fix the I/O bitmap invalidation on XEN PV, which was overlooked in
           the recent ioperm/iopl rework. This caused the TSS and XEN's I/O
           bitmap to get out of sync.
      
         - Use the proper vectors for HYPERV.
      
         - Make disabling of stack protector for the entry code work with GCC
           builds which enable stack protector by default. Removing the option
           is not sufficient, it needs an explicit -fno-stack-protector to
           shut it off.
      
         - Mark check_user_regs() noinstr as it is called from noinstr code.
           The missing annotation causes it to be placed in the text section
           which makes it instrumentable.
      
         - Add the missing interrupt disable in exc_alignment_check()
      
         - Fixup a XEN_PV build dependency in the 32bit entry code
      
         - A few fixes to make the Clang integrated assembler happy
      
         - Move EFI stub build to the right place for out of tree builds
      
         - Make prepare_exit_to_usermode() static. It's not longer called from
           ASM code"
      
      * tag 'x86-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/boot: Don't add the EFI stub to targets
        x86/entry: Actually disable stack protector
        x86/ioperm: Fix io bitmap invalidation on Xen PV
        x86: math-emu: Fix up 'cmp' insn for clang ias
        x86/entry: Fix vectors to IDTENTRY_SYSVEC for CONFIG_HYPERV
        x86/entry: Add compatibility with IAS
        x86/entry/common: Make prepare_exit_to_usermode() static
        x86/entry: Mark check_user_regs() noinstr
        x86/traps: Disable interrupts in exc_aligment_check()
        x86/entry/32: Fix XEN_PV build dependency
      efb9666e
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2020-07-19' of... · 66e4b636
      Linus Torvalds authored
      Merge tag 'timers-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into master
      
      Pull timer fixes from Thomas Gleixner:
       "Two fixes for the timer wheel:
      
         - A timer which is already expired at enqueue time can set the
           base->next_expiry value backwards. As a consequence base->clk can
           be set back as well. This can lead to timers expiring early. Add a
           sanity check to prevent this.
      
         - When a timer is queued with an expiry time beyond the wheel
           capacity then it should be queued in the bucket of the last wheel
           level which is expiring last.
      
           The code adjusted the expiry time to the maximum wheel capacity,
           which is only correct when the wheel clock is 0. Aside of that the
           check whether the delta is larger than wheel capacity does not
           check the delta, it checks the expiry value itself. As a result
           timers can expire at random.
      
           Fix this by checking the right variable and adjust expiry time so
           it becomes base->clock plus capacity which places it into the
           outmost bucket in the last wheel level"
      
      * tag 'timers-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        timer: Fix wheel index calculation on last level
        timer: Prevent base->clk from moving backward
      66e4b636
    • Linus Torvalds's avatar
      Merge tag 'sched-urgent-2020-07-19' of... · 43768f7c
      Linus Torvalds authored
      Merge tag 'sched-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into master
      
      Pull scheduler fixes from Thomas Gleixner:
       "A set of scheduler fixes:
      
         - Plug a load average accounting race which was introduced with a
           recent optimization casing load average to show bogus numbers.
      
         - Fix the rseq CPU id initialization for new tasks. sched_fork() does
           not update the rseq CPU id so the id is the stale id of the parent
           task, which can cause user space data corruption.
      
         - Handle a 0 return value of task_h_load() correctly in the load
           balancer, which does not decrease imbalance and therefore pulls
           until the maximum number of loops is reached, which might be all
           tasks just created by a fork bomb"
      
      * tag 'sched-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: handle case of task_h_load() returning 0
        sched: Fix unreliable rseq cpu_id for new tasks
        sched: Fix loadavg accounting race
      43768f7c
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2020-07-19' of... · 9413cd77
      Linus Torvalds authored
      Merge tag 'irq-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into master
      
      Pull irq fixes from Thomas Gleixner:
       "Two fixes for the interrupt subsystem:
      
         - Make the handling of the firmware node consistent and do not free
           the node after the domain has been created successfully. The core
           code stores a pointer to it which can lead to a use after free or
           double free.
      
           This used to "work" because the pointer was not stored when the
           initial code was written, but at some point later it was required
           to store it. Of course nobody noticed that the existing users break
           that way.
      
         - Handle affinity setting on inactive interrupts correctly when
           hierarchical irq domains are enabled.
      
           When interrupts are inactive with the modern hierarchical irqdomain
           design, the interrupt chips are not necessarily in a state where
           affinity changes can be handled. The legacy irq chip design allowed
           this because interrupts are immediately fully initialized at
           allocation time. X86 has a hacky workaround for this, but other
           implementations do not.
      
           This cased malfunction on GIC-V3. Instead of playing whack a mole
           to find all affected drivers, change the core code to store the
           requested affinity setting and then establish it when the interrupt
           is allocated, which makes the X86 hack go away"
      
      * tag 'irq-urgent-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq/affinity: Handle affinity setting on inactive interrupts correctly
        irqdomain/treewide: Keep firmware node unconditionally allocated
      9413cd77
    • Linus Torvalds's avatar
      Merge tag 'usb-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb into master · ce20d7bf
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a few small USB fixes, and one thunderbolt fix, for 5.8-rc6.
      
        Nothing huge in here, just the normal collection of gadget, dwc2/3,
        serial, and other minor USB driver fixes and id additions. Full
        details are in the shortlog.
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'usb-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        USB: serial: iuu_phoenix: fix memory corruption
        USB: c67x00: fix use after free in c67x00_giveback_urb
        usb: gadget: function: fix missing spinlock in f_uac1_legacy
        usb: gadget: udc: atmel: fix uninitialized read in debug printk
        usb: gadget: udc: atmel: remove outdated comment in usba_ep_disable()
        usb: dwc2: Fix shutdown callback in platform
        usb: cdns3: trace: fix some endian issues
        usb: cdns3: ep0: fix some endian issues
        usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init()
        usb: gadget: fix langid kernel-doc warning in usbstring.c
        usb: dwc3: pci: add support for the Intel Jasper Lake
        usb: dwc3: pci: add support for the Intel Tiger Lake PCH -H variant
        usb: chipidea: core: add wakeup support for extcon
        USB: serial: option: add Quectel EG95 LTE modem
        thunderbolt: Fix path indices used in USB3 tunnel discovery
        USB: serial: ch341: add new Product ID for CH340
        USB: serial: option: add GosunCn GM500 series
        USB: serial: cypress_m8: enable Simply Automated UPB PIM
      ce20d7bf
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.8-6' of git://git.infradead.org/users/hch/dma-mapping into master · 8c18fc63
      Linus Torvalds authored
      Pull dma-mapping fixes from Christoph Hellwig:
       "Ensure we always have fully addressable memory in the dma coherent
        pool (Nicolas Saenz Julienne)"
      
      * tag 'dma-mapping-5.8-6' of git://git.infradead.org/users/hch/dma-mapping:
        dma-pool: do not allocate pool memory from CMA
        dma-pool: make sure atomic pool suits device
        dma-pool: introduce dma_guess_pool()
        dma-pool: get rid of dma_in_atomic_pool()
        dma-direct: provide function to check physical memory area validity
      8c18fc63
  7. Jul 19, 2020
    • Mauro Carvalho Chehab's avatar
      Revert "media: atomisp: keep the ISP powered on when setting it" · 0d6db851
      Mauro Carvalho Chehab authored
      changeset d0213061a501 ("media: atomisp: fix mask and shift operation on ISPSSPM0")
      solved the existing issue with the IUNIT power on code.
      
      So, the driver can now use the right code again.
      
      This reverts commit 95d1f398
      
      .
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      0d6db851
    • Colin Ian King's avatar
      media: atomisp: fix mask and shift operation on ISPSSPM0 · 23988c97
      Colin Ian King authored
      Currently the check on bits 25:24 on ISPSSPM0 is always 0 because
      the mask and shift operations are incorrect. Fix this by shifting
      by MRFLD_ISPSSPM0_ISPSSS_OFFSET (24 bits right) and then masking
      with RFLD_ISPSSPM0_ISPSSC_MASK (0x03) to get the appropriate 2 bits
      to check.
      
      Addresses-Coverity: ("Operands don't affect result")
      Fixes: 0f441fd7
      
       ("media: atomisp: simplify the power down/up code")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      23988c97
    • Arvind Sankar's avatar
      x86/boot: Don't add the EFI stub to targets · da05b143
      Arvind Sankar authored
      
      
      vmlinux-objs-y is added to targets, which currently means that the EFI
      stub gets added to the targets as well. It shouldn't be added since it
      is built elsewhere.
      
      This confuses Makefile.build which interprets the EFI stub as a target
      	$(obj)/$(objtree)/drivers/firmware/efi/libstub/lib.a
      and will create drivers/firmware/efi/libstub/ underneath
      arch/x86/boot/compressed, to hold this supposed target, if building
      out-of-tree. [0]
      
      Fix this by pulling the stub out of vmlinux-objs-y into efi-obj-y.
      
      [0] See scripts/Makefile.build near the end:
          # Create directories for object files if they do not exist
      
      Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Link: https://lkml.kernel.org/r/20200715032631.1562882-1-nivedita@alum.mit.edu
      da05b143
    • Kees Cook's avatar
      x86/entry: Actually disable stack protector · 58ac3154
      Kees Cook authored
      Some builds of GCC enable stack protector by default. Simply removing
      the arguments is not sufficient to disable stack protector, as the stack
      protector for those GCC builds must be explicitly disabled. Remove the
      argument removals and add -fno-stack-protector. Additionally include
      missed x32 argument updates, and adjust whitespace for readability.
      
      Fixes: 20355e5f
      
       ("x86/entry: Exclude low level entry code from sanitizing")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/202006261333.585319CA6B@keescook
      58ac3154
    • Mauro Carvalho Chehab's avatar
      media: atomisp: move system_local consts into a C file · 85ebb8eb
      Mauro Carvalho Chehab authored
      
      
      Instead of declaring all those consts everywhere when the
      headers are included, just place them on a single place.
      
      This change shuts up lots of warnings when built with W=1:
      
      In file included from drivers/staging/media/atomisp/pci/ia_css_acc_types.h:23,
                       from drivers/staging/media/atomisp/pci/ia_css.h:26,
                       from drivers/staging/media/atomisp/pci/atomisp_compat_css20.h:24,
                       from drivers/staging/media/atomisp/pci/atomisp_compat.h:22,
                       from drivers/staging/media/atomisp/pci/atomisp_drvfs.c:23:
      ./drivers/staging/media/atomisp//pci/system_local.h:193:26: warning: ‘STREAM2MMIO_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        193 | static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:186:26: warning: ‘PIXELGEN_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        186 | static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:179:26: warning: ‘CSI_RX_BE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        179 | static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:172:26: warning: ‘CSI_RX_FE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        172 | static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:165:26: warning: ‘ISYS_IRQ_BASE’ defined but not used [-Wunused-const-variable=]
        165 | static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:158:26: warning: ‘IBUF_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        158 | static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:153:26: warning: ‘RX_BASE’ defined but not used [-Wunused-const-variable=]
        153 | static const hrt_address RX_BASE[N_RX_ID] = {
            |                          ^~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:138:26: warning: ‘INPUT_SYSTEM_BASE’ defined but not used [-Wunused-const-variable=]
        138 | static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:130:26: warning: ‘INPUT_FORMATTER_BASE’ defined but not used [-Wunused-const-variable=]
        130 | static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:125:26: warning: ‘TIMED_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        125 | static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:120:26: warning: ‘GPIO_BASE’ defined but not used [-Wunused-const-variable=]
        120 | static const hrt_address GPIO_BASE[N_GPIO_ID] = {
            |                          ^~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:116:26: warning: ‘GP_TIMER_BASE’ defined but not used [-Wunused-const-variable=]
        116 | static const hrt_address GP_TIMER_BASE =
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:109:26: warning: ‘GP_DEVICE_BASE’ defined but not used [-Wunused-const-variable=]
        109 | static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:96:26: warning: ‘FIFO_MONITOR_BASE’ defined but not used [-Wunused-const-variable=]
         96 | static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:90:26: warning: ‘GDC_BASE’ defined but not used [-Wunused-const-variable=]
         90 | static const hrt_address GDC_BASE[N_GDC_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:78:26: warning: ‘IRQ_BASE’ defined but not used [-Wunused-const-variable=]
         78 | static const hrt_address IRQ_BASE[N_IRQ_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:73:26: warning: ‘ISYS2401_DMA_BASE’ defined but not used [-Wunused-const-variable=]
         73 | static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:69:26: warning: ‘DMA_BASE’ defined but not used [-Wunused-const-variable=]
         69 | static const hrt_address DMA_BASE[N_DMA_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:63:26: warning: ‘MMU_BASE’ defined but not used [-Wunused-const-variable=]
         63 | static const hrt_address MMU_BASE[N_MMU_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:54:26: warning: ‘SP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         54 | static const hrt_address SP_DMEM_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:50:26: warning: ‘SP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         50 | static const hrt_address SP_CTRL_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:45:26: warning: ‘ISP_BAMEM_BASE’ defined but not used [-Wunused-const-variable=]
         45 | static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:41:26: warning: ‘ISP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         41 | static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:37:26: warning: ‘ISP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         37 | static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      In file included from drivers/staging/media/atomisp/pci/ia_css_acc_types.h:23,
                       from drivers/staging/media/atomisp/pci/ia_css.h:26,
                       from drivers/staging/media/atomisp/pci/atomisp_file.c:27:
      ./drivers/staging/media/atomisp//pci/system_local.h:193:26: warning: ‘STREAM2MMIO_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        193 | static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:186:26: warning: ‘PIXELGEN_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        186 | static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:179:26: warning: ‘CSI_RX_BE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        179 | static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:172:26: warning: ‘CSI_RX_FE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        172 | static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:165:26: warning: ‘ISYS_IRQ_BASE’ defined but not used [-Wunused-const-variable=]
        165 | static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:158:26: warning: ‘IBUF_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        158 | static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:153:26: warning: ‘RX_BASE’ defined but not used [-Wunused-const-variable=]
        153 | static const hrt_address RX_BASE[N_RX_ID] = {
            |                          ^~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:138:26: warning: ‘INPUT_SYSTEM_BASE’ defined but not used [-Wunused-const-variable=]
        138 | static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:130:26: warning: ‘INPUT_FORMATTER_BASE’ defined but not used [-Wunused-const-variable=]
        130 | static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:125:26: warning: ‘TIMED_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        125 | static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:120:26: warning: ‘GPIO_BASE’ defined but not used [-Wunused-const-variable=]
        120 | static const hrt_address GPIO_BASE[N_GPIO_ID] = {
            |                          ^~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:116:26: warning: ‘GP_TIMER_BASE’ defined but not used [-Wunused-const-variable=]
        116 | static const hrt_address GP_TIMER_BASE =
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:109:26: warning: ‘GP_DEVICE_BASE’ defined but not used [-Wunused-const-variable=]
        109 | static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:96:26: warning: ‘FIFO_MONITOR_BASE’ defined but not used [-Wunused-const-variable=]
         96 | static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:90:26: warning: ‘GDC_BASE’ defined but not used [-Wunused-const-variable=]
         90 | static const hrt_address GDC_BASE[N_GDC_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:78:26: warning: ‘IRQ_BASE’ defined but not used [-Wunused-const-variable=]
         78 | static const hrt_address IRQ_BASE[N_IRQ_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:73:26: warning: ‘ISYS2401_DMA_BASE’ defined but not used [-Wunused-const-variable=]
         73 | static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:69:26: warning: ‘DMA_BASE’ defined but not used [-Wunused-const-variable=]
         69 | static const hrt_address DMA_BASE[N_DMA_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:63:26: warning: ‘MMU_BASE’ defined but not used [-Wunused-const-variable=]
         63 | static const hrt_address MMU_BASE[N_MMU_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:54:26: warning: ‘SP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         54 | static const hrt_address SP_DMEM_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:50:26: warning: ‘SP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         50 | static const hrt_address SP_CTRL_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:45:26: warning: ‘ISP_BAMEM_BASE’ defined but not used [-Wunused-const-variable=]
         45 | static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:41:26: warning: ‘ISP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         41 | static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:37:26: warning: ‘ISP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         37 | static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      In file included from ./drivers/staging/media/atomisp//pci/ia_css_acc_types.h:23,
                       from ./drivers/staging/media/atomisp//pci/ia_css_pipe_public.h:29,
                       from drivers/staging/media/atomisp/pci/sh_css_legacy.h:23,
                       from drivers/staging/media/atomisp/pci/atomisp_internal.h:34,
                       from drivers/staging/media/atomisp/pci/atomisp_cmd.h:30,
                       from drivers/staging/media/atomisp/pci/atomisp_csi2.c:21:
      ./drivers/staging/media/atomisp//pci/system_local.h:193:26: warning: ‘STREAM2MMIO_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        193 | static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:186:26: warning: ‘PIXELGEN_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        186 | static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:179:26: warning: ‘CSI_RX_BE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        179 | static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:172:26: warning: ‘CSI_RX_FE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        172 | static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:165:26: warning: ‘ISYS_IRQ_BASE’ defined but not used [-Wunused-const-variable=]
        165 | static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:158:26: warning: ‘IBUF_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        158 | static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:153:26: warning: ‘RX_BASE’ defined but not used [-Wunused-const-variable=]
        153 | static const hrt_address RX_BASE[N_RX_ID] = {
            |                          ^~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:138:26: warning: ‘INPUT_SYSTEM_BASE’ defined but not used [-Wunused-const-variable=]
        138 | static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:130:26: warning: ‘INPUT_FORMATTER_BASE’ defined but not used [-Wunused-const-variable=]
        130 | static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:125:26: warning: ‘TIMED_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        125 | static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:120:26: warning: ‘GPIO_BASE’ defined but not used [-Wunused-const-variable=]
        120 | static const hrt_address GPIO_BASE[N_GPIO_ID] = {
            |                          ^~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:116:26: warning: ‘GP_TIMER_BASE’ defined but not used [-Wunused-const-variable=]
        116 | static const hrt_address GP_TIMER_BASE =
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:109:26: warning: ‘GP_DEVICE_BASE’ defined but not used [-Wunused-const-variable=]
        109 | static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:96:26: warning: ‘FIFO_MONITOR_BASE’ defined but not used [-Wunused-const-variable=]
         96 | static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:90:26: warning: ‘GDC_BASE’ defined but not used [-Wunused-const-variable=]
         90 | static const hrt_address GDC_BASE[N_GDC_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:78:26: warning: ‘IRQ_BASE’ defined but not used [-Wunused-const-variable=]
         78 | static const hrt_address IRQ_BASE[N_IRQ_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:73:26: warning: ‘ISYS2401_DMA_BASE’ defined but not used [-Wunused-const-variable=]
         73 | static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:69:26: warning: ‘DMA_BASE’ defined but not used [-Wunused-const-variable=]
         69 | static const hrt_address DMA_BASE[N_DMA_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:63:26: warning: ‘MMU_BASE’ defined but not used [-Wunused-const-variable=]
         63 | static const hrt_address MMU_BASE[N_MMU_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:54:26: warning: ‘SP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         54 | static const hrt_address SP_DMEM_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:50:26: warning: ‘SP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         50 | static const hrt_address SP_CTRL_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:45:26: warning: ‘ISP_BAMEM_BASE’ defined but not used [-Wunused-const-variable=]
         45 | static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:41:26: warning: ‘ISP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         41 | static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:37:26: warning: ‘ISP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         37 | static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      In file included from ./drivers/staging/media/atomisp//pci/ia_css_acc_types.h:23,
                       from ./drivers/staging/media/atomisp//pci/ia_css_pipe_public.h:29,
                       from drivers/staging/media/atomisp/pci/sh_css_legacy.h:23,
                       from drivers/staging/media/atomisp/pci/atomisp_internal.h:34,
                       from drivers/staging/media/atomisp/pci/atomisp_acc.h:23,
                       from drivers/staging/media/atomisp/pci/atomisp_acc.c:29:
      ./drivers/staging/media/atomisp//pci/system_local.h:193:26: warning: ‘STREAM2MMIO_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        193 | static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:186:26: warning: ‘PIXELGEN_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        186 | static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:179:26: warning: ‘CSI_RX_BE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        179 | static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:172:26: warning: ‘CSI_RX_FE_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        172 | static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:165:26: warning: ‘ISYS_IRQ_BASE’ defined but not used [-Wunused-const-variable=]
        165 | static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:158:26: warning: ‘IBUF_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        158 | static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:153:26: warning: ‘RX_BASE’ defined but not used [-Wunused-const-variable=]
        153 | static const hrt_address RX_BASE[N_RX_ID] = {
            |                          ^~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:138:26: warning: ‘INPUT_SYSTEM_BASE’ defined but not used [-Wunused-const-variable=]
        138 | static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:130:26: warning: ‘INPUT_FORMATTER_BASE’ defined but not used [-Wunused-const-variable=]
        130 | static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {
            |                          ^~~~~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:125:26: warning: ‘TIMED_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
        125 | static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {
            |                          ^~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:120:26: warning: ‘GPIO_BASE’ defined but not used [-Wunused-const-variable=]
        120 | static const hrt_address GPIO_BASE[N_GPIO_ID] = {
            |                          ^~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:116:26: warning: ‘GP_TIMER_BASE’ defined but not used [-Wunused-const-variable=]
        116 | static const hrt_address GP_TIMER_BASE =
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:109:26: warning: ‘GP_DEVICE_BASE’ defined but not used [-Wunused-const-variable=]
        109 | static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:96:26: warning: ‘FIFO_MONITOR_BASE’ defined but not used [-Wunused-const-variable=]
         96 | static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:90:26: warning: ‘GDC_BASE’ defined but not used [-Wunused-const-variable=]
         90 | static const hrt_address GDC_BASE[N_GDC_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:78:26: warning: ‘IRQ_BASE’ defined but not used [-Wunused-const-variable=]
         78 | static const hrt_address IRQ_BASE[N_IRQ_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:73:26: warning: ‘ISYS2401_DMA_BASE’ defined but not used [-Wunused-const-variable=]
         73 | static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {
            |                          ^~~~~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:69:26: warning: ‘DMA_BASE’ defined but not used [-Wunused-const-variable=]
         69 | static const hrt_address DMA_BASE[N_DMA_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:63:26: warning: ‘MMU_BASE’ defined but not used [-Wunused-const-variable=]
         63 | static const hrt_address MMU_BASE[N_MMU_ID] = {
            |                          ^~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:54:26: warning: ‘SP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         54 | static const hrt_address SP_DMEM_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:50:26: warning: ‘SP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         50 | static const hrt_address SP_CTRL_BASE[N_SP_ID] = {
            |                          ^~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:45:26: warning: ‘ISP_BAMEM_BASE’ defined but not used [-Wunused-const-variable=]
         45 | static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {
            |                          ^~~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:41:26: warning: ‘ISP_DMEM_BASE’ defined but not used [-Wunused-const-variable=]
         41 | static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      ./drivers/staging/media/atomisp//pci/system_local.h:37:26: warning: ‘ISP_CTRL_BASE’ defined but not used [-Wunused-const-variable=]
         37 | static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {
            |                          ^~~~~~~~~~~~~
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      85ebb8eb
    • Mauro Carvalho Chehab's avatar
      media: atomisp: get rid of version-specific system_local.h · 08b2bcc6
      Mauro Carvalho Chehab authored
      
      
      After removing the unused 32-bits data, the isp2401_system_local.h
      now contains everything that it is needed, either by isp2401 or
      by isp2400.
      
      So, remove code duplication.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      08b2bcc6
    • Mauro Carvalho Chehab's avatar
      media: atomisp: move global stuff into a common header · 4b28ded7
      Mauro Carvalho Chehab authored
      
      
      Right now, there are two versions of system_global.h headers.
      
      Both share a lot of common code. There are some ISP2401 specific
      types on one of the headers, but it doesn't conflict with the
      ISP2400 ones.
      
      Also, the common code is identical.
      
      So, remove code duplication by moving such code into a
      common header.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      4b28ded7
    • Mauro Carvalho Chehab's avatar
      media: atomisp: remove non-used 32-bits consts at system_local · a6154805
      Mauro Carvalho Chehab authored
      
      
      There is an abstraction at the code in order to support
      32 or 64 bits address/data length. However, for all
      Atom chipsets supported by this version, the size is fixed.
      
      So, cleanup the mess, removing the uused code and placing
      the data sizes on a single place.
      
      The end goal is to completely remove those local/global
      headers, replacing them by some ISP-version dependent struct,
      in order for the driver to decide what version it would need
      in runtime.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      a6154805
    • Mauro Carvalho Chehab's avatar
      media: atomisp: get rid of some unused static vars · ecf1b4ca
      Mauro Carvalho Chehab authored
      
      
      There are several static vars declared inside the
      system local headers. This causes lots of warnings when W=1.
      
      Remove the unused ones.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      ecf1b4ca
    • Dan Carpenter's avatar
      media: atomisp: Fix error code in ov5693_probe() · ac828456
      Dan Carpenter authored
      If gmin_camera_platform_data() returns NULL then we should return a
      negative error instead of success.
      
      Fixes: 90ebe55a
      
       ("media: staging: atomisp: Add driver prefix to Kconfig option and module names")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      ac828456