public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Mark McLoughlin <markmc@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	x86@kernel.org
Subject: Re: [PATCH 3/8] intel-iommu: move context entry defs out from dma_remapping.h
Date: Thu, 20 Nov 2008 20:11:35 +0100	[thread overview]
Message-ID: <20081120191135.GB3955@elte.hu> (raw)
In-Reply-To: <1227196190-488-3-git-send-email-markmc@redhat.com>


* Mark McLoughlin <markmc@redhat.com> wrote:

> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> ---
>  drivers/pci/intel-iommu.c     |   38 ++++++++++++++++++++++++++++++++++++++
>  include/linux/dma_remapping.h |   38 --------------------------------------
>  2 files changed, 38 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
> index 2e56e5a..1c011bb 100644
> --- a/drivers/pci/intel-iommu.c
> +++ b/drivers/pci/intel-iommu.c
> @@ -90,6 +90,44 @@ get_context_addr_from_root(struct root_entry *root)
>  		NULL);
>  }
>  
> +/*
> + * low 64 bits:
> + * 0: present
> + * 1: fault processing disable
> + * 2-3: translation type
> + * 12-63: address space root
> + * high 64 bits:
> + * 0-2: address width
> + * 3-6: aval
> + * 8-23: domain id
> + */
> +struct context_entry {
> +	u64 lo;
> +	u64 hi;
> +};
> +#define context_present(c) ((c).lo & 1)
> +#define context_fault_disable(c) (((c).lo >> 1) & 1)
> +#define context_translation_type(c) (((c).lo >> 2) & 3)
> +#define context_address_root(c) ((c).lo & VTD_PAGE_MASK)
> +#define context_address_width(c) ((c).hi &  7)
> +#define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1))
> +
> +#define context_set_present(c) do {(c).lo |= 1;} while (0)
> +#define context_set_fault_enable(c) \
> +	do {(c).lo &= (((u64)-1) << 2) | 1;} while (0)
> +#define context_set_translation_type(c, val) \
> +	do { \
> +		(c).lo &= (((u64)-1) << 4) | 3; \
> +		(c).lo |= ((val) & 3) << 2; \
> +	} while (0)
> +#define CONTEXT_TT_MULTI_LEVEL 0
> +#define context_set_address_root(c, val) \
> +	do {(c).lo |= (val) & VTD_PAGE_MASK; } while (0)
> +#define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0)
> +#define context_set_domain_id(c, val) \
> +	do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0)
> +#define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while (0)

Since you move this code, please also do a patch to clean it up to use 
inlines, not macros.

Thanks,

	Ingo

  parent reply	other threads:[~2008-11-20 19:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 14:21 [PATCH] intel-iommu: make init_dmars() static Mark McLoughlin
2008-11-20 14:24 ` Mark McLoughlin
2008-11-20 14:37   ` David Woodhouse
2008-11-20 15:49     ` [PATCH 1/8] intel-iommu: move DMA_32/64BIT_PFN into intel-iommu.c Mark McLoughlin
2008-11-20 15:49       ` [PATCH 2/8] intel-iommu: move root entry defs from dma_remapping.h Mark McLoughlin
2008-11-20 15:49         ` [PATCH 3/8] intel-iommu: move context entry defs out " Mark McLoughlin
2008-11-20 15:49           ` [PATCH 4/8] intel-iommu: move DMA PTE defs out of dma_remapping.h Mark McLoughlin
2008-11-20 15:49             ` [PATCH 5/8] intel-iommu: move struct dmar_domain def out dma_remapping.h Mark McLoughlin
2008-11-20 15:49               ` [PATCH 6/8] intel-iommu: move struct device_domain_info out of dma_remapping.h Mark McLoughlin
2008-11-20 15:49                 ` [PATCH 7/8] intel-iommu: kill off duplicate def of dmar_disabled Mark McLoughlin
2008-11-20 15:49                   ` [PATCH 8/8] intel-iommu: move iommu_prepare_gfx_mapping() out of dma_remapping.h Mark McLoughlin
2008-11-20 19:10             ` [PATCH 4/8] intel-iommu: move DMA PTE defs " Ingo Molnar
2008-11-20 19:11           ` Ingo Molnar [this message]
2008-11-21 16:50             ` [PATCH 3/8] intel-iommu: move context entry defs out from dma_remapping.h Mark McLoughlin
2008-11-21 16:54               ` [PATCH 1/2] intel-iommu: trivially inline context entry macros Mark McLoughlin
2008-11-21 16:56                 ` [PATCH 2/2] intel-iommu: trivially inline DMA PTE macros Mark McLoughlin
2008-11-20 16:05       ` [PATCH 1/8] intel-iommu: move DMA_32/64BIT_PFN into intel-iommu.c David Woodhouse
2008-11-20 14:25 ` [PATCH] intel-iommu: make init_dmars() static David Woodhouse

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=20081120191135.GB3955@elte.hu \
    --to=mingo@elte.hu \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markmc@redhat.com \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox