Eric,
In northbridge.c
Another typo error
/* If so place the one with the most stringent alignment first */ if (mem2->align > mem1->align) { struct resource *tmp; tmp = mem1; mem1 = mem2; mem2 = mem1; } /* Now place the memory as high up as it will go */ mem2->base = resource_max(mem2); mem1->limit = mem2->base - 1; mem1->base = resource_max(mem1);
----> /* If so place the one with the most stringent alignment first */ if (mem2->align > mem1->align) { struct resource *tmp; tmp = mem1; mem1 = mem2; mem2 = tmp; } /* Now place the memory as high up as it will go */ mem2->base = resource_max(mem2); mem1->limit = mem2->base - 1; mem1->base = resource_max(mem1);
Another question is
Should do align big allocation at first or align small first.
It seems you should do align big allocation.
Align big first
base1: 0xd0000000 limit1: 0xfebfffff size: 0x18800000 align: 28 base2: 0xec000000 limit2: 0xfebfffff size: 0x06b00000 align: 26 base1: 0xd8000000 limit1: 0xdfffffff size: 0x06b00000 align: 26 base2: 0xe0000000 limit2: 0xfebfffff size: 0x18800000 align: 28 PCI_DOMAIN: 0000 00 <- [0x0000001000 - 0x0000005fff] io PCI_DOMAIN: 0000 01 <- [0x00e0000000 - 0x00f87fffff] prefmem PCI_DOMAIN: 0000 02 <- [0x00d8000000 - 0x00deafffff] mem
Align small first base1: 0xd0000000 limit1: 0xfebfffff size: 0x18800000 align: 28 base2: 0xec000000 limit2: 0xfebfffff size: 0x06b00000 align: 26 base1: 0xd0000000 limit1: 0xf7ffffff size: 0x18800000 align: 28 base2: 0xf8000000 limit2: 0xfebfffff size: 0x06b00000 align: 26 PCI_DOMAIN: 0000 00 <- [0x0000001000 - 0x0000005fff] io PCI_DOMAIN: 0000 01 <- [0x00d0000000 - 0x00e87fffff] prefmem PCI_DOMAIN: 0000 02 <- [0x00f8000000 - 0x00feafffff] mem
YhLu YhLu@tyan.com writes:
Eric,
In northbridge.c
Another typo error
Thanks. My test case obviously does not include a 32bit prefetchable memory resource.
Another question is
Should do align big allocation at first or align small first.
It seems you should do align big allocation.
Hmm.
What has generally proved to be a good solution. Is to allocate the resources with the largest alignment at the lowest addresses, and the resources with the less strict alignment at later addresses. So I think we are in agreement about what works well.
I don't think it matters which order you perform the allocation so long as the larger alignments come at the lower addresses in memory.
Right now this is a first pass and it does ok, but it has all sorts of issues. I believe what really needs to happen is that these resources become transparent/subtractive and that compute_allocate_resource be taught how to do a better job with limits.
That should also help with the case where one bridge can do something better than another bridge.
The current strategy of reducing the limit of the parent resource actually falls down when we hit pnp I/O resources that are only 12 bit.
I need to be fresh before I fix the general problem though.
Eric