[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 3/6] xen/arm: observe itargets setting in vgic_enable_irqs and vgic_disable_irqs



Hi Stefano,

On 11/06/14 17:27, Stefano Stabellini wrote:
+static struct vcpu *_vgic_get_target_vcpu(struct vcpu *v, unsigned int irq)

[..]

+struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq)

Can you add comment explaining what are the differences between these 2 functions?

AFAIU, the first one is assuming the rank lock is taken. If so, I would add an ASSERT in it. I would avoid people misuse the 2 functions.

      case GICD_ISPENDR ... GICD_ISPENDRN:
@@ -589,12 +625,23 @@ 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_rank_offset(v, 8, gicd_reg - GICD_ITARGETSR);
          if ( rank == NULL) goto write_ignore;
+        /* 8-bit vcpu mask for this domain */

BUG_ON(v->domain->max_vcpus > 8)? Just for enforcement.

+        tr = (1 << v->domain->max_vcpus) - 1;
+        tr = tr | (tr << 8) | (tr << 16) | (tr << 24);
+        tr &= *r;
+        /* ignore zero writes */
+        if ( !tr )
+            goto write_ignore;
+        if ( dabt.size == 2 &&
+            !((tr & 0xff) && (tr & (0xff << 8)) &&
+             (tr & (0xff << 16)) && (tr & (0xff << 24))))
+            goto write_ignore;

I quite difficult to understand this check. Does this check is only for word-access?

AFAIU, with byte-access it's possible to write 0 in itargets. For this case, the register may contain some 1 out of the byte offset.

Regards,

--
Julien Grall

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.