From nobody Thu Apr 25 21:33:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1592600706; cv=none; d=zohomail.com; s=zohoarc; b=ABdv/My0Hapc53KblWYHykIPDNcuoAMpdzUq5DGHnLM1XfdWOtN7B6Kf0FVwUiKuGuySJWO1iR4xWsqi7GBrCr8hpK+qV3pvLoZcyAHId8+eXH4mKB80k0lKlcZdTamMvtnOaLqwZ510Z+MnO1SF85bcjoARL7fBOWsQQrBujFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592600706; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gfC/NvvT+tUrOjnTOBdeoy2OePKDt4ZOHPp9bwGULhs=; b=TW67TBopjjMxRYgihB0bwq+oyqS3wvEgNnSCwtZnjOpRcXQ49PLVcRfZ+nq0YJRY3x4PlCb21uxXQjhR7r3716fDW52Ejwn4SkYLPMWTgacm7ie9rBAQ7/MtwZ7eJlsCbW4De+ZeJ4CRvjTm1QgBHcVNwALdEyXaYl8BLau/OFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592600706167730.6802050589771; Fri, 19 Jun 2020 14:05:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-T4Jiqi5ePACX5fLt9muLpg-1; Fri, 19 Jun 2020 17:05:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 632B58015CE; Fri, 19 Jun 2020 21:04:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA9465BAC3; Fri, 19 Jun 2020 21:04:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 18729833C9; Fri, 19 Jun 2020 21:04:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05JL4pex004993 for ; Fri, 19 Jun 2020 17:04:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 824462166B27; Fri, 19 Jun 2020 21:04:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DF5F2157F26 for ; Fri, 19 Jun 2020 21:04:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5ED20800294 for ; Fri, 19 Jun 2020 21:04:49 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-V-hSJqTXOLSXIbsR4QD3LQ-1; Fri, 19 Jun 2020 17:04:47 -0400 Received: by mail-qt1-f194.google.com with SMTP id x62so4934423qtd.3 for ; Fri, 19 Jun 2020 14:04:47 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:f4fd:8bc3:b592:166:c3c7]) by smtp.gmail.com with ESMTPSA id q124sm7792047qke.51.2020.06.19.14.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 14:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592600704; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gfC/NvvT+tUrOjnTOBdeoy2OePKDt4ZOHPp9bwGULhs=; b=Egpl+cDT2sWarMLjg2EmrCln+KFZ80zK2xKRlf6RatB3zfxoIQGU0rcA1iiyF6U62ur6+R yqYBzH80uTdfjKD45EnDKSPfdZx+IoxafHM4yqRuy1v1a/PsJcBUgdYgLVNYpjPUtQ0830 ZwdvLVozoLOcZYZlNrT7V0W1eH8YT7A= X-MC-Unique: T4Jiqi5ePACX5fLt9muLpg-1 X-MC-Unique: V-hSJqTXOLSXIbsR4QD3LQ-1 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=gfC/NvvT+tUrOjnTOBdeoy2OePKDt4ZOHPp9bwGULhs=; b=bbhZJihF6APPh5/cHQOsCLne6nLXS3C1GuLV5UMECUjuFH5ZZyLBxBctubmDgo/Y0i 5upZ46pUZs8V2Zk5IHYqeiTb1ukmFtfsiJ411DHsrl6STktqnOmtheY2JYgrnNJntxhq ObTCDZ/GED9WEC+/1AnGgcWSlrK2xH3vhipt0PN2Bb+JrgDw9c9LfpfXF461tb9/omz5 5gaQRFMDU3dg3+hdKdZ/Q2UoWm69NgyF3PDoSFJyp5qd0k6Iaeq8ILckDPyyWxmr2xYw TgkH3KdMbWsPwJpJAkIkyBP/kT8sJING6cOVGDts1ZA0A68iYS/bnp+GreFujmOa8h7k 4AOA== X-Gm-Message-State: AOAM532p2jIzBzEIForuzDLZiA/T009LW5wsT6qhplsojt5P9MPlwvsn 9EhW8Yql+3uqE5UO22EatRhjDR6J X-Google-Smtp-Source: ABdhPJz6nFeAmRtw3wB2Bg2V3nzk0DxWrwVj6mO376OKWC9vu+LTyEeModsonFudwHHbeaEjvqIo1w== X-Received: by 2002:ac8:5301:: with SMTP id t1mr5327832qtn.310.1592600686395; Fri, 19 Jun 2020 14:04:46 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 1/2] virt-host-validade-common: move virHostKernelModuleIsLoaded to virkmod Date: Fri, 19 Jun 2020 18:04:32 -0300 Message-Id: <20200619210433.516877-2-danielhb413@gmail.com> In-Reply-To: <20200619210433.516877-1-danielhb413@gmail.com> References: <20200619210433.516877-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function will be used in a later patch by QEMU code. Rename it to virKModIsLoaded to be compliant with the other helpers. Signed-off-by: Daniel Henrique Barboza --- src/libvirt_private.syms | 1 + src/util/virkmod.c | 34 +++++++++++++++++++++++++++++++ src/util/virkmod.h | 1 + tools/virt-host-validate-common.c | 27 ------------------------ tools/virt-host-validate-common.h | 2 -- tools/virt-host-validate-qemu.c | 3 ++- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 42f8d7c222..b86d7e3cb0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2404,6 +2404,7 @@ virKeycodeValueTranslate; # util/virkmod.h virKModConfig; virKModIsBlacklisted; +virKModIsLoaded; virKModLoad; virKModUnload; =20 diff --git a/src/util/virkmod.c b/src/util/virkmod.c index 12cb5920e8..3110f3bf8b 100644 --- a/src/util/virkmod.c +++ b/src/util/virkmod.c @@ -24,6 +24,7 @@ #include "virkmod.h" #include "vircommand.h" #include "virstring.h" +#include "virfile.h" =20 static int doModprobe(const char *opts, const char *module, char **outbuf, char **err= buf) @@ -60,6 +61,39 @@ doRmmod(const char *module, char **errbuf) return 0; } =20 + +/** + * virKModModuleIsLoaded: + * + * Returns true if the module is loaded, false otherwise. + */ +bool virKModIsLoaded(const char *module) +{ + FILE *fp; + bool ret =3D false; + + if (!(fp =3D fopen("/proc/modules", "r"))) + return false; + + do { + char line[1024]; + + if (!fgets(line, sizeof(line), fp)) + break; + + if (STRPREFIX(line, module)) { + ret =3D true; + break; + } + + } while (1); + + VIR_FORCE_FCLOSE(fp); + + return ret; +} + + /** * virKModConfig: * diff --git a/src/util/virkmod.h b/src/util/virkmod.h index f05cf83cf6..db0d4aabe3 100644 --- a/src/util/virkmod.h +++ b/src/util/virkmod.h @@ -24,6 +24,7 @@ #include "internal.h" =20 char *virKModConfig(void); +bool virKModIsLoaded(const char *); char *virKModLoad(const char *, bool) ATTRIBUTE_NONNULL(1); char *virKModUnload(const char *) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-c= ommon.c index f68c9c7c96..5986c26a0d 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -417,33 +417,6 @@ int virHostValidateIOMMU(const char *hvname, } =20 =20 -bool virHostKernelModuleIsLoaded(const char *module) -{ - FILE *fp; - bool ret =3D false; - - if (!(fp =3D fopen("/proc/modules", "r"))) - return false; - - do { - char line[1024]; - - if (!fgets(line, sizeof(line), fp)) - break; - - if (STRPREFIX(line, module)) { - ret =3D true; - break; - } - - } while (1); - - VIR_FORCE_FCLOSE(fp); - - return ret; -} - - int virHostValidateSecureGuests(const char *hvname, virHostValidateLevel level) { diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-c= ommon.h index 3df5ea0c7e..87aeefe2bb 100644 --- a/tools/virt-host-validate-common.h +++ b/tools/virt-host-validate-common.h @@ -87,5 +87,3 @@ int virHostValidateIOMMU(const char *hvname, =20 int virHostValidateSecureGuests(const char *hvname, virHostValidateLevel level); - -bool virHostKernelModuleIsLoaded(const char *module); diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qem= u.c index ea7f172790..e590057c9c 100644 --- a/tools/virt-host-validate-qemu.c +++ b/tools/virt-host-validate-qemu.c @@ -27,6 +27,7 @@ #include "virarch.h" #include "virbitmap.h" #include "vircgroup.h" +#include "virkmod.h" =20 int virHostValidateQEMU(void) { @@ -92,7 +93,7 @@ int virHostValidateQEMU(void) if (arch =3D=3D VIR_ARCH_PPC64 || arch =3D=3D VIR_ARCH_PPC64LE) { virHostMsgCheck("QEMU", "%s", _("for PowerPC KVM module loaded")); =20 - if (!virHostKernelModuleIsLoaded("kvm_hv")) + if (!virKModIsLoaded("kvm_hv")) virHostMsgFail(VIR_HOST_VALIDATE_WARN, _("Load kvm_hv for better performance")); else --=20 2.26.2 From nobody Thu Apr 25 21:33:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1592600722; cv=none; d=zohomail.com; s=zohoarc; b=lc2jS8aSWHpib0DyzI0jZwu+2B4L08up7Oc4hoQVv0X7HnzWOUP+plAmcAUVRreXmVO3/zD0Ou/+TDFuKb4/Bszsln9MAmD/msfO6SqvKzidxdCH0vy+tnU/Nk5vebh7F/hGx51sdYhTxHkDbs8wtdIIe1uOl2gsgW86SrUrKuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592600722; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b3nnoWA1QJbj2jlQ37DfNVyCIsBJ0EhlWcFuGRpkqMw=; b=lDpRfhu0SP7fPhgLQFGGfLbChi8D/BjS7EKoC9N3iFUfpbbrXJpdp7RRmhsUpZcLZ7mCNqrvS4xvJcq2/fmaUAiaRlHxu4PdiQc6Tp1rDszGME5s5V7nCpoxaRCVWI20NfYSM2HzMsOdXqMfhArSLkYI5B51mnJdXt+3vdK92/E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1592600722173755.9470617906908; Fri, 19 Jun 2020 14:05:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-6vvEgId0PmWKRMob1t_pmg-1; Fri, 19 Jun 2020 17:05:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 13F4E18FE860; Fri, 19 Jun 2020 21:05:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3C7910002B5; Fri, 19 Jun 2020 21:05:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 91A44833D3; Fri, 19 Jun 2020 21:05:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05JL4rFE005004 for ; Fri, 19 Jun 2020 17:04:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id F1DFA2026E1C; Fri, 19 Jun 2020 21:04:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED3002026D67 for ; Fri, 19 Jun 2020 21:04:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9FD88007C9 for ; Fri, 19 Jun 2020 21:04:52 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-B675MW6qMous8YK3thFG8w-1; Fri, 19 Jun 2020 17:04:49 -0400 Received: by mail-qk1-f195.google.com with SMTP id q8so10269713qkm.12; Fri, 19 Jun 2020 14:04:49 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:f4fd:8bc3:b592:166:c3c7]) by smtp.gmail.com with ESMTPSA id q124sm7792047qke.51.2020.06.19.14.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 14:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592600721; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=b3nnoWA1QJbj2jlQ37DfNVyCIsBJ0EhlWcFuGRpkqMw=; b=YAvU61Ipj3PWhuDpJ84qi3yL9DlHtV/7+MVOZpeATwcFZwFbdUnFAb2DqSkcvd2b3HpFX+ TjkhuIdkIz1iXoUuuzxJb8alExPJblG0hFlra36h6k+gnDxm+zp/wHCtLyldrKCNgqICAI sFhjsmrQmkwE30jtTPLYzq96ap0ieXg= X-MC-Unique: 6vvEgId0PmWKRMob1t_pmg-1 X-MC-Unique: B675MW6qMous8YK3thFG8w-1 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=b3nnoWA1QJbj2jlQ37DfNVyCIsBJ0EhlWcFuGRpkqMw=; b=VsbCzO/Y5eYk5z1e0743/Xfvnsih73Efss24SPcvGgRslMMvZf2KdQuFaJGWvirc+i 9ecAifxCAXs00VTmD5HH+qzR21Tsw9/45EVKpYqFio+nRlMmWpiikI/3Z7JnkpWB3HRs v+9OSSENBUvZLARFO+16NvUAv7yJ1NYQ3F6IqYaSO8xSxmrKNBb/hnp/+kpxLQI+xEVW iSfPHTHCTZGsrmfZGGFlsJvUEbp9br3bbgDG0uaFj3LznrwMm58XkDTVP0xMYAmSe7rS h6AtD2wO6t70rQZf8n8kaV1DHmcCvl3CJXdQ9oc3w2i4SgbxbxhVl17Uqlejov5MNJ9V y0Qg== X-Gm-Message-State: AOAM533GnQFjAoOB0vhFlojZRsJnGiSzVZUbK8kWic0Qf3QHCBkl/Fyc AEo1xvPOFue2oEwt9uwnVBterKFu X-Google-Smtp-Source: ABdhPJyI/oJSpnsrMxQpj4ZaieYIo5vGIkgNPNqQEvOLb+HKpwEede/AsT+b38vf2UUg/b66uhvcZw== X-Received: by 2002:a37:9d8e:: with SMTP id g136mr5367161qke.25.1592600688724; Fri, 19 Jun 2020 14:04:48 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu_capabilities.c: drop 'kvm_pr' support for non-Power8 hosts Date: Fri, 19 Jun 2020 18:04:33 -0300 Message-Id: <20200619210433.516877-3-danielhb413@gmail.com> In-Reply-To: <20200619210433.516877-1-danielhb413@gmail.com> References: <20200619210433.516877-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Leonardo=20Augusto=20Guimar=C3=A3es=20Garcia?= , Daniel Henrique Barboza , Greg Kurz , David Gibson X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) PPC64 has two KVM modules: kvm_hv and kvm_pr. The official supported module was always kvm_hv, while kvm_pr was used for internal testing or for very niche cases in Power 8 hosts, always without official IBM or distro support. Problem is, QMP will report KVM supportfor PPC64 if any of these modules is loaded in the host, and kvm_pr is broken in everything but Power8 (and will remain broken, since kvm_pr is unmaintained). This can lead to situations like [1], where the tooling is misled to believe that the host has KVM capabilities when in reality it doesn't. The first reaction would be to simply forsake kvm_pr support entirely and move on, but there is no reason for now to be disruptive with any Power8 guests in the wild that are using kvm_pr (somehow). A more subtle approach is to not claim QEMU_CAPS_KVM support in all cases that we know it's completely broken, allowing Power8 users to take their shot using kvm_pr in their VMs. We can remove kvm_pr support completely when the module is removed from the kernel. [1] https://bugzilla.redhat.com/show_bug.cgi?id=3D1843865 CC: Leonardo Augusto Guimar=C3=A3es Garcia CC: Greg Kurz CC: David Gibson CC: Richard W.M. Jones Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 484fff99e5..b1c1d4dd70 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -49,6 +49,7 @@ #include "qemu_process.h" #include "qemu_firmware.h" #include "virutil.h" +#include "virkmod.h" =20 #include #include @@ -3242,6 +3243,31 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, } =20 =20 +static void +virQEMUCapsSetPPC64KVMState(virQEMUCapsPtr qemuCaps, virArch hostArch) +{ + g_autoptr(virCPUDef) hostCPU =3D virCPUProbeHost(hostArch); + + /* At this moment, PPC64 has two KVM modules: kvm_hv and kvm_pr. + * QEMU will return KVM present and enabled =3D true if any of these + * is loaded in the host. Thing is, kvm_pr was never officially + * supported by IBM or any other distro, but people still ended + * up using it in Power8 hosts regardless. It is also currently + * unmaintained and broken on Power9, and will be sunset in the + * future. kvm_hv is the only KVM module that is and will be + * supported. + * + * Until then, do not claim QEMU_CAPS_KVM if there is only kvm_pr + * loaded in the host. There is a good chance that there are + * unsupported kvm_pr Power8 guests running in the wild, so let's + * cut some slack for this case, for now. */ + if (STRNEQLEN(hostCPU->model, "POWER8", 6) && !virKModIsLoaded("kvm_hv= ")) + return; + + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); +} + + static int virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon) @@ -3252,8 +3278,16 @@ virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr qemuCaps, if (qemuMonitorGetKVMState(mon, &enabled, &present) < 0) return -1; =20 - if (present && enabled) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); + if (present && enabled) { + virArch hostArch =3D virArchFromHost(); + + if (ARCH_IS_PPC64(hostArch)) { + virQEMUCapsSetPPC64KVMState(qemuCaps, hostArch); + return 0; + } + + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); + } =20 return 0; } --=20 2.26.2