All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Juergen Gross" <jgross@suse.com>,
	"Kevin Tian" <kevin.tian@intel.com>,
	"Jan Beulich" <JBeulich@suse.com>, "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Jun Nakajima" <jun.nakajima@intel.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] x86/VT-d: Misc initialisation cleanup
Date: Thu, 24 Oct 2019 18:27:31 +0100	[thread overview]
Message-ID: <20191024172731.15752-1-andrew.cooper3@citrix.com> (raw)

 * 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 <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
CC: Juergen Gross <jgross@suse.com>

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 = -1; /* No irq assigned yet. */
     iommu->node = 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);
 
     iommu->drhd = drhd;
@@ -1197,21 +1199,18 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     nr_dom = cap_ndoms(iommu->cap);
     iommu->domid_bitmap = xzalloc_array(unsigned long, BITS_TO_LONGS(nr_dom));
     if ( !iommu->domid_bitmap )
-        return -ENOMEM ;
+        return -ENOMEM;
 
     /*
      * 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);
 
     iommu->domid_map = xzalloc_array(u16, nr_dom);
     if ( !iommu->domid_map )
-        return -ENOMEM ;
-
-    spin_lock_init(&iommu->lock);
-    spin_lock_init(&iommu->register_lock);
+        return -ENOMEM;
 
     return 0;
 }
@@ -2272,15 +2271,10 @@ static int __init vtd_setup(void)
     {
         iommu = drhd->iommu;
 
-        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" : "");
 
         if ( iommu_snoop && !ecap_snp_ctl(iommu->ecap) )
             iommu_snoop = 0;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2019-10-24 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 17:27 Andrew Cooper [this message]
2019-10-25  0:18 ` [Xen-devel] [PATCH] x86/VT-d: Misc initialisation cleanup Tian, Kevin
2019-10-25 14:50 ` Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191024172731.15752-1-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.