From: Feng Wu <feng.wu@intel.com>
To: xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, Feng Wu <feng.wu@intel.com>,
george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
dario.faggioli@citrix.com, jbeulich@suse.com
Subject: [PATCH v7 5/6] VT-d: Some cleanups
Date: Mon, 7 Nov 2016 16:08:02 +0800 [thread overview]
Message-ID: <1478506083-14560-6-git-send-email-feng.wu@intel.com> (raw)
In-Reply-To: <1478506083-14560-1-git-send-email-feng.wu@intel.com>
Use type-safe structure assignment instead of memcpy()
Use sizeof(*iremap_entry).
Signed-off-by: Feng Wu <feng.wu@intel.com>
---
v7:
- Remove a useless cleanup
v6:
- More descripion about the patch
xen/drivers/passthrough/vtd/intremap.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 3f8c109..00a4bc1 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -183,8 +183,8 @@ static void free_remap_entry(struct iommu *iommu, int index)
GET_IREMAP_ENTRY(ir_ctrl->iremap_maddr, index,
iremap_entries, iremap_entry);
- memset(iremap_entry, 0, sizeof(struct iremap_entry));
- iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry));
+ memset(iremap_entry, 0, sizeof(*iremap_entry));
+ iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
iommu_flush_iec_index(iommu, 0, index);
unmap_vtd_domain_page(iremap_entries);
@@ -310,7 +310,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
GET_IREMAP_ENTRY(ir_ctrl->iremap_maddr, index,
iremap_entries, iremap_entry);
- memcpy(&new_ire, iremap_entry, sizeof(struct iremap_entry));
+ new_ire = *iremap_entry;
if ( rte_upper )
{
@@ -353,8 +353,8 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
remap_rte->format = 1; /* indicate remap format */
}
- memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry));
- iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry));
+ *iremap_entry = new_ire;
+ iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
iommu_flush_iec_index(iommu, 0, index);
unmap_vtd_domain_page(iremap_entries);
@@ -642,8 +642,8 @@ static int msi_msg_to_remap_entry(
if ( iremap_entry->val != new_ire.val )
{
- memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry));
- iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry));
+ *iremap_entry = new_ire;
+ iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
iommu_flush_iec_index(iommu, 0, index);
}
--
2.1.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-11-07 8:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 8:07 [PATCH v7 0/6] VMX: Properly handle pi descriptor and per-cpu blocking list Feng Wu
2016-11-07 8:07 ` [PATCH v7 1/6] VMX: Permanently assign PI hook vmx_pi_switch_to() Feng Wu
2016-11-11 18:28 ` Konrad Rzeszutek Wilk
2016-11-12 9:14 ` Wu, Feng
2016-11-12 14:07 ` Konrad Rzeszutek Wilk
2016-11-07 8:07 ` [PATCH v7 2/6] VMX: Properly handle pi when all the assigned devices are removed Feng Wu
2016-11-07 16:53 ` Jan Beulich
2016-11-07 8:08 ` [PATCH v7 3/6] VMX: Make sure PI is in proper state before install the hooks Feng Wu
2016-11-07 8:08 ` [PATCH v7 4/6] VT-d: No need to set irq affinity for posted format IRTE Feng Wu
2016-11-07 8:08 ` Feng Wu [this message]
2016-11-11 18:24 ` [PATCH v7 5/6] VT-d: Some cleanups Konrad Rzeszutek Wilk
2016-11-07 8:08 ` [PATCH v7 6/6] VMX: Fixup PI descriptor when cpu is offline Feng Wu
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=1478506083-14560-6-git-send-email-feng.wu@intel.com \
--to=feng.wu@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=george.dunlap@eu.citrix.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).