mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
KVM: arm64: vgic-v5: Add for_each_visible_v5_ppi() iterator
We have multiple instances of iterators walking the vgic_ppi_mask mask, and the way it is written has a tendency to make one's eyes bleed. Factor it as a helper and use that across the code base. Link: https://lore.kernel.org/r/20260520091949.542365-2-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
7fd2df204f
commit
09a4b56100
|
|
@ -751,7 +751,7 @@ static bool access_gicv5_ppi_enabler(struct kvm_vcpu *vcpu,
|
|||
* Sync the change in enable states to the vgic_irqs. We consider all
|
||||
* PPIs as we don't expose many to the guest.
|
||||
*/
|
||||
for_each_set_bit(i, mask, VGIC_V5_NR_PRIVATE_IRQS) {
|
||||
for_each_visible_v5_ppi(i, vcpu->kvm) {
|
||||
u32 intid = vgic_v5_make_ppi(i);
|
||||
struct vgic_irq *irq;
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ static void vgic_v5_sync_ppi_priorities(struct kvm_vcpu *vcpu)
|
|||
* those actually exposed to the guest by first iterating over the mask
|
||||
* of exposed PPIs.
|
||||
*/
|
||||
for_each_set_bit(i, vcpu->kvm->arch.vgic.gicv5_vm.vgic_ppi_mask, VGIC_V5_NR_PRIVATE_IRQS) {
|
||||
for_each_visible_v5_ppi(i, vcpu->kvm) {
|
||||
u32 intid = vgic_v5_make_ppi(i);
|
||||
struct vgic_irq *irq;
|
||||
int pri_idx, pri_reg, pri_bit;
|
||||
|
|
@ -358,7 +358,7 @@ bool vgic_v5_has_pending_ppi(struct kvm_vcpu *vcpu)
|
|||
if (!priority_mask)
|
||||
return false;
|
||||
|
||||
for_each_set_bit(i, vcpu->kvm->arch.vgic.gicv5_vm.vgic_ppi_mask, VGIC_V5_NR_PRIVATE_IRQS) {
|
||||
for_each_visible_v5_ppi(i, vcpu->kvm) {
|
||||
u32 intid = vgic_v5_make_ppi(i);
|
||||
bool has_pending = false;
|
||||
struct vgic_irq *irq;
|
||||
|
|
@ -391,8 +391,7 @@ void vgic_v5_fold_ppi_state(struct kvm_vcpu *vcpu)
|
|||
activer = host_data_ptr(vgic_v5_ppi_state)->activer_exit;
|
||||
pendr = host_data_ptr(vgic_v5_ppi_state)->pendr;
|
||||
|
||||
for_each_set_bit(i, vcpu->kvm->arch.vgic.gicv5_vm.vgic_ppi_mask,
|
||||
VGIC_V5_NR_PRIVATE_IRQS) {
|
||||
for_each_visible_v5_ppi(i, vcpu->kvm) {
|
||||
u32 intid = vgic_v5_make_ppi(i);
|
||||
struct vgic_irq *irq;
|
||||
|
||||
|
|
@ -429,8 +428,7 @@ void vgic_v5_flush_ppi_state(struct kvm_vcpu *vcpu)
|
|||
* ICC_PPI_PENDRx_EL1, however.
|
||||
*/
|
||||
bitmap_zero(pendr, VGIC_V5_NR_PRIVATE_IRQS);
|
||||
for_each_set_bit(i, vcpu->kvm->arch.vgic.gicv5_vm.vgic_ppi_mask,
|
||||
VGIC_V5_NR_PRIVATE_IRQS) {
|
||||
for_each_visible_v5_ppi(i, vcpu->kvm) {
|
||||
u32 intid = vgic_v5_make_ppi(i);
|
||||
struct vgic_irq *irq;
|
||||
|
||||
|
|
|
|||
|
|
@ -378,6 +378,9 @@ void vgic_v5_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr);
|
|||
void vgic_v5_restore_state(struct kvm_vcpu *vcpu);
|
||||
void vgic_v5_save_state(struct kvm_vcpu *vcpu);
|
||||
|
||||
#define for_each_visible_v5_ppi(__i, __k) \
|
||||
for_each_set_bit(__i, (__k)->arch.vgic.gicv5_vm.vgic_ppi_mask, VGIC_V5_NR_PRIVATE_IRQS)
|
||||
|
||||
static inline int vgic_v3_max_apr_idx(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct vgic_cpu *cpu_if = &vcpu->arch.vgic_cpu;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user