[RFC PATCH 01/37] KVM: x86/mmu: Store the address space ID directly in kvm_mmu_page_role
Sean Christopherson
seanjc at google.com
Mon Dec 12 17:42:10 PST 2022
On Mon, Dec 12, 2022, Paolo Bonzini wrote:
> On 12/12/22 18:39, Sean Christopherson wrote:
> > My preference would be to leave .smm in x86's page role
>
> What about defining a byte of arch_role and a macro to build it?
I think David already carved out a big chunk for arch role bits, my objection
was purely to making as_id a generic 8-bit role.
> > Unless I'm missing something, e.g. a need to map GPAs differently for
> > SMM vs. non-SMM, SMM could have been implemented with a simple flag
> > in a memslot to mark the memslot as SMM-only.
>
> Unfortunately not, because there can be another region (for example video
> RAM at 0A0000h) underneath SMRAM.
Ugh, it's even a very explicitly documented "feature".
When compatible SMM space is enabled, SMM-mode CBO accesses to this range route
to physical system DRAM at 00_000A_0h – 00_000B_FFFFh.
Non-SMM mode CBO accesses to this range are considered to be to the Video Buffer
Area as described above. PCI Express* and DMI originated cycles to SMM space are not
supported and are considered to be to the Video Buffer Area.
I also forgot KVM supports SMBASE relocation :-(
> In fact, KVM_MEM_X86_SMRAM was the first idea. It was uglier than multiple
> address spaces (https://lore.kernel.org/lkml/1431084034-8425-1-git-send-email-pbonzini@redhat.com).
> In retrospect there were probably ways to mix the best of the two designs,
> but it wasn't generic enough.
>
> > And separate address spaces become truly nasty if the CPU can access multiple
> > protected regions, e.g. if the CPU can access type X and type Y at the same time,
> > then there would need to be memslots for "regular", X, Y, and X+Y.
>
> Without a usecase that's hard to say. It's just as possible that there
> would be a natural hierarchy of levels.
Ah, true.
More information about the linux-riscv
mailing list