Commit Graph
65 Commits
Author SHA1 Message Date
Denis Mukhin e2c8e9e62d xen/serial: drop stale SERIAL_NEVER_DROP_CHARS
Left over from 2754857001 ("Bring back console_start_log_everything()
as a milder alternative to"), which dropped the sole use only a few weeks
after its introduction.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2026-07-21 09:46:40 +02:00
Denis Mukhin 05edb693a2 xen/console: use bool as return value from printk_ratelimit()
{__,}printk_ratelimit() are predicates. Make that pronounced by updating the
return value to boolean.

Not a functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
2026-07-20 09:49:23 +02:00
Denis Mukhin a7fd7d4cbd xen/console: use memcpy() in console_init_ring()
Make console_init_ring() more efficient by using memcpy()'s, rather than
copying the ring a byte at a time.

No functional change intended.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
2026-07-16 09:18:43 +02:00
Denis Mukhin 185847d0b6 xen/console: promote conring{,_size} to __ro_after_init
Both conring{,_size} should be RO after initialization is completed.

Change the conring integer parameters type to `unsigned int` as required
by CODING_STYLE.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2026-07-16 09:18:26 +02:00
Denis Mukhin bf0fd17072 argo: fixup argo_dprintk()
Current argo_dprintk() implementation is a wrapper around raw printk().

Rewire it through gprintk() to allow for better debugging context
(such as domain ID).

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
2026-07-10 19:35:49 +01:00
Denis Mukhin a656d5c3a3 argo: drop argo prefix from argo_dprintk() calls
argo_dprintk() prefixes all log lines with "argo: " automatically.

Remove duplicate prefixes from log messages in the Argo module where
applicable.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
2026-07-10 19:35:49 +01:00
Denis Mukhin b66ad9b9ad argo: correct logline in ring_unmap()
Drop XENLOG_ERR from the logline since argo_dprintk() already injects
the proper log level indicator.

Also, drop "argo: " prefix, since it is also injected by argo_dprintk()

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
2026-07-10 19:35:49 +01:00
Denis Mukhin 050598c254 argo: lower level of noisy connection-refused log
Switch the log line to argo_dprintk() so it is enabled only in debug
environments, as it can spam the logs when a dom0 service using the Argo
hypercall tries to communicate with a domain that is still starting up.

Note that this also lowers the log level to debug when the argo_dprintk()
facility is enabled.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
2026-07-10 19:35:49 +01:00
Denis Mukhin 3c4e804607 argo: introduce CONFIG_ARGO_DEBUG
Add Kconfig knob to enable traces for Argo debugging.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2026-06-05 10:10:14 +02:00
Denis Mukhin 957f0f0b73 argo: fixup argo_dprintk()
Current argo_dprintk() implementation is a wrapper around raw printk().

Rewire it through gprintk() to allow for better debugging context
(such as domain ID).

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2026-06-05 10:10:04 +02:00
Denis Mukhin 2bc9bc1978 argo: drop argo prefix from argo_dprintk() calls
argo_dprintk() prefixes all log lines with "argo: " automatically.

Remove duplicate prefixes from log messages in the Argo module where
applicable.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2026-06-05 10:09:52 +02:00
Denis Mukhin 03ebee6ed8 argo: correct logline in ring_unmap()
Drop XENLOG_ERR from the logline since argo_dprintk() already injects
the proper log level indicator.

Also, drop "argo: " prefix, since it is also injected by argo_dprintk()

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2026-06-05 10:09:42 +02:00
Denis Mukhin a9720605b6 argo: lower level of noisy connection-refused log
Switch the log line to argo_dprintk() so it is enabled only in debug
environments, as it can spam the logs when a dom0 service using the Argo
hypercall tries to communicate with a domain that is still starting up.

Note that this also lowers the log level to debug when the argo_dprintk()
facility is enabled.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2026-06-05 10:09:06 +02:00
Denis Mukhin 23e2479ff9 xen/domain: introduce DOMID_ANY
Add a new symbol DOMID_ANY to improve the readability of the code.

Update all relevant domid_alloc() call sites and harden the domid_alloc()
input value check.

Also, fix problem with passing invalid domain IDs in
XEN_DOMCTL_createdomain: turns out libxl__domain_make() (toolstack)
uses 0xffff as domain ID.

Fix failing tools tests too.

Amends: 2d50650607 ("xen/domain: unify domain ID allocation")
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2026-05-19 22:29:10 -05:00
Denis Mukhin f7173bff9d xtf: fix argo test parameters
The mac-permissive= option is currently ignored because Argo configuration
parameters are comma-separated.

Fix the missing comma in the XTF test arguments.

Fixes: 150c6ef459 ("CI: add argo x86 XTF test")
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2026-02-14 01:01:33 +00:00
Denis Mukhin 49f88b1db5 xen/console: group conring code together
Groups conring buffer management code in the console driver for ease of
maintaining this code.

Not a functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2026-02-10 10:22:27 +01:00
Denis Mukhin 032ac14b05 scripts/config: hook to automation build script
Use the new .config manipulation tool to toggle CONFIG_DEBUG in the
Xen automation build script.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2026-02-04 15:44:06 -08:00
Denis Mukhin 74bcaa9283 scripts/config: add -y|-n flags
Add alias -y ("yes") to --enable and -n ("no") to --disable a Kconfig
option for better scripting experience.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2026-02-04 15:42:23 -08:00
Denis Mukhin 0081a505b3 scripts/config: drop modules support
Drop the --module (-m) and --module-after (-M) options, as Xen
does not support loadable modules, so options are not applicable.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2026-02-04 15:42:23 -08:00
Denis Mukhin 08f0b7d26e scripts/config: import Kconfig manipulation tool from Linux
Manipulating Kconfig settings is often required when preparing a custom
Xen build using an external build system (e.g., a Yocto-based workflow).

Import the Kconfig manipulation tool from the Linux kernel
(commit 0f61b1860cc3, Linux v6.19-rc5) to support this use case.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2026-02-04 15:42:22 -08:00
Denis Mukhin 3a7b635365 automation: align XTF qemu parameters across achitectures
It is handy to have 2 CPUs and more RAM for smoke testing a hypervisor
change via XTF.

Align x86 QEMU configuration with Arm for XTF tests: 2 CPU and 2G of RAM.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2026-02-04 14:35:00 -08:00
Denis Mukhin 1952fc2156 INSTALL: remove unsupported XEN_CONFIG_EXPERT from documentation
Remove XEN_CONFIG_EXPERT explanation and also correct information in
the entire "Xen Hypervisor" section.

Link: 37339ba9ef ("automation: Remove XEN_CONFIG_EXPERT leftovers")
Suggested-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2026-01-22 09:13:49 +01:00
Denis Mukhin ada5306708 xen/console: introduce domain_console struct
Introduce domain_console for grouping data structures used for integrating
domain's diagnostic console with Xen's console driver.

Group all pbuf-related data structures under domain_console. Rename the moved
fields to plain .buf, .idx and .lock names, since all uses of the fields are
touched.

Ensure accesses to domain_console pointer are valid in console_switch_input().

Bump the domain console buffer allocation size to 256. No extra symbol for the
value since it is used only once during data structure declaration. All size
checks use ARRAY_SIZE().

Allocate domain_console from the heap so that the parent domain struct size
stays below PAGE_SIZE boundary to account for more console-related fields
added in the future.

Finally, update the domain_console allocation and initialization code. Make
sure domain_console is not allocated for system domains.

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-11-26 12:06:56 +01:00
Denis Mukhin 5104e05904 xen/domain: update create_dom0() messages
Use %pd for domain identification in error/panic messages in create_dom0().

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
2025-09-04 13:37:21 -07:00
Denis Mukhin b3d31533a0 tools/tests: introduce unit tests for domain ID allocator
Introduce some basic infrastructure for doing domain ID allocation unit tests,
and add a few tests that ensure correctness of the domain ID allocator.

Use <xen-tools/bitops.h> and xen/lib/find-next-bit.c in test hardness code.

Adjust find-next-bit.c to be compiled with __XEN_TOOLS__.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
2025-09-04 13:37:18 -07:00
Denis Mukhin 2d50650607 xen/domain: unify domain ID allocation
Currently, there are two different domain ID allocation implementations:

  1) Sequential IDs allocation in dom0less Arm code based on max_init_domid;

  2) Sequential IDs allocation in XEN_DOMCTL_createdomain; does not use
     max_init_domid (both Arm and x86).

The domain ID allocation covers dom0 or late hwdom, predefined domains,
post-boot domains, excluding Xen system domains (domid >=
DOMID_FIRST_RESERVED).

It makes sense to have a common helper code for such task across architectures
(Arm and x86) and between dom0less / toolstack domU allocation.

Note, fixing dependency on max_init_domid is out of scope of this patch.

Wrap the domain ID allocation as an arch-independent function domid_alloc() in
new common/domid.c based on the bitmap.

Allocation algorithm:
- If an explicit domain ID is provided, verify its availability and use it if
  ID is not used;
- If DOMID_INVALID is provided, search the range [1..DOMID_FIRST_RESERVED-1],
  starting from the last used ID.
  Implementation guarantees that two consecutive calls will never return the
  same ID. ID#0 is reserved for the first boot domain (currently, dom0) and
  excluded from the allocation range.

Remove is_free_domid() helper as it is not needed now.

No functional change intended.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
2025-09-04 13:36:17 -07:00
Denis Mukhin b0bdfbfc88 tools/include: move xc_bitops.h to xen-tools/bitops.h
Move xc_bitops.h to common tools location to be shared between
the toolstack and unit test code.

Adjust the guard in xen-tools/bitops.h

Correct the #include directives and comments referring to the old
xc_bitops.h in the toolstack code.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
2025-09-01 13:07:01 +02:00
Denis Mukhin 8241316f49 ns16550: remove trailing whitespaces
Remove trailing whitespaces in NS16550-compatible UART driver.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-07-30 12:04:08 +02:00
Denis Mukhin 150c6ef459 CI: add argo x86 XTF test
Introduce new CI job to run x86 XTF argo test under QEMU to smoke test argo
feature functionality in upstream CI.

The new job lead time is ~30s, limit max job duration to 60s.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-25 13:17:39 -07:00
Denis Mukhin 422b6023ed xen/console: introduce CONSOLE_PREFIX
Add CONSOLE_PREFIX symbol to keep the prefix of the hypervisor's diagnostic
messages.

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-24 18:02:07 -07:00
Denis Mukhin 3491e85a15 xen/domain: fix memory leak in domain_create()
Fix potential memory leak in domain_create() in late hardware domain case.

Fixes: b959f3b820 ("xen: introduce hardware domain create flag")
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
2025-06-23 10:50:33 +02:00
Denis Mukhin 337f0ad8d4 xen/domain: rewrite emulation_flags_ok()
Rewrite emulation_flags_ok() to simplify future modifications.

No functional change intended.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2025-06-17 10:59:05 -07:00
Denis Mukhin 8dd642a479 xen/domain: fix late hwdom feature
Fix get_initial_domain_id() which returns hardware_domid and thus breaks
late hwdom feature [1].

[1] https://lore.kernel.org/xen-devel/a4c860d7-1fa0-43f4-8ae1-af59b7c6506f@xen.org/

Fixes: f147ccf2b3 ("xen/consoled: clean up console handling for PV shim")
Reported-by: Julien Grall <julien@xen.org>
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-06-12 14:45:41 +02:00
Denis Mukhin c2dddce4b9 xen/console: introduce console input permission
Add new flag to domain structure for marking permission to intercept
the physical console input by the domain.

Update console input switch logic accordingly.

No functional change intended.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-06-04 14:24:26 -07:00
Denis Mukhin c3933dbf77 xen/console: rename switch_serial_input() to console_switch_input()
Update the function name as per naming notation in the console driver.

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-06-02 12:46:50 +02:00
Denis Mukhin f6d1bfa160 xen/console: introduce conring_flush()
Introduce conring_flush() to ensure all messages kept in the internal
console ring are sent to all physical consoles (serial, VGA (x86))
after their initialization is completed.

Rename dump_console_ring_key to conring_dump_keyhandler to match the
notation for conring management symbols.

Resolves: https://gitlab.com/xen-project/xen/-/issues/184
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-05-20 18:58:45 -07:00
Denis Mukhin 77f70275fd xen/console: introduce console_send()
guest_console_write() duplicates the code from __putstr(), eliminate code
duplication.

Introduce console_send() for sending a message on console devices.

Also, introduce internal console flags to control which console devices
should be used.

No functional change intended.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-05-20 18:58:44 -07:00
Denis Mukhin f90a543bd6 xen/console: cleanup conring management
Move conring tasklet code close to conring definitions in the console driver
and rename conring tasklet variables by adding conring_ prefix for better
readability.

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-05-20 18:58:43 -07:00
Denis Mukhin 48c9e67594 x86/vmx: Update DR7 type
Use the new vmread() accessor and shrink dr7 to it's preferred size.

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-28 21:01:24 +01:00
Denis Mukhin 881e5993df x86/vmx: Introduce vmread()
The current implementation of __vmread() is void and returns the result via
pointer argument which leads to excess code in some places.

Introduce a new vmread() function, and implement __vmread() in terms of it.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-28 21:01:20 +01:00
Denis Mukhin 934fcfb17d CI: switch arm64 XTF test runner to qemu-xtf.sh
Hook arm64 QEMU configuration to qemu-xtf.sh and use new script in arm64 CI
jobs.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-04-22 13:07:13 -07:00
Denis Mukhin 23041e72d9 CI: switch x86 EFI smoke test runner to qemu-xtf.sh
Use qemu-xtf.sh for qemu-smoke-x86-64-gcc-efi job.

Lead time is reduced a bit since not all XTF code base is built, just the
required test.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-04-22 13:07:12 -07:00
Denis Mukhin a22f80e758 CI: unify x86 XTF test runner
Add test runner script qemu-xtf.sh which is allows any XTF x86 test to be
easily executed. Test runner is invoked from the qemu-smoke* jobs with the
hardcoded parameters.

Each x86 XTF job lead time is reduced a bit since only the test-related code
is built, not the entire XTF project.

Add .gitignore to avoid committing test artifacts by mistake.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-04-22 13:07:12 -07:00
Denis Mukhin b806f5fddc x86/domain: revisit logging in arch_domain_create()
Use %pd in all logs issued from arch_domain_create() and reword some of the
messages.

Also, expand error message in arch_domain_create() under !emulation_flags_ok()
case to help debugging.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-04-09 15:33:04 +02:00
Denis Mukhin fc3db01db6 x86/vmx: Rework VMX wrappers using asm goto()
Improve error handling in VMX wrappers by switching to `asm goto()` where
possible.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/210
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-07 12:55:06 +01:00
Denis Mukhin 05bf9f1f0f x86/emulate: Remove HAVE_AS_RDRAND and HAVE_AS_RDSEED
The new toolchain baseline knows the RDRAND and RDSEED instructions; no need
to carry the workaround in the code.

Fix up arch_get_random() too.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/208
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-07 12:55:06 +01:00
Denis Mukhin befc384d21 x86/emulate: Remove HAVE_AS_SSE4_2
The new toolchain baseline knows the CRC32 instructions; no need to carry the
workaround in the code.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/206
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-03 21:29:34 +01:00
Denis Mukhin 5d40380ee9 x86/asm: Remove HAVE_AS_INVPCID
The new toolchain baseline knows the INVPCID instruction; no need to carry the
workaround in the code.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/209
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-03 21:29:34 +01:00
Denis Mukhin 56ad7a3b27 x86/msr: Remove HAVE_AS_FSGSBASE
The new toolchain baseline knows the {RD,WR}{F,G}SBASE instructions; no need
to carry the workaround in the code.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/207
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-03 21:29:34 +01:00
Denis Mukhin 1f2ea165f6 x86/vmx: Remove HAVE_AS_{EPT,VMX}, GAS_VMX_OP(), etc
The new toolchain baseline knows the VMX instructions; no need to carry the
workaround in the code.

Inline __vmxoff() into it's single caller.

Updated formatting in the wrappers to consistent.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/202
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-03 21:29:34 +01:00
Denis Mukhin a48be48f0c x86/asm: remove HAVE_AS_CLAC_STAC
The new toolchain baseline knows the STAC/CLAC instructions,
no need to carry the workaround in the code.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/203
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-04-02 13:16:27 +01:00
Denis Mukhin b7234d32e3 x86/irq: introduce APIC_VECTOR_VALID()
Add new macro APIC_VECTOR_VALID() to validate the interrupt vector
range as per [1]. This macro replaces hardcoded checks against the
open-coded value 16 in LAPIC and virtual LAPIC code and simplifies
the code a bit.

[1] Intel SDM volume 3A
    Chapter "ADVANCED PROGRAMMABLE INTERRUPT CONTROLLER"
    Section "Valid Interrupt Vectors"

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2025-03-25 09:22:59 +01:00
Denis Mukhin 6cc1862f54 xen/console: fix trailing whitespaces
Remove trailing whitespaces in the console driver.

No functional change.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-03-20 08:51:14 +01:00
Denis Mukhin 3c0745196c x86/irq: use NR_ISA_IRQS instead of open-coded value
Replace the open-coded value 16 with the NR_ISA_IRQS symbol to enhance
readability.

No functional changes.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2025-03-17 16:08:26 +00:00
Denis Mukhin 29975e126d x86/irq: rename NR_ISAIRQS to NR_ISA_IRQS
Rename NR_ISAIRQS to NR_ISA_IRQS to enhance readability.

No functional changes.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-03-17 16:08:25 +00:00
Denis Mukhin e3ed540f2e x86/hvm: add HVM-specific Kconfig
Add a separate menu for configuring HVM build-time settings to better
organize HVM-specific options.

HVM options will now appear in a dedicated sub-menu in the menuconfig
tool.

Also, make AMD_SVM config dependent on AMD config and INTEL_VMX on INTEL
respectively.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-03-17 15:01:25 +00:00
Denis Mukhin ec7a279a23 docs: add explanation for 'Resolves:'
'Resolves:' tag may be used if the patch addresses one of the tickets
logged via Gitlab to auto-close such ticket when the patch got merged.

Add documentation for the tag.

Resolves: https://gitlab.com/xen-project/xen/-/issues/199
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2025-03-11 22:30:10 +00:00
Denis Mukhin f147ccf2b3 xen/consoled: clean up console handling for PV shim
There are few places which check pv_shim console under CONFIG_PV_SHIM or
CONFIG_X86 in xen console driver.

Instead of inconsistent #ifdef-ing, introduce and use consoled_is_enabled() in
switch_serial_input() and __serial_rx().

PV shim case is fixed in __serial_rx() - should be under 'pv_shim &&
pv_console' check.

Signature of consoled_guest_{rx,tx} has changed so the errors can be logged
on the callsites.

Also, move get_initial_domain_id() to arch-independent header since it is now
required by console driver.

Lastly, add missing SPDX-License-Identifier to xen/consoled.h

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-03-10 09:53:11 +01:00
Denis Mukhin 91db39013a xen/console: introduce console_{get,put}_domain()
console_input_domain() takes an RCU lock to protect domain structure.
That implies call to rcu_unlock_domain() after use.

Introduce a pair of console_get_domain() / console_put_domain() to highlight
the correct use of the call within the code interacting with Xen console
driver.

The new calls used in __serial_rx(), which also fixed console forwarding to
late hardware domains which run with domain IDs different from 0.

While moving the guest_printk() invocation also drop the redundant _G infix.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2025-03-05 15:42:49 +01:00
Denis Mukhin 1b861bd95e xen/include: introduce resource.h
Move resource definitions to a new architecture-agnostic shared header file.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-03-03 16:06:17 -08:00
Denis Mukhin 478556f8e3 xen/console: print Xen version via keyhandler
Add Xen version printout to 'h' keyhandler output.

That is useful for debugging systems that have been left intact for a long
time.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2025-02-26 12:17:01 +01:00
Denis Mukhin 8743258747 xen/console: introduce is_console_printable()
Add is_console_printable() to implement a common check for printable characters
in the UART emulation and guest logging code.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-02-25 08:42:37 +01:00
Denis Mukhin b2da4fc055 tools: fix typo in sysconfig.xencommons.in
Fixes: 7b61011e14 ("tools: make xenstore domain easy configurable")
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2025-02-11 17:09:00 +00:00
Denis Mukhin 4a06cc7178 xsm/flask: missing breaks, MISRA rule 16.4
While working on console forwarding for virtual NS8250 I stepped into
  flask_domain_alloc_security()
where break statement was missing in default case which violates MISRA
rule 16.4.

Fixed everywhere in hooks.c.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
2024-11-27 14:49:58 +00:00
Denis Mukhin 738df43521 x86/setup: fix typo in acpi=off description
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2024-11-27 11:41:16 +01:00