From nobody Mon Jun 22 14:24:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1D2AC433FE for ; Tue, 22 Mar 2022 11:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233988AbiCVLIx (ORCPT ); Tue, 22 Mar 2022 07:08:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233910AbiCVLIp (ORCPT ); Tue, 22 Mar 2022 07:08:45 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2998A80211; Tue, 22 Mar 2022 04:07:18 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id r190-20020a1c2bc7000000b0038a1013241dso1280309wmr.1; Tue, 22 Mar 2022 04:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qSUlhzlA1s0q6/uoUd3jdsktSfPe0Uq9dHq53cc4Gxg=; b=XA5jZz1m1fVkCv5KbXNRwidDsuCEqJojKTKiXtRcF1KsBPZ35mI1Q5etGXwyot4QYY zz6jtCy+SkoH91ciK+DPJi/vNajDBnGKBxMCBXl6so9uvwulI0uLsyzTYDnjxfPEhw+k 3N/41iPSEEIC8DYAHOlvvHhACLCRpd4Q7veAK24AEE9jH+8dXd7ZaoYsFfLPXZ2g2grU xkVIKK/Y9jo4ZEOxuvvbnYf29+zp+3G2lnAVqWQHH1q9aZ86NkNmHEzzmN9HRUVAyTPM nmwa8DROBpAa+wlTUGMtMaekvqRS8SEmb6VzluOA4sN5mteRVNx6/hndxpbz5R5ADwRY pEHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qSUlhzlA1s0q6/uoUd3jdsktSfPe0Uq9dHq53cc4Gxg=; b=dqoQA8w4OWJPNDVqCfnIeyf6xDDXLE+9VaNBd4OvpkGMM06vwmK+RFYyjG7sDdZho0 DsFcXcXYDSFSc9T9/0AfpW/0t9148c2P54rG+j6SVRLCmdLs0hgdDhhmpeR3rrytgZ12 udzhr2jfXYMdTetrSbvWwSI3ut7/0ZxieCzfRRFEnyVJsfAo/TcCuOVK+nQV1klKTkFB ejZL8XMQG3cvPO7pQA8kwO+V/Ck4G04An8GVy6upFYclZnxqxxw8FQ6h5dJspVFHxnOf FkpGF35kYTL1pXwuxRXB7zEXl/23UqK0t7DCe1E3mbRpQ3mnlSsuRaBI2UctUBqwz3bz 771A== X-Gm-Message-State: AOAM532Gen4gta0rQ2iN2bN+Ang08DPpmAKAtlyCytGKcP7v7fJZXHLv 29SINH5RpLfv2VGh3oJOzfx/HLsmbBE= X-Google-Smtp-Source: ABdhPJwaj6eNRUFaM56E9G8HghIEbHssoHxrDMcjFvbAA1Skt9pig7VM8osSqap4IDWGBhTzsCJH9A== X-Received: by 2002:a7b:c0ca:0:b0:38c:b9a9:a64d with SMTP id s10-20020a7bc0ca000000b0038cb9a9a64dmr2114497wmh.195.1647947236585; Tue, 22 Mar 2022 04:07:16 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b0038c949ef0d5sm1746379wmq.8.2022.03.22.04.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 04:07:16 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: mlevitsk@redhat.com, jmattson@google.com Subject: [PATCH 1/3] Documentation: KVM: add separate directories for architecture-specific documentation Date: Tue, 22 Mar 2022 12:07:10 +0100 Message-Id: <20220322110712.222449-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322110712.222449-1-pbonzini@redhat.com> References: <20220322110712.222449-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" ARM already has an arm/ subdirectory, but s390 and x86 do not even though they have a relatively large number of files specific to them. Create new directories in Documentation/virt/kvm for these two architectures as well. While at it, group the API documentation and the developer documentation in the table of contents. Signed-off-by: Paolo Bonzini --- Documentation/virt/kvm/index.rst | 28 ++++++------------- Documentation/virt/kvm/s390/index.rst | 12 ++++++++ .../virt/kvm/{ =3D> s390}/s390-diag.rst | 0 .../virt/kvm/{ =3D> s390}/s390-pv-boot.rst | 0 Documentation/virt/kvm/{ =3D> s390}/s390-pv.rst | 0 .../kvm/{ =3D> x86}/amd-memory-encryption.rst | 0 Documentation/virt/kvm/{ =3D> x86}/cpuid.rst | 0 .../virt/kvm/{ =3D> x86}/halt-polling.rst | 0 .../virt/kvm/{ =3D> x86}/hypercalls.rst | 0 Documentation/virt/kvm/x86/index.rst | 18 ++++++++++++ Documentation/virt/kvm/{ =3D> x86}/mmu.rst | 0 Documentation/virt/kvm/{ =3D> x86}/msr.rst | 0 .../virt/kvm/{ =3D> x86}/nested-vmx.rst | 0 .../kvm/{ =3D> x86}/running-nested-guests.rst | 0 .../virt/kvm/{ =3D> x86}/timekeeping.rst | 0 15 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 Documentation/virt/kvm/s390/index.rst rename Documentation/virt/kvm/{ =3D> s390}/s390-diag.rst (100%) rename Documentation/virt/kvm/{ =3D> s390}/s390-pv-boot.rst (100%) rename Documentation/virt/kvm/{ =3D> s390}/s390-pv.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/amd-memory-encryption.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/cpuid.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/halt-polling.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/hypercalls.rst (100%) create mode 100644 Documentation/virt/kvm/x86/index.rst rename Documentation/virt/kvm/{ =3D> x86}/mmu.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/msr.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/nested-vmx.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/running-nested-guests.rst (100%) rename Documentation/virt/kvm/{ =3D> x86}/timekeeping.rst (100%) diff --git a/Documentation/virt/kvm/index.rst b/Documentation/virt/kvm/inde= x.rst index b6833c7bb474..e0a2c74e1043 100644 --- a/Documentation/virt/kvm/index.rst +++ b/Documentation/virt/kvm/index.rst @@ -8,25 +8,13 @@ KVM :maxdepth: 2 =20 api - amd-memory-encryption - cpuid - halt-polling - hypercalls - locking - mmu - msr - nested-vmx - ppc-pv - s390-diag - s390-pv - s390-pv-boot - timekeeping - vcpu-requests - - review-checklist - - arm/index - devices/index =20 - running-nested-guests + arm/index + s390/index + ppc-pv + x86/index + + locking + vcpu-requests + review-checklist diff --git a/Documentation/virt/kvm/s390/index.rst b/Documentation/virt/kvm= /s390/index.rst new file mode 100644 index 000000000000..605f488f0cc5 --- /dev/null +++ b/Documentation/virt/kvm/s390/index.rst @@ -0,0 +1,12 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +KVM for s390 systems +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +.. toctree:: + :maxdepth: 2 + + s390-diag + s390-pv + s390-pv-boot diff --git a/Documentation/virt/kvm/s390-diag.rst b/Documentation/virt/kvm/= s390/s390-diag.rst similarity index 100% rename from Documentation/virt/kvm/s390-diag.rst rename to Documentation/virt/kvm/s390/s390-diag.rst diff --git a/Documentation/virt/kvm/s390-pv-boot.rst b/Documentation/virt/k= vm/s390/s390-pv-boot.rst similarity index 100% rename from Documentation/virt/kvm/s390-pv-boot.rst rename to Documentation/virt/kvm/s390/s390-pv-boot.rst diff --git a/Documentation/virt/kvm/s390-pv.rst b/Documentation/virt/kvm/s3= 90/s390-pv.rst similarity index 100% rename from Documentation/virt/kvm/s390-pv.rst rename to Documentation/virt/kvm/s390/s390-pv.rst diff --git a/Documentation/virt/kvm/amd-memory-encryption.rst b/Documentati= on/virt/kvm/x86/amd-memory-encryption.rst similarity index 100% rename from Documentation/virt/kvm/amd-memory-encryption.rst rename to Documentation/virt/kvm/x86/amd-memory-encryption.rst diff --git a/Documentation/virt/kvm/cpuid.rst b/Documentation/virt/kvm/x86/= cpuid.rst similarity index 100% rename from Documentation/virt/kvm/cpuid.rst rename to Documentation/virt/kvm/x86/cpuid.rst diff --git a/Documentation/virt/kvm/halt-polling.rst b/Documentation/virt/k= vm/x86/halt-polling.rst similarity index 100% rename from Documentation/virt/kvm/halt-polling.rst rename to Documentation/virt/kvm/x86/halt-polling.rst diff --git a/Documentation/virt/kvm/hypercalls.rst b/Documentation/virt/kvm= /x86/hypercalls.rst similarity index 100% rename from Documentation/virt/kvm/hypercalls.rst rename to Documentation/virt/kvm/x86/hypercalls.rst diff --git a/Documentation/virt/kvm/x86/index.rst b/Documentation/virt/kvm/= x86/index.rst new file mode 100644 index 000000000000..55ede8e070b6 --- /dev/null +++ b/Documentation/virt/kvm/x86/index.rst @@ -0,0 +1,18 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +KVM for x86 systems +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +.. toctree:: + :maxdepth: 2 + + amd-memory-encryption + cpuid + halt-polling + hypercalls + mmu + msr + nested-vmx + running-nested-guests + timekeeping diff --git a/Documentation/virt/kvm/mmu.rst b/Documentation/virt/kvm/x86/mm= u.rst similarity index 100% rename from Documentation/virt/kvm/mmu.rst rename to Documentation/virt/kvm/x86/mmu.rst diff --git a/Documentation/virt/kvm/msr.rst b/Documentation/virt/kvm/x86/ms= r.rst similarity index 100% rename from Documentation/virt/kvm/msr.rst rename to Documentation/virt/kvm/x86/msr.rst diff --git a/Documentation/virt/kvm/nested-vmx.rst b/Documentation/virt/kvm= /x86/nested-vmx.rst similarity index 100% rename from Documentation/virt/kvm/nested-vmx.rst rename to Documentation/virt/kvm/x86/nested-vmx.rst diff --git a/Documentation/virt/kvm/running-nested-guests.rst b/Documentati= on/virt/kvm/x86/running-nested-guests.rst similarity index 100% rename from Documentation/virt/kvm/running-nested-guests.rst rename to Documentation/virt/kvm/x86/running-nested-guests.rst diff --git a/Documentation/virt/kvm/timekeeping.rst b/Documentation/virt/kv= m/x86/timekeeping.rst similarity index 100% rename from Documentation/virt/kvm/timekeeping.rst rename to Documentation/virt/kvm/x86/timekeeping.rst --=20 2.35.1 From nobody Mon Jun 22 14:24:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEB31C433EF for ; Tue, 22 Mar 2022 11:07:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233986AbiCVLJH (ORCPT ); Tue, 22 Mar 2022 07:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233939AbiCVLIr (ORCPT ); Tue, 22 Mar 2022 07:08:47 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5F480211; Tue, 22 Mar 2022 04:07:19 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id v130-20020a1cac88000000b00389d0a5c511so1633076wme.5; Tue, 22 Mar 2022 04:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J4WuZIw1gEze4qEJaV70xo0L6nuByRxRegmX9Sw5Tk8=; b=ffp9vlurUn1J8JPD14Wv6UdC6FjgZlW9sebn2ZrQEvSdK+Y8umvguAsoF+EWM/Bl8r SGuSSyvPQrIdqDVK3uYAnH0J6es7DT2KnWxLFbSUZT1ohHtvyHGkkorEvnH1j4TRjIvJ UOXA9+HHnOgY1gUh+gq0edf0btyobsqxo9PssX9beDi0TEas27Eueov0D/FiR15EqndE rfb4+p2MWI6f/pqD2gotwnm7DmP4rIqbHgi2AhzDtp27RhduDGvjTiF+jhdpW+mdTyfY 3inZjnoqtpEz4X01LX7mR0prJWVcyL9l27arwguAc5QiwtKeOVN/nSAqOKDEK+KNiyT7 U2+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=J4WuZIw1gEze4qEJaV70xo0L6nuByRxRegmX9Sw5Tk8=; b=7M+uAomZoKVgNGbmGtvSgsc6ZRliumaoYbTf3q8BtskKkbqQ+P+xeF/PNg5msWzjwt B6CuOJrPZJPSgskqbadLoD09RwVaxHFLHV2UCrxF40UUr7vUV7JEwvy4QmTSa1zITzY4 kMSR2AefDq96zG3J2ldxPE8ntKbRvRZ1FARliz9rsUXvzO7HYoewOteIA1cMka+mkaTh fiCq6hcmikIuH03r44Kf8CJVKsn85WVVXbuSXVRyWk8QydudfF7S+Ic6f2Y77GvaqaYK TH6QtwWQqsTua8O/bLonUavznKambL6RgoA+wGzDdeSo3+GOiEHlUkdmV2k6YuzYA9qg 7lVg== X-Gm-Message-State: AOAM532TrIHBLA2Aaolq0g82AtZXWjcE7YWuhws8Jh2NovJ64QFfdDSE feld+9XNhdKh3EnasGh0iURZ3NZO51E= X-Google-Smtp-Source: ABdhPJz3ElnnHBMGnkHFPKyU6xFn9j6lu5NoN0v3V3H6bv6FoTfdaOqb2EYL31W9Ie9ctRJBR2LZEw== X-Received: by 2002:a7b:ce92:0:b0:38b:ed80:9e66 with SMTP id q18-20020a7bce92000000b0038bed809e66mr3254732wmj.82.1647947237944; Tue, 22 Mar 2022 04:07:17 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b0038c949ef0d5sm1746379wmq.8.2022.03.22.04.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 04:07:17 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: mlevitsk@redhat.com, jmattson@google.com Subject: [PATCH 2/3] Documentation: KVM: add virtual CPU errata documentation Date: Tue, 22 Mar 2022 12:07:11 +0100 Message-Id: <20220322110712.222449-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322110712.222449-1-pbonzini@redhat.com> References: <20220322110712.222449-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a file to document all the different ways in which the virtual CPU emulation is imperfect. Include an example to show how to document such errata. Signed-off-by: Paolo Bonzini Reviewed-by: Jim Mattson Reviewed-by: Oliver Upton --- Documentation/virt/kvm/x86/errata.rst | 39 +++++++++++++++++++++++++++ Documentation/virt/kvm/x86/index.rst | 1 + 2 files changed, 40 insertions(+) create mode 100644 Documentation/virt/kvm/x86/errata.rst diff --git a/Documentation/virt/kvm/x86/errata.rst b/Documentation/virt/kvm= /x86/errata.rst new file mode 100644 index 000000000000..df394d34a836 --- /dev/null +++ b/Documentation/virt/kvm/x86/errata.rst @@ -0,0 +1,39 @@ + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Known limitations of CPU virtualization +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Whenever perfect emulation of a CPU feature is impossible or too hard, KVM +has to choose between not implementing the feature at all or introducing +behavioral differences between virtual machines and bare metal systems. + +This file documents some of the known limitations that KVM has in +virtualizing CPU features. + +x86 +=3D=3D=3D + +``KVM_GET_SUPPORTED_CPUID`` issues +---------------------------------- + +x87 features +~~~~~~~~~~~~ + +Unlike most other CPUID feature bits, CPUID[EAX=3D7,ECX=3D0]:EBX[6] +(FDP_EXCPTN_ONLY) and CPUID[EAX=3D7,ECX=3D0]:EBX]13] (ZERO_FCS_FDS) are +clear if the features are present and set if the features are not present. + +Clearing these bits in CPUID has no effect on the operation of the guest; +if these bits are set on hardware, the features will not be present on +any virtual machine that runs on that hardware. + +**Workaround:** It is recommended to always set these bits in guest CPUID. +Note however that any software (e.g ``WIN87EM.DLL``) expecting these featu= res +to be present likely predates these CPUID feature bits, and therefore +doesn't know to check for them anyway. + +Nested virtualization features +------------------------------ + +TBD + diff --git a/Documentation/virt/kvm/x86/index.rst b/Documentation/virt/kvm/= x86/index.rst index 55ede8e070b6..7ff588826b9f 100644 --- a/Documentation/virt/kvm/x86/index.rst +++ b/Documentation/virt/kvm/x86/index.rst @@ -9,6 +9,7 @@ KVM for x86 systems =20 amd-memory-encryption cpuid + errata halt-polling hypercalls mmu --=20 2.35.1 From nobody Mon Jun 22 14:24:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9E5C433F5 for ; Tue, 22 Mar 2022 11:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234013AbiCVLJK (ORCPT ); Tue, 22 Mar 2022 07:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233947AbiCVLIt (ORCPT ); Tue, 22 Mar 2022 07:08:49 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FE0480212; Tue, 22 Mar 2022 04:07:21 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id bg31-20020a05600c3c9f00b00381590dbb33so1275074wmb.3; Tue, 22 Mar 2022 04:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PyWMhkHDA8FmVbcGzMZ4aLs+B2iNMXC/LNGOuXbuKpU=; b=iQCE9QOgyw6+P9QVFLZAqRW03I/v4JSOqAJWIh5qRkD2sHMeVC9mZS4KjYbYEF+1k6 o4BGtsO6wS6PzkxrkVjCWSNZ+PELapUEkIDc7I9glm8E9c/4BMMzYwgvegiJxSYQoLts 0ZwSKqdAHt2KJnQXijV7qw5CGVr3pLOJfPRRqR9oARvw/T2S863WB1W9WvJnX0yOqAdH a+QrSbsFSFSmBKfadMrPReHwfNdREk0kDpicDsCzKoteaGZjfs8PgbDGqv+ZAnfn7r4v EVNZLySbtOOt6KlMLnInyn36i7sTDJuXQj91OZXjicEZh5lwzdhZ+UHYgP9fVBrUftza Gfjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=PyWMhkHDA8FmVbcGzMZ4aLs+B2iNMXC/LNGOuXbuKpU=; b=a0gDgNdNUpOKzREEd2W9Kmi8CVXaQ+eCLY0ExTTsXpSnsEOxL/f5HQGdXLZQp9+6g9 VjEJOXdOyBOUw1flI+hgGG4ABlMUZjFbRcnE6tqGeNhTkv0LdKFY38g+cr9kOHIK7Klw XiOkd5oPrpH3Pg19R8yZXSLpwMZGhJ1jAYlHWios+v6e0rsnZQqRG2MtEH6XBFOzI69C C0aGc+88jSSgQF+zb04Ode9C77s9/hNNe1k+xvSODZsEabTSjKjYoA1qhl5dVbi9IlUM 2bYNdjSwTsSZGbXhYjisfrw3OGMXVlM/L4ejP2k7yxaj9my7yEwxtsM+l2xynfmzNjuQ 98Iw== X-Gm-Message-State: AOAM532XeVAYxWF3j5DpJgarF0efBihmbRSe6NQF0KNN8qK+L51zGsq9 7jPbx4iAxtmpDkcxlfsb1jBPi6XsclQ= X-Google-Smtp-Source: ABdhPJxlFbZVNjAss+JR1DFkgQFHuwfEo2WgGvgMyD3D5ryBmDRfyGcdhKMgU74bUwPECCY3/iGNug== X-Received: by 2002:a5d:6101:0:b0:204:871e:9912 with SMTP id v1-20020a5d6101000000b00204871e9912mr2504628wrt.60.1647947239442; Tue, 22 Mar 2022 04:07:19 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b0038c949ef0d5sm1746379wmq.8.2022.03.22.04.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 04:07:18 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: mlevitsk@redhat.com, jmattson@google.com Subject: [PATCH 3/3] Documentation: KVM: add API issues section Date: Tue, 22 Mar 2022 12:07:12 +0100 Message-Id: <20220322110712.222449-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322110712.222449-1-pbonzini@redhat.com> References: <20220322110712.222449-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a section to document all the different ways in which the KVM API sucks. I am sure there are way more, give people a place to vent so that userspace authors are aware. Signed-off-by: Paolo Bonzini --- Documentation/virt/kvm/api.rst | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 9f3172376ec3..8787fcd3b23f 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -7575,3 +7575,49 @@ The argument to KVM_ENABLE_CAP is also a bitmask, an= d must be a subset of the result of KVM_CHECK_EXTENSION. KVM will forward to userspace the hypercalls whose corresponding bit is in the argument, and return ENOSYS for the others. + +9. Known KVM API problems +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +In some cases, KVM's API has some inconsistencies or common pitfalls +that userspace need to be aware of. This section details some of +these issues. + +Most of them are architecture specific, so the section is split by +architecture. + +9.1. x86 +-------- + +``KVM_GET_SUPPORTED_CPUID`` issues +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In general, ``KVM_GET_SUPPORTED_CPUID`` is designed so that it is possible +to take its result and pass it directly to ``KVM_SET_CPUID2``. This secti= on +documents some cases in which that requires some care. + +Local APIC features +~~~~~~~~~~~~~~~~~~~ + +CPU[EAX=3D1]:ECX[21] (X2APIC) is reported by ``KVM_GET_SUPPORTED_CPUID``, +but it can only be enabled if ``KVM_CREATE_IRQCHIP`` or +``KVM_ENABLE_CAP(KVM_CAP_IRQCHIP_SPLIT)`` are used to enable in-kernel emu= lation of +the local APIC. + +The same is true for the ``KVM_FEATURE_PV_UNHALT`` paravirtualized feature. + +CPU[EAX=3D1]:ECX[24] (TSC_DEADLINE) is not reported by ``KVM_GET_SUPPORTED= _CPUID``. +It can be enabled if ``KVM_CAP_TSC_DEADLINE_TIMER`` is present and the ker= nel +has enabled in-kernel emulation of the local APIC. + +Obsolete ioctls and capabilities +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +KVM_CAP_DISABLE_QUIRKS does not let userspace know which quirks are actual= ly +available. Use ``KVM_CHECK_EXTENSION(KVM_CAP_DISABLE_QUIRKS2)`` instead if +available. + +Ordering of KVM_GET_*/KVM_SET_* ioctls +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +TBD --=20 2.35.1