Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8346646ybi; Tue, 9 Jul 2019 13:57:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsYa66g2UqhnNJCvq8F1/pCTgGfZiH69xaMm7rYRBeDVvyIsUepbTuYVZRz6mR2gUYASTn X-Received: by 2002:a63:1918:: with SMTP id z24mr29334476pgl.94.1562705820798; Tue, 09 Jul 2019 13:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562705820; cv=none; d=google.com; s=arc-20160816; b=Axm4VUy5BYZNivWdgDmlOUnY+/ZRDEPXR2fzXnnw7o++WUtcAQ96gCnqe7RpfT+YHb Ah0x6V8TQ8on1vZYwQPBuemNCPGDftCSjFlzKuntFKHTzMRd4SRIctK1tGodVRah+yTm yqspJqH2nD0myARK9ZN//7oCAp2P6DvLSXIx9JQxMsFH0ySWxWWQNWGAqTnxYrv64/Du e3GC1UDCHlxYxf+/NJEs7hAlTlzbAjMEq+vBSe56qfGilz1ZVfhUUoPiV3WSBpvzJA6g L9jzwfDfCQQGhEE+cUiKTbTjZ2e/ifpMHEAh5SxF91ehokjf00l04TJfqHwUebr6rANV KnqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zBe6Clg/nrHpxQCV8ORxxfEDeRgWtb8vqB8MmWt0LB4=; b=uRUGf2uUkvuXRxEaTj/QHBIgY60EFUgN5iC1TeQg+hceuge25O4LKWG48uQ7tPMFNp psxHx5vM7+5Ke9vN0nJfj7V/6fOWrd7Ypq0YmQ4X1Pv1bqazkpQJR6erTYZY6wua/3E9 0oZxwdlPfBwAOUBx5o2ne3RdWu7Q00M4fjqQDBCT/KdI1Mi+F1MDqjtNx1+wBnCeL5gH iOqRLhPMo4+NGqACCIcQGxGmoyBs/UXefxMmHtqxesonXXNyv79EM1oMjs/nsn5YqRDp hC9DeRcDoaMnZenHFUHUIn2Q0Z3JjSHQbpTTg/v06Ha2CUihANkGhZOs5OqTCcE96ewB hMEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=Adz22CIm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucsd.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x126si8866111pgx.356.2019.07.09.13.56.45; Tue, 09 Jul 2019 13:57:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=Adz22CIm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucsd.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729561AbfGIUII (ORCPT + 99 others); Tue, 9 Jul 2019 16:08:08 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:45088 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729544AbfGIUIH (ORCPT ); Tue, 9 Jul 2019 16:08:07 -0400 Received: by mail-lf1-f68.google.com with SMTP id u10so14251787lfm.12 for ; Tue, 09 Jul 2019 13:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zBe6Clg/nrHpxQCV8ORxxfEDeRgWtb8vqB8MmWt0LB4=; b=Adz22CImkMbL2GH/Gtq43OilsXJnMnpxBjq/NaRq/HBb58Sf3d2JfrpeNL00Le6wwH fFLvbBclAbs9at2yjYXLSusAQuxoikAnUfw2GgkfB+OJrWzFNOQVCfHge2zjTpwXxzhE pMYEIXwwsVIONYY8k3GQ3LA39/pw7ke4qxmoI= 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=zBe6Clg/nrHpxQCV8ORxxfEDeRgWtb8vqB8MmWt0LB4=; b=IoLzylfOqtXDMe1ywkbcLR8M/fuX63xqJMjg+h9ANlnLTeMTSfA07z6p7d+DayqoPf p8EigFZJdKVHskj9wkrHY4Vhs4i0RhHlPIIAIPAaYYc/coZPu2G/l2SmyUWk4adTRfx6 ZyhLYGRofaETsv7AbAiWYn6aN7oOusopz+RpawUeiV936YoqSbOfyBxYQ97p5+3zGA7M prnQmCzUOqeOQQcF1ECMK8lSpue20pGUeIhzkioeG2EmXV4TO4i9f43EnklGwEPq3UVL pFHyEniyylvZAmn/KmHRnceCr/HhgqCRu1MxfWCtssV3ZrSiXWzerO1As5t1TbSiwA+c DQrg== X-Gm-Message-State: APjAAAVDjpwjCkHdKFCY9GXfaNc34LtTr5jlPgWmZAMttr87BmHkG0ls HuRJNCWi3Pru6hCg3I4y6VB1xg== X-Received: by 2002:a19:4f42:: with SMTP id a2mr12356298lfk.23.1562702885227; Tue, 09 Jul 2019 13:08:05 -0700 (PDT) Received: from luke-XPS-13.home (159-205-76-204.adsl.inetia.pl. [159.205.76.204]) by smtp.gmail.com with ESMTPSA id f1sm4489ljk.86.2019.07.09.13.08.03 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 13:08:04 -0700 (PDT) From: Luke Nowakowski-Krijger X-Google-Original-From: Luke Nowakowski-Krijger To: linux-kernel-mentees@lists.linuxfoundation.org Cc: Luke Nowakowski-Krijger , pbonzini@redhat.com, rkrcmar@redhat.com, corbet@lwn.net, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] Documentation: kvm: Convert cpuid.txt to .rst Date: Tue, 9 Jul 2019 13:07:19 -0700 Message-Id: <20190709200721.16991-2-lnowakow@neg.ucsd.edu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190709200721.16991-1-lnowakow@neg.ucsd.edu> References: <20190709200721.16991-1-lnowakow@neg.ucsd.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luke Nowakowski-Krijger Convert cpuid.txt to .rst format to be parsable by sphinx. Change format and spacing to make function definitions and return values much more clear. Also added a table that is parsable by sphinx and makes the information much more clean. Updated Author email to their new active email address. Added license identifier with the consent of the author. Signed-off-by: Luke Nowakowski-Krijger --- Changes since v2: + added updated Author email address + changed table to simpler format - removed function bolding from v1 Changes since v1: + Converted doc to .rst format Documentation/virtual/kvm/cpuid.rst | 99 +++++++++++++++++++++++++++++ Documentation/virtual/kvm/cpuid.txt | 83 ------------------------ 2 files changed, 99 insertions(+), 83 deletions(-) create mode 100644 Documentation/virtual/kvm/cpuid.rst delete mode 100644 Documentation/virtual/kvm/cpuid.txt diff --git a/Documentation/virtual/kvm/cpuid.rst b/Documentation/virtual/kvm/cpuid.rst new file mode 100644 index 000000000000..644c53687861 --- /dev/null +++ b/Documentation/virtual/kvm/cpuid.rst @@ -0,0 +1,99 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============== +KVM CPUID bits +============== + +:Author: Glauber Costa + +A guest running on a kvm host, can check some of its features using +cpuid. This is not always guaranteed to work, since userspace can +mask-out some, or even all KVM-related cpuid features before launching +a guest. + +KVM cpuid functions are: + +function: KVM_CPUID_SIGNATURE (0x40000000) + +returns:: + + eax = 0x40000001 + ebx = 0x4b4d564b + ecx = 0x564b4d56 + edx = 0x4d + +Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM". +The value in eax corresponds to the maximum cpuid function present in this leaf, +and will be updated if more functions are added in the future. +Note also that old hosts set eax value to 0x0. This should +be interpreted as if the value was 0x40000001. +This function queries the presence of KVM cpuid leafs. + +function: define KVM_CPUID_FEATURES (0x40000001) + +returns:: + + ebx, ecx + eax = an OR'ed group of (1 << flag) + +where ``flag`` is defined as below: + +================================= =========== ================================ +flag value meaning +================================= =========== ================================ +KVM_FEATURE_CLOCKSOURCE 0 kvmclock available at msrs + 0x11 and 0x12 + +KVM_FEATURE_NOP_IO_DELAY 1 not necessary to perform delays + on PIO operations + +KVM_FEATURE_MMU_OP 2 deprecated + +KVM_FEATURE_CLOCKSOURCE2 3 kvmclock available at msrs + + 0x4b564d00 and 0x4b564d01 +KVM_FEATURE_ASYNC_PF 4 async pf can be enabled by + writing to msr 0x4b564d02 + +KVM_FEATURE_STEAL_TIME 5 steal time can be enabled by + writing to msr 0x4b564d03 + +KVM_FEATURE_PV_EOI 6 paravirtualized end of interrupt + handler can be enabled by + writing to msr 0x4b564d04 + +KVM_FEATURE_PV_UNHAULT 7 guest checks this feature bit + before enabling paravirtualized + spinlock support + +KVM_FEATURE_PV_TLB_FLUSH 9 guest checks this feature bit + before enabling paravirtualized + tlb flush + +KVM_FEATURE_ASYNC_PF_VMEXIT 10 paravirtualized async PF VM EXIT + can be enabled by setting bit 2 + when writing to msr 0x4b564d02 + +KVM_FEATURE_PV_SEND_IPI 11 guest checks this feature bit + before enabling paravirtualized + sebd IPIs + +KVM_FEATURE_CLOCSOURCE_STABLE_BIT 24 host will warn if no guest-side + per-cpu warps are expeced in + kvmclock +================================= =========== ================================ + +:: + + edx = an OR'ed group of (1 << flag) + +Where ``flag`` here is defined as below: + +================== ============ ================================= +flag value meaning +================== ============ ================================= +KVM_HINTS_REALTIME 0 guest checks this feature bit to + determine that vCPUs are never + preempted for an unlimited time + allowing optimizations +================== ============ ================================= diff --git a/Documentation/virtual/kvm/cpuid.txt b/Documentation/virtual/kvm/cpuid.txt deleted file mode 100644 index 97ca1940a0dc..000000000000 --- a/Documentation/virtual/kvm/cpuid.txt +++ /dev/null @@ -1,83 +0,0 @@ -KVM CPUID bits -Glauber Costa , Red Hat Inc, 2010 -===================================================== - -A guest running on a kvm host, can check some of its features using -cpuid. This is not always guaranteed to work, since userspace can -mask-out some, or even all KVM-related cpuid features before launching -a guest. - -KVM cpuid functions are: - -function: KVM_CPUID_SIGNATURE (0x40000000) -returns : eax = 0x40000001, - ebx = 0x4b4d564b, - ecx = 0x564b4d56, - edx = 0x4d. -Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM". -The value in eax corresponds to the maximum cpuid function present in this leaf, -and will be updated if more functions are added in the future. -Note also that old hosts set eax value to 0x0. This should -be interpreted as if the value was 0x40000001. -This function queries the presence of KVM cpuid leafs. - - -function: define KVM_CPUID_FEATURES (0x40000001) -returns : ebx, ecx - eax = an OR'ed group of (1 << flag), where each flags is: - - -flag || value || meaning -============================================================================= -KVM_FEATURE_CLOCKSOURCE || 0 || kvmclock available at msrs - || || 0x11 and 0x12. ------------------------------------------------------------------------------- -KVM_FEATURE_NOP_IO_DELAY || 1 || not necessary to perform delays - || || on PIO operations. ------------------------------------------------------------------------------- -KVM_FEATURE_MMU_OP || 2 || deprecated. ------------------------------------------------------------------------------- -KVM_FEATURE_CLOCKSOURCE2 || 3 || kvmclock available at msrs - || || 0x4b564d00 and 0x4b564d01 ------------------------------------------------------------------------------- -KVM_FEATURE_ASYNC_PF || 4 || async pf can be enabled by - || || writing to msr 0x4b564d02 ------------------------------------------------------------------------------- -KVM_FEATURE_STEAL_TIME || 5 || steal time can be enabled by - || || writing to msr 0x4b564d03. ------------------------------------------------------------------------------- -KVM_FEATURE_PV_EOI || 6 || paravirtualized end of interrupt - || || handler can be enabled by writing - || || to msr 0x4b564d04. ------------------------------------------------------------------------------- -KVM_FEATURE_PV_UNHALT || 7 || guest checks this feature bit - || || before enabling paravirtualized - || || spinlock support. ------------------------------------------------------------------------------- -KVM_FEATURE_PV_TLB_FLUSH || 9 || guest checks this feature bit - || || before enabling paravirtualized - || || tlb flush. ------------------------------------------------------------------------------- -KVM_FEATURE_ASYNC_PF_VMEXIT || 10 || paravirtualized async PF VM exit - || || can be enabled by setting bit 2 - || || when writing to msr 0x4b564d02 ------------------------------------------------------------------------------- -KVM_FEATURE_PV_SEND_IPI || 11 || guest checks this feature bit - || || before using paravirtualized - || || send IPIs. ------------------------------------------------------------------------------- -KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side - || || per-cpu warps are expected in - || || kvmclock. ------------------------------------------------------------------------------- - - edx = an OR'ed group of (1 << flag), where each flags is: - - -flag || value || meaning -================================================================================== -KVM_HINTS_REALTIME || 0 || guest checks this feature bit to - || || determine that vCPUs are never - || || preempted for an unlimited time, - || || allowing optimizations ----------------------------------------------------------------------------------- -- 2.20.1