Tom Rotenberg
2009-May-25 09:01 UTC
[Xen-devel] Question about the dynamic sizing of the PCI hole
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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-May-25 09:14 UTC
Re: [Xen-devel] Question about the dynamic sizing of the PCI hole
On 25/05/2009 10:01, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote:> 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" ?Leading bits of this 32-bit value are 1s. Hence left shift is what we want. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tom Rotenberg
2009-May-25 09:24 UTC
Re: [Xen-devel] Question about the dynamic sizing of the PCI hole
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 <keir.fraser@eu.citrix.com>> On 25/05/2009 10:01, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote: > > > 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" ? > > Leading bits of this 32-bit value are 1s. Hence left shift is what we want. > > -- Keir > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-May-25 09:42 UTC
Re: [Xen-devel] Question about the dynamic sizing of the PCI hole
That field is updated dynamically. Can''t you fluently read ASL? ;-) -- Keir On 25/05/2009 10:24, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote:> 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 <keir.fraser@eu.citrix.com> >> On 25/05/2009 10:01, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote: >> >>> 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" ? >> >> Leading bits of this 32-bit value are 1s. Hence left shift is what we want. >> >> -- Keir >> >> >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tom Rotenberg
2009-May-25 09:48 UTC
Re: [Xen-devel] Question about the dynamic sizing of the PCI hole
Well, can u give me any pointer to which code updates it? (my English is better than my ASL :) 2009/5/25 Keir Fraser <keir.fraser@eu.citrix.com>> That field is updated dynamically. Can''t you fluently read ASL? ;-) > > -- Keir > > On 25/05/2009 10:24, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote: > > > 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 <keir.fraser@eu.citrix.com> > >> On 25/05/2009 10:01, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote: > >> > >>> 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" ? > >> > >> Leading bits of this 32-bit value are 1s. Hence left shift is what we > want. > >> > >> -- Keir > >> > >> > > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-May-25 11:24 UTC
Re: [Xen-devel] Question about the dynamic sizing of the PCI hole
On 25/05/2009 10:48, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote:> 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) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel