5 comments

  • tiernano 2 hours ago
    Hmmm.... Wondering if this could be eventually used to emulate a PCIe card using another device, like a RaspberryPi or something more powerful... Thinking the idea of a card you could stick in a machine, anything from a 1x to 16x slot, that emulates a network card (you could run VPN or other stuff on the card and offload it from the host) or storage (running something with enough power to run ZFS and a few disks, and show to the host as a single disk, allowing ZFS on devices that would not support it). but this is probably not something easy...
    • cakehonolulu 21 minutes ago
      Hi! Author here! You can technically offload the transactions the real driver on your host does to wherever you want really. PCI is very delay-tolerant and it usually negotiates with the device so I see not much of an issue doing that proven that you can efficiently and performantly manage the throughput throughout the architecture. The thing that kinda makes PCIem special is that you are pretty much free to do whatever you want with the accesses the driver does, you have total freedom. I have made a simple NVME controller (With a 1GB drive I basically malloc'd) which pops up on the local PCI bus (And the regular Linux's nvme block driver attaches to it just fine). You can format it, mount it, create files, folders... it's kinda neat. I also have a simple dumb rasteriser that I made inside QEMU that I wanted to write a driver for, but since it doesn't exist, I used PCIem to help me redirect the driver writes to the QEMU instance hosting the card (Thus was able to run software-rendered DOOM, OpenGL 1.X-based Quake and Half-Life ports).
    • Palomides 10 minutes ago
      some ARM chips can do PCIe endpoint mode, and the kernel has support for pretending to be an nvme ssd https://docs.kernel.org/nvme/nvme-pci-endpoint-target.html
    • pjc50 1 hour ago
      > emulate a PCIe card using another device

      The other existing solution to this is FPGA cards: https://www.fpgadeveloper.com/list-of-fpga-dev-boards-for-pc... - note the wide spread in price. You then also have to deal with FPGA tooling. The benefit is much better timing.

      • cakehonolulu 19 minutes ago
        Indeed, and even then, there's some sw-hw-codesign stuff that kinda helps you do what PCIem does but it's usually really pricey; so I kinda thought it'd be a good thing to have for free.

        PCIe prototyping is usually not something super straightforward if you don't want to pay hefty sums IME.

    • xerxes901 2 hours ago
      Something like the stm32mp2 series of MCUs can run Linux and act as a PCIe endpoint you can control from a kernel module on the MCU. So you can program an arbitrary PCIe device that way (although it won’t be setting any speed records, and I think the PHY might be limited to PCIe 1x)
      • tiernano 2 hours ago
        interesting... x1 would too slow for large amounts of storage, but as a test, a couple small SSDs could potentially be workable... sounds like im doing some digging...
        • cakehonolulu 10 minutes ago
          If there's any particular feature you feel you are missing on PCIem or anything, feel free to open an Issue and I'll look into it ;)
    • hsbauauvhabzb 2 hours ago
      … or pcie over ethernet ;)
  • Surac 2 hours ago
    that is a huge win if you are developing drivers or even real hardware. it allows to iterate on protokols just with the press of a button
    • cakehonolulu 8 minutes ago
      Indeed, the project has gone through a few iterations already (It was first a monolithic kernel module that required a secondary module to call into the API and whatnot). I've went towards a more userspace-friendly usage mainly so that you can iterate your changes much, much faster. Creating the synthetic PCI device is as easy as opening the userspace shim you program, it'll then appear on your bus. When you want to test new changes, you close the shim normally (Effectively removing it from the bus) and you can do this process as many times as needed.
  • throwaway132448 2 hours ago
    Tangential question: PCIe is a pretty future-proof technology to learn/invest in, right? As in, it is very unlikely to become obsolete in the next 5-10 years (like USB)?
    • pjc50 1 hour ago
      Neither of those is going to be obsolete in 5 years. Might get rebadged and a bunch of extensions, but there's such a huge install base that rapid change is unlikely. Neither Firewire nor Thunderbolt unseated USB.
      • formerly_proven 1 hour ago
        USB4 is the ~third USB protocol stack though (USB1/2 being basically the same iirc, USB3 being a completely separate protocol that neither logically nor physically interacts with USB1/2 at all), heavily based on Thunderbolt to the point of backwards compatibility.
        • p_l 15 minutes ago
          USB4 is essentially thunderbolt with some new features and some features being optional instead of mandatory.
    • neocron 2 hours ago
      Might as well be replaced by optical connectors next years, but who knows in advance. Currently there is no competition
      • tiernano 2 hours ago
        even though it would be optical, it still is using PCIe protocols in the background...
        • embedding-shape 57 minutes ago
          How could you possibly know exactly what protocol they'd be using for the potential future optical PCIe connection? Your guess is as good as anyone's, no?
          • p_l 14 minutes ago
            Probably because optical PCI-E is an old thing by now.

            In fact, "zero~th generation" of thunderbolt used optical link, too. Also both thunderbolt and DisplayPort reuse a lot of common elements from PCI-E

    • checker659 1 hour ago
      Curious what you mean by learning? Learning about TLPs? Learning about FPGA DMA Engines like XDMA? Learning about PCIe switches / retimers? Learning about `lspci`?
  • zozbot234 57 minutes ago
    inb4 Linux kernel is getting every feature from plan9 and turning into a proper microkernel OS. It's finally no longer "obsolete"!