Monday, 2022-07-11

*** tpb <[email protected]> has joined #openrisc00:00
shornearnd: thanks for your review on the PCI stuff08:45
shorneI will need to take that and review some things08:45
arndok, no worries. What PCI host bridge implementation are you actually working on integrating? Is this for qemu, some license IP core or something else?08:46
shornethe host bridge we use is "pci-host-ecam-generic/",  the hardware is using qemu's generic pci stack in a new virt openrisc platform I am putting together08:47
arndok, I see. I think at least traditionally the way qemu dealt with I/O space  was rather weird, as the person who first ported that code from x86 to the arm kvm model didn't understand how I/O space works08:48
shorneI see, probably I don't really understand either as I was just using existing code as examples08:49
shorneYour comments help, I should be able to simplify this08:49
arndthey used to put the I/O space at a fixed location at physical address zero to have I/O port number equal to  physical memory address. This sounds like the right thing at first, but it really is not, as no real hardware ever did this08:49
arndwhat you should have in the qemu model is one register range for ECAM config space registers, and another 64KB register range for I/O space08:50
shornehttps://github.com/stffrdhrn/qemu/commit/d45518b39f35ee6dc2f764b2a65b4115f3dd205708:51
arndboth get listed in DT. The way they do get listed is again rather confusing, let me know if you need help with that. config space here is a regular 'reg' property, but I/O space is encoded in 'ranges'08:51
shornethis is my current patch for adding the qemu pci bus08:51
shorne    [VIRT_ECAM] =      { 0x9e000000,  0x1000000 },08:51
shorne    [VIRT_PIO] =       { 0x9f000000,  0x1000000 },08:51
shorne    [VIRT_MMIO] =      { 0xa0000000, 0x10000000 },08:51
arndok, that seems reasonable, though the PIO space is much too large, and the MMIO space is rather small08:52
arndPIO space size should be 0x10000, or possibly 0x1000, MMIO space should be as large as you can afford08:52
shorneok, mmio is now 256mb if I read it correct, so maybe 1gb would be more reasonable?08:54
shorneI am not sure i can afford much more08:54
shorneconsidering I will like to run with 1-2gb ram08:54
shorneI have to step away and get kids08:56
arndit depends on what kind of PCI card you want to attach, and how many of them. Most cards use at most 1MB of address space, the critical ones tend to be GPU or infiniband adapters, which you may not care about08:58
arndthe NVIDIA GPU on my system has one 256MB BAR, everything else fits into 64MB I think08:59
arndthe traditional way that x86-32 handled this was to give everything that is not RAM to PCI MMIO address space, so e.g. you could have RAM start at address 0, have all fixed MMIO locations start top-down from 0xffffffff, and use everything in the middle for MMIO space.09:02
shornearnd: I see, that could work12:56
*** shorne <[email protected]> has quit IRC (Read error: Connection reset by peer)15:43
*** shorne <[email protected]> has joined #openrisc15:49
*** shorne <[email protected]> has quit IRC (Read error: Connection reset by peer)16:53
*** shorne <[email protected]> has joined #openrisc16:58

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!