public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: "Han, Weidong" <weidong.han@intel.com>
Cc: "'Avi Kivity'" <avi@redhat.com>,
	"Woodhouse, David" <david.woodhouse@intel.com>,
	"'Jesse Barnes'" <jbarnes@virtuousgeek.org>,
	"Yu, Fenghua" <fenghua.yu@intel.com>,
	"'iommu@lists.linux-foundation.org'"
	<iommu@lists.linux-foundation.org>,
	"'kvm@vger.kernel.org'" <kvm@vger.kernel.org>
Subject: Re: [PATCH 03/13] set iommu agaw
Date: Thu, 04 Dec 2008 17:12:41 +0000	[thread overview]
Message-ID: <1228410761.3732.138.camel@blaa> (raw)
In-Reply-To: <715D42877B251141A38726ABF5CABF2C018BF05989@pdsmsx503.ccr.corp.intel.com>

On Tue, 2008-12-02 at 22:22 +0800, Han, Weidong wrote:
> agaw may be different across iommus.
> 
> Signed-off-by: Weidong Han <weidong.han@intel.com>
> ---
>  drivers/pci/dmar.c            |   14 ++++++++++++++
>  include/linux/dma_remapping.h |    2 ++
>  include/linux/intel-iommu.h   |    1 +
>  3 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
> index 691b3ad..ebcc7c2 100644
> --- a/drivers/pci/dmar.c
> +++ b/drivers/pci/dmar.c
> @@ -491,6 +491,8 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
>  	int map_size;
>  	u32 ver;
>  	static int iommu_allocated = 0;
> +	unsigned long sagaw;
> +	int agaw;
>  
>  	iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
>  	if (!iommu)
> @@ -506,6 +508,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
>  	iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
>  	iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
>  
> +	/* set agaw, "SAGAW" may be different across iommus */
> +	sagaw = cap_sagaw(iommu->cap);
> +	for (agaw = width_to_agaw(DEFAULT_DOMAIN_ADDRESS_WIDTH);
> +	     agaw >= 0; agaw--)
> +		if (test_bit(agaw, &sagaw))
> +			break;
> +	if (agaw < 0) {
> +		printk(KERN_ERR "IOMMU: unsupported sagaw %lx\n", sagaw);
> +		goto error;
> +	}
> +	iommu->agaw = agaw;

Could we add something like intel_iommu_calculate_agaw() and keep the
agaw code internal to intel-iommu.c?

Also, "unsupported sagaw" expands to "unsupported supported adjusted
guest address width" which doesn't make much sense :-)

"unsupported address width" would be sufficient, I think.

Cheers,
Mark.


  reply	other threads:[~2008-12-04 17:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-02 14:22 [PATCH 03/13] set iommu agaw Han, Weidong
2008-12-04 17:12 ` Mark McLoughlin [this message]
2008-12-05  0:56   ` Han, Weidong

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=1228410761.3732.138.camel@blaa \
    --to=markmc@redhat.com \
    --cc=avi@redhat.com \
    --cc=david.woodhouse@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kvm@vger.kernel.org \
    --cc=weidong.han@intel.com \
    /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