Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2034744iof; Tue, 7 Jun 2022 17:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUbGEExzbGv1iNmXCpSXR0J+xtq1jzdyWXvjRuvyvTPuXiuVFjw04EUDM02zXS5GXVjv5X X-Received: by 2002:a17:902:c2c7:b0:159:9f9:85f3 with SMTP id c7-20020a170902c2c700b0015909f985f3mr31162522pla.18.1654648840532; Tue, 07 Jun 2022 17:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654648840; cv=none; d=google.com; s=arc-20160816; b=InRgo3BSZdeh4vMPqfHkIGfybr72smMlAO+IYz7EwFWdhmtyQ65MHq71MK3e3jYY8z rfTLdVHarqyQZ5Ul6spQ378J8wIk3RbdcB5xFJlG16BIt67CmGzbe+c4kVKgwqMqXVzK wadxVd0Bxy7RHSIFDK/I0+Sw4pTiKBm2fVqAvaHgdizm4pLTjuINSdZWFgV2pk0U03lA dEhow8qAdSiV3f+av6Oc8xoGbCKNxgCJbQIJI7UvzXQcucIkZTBW+s+sinJeb/gHGjhn 9I9j24X34PcvV29L/BK9jLS0D0lutAql//47GetXFrEAQhOnuCPh5o7QxcpybAUjhDvd OOYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=Ap/ea5Xnr5bNkYBc/gjvXLi7f8rQXdBfxSXXArkzhjs=; b=tXyTuS6wy/bdw3bfnujSeDW2OPtbWlLsQ7P6Yo+4m44CEUQMXo+aZk4Yosh6qUQ8Wx UdYwo8qGuGMKvPEyfCKhDiKbqDVrubDd0tgL4Q9M28cLeA9gtb8o+7D1HjJqBut8Nfc9 oXfg6v9t9NJxXsYNvE9h444idkzyaKQz7AnqdtrOiRCr38FVsfBFr4dyQTmlTCfoOb/g N/PUJ5ZubpuY5NwyikxLK662hiFfbStjbQhZtxLbp6KE4ceQ5JH+RGpB9Vct/k7hZyeP 2p6h1/Xviwd0BKJdPgN7DsNHp42SzLrTpUeOT8vF71k5T0m7t3gCZMTz84dYWTnC/V6J L7cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cj4lH2wL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l11-20020a170903244b00b00164195d35a6si25140902pls.47.2022.06.07.17.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 17:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cj4lH2wL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 96953AF300; Tue, 7 Jun 2022 17:33:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240626AbiFGKEC (ORCPT + 99 others); Tue, 7 Jun 2022 06:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240623AbiFGKDz (ORCPT ); Tue, 7 Jun 2022 06:03:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09948D02A3 for ; Tue, 7 Jun 2022 03:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654596232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ap/ea5Xnr5bNkYBc/gjvXLi7f8rQXdBfxSXXArkzhjs=; b=Cj4lH2wLIL1d/CAIbZEZZEQD7/IKOMAK9RfVYykWZvzeMBtFs7sIiYKAT9vJSc0iL1k/xO 2X4I7+flB8H+TzkEN3v1gAsHrSAXVzeizmrXrjNexdnw3N08bZ5PkMEt8moZ91GvSx+VUN FcxykPYtElkpMXFGx9c+APNutPKcFn8= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-349-7RpuEZibMSehyPzWQnZJnQ-1; Tue, 07 Jun 2022 06:03:51 -0400 X-MC-Unique: 7RpuEZibMSehyPzWQnZJnQ-1 Received: by mail-qk1-f198.google.com with SMTP id bs39-20020a05620a472700b006a6772a6cb3so11730188qkb.14 for ; Tue, 07 Jun 2022 03:03:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=Ap/ea5Xnr5bNkYBc/gjvXLi7f8rQXdBfxSXXArkzhjs=; b=p9kCUVfnKMYZ5zg90ftWUrMde7IONKOICXOvShUvc5bAZRTsJEsLHfs0ai1bUt6zVH d58CEVEZLTnqYC6qAy9JEoztgmg01FhlJunTrTgXLxxGCdAsUH4DkIkTB+PY5SKY9Eja YM+tp/tlBhl42Cuqb0sOfdYFunT3VTfhvesdTdolZt3gtFETq+MqWBP2XjsUaGJp7lb8 hNQ4DVl4fT6IfPwbOtBbFMKoPoC0o9J4Lu5TQeEjYfYeTw4+hiHBkhLfwbgmC2BfjDGT 4AQ3L/lh4q7fvmiUQwR94PpeQVs3vHz93eVPy6dYtHqIF+qEq8V3BRr0+U5XdVaEXiJ3 B94A== X-Gm-Message-State: AOAM530eagzFqkaQjSMLBDYpMoaPc6tvZbLnFZ/ZGICetmmpgAhYQWEV I7nbzTHe1Bmkf9D4nEhvujScZw/tPdcn1PCOIOZW/wn1f924mRA6fhP4PR3trUpZMSKMks0MGQT TO+42aGnSPc4GEV+KOK/Zom7y X-Received: by 2002:a05:620a:1672:b0:6a6:b0de:88ae with SMTP id d18-20020a05620a167200b006a6b0de88aemr9502579qko.191.1654596230527; Tue, 07 Jun 2022 03:03:50 -0700 (PDT) X-Received: by 2002:a05:620a:1672:b0:6a6:b0de:88ae with SMTP id d18-20020a05620a167200b006a6b0de88aemr9502564qko.191.1654596230302; Tue, 07 Jun 2022 03:03:50 -0700 (PDT) Received: from [10.35.4.238] (bzq-82-81-161-50.red.bezeqint.net. [82.81.161.50]) by smtp.gmail.com with ESMTPSA id h10-20020a05620a284a00b006a6e13e2b4bsm794500qkp.24.2022.06.07.03.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 03:03:49 -0700 (PDT) Message-ID: <42de55976d158eb34fe97595d4509c4de28771b7.camel@redhat.com> Subject: Re: [PATCH v6 26/38] KVM: selftests: Move the function doing Hyper-V hypercall to a common header From: Maxim Levitsky To: Vitaly Kuznetsov , kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 07 Jun 2022 13:03:46 +0300 In-Reply-To: <20220606083655.2014609-27-vkuznets@redhat.com> References: <20220606083655.2014609-1-vkuznets@redhat.com> <20220606083655.2014609-27-vkuznets@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2022-06-06 at 10:36 +0200, Vitaly Kuznetsov wrote: > All Hyper-V specific tests issuing hypercalls need this. > > Signed-off-by: Vitaly Kuznetsov > --- >  .../selftests/kvm/include/x86_64/hyperv.h       | 15 +++++++++++++++ >  .../selftests/kvm/x86_64/hyperv_features.c      | 17 +---------------- >  2 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/tools/testing/selftests/kvm/include/x86_64/hyperv.h b/tools/testing/selftests/kvm/include/x86_64/hyperv.h > index f0a8a93694b2..e0a1b4c2fbbc 100644 > --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h > +++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h > @@ -185,6 +185,21 @@ >  /* hypercall options */ >  #define HV_HYPERCALL_FAST_BIT          BIT(16) >   > +static inline u64 hyperv_hypercall(u64 control, vm_vaddr_t input_address, > +                          vm_vaddr_t output_address) > +{ > +       u64 hv_status; > + > +       asm volatile("mov %3, %%r8\n" > +                    "vmcall" > +                    : "=a" (hv_status), > +                      "+c" (control), "+d" (input_address) > +                    :  "r" (output_address) > +                    : "cc", "memory", "r8", "r9", "r10", "r11"); > + > +       return hv_status; > +} > + >  /* Proper HV_X64_MSR_GUEST_OS_ID value */ >  #define HYPERV_LINUX_OS_ID ((u64)0x8100 << 48) >   > diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/testing/selftests/kvm/x86_64/hyperv_features.c > index 98c020356925..788d570e991e 100644 > --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c > +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c > @@ -48,21 +48,6 @@ static void do_wrmsr(u32 idx, u64 val) >  static int nr_gp; >  static int nr_ud; >   > -static inline u64 hypercall(u64 control, vm_vaddr_t input_address, > -                           vm_vaddr_t output_address) > -{ > -       u64 hv_status; > - > -       asm volatile("mov %3, %%r8\n" > -                    "vmcall" > -                    : "=a" (hv_status), > -                      "+c" (control), "+d" (input_address) > -                    :  "r" (output_address) > -                    : "cc", "memory", "r8", "r9", "r10", "r11"); > - > -       return hv_status; > -} > - >  static void guest_gp_handler(struct ex_regs *regs) >  { >         unsigned char *rip = (unsigned char *)regs->rip; > @@ -138,7 +123,7 @@ static void guest_hcall(vm_vaddr_t pgs_gpa, struct hcall_data *hcall) >                         input = output = 0; >                 } >   > -               res = hypercall(hcall->control, input, output); > +               res = hyperv_hypercall(hcall->control, input, output); >                 if (hcall->ud_expected) >                         GUEST_ASSERT(nr_ud == 1); >                 else Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky