[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <690236e95d6f7_20bb41100aa@iweiny-mobl.notmuch>
Date: Wed, 29 Oct 2025 10:46:49 -0500
From: Ira Weiny <ira.weiny@...el.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>, Sagi Shahar <sagis@...gle.com>
CC: <linux-kselftest@...r.kernel.org>, Paolo Bonzini <pbonzini@...hat.com>,
	Shuah Khan <shuah@...nel.org>, Sean Christopherson <seanjc@...gle.com>,
	Ackerley Tng <ackerleytng@...gle.com>, Ryan Afranji <afranji@...gle.com>,
	Andrew Jones <ajones@...tanamicro.com>, Isaku Yamahata
	<isaku.yamahata@...el.com>, Erdem Aktas <erdemaktas@...gle.com>, "Rick
 Edgecombe" <rick.p.edgecombe@...el.com>, Roger Wang <runanwang@...gle.com>,
	Oliver Upton <oliver.upton@...ux.dev>, "Pratik R. Sampat"
	<pratikrajesh.sampat@....com>, Reinette Chatre <reinette.chatre@...el.com>,
	Ira Weiny <ira.weiny@...el.com>, Chao Gao <chao.gao@...el.com>, Chenyi Qiang
	<chenyi.qiang@...el.com>, <linux-kernel@...r.kernel.org>,
	<kvm@...r.kernel.org>
Subject: Re: [PATCH v12 07/23] KVM: selftests: Add kbuild definitons
Binbin Wu wrote:
> 
> 
> On 10/29/2025 5:20 AM, Sagi Shahar wrote:
> > Add kbuild.h that can be used by files under tools/
> >
> > Definitions are taken from the original definitions at
> > include/linux/kbuild.h
> >
> > This is needed to expose values from c code to assembly code.
> >
> > Signed-off-by: Sagi Shahar <sagis@...gle.com>
> > ---
> >   tools/include/linux/kbuild.h | 18 ++++++++++++++++++
> >   1 file changed, 18 insertions(+)
> >   create mode 100644 tools/include/linux/kbuild.h
> >
> > diff --git a/tools/include/linux/kbuild.h b/tools/include/linux/kbuild.h
> > new file mode 100644
> > index 000000000000..62e20ba9380e
> > --- /dev/null
> > +++ b/tools/include/linux/kbuild.h
> > @@ -0,0 +1,18 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef __TOOLS_LINUX_KBUILD_H
> > +#define __TOOLS_LINUX_KBUILD_H
> > +
> > +#include <stddef.h>
> 
> This is not in kernel's version.
> Instead, consumers of kbuild.h include the necessary header.
> 
> Maybe it can follow kernel's style?
Is there a need to not include what is needed?  Generally that is a good
idea unless the header file dependencies cause some build slowdowns.  I
don't think that is the case here.
Ira
> 
> > +
> > +#define DEFINE(sym, val) \
> > +	asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
> > +
> > +#define BLANK() asm volatile("\n.ascii \"->\"" : : )
> > +
> > +#define OFFSET(sym, str, mem) \
> > +	DEFINE(sym, offsetof(struct str, mem))
> > +
> > +#define COMMENT(x) \
> > +	asm volatile("\n.ascii \"->#" x "\"")
> > +
> > +#endif /* __TOOLS_LINUX_KBUILD_H */
> 
Powered by blists - more mailing lists
 
