23 Oct, 2015

1 commit

  • commit fc2ca674470bbfe11d72a20a3f19fd3dc43bfca0 upstream.

    Commit 3adeb2566b9b ("MIPS: Loongson: Improve LEFI firmware interface")
    made the number of UARTs dynamic if LEFI_FIRMWARE_INTERFACE is configured.
    Unfortunately, it did not initialize the number of UARTs if
    LEFI_FIRMWARE_INTERFACE is not configured. As a result, the Fulong2e
    system has no console.

    Fixes: 3adeb2566b9b ("MIPS: Loongson: Improve LEFI firmware interface")
    Acked-by: Huacai Chen
    Signed-off-by: Guenter Roeck
    Tested-by: Markos Chandras
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/11076/
    Signed-off-by: Ralf Baechle
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

10 Jun, 2015

1 commit

  • If CONFIG_SERIAL_8250 is set to m, the Loongson seria.ko module might get
    unloaded while the serial driver modules are still loaded resulting in
    stale references to the destroyed platform_device instance.

    Anyway, platform devices should always be registered indicated what
    devices are present, _not_ what drivers have been configured.

    Signed-off-by: Ralf Baechle
    Reported-by: Paul Gortmaker
    Patchwork: https://patchwork.linux-mips.org/patch/10538/

    Ralf Baechle
     

06 Jun, 2015

1 commit

  • setup_per_cpu_areas() only setup __per_cpu_offset[] for each possible
    cpu, but loongson_sysconf.nr_cpus can be greater than possible cpus
    (due to reserved_cpus_mask). So in loongson3_ipi_interrupt(), percpu
    access will touch the original varible in .data..percpu section which
    has been freed. Without this patch, cpu-hotplug will cause memery
    corruption.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: http://patchwork.linux-mips.org/patch/10524/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     

21 Apr, 2015

1 commit

  • Pull final removal of deprecated cpus_* cpumask functions from Rusty Russell:
    "This is the final removal (after several years!) of the obsolete
    cpus_* functions, prompted by their mis-use in staging.

    With these function removed, all cpu functions should only iterate to
    nr_cpu_ids, so we finally only allocate that many bits when cpumasks
    are allocated offstack"

    * tag 'cpumask-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (25 commits)
    cpumask: remove __first_cpu / __next_cpu
    cpumask: resurrect CPU_MASK_CPU0
    linux/cpumask.h: add typechecking to cpumask_test_cpu
    cpumask: only allocate nr_cpumask_bits.
    Fix weird uses of num_online_cpus().
    cpumask: remove deprecated functions.
    mips: fix obsolete cpumask_of_cpu usage.
    x86: fix more deprecated cpu function usage.
    ia64: remove deprecated cpus_ usage.
    powerpc: fix deprecated CPU_MASK_CPU0 usage.
    CPU_MASK_ALL/CPU_MASK_NONE: remove from deprecated region.
    staging/lustre/o2iblnd: Don't use cpus_weight
    staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_
    staging/lustre/ptlrpc: Do not use deprecated cpus_* functions
    blackfin: fix up obsolete cpu function usage.
    parisc: fix up obsolete cpu function usage.
    tile: fix up obsolete cpu function usage.
    arm64: fix up obsolete cpu function usage.
    mips: fix up obsolete cpu function usage.
    x86: fix up obsolete cpu function usage.
    ...

    Linus Torvalds
     

18 Apr, 2015

1 commit

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

    - A new GPIO hogging mechanism has been added. This can be used on
    boards that want to drive some GPIO line high, low, or set it as
    input on boot and then never touch it again. For some embedded
    systems this is bliss and simplifies things to a great extent.

    - Some API cleanup and closure: gpiod_get_array() and
    gpiod_put_array() has been added to get and put GPIOs in bulk as
    was possible with the non-descriptor API.

    - Encapsulate cross-calls to the pin control subsystem in
    . Now this should be the only header any GPIO
    driver needs to include or something is wrong. Cleanups
    restricting drivers to this include are welcomed if tested.

    - Sort the GPIO Kconfig and split it into submenus, as it was
    becoming and unstructured, illogical and unnavigatable mess. I
    hope this is easier to follow. Menus that require a certain
    subsystem like I2C can now be hidden nicely for example, still
    working on others.

    - New drivers:

    - New driver for the Altera Soft GPIO.

    - The F7188x driver now handles the F71869 and F71869A variants.

    - The MIPS Loongson driver has been moved to drivers/gpio for
    consolidation and cleanup.

    - Cleanups:

    - The MAX732x is converted to use the GPIOLIB_IRQCHIP
    infrastructure.

    - The PCF857x is converted to use the GPIOLIB_IRQCHIP
    infrastructure.

    - Radical cleanup of the OMAP driver.

    - Misc:

    - Enable the DWAPB GPIO for all architectures. This is a "hard
    IP" block from Synopsys which has started to turn up in so
    diverse architectures as X86 Quark, ARC and a slew of ARM
    systems. So even though it's not an expander, it's generic
    enough to be available for all.

    - We add a mock GPIO on Crystalcove PMIC after a long discussion
    with Daniel Vetter et al, tracing back to the shootout at the
    kernel summit where DRM drivers and sub-componentization was
    discussed. In this case a mock GPIO is assumed to be the best
    compromise gaining some reuse of infrastructure without making
    DRM drivers overly complex at the same time. Let's see"

    * tag 'gpio-v4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (62 commits)
    Revert "gpio: sch: use uapi/linux/pci_ids.h directly"
    gpio: dwapb: remove dependencies
    gpio: dwapb: enable for ARC
    gpio: removing kfree remove functionality
    gpio: mvebu: Fix mask/unmask managment per irq chip type
    gpio: split GPIO drivers in submenus
    gpio: move MFD GPIO drivers under their own comment
    gpio: move BCM Kona Kconfig option
    gpio: arrange SPI Kconfig symbols alphabetically
    gpio: arrange PCI GPIO controllers alphabetically
    gpio: arrange I2C Kconfig symbols alphabetically
    gpio: arrange Kconfig symbols alphabetically
    gpio: ich: Implement get_direction function
    gpio: use (!foo) instead of (foo == NULL)
    gpio: arizona: drop owner assignment from platform_drivers
    gpio: max7300: remove 'ret' variable
    gpio: use devm_kzalloc
    gpio: sch: use uapi/linux/pci_ids.h directly
    gpio: x-gene: fix devm_ioremap_resource() check
    gpio: loongson: Add Loongson-3A/3B GPIO driver support
    ...

    Linus Torvalds
     

13 Apr, 2015

1 commit


08 Apr, 2015

1 commit

  • Define the central place the default FCSR value is set from, initialised
    in `cpu_probe'. Determine the FCSR mask applied to values written to
    the register with CTC1 in the full emulation mode and via ptrace(2),
    according to the ISA level of processor hardware or the writability of
    bits 31:18 if actual FPU hardware is used.

    Software may rely on FCSR bits whose functions our emulator does not
    implement, so it should not allow them to be set or software may get
    confused. For ptrace(2) it's just sanity.

    [ralf@linux-mips.org: Fixed double inclusion of .]

    Signed-off-by: Maciej W. Rozycki
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/9711/
    Signed-off-by: Ralf Baechle

    Maciej W. Rozycki
     

07 Apr, 2015

2 commits


01 Apr, 2015

3 commits

  • This add south-bridge (SB700/SB710/SB800 chipset) ACPI platform driver
    for Loongson-3. This will be used by EC (Embedded Controller, used by
    laptops) driver and STR (Suspend To RAM).

    [ralf@linux-mips.org: Fix build error if !CONFIG_CPU_LOONGSON3. Build
    doesn't like it if no obj-* variable is defined at all in a Makefile.
    Obviously this has not been tested on other platforms.]

    Signed-off-by: Huacai Chen
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/9619/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • This add CPU Hwmon (temperature sensor) platform driver for Loongson-3.

    Signed-off-by: Huacai Chen
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/9617/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • This removes the use of the IRQF_DISABLED flag
    from arch/mips/loongson/loongson-3/hpet.c

    It's a NOOP since 2.6.35.

    Signed-off-by: Michael Opdenacker
    Cc: chenhc@lemote.com
    Cc: taohl@lemote.com
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/9609/
    Signed-off-by: Ralf Baechle

    Michael Opdenacker
     

25 Mar, 2015

1 commit

  • HPET irq is routed to i8259 and then to MIPS CPU irq (cascade). After
    commit a3e6c1eff5 (MIPS: IRQ: Fix disable_irq on CPU IRQs), if without
    IRQF_NO_SUSPEND in cascade_irqaction, HPET interrupts will lost during
    suspend. The result is machine cannot be waken up.

    Signed-off-by: Huacai Chen
    Cc:
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/9528/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     

05 Mar, 2015

1 commit


12 Dec, 2014

1 commit

  • Pull MIPS updates from Ralf Baechle:
    "This is an unusually large pull request for MIPS - in parts because
    lots of patches missed the 3.18 deadline but primarily because some
    folks opened the flood gates.

    - Retire the MIPS-specific phys_t with the generic phys_addr_t.
    - Improvments for the backtrace code used by oprofile.
    - Better backtraces on SMP systems.
    - Cleanups for the Octeon platform code.
    - Cleanups and fixes for the Loongson platform code.
    - Cleanups and fixes to the firmware library.
    - Switch ATH79 platform to use the firmware library.
    - Grand overhault to the SEAD3 and Malta interrupt code.
    - Move the GIC interrupt code to drivers/irqchip
    - Lots of GIC cleanups and updates to the GIC code to use modern IRQ
    infrastructures and features of the kernel.
    - OF documentation updates for the GIC bindings
    - Move GIC clocksource driver to drivers/clocksource
    - Merge GIC clocksource driver with clockevent driver.
    - Further updates to bring the GIC clocksource driver up to date.
    - R3000 TLB code cleanups
    - Improvments to the Loongson 3 platform code.
    - Convert pr_warning to pr_warn.
    - Merge a bunch of small lantiq and ralink fixes that have been
    staged/lingering inside the openwrt tree for a while.
    - Update archhelp for IP22/IP32
    - Fix a number of issues for Loongson 1B.
    - New clocksource and clockevent driver for Loongson 1B.
    - Further work on clk handling for Loongson 1B.
    - Platform work for Broadcom BMIPS.
    - Error handling cleanups for TurboChannel.
    - Fixes and optimization to the microMIPS support.
    - Option to disable the FTLB.
    - Dump more relevant information on machine check exception
    - Change binfmt to allow arch to examine PT_*PROC headers
    - Support for new style FPU register model in O32
    - VDSO randomization.
    - BCM47xx cleanups
    - BCM47xx reimplement the way the kernel accesses NVRAM information.
    - Random cleanups
    - Add support for ATH25 platforms
    - Remove pointless locking code in some PCI platforms.
    - Some improvments to EVA support
    - Minor Alchemy cleanup"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (185 commits)
    MIPS: Add MFHC0 and MTHC0 instructions to uasm.
    MIPS: Cosmetic cleanups of page table headers.
    MIPS: Add CP0 macros for extended EntryLo registers
    MIPS: Remove now unused definition of phys_t.
    MIPS: Replace use of phys_t with phys_addr_t.
    MIPS: Replace MIPS-specific 64BIT_PHYS_ADDR with generic PHYS_ADDR_T_64BIT
    PCMCIA: Alchemy Don't select 64BIT_PHYS_ADDR in Kconfig.
    MIPS: lib: memset: Clean up some MIPS{EL,EB} ifdefery
    MIPS: iomap: Use __mem_{read,write}{b,w,l} for MMIO
    MIPS: fix indentation.
    MAINTAINERS: Add entry for BMIPS multiplatform kernel
    MIPS: Enable VDSO randomization
    MIPS: Remove a temporary hack for debugging cache flushes in SMTC configuration
    MIPS: Remove declaration of obsolete arch_init_clk_ops()
    MIPS: atomic.h: Reformat to fit in 79 columns
    MIPS: Apply `.insn' to fixup labels throughout
    MIPS: Fix microMIPS LL/SC immediate offsets
    MIPS: Kconfig: Only allow 32-bit microMIPS builds
    MIPS: signal.c: Fix an invalid cast in ISA mode bit handling
    MIPS: mm: Only build one microassembler that is suitable
    ...

    Linus Torvalds
     

24 Nov, 2014

13 commits

  • Make loongson_rtc_resources static to eliminate the following
    sparse warning:
    warning: symbol 'loongson_rtc_resources' was not declared. Should it be static?

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8529/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Add a missing include to eliminate the following sparse warnings:
    warning: symbol 'prom_init' was not declared. Should it be static?
    warning: symbol 'prom_free_prom_memory' was not declared. Should it be static?

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8531/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Make ml2f_reboot static to elimite the following sparse warning:
    warning: symbol 'ml2f_reboot' was not declared. Should it be static?

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8528/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Make internal static to eliminate the following sparse warnings:
    warning: symbol 'ip6_irqaction' was not declared. Should it be static?
    warning: symbol 'cascade_irqaction' was not declared. Should it be static?

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8527/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Add a missing include to get rid of the following sparse warning:
    warning: symbol 'plat_mem_setup' was not declared. Should it be static?

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8530/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Add a missing include to get rid of the following sparse warnings:
    warning: symbol 'cs5536_pci_conf_write4' was not declared. Should it be static?
    warning: symbol 'cs5536_pci_conf_read4' was not declared. Should it be static?

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8526/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • Fix array initializer syntax to get rid of the following sparse warnings:
    "obsolete array initializer, use C99 syntax".

    Signed-off-by: Aaro Koskinen
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/8525/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     
  • CPUFreq driver need external timer, so add hpet at first.

    In Loongson 3, only Core-0 can receive external interrupt. As a result,
    timekeeping cannot absolutely use HPET timer. We use a hybrid solution:
    Core-0 use HPET as its clock event device, but other cores still use
    MIPS; clock source is global and doesn't need interrupt, so use HPET.

    Signed-off-by: Huacai Chen
    Signed-off-by: Hongliang Tao
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/8329/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • Machtypes of Loongson-3 machines become more and more, but there are
    only small differences among different machtypes. Keeping a large table
    of machtypes is very ugly and hard to extend. We found that the major
    machtype differences are UARTs information (number of UARTs, UART IRQs,
    UART clocks, etc.), platform devices (EC, temperature sensors, fan
    controllers, etc.) and some workarounds (because of some CPU bugs or
    mainboard bugs).

    In this patch we improve the UEFI-like (LEFI) interface to make all
    Loongson-3 machines use a same machtype "generic-loongson-machine".

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/8324/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • By offering Logical->Physical core id mapping, so as to reserve some
    physical cores via mask. This allow booting from any core when core-0
    has problems. Since the maximun cores supported by Loongson-3 is 16,
    32-bit cpu_startup_core_id can be split to 16-bit cpu_startup_core_id
    and 16-bit reserved_cores_mask for compatibility.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/8323/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • The width of HT-bus is only 40-bit, but Loongson-3 has 48-bit physical
    address. This implies only node-0's memory is DMAable because high bits
    (Node ID) will lost. Fortunately, by configuring address windows in
    firmware, we can extract 2bit Node ID (bit 44~47, only bit 44~45 used
    now) from Loongson-3's 48-bit address space and embed it into 40-bit
    (bit 37~38). Every NUMA node can do DMA now (however, maximum memory of
    each node is reduced to 2^37 = 128GB).

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/8321/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • Based on the spatch

    @@
    expression e;
    @@
    - return (e);
    + return e;

    with heavy hand editing because some of the changes are either whitespace
    or identation only or result in excessivly long lines.

    Signed-off-by: Ralf Baechle

    Ralf Baechle
     
  • If SERIAL_8250 is compiled as a module, the platform specific setup
    for Loongson will be a module too, and it will not work very well.
    At least on Loongson 3 it will trigger a build failure,
    since loongson_sysconf is not exported to modules.

    Fix by making the platform specific serial code always built-in.

    Signed-off-by: Aaro Koskinen
    Reported-by: Ralf Baechle
    Cc: stable@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Cc: Huacai Chen
    Cc: Markos Chandras
    Patchwork: https://patchwork.linux-mips.org/patch/8533/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     

20 Nov, 2014

1 commit

  • export the __node_distances symbol in the loongson3 numa code to fix the
    build error:

    Building modules, stage 2.
    MODPOST 221 modules
    ERROR: "__node_distances" [drivers/block/nvme.ko] undefined!
    scripts/Makefile.modpost:90: recipe for target '__modpost' failed

    when building the kernel with:
    CONFIG_CPU_LOONGSON3=y
    CONFIG_NUMA=y
    CONFIG_BLK_DEV_NVME=m

    Signed-off-by: James Cowgill
    Cc: # v3.17+
    Reviewed-by: James Hogan
    Reviewed-by: Huacai Chen
    Cc: linux-mips@linux-mips.org
    Cc: Wei Yongjun
    Patchwork: https://patchwork.linux-mips.org/patch/8444/
    Signed-off-by: Ralf Baechle

    James Cowgill
     

23 Oct, 2014

1 commit

  • During 3.16 merge window, parts of the commit 8e8acb32960f
    (MIPS/loongson2_cpufreq: Fix CPU clock rate setting) seem to have
    been deleted probably due to a mismerge, and as a result cpufreq
    is broken again on Loongson2 boards in 3.16 and newer kernels.
    Fix by repeating the fix.

    Signed-off-by: Aaro Koskinen
    Cc: stable@vger.kernel.org # 3.16
    Cc: Rafael J. Wysocki
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/7835/
    Signed-off-by: Ralf Baechle

    Aaro Koskinen
     

15 Oct, 2014

1 commit

  • Pull percpu consistent-ops changes from Tejun Heo:
    "Way back, before the current percpu allocator was implemented, static
    and dynamic percpu memory areas were allocated and handled separately
    and had their own accessors. The distinction has been gone for many
    years now; however, the now duplicate two sets of accessors remained
    with the pointer based ones - this_cpu_*() - evolving various other
    operations over time. During the process, we also accumulated other
    inconsistent operations.

    This pull request contains Christoph's patches to clean up the
    duplicate accessor situation. __get_cpu_var() uses are replaced with
    with this_cpu_ptr() and __this_cpu_ptr() with raw_cpu_ptr().

    Unfortunately, the former sometimes is tricky thanks to C being a bit
    messy with the distinction between lvalues and pointers, which led to
    a rather ugly solution for cpumask_var_t involving the introduction of
    this_cpu_cpumask_var_ptr().

    This converts most of the uses but not all. Christoph will follow up
    with the remaining conversions in this merge window and hopefully
    remove the obsolete accessors"

    * 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (38 commits)
    irqchip: Properly fetch the per cpu offset
    percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t -fix
    ia64: sn_nodepda cannot be assigned to after this_cpu conversion. Use __this_cpu_write.
    percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t
    Revert "powerpc: Replace __get_cpu_var uses"
    percpu: Remove __this_cpu_ptr
    clocksource: Replace __this_cpu_ptr with raw_cpu_ptr
    sparc: Replace __get_cpu_var uses
    avr32: Replace __get_cpu_var with __this_cpu_write
    blackfin: Replace __get_cpu_var uses
    tile: Use this_cpu_ptr() for hardware counters
    tile: Replace __get_cpu_var uses
    powerpc: Replace __get_cpu_var uses
    alpha: Replace __get_cpu_var
    ia64: Replace __get_cpu_var uses
    s390: cio driver &__get_cpu_var replacements
    s390: Replace __get_cpu_var uses
    mips: Replace __get_cpu_var uses
    MIPS: Replace __get_cpu_var uses in FPU emulator.
    arm: Replace __this_cpu_ptr with raw_cpu_ptr
    ...

    Linus Torvalds
     

27 Aug, 2014

1 commit

  • __get_cpu_var() is used for multiple purposes in the kernel source. One of
    them is address calculation via the form &__get_cpu_var(x). This calculates
    the address for the instance of the percpu variable of the current processor
    based on an offset.

    Other use cases are for storing and retrieving data from the current
    processors percpu area. __get_cpu_var() can be used as an lvalue when
    writing data or on the right side of an assignment.

    __get_cpu_var() is defined as :

    #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))

    __get_cpu_var() always only does an address determination. However, store
    and retrieve operations could use a segment prefix (or global register on
    other platforms) to avoid the address calculation.

    this_cpu_write() and this_cpu_read() can directly take an offset into a
    percpu area and use optimized assembly code to read and write per cpu
    variables.

    This patch converts __get_cpu_var into either an explicit address
    calculation using this_cpu_ptr() or into a use of this_cpu operations that
    use the offset. Thereby address calculations are avoided and less registers
    are used when code is generated.

    At the end of the patch set all uses of __get_cpu_var have been removed so
    the macro is removed too.

    The patch set includes passes over all arches as well. Once these operations
    are used throughout then specialized macros can be defined in non -x86
    arches as well in order to optimize per cpu access by f.e. using a global
    register that may be set to the per cpu base.

    Transformations done to __get_cpu_var()

    1. Determine the address of the percpu instance of the current processor.

    DEFINE_PER_CPU(int, y);
    int *x = &__get_cpu_var(y);

    Converts to

    int *x = this_cpu_ptr(&y);

    2. Same as #1 but this time an array structure is involved.

    DEFINE_PER_CPU(int, y[20]);
    int *x = __get_cpu_var(y);

    Converts to

    int *x = this_cpu_ptr(y);

    3. Retrieve the content of the current processors instance of a per cpu
    variable.

    DEFINE_PER_CPU(int, y);
    int x = __get_cpu_var(y)

    Converts to

    int x = __this_cpu_read(y);

    4. Retrieve the content of a percpu struct

    DEFINE_PER_CPU(struct mystruct, y);
    struct mystruct x = __get_cpu_var(y);

    Converts to

    memcpy(&x, this_cpu_ptr(&y), sizeof(x));

    5. Assignment to a per cpu variable

    DEFINE_PER_CPU(int, y)
    __get_cpu_var(y) = x;

    Converts to

    __this_cpu_write(y, x);

    6. Increment/Decrement etc of a per cpu variable

    DEFINE_PER_CPU(int, y);
    __get_cpu_var(y)++

    Converts to

    __this_cpu_inc(y)

    Cc: Ralf Baechle
    Signed-off-by: Christoph Lameter
    Signed-off-by: Tejun Heo

    Christoph Lameter
     

20 Aug, 2014

1 commit

  • In preemptible kernel, only TIF_USEDFPU flag is reliable to distinguish
    whether _init_fpu()/_restore_fp() is needed. Because the value of the
    CP0_Status.CU1 isn't changed during preemption.

    V2: Fix coding style.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: Aurelien Jarno
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/7515/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     

19 Aug, 2014

1 commit


31 Jul, 2014

5 commits

  • Since this CONFIG option will be used for both Loongson-3A/3B machines,
    and not all Loongson-3 machines are produced by Lemote, we rename
    CONFIG_LEMOTE_MACH3A to CONFIG_LOONGSON_MACH3X.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: Aurelien Jarno
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/7190/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • Loongson-3 has some specific instructions (MMI/SIMD) in coprocessor 2.
    COP2 isn't independent because it share COP1 (FPU)'s registers. This
    patch enable the COP2 usage so user-space programs can use the MMI/SIMD
    instructions. When COP2 exception happens, we enable both COP1 (FPU)
    and COP2, only in this way the fp context can be saved and restored
    correctly.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: Aurelien Jarno
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/7189/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • Loongson-3B is a 8-cores processor. In general it looks like there are
    two Loongson-3A integrated in one chip: 8 cores are separated into two
    groups (two NUMA node), each node has its own local memory.

    Of course there are some differences between one Loongson-3B and two
    Loongson-3A. E.g., the base addresses of IPI registers of each node are
    not the same; Loongson-3A use ChipConfig register to enable/disable
    clock, but Loongson-3B use FreqControl register instead.

    There are two revision of Loongson-3B, the first revision is called as
    Loongson-3B1000, whose frequency is 1GHz and has a PRid 0x6306, the
    second revision is called as Loongson-3B1500, whose frequency is 1.5GHz
    and has a PRid 0x6307. Both revisions has a bug that clock cannot be
    disabled at runtime, but this will be fixed in future.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: Aurelien Jarno
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/7188/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • Multiple Loongson-3A chips can be interconnected with HT0-bus. This is
    a CC-NUMA system that every chip (node) has its own local memory and
    cache coherency is maintained by hardware. The 64-bit physical memory
    address format is as follows:

    0x-0000-YZZZ-ZZZZ-ZZZZ

    The high 16 bits should be 0, which means the real physical address
    supported by Loongson-3 is 48-bit. The "Y" bits is the base address of
    each node, which can be also considered as the node-id. The "Z" bits is
    the address offset within a node, which means every node has a 44 bits
    address space.

    Macros XPHYSADDR and MAX_PHYSMEM_BITS are modified unconditionally,
    because many other MIPS CPUs have also extended their address spaces.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: Aurelien Jarno
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/7187/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     
  • This patch is prepared for Multi-chip interconnection. Since each chip
    has a ChipConfig register, LOONGSON_CHIPCFG should be an array.

    Signed-off-by: Huacai Chen
    Cc: John Crispin
    Cc: Steven J. Hill
    Cc: Aurelien Jarno
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Patchwork: https://patchwork.linux-mips.org/patch/7185/
    Signed-off-by: Ralf Baechle

    Huacai Chen
     

10 Jun, 2014

1 commit

  • Pull MIPS updates from Ralf Baechle:
    - three fixes for 3.15 that didn't make it in time
    - limited Octeon 3 support.
    - paravirtualization support
    - improvment to platform support for Netlogix SOCs.
    - add support for powering down the Malta eval board in software
    - add many instructions to the in-kernel microassembler.
    - add support for the BPF JIT.
    - minor cleanups of the BCM47xx code.
    - large cleanup of math emu code resulting in significant code size
    reduction, better readability of the code and more accurate
    emulation.
    - improvments to the MIPS CPS code.
    - support C3 power status for the R4k count/compare clock device.
    - improvments to the GIO support for older SGI workstations.
    - increase number of supported CPUs to 256; this can be reached on
    certain embedded multithreaded ccNUMA configurations.
    - various small cleanups, updates and fixes

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (173 commits)
    MIPS: IP22/IP28: Improve GIO support
    MIPS: Octeon: Add twsi interrupt initialization for OCTEON 3XXX, 5XXX, 63XX
    DEC: Document the R4k MB ASIC mini interrupt controller
    DEC: Add self as the maintainer
    MIPS: Add microMIPS MSA support.
    MIPS: Replace calls to obsolete strict_strto call with kstrto* equivalents.
    MIPS: Replace obsolete strict_strto call with kstrto
    MIPS: BFP: Simplify code slightly.
    MIPS: Call find_vma with the mmap_sem held
    MIPS: Fix 'write_msa_##' inline macro.
    MIPS: Fix MSA toolchain support detection.
    mips: Update the email address of Geert Uytterhoeven
    MIPS: Add minimal defconfig for mips_paravirt
    MIPS: Enable build for new system 'paravirt'
    MIPS: paravirt: Add pci controller for virtio
    MIPS: Add code for new system 'paravirt'
    MIPS: Add functions for hypervisor call
    MIPS: OCTEON: Add OCTEON3 to __get_cpu_type
    MIPS: Add function get_ebase_cpunum
    MIPS: Add minimal support for OCTEON3 to c-r4k.c
    ...

    Linus Torvalds