Re: [RFC v2-fix 1/1] x86/tdx: Handle in-kernel MMIO

From: Dave Hansen
Date: Tue May 18 2021 - 16:40:35 EST


On 5/18/21 1:20 PM, Andi Kleen wrote:
>
> On 5/18/2021 10:46 AM, Dave Hansen wrote:
>> On 5/18/21 10:21 AM, Andi Kleen wrote:
>>> Besides instruction decoding works fine for all the existing
>>> hypervisors. All we really want to do is to do the same thing as KVM
>>> would do.
>> Dumb question of the day: If you want to do the same thing that KVM
>> does, why don't you share more code with KVM?  Wouldn't you, for
>> instance, need to crack the same instruction opcodes?
>
> We're talking about ~60 lines of codes that calls an established
> standard library.
>
> https://github.com/intel/tdx/blob/8c20c364d1f52e432181d142054b1c2efa0ae6d3/arch/x86/kernel/tdx.c#L490
>
> You're proposing a gigantic refactoring to avoid 60 lines of straight
> forward code.
>
> That's not a practical proposal.

Hi Andi,

I'm not actually trying to propose things. I'm really just trying to
get an idea why the implementation ended up how it did. I actually
entirely respect the position that the KVM code is a monster and
shouldn't get reused. That seems totally reasonable.

What isn't reasonable is the lack of documentation of these design
decisions in the changelogs. My goal here is to raise the quality of
the changelogs so that other reviewers and maintainers don't have to ask
these questions when they perform their reviews.

This is honestly the best way I know to help get this code merged as
soon as possible. If I'm not helping, please let me know. I'm happy to
spend my time elsewhere.