Re: [Xen-devel] [PATCH v8 09/13] arm/guest_access: Rename vgic_access_guest_memory
Hi Sergej, On 09/08/17 09:20, Sergej Proskurin wrote: This commit renames the function vgic_access_guest_memory to access_guest_memory_by_ipa. As the function name suggests, the functions expects an IPA as argument. All invocations of this function have been adapted accordingly. Apart from that, we have adjusted all printk messages for cleanup and to eliminate artefacts of the function's previous location. Signed-off-by: Sergej ProskurinAcked-by: Julien Grall Cheers, --- Cc: Stefano Stabellini Cc: Julien Grall --- v6: We added this patch to our patch series. v7: Renamed the function's argument ipa back to gpa. Removed any mentioning of "vITS" in the function's printk messages and adjusted the commit message accordingly. --- xen/arch/arm/guestcopy.c | 10 +- xen/arch/arm/vgic-v3-its.c | 36 ++-- xen/include/asm-arm/guest_access.h | 4 ++-- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 938ffe2668..4ee07fcea3 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -123,8 +123,8 @@ unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned le * Temporarily map one physical guest page and copy data to or from it. * The data to be copied cannot cross a page boundary. */ -int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, - uint32_t size, bool is_write) +int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf, + uint32_t size, bool is_write) { struct page_info *page; uint64_t offset = gpa & ~PAGE_MASK; /* Offset within the mapped page */ @@ -134,7 +134,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, /* Do not cross a page boundary. */ if ( size > (PAGE_SIZE - offset) ) { -printk(XENLOG_G_ERR "d%d: vITS: memory access would cross page boundary\n", +printk(XENLOG_G_ERR "d%d: guestcopy: memory access crosses page boundary.\n", d->domain_id); return -EINVAL; } @@ -142,7 +142,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, page = get_page_from_gfn(d, paddr_to_pfn(gpa), , P2M_ALLOC); if ( !page ) { -printk(XENLOG_G_ERR "d%d: vITS: Failed to get table entry\n", +printk(XENLOG_G_ERR "d%d: guestcopy: failed to get table entry.\n", d->domain_id); return -EINVAL; } @@ -150,7 +150,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, if ( !p2m_is_ram(p2mt) ) { put_page(page); -printk(XENLOG_G_ERR "d%d: vITS: memory used by the ITS should be RAM.", +printk(XENLOG_G_ERR "d%d: guestcopy: guest memory should be RAM.\n", d->domain_id); return -EINVAL; } diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 1af6820cab..72a5c70656 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -131,9 +131,9 @@ static int its_set_collection(struct virt_its *its, uint16_t collid, if ( collid >= its->max_collections ) return -ENOENT; -return vgic_access_guest_memory(its->d, -addr + collid * sizeof(coll_table_entry_t), -_id, sizeof(vcpu_id), true); +return access_guest_memory_by_ipa(its->d, + addr + collid * sizeof(coll_table_entry_t), + _id, sizeof(vcpu_id), true); } /* Must be called with the ITS lock held. */ @@ -149,9 +149,9 @@ static struct vcpu *get_vcpu_from_collection(struct virt_its *its, if ( collid >= its->max_collections ) return NULL; -ret = vgic_access_guest_memory(its->d, - addr + collid * sizeof(coll_table_entry_t), - _id, sizeof(coll_table_entry_t), false); +ret = access_guest_memory_by_ipa(its->d, + addr + collid * sizeof(coll_table_entry_t), + _id, sizeof(coll_table_entry_t), false); if ( ret ) return NULL; @@ -171,9 +171,9 @@ static int its_set_itt_address(struct virt_its *its, uint32_t devid, if ( devid >= its->max_devices ) return -ENOENT; -return vgic_access_guest_memory(its->d, -addr + devid * sizeof(dev_table_entry_t), -_entry, sizeof(itt_entry), true); +return access_guest_memory_by_ipa(its->d, + addr + devid * sizeof(dev_table_entry_t), + _entry, sizeof(itt_entry), true); } /* @@ -189,9 +189,9 @@
[Xen-devel] [PATCH v8 09/13] arm/guest_access: Rename vgic_access_guest_memory
This commit renames the function vgic_access_guest_memory to access_guest_memory_by_ipa. As the function name suggests, the functions expects an IPA as argument. All invocations of this function have been adapted accordingly. Apart from that, we have adjusted all printk messages for cleanup and to eliminate artefacts of the function's previous location. Signed-off-by: Sergej Proskurin--- Cc: Stefano Stabellini Cc: Julien Grall --- v6: We added this patch to our patch series. v7: Renamed the function's argument ipa back to gpa. Removed any mentioning of "vITS" in the function's printk messages and adjusted the commit message accordingly. --- xen/arch/arm/guestcopy.c | 10 +- xen/arch/arm/vgic-v3-its.c | 36 ++-- xen/include/asm-arm/guest_access.h | 4 ++-- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 938ffe2668..4ee07fcea3 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -123,8 +123,8 @@ unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned le * Temporarily map one physical guest page and copy data to or from it. * The data to be copied cannot cross a page boundary. */ -int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, - uint32_t size, bool is_write) +int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf, + uint32_t size, bool is_write) { struct page_info *page; uint64_t offset = gpa & ~PAGE_MASK; /* Offset within the mapped page */ @@ -134,7 +134,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, /* Do not cross a page boundary. */ if ( size > (PAGE_SIZE - offset) ) { -printk(XENLOG_G_ERR "d%d: vITS: memory access would cross page boundary\n", +printk(XENLOG_G_ERR "d%d: guestcopy: memory access crosses page boundary.\n", d->domain_id); return -EINVAL; } @@ -142,7 +142,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, page = get_page_from_gfn(d, paddr_to_pfn(gpa), , P2M_ALLOC); if ( !page ) { -printk(XENLOG_G_ERR "d%d: vITS: Failed to get table entry\n", +printk(XENLOG_G_ERR "d%d: guestcopy: failed to get table entry.\n", d->domain_id); return -EINVAL; } @@ -150,7 +150,7 @@ int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf, if ( !p2m_is_ram(p2mt) ) { put_page(page); -printk(XENLOG_G_ERR "d%d: vITS: memory used by the ITS should be RAM.", +printk(XENLOG_G_ERR "d%d: guestcopy: guest memory should be RAM.\n", d->domain_id); return -EINVAL; } diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 1af6820cab..72a5c70656 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -131,9 +131,9 @@ static int its_set_collection(struct virt_its *its, uint16_t collid, if ( collid >= its->max_collections ) return -ENOENT; -return vgic_access_guest_memory(its->d, -addr + collid * sizeof(coll_table_entry_t), -_id, sizeof(vcpu_id), true); +return access_guest_memory_by_ipa(its->d, + addr + collid * sizeof(coll_table_entry_t), + _id, sizeof(vcpu_id), true); } /* Must be called with the ITS lock held. */ @@ -149,9 +149,9 @@ static struct vcpu *get_vcpu_from_collection(struct virt_its *its, if ( collid >= its->max_collections ) return NULL; -ret = vgic_access_guest_memory(its->d, - addr + collid * sizeof(coll_table_entry_t), - _id, sizeof(coll_table_entry_t), false); +ret = access_guest_memory_by_ipa(its->d, + addr + collid * sizeof(coll_table_entry_t), + _id, sizeof(coll_table_entry_t), false); if ( ret ) return NULL; @@ -171,9 +171,9 @@ static int its_set_itt_address(struct virt_its *its, uint32_t devid, if ( devid >= its->max_devices ) return -ENOENT; -return vgic_access_guest_memory(its->d, -addr + devid * sizeof(dev_table_entry_t), -_entry, sizeof(itt_entry), true); +return access_guest_memory_by_ipa(its->d, + addr + devid * sizeof(dev_table_entry_t), + _entry, sizeof(itt_entry), true); } /* @@ -189,9 +189,9 @@ static int its_get_itt(struct virt_its *its, uint32_t devid, if ( devid >= its->max_devices )