24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

27 Jul, 2020

1 commit

  • The sparse tool complains as follows:

    drivers/irqchip/irq-mips-gic.c:49:1: warning:
    symbol '__pcpu_scope_pcpu_masks' was not declared. Should it be static?
    drivers/irqchip/irq-mips-gic.c:620:6: warning:
    symbol 'gic_ipi_domain_free' was not declared. Should it be static?
    drivers/irqchip/irq-mips-gic.c:634:5: warning:
    symbol 'gic_ipi_domain_match' was not declared. Should it be static?

    Those symbols are not used outside of irq-mips-gic.c, so marks
    them static.

    Reported-by: Hulk Robot
    Signed-off-by: Wei Yongjun
    Signed-off-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20200714142245.16124-1-weiyongjun1@huawei.com

    Wei Yongjun
     

06 Jan, 2020

1 commit


05 Jun, 2019

1 commit

  • The MIPS GIC contains a block of registers used to map local interrupts
    to a particular CPU interrupt pin. Since these registers are found at a
    consecutive range of addresses we access them using an index, via the
    (read|write)_gic_v[lo]_map accessor functions. We currently use values
    from enum mips_gic_local_interrupt as those indices.

    Unfortunately whilst enum mips_gic_local_interrupt provides the correct
    offsets for bits in the pending & mask registers, the ordering of the
    map registers is subtly different... Compared with the ordering of
    pending & mask bits, the map registers move the FDC from the end of the
    list to index 3 after the timer interrupt. As a result the performance
    counter & software interrupts are therefore at indices 4-6 rather than
    indices 3-5.

    Notably this causes problems with performance counter interrupts being
    incorrectly mapped on some systems, and presumably will also cause
    problems for FDC interrupts.

    Introduce a function to map from enum mips_gic_local_interrupt to the
    index of the corresponding map register, and use it to ensure we access
    the map registers for the correct interrupts.

    Signed-off-by: Paul Burton
    Fixes: a0dc5cb5e31b ("irqchip: mips-gic: Simplify gic_local_irq_domain_map()")
    Fixes: da61fcf9d62a ("irqchip: mips-gic: Use irq_cpu_online to (un)mask all-VP(E) IRQs")
    Reported-and-tested-by: Archer Yan
    Cc: Thomas Gleixner
    Cc: Jason Cooper
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Marc Zyngier

    Paul Burton
     

16 Feb, 2018

1 commit

  • Commit 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading
    GIC_SH_MASK*") removed the read of the hardware mask register when
    handling shared interrupts, instead using the driver's shadow pcpu_masks
    entry as the effective mask. Unfortunately this did not take account of
    the write to pcpu_masks during gic_shared_irq_domain_map, which
    effectively unmasks the interrupt early. If an interrupt is asserted,
    gic_handle_shared_int decodes and processes the interrupt even though it
    has not yet been unmasked via gic_unmask_irq, which also sets the
    appropriate bit in pcpu_masks.

    On the MIPS Boston board, when a console command line of
    "console=ttyS0,115200n8r" is passed, the modem status IRQ is enabled in
    the UART, which is immediately raised to the GIC. The interrupt has been
    mapped, but no handler has yet been registered, nor is it expected to be
    unmasked. However, the write to pcpu_masks in gic_shared_irq_domain_map
    has effectively unmasked it, resulting in endless reports of:

    [ 5.058454] irq 13, desc: ffffffff80a7ad80, depth: 1, count: 0, unhandled: 0
    [ 5.062057] ->handle_irq(): ffffffff801b1838,
    [ 5.062175] handle_bad_irq+0x0/0x2c0

    Where IRQ 13 is the UART interrupt.

    To fix this, just remove the write to pcpu_masks in
    gic_shared_irq_domain_map. The existing write in gic_unmask_irq is the
    correct place for what is now the effective unmasking.

    Cc: stable@vger.kernel.org
    Fixes: 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*")
    Signed-off-by: Matt Redfearn
    Reviewed-by: Paul Burton
    Signed-off-by: Marc Zyngier

    Matt Redfearn
     

09 Nov, 2017

2 commits

  • If the physical address of the GIC resource cannot be read from device
    tree, then the code falls back to reading it from the gcr_gic_base
    register. Hopefully this has been set to a sane value by the bootloader
    or some platform code, but is defined by the hardware manual to have
    "undefined" reset state. Using it as the address at which the GIC will
    be mapped into physical memory space can therefore be risky if it has
    not been initialised, since it may result in the GIC being mapped to an
    effectively random address anywhere in physical memory, where it might
    conflict with peripherals or RAM and lead to weird crashes.

    Since a "sane value" is very platform specific because it is particular
    to the platform's memory map, it is difficult to test for. At the very
    least, a warning message should be printed in the case that we trust the
    inherited value.

    Reported-by: Amit Kama
    Signed-off-by: Matt Redfearn
    Reviewed-by: Paul Burton
    Signed-off-by: Marc Zyngier

    Matt Redfearn
     
  • Several messages from the MIPS GIC driver include the text "GIC", but
    the format is not standard. Add a pr_fmt of "irq-mips-gic: " and reword
    the messages now that they will be prefixed with the driver name.

    Signed-off-by: Matt Redfearn
    Reviewed-by: Paul Burton
    Signed-off-by: Marc Zyngier

    Matt Redfearn
     

02 Nov, 2017

8 commits

  • We have 2 bitmaps used to keep track of interrupts dedicated to IPIs in
    the MIPS GIC irqchip driver. These bitmaps are only used from the one
    compilation unit of that driver, and so can be made static. Do so in
    order to avoid polluting the symbol table & global namespace.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • The gic_set_type() function included writes to the MIPS GIC polarity,
    trigger & dual-trigger registers in each case of a switch statement
    determining the IRQs type. This is all well & good when we only have a
    single cluster & thus a single GIC whose register we want to update. It
    will lead to significant duplication once we have multi-cluster support
    & multiple GICs to update.

    Refactor this such that we determine values for the polarity, trigger &
    dual-trigger registers and then have a single set of register writes
    following the switch statement. This will allow us to write the same
    values to each GIC in a multi-cluster system in a later patch, rather
    than needing to duplicate more register writes in each case.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • Following the past few patches nothing uses the gic_vpes variable any
    longer. Remove the dead code.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • Reserving a number of IPIs based upon the number of VPs reported by the
    GIC makes little sense for a few reasons:

    - The kernel may have been configured with NR_CPUS less than the number
    of VPs in the cluster, in which case using gic_vpes causes us to
    reserve more interrupts for IPIs than we will possibly use.

    - If a kernel is configured without support for multi-threading & runs
    on a system with multi-threading & multiple VPs per core then we'll
    similarly reserve more interrupts for IPIs than we will possibly use.

    - In systems with multiple clusters the GIC can only provide us with
    the number of VPs in its cluster, not across all clusters. In this
    case we'll reserve fewer interrupts for IPIs than we need.

    Fix these issues by using num_possible_cpus() instead, which in all
    cases is actually indicative of how many IPIs we may need.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • Rather than configuring EIC mode for all CPUs during boot, configure it
    locally on each when they come online. This will become important with
    multi-cluster support, since clusters may be powered on & off (for
    example via hotplug) and would lose the EIC configuration when powered
    off.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • We currently walk through the range 0..gic_vpes-1, expecting these
    values all to be valid Linux CPU numbers to provide to mips_cm_vp_id(),
    and masking all routable local interrupts during boot. This approach has
    a few drawbacks:

    - In multi-cluster systems we won't have access to all CPU's GIC local
    registers when the driver is probed, since clusters (and their GICs)
    may be powered down at this point & only brought online later.

    - In multi-cluster systems we may power down clusters at runtime, for
    example if we offline all CPUs within it via hotplug, and the
    cluster's GIC may lose state. We therefore need to reinitialise it
    when powering back up, which this approach does not take into
    account.

    - The range 0..gic_vpes-1 may not all be valid Linux CPU numbers, for
    example if we run a kernel configured to support fewer CPUs than the
    system it is running on actually has. In this case we'll get garbage
    values from mips_cm_vp_id() as we read past the end of the cpu_data
    array.

    Fix this and simplify the code somewhat by writing an all-bits-set
    value to the VP-local reset mask register when a CPU is brought online,
    before any local interrupts are configured for it. This removes the need
    for us to access all CPUs during driver probe, removing all of the
    problems described above.

    In the name of simplicity we drop the checks for routability of
    interrupts and simply clear the mask bits for all interrupts. Bits for
    non-routable local interrupts will have no effect so there's no point
    performing extra work to avoid modifying them.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • The gic_all_vpes_local_irq_controller chip currently attempts to operate
    on all CPUs/VPs in the system when masking or unmasking an interrupt.
    This has a few drawbacks:

    - In multi-cluster systems we may not always have access to all CPUs in
    the system. When all CPUs in a cluster are powered down that
    cluster's GIC may also power down, in which case we cannot configure
    its state.

    - Relatedly, if we power down a cluster after having configured
    interrupts for CPUs within it then the cluster's GIC may lose state &
    we need to reconfigure it. The current approach doesn't take this
    into account.

    - It's wasteful if we run Linux on fewer VPs than are present in the
    system. For example if we run a uniprocessor kernel on CPU0 of a
    system with 16 CPUs then there's no point in us configuring CPUs
    1-15.

    - The implementation is also lacking in that it expects the range
    0..gic_vpes-1 to represent valid Linux CPU numbers which may not
    always be the case - for example if we run on a system with more VPs
    than the kernel is configured to support.

    Fix all of these issues by only configuring the affected interrupts for
    CPUs which are online at the time, and recording the configuration in a
    new struct gic_all_vpes_chip_data for later use by CPUs being brought
    online. We register a CPU hotplug state (reusing
    CPUHP_AP_IRQ_GIC_STARTING which the ARM GIC driver uses, and which seems
    suitably generic for reuse with the MIPS GIC) and execute
    irq_cpu_online() in order to configure the interrupts on the newly
    onlined CPU.

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     
  • The gic_local_irq_domain_map() function has only one callsite in
    gic_irq_domain_map(), and the split between the two functions makes it
    unclear that they duplicate calculations & checks.

    Inline gic_local_irq_domain_map() into gic_irq_domain_map() in order to
    clean this up. Doing this makes the following small issues obvious, and
    the patch tidies them up:

    - Both functions used GIC_HWIRQ_TO_LOCAL() to convert a hwirq number to
    a local IRQ number. We now only do this once. Although the compiler
    ought to have optimised this away before anyway, the change leaves us
    with less duplicate code.

    - gic_local_irq_domain_map() had a check for invalid local interrupt
    numbers (intr > GIC_LOCAL_INT_FDC). This condition can never occur
    because any hwirq higher than those used for local interrupts is a
    shared interrupt, which gic_irq_domain_map() already handles
    separately. We therefore remove this check.

    - The decision of whether to map the interrupt to gic_cpu_pin or
    timer_cpu_pin can be handled within the existing switch statement in
    gic_irq_domain_map(), shortening the code a little.

    The change additionally prepares us nicely for the following patch of
    the series which would otherwise need to duplicate the check for whether
    a local interrupt should be percpu_devid or just percpu (ie. the switch
    statement from gic_irq_domain_map()) in gic_local_irq_domain_map().

    Signed-off-by: Paul Burton
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     

26 Sep, 2017

2 commits

  • Commit 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading
    GIC_SH_MASK*") adjusted the way we handle masking interrupts to set &
    clear the interrupt's bit in each pcpu_mask. This allows us to avoid
    needing to read the GIC mask registers and perform a bitwise and of
    their values with the pending & pcpu_masks.

    Unfortunately this didn't quite work for IPIs, which were mapped to a
    particular CPU/VP during initialisation but never set the affinity or
    effective_affinity fields of their struct irq_desc. This led to them
    losing their affinity when gic_unmask_irq() was called for them, and
    they'd all become affine to cpu0.

    Fix this by:

    1) Setting the effective affinity of interrupts in
    gic_shared_irq_domain_map(), which is where we actually map an
    interrupt to a CPU/VP. This ensures that the effective affinity mask
    is always valid, not just after explicitly setting affinity.

    2) Using an interrupt's effective affinity when unmasking it, which
    prevents gic_unmask_irq() from unintentionally changing which
    pcpu_mask includes an interrupt.

    Fixes: 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*")
    Signed-off-by: Paul Burton
    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Cc: Jason Cooper
    Link: https://lkml.kernel.org/r/20170922062440.23701-3-paul.burton@imgtec.com

    Paul Burton
     
  • The MIPS GIC driver is incorrectly using __fls to shift registers,
    intending to shift to the least significant bit of a value based upon
    its mask but instead shifting off all but the value's top bit. It should
    actually be using __ffs to shift to the first, not last, bit of the
    value.

    Apparently the system I used when testing commit 3680746abd87
    ("irqchip: mips-gic: Convert remaining shared reg access to new
    accessors") and commit b2b2e584ceab ("irqchip: mips-gic: Clean up mti,
    reserved-cpu-vectors handling") managed to work correctly despite this
    issue, but not all systems do...

    Fixes: 3680746abd87 ("irqchip: mips-gic: Convert remaining shared reg access to new accessors")
    Fixes: b2b2e584ceab ("irqchip: mips-gic: Clean up mti, reserved-cpu-vectors handling")
    Signed-off-by: Paul Burton
    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Cc: Jason Cooper
    Link: https://lkml.kernel.org/r/20170922062440.23701-2-paul.burton@imgtec.com

    Paul Burton
     

20 Sep, 2017

1 commit

  • The write_gic_smask() & write_gic_rmask() functions take a shared
    interrupt number as a parameter, but we're incorrectly providing them a
    bitmask with the shared interrupt's bit set. This effectively means that
    we mask or unmask the shared interrupt 1<
    Fixes: 68898c8765f4 ("irqchip: mips-gic: Drop gic_(re)set_mask() functions")
    Cc: Jason Cooper
    Cc: Marc Zyngier
    Cc: Ralf Baechle
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Marc Zyngier

    Paul Burton
     

16 Sep, 2017

1 commit

  • Pull MIPS updates from Ralf Baechle:
    "This is the main pull request for 4.14 for MIPS; below a summary of
    the non-merge commits:

    CM:
    - Rename mips_cm_base to mips_gcr_base
    - Specify register size when generating accessors
    - Use BIT/GENMASK for register fields, order & drop shifts
    - Add cluster & block args to mips_cm_lock_other()

    CPC:
    - Use common CPS accessor generation macros
    - Use BIT/GENMASK for register fields, order & drop shifts
    - Introduce register modify (set/clear/change) accessors
    - Use change_*, set_* & clear_* where appropriate
    - Add CM/CPC 3.5 register definitions
    - Use GlobalNumber macros rather than magic numbers
    - Have asm/mips-cps.h include CM & CPC headers
    - Cluster support for topology functions
    - Detect CPUs in secondary clusters

    CPS:
    - Read GIC_VL_IDENT directly, not via irqchip driver

    DMA:
    - Consolidate coherent and non-coherent dma_alloc code
    - Don't use dma_cache_sync to implement fd_cacheflush

    FPU emulation / FP assist code:
    - Another series of 14 commits fixing corner cases such as NaN
    propgagation and other special input values.
    - Zero bits 32-63 of the result for a CLASS.D instruction.
    - Enhanced statics via debugfs
    - Do not use bools for arithmetic. GCC 7.1 moans about this.
    - Correct user fault_addr type

    Generic MIPS:
    - Enhancement of stack backtraces
    - Cleanup from non-existing options
    - Handle non word sized instructions when examining frame
    - Fix detection and decoding of ADDIUSP instruction
    - Fix decoding of SWSP16 instruction
    - Refactor handling of stack pointer in get_frame_info
    - Remove unreachable code from force_fcr31_sig()
    - Convert to using %pOF instead of full_name
    - Remove the R6000 support.
    - Move FP code from *_switch.S to *_fpu.S
    - Remove unused ST_OFF from r2300_switch.S
    - Allow platform to specify multiple its.S files
    - Add #includes to various files to ensure code builds reliable and
    without warning..
    - Remove __invalidate_kernel_vmap_range
    - Remove plat_timer_setup
    - Declare various variables & functions static
    - Abstract CPU core & VP(E) ID access through accessor functions
    - Store core & VP IDs in GlobalNumber-style variable
    - Unify checks for sibling CPUs
    - Add CPU cluster number accessors
    - Prevent direct use of generic_defconfig
    - Make CONFIG_MIPS_MT_SMP default y
    - Add __ioread64_copy
    - Remove unnecessary inclusions of linux/irqchip/mips-gic.h

    GIC:
    - Introduce asm/mips-gic.h with accessor functions
    - Use new GIC accessor functions in mips-gic-timer
    - Remove counter access functions from irq-mips-gic.c
    - Remove gic_read_local_vp_id() from irq-mips-gic.c
    - Simplify shared interrupt pending/mask reads in irq-mips-gic.c
    - Simplify gic_local_irq_domain_map() in irq-mips-gic.c
    - Drop gic_(re)set_mask() functions in irq-mips-gic.c
    - Remove gic_set_polarity(), gic_set_trigger(), gic_set_dual_edge(),
    gic_map_to_pin() and gic_map_to_vpe() from irq-mips-gic.c.
    - Convert remaining shared reg access, local int mask access and
    remaining local reg access to new accessors
    - Move GIC_LOCAL_INT_* to asm/mips-gic.h
    - Remove GIC_CPU_INT* macros from irq-mips-gic.c
    - Move various definitions to the driver
    - Remove gic_get_usm_range()
    - Remove __gic_irq_dispatch() forward declaration
    - Remove gic_init()
    - Use mips_gic_present() in place of gic_present and remove
    gic_present
    - Move gic_get_c0_*_int() to asm/mips-gic.h
    - Remove linux/irqchip/mips-gic.h
    - Inline __gic_init()
    - Inline gic_basic_init()
    - Make pcpu_masks a per-cpu variable
    - Use pcpu_masks to avoid reading GIC_SH_MASK*
    - Clean up mti, reserved-cpu-vectors handling
    - Use cpumask_first_and() in gic_set_affinity()
    - Let the core set struct irq_common_data affinity

    microMIPS:
    - Fix microMIPS stack unwinding on big endian systems

    MIPS-GIC:
    - SYNC after enabling GIC region

    NUMA:
    - Remove the unused parent_node() macro

    R6:
    - Constify r2_decoder_tables
    - Add accessor & bit definitions for GlobalNumber

    SMP:
    - Constify smp ops
    - Allow boot_secondary SMP op to return errors

    VDSO:
    - Drop gic_get_usm_range() usage
    - Avoid use of linux/irqchip/mips-gic.h

    Platform changes:

    Alchemy:
    - Add devboard machine type to cpuinfo
    - update cpu feature overrides
    - Threaded carddetect irqs for devboards

    AR7:
    - allow NULL clock for clk_get_rate

    BCM63xx:
    - Fix ENETDMA_6345_MAXBURST_REG offset
    - Allow NULL clock for clk_get_rate

    CI20:
    - Enable GPIO and RTC drivers in defconfig
    - Add ethernet and fixed-regulator nodes to DTS

    Generic platform:
    - Move Boston and NI 169445 FIT image source to their own files
    - Include asm/bootinfo.h for plat_fdt_relocated()
    - Include asm/time.h for get_c0_*_int()
    - Include asm/bootinfo.h for plat_fdt_relocated()
    - Include asm/time.h for get_c0_*_int()
    - Allow filtering enabled boards by requirements
    - Don't explicitly disable CONFIG_USB_SUPPORT
    - Bump default NR_CPUS to 16

    JZ4700:
    - Probe the jz4740-rtc driver from devicetree

    Lantiq:
    - Drop check of boot select from the spi-falcon driver.
    - Drop check of boot select from the lantiq-flash MTD driver.
    - Access boot cause register in the watchdog driver through regmap
    - Add device tree binding documentation for the watchdog driver
    - Add docs for the RCU DT bindings.
    - Convert the fpi bus driver to a platform_driver
    - Remove ltq_reset_cause() and ltq_boot_select(
    - Switch to a proper reset driver
    - Switch to a new drivers/soc GPHY driver
    - Add an USB PHY driver for the Lantiq SoCs using the RCU module
    - Use of_platform_default_populate instead of __dt_register_buses
    - Enable MFD_SYSCON to be able to use it for the RCU MFD
    - Replace ltq_boot_select() with dummy implementation.

    Loongson 2F:
    - Allow NULL clock for clk_get_rate

    Malta:
    - Use new GIC accessor functions

    NI 169445:
    - Add support for NI 169445 board.
    - Only include in 32r2el kernels

    Octeon:
    - Add support for watchdog of 78XX SOCs.
    - Add support for watchdog of CN68XX SOCs.
    - Expose support for mips32r1, mips32r2 and mips64r1
    - Enable more drivers in config file
    - Add support for accessing the boot vector.
    - Remove old boot vector code from watchdog driver
    - Define watchdog registers for 70xx, 73xx, 78xx, F75xx.
    - Make CSR functions node aware.
    - Allow access to CIU3 IRQ domains.
    - Misc cleanups in the watchdog driver

    Omega2+:
    - New board, add support and defconfig

    Pistachio:
    - Enable Root FS on NFS in defconfig

    Ralink:
    - Add Mediatek MT7628A SoC
    - Allow NULL clock for clk_get_rate
    - Explicitly request exclusive reset control in the pci-mt7620 PCI driver.

    SEAD3:
    - Only include in 32 bit kernels by default

    VoCore:
    - Add VoCore as a vendor t0 dt-bindings
    - Add defconfig file"

    * '4.14-features' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (167 commits)
    MIPS: Refactor handling of stack pointer in get_frame_info
    MIPS: Stacktrace: Fix microMIPS stack unwinding on big endian systems
    MIPS: microMIPS: Fix decoding of swsp16 instruction
    MIPS: microMIPS: Fix decoding of addiusp instruction
    MIPS: microMIPS: Fix detection of addiusp instruction
    MIPS: Handle non word sized instructions when examining frame
    MIPS: ralink: allow NULL clock for clk_get_rate
    MIPS: Loongson 2F: allow NULL clock for clk_get_rate
    MIPS: BCM63XX: allow NULL clock for clk_get_rate
    MIPS: AR7: allow NULL clock for clk_get_rate
    MIPS: BCM63XX: fix ENETDMA_6345_MAXBURST_REG offset
    mips: Save all registers when saving the frame
    MIPS: Add DWARF unwinding to assembly
    MIPS: Make SAVE_SOME more standard
    MIPS: Fix issues in backtraces
    MIPS: jz4780: DTS: Probe the jz4740-rtc driver from devicetree
    MIPS: Ci20: Enable RTC driver
    watchdog: octeon-wdt: Add support for 78XX SOCs.
    watchdog: octeon-wdt: Add support for cn68XX SOCs.
    watchdog: octeon-wdt: File cleaning.
    ...

    Linus Torvalds
     

05 Sep, 2017

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The interrupt subsystem delivers this time:

    - Refactoring of the GIC-V3 driver to prepare for the GIC-V4 support

    - Initial GIC-V4 support

    - Consolidation of the FSL MSI support

    - Utilize the effective affinity interface in various ARM irqchip
    drivers

    - Yet another interrupt chip driver (UniPhier AIDET)

    - Bulk conversion of the irq chip driver to use %pOF

    - The usual small fixes and improvements all over the place"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (77 commits)
    irqchip/ls-scfg-msi: Add MSI affinity support
    irqchip/ls-scfg-msi: Add LS1043a v1.1 MSI support
    irqchip/ls-scfg-msi: Add LS1046a MSI support
    arm64: dts: ls1046a: Add MSI dts node
    arm64: dts: ls1043a: Share all MSIs
    arm: dts: ls1021a: Share all MSIs
    arm64: dts: ls1043a: Fix typo of MSI compatible string
    arm: dts: ls1021a: Fix typo of MSI compatible string
    irqchip/ls-scfg-msi: Fix typo of MSI compatible strings
    irqchip/irq-bcm7120-l2: Use correct I/O accessors for irq_fwd_mask
    irqchip/mmp: Make mmp_intc_conf const
    irqchip/gic: Make irq_chip const
    irqchip/gic-v3: Advertise GICv4 support to KVM
    irqchip/gic-v4: Enable low-level GICv4 operations
    irqchip/gic-v4: Add some basic documentation
    irqchip/gic-v4: Add VLPI configuration interface
    irqchip/gic-v4: Add VPE command interface
    irqchip/gic-v4: Add per-VM VPE domain creation
    irqchip/gic-v3-its: Set implementation defined bit to enable VLPIs
    irqchip/gic-v3-its: Allow doorbell interrupts to be injected/cleared
    ...

    Linus Torvalds
     

04 Sep, 2017

20 commits

  • gic_set_affinity() manually copies the provided cpumask to the struct
    irq_common_data affinity field, returning IRQ_SET_MASK_OK_NOCOPY in
    order to prevent the core code from doing that.

    We can instead simply let the core code do it for us, by returning
    IRQ_SET_MASK_OK instead of IRQ_SET_MASK_OK_NOCOPY & doing the copy
    ourselves.

    [ralf@linux-mips.org: Resolve merge conflict.]

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17056/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Currently in gic_set_affinity() we calculate a temporary cpumask holding
    the intersection of the provided cpumask & the CPUs that are online,
    then we call cpumask_first twice on it to find the first such CPU. Since
    we don't need the temporary cpumask for anything else & we only care
    about the first CPU that's both online & in the provided cpumask, we can
    instead use cpumask_first_and to find that CPU & drop the temporary
    mask.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17110/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • When parsing mti,reserved-cpu-vectors we generate a mask of all bits
    that have been declared reserved, the loop through starting from bit 2
    to find one that isn't reserved (ie. is zero).

    This patch accomplishes the same task more simply by:

    - Inititialising the reserved mask to 0x3 (ie. the 2 software
    interrupts). This means we don't need to skip them later as the loop
    previously has.

    - Replacing the loop checking for zero bits with find_first_zero_bit,
    which fits our needs now that the 2 software interrupts are marked
    reserved. This requires that the type of reserved is changed to
    unsigned long so that it's suitable for use with bitmap functions.

    - Replacing the magic number 8 with the hamming weight of the ST0_IM
    field - ie. the number of bits that a MIPS CPU has for interrupt
    inputs. This is still a compile-time constant 8, but makes it
    clearer why it's 8.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17054/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • This patch avoids the need to read the GIC_SH_MASK* registers when
    decoding shared interrupts by setting & clearing the interrupt's bit in
    the appropriate CPU's pcpu_masks entry when masking or unmasking the
    interrupt.

    This effectively means that whilst an interrupt is masked we clear its
    bit in all pcpu_masks, which causes gic_handle_shared_int() to ignore it
    on all CPUs without needing to check GIC_SH_MASK*.

    In essence, we add a little overhead to masking or unmasking interrupts
    but in return reduce the overhead of the far more common task of
    decoding interrupts.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17109/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Define the pcpu_masks variable using the kernel's standard per-cpu
    variable support, rather than an open-coded array of structs containing
    bitmaps.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17052/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • gic_basic_init() is now a fairly short function that is only called in
    one place. Inline it into gic_of_init() to help readability.

    [ralf@linux-mips.org: Resolved conflict.]

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17051/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • The __gic_init() function is only called from gic_of_init() now that the
    non-DT path has been removed. In order to simplify the code & aid
    readability, fold __gic_init() into gic_of_init().

    This provides us with the ability to return an error code, which
    __gic_init() was previously unable to do. As such the irq_domain_add_*()
    error paths are modified to print & return an error rather than panic().

    [ralf@linux-mips.org: Resoled reject.]

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17050/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • The linux/irqchip/mips-gic.h header is now almost empty. Move the
    declarations of gic_get_c0_compare_int(), gic_get_c0_perfcount_int() &
    gic_get_c0_fdc_int() to asm/mips-gic.h in order to close in on being
    able to delete the former header.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17046/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Nothing uses the global gic_present variable anymore; mips_gic_present()
    should be used instead. Remove the dead code.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17045/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • All in-tree platforms now probe the GIC driver using device tree, and as
    such nothing calls gic_init() any longer. Remove the dead code.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17043/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • We provide a forward declaration of the __gic_irq_dispatch() function
    for no apparent reason. Remove it.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17042/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • The MIPS VDSO code is no longer reliant upon the irqchip driver to
    provide the address of the GIC's user-visible section via
    gic_get_usm_range(). Remove the now-dead code.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17041/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Move the definitions of macros used to convert between hardware IRQ
    numbers & shared or local interrupt numbers into the irqchip driver,
    which is all that should ever need to care about them.

    Remove GIC_CPU_TO_VEC_OFFSET() in the process since it's never used.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17039/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Convert the remaining accesses to registers in the GIC VP-local &
    VP-other register blocks to use the new accessor functions provided by
    asm/mips-gic.h, resulting in code which is often shorter & easier to
    read.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17036/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Use the new accessor functions provided by asm/mips-gic.h to access
    masks controlling local interrupts, resulting in code which is often
    shorter & easier to read.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17035/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Convert the remaining accesses to registers in the GIC shared register
    block to use the new accessor functions provided by asm/mips-gic.h,
    resulting in code which is often shorter & easier to read.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17034/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Remove the gic_map_to_vpe() function in favour of using the new
    write_gic_map_vp() accessor function which isn't any more complex to
    use & allows us to drop a level of abstraction.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17033/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Remove the gic_map_to_pin() function in favour of using the new
    write_gic_map_pin() accessor function which isn't any more complex to
    use & allows us to drop a level of abstraction.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17032/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Remove the gic_set_dual_edge() function in favour of using the new
    change_gic_dual() accessor function which provides equivalent
    functionality. This also allows us to remove the gic_update_bits()
    function which gic_set_dual_edge() was the last user of, along with the
    GIC_INTR_OFS() & GIC_INTR_BIT() macros.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17031/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • Remove the gic_set_trigger() function in favour of using the new
    change_gic_trig() accessor function which provides equivalent
    functionality.

    Signed-off-by: Paul Burton
    Acked-by: Marc Zyngier
    Cc: Jason Cooper
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/17030/
    Signed-off-by: Ralf Baechle

    Paul Burton