Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp100742pxb; Wed, 8 Sep 2021 18:41:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3Be4HO6srYcAXAfYHArruDqZHjUURs5waPrN1h2tKOT6atBtBT+UFnlidatcqwl+fkBF3 X-Received: by 2002:a05:6e02:2163:: with SMTP id s3mr405508ilv.172.1631151695859; Wed, 08 Sep 2021 18:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631151695; cv=none; d=google.com; s=arc-20160816; b=QOJ2hLvXBDBD7u0iktYABiWd37aaKpM7mrlqgctpOWhP1dZn0BpnUmWyqMbKco+pJ6 LxcM1TFrJHC57OQId1Bd3ow1TGP5L485RJvCm4hHQ25Cn/XMn9NCL4/E0HnUVI/JYUgA M3iEKTOBLH53WEJPTRJi0i4PEkz4hiihDDv4WrmKLrdYvwsSy4v6ivLMiHXpmKhVISEl Sj5An+TiXCQfwU6lhADHLO8+QNUw6g66ZDq6stZbwxbUanX4cRk4MGn/TbJ7X215TQiS i1iMhLuEOQCfQBWFU2pJ/Z8hxqbmbggjJgEUnz982pPqnO14mmtDfiy60iNDU7moidaC 98zg== 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=gnXKJQdV0c3R/PtxS6JEuqPswo+mI03RfMS+GJY9V2c=; b=OlnT14992fEu39GtJYGSl5IEN0F/bR+q2hqstWBg4MJw74A9DVdMcCdrqAA7z9PT0L VjlzoyojkpGnKugNRIJwCPAlNSeIiI9gtK1+4OaQGZ6G+rKkXIkrehFTYNhJMYXlusDS 9YFXuj0iBFjmzHuXALntQg+1dLIak2kIbNoLYaWpG23r/qXK6Rf62e6tiiTZU47lH3hr JOkxqWdVlMqyDcg69S6bV9d8i9K11fW3piw6EvxNqQeEuAliXO+na7DQqxRebnE1AwbL KDloyvOuhX8Z/RDdxbgMK/upe0KkS/Qgc/UteDKW6YKRTrbOVWiGkuLdWfoyX0Xhp7vt huMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qovCNdOb; 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 s186si184213ios.107.2021.09.08.18.41.24; Wed, 08 Sep 2021 18:41:35 -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=qovCNdOb; 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 S1349728AbhIIBjv (ORCPT + 99 others); Wed, 8 Sep 2021 21:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349513AbhIIBjq (ORCPT ); Wed, 8 Sep 2021 21:39:46 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C79C061575 for ; Wed, 8 Sep 2021 18:38:37 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id l6-20020a170902ec0600b0013882202041so16062pld.15 for ; Wed, 08 Sep 2021 18:38:37 -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=gnXKJQdV0c3R/PtxS6JEuqPswo+mI03RfMS+GJY9V2c=; b=qovCNdObk9hAYj5TRIstPpudmx6SP1gE3xKWc2RIyrpnrPqHTaRlABxqgUjn2zw7rT vEidP+eM7AUJIEqMeJgU88+wfjlSHF19U/ZiK9c6aesOhSvvkl4oRIUjCOTHPGyEZWay I37gnbfuZr2v8I5I5mxm2EC0V8EZ6yK+qOAnp+jtr324k5m51nzdTq56dzoHMs10+7zn 8u22Sqvehn7ThNOUO7HAFN5kRqbI2jP4+7K40fB+qnINSr4lmHmlxbbzeV/WnIy1E+x6 R3gWMpaynW+uiMBXTZa/08/31Czfo6HEvQtCL8VmjI/Mf0dUE+Al2Qvm46MSYSaI3WGq IYLg== 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=gnXKJQdV0c3R/PtxS6JEuqPswo+mI03RfMS+GJY9V2c=; b=10NWpaQa6w7czPctC4xSiRqAru/zfivZtg/g/RE51Uex1r6jEg/TdkgZXk4hJz3o6I 3zE6fv1yXagSquz2feQb81SiKZ1Isnq5IEGr2Jb0usKX6wT1x8pc9sulEFMimgM4lQrn 6nfi6appYmKXbXSjLAc9BUexvIRbY4i04A5Pw2XKllRAT5Ovb27DhNRdcWuGjelRjOia b7H8LIm7pIVY17vvl/t4N0wopUjNiPYZOPaBDJXkHnCf2zcjhZGax6fuG993X06WRwcu z7cpyOrrvzaFFWuyGU3xxrzNMn+6RV9zM5i/Kp0K1kidbLdspoCVfj6HXvyaVtmmdgsj dL9Q== X-Gm-Message-State: AOAM530QXRsznlhd29ABtPjYYk8xSnkv/2JcdxSAdYsvQBeY9FKTowFw A5+C/bCluOG485KQeWRfyaD7RjqlYXCF X-Received: from rananta-virt.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1bcc]) (user=rananta job=sendgmr) by 2002:aa7:9693:0:b0:412:448c:89c6 with SMTP id f19-20020aa79693000000b00412448c89c6mr616147pfk.82.1631151516895; Wed, 08 Sep 2021 18:38:36 -0700 (PDT) Date: Thu, 9 Sep 2021 01:38:05 +0000 In-Reply-To: <20210909013818.1191270-1-rananta@google.com> Message-Id: <20210909013818.1191270-6-rananta@google.com> Mime-Version: 1.0 References: <20210909013818.1191270-1-rananta@google.com> X-Mailer: git-send-email 2.33.0.153.gba50c8fa24-goog Subject: [PATCH v4 05/18] 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 ac8b63f8aab7..166d273ad715 100644 --- a/tools/testing/selftests/kvm/include/aarch64/processor.h +++ b/tools/testing/selftests/kvm/include/aarch64/processor.h @@ -134,6 +134,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.153.gba50c8fa24-goog