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

Re: [PATCH v2 5/8] xen/arm/gic: Allow routing/removing interrupt to running VMs


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Fri, 17 May 2024 14:03:21 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EQSB1ASWz/oXaBldxTRIk2Q7eTJHYhI6okfoX6IssWk=; b=i3fcibowIv9WzAjghPvchLRmuErsRpm6+StI/YDPQ5GtszxW8AteHJJB3n6pnKUTccMKPk7S2Qh2ZWbmN4JpzQT1EWmx+jhMQkUl4VJvHenqFdrmQOJl4P2Czb7TAgB86nR9RB35EgO12XlXwyxqSqNWN8y38OuhqDJjsNrj/79Y62XMiyAhOFuno5NvV6vrWlUlPTwXyHtK5NtcXpf9hwkIUIXlUp5MyoS1+bGoclXYytHe1v6D//j09PQ9k67PvTj3g7D8jeJhFKNdEq6t2ipWdtylDqG5hPM4lN7A7SfVr0ikw7DcRWjC8jqGOXU5OUsmLa2E0EyOxoKsoSdHiw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BFlxTWr36NYgGxGk79I7nvb+ssd4dylNKZXvQQmYgUlqcF9yu6oyJ0/eCMq1DmxxL+Ff8dt7Q3WUsg9t8qkGn5HoVDIpwaX5W3WDZzi66uN27Fbzak1XaiBUc7DbNfZrpy7qvkrCakHa8n36TgaYNJ8j3QxxE7X/iS7CSsM04CukPpd2zaeuGuCYqKifML/zAjz8b6iHgJ6w+4vJzToomSbLvRt4iXDoavToQcpDySvyJZ5XHmd8gIA2h2GdT3WHgOsHO5/QVBZty5N2OhzIdcX2yzkHW3Lc1ZJpIpOMrORVnq1zW54Hv1Q4E12rkVB2/iwbqUrksJcUx2oLQxTaEw==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 17 May 2024 06:03:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 5/16/2024 6:03 PM, Henry Wang wrote:
From: Vikram Garhwal <fnu.vikram@xxxxxxxxxx>

Currently, routing/removing physical interrupts are only allowed at
the domain creation/destroy time. For use cases such as dynamic device
tree overlay adding/removing, the routing/removing of physical IRQ to
running domains should be allowed.

Removing the above-mentioned domain creation/dying check. Since this
will introduce interrupt state unsync issues for cases when the
interrupt is active or pending in the guest, therefore for these cases
we simply reject the operation. Do it for both new and old vGIC
implementations.

Signed-off-by: Vikram Garhwal <fnu.vikram@xxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
---
v2:
- Reject the case where the IRQ is active or pending in guest.
---
  xen/arch/arm/gic-vgic.c  |  8 ++++++--
  xen/arch/arm/gic.c       | 15 ---------------
  xen/arch/arm/vgic/vgic.c |  5 +++--
  3 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 56490dbc43..d1608415f8 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -444,14 +444,18 @@ int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, 
unsigned int virq,
      {
          /* The VIRQ should not be already enabled by the guest */
          if ( !p->desc &&
-             !test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) )
+             !test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) &&
+             !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) &&
+             !test_bit(GIC_IRQ_GUEST_ACTIVE, &p->status) )
              p->desc = desc;
          else
              ret = -EBUSY;
      }
      else
      {
-        if ( desc && p->desc != desc )
+        if ( desc && p->desc != desc &&
+             (test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) ||
+              test_bit(GIC_IRQ_GUEST_ACTIVE, &p->status)) )

This should be

+        if ( (desc && p->desc != desc) ||
+             test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) ||
+             test_bit(GIC_IRQ_GUEST_ACTIVE, &p->status) )

@@ -887,7 +887,8 @@ int vgic_connect_hw_irq(struct domain *d, struct vcpu *vcpu,
      }
      else                                /* remove a mapped IRQ */
      {
-        if ( desc && irq->hwintid != desc->irq )
+        if ( desc && irq->hwintid != desc->irq &&
+             (irq->active || irq->pending_latch) )

Same here, this should be

+        if ( (desc && irq->hwintid != desc->irq) ||
+             irq->active || irq->pending_latch )

Kind regards,
Henry




 


Rackspace

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