All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suravee Suthikulanit <suravee.suthikulpanit@amd.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Jacob Shin <jacob.shin@amd.com>,
	Xiantao Zhang <xiantao.zhang@intel.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH 3/4] IOMMU: use is_hardware_domain instead of domid == 0
Date: Thu, 11 Jul 2013 14:57:14 -0500	[thread overview]
Message-ID: <51DF0E1A.4000205@amd.com> (raw)
In-Reply-To: <1373294782-20328-4-git-send-email-dgdegra@tycho.nsa.gov>

On 7/8/2013 9:46 AM, Daniel De Graaf wrote:
> This makes checks for dom0 more explicit than checking the domain ID.
>
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Acked-by: Suravee Suthikulpanit <suravee.suthiuklpanit@amd.com>

> Cc: Jacob Shin <jacob.shin@amd.com>
> Cc: Xiantao Zhang <xiantao.zhang@intel.com>
> ---
>   xen/drivers/passthrough/amd/pci_amd_iommu.c | 2 +-
>   xen/drivers/passthrough/vtd/iommu.c         | 8 ++++----
>   xen/drivers/passthrough/vtd/x86/vtd.c       | 2 +-
>   3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> index 5ea1a1d..e8ec695 100644
> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
> +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> @@ -122,7 +122,7 @@ static void amd_iommu_setup_domain_device(
>   
>       BUG_ON( !hd->root_table || !hd->paging_mode || !iommu->dev_table.buffer );
>   
> -    if ( iommu_passthrough && (domain->domain_id == 0) )
> +    if ( iommu_passthrough && is_hardware_domain(domain) )
>           valid = 0;
>   
>       if ( ats_enabled )
> diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
> index 0fc10de..8d5c43d 100644
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1336,7 +1336,7 @@ int domain_context_mapping_one(
>           return res;
>       }
>   
> -    if ( iommu_passthrough && (domain->domain_id == 0) )
> +    if ( iommu_passthrough && is_hardware_domain(domain) )
>       {
>           context_set_translation_type(*context, CONTEXT_TT_PASS_THRU);
>           agaw = level_to_agaw(iommu->nr_pt_levels);
> @@ -1710,7 +1710,7 @@ static int intel_iommu_map_page(
>           return 0;
>   
>       /* do nothing if dom0 and iommu supports pass thru */
> -    if ( iommu_passthrough && (d->domain_id == 0) )
> +    if ( iommu_passthrough && is_hardware_domain(d) )
>           return 0;
>   
>       spin_lock(&hd->mapping_lock);
> @@ -1754,7 +1754,7 @@ static int intel_iommu_map_page(
>   static int intel_iommu_unmap_page(struct domain *d, unsigned long gfn)
>   {
>       /* Do nothing if dom0 and iommu supports pass thru. */
> -    if ( iommu_passthrough && (d->domain_id == 0) )
> +    if ( iommu_passthrough && is_hardware_domain(d) )
>           return 0;
>   
>       dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
> @@ -1927,7 +1927,7 @@ static int intel_iommu_remove_device(u8 devfn, struct pci_dev *pdev)
>       /* If the device belongs to dom0, and it has RMRR, don't remove it
>        * from dom0, because BIOS may use RMRR at booting time.
>        */
> -    if ( pdev->domain->domain_id == 0 )
> +    if ( is_hardware_domain(pdev->domain) )
>       {
>           for_each_rmrr_device ( rmrr, bdf, i )
>           {
> diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
> index 875b033..eb9e52a 100644
> --- a/xen/drivers/passthrough/vtd/x86/vtd.c
> +++ b/xen/drivers/passthrough/vtd/x86/vtd.c
> @@ -117,7 +117,7 @@ void __init iommu_set_dom0_mapping(struct domain *d)
>   {
>       unsigned long i, j, tmp, top;
>   
> -    BUG_ON(d->domain_id != 0);
> +    BUG_ON(!is_hardware_domain(d));
>   
>       top = max(max_pdx, pfn_to_pdx(0xffffffffUL >> PAGE_SHIFT) + 1);
>   

  reply	other threads:[~2013-07-11 19:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 14:46 [PATCH 0/4] Clarify explicit domain ID checks Daniel De Graaf
2013-07-08 14:46 ` [PATCH 1/4] xen: use domid check in is_hardware_domain Daniel De Graaf
2013-07-08 14:58   ` Jan Beulich
2013-07-08 15:58     ` Daniel De Graaf
2013-07-09  6:29       ` Jan Beulich
2013-07-09 13:26       ` George Dunlap
2013-07-08 14:46 ` [PATCH 2/4] xen/arch/x86: clarify domid == 0 checks Daniel De Graaf
2013-07-08 14:46 ` [PATCH 3/4] IOMMU: use is_hardware_domain instead of domid == 0 Daniel De Graaf
2013-07-11 19:57   ` Suravee Suthikulanit [this message]
2013-07-08 14:46 ` [PATCH 4/4] xen/arch/arm: clarify domid == 0 checks Daniel De Graaf

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=51DF0E1A.4000205@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=jacob.shin@amd.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xiantao.zhang@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 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.