On Thu, Jul 23, 2020 at 2:00 AM Richard Henderson < richard.hender...@linaro.org> wrote:
> On 7/22/20 2:15 AM, frank.ch...@sifive.com wrote: > > -static void vext_clear(void *tail, uint32_t cnt, uint32_t tot) > > +static void vext_clear(void *tail, uint32_t vta, uint32_t cnt, uint32_t > tot) > > { > > + if (vta == 0) { > > + /* tail element undisturbed */ > > + return; > > + } > > + > > /* > > + * Tail element agnostic. > > * Split the remaining range to two parts. > > * The first part is in the last uint64_t unit. > > * The second part start from the next uint64_t unit. > > @@ -152,41 +168,50 @@ static void vext_clear(void *tail, uint32_t cnt, > uint32_t tot) > > if (cnt % 8) { > > part1 = 8 - (cnt % 8); > > part2 = tot - cnt - part1; > > - memset((void *)((uintptr_t)tail & ~(7ULL)), 0, part1); > > - memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 0, part2); > > + memset((void *)((uintptr_t)tail & ~(7ULL)), 1, part1); > > + memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 1, part2); > > } else { > > - memset(tail, 0, part2); > > + memset(tail, 1, part2); > > } > > } > > "1s" surely means all bits set to 1, not each byte to 1. > You're correct, I can't just simply replace the value from 0 to 1. > > Is there any reason to do anything with VTA/VMA at all? One alternative > for > "agnostic" is to leave the values undisturbed. So the quickest thing for > qemu > to do is remove all of this code. Then we don't have to pass the values in > translate either. > > Which is exactly what is recommended in the 4th paragraph of the notes > following the VTA/VMA description. > > I was trying to keep these codes as an option for the user to specify the behaviors of VTA. But as long as it's easier for QEMU to just treat VTA/VMA as agnostic(no changes)/undisturbed. I will remove all the clean functions in my next patchset. > > r~ > Frank Chang