Module Name:    src
Committed By:   jdolecek
Date:           Fri May 15 07:31:07 UTC 2020

Modified Files:
        src/sys/arch/xen/x86: pintr.c

Log Message:
only call PHYSDEVOP_map_pirq for a shared interrupt once, same as previous code

fixes boot problem reported privately by Frank Kardel and Patrick Welche


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/pintr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.14 src/sys/arch/xen/x86/pintr.c:1.15
--- src/sys/arch/xen/x86/pintr.c:1.14	Mon May  4 15:55:56 2020
+++ src/sys/arch/xen/x86/pintr.c	Fri May 15 07:31:07 2020
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.14 2020/05/04 15:55:56 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.15 2020/05/15 07:31:07 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -194,6 +194,11 @@ xen_pic_to_gsi(struct pic *pic, int pin)
 	    {
 		KASSERT(gsi < 255);
 
+		if (irq2port[gsi] != 0) {
+			/* Already mapped the shared interrupt */
+			break;
+		}
+
 		memset(&map_irq, 0, sizeof(map_irq));
 		map_irq.domid = DOMID_SELF;
 		map_irq.type = MAP_PIRQ_TYPE_GSI;
@@ -201,7 +206,8 @@ xen_pic_to_gsi(struct pic *pic, int pin)
 		map_irq.pirq = gsi;
 		ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
 		if (ret != 0)
-			panic("physdev_op(PHYSDEVOP_map_pirq) fail");
+			panic("physdev_op(PHYSDEVOP_map_pirq) GSI fail %d",
+			    ret);
 		break;
 	    }
 	case PIC_MSI:
@@ -226,7 +232,8 @@ xen_pic_to_gsi(struct pic *pic, int pin)
 		}
 		ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
 		if (ret != 0)
-			panic("physdev_op(PHYSDEVOP_map_pirq) fail");
+			panic("physdev_op(PHYSDEVOP_map_pirq) MSI fail %d",
+			    ret);
 		KASSERT(map_irq.entry_nr == i->mp_veccnt);
 		gsi = map_irq.pirq;
 		break;

Reply via email to