diff mbox series

[2/3] hvm/irq: tighten check in hvm_domain_use_pirq

Message ID 20220303103057.49181-3-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series x86/hvm: PIRQ related cleanup and a fix | expand

Commit Message

Roger Pau Monné March 3, 2022, 10:30 a.m. UTC
hvm_domain_use_pirq checking whether the passed domain is an HVM
guests is pointless, as all calls originate from HVM only paths.
Instead check whether the domain has PIRQ support in order to avoid
further checks.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Beulich March 3, 2022, 12:44 p.m. UTC | #1
On 03.03.2022 11:30, Roger Pau Monne wrote:
> hvm_domain_use_pirq checking whether the passed domain is an HVM
> guests is pointless, as all calls originate from HVM only paths.
> Instead check whether the domain has PIRQ support in order to avoid
> further checks.

I agree with this, but I wonder ...

> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -30,7 +30,7 @@
>  
>  bool hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
>  {
> -    return is_hvm_domain(d) && pirq && pirq->arch.hvm.emuirq != IRQ_UNBOUND;
> +    return has_pirq(d) && pirq && pirq->arch.hvm.emuirq != IRQ_UNBOUND;

... whether there can be a non-NULL pirq in the first place for a
!has_pirq() domain. Judging from e.g. hvm_inject_msi() it looks like
this might be possible, but perhaps wrongly so?

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 5a7f39b54f..7c5dfd3c3a 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -30,7 +30,7 @@ 
 
 bool hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
 {
-    return is_hvm_domain(d) && pirq && pirq->arch.hvm.emuirq != IRQ_UNBOUND;
+    return has_pirq(d) && pirq && pirq->arch.hvm.emuirq != IRQ_UNBOUND;
 }
 
 /* Must be called with hvm_domain->irq_lock hold */