summaryrefslogtreecommitdiff
path: root/docs/07-Linux-cpu-hotplug-howto.txt
blob: 90343eb061199239f376c825d4d768e1b007a1ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Instructions & guidelines to use Linux CPU hotplug
==================================================

A   Introduction

    This note describes how the Virtualizer software should
    be configured for use with the Linux CPU hotplug
    subsystem. It also mentions conditions that both Linux
    and the Virtualizer software should fulfil for cpu
    hotplug to work.

B   Guidelines

    A CPU hotplug operation involves migration of all tasks
    and interrupts from the CPU in question before flushing
    the relevant cache level(s) and shutting down the CPU.
    A CPU is shutdown by programming the relevant RST_HOLDx
    register in the KingFisher System Control Block (KFSCB).

    The Virtualizer software traps accesses to the KFSCB made
    by Linux to shutdown a CPU to save its HYP mode context
    and request the Secure world to save its own context. It
    then proceeds with the shutdown operation as Linux
    originally intended. The key assumption made here is that
    Linux will access the KFSCB RST_HOLDx registers only
    during a CPU hotplug operation.

    It is also assumed that its not possible to hotplug CPU0.
    Hence, Linux CPU hotplug will work only with the MPx4
    variant of the big.LITTLE FastModels. The CPU choice here
    isn't prescriptive and does not imply that CPU0 should
    always be the last man standing CPU in a hotplug capable
    system. It was chosen for simplicity.

    The Virtualizer software is built to switch the payload
    software between clusters asynchronously. There is a
    possibility of unpredictable behaviour happening if a
    cluster switch is initiated when a CPU hotplug operation
    is in progress. Hence the following two conditions need
    to be met to be able to use the Virtualizer software in
    conjunction with Linux CPU hotplug:

    1.  The Virtualizer software must be built to support
        synchronous switching by setting the ASYNC
        environment variable to FALSE prior to building it.
        For example with the tcsh shell:

        setenv ASYNC FALSE; make

    2.  Linux should invoke a cluster switch explicitly
        after ensuring that no CPU hotplug operation is in
        progress and vice versa. It can invoke a cluster
        switch by using the "HVC #1" assembler instruction
        from the relevant code.

C   Instructions

    1.  Build a linux kernel as per the steps listed in
        "docs/03-Linux-kernel-build.txt".
        The configuration includes support for CPU
        hotplug by default.

    2.  Use an existing root filesystem or build a new
        one as per the steps listed in
        "docs/06-Optional-rootfs-build.txt".

    3.  Place the kernel in the
        "bootwrapper/payload/kernel" directory and the
        filesystem in the "bootwrapper/payload/fsimg"
        directory. Build the Virtualizer software with
        support for synchronous switching as mentioned
        in B.1.

    4.  Boot the resulting "bootwrapper/img.axf" file
        using the "bootwrapper/big-little-mp4.mxscript"
        file. At the command prompt, the Linux cpu
        hotplug commands to hotplug CPUs should work
        as expected. For example, to hotplug CPU1 do:

        echo 0 > /sys/devices/system/cpu/cpu1/online

        To bring CPU1 online do:

        echo 1 > /sys/devices/system/cpu/cpu1/online