71 lines · plain
1// SPDX-License-Identifier: GPL-2.0-only2// Copyright (C) 2021 ARM Limited.3// Original author: Mark Brown <broonie@kernel.org>4//5// Trivial syscall overhead benchmark.6//7// This is implemented in asm to ensure that we don't have any issues with8// system libraries using instructions that disrupt the test.9 10#include <asm/unistd.h>11#include "assembler.h"12 13.arch_extension sve14 15.macro test_loop per_loop16 mov x10, x2017 mov x8, #__NR_getpid18 mrs x11, CNTVCT_EL0191:20 \per_loop21 svc #022 sub x10, x10, #123 cbnz x10, 1b24 25 mrs x12, CNTVCT_EL026 sub x0, x12, x1127 bl putdec28 puts "\n"29.endm30 31// Main program entry point32.globl _start33function _start34 puts "Iterations per test: "35 mov x20, #1000036 lsl x20, x20, #837 mov x0, x2038 bl putdec39 puts "\n"40 41 // Test having never used SVE42 puts "No SVE: "43 test_loop44 45 // Check for SVE support - should use hwcap but that's hard in asm46 mrs x0, ID_AA64PFR0_EL147 ubfx x0, x0, #32, #448 cbnz x0, 1f49 puts "System does not support SVE\n"50 b out511:52 53 // Execute a SVE instruction54 puts "SVE VL: "55 rdvl x0, #856 bl putdec57 puts "\n"58 59 puts "SVE used once: "60 test_loop61 62 // Use SVE per syscall63 puts "SVE used per syscall: "64 test_loop "rdvl x0, #8"65 66 // And we're done67out:68 mov x0, #069 mov x8, #__NR_exit70 svc #071