Skip to content

Conversation

@joshwhieb
Copy link

Otherwise we can't realize the nvme disk through LUA. closes #27 . Was able to test this on qbox 3.0.1. How do I test this on the latest qbox master? I don't have access to the qemu "libqemu-v9.1-v0.17" tag.

Updated the documentation with an example of instantiating via lua. Not sure if we want to clean up the documentation a little bit since the gpex.add_device() is part of the constructor now?

Was able to add the following to conf.lua

    nvme_disk_0 = {
        moduletype = "nvme_disk",
        dylib_path = "nvme",
        args = {"&platform.qemu_inst", "&platform.gpex_0"},
        serial = "nvme_serial_001",
        blob_file=top().."fw/Artifacts/nvme_disk.img",
        max_ioqpairs = 64
    };

Now the device shows up in lspci on boot:

#> lspci -vv

00:01.0 Non-Volatile memory controller: Red Hat, Inc. QEMU NVM Express Controller (rev 02) (prog-if 02 [NVM Express])
        Subsystem: Red Hat, Inc. QEMU NVM Express Controller
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Interrupt: pin A routed to IRQ 18
        Region 0: Memory at 400000000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [80] Express (v2) Root Complex Integrated Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0
                        ExtTag- RBE+ FLReset+
                DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop- FLReset-
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr- TransPend-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis- NROPrPrP- LTR-
                         10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt+ EETLPPrefix+, MaxEETLPPrefixes 4
                         EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
                         FRS-
                         AtomicOpsCap: 32bit- 64bit- 128bitCAS-
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- OBFF Disabled,
                         AtomicOpsCtl: ReqEn-
        Capabilities: [60] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Kernel driver in use: nvme
        Kernel modules: nvme

Also able to read/write to the device.

#> dd if=/dev/nvme0n1 of=/dev/null bs=1K count=100 iflag=direct
100+0 records in
100+0 records out
102400 bytes (102 kB, 100 KiB) copied, 0.0622617 s, 1.6 MB/s

#> dd if=/dev/zero of=/dev/nvme0n1 bs=1K count=100 oflag=direct
100+0 records in
100+0 records out
102400 bytes (102 kB, 100 KiB) copied, 0.0702145 s, 1.5 MB/s

I do get a warning that MSI-X isn't supported by the interrupt controller before the kernel starts but still seems to work? Half the time the simulation on start also segmentation faults so there is some instability under the surface.

libqbox: warning: MSI-X is not supported by interrupt controller

jhieb added 3 commits August 18, 2025 11:51
… so that it is realized

Updated the documentation with an example of instantiating via lua.
Updated readme.md with same changes as the local.md
@joshwhieb joshwhieb closed this Aug 18, 2025
@joshwhieb
Copy link
Author

Needed to do sign-off. Will open a new PR.

@androm3da
Copy link
Contributor

Needed to do sign-off. Will open a new PR.

You can push a new commit w/the DCO without opening a new pull request.

@joshwhieb
Copy link
Author

ok good to know for next time. Seemed like from the error it was displaying each individual commit without the DCO.

@androm3da
Copy link
Contributor

ok good to know for next time. Seemed like from the error it was displaying each individual commit without the DCO.

Indeed: all of the commits do require the DCO. But once you add those you can (force) push them and this PR will reflect the updated commits. Holler if you need a hand rewriting those commits.

@joshwhieb
Copy link
Author

What I did was just squash merge all my changes to a new branch on my fork and i added the DCO there. The new PR passed the DCO check so is waiting on approval for the rest of the workflows. Seemed easier :)

#30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nvme disk not realized or connected when defining through lua

3 participants