Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1061984pxb; Tue, 14 Sep 2021 15:33:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt1/ktXsZJOAcQzeVPB9/qkhtTT8sZLwKhbkLvPFWL5KPFxXlmTkvj/Mcy9aBLkpdkRY6D X-Received: by 2002:a05:6e02:c6d:: with SMTP id f13mr12357531ilj.55.1631658838775; Tue, 14 Sep 2021 15:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631658838; cv=none; d=google.com; s=arc-20160816; b=LO+VJXv4ft9EjHs0T4XaT8FMxbWs2zbyVCJnGa5EUc2s+4okB2Df70tTdRsaBKQdgX MQm9rBt5ISVPpkenYuFylSy8cZdgoQlqJgobIK5/G1PtXFZ+lv7ew5UiO/u+qI7dEw25 dpEZGvdfG1sV+ryqWi7DNUGeM6NOM6inbjMIEQMhsizRrX2kkzTOleme+dtNGizo+VQv BRiNQYmQ+rHEPpoE+7HXws3gBlCwCbTNYaxUX1XsMVqg5+m+X0mcL5/m0+Kb1B1Me0GR GSOgAjYD/MU7+p0s2PG8beKdT8fuItgnn8SICV0T/NG2OfRlsg0lQ/my9xFcMMBrhgAo Geww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=VREX88yx9xWzleHW1ZEh6k892sL/xPpdGpps/n5mOO0=; b=KKY5U0apaxAQa+EQgPjSXTLhcXWoRtQkQPfGDxlqWcR/XiWgSQhZOqPx16ElSiLTEW zXQyvoHKR0muRMzu7gycZjd2fdF/U8r1sJBtvSJXCOw8RBGjgi1gjFrz8C29zqYJkp/P EKc4EeskA1AfL3kwTkwhHQslIBwA4N2FMsL81R5fsaGE14OLzysC/HG2TCK54mwewqbt hdRe2kOl468n+GIl0AEwgTjSE1od1Rhq8XPUeC9mu51oHnKgRf0yQhO2MNP9qOAJ04gJ nz8ll0nEjtG6zprPeHFGm/UdWKJzTTV8YwV7M0EcOrK/PmnEPRq20K4yhrjcMyNHRDKA G0+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="lq/RxhWN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si12470190jam.69.2021.09.14.15.33.47; Tue, 14 Sep 2021 15:33:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="lq/RxhWN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236126AbhINWdb (ORCPT + 99 others); Tue, 14 Sep 2021 18:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235704AbhINWcw (ORCPT ); Tue, 14 Sep 2021 18:32:52 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 838D3C061766 for ; Tue, 14 Sep 2021 15:31:34 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id k15-20020a25240f000000b0059efafc5a58so921362ybk.11 for ; Tue, 14 Sep 2021 15:31:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=VREX88yx9xWzleHW1ZEh6k892sL/xPpdGpps/n5mOO0=; b=lq/RxhWNVx7HvcaPCnLIvkYwVN/qajC6Z/TJt7BjQwh2kiG8aYIi9XXaH0fBS2ObXi uE6/PIk3diZR5P/av9EkChN11F3yxn4ytG2jrnfrPhRGWUQURMRhLO13q9wfpwCR7A5g 7/RM69WnbITiPwIbs0CKxqrkVixmM0zXsLIHEQ1wRoh9YknzbX05OpiklsPNYRuGulYJ ieHH741AlkpjfWugkGP71HaL/RjstLd4VOJDdNdvowz1eyiO3NYovGHA5UHOVGx1wlXU yW88zoT/uvTdgcLKGt87Xg/M64lmUFO4TbQhZOSwiPy7azMCeLzAURvn+KJL+pQF/9m8 vfNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=VREX88yx9xWzleHW1ZEh6k892sL/xPpdGpps/n5mOO0=; b=DhQfHJ6l/VIeTkxaLbeQBn0Yc1nAI6c9W/2jz26E5SvZEeI6axGR4tZKitXHuHSCyw GbRKgVlECUlHQ2ztgagiRW3kLAhM7scVoMrQl9fS/oBUXzvRG7Hln02yW0W+kovktpUh BsS7zWG669j1FIfdkRZAKH7UpsnrACYqapGqfCsVLvQ+XazRESUgn5D/eY8CRKeK1XFU ubK4AhVcVkEHEuY7s9oLn28JrNLKvHXLvqF/jTinBgj+GcFp/z5m5ATbqEv38HuAXp9G 93YjeZoy/sxYlgd05JS2593Lz7VOxvq7I1PGg+N7juXqbc76J9NtC3SFl6cTFCLu6xDa EmuA== X-Gm-Message-State: AOAM531dOY9bxNIFgvSCTKlC2f5GxHHBdEp/v+t+jtpmHMmrxrdf00Jd 32XfjEuqSYTOXrryn6G+3NXVvGFBwgps X-Received: from rananta-virt.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1bcc]) (user=rananta job=sendgmr) by 2002:a25:61c8:: with SMTP id v191mr1965131ybb.472.1631658693708; Tue, 14 Sep 2021 15:31:33 -0700 (PDT) Date: Tue, 14 Sep 2021 22:31:04 +0000 In-Reply-To: <20210914223114.435273-1-rananta@google.com> Message-Id: <20210914223114.435273-6-rananta@google.com> Mime-Version: 1.0 References: <20210914223114.435273-1-rananta@google.com> X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog Subject: [PATCH v7 05/15] KVM: arm64: selftests: Add support for cpu_relax From: Raghavendra Rao Ananta To: Paolo Bonzini , Marc Zyngier , Andrew Jones , James Morse , Alexandru Elisei , Suzuki K Poulose Cc: Catalin Marinas , Will Deacon , Peter Shier , Ricardo Koller , Oliver Upton , Reiji Watanabe , Jing Zhang , Raghavendra Rao Anata , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement the guest helper routine, cpu_relax(), to yield the processor to other tasks. The function was derived from arch/arm64/include/asm/vdso/processor.h. Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Oliver Upton Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/include/aarch64/processor.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tools/testing/selftests/kvm/include/aarch64/processor.h index 93797783abad..265054c24481 100644 --- a/tools/testing/selftests/kvm/include/aarch64/processor.h +++ b/tools/testing/selftests/kvm/include/aarch64/processor.h @@ -122,6 +122,11 @@ void vm_install_exception_handler(struct kvm_vm *vm, void vm_install_sync_handler(struct kvm_vm *vm, int vector, int ec, handler_fn handler); +static inline void cpu_relax(void) +{ + asm volatile("yield" ::: "memory"); +} + #define isb() asm volatile("isb" : : : "memory") #define dsb(opt) asm volatile("dsb " #opt : : : "memory") #define dmb(opt) asm volatile("dmb " #opt : : : "memory") -- 2.33.0.309.g3052b89438-goog