1. 06 Apr, 2019 1 commit
  2. 05 Apr, 2019 39 commits
    • Greg Kroah-Hartman's avatar
      Linux 5.0.7 · 8b298d3a
      Greg Kroah-Hartman authored
      8b298d3a
    • Masahiro Yamada's avatar
      kbuild: skip sub-make for in-tree build with GNU Make 4.x · e73f1455
      Masahiro Yamada authored
      commit 688931a5 upstream.
      
      Commit 2b50f7ab ("kbuild: add workaround for Debian make-kpkg")
      annoyed people who want to wrap the top Makefile with GNUmakefile
      to customize it for their use.
      
      On second thought, we do not need to run the sub-make for in-tree
      build with Make 4.x because the 'MAKEFLAGS += -rR' issue only happens
      on GNU Make 3.x.
      
      With this commit, people will get back their workflow, and the Debian
      make-kpkg will still work.
      
      Fixes: 2b50f7ab ("kbuild: add workaround for Debian make-kpkg")
      Reported-by: 's avatarAndreas Schwab <schwab@suse.de>
      Reported-by: 's avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: 's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: 's avatarAndreas Schwab <schwab@suse.de>
      Tested-by: 's avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e73f1455
    • Masahiro Yamada's avatar
      kbuild: add workaround for Debian make-kpkg · d972d1c0
      Masahiro Yamada authored
      commit 2b50f7ab upstream.
      
      Since commit 3812b8c5 ("kbuild: make -r/-R effective in top
      Makefile for old Make versions"), make-kpkg is not working.
      
      make-kpkg directly includes the top Makefile of Linux kernel, and
      appends some debian_* targets.
      
        /usr/share/kernel-package/ruleset/kernel_version.mk:
      
          # Include the kernel makefile
          override dot-config := 1
          include Makefile
          dot-config := 1
      
      I did not know the kernel Makefile was used in that way, and it is
      hard to guarantee the behavior when the kernel Makefile is included
      by another Makefile from a different project.
      
      It looks like Debian Stretch stopped providing make-kpkg. Maybe it is
      obsolete and being replaced with 'make deb-pkg' etc. but still widely
      used.
      
      This commit adds a workaround; if the top Makefile is included by
      another Makefile, skip sub-make in order to make the main part visible.
      'MAKEFLAGS += -rR' does not become effective for GNU Make < 4.0, but
      Debian/Ubuntu is already using newer versions.
      
      The effect of this commit:
      
        Debian 8 (Jessie)  : Fixed
        Debian 9 (Stretch) : make-kpkg (kernel-package) is not provided
        Ubuntu 14.04 LTS   : NOT Fixed
        Ubuntu 16.04 LTS   : Fixed
        Ubuntu 18.04 LTS   : Fixed
      
      This commit cannot fix Ubuntu 14.04 because it installs GNU Make 3.81,
      but its support will end in Apr 2019, which is before the Linux v5.1
      release.
      
      I added warning so that nobody would try to include the top Makefile.
      
      Fixes: 3812b8c5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")
      Reported-by: 's avatarLiz Zhang <lizzha@microsoft.com>
      Signed-off-by: 's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: 's avatarLili Deng <v-lide@microsoft.com>
      Cc: Manoj Srivastava <srivasta@debian.org>
      Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d972d1c0
    • Coly Li's avatar
      bcache: fix potential div-zero error of writeback_rate_p_term_inverse · 38d2286e
      Coly Li authored
      [ Upstream commit 5b5fd3c9 ]
      
      Current code already uses d_strtoul_nonzero() to convert input string
      to an unsigned integer, to make sure writeback_rate_p_term_inverse
      won't be zero value. But overflow may happen when converting input
      string to an unsigned integer value by d_strtoul_nonzero(), then
      dc->writeback_rate_p_term_inverse can still be set to 0 even if the
      sysfs file input value is not zero, e.g. 4294967296 (a.k.a UINT_MAX+1).
      
      If dc->writeback_rate_p_term_inverse is set to 0, it might cause a
      dev-zero error in following code from __update_writeback_rate(),
      	int64_t proportional_scaled =
      		div_s64(error, dc->writeback_rate_p_term_inverse);
      
      This patch replaces d_strtoul_nonzero() by sysfs_strtoul_clamp() and
      limit the value range in [1, UINT_MAX]. Then the unsigned integer
      overflow and dev-zero error can be avoided.
      Signed-off-by: 's avatarColy Li <colyli@suse.de>
      Signed-off-by: 's avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      38d2286e
    • Hans de Goede's avatar
      ACPI / video: Extend chassis-type detection with a "Lunch Box" check · ae050638
      Hans de Goede authored
      [ Upstream commit d693c008 ]
      
      Commit 53fa1f6e ("ACPI / video: Only default only_lcd to true on
      Win8-ready _desktops_") introduced chassis type detection, limiting the
      lcd_only check for the backlight to devices where the chassis-type
      indicates their is no builtin LCD panel.
      
      The purpose of the lcd_only check is to avoid advertising a backlight
      interface on desktops, since skylake and newer machines seem to always
      have a backlight interface even if there is no LCD panel. The limiting
      of this check to desktops only was done to avoid breaking backlight
      support on some laptops which do not have the lcd flag set.
      
      The Fujitsu ESPRIMO Q910 which is a compact (NUC like) desktop machine
      has a chassis type of 0x10 aka "Lunch Box". Without the lcd_only check
      we end up falsely advertising backlight/brightness control on this
      device. This commit extend the dmi_is_desktop check to return true
      for type 0x10 to fix this.
      
      Fixes: 53fa1f6e ("ACPI / video: Only default only_lcd to true ...")
      Signed-off-by: 's avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: 's avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      ae050638
    • Thierry Reding's avatar
      gpio: of: Restrict enable-gpio quirk to regulator-gpio · 3e033b1b
      Thierry Reding authored
      [ Upstream commit 692ef26e ]
      
      Commit 0e7d6f94 ("gpio: of: Apply regulator-gpio quirk only to
      enable-gpios") breaks the device tree ABI specified in the device tree
      bindings for fixed regulators (compatible "regulator-fixed"). According
      to these bindings the polarity of the GPIO is exclusively controlled by
      the presence or absence of the enable-active-high property. As such the
      polarity quirk implemented in of_gpio_flags_quirks() must be applied to
      the GPIO specified for fixed regulators.
      
      However, commit 0e7d6f94 ("gpio: of: Apply regulator-gpio quirk only
      to enable-gpios") restricted the quirk to the enable-gpios property for
      fixed regulators as well, whereas according to the commit message itself
      it should only apply to "regulator-gpio" compatible device tree nodes.
      
      Fix this by actually implementing what the offending commit intended,
      which is to ensure that the quirk is applied to the GPIO specified by
      the "enable-gpio" property for the "regulator-gpio" bindings only.
      
      This fixes a regression on Jetson TX1 where the fixed regulator for the
      HDMI +5V pin relies on the flags quirk for the proper polarity.
      
      Fixes: 0e7d6f94 ("gpio: of: Apply regulator-gpio quirk only to enable-gpios")
      Signed-off-by: 's avatarThierry Reding <treding@nvidia.com>
      Tested-by: 's avatarMarek Vasut <marek.vasut@gmail.com>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      3e033b1b
    • Arnd Bergmann's avatar
      appletalk: Fix compile regression · ae42fc86
      Arnd Bergmann authored
      [ Upstream commit 27da0d2e ]
      
      A bugfix just broke compilation of appletalk when CONFIG_SYSCTL
      is disabled:
      
      In file included from net/appletalk/ddp.c:65:
      net/appletalk/ddp.c: In function 'atalk_init':
      include/linux/atalk.h:164:34: error: expected expression before 'do'
       #define atalk_register_sysctl()  do { } while(0)
                                        ^~
      net/appletalk/ddp.c:1934:7: note: in expansion of macro 'atalk_register_sysctl'
        rc = atalk_register_sysctl();
      
      This is easier to avoid by using conventional inline functions
      as stubs rather than macros. The header already has inline
      functions for other purposes, so I'm changing over all the
      macros for consistency.
      
      Fixes: 6377f787 ("appletalk: Fix use-after-free in atalk_proc_exit")
      Signed-off-by: 's avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      ae42fc86
    • Nathan Chancellor's avatar
      net: stmmac: Avoid one more sometimes uninitialized Clang warning · a84b7c68
      Nathan Chancellor authored
      [ Upstream commit 1f5d861f ]
      
      When building with -Wsometimes-uninitialized, Clang warns:
      
      drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable
      'ns' is used uninitialized whenever 'if' condition is false
      [-Werror,-Wsometimes-uninitialized]
      drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable
      'ns' is used uninitialized whenever '&&' condition is false
      [-Werror,-Wsometimes-uninitialized]
      
      Clang is concerned with the use of stmmac_do_void_callback (which
      stmmac_get_systime wraps), as it may fail to initialize these values if
      the if condition was ever false (meaning the callback doesn't exist).
      It's not wrong because the callback is what initializes ns. While it's
      unlikely that the callback is going to disappear at some point and make
      that condition false, we can easily avoid this warning by zero
      initializing the variable.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/384
      Fixes: df103170 ("net: stmmac: Avoid sometimes uninitialized Clang warnings")
      Suggested-by: 's avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: Nathan Chancellor's avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: 's avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      a84b7c68
    • Ville Syrjälä's avatar
      drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers · 36b39631
      Ville Syrjälä authored
      [ Upstream commit c978ae9b ]
      
      We aren't supposed to force a stop+start between every i2c msg
      when performing multi message transfers. This should eg. cause
      the DDC segment address to be reset back to 0 between writing
      the segment address and reading the actual EDID extension block.
      
      To quote the E-DDC spec:
      "... this standard requires that the segment pointer be
       reset to 00h when a NO ACK or a STOP condition is received."
      
      Since we're going to touch this might as well consult the
      I2C_M_STOP flag to determine whether we want to force the stop
      or not.
      
      Cc: Brian Vincent <brainn@gmail.com>
      References: https://bugs.freedesktop.org/show_bug.cgi?id=108081Signed-off-by: 's avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180928180403.22499-1-ville.syrjala@linux.intel.comReviewed-by: 's avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      36b39631
    • Chris Wilson's avatar
      drm: Reorder set_property_atomic to avoid returning with an active ww_ctx · 8826838f
      Chris Wilson authored
      [ Upstream commit 227ad6d9 ]
      
      Delay the drm_modeset_acquire_init() until after we check for an
      allocation failure so that we can return immediately upon error without
      having to unwind.
      
      WARNING: lock held when returning to user space!
      4.20.0+ #174 Not tainted
      ------------------------------------------------
      syz-executor556/8153 is leaving the kernel with locks still held!
      1 lock held by syz-executor556/8153:
        #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at:
      set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462
      
      Reported-by: syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com
      Fixes: 144a7999 ("drm: Handle properties in the core for atomic drivers")
      Signed-off-by: 's avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: David Airlie <airlied@linux.ie>
      Cc: <stable@vger.kernel.org> # v4.14+
      Reviewed-by: 's avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181230122842.21917-1-chris@chris-wilson.co.ukSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      8826838f
    • Kuninori Morimoto's avatar
      ASoC: simple-card-utils: check "reg" property on asoc_simple_card_get_dai_id() · 0a2e1a5b
      Kuninori Morimoto authored
      [ Upstream commit a0c426fe ]
      
      We will get DAI ID from "reg" property if it has on DT, otherwise get
      it by counting port/endpoint.
      
      But in below case, we need to get DAI ID = 0 via port reg = <0>, but
      current implementation returns ID = 1, because it can't judge ID = 0 was
      from "non reg" or "reg = <0>".
      Thus, it will count port/endpoint number as "non reg" case.
      
      of_graph_parse_endpoint() implementation itself is not a problem,
      but because asoc_simple_card_get_dai_id() need to count port/endpoint
      number when "non reg" case, it need to know ID = 0 was from
      "non reg" or "reg = <0>".
      This patch fix this issue.
      
      	port {
      		reg = <0>;
      		xxxx: endpoint@0 {
      		};
      =>		xxxx: endpoint@1 {
      		};
      	};
      Signed-off-by: 's avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      0a2e1a5b
    • Hans de Goede's avatar
      Input: soc_button_array - fix mapping of the 5th GPIO in a PNP0C40 device · 45040e92
      Hans de Goede authored
      [ Upstream commit e9eb788f ]
      
      The Microsoft documenation for the PNP0C40 device aka the
      "Windows-compatible button array" describes the 5th GpioInt listed in
      the resources as: '5. Interrupt corresponding to the "Rotation Lock"
      button, if supported'.
      
      Notice this describes the 5th entry as a button while we sofar have been
      mapping it to EV_SW, SW_ROTATE_LOCK. On my Point of View TAB P1006W-232
      which actually comes with a rotation-lock button, the button indeed is a
      button and not a slider/switch. An image search for other Windows tablets
      has found 2 more models with a rotation-lock button and on both of those
      it too is a push-button and not a slider/switch.
      
      Further evidence can be found in the HUT extension HUTRR52 from Microsoft
      which adds rotation lock support to the HUT, which describes 2 different
      usages: "0xC9 System Display Rotation Lock Button" and
      "0xCA System Display Rotation Lock Slider Switch" note that switch is seen
      as a separate thing here and the non switch wording is an exact match for
      the "Windows-compatible button array" spec wording.
      
      TL;DR: our current mapping of the 5th GPIO to SW_ROTATE_LOCK is wrong
      because the 5th GPIO is for a push-button not a switch.
      
      This commit fixes this by maping the 5th GPIO to KEY_ROTATE_LOCK_TOGGLE.
      Signed-off-by: 's avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: 's avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      45040e92
    • Jeremy Fertic's avatar
      staging: iio: adt7316: fix dac_bits assignment · 1ad62489
      Jeremy Fertic authored
      [ Upstream commit e9de4757 ]
      
      The value of dac_bits is used in adt7316_show_DAC() and adt7316_store_DAC(),
      and it should be either 8, 10, or 12 bits depending on the device in use. The
      driver currently only assigns a value to dac_bits in
      adt7316_store_da_high_resolution(). The purpose of the dac high resolution
      option is not to change dac resolution for normal operation. Instead, it
      is specific to an optional feature where one or two of the four dacs can
      be set to output voltage proportional to temperature. If the user chooses
      to set dac a and/or dac b to output voltage proportional to temperature,
      the da_high_resolution attribute can optionally be enabled to use 10 bit
      resolution rather than the default 8 bits. This is only available on the
      10 and 12 bit dac devices. If the user attempts to read or write dacs a
      or b under these settings, the driver's current behaviour is to return an
      error. Dacs c and d continue to operate normally under these conditions.
      With the above in mind, remove the dac_bits assignments from this function
      since the value of dac_bits as used in the driver is not dependent on this
      dac high resolution option.
      
      Since the dac_bits assignments discussed above are currently the only ones
      in this driver, the default value of dac_bits is 0. This results in incorrect
      calculations when the dacs are read or written in adt7316_show_DAC() and
      adt7316_store_DAC(). To correct this, assign a value to dac_bits in
      adt7316_probe() to ensure correct operation as soon as the device is
      registered and available to userspace.
      
      Fixes: 35f6b6b8 ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
      Signed-off-by: 's avatarJeremy Fertic <jeremyfertic@gmail.com>
      Signed-off-by: 's avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      1ad62489
    • Ben Dooks's avatar
      dmaengine: tegra: avoid overflow of byte tracking · 2bece1d3
      Ben Dooks authored
      [ Upstream commit e486df39 ]
      
      The dma_desc->bytes_transferred counter tracks the number of bytes
      moved by the DMA channel. This is then used to calculate the information
      passed back in the in the tegra_dma_tx_status callback, which is usually
      fine.
      
      When the DMA channel is configured as continous, then the bytes_transferred
      counter will increase over time and eventually overflow to become negative
      so the residue count will become invalid and the ALSA sound-dma code will
      report invalid hardware pointer values to the application. This results in
      some users becoming confused about the playout position and putting audio
      data in the wrong place.
      
      To fix this issue, always ensure the bytes_transferred field is modulo the
      size of the request. We only do this for the case of the cyclic transfer
      done ISR as anyone attempting to move 2GiB of DMA data in one transfer
      is unlikely.
      
      Note, we don't fix the issue that we should /never/ transfer a negative
      number of bytes so we could make those fields unsigned.
      Reviewed-by: 's avatarDmitry Osipenko <digetx@gmail.com>
      Signed-off-by: Ben Dooks's avatarBen Dooks <ben.dooks@codethink.co.uk>
      Acked-by: 's avatarJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: Vinod Koul's avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      2bece1d3
    • Katsuhiro Suzuki's avatar
      clk: rockchip: fix frac settings of GPLL clock for rk3328 · e84e0a8c
      Katsuhiro Suzuki authored
      [ Upstream commit a0e447b0 ]
      
      This patch fixes settings of GPLL frequency in fractional mode for
      rk3328. In this mode, FOUTVCO is calcurated by following formula:
        FOUTVCO = FREF * FBDIV / REFDIV + ((FREF * FRAC / REFDIV) >> 24)
      
      The problem is in FREF * FRAC >> 24 term. This result always lacks
      one from target value is specified by rate member. For example first
      itme of rk3328_pll_frac_rate originally has
        - rate  : 1016064000
        - refdiv: 3
        - fbdiv : 127
        - frac  : 134217
        - FREF * FBDIV / REFDIV        = 1016000000
        - (FREF * FRAC / REFDIV) >> 24 = 63999
      Thus calculated rate is 1016063999. It seems wrong.
      
      If frac has 134218 (it is increased 1 from original value), second
      term is 64000. All other items have same situation. So this patch
      adds 1 to frac member in all items of rk3328_pll_frac_rate.
      Signed-off-by: 's avatarKatsuhiro Suzuki <katsuhiro@katsuster.net>
      Acked-by: 's avatarElaine Zhang <zhangqing@rock-chips.com>
      Signed-off-by: 's avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      e84e0a8c
    • Marek Vasut's avatar
      ARM: shmobile: Fix R-Car Gen2 regulator quirk · 25fb6c32
      Marek Vasut authored
      [ Upstream commit 5347a020 ]
      
      The quirk code currently detects all compatible I2C chips with a shared
      IRQ line on all I2C busses, adds them into a list, and registers a bus
      notifier. For every chip for which the bus notifier triggers, the quirk
      code performs I2C transfer on that I2C bus for all addresses in the list.
      The problem is that this may generate transfers to non-existing chips on
      systems with multiple I2C busses.
      
      This patch adds a check to verify that the I2C bus to which the chip with
      shared IRQ is attached to matches the I2C bus of the chip which triggered
      the bus notifier and only starts the I2C transfer if they match.
      Signed-off-by: 's avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Tested-by: 's avatarNguyen Viet Dung <dung.nguyen.aj@renesas.com>
      Signed-off-by: 's avatarSimon Horman <horms+renesas@verge.net.au>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      25fb6c32
    • Jerome Brunet's avatar
      clk: meson: clean-up clock registration · 9b0f4304
      Jerome Brunet authored
      [ Upstream commit 8d9981ef ]
      
      Order, ids and size  between the table of regmap clocks and the onecell
      data table could be different.
      
      Set regmap pointer in all the regmap clocks before starting the
      registration using the onecell data, to make sure we don't
      get into an incoherent situation.
      Signed-off-by: Jerome Brunet's avatarJerome Brunet <jbrunet@baylibre.com>
      Acked-by: Neil Armstrong's avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: Neil Armstrong's avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lkml.kernel.org/r/20181221160239.26265-3-jbrunet@baylibre.comSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      9b0f4304
    • Peter Wu's avatar
      drm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup · a644d2d2
      Peter Wu authored
      [ Upstream commit 00eb5b0d ]
      
      After drm_fb_helper_fbdev_setup calls drm_fb_helper_init,
      "dev->fb_helper" will be initialized (and thus drm_fb_helper_fini will
      have some effect). After that, drm_fb_helper_initial_config is called
      which may call the "fb_probe" driver callback.
      
      This driver callback may call drm_fb_helper_defio_init (as is done by
      drm_fb_helper_generic_probe) or set a framebuffer (as is done by bochs)
      as documented. These are normally cleaned up on exit by
      drm_fb_helper_fbdev_teardown which also calls drm_fb_helper_fini.
      
      If an error occurs after "fb_probe", but before setup is complete, then
      calling just drm_fb_helper_fini will leak resources. This was triggered
      by df2052cc ("bochs: convert to drm_fb_helper_fbdev_setup/teardown"):
      
          [   50.008030] bochsdrmfb: enable CONFIG_FB_LITTLE_ENDIAN to support this framebuffer
          [   50.009436] bochs-drm 0000:00:02.0: [drm:drm_fb_helper_fbdev_setup] *ERROR* fbdev: Failed to set configuration (ret=-38)
          [   50.011456] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 2
          [   50.013604] WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x280/0x2a0
          [   50.016175] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G                T 4.20.0-rc7 #1
          [   50.017732] EIP: drm_mode_config_cleanup+0x280/0x2a0
          ...
          [   50.023155] Call Trace:
          [   50.023155]  ? bochs_kms_fini+0x1e/0x30
          [   50.023155]  ? bochs_unload+0x18/0x40
      
      This can be reproduced with QEMU and CONFIG_FB_LITTLE_ENDIAN=n.
      
      Link: https://lkml.kernel.org/r/20181221083226.GI23332@shao2-debian
      Link: https://lkml.kernel.org/r/20181223004315.GA11455@al
      Fixes: 87412163 ("drm/fb-helper: Add drm_fb_helper_fbdev_setup/teardown()")
      Reported-by: 's avatarkernel test robot <rong.a.chen@intel.com>
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Signed-off-by: Peter Wu's avatarPeter Wu <peter@lekensteyn.nl>
      Reviewed-by: 's avatarNoralf Trønnes <noralf@tronnes.org>
      Signed-off-by: 's avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181223005507.28328-1-peter@lekensteyn.nlSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      a644d2d2
    • Rafael Ávila de Espíndola's avatar
      x86/build: Mark per-CPU symbols as absolute explicitly for LLD · c8a8dd1d
      Rafael Ávila de Espíndola authored
      [ Upstream commit d071ae09 ]
      
      Accessing per-CPU variables is done by finding the offset of the
      variable in the per-CPU block and adding it to the address of the
      respective CPU's block.
      
      Section 3.10.8 of ld.bfd's documentation states:
      
        For expressions involving numbers, relative addresses and absolute
        addresses, ld follows these rules to evaluate terms:
      
        Other binary operations, that is, between two relative addresses
        not in the same section, or between a relative address and an
        absolute address, first convert any non-absolute term to an
        absolute address before applying the operator."
      
      Note that LLVM's linker does not adhere to the GNU ld's implementation
      and as such requires implicitly-absolute terms to be explicitly marked
      as absolute in the linker script. If not, it fails currently with:
      
        ld.lld: error: ./arch/x86/kernel/vmlinux.lds:153: at least one side of the expression must be absolute
        ld.lld: error: ./arch/x86/kernel/vmlinux.lds:154: at least one side of the expression must be absolute
        Makefile:1040: recipe for target 'vmlinux' failed
      
      This is not a functional change for ld.bfd which converts the term to an
      absolute symbol anyways as specified above.
      
      Based on a previous submission by Tri Vo <trong@android.com>.
      Reported-by: Dmitry Golovin's avatarDmitry Golovin <dima@golovin.in>
      Signed-off-by: Rafael Ávila de Espíndola's avatarRafael Ávila de Espíndola <rafael@espindo.la>
      [ Update commit message per Boris' and Michael's suggestions. ]
      Signed-off-by: 's avatarNick Desaulniers <ndesaulniers@google.com>
      [ Massage commit message more, fix typos. ]
      Signed-off-by: 's avatarBorislav Petkov <bp@suse.de>
      Tested-by: Dmitry Golovin's avatarDmitry Golovin <dima@golovin.in>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Brijesh Singh <brijesh.singh@amd.com>
      Cc: Cao Jin <caoj.fnst@cn.fujitsu.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Joerg Roedel <jroedel@suse.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tri Vo <trong@android.com>
      Cc: dima@golovin.in
      Cc: morbo@google.com
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20181219190145.252035-1-ndesaulniers@google.comSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      c8a8dd1d
    • Zumeng Chen's avatar
      wlcore: Fix memory leak in case wl12xx_fetch_firmware failure · 38af5462
      Zumeng Chen authored
      [ Upstream commit ba2ffc96 ]
      
      Release fw_status, raw_fw_status, and tx_res_if when wl12xx_fetch_firmware
      failed instead of meaningless goto out to avoid the following memory leak
      reports(Only the last one listed):
      
      unreferenced object 0xc28a9a00 (size 512):
        comm "kworker/0:4", pid 31298, jiffies 2783204 (age 203.290s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
        backtrace:
          [<6624adab>] kmemleak_alloc+0x40/0x74
          [<500ddb31>] kmem_cache_alloc_trace+0x1ac/0x270
          [<db4d731d>] wl12xx_chip_wakeup+0xc4/0x1fc [wlcore]
          [<76c5db53>] wl1271_op_add_interface+0x4a4/0x8f4 [wlcore]
          [<cbf30777>] drv_add_interface+0xa4/0x1a0 [mac80211]
          [<65bac325>] ieee80211_reconfig+0x9c0/0x1644 [mac80211]
          [<2817c80e>] ieee80211_restart_work+0x90/0xc8 [mac80211]
          [<7e1d425a>] process_one_work+0x284/0x42c
          [<55f9432e>] worker_thread+0x2fc/0x48c
          [<abb582c6>] kthread+0x148/0x160
          [<63144b13>] ret_from_fork+0x14/0x2c
          [< (null)>] (null)
          [<1f6e7715>] 0xffffffff
      Signed-off-by: 's avatarZumeng Chen <zumeng.chen@gmail.com>
      Signed-off-by: 's avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      38af5462
    • Hans de Goede's avatar
      brcmfmac: Use firmware_request_nowarn for the clm_blob · ab79dc3e
      Hans de Goede authored
      [ Upstream commit 4ad0be16 ]
      
      The linux-firmware brcmfmac firmware files contain an embedded table with
      per country allowed channels and strength info.
      
      For recent hardware these versions of the firmware are specially build for
      linux-firmware, the firmware files directly available from Cypress rely on
      a separate clm_blob file for this info.
      
      For some unknown reason Cypress refuses to provide the standard firmware
      files + clm_blob files it uses elsewhere for inclusion into linux-firmware,
      instead relying on these special builds with the clm_blob info embedded.
      This means that the linux-firmware firmware versions often lag behind,
      but I digress.
      
      The brcmfmac driver does support the separate clm_blob file and always
      tries to load this. Currently we use request_firmware for this. This means
      that on any standard install, using the standard combo of linux-kernel +
      linux-firmware, we will get a warning:
      "Direct firmware load for ... failed with error -2"
      
      On top of this, brcmfmac itself prints: "no clm_blob available (err=-2),
      device may have limited channels available".
      
      This commit switches to firmware_request_nowarn, fixing almost any brcmfmac
      device logging the warning (it leaves the brcmfmac info message in place).
      Signed-off-by: 's avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: 's avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      ab79dc3e
    • Ondrej Mosnáček's avatar
      selinux: do not override context on context mounts · f836093a
      Ondrej Mosnáček authored
      [ Upstream commit 53e0c2aa ]
      
      Ignore all selinux_inode_notifysecctx() calls on mounts with SBLABEL_MNT
      flag unset. This is achived by returning -EOPNOTSUPP for this case in
      selinux_inode_setsecurtity() (because that function should not be called
      in such case anyway) and translating this error to 0 in
      selinux_inode_notifysecctx().
      
      This fixes behavior of kernfs-based filesystems when mounted with the
      'context=' option. Before this patch, if a node's context had been
      explicitly set to a non-default value and later the filesystem has been
      remounted with the 'context=' option, then this node would show up as
      having the manually-set context and not the mount-specified one.
      
      Steps to reproduce:
          # mount -t cgroup2 cgroup2 /sys/fs/cgroup/unified
          # chcon unconfined_u:object_r:user_home_t:s0 /sys/fs/cgroup/unified/cgroup.stat
          # ls -lZ /sys/fs/cgroup/unified
          total 0
          -r--r--r--. 1 root root system_u:object_r:cgroup_t:s0        0 Dec 13 10:41 cgroup.controllers
          -rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0        0 Dec 13 10:41 cgroup.max.depth
          -rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0        0 Dec 13 10:41 cgroup.max.descendants
          -rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0        0 Dec 13 10:41 cgroup.procs
          -r--r--r--. 1 root root unconfined_u:object_r:user_home_t:s0 0 Dec 13 10:41 cgroup.stat
          -rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0        0 Dec 13 10:41 cgroup.subtree_control
          -rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0        0 Dec 13 10:41 cgroup.threads
          # umount /sys/fs/cgroup/unified
          # mount -o context=system_u:object_r:tmpfs_t:s0 -t cgroup2 cgroup2 /sys/fs/cgroup/unified
      
      Result before:
          # ls -lZ /sys/fs/cgroup/unified
          total 0
          -r--r--r--. 1 root root system_u:object_r:tmpfs_t:s0         0 Dec 13 10:41 cgroup.controllers
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0         0 Dec 13 10:41 cgroup.max.depth
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0         0 Dec 13 10:41 cgroup.max.descendants
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0         0 Dec 13 10:41 cgroup.procs
          -r--r--r--. 1 root root unconfined_u:object_r:user_home_t:s0 0 Dec 13 10:41 cgroup.stat
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0         0 Dec 13 10:41 cgroup.subtree_control
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0         0 Dec 13 10:41 cgroup.threads
      
      Result after:
          # ls -lZ /sys/fs/cgroup/unified
          total 0
          -r--r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.controllers
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.max.depth
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.max.descendants
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.procs
          -r--r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.stat
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.subtree_control
          -rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.threads
      Signed-off-by: Ondrej Mosnáček's avatarOndrej Mosnacek <omosnace@redhat.com>
      Reviewed-by: Stephen Smalley's avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: 's avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      f836093a
    • George Rimar's avatar
      x86/build: Specify elf_i386 linker emulation explicitly for i386 objects · 993f9641
      George Rimar authored
      [ Upstream commit 927185c1 ]
      
      The kernel uses the OUTPUT_FORMAT linker script command in it's linker
      scripts. Most of the time, the -m option is passed to the linker with
      correct architecture, but sometimes (at least for x86_64) the -m option
      contradicts the OUTPUT_FORMAT directive.
      
      Specifically, arch/x86/boot and arch/x86/realmode/rm produce i386 object
      files, but are linked with the -m elf_x86_64 linker flag when building
      for x86_64.
      
      The GNU linker manpage doesn't explicitly state any tie-breakers between
      -m and OUTPUT_FORMAT. But with BFD and Gold linkers, OUTPUT_FORMAT
      overrides the emulation value specified with the -m option.
      
      LLVM lld has a different behavior, however. When supplied with
      contradicting -m and OUTPUT_FORMAT values it fails with the following
      error message:
      
        ld.lld: error: arch/x86/realmode/rm/header.o is incompatible with elf_x86_64
      
      Therefore, just add the correct -m after the incorrect one (it overrides
      it), so the linker invocation looks like this:
      
        ld -m elf_x86_64 -z max-page-size=0x200000 -m elf_i386 --emit-relocs -T \
          realmode.lds header.o trampoline_64.o stack.o reboot.o -o realmode.elf
      
      This is not a functional change for GNU ld, because (although not
      explicitly documented) OUTPUT_FORMAT overrides -m EMULATION.
      
      Tested by building x86_64 kernel with GNU gcc/ld toolchain and booting
      it in QEMU.
      
       [ bp: massage and clarify text. ]
      Suggested-by: Dmitry Golovin's avatarDmitry Golovin <dima@golovin.in>
      Signed-off-by: 's avatarGeorge Rimar <grimar@accesssoftek.com>
      Signed-off-by: 's avatarTri Vo <trong@android.com>
      Signed-off-by: 's avatarBorislav Petkov <bp@suse.de>
      Tested-by: 's avatarTri Vo <trong@android.com>
      Tested-by: 's avatarNick Desaulniers <ndesaulniers@google.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Matz <matz@suse.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: morbo@google.com
      Cc: ndesaulniers@google.com
      Cc: ruiu@google.com
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20190111201012.71210-1-trong@android.comSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      993f9641
    • Daniel Vetter's avatar
      drm/nouveau: Stop using drm_crtc_force_disable · 16d4d75d
      Daniel Vetter authored
      [ Upstream commit 934c5b32 ]
      
      The correct way for legacy drivers to update properties that need to
      do a full modeset, is to do a full modeset.
      
      Note that we don't need to call the drm_mode_config_internal helper
      because we're not changing any of the refcounted paramters.
      
      v2: Fixup error handling (Ville). Since the old code didn't bother
      I decided to just delete it instead of adding even more code for just
      error handling.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
      Cc: Sean Paul <seanpaul@chromium.org>
      Signed-off-by: 's avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181217194303.14397-2-daniel.vetter@ffwll.chSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      16d4d75d
    • Paul Kocialkowski's avatar
      drm: Auto-set allow_fb_modifiers when given modifiers at plane init · bfb59eab
      Paul Kocialkowski authored
      [ Upstream commit 890880dd ]
      
      When drivers pass non-empty lists of modifiers for initializing their
      planes, we can infer that they allow framebuffer modifiers and set the
      driver's allow_fb_modifiers mode config element.
      
      In case the allow_fb_modifiers element was not set (some drivers tend
      to set them after registering planes), the modifiers will still be
      registered but won't be available to userspace unless the flag is set
      later. However in that case, the IN_FORMATS blob won't be created.
      
      In order to avoid this case and generally reduce the trouble associated
      with the flag, always set allow_fb_modifiers when a non-empty list of
      format modifiers is passed at plane init.
      Reviewed-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: 's avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
      Signed-off-by: 's avatarMaxime Ripard <maxime.ripard@bootlin.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190104085610.5829-1-paul.kocialkowski@bootlin.comSigned-off-by: 's avatarSasha Levin <sashal@kernel.org>
      bfb59eab
    • Martin Blumenstingl's avatar
      pinctrl: meson: meson8b: add the eth_rxd2 and eth_rxd3 pins · 778c82db
      Martin Blumenstingl authored
      [ Upstream commit 6daae002 ]
      
      Gigabit Ethernet requires the Ethernet TXD0..3 and RXD0..3 data lines.
      Add the missing eth_rxd2 and eth_rxd3 definitions so we don't have to
      rely on the bootloader to set them up correctly.
      
      The vendor u-boot sources for Odroid-C1 use the following Ethernet
      pinmux configuration:
        SET_CBUS_REG_MASK(PERIPHS_PIN_MUX_6, 0x3f4f);
        SET_CBUS_REG_MASK(PERIPHS_PIN_MUX_7, 0xf00000);
      This translates to the following pin groups in the mainline kernel:
      - register 6 bit  0: eth_rxd1 (DIF_0_P)
      - register 6 bit  1: eth_rxd0 (DIF_0_N)
      - register 6 bit  2: eth_rx_dv (DIF_1_P)
      - register 6 bit  3: eth_rx_clk (DIF_1_N)
      - register 6 bit  6: eth_tx_en (DIF_3_P)
      - register 6 bit  8: eth_ref_clk (DIF_3_N)
      - register 6 bit  9: eth_mdc (DIF_4_P)
      - register 6 bit 10: eth_mdio_en (DIF_4_N)
      - register 6 bit 11: eth_tx_clk (GPIOH_9)
      - register 6 bit 12: eth_txd2 (GPIOH_8)
      - register 6 bit 13: eth_txd3 (GPIOH_7)
      - register 7 bit 20: eth_txd0_0 (GPIOH_6)
      - register 7 bit 21: eth_txd1_0 (GPIOH_5)
      - register 7 bit 22: eth_rxd3 (DIF_2_P)
      - register 7 bit 23: eth_rxd2 (DIF_2_N)
      
      All functions except eth_rxd2 and eth_rxd3 are already supported by the
      pinctrl-meson8b driver.
      Suggested-by: 's avatarJianxin Pan <jianxin.pan@amlogic.com>
      Signed-off-by: 's avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: Kevin Hilman's avatarKevin Hilman <khilman@baylibre.com>
      Tested-by: 's avatarEmiliano Ingrassia <ingrassia@epigenesys.com>
      Reviewed-by: 's avatarEmiliano Ingrassia <ingrassia@epigenesys.com>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      778c82db
    • Axel Lin's avatar
      regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting · 1048bfd8
      Axel Lin authored
      [ Upstream commit f01a7beb ]
      
      The act8600_sudcdc_voltage_ranges setting does not match the datasheet.
      
      The problems in below entry:
        REGULATOR_LINEAR_RANGE(19000000, 191, 255, 400000),
      
      1. The off-by-one min_sel causes wrong volatage calculation.
         The min_sel should be 192.
      2. According to the datasheet[1] Table 7. (on page 43):
         The selector 248 (0b11111000) ~ 255 (0b11111111) are 41.400V.
      
      Also fix off-by-one for ACT8600_SUDCDC_VOLTAGE_NUM.
      
      [1] https://active-semi.com/wp-content/uploads/ACT8600_Datasheet.pdf
      
      Fixes: df3a950e ("regulator: act8865: Add act8600 support")
      Signed-off-by: 's avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      1048bfd8
    • Richard Guy Briggs's avatar
      audit: hand taken context to audit_kill_trees for syscall logging · e78d5e16
      Richard Guy Briggs authored
      [ Upstream commit 9e36a5d4 ]
      
      Since the context is derived from the task parameter handed to
      __audit_free(), hand the context to audit_kill_trees() so it can be used
      to associate with a syscall record.  This requires adding the context
      parameter to kill_rules() rather than using the current audit_context.
      
      The callers of trim_marked() and evict_chunk() still have their context.
      
      The EOE record was being issued prior to the pruning of the killed_tree
      list.
      
      Move the kill_trees call before the audit_log_exit call in
      __audit_free() and __audit_syscall_exit() so that any pruned trees
      CONFIG_CHANGE records are included with the associated syscall event by
      the user library due to the EOE record flagging the end of the event.
      
      See: https://github.com/linux-audit/audit-kernel/issues/50
      See: https://github.com/linux-audit/audit-kernel/issues/59Signed-off-by: 's avatarRichard Guy Briggs <rgb@redhat.com>
      [PM: fixed merge fuzz in kernel/audit_tree.c]
      Signed-off-by: 's avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      e78d5e16
    • Mika Westerberg's avatar
      PCI: pciehp: Assign ctrl->slot_ctrl before writing it to hardware · a43ea8ca
      Mika Westerberg authored
      [ Upstream commit 25bd879e ]
      
      Shameerali reported that running v4.20-rc1 as QEMU guest, the PCIe hotplug
      port times out during boot:
      
        pciehp 0000:00:01.0:pcie004: Timeout on hotplug command 0x03f1 (issued 1016 msec ago)
        pciehp 0000:00:01.0:pcie004: Timeout on hotplug command 0x03f1 (issued 1024 msec ago)
        pciehp 0000:00:01.0:pcie004: Failed to check link status
        pciehp 0000:00:01.0:pcie004: Timeout on hotplug command 0x02f1 (issued 2520 msec ago)
      
      The issue was bisected down to commit 720d6a67 ("PCI: pciehp: Do not
      handle events if interrupts are masked") and was further analyzed by the
      reporter to be caused by the fact that pciehp first updates the hardware
      and only then cache the ctrl->slot_ctrl in pcie_do_write_cmd().  If the
      interrupt happens before we cache the value, pciehp_isr() reads value 0 and
      decides that the interrupt was not meant for it causing the above timeout
      to trigger.
      
      Fix by moving ctrl->slot_ctrl assignment to happen before it is written to
      the hardware.
      
      Fixes: 720d6a67 ("PCI: pciehp: Do not handle events if interrupts are masked")
      Link: https://lore.kernel.org/linux-pci/5FC3163CFD30C246ABAA99954A238FA8387DD344@FRAEML521-MBX.china.huawei.comReported-by: 's avatarShameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
      Signed-off-by: 's avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: 's avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      a43ea8ca
    • PabloPL's avatar
      media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration · e5d1f1c0
      PabloPL authored
      [ Upstream commit 49710c32 ]
      
      Previously when doing format enumeration, it was returning all
       formats supported by driver, even if they're not supported by hw.
      Add missing check for fmt_ver_flag, so it'll be fixed and only those
       supported by hw will be returned. Similar thing is already done
       in s5p_jpeg_find_format.
      
      It was found by using v4l2-compliance tool and checking result
       of VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS test
      and using v4l2-ctl to get list of all supported formats.
      
      Tested on s5pv210-galaxys (Samsung i9000 phone).
      
      Fixes: bb677f3a ("[media] Exynos4 JPEG codec v4l2 driver")
      Signed-off-by: PabloPL's avatarPawe? Chmiel <pawel.mikolaj.chmiel@gmail.com>
      Reviewed-by: 's avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
      [hverkuil-cisco@xs4all.nl: fix a few alignment issues]
      Signed-off-by: 's avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      e5d1f1c0
    • Steve Longerbeam's avatar
      media: rcar-vin: Allow independent VIN link enablement · 68ec6a13
      Steve Longerbeam authored
      [ Upstream commit c5ff0edb ]
      
      There is a block of code in rvin_group_link_notify() that prevents
      enabling a link to a VIN node if any entity in the media graph is
      in use. This prevents enabling a VIN link even if there is an in-use
      entity somewhere in the graph that is independent of the link's
      pipeline.
      
      For example, the code block will prevent enabling a link from
      the first rcar-csi2 receiver to a VIN node even if there is an
      enabled link somewhere far upstream on the second independent
      rcar-csi2 receiver pipeline.
      
      If this code block is meant to prevent modifying a link if any entity
      in the graph is actively involved in streaming (because modifying
      the CHSEL register fields can disrupt any/all running streams), then
      the entities stream counts should be checked rather than the use counts.
      
      (There is already such a check in __media_entity_setup_link() that verifies
      the stream_count of the link's source and sink entities are both zero,
      but that is insufficient, since there should be no running streams in
      the entire graph).
      
      Modify the code block to check the entity stream_count instead of the
      use_count (and elaborate on the comment). VIN node links can now be
      enabled even if there are other independent in-use entities that are
      not streaming.
      
      Fixes: c0cc5aef ("media: rcar-vin: add link notify for Gen3")
      Signed-off-by: 's avatarSteve Longerbeam <slongerbeam@gmail.com>
      Reviewed-by: 's avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: 's avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: 's avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      68ec6a13
    • Florian Westphal's avatar
      netfilter: physdev: relax br_netfilter dependency · ebd0f306
      Florian Westphal authored
      [ Upstream commit 8e2f311a ]
      
      Following command:
        iptables -D FORWARD -m physdev ...
      causes connectivity loss in some setups.
      
      Reason is that iptables userspace will probe kernel for the module revision
      of the physdev patch, and physdev has an artificial dependency on
      br_netfilter (xt_physdev use makes no sense unless a br_netfilter module
      is loaded).
      
      This causes the "phydev" module to be loaded, which in turn enables the
      "call-iptables" infrastructure.
      
      bridged packets might then get dropped by the iptables ruleset.
      
      The better fix would be to change the "call-iptables" defaults to 0 and
      enforce explicit setting to 1, but that breaks backwards compatibility.
      
      This does the next best thing: add a request_module call to checkentry.
      This was a stray '-D ... -m physdev' won't activate br_netfilter
      anymore.
      Signed-off-by: 's avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: 's avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      ebd0f306
    • Shunyong Yang's avatar
      dmaengine: qcom_hidma: initialize tx flags in hidma_prep_dma_* · d7e6e93b
      Shunyong Yang authored
      [ Upstream commit 875aac8a ]
      
      In async_tx_test_ack(), it uses flags in struct dma_async_tx_descriptor
      to check the ACK status. As hidma reuses the descriptor in a free list
      when hidma_prep_dma_*(memcpy/memset) is called, the flag will keep ACKed
      if the descriptor has been used before. This will cause a BUG_ON in
      async_tx_quiesce().
      
        kernel BUG at crypto/async_tx/async_tx.c:282!
        Internal error: Oops - BUG: 0 1 SMP
        ...
        task: ffff8017dd3ec000 task.stack: ffff8017dd3e8000
        PC is at async_tx_quiesce+0x54/0x78 [async_tx]
        LR is at async_trigger_callback+0x98/0x110 [async_tx]
      
      This patch initializes flags in dma_async_tx_descriptor by the flags
      passed from the caller when hidma_prep_dma_*(memcpy/memset) is called.
      
      Cc: Joey Zheng <yu.zheng@hxt-semitech.com>
      Reviewed-by: 's avatarSinan Kaya <okaya@kernel.org>
      Signed-off-by: 's avatarShunyong Yang <shunyong.yang@hxt-semitech.com>
      Signed-off-by: Vinod Koul's avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      d7e6e93b
    • Shunyong Yang's avatar
      dmaengine: qcom_hidma: assign channel cookie correctly · 1bac8b82
      Shunyong Yang authored
      [ Upstream commit 546c0547 ]
      
      When dma_cookie_complete() is called in hidma_process_completed(),
      dma_cookie_status() will return DMA_COMPLETE in hidma_tx_status(). Then,
      hidma_txn_is_success() will be called to use channel cookie
      mchan->last_success to do additional DMA status check. Current code
      assigns mchan->last_success after dma_cookie_complete(). This causes
      a race condition of dma_cookie_status() returns DMA_COMPLETE before
      mchan->last_success is assigned correctly. The race will cause
      hidma_tx_status() return DMA_ERROR but the transaction is actually a
      success. Moreover, in async_tx case, it will cause a timeout panic
      in async_tx_quiesce().
      
       Kernel panic - not syncing: async_tx_quiesce: DMA error waiting for
       transaction
       ...
       Call trace:
       [<ffff000008089994>] dump_backtrace+0x0/0x1f4
       [<ffff000008089bac>] show_stack+0x24/0x2c
       [<ffff00000891e198>] dump_stack+0x84/0xa8
       [<ffff0000080da544>] panic+0x12c/0x29c
       [<ffff0000045d0334>] async_tx_quiesce+0xa4/0xc8 [async_tx]
       [<ffff0000045d03c8>] async_trigger_callback+0x70/0x1c0 [async_tx]
       [<ffff0000048b7d74>] raid_run_ops+0x86c/0x1540 [raid456]
       [<ffff0000048bd084>] handle_stripe+0x5e8/0x1c7c [raid456]
       [<ffff0000048be9ec>] handle_active_stripes.isra.45+0x2d4/0x550 [raid456]
       [<ffff0000048beff4>] raid5d+0x38c/0x5d0 [raid456]
       [<ffff000008736538>] md_thread+0x108/0x168
       [<ffff0000080fb1cc>] kthread+0x10c/0x138
       [<ffff000008084d34>] ret_from_fork+0x10/0x18
      
      Cc: Joey Zheng <yu.zheng@hxt-semitech.com>
      Reviewed-by: 's avatarSinan Kaya <okaya@kernel.org>
      Signed-off-by: 's avatarShunyong Yang <shunyong.yang@hxt-semitech.com>
      Signed-off-by: Vinod Koul's avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      1bac8b82
    • Anders Roxell's avatar
      dmaengine: imx-dma: fix warning comparison of distinct pointer types · 56d276b5
      Anders Roxell authored
      [ Upstream commit 9227ab56 ]
      
      The warning got introduced by commit 930507c1 ("arm64: add basic
      Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
      haven't been seen before since size_t was 'unsigned int' when built on
      arm32.
      
      ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
      ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
         (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                   ^~
      ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
         (__typecheck(x, y) && __no_side_effects(x, y))
          ^~~~~~~~~~~
      ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
        __builtin_choose_expr(__safe_cmp(x, y), \
                              ^~~~~~~~~~
      ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
       #define min(x, y) __careful_cmp(x, y, <)
                         ^~~~~~~~~~~~~
      ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
        now = min(d->len, sg_dma_len(sg));
              ^~~
      
      Rework so that we use min_t and pass in the size_t that returns the
      minimum of two values, using the specified type.
      Signed-off-by: 's avatarAnders Roxell <anders.roxell@linaro.org>
      Acked-by: Olof Johansson's avatarOlof Johansson <olof@lixom.net>
      Reviewed-by: Fabio Estevam's avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: Vinod Koul's avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      56d276b5
    • Valentin Schneider's avatar
      cpu/hotplug: Mute hotplug lockdep during init · 964065d2
      Valentin Schneider authored
      [ Upstream commit ce48c457 ]
      
      Since we've had:
      
        commit cb538267 ("jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations")
      
      we've been getting some lockdep warnings during init, such as on HiKey960:
      
      [    0.820495] WARNING: CPU: 4 PID: 0 at kernel/cpu.c:316 lockdep_assert_cpus_held+0x3c/0x48
      [    0.820498] Modules linked in:
      [    0.820509] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G S                4.20.0-rc5-00051-g4cae42a #34
      [    0.820511] Hardware name: HiKey960 (DT)
      [    0.820516] pstate: 600001c5 (nZCv dAIF -PAN -UAO)
      [    0.820520] pc : lockdep_assert_cpus_held+0x3c/0x48
      [    0.820523] lr : lockdep_assert_cpus_held+0x38/0x48
      [    0.820526] sp : ffff00000a9cbe50
      [    0.820528] x29: ffff00000a9cbe50 x28: 0000000000000000
      [    0.820533] x27: 00008000b69e5000 x26: ffff8000bff4cfe0
      [    0.820537] x25: ffff000008ba69e0 x24: 0000000000000001
      [    0.820541] x23: ffff000008fce000 x22: ffff000008ba70c8
      [    0.820545] x21: 0000000000000001 x20: 0000000000000003
      [    0.820548] x19: ffff00000a35d628 x18: ffffffffffffffff
      [    0.820552] x17: 0000000000000000 x16: 0000000000000000
      [    0.820556] x15: ffff00000958f848 x14: 455f3052464d4d34
      [    0.820559] x13: 00000000769dde98 x12: ffff8000bf3f65a8
      [    0.820564] x11: 0000000000000000 x10: ffff00000958f848
      [    0.820567] x9 : ffff000009592000 x8 : ffff00000958f848
      [    0.820571] x7 : ffff00000818ffa0 x6 : 0000000000000000
      [    0.820574] x5 : 0000000000000000 x4 : 0000000000000001
      [    0.820578] x3 : 0000000000000000 x2 : 0000000000000001
      [    0.820582] x1 : 00000000ffffffff x0 : 0000000000000000
      [    0.820587] Call trace:
      [    0.820591]  lockdep_assert_cpus_held+0x3c/0x48
      [    0.820598]  static_key_enable_cpuslocked+0x28/0xd0
      [    0.820606]  arch_timer_check_ool_workaround+0xe8/0x228
      [    0.820610]  arch_timer_starting_cpu+0xe4/0x2d8
      [    0.820615]  cpuhp_invoke_callback+0xe8/0xd08
      [    0.820619]  notify_cpu_starting+0x80/0xb8
      [    0.820625]  secondary_start_kernel+0x118/0x1d0
      
      We've also had a similar warning in sched_init_smp() for every
      asymmetric system that would enable the sched_asym_cpucapacity static
      key, although that was singled out in:
      
        commit 40fa3780 ("sched/core: Take the hotplug lock in sched_init_smp()")
      
      Those warnings are actually harmless, since we cannot have hotplug
      operations at the time they appear. Instead of starting to sprinkle
      useless hotplug lock operations in the init codepaths, mute the
      warnings until they start warning about real problems.
      Suggested-by: 's avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: 's avatarValentin Schneider <valentin.schneider@arm.com>
      Signed-off-by: 's avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: cai@gmx.us
      Cc: daniel.lezcano@linaro.org
      Cc: dietmar.eggemann@arm.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: longman@redhat.com
      Cc: marc.zyngier@arm.com
      Cc: mark.rutland@arm.com
      Link: https://lkml.kernel.org/r/1545243796-23224-2-git-send-email-valentin.schneider@arm.comSigned-off-by: 's avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      964065d2
    • Takeshi Kihara's avatar
      pinctrl: sh-pfc: r8a77995: Fix MOD_SEL bit numbering · 8376acca
      Takeshi Kihara authored
      [ Upstream commit 5219aa33 ]
      
      MOD_SEL register bit numbering was different from R-Car D3 SoC and
      R-Car H3/M3-[WN] SoCs.
      
      MOD_SEL 1-bit      H3/M3-[WN]  D3
      ===============    ==========  =====
      Set Value = H'0    b'0         b'0
      Set Value = H'1    b'1         b'1
      
      MOD_SEL 2-bits     H3/M3-[WN]  D3
      ===============    ==========  =====
      Set Value = H'0    b'00        b'00
      Set Value = H'1    b'01        b'10
      Set Value = H'2    b'10        b'01
      Set Value = H'3    b'11        b'11
      
      MOD_SEL 3-bits     H3/M3-[WN]  D3
      ===============    ==========  =====
      Set Value = H'0    b'000       b'000
      Set Value = H'1    b'001       b'100
      Set Value = H'2    b'010       b'010
      Set Value = H'3    b'011       b'110
      Set Value = H'4    b'100       b'001
      Set Value = H'5    b'101       b'101
      Set Value = H'6    b'110       b'011
      Set Value = H'7    b'111       b'111
      
      This patch replaces the #define name and value of MOD_SEL.
      Signed-off-by: 's avatarTakeshi Kihara <takeshi.kihara.df@renesas.com>
      Fixes: 794a6711 ("pinctrl: sh-pfc: Initial R8A77995 PFC support")
      [shimoda: split a patch per SoC and revise the commit log]
      Signed-off-by: Yoshihiro Shimoda's avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      [geert: Use a macro to do the actual reordering]
      Signed-off-by: 's avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: 's avatarSimon Horman <horms+renesas@verge.net.au>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      8376acca
    • Takeshi Kihara's avatar
      pinctrl: sh-pfc: r8a77990: Fix MOD_SEL bit numbering · e848354f
      Takeshi Kihara authored
      [ Upstream commit 3e3eebea ]
      
      MOD_SEL register bit numbering was different from R-Car E3 SoC and
      R-Car H3/M3-[WN] SoCs.
      
      MOD_SEL 1-bit      H3/M3-[WN]  E3
      ===============    ==========  =====
      Set Value = H'0    b'0         b'0
      Set Value = H'1    b'1         b'1
      
      MOD_SEL 2-bits     H3/M3-[WN]  E3
      ===============    ==========  =====
      Set Value = H'0    b'00        b'00
      Set Value = H'1    b'01        b'10
      Set Value = H'2    b'10        b'01
      Set Value = H'3    b'11        b'11
      
      MOD_SEL 3-bits     H3/M3-[WN]  E3
      ===============    ==========  =====
      Set Value = H'0    b'000       b'000
      Set Value = H'1    b'001       b'100
      Set Value = H'2    b'010       b'010
      Set Value = H'3    b'011       b'110
      Set Value = H'4    b'100       b'001
      Set Value = H'5    b'101       b'101
      Set Value = H'6    b'110       b'011
      Set Value = H'7    b'111       b'111
      
      This patch replaces the #define name and value of MOD_SEL.
      Signed-off-by: 's avatarTakeshi Kihara <takeshi.kihara.df@renesas.com>
      Fixes: 6d4036a1 ("pinctrl: sh-pfc: Initial R8A77990 PFC support")
      [shimoda: Split a patch per SoC and revise the commit log]
      Signed-off-by: Yoshihiro Shimoda's avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      [geert: Use macros to do the actual reordering]
      Signed-off-by: 's avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Yoshihiro Shimoda's avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      e848354f
    • Xingyu Chen's avatar
      pinctrl: meson: fix G12A ao pull registers base address · 9d7ff2ae
      Xingyu Chen authored
      [ Upstream commit e66dd48e ]
      
      Since Meson G12A SoC, Introduce new ao registers AO_RTI_PULL_UP_EN_REG
      and AO_GPIO_O.
      
      These bits of controlling output level are remapped to the new register
      AO_GPIO_O, and the AO_GPIO_O_EN_N support only controlling output enable.
      
      These bits of controlling pull enable are remapped to the new register
      AO_RTI_PULL_UP_EN_REG, and the AO_RTI_PULL_UP_REG support only controlling
      pull type(up/down).
      
      The new layout of ao gpio/pull registers is as follows:
      - AO_GPIO_O_EN_N        [offset: 0x9 << 2]
      - AO_GPIO_I             [offset: 0xa << 2]
      - AO_RTI_PULL_UP_REG    [offset: 0xb << 2]
      - AO_RTI_PULL_UP_EN_REG [offset: 0xc << 2]
      - AO_GPIO_O             [offset: 0xd << 2]
      
      From above, we can see ao GPIO registers region has been separated by the
      ao pull registers. In order to ensure the continuity of the region on
      software, the ao GPIO and ao pull registers use the same base address, but
      can be identified by the offset.
      
      Fixes: 29ae0952 ("pinctrl: meson-g12a: add pinctrl driver support")
      Signed-off-by: 's avatarXingyu Chen <xingyu.chen@amlogic.com>
      Signed-off-by: 's avatarJianxin Pan <jianxin.pan@amlogic.com>
      Signed-off-by: Jerome Brunet's avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
      9d7ff2ae