21 May, 2016

1 commit

  • Commit e61452365372 ("radix_tree: add support for multi-order entries")
    left the impression that the support for multiorder radix tree entries
    was functional. As soon as Ross tried to use it, it became apparent
    that my testing was completely inadequate, and it didn't even work a
    little bit for orders that were not a multiple of shift.

    This series of patches is the result of about 6 weeks of redesign,
    reimplementation, testing, arguing and hair-pulling. The great news is
    that the test-suite is now far better than it was. That's reflected in
    the diffstat for the test-suite alone:

    12 files changed, 436 insertions(+), 28 deletions(-)

    The highlight for users of the tree is that the restriction on the order
    of inserted entries being >= RADIX_TREE_MAP_SHIFT is now gone; the radix
    tree now supports any order between 0 and 64.

    For those who are interested in how the tree works, patch 9 is probably
    the most interesting one as it introduces the new machinery for handling
    sibling entries.

    I've tried to be fair in attributing authorship to the person who
    contributed the majority of the code in each patch; Ross has been an
    invaluable partner in the development of this support and it's fair to
    say that each of us has code in every commit.

    I should also express my appreciation of the 0day testing. It prompted
    me that I was bloating the tinyconfig in an unacceptable way, and it
    bisected to a commit which contained a rather nasty memory-corruption
    bug.

    This patch (of 29):

    The irqdomain code was checking for 0 or 1 entries, not 0 entries like
    the comment said they were. Introduce a new helper that will actually
    check for an empty tree.

    Signed-off-by: Matthew Wilcox
    Reviewed-by: Ross Zwisler
    Reviewed-by: Jan Kara
    Cc: Konstantin Khlebnikov
    Cc: Kirill Shutemov
    Cc: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     

18 May, 2016

1 commit

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for kernel cycle v4.7:

    Core infrastructural changes:

    - Support for natively single-ended GPIO driver stages.

    This means that if the hardware has registers to configure open
    drain or open source configuration, we use that rather than (as we
    did before) try to emulate it by switching the line to an input to
    get high impedance.

    This is also documented throughly in Documentation/gpio/driver.txt
    for those of you who did not understand one word of what I just
    wrote.

    - Start to do away with the unnecessarily complex and unitelligible
    ARCH_REQUIRE_GPIOLIB and ARCH_WANT_OPTIONAL_GPIOLIB, another
    evolutional artifact from the time when the GPIO subsystem was
    unmaintained.

    Archs can now just select GPIOLIB and be done with it, cleanups to
    arches will trickle in for the next kernel. Some minor archs ACKed
    the changes immediately so these are included in this pull request.

    - Advancing the use of the data pointer inside the GPIO device for
    storing driver data by switching the PowerPC, Super-H Unicore and
    a few other subarches or subsystem drivers in ALSA SoC, Input,
    serial, SSB, staging etc to use it.

    - The initialization now reads the input/output state of the GPIO
    lines, so that each GPIO descriptor knows - if this callback is
    implemented - whether the line is input or output. This also
    reflects nicely in userspace "lsgpio".

    - It is now possible to name GPIO producer names, line names, from
    the device tree. (Platform data has been supported for a while).
    I bet we will get a similar mechanism for ACPI one of those days.
    This makes is possible to get sensible producer names for e.g.
    GPIO rails in "lsgpio" in userspace.

    New drivers:

    - New driver for the Loongson1.

    - The XLP driver now supports Broadcom Vulcan ARM64.

    - The IT87 driver now supports IT8620 and IT8628.

    - The PCA953X driver now supports Galileo Gen2.

    Driver improvements:

    - MCP23S08 was switched to use the gpiolib irqchip helpers and now
    also suppors level-triggered interrupts.

    - 74x164 and RCAR now supports the .set_multiple() callback

    - AMDPT was converted to use generic GPIO.

    - TC3589x, TPS65218, SX150X, F7188X, MENZ127, VX855, WM831X, WM8994
    support the new single ended callback for open drain and in some
    cases open source.

    - Implement the .get_direction() callback for a few more drivers like
    PL061, Xgene.

    Cleanups:

    - Paul Gortmaker combed through the drivers and de-modularized those
    who are not really modules.

    - Move the GPIO poweroff DT bindings to the power subdir where they
    belong.

    - Rename gpio-generic.c to gpio-mmio.c, which is much more to the
    point. That's what it is handling, nothing more, nothing less"

    * tag 'gpio-v4.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (126 commits)
    MIPS: do away with ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB
    gpio: zevio: make it explicitly non-modular
    gpio: timberdale: make it explicitly non-modular
    gpio: stmpe: make it explicitly non-modular
    gpio: sodaville: make it explicitly non-modular
    pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error
    gpio: dwapb: Add ACPI device ID for DWAPB GPIO controller on X-Gene platforms
    gpio: dt-bindings: add wd,mbl-gpio bindings
    gpio: of: make it possible to name GPIO lines
    gpio: make gpiod_to_irq() return negative for NO_IRQ
    gpio: xgene: implement .get_direction()
    gpio: xgene: Enable ACPI support for X-Gene GFC GPIO driver
    gpio: tegra: Implement gpio_get_direction callback
    gpio: set up initial state from .get_direction()
    gpio: rename gpio-generic.c into gpio-mmio.c
    gpio: generic: fix GPIO_GENERIC_PLATFORM is set to module case
    gpio: dwapb: add gpio-signaled acpi event support
    gpio: dwapb: convert device node to fwnode
    gpio: dwapb: remove name from dwapb_port_property
    gpio/qoriq: select IRQ_DOMAIN
    ...

    Linus Torvalds
     

11 May, 2016

1 commit

  • In the function, setup_irq(), we don't check that the descriptor
    returned from irq_to_desc() is valid before we start using it. For
    example chip_bus_lock() called from setup_irq(), assumes that the
    descriptor pointer is valid and doesn't check before dereferencing it.

    In many other functions including setup/free_percpu_irq() we do check
    that the descriptor returned is not NULL and therefore add the same test
    to setup_irq() to ensure the descriptor returned is valid.

    Signed-off-by: Jon Hunter
    Signed-off-by: Marc Zyngier

    Jon Hunter
     

02 May, 2016

4 commits

  • In order to prepare the genirq layer for the concept of partitionned
    percpu interrupts, let's allow an affinity to be associated with
    such an interrupt. We introduce:

    - irq_set_percpu_devid_partition: flag an interrupt as a percpu-devid
    interrupt, and associate it with an affinity
    - irq_get_percpu_devid_partition: allow the affinity of that interrupt
    to be retrieved.

    This will allow a driver to discover which CPUs the per-cpu interrupt
    can actually fire on.

    Signed-off-by: Marc Zyngier
    Cc: Mark Rutland
    Cc: devicetree@vger.kernel.org
    Cc: Jason Cooper
    Cc: Will Deacon
    Cc: Rob Herring
    Link: http://lkml.kernel.org/r/1460365075-7316-3-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     
  • When iterating over the irq domain list, we try to match a domain
    either by calling a match() function or by comparing a number
    of fields passed as parameters.

    Both approaches are a bit restrictive:
    - match() is DT specific and only takes a device node
    - the fallback case only deals with the fwnode_handle

    It would be useful if we had a per-domain function that would
    actually perform the matching check on the whole of the
    irq_fwspec structure. This would allow for a domain to triage
    matching attempts that need to extend beyond the fwnode.

    Let's introduce irq_find_matching_fwspec(), which takes a full
    blown irq_fwspec structure, and call into a select() function
    implemented by the irqdomain. irq_find_matching_fwnode() is
    made a wrapper around irq_find_matching_fwspec in order to
    preserve compatibility.

    Signed-off-by: Marc Zyngier
    Cc: Mark Rutland
    Cc: devicetree@vger.kernel.org
    Cc: Jason Cooper
    Cc: Will Deacon
    Cc: Rob Herring
    Link: http://lkml.kernel.org/r/1460365075-7316-2-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     
  • Make these functions return appropriate error codes when something goes
    wrong.

    Previously irq_destroy_ipi returned void making it impossible to notify
    the caller if the request could not be fulfilled. Patch 1 in the series
    added another condition in which this could fail in addition to the
    existing ones. irq_reserve_ipi returned an unsigned int meaning it could
    only return 0 on failure and give the caller no indication as to why the
    request failed.

    As time goes on there are likely to be further conditions added in which
    these functions can fail. These APIs and the IPI IRQ domain are new in
    4.6 and the number of existing call sites are low, changing the API now
    has little impact on the code, while making it easier for these
    functions to grow over time.

    Signed-off-by: Matt Redfearn
    Cc: linux-mips@linux-mips.org
    Cc: jason@lakedaemon.net
    Cc: marc.zyngier@arm.com
    Cc: ralf@linux-mips.org
    Cc: Qais Yousef
    Cc: lisa.parratt@imgtec.com
    Cc: jiang.liu@linux.intel.com
    Link: http://lkml.kernel.org/r/1461568464-31701-2-git-send-email-matt.redfearn@imgtec.com
    Signed-off-by: Thomas Gleixner

    Matt Redfearn
     
  • Previously irq_destroy_ipi() would destroy IPIs to all CPUs that were
    configured by irq_reserve_ipi(). This change makes it possible to
    destroy just a subset of the IPIs. This may be useful to remove IPIs to
    CPUs that have been hot removed so that the IRQ numbers allocated within
    the IPI domain can be re-used.

    The original behaviour is restored by passing the complete mask that the
    IPI was created with.

    There are currently no users of this function that would break from the
    API change.

    Signed-off-by: Matt Redfearn
    Cc: linux-mips@linux-mips.org
    Cc: jason@lakedaemon.net
    Cc: marc.zyngier@arm.com
    Cc: ralf@linux-mips.org
    Cc: Qais Yousef
    Cc: lisa.parratt@imgtec.com
    Cc: jiang.liu@linux.intel.com
    Link: http://lkml.kernel.org/r/1461568464-31701-1-git-send-email-matt.redfearn@imgtec.com
    Signed-off-by: Thomas Gleixner

    Matt Redfearn
     

21 Apr, 2016

1 commit

  • The IPI domain re-purposes the IRQ affinity to signify the mask of CPUs
    that this IPI will deliver to. This must not be modified before the IPI
    is destroyed again, so set the IRQ_NO_BALANCING flag to prevent the
    affinity being overwritten by setup_affinity().

    Without this, if an IPI is reserved for a single target CPU, then
    allocated using __setup_irq(), the affinity is overwritten with
    cpu_online_mask. When ipi_destroy() is subsequently called on a
    multi-cpu system, it will attempt to free cpumask_weight() IRQs
    that were never allocated, and crash.

    Fixes: d17bf24e6952 ("genirq: Add a new generic IPI reservation code to irq core")
    Signed-off-by: Matt Redfearn
    Cc: linux-mips@linux-mips.org
    Cc: jason@lakedaemon.net
    Cc: marc.zyngier@arm.com
    Cc: ralf@linux-mips.org
    Cc: Qais Yousef
    Cc: lisa.parratt@imgtec.com
    Link: http://lkml.kernel.org/r/1461229712-13057-1-git-send-email-matt.redfearn@imgtec.com
    Signed-off-by: Thomas Gleixner

    Matt Redfearn
     

31 Mar, 2016

1 commit


23 Mar, 2016

1 commit

  • Use the more common logging method with the eventual goal of removing
    pr_warning altogether.

    Miscellanea:

    - Realign arguments
    - Coalesce formats
    - Add missing space between a few coalesced formats

    Signed-off-by: Joe Perches
    Acked-by: Rafael J. Wysocki [kernel/power/suspend.c]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

17 Mar, 2016

1 commit

  • Pull power management and ACPI updates from Rafael Wysocki:
    "This time the majority of changes go into cpufreq and they are
    significant.

    First off, the way CPU frequency updates are triggered is different
    now. Instead of having to set up and manage a deferrable timer for
    each CPU in the system to evaluate and possibly change its frequency
    periodically, cpufreq governors set up callbacks to be invoked by the
    scheduler on a regular basis (basically on utilization updates). The
    "old" governors, "ondemand" and "conservative", still do all of their
    work in process context (although that is triggered by the scheduler
    now), but intel_pstate does it all in the callback invoked by the
    scheduler with no need for any additional asynchronous processing.

    Of course, this eliminates the overhead related to the management of
    all those timers, but also it allows the cpufreq governor code to be
    simplified quite a bit. On top of that, the common code and data
    structures used by the "ondemand" and "conservative" governors are
    cleaned up and made more straightforward and some long-standing and
    quite annoying problems are addressed. In particular, the handling of
    governor sysfs attributes is modified and the related locking becomes
    more fine grained which allows some concurrency problems to be avoided
    (particularly deadlocks with the core cpufreq code).

    In principle, the new mechanism for triggering frequency updates
    allows utilization information to be passed from the scheduler to
    cpufreq. Although the current code doesn't make use of it, in the
    works is a new cpufreq governor that will make decisions based on the
    scheduler's utilization data. That should allow the scheduler and
    cpufreq to work more closely together in the long run.

    In addition to the core and governor changes, cpufreq drivers are
    updated too. Fixes and optimizations go into intel_pstate, the
    cpufreq-dt driver is updated on top of some modification in the
    Operating Performance Points (OPP) framework and there are fixes and
    other updates in the powernv cpufreq driver.

    Apart from the cpufreq updates there is some new ACPICA material,
    including a fix for a problem introduced by previous ACPICA updates,
    and some less significant changes in the ACPI code, like CPPC code
    optimizations, ACPI processor driver cleanups and support for loading
    ACPI tables from initrd.

    Also updated are the generic power domains framework, the Intel RAPL
    power capping driver and the turbostat utility and we have a bunch of
    traditional assorted fixes and cleanups.

    Specifics:

    - Redesign of cpufreq governors and the intel_pstate driver to make
    them use callbacks invoked by the scheduler to trigger CPU
    frequency evaluation instead of using per-CPU deferrable timers for
    that purpose (Rafael Wysocki).

    - Reorganization and cleanup of cpufreq governor code to make it more
    straightforward and fix some concurrency problems in it (Rafael
    Wysocki, Viresh Kumar).

    - Cleanup and improvements of locking in the cpufreq core (Viresh
    Kumar).

    - Assorted cleanups in the cpufreq core (Rafael Wysocki, Viresh
    Kumar, Eric Biggers).

    - intel_pstate driver updates including fixes, optimizations and a
    modification to make it enable enable hardware-coordinated P-state
    selection (HWP) by default if supported by the processor (Philippe
    Longepe, Srinivas Pandruvada, Rafael Wysocki, Viresh Kumar, Felipe
    Franciosi).

    - Operating Performance Points (OPP) framework updates to improve its
    handling of voltage regulators and device clocks and updates of the
    cpufreq-dt driver on top of that (Viresh Kumar, Jon Hunter).

    - Updates of the powernv cpufreq driver to fix initialization and
    cleanup problems in it and correct its worker thread handling with
    respect to CPU offline, new powernv_throttle tracepoint (Shilpasri
    Bhat).

    - ACPI cpufreq driver optimization and cleanup (Rafael Wysocki).

    - ACPICA updates including one fix for a regression introduced by
    previos changes in the ACPICA code (Bob Moore, Lv Zheng, David Box,
    Colin Ian King).

    - Support for installing ACPI tables from initrd (Lv Zheng).

    - Optimizations of the ACPI CPPC code (Prashanth Prakash, Ashwin
    Chaugule).

    - Support for _HID(ACPI0010) devices (ACPI processor containers) and
    ACPI processor driver cleanups (Sudeep Holla).

    - Support for ACPI-based enumeration of the AMBA bus (Graeme Gregory,
    Aleksey Makarov).

    - Modification of the ACPI PCI IRQ management code to make it treat
    255 in the Interrupt Line register as "not connected" on x86 (as
    per the specification) and avoid attempts to use that value as a
    valid interrupt vector (Chen Fan).

    - ACPI APEI fixes related to resource leaks (Josh Hunt).

    - Removal of modularity from a few ACPI drivers (BGRT, GHES,
    intel_pmic_crc) that cannot be built as modules in practice (Paul
    Gortmaker).

    - PNP framework update to make it treat ACPI_RESOURCE_TYPE_SERIAL_BUS
    as a valid resource type (Harb Abdulhamid).

    - New device ID (future AMD I2C controller) in the ACPI driver for
    AMD SoCs (APD) and in the designware I2C driver (Xiangliang Yu).

    - Assorted ACPI cleanups (Colin Ian King, Kaiyen Chang, Oleg Drokin).

    - cpuidle menu governor optimization to avoid a square root
    computation in it (Rasmus Villemoes).

    - Fix for potential use-after-free in the generic device properties
    framework (Heikki Krogerus).

    - Updates of the generic power domains (genpd) framework including
    support for multiple power states of a domain, fixes and debugfs
    output improvements (Axel Haslam, Jon Hunter, Laurent Pinchart,
    Geert Uytterhoeven).

    - Intel RAPL power capping driver updates to reduce IPI overhead in
    it (Jacob Pan).

    - System suspend/hibernation code cleanups (Eric Biggers, Saurabh
    Sengar).

    - Year 2038 fix for the process freezer (Abhilash Jindal).

    - turbostat utility updates including new features (decoding of more
    registers and CPUID fields, sub-second intervals support, GFX MHz
    and RC6 printout, --out command line option), fixes (syscall jitter
    detection and workaround, reductioin of the number of syscalls
    made, fixes related to Xeon x200 processors, compiler warning
    fixes) and cleanups (Len Brown, Hubert Chrzaniuk, Chen Yu)"

    * tag 'pm+acpi-4.6-rc1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (182 commits)
    tools/power turbostat: bugfix: TDP MSRs print bits fixing
    tools/power turbostat: correct output for MSR_NHM_SNB_PKG_CST_CFG_CTL dump
    tools/power turbostat: call __cpuid() instead of __get_cpuid()
    tools/power turbostat: indicate SMX and SGX support
    tools/power turbostat: detect and work around syscall jitter
    tools/power turbostat: show GFX%rc6
    tools/power turbostat: show GFXMHz
    tools/power turbostat: show IRQs per CPU
    tools/power turbostat: make fewer systems calls
    tools/power turbostat: fix compiler warnings
    tools/power turbostat: add --out option for saving output in a file
    tools/power turbostat: re-name "%Busy" field to "Busy%"
    tools/power turbostat: Intel Xeon x200: fix turbo-ratio decoding
    tools/power turbostat: Intel Xeon x200: fix erroneous bclk value
    tools/power turbostat: allow sub-sec intervals
    ACPI / APEI: ERST: Fixed leaked resources in erst_init
    ACPI / APEI: Fix leaked resources
    intel_pstate: Do not skip samples partially
    intel_pstate: Remove freq calculation from intel_pstate_calc_busy()
    intel_pstate: Move intel_pstate_calc_busy() into get_target_pstate_use_performance()
    ...

    Linus Torvalds
     

16 Mar, 2016

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The 4.6 pile of irq updates contains:

    - Support for IPI irqdomains to support proper integration of IPIs to
    and from coprocessors. The first user of this new facility is
    MIPS. The relevant MIPS patches come with the core to avoid merge
    ordering issues and have been acked by Ralf.

    - A new command line option to set the default interrupt affinity
    mask at boot time.

    - Support for some more new ARM and MIPS interrupt controllers:
    tango, alpine-msix and bcm6345-l1

    - Two small cleanups for x86/apic which we merged into irq/core to
    avoid yet another branch in x86 with two tiny commits.

    - The usual set of updates, cleanups in drivers/irqchip. Mostly in
    the area of ARM-GIC, arada-37-xp and atmel chips. Nothing
    outstanding here"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (56 commits)
    irqchip/irq-alpine-msi: Release the correct domain on error
    irqchip/mxs: Fix error check of of_io_request_and_map()
    irqchip/sunxi-nmi: Fix error check of of_io_request_and_map()
    genirq: Export IRQ functions for module use
    irqchip/gic/realview: Support more RealView DCC variants
    Documentation/bindings: Document the Alpine MSIX driver
    irqchip: Add the Alpine MSIX interrupt controller
    irqchip/gic-v3: Always return IRQ_SET_MASK_OK_DONE in gic_set_affinity
    irqchip/gic-v3-its: Mark its_init() and its children as __init
    irqchip/gic-v3: Remove gic_root_node variable from the ITS code
    irqchip/gic-v3: ACPI: Add redistributor support via GICC structures
    irqchip/gic-v3: Add ACPI support for GICv3/4 initialization
    irqchip/gic-v3: Refactor gic_of_init() for GICv3 driver
    x86/apic: Deinline _flat_send_IPI_mask, save ~150 bytes
    x86/apic: Deinline __default_send_IPI_*, save ~200 bytes
    dt-bindings: interrupt-controller: Add SoC-specific compatible string to Marvell ODMI
    irqchip/mips-gic: Add new DT property to reserve IPIs
    MIPS: Delete smp-gic.c
    MIPS: Make smp CMP, CPS and MT use the new generic IPI functions
    MIPS: Add generic SMP IPI support
    ...

    Linus Torvalds
     

15 Mar, 2016

1 commit


10 Mar, 2016

1 commit

  • Export irq_chip_*_parent(), irq_domain_create_hierarchy(),
    irq_domain_set_hwirq_and_chip(), irq_domain_reset_irq_data(),
    irq_domain_alloc/free_irqs_parent()

    So gpio drivers can be built as modules. First user: gpio-xgene-sb

    Signed-off-by: Quan Nguyen
    Acked-by: Linus Walleij
    Cc: Phong Vo
    Cc: Marc Zyngier
    Cc: patches@apm.com
    Cc: Loc Ho
    Cc: Keyur Chudgar
    Cc: Jiang Liu
    Link: https://lists.01.org/pipermail/kbuild-all/2016-February/017914.html
    Link: http://lkml.kernel.org/r/1457017012-10628-1-git-send-email-qnguyen@apm.com
    Signed-off-by: Thomas Gleixner

    Quan Nguyen
     

09 Mar, 2016

1 commit

  • Per the x86-specific footnote to PCI spec r3.0, sec 6.2.4, the value 255 in
    the Interrupt Line register means "unknown" or "no connection."
    Previously, when we couldn't derive an IRQ from the _PRT, we fell back to
    using the value from Interrupt Line as an IRQ. It's questionable whether
    we should do that at all, but the spec clearly suggests we shouldn't do it
    for the value 255 on x86.

    Calling request_irq() with IRQ 255 may succeed, but the driver won't
    receive any interrupts. Or, if IRQ 255 is shared with another device, it
    may succeed, and the driver's ISR will be called at random times when the
    *other* device interrupts. Or it may fail if another device is using IRQ
    255 with incompatible flags. What we *want* is for request_irq() to fail
    predictably so the driver can fall back to polling.

    On x86, assume 255 in the Interrupt Line means the INTx line is not
    connected. In that case, set dev->irq to IRQ_NOTCONNECTED so request_irq()
    will fail gracefully with -ENOTCONN.

    We found this problem on a system where Secure Boot firmware assigned
    Interrupt Line 255 to an i801_smbus device and another device was already
    using MSI-X IRQ 255. This was in v3.10, where i801_probe() fails if
    request_irq() fails:

    i801_smbus 0000:00:1f.3: enabling device (0140 -> 0143)
    i801_smbus 0000:00:1f.3: can't derive routing for PCI INT C
    i801_smbus 0000:00:1f.3: PCI INT C: no GSI
    genirq: Flags mismatch irq 255. 00000080 (i801_smbus) vs. 00000000 (megasa)
    CPU: 0 PID: 2487 Comm: kworker/0:1 Not tainted 3.10.0-229.el7.x86_64 #1
    Hardware name: FUJITSU PRIMEQUEST 2800E2/D3736, BIOS PRIMEQUEST 2000 Serie5
    Call Trace:
    dump_stack+0x19/0x1b
    __setup_irq+0x54a/0x570
    request_threaded_irq+0xcc/0x170
    i801_probe+0x32f/0x508 [i2c_i801]
    local_pci_probe+0x45/0xa0
    i801_smbus 0000:00:1f.3: Failed to allocate irq 255: -16
    i801_smbus: probe of 0000:00:1f.3 failed with error -16

    After aeb8a3d16ae0 ("i2c: i801: Check if interrupts are disabled"),
    i801_probe() will fall back to polling if request_irq() fails. But we
    still need this patch because request_irq() may succeed or fail depending
    on other devices in the system. If request_irq() fails, i801_smbus will
    work by falling back to polling, but if it succeeds, i801_smbus won't work
    because it expects interrupts that it may not receive.

    Signed-off-by: Chen Fan
    Acked-by: Thomas Gleixner
    Acked-by: Bjorn Helgaas
    Signed-off-by: Rafael J. Wysocki

    Chen Fan
     

25 Feb, 2016

5 commits

  • Add APIs to send IPIs from driver and arch code.

    We have different functions because we allow architecture code to cache the
    irq descriptor to avoid lookups. Driver code has to use the irq number and is
    subject to more restrictive checks.

    [ tglx: Polish the implementation ]

    Signed-off-by: Qais Yousef
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: Qais Yousef
    Link: http://lkml.kernel.org/r/1449580830-23652-12-git-send-email-qais.yousef@imgtec.com
    Signed-off-by: Thomas Gleixner

    Qais Yousef
     
  • When dealing with coprocessors we need to find out the actual hwirqs values to
    pass on to the firmware so that it knows what it needs to use to receive IPIs
    from and send IPIs to Linux cpus.

    [ tglx: Fixed the single hwirq IPI case. The hardware irq number does not
    change due to the cpu number ]

    Signed-off-by: Qais Yousef
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: Qais Yousef
    Link: http://lkml.kernel.org/r/1449580830-23652-10-git-send-email-qais.yousef@imgtec.com
    Signed-off-by: Thomas Gleixner

    Qais Yousef
     
  • Add a generic mechanism to dynamically allocate an IPI. Depending on the
    underlying implementation this creates either a single Linux irq or a
    consective range of Linux irqs. The Linux irq is used later to send IPIs to
    other CPUs.

    [ tglx: Massaged the code and removed the 'consecutive mask' restriction for
    the single IRQ case ]

    Signed-off-by: Qais Yousef
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: Qais Yousef
    Link: http://lkml.kernel.org/r/1449580830-23652-9-git-send-email-qais.yousef@imgtec.com
    Signed-off-by: Thomas Gleixner

    Qais Yousef
     
  • We will need to use this function to implement irq_reserve_ipi() later. So
    make it non static and move the prototype to irqdomain.h to allow using it
    outside irqdomain.c

    Signed-off-by: Qais Yousef
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: Qais Yousef
    Link: http://lkml.kernel.org/r/1449580830-23652-8-git-send-email-qais.yousef@imgtec.com
    Signed-off-by: Thomas Gleixner

    Qais Yousef
     
  • Select this to enable the generic IPI domain support

    Signed-off-by: Qais Yousef
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: Qais Yousef
    Link: http://lkml.kernel.org/r/1449580830-23652-4-git-send-email-qais.yousef@imgtec.com
    Signed-off-by: Thomas Gleixner

    Qais Yousef
     

24 Feb, 2016

1 commit

  • irq_common_data::state_use_accessors is not designed for public use.
    Therefore make it private so that people who write code accessing it
    directly will get blamed by sparse. Also #undef the macro
    __irqd_to_state after used in header files, so that the macro can't be
    misused.

    Signed-off-by: Boqun Feng
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Paul E. McKenney

    Boqun Feng
     

15 Feb, 2016

1 commit

  • The irq code browses the list of actions differently to inspect the element
    one by one. Even if it is not a problem, for the sake of consistent code,
    provide a macro similar to for_each_irq_desc in order to have the same loop to
    go through the actions list and use it in the code.

    [ tglx: Renamed the macro ]

    Signed-off-by: Daniel Lezcano
    Link: http://lkml.kernel.org/r/1452765253-31148-1-git-send-email-daniel.lezcano@linaro.org
    Signed-off-by: Thomas Gleixner

    Daniel Lezcano
     

08 Feb, 2016

1 commit

  • If we isolate CPUs, then we don't want random device interrupts on them. Even
    w/o the user space irq balancer enabled we can end up with irqs on non boot
    cpus and chasing newly requested interrupts is a tedious task.

    Allow to restrict the default irq affinity mask.

    Signed-off-by: Thomas Gleixner
    Cc: Rik van Riel
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Sebastian Siewior
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1602031948190.25254@nanos
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

01 Feb, 2016

1 commit

  • Pull IRQ fixes from Ingo Molnar:
    "Mostly irqchip driver fixes, but also an irq core crash fix and a
    build fix"

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    irqchip/mxs: Add missing set_handle_irq()
    irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
    irqchip/gic-v3-its: Recompute the number of pages on page size change
    base: Export platform_msi_domain_[alloc,free]_irqs
    of: MSI: Simplify irqdomain lookup
    irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token
    irqchip: Fix dependencies for archs w/o HAS_IOMEM
    irqchip/s3c24xx: Mark init_eint as __maybe_unused
    genirq: Validate action before dereferencing it in handle_irq_event_percpu()

    Linus Torvalds
     

26 Jan, 2016

1 commit

  • Let's take the (outlandish) example of an interrupt controller
    capable of handling both wired interrupts and PCI MSIs.

    With the current code, the PCI MSI domain is going to be tagged
    with DOMAIN_BUS_PCI_MSI, and the wired domain with DOMAIN_BUS_ANY.

    Things get hairy when we start looking up the domain for a wired
    interrupt (typically when creating it based on some firmware
    information - DT or ACPI).

    In irq_create_fwspec_mapping(), we perform the lookup using
    DOMAIN_BUS_ANY, which is actually used as a wildcard. This gives
    us one chance out of two to end up with the wrong domain, and
    we try to configure a wired interrupt with the MSI domain.
    Everything grinds to a halt pretty quickly.

    What we really need to do is to start looking for a domain that
    would uniquely identify a wired interrupt domain, and only use
    DOMAIN_BUS_ANY as a fallback.

    In order to solve this, let's introduce a new DOMAIN_BUS_WIRED
    token, which is going to be used exactly as described above.
    Of course, this depends on the irqchip to setup the domain
    bus_token, and nobody had to implement this so far.

    Only so far.

    Signed-off-by: Marc Zyngier
    Cc: Greg Kroah-Hartman
    Cc: Rob Herring
    Cc: Frank Rowand
    Cc: Grant Likely
    Cc: Thomas Petazzoni
    Cc: Jiang Liu
    Link: http://lkml.kernel.org/r/1453816347-32720-2-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

22 Jan, 2016

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for the v4.5 merge window:

    Enumeration:
    - Simplify config space size computation (Bjorn Helgaas)
    - Avoid iterating through ROM outside the resource window (Edward O'Callaghan)
    - Support PCIe devices with short cfg_size (Jason S. McMullan)
    - Add Netronome vendor and device IDs (Jason S. McMullan)
    - Limit config space size for Netronome NFP6000 family (Jason S. McMullan)
    - Add Netronome NFP4000 PF device ID (Simon Horman)
    - Limit config space size for Netronome NFP4000 (Simon Horman)
    - Print warnings for all invalid expansion ROM headers (Vladis Dronov)

    Resource management:
    - Fix minimum allocation address overwrite (Christoph Biedl)

    PCI device hotplug:
    - acpiphp_ibm: Fix null dereferences on null ibm_slot (Colin Ian King)
    - pciehp: Always protect pciehp_disable_slot() with hotplug mutex (Guenter Roeck)
    - shpchp: Constify hpc_ops structure (Julia Lawall)
    - ibmphp: Remove unneeded NULL test (Julia Lawall)

    Power management:
    - Make ASPM sysfs link_state_store() consistent with link_state_show() (Andy Lutomirski)

    Virtualization
    - Add function 1 DMA alias quirk for Lite-On/Plextor M6e/Marvell 88SS9183 (Tim Sander)

    MSI:
    - Remove empty pci_msi_init_pci_dev() (Bjorn Helgaas)
    - Mark PCIe/PCI (MSI) IRQ cascade handlers as IRQF_NO_THREAD (Grygorii Strashko)
    - Initialize MSI capability for all architectures (Guilherme G. Piccoli)
    - Relax msi_domain_alloc() to support parentless MSI irqdomains (Liu Jiang)

    ARM Versatile host bridge driver:
    - Remove unused pci_sys_data structures (Lorenzo Pieralisi)

    Broadcom iProc host bridge driver:
    - Hide CONFIG_PCIE_IPROC (Arnd Bergmann)
    - Do not use 0x in front of %pap (Dmitry V. Krivenok)
    - Update iProc PCIe device tree binding (Ray Jui)
    - Add PAXC interface support (Ray Jui)
    - Add iProc PCIe MSI device tree binding (Ray Jui)
    - Add iProc PCIe MSI support (Ray Jui)

    Freescale i.MX6 host bridge driver:
    - Use gpio_set_value_cansleep() (Fabio Estevam)
    - Add support for active-low reset GPIO (Petr Štetiar)

    HiSilicon host bridge driver:
    - Add support for HiSilicon Hip06 PCIe host controllers (Gabriele Paoloni)

    Intel VMD host bridge driver:
    - Export irq_domain_set_info() for module use (Keith Busch)
    - x86/PCI: Allow DMA ops specific to a PCI domain (Keith Busch)
    - Use 32 bit PCI domain numbers (Keith Busch)
    - Add driver for Intel Volume Management Device (VMD) (Keith Busch)

    Qualcomm host bridge driver:
    - Document PCIe devicetree bindings (Stanimir Varbanov)
    - Add Qualcomm PCIe controller driver (Stanimir Varbanov)
    - dts: apq8064: add PCIe devicetree node (Stanimir Varbanov)
    - dts: ifc6410: enable PCIe DT node for this board (Stanimir Varbanov)

    Renesas R-Car host bridge driver:
    - Add support for R-Car H3 to pcie-rcar (Harunobu Kurokawa)
    - Allow DT to override default window settings (Phil Edworthy)
    - Convert to DT resource parsing API (Phil Edworthy)
    - Revert "PCI: rcar: Build pcie-rcar.c only on ARM" (Phil Edworthy)
    - Remove unused pci_sys_data struct from pcie-rcar (Phil Edworthy)
    - Add runtime PM support to pcie-rcar (Phil Edworthy)
    - Add Gen2 PHY setup to pcie-rcar (Phil Edworthy)
    - Add gen2 fallback compatibility string for pci-rcar-gen2 (Simon Horman)
    - Add gen2 fallback compatibility string for pcie-rcar (Simon Horman)

    Synopsys DesignWare host bridge driver:
    - Simplify control flow (Bjorn Helgaas)
    - Make config accessor override checking symmetric (Bjorn Helgaas)
    - Ensure ATU is enabled before IO/conf space accesses (Stanimir Varbanov)

    Miscellaneous:
    - Add of_pci_get_host_bridge_resources() stub (Arnd Bergmann)
    - Check for PCI_HEADER_TYPE_BRIDGE equality, not bitmask (Bjorn Helgaas)
    - Fix all whitespace issues (Bogicevic Sasa)
    - x86/PCI: Simplify pci_bios_{read,write} (Geliang Tang)
    - Use to_pci_dev() instead of open-coding it (Geliang Tang)
    - Use kobj_to_dev() instead of open-coding it (Geliang Tang)
    - Use list_for_each_entry() to simplify code (Geliang Tang)
    - Fix typos in (Thomas Petazzoni)
    - x86/PCI: Clarify AMD Fam10h config access restrictions comment (Tomasz Nowicki)"

    * tag 'pci-v4.5-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (58 commits)
    PCI: Add function 1 DMA alias quirk for Lite-On/Plextor M6e/Marvell 88SS9183
    PCI: Limit config space size for Netronome NFP4000
    PCI: Add Netronome NFP4000 PF device ID
    x86/PCI: Add driver for Intel Volume Management Device (VMD)
    PCI/AER: Use 32 bit PCI domain numbers
    x86/PCI: Allow DMA ops specific to a PCI domain
    irqdomain: Export irq_domain_set_info() for module use
    PCI: host: Add of_pci_get_host_bridge_resources() stub
    genirq/MSI: Relax msi_domain_alloc() to support parentless MSI irqdomains
    PCI: rcar: Add Gen2 PHY setup to pcie-rcar
    PCI: rcar: Add runtime PM support to pcie-rcar
    PCI: designware: Make config accessor override checking symmetric
    PCI: ibmphp: Remove unneeded NULL test
    ARM: dts: ifc6410: enable PCIe DT node for this board
    ARM: dts: apq8064: add PCIe devicetree node
    PCI: hotplug: Use list_for_each_entry() to simplify code
    PCI: rcar: Remove unused pci_sys_data struct from pcie-rcar
    PCI: hisi: Add support for HiSilicon Hip06 PCIe host controllers
    PCI: Avoid iterating through memory outside the resource window
    PCI: acpiphp_ibm: Fix null dereferences on null ibm_slot
    ...

    Linus Torvalds
     

16 Jan, 2016

1 commit


15 Jan, 2016

2 commits

  • Previously msi_domain_alloc() assumed MSI irqdomains always had parent
    irqdomains, but that's not true for the new Intel VMD devices. Relax
    msi_domain_alloc() to support parentless MSI irqdomains.

    Signed-off-by: Jiang Liu
    Signed-off-by: Keith Busch
    Signed-off-by: Bjorn Helgaas
    Acked-by: Thomas Gleixner

    Liu Jiang
     
  • commit 71f64340fc0e changed the handling of irq_desc->action from

    CPU 0 CPU 1
    free_irq() lock(desc)
    lock(desc) handle_edge_irq()
    if (desc->action) {
    handle_irq_event()
    action = desc->action
    unlock(desc)
    desc->action = NULL handle_irq_event_percpu(desc, action)
    action->xxx
    to

    CPU 0 CPU 1
    free_irq() lock(desc)
    lock(desc) handle_edge_irq()
    if (desc->action) {
    handle_irq_event()
    unlock(desc)
    desc->action = NULL handle_irq_event_percpu(desc, action)
    action = desc->action
    action->xxx

    So if free_irq manages to set the action to NULL between the unlock and before
    the readout, we happily dereference a null pointer.

    We could simply revert 71f64340fc0e, but we want to preserve the better code
    generation. A simple solution is to change the action loop from a do {} while
    to a while {} loop.

    This is safe because we either see a valid desc->action or NULL. If the action
    is about to be removed it is still valid as free_irq() is blocked on
    synchronize_irq().

    CPU 0 CPU 1
    free_irq() lock(desc)
    lock(desc) handle_edge_irq()
    handle_irq_event(desc)
    set(INPROGRESS)
    unlock(desc)
    handle_irq_event_percpu(desc)
    action = desc->action
    desc->action = NULL while (action) {
    action->xxx
    ...
    action = action->next;
    sychronize_irq()
    while(INPROGRESS); lock(desc)
    clr(INPROGRESS)
    free(action)

    That's basically the same mechanism as we have for shared
    interrupts. action->next can become NULL while handle_irq_event_percpu()
    runs. Either it sees the action or NULL. It does not matter, because action
    itself cannot go away before the interrupt in progress flag has been cleared.

    Fixes: commit 71f64340fc0e "genirq: Remove the second parameter from handle_irq_event_percpu()"
    Reported-by: zyjzyj2000@gmail.com
    Signed-off-by: Thomas Gleixner
    Cc: Huang Shijie
    Cc: Jiang Liu
    Cc: Peter Zijlstra
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1601131224190.3575@nanos

    Thomas Gleixner
     

12 Jan, 2016

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The irq department provides:

    - Support for MSI to wire bridges and a first user of it

    - More ACPI support for ARM/GIC

    - A new TS-4800 interrupt controller driver

    - RCU based free of interrupt descriptors to support the upcoming
    Intel VMD technology without introducing a locking nightmare

    - The usual pile of fixes and updates to drivers and core code"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (41 commits)
    irqchip/omap-intc: Add support for spurious irq handling
    irqchip/zevio: Use irq_data_get_chip_type() helper
    irqchip/omap-intc: Remove duplicate setup for IRQ chip type handler
    irqchip/ts4800: Add TS-4800 interrupt controller
    irqchip/ts4800: Add documentation for TS-4800 interrupt controller
    irq/platform-MSI: Increase the maximum MSIs the MSI framework can support
    irqchip/gicv2m: Miscellaneous fixes for v2m resources and SPI ranges
    irqchip/bcm2836: Make code more readable
    irqchip/bcm2836: Tolerate IRQs while no flag is set in ISR
    irqchip/bcm2836: Add SMP support for the 2836
    irqchip/bcm2836: Fix initialization of the LOCAL_IRQ_CNT timers
    irqchip/gic-v2m: acpi: Introducing GICv2m ACPI support
    irqchip/gic-v2m: Refactor to prepare for ACPI support
    irqdomain: Introduce is_fwnode_irqchip helper
    acpi: pci: Setup MSI domain for ACPI based pci devices
    genirq/msi: Export functions to allow MSI domains in modules
    irqchip/mbigen: Implement the mbigen irq chip operation functions
    irqchip/mbigen: Create irq domain for each mbigen device
    irqchip/mgigen: Add platform device driver for mbigen device
    dt-bindings: Documents the mbigen bindings
    ...

    Linus Torvalds
     

29 Dec, 2015

1 commit


21 Dec, 2015

1 commit


20 Dec, 2015

1 commit

  • The Linux kernel already has the concept of IRQ domain, wherein a
    component can expose a set of IRQs which are managed by a particular
    interrupt controller chip or other subsystem. The PCI driver exposes
    the notion of an IRQ domain for Message-Signaled Interrupts (MSI) from
    PCI Express devices. This patch exposes the functions which are
    necessary for creating a MSI IRQ domain within a module.

    [ tglx: Split it into x86 and core irq parts ]

    Signed-off-by: Jake Oshins
    Cc: gregkh@linuxfoundation.org
    Cc: kys@microsoft.com
    Cc: devel@linuxdriverproject.org
    Cc: olaf@aepfle.de
    Cc: apw@canonical.com
    Cc: vkuznets@redhat.com
    Cc: haiyangz@microsoft.com
    Cc: marc.zyngier@arm.com
    Cc: bhelgaas@google.com
    Link: http://lkml.kernel.org/r/1449769983-12948-4-git-send-email-jakeo@microsoft.com
    Signed-off-by: Thomas Gleixner

    Jake Oshins
     

19 Dec, 2015

1 commit


16 Dec, 2015

3 commits


14 Dec, 2015

2 commits

  • The new VMD device driver needs to iterate over a list of
    "demultiplexing" interrupts. Protecting that list with a lock is not
    possible because the list is also required in code pathes which hold
    irq descriptor lock. Therefor the demultiplexing interrupt handler
    would create a lock inversion scenario if it calls a demux handler
    with the list protection lock held.

    A solution for this is to free the irq descriptor via RCU, so the
    list can be walked with rcu read lock held.

    Signed-off-by: Thomas Gleixner
    Cc: Keith Busch

    Thomas Gleixner
     
  • If a interrupt chip utilizes chip->buslock then free_irq() can
    deadlock in the following way:

    CPU0 CPU1
    interrupt(X) (Shared or spurious)
    free_irq(X) interrupt_thread(X)
    chip_bus_lock(X)
    irq_finalize_oneshot(X)
    chip_bus_lock(X)
    synchronize_irq(X)

    synchronize_irq() waits for the interrupt thread to complete,
    i.e. forever.

    Solution is simple: Drop chip_bus_lock() before calling
    synchronize_irq() as we do with the irq_desc lock. There is nothing to
    be protected after the point where irq_desc lock has been released.

    This adds chip_bus_lock/unlock() to the remove_irq() code path, but
    that's actually correct in the case where remove_irq() is called on
    such an interrupt. The current users of remove_irq() are not affected
    as none of those interrupts is on a chip which requires buslock.

    Reported-by: Fredrik Markström
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org

    Thomas Gleixner
     

08 Dec, 2015

1 commit

  • Certain interrupt controller drivers have a register set that does not
    make it easy to save/restore the mask of enabled/disabled interrupts
    at suspend/resume time. At resume time, such drivers rely on the core
    kernel irq subsystem to tell whether such or such interrupt is enabled
    or not, in order to restore the proper state in the interrupt
    controller register.

    While the irqd_irq_disabled() provides the relevant information for
    global interrupts, there is no similar function to query the
    enabled/disabled state of a per-CPU interrupt.

    Therefore, this commit complements the percpu_irq API with an
    irq_percpu_is_enabled() function.

    [ tglx: Simplified the implementation and added kerneldoc ]

    Signed-off-by: Thomas Petazzoni
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Tawfik Bayouk
    Cc: Nadav Haklai
    Cc: Lior Amsalem
    Cc: Andrew Lunn
    Cc: Sebastian Hesselbarth
    Cc: Gregory Clement
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1445347435-2333-2-git-send-email-thomas.petazzoni@free-electrons.com
    Signed-off-by: Thomas Gleixner

    Thomas Petazzoni