xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v2 1/2] xen/arm: ignore guest writes to GICD_ITARGETSR for SPIs
Date: Tue, 3 Jun 2014 17:07:06 +0100	[thread overview]
Message-ID: <1401811627-4389-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1406031703570.2526@kaball.uk.xensource.com>

Ignore guest writes to GICD_ITARGETSR that set the target cpu to a cpu
other than cpu0 for SPIs.

Also ignore guest writes to GICD_ITARGETSR for PPIs and SGIs as they can
only be delivered to the same cpu and that has already been configured
at initialization time.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

Changes in v2:
- ignore writes to rank 0;
- don't print a warning for ignoring writes to GICD_ITARGETSR;
- add a comment in the code to remember that we don't implement writes
to GICD_ITARGETSR.
---
 xen/arch/arm/vgic.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index cb8df3a..1304b5e 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -584,6 +584,13 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
         if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
         rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ITARGETSR);
         if ( rank == NULL) goto write_ignore;
+        /* only same vcpu delivery can be allowed for PPIs and SGIs */
+        if ( REG_RANK_NR(8, gicd_reg - GICD_ITARGETSR) == 0 ) 
+            return 1;
+        /* SPI delivery to secondary vcpus is unimplemented */
+        if ( REG_RANK_NR(8, gicd_reg - GICD_ITARGETSR) > 0 &&
+             *r != (1|1<<8|1<<16|1<<24) )
+            return 1;
         vgic_lock_rank(v, rank);
         if ( dabt.size == 2 )
             rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)] = *r;
-- 
1.7.10.4

  reply	other threads:[~2014-06-03 16:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 16:04 [PATCH v2 0/2] vgic emulation and GICD_ITARGETSR Stefano Stabellini
2014-06-03 16:07 ` Stefano Stabellini [this message]
2014-06-03 16:23   ` [PATCH v2 1/2] xen/arm: ignore guest writes to GICD_ITARGETSR for SPIs Ian Campbell
2014-06-03 16:25   ` Julien Grall
2014-06-03 16:07 ` [PATCH v2 2/2] xen/arm: observe itarget setting in vgic_enable_irqs and vgic_disable_irqs Stefano Stabellini
2014-06-03 16:33   ` Julien Grall
2014-06-06 16:29 ` [PATCH v2 0/2] vgic emulation and GICD_ITARGETSR Ian Campbell
2014-06-06 16:32   ` Ian Campbell
2014-06-09 10:41   ` Stefano Stabellini
2014-06-10 11:16     ` Ian Campbell
2014-06-10 14:10       ` Stefano Stabellini

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=1401811627-4389-1-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).