tech-kern archive

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

Re: VirtIO MMIO for amd64




On 12/20/23 16:56, Taylor R Campbell wrote:

My guess is that this is not going to be MSI -- it'll either be i8259
or ioapic.  In that case, it may work to do this:

Thanks a lot for that, here's the result, unfortunately it still
hangs at the first VOP_OPEN() from subr_disk_open.c and the
handler function never gets triggered:

static int
virtio_mmio_cmdline_alloc_interrupts(struct virtio_mmio_softc *msc)
{
	struct virtio_mmio_cmdline_softc *const sc =
		(struct virtio_mmio_cmdline_softc *)msc;
	struct virtio_softc *const vsc = &msc->sc_sc;
	struct ioapic_softc *ioapic;
	struct pic *pic;
	int irq = sc->margs.irq;
	int pin = irq;

	ioapic = ioapic_find_bybase(irq);

	/* we don't enter here */
	if (ioapic != NULL) {
		pic = &ioapic->sc_pic;
		pin = irq - pic->pic_vecbase;
		irq = -1;
	} else
		pic = &i8259_pic;

	msc->sc_ih = intr_establish_xname(irq, pic, pin, IST_EDGE, IPL_BIO,
		virtio_mmio_intr, msc, false, device_xname(vsc->sc_dev));
	if (msc->sc_ih == NULL) {
		aprint_error_dev(vsc->sc_dev,
		    "failed to establish interrupt\n");
		return -1;
	}
	aprint_normal_dev(vsc->sc_dev, "interrupting on %d\n", irq);

	return 0;
}

/* --- */

intr_establish_xname() does get through :

[   1.0000030] viommio: 4K@0xd0000000:5
[   1.0000030] virtio0: block device (id 2, rev. 0x02)
[   1.0000030] ld0 at virtio0: features: 0x100000000<V1>
[   1.0000030] virtio0: interrupting on 5 <---
[ 1.0000030] ld0: 30720 KB, 60 cyl, 16 head, 63 sec, 512 bytes/sect x 61441 sectors
[   1.0107398] boot device: ld0

--
------------------------------------------------------------------------
Emile `iMil' Heitor <imil@{home.imil.net,NetBSD.org}> | https://imil.net


Home | Main Index | Thread Index | Old Index