On 5/17/21 5:48 PM, Kuppuswamy Sathyanarayanan wrote:
From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>Why is it not possible?
In traditional VMs, MMIO tends to be implemented by giving a
guest access to a mapping which will cause a VMEXIT on access.
That's not possible in TDX guest.
For now we only handle a subset of instructions that the kernelHow do you know which instructions the kernel uses?
uses for MMIO operations. User-space access triggers SIGBUS.
How do you know
that the compiler won't change them?
That sounds like something objective we can measure. Does this cost 1
byte of extra text per readl/writel? 10? 100?
I thought there were more than a few ways that userspace could get
access to MMIO mappings.
Yes rate limiting makes sense.+ if (user_mode(regs)) {extra space ^
+ pr_err("Unexpected user-mode MMIO access.\n");
+ force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *) ve->gla);
Is a non-ratelimited pr_err() appropriate here? I guess there shouldn't
be any MMIO passthrough to userspace on these systems.