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: Kevin Tian <kevin.tian@intel.com>
Subject: [PATCH 4/6] VT-d: qinval indexes are only up to 19 bits wide
Date: Thu, 1 Apr 2021 10:45:14 +0200	[thread overview]
Message-ID: <f205b254-9c1c-45fe-48ed-359a7f8d178f@suse.com> (raw)
In-Reply-To: <157e4a65-6d0b-7ea8-1c23-cd393c8c0d7f@suse.com>

There's no need for 64-bit accesses to these registers (outside of
initial setup and dumping).

Also remove some stray blanks.

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

--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -42,14 +42,13 @@ static void print_qi_regs(const struct v
 
 static unsigned int qinval_next_index(struct vtd_iommu *iommu)
 {
-    u64 tail;
+    unsigned int tail = dmar_readl(iommu->reg, DMAR_IQT_REG);
 
-    tail = dmar_readq(iommu->reg, DMAR_IQT_REG);
     tail >>= QINVAL_INDEX_SHIFT;
 
     /* (tail+1 == head) indicates a full queue, wait for HW */
-    while ( ( tail + 1 ) % QINVAL_ENTRY_NR ==
-            ( dmar_readq(iommu->reg, DMAR_IQH_REG) >> QINVAL_INDEX_SHIFT ) )
+    while ( (tail + 1) % QINVAL_ENTRY_NR ==
+            (dmar_readl(iommu->reg, DMAR_IQH_REG) >> QINVAL_INDEX_SHIFT) )
         cpu_relax();
 
     return tail;
@@ -57,12 +56,12 @@ static unsigned int qinval_next_index(st
 
 static void qinval_update_qtail(struct vtd_iommu *iommu, unsigned int index)
 {
-    u64 val;
+    unsigned int val;
 
     /* Need hold register lock when update tail */
     ASSERT( spin_is_locked(&iommu->register_lock) );
     val = (index + 1) % QINVAL_ENTRY_NR;
-    dmar_writeq(iommu->reg, DMAR_IQT_REG, (val << QINVAL_INDEX_SHIFT));
+    dmar_writel(iommu->reg, DMAR_IQT_REG, val << QINVAL_INDEX_SHIFT);
 }
 
 static int __must_check queue_invalidate_context_sync(struct vtd_iommu *iommu,



  parent reply	other threads:[~2021-04-01  8:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  8:42 [PATCH 0/6] VT-d: assorted cleanup Jan Beulich
2021-04-01  8:44 ` [PATCH 1/6] VT-d: improve save/restore of registers across S3 Jan Beulich
2021-04-01  8:44 ` [PATCH 2/6] VT-d: don't open-code dmar_readl() Jan Beulich
2021-04-01  8:44 ` [PATCH 3/6] VT-d: bring print_qi_regs() in line with print_iommu_regs() Jan Beulich
2021-04-01  8:45 ` Jan Beulich [this message]
2021-04-01  8:45 ` [PATCH 5/6] VT-d: avoid pointless use of 64-bit constants Jan Beulich
2021-04-01  8:45 ` [PATCH 6/6] VT-d: drop unused #define-s Jan Beulich
2021-04-13  2:50 ` [PATCH 0/6] VT-d: assorted cleanup Tian, Kevin

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=f205b254-9c1c-45fe-48ed-359a7f8d178f@suse.com \
    --to=jbeulich@suse.com \
    --cc=kevin.tian@intel.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.