19 Aug, 2018

1 commit

  • Pull driver core updates from Greg KH:
    "Here are all of the driver core and related patches for 4.19-rc1.

    Nothing huge here, just a number of small cleanups and the ability to
    now stop the deferred probing after init happens.

    All of these have been in linux-next for a while with only a merge
    issue reported"

    * tag 'driver-core-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (21 commits)
    base: core: Remove WARN_ON from link dependencies check
    drivers/base: stop new probing during shutdown
    drivers: core: Remove glue dirs from sysfs earlier
    driver core: remove unnecessary function extern declare
    sysfs.h: fix non-kernel-doc comment
    PM / Domains: Stop deferring probe at the end of initcall
    iommu: Remove IOMMU_OF_DECLARE
    iommu: Stop deferring probe at end of initcalls
    pinctrl: Support stopping deferred probe after initcalls
    dt-bindings: pinctrl: add a 'pinctrl-use-default' property
    driver core: allow stopping deferred probe after init
    driver core: add a debugfs entry to show deferred devices
    sysfs: Fix internal_create_group() for named group updates
    base: fix order of OF initialization
    linux/device.h: fix kernel-doc notation warning
    Documentation: update firmware loader fallback reference
    kobject: Replace strncpy with memcpy
    drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number
    kernfs: Replace strncpy with memcpy
    device: Add #define dev_fmt similar to #define pr_fmt
    ...

    Linus Torvalds
     

18 Aug, 2018

4 commits

  • Some architectures do not define certain PAGE_KERNEL_* flags, this is
    either because:

    a) The way to implement some of these flags is *not yet ported*, or
    b) The architecture *has no way* to describe them

    Over time we have accumulated a few PAGE_KERNEL_* fallback workarounds
    for architectures in the kernel which do not define them using
    *relatively safe* equivalents. Move these scattered fallback hacks into
    asm-generic.

    We start off with PAGE_KERNEL_RO using PAGE_KERNEL as a fallback. This
    has been in place on the firmware loader for years. Move the fallback
    into the respective asm-generic header.

    Link: http://lkml.kernel.org/r/20180510185507.2439-2-mcgrof@kernel.org
    Signed-off-by: Luis R. Rodriguez
    Reviewed-by: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Matthew Wilcox
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis R. Rodriguez
     
  • Callers of register_mem_sect_under_node() are always passing a valid
    memory_block (not NULL), so we can safely drop the check for NULL.

    In the same way, register_mem_sect_under_node() is only called in case
    the node is online, so we can safely remove that check as well.

    Link: http://lkml.kernel.org/r/20180622111839.10071-5-osalvador@techadventures.net
    Signed-off-by: Oscar Salvador
    Reviewed-by: Pavel Tatashin
    Tested-by: Reza Arbab
    Tested-by: Jonathan Cameron
    Cc: Pasha Tatashin
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oscar Salvador
     
  • link_mem_sections() and walk_memory_range() share most of the code, so
    we can use convert link_mem_sections() into a dummy function that calls
    walk_memory_range() with a callback to register_mem_sect_under_node().

    This patch converts register_mem_sect_under_node() in order to match a
    walk_memory_range's callback, getting rid of the check_nid argument and
    checking instead if the system is still boothing, since we only have to
    check for the nid if the system is in such state.

    Link: http://lkml.kernel.org/r/20180622111839.10071-4-osalvador@techadventures.net
    Signed-off-by: Oscar Salvador
    Suggested-by: Pavel Tatashin
    Tested-by: Reza Arbab
    Tested-by: Jonathan Cameron
    Reviewed-by: Pavel Tatashin
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oscar Salvador
     
  • When hotplugging memory, it is possible that two calls are being made to
    register_mem_sect_under_node().

    One comes from __add_section()->hotplug_memory_register() and the other
    from add_memory_resource()->link_mem_sections() if we had to register a
    new node.

    In case we had to register a new node, hotplug_memory_register() will
    only handle/allocate the memory_block's since
    register_mem_sect_under_node() will return right away because the node
    it is not online yet.

    I think it is better if we leave hotplug_memory_register() to
    handle/allocate only memory_block's and make link_mem_sections() to call
    register_mem_sect_under_node().

    So this patch removes the call to register_mem_sect_under_node() from
    hotplug_memory_register(), and moves the call to link_mem_sections() out
    of the condition, so it will always be called. In this way we only have
    one place where the memory sections are registered.

    Link: http://lkml.kernel.org/r/20180622111839.10071-3-osalvador@techadventures.net
    Signed-off-by: Oscar Salvador
    Reviewed-by: Pavel Tatashin
    Tested-by: Reza Arbab
    Tested-by: Jonathan Cameron
    Cc: Pasha Tatashin
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oscar Salvador
     

16 Aug, 2018

2 commits

  • Pull networking updates from David Miller:
    "Highlights:

    - Gustavo A. R. Silva keeps working on the implicit switch fallthru
    changes.

    - Support 802.11ax High-Efficiency wireless in cfg80211 et al, From
    Luca Coelho.

    - Re-enable ASPM in r8169, from Kai-Heng Feng.

    - Add virtual XFRM interfaces, which avoids all of the limitations of
    existing IPSEC tunnels. From Steffen Klassert.

    - Convert GRO over to use a hash table, so that when we have many
    flows active we don't traverse a long list during accumluation.

    - Many new self tests for routing, TC, tunnels, etc. Too many
    contributors to mention them all, but I'm really happy to keep
    seeing this stuff.

    - Hardware timestamping support for dpaa_eth/fsl-fman from Yangbo Lu.

    - Lots of cleanups and fixes in L2TP code from Guillaume Nault.

    - Add IPSEC offload support to netdevsim, from Shannon Nelson.

    - Add support for slotting with non-uniform distribution to netem
    packet scheduler, from Yousuk Seung.

    - Add UDP GSO support to mlx5e, from Boris Pismenny.

    - Support offloading of Team LAG in NFP, from John Hurley.

    - Allow to configure TX queue selection based upon RX queue, from
    Amritha Nambiar.

    - Support ethtool ring size configuration in aquantia, from Anton
    Mikaev.

    - Support DSCP and flowlabel per-transport in SCTP, from Xin Long.

    - Support list based batching and stack traversal of SKBs, this is
    very exciting work. From Edward Cree.

    - Busyloop optimizations in vhost_net, from Toshiaki Makita.

    - Introduce the ETF qdisc, which allows time based transmissions. IGB
    can offload this in hardware. From Vinicius Costa Gomes.

    - Add parameter support to devlink, from Moshe Shemesh.

    - Several multiplication and division optimizations for BPF JIT in
    nfp driver, from Jiong Wang.

    - Lots of prepatory work to make more of the packet scheduler layer
    lockless, when possible, from Vlad Buslov.

    - Add ACK filter and NAT awareness to sch_cake packet scheduler, from
    Toke Høiland-Jørgensen.

    - Support regions and region snapshots in devlink, from Alex Vesker.

    - Allow to attach XDP programs to both HW and SW at the same time on
    a given device, with initial support in nfp. From Jakub Kicinski.

    - Add TLS RX offload and support in mlx5, from Ilya Lesokhin.

    - Use PHYLIB in r8169 driver, from Heiner Kallweit.

    - All sorts of changes to support Spectrum 2 in mlxsw driver, from
    Ido Schimmel.

    - PTP support in mv88e6xxx DSA driver, from Andrew Lunn.

    - Make TCP_USER_TIMEOUT socket option more accurate, from Jon
    Maxwell.

    - Support for templates in packet scheduler classifier, from Jiri
    Pirko.

    - IPV6 support in RDS, from Ka-Cheong Poon.

    - Native tproxy support in nf_tables, from Máté Eckl.

    - Maintain IP fragment queue in an rbtree, but optimize properly for
    in-order frags. From Peter Oskolkov.

    - Improvde handling of ACKs on hole repairs, from Yuchung Cheng"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1996 commits)
    bpf: test: fix spelling mistake "REUSEEPORT" -> "REUSEPORT"
    hv/netvsc: Fix NULL dereference at single queue mode fallback
    net: filter: mark expected switch fall-through
    xen-netfront: fix warn message as irq device name has '/'
    cxgb4: Add new T5 PCI device ids 0x50af and 0x50b0
    net: dsa: mv88e6xxx: missing unlock on error path
    rds: fix building with IPV6=m
    inet/connection_sock: prefer _THIS_IP_ to current_text_addr
    net: dsa: mv88e6xxx: bitwise vs logical bug
    net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd()
    ieee802154: hwsim: using right kind of iteration
    net: hns3: Add vlan filter setting by ethtool command -K
    net: hns3: Set tx ring' tc info when netdev is up
    net: hns3: Remove tx ring BD len register in hns3_enet
    net: hns3: Fix desc num set to default when setting channel
    net: hns3: Fix for phy link issue when using marvell phy driver
    net: hns3: Fix for information of phydev lost problem when down/up
    net: hns3: Fix for command format parsing error in hclge_is_all_function_id_zero
    net: hns3: Add support for serdes loopback selftest
    bnxt_en: take coredump_record structure off stack
    ...

    Linus Torvalds
     
  • Pull security subsystem updates from James Morris:

    - kstrdup() return value fix from Eric Biggers

    - Add new security_load_data hook to differentiate security checking of
    kernel-loaded binaries in the case of there being no associated file
    descriptor, from Mimi Zohar.

    - Add ability to IMA to specify a policy at build-time, rather than
    just via command line params or by loading a custom policy, from
    Mimi.

    - Allow IMA and LSMs to prevent sysfs firmware load fallback (e.g. if
    using signed firmware), from Mimi.

    - Allow IMA to deny loading of kexec kernel images, as they cannot be
    measured by IMA, from Mimi.

    * 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
    security: check for kstrdup() failure in lsm_append()
    security: export security_kernel_load_data function
    ima: based on policy warn about loading firmware (pre-allocated buffer)
    module: replace the existing LSM hook in init_module
    ima: add build time policy
    ima: based on policy require signed firmware (sysfs fallback)
    firmware: add call to LSM hook before firmware sysfs fallback
    ima: based on policy require signed kexec kernel images
    kexec: add call to LSM hook in original kexec_load syscall
    security: define new LSM hook named security_kernel_load_data
    MAINTAINERS: remove the outdated "LINUX SECURITY MODULE (LSM) FRAMEWORK" entry

    Linus Torvalds
     

15 Aug, 2018

3 commits

  • Pull power management updates from Rafael Wysocki:
    "These add a new framework for CPU idle time injection, to be used by
    all of the idle injection code in the kernel in the future, fix some
    issues and add a number of relatively small extensions in multiple
    places.

    Specifics:

    - Add a new framework for CPU idle time injection (Daniel Lezcano).

    - Add AVS support to the armada-37xx cpufreq driver (Gregory
    CLEMENT).

    - Add support for current CPU frequency reporting to the ACPI CPPC
    cpufreq driver (George Cherian).

    - Rework the cooling device registration in the imx6q/thermal driver
    (Bastian Stender).

    - Make the pcc-cpufreq driver refuse to work with dynamic scaling
    governors on systems with many CPUs to avoid scalability issues
    with it (Rafael Wysocki).

    - Fix the intel_pstate driver to report different maximum CPU
    frequencies on systems where they really are different and to
    ignore the turbo active ratio if hardware-managend P-states (HWP)
    are in use; make it use the match_string() helper (Xie Yisheng,
    Srinivas Pandruvada).

    - Fix a minor deferred probe issue in the qcom-kryo cpufreq driver
    (Niklas Cassel).

    - Add a tracepoint for the tracking of frequency limits changes (from
    Andriod) to the cpufreq core (Ruchi Kandoi).

    - Fix a circular lock dependency between CPU hotplug and sysfs
    locking in the cpufreq core reported by lockdep (Waiman Long).

    - Avoid excessive error reports on driver registration failures in
    the ARM cpuidle driver (Sudeep Holla).

    - Add a new device links flag to the driver core to make links go
    away automatically on supplier driver removal (Vivek Gautam).

    - Eliminate potential race condition between system-wide power
    management transitions and system shutdown (Pingfan Liu).

    - Add a quirk to save NVS memory on system suspend for the ASUS 1025C
    laptop (Willy Tarreau).

    - Make more systems use suspend-to-idle (instead of ACPI S3) by
    default (Tristian Celestin).

    - Get rid of stack VLA usage in the low-level hibernation code on
    64-bit x86 (Kees Cook).

    - Fix error handling in the hibernation core and mark an expected
    fall-through switch in it (Chengguang Xu, Gustavo Silva).

    - Extend the generic power domains (genpd) framework to support
    attaching a device to a power domain by name (Ulf Hansson).

    - Fix device reference counting and user limits initialization in the
    devfreq core (Arvind Yadav, Matthias Kaehlcke).

    - Fix a few issues in the rk3399_dmc devfreq driver and improve its
    documentation (Enric Balletbo i Serra, Lin Huang, Nick Milner).

    - Drop a redundant error message from the exynos-ppmu devfreq driver
    (Markus Elfring)"

    * tag 'pm-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (35 commits)
    PM / reboot: Eliminate race between reboot and suspend
    PM / hibernate: Mark expected switch fall-through
    cpufreq: intel_pstate: Ignore turbo active ratio in HWP
    cpufreq: Fix a circular lock dependency problem
    cpu/hotplug: Add a cpus_read_trylock() function
    x86/power/hibernate_64: Remove VLA usage
    cpufreq: trace frequency limits change
    cpufreq: intel_pstate: Show different max frequency with turbo 3 and HWP
    cpufreq: pcc-cpufreq: Disable dynamic scaling on many-CPU systems
    cpufreq: qcom-kryo: Silently error out on EPROBE_DEFER
    cpufreq / CPPC: Add cpuinfo_cur_freq support for CPPC
    cpufreq: armada-37xx: Add AVS support
    dt-bindings: marvell: Add documentation for the Armada 3700 AVS binding
    PM / devfreq: rk3399_dmc: Fix duplicated opp table on reload.
    PM / devfreq: Init user limits from OPP limits, not viceversa
    PM / devfreq: rk3399_dmc: fix spelling mistakes.
    PM / devfreq: rk3399_dmc: do not print error when get supply and clk defer.
    dt-bindings: devfreq: rk3399_dmc: move interrupts to be optional.
    PM / devfreq: rk3399_dmc: remove wait for dcf irq event.
    dt-bindings: clock: add rk3399 DDR3 standard speed bins.
    ...

    Linus Torvalds
     
  • Pull regulator updates from Mark Brown:
    "The biggest set of changes in here is the addition of the Qualcomm
    RPMH driver. As well as the regualtor driver itself being quite large
    due to the usual involved Qualcomm regulator stuff there's also some
    code shared with the arm-soc tree, a bus driver required to
    communicate with the hardware that actually winds up being much larger
    than the regulator driver itself and a LLCC driver that was part of
    the same signed tag used with the arm-soc tree.

    Other than that it's a fairly standard and quiet release, highlights
    include:

    - Addition of device links from regulator consumers to their
    regulators, helping the core avoid dependency issues during
    suspend.

    - Support for the entertainingly innovative suspend implementation in
    the BD9571MWV.

    - Support for switch regulators on the PFUZE100, this required two
    goes due to backwards compatibility issues with old DTs that were
    discovered.

    - Support for Freescale PFUZE3001 and SocioNext UniPhier.

    - The aforementioned Qualcomm RPMH driver together with the driver
    changes required to support it"

    * tag 'regulator-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (52 commits)
    regulator: add QCOM RPMh regulator driver
    regulator: dt-bindings: add QCOM RPMh regulator bindings
    regulator: samsung: Add SPDX license identifiers
    regulator: maxim: Add SPDX license identifiers
    regulator: bd71837: adobt MFD changes to regulator driver
    regulator: tps65217: Fix NULL pointer dereference on probe
    regulator: Add support for CPCAP regulators on Motorola Xoom devices.
    regulator: Add sw2_sw4 voltage table to cpcap regulator.
    regulator: bd9571mwv: Make symbol 'dev_attr_backup_mode' static
    regulator: pfuze100: add support to en-/disable switch regulators
    regulator: pfuze100: add optional disable switch-regulators binding
    soc: qcom: rmtfs-mem: fix memleak in probe error paths
    soc: qcom: llc-slice: Add missing MODULE_LICENSE()
    drivers: qcom: rpmh: fix unwanted error check for get_tcs_of_type()
    drivers: qcom: rpmh-rsc: fix the loop index check in get_req_from_tcs
    firmware: qcom: scm: add a dummy qcom_scm_assign_mem()
    drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children
    drivers: qcom: rpmh-rsc: allow active requests from wake TCS
    drivers: qcom: rpmh: add support for batch RPMH request
    drivers: qcom: rpmh: allow requests to be sent asynchronously
    ...

    Linus Torvalds
     
  • Pull regmap updates from Mark Brown:
    "Several small new features for regmap this time around:

    - Support for SCCB, an I2C variant used on some media cards. This has
    also pulled in an I2C commit from Peter Rosin as a dependency.

    - Addition of an API for reading repeatedly from registers where the
    address doesn't automatically increment like some ADC outputs or
    GPIO status registers.

    - Support for bulk I/O on Slimbus"

    * tag 'regmap-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
    regmap: Add regmap_noinc_read API
    regmap: sccb: fix typo and sort headers alphabetically
    i2c: smbus: add unlocked __i2c_smbus_xfer variant
    regmap: add SCCB support
    regmap: slimbus: add support to multi read/write

    Linus Torvalds
     

14 Aug, 2018

1 commit

  • Merge changes in the PM core, system-wide PM infrastructure, generic
    power domains (genpd) framework, ACPI PM infrastructure and cpuidle
    for 4.19.

    * pm-core:
    driver core: Add flag to autoremove device link on supplier unbind
    driver core: Rename flag AUTOREMOVE to AUTOREMOVE_CONSUMER

    * pm-domains:
    PM / Domains: Introduce dev_pm_domain_attach_by_name()
    PM / Domains: Introduce option to attach a device by name to genpd
    PM / Domains: dt: Add a power-domain-names property

    * pm-sleep:
    PM / reboot: Eliminate race between reboot and suspend
    PM / hibernate: Mark expected switch fall-through
    x86/power/hibernate_64: Remove VLA usage
    PM / hibernate: cast PAGE_SIZE to int when comparing with error code

    * acpi-pm:
    ACPI / PM: save NVS memory for ASUS 1025C laptop
    ACPI / PM: Default to s2idle in all machines supporting LP S0

    * pm-cpuidle:
    ARM: cpuidle: silence error on driver registration failure

    Rafael J. Wysocki
     

11 Aug, 2018

1 commit


09 Aug, 2018

3 commits

  • Mark Brown
     
  • regmap: Support non-incrementing registers

    Some devices have individual registers that don't autoincrement the
    register address during bulk reads but instead repeatedly read the same
    value, for example for monitoring GPIOs or ADCs. Add support for these.

    Mark Brown
     
  • The regmap API usually assumes that bulk read operations will read a
    range of registers but some I2C/SPI devices have certain registers for
    which a such a read operation will return data from an internal FIFO
    instead. Add an explicit API to support bulk read without range semantics.

    Some linux drivers use regmap_bulk_read or regmap_raw_read for such
    registers, for example mpu6050 or bmi150 from IIO. This only happens to
    work because when caching is disabled a single regmap read op will map
    to a single bus read op (as desired). This breaks if caching is enabled and
    reg+1 happens to be a cacheable register.

    Without regmap support refactoring a driver to enable regmap caching
    requires separate I2C and SPI paths. This is exactly what regmap is
    supposed to help avoid.

    Suggested-by: Jonathan Cameron
    Signed-off-by: Crestez Dan Leonard
    Signed-off-by: Stefan Popa
    Signed-off-by: Mark Brown

    Crestez Dan Leonard
     

05 Aug, 2018

1 commit


03 Aug, 2018

1 commit


30 Jul, 2018

1 commit


27 Jul, 2018

1 commit


24 Jul, 2018

2 commits


21 Jul, 2018

3 commits

  • In some cases the link between between customer and supplier
    already exist, for example when a device use its parent as a supplier.
    Do not warn about already existing dependencies because device_link_add()
    takes care of this case.

    Link: http://lkml.kernel.org/r/20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d~-rzycA5Rg0378203782eucas1p1C@eucas1p1.samsung.com

    Reported-by: Marek Szyprowski
    Reviewed-by: Mark Brown
    Signed-off-by: Benjamin Gaignard
    Reviewed-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Gaignard
     
  • There is a race window in device_shutdown(), which may cause
    -1. parent device shut down before child or
    -2. no shutdown on a new probing device.

    For 1st, taking the following scenario:
    device_shutdown new plugin device
    list_del_init(parent_dev);
    spin_unlock(list_lock);
    device_add(child)
    probe child
    shutdown parent_dev
    --> now child is on the tail of devices_kset

    For 2nd, taking the following scenario:
    device_shutdown new plugin device
    device_add(dev)
    device_lock(dev);
    ...
    device_unlock(dev);
    probe dev
    --> now, the new occurred dev has no opportunity to shutdown

    To fix this race issue, just prevent the new probing request. With this
    logic, device_shutdown() is more similar to dpm_prepare().

    Signed-off-by: Pingfan Liu
    Reviewed-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Pingfan Liu
     
  • Plumb in get_ownership() callback for devices belonging to a class so that
    they can be created with uid/gid different from global root. This will
    allow network devices in a container to belong to container's root and not
    global root.

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Tyler Hicks
    Signed-off-by: David S. Miller

    Dmitry Torokhov
     

18 Jul, 2018

2 commits

  • …ie/regmap into regmap-4.19

    regmap: Add support for SCCB

    This is an I2C subset.

    Mark Brown
     
  • This adds Serial Camera Control Bus (SCCB) support for regmap API that
    is intended to be used by some of Omnivision sensor drivers.

    The ov772x and ov9650 drivers are going to use this SCCB regmap API.

    The ov772x driver was previously only worked with the i2c controller
    drivers that support I2C_FUNC_PROTOCOL_MANGLING, because the ov772x
    device doesn't support repeated starts. After commit 0b964d183cbf
    ("media: ov772x: allow i2c controllers without
    I2C_FUNC_PROTOCOL_MANGLING"), reading ov772x register is replaced with
    issuing two separated i2c messages in order to avoid repeated start.
    Using this SCCB regmap hides the implementation detail.

    The ov9650 driver also issues two separated i2c messages to read the
    registers as the device doesn't support repeated start. So it can
    make use of this SCCB regmap.

    Cc: Mark Brown
    Cc: Peter Rosin
    Cc: Sebastian Reichel
    Cc: Wolfram Sang
    Cc: Sylwester Nawrocki
    Cc: Jacopo Mondi
    Cc: Laurent Pinchart
    Cc: Hans Verkuil
    Cc: Sakari Ailus
    Cc: Mauro Carvalho Chehab
    Signed-off-by: Akinobu Mita
    Signed-off-by: Mark Brown

    Akinobu Mita
     

17 Jul, 2018

1 commit


16 Jul, 2018

2 commits

  • For devices with a class, we create a "glue" directory between
    the parent device and the new device with the class name.

    This directory is never "explicitely" removed when empty however,
    this is left to the implicit sysfs removal done by kobject_release()
    when the object loses its last reference via kobject_put().

    This is problematic because as long as it's not been removed from
    sysfs, it is still present in the class kset and in sysfs directory
    structure.

    The presence in the class kset exposes a use after free bug fixed
    by the previous patch, but the presence in sysfs means that until
    the kobject is released, which can take a while (especially with
    kobject debugging), any attempt at re-creating such as binding a
    new device for that class/parent pair, will result in a sysfs
    duplicate file name error.

    This fixes it by instead doing an explicit kobject_del() when
    the glue dir is empty, by keeping track of the number of
    child devices of the gluedir.

    This is made easy by the fact that all glue dir operations are
    done with a global mutex, and there's already a function
    (cleanup_glue_dir) called in all the right places taking that
    mutex that can be enhanced for this. It appears that this was
    in fact the intent of the function, but the implementation was
    wrong.

    Signed-off-by: Benjamin Herrenschmidt
    Acked-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Herrenschmidt
     
  • device_private_init is called only in core.c, extern declare is
    unnecessary and make it static.

    Cc: Greg Kroah-Hartman
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Shaokun Zhang
    Signed-off-by: Greg Kroah-Hartman

    Shaokun Zhang
     

11 Jul, 2018

1 commit


10 Jul, 2018

3 commits

  • Commit 52cdbdd49853 (driver core: correct device's shutdown order)
    introduced a regression by breaking device shutdown on some systems.

    Namely, the devices_kset_move_last() call in really_probe() added by
    that commit is a mistake as it may cause parents to follow children
    in the devices_kset list which then causes shutdown to fail. For
    example, if a device has children before really_probe() is called
    for it (which is not uncommon), that call will cause it to be
    reordered after the children in the devices_kset list and the
    ordering of that list will not reflect the correct device shutdown
    order any more.

    Also it causes the devices_kset list to be constantly reordered
    until all drivers have been probed which is totally pointless
    overhead in the majority of cases and it only covered an issue
    with system shutdown, while system-wide suspend/resume potentially
    had the same issue on the affected platforms (which was not covered).

    Moreover, the shutdown issue originally addressed by the change in
    really_probe() made by commit 52cdbdd49853 is not present in 4.18-rc
    any more, since dra7 started to use the sdhci-omap driver which
    doesn't disable any regulators during shutdown, so the really_probe()
    part of commit 52cdbdd49853 can be safely reverted. [The original
    issue was related to the omap_hsmmc driver used by dra7 previously.]

    For the above reasons, revert the really_probe() modifications made
    by commit 52cdbdd49853.

    The other code changes made by commit 52cdbdd49853 are useful and
    they need not be reverted.

    Fixes: 52cdbdd49853 (driver core: correct device's shutdown order)
    Link: https://lore.kernel.org/lkml/CAFgQCTt7VfqM=UyCnvNFxrSw8Z6cUtAi3HUwR4_xPAc03SgHjQ@mail.gmail.com/
    Reported-by: Pingfan Liu
    Tested-by: Pingfan Liu
    Reviewed-by: Kishon Vijay Abraham I
    Signed-off-by: Rafael J. Wysocki
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • All PM domain drivers must be built-in (at least those using DT), so
    there is no point deferring probe after initcalls are done. Continuing
    to defer probe may prevent booting successfully even if managing PM
    domains is not required. This can happen if the user failed to enable
    the driver or if power-domains are added to a platform's DT, but there
    is not yet a driver (e.g. a new DTB with an old kernel).

    Call the driver core function driver_deferred_probe_check_init_done()
    instead of just returning -EPROBE_DEFER to stop deferring probe when
    initcalls are done.

    Acked-by: "Rafael J. Wysocki"
    Cc: Kevin Hilman
    Cc: Ulf Hansson
    Cc: Pavel Machek
    Cc: Len Brown
    Cc: Greg Kroah-Hartman
    Cc: linux-pm@vger.kernel.org
    Signed-off-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Rob Herring
     
  • Deferred probe will currently wait forever on dependent devices to probe,
    but sometimes a driver will never exist. It's also not always critical for
    a driver to exist. Platforms can rely on default configuration from the
    bootloader or reset defaults for things such as pinctrl and power domains.
    This is often the case with initial platform support until various drivers
    get enabled. There's at least 2 scenarios where deferred probe can render
    a platform broken. Both involve using a DT which has more devices and
    dependencies than the kernel supports. The 1st case is a driver may be
    disabled in the kernel config. The 2nd case is the kernel version may
    simply not have the dependent driver. This can happen if using a newer DT
    (provided by firmware perhaps) with a stable kernel version. Deferred
    probe issues can be difficult to debug especially if the console has
    dependencies or userspace fails to boot to a shell.

    There are also cases like IOMMUs where only built-in drivers are
    supported, so deferring probe after initcalls is not needed. The IOMMU
    subsystem implemented its own mechanism to handle this using OF_DECLARE
    linker sections.

    This commit adds makes ending deferred probe conditional on initcalls
    being completed or a debug timeout. Subsystems or drivers may opt-in by
    calling driver_deferred_probe_check_init_done() instead of
    unconditionally returning -EPROBE_DEFER. They may use additional
    information from DT or kernel's config to decide whether to continue to
    defer probe or not.

    The timeout mechanism is intended for debug purposes and WARNs loudly.
    The remaining deferred probe pending list will also be dumped after the
    timeout. Not that this timeout won't work for the console which needs
    to be enabled before userspace starts. However, if the console's
    dependencies are resolved, then the kernel log will be printed (as
    opposed to no output).

    Cc: Alexander Graf
    Signed-off-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Rob Herring
     

09 Jul, 2018

4 commits

  • Add a flag to autoremove the device links on supplier driver
    unbind. This obviates the need to explicitly delete the link
    in the remove path.
    We remove these links only when the supplier's link to its
    consumers has gone to DL_STATE_SUPPLIER_UNBIND state.

    Signed-off-by: Vivek Gautam
    Suggested-by: Lukas Wunner
    Reviewed-by: Ulf Hansson
    Signed-off-by: Rafael J. Wysocki

    Vivek Gautam
     
  • Now that we want to add another flag to autoremove the device link
    on supplier unbind, it's fair to rename the existing flag from
    DL_FLAG_AUTOREMOVE to DL_FLAG_AUTOREMOVE_CONSUMER so that we can
    add similar flag for supplier later.
    And, while we are touching device.h, fix a doc build warning.

    Signed-off-by: Vivek Gautam
    Reviewed-by: Ulf Hansson
    Signed-off-by: Rafael J. Wysocki

    Vivek Gautam
     
  • For the multiple PM domain case, let's introduce a new API called
    dev_pm_domain_attach_by_name(). This allows a consumer driver to associate
    its device with one of its PM domains, by using a name based lookup.

    Do note that, currently it's only genpd that supports multiple PM domains
    per device, but dev_pm_domain_attach_by_name() can easily by extended to
    cover other PM domain types, if/when needed.

    Signed-off-by: Ulf Hansson
    Tested-by: Rajendra Nayak
    Reviewed-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     
  • For the multiple PM domain case, let's introduce a new function called
    genpd_dev_pm_attach_by_name(). This allows a device to be associated with
    its PM domain through genpd, by using a name based lookup.

    Note that, genpd_dev_pm_attach_by_name() shall only be called by the driver
    core / PM core, similar to how the existing dev_pm_domain_attach_by_id()
    makes use of genpd_dev_pm_attach_by_id(). However, this is implemented by
    following changes on top.

    Signed-off-by: Ulf Hansson
    Tested-by: Rajendra Nayak
    Reviewed-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

08 Jul, 2018

1 commit

  • With Device Trees (DT), the dependencies of the devices are defined in the
    DT, then the drivers parse that information to lookup the needed resources
    that have as dependencies.

    Since drivers and devices are registered in a non-deterministic way, it is
    possible that a device that is a dependency has not been registered yet by
    the time that is looked up.

    In this case the driver that requires this dependency cannot probe and has
    to defer it. So the driver core adds it to a list of deferred devices that
    is iterated again every time that a new driver is probed successfully.

    For debugging purposes it may be useful to know what are the devices whose
    probe function was deferred. Add a debugfs entry showing that information.

    $ cat /sys/kernel/debug/devices_deferred
    48070000.i2c:twl@48:bci
    musb-hdrc.0.auto
    omapdrm.0

    This information could be obtained partially by enabling debugging, but it
    means that the kernel log has to be parsed and the probe deferral balanced
    with the successes. This can be error probe and has to be done in a ad-hoc
    manner by everyone who needs to debug these kind of issues.

    Since the information is already known by the kernel, just show it to make
    it easier to debug.

    Signed-off-by: Javier Martinez Canillas
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Javier Martinez Canillas
     

07 Jul, 2018

2 commits

  • This fixes: [ 0.010000] cpu cpu0: Error -2 creating of_node link
    ... which you get for every CPU on all architectures that use
    CONFIG_GENERIC_CPU_DEVICES.

    In that case, driver_init() calls cpu_dev_init() before calling
    of_core_init(). Then we get the callchain:

    cpu_dev_init()
    -> cpu_dev_register_generic()
    -> register_cpu(cpu, i)
    -> device_register(&cpu->dev)
    -> device_add(dev)
    -> device_add_class_symlinks(dev)

    ... in device_add_class_symlinks, we we dev->of_node, and call
    sysfs_create_link(), which fails because we haven't called
    of_core_init() to register the sysfs devicetree directory yet.

    Signed-off-by: Wesley W. Terpstra
    [hch: updated the changelog based on review feedback]
    Signed-off-by: Christoph Hellwig
    Acked-by: Mark Rutland
    Acked-by: Frank Rowand
    Signed-off-by: Greg Kroah-Hartman

    Wesley W. Terpstra
     
  • of_property_read_u32 searches for a property in a device node and read
    a 32-bit value from it. Instead of using of_get_property to get the
    property and then read 32-bit value using of_read_number, we can
    simplify it by using of_property_read_u32.

    Suggested-by: Andy Shevchenko
    Signed-off-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla