From patchwork Tue Nov 1 14:54:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 13721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3022148wru; Tue, 1 Nov 2022 08:00:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JDMoNIoJMpM7WoX0NTj7rmqonmFmeg+n0fLjUBk6Jyoy3ILUHmWwMpFt/+oyTTXcjJVFt X-Received: by 2002:a05:6402:214:b0:463:7f0a:b874 with SMTP id t20-20020a056402021400b004637f0ab874mr8716462edv.90.1667314841972; Tue, 01 Nov 2022 08:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667314841; cv=none; d=google.com; s=arc-20160816; b=oDcgnAaFlWGrkocd2rQdnqsZXMJVRVtQGdfOGaA7ftpxBNieFOVeVnRw63M4TL80Gw KxY+80MI+esY9jjteD6ATQnKqYZqj4HsJ2ivpYRuZwAgeCyySds17q4NCtyPzidkBu5L rUPK7p9l9zBFiGRf2lmPGOxK6EnUQ3+KqLjQc/GUc58xz4Bl7s+3V67/QwJaw6sY7Vm7 wYNVzIBZg2ZY267FwSHiF5ExxNqaIrliO8QRrGF5YsOPSoaLxrdb7oQ6f5TXVsD/8UK9 N8S7pbj7M5biVTcabI1MKa9Ztt0Kp9oqodBpRw6X1u3cnOIf3EO/f3dHRCUsCbGmJ+pP OmtA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zFhCS/Ez+XT2rbHbT+pv3KOcpkpeFqRZXNsB6wEui4U=; b=f9rpEkth/oYXdFPho39CgHSLDSAyR3/a/6Ey4Ffnk/c9n7pEbG5m7vz3M8FeQ/qgvv YYdWnbWfiOZwQcDVh8Vv7pxb9VDnETGb0TEY4fZbyi9Ai3kuoOWI9of1Xe2JQ569eChZ 7h02xLoR8T4ANpA4+M+PCXPJFzyMETp6wzGyvXFzk/XtBIFtGKy+ytnBQLDDKzITndQg 4dLJSo7Xuj1KAy4LPoCu6FttnTORaTRS2sfeAZqFgRmdWDJAed4wzeVUIy43iDJv+r70 cim3QzJAu1HJa0PJgqAWwMQV+WEpwC3WbM5veEev4glwstnoWbdU6x5pVxjlmeEOqpfQ pgUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BSxkZS3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a170906924400b0078d4a0c77f9si9765258ejx.458.2022.11.01.08.00.17; Tue, 01 Nov 2022 08:00:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BSxkZS3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230387AbiKAO7F (ORCPT + 99 others); Tue, 1 Nov 2022 10:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbiKAO62 (ORCPT ); Tue, 1 Nov 2022 10:58:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8FD01D0DD for ; Tue, 1 Nov 2022 07:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314567; 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=zFhCS/Ez+XT2rbHbT+pv3KOcpkpeFqRZXNsB6wEui4U=; b=BSxkZS3XzztVJ4Uynw5G38LWXT+2x6T3WiazQN+SXkrNgr5gVLsvk5Lj6Zo1GMdTcjctI9 ZLfJStC+bCqX+iM+7SyzjholN9QNkt19WL3uImYEzpCrkzGZwwF4eJPepX4uepX1cY028a /Tp/Jg1FgY2t0Gomyp/RES+mU3pU58k= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-NtEDNt1yOqShWjmlfy9eNA-1; Tue, 01 Nov 2022 10:56:04 -0400 X-MC-Unique: NtEDNt1yOqShWjmlfy9eNA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1EE2929ABA13; Tue, 1 Nov 2022 14:56:04 +0000 (UTC) Received: from ovpn-194-149.brq.redhat.com (ovpn-194-149.brq.redhat.com [10.40.194.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17AD7C15BA5; Tue, 1 Nov 2022 14:56:01 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 31/48] KVM: selftests: Move HYPERV_LINUX_OS_ID definition to a common header Date: Tue, 1 Nov 2022 15:54:09 +0100 Message-Id: <20221101145426.251680-32-vkuznets@redhat.com> In-Reply-To: <20221101145426.251680-1-vkuznets@redhat.com> References: <20221101145426.251680-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748306327613298046?= X-GMAIL-MSGID: =?utf-8?q?1748306327613298046?= HYPERV_LINUX_OS_ID needs to be written to HV_X64_MSR_GUEST_OS_ID by each Hyper-V specific selftest. Reviewed-by: Maxim Levitsky Reviewed-by: Sean Christopherson Signed-off-by: Vitaly Kuznetsov --- tools/testing/selftests/kvm/include/x86_64/hyperv.h | 3 +++ tools/testing/selftests/kvm/x86_64/hyperv_features.c | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/include/x86_64/hyperv.h b/tools/testing/selftests/kvm/include/x86_64/hyperv.h index b66910702c0a..f0a8a93694b2 100644 --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h +++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h @@ -185,4 +185,7 @@ /* hypercall options */ #define HV_HYPERCALL_FAST_BIT BIT(16) +/* Proper HV_X64_MSR_GUEST_OS_ID value */ +#define HYPERV_LINUX_OS_ID ((u64)0x8100 << 48) + #endif /* !SELFTEST_KVM_HYPERV_H */ diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/testing/selftests/kvm/x86_64/hyperv_features.c index 05b32e550a80..71bb91602a7f 100644 --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c @@ -13,8 +13,6 @@ #include "processor.h" #include "hyperv.h" -#define LINUX_OS_ID ((u64)0x8100 << 48) - static inline uint8_t hypercall(u64 control, vm_vaddr_t input_address, vm_vaddr_t output_address, uint64_t *hv_status) { @@ -71,7 +69,7 @@ static void guest_hcall(vm_vaddr_t pgs_gpa, struct hcall_data *hcall) GUEST_ASSERT(hcall->control); - wrmsr(HV_X64_MSR_GUEST_OS_ID, LINUX_OS_ID); + wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_LINUX_OS_ID); wrmsr(HV_X64_MSR_HYPERCALL, pgs_gpa); if (!(hcall->control & HV_HYPERCALL_FAST_BIT)) { @@ -169,7 +167,7 @@ static void guest_test_msrs_access(void) */ msr->idx = HV_X64_MSR_GUEST_OS_ID; msr->write = 1; - msr->write_val = LINUX_OS_ID; + msr->write_val = HYPERV_LINUX_OS_ID; msr->available = 1; break; case 3: