Skip to contentSkip to conversation

Question about the dynamic sizing of the PCI hole

DISCUSSION Tom Rotenberg 2 participants 6 messages May 25, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I am reviewing the code of the hvmloader from Xen 3.4, and i saw that in changeset 19021, there was a patch which added the ability to dynamically size the PCI hole. I have seen that this patch calculates the total memory size, but i failed to understand the following lines:

while ( (mmio_total > (pci_mem_end - pci_mem_start)) &&

            ((pci_mem_start << 1) != 0) )
        pci_mem_start <<= 1;

It looks as if the pci mem start will be increased if there isn't enough space for the PCI devices, although, as far as i understand, it should be decreased (so the PCI hole will be enlarged). So, shouldn't it be:
"pci_mem_start >> = 1" ?

Thanks,
Tom

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 5 lines · Tom Rotenberg

I am reviewing the code of the hvmloader from Xen 3.4, and i saw that in changeset 19021, there was a patch which added the ability to dynamically size the PCI hole. I have seen that this patch calculates the total memory size, but i failed to understand the following lines:

Quoted 8 lines

while ( (mmio_total > (pci_mem_end - pci_mem_start)) && ((pci_mem_start << 1) != 0) ) pci_mem_start <<= 1;

It looks as if the pci mem start will be increased if there isn't enough space for the PCI devices, although, as far as i understand, it should be decreased (so the PCI hole will be enlarged). So, shouldn't it be: "pci_mem_start >> = 1" ?

Leading bits of this 32-bit value are 1s. Hence left shift is what we want.

-- Keir

#2 lore raw

And, won't we have any problem if we dynamically size the PCI hole, and not update it in the DSDT we give for the HVM (in the DSDT it's always 0xf0000...)?

2009/5/25 Keir Fraser <[email protected]>

Quoted 16 lines · Tom Rotenberg
Quoted 3 lines

I am reviewing the code of the hvmloader from Xen 3.4, and i saw that in changeset 19021, there was a patch which added the ability to dynamically

size

Quoted 1 line

the PCI hole. I have seen that this patch calculates the total memory

size,

Quoted 7 lines

but i failed to understand the following lines:

while ( (mmio_total > (pci_mem_end - pci_mem_start)) &&

            ((pci_mem_start << 1) != 0) )
        pci_mem_start <<= 1;

It looks as if the pci mem start will be increased if there isn't enough

space

Quoted 1 line

for the PCI devices, although, as far as i understand, it should be

Quoted 11 lines

decreased

Quoted 3 lines

(so the PCI hole will be enlarged). So, shouldn't it be: "pci_mem_start

Quoted 1 line

=

1" ?

Leading bits of this 32-bit value are 1s. Hence left shift is what we want.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

That field is updated dynamically. Can't you fluently read ASL? ;-)

-- Keir

Quoted 30 lines · Tom Rotenberg

And, won't we have any problem if we dynamically size the PCI hole, and not update it in the DSDT we give for the HVM (in the DSDT it's always 0xf0000...)?

2009/5/25 Keir Fraser <[email protected]>

Quoted 24 lines · Tom Rotenberg
Quoted 11 lines

I am reviewing the code of the hvmloader from Xen 3.4, and i saw that in changeset 19021, there was a patch which added the ability to dynamically size
the PCI hole. I have seen that this patch calculates the total memory size, but i failed to understand the following lines:

while ( (mmio_total > (pci_mem_end - pci_mem_start)) && ((pci_mem_start << 1) != 0) ) pci_mem_start <<= 1;

Quoted 6 lines

It looks as if the pci mem start will be increased if there isn't enough space
for the PCI devices, although, as far as i understand, it should be decreased
(so the PCI hole will be enlarged). So, shouldn't it be: "pci_mem_start >> = 1" ?

Leading bits of this 32-bit value are 1s. Hence left shift is what we want.

 -- Keir

#4 lore raw

Well, can u give me any pointer to which code updates it? (my English is better than my ASL :)

2009/5/25 Keir Fraser <[email protected]>

Quoted 33 lines

That field is updated dynamically. Can't you fluently read ASL? ;-)

-- Keir

Quoted 1 line · Tom Rotenberg

And, won't we have any problem if we dynamically size the PCI hole, and

not

Quoted 7 lines

update it in the DSDT we give for the HVM (in the DSDT it's always 0xf0000...)?

2009/5/25 Keir Fraser <[email protected]>

Quoted 3 lines · Tom Rotenberg
Quoted 2 lines

I am reviewing the code of the hvmloader from Xen 3.4, and i saw that

in

Quoted 1 line
Quoted 1 line
Quoted 1 line

changeset 19021, there was a patch which added the ability to

dynamically

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

size
the PCI hole. I have seen that this patch calculates the total memory

size,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

but i failed to understand the following lines:

while ( (mmio_total > (pci_mem_end - pci_mem_start)) &&

            ((pci_mem_start << 1) != 0) )
        pci_mem_start <<= 1;

It looks as if the pci mem start will be increased if there isn't

enough

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

space
for the PCI devices, although, as far as i understand, it should be decreased
(so the PCI hole will be enlarged). So, shouldn't it be: "pci_mem_start

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines

=

Quoted 1 line

1" ?

Leading bits of this 32-bit value are 1s. Hence left shift is what we

want.

Quoted 5 lines
Quoted 4 lines

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 2 lines · Tom Rotenberg

Well, can u give me any pointer to which code updates it? (my English is better than my ASL :)

                CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01._MIN, MMIN)
                CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01._MAX, MMAX)
                CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01._LEN, MLEN)

                Store(\_SB.PMIN, MMIN)
                Store(\_SB.PLEN, MLEN)
                Add(MMIN, MLEN, MMAX)
                Subtract(MMAX, One, MMAX)