Message ID | 1491508074-31647-6-git-send-email-cjp256@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello, On 06/04/2017 20:47, Chris Patterson wrote: > From: "Chris Patterson" <pattersonc@ainfosec.com> > > The addition of new IRQ-related platform hooks now allow platforms to > perform platform-specific interrupt logic, such as allowing virtualization > of platform-specific interrupt controller hardware. > > This commit adds the ability for the platform to identify the domain > a given IRQ is routed to, allowing platform logic to deny access to > registers associated with a given IRQ unless the requesting domain > 'owns' the IRQ. This will be used on Tegra platforms, where the hardware > domain needs access to its legacy interrupt controller, but should not > be able to control registers that correspond to other domains' IRQs, or > sections associated with IRQs routed to Xen. > > Authored-by: Kyle Temkin <temkink@ainfosec.com> > Signed-off-by: Kyle Temkin <temkink@ainfosec.com> > Signed-off-by: Chris Patterson <pattersonc@ainfosec.com> > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > > changes since rfc: > - formatting & code style cleanup > > --- > > xen/arch/arm/irq.c | 10 ++++++++++ > xen/include/asm-arm/irq.h | 2 ++ > 2 files changed, 12 insertions(+) > > diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c > index 0b4eaa9..51bce58 100644 > --- a/xen/arch/arm/irq.c > +++ b/xen/arch/arm/irq.c > @@ -143,6 +143,16 @@ static inline struct domain *irq_get_domain(struct irq_desc *desc) > return irq_get_guest_info(desc)->d; > } > > +domid_t irq_get_domain_id(struct irq_desc *desc) > +{ > + /* If this domain isn't routed to a guest, return DOMID_XEN. */ > + if ( !test_bit(_IRQ_GUEST, &desc->status) ) > + return DOMID_XEN; > + > + /* Otherise, get the guest domain's information. */ NIT: s/Otherise/Otherwise/ > + return irq_get_domain(desc)->domain_id; > +} > + > void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask) > { > if ( desc != NULL ) > diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h > index 4849f16..d0fd6db 100644 > --- a/xen/include/asm-arm/irq.h > +++ b/xen/include/asm-arm/irq.h > @@ -44,6 +44,8 @@ int route_irq_to_guest(struct domain *d, unsigned int virq, > unsigned int irq, const char *devname); > int release_guest_irq(struct domain *d, unsigned int irq); > > +domid_t irq_get_domain_id(struct irq_desc *desc); > + > void arch_move_irqs(struct vcpu *v); > > #define arch_evtchn_bind_pirq(d, pirq) ((void)((d) + (pirq))) > Cheers,
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 0b4eaa9..51bce58 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -143,6 +143,16 @@ static inline struct domain *irq_get_domain(struct irq_desc *desc) return irq_get_guest_info(desc)->d; } +domid_t irq_get_domain_id(struct irq_desc *desc) +{ + /* If this domain isn't routed to a guest, return DOMID_XEN. */ + if ( !test_bit(_IRQ_GUEST, &desc->status) ) + return DOMID_XEN; + + /* Otherise, get the guest domain's information. */ + return irq_get_domain(desc)->domain_id; +} + void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask) { if ( desc != NULL ) diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h index 4849f16..d0fd6db 100644 --- a/xen/include/asm-arm/irq.h +++ b/xen/include/asm-arm/irq.h @@ -44,6 +44,8 @@ int route_irq_to_guest(struct domain *d, unsigned int virq, unsigned int irq, const char *devname); int release_guest_irq(struct domain *d, unsigned int irq); +domid_t irq_get_domain_id(struct irq_desc *desc); + void arch_move_irqs(struct vcpu *v); #define arch_evtchn_bind_pirq(d, pirq) ((void)((d) + (pirq)))