From: "Huang, Kai" <kai.huang@intel.com>
To: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: "Hansen, Dave" <dave.hansen@intel.com>,
"seanjc@google.com" <seanjc@google.com>,
"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"jgross@suse.com" <jgross@suse.com>,
"Yamahata, Isaku" <isaku.yamahata@intel.com>
Subject: Re: [PATCH 1/5] x86/virt/tdx: Rename _offset to _member for TD_SYSINFO_MAP() macro
Date: Mon, 6 May 2024 11:34:21 +0000 [thread overview]
Message-ID: <9aac71bcec5956177c288e4d0d0e6427c0986877.camel@intel.com> (raw)
In-Reply-To: <ba0e8645c0a6878efbb6224bfdd8ab2cdc813542.camel@intel.com>
On Fri, 2024-05-03 at 00:07 +0000, Edgecombe, Rick P wrote:
> On Sat, 2024-03-02 at 00:20 +1300, Kai Huang wrote:
> > TD_SYSINFO_MAP() macro actually takes the member of the 'struct
> > tdx_tdmr_sysinfo' as the second argument and uses the offsetof() to
> > calculate the offset for that member.
> >
> > Rename the macro argument _offset to _member to reflect this.
>
> The KVM patches will want to use this macro. The fact that it is misnamed will
> percolate into the KVM code if it is not updated before it gets wider callers.
> (This is a reason why this is good change from KVM's perspective).
>
> See the KVM code below:
>
> #define TDX_INFO_MAP(_field_id, _member) \
> TD_SYSINFO_MAP(_field_id, struct st, _member)
>
> struct tdx_metadata_field_mapping st_fields[] = {
> TDX_INFO_MAP(NUM_CPUID_CONFIG, num_cpuid_config),
> TDX_INFO_MAP(TDCS_BASE_SIZE, tdcs_base_size),
> TDX_INFO_MAP(TDVPS_BASE_SIZE, tdvps_base_size),
> };
> #undef TDX_INFO_MAP
>
> #define TDX_INFO_MAP(_field_id, _member) \
> TD_SYSINFO_MAP(_field_id, struct tdx_info, _member)
>
> struct tdx_metadata_field_mapping fields[] = {
> TDX_INFO_MAP(FEATURES0, features0),
> TDX_INFO_MAP(ATTRS_FIXED0, attributes_fixed0),
> TDX_INFO_MAP(ATTRS_FIXED1, attributes_fixed1),
> TDX_INFO_MAP(XFAM_FIXED0, xfam_fixed0),
> TDX_INFO_MAP(XFAM_FIXED1, xfam_fixed1),
> };
> #undef TDX_INFO_MAP
I was thinking how to respond. I guess your point is we can also mention
KVM will need to use this too so it's better to change it before it gets
wider callers. But I don't think it is needed because if it is misnamed
now then we already have a justification to do it.
And technically, I don't think the argument name used in KVM actually has
anything to do with the argument name used in the TD_SYSINFO_MAP() macro
definition here. What really matters is when they get used, we need to
pass the "real struct member":
struct whatever {
u64 a;
u16 b;
};
#define TDX_INFO_MAP_WHATEVER(_field_id, _xyz) \
TD_SYSINFO_MAP(_field_id, struct whatever, _xyz)
const struct tdx_metadata_field_mapping fields[] = {
TDX_INFO_MAP_WHATEVER(_FIELD_A, a),
TDX_INFO_MAP_WHATEVER(_FIELD_B, b),
};
No?
next prev parent reply other threads:[~2024-05-06 11:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 11:20 [PATCH 0/5] TDX host: Provide TDX module metadata reading APIs Kai Huang
2024-03-01 11:20 ` [PATCH 1/5] x86/virt/tdx: Rename _offset to _member for TD_SYSINFO_MAP() macro Kai Huang
2024-05-03 0:07 ` Edgecombe, Rick P
2024-05-06 11:34 ` Huang, Kai [this message]
2024-03-01 11:20 ` [PATCH 2/5] x86/virt/tdx: Move TDMR metadata fields map table to local variable Kai Huang
2024-05-03 0:09 ` Edgecombe, Rick P
2024-05-03 0:18 ` Huang, Kai
2024-05-03 0:29 ` Edgecombe, Rick P
2024-05-03 0:54 ` Huang, Kai
2024-05-03 16:01 ` Dave Hansen
2024-05-06 8:04 ` Huang, Kai
2024-03-01 11:20 ` [PATCH 3/5] x86/virt/tdx: Unbind global metadata read with 'struct tdx_tdmr_sysinfo' Kai Huang
2024-05-03 0:12 ` Edgecombe, Rick P
2024-05-03 0:52 ` Huang, Kai
2024-05-03 19:03 ` Edgecombe, Rick P
2024-05-06 11:15 ` Huang, Kai
2024-03-01 11:20 ` [PATCH 4/5] x86/virt/tdx: Support global metadata read for all element sizes Kai Huang
2024-03-16 0:49 ` Isaku Yamahata
2024-03-20 12:24 ` Huang, Kai
2024-05-03 0:19 ` Edgecombe, Rick P
2024-05-03 1:14 ` Huang, Kai
2024-05-03 12:10 ` Huang, Kai
2024-05-03 12:26 ` Huang, Kai
2024-05-03 18:32 ` Edgecombe, Rick P
2024-05-06 10:59 ` Huang, Kai
2024-03-01 11:20 ` [PATCH 5/5] x86/virt/tdx: Export global metadata read infrastructure Kai Huang
2024-03-13 3:44 ` Xiaoyao Li
2024-03-15 0:24 ` Huang, Kai
2024-03-15 2:10 ` Xiaoyao Li
2024-05-03 0:21 ` Edgecombe, Rick P
2024-05-03 2:17 ` Huang, Kai
2024-05-03 18:31 ` Edgecombe, Rick P
2024-05-06 11:35 ` Huang, Kai
2024-05-06 15:43 ` Dave Hansen
2024-05-06 22:13 ` Huang, Kai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9aac71bcec5956177c288e4d0d0e6427c0986877.camel@intel.com \
--to=kai.huang@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=isaku.yamahata@intel.com \
--cc=jgross@suse.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®