From nobody Mon Apr 29 13:06:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527244929309909.5145871299643; Fri, 25 May 2018 03:42:09 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 9823630CA2DB; Fri, 25 May 2018 10:42:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4BC685B68A; Fri, 25 May 2018 10:42:07 +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 AD85D180BA83; Fri, 25 May 2018 10:42:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4PAduTt028238 for ; Fri, 25 May 2018 06:39:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id C40852010CB0; Fri, 25 May 2018 10:39:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB4ED2010CA4 for ; Fri, 25 May 2018 10:39:54 +0000 (UTC) Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 604743A80F9 for ; Fri, 25 May 2018 10:39:42 +0000 (UTC) Received: by mail-wr0-f173.google.com with SMTP id w3-v6so8367575wrl.12 for ; Fri, 25 May 2018 03:39:42 -0700 (PDT) Received: from filip.redhat.com ([213.175.37.12]) by smtp.googlemail.com with ESMTPSA id t198-v6sm8322815wmt.23.2018.05.25.03.39.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 03:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cGCsIeMsERYRrjMofgR2EilqsIrrJn9FkF5vzwCRpvU=; b=nxrLynx04jsIJAjN+mO7YmORr1hH8rp5laIdHvp1RkJaEeRynwnmZmMOeAwwLhE1kA 7SBQdAorkHg4svUnDTNsGitknSRgjkxb8PXPzXxpwvQb29bnAZnFvDPUQOXUHfuxAED3 0XvGZ+lvo9wtgDv5J8GqNv2vsQOnKkJik0+CzjRdW08jNR2w3IMgDCfC5BUl2Q+auVQf Zz0MtyAVaPx9e82htlI6thjbp94Em9gP+gNEXO+r3UcgYrlWo0ayCdSDEHz8q2H2bs8s HAzx99yPmYN0c1QdokWtq8GJto10HL7BVlK1Fq2sj/b0AFTYvItSkOraCqZxqYCFP1vL xMNg== 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; bh=cGCsIeMsERYRrjMofgR2EilqsIrrJn9FkF5vzwCRpvU=; b=EnqqnoMDboICG/X+1SHHnv1nUABZarvZk5GYOpG5rj/fc+mwZlDlhEmkR+A+MAQoHY BhevJO3By/9lV7X8K/evD0kOSZXHaitHbch2JZoBD8JvhV/q31DiJTmxNloY2P18WofC zc40FRC59alm5HBCAakPXX/mCB8aF2EXclAV4sGxukhjZdf0XEPcUlJ2gp1WV5oywkkB y+lX2wPM15ToZhwgUmUvWHIJ8Trf98psVIju6Unv4x6gVJqDZYhedun1lWR6EZbmiM74 Drcj13VfvNSVP0RBXRTwa2fTT/zuHPOxKPjR+jBj96n8ICn8TEhdhM852eI66NpsXqI1 wyGA== X-Gm-Message-State: ALKqPweCm+YjI4kvnym3eVonzENXQW1k+cd7nQZFWPTAwdSqYrKpCGfM 6NXym5nCFbjHru9Awbx1LOHe1A== X-Google-Smtp-Source: AB8JxZrfSIKX0UEG8tnWVadwBCwj1zziHIH4SazuxkwMgHwCaRG31+0KU0/gx15JAq968V5LPNyp3g== X-Received: by 2002:adf:f74c:: with SMTP id z12-v6mr1773670wrp.165.1527244780720; Fri, 25 May 2018 03:39:40 -0700 (PDT) From: Filip Alac To: libvir-list@redhat.com Date: Fri, 25 May 2018 12:39:22 +0200 Message-Id: <20180525103923.1782-2-filipalac@gmail.com> In-Reply-To: <20180525103923.1782-1-filipalac@gmail.com> References: <20180525103923.1782-1-filipalac@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 25 May 2018 10:39:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 25 May 2018 10:39:42 +0000 (UTC) for IP:'209.85.128.173' DOMAIN:'mail-wr0-f173.google.com' HELO:'mail-wr0-f173.google.com' FROM:'filipalac@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.301 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.128.173 mail-wr0-f173.google.com 209.85.128.173 mail-wr0-f173.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Cc: Filip Alac Subject: [libvirt] [PATCH 1/2] capabilities: Provide info about host IOMMU support 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 25 May 2018 10:42:08 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D967231 Signed-off-by: Filip Alac --- docs/schemas/capability.rng | 11 +++++++++++ src/conf/capabilities.c | 8 ++++++++ src/conf/capabilities.h | 5 +++++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 4 ++++ src/util/virpci.c | 19 +++++++++++++++++++ src/util/virpci.h | 2 ++ 7 files changed, 50 insertions(+) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index e1ab5c224..7e7d8fbc7 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -39,6 +39,9 @@ + + + @@ -148,6 +151,14 @@ =20 + + + + + + + + diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index dd2fc77f9..eb387916f 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1020,6 +1020,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) } virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); + virBufferAsprintf(&buf, "\n", + caps->host.iommu ? "yes" : "no"); } else { /* The host does not support any PM feature. */ virBufferAddLit(&buf, "\n"); @@ -1743,3 +1745,9 @@ virCapabilitiesInitCaches(virCapsPtr caps) virBitmapFree(cpus); return ret; } + +int +virCapabilitiesHostInitIOMMU(virCapsPtr caps) +{ + return caps->host.iommu =3D virPCIHasIOMMU(); +} diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index f0a06a24d..4d41363a3 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -183,6 +183,7 @@ struct _virCapsHost { int nPagesSize; /* size of pagesSize array */ unsigned int *pagesSize; /* page sizes support on the system */ unsigned char host_uuid[VIR_UUID_BUFLEN]; + int iommu; }; =20 typedef int (*virDomainDefNamespaceParse)(xmlDocPtr, xmlNodePtr, @@ -327,4 +328,8 @@ void virCapsHostCacheBankFree(virCapsHostCacheBankPtr p= tr); =20 int virCapabilitiesInitCaches(virCapsPtr caps); =20 +int virCapabilitiesInitCaches(virCapsPtr caps); + +int virCapabilitiesHostInitIOMMU(virCapsPtr caps); + #endif /* __VIR_CAPABILITIES_H */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a97b7fe22..258d02962 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -58,6 +58,7 @@ virCapabilitiesFreeMachines; virCapabilitiesFreeNUMAInfo; virCapabilitiesGetCpusForNodemask; virCapabilitiesGetNodeInfo; +virCapabilitiesHostInitIOMMU; virCapabilitiesHostSecModelAddBaseLabel; virCapabilitiesInitCaches; virCapabilitiesInitNUMA; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 8a63db5f4..552d5452d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -948,6 +948,10 @@ virQEMUCapsInit(virFileCachePtr cache) if (virCapabilitiesInitPages(caps) < 0) VIR_WARN("Failed to get pages info"); =20 + /* Add IOMMU info */ + if (virCapabilitiesHostInitIOMMU(caps) < 0) + VIR_WARN("Failed to get iommmu info"); + /* Add domain migration transport URIs */ virCapabilitiesAddHostMigrateTransport(caps, "tcp"); virCapabilitiesAddHostMigrateTransport(caps, "rdma"); diff --git a/src/util/virpci.c b/src/util/virpci.c index 8d0236666..c88b13c97 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -3288,3 +3288,22 @@ virPCIEDeviceInfoFree(virPCIEDeviceInfoPtr dev) VIR_FREE(dev->link_sta); VIR_FREE(dev); } + +bool +virPCIHasIOMMU(void) +{ + struct stat sb; + + /* We can only check on newer kernels with iommu groups & vfio */ + if (stat("/sys/kernel/iommu_groups", &sb) < 0) + return false; + + if (!S_ISDIR(sb.st_mode)) + return false; + + /* Check if folder is empty */ + if (sb.st_nlink <=3D 2) + return false; + + return true; +} diff --git a/src/util/virpci.h b/src/util/virpci.h index 794b7e59d..93ea8cdf6 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -253,4 +253,6 @@ void virPCIEDeviceInfoFree(virPCIEDeviceInfoPtr dev); ssize_t virPCIGetMdevTypes(const char *sysfspath, virMediatedDeviceType ***types); =20 +bool virPCIHasIOMMU(void); + #endif /* __VIR_PCI_H__ */ --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:06:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15272449357381012.4892634824894; Fri, 25 May 2018 03:42:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E40B30DD753; Fri, 25 May 2018 10:42:14 +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 EC24D308BDA3; Fri, 25 May 2018 10:42:13 +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 9AEA04CA85; Fri, 25 May 2018 10:42:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4PAe1PL028251 for ; Fri, 25 May 2018 06:40:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 571B245D5; Fri, 25 May 2018 10:40:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C30845CF for ; Fri, 25 May 2018 10:39:56 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53385300DF5 for ; Fri, 25 May 2018 10:39:45 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id f8-v6so13339842wmc.4 for ; Fri, 25 May 2018 03:39:45 -0700 (PDT) Received: from filip.redhat.com ([213.175.37.12]) by smtp.googlemail.com with ESMTPSA id t198-v6sm8322815wmt.23.2018.05.25.03.39.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 03:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RP0gDjXrUL9Aeovfi7VExFQZje28oPcYjzuAJhANjoA=; b=cnmGEpG5dfK0vFuWEOlvDEp3m+H9789L3yOlGelx5VKA/kxRtiO5L1ma/cgLIQQOhb Pw4VTvXA9xfZ47fMnzFGDPPhVqRQ1S8P2TSaX6nE2OjhJ9/rzdOrJ1acrirfN64JnwSK V8Ju6D4LONtM3QadfEAFYVxvaUBvIZIq+VLAlZb0lPabei1ddKdM3o+26fZjdeqHFwpy GO9AQbByWZbl3GNmpo8yoGVK++gzOPKM/G2GUaoYbTYgsLNlig7kSRuLvXnt1f+yrCON oYjZGVQyvqBlNvCwR3le/9m/g5O6VPLp6EfY6vvo+nkj7/k6+M2e0znIWn4/GFPkig0X gw3Q== 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; bh=RP0gDjXrUL9Aeovfi7VExFQZje28oPcYjzuAJhANjoA=; b=BIx3JZMNdyAvHjj+o/HxGLhxPybegkcqdVQwtTdEuw7fMg6Z079ysyKohU+e+csfNy Y4cH0zLxwtuaVr3RQr3hcBmAY6RF/b/hadiiG8dSfANcUJ9Y4YVTWOPkfFV3UtiBTRHF MVz4ezJM7x4JODjC9iD0uoKhSBhH2wE1qatpNzIOHhZccBIlptMHvmzRFvSTmihWe6iW FSrjZahNdxBXr9BYgf5gRayzkx1mnFuqYBEGHExiwtLwrejrB1BaXBmvOp5FfSsNgvmm AOO0G/vsxibx3UAWtgU1Kt382COUnX6zlWXSDc52ir0d3RvMmdk16NWa6qfflkXjuq4U qLiw== X-Gm-Message-State: ALKqPwc5cyE8OxO3JMdOqPTN8vY+RgKzMuRCWoeLjQDzkMWKixU3Rk05 r3PymMtQcyHvX1YomoQVGNSquw== X-Google-Smtp-Source: AB8JxZp6rjmsPZfS4a4/XAOQqPnbDs//UgRClVzffXvUvUM9dVewJiIbXgznyFmI+ZuhZSfOl+UMVw== X-Received: by 2002:a1c:711c:: with SMTP id m28-v6mr1459266wmc.92.1527244783796; Fri, 25 May 2018 03:39:43 -0700 (PDT) From: Filip Alac To: libvir-list@redhat.com Date: Fri, 25 May 2018 12:39:23 +0200 Message-Id: <20180525103923.1782-3-filipalac@gmail.com> In-Reply-To: <20180525103923.1782-1-filipalac@gmail.com> References: <20180525103923.1782-1-filipalac@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 25 May 2018 10:39:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 25 May 2018 10:39:45 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'filipalac@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Filip Alac Subject: [libvirt] [PATCH 2/2] docs: news: Add entry about iommu_support 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 25 May 2018 10:42:14 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Filip Alac --- docs/news.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 693d4a373..babf13379 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -93,6 +93,14 @@ secret-event, pool-event and nodedev-event) + + + capabilities: Provide info about host IOMMU support + + + Capabilities XML now provide information about host IOMMU suppor= t. + +
--=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list