All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [Xen-devel] [PATCH v6 6/8] AMD/IOMMU: tidy struct ivrs_mappings
Date: Thu, 19 Sep 2019 15:24:11 +0200	[thread overview]
Message-ID: <6de11867-b872-a2a1-7c26-af004164bfea@suse.com> (raw)
In-Reply-To: <aa62726c-5aa4-8bcd-dc35-61eb8dfeaee3@suse.com>

Move the device flags field up into an unused hole, thus shrinking
overall structure size by 8 bytes. Use bool and uint<N>_t as
appropriate. Drop pointless (redundant) initializations.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v6: New.

---
 xen/drivers/passthrough/amd/iommu_acpi.c |    6 +++---
 xen/drivers/passthrough/amd/iommu_init.c |    6 ------
 xen/include/asm-x86/amd-iommu.h          |   17 +++++++++--------
 3 files changed, 12 insertions(+), 17 deletions(-)

--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -165,7 +165,7 @@ static void __init reserve_unity_map_for
     /* extend r/w permissioms and keep aggregate */
     ivrs_mappings[bdf].write_permission = iw;
     ivrs_mappings[bdf].read_permission = ir;
-    ivrs_mappings[bdf].unity_map_enable = IOMMU_CONTROL_ENABLED;
+    ivrs_mappings[bdf].unity_map_enable = true;
     ivrs_mappings[bdf].addr_range_start = base;
     ivrs_mappings[bdf].addr_range_length = length;
 }
@@ -242,8 +242,8 @@ static int __init register_exclusion_ran
     if ( limit >= iommu_top  )
     {
         reserve_iommu_exclusion_range(iommu, base, limit);
-        ivrs_mappings[bdf].dte_allow_exclusion = IOMMU_CONTROL_ENABLED;
-        ivrs_mappings[req].dte_allow_exclusion = IOMMU_CONTROL_ENABLED;
+        ivrs_mappings[bdf].dte_allow_exclusion = true;
+        ivrs_mappings[req].dte_allow_exclusion = true;
     }
 
     return 0;
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1222,12 +1222,6 @@ static int __init alloc_ivrs_mappings(u1
     for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
     {
         ivrs_mappings[bdf].dte_requestor_id = bdf;
-        ivrs_mappings[bdf].dte_allow_exclusion = IOMMU_CONTROL_DISABLED;
-        ivrs_mappings[bdf].unity_map_enable = IOMMU_CONTROL_DISABLED;
-        ivrs_mappings[bdf].iommu = NULL;
-
-        ivrs_mappings[bdf].intremap_table = NULL;
-        ivrs_mappings[bdf].device_flags = 0;
 
         if ( amd_iommu_perdev_intremap )
             spin_lock_init(&ivrs_mappings[bdf].intremap_lock);
--- a/xen/include/asm-x86/amd-iommu.h
+++ b/xen/include/asm-x86/amd-iommu.h
@@ -106,12 +106,16 @@ struct amd_iommu {
 };
 
 struct ivrs_mappings {
-    u16 dte_requestor_id;
-    u8 dte_allow_exclusion;
-    u8 unity_map_enable;
-    u8 write_permission;
-    u8 read_permission;
+    uint16_t dte_requestor_id;
     bool valid;
+    bool dte_allow_exclusion;
+    bool unity_map_enable;
+    bool write_permission;
+    bool read_permission;
+
+    /* ivhd device data settings */
+    uint8_t device_flags;
+
     unsigned long addr_range_start;
     unsigned long addr_range_length;
     struct amd_iommu *iommu;
@@ -120,9 +124,6 @@ struct ivrs_mappings {
     void *intremap_table;
     unsigned long *intremap_inuse;
     spinlock_t intremap_lock;
-
-    /* ivhd device data settings */
-    u8 device_flags;
 };
 
 extern unsigned int ivrs_bdf_entries;


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

  parent reply	other threads:[~2019-09-19 13:24 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 13:08 [Xen-devel] [PATCH v6 0/8] AMD IOMMU: further improvements Jan Beulich
2019-09-19 13:21 ` [Xen-devel] [PATCH v6 1/8] AMD/IOMMU: don't blindly allocate interrupt remapping tables Jan Beulich
2019-09-23 15:27   ` Paul Durrant
2019-09-25 13:23   ` Andrew Cooper
2019-09-19 13:22 ` [Xen-devel] [PATCH v6 2/8] AMD/IOMMU: make phantom functions share " Jan Beulich
2019-09-23 15:44   ` Paul Durrant
2019-09-19 13:22 ` [Xen-devel] [PATCH v6 3/8] x86/PCI: read maximum MSI vector count early Jan Beulich
2019-09-23 14:22   ` Roger Pau Monné
2019-09-23 14:41     ` Jan Beulich
2019-09-23 15:18       ` Roger Pau Monné
2019-09-23 15:26         ` Jan Beulich
2019-09-25 13:31       ` Andrew Cooper
2019-09-25 13:34         ` Jan Beulich
2019-09-23 15:57   ` Paul Durrant
2019-09-23 16:00     ` Jan Beulich
2019-09-25 13:26   ` Andrew Cooper
2019-09-19 13:23 ` [Xen-devel] [PATCH v6 4/8] AMD/IOMMU: replace INTREMAP_ENTRIES Jan Beulich
2019-09-23 16:13   ` Paul Durrant
2019-09-19 13:23 ` [Xen-devel] [PATCH v6 5/8] AMD/IOMMU: restrict interrupt remapping table sizes Jan Beulich
2019-09-23 16:22   ` Paul Durrant
2019-09-25 13:40   ` Andrew Cooper
2019-09-19 13:24 ` Jan Beulich [this message]
2019-09-23 16:25   ` [Xen-devel] [PATCH v6 6/8] AMD/IOMMU: tidy struct ivrs_mappings Paul Durrant
2019-09-24  9:01     ` Jan Beulich
2019-09-24  9:08       ` Paul Durrant
2019-09-24  9:13         ` Jan Beulich
2019-09-24  9:18           ` Paul Durrant
2019-09-25 13:41   ` Andrew Cooper
2019-09-19 13:24 ` [Xen-devel] [PATCH v6 7/8] AMD/IOMMU: allocate one device table per PCI segment Jan Beulich
2019-09-23 16:30   ` Paul Durrant
2019-09-24  9:10     ` Jan Beulich
2019-09-24  9:20       ` Paul Durrant
2019-09-24  9:30         ` Jan Beulich
2019-09-25 14:19   ` Andrew Cooper
2019-09-25 14:40     ` Jan Beulich
2019-09-19 13:25 ` [Xen-devel] [PATCH v6 8/8] AMD/IOMMU: pre-fill all DTEs right after table allocation Jan Beulich
2019-09-23 16:33   ` Paul Durrant
2019-09-25 14:59   ` Andrew Cooper
2019-09-26 13:29     ` Jan Beulich

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=6de11867-b872-a2a1-7c26-af004164bfea@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --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.