Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp242058pxb; Mon, 13 Sep 2021 18:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIp9XOlwcuJhMs0RN4Avm1ArZli3H/L2eEfyPGgKwFAJBKLXEm2snTgswoXyWrYK+Dw5E/ X-Received: by 2002:a6b:8f4e:: with SMTP id r75mr11674383iod.172.1631581676274; Mon, 13 Sep 2021 18:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631581676; cv=none; d=google.com; s=arc-20160816; b=uNRDFeuYk+BGI4f8elKjwaNGnXTPI9UvDUEDHyOT4NYUIQR0f30+i//UywwCyhC+pM IPA5gZvykKWq1W3XFsXlKsfTzIJHfMPzROf5SX4A9b/xuFNb7OjavcCeNXDU/AmX2RCh 7cw6kXrHG3ZDWPhBZJDkbyqHkGW+Xz8BrRGmv0CRGvdkUdJorQKzyqy6WjogJ/OjMDPn FyppkGgHQjBa9qYRVEvquJA3sxWS2hodVBqiNZz3lXSOPYOzDN+56Ptxm2QAbbW1v6pQ +W/TI8iMAhY8u3ldhnlpcNqXwsQ1kLw3A4V+9K0r/KOXhIMy7tY5UjAemFl7xnE8oNBG jvoA== 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=pX7Upidhq0W42wWgGsTe9qRy9vnFkoOINdmrXtxNLGTE1GHk9JadYbChs8q58WoBbg RucbuSRi+kF9bz8HsHg1xNxoqXm8TrlMQxgEUDvoc/KlAAHUsTwyvViFnAkiuk/hdAAE UDN9QVKdmufxnhyzZeIDZVD23T9hyxGO8GnuR7F4XB19zerivOjWWwKwFXdTrQKjxYzc xLi1cn0BwZyT1WmBOEPYEbyk78AdRsP/ErlnQfO9+Zzlnq9JqaN+A7xP2UpqBD+0/LWR iz8L9PoedTBFIpvEV18RFVR5wEh85B1kWcAnjb7BDx2g7yi5TfJtXUvI8EGrzBDw/0ju DkRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jXfd6Ifb; 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 b18si9056040ioz.23.2021.09.13.18.07.44; Mon, 13 Sep 2021 18:07:56 -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=jXfd6Ifb; 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 S1348242AbhIMUvk (ORCPT + 99 others); Mon, 13 Sep 2021 16:51:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347882AbhIMUvK (ORCPT ); Mon, 13 Sep 2021 16:51:10 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E35C061574 for ; Mon, 13 Sep 2021 13:49:54 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id g17-20020aa781910000b0290360a5312e3eso6888981pfi.7 for ; Mon, 13 Sep 2021 13:49:54 -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=jXfd6Ifbv2PUpHnXkJKAouWhIx2rYsNCCmG89uNRrOlOzCsjeYdmZPzk7mQuLwmR6r HOnftjjdFpgdyeyrS9r1+xeyl+Z5dbnbGGrObV6o+HbKo1FTge0yKCDMgwpOj14py+V1 BFJnXQbJTaKi2YgBbos4ghKJeyONx2b2NwHcB1YLf2Ijco6HnidQU1ZWLXg2T0xYYU9o aAJIP0FW5mCUmEVJD3qU1APMqM3FiNktBmol28OLolIw4CyTzcnpvwgA1ZDMgNYpUokQ UkGiNSM75gqzCAq7jQEGsroFKM6zUAUvJ1nDq6vWGlhJj7QmBIuX2XcKbZcz1qhZ+1NU FCIA== 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=BUgdoJWnp54nQRXpwQDbR5QutWviBXtgsJ0RcXSgkPJoCjXtnrhlqydTaZ+c8wFLJr ZD7LgY93QVTCjnkU0li2EZ/1j0CW+ExfG+9S+AAioG05Q/bxTbHgD+KZSpzikQX926qc FfwcfmE/78KTA9D1ffDq2LjPleEmFa6OAesLTYEvZuzpn94uBih/ldKibj3tT+n+Snzn asaYOOR8QJv/p10w4Ol7rDATwdXzvZIJcTyH4mu1ystCFKkOFtj9NgCTvJRGwnrMeo4X uruTEj3SrUgPPebNnodrtM/+QAKe5hx+dwOSGFA3Qfu29lW8AI6dB9NEA/p48IOB8UFz XO9A== X-Gm-Message-State: AOAM533Ye9mjDOsUIxLOlvYEuCrdCy1lw/aabbRsiCHHoStrdt/2Lzqz yUT0rUo6czpTKYjfW/nGJWRLWuMbC3cf X-Received: from rananta-virt.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1bcc]) (user=rananta job=sendgmr) by 2002:a63:6e03:: with SMTP id j3mr12719146pgc.465.1631566193824; Mon, 13 Sep 2021 13:49:53 -0700 (PDT) Date: Mon, 13 Sep 2021 20:49:21 +0000 In-Reply-To: <20210913204930.130715-1-rananta@google.com> Message-Id: <20210913204930.130715-6-rananta@google.com> Mime-Version: 1.0 References: <20210913204930.130715-1-rananta@google.com> X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog Subject: [PATCH v5 05/14] 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