Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp329897pxt; Fri, 6 Aug 2021 03:09:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS50dhRsgZxzzoS6I1PtT075NMGx8svgP7HqoJ4brd8iP7Y3JZ8zIycMqgDSPt0x+Vy4HS X-Received: by 2002:a05:6638:1004:: with SMTP id r4mr9058846jab.105.1628244542191; Fri, 06 Aug 2021 03:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628244542; cv=none; d=google.com; s=arc-20160816; b=wXUVmuiOlzyUq3ehdQUh+JAqd5vZb/56kLVsWXzIMqnDb+xmERmHkGPD5ZeI57dYMT 133o7dq2Kl/45eIJ/RcfmtyyRg01+0Iq5hql6f4j8QnxAgqigAanoS23XDAOpfzYLTeC hVZffEqBxw+znhq8nVbX1JNJj1Mx1usZCSI5o7LpOZPIFJFccN6j8Xm4oDV44gvP1QiT B78NfR5QG6Gx2mNIlO+/aI3aivtX+puJYgIGgtV9C3VM73ak+3iPo3E118/lTcp42qdt Usl3vkxEnsG5FWEud0XK2/mNzE4Pt/CBoMRa6btFj/blXe/h+QKVOlbDAVntTlSOxnzP +jtQ== 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=iyZptw0PZMngUpuqTbhFqAgHUBZ0pdUlUAf/+I6duzw=; b=PVFgAPpnyH4bTetJDEhk7jk/VK1cr2sAOrNPxKNBoxSXGpMrOzrR3+PR6QDPQR7VVk LIica8UqUuwBbqKJ+ckuArmhDrVK21Qf3SMnYB/dNzZRRhBKH+qHA3cFE9AwKuUuEnFh e97Q3mGgqXUJ5M8QmEIiQTpaAtP4v3R85X59fIGMXRBQeW/QmXxPE8GK6KTk8YVeGc56 R/I55JetnaxOkxWe+fmZ3sXS+dgoSBj6ysEOgacMKzfjCs1q9UG1/8Fjyxq6OUTmCBMx 62qhOBzkocrWt3/cxYmQOBkBs11vltF4d64FEnvxB7qRJphSTljKtahVjE4x+4vBzC0L E4XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="CtVi//qK"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si9607723ilj.65.2021.08.06.03.08.50; Fri, 06 Aug 2021 03:09:02 -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=@chromium.org header.s=google header.b="CtVi//qK"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244862AbhHFKIC (ORCPT + 99 others); Fri, 6 Aug 2021 06:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244843AbhHFKIC (ORCPT ); Fri, 6 Aug 2021 06:08:02 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5A07C06179A for ; Fri, 6 Aug 2021 03:07:46 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id q2so6383262plr.11 for ; Fri, 06 Aug 2021 03:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iyZptw0PZMngUpuqTbhFqAgHUBZ0pdUlUAf/+I6duzw=; b=CtVi//qKnyxS/ct/N+YbU6Len9+6aCpNg2+v9ZZ3f6BQCNUzgLxxflvvevFm2Ab1Fd oLJMXrHf3u7Ja2HQWCDmmqwZEjlREMGLQa3kIKXMZIxMG70f1F74xjigutP2SR3Zhuif 6mwlkQwBRksfU6508ZkkZ9Pqs+QiZC5xkIrqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iyZptw0PZMngUpuqTbhFqAgHUBZ0pdUlUAf/+I6duzw=; b=mBif4JiNnSw0jqv8ImrJkhhLVa0amTofNAumEQjO4ZeFrvjpoRAUTu+/ocoJvscgl7 S3/Tm0prsZBrbkXskXv/v/TROtWDMeplFrqOYqWa6tfFtEQtWKwGFckFa1qKMh9fiXjz dOxFmfTcvLIsxYf8YIsA5bXKIQEXJ95lUIFCF0lpTlwxnGpGI//F9vmlXEeg0IKTQ41V xd4MQjree4Q6WcX6G9mnzLxzGkAuqEx8TKWmqUBUZR0Sd/RRRoN+ZVxgGgF5m79Mx4sN rKKUMl3J5b5k6hnGHVC8ruJOJq964Ifkcqo1766dTtwVA+ewqsB4xYYv0bec+VuH5pLy SIGQ== X-Gm-Message-State: AOAM531XY6UrRIp5A3iSCsGuXc3oPG2L7U0j2ztIUoh9EhyP9qb5KGqk lWyB9THvt/IXemmkUzDTsWSxueKD6IbTGQ== X-Received: by 2002:a17:902:a702:b029:12b:aa0f:d553 with SMTP id w2-20020a170902a702b029012baa0fd553mr8181136plq.3.1628244466238; Fri, 06 Aug 2021 03:07:46 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:b731:9e91:71e2:65e7]) by smtp.gmail.com with UTF8SMTPSA id d17sm9696510pfn.110.2021.08.06.03.07.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Aug 2021 03:07:45 -0700 (PDT) From: Hikaru Nishida To: linux-kernel@vger.kernel.org, dme@dme.org, tglx@linutronix.de, mlevitsk@redhat.com Cc: suleiman@google.com, Hikaru Nishida , Jonathan Corbet , Paolo Bonzini , kvm@vger.kernel.org, linux-doc@vger.kernel.org Subject: [v2 PATCH 1/4] x86/kvm: Reserve KVM_FEATURE_HOST_SUSPEND_TIME and MSR_KVM_HOST_SUSPEND_TIME Date: Fri, 6 Aug 2021 19:07:07 +0900 Message-Id: <20210806190607.v2.1.I2a67009253163b8eecf1ae8d050c541d35ac0bd8@changeid> X-Mailer: git-send-email 2.32.0.605.g8dce9f2422-goog In-Reply-To: <20210806100710.2425336-1-hikalium@chromium.org> References: <20210806100710.2425336-1-hikalium@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change; just add documentation for KVM_FEATURE_HOST_SUSPEND_TIME and its corresponding MSR_KVM_HOST_SUSPEND_TIME to support virtual suspend timing injection in later patches. Signed-off-by: Hikaru Nishida --- Documentation/virt/kvm/cpuid.rst | 3 +++ Documentation/virt/kvm/msr.rst | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Documentation/virt/kvm/cpuid.rst b/Documentation/virt/kvm/cpuid.rst index bda3e3e737d7..f17b95b0d943 100644 --- a/Documentation/virt/kvm/cpuid.rst +++ b/Documentation/virt/kvm/cpuid.rst @@ -103,6 +103,9 @@ KVM_FEATURE_HC_MAP_GPA_RANGE 16 guest checks this feature bit bef KVM_FEATURE_MIGRATION_CONTROL 17 guest checks this feature bit before using MSR_KVM_MIGRATION_CONTROL +KVM_FEATURE_HOST_SUSPEND_TIME 18 host suspend time information + is available at msr 0x4b564d09. + KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 host will warn if no guest-side per-cpu warps are expected in kvmclock diff --git a/Documentation/virt/kvm/msr.rst b/Documentation/virt/kvm/msr.rst index 9315fc385fb0..a218a350d0d0 100644 --- a/Documentation/virt/kvm/msr.rst +++ b/Documentation/virt/kvm/msr.rst @@ -389,3 +389,33 @@ data: guest is communicating page encryption status to the host using the ``KVM_HC_MAP_GPA_RANGE`` hypercall, it can set bit 0 in this MSR to allow live migration of the guest. + +MSR_KVM_HOST_SUSPEND_TIME: + 0x4b564d09 + +data: + 8-byte alignment physical address of a memory area which must be + in guest RAM, plus an enable bit in bit 0. This memory is expected to + hold a copy of the following structure:: + + struct kvm_suspend_time { + __u64 suspend_time_ns; + }; + + whose data will be filled in by the hypervisor. + If the guest register this structure through the MSR write, the host + will stop all the clocks including TSCs observed by the guest during + the host's suspension and report the duration of suspend through this + structure. The update will be notified through + VIRT_SUSPEND_TIMING_VECTOR IRQ. Fields have the following meanings: + + suspend_time_ns: + Total number of nanoseconds passed during the host's suspend + while the VM is running. This value will be increasing + monotonically. + + Note that although MSRs are per-CPU entities, the effect of this + particular MSR is global. + + Availability of this MSR must be checked via bit 18 in 0x4000001 cpuid + leaf prior to usage. -- 2.32.0.605.g8dce9f2422-goog