On Mon, 14 Apr 2014, Alexander Graf wrote:
On 09.03.14 01:13, BALATON Zoltan wrote:
On Sat, 8 Mar 2014, Mark Cave-Ayland wrote:
I would say do a separate patchset with patches 1 and 4 with CC to the PPC maintainers (Alex and Andreas) and make sure that they are happy with the changes.
Here are my proposed changes to qemu/init.c. This is all in one patch currently that I can split into 3 or 4 separate patches if that preferred but before doing that I'd like to get your comments if other changes are needed. The patch contains the following changes:
- Remove unused clock_frequency from CPU info (these are now get via
FW_CFG for a while)
- Add tlb-sets and tlb-size instead (only for G4 for now because I don't
know the correct values for other CPUs)
- Add bus-frequency property to CPU
- Rename the root node on Apple machines to match their conventions
Regards, BALATON Zoltan
Index: openbios-devel/arch/ppc/qemu/init.c
--- openbios-devel/arch/ppc/qemu/init.c (revision 1277) +++ openbios-devel/arch/ppc/qemu/init.c (working copy) @@ -44,7 +44,7 @@ int icache_size, dcache_size; int icache_sets, dcache_sets; int icache_block_size, dcache_block_size;
- int clock_frequency;
- int tlb_sets, tlb_size; void (*initfn)(const struct cpudef *cpu); };
@@ -269,6 +269,18 @@ push_str("i-cache-block-size"); fword("property");
- if(cpu->tlb_size) {
PUSH(cpu->tlb_sets);
fword("encode-int");
push_str("tlb-sets");
fword("property");
PUSH(cpu->tlb_size);
fword("encode-int");
push_str("tlb-size");
fword("property");
Please just find the correct values and add the properties to the cpu nodes always.
Where can I find the correct values? Maybe QEMU should send it via FW_CFG because OpenBIOS only seems to have data for a few CPUs and most of them have a comment saying that the values are not correct anyway. But I could not find where is this data available in QEMU.
- }
PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ)); fword("encode-int"); push_str("timebase-frequency");
@@ -279,6 +291,11 @@ push_str("clock-frequency"); fword("property");
- PUSH(100 * 1000 * 1000);
- fword("encode-int");
- push_str("bus-frequency");
- fword("property");
I'm fairly sure this is wrong.
What is the good value then? (Some other data e.g. the clock frequency is also a made up value to make the clients happy.)
push_str("running"); fword("encode-string"); push_str("state");
@@ -391,7 +408,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x07de2900,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_604_init, }, { // XXX find out real values
@@ -403,7 +421,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x07de2900,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_604_init, }, { // XXX find out real values
@@ -415,7 +434,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x07de2900,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_604_init, }, { // XXX find out real values
@@ -427,7 +447,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x14dc9380,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_750_init, }, {
@@ -439,7 +460,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x14dc9380,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_750_init, }, { // XXX find out real values
@@ -451,7 +473,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x14dc9380,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_750_init, }, { // XXX find out real values
@@ -463,7 +486,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x14dc9380,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_750_init, }, { // XXX find out real values
@@ -475,7 +499,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x14dc9380,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_750_init, }, { // XXX find out real values
@@ -487,7 +512,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x14dc9380,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_750_init, }, {
@@ -499,7 +525,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x20, .dcache_block_size = 0x20,
.clock_frequency = 0x1dcd6500,
.tlb_sets = 0x40,
.tlb_size = 0x80, .initfn = cpu_g4_init, }, {
@@ -511,7 +538,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x80, .dcache_block_size = 0x80,
.clock_frequency = 0x5f5e1000,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_970_init, }, { // XXX find out real values
@@ -523,7 +551,8 @@ .dcache_sets = 0x80, .icache_block_size = 0x80, .dcache_block_size = 0x80,
.clock_frequency = 0x1dcd6500,
.tlb_sets = 0x00,
.tlb_size = 0x00, .initfn = cpu_970_init, }, {
@@ -535,7 +564,8 @@ .dcache_sets = 0x40, .icache_block_size = 0x80, .dcache_block_size = 0x80,
.clock_frequency = 0x629b4940,
.tlb_sets = 0x00,
};.tlb_size = 0x00, .initfn = cpu_970_init, },
@@ -702,6 +732,12 @@ push_str("/"); fword("find-device");
- /* Apple calls the root node device-tree */
- if (is_apple()) {
push_str("device-tree");
fword("device-name");
- }
Always? No difference between oldworld and newworld?
As far as I can tell looking at these device tree dumps: http://web.archive.org/web/20081120133742/http://penguinppc.org/historical/d... it seems to be always called like that also on old world machines.
Regards, BALATON Zoltan