From nobody Sun May 5 17:55:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571938167; cv=none; d=zoho.com; s=zohoarc; b=iuvA7uf89e+RGacTUpc3rwP6E05D+KA9twGwe7OUSGpKkshUSLzW/RNfQFoeHpL+vOgdFMjOSI99nVw6RJLswMnNnaL+K2n4TTdvaiJewElzehQ3T3r+rB4dFNCPrzkNDUK1bMTRxmI0GbRm7FqF4g04IAaYvXxy5zhnrTVHKOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571938167; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HV92JN9is0D+789nUiqAS3ZfzkZcBHCdWvpXRQuMiqo=; b=Q0ux1POSWY45I2hO+QJjhOVQpfjPtK0D2aIM7o6pQzZKOtLHBnR2ozYl2rLzIj4nLLGetvOVNNsN9lPI4Tw4msGgl2gsH7uyJheN4P7YBJvclcOZjGq8rjlwlOxRODkVVKx0dsMzzm7NgbQ741OcZgNm9zeaCKGNTVkDZWTYdg8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571938167211253.6210829829423; Thu, 24 Oct 2019 10:29:27 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNgu0-0008AR-BT; Thu, 24 Oct 2019 17:28:00 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNgtz-0008AM-K4 for xen-devel@lists.xenproject.org; Thu, 24 Oct 2019 17:27:59 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9ef0ccd5-f683-11e9-94ab-12813bfff9fa; Thu, 24 Oct 2019 17:27:58 +0000 (UTC) X-Inumbo-ID: 9ef0ccd5-f683-11e9-94ab-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571938078; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=bIncVFUqOaY7r6BAE6cM3jnH2xJ9AXIgZ4sNPc/YRd8=; b=hFl65Xb57YhIGVAPUnnaT7NlG9pNERX2TEEpHfD0eiVMcwWvsPmyl49c nJFUZ6qz40Uu9jIYWeYeYL9sxp32Ar1ehgyWY1NvQl7D88VlrhamOhvjb 3eGXgFhLcV4oa5myCtGjz12tL16rn6+IoRMhdZSU7kIOSYH9Fb9WWqceC 8=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: VnJZYlJ7wVpjGE6n9PzAidhSKmR81bqbIiRUPx/QVNJHlQ/uM9dNfvzD/JZmyojJy31/izH4e5 fpq5lT4O3eAqWMar+Xaz6Z4kU3o26GPwHXr+bqNBTD97xJXbo4qOUD00LP8s5XwYQCl9Lc8vky 5IX2ZS9Z3nscDNGBbJb3ELJovYX9tvi8a+O5UOi4YkLcbRoc1t//7YlRLGeSViAkmRhxtXSsK6 gP948IIY3pDhSd8JnT0AKwIAcSDQvoFXPIrVg+OJ77/x+rEJEJR2CLGUm4cWF5YQi9qsT0ib4u Px4= X-SBRS: 2.7 X-MesageID: 7746716 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,225,1569297600"; d="scan'208";a="7746716" From: Andrew Cooper To: Xen-devel Date: Thu, 24 Oct 2019 18:27:31 +0100 Message-ID: <20191024172731.15752-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/VT-d: Misc initialisation cleanup X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Kevin Tian , Jan Beulich , Wei Liu , Andrew Cooper , Jun Nakajima , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) * Initialise all spinlock fields together * No need for an atomic set_bit() to initialise domid_bitmap * Avoid using partial-line printk()'s. * Style fixes (too many, and too few spaces) No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Kevin Tian --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Jun Nakajima CC: Kevin Tian CC: Juergen Gross This isn't required for 4.13, but it is a couple of nice-to-have's and we're still at the early RC phase. --- xen/drivers/passthrough/vtd/iommu.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/= vtd/iommu.c index 0522ecd3bc..4a759d33cd 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1145,6 +1145,8 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd) iommu->msi.irq =3D -1; /* No irq assigned yet. */ iommu->node =3D NUMA_NO_NODE; INIT_LIST_HEAD(&iommu->ats_devices); + spin_lock_init(&iommu->lock); + spin_lock_init(&iommu->register_lock); spin_lock_init(&iommu->intremap.lock); =20 iommu->drhd =3D drhd; @@ -1197,21 +1199,18 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd) nr_dom =3D cap_ndoms(iommu->cap); iommu->domid_bitmap =3D xzalloc_array(unsigned long, BITS_TO_LONGS(nr_= dom)); if ( !iommu->domid_bitmap ) - return -ENOMEM ; + return -ENOMEM; =20 /* * if Caching mode is set, then invalid translations are tagged with * domain id 0, Hence reserve bit 0 for it */ if ( cap_caching_mode(iommu->cap) ) - set_bit(0, iommu->domid_bitmap); + __set_bit(0, iommu->domid_bitmap); =20 iommu->domid_map =3D xzalloc_array(u16, nr_dom); if ( !iommu->domid_map ) - return -ENOMEM ; - - spin_lock_init(&iommu->lock); - spin_lock_init(&iommu->register_lock); + return -ENOMEM; =20 return 0; } @@ -2272,15 +2271,10 @@ static int __init vtd_setup(void) { iommu =3D drhd->iommu; =20 - printk("Intel VT-d iommu %"PRIu32" supported page sizes: 4kB", - iommu->index); - if (cap_sps_2mb(iommu->cap)) - printk(", 2MB"); - - if (cap_sps_1gb(iommu->cap)) - printk(", 1GB"); - - printk(".\n"); + printk("Intel VT-d iommu %u supported page sizes: 4kB%s%s\n", + iommu->index, + cap_sps_2mb(iommu->cap) ? ", 2MB" : "", + cap_sps_1gb(iommu->cap) ? ", 1GB" : ""); =20 if ( iommu_snoop && !ecap_snp_ctl(iommu->ecap) ) iommu_snoop =3D 0; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel