From: Wei Wang <wei.wang2@amd.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [PATCH] amd iommu: disable iommu emulation on non-iommu systems
Date: Thu, 26 Jan 2012 11:56:39 +0100 [thread overview]
Message-ID: <4F213167.3010400@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
Introduce a new flag to disable iommu emulation on old iommu systems.
This patch is taken from my v4 patch queue, which is till pending, to
make old or non-iommu system to run cleanly without interfered by
iommuv2 codes. This might be helpful to isolate iommuv2 code in
debugging unstable regressions. The reset part of v4 will be re-based.
Thanks,
Wei
Signed-off-by: Wei Wang <wei.wang2@amd.com>
[-- Attachment #2: iommuv2_flag.patch --]
[-- Type: text/x-patch, Size: 2264 bytes --]
diff -r a2a8089b1ffb xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c Tue Jan 24 16:46:17 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c Thu Jan 26 11:50:02 2012 +0100
@@ -805,6 +805,9 @@ int guest_iommu_set_base(struct domain *
p2m_type_t t;
struct guest_iommu *iommu = domain_iommu(d);
+ if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
+ return 0;
+
if ( !iommu )
return -EACCES;
@@ -867,7 +870,7 @@ int guest_iommu_init(struct domain* d)
struct guest_iommu *iommu;
struct hvm_iommu *hd = domain_hvm_iommu(d);
- if ( !is_hvm_domain(d) )
+ if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
return 0;
iommu = xzalloc(struct guest_iommu);
@@ -893,7 +896,7 @@ void guest_iommu_destroy(struct domain *
{
struct guest_iommu *iommu;
- if ( !is_hvm_domain(d) )
+ if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
return;
iommu = domain_iommu(d);
diff -r a2a8089b1ffb xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c Tue Jan 24 16:46:17 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c Thu Jan 26 11:50:02 2012 +0100
@@ -38,6 +38,7 @@ unsigned short ivrs_bdf_entries;
static struct radix_tree_root ivrs_maps;
struct list_head amd_iommu_head;
struct table_struct device_table;
+bool_t iommuv2_enabled = 0;
static int iommu_has_ht_flag(struct amd_iommu *iommu, u8 mask)
{
@@ -887,6 +888,9 @@ static int __init amd_iommu_init_one(str
get_iommu_features(iommu);
+ if ( iommu->features )
+ iommuv2_enabled = 1;
+
if ( allocate_cmd_buffer(iommu) == NULL )
goto error_out;
@@ -950,6 +954,7 @@ static void __init amd_iommu_init_cleanu
iommu_enabled = 0;
iommu_passthrough = 0;
iommu_intremap = 0;
+ iommuv2_enabled = 0;
}
/*
diff -r a2a8089b1ffb xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h Tue Jan 24 16:46:17 2012 +0000
+++ b/xen/include/asm-x86/amd-iommu.h Thu Jan 26 11:50:02 2012 +0100
@@ -182,4 +182,6 @@ struct guest_iommu {
struct guest_iommu_msi msi;
};
+extern bool_t iommuv2_enabled;
+
#endif /* _ASM_X86_64_AMD_IOMMU_H */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2012-01-26 10:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 10:56 Wei Wang [this message]
2012-02-01 15:58 ` [PATCH] amd iommu: disable iommu emulation on non-iommu systems Jan Beulich
2012-02-03 14:09 ` Wei Wang
2012-02-03 14:11 ` Jan Beulich
2012-02-03 14:28 ` Wei Wang
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=4F213167.3010400@amd.com \
--to=wei.wang2@amd.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xensource.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.