Re: [RFC v2 13/17] x86/apic: Handle EOI writes for SAVIC guests

Thomas Gleixner
2025-03-21T15:41:47Z

On Wed, Feb 26 2025 at 14:35, Neeraj Upadhyay wrote:
> +static int find_highest_isr(void *backing_page)
> +{
> + int vec_per_reg = 32;
> + int max_vec = 256;
> + u32 reg;
> + int vec;
> +
> + for (vec = max_vec - 32; vec >= 0; vec -= vec_per_reg) {
> + reg = get_reg(backing_page, APIC_ISR + REG_POS(vec));
> + if (reg)
> + return __fls(reg) + vec;
> + }
> +
> + return -1;

Congrats. You managed to re-implement find_last_bit() in the most
incomprehesible way.

Thanks,

tglx