All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 2/3] x86/HVM: make vmsi_deliver() return proper error values
Date: Tue, 3 Jun 2014 15:13:15 +0100	[thread overview]
Message-ID: <538DD7FB.8050304@citrix.com> (raw)
In-Reply-To: <538DF0ED0200007800017698@mail.emea.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 3937 bytes --]

On 03/06/14 14:59, Jan Beulich wrote:
> ... and propagate this from hvm_inject_msi(). In the course of this I
> spotted further room for cleanup:
> - vmsi_inj_irq()'s struct domain * parameter was unused
> - vmsi_deliver() pointlessly passed on dest_ExtINT to vmsi_inj_irq()
>   (which that one validly refused to handle)
> - vmsi_inj_irq()'s sole caller guarantees a proper delivery mode (i.e.
>   rather than printing an obscure message we can just BUG())
> - some formatting and log message quirks
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Arguably under Xen style, the final addition in the final hunk should
have a newline before return 0, but that's trivial.

>
> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -311,9 +311,7 @@ int hvm_inject_msi(struct domain *d, uin
>          return -ERANGE;
>      }
>  
> -    vmsi_deliver(d, vector, dest, dest_mode, delivery_mode, trig_mode);
> -
> -    return 0;
> +    return vmsi_deliver(d, vector, dest, dest_mode, delivery_mode, trig_mode);
>  }
>  
>  void hvm_set_callback_via(struct domain *d, uint64_t via)
> --- a/xen/arch/x86/hvm/vmsi.c
> +++ b/xen/arch/x86/hvm/vmsi.c
> @@ -43,14 +43,12 @@
>  #include <asm/io_apic.h>
>  
>  static void vmsi_inj_irq(
> -    struct domain *d,
>      struct vlapic *target,
>      uint8_t vector,
>      uint8_t trig_mode,
>      uint8_t delivery_mode)
>  {
> -    HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "vmsi_inj_irq "
> -                "irq %d trig %d delive mode %d\n",
> +    HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "vmsi_inj_irq: vec %02x trig %d dm %d\n",
>                  vector, trig_mode, delivery_mode);
>  
>      switch ( delivery_mode )
> @@ -60,8 +58,7 @@ static void vmsi_inj_irq(
>          vlapic_set_irq(target, vector, trig_mode);
>          break;
>      default:
> -        gdprintk(XENLOG_WARNING, "error delivery mode %d\n", delivery_mode);
> -        break;
> +        BUG();
>      }
>  }
>  
> @@ -76,38 +73,31 @@ int vmsi_deliver(
>      switch ( delivery_mode )
>      {
>      case dest_LowestPrio:
> -    {
>          target = vlapic_lowest_prio(d, NULL, 0, dest, dest_mode);
>          if ( target != NULL )
> -            vmsi_inj_irq(d, target, vector, trig_mode, delivery_mode);
> -        else
> -            HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "null round robin: "
> -                        "vector=%x delivery_mode=%x\n",
> -                        vector, dest_LowestPrio);
> -        break;
> -    }
> +        {
> +            vmsi_inj_irq(target, vector, trig_mode, delivery_mode);
> +            break;
> +        }
> +        HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "null MSI round robin: vector=%02x\n",
> +                    vector);
> +        return -ESRCH;
>  
>      case dest_Fixed:
> -    case dest_ExtINT:
> -    {
>          for_each_vcpu ( d, v )
>              if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
>                                     0, dest, dest_mode) )
> -                vmsi_inj_irq(d, vcpu_vlapic(v),
> -                             vector, trig_mode, delivery_mode);
> +                vmsi_inj_irq(vcpu_vlapic(v), vector,
> +                             trig_mode, delivery_mode);
>          break;
> -    }
>  
> -    case dest_SMI:
> -    case dest_NMI:
> -    case dest_INIT:
> -    case dest__reserved_2:
>      default:
> -        gdprintk(XENLOG_WARNING, "Unsupported delivery mode %d\n",
> -                 delivery_mode);
> -        break;
> +        printk(XENLOG_G_WARNING
> +               "%pv: Unsupported MSI delivery mode %d for Dom%d\n",
> +               current, delivery_mode, d->domain_id);
> +        return -EINVAL;
>      }
> -    return 1;
> +    return 0;
>  }
>  
>  void vmsi_deliver_pirq(struct domain *d, const struct hvm_pirq_dpci *pirq_dpci)
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 4680 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2014-06-03 14:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 13:52 [PATCH 0/3] XSA-96 follow-ups Jan Beulich
2014-06-03 13:58 ` [PATCH 1/3] x86/HVM: properly propagate errors from HVMOP_inject_msi Jan Beulich
2014-06-03 14:05   ` Andrew Cooper
2014-06-03 13:59 ` [PATCH 2/3] x86/HVM: make vmsi_deliver() return proper error values Jan Beulich
2014-06-03 14:13   ` Andrew Cooper [this message]
2014-06-03 14:00 ` [PATCH 3/3] pt-irq fixes and improvements Jan Beulich
2014-06-03 14:50   ` Andrew Cooper
2014-06-04  8:24     ` [PATCH v2 " Jan Beulich
2014-06-10  0:32       ` Zhang, Yang Z
2014-06-11 12:32       ` Ping [tools]: " Jan Beulich
2014-06-11 16:54         ` Ian Campbell
2014-06-12  9:02       ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538DD7FB.8050304@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.