Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e84e0e0 authored by Marc Zyngier's avatar Marc Zyngier
Browse files

KVM: arm/arm64: vgic: Add vgic_{get,set}_phys_irq_active



In order to control the active state of an interrupt, introduce
a pair of accessors allowing the state to be set/queried.

This only affects the logical state, and the HW state will only be
applied at world-switch time.

Acked-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 08fd6461
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -356,6 +356,8 @@ int kvm_vgic_vcpu_active_irq(struct kvm_vcpu *vcpu);
struct irq_phys_map *kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu,
					   int virt_irq, int irq);
int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map);
bool kvm_vgic_get_phys_irq_active(struct irq_phys_map *map);
void kvm_vgic_set_phys_irq_active(struct irq_phys_map *map, bool active);

#define irqchip_in_kernel(k)	(!!((k)->arch.vgic.in_kernel))
#define vgic_initialized(k)	(!!((k)->arch.vgic.nr_cpus))
+24 −0
Original line number Diff line number Diff line
@@ -1801,6 +1801,30 @@ static void vgic_free_phys_irq_map_rcu(struct rcu_head *rcu)
	kfree(entry);
}

/**
 * kvm_vgic_get_phys_irq_active - Return the active state of a mapped IRQ
 *
 * Return the logical active state of a mapped interrupt. This doesn't
 * necessarily reflects the current HW state.
 */
bool kvm_vgic_get_phys_irq_active(struct irq_phys_map *map)
{
	BUG_ON(!map);
	return map->active;
}

/**
 * kvm_vgic_set_phys_irq_active - Set the active state of a mapped IRQ
 *
 * Set the logical active state of a mapped interrupt. This doesn't
 * immediately affects the HW state.
 */
void kvm_vgic_set_phys_irq_active(struct irq_phys_map *map, bool active)
{
	BUG_ON(!map);
	map->active = active;
}

/**
 * kvm_vgic_unmap_phys_irq - Remove a virtual to physical IRQ mapping
 * @vcpu: The VCPU pointer