]> xenbits.xensource.com Git - xen.git/commit
x86/vpic: Improve bitops usage
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Apr 2025 13:52:08 +0000 (14:52 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 2 May 2025 13:12:10 +0000 (14:12 +0100)
commitebd53a74924b4a56819d44e765c945a485fb4393
tree6e7ae3d21066e3c5249c437189b19383b498e400
parent251015a40c6262038faadda49ec77ebb5ad97742
x86/vpic: Improve bitops usage

 * For vpic_get_priority(), introduce a common ror8() helper in plain C.  One
   thing that I can't persuade the compiler to realise is that a non-zero
   value rotated is still non-zero, so use __builtin_clz() to help the
   optimiser out.

 * vpic_ioport_write() can be simplified to just for_each_set_bit(), which
   avoids spilling pending to the stack each loop iteration.  Changing pending
   from unsigned int to uint8_t isn't even strictly necessary given the
   underlying types of vpic->isr and vpic->irr, but done so clarity.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/vpic.c
xen/include/xen/bitops.h