From: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH v1 1/1] iommu/vt-d: use lo_hi_readq() / lo_hi_writeq()
Date: Thu, 17 Sep 2015 12:00:12 +0300 [thread overview]
Message-ID: <1442480412.8361.74.camel@linux.intel.com> (raw)
In-Reply-To: <1439820252-109537-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
On Mon, 2015-08-17 at 17:04 +0300, Andy Shevchenko wrote:
> There is already helper functions to do 64-bit I/O on 32-bit machines
> or buses,
> thus we don't need to reinvent the wheel.
>
Any comment on this one?
> Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> include/linux/intel-iommu.h | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/include/linux/intel-iommu.h b/include/linux/intel
> -iommu.h
> index a868a0f..5439ea4 100644
> --- a/include/linux/intel-iommu.h
> +++ b/include/linux/intel-iommu.h
> @@ -26,6 +26,8 @@
> #include <linux/iova.h>
> #include <linux/io.h>
> #include <linux/dma_remapping.h>
> +
> +#include <asm-generic/io-64-nonatomic-lo-hi.h>
> #include <asm/cacheflush.h>
> #include <asm/iommu.h>
>
> @@ -59,26 +61,15 @@
> #define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr
> register */
>
> #define OFFSET_STRIDE (9)
> -/*
> -#define dmar_readl(dmar, reg) readl(dmar + reg)
> -#define dmar_readq(dmar, reg) ({ \
> - u32 lo, hi; \
> - lo = readl(dmar + reg); \
> - hi = readl(dmar + reg + 4); \
> - (((u64) hi) << 32) + lo; })
> -*/
> +
> static inline u64 dmar_readq(void __iomem *addr)
> {
> - u32 lo, hi;
> - lo = readl(addr);
> - hi = readl(addr + 4);
> - return (((u64) hi) << 32) + lo;
> + return lo_hi_readq(addr);
> }
>
> static inline void dmar_writeq(void __iomem *addr, u64 val)
> {
> - writel((u32)val, addr);
> - writel((u32)(val >> 32), addr + 4);
> + lo_hi_writeq(val, addr);
> }
>
> #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
--
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Intel Finland Oy
prev parent reply other threads:[~2015-09-17 9:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 14:04 [PATCH v1 1/1] iommu/vt-d: use lo_hi_readq() / lo_hi_writeq() Andy Shevchenko
[not found] ` <1439820252-109537-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-09-17 9:00 ` Andy Shevchenko [this message]
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=1442480412.8361.74.camel@linux.intel.com \
--to=andriy.shevchenko-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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.