Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp330781pxt; Fri, 6 Aug 2021 03:10:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyphkgc3ccjI2wyLVZkdM0nSpMEoeacjHMUV8iBWu66QzWuVzFjK7S3Ii09EdT8V+KmByH7 X-Received: by 2002:a05:6638:15:: with SMTP id z21mr8966906jao.25.1628244632334; Fri, 06 Aug 2021 03:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628244632; cv=none; d=google.com; s=arc-20160816; b=a9vWoHQ+AWlaAh13wLNggo5GOrF9YV2FCl9ti5o/xLkDkTNge8YG/bKfUIXPGNsefP YpiSpGl8WVmpnJ1T57zqoDp3xFgj7jcZXF0MkblIXSSs9q1pc94Y4c/JzhVD4+8JlmpK bDye2h8Oaa+kl2yqZUY9SVE77mxPLKfGiqe1RPOXrOSTlxjNxu+OyL9n9FdjLg1zQy2d OcT9iLaZDPa3pkINu95zXrfDeSnQiYUwvykZb2IRLfN4lIcmLrmRqVGwugdkcWKWikPV TPEckL7SqRGN+Zkxnt3gJL7oWxEC1ONeKou8jtU1pzdzGOXAOE28UIL2x2ab1ZNObxM0 TbCA== 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=ahtnS9hLodXxU8A228rsRwAFPAlH8yhUkyVUwHFy6q0=; b=Gp0R7Eni7caMGOcpyoDBQAhA+qFXM+90qLtfFopD5O7VxUqLLuoiY5XM/q3jg/CkqB o9r6Ie9lVbLOn8gDYsAYUKfyzipMqYyuo/6wIMcvdzFtoDvPI8si+xURys+RyalCoQ+c N8KLs4Am6ApaLizsrntRjw5vP9kAJUR81V9Z2MhGgjDsJDri+hUM83wAkD0EXD3qQ/eC EgQ2kz6QjBykn06G7rec3ByssZBGXC9gAO8x6a6jY3lB6r2w+mgrVvyaMeZTuwzHCBLj iJIDB6EeWyLobIZxQ1aBeVb+17fEEZv5uPpj1yi0sOj5+v5JmDxYXpeAat9xaP4gLc7u x24A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iux2l32k; 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 p37si2892940jal.38.2021.08.06.03.10.18; Fri, 06 Aug 2021 03:10:32 -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=iux2l32k; 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 S244874AbhHFKIP (ORCPT + 99 others); Fri, 6 Aug 2021 06:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244871AbhHFKIO (ORCPT ); Fri, 6 Aug 2021 06:08:14 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD6B5C061799 for ; Fri, 6 Aug 2021 03:07:58 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id k2so6373226plk.13 for ; Fri, 06 Aug 2021 03:07:58 -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=ahtnS9hLodXxU8A228rsRwAFPAlH8yhUkyVUwHFy6q0=; b=iux2l32kz4u5gaFj2drpMG3N5dya5a2e6JX3ibEFu+9mgVngK4aylu5KbQH0yNUfOO OeLbhLd/RbKRUof1FC9Uft8uU2jdtB6sO3ar4m1rcFIM5FPFAeT3uCChuQzYp4KUKfUx nNPR8MZjuZXja8FRMtWHsTNa72aLnkYtRa/Lk= 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=ahtnS9hLodXxU8A228rsRwAFPAlH8yhUkyVUwHFy6q0=; b=RPTP+93L0qh42411igFOTRyOlhMU70/q7AfhwLvVmerSyvLznrr5LcFOOth8UifjQt 5yncX3Pax2SdUHo5uMskQV8Icd3k8yBeoKIGe9FOfKCiJmiSpQq6aLkNOgkcHKdrEoAE pPdVf+0a4y3rzeHrcK7z9U2KvUVw8Om6WV3lLRUJV7/nZPh2BUNp9O9g0VWelUEZOoY9 9ftPxI/W/95o6GrqClYFtiGKIcyc5gUGLCo3UqZfzKVaHjILZwGDvdS0TwFP3MOYi9VN Rrb0YuAdvm692lzm4kdp+hfmFw6ayTN4Muomi6K40U7ahKSXc6BE7Abx0z+tIMpk15E6 s4xg== X-Gm-Message-State: AOAM532m7x9/GHk6kHYU3hxu1uaWpRYhAI7yUKaTGF78I7EBonuffkEy xJfBVTtv4pdflkqBafQhAbw57J5vzltAVA== X-Received: by 2002:a63:b1a:: with SMTP id 26mr278462pgl.12.1628244478053; Fri, 06 Aug 2021 03:07:58 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:b731:9e91:71e2:65e7]) by smtp.gmail.com with UTF8SMTPSA id t8sm11442791pgh.18.2021.08.06.03.07.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Aug 2021 03:07:57 -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 , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Jim Mattson , Joerg Roedel , John Stultz , Paolo Bonzini , Sean Christopherson , Stephen Boyd , Steve Wahl , Vitaly Kuznetsov , Wanpeng Li , kvm@vger.kernel.org, x86@kernel.org Subject: [v2 PATCH 2/4] x86/kvm: Add definitions for virtual suspend time injection Date: Fri, 6 Aug 2021 19:07:08 +0900 Message-Id: <20210806190607.v2.2.I6e8f979820f45e38370aa19180a33a8c046d0fa9@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 Add definitions of MSR, KVM_FEATURE bit, IRQ and a structure called kvm_suspend_time that are used by later patchs to support the virtual suspend time injection mechanism. Signed-off-by: Hikaru Nishida --- arch/x86/include/asm/irq_vectors.h | 7 ++++++- arch/x86/include/uapi/asm/kvm_para.h | 6 ++++++ kernel/time/timekeeping.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h index 43dcb9284208..6785054080c8 100644 --- a/arch/x86/include/asm/irq_vectors.h +++ b/arch/x86/include/asm/irq_vectors.h @@ -104,7 +104,12 @@ #define HYPERV_STIMER0_VECTOR 0xed #endif -#define LOCAL_TIMER_VECTOR 0xec +#if defined(CONFIG_KVM_VIRT_SUSPEND_TIMING) || \ + defined(CONFIG_KVM_VIRT_SUSPEND_TIMING_GUEST) +#define VIRT_SUSPEND_TIMING_VECTOR 0xec +#endif + +#define LOCAL_TIMER_VECTOR 0xeb #define NR_VECTORS 256 diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h index 5146bbab84d4..ccea4e344f46 100644 --- a/arch/x86/include/uapi/asm/kvm_para.h +++ b/arch/x86/include/uapi/asm/kvm_para.h @@ -35,6 +35,7 @@ #define KVM_FEATURE_MSI_EXT_DEST_ID 15 #define KVM_FEATURE_HC_MAP_GPA_RANGE 16 #define KVM_FEATURE_MIGRATION_CONTROL 17 +#define KVM_FEATURE_HOST_SUSPEND_TIME 18 #define KVM_HINTS_REALTIME 0 @@ -57,6 +58,7 @@ #define MSR_KVM_ASYNC_PF_INT 0x4b564d06 #define MSR_KVM_ASYNC_PF_ACK 0x4b564d07 #define MSR_KVM_MIGRATION_CONTROL 0x4b564d08 +#define MSR_KVM_HOST_SUSPEND_TIME 0x4b564d09 struct kvm_steal_time { __u64 steal; @@ -79,6 +81,10 @@ struct kvm_clock_pairing { __u32 pad[9]; }; +struct kvm_suspend_time { + __u64 suspend_time_ns; +}; + #define KVM_STEAL_ALIGNMENT_BITS 5 #define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1))) #define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 8a364aa9881a..233ceb6cce1f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "tick-internal.h" #include "ntp_internal.h" -- 2.32.0.605.g8dce9f2422-goog