• Paul Mackerras's avatar
    [POWERPC] Fix performance monitor on machines with logical PVR · 87a72f9e
    Paul Mackerras authored
    Some IBM machines supply a "logical" PVR (processor version register)
    value in the device tree in the cpu nodes rather than the real PVR.
    This is used for instance to indicate that the processors in a POWER6
    partition have been configured by the hypervisor to run in POWER5+
    mode rather than POWER6 mode.  To cope with this, we call identify_cpu
    a second time with the logical PVR value (the first call is with the
    real PVR value in the very early setup code).
    
    However, POWER5+ machines can also supply a logical PVR value, and use
    the same value (the value that indicates a v2.04 architecture
    compliant processor).  This causes problems for code that uses the
    performance monitor (such as oprofile), because the PMU registers are
    different in POWER6 (even in POWER5+ mode) from the real POWER5+.
    
    This change works around this problem by taking out the PMU
    information from the cputable entries for the logical PVR values, and
    changing identify_cpu so that the second call to it won't overwrite
    the PMU information that was established by the first call (the one
    with the real PVR), but does update the other fields.  Specifically,
    if the cputable entry for the logical PVR value has num_pmcs == 0,
    none of the PMU-related fields get used.
    
    So that we can create a mixed cputable entry, we now make cur_cpu_spec
    point to a single static struct cpu_spec, and copy stuff from
    cpu_specs[i] into it.  This has the side-effect that we can now make
    cpu_specs[] be initdata.
    
    Ultimately it would be good to move the PMU-related fields out to a
    separate structure, pointed to by the cputable entries, and change
    identify_cpu so that it saves the PMU info pointer, copies the whole
    structure, and restores the PMU info pointer, rather than identify_cpu
    having to list all the fields that are *not* PMU-related.
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    87a72f9e
cputable.c 38.7 KB