Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp254631pxb; Mon, 13 Sep 2021 18:29:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGHnJ7kVRt03TIa8tpiZk35iqb0301MB1W+sLJf03uFY75j/gh5J0EcH0t04tjiZrxhe+3 X-Received: by 2002:a17:906:9747:: with SMTP id o7mr16073838ejy.486.1631582981452; Mon, 13 Sep 2021 18:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631582981; cv=none; d=google.com; s=arc-20160816; b=dOO2JGoU9JMbxTSRGIEJ0+9rMcUJ6NiW0FOl8qgdWpY56kYL1FR5tq1FcNLV7wsIxE 5n5Ot6vIpw1S1s+xdZICtFO/gSkCPeS6EBSyrBc5Q0I2v0e1+USr5RMjyfiDtz/jTrys IXZIxWQ+k1HoA1+z/4okj48swS2rGvV613/Kj/qcOILNm/SruhWIupZxotL3AivmxkY/ cd1HpdynFYQecB77MI7AtlWLrxMPsqjf6EV5XDjtgq9DM4jPyHdkxYmjdMYLCd5WkC3K BmVVUdYCuR7urisd1BSkTM+ewIWbMbciOKoMkmQeb+xwxCORurQD1GYI868GQajx97hL rkrg== 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=Av88oATjn+PXC34Nl03BuBqEs984u2y9FnIDjoRHsiekw69yI4+aUGMioQ7iFFTHeT LRqjoiYEN9jyuSu5k/YuKm+B+FkPDJcSj96E7sk7zh93oh4y2hfgK+dvM6laO3UoU0jb 4BqcAM7T4TzSGg59gZOYjk+byuwSis3V1GHcDPPuhvv9IYknv2kdy4HVGq4N/cGmuUJi un22IlhODRQg6Y1R6Bo0ac62SCbghaqFsKLLqy0o4G6Kr//lgV4L6mP9dzniNo/gf2f3 XnuiOkUJaiivbYoWuB0h+uY5puUN4SUg/0rcTpa4hOuQF8W2foA86MSqUOb7qCJL+92j md0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iK83yniV; 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 18si8971057ejj.568.2021.09.13.18.29.18; Mon, 13 Sep 2021 18:29:41 -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=iK83yniV; 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 S1349903AbhIMXNH (ORCPT + 99 others); Mon, 13 Sep 2021 19:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349405AbhIMXL5 (ORCPT ); Mon, 13 Sep 2021 19:11:57 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2D5EC0613E1 for ; Mon, 13 Sep 2021 16:10:13 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id y134-20020a25dc8c000000b0059f0301df0fso14883924ybe.21 for ; Mon, 13 Sep 2021 16:10:13 -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=iK83yniVjgitiMsPKE4heQ6oT5rN4oNwgLzQoyg5AZbIqAYzYHhPvLBF3Z3crr9r15 9U+ZxVXK13YUTjJZJ4Yz5pii/pFm/7uIvC8pAu63Tn+8Vu0GIJwOSYuDaEpBkNcskqWf fs9FJCplOKxOdfrEDqL2+nU1gOritaqPDtimBWNEaypbZDTErBxFjkHWtO1D2rylDVfo 3TOQq1XxOgSnD5Q6IfRthoDnW4h1H4/ngV0eT6/oJdj1/g1nKuOocfqESB9G6HVtqQWS 2Nd3LR006dsHJuBkVl7PKAQ1+7BFeF7935GxPhrgHW9uyt/R8Pqt+Svp/fX8KXAPFU65 /oBg== 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=DtSuSMSicvs83orhx+2Gt8upzNFlSWN1I8LeVljD1bkWOSVU32YnPGpBkc7wGsQnNz 7tvqRPZRVtAQ+8uGyfpxnTFiwKvhg50dVArstBNee+oH1tm/iqTy+i0vXmpS6WY4vSZB xSHdeyUZW1g6+3YuL07LQQRaHRAMzH+Ikq+yPf+11QaWQjo5H+w8KOsX7jzOKjsFo4cL FyNNkoH9TyEReVOlT5nZSd81Lr7QeQ1B+5At/E5S9O/WgtItgK4UxU8g90ao5yUu+Fbc BQD4pOOh1EnZ+jeAi52vrX1EpjCjSwekrvD5QpnedjEIciqJLSbHAbB9knGGRLPlDbCR y8fQ== X-Gm-Message-State: AOAM530i6uYo+4tPEV2murRAqD9ncO05R6j/tKOLFh+4v77l9ddnWo7I grdhTMCfTuHA+jXaItWvOYzBwnDymGXY X-Received: from rananta-virt.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1bcc]) (user=rananta job=sendgmr) by 2002:a25:44d:: with SMTP id 74mr20148426ybe.54.1631574613117; Mon, 13 Sep 2021 16:10:13 -0700 (PDT) Date: Mon, 13 Sep 2021 23:09:46 +0000 In-Reply-To: <20210913230955.156323-1-rananta@google.com> Message-Id: <20210913230955.156323-6-rananta@google.com> Mime-Version: 1.0 References: <20210913230955.156323-1-rananta@google.com> X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog Subject: [PATCH v6 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