Author: jrtc27
Date: Wed Sep 30 02:21:38 2020
New Revision: 366279
URL: https://svnweb.freebsd.org/changeset/base/366279

Log:
  riscv: Define __PCI_REROUTE_INTERRUPT
  
  Every other architecture defines this and this is required for
  interrupts to work when using QEMU's PCI VirtIO devices (which all
  report an interrupt line of 0) for two reasons.
  
  Firstly, interrupt line 0 is wrong; they use one of 0x20-0x23 with the
  lines being cycled across devices like normal. Moreover, RISC-V uses
  INTRNG, whose IRQs are virtual as indices into its irq_map, so even if
  we have the right interrupt line we still need to try and route the
  interrupt in order to ultimately call into intr_map_irq and get back a
  unique index into the map for the given line, otherwise we will use
  whatever happens to be in irq_map[line] (which for QEMU where the line
  is initialised to 0 results in using the first allocated interrupt,
  namely the RTC on IRQ 11 at time of commit).
  
  Note that pci_assign_interrupt will still do the wrong thing for INTRNG
  when using a tunable, as it will bypass INTRNG entirely and use the
  tunable's value as the index into irq_map, when it should instead
  (indirectly) call intr_map_irq to allocate a new entry for the given
  IRQ and treat the tunable as stating the physical line in use, which is
  what one would expect. This, however, is a problem shared by all INTRNG
  architectures, and not exclusive to RISC-V.
  
  Reviewed by:  kib
  Approved by:  kib
  Differential Revision:        https://reviews.freebsd.org/D26564

Modified:
  head/sys/riscv/include/param.h

Modified: head/sys/riscv/include/param.h
==============================================================================
--- head/sys/riscv/include/param.h      Wed Sep 30 02:18:09 2020        
(r366278)
+++ head/sys/riscv/include/param.h      Wed Sep 30 02:21:38 2020        
(r366279)
@@ -42,6 +42,8 @@
 #define        STACKALIGNBYTES (16 - 1)
 #define        STACKALIGN(p)   ((uint64_t)(p) & ~STACKALIGNBYTES)
 
+#define __PCI_REROUTE_INTERRUPT
+
 #ifndef MACHINE
 #define        MACHINE         "riscv"
 #endif
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to