x86/VT-d: Misc initialisation cleanup
PATCH 1/1 x86/VT-d: Misc initialisation cleanup
* 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.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Juergen Gross <[email protected]>
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(-)
xen/drivers/passthrough/vtd/iommu.c +9 -15
@@ -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 ;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Friday, October 25, 2019 1:28 AM* Initialise all spinlock fields together
* No need for an atomicset_bit()to initialisedomid_bitmap
* Avoid using partial-line printk()'s.
* Style fixes (too many, and too few spaces)No functional change.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Andrew Cooper
* Initialise all spinlock fields together
* No need for an atomicset_bit()to initialisedomid_bitmap
* Avoid using partial-line printk()'s.
* Style fixes (too many, and too few spaces)No functional change.
Signed-off-by Andrew Cooper <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel