From: "Xu, Quan" <quan.xu@intel.com>
To: xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>,
dario.faggioli@citrix.com, Feng Wu <feng.wu@intel.com>,
Jan Beulich <jbeulich@suse.com>, Quan Xu <quan.xu@intel.com>
Subject: [PATCH v7 11/11] vt-d: add __must_check annotation to IOMMU flush pointers and handlers
Date: Wed, 8 Jun 2016 16:59:04 +0800 [thread overview]
Message-ID: <1465376344-28290-12-git-send-email-quan.xu@intel.com> (raw)
In-Reply-To: <1465376344-28290-1-git-send-email-quan.xu@intel.com>
From: Quan Xu <quan.xu@intel.com>
Signed-off-by: Quan Xu <quan.xu@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Kevin Tian <kevin.tian@intel.com>
CC: Feng Wu <feng.wu@intel.com>
v7: using !! instead of ?: .
---
xen/drivers/passthrough/vtd/iommu.c | 44 ++++++++++++++++++------------------
xen/drivers/passthrough/vtd/iommu.h | 11 +++++----
xen/drivers/passthrough/vtd/qinval.c | 14 ++++++------
3 files changed, 36 insertions(+), 33 deletions(-)
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 8ad862e..fc5c76c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -335,10 +335,9 @@ static void iommu_flush_write_buffer(struct iommu *iommu)
}
/* return value determine if we need a write buffer flush */
-static int flush_context_reg(
- void *_iommu,
- u16 did, u16 source_id, u8 function_mask, u64 type,
- int flush_non_present_entry)
+static int __must_check flush_context_reg(void *_iommu, u16 did, u16 source_id,
+ u8 function_mask, u64 type,
+ bool_t flush_non_present_entry)
{
struct iommu *iommu = (struct iommu *) _iommu;
u64 val = 0;
@@ -389,7 +388,7 @@ static int flush_context_reg(
}
static int __must_check iommu_flush_context_global(struct iommu *iommu,
- int flush_non_present_entry)
+ bool_t flush_non_present_entry)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
return flush->context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL,
@@ -399,7 +398,7 @@ static int __must_check iommu_flush_context_global(struct iommu *iommu,
static int __must_check iommu_flush_context_device(struct iommu *iommu,
u16 did, u16 source_id,
u8 function_mask,
- int flush_non_present_entry)
+ bool_t flush_non_present_entry)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
return flush->context(iommu, did, source_id, function_mask,
@@ -408,9 +407,10 @@ static int __must_check iommu_flush_context_device(struct iommu *iommu,
}
/* return value determine if we need a write buffer flush */
-static int flush_iotlb_reg(void *_iommu, u16 did,
- u64 addr, unsigned int size_order, u64 type,
- int flush_non_present_entry, int flush_dev_iotlb)
+static int __must_check flush_iotlb_reg(void *_iommu, u16 did, u64 addr,
+ unsigned int size_order, u64 type,
+ bool_t flush_non_present_entry,
+ bool_t flush_dev_iotlb)
{
struct iommu *iommu = (struct iommu *) _iommu;
int tlb_offset = ecap_iotlb_offset(iommu->ecap);
@@ -475,8 +475,8 @@ static int flush_iotlb_reg(void *_iommu, u16 did,
}
static int __must_check iommu_flush_iotlb_global(struct iommu *iommu,
- int flush_non_present_entry,
- int flush_dev_iotlb)
+ bool_t flush_non_present_entry,
+ bool_t flush_dev_iotlb)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
int status;
@@ -494,8 +494,8 @@ static int __must_check iommu_flush_iotlb_global(struct iommu *iommu,
}
static int __must_check iommu_flush_iotlb_dsi(struct iommu *iommu, u16 did,
- int flush_non_present_entry,
- int flush_dev_iotlb)
+ bool_t flush_non_present_entry,
+ bool_t flush_dev_iotlb)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
int status;
@@ -514,8 +514,8 @@ static int __must_check iommu_flush_iotlb_dsi(struct iommu *iommu, u16 did,
static int __must_check iommu_flush_iotlb_psi(struct iommu *iommu, u16 did,
u64 addr, unsigned int order,
- int flush_non_present_entry,
- int flush_dev_iotlb)
+ bool_t flush_non_present_entry,
+ bool_t flush_dev_iotlb)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
int status;
@@ -570,7 +570,7 @@ static int __must_check iommu_flush_all(void)
rc = iommu_flush_context_global(iommu, 0);
if ( rc <= 0 )
{
- int flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
+ bool_t flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
int ret = iommu_flush_iotlb_global(iommu, 0, flush_dev_iotlb);
ASSERT(ret <= 0);
@@ -595,7 +595,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
struct domain_iommu *hd = dom_iommu(d);
struct acpi_drhd_unit *drhd;
struct iommu *iommu;
- int flush_dev_iotlb;
+ bool_t flush_dev_iotlb;
int iommu_domid;
int rc = 0;
@@ -610,7 +610,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
continue;
- flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
+ flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
iommu_domid= domain_iommu_domid(d, iommu);
if ( iommu_domid == -1 )
continue;
@@ -1453,7 +1453,7 @@ int domain_context_mapping_one(
*/
if ( rc <= 0 )
{
- int flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
+ bool_t flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
int ret = iommu_flush_iotlb_dsi(iommu, 0, 1, flush_dev_iotlb);
ASSERT(ret <= 0);
@@ -1614,7 +1614,7 @@ int domain_context_unmap_one(
*/
if ( rc <= 0 )
{
- int flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
+ bool_t flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
int ret = iommu_flush_iotlb_dsi(iommu, iommu_domid, 0, flush_dev_iotlb);
ASSERT(ret <= 0);
@@ -1845,7 +1845,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
struct acpi_drhd_unit *drhd;
struct iommu *iommu = NULL;
struct domain_iommu *hd = dom_iommu(d);
- int flush_dev_iotlb;
+ bool_t flush_dev_iotlb;
int iommu_domid;
int rc = 0;
@@ -1857,7 +1857,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
continue;
- flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
+ flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
iommu_domid= domain_iommu_domid(d, iommu);
if ( iommu_domid == -1 )
continue;
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index c55ee08..e6cf738 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -514,10 +514,13 @@ struct ir_ctrl {
};
struct iommu_flush {
- int (*context)(void *iommu, u16 did, u16 source_id,
- u8 function_mask, u64 type, int non_present_entry_flush);
- int (*iotlb)(void *iommu, u16 did, u64 addr, unsigned int size_order,
- u64 type, int flush_non_present_entry, int flush_dev_iotlb);
+ int __must_check (*context)(void *iommu, u16 did, u16 source_id,
+ u8 function_mask, u64 type,
+ bool_t non_present_entry_flush);
+ int __must_check (*iotlb)(void *iommu, u16 did, u64 addr,
+ unsigned int size_order, u64 type,
+ bool_t flush_non_present_entry,
+ bool_t flush_dev_iotlb);
};
struct intel_iommu {
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index b81b0bd..aa7841a 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -274,9 +274,9 @@ int iommu_flush_iec_index(struct iommu *iommu, u8 im, u16 iidx)
return __iommu_flush_iec(iommu, IEC_INDEX_INVL, im, iidx);
}
-static int flush_context_qi(
- void *_iommu, u16 did, u16 sid, u8 fm, u64 type,
- int flush_non_present_entry)
+static int __must_check flush_context_qi(void *_iommu, u16 did,
+ u16 sid, u8 fm, u64 type,
+ bool_t flush_non_present_entry)
{
int ret = 0;
struct iommu *iommu = (struct iommu *)_iommu;
@@ -305,10 +305,10 @@ static int flush_context_qi(
return ret;
}
-static int flush_iotlb_qi(
- void *_iommu, u16 did,
- u64 addr, unsigned int size_order, u64 type,
- int flush_non_present_entry, int flush_dev_iotlb)
+static int __must_check flush_iotlb_qi(void *_iommu, u16 did, u64 addr,
+ unsigned int size_order, u64 type,
+ bool_t flush_non_present_entry,
+ bool_t flush_dev_iotlb)
{
u8 dr = 0, dw = 0;
int ret = 0;
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-08 8:59 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 8:58 [PATCH v7 00/11] Check VT-d Device-TLB flush error Xu, Quan
2016-06-08 8:58 ` [PATCH v7 01/11] IOMMU: handle IOMMU mapping and unmapping failures Xu, Quan
2016-06-08 8:58 ` [PATCH v7 02/11] IOMMU/MMU: enhance the call trees of IOMMU unmapping and mapping Xu, Quan
2016-06-08 14:40 ` Jan Beulich
[not found] ` <57584D8602000078000F32D0@prv-mh.provo.novell.com>
[not found] ` <421857ad-4f6b-e99c-1e81-034b19effdfb@amd.com>
2016-06-10 6:56 ` Jan Beulich
2016-06-12 6:41 ` Tian, Kevin
2016-06-08 8:58 ` [PATCH v7 03/11] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU unmapping (top level ones) Xu, Quan
2016-06-08 14:42 ` Jan Beulich
2016-06-08 14:54 ` Jan Beulich
2016-06-09 19:30 ` Suravee Suthikulanit
2016-06-09 10:28 ` Julien Grall
2016-06-08 8:58 ` [PATCH v7 04/11] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU mapping " Xu, Quan
2016-06-08 14:43 ` Jan Beulich
2016-06-09 18:45 ` Suravee Suthikulanit
2016-06-09 10:30 ` Julien Grall
2016-06-08 8:58 ` [PATCH v7 05/11] IOMMU/MMU: propagate IOMMU Device-TLB flush error up to iommu_iotlb_flush{, _all} " Xu, Quan
2016-06-09 11:12 ` Julien Grall
2016-06-09 11:45 ` Jan Beulich
2016-06-09 12:03 ` Julien Grall
2016-06-09 12:08 ` Julien Grall
2016-06-09 12:15 ` Jan Beulich
2016-06-09 12:24 ` Julien Grall
2016-06-09 12:32 ` Jan Beulich
2016-06-09 12:39 ` Julien Grall
2016-06-12 6:55 ` Tian, Kevin
2016-06-12 7:02 ` Xu, Quan
2016-06-12 15:35 ` Julien Grall
2016-06-09 12:14 ` Jan Beulich
2016-06-12 6:46 ` Tian, Kevin
2016-06-08 8:58 ` [PATCH v7 06/11] propagate IOMMU Device-TLB flush error up to EPT update " Xu, Quan
2016-06-08 8:59 ` [PATCH v7 07/11] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU suspending " Xu, Quan
2016-06-08 14:51 ` Jan Beulich
2016-06-12 7:42 ` Xu, Quan
2016-06-13 9:25 ` Jan Beulich
2016-06-09 18:58 ` Suravee Suthikulanit
2016-06-12 6:58 ` Tian, Kevin
2016-06-08 8:59 ` [PATCH v7 08/11] IOMMU: propagate IOMMU Device-TLB flush error (leaf ones) Xu, Quan
2016-06-08 8:59 ` [PATCH v7 09/11] vt-d: fix the IOMMU flush issue Xu, Quan
2016-06-12 7:32 ` Tian, Kevin
2016-06-12 9:27 ` Xu, Quan
2016-06-13 8:50 ` Xu, Quan
2016-06-08 8:59 ` [PATCH v7 10/11] vt-d: propagate the IOMMU Device-TLB flush error up to ME phantom functions Xu, Quan
2016-06-12 7:34 ` Tian, Kevin
2016-06-08 8:59 ` Xu, Quan [this message]
2016-06-12 7:35 ` [PATCH v7 11/11] vt-d: add __must_check annotation to IOMMU flush pointers and handlers Tian, Kevin
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=1465376344-28290-12-git-send-email-quan.xu@intel.com \
--to=quan.xu@intel.com \
--cc=dario.faggioli@citrix.com \
--cc=feng.wu@intel.com \
--cc=jbeulich@suse.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.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).