Skip to content
  • Thomas Huth's avatar
    arm/pmu: Fix inline assembly for Clang · 9e186511
    Thomas Huth authored
    
    
    Clang complains here:
    
    arm/pmu.c:201:16: error: value size does not match register size specified by
     the constraint and modifier [-Werror,-Wasm-operand-widths]
            : [pmcr] "r" (pmcr)
                          ^
    arm/pmu.c:194:18: note: use constraint modifier "w"
            "       msr     pmcr_el0, %[pmcr]\n"
                                      ^~~~~~~
                                      %w[pmcr]
    arm/pmu.c:200:17: error: value size does not match register size specified by
     the constraint and modifier [-Werror,-Wasm-operand-widths]
            : [loop] "+r" (loop)
                           ^
    arm/pmu.c:196:11: note: use constraint modifier "w"
            "1:     subs    %[loop], %[loop], #1\n"
                            ^~~~~~~
                            %w[loop]
    arm/pmu.c:200:17: error: value size does not match register size specified by
     the constraint and modifier [-Werror,-Wasm-operand-widths]
            : [loop] "+r" (loop)
                           ^
    arm/pmu.c:196:20: note: use constraint modifier "w"
            "1:     subs    %[loop], %[loop], #1\n"
                                     ^~~~~~~
                                     %w[loop]
    arm/pmu.c:284:35: error: value size does not match register size specified
     by the constraint and modifier [-Werror,-Wasm-operand-widths]
            : [addr] "r" (addr), [pmcr] "r" (pmcr), [loop] "r" (loop)
                                             ^
    arm/pmu.c:274:28: note: use constraint modifier "w"
            "       msr     pmcr_el0, %[pmcr]\n"
                                      ^~~~~~~
                                      %w[pmcr]
    arm/pmu.c:284:54: error: value size does not match register size specified
     by the constraint and modifier [-Werror,-Wasm-operand-widths]
            : [addr] "r" (addr), [pmcr] "r" (pmcr), [loop] "r" (loop)
                                                                ^
    arm/pmu.c:276:23: note: use constraint modifier "w"
            "       mov     x10, %[loop]\n"
                                 ^~~~~~~
                                 %w[loop]
    
    pmcr should be 64-bit since it is a sysreg, but for loop we can use the
    "w" modifier.
    
    Suggested-by: default avatarAndrew Jones <drjones@redhat.com>
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    Message-Id: <20201001072234.143703-6-thuth@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
    Tested-by: default avatarAndrew Jones <drjones@redhat.com>
    9e186511