Dne 28.2.2017 v 23:11 Richard Henderson napsal(a): > On 02/27/2017 09:18 PM, Michal Marek wrote: >> +static int do_stfle(CPUS390XState *env, uint64_t addr, uint32_t ar, >> int len) >> +{ >> + S390CPU *cpu = s390_env_get_cpu(env); >> + /* 256 doublewords as per STFLE documentation */ >> + uint8_t data[256 * 8] = { 0 }; >> + int res; >> + >> + res = s390_fill_feat_block(cpu->model->features, >> S390_FEAT_TYPE_STFL, data); >> + res = ROUND_UP(res, 8); >> + s390_cpu_virt_mem_write(cpu, addr, ar, data, MIN(res, len)); > > This does not do what you think it does. Or indeed, I suspect what the > original author thinks it does. I suspect it works for KVM only, and no > one has actually tried the non-KVM code path. > > Primarily, it does not raise an exception for error. Secondarily, I > have no idea what the "AR" argument is supposed to be, or how that's > supposed to interact with the rest of the virtual memory system. > > Your writes need to look a lot more like fast_memmove in mem_helper.c, > except that of course only the destination needs translation. > > Of course, in practice we could reduce this to just one cpu_stl_data for > STFL and one or two cpu_stq_data for STFLE. So a full fast_memmove loop > is overkill. > > As it happens, this reminds me that I wrote a version of this several > years ago but never submitted it upstream. I'll dig it out.
So, does it make sense for me to post a v5 again not using s390_cpu_virt_mem_write(), or are you going to refresh your stfle implementation? Thanks, Michal