문제

I understand that PCI and PCIe devices can be configured by the CPU (via code in the BIOS or OS) to respond to certain physical memory addresses by writing to specific areas of the device's configuration space.
In fact the Linux kernel has quite the complicated algorithm for doing this taking into account a lot of requirements of the device (memory alignment, DMA capabilities etc).

Seeing that software seems to be in control of if, when and where this memory is mapped, my question is: How can a piece of software control mapping of physical memory?

After this configuration, the PCI device will know to respond to the given address range, but how does the CPU know that it should go on the PCI bus for those specific addresses that were just dynamically decided?

도움이 되었습니까?

해결책

The northbridge is programmed with the address range(s) that are to be routed to the memory controller(s). All other addresses go to the external bus.

다른 팁

It is based on address mapping info that CPU had. normally you have 2^64 -1 address lines with CPU if it is 64 bit processor. Now memory is now around 16 GB which is 2^34 is around 16 GB. So all the devices which CPU has (even legacy PCI and PCIe devices) and their config space can be mapped to address line above this RAM physical address space. Any IO to this space can be forwarded to respective device. In our case CPU finds out that the config space which it wants to access to is a PCI or PCIe device then it forwards the instruction to host bridge of CPU (00:00:00 Do lspci in a box you will see the host bridge with this BDF)

Once it finds out the target device is within host bridge the instruction (Can be IO or Memory) will be converted to appropriate TLP request.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top