From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: ian.campbell@citrix.com, Julien Grall <julien.grall@linaro.org>,
tim@xen.org, stefano.stabellini@citrix.com,
Jan Beulich <jbeulich@suse.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [PATCH v3 02/13] xen/passthrough: amd: Remove domain_id from hvm_iommu
Date: Tue, 11 Mar 2014 15:49:48 +0000 [thread overview]
Message-ID: <1394552999-14171-3-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1394552999-14171-1-git-send-email-julien.grall@linaro.org>
The structure hvm_iommu contains a shadow value of domain->domain_id. There
is no reason to not directly use domain->domain_id.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>
---
Changes in v3:
- Patch added
---
xen/drivers/passthrough/amd/iommu_cmd.c | 3 +--
xen/drivers/passthrough/amd/iommu_map.c | 2 +-
xen/drivers/passthrough/amd/pci_amd_iommu.c | 8 +++-----
xen/include/xen/hvm/iommu.h | 1 -
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/xen/drivers/passthrough/amd/iommu_cmd.c b/xen/drivers/passthrough/amd/iommu_cmd.c
index d27bd3c..4faa01b 100644
--- a/xen/drivers/passthrough/amd/iommu_cmd.c
+++ b/xen/drivers/passthrough/amd/iommu_cmd.c
@@ -354,8 +354,7 @@ static void _amd_iommu_flush_pages(struct domain *d,
{
unsigned long flags;
struct amd_iommu *iommu;
- struct hvm_iommu *hd = domain_hvm_iommu(d);
- unsigned int dom_id = hd->domain_id;
+ unsigned int dom_id = d->domain_id;
/* send INVALIDATE_IOMMU_PAGES command */
for_each_amd_iommu ( iommu )
diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index 1294561..b79e470 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -614,7 +614,7 @@ static int update_paging_mode(struct domain *d, unsigned long gfn)
/* valid = 0 only works for dom0 passthrough mode */
amd_iommu_set_root_page_table((u32 *)device_entry,
page_to_maddr(hd->root_table),
- hd->domain_id,
+ d->domain_id,
hd->paging_mode, 1);
amd_iommu_flush_device(iommu, req_id);
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index c26aabc..79f4a77 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -138,7 +138,7 @@ static void amd_iommu_setup_domain_device(
{
/* bind DTE to domain page-tables */
amd_iommu_set_root_page_table(
- (u32 *)dte, page_to_maddr(hd->root_table), hd->domain_id,
+ (u32 *)dte, page_to_maddr(hd->root_table), domain->domain_id,
hd->paging_mode, valid);
if ( pci_ats_device(iommu->seg, bus, pdev->devfn) &&
@@ -152,7 +152,7 @@ static void amd_iommu_setup_domain_device(
"domain = %d, paging mode = %d\n",
req_id, pdev->type,
page_to_maddr(hd->root_table),
- hd->domain_id, hd->paging_mode);
+ domain->domain_id, hd->paging_mode);
}
spin_unlock_irqrestore(&iommu->lock, flags);
@@ -273,8 +273,6 @@ static int amd_iommu_domain_init(struct domain *d)
IOMMU_PAGING_MODE_LEVEL_2 :
get_paging_mode(max_page);
- hd->domain_id = d->domain_id;
-
guest_iommu_init(d);
return 0;
@@ -333,7 +331,7 @@ void amd_iommu_disable_domain_device(struct domain *domain,
AMD_IOMMU_DEBUG("Disable: device id = %#x, "
"domain = %d, paging mode = %d\n",
- req_id, domain_hvm_iommu(domain)->domain_id,
+ req_id, domain->domain_id,
domain_hvm_iommu(domain)->paging_mode);
}
spin_unlock_irqrestore(&iommu->lock, flags);
diff --git a/xen/include/xen/hvm/iommu.h b/xen/include/xen/hvm/iommu.h
index 26539e0..6ab684e 100644
--- a/xen/include/xen/hvm/iommu.h
+++ b/xen/include/xen/hvm/iommu.h
@@ -44,7 +44,6 @@ struct hvm_iommu {
struct list_head mapped_rmrrs;
/* amd iommu support */
- int domain_id;
int paging_mode;
struct page_info *root_table;
struct guest_iommu *g_iommu;
--
1.7.10.4
next prev parent reply other threads:[~2014-03-11 15:50 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 15:49 [PATCH v3 00/13] IOMMU support for ARM Julien Grall
2014-03-11 15:49 ` [PATCH v3 01/13] xen/common: grant-table: only call IOMMU if paging mode translate is disabled Julien Grall
2014-03-11 15:49 ` Julien Grall [this message]
2014-03-18 16:19 ` [PATCH v3 02/13] xen/passthrough: amd: Remove domain_id from hvm_iommu Ian Campbell
2014-03-18 16:32 ` Jan Beulich
2014-03-11 15:49 ` [PATCH v3 03/13] xen/dts: Add dt_property_read_bool Julien Grall
2014-03-11 15:49 ` [PATCH v3 04/13] xen/dts: Add dt_parse_phandle_with_args and dt_parse_phandle Julien Grall
2014-03-18 16:20 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 05/13] xen/passthrough: rework dom0_pvh_reqs to use it also on ARM Julien Grall
2014-03-18 16:22 ` Ian Campbell
2014-03-18 17:28 ` Julien Grall
2014-03-18 17:50 ` Ian Campbell
2014-03-18 18:19 ` Julien Grall
2014-03-19 10:01 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 06/13] xen/passthrough: iommu: Split generic IOMMU code Julien Grall
2014-03-11 16:50 ` Jan Beulich
2014-03-11 17:09 ` Julien Grall
2014-03-12 7:15 ` Jan Beulich
2014-03-18 16:24 ` Ian Campbell
2014-03-18 17:36 ` Julien Grall
2014-03-18 17:50 ` Ian Campbell
2014-03-18 18:21 ` Julien Grall
2014-03-19 10:02 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 07/13] xen/passthrough: iommu: Introduce arch specific code Julien Grall
2014-03-11 16:15 ` Julien Grall
2014-03-11 16:53 ` Jan Beulich
2014-03-18 16:27 ` Ian Campbell
2014-03-18 19:40 ` Julien Grall
2014-03-11 15:49 ` [PATCH v3 08/13] xen/passthrough: iommu: Basic support of device tree assignment Julien Grall
2014-03-11 16:55 ` Jan Beulich
2014-03-18 16:33 ` Ian Campbell
2014-03-18 19:46 ` Julien Grall
2014-03-19 10:12 ` Ian Campbell
2014-03-19 10:42 ` Julien Grall
2014-03-19 10:54 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 09/13] xen/passthrough: Introduce IOMMU ARM architecture Julien Grall
2014-03-18 16:40 ` Ian Campbell
2014-03-18 19:58 ` Julien Grall
2014-03-19 10:29 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 10/13] MAINTAINERS: Add drivers/passthrough/arm Julien Grall
2014-03-11 15:49 ` [PATCH v3 11/13] xen/arm: Don't give IOMMU devices to dom0 when iommu is disabled Julien Grall
2014-03-18 16:41 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 12/13] xen/arm: Add the property "protected-devices" in the hypervisor node Julien Grall
2014-03-18 16:48 ` Ian Campbell
2014-03-18 20:09 ` Julien Grall
2014-03-19 10:33 ` Ian Campbell
2014-04-03 21:51 ` Julien Grall
2014-04-04 9:40 ` Ian Campbell
2014-04-04 10:25 ` Julien Grall
2014-04-04 10:28 ` Ian Campbell
2014-04-04 10:39 ` Julien Grall
2014-04-04 10:48 ` Ian Campbell
2014-04-04 11:01 ` Julien Grall
2014-04-04 11:13 ` Ian Campbell
2014-04-04 11:23 ` Julien Grall
2014-04-04 12:45 ` Ian Campbell
2014-04-04 13:10 ` Julien Grall
2014-04-04 13:18 ` Ian Campbell
2014-03-11 15:49 ` [PATCH v3 13/13] drivers/passthrough: arm: Add support for SMMU drivers Julien Grall
2014-03-18 16:54 ` Ian Campbell
2014-03-18 20:25 ` Julien Grall
2014-03-19 10:35 ` Ian Campbell
2014-03-19 10:44 ` Julien Grall
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=1394552999-14171-3-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=stefano.stabellini@citrix.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tim@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).