Re: [PATCH] x86: reduce dependencies on x86_emulate/x86_emulate.h

Andrew Cooper <[email protected]> Wed, 5 Aug 2026 11:38:53 +0100
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
On 05/08/2026 9:29 am, Jan Beulich wrote:
> Split out struct x86_event to an entirely separate header, and move a few
> other items describing the architecture to a new x86-types.h. With a few
> forward decls of structures and with a fair number of new #include-s in
> .c files, the inclusion of x86_emulate.h (and hence
> x86_emulate/x86_emulate.h) can be dropped from all header files except
> hvm/emulate.h; it needs additionally adding to hvm/ioreq.h though.
>
> Signed-off-by: Jan Beulich <[email protected]>

This looks broadly fine.

However, I don't see any hunks downgrading arch/x86/hvm/svm/vmcb.h from
x86_emulate.h to x86-types.h.  It needs struct segment_register, but
nothing else I can spot.

> --- /dev/null
> +++ b/xen/arch/x86/include/asm/x86-types.h
> @@ -0,0 +1,76 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * x86-types.h
> + *
> + * Type definitions and basic helpers which are more or less directly
> + * describing aspects of the architecture.
> + */
> +
> +#ifndef X86_X86_TYPES_H
> +#define X86_X86_TYPES_H
> +
> +#ifdef __XEN__
> +# include <xen/types.h>
> +#else
> +# include <stdint.h>
> +#endif
> +
> +/*
> + * Comprehensive enumeration of x86 segment registers.

This comment has become stale with the recent additions.  I'd be tempted
to simply drop "registers" from this sentence while you move it.

Due to the way we use these, we should even technically drop the
trailing r from gdt/ldt/idt but I suspect that is going too far.

~Andrew