qdev property bug?
Quoted 11 lines · Gerd Hoffmann
Quoted 1 line · Michael S. Tsirkin
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader. It fails to fit both e1000 (default nic) and virtio-net boot roms into the option rom area and bails out (before loading seabios).
vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...
Quoted 3 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.
Yes.
Quoted 2 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit big compared to the older roms we had.
Hmm, it's a regression then ...
Quoted 6 lines
Do they have tons of features
compiled in? Can we make them smaller by disabling some? Or maybe have *one* rom which supports *all* qemu nics? It would be larger of course, but assuming a big share of the option rom is non-hardware specific code which wouldn't be duplicated in memory then with two different cards it might work out nevertheless?
Haven't looked at the code at all yet.
I would expect common code with all the features to be part of PXE code in BIOS, not part of option rom. Isn't this how it is structured?
Quoted 2 lines
Or add a nic property to disable rom
loading?
Yes, and I think it should be off by default.
Quoted 2 lines
cheers,
Gerd
Cc qemu and other people who participated in a similar discussion in the past.
Signature · 1 line
MST
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines · Michael S. Tsirkin
Quoted 1 line
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader. It fails to fit both e1000 (default nic) and virtio-net boot roms into the option rom area and bails out (before loading seabios).
vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...With two identical nics the (single) rom fits and qemu boots.
Quoted 8 lines
Quoted 1 line
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 2 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit big compared to the older roms we had.
Hmm, it's a regression then ...
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
So there must be some way to just have more option rom space. Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
Quoted 28 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 25 lines · Gerd Hoffmann
Quoted 14 lines · Michael S. Tsirkin
Quoted 2 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 3 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 3 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.
Quoted 5 lines
Quoted 1 line
Hmm, it's a regression then ...
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.
Quoted 1 line
So there must be some way to just have more option rom space.
What do you mean?
Quoted 4 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.
Signature · 1 line
MST
Quoted 40 lines · Michael S. Tsirkin
Quoted 31 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 28 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 4 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.Quoted 6 lines
Quoted 2 lines
Hmm, it's a regression then ...
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Quoted 5 lines
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.
There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
Quoted 5 lines
Quoted 2 lines
So there must be some way to just have more option rom space.
What do you mean?
Well, what's keeping us from having 5 MB of option roms?
Quoted 10 lines
Quoted 5 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.
Agreed. If there is a solution that gives us the chance to support an arbitrary number of option roms that wouldn't take forever to implement, I'd rather take that one though.
Alex
Quoted 47 lines · Alexander Graf
Quoted 40 lines · Michael S. Tsirkin
Quoted 31 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 28 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 4 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.Quoted 6 lines
Quoted 2 lines
Hmm, it's a regression then ...
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Quoted 5 lines
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.
Quoted 3 lines
There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
This might boil down to better ROMs. E.g. maybe they request memory with PMM and then give it up after initialization?
Quoted 24 lines
Quoted 5 lines
Quoted 2 lines
So there must be some way to just have more option rom space.
What do you mean?
Well, what's keeping us from having 5 MB of option roms?
Quoted 10 lines
Quoted 5 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.Agreed. If there is a solution that gives us the chance to support an arbitrary number of option roms that wouldn't take forever to implement, I'd rather take that one though.
Alex
The old behavior with two different nic types and -boot n was "undefined".
The old etherboot roms were quite large. To large to fit more than one (certainly not two).
Quoted 1 line
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
You can disable rom loading for individual cards.
Quoted 1 line
So there must be some way to just have more option rom space. Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
gPXE is freakishly large as far as option roms go :-)
Regards,
Anthony Liguori
Quoted 57 lines · Alexander Graf
Quoted 40 lines · Michael S. Tsirkin
Quoted 37 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 33 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 5 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader. It fails to fit both e1000 (default nic) and virtio-net boot roms into the option rom area and bails out (before loading seabios).
vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 5 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit big compared to the older roms we had.
Hmm, it's a regression then ...
Quoted 9 lines
Quoted 3 lines
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
So there must be some way to just have more option rom space.
What do you mean?
Well, what's keeping us from having 5 MB of option roms?
For starters, option roms run in real mode when you only have 1MB of addressable memory :-)
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.
Quoted 4 lines
Agreed. If there is a solution that gives us the chance to support an arbitrary number of option roms that wouldn't take forever to implement, I'd rather take that one though.
For 0.12, we just need to fail gracefully (meaning stop loading option roms when we run out of room). It's not a regression compared to 0.11.
Regards,
Anthony Liguori
Quoted 79 lines · Anthony Liguori
Quoted 52 lines · Alexander Graf
Quoted 35 lines · Michael S. Tsirkin
Quoted 33 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 30 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 4 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.Hmm, it's a regression then ...
Quoted 9 lines
Quoted 4 lines
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So there must be some way to just have more option rom space.
What do you mean?
Well, what's keeping us from having 5 MB of option roms?
For starters, option roms run in real mode when you only have 1MB of addressable memory :-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
Quoted 9 lines
Quoted 4 lines
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.Agreed. If there is a solution that gives us the chance to support an arbitrary number of option roms that wouldn't take forever to implement, I'd rather take that one though.
Quoted 6 lines
For 0.12, we just need to fail gracefully (meaning stop loading option roms when we run out of room). It's not a regression compared to 0.11.
Regards,
Anthony Liguori
Well I am pretty sure that I used virtio + e1000 with 0.11 and apparently I can't now.
So it does look like a regression to me ...
Signature · 1 line
MST
Quoted 83 lines · Michael S. Tsirkin
Quoted 82 lines · Anthony Liguori
Quoted 52 lines · Alexander Graf
Quoted 35 lines · Michael S. Tsirkin
Quoted 33 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 30 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 4 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.Hmm, it's a regression then ...
Quoted 9 lines
Quoted 4 lines
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So there must be some way to just have more option rom space.
What do you mean?
Well, what's keeping us from having 5 MB of option roms?
For starters, option roms run in real mode when you only have 1MB of addressable memory :-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
Quoted 9 lines
Quoted 4 lines
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.Agreed. If there is a solution that gives us the chance to support an arbitrary number of option roms that wouldn't take forever to implement, I'd rather take that one though.
For 0.12, we just need to fail gracefully (meaning stop loading option roms when we run out of room). It's not a regression compared to 0.11.
Quoted 9 lines
Quoted 3 lines
Regards,
Anthony Liguori
Well I am pretty sure that I used virtio + e1000 with 0.11 and apparently I can't now.
So it does look like a regression to me ...
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
Quoted 2 lines
Signature · 1 line
MST
Quoted 4 lines · Michael S. Tsirkin
Well I am pretty sure that I used virtio + e1000 with 0.11 and apparently I can't now.
So it does look like a regression to me ...
That's what I said, we should make sure that we stop loading roms when we run out of room as opposed to trampling over the bios space.
But let's not try to solve the problem of fitting more roms into the space than we can.
Regards,
Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
Regards,
Anthony Liguori
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
MST
Quoted 4 lines · Anthony Liguori
The old behavior with two different nic types and -boot n was "undefined".
The old etherboot roms were quite large. To large to fit more than one (certainly not two).
Two worked with the etherboot roms.
Quoted 5 lines
Quoted 3 lines
So there must be some way to just have more option rom space. Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
gPXE is freakishly large as far as option roms go :-)
With gPXE only one rom fits in.
cheers,
Gerd
Quoted 7 lines · Gerd Hoffmann
Quoted 4 lines · Anthony Liguori
The old behavior with two different nic types and -boot n was "undefined".
The old etherboot roms were quite large. To large to fit more than one (certainly not two).
Two worked with the etherboot roms.
Yes, they were 32k. Two did not work though if you were also using extboot (which was 2k). Still, etherboot was not a BEV rom so you couldn't make sense out of two of them anyway (since they hijack int19).
Regards,
Anthony Liguori
Quoted 16 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
Quoted 6 lines
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Sorry, I misunderstood what you were saying. I thought you suggested handling it with exit(1) or something like that. Yes, this hack will work I think, unless we want to go back to 0.11 behaviour.
Quoted 11 lines
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
Regards,
Anthony Liguori
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
MST
Quoted 48 lines · Michael S. Tsirkin
Quoted 47 lines · Alexander Graf
Quoted 45 lines · Michael S. Tsirkin
Quoted 31 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 28 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 4 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.Quoted 6 lines
Quoted 2 lines
Hmm, it's a regression then ...
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.
Quoted 7 lines
Quoted 3 lines
There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
This might boil down to better ROMs. E.g. maybe they request memory with PMM and then give it up after initialization?
That would be my guess.
However, gpxe rom are also used in real hardware. Maybe there is some config trick we're missing?
Quoted 83 lines · Michael S. Tsirkin
Quoted 82 lines · Anthony Liguori
Quoted 52 lines · Alexander Graf
Quoted 35 lines · Michael S. Tsirkin
Quoted 33 lines · Alexander Graf
Am 14.12.2009 um 11:59 schrieb "Michael S. Tsirkin" <[email protected]>:
Quoted 30 lines · Gerd Hoffmann
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines
No, it did not even start booting the kernel. Just gave me blank screen.
[ testing ]
Oh. That is something completely different. A bug in the rom loader.
It fails to fit both e1000 (default nic) and virtio-net boot roms into
the option rom area and bails out (before loading seabios).vl.cdoesn't check the return value and happily continues (without bios). Which doesn't work out very well ...Quoted 4 lines
With two identical nics the (single) rom fits and qemu boots.
Hmm. Of course
vl.cmust be fixed to check the return value.Yes.
Quoted 4 lines
Not sure how to deal with the rom size issue. The gPXE roms look quit
big compared to the older roms we had.Hmm, it's a regression then ...
Quoted 9 lines
Quoted 4 lines
How does real hw handle this? I'm pretty sure most servers these days use more option rom space than this. They usually have some onboard raid bios, external storage, on-board nic, pci nic, ...
Real hardware might do several things I know about
- option rom is typically small.
- option rom is not loaded always (BIOS option), or not for all cards. There are might be other tricks.There are probably other tricks. I was booting up a machine that had like 5 options roms going through their initialization that all weren't exactly small.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So there must be some way to just have more option rom space.
What do you mean?
Well, what's keeping us from having 5 MB of option roms?
For starters, option roms run in real mode when you only have 1MB of addressable memory :-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Implementing anything else would just be a waste of time. It'd break again when ppl do device assignment.
Alex
Quoted 9 lines
Quoted 4 lines
We need some solution for 0.12 though IMO.
This does not need to address device assignment,
but it must be simple.Agreed. If there is a solution that gives us the chance to support an arbitrary number of option roms that wouldn't take forever to implement, I'd rather take that one though.
For 0.12, we just need to fail gracefully (meaning stop loading option roms when we run out of room). It's not a regression compared to 0.11.
Quoted 8 lines
Quoted 3 lines
Regards,
Anthony Liguori
Well I am pretty sure that I used virtio + e1000 with 0.11 and apparently I can't now.
So it does look like a regression to me ...
e1000 is the problem here, since it is by far the largest roms of them all.
Quoted 7 lines · Anthony Liguori
Quoted 3 lines · Michael S. Tsirkin
Well I am pretty sure that I used virtio + e1000 with 0.11 and apparently I can't now.
So it does look like a regression to me ...That's what I said, we should make sure that we stop loading roms when we run out of room as opposed to trampling over the bios space.
Can't we first load the bios?
Then we're pretty sure oproms will never trample it.
Quoted 11 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
I think it used to be possible to have two different nic types and only load one rom, e.g. -net nic,model=pcnet -net nic,model=e1000 -option-rom e1000.rom Then use the boot menu to select the e1000 nic.
Quoted 1 line
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Even if i repeat myself [1] i suggest putting an option-rom loading flag to the -net option:
-net nic,model=e1000,rom=[on,off,e1000.bin]
Quoted 1 line
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
The default behaviour should be not loading option-roms; users should request those.
[1] http://lists.gnu.org/archive/html/qemu-devel/2009-11/msg01095.html
- Sebastian
Quoted 35 lines · Sebastian Herbszt
Quoted 8 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
Quoted 7 lines
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
I think it used to be possible to have two different nic types and only load one rom, e.g. -net nic,model=pcnet -net nic,model=e1000 -option-rom e1000.rom Then use the boot menu to select the e1000 nic.
Quoted 6 lines
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Even if i repeat myself [1] i suggest putting an option-rom loading flag to the -net option:
-net nic,model=e1000,rom=[on,off,e1000.bin]Quoted 3 lines
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
Quoted 5 lines
The default behaviour should be not loading option-roms; users should request those.
[1] http://lists.gnu.org/archive/html/qemu-devel/2009-11/msg01095.html
- Sebastian
I am not sure I agree. This is common for PXE and I think makes sense there, but I think this might not make sense for VGA rom or e.g. scsi.
Signature · 1 line
MST
Quoted 9 lines · Sebastian Herbszt
Quoted 8 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
Quoted 7 lines
Quoted 3 lines
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
I think it used to be possible to have two different nic types and only load one rom, e.g. -net nic,model=pcnet -net nic,model=e1000 -option-rom e1000.rom Then use the boot menu to select the e1000 nic.
That's a super hack :-) The fact that works is pure luck.
Quoted 4 lines
Quoted 1 line
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Even if i repeat myself [1] i suggest putting an option-rom loading flag to the -net option:
-net nic,model=e1000,rom=[on,off,e1000.bin]
Well it ought to be a qdev property and it ought to be applicable to every PCI device.
Quoted 3 lines
Quoted 1 line
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
The default behaviour should be not loading option-roms; users should request those.
I disagree. A user should not have to decide whether they want PXE boot or not when they create a VM. The less decisions a user has to make up front the easier qemu is to use.
Regards,
Anthony Liguori
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Sebastian Herbszt
Quoted 11 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
I think it used to be possible to have two different nic types and only load one rom, e.g. -net nic,model=pcnet -net nic,model=e1000 -option-rom e1000.rom Then use the boot menu to select the e1000 nic.
Quoted 1 line
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Even if i repeat myself [1] i suggest putting an option-rom loading flag to the -net option:
-net nic,model=e1000,rom=[on,off,e1000.bin]Quoted 1 line
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
The default behaviour should be not loading option-roms; users should request those.
Quoted 7 lines
Quoted 3 lines
[1] http://lists.gnu.org/archive/html/qemu-devel/2009-11/msg01095.html
- Sebastian
I am not sure I agree. This is common for PXE and I think makes sense there, but I think this might not make sense for VGA rom or e.g. scsi.
I think it makes sense at least for nic and scsi. It might even be useful for vga, e.g. choose between pci/onboard and agp vga and only load one of both roms.
- Sebastian
Quoted 44 lines · Anthony Liguori
Quoted 17 lines · Sebastian Herbszt
Quoted 8 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
Quoted 7 lines
I don't quite understand this.
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
Quoted 5 lines
I think it used to be possible to have two different nic types and only load
one rom, e.g. -net nic,model=pcnet -net nic,model=e1000 -option-rom e1000.rom
Then use the boot menu to select the e1000 nic.That's a super hack :-) The fact that works is pure luck.
Quoted 10 lines
Quoted 6 lines
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Even if i repeat myself [1] i suggest putting an option-rom loading flag to the -net option:
-net nic,model=e1000,rom=[on,off,e1000.bin]Well it ought to be a qdev property and it ought to be applicable to every PCI device.
Quoted 4 lines
Quoted 3 lines
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
Quoted 5 lines
Quoted 2 lines
The default behaviour should be not loading option-roms; users should request those.
I disagree. A user should not have to decide whether they want PXE boot or not when they create a VM.
At some level this is wrong. ROM presence is a hardware feature and you definitely need to select your hardware when you create a VM. For real hardware, cards with PXE are sometimes more expensive than without as they need ROM memory. People do select hardware based on this.
Even when PXE is present in hardware, most BIOS
vendors will let you turn it on/off optionally,
for security if not for other reasons.
What the default should be depends on whether the
majority of our users use PXE. I guess not,
and if I am right default should be off.
Quoted 6 lines
The less decisions a user has to make up
front the easier qemu is to use.Regards,
Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
At some level this is wrong. ROM presence is a hardware feature and you definitely need to select your hardware when you create a VM. For real hardware, cards with PXE are sometimes more expensive than without as they need ROM memory. People do select hardware based on this.
Quoted 8 lines
Even when PXE is present in hardware, most BIOS
vendors will let you turn it on/off optionally,
for security if not for other reasons.What the default should be depends on whether the
majority of our users use PXE. I guess not,
and if I am right default should be off.
The real way to pose this question is, what is the impact to users by keeping this on to those that don't use it vs. the cost of turning it off by default for users that do need it.
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Regards,
Anthony Liguori
Quoted 12 lines · Anthony Liguori
Quoted 11 lines · Sebastian Herbszt
Quoted 10 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Further, we should error out when device is added. Doing this during boot is way too late, management won't be able to understand such errors and won't be able to recover.
I don't quite understand this.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
In 0.11, we never loaded option roms unless a user specified -boot n. If a user specified -boot n and used more than one nic type, I'm fairly certain it would error out during start up because it would run out of option rom space. Maybe it required three types of nics, but the point still remains.
I think it used to be possible to have two different nic types and only load one rom, e.g. -net nic,model=pcnet -net nic,model=e1000 -option-rom e1000.rom Then use the boot menu to select the e1000 nic.
That's a super hack :-) The fact that works is pure luck.
Super hack? Maybe. Pure luck - no. Even if, it's still a regression if that's no longer possible.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
In 0.12, we always load the option rom for a PCI device. An easy solution here would be to just gracefully handle the case where we ran out of option rom space and (silently) stop loading additional roms. With respect to -boot n, it makes the behavior buggy (you cannot boot from the second nic) but my original point is that that is not a regression from 0.11.
Even if i repeat myself [1] i suggest putting an option-rom loading flag to the -net option:
-net nic,model=e1000,rom=[on,off,e1000.bin]Well it ought to be a qdev property and it ought to be applicable to every PCI device.
And ISA too.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
For 0.13, we should probably allow a user to suppress option rom loading for a given PCI device. The limited space is a pretty good justification for that.
The default behaviour should be not loading option-roms; users should request those.
I disagree. A user should not have to decide whether they want PXE boot or not when they create a VM. The less decisions a user has to make up front the easier qemu is to use.
If i want PXE boot on my computer, i have to enter the BIOS and enable it. If qemu starts to automagically enable stuff people might want to use, some people will end up with long command lines just to disable it again.
- Sebastian
Quoted 19 lines · Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
At some level this is wrong. ROM presence is a hardware feature and you definitely need to select your hardware when you create a VM. For real hardware, cards with PXE are sometimes more expensive than without as they need ROM memory. People do select hardware based on this.
Quoted 8 lines
Even when PXE is present in hardware, most BIOS
vendors will let you turn it on/off optionally,
for security if not for other reasons.What the default should be depends on whether the
majority of our users use PXE. I guess not,
and if I am right default should be off.The real way to pose this question is, what is the impact to users by keeping this on to those that don't use it vs. the cost of turning it off by default for users that do need it.
Quoted 7 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Regards,
Anthony Liguori
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Signature · 1 line
MST
Quoted 3 lines · Michael S. Tsirkin
Quoted 3 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 2 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
-boot order=[something with 'n' here]
or via
-boot menu=on + F12 + picking menu entry
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
cheers,
Gerd
Quoted 17 lines · Gerd Hoffmann
Quoted 3 lines · Michael S. Tsirkin
Quoted 3 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 2 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
-boot order=[something with 'n' here]
or via
Quoted 7 lines
-boot menu=on + F12 + picking menu entry
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
cheers,
Gerd
I guess so. But then, why are we loading it in BIOS and wasting memory? Let's only shadow the ROM when PXE is selected?
Signature · 1 line
MST
Quoted 23 lines · Michael S. Tsirkin
Quoted 22 lines · Gerd Hoffmann
Quoted 3 lines · Michael S. Tsirkin
Quoted 3 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 2 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
-boot order=[something with 'n' here]
or via
-boot menu=on + F12 + picking menu entry
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
Quoted 6 lines
Quoted 2 lines
cheers,
GerdI guess so. But then, why are we loading it in BIOS and wasting memory? Let's only shadow the ROM when PXE is selected?
Or, we could have a very small ROM, that loads
more actual code from card or from qemu directly
when it is run.
Quoted 3 lines
Signature · 2 lines
-- MST
Quoted 12 lines · Gerd Hoffmann
Quoted 3 lines · Michael S. Tsirkin
Quoted 3 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 2 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
Quoted 7 lines
-boot order=[something with 'n' here]
or via
-boot menu=on + F12 + picking menu entry
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
Tho this depends on the option rom, e.g. Etherboot hooks INT 19h.
- Sebastian
Quoted 24 lines · Michael S. Tsirkin
Quoted 22 lines · Gerd Hoffmann
Quoted 4 lines · Michael S. Tsirkin
Quoted 4 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 3 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
-boot order=[something with 'n' here]
or via
-boot menu=on + F12 + picking menu entry
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
Quoted 8 lines
Quoted 3 lines
cheers,
GerdI guess so. But then, why are we loading it in BIOS and wasting memory? Let's only shadow the ROM when PXE is selected?
Because it can be selected by the user via the menu and because it can be selected at runtime via the boot_set monitor command.
Also, the comment about "wasting memory" not quite accurate. The memory region in question is only used for roms. If we didn't put roms there, it would go to waste.
Currently, the only roms we load are pxe roms or things specified by -option-rom. You could certainly argue that making -option-rom higher priority than implicit pxe roms is valuable but removing the pxe roms really serves no purpose.
Regards,
Anthony Liguori
Quoted 4 lines · Michael S. Tsirkin
Or, we could have a very small ROM, that loads
more actual code from card or from qemu directly
when it is run.
It's not as simple as it sounds but it's possible, in theory at least.
But I think the question really is, what problem are we trying to solve?
Regards,
Anthony Liguori
Quoted 19 lines · Michael S. Tsirkin
Quoted 18 lines · Gerd Hoffmann
Quoted 3 lines · Michael S. Tsirkin
Quoted 3 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 2 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
-boot order=[something with 'n' here]
or via
-boot menu=on + F12 + picking menu entry
Quoted 8 lines
Quoted 4 lines
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
cheers,
GerdI guess so. But then, why are we loading it in BIOS and wasting memory? Let's only shadow the ROM when PXE is selected?
Some DOS-based software might need the UMA (RAM UMB).
- Sebastian
Quoted 31 lines · Anthony Liguori
Quoted 30 lines · Michael S. Tsirkin
Quoted 27 lines · Gerd Hoffmann
Quoted 4 lines · Michael S. Tsirkin
Quoted 4 lines
So far, it's not clear to me that anyone has demonstrated how this is harmful for people that don't want pxe booting. Assuming we fix the bug about rom loading, then there's really no impact to users.
Fix (v2) is on the list already.
Quoted 3 lines
PXE booting might have security impact. You do not want to do this if you are on a hostile network.
Option rom loaded doesn't imply pxe boot will be tried. It only means PXE boot can be selected, either via
-boot order=[something with 'n' here]
or via
-boot menu=on + F12 + picking menu entry
By default qemu doesn't try to PXE-boot, even if no other bootable device is available.
cheers,
Gerd
Quoted 7 lines
Quoted 4 lines
I guess so. But then, why are we loading it in BIOS and wasting memory? Let's only shadow the ROM when PXE is selected?
Because it can be selected by the user via the menu and because it can be selected at runtime via the
boot_setmonitor command.
Yes, but it's not like we have nowhere to store them. We could shadow ROM when it is actually needed.
Quoted 3 lines
Also, the comment about "wasting memory" not quite accurate. The memory region in question is only used for roms. If we didn't put roms there, it would go to waste.
Some BIOSes I saw have an option not to use the first 1M for rom shadowing :). Seriously as you see we are already running out of that 1M.
Quoted 8 lines
Currently, the only roms we load are pxe roms or things specified by -option-rom. You could certainly argue that making -option-rom higher priority than implicit pxe roms is valuable but removing the pxe roms really serves no purpose.
Regards,
Anthony Liguori
I am concerned about management. User selects "PXE support" when creating VM, and creationg succeeds, but in fact PXE can not work because we can not shadow the ROM.
Sounds bad. If device creation failed,
user would get feedback when it is expected.
Signature · 1 line
MST
Quoted 9 lines · Anthony Liguori
Quoted 4 lines · Michael S. Tsirkin
Or, we could have a very small ROM, that loads
more actual code from card or from qemu directly
when it is run.It's not as simple as it sounds but it's possible, in theory at least.
But I think the question really is, what problem are we trying to solve?
Support 256 devices on PCI bus seamlessly.
Quoted 3 lines
Regards,
Anthony Liguori
Quoted 1 line · Sebastian Herbszt
Some DOS-based software might need the UMA (RAM UMB).
I don't think that's the workload to optimize for in terms of the default settings. Certainly, it's important to allow such workloads to disable all unnecessary rom loading but I don't think it's justification for default settings.
Quoted 2 lines
- Sebastian
Regards,
Anthony Liguori
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Anthony Liguori
Because it can be selected by the user via the menu and because it can be selected at runtime via the
boot_setmonitor command.Yes, but it's not like we have nowhere to store them. We could shadow ROM when it is actually needed.
I believe the way this works with real BIOSes is that the rom is initially loaded somewhere outside of the 1M region and it's init is executed. It's then the rom's job to execute it's initialization. Afterwards, the bios copies the rom into the 1M region. This is how PMM works.
The idea is that while outside of the 1M region, the rom can eliminate unnecessary code and update it's own header to reflect it's new, improved code size.
I don't know whether gpxe will actually reduce it's size as part of this process so it may not matter. After running the option roms init vector, the rom must be relocated into the option rom space though so even this technique is not a solution unless gpxe is able to discard a lot of bits it doesn't need.
Quoted 7 lines
Quoted 2 lines
Also, the comment about "wasting memory" not quite accurate. The memory region in question is only used for roms. If we didn't put roms there, it would go to waste.
Some BIOSes I saw have an option not to use the first 1M for rom shadowing :). Seriously as you see we are already running out of that 1M.
I think that's just the first phase of rom loading.
Quoted 9 lines
Quoted 8 lines
Currently, the only roms we load are pxe roms or things specified by -option-rom. You could certainly argue that making -option-rom higher
priority than implicit pxe roms is valuable but removing the pxe roms really serves no purpose.Regards,
Anthony Liguori
Quoted 7 lines
I am concerned about management. User selects "PXE support" when creating VM, and creationg succeeds, but in fact PXE can not work because we can not shadow the ROM.
Sounds bad. If device creation failed,
user would get feedback when it is expected.
It's unfortunately much more complicated than this :-/
Ignore the case of one nic, that should Just Work today.
If you have two nics, even if we are able to load both roms, we have no way of communicating to the bios that we want to use one BEV device vs. another. That means if you have two nics that are both capable of pxe booting, '-boot n' really cannot be used to determine which one actually gets to pxe boot.
We'll have the same problem with BCV based extboot. We really need to improve -boot to support things other than the concept of "first disk" and "first nic".
That's why I'm a fan of the intermediate solution of just stopping loading roms when we run out of room. It's just as well defined behavior as we have even if we could load more roms.
Regards,
Anthony Liguori
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Anthony Liguori
Because it can be selected by the user via the menu and because it can be selected at runtime via the
boot_setmonitor command.
Quoted 7 lines
Quoted 3 lines
Yes, but it's not like we have nowhere to store them. We could shadow ROM when it is actually needed.
I believe the way this works with real BIOSes is that the rom is initially loaded somewhere outside of the 1M region and it's init is executed. It's then the rom's job to execute it's initialization. Afterwards, the bios copies the rom into the 1M region. This is how PMM works.
The idea is that while outside of the 1M region, the rom can eliminate unnecessary code and update it's own header to reflect it's new, improved code size.
It's more like the following (pci 2.2):
- enable and map expansion rom bar
- find rom and copy to ram (0xC000-0xDFFFF)
- disable expansion rom bar
- call rom init
- rom might resize itself (DDIM)
- write protect rom
PMM doesn't have (anything?) to do with this and the rom doesn't have to be loaded outside of 1MB.
Quoted 1 line
I don't know whether gpxe will actually reduce it's size as part of this process so it may not matter. After running the option roms init vector, the rom must be relocated into the option rom space though so even this technique is not a solution unless gpxe is able to discard a lot of bits it doesn't need.
gPXE supports DDIM.
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
Also, the comment about "wasting memory" not quite accurate. The memory region in question is only used for roms. If we didn't put roms there, it would go to waste.
Some BIOSes I saw have an option not to use the first 1M for rom shadowing :). Seriously as you see we are already running out of that 1M.
I think that's just the first phase of rom loading.
- Sebastian
Quoted 23 lines · Sebastian Herbszt
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Anthony Liguori
Because it can be selected by the user via the menu and because it can be selected at runtime via the
boot_setmonitor command.Quoted 7 lines
Quoted 3 lines
Yes, but it's not like we have nowhere to store them. We could shadow ROM when it is actually needed.
I believe the way this works with real BIOSes is that the rom is initially loaded somewhere outside of the 1M region and it's init is executed. It's then the rom's job to execute it's initialization. Afterwards, the bios copies the rom into the 1M region. This is how PMM works.
The idea is that while outside of the 1M region, the rom can eliminate unnecessary code and update it's own header to reflect it's new, improved code size.
It's more like the following (pci 2.2):
- enable and map expansion rom bar
- find rom and copy to ram (0xC000-0xDFFFF)
- disable expansion rom bar
- call rom init
- rom might resize itself (DDIM)
- write protect rom
Quoted 2 lines
PMM doesn't have (anything?) to do with this and the rom doesn't have to be loaded outside of 1MB.
Well PMM is used to do the resizing.
But it sounds like the problem is that we should not be loading the roms into the rom space. Instead, seabios should be mapping them into that space, running the rom init, then moving to the next one.
I suspect we need to either need to implement the proper pci interface for seabios to do this or we need to provide a pv channel.
Regards,
Anthony Liguori
Quoted 24 lines · Anthony Liguori
Quoted 23 lines · Sebastian Herbszt
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Anthony Liguori
Because it can be selected by the user via the menu and because it can be selected at runtime via the
boot_setmonitor command.Quoted 7 lines
Quoted 3 lines
Yes, but it's not like we have nowhere to store them. We could shadow ROM when it is actually needed.
I believe the way this works with real BIOSes is that the rom is initially loaded somewhere outside of the 1M region and it's init is executed. It's then the rom's job to execute it's initialization. Afterwards, the bios copies the rom into the 1M region. This is how PMM works.
The idea is that while outside of the 1M region, the rom can eliminate unnecessary code and update it's own header to reflect it's new, improved code size.
It's more like the following (pci 2.2):
- enable and map expansion rom bar
- find rom and copy to ram (0xC000-0xDFFFF)
- disable expansion rom bar
- call rom init
- rom might resize itself (DDIM)
- write protect rom
Quoted 4 lines
Quoted 2 lines
PMM doesn't have (anything?) to do with this and the rom doesn't have to be loaded outside of 1MB.
Well PMM is used to do the resizing.
You can shrink in-place with rom layout like [header, run-time code, init code]. The init code can then just be "truncated". You only need PMM if you can't manage with the allocated memory.
Quoted 3 lines
But it sounds like the problem is that we should not be loading the roms into the rom space. Instead, seabios should be mapping them into that space, running the rom init, then moving to the next one.
I suspect we need to either need to implement the proper pci interface for seabios to do this or we need to provide a pv channel.
I suggested a proper pci interface before [1]; please no pv channel.
[1] http://lists.gnu.org/archive/html/qemu-devel/2009-11/msg01823.html
- Sebastian
Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Michael S. TsirkinQuoted 9 lines · Michael S. Tsirkin
Quoted 7 lines · Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
Or, we could have a very small ROM, that loads
more actual code from card or from qemu directly
when it is run.
Quoted 6 lines
Quoted 4 lines
It's not as simple as it sounds but it's possible, in theory at least.
But I think the question really is, what problem are we trying to solve?
Support 256 devices on PCI bus seamlessly
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Regards,
Anthony Liguori
From 1cbe4d2379c09e4402e3a3c320128d5a80dff5a8 Mon Sep 17 00:00:00 2001
From: Anthony Liguori <[email protected]>
Date: Mon, 14 Dec 2009 20:28:38 -0600
Subject: [PATCH 1/2] Do not guard qemu shadow ram work around in CONFIG_OPTIONROMS_DEPLOYED
As we are going to disable CONFIG_OPTIONROMS_DEPLOYED under QEMU so that we can make proper use of DDIM.
--- src/shadow.c | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-)
src/shadow.c +8 -12
@@ -29,18 +29,14 @@ __make_bios_writable(u16 bdf)int clear =0 ;int i;for (i=0 ; i<6 ; i++) { -if (CONFIG_OPTIONROMS_DEPLOYED ) { -int reg =pci_config_readb (bdf,0x5a + i); -if ((reg &0x11 ) !=0x11 ) { -// Need to copy optionroms to work around qemu implementation -void *mem = (void *)(BUILD_ROM_START + i *32 *1024 ); -memcpy ((void *)BUILD_BIOS_TMP_ADDR , mem,32 *1024 ); -pci_config_writeb (bdf,0x5a + i,0x33 ); -memcpy (mem, (void *)BUILD_BIOS_TMP_ADDR ,32 *1024 ); - clear =1 ; - }else { -pci_config_writeb (bdf,0x5a + i,0x33 ); - } +int reg =pci_config_readb (bdf,0x5a + i); +if ((reg &0x11 ) !=0x11 ) { +// Need to copy optionroms to work around qemu implementation +void *mem = (void *)(BUILD_ROM_START + i *32 *1024 ); +memcpy ((void *)BUILD_BIOS_TMP_ADDR , mem,32 *1024 ); +pci_config_writeb (bdf,0x5a + i,0x33 ); +memcpy (mem, (void *)BUILD_BIOS_TMP_ADDR ,32 *1024 ); + clear =1 ; }else {pci_config_writeb (bdf,0x5a + i,0x33 ); }
Signature · 1 line
1.6.2.5
From be457d121f4375e90d6396f28f4e72efdfb714ae Mon Sep 17 00:00:00 2001
From: Anthony Liguori <[email protected]>
Date: Mon, 14 Dec 2009 20:26:19 -0600
Subject: [PATCH 1/1] Support PCI based option rom loading
Currently, we preload option roms into the option rom space in memory. This prevents DDIM from functioning correctly which severely limits the number of roms we can support.
This patch introduces a pci_add_option_rom() which registers the PCI_ROM_ADDRESS bar which points to our option rom. It also converts over the cirrus vga adapter, the rtl8139, virtio, and the e1000 to use this new mechanism.
The result is that PXE boot functions even with three unique types of cards.
--- hw/cirrus_vga.c | 2 +- hw/e1000.c | 2 +- hw/pci.c | 35 +++++++++++++++++++++++++++++++++++ hw/pci.h | 5 +++++ hw/rtl8139.c | 2 +- hw/virtio-pci.c | 2 +- 6 files changed, 44 insertions(+), 4 deletions(-)
hw/cirrus_vga.c +1 -1
@@ -3211,7 +3211,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) }/* ROM BIOS */ -rom_add_vga (VGABIOS_CIRRUS_FILENAME ); +pci_add_option_rom ((PCIDevice *)d,VGABIOS_CIRRUS_FILENAME );return 0 ; }
hw/e1000.c +1 -1
@@ -1125,7 +1125,7 @@ static int pci_e1000_init(PCIDevice *pci_dev)if (!pci_dev->qdev.hotplugged) {static int loaded =0 ;if (!loaded) { -rom_add_option ("pxe-e1000.bin" ); +pci_add_option_rom (&d->dev,"pxe-e1000.bin" ); loaded =1 ; } }
hw/pci.c +35 -0
@@ -26,6 +26,7 @@#include "monitor.h" #include "net.h" #include "sysemu.h" +#include "loader.h" //#define DEBUG_PCI #ifdef DEBUG_PCI
@@ -1438,6 +1439,40 @@ static uint8_t pci_find_capability_list(PCIDevice *pdev, uint8_t cap_id,return next; } +static void pci_map_option_rom (PCIDevice *pdev,int region_num,pcibus_t addr,pcibus_t size,int type) +{ +cpu_register_physical_memory (addr, size, pdev->rom_offset); +} + +/* Add an option rom for the device */ +int pci_add_option_rom (PCIDevice *pdev,const char *name) +{ +int size; +char *path; +void *ptr; + + path =qemu_find_file (QEMU_FILE_TYPE_BIOS , name); +if (path ==NULL ) { + path =qemu_strdup (name); + } + + size =get_image_size (path); +if (size & (size -1 )) { + size =1 <<qemu_fls (size); + } + + pdev->rom_offset =qemu_ram_alloc (size); + + ptr =qemu_get_ram_ptr (pdev->rom_offset); +load_image (path, ptr); +qemu_free (path); + +pci_register_bar (pdev,PCI_ROM_SLOT , size, +0 , pci_map_option_rom); + +return 0 ; +} +/* Reserve space and add capability to the linked list in pci config space */ int pci_add_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) {
hw/pci.h +5 -0
@@ -242,6 +242,9 @@ struct PCIDevice {uint32_t msix_bar_size;/* Version id needed for VMState */ int32_t version_id; + +/* Location of option rom */ +ram_addr_t rom_offset; }; PCIDevice *pci_register_device(PCIBus *bus, const char *name,
@@ -253,6 +256,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, pcibus_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_option_rom (PCIDevice *pdev,const char *name); +int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);
hw/rtl8139.c +1 -1
@@ -3357,7 +3357,7 @@ static int pci_rtl8139_init(PCIDevice *dev)if (!dev->qdev.hotplugged) {static int loaded =0 ;if (!loaded) { -rom_add_option ("pxe-rtl8139.bin" ); +pci_add_option_rom (&s->dev,"pxe-rtl8139.bin" ); loaded =1 ; } }
hw/virtio-pci.c +1 -1
@@ -522,7 +522,7 @@ static int virtio_net_init_pci(PCIDevice *pci_dev)if (!pci_dev->qdev.hotplugged) {static int loaded =0 ;if (!loaded) { -rom_add_option ("pxe-virtio.bin" ); +pci_add_option_rom (pci_dev,"pxe-virtio.bin" ); loaded =1 ; } }
Signature · 1 line
1.6.2.5
From 560bd3553b961a4613d298ad276d859be38be0f3 Mon Sep 17 00:00:00 2001
From: Anthony Liguori <[email protected]>
Date: Mon, 14 Dec 2009 20:29:41 -0600
Subject: [PATCH 2/2] Disable CONFIG_OPTIONROMS_DEPLOYED by default
Since qemu now supports loading option roms through PCI
--- src/config.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
src/config.h +1 -1
@@ -83,7 +83,7 @@// Support finding and running option roms during post. #define CONFIG_OPTIONROMS 1// Set if option roms are already copied to 0xc0000-0xf0000 -#define CONFIG_OPTIONROMS_DEPLOYED 1 +#define CONFIG_OPTIONROMS_DEPLOYED 0// When option roms are not pre-deployed, SeaBIOS can copy an optionrom // from flash for up to 2 devices. #define OPTIONROM_VENDEV_1 0x00000000
Signature · 1 line
1.6.2.5
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 2 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
Yes - I think this is the best way to fix this. Space optimizations can be most easily done by allowing SeaBIOS to copy the option roms into the area between 0xc0000-0xf0000. This is also what a real BIOS would do, and it's what SeaBIOS does when it is run on real hardware.
-Kevin
Quoted 5 lines · Anthony Liguori
I believe the way this works with real BIOSes is that the rom is initially loaded somewhere outside of the 1M region and it's init is executed. It's then the rom's job to execute it's initialization. Afterwards, the bios copies the rom into the 1M region. This is how PMM works.
The option rom load is generally a little different. The BIOS enables the PCI rom bar, verifies the rom, copies the rom to the 0xa0000-0xf0000 region, unmaps the PCI rom bar, and then jumps to the rom it just copied. The rom may reduce its reported rom size to effectively shrink its memory footprint. As you noted in another post, gPXE does this today by relocating itself into PMM allocated memory.
The PCIv3 spec does define a feature where the bios can copy the rom to some random area of memory and execute it - the rom is then responsible for copying itself into the 0xa0000-0xf0000 region. However, this support is optional for the BIOS to implement; SeaBIOS doesn't implement it.
Having SeaBIOS copy the roms from PCI space enables a number of space optimizations. First, if SeaBIOS copies the roms, it can pack them so that rom shrinking actually works. As it is now, a rom can shrink itself, but because SeaBIOS doesn't deploy the roms, the saved space isn't utilized for other roms. Second, SeaBIOS right now is about 75K in size, but to satisfy qemu it fills itself to an even 128K. When SeaBIOS copies roms, it knows it can use the unused parts of the e-segment (another 50K).
One idea I've been thinking about is to have SeaBIOS hoist it's 32bit code into high-memory (much like what gPXE does). This would make the remaining parts of the e-segment available for roms. It would also free up another 30K of the f-segment for roms (the PCIv3 spec permits roms to be located in the f-segment). However, implementing this doesn't seem like a high priority as most roms seem to fit okay today (when rom shrinking works).
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 2 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
I'm not sure why "Do not guard qemu shadow ram work around in CONFIG_OPTIONROMS_DEPLOYED" patch is needed. The code today is:
if (CONFIG_OPTIONROMS_DEPLOYED) {
int reg = pci_config_readb(bdf, 0x5a + i);
if ((reg & 0x11) != 0x11) {
// Need to copy optionroms to work around qemu implementation
void *mem = (void*)(BUILD_ROM_START + i * 32*1024);
memcpy((void*)BUILD_BIOS_TMP_ADDR, mem, 32*1024);
pci_config_writeb(bdf, 0x5a + i, 0x33);
memcpy(mem, (void*)BUILD_BIOS_TMP_ADDR, 32*1024);
clear = 1;
} else {
pci_config_writeb(bdf, 0x5a + i, 0x33);
}
} else {
pci_config_writeb(bdf, 0x5a + i, 0x33);
}So, in the non CONFIG_OPTIONROMS_DEPLOYED case, SeaBIOS will just do the write enable call (pci_config_writeb(bdf, 0x5a + i, 0x33)). The CONFIG_OPTIONROMS_DEPLOYED case should just be to copy the roms qemu has deployed. If SeaBIOS is filling in the 0xc0000-0xf0000 space, it shouldn't matter if the contents of that space is lost during the write enable.
Let me know if I've missed something.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 13 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
Quoted 3 lines
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Is this needed in the first place? Integration into pci like your patch does looks sensible to me. That wouldn't get us re-loading on reset, but as the guest shouldn't be able to modify the roms I don't think we need this ...
We could also add a "romfile" property to the pci bus and do everything (except setting the default filename) in generic pci code.
I'm more worried about the CONFIG_OPTIONROMS_DEPLOYED patches for seabios, although I don't fully understand what they are doing. There are non-pci option roms (linuxboot, multiboot, extboot) which qemu will continue to deploy the way roms are deployed today.
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Hi,
Quoted 2 lines
We could also add a "romfile" property to the pci bus and do everything (except setting the default filename) in generic pci code.
Patch attached (incremental to yours).
Quoted 4 lines
I'm more worried about the
CONFIG_OPTIONROMS_DEPLOYEDpatches for seabios, although I don't fully understand what they are doing. There are non-pci option roms (linuxboot, multiboot, extboot) which qemu will continue to deploy the way roms are deployed today.
-kernel didn't work on a quick test.
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 38 lines · Anthony Liguori
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Michael S. Tsirkin
Or, we could have a very small ROM, that loads
more actual code from card or from qemu directly
when it is run.Quoted 6 lines
Quoted 4 lines
It's not as simple as it sounds but it's possible, in theory at least.
But I think the question really is, what problem are we trying to solve?
Support 256 devices on PCI bus seamlessly
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Regards,
Anthony Liguori
From a quick overview, I see register memory but no unregister?
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Kevin O'ConnorQuoted 24 lines · Kevin O'Connor
Quoted 2 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
I'm not sure why "Do not guard qemu shadow ram work around in
CONFIG_OPTIONROMS_DEPLOYED" patch is needed. The code today is:if (CONFIG_OPTIONROMS_DEPLOYED) { int reg = pci_config_readb(bdf, 0x5a + i); if ((reg & 0x11) != 0x11) { // Need to copy optionroms to work around qemu implementation void *mem = (void*)(BUILD_ROM_START + i * 32*1024); memcpy((void*)BUILD_BIOS_TMP_ADDR, mem, 32*1024); pci_config_writeb(bdf, 0x5a + i, 0x33); memcpy(mem, (void*)BUILD_BIOS_TMP_ADDR, 32*1024); clear = 1; } else { pci_config_writeb(bdf, 0x5a + i, 0x33); } } else { pci_config_writeb(bdf, 0x5a + i, 0x33); }
Quoted 7 lines
So, in the non
CONFIG_OPTIONROMS_DEPLOYEDcase, SeaBIOS will just do the write enable call (pci_config_writeb(bdf, 0x5a + i, 0x33)). TheCONFIG_OPTIONROMS_DEPLOYEDcase should just be to copy the roms qemu has deployed. If SeaBIOS is filling in the 0xc0000-0xf0000 space, it shouldn't matter if the contents of that space is lost during the write enable.
The bios gets mapped in 0xe0000 .. 0x100000 so if SeaBIOS fills the 0xc0000-0xf0000 space it will write over half of the bios.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gerd HoffmannQuoted 18 lines · Gerd Hoffmann
Quoted 13 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
Quoted 3 lines
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Quoted 5 lines
Is this needed in the first place? Integration into pci like your patch does looks sensible to me. That wouldn't get us re-loading on reset, but as the guest shouldn't be able to modify the roms I don't think we need this ...
We could also add a "romfile" property to the pci bus and do everything (except setting the default filename) in generic pci code.
I'm more worried about the
CONFIG_OPTIONROMS_DEPLOYEDpatches for seabios, although I don't fully understand what they are doing. There are non-pci option roms (linuxboot, multiboot, extboot) which qemu will continue to deploy the way roms are deployed today.
That's a good point. Need to think about how to best handle that. SeaBIOS supports up to two static option roms so maybe what we need to do is make use of that mechanism for things like linuxboot/extboot.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 2 lines · Anthony Liguori
The bios gets mapped in
0xe0000..0x100000so if SeaBIOS fills the 0xc0000-0xf0000 space it will write over half of the bios.
I'm a little confused by this. SeaBIOS seems to assume that it only has to deal with the 0xf0000 .. 0x100000 space as the bios which is certainly true (i don't think there's anything special about the 0xe0000 .. 0xf0000 region).
I'm not sure why we load the 128K worth of bios instead of just loading 64K.
Regards,
Anthony Liguori
Quoted 3 lines
Regards,
Anthony Liguori
Re: [SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Anthony Liguori
The bios gets mapped in
0xe0000..0x100000so if SeaBIOS fills the 0xc0000-0xf0000 space it will write over half of the bios.I'm a little confused by this. SeaBIOS seems to assume that it only has to deal with the
0xf0000..0x100000space as the bios which is certainly true (i don't think there's anything special about the0xe0000..0xf0000region).I'm not sure why we load the 128K worth of bios instead of just loading 64K.
bochs bios required all 128kB, so this is probably a leftover.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 11 lines · Avi Kivity
Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Anthony Liguori
The bios gets mapped in
0xe0000..0x100000so if SeaBIOS fills the 0xc0000-0xf0000 space it will write over half of the bios.I'm a little confused by this. SeaBIOS seems to assume that it only has to deal with the
0xf0000..0x100000space as the bios which is certainly true (i don't think there's anything special about the0xe0000..0xf0000region).I'm not sure why we load the 128K worth of bios instead of just loading 64K.
bochs bios required all 128kB, so this is probably a leftover.
This is apparently well defined in the PIIX spec. There is a bit of a difference between the lower half and upper half of the BIOS region though and I expect this is part of what the problem is. FYI, the following patch works. Surprisingly, we only need to restore the 0xe8000..0xe8fff region. Still trying to understand what's happening.
src/shadow.c +2 -1
@@ -29,7 +29,8 @@ __make_bios_writable(u16 bdf)int clear =0 ;int i;for (i=0 ; i<6 ; i++) { -if (CONFIG_OPTIONROMS_DEPLOYED ) { +/* need to copy 0xe8000 bios region for qemu */ +if (i==5 ) {int reg =pci_config_readb (bdf,0x5a + i);if ((reg &0x11 ) !=0x11 ) {// Need to copy optionroms to work around qemu
implementation
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Michael S. TsirkinQuoted 2 lines · Michael S. Tsirkin
From a quick overview, I see register memory but no unregister?
There's no cpu_unregister_physical_memory() in qemu. Devices can unregister an io memory type but this is not io memory, this is ram.
We should qemu_ram_free() though.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 7 lines · Anthony Liguori
Quoted 2 lines · Michael S. Tsirkin
From a quick overview, I see register memory but no unregister?
There's no
cpu_unregister_physical_memory()in qemu. Devices can unregister an io memory type but this is not io memory, this is ram.We should
qemu_ram_free()though.
Except it's a nop :-)
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gerd HoffmannQuoted 6 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
We could also add a "romfile" property to the pci bus and do everything (except setting the default filename) in generic pci code.
Patch attached (incremental to yours).
Sounds great, but no patch is attached.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gerd HoffmannQuoted 14 lines · Gerd Hoffmann
Quoted 13 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
Quoted 5 lines
Quoted 3 lines
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Is this needed in the first place?
Only if we care about 'info roms' working. Problem is roms is very centric now to roms at a static guest physical location. In this case, the rom lives in hardware and is mapped into physical memory based on what the guest does.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gerd HoffmannQuoted 1 line · Gerd Hoffmann
-kernel didn't work on a quick test.
Thinking about how to fix this, we have two options. The first would be to use the support in SeaBIOS for static roms but that would limit us to two user supplied option roms (including kernel/multiboot/extboot). We could extend this to more than two roms but I think that's generally ugly.
Alternatively, we could introduce a special rom-only PCI device. Besides getting support for a much greater number of option roms, it also gives us a much nicer way to integrate multiboot/linux boot support via qdev (instead of the ugly machine hack we have now).
We could make them multifunction devices so that we don't unnecessarily burn PCI slots to support roms.
Regards,
Anthony Liguori
Quoted 2 lines
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 4 lines · Anthony Liguori
Quoted 1 line · Gerd Hoffmann
-kernel didn't work on a quick test.
Thinking about how to fix this, we have two options.
Hmm, can you pls explain why it stops working?
Quoted 11 lines
The first would be
to use the support in SeaBIOS for static roms but that would limit us to two user supplied option roms (includingkernel/multiboot/extboot). We could extend this to more than two roms but I think that's generally ugly.Alternatively, we could introduce a special rom-only PCI device. Besides getting support for a much greater number of option roms, it also gives us a much nicer way to integrate multiboot/linux boot support via qdev (instead of the ugly machine hack we have now).
Quoted 8 lines
We could make them multifunction devices so that we don't unnecessarily burn PCI slots to support roms.
Regards,
Anthony Liguori
Quoted 2 lines
cheers,
Gerd
Will be a problem for non-PCI systems?
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 21 lines · Anthony Liguori
Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
Quoted 5 lines
Quoted 3 lines
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Is this needed in the first place?
Quoted 8 lines
Only if we care about 'info roms' working. Problem is roms is very centric now to roms at a static guest physical location. In this case, the rom lives in hardware and is mapped into physical memory based on what the guest does.
Regards,
Anthony Liguori
I also think it is very important to have roms sent during migration, otherwise things break if we migrate in the middle of accessing roms.
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 4 lines · Anthony Liguori
Quoted 1 line · Gerd Hoffmann
I'm more worried about the
CONFIG_OPTIONROMS_DEPLOYEDpatches for seabios, although I don't fully understand what they are doing. There are non-pci option roms (linuxboot, multiboot, extboot) which qemu will continue to deploy the way roms are deployed today.That's a good point. Need to think about how to best handle that. SeaBIOS supports up to two static option roms so maybe what we need to do is make use of that mechanism for things like linuxboot/extboot.
Keep loading custom roms (e.g. from -option-rom) with rom_add_file starting at 0xc8000. Modify SeaBIOS to scan the memory range for pre-deployed option roms before deploying PCI roms. SeaBIOS will find the last pre-deployed rom and have a starting address for deploying PCI roms. This will keep ISA option roms working.
- Sebastian
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 10 lines · Sebastian Herbszt
Quoted 4 lines · Anthony Liguori
Quoted 1 line · Gerd Hoffmann
I'm more worried about the
CONFIG_OPTIONROMS_DEPLOYEDpatches for seabios, although I don't fully understand what they are doing. There are non-pci option roms (linuxboot, multiboot, extboot) which qemu will continue to deploy the way roms are deployed today.That's a good point. Need to think about how to best handle that. SeaBIOS supports up to two static option roms so maybe what we need to do is make use of that mechanism for things like linuxboot/extboot.
Keep loading custom roms (e.g. from -option-rom) with
rom_add_filestarting at0xc8000. Modify SeaBIOS to scan the memory range for pre-deployed option roms before deploying PCI roms. SeaBIOS will find the last pre-deployed rom and have a starting address for deploying PCI roms. This will keep ISA option roms working.
If we make -option-rom appear through a PCI device, then DDIM will work properly for those roms. Also, it would be nice if Linux boot used a PCI device instead of fw_cfg to load the kernel into memory.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Sebastian Herbszt
Quoted 3 lines · Anthony Liguori
Quoted 1 line · Gerd Hoffmann
I'm more worried about the
CONFIG_OPTIONROMS_DEPLOYEDpatches for seabios, although I don't fully understand what they are doing. There are non-pci option roms (linuxboot, multiboot, extboot) which qemu will continue to deploy the way roms are deployed today.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
That's a good point. Need to think about how to best handle that. SeaBIOS supports up to two static option roms so maybe what we need to do is make use of that mechanism for things like linuxboot/extboot.
Keep loading custom roms (e.g. from -option-rom) with
rom_add_filestarting at0xc8000. Modify SeaBIOS to scan the memory range for pre-deployed option roms before deploying PCI roms. SeaBIOS will find the last pre-deployed rom and have a starting address for deploying PCI roms. This will keep ISA option roms working.If we make -option-rom appear through a PCI device, then DDIM will work properly for those roms. Also, it would be nice if Linux boot used a PCI device instead of
fw_cfgto load the kernel into memory.
What about isapc? Or (pci)pc with isa card? Keeping the possibility of having option roms pre-deployed also allows using Bochs BIOS until SeaBIOS has no more regressions.
- Sebastian
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Michael S. TsirkinQuoted 11 lines · Michael S. Tsirkin
Quoted 6 lines · Anthony Liguori
Quoted 2 lines · Gerd Hoffmann
-kernel didn't work on a quick test.
Thinking about how to fix this, we have two options.
Hmm, can you pls explain why it stops working?
Sure. SeaBIOS loads roms in a few ways.
If CONFIG_OPTIONROMS_DEPLOYED, then SeaBIOS scans the 0xc0000..0xf0000 region for anything that looks like a rom. This is how Bochs did it and is what qemu supports. This is not how modern systems work though.
Modern systems (SeaBIOS with !CONFIG_OPTIONROMS_DEPLOYED), walk the PCI bus and look for any device with a PCI_ROM_ADDRESS that maps a valid option rom. It will map the rom in PCI memory and run it's init function. The rom can use PMM to allocate temporary memory to reorganize itself. During this time, the rom area is writable. The rom will create a stub that's usually pretty small that gets loaded by the BIOS after init into the 0xc0000..0xf0000 region.
So when !CONFIG_OPTIONROMS_DEPLOYED, SeaBIOS does look in this region for roms because it maps them all from the actual PCI devices.
SeaBIOS can also load roms from up to two fixed physical addresses (when !CONFIG_OPTIONROMS_DEPLOYED) or from a CBFS payload.
BTW, I'm pretty sure this style of option rom loading (from a PCI device) is going to be required for device passthrough if we want to support running those roms in the guests. In fact, it should Just Work with my patches !CONFIG_OPTIONROMS_DEPLOYED in SeaBIOS.
Quoted 10 lines
Quoted 7 lines
Regards,
Anthony Liguori
Quoted 3 lines
cheers,
GerdWill be a problem for non-PCI systems?
You mean, non-PCI x86 systems? I think -m isapc is mainly used for dos guests. I don't think it's really useful in combination with -kernel and certainly not for extboot.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Michael S. TsirkinQuoted 29 lines · Michael S. Tsirkin
Quoted 27 lines · Anthony Liguori
Quoted 15 lines · Gerd Hoffmann
Quoted 13 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
Quoted 6 lines
Quoted 4 lines
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Is this needed in the first place?
Only if we care about 'info roms' working. Problem is roms is very centric now to roms at a static guest physical location. In this case, the rom lives in hardware and is mapped into physical memory based on what the guest does.
Regards,
Quoted 8 lines
Quoted 2 lines
Anthony Liguori
I also think it is very important to have roms sent during migration, otherwise things break if we migrate in the middle of accessing roms.
Heh, this is going to be really broken with my patches :-)
We're during qemu_ram_alloc() and we currently don't have a means to associate ram with anything meaningful. This means that if you hot plug on two ends in different orders (even with fixed slots), the returned qemu_ram_alloc() pointers will be different for the same device. This means when you did the live migration of the rom contents, you'd get the wrong roms in the wrong places.
I think we need to improve how we do qemu_ram_alloc() such that we can associate some meaningful context with each allocated chunk that we can migrate with the chunk of ram.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 51 lines · Anthony Liguori
Quoted 32 lines · Michael S. Tsirkin
Quoted 30 lines · Anthony Liguori
Quoted 15 lines · Gerd Hoffmann
Quoted 13 lines · Anthony Liguori
Okay, I think I've figured out how this is supposed to work. With these two patches to SeaBIOS and the patch to qemu, I can run:
qemu -net nic,model=rtl8139 -net nic,model=virtio -net nic,model=e1000 -boot menu=on
And all three option roms load. I can also select which NIC I want to boot from using the F12 menu. This works by not actually loading the option roms in the 1M space, but instead making them mappable through the PCI devices. With PMM and DDIM, the result is that we only have to copy in 2K for each option rom which means we can support up to 48 unique option roms. That should be plenty for now.
Quoted 6 lines
Quoted 4 lines
These patches are very rough but I'll clean them up tomorrow. I'm not sure the best way to integrate with the rom infrastructure since we no longer have a physical address to map to. Any suggestions Gerd?
Is this needed in the first place?
Only if we care about 'info roms' working. Problem is roms is very centric now to roms at a static guest physical location. In this case, the rom lives in hardware and is mapped into physical memory based on what the guest does.
Regards,
Quoted 8 lines
Quoted 2 lines
Anthony Liguori
I also think it is very important to have roms sent during migration, otherwise things break if we migrate in the middle of accessing roms.
Heh, this is going to be really broken with my patches :-)
We're during
qemu_ram_alloc()and we currently don't have a means to associate ram with anything meaningful. This means that if you hot plug on two ends in different orders (even with fixed slots), the returnedqemu_ram_alloc()pointers will be different for the same device. This means when you did the live migration of the rom contents, you'd get the wrong roms in the wrong places.
Quoted 7 lines
I think we need to improve how we do
qemu_ram_alloc()such that we can associate some meaningful context with each allocated chunk that we can migrate with the chunk of ram.Regards,
Anthony Liguori
Hmm. You think all this is 0.12 material?
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 4 lines · Michael S. Tsirkin
Quoted 4 lines
Heh, this is going to be really broken with my patches :-)
We're during
qemu_ram_alloc()and we currently don't have a means to associate ram with anything meaningful. This means that if you hot plug on two ends in different orders (even with fixed slots), the returnedqemu_ram_alloc()pointers will be different for the same device. This means when you did the live migration of the rom contents, you'd get the wrong roms in the wrong places.
Quoted 9 lines
Quoted 6 lines
I think we need to improve how we do
qemu_ram_alloc()such that we can associate some meaningful context with each allocated chunk that we can migrate with the chunk of ram.Regards,
Anthony Liguori
Hmm. You think all this is 0.12 material?
I think it's stable-0.12 material because it's badly broken right now but it's clearly not a candidate for 0.12.0 as it still doesn't work reliably.
I'm going to pull in Gerd's fix for 0.12.0.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Sebastian HerbsztQuoted 1 line · Sebastian Herbszt
What about isapc? Or (pci)pc with isa card?
I'm not sure how the bios enumerates isa option roms on bare metal. That said, I don't know that it's all that important to support -option-rom, -kernel, or extboot on isapc.
The isa version of cirrus-vga will still load it's rom with rom_add. I guess SeaBIOS needs to know how to properly initialize that.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 14 lines · Anthony Liguori
Quoted 13 lines · Michael S. Tsirkin
Quoted 13 lines
Heh, this is going to be really broken with my patches :-)
We're during
qemu_ram_alloc()and we currently don't have a means to associate ram with anything meaningful. This means that if you hot plug on two ends in different orders (even with fixed slots), the returnedqemu_ram_alloc()pointers will be different for the same device. This means when you did the live migration of the rom contents, you'd get the wrong roms in the wrong places.I think we need to improve how we do
qemu_ram_alloc()such that we can associate some meaningful context with each allocated chunk that we can migrate with the chunk of ram.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Regards,
Anthony Liguori
Hmm. You think all this is 0.12 material?
I think it's stable-0.12 material because it's badly broken right now
I thought the rule was no guest visible changes in stable series?
Quoted 8 lines
but it's clearly not a candidate for 0.12.0 as it still doesn't work reliably.
I'm going to pull in Gerd's fix for 0.12.0.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
I think it's stable-0.12 material because it's badly broken right now
I thought the rule was no guest visible changes in stable series?
Yeah, good point, so we need to figure out something for 0.12.0.
Sebastian's suggestion of loading roms from 0xc0000 first and then from PCI devices is a good one, but I think the problem with that is that the roms don't necessarily have to be contiguous in that space. For instance, the lower bios portions are technically in the rom area which leaves a big gap in the middle.
We could just assume that knowledge in SeaBIOS.
We'll also need the ability to select whether to use PCI or legacy rom loading for each PCI device (via a qdev property). This will need to be plumbed into the machine compat bits such that -M pc-0.11.0 uses legacy rom loading. Otherwise, the PCI devices will be detectably different within the guest.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 10 lines · Anthony Liguori
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
I think it's stable-0.12 material because it's badly broken right now
I thought the rule was no guest visible changes in stable series?
Yeah, good point, so we need to figure out something for 0.12.0.
Sebastian's suggestion of loading roms from
0xc0000first and then from PCI devices is a good one, but I think the problem with that is that the roms don't necessarily have to be contiguous in that space. For instance, the lower bios portions are technically in the rom area which leaves a big gap in the middle.
I don't think i get your objection - mind to explain it a little bit? My suggestion was like this:
PCI pc and -option-rom rom1.bin -option-rom rom2.bin
Qemu will map rom1.bin to PC_ROM_MIN_OPTION (0xc8000) and map rom2.bin
to 0xd0000. Either qemu will map vga bios to PC_ROM_MIN_VGA (0xc0000) or SeaBIOS will map it there (with pci 3.0 it could map it somewhere else, but i doubt thats a good idea). In case the vga bios size is below 0x8000, some rom space is lost. SeaBIOS will scan the option rom space starting at PC_ROM_MIN_OPTION and adjust its RomEnd in case a rom is found. Then it will start the pci scan and map pci option roms after RomEnd.
- Sebastian
Re: [SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 12 lines · Anthony Liguori
Quoted 2 lines · Avi Kivity
bochs bios required all 128kB, so this is probably a leftover.
This is apparently well defined in the PIIX spec. There is a bit of a difference between the lower half and upper half of the BIOS region though and I expect this is part of what the problem is. FYI, the following patch works. Surprisingly, we only need to restore the 0xe8000..0xe8fff region.
Still trying to understand what's happening.
SeaBIOS is currently using over 64K of space. So, it is extending into the e-segment
and thus needs to have the e-segment copied properly (I missed that in my earlier email).
SeaBIOS is only extending a few K into the e-segment, so only that part needs to
be saved and restored.
Should SeaBIOS options be trimmed so that it fit under 64K, then the build would
create only a 64K rom. However, since it is larger than 64K, it pads itself to 128K. As
mentioned before, SeaBIOS can still copy roms into the unused parts of the e-segment,
as it knows which parts of the e-segment it is using.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 3 lines · * Anthony Liguori ([email protected]) wrote:
BTW, I'm pretty sure this style of option rom loading (from a PCI device) is going to be required for device passthrough if we want to support running those roms in the guests.
I think so too.
Quoted 2 lines
In fact, it should Just
Work with my patches !CONFIG_OPTIONROMS_DEPLOYED in SeaBIOS.
What would be the magic to boot from that ROM?
thanks,
-chris
Re: [SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Kevin OConnorQuoted 15 lines · Kevin OConnor
On Tue, Dec 15, 2009 at 12:35 PM, Anthony Liguori <[email protected] <mailto:[email protected]>> wrote:
Avi Kivity wrote:
bochs bios required all 128kB, so this is probably a leftover.
This is apparently well defined in the PIIX spec. There is a bit of a difference between the lower half and upper half of the BIOS region though and I expect this is part of what the problem is.
FYI, the following patch works. Surprisingly, we only need to
restore the 0xe8000..0xe8fff region. Still trying to understand what's happening.
Quoted 3 lines
SeaBIOS is currently using over 64K of space. So, it is extending into the e-segment and thus needs to have the e-segment copied properly (I missed that in my earlier email).
Okay. So I assume this is something that SeaBIOS needs to do? I've been trying to understand the origin of:
// Need to copy optionroms to work around qemu implementation
What is it that we're doing wrong in the qemu implementation? If it's the lack of PCI option loading, then I guess we're okay post my changes provided that SeaBIOS can take care of what it needs in the e-segment.
Regards,
Anthony Liguori
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Chris WrightQuoted 7 lines · Chris Wright
Quoted 4 lines · * Anthony Liguori ([email protected]) wrote:
BTW, I'm pretty sure this style of option rom loading (from a PCI device) is going to be required for device passthrough if we want to support running those roms in the guests.
Quoted 9 lines
I think so too.
Quoted 3 lines
In fact, it should Just
Work with my patches !CONFIG_OPTIONROMS_DEPLOYED in SeaBIOS.What would be the magic to boot from that ROM?
Setup device assignment, add -boot menu=on with my patches, and hit F12 when prompted. In theory, you should see an entry for the device.
If not, the output with DEBUG_BIOS enabled in hw/pc.c would be very interesting.
Regards,
Anthony Liguori
Re: [SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 11 lines · Anthony Liguori
Quoted 3 lines · Kevin OConnor
SeaBIOS is currently using over 64K of space. So, it is extending into the e-segment and thus needs to have the e-segment copied properly (I missed that in my earlier email).
Okay. So I assume this is something that SeaBIOS needs to do? I've been trying to understand the origin of:
// Need to copy optionroms to work around qemu implementation
What is it that we're doing wrong in the qemu implementation?
The comment is referring to the fact that enabling write access to that area causes the existing contents to be discarded, and SeaBIOS needs to copy the contents elsewhere, enable the write, and then copy the contents back. A real machine shadow implementation wouldn't require that. Though, I don't think it's a big deal to handle this in SeaBIOS.
Quoted 3 lines
If it's
the lack of PCI option loading, then I guess we're okay post my changes provided that SeaBIOS can take care of what it needs in the e-segment.
Yes - I think your changes are fine.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Sebastian HerbsztQuoted 5 lines · Sebastian Herbszt
Keep loading custom roms (e.g. from -option-rom) with
rom_add_filestarting at0xc8000. Modify SeaBIOS to scan the memory range for pre-deployed option roms before deploying PCI roms. SeaBIOS will find the last pre-deployed rom and have a starting address for deploying PCI roms. This will keep ISA option roms working.
Unfortunately, if the SeaBIOS post entry gets called again (eg, on ctrl+alt+del), it wont know which roms were originally present, and which roms were deployed by SeaBIOS on the first boot.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 2 lines · Anthony Liguori
SeaBIOS can also load roms from up to two fixed physical addresses (when !CONFIG_OPTIONROMS_DEPLOYED) or from a CBFS payload.
The support for loading of two static option roms wont work well for qemu - it requires compiling into SeaBIOS the PCI ids of the roms.
The CBFS payload loading is closer to what qemu wants. Basically, CBFS (coreboot filesystem) is a mechanism that coreboot uses for storing named files in flash. Code to mix PCI bar roms with other roms is something SeaBIOS already handles with the CBFS system. I doubt it would be worthwhile to introduce CBFS to qemu, but I think adding a "named file" interface to qemu cfg would help.
That way, SeaBIOS could load roms from the PCI bar, CBFS, or qemu cfg without having to duplicate the logic.
This came up before in the discussion at:
http://lists.gnu.org/archive/html/qemu-devel/2009-09/msg01200.html
Right now, qemu cfg uses two ports - a file select port (0x510) and a data port (0x511). Perhaps two new ports could be added - a file name port (0x0512) and a file length port (0x513).
Basically, if there is some way for SeaBIOS to walk a list of "files" in the "qemu cfg" space, then it should be straight forward to enhance the existing code in seabios to extract and deploy roms in addition to those found in the PCI bar.
Quoted 3 lines
You mean, non-PCI x86 systems? I think -m isapc is mainly used for dos guests. I don't think it's really useful in combination with -kernel and certainly not for extboot.
I think the issue here is that a "-m isapc" machine wont be able to run the vga rom if the vga rom is only available from a pci bar.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Kevin O'ConnorQuoted 10 lines · Kevin O'Connor
Quoted 5 lines · Sebastian Herbszt
Keep loading custom roms (e.g. from -option-rom) with
rom_add_filestarting at0xc8000. Modify SeaBIOS to scan the memory range for pre-deployed option roms before deploying PCI roms. SeaBIOS will find the last pre-deployed rom and have a starting address for deploying PCI roms. This will keep ISA option roms working.Unfortunately, if the SeaBIOS post entry gets called again (eg, on ctrl+alt+del), it wont know which roms were originally present, and which roms were deployed by SeaBIOS on the first boot.
option roms loaded by seabios via pci seem to care only about the pci device they where loaded from. So this optionrom <=> pcidevice relationship must be stored somewhere. Can SeaBIOS use that to figure which option roms where loaded by seabios itself?
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 9 lines · Anthony Liguori
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
We could also add a "romfile" property to the pci bus and do everything (except setting the default filename) in generic pci code.
Patch attached (incremental to yours).
Sounds great, but no patch is attached.
Next try ...
cheers,
Gerd
Quoted 1 line
From
dfbe5a62db3da79d3d8b73634915471921f6e8eeMon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Tue, 15 Dec 2009 11:04:31 +0100
Subject: [PATCH] pci: add romfile property
Add romfile as bus property to pci, load the file into the rom bar when specified.
--- hw/cirrus_vga.c | 4 +++- hw/e1000.c | 8 ++------ hw/pci.c | 19 ++++++++++++++++--- hw/pci.h | 3 +-- hw/rtl8139.c | 8 ++------ hw/virtio-pci.c | 8 ++------ pc-bios/bios.bin | Bin 131072 -> 131072 bytes 7 files changed, 26 insertions(+), 24 deletions(-)
hw/cirrus_vga.c +3 -1
@@ -3211,7 +3211,9 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) }/* ROM BIOS */ -pci_add_option_rom ((PCIDevice *)d,VGABIOS_CIRRUS_FILENAME ); +if (dev->rom_filename ==NULL ) { + dev->rom_filename =qemu_strdup (VGABIOS_CIRRUS_FILENAME ); + }return 0 ; }
hw/e1000.c +2 -6
@@ -1122,12 +1122,8 @@ static int pci_e1000_init(PCIDevice *pci_dev)qemu_format_nic_info_str (&d->nic->nc, macaddr); -if (!pci_dev->qdev.hotplugged) { -static int loaded =0 ; -if (!loaded) { -pci_add_option_rom (&d->dev,"pxe-e1000.bin" ); - loaded =1 ; - } +if (pci_dev->rom_filename ==NULL ) { + pci_dev->rom_filename =qemu_strdup ("pxe-e1000.bin" ); }return 0 ; }
hw/pci.c +16 -3
@@ -63,12 +63,14 @@ static struct BusInfo pci_bus_info = { .print_dev = pcibus_dev_print, .props = (Property []) {DEFINE_PROP_PCI_DEVFN ("addr" , PCIDevice, devfn,-1 ), +DEFINE_PROP_STRING ("romfile" , PCIDevice, rom_filename),DEFINE_PROP_END_OF_LIST () } };static void pci_update_mappings (PCIDevice *d);static void pci_set_irq (void *opaque,int irq_num,int level); +static int pci_add_option_rom (PCIDevice *pdev);target_phys_addr_t pci_mem_base;static uint16_t pci_default_sub_vendor_id =PCI_SUBVENDOR_ID_REDHAT_QUMRANET ;
@@ -1387,6 +1389,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) rc = info->init (pci_dev);if (rc !=0 )return rc; +pci_add_option_rom (pci_dev);if (qdev->hotplugged) bus->hotplug (pci_dev,1 );return 0 ;
@@ -1470,18 +1473,28 @@ static void pci_map_option_rom(PCIDevice *pdev, int region_num, pcibus_t addr, p }/* Add an option rom for the device */ -int pci_add_option_rom (PCIDevice *pdev,const char *name) +static int pci_add_option_rom (PCIDevice *pdev) {int size;char *path;void *ptr; - path =qemu_find_file (QEMU_FILE_TYPE_BIOS , name); +if (!pdev->rom_filename) +return 0 ; +if (strlen (pdev->rom_filename) ==0 ) +return 0 ; + + path =qemu_find_file (QEMU_FILE_TYPE_BIOS , pdev->rom_filename);if (path ==NULL ) { - path =qemu_strdup (name); + path =qemu_strdup (pdev->rom_filename); } size =get_image_size (path); +if (size <0 ) { +qemu_error ("%s: failed to find romfile \"%s\"\n" , __FUNCTION__, + pdev->rom_filename); +return -1 ; + }if (size & (size -1 )) { size =1 <<qemu_fls (size); }
hw/pci.h +1 -2
@@ -245,6 +245,7 @@ struct PCIDevice {int32_t version_id;/* Location of option rom */ +char *rom_filename;ram_addr_t rom_offset; };
@@ -257,8 +258,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, pcibus_t size, int type, PCIMapIORegionFunc *map_func); -int pci_add_option_rom (PCIDevice *pdev,const char *name); -int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);
hw/rtl8139.c +2 -6
@@ -3354,12 +3354,8 @@ static int pci_rtl8139_init(PCIDevice *dev) rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock)));#endif /* RTL8139_ONBOARD_TIMER */ -if (!dev->qdev.hotplugged) { -static int loaded =0 ; -if (!loaded) { -pci_add_option_rom (&s->dev,"pxe-rtl8139.bin" ); - loaded =1 ; - } +if (dev->rom_filename ==NULL ) { + dev->rom_filename =qemu_strdup ("pxe-rtl8139.bin" ); }return 0 ; }
hw/virtio-pci.c +2 -6
@@ -519,12 +519,8 @@ static int virtio_net_init_pci(PCIDevice *pci_dev)/* make the actual value visible */ proxy->nvectors = vdev->nvectors; -if (!pci_dev->qdev.hotplugged) { -static int loaded =0 ; -if (!loaded) { -pci_add_option_rom (pci_dev,"pxe-virtio.bin" ); - loaded =1 ; - } +if (pci_dev->rom_filename ==NULL ) { + pci_dev->rom_filename =qemu_strdup ("pxe-virtio.bin" ); }return 0 ; }
pc-bios/bios.bin binary +0 -0
Signature · 1 line
1.6.5.2
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Kevin O'ConnorHi,
Quoted 4 lines
Basically, if there is some way for SeaBIOS to walk a list of "files" in the "qemu cfg" space, then it should be straight forward to enhance the existing code in seabios to extract and deploy roms in addition to those found in the PCI bar.
I think using fw_config is the only sane way to make it work, especially in case we switch vga bios load to pci bar too.
base address for vga bios is 0xc0000
base address for option roms is 0xc8000
If the vga bios is larger than 0x08000 bytes then the first option rom has to be loaded at a higher address. Which is actually the case, check 'info roms':
addr=00000000000c0000 size=0x008c00 mem=ram name="vgabios-cirrus.bin" addr=00000000000c9000 size=0x00dc00 mem=ram name="pxe-virtio.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin"
Thus having qemu load -- say -- linuxboot.bin and seabios load vgabios-cirrus.bin and pxe-virtio.bin simply isn't going to work. qemu has no idea what address linuxboot.bin can be loaded at (without introducing dirty hacks).
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gerd HoffmannQuoted 7 lines · Gerd Hoffmann
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
We could also add a "romfile" property to the pci bus and do everything (except setting the default filename) in generic pci code.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Patch attached (incremental to yours).
Sounds great, but no patch is attached.
Next try ...
cheers,
Gerd
What will happen when we find a bug in one of ROMs I wonder? I think we will need to keep the old ROM around, and put it in as part of compat machine type?
Quoted 1,784 lines
Quoted 1 line
From
dfbe5a62db3da79d3d8b73634915471921f6e8eeMon Sep 17 00:00:00 2001From: Gerd Hoffmann <[email protected]>
Date: Tue, 15 Dec 2009 11:04:31 +0100
Subject: [PATCH] pci: add romfile propertyAdd romfile as bus property to pci, load the file into the rom bar when specified.
--- hw/cirrus_vga.c | 4 +++- hw/e1000.c | 8 ++------ hw/pci.c | 19 ++++++++++++++++--- hw/pci.h | 3 +-- hw/rtl8139.c | 8 ++------ hw/virtio-pci.c | 8 ++------ pc-bios/bios.bin | Bin 131072 -> 131072 bytes 7 files changed, 26 insertions(+), 24 deletions(-)hw/cirrus_vga.c +3
-1@@ -3211,7 +3211,9 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) }/* ROM BIOS */ -pci_add_option_rom ((PCIDevice *)d,VGABIOS_CIRRUS_FILENAME ); +if (dev->rom_filename ==NULL ) { + dev->rom_filename =qemu_strdup (VGABIOS_CIRRUS_FILENAME ); + }return 0 ; }hw/e1000.c +2
-6@@ -1122,12 +1122,8 @@ static int pci_e1000_init(PCIDevice *pci_dev)qemu_format_nic_info_str (&d->nic->nc, macaddr); -if (!pci_dev->qdev.hotplugged) { -static int loaded =0 ; -if (!loaded) { -pci_add_option_rom (&d->dev,"pxe-e1000.bin" ); - loaded =1 ; - } +if (pci_dev->rom_filename ==NULL ) { + pci_dev->rom_filename =qemu_strdup ("pxe-e1000.bin" ); }return 0 ; }hw/pci.c +16
-3@@ -63,12 +63,14 @@ static struct BusInfo pci_bus_info = { .print_dev = pcibus_dev_print, .props = (Property []) {DEFINE_PROP_PCI_DEVFN ("addr" , PCIDevice, devfn,-1 ), +DEFINE_PROP_STRING ("romfile" , PCIDevice, rom_filename),DEFINE_PROP_END_OF_LIST () } };static void pci_update_mappings (PCIDevice *d);static void pci_set_irq (void *opaque,int irq_num,int level); +static int pci_add_option_rom (PCIDevice *pdev);target_phys_addr_t pci_mem_base;static uint16_t pci_default_sub_vendor_id =PCI_SUBVENDOR_ID_REDHAT_QUMRANET ;@@ -1387,6 +1389,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) rc = info->init (pci_dev);if (rc !=0 )return rc; +pci_add_option_rom (pci_dev);if (qdev->hotplugged) bus->hotplug (pci_dev,1 );return 0 ;@@ -1470,18 +1473,28 @@ static void pci_map_option_rom(PCIDevice *pdev, int region_num, pcibus_t addr, p }/* Add an option rom for the device */ -int pci_add_option_rom (PCIDevice *pdev,const char *name) +static int pci_add_option_rom (PCIDevice *pdev) {int size;char *path;void *ptr; - path =qemu_find_file (QEMU_FILE_TYPE_BIOS , name); +if (!pdev->rom_filename) +return 0 ; +if (strlen (pdev->rom_filename) ==0 ) +return 0 ; + + path =qemu_find_file (QEMU_FILE_TYPE_BIOS , pdev->rom_filename);if (path ==NULL ) { - path =qemu_strdup (name); + path =qemu_strdup (pdev->rom_filename); } size =get_image_size (path); +if (size <0 ) { +qemu_error ("%s: failed to find romfile \"%s\"\n" , __FUNCTION__, + pdev->rom_filename); +return -1 ; + }if (size & (size -1 )) { size =1 <<qemu_fls (size); }hw/pci.h +1
-2@@ -245,6 +245,7 @@ struct PCIDevice {int32_t version_id;/* Location of option rom */ +char *rom_filename;ram_addr_t rom_offset; };@@ -257,8 +258,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, pcibus_t size, int type, PCIMapIORegionFunc *map_func); -int pci_add_option_rom (PCIDevice *pdev,const char *name); -int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);hw/rtl8139.c +2
-6@@ -3354,12 +3354,8 @@ static int pci_rtl8139_init(PCIDevice *dev) rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock)));#endif /* RTL8139_ONBOARD_TIMER */ -if (!dev->qdev.hotplugged) { -static int loaded =0 ; -if (!loaded) { -pci_add_option_rom (&s->dev,"pxe-rtl8139.bin" ); - loaded =1 ; - } +if (dev->rom_filename ==NULL ) { + dev->rom_filename =qemu_strdup ("pxe-rtl8139.bin" ); }return 0 ; }hw/virtio-pci.c +2
-6@@ -519,12 +519,8 @@ static int virtio_net_init_pci(PCIDevice *pci_dev)/* make the actual value visible */ proxy->nvectors = vdev->nvectors; -if (!pci_dev->qdev.hotplugged) { -static int loaded =0 ; -if (!loaded) { -pci_add_option_rom (pci_dev,"pxe-virtio.bin" ); - loaded =1 ; - } +if (pci_dev->rom_filename ==NULL ) { + pci_dev->rom_filename =qemu_strdup ("pxe-virtio.bin" ); }return 0 ; }pc-bios/bios.bin binary +0
-0Signature · 2 lines
-- 1.6.5.2
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Hi,
Quoted 3 lines
What will happen when we find a bug in one of ROMs I wonder? I think we will need to keep the old ROM around, and put it in as part of compat machine type?
What do you want?
Old way to load the rom?
Old rom binaries (i.e. etherboot)?
Both?
The new way to load the roms is a guest-visible change (devices get a rom bar they had not before), so we might want to have a backward compatibility property for that. Not sure whenever this is a problem.
Allowing old ROMs isn't easy as they don't support BEV.
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 11 lines · Gerd Hoffmann
Hi,
Quoted 3 lines
What will happen when we find a bug in one of ROMs I wonder? I think we will need to keep the old ROM around, and put it in as part of compat machine type?
What do you want?
Old way to load the rom?
Old rom binaries (i.e. etherboot)?
Both?
Quoted 8 lines
The new way to load the roms is a guest-visible change (devices get a rom bar they had not before), so we might want to have a backward compatibility property for that. Not sure whenever this is a problem.
Allowing old ROMs isn't easy as they don't support BEV.
cheers,
Gerd
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 7 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
Quoted 5 lines
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.
Yes, but if migration happens in the middle of the copying...
--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Kevin O'ConnorQuoted 7 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
Quoted 6 lines
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.-Kevin
Ah, cool. We still have the issue of migrating while ROM is being read, but this bug existed already.
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gleb NatapovQuoted 8 lines · Gleb Natapov
Quoted 7 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
Quoted 6 lines
Quoted 5 lines
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.Yes, but if migration happens in the middle of the copying...
Yes. This is not a new bug though.
Quoted 2 lines
--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Gleb Natapov
Quoted 7 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.Yes, but if migration happens in the middle of the copying...
Yes. This is not a new bug though.
How so?
--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 15 lines · Gleb Natapov
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Yes, but if migration happens in the middle of the copying...
Yes. This is not a new bug though.
How so?
BIOS already reads roms from devices, does it not? If we migrate in the middle of this process to a device with a different ROM, tough.
Quoted 2 lines
--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Gleb Natapov
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Yes, but if migration happens in the middle of the copying...
Yes. This is not a new bug though.
How so?
BIOS already reads roms from devices, does it not?
No it doesn't.
Quoted 5 lines
If we migrate in the middle of this process to
a device with a different ROM, tough.Quoted 2 lines
--
Gleb.
--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 17 lines · Gleb Natapov
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Gleb Natapov
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Kevin O'Connor
Quoted 5 lines · Michael S. Tsirkin
I am mostly concerned with migrating between qemu versions with different roms, while guest was in the middle of running ROM. This might be solved if we migrated ROM content together with the device and put some padding in ROM content so that size can be kept constant.
SeaBIOS will always copy the roms into the 0xc0000-0xf0000 memory area (regardless of
CONFIG_OPTIONROMS_DEPLOYED). So, if one migrates a machine while running a rom, the memory holding the rom should get migrated with everything else.
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Yes, but if migration happens in the middle of the copying...
Yes. This is not a new bug though.
How so?
BIOS already reads roms from devices, does it not?
No it doesn't.
Oh, you are right, we do this on device init.
Quoted 8 lines
Quoted 5 lines
If we migrate in the middle of this process to
a device with a different ROM, tough.Quoted 2 lines
--
Gleb.--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 3 lines · Anthony Liguori
BTW, I'm pretty sure this style of option rom loading (from a PCI device) is going to be required for device passthrough if we want to support running those roms in the guests.
Well, qemu-kvm has quite some code to poke the rom out of /proc/bus/pci and feed it into the rom loader. All this can simply be dropped then.
cheers
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 10 lines · Gerd Hoffmann
Quoted 3 lines · Anthony Liguori
BTW, I'm pretty sure this style of option rom loading (from a PCI device) is going to be required for device passthrough if we want to support running those roms in the guests.
Well, qemu-kvm has quite some code to poke the rom out of
/proc/bus/pciand feed it into the rom loader. All this can simply be dropped then.cheers
Gerd
It's probably safer not to assume that guest does not run the rom directly.
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Sebastian HerbsztQuoted 2 lines · Sebastian Herbszt
Qemu will map rom1.bin to
PC_ROM_MIN_OPTION(0xc8000) and map rom2.bin to0xd0000.
No.
rom1.bin will be loaded to max(0xc8000, 0xc0000 + cirrus-bios-size) aligned to 2k, which (with cirrus) is 0xc90000.
rom2.bin will be loaded after rom1.bin (also 2k aligned), so the address will depend on rom1.bin size.
Quoted 5 lines
Either qemu will map vga bios to
PC_ROM_MIN_VGA(0xc0000) or SeaBIOS will map it there (with pci 3.0 it could map it somewhere else, but i doubt thats
a good idea). In case the vga bios size is below0x8000, some rom space is lost.
Because it is larger than 0x8000 option roms will be overwritten when loaded to 0xc8000
Quoted 5 lines
SeaBIOS
will scan the option rom space starting atPC_ROM_MIN_OPTIONand adjust its RomEnd in
case a rom is found. Then it will start the pci scan and map pci option roms after RomEnd.
Doesn't fly.
I think either qemu or seabios should load *all* roms. I think the idea to provide non-pci roms via fw_cfg and let seabios load them is the best idea we had so far.
cheers,
Gerd
Re: [SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Michael S. TsirkinQuoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Gerd Hoffmann
Quoted 3 lines · Anthony Liguori
BTW, I'm pretty sure this style of option rom loading (from a PCI device) is going to be required for device passthrough if we want to support running those roms in the guests.
Quoted 9 lines
Quoted 5 lines
Well, qemu-kvm has quite some code to poke the rom out of
/proc/bus/pciand feed it into the rom loader. All this can simply be dropped then.cheers
GerdIt's probably safer not to assume that guest does not run the rom directly.
Directly from PCI ROM? Is this even possible?
--
Gleb.
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Kevin O'ConnorQuoted 8 lines
Right now, qemu cfg uses two ports - a file select port (
0x510) and a data port (0x511). Perhaps two new ports could be added - a file name port (0x0512) and a file length port (0x513).Basically, if there is some way for SeaBIOS to walk a list of "files" in the "qemu cfg" space, then it should be straight forward to enhance the existing code in seabios to extract and deploy roms in addition to those found in the PCI bar.
What information does seabios need?
It probably needs to know whenever the rom in question is the vga bios or an option rom.
It probably also wants to get the vga bios first I assume?
Is a (file) name needed?
Would seabios load the option roms one by one or all in one go?
I'd tend to have one fw_cfg entry which returns structed data, like this:
struct fw_files {
u32 filecount;
struct fw_file {
u32 type; /* vga, option, other? */
u32 size; /* file size */
u32 select; /* write this to 0x510 to read it */
u32 reserved; /* you never know ;) */
char name[16]; /* maybe: filename */ };
};
What do you think?
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 9 lines · Gerd Hoffmann
Quoted 8 lines
Right now, qemu cfg uses two ports - a file select port (
0x510) and a data port (0x511). Perhaps two new ports could be added - a file name port (0x0512) and a file length port (0x513).Basically, if there is some way for SeaBIOS to walk a list of "files" in the "qemu cfg" space, then it should be straight forward to enhance the existing code in seabios to extract and deploy roms in addition to those found in the PCI bar.
Quoted 6 lines
What information does seabios need?
It probably needs to know whenever the rom in question is the vga bios or an option rom.
It probably also wants to get the vga bios first I assume?
The current "CBFS" mechanism looks for named "files" of the following form:
- pciVVVV,DDDD.rom - a rom associated with a PCI device with the given vendor and device id.
- vgaroms/* - any "file" starting with the "vgaroms/" prefix is treated as a vga option rom not associated with any specific pci device.
- genroms/* - any "file" starting with the "genroms/" prefix is treated as a generic option rom not associated with any specific pci device.
The deployment order is: find the PCI vga device and look for a corresponding "pciVVVV,DDDD.rom" file or a PCI bar for it, deploy any "vgaroms/*" roms, iterate through all non-vga PCI devices and deploy their corresponding "pciVVVV,DDDD.rom" or PCI bar roms, deploy any "genroms/*" roms.
When SeaBIOS deploys a rom that is associated with a specific PCI device (either "pciVVVV,DDDD.rom" or PCI bar), it passes the PCI location as a parameter to the rom (as is required in the PCI firmware spec). Roms not associated with a device (genroms/*, vgaroms/*, and when CONFIG_OPTIONROMS_DEPLOYED) don't pass in the PCI id, so they have a slightly different calling convention.
Quoted 1 line
Is a (file) name needed?
Associating a name to the fw_cfg entries and using the naming convention above would allow SeaBIOS to reuse its existing code. It seems to me that both coreboot and qemu are trying to solve the same problem, so using the same mechanism seems advantageous.
BTW, my preference would be to assign a name to all fw_cfg entries; even the existing ones.
Quoted 1 line
Would seabios load the option roms one by one or all in one go?
One by one - so it can satisfy the requirement of passing the PCI location as a parameter to roms that may need that while still handling roms not associated with a device (eg, kvm's vbios, the -kernel rom, etc.).
Quoted 10 lines
I'd tend to have one
fw_cfgentry which returns structed data, like this:struct
fw_files{
u32 filecount;
structfw_file{u32 type; /* vga, option, other? */ u32 size; /* file size */ u32 select; /* write this to 0x510 to read it */ u32 reserved; /* you never know ;) */ char name[16]; /* maybe: filename */
Quoted 4 lines
};
};What do you think?
It works for me. The name would need to be larger (64 bytes?). The current scheme essentially encodes 'type' into the name, so it wouldn't be needed.
-Kevin
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 6 lines · Kevin O'Connor
On Wed, Dec 16, 2009 at 05:22:41PM +0100, Gerd Hoffmann wrote:
The current "CBFS" mechanism looks for named "files" of the following form:- pciVVVV,DDDD.rom - a rom associated with a PCI device with the given vendor and device id.
Might be useful for backward compatibility with older qemu versions as adding a rom bar to the pci devices is a guest-visible change in pci config space.
Quoted 3 lines
- vgaroms/* - any "file" starting with the "vgaroms/" prefix is treated as a vga option rom not associated with any specific pci device.
obvious place for vgabios.
Quoted 3 lines
- genroms/* - any "file" starting with the "genroms/" prefix is treated as a generic option rom not associated with any specific pci device.
and this for the non-pci roms like extboot &
Quoted 2 lines
Associating a name to the
fw_cfgentries and using the naming convention above would allow SeaBIOS to reuse its existing code.
Ok.
Quoted 13 lines
Quoted 13 lines
I'd tend to have one
fw_cfgentry which returns structed data, like this:struct
fw_files{
u32 filecount;
structfw_file{u32 type; /* vga, option, other? */ u32 size; /* file size */ u32 select; /* write this to 0x510 to read it */ u32 reserved; /* you never know ;) */ char name[16]; /* maybe: filename */};
};
Quoted 3 lines
Quoted 1 line
What do you think?
It works for me. The name would need to be larger (64 bytes?).
I'd size name so it pads the struct to 32 or 64 bytes total. 32bit size, 16bit select, 16bit reserved, leaves 24 bytes for the name with 32 bytes. Hmm, better to go for a 64 byte struct, leaving 56 bytes for the name, which should be enougth.
I'll have patches ready later today.
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 22 lines · Gerd Hoffmann
Quoted 6 lines · Kevin O'Connor
On Wed, Dec 16, 2009 at 05:22:41PM +0100, Gerd Hoffmann wrote:
The current "CBFS" mechanism looks for named "files" of the following form:- pciVVVV,DDDD.rom - a rom associated with a PCI device with the given vendor and device id.
Might be useful for backward compatibility with older qemu versions as adding a rom bar to the pci devices is a guest-visible change in pci config space.
Quoted 3 lines
- vgaroms/* - any "file" starting with the "vgaroms/" prefix is treated as a vga option rom not associated with any specific pci device.
obvious place for vgabios.
Quoted 3 lines
- genroms/* - any "file" starting with the "genroms/" prefix is treated as a generic option rom not associated with any specific pci device.
Quoted 17 lines
and this for the non-pci roms like extboot &
Quoted 2 lines
Associating a name to the
fw_cfgentries and using the naming convention above would allow SeaBIOS to reuse its existing code.Ok.
Quoted 10 lines
Quoted 10 lines
I'd tend to have one
fw_cfgentry which returns structed data, like this:struct
fw_files{
u32 filecount;
structfw_file{u32 type; /* vga, option, other? */ u32 size; /* file size */ u32 select; /* write this to 0x510 to read it */ u32 reserved; /* you never know ;) */ char name[16]; /* maybe: filename */
Can't name simply be null terminated?
Quoted 16 lines
Quoted 6 lines
Quoted 4 lines
}; };What do you think?
It works for me. The name would need to be larger (64 bytes?).
I'd size name so it pads the struct to 32 or 64 bytes total. 32bit size, 16bit select, 16bit reserved, leaves 24 bytes for the name with 32 bytes. Hmm, better to go for a 64 byte struct, leaving 56 bytes for the name, which should be enougth.
I'll have patches ready later today.
cheers,
Gerd
Signature · 1 line
MST
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
struct fw_files { u32 filecount; struct fw_file { u32 type; /* vga, option, other? */ u32 size; /* file size */ u32 select; /* write this to 0x510 to read it */ u32 reserved; /* you never know ;) */ char name[16]; /* maybe: filename */Can't name simply be null terminated?
It can, but it wouldn't be simple ...
cheers,
Gerd
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Gerd HoffmannQuoted 8 lines · Gerd Hoffmann
Quoted 2 lines · Sebastian Herbszt
Qemu will map rom1.bin to
PC_ROM_MIN_OPTION(0xc8000) and map rom2.bin to0xd0000.No.
rom1.bin will be loaded to
max(0xc8000, 0xc0000 + cirrus-bios-size)aligned to 2k, which (with cirrus) is0xc90000.
My bad - for some reason i assumed the vga bios has to be 32k max.
Quoted 16 lines
rom2.bin will be loaded after rom1.bin (also 2k aligned), so the address will depend on rom1.bin size.
Quoted 5 lines
Either qemu will map vga bios to
PC_ROM_MIN_VGA(0xc0000) or SeaBIOS will map it there (with pci 3.0 it could map it somewhere else, but i doubt thats
a good idea). In case the vga bios size is below0x8000, some rom space is lost.Because it is larger than
0x8000option roms will be overwritten when loaded to0xc8000Quoted 5 lines
SeaBIOS
will scan the option rom space starting atPC_ROM_MIN_OPTIONand adjust its RomEnd in
case a rom is found. Then it will start the pci scan and map pci option roms after RomEnd.
Quoted 3 lines
Doesn't fly.
I think either qemu or seabios should load *all* roms. I think the idea to provide non-pci roms via
fw_cfgand let seabios load them is the best idea we had so far.
I don't think that is what happens on real hardware with ISA cards which have an option rom. Therefore i suggest inverting some of my suggestion from above and put the qemu loaded roms not at the beginning of the option rom space, but starting at the end of it, e.g. rom1.bin below 0xe0000 and rom2.bin below rom1.bin (considering rom length and alignment). SeaBIOS could then locate those roms and setup it's "RomEnd" (max. pci rom loading address) according to it.
- Sebastian
Re: Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)
In reply to Anthony LiguoriQuoted 4 lines · Anthony Liguori
Quoted 1 line · Sebastian Herbszt
What about isapc? Or (pci)pc with isa card?
I'm not sure how the bios enumerates isa option roms on bare metal.
Let's give this a shot:
A typical isa expansion card seems to have a jumper to select a I/O port, IRQ and boot rom location, e.g. 280, 10, cc00.
In its default configuration the PMC directs access to 0xc0000-0xdffff to pci and doesn't respond to those. Those accesses are forwarded to isa. Now they can be decoded by the expansion card. I assume isa option roms just appear to be there and the bios only needs to scan for them. This seems to be exactly what qemu does right now with "-option-rom".
- Sebastian