On Tue, Nov 23, 2010 at 09:48:58AM +0200, Avi Kivity wrote:
On 11/23/2010 09:45 AM, Gleb Natapov wrote:
Yes. We could define a set of alternate memory slots to be used when SMM is active. The mmu is already prepared (like we support vcpus with different paging modes simultaneously).
But memory slots resides below mmu. The responsible of mmu is to translate gva to gpa. After that memory slots are used to translate gpa into hva and at this point it is not per vcpu. With SMM one vcpu can generate MMIO access and another one memory access with the same gpa.
The mmu would translate gva to a (gpa, smm) pair (when tdp is enabled, translate gpa or ngpa to (gpa, smm). gfn_to_page() translates a (gpa, smm) pair to a struct page.
Actually smm is a vcpu state, so only gfn_to_pfn will have to be changed to get vcpu as a parameter (or is_smm flag, although this look like very x86ish thing for common code where gfn_to_pfn resides).