Re: [PATCHv4 05/30] x86/tdx: Extend the confidential computing API to support TDX guests

Kirill A. Shutemov
2022-02-24T23:54:06Z

On Thu, Feb 24, 2022 at 09:54:16AM -0800, Dave Hansen wrote:
>
> This left me wondering two things. First, why this bothers storing
> 'gpa_width' when it's only used to generate a mask? Why not just store
> the mask in the structure?

It was needed when tdx_shared_mask() was a thing. It takes a pair of
fresh eyes to break the inertia.

> Second, why have the global 'td_info' instead of just declaring it on
> the stack. It is only used within a single function. Having it on the
> stack is *REALLY* nice because the code ends up looking like:
>
> struct foo foo;
> get_info(&foo);
> cc_set_bar(foo.bar);
>
> The dependencies and scope are just stupidly obvious if you do that.

Okay, I will rework it with plain gpa_width on stack and get_info(&gpa_width);
Attributes will be needed after core enabling, so I will drop it from
here.

--
Kirill A. Shutemov