[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/HVM: slightly improve hvm_mmio_{first, last}_byte()
commit 4561569a11353688b97220be8d6a0821d53b97a6 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Apr 26 13:47:21 2016 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Apr 26 13:47:21 2016 +0200 x86/HVM: slightly improve hvm_mmio_{first,last}_byte() EFLAGS.DF can be assumed to be usually clear, so unlikely()-annotate the conditionals accordingly. Also prefer latching p->size (used twice) into a local variable, at once making it unnecessary for the reader to be sure expressions get evaluated left to right (operand promotion would yield a different result if p->addr + p->size - 1 was evaluted right to left). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/include/asm-x86/hvm/io.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index ceefa2e..5445fce 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -44,18 +44,18 @@ struct hvm_mmio_ops { static inline paddr_t hvm_mmio_first_byte(const ioreq_t *p) { - return p->df ? + return unlikely(p->df) ? p->addr - (p->count - 1ul) * p->size : p->addr; } static inline paddr_t hvm_mmio_last_byte(const ioreq_t *p) { - unsigned long count = p->count; + unsigned long size = p->size; - return p->df ? - p->addr + p->size - 1: - p->addr + (count * p->size) - 1; + return unlikely(p->df) ? + p->addr + size - 1: + p->addr + (p->count * size) - 1; } typedef int (*portio_action_t)( -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |