Hello! > > > Did you check if PAGE_HYP_DEVICE can mean something sane on a stage-2 > > > page table entry and vice verse? > > > > I tried to, the chain of macros and variables is complicated enough not to > > get 200% sure, but anyway PAGE_HYP_DEVICE (as well as PAGE_S2_DEVICE) > > includes PROT_PTE_DEVICE, so this is definitely device. > > I even tried to construct some mask in order to make a single check for only > > DEVICE flags, but, to make things even less understandable and predictable, > > the same code with different bitfields is reused by ARM64. So, i thought that > > it will be more reliable just to add a second test. > > The thing I want to avoid is PAGE_HYP_DEVICE covering some normal S2 > mapping, which we *should* flush but that we now end up ignoring? That > doesn't sound like it can be the case because the device bit is the same > bit for both types of page tables, correct? Yes, this is exactly what i think. If DEVICE bit is set, then it's somehow device memory and it doesn't need flashing. Or, in order to be 200% sure, we could modify the whole unmapping logic to carry over a flag, telling whether we are removing normal or HYP mappings. But wouldn't this be much more complicated? Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html