diff mbox series

[1/3] evtchn/hvm: do not allow binding PIRQs unless supported

Message ID 20220303103057.49181-2-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 (or PVH) domain not having PIRQ support won't be allowed to map PIRQs in
the first place, but would still be allowed usage of
EVTCHNOP_bind_pirq. Such hypercall won't have any practical effect on
the domain, as the event channels would never be bound to PIRQs.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/event_channel.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jan Beulich March 3, 2022, 12:36 p.m. UTC | #1
On 03.03.2022 11:30, Roger Pau Monne wrote:
> --- a/xen/common/event_channel.c
> +++ b/xen/common/event_channel.c
> @@ -556,6 +556,9 @@ static int evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
>      int            port = 0, rc;
>      unsigned int   pirq = bind->pirq;
>  
> +    if ( is_hvm_domain(d) && !has_pirq(d) )

Arm doesn't have has_pirq(), so some further conditional will be needed,
or has_pirq() needs adding there.

Doesn't this want further accompanying with adjustments to the checks in
physdev_{,un}map_pirq()?

> +        return -ENOSYS;

-EOPNOTSUPP please.

Jan
diff mbox series

Patch

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index ffb042a241..bc4985706a 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -556,6 +556,9 @@  static int evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
     int            port = 0, rc;
     unsigned int   pirq = bind->pirq;
 
+    if ( is_hvm_domain(d) && !has_pirq(d) )
+        return -ENOSYS;
+
     if ( pirq >= d->nr_pirqs )
         return -EINVAL;