diff options
author | Greg Kroah-Hartman | 2016-11-14 08:53:56 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2016-11-14 08:53:56 +0100 |
commit | ce0347c2b089eb6ad6c14ab628a0ba5eb42f1492 (patch) | |
tree | ac46f6168ebf7d44e33903f35f699cda2ec21ace /virt/kvm/arm/vgic/vgic-mmio.h | |
parent | abbdc56b17d662ae710bc0c30cf0d0e9da805fd4 (diff) | |
parent | a25f0944ba9b1d8a6813fd6f1a86f1bd59ac25a6 (diff) |
Merge 4.9-rc5 into staging-next
We want the staging/iio fixes in here as well to resolve issues and
merge problems.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'virt/kvm/arm/vgic/vgic-mmio.h')
-rw-r--r-- | virt/kvm/arm/vgic/vgic-mmio.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/virt/kvm/arm/vgic/vgic-mmio.h b/virt/kvm/arm/vgic/vgic-mmio.h index 4c34d39d44a0..84961b4e4422 100644 --- a/virt/kvm/arm/vgic/vgic-mmio.h +++ b/virt/kvm/arm/vgic/vgic-mmio.h @@ -50,15 +50,15 @@ extern struct kvm_io_device_ops kvm_io_gic_ops; #define VGIC_ADDR_IRQ_MASK(bits) (((bits) * 1024 / 8) - 1) /* - * (addr & mask) gives us the byte offset for the INT ID, so we want to - * divide this with 'bytes per irq' to get the INT ID, which is given - * by '(bits) / 8'. But we do this with fixed-point-arithmetic and - * take advantage of the fact that division by a fraction equals - * multiplication with the inverted fraction, and scale up both the - * numerator and denominator with 8 to support at most 64 bits per IRQ: + * (addr & mask) gives us the _byte_ offset for the INT ID. + * We multiply this by 8 the get the _bit_ offset, then divide this by + * the number of bits to learn the actual INT ID. + * But instead of a division (which requires a "long long div" implementation), + * we shift by the binary logarithm of <bits>. + * This assumes that <bits> is a power of two. */ #define VGIC_ADDR_TO_INTID(addr, bits) (((addr) & VGIC_ADDR_IRQ_MASK(bits)) * \ - 64 / (bits) / 8) + 8 >> ilog2(bits)) /* * Some VGIC registers store per-IRQ information, with a different number |