From: Wei Wang2 <wei.wang2@amd.com>
To: Tim Deegan <tim@xen.org>
Cc: xen-devel@lists.xensource.com, keir@xen.org, JBeulich@suse.com
Subject: Re: [PATCH 11 of 16] amd iommu: Add a new flag to indication iommuv2 feature enabled or not
Date: Thu, 15 Dec 2011 15:05:25 +0100 [thread overview]
Message-ID: <201112151505.26272.wei.wang2@amd.com> (raw)
In-Reply-To: <20111215133915.GF4274@ocelot.phlegethon.org>
On Thursday 15 December 2011 14:39:15 Tim Deegan wrote:
> At 16:29 +0100 on 14 Dec (1323880172), Wei Wang wrote:
> > # HG changeset patch
> > # User Wei Wang <wei.wang2@amd.com>
> > # Date 1323875776 -3600
> > # Node ID 9a93e064dd3c467ce4b87ddef8739a3573ef547c
> > # Parent 001681ff1a0c09c4d04fd8bd45e8d26805686246
> > amd iommu: Add a new flag to indication iommuv2 feature enabled or not.
> > Hypercalls should return early on non-iommuv2 systems.
> >
> > Signed-off-by: Wei Wang <wei.wang2@amd.com>
> >
> > diff -r 001681ff1a0c -r 9a93e064dd3c
> > xen/drivers/passthrough/amd/iommu_guest.c ---
> > a/xen/drivers/passthrough/amd/iommu_guest.c Wed Dec 14 16:16:15 2011
> > +0100 +++ b/xen/drivers/passthrough/amd/iommu_guest.c Wed Dec 14 16:16:16
> > 2011 +0100 @@ -48,6 +48,8 @@
> > (reg)->hi = (val >> 32) & 0xFFFFFFFF; \
> > } while(0)
> >
> > +extern bool_t iommuv2_enabled;
> > +
> > static unsigned int machine_bdf(struct domain *d, uint16_t guest_bdf)
> > {
> > struct pci_dev *pdev;
> > @@ -839,6 +841,9 @@ int guest_iommu_set_base(struct domain *
> > p2m_type_t t;
> > struct guest_iommu *iommu = domain_iommu(d);
> >
> > + if ( !is_hvm_domain(d) && !iommuv2_enabled )
> > + return 1;
>
> Shouldn't that that be || ? (And likewise below)
Oops... I will fix that.
Thanks.
Wei
> Cheers,
>
> Tim.
>
> > +
> > iommu->mmio_base = base;
> > base >>= PAGE_SHIFT;
> >
> > @@ -898,7 +903,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) && !iommuv2_enabled )
> > return 0;
> >
> > iommu = xzalloc(struct guest_iommu);
> > @@ -940,7 +945,7 @@ void guest_iommu_destroy(struct domain *
> > {
> > struct guest_iommu *iommu;
> >
> > - if ( !is_hvm_domain(d) )
> > + if ( !is_hvm_domain(d) && !iommuv2_enabled )
> > return;
> >
> > iommu = domain_iommu(d);
> > @@ -973,7 +978,7 @@ int iommu_bind_bdf(struct domain* d, uin
> > struct pci_dev *pdev;
> > int ret = -ENODEV;
> >
> > - if ( !iommu_found() )
> > + if ( !iommu_found() || !iommuv2_enabled )
> > return 0;
> >
> > spin_lock(&pcidevs_lock);
> > @@ -998,7 +1003,7 @@ void iommu_set_msi(struct domain* d, uin
> > {
> > struct guest_iommu *iommu = domain_iommu(d);
> >
> > - if ( !iommu_found() )
> > + if ( !iommu_found() || !iommuv2_enabled )
> > return;
> >
> > iommu->msi.vector = vector;
> > diff -r 001681ff1a0c -r 9a93e064dd3c
> > xen/drivers/passthrough/amd/iommu_init.c ---
> > a/xen/drivers/passthrough/amd/iommu_init.c Wed Dec 14 16:16:15 2011 +0100
> > +++ b/xen/drivers/passthrough/amd/iommu_init.c Wed Dec 14 16:16:16 2011
> > +0100 @@ -36,6 +36,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;
> >
> > static int iommu_has_ht_flag(struct amd_iommu *iommu, u8 mask)
> > {
> > @@ -759,6 +760,10 @@ static void enable_iommu(struct amd_iomm
> > amd_iommu_flush_all_caches(iommu);
> >
> > iommu->enabled = 1;
> > +
> > + if ( iommu->features )
> > + iommuv2_enabled = 1;
> > +
> > spin_unlock_irqrestore(&iommu->lock, flags);
> >
> > }
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2011-12-15 14:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 15:29 [PATCH 00 of 16] [RFC] amd iommu: support ATS device passthru on IOMMUv2 systems Wei Wang
2011-12-14 15:29 ` [PATCH 01 of 16] amd iommu: Refactoring iommu ring buffer definition Wei Wang
2011-12-14 15:29 ` [PATCH 02 of 16] amd iommu: Introduces new helper functions to simplify iommu bitwise operations Wei Wang
2011-12-14 15:29 ` [PATCH 03 of 16] amd iommu: Add iommu emulation for hvm guest Wei Wang
2011-12-15 13:35 ` Tim Deegan
2011-12-15 14:09 ` Wei Wang2
2011-12-15 14:13 ` Jan Beulich
2011-12-15 14:30 ` Wei Wang2
2011-12-14 15:29 ` [PATCH 04 of 16] amd iommu: Enable ppr log Wei Wang
2011-12-14 15:29 ` [PATCH 05 of 16] amd iommu: Enable guest level translation Wei Wang
2011-12-14 15:29 ` [PATCH 06 of 16] amd iommu: add ppr log processing into iommu interrupt handling Wei Wang
2011-12-14 15:29 ` [PATCH 07 of 16] amd iommu: Add 2 hypercalls for libxc Wei Wang
2011-12-14 16:44 ` Jan Beulich
2011-12-14 16:57 ` Wei Wang2
2011-12-14 17:03 ` Jan Beulich
2011-12-15 10:02 ` Wei Wang2
2011-12-14 15:29 ` [PATCH 08 of 16] amd iommu: Add a hypercall for hvmloader Wei Wang
2011-12-14 15:29 ` [PATCH 09 of 16] amd iommu: add iommu mmio handler Wei Wang
2011-12-14 15:29 ` [PATCH 10 of 16] amd iommu: Enable FC bit in iommu host level PTE Wei Wang
2011-12-14 15:29 ` [PATCH 11 of 16] amd iommu: Add a new flag to indication iommuv2 feature enabled or not Wei Wang
2011-12-15 13:39 ` Tim Deegan
2011-12-15 14:05 ` Wei Wang2 [this message]
2011-12-14 15:29 ` [PATCH 12 of 16] hvmloader: Build IVRS table Wei Wang
2011-12-15 12:29 ` Ian Campbell
2011-12-14 15:29 ` [PATCH 13 of 16] libxc: add wrappers for new hypercalls Wei Wang
2011-12-14 15:29 ` [PATCH 14 of 16] libxl: bind virtual bdf to physical bdf after device assignment Wei Wang
2011-12-15 14:26 ` Ian Campbell
2011-12-14 15:29 ` [PATCH 15 of 16] libxl: Introduce a new guest config file parameter Wei Wang
2011-12-15 16:27 ` Ian Jackson
2011-12-14 15:29 ` [PATCH 16 of 16] libxl: add iommu parameter to qemu-dm Wei Wang
2011-12-15 14:30 ` Ian Campbell
2011-12-15 14:52 ` Wei Wang2
2011-12-15 16:59 ` Ian Campbell
2011-12-15 17:10 ` Wei Wang2
2011-12-16 11:44 ` Ian Campbell
2011-12-15 10:23 ` [PATCH 00 of 16] [RFC] amd iommu: support ATS device passthru on IOMMUv2 systems Jan Beulich
2011-12-15 11:18 ` Wei Wang2
-- strict thread matches above, loose matches on Subject: below --
2011-12-23 11:29 [PATCH 00 of 16] [V2] " Wei Wang
2011-12-23 11:29 ` [PATCH 11 of 16] amd iommu: Add a new flag to indication iommuv2 feature enabled or not Wei Wang
2012-01-02 11:29 ` Jan Beulich
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=201112151505.26272.wei.wang2@amd.com \
--to=wei.wang2@amd.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@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.