{"id":813925,"url":"http://patchwork.ozlabs.org/api/patches/813925/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/150541714343.1616.11893912014879112098.stgit@bahia.lan/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<150541714343.1616.11893912014879112098.stgit@bahia.lan>","list_archive_url":null,"date":"2017-09-14T19:25:43","name":"[3/3] ppc/kvm: check some capabilities with kvm_vm_check_extension()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"715b826d709f2ed71bd8264f11de15721b8d23d7","submitter":{"id":69178,"url":"http://patchwork.ozlabs.org/api/people/69178/?format=json","name":"Greg Kurz","email":"groug@kaod.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/150541714343.1616.11893912014879112098.stgit@bahia.lan/mbox/","series":[{"id":3152,"url":"http://patchwork.ozlabs.org/api/series/3152/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3152","date":"2017-09-14T19:25:11","name":"kvm: use kvm_vm_check_extension() with VM capabilities","version":1,"mbox":"http://patchwork.ozlabs.org/series/3152/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813925/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813925/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtT8V6GQ0z9s4s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 05:28:10 +1000 (AEST)","from localhost ([::1]:49655 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsZo0-00038z-VI\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 15:28:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53829)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1dsZlq-0001ii-Ew\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 15:25:58 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1dsZlm-000687-DL\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 15:25:54 -0400","from 7.mo2.mail-out.ovh.net ([188.165.48.182]:51324)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <groug@kaod.org>) id 1dsZlm-00067N-0R\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 15:25:50 -0400","from player770.ha.ovh.net (b6.ovh.net [213.186.33.56])\n\tby mo2.mail-out.ovh.net (Postfix) with ESMTP id 01F2AABC7F\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 21:25:48 +0200 (CEST)","from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139])\n\t(Authenticated sender: groug@kaod.org)\n\tby player770.ha.ovh.net (Postfix) with ESMTPA id A28FE3C006E;\n\tThu, 14 Sep 2017 21:25:43 +0200 (CEST)"],"From":"Greg Kurz <groug@kaod.org>","To":"qemu-devel@nongnu.org","Date":"Thu, 14 Sep 2017 21:25:43 +0200","Message-ID":"<150541714343.1616.11893912014879112098.stgit@bahia.lan>","In-Reply-To":"<150541711102.1616.2690784964841960181.stgit@bahia.lan>","References":"<150541711102.1616.2690784964841960181.stgit@bahia.lan>","User-Agent":"StGit/0.17.1-46-g6855-dirty","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-Ovh-Tracer-Id":"15545300017006483762","X-VR-SPAMSTATE":"OK","X-VR-SPAMSCORE":"-100","X-VR-SPAMCAUSE":"gggruggvucftvghtrhhoucdtuddrfeelledrgeeigddugedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"188.165.48.182","Subject":"[Qemu-devel] [PATCH 3/3] ppc/kvm: check some capabilities with\n\tkvm_vm_check_extension()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>,\n\tqemu-ppc@nongnu.org, Sam Bobroff <sam.bobroff@au1.ibm.com>,\n\tDavid Gibson <david@gibson.dropbear.id.au>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"The following capabilities are VM specific:\n- KVM_CAP_PPC_SMT_POSSIBLE\n- KVM_CAP_PPC_HTAB_FD\n- KVM_CAP_PPC_ALLOC_HTAB\n\nIf both KVM HV and KVM PR are present, checking them always return\nthe HV value, even if we explicitely requested to use PR.\n\nThis has no visible effect for KVM_CAP_PPC_ALLOC_HTAB, because we also\ntry the KVM_PPC_ALLOCATE_HTAB ioctl which is only suppored by HV. As\na consequence, the spapr code doesn't even check KVM_CAP_PPC_HTAB_FD.\n\nHowever, this will cause kvmppc_hint_smt_possible(), introduced by\ncommit fa98fbfcdfcb9, to report several VSMT modes (eg, Available\nVSMT modes: 8 4 2 1) whereas PR only support mode 1.\n\nThis patch fixes all three anyway to use kvm_vm_check_extension(). It\nis okay since the VM is already created at the time kvm_arch_init() or\nkvmppc_reset_htab() is called.\n\nSigned-off-by: Greg Kurz <groug@kaod.org>\n---\n target/ppc/kvm.c |    6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c\nindex 1deaf106d2b9..208c70e81426 100644\n--- a/target/ppc/kvm.c\n+++ b/target/ppc/kvm.c\n@@ -131,7 +131,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)\n     cap_interrupt_level = kvm_check_extension(s, KVM_CAP_PPC_IRQ_LEVEL);\n     cap_segstate = kvm_check_extension(s, KVM_CAP_PPC_SEGSTATE);\n     cap_booke_sregs = kvm_check_extension(s, KVM_CAP_PPC_BOOKE_SREGS);\n-    cap_ppc_smt_possible = kvm_check_extension(s, KVM_CAP_PPC_SMT_POSSIBLE);\n+    cap_ppc_smt_possible = kvm_vm_check_extension(s, KVM_CAP_PPC_SMT_POSSIBLE);\n     cap_ppc_rma = kvm_check_extension(s, KVM_CAP_PPC_RMA);\n     cap_spapr_tce = kvm_check_extension(s, KVM_CAP_SPAPR_TCE);\n     cap_spapr_tce_64 = kvm_check_extension(s, KVM_CAP_SPAPR_TCE_64);\n@@ -143,7 +143,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)\n     cap_ppc_watchdog = kvm_check_extension(s, KVM_CAP_PPC_BOOKE_WATCHDOG);\n     /* Note: we don't set cap_papr here, because this capability is\n      * only activated after this by kvmppc_set_papr() */\n-    cap_htab_fd = kvm_check_extension(s, KVM_CAP_PPC_HTAB_FD);\n+    cap_htab_fd = kvm_vm_check_extension(s, KVM_CAP_PPC_HTAB_FD);\n     cap_fixup_hcalls = kvm_check_extension(s, KVM_CAP_PPC_FIXUP_HCALL);\n     cap_ppc_smt = kvm_vm_check_extension(s, KVM_CAP_PPC_SMT);\n     cap_htm = kvm_vm_check_extension(s, KVM_CAP_PPC_HTM);\n@@ -2353,7 +2353,7 @@ int kvmppc_reset_htab(int shift_hint)\n         /* Full emulation, tell caller to allocate htab itself */\n         return 0;\n     }\n-    if (kvm_check_extension(kvm_state, KVM_CAP_PPC_ALLOC_HTAB)) {\n+    if (kvm_vm_check_extension(kvm_state, KVM_CAP_PPC_ALLOC_HTAB)) {\n         int ret;\n         ret = kvm_vm_ioctl(kvm_state, KVM_PPC_ALLOCATE_HTAB, &shift);\n         if (ret == -ENOTTY) {\n","prefixes":["3/3"]}