]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/log
people/aperard/xen-unstable.git
9 months agox86/traps: address violations of MISRA C Rule 16.3
Federico Serafini [Tue, 30 Jul 2024 09:53:06 +0000 (11:53 +0200)]
x86/traps: address violations of MISRA C Rule 16.3

Add break or pseudo keyword fallthrough to address violations of
MISRA C Rule 16.3: "An unconditional `break' statement shall terminate
every switch-clause".

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/vpmu: address violations of MISRA C Rule 16.3
Federico Serafini [Tue, 30 Jul 2024 09:52:47 +0000 (11:52 +0200)]
x86/vpmu: address violations of MISRA C Rule 16.3

Add missing break statements to address violations of MISRA C Rule
16.3: "An unconditional `break' statement shall terminate every
switch-clause".

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agoautomation/eclair: fix deviation of MISRA C Rule 16.3
Federico Serafini [Tue, 30 Jul 2024 09:52:31 +0000 (11:52 +0200)]
automation/eclair: fix deviation of MISRA C Rule 16.3

Add missing escape for the final dot of the fallthrough comment,
extend the search of a fallthrough comment up to 2 lines after the last
statement and improve the text of the justification.

Fixes: a128d8da91 ("automation/eclair: add deviations for MISRA C:2012 Rule 16.3")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
9 months agoxen/cpupools: silence maybe-unitialized warning
Stewart Hildebrand [Tue, 30 Jul 2024 09:52:03 +0000 (11:52 +0200)]
xen/cpupools: silence maybe-unitialized warning

When building with gcc with -finstrument-functions, optimization level
-O1, CONFIG_HYPFS=y and # CONFIG_HAS_SCHED_GRANULARITY is not set, the
the following build warning (error) is encountered:

common/sched/cpupool.c: In function ‘cpupool_gran_write’:
common/sched/cpupool.c:1220:26: error: ‘gran’ may be used uninitialized [-Werror=maybe-uninitialized]
 1220 |                      0 : cpupool_check_granularity(gran);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/sched/cpupool.c:1207:21: note: ‘gran’ declared here
 1207 |     enum sched_gran gran;
      |                     ^~~~

This is a false positive. Silence the warning (error) by initializing
the variable.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
9 months agox86/viridian: Clarify some viridian logging strings
Alejandro Vallejo [Tue, 30 Jul 2024 09:51:23 +0000 (11:51 +0200)]
x86/viridian: Clarify some viridian logging strings

It's sadically misleading to show an error without letters and expect
the dmesg reader to understand it's in hex. The patch adds a 0x prefix
to all hex numbers that don't already have it.

On the one instance in which a boolean is printed as an integer, print
it as a decimal integer instead so it's 0/1 in the common case and not
misleading if it's ever not just that due to a bug.

While at it, rename VIRIDIAN CRASH to VIRIDIAN GUEST_CRASH. Every member
of a support team that looks at the message systematically believes
"viridian" crashed, which is absolutely not what goes on. It's the guest
asking the hypervisor for a sudden shutdown because it crashed, and
stating why.

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Reviewed-by: Paul Durrant <paul@xen.org>
9 months agoCHANGELOG.md: Finalize changes in 4.19 release cycle
Oleksii Kurochko [Mon, 29 Jul 2024 11:52:36 +0000 (13:52 +0200)]
CHANGELOG.md: Finalize changes in 4.19 release cycle

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agohvmloader: Use fastcall everywhere
Andrew Cooper [Thu, 9 May 2024 17:52:59 +0000 (18:52 +0100)]
hvmloader: Use fastcall everywhere

HVMLoader is a single freestanding 32bit program with no external
dependencies.  Use the fastcall calling convetion (up to 3 parameters in
registers) globally, which is more efficient than passing all parameters on
the stack.

Some bloat-o-meter highlights are:

  add/remove: 0/0 grow/shrink: 3/118 up/down: 8/-3004 (-2996)
  Function                                     old     new   delta
  ...
  hvmloader_acpi_build_tables                 1125     961    -164
  acpi_build_tables                           1277    1081    -196
  pci_setup                                   4756    4516    -240
  construct_secondary_tables                  1689    1447    -242

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/APIC: Rewrite apic_isr_read() to match apic_{tmr,irr}_read()
Andrew Cooper [Tue, 23 Jul 2024 19:21:02 +0000 (20:21 +0100)]
x86/APIC: Rewrite apic_isr_read() to match apic_{tmr,irr}_read()

This allows for marginally better code generation including the use of BT
rather than SHR/TEST.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/APIC: Change APIC reg types to unsigned int
Andrew Cooper [Tue, 23 Jul 2024 19:28:24 +0000 (20:28 +0100)]
x86/APIC: Change APIC reg types to unsigned int

They're all within a 12 bit range of their respective bases, and this prevents
all the x2APIC MSR addresses being calculated in %rcx.

Also swap two u32's for uint32_t.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/IO-APIC: Improve APIC_TMR accesses
Andrew Cooper [Tue, 23 Jul 2024 16:32:26 +0000 (17:32 +0100)]
x86/IO-APIC: Improve APIC_TMR accesses

XenServer's instance of Coverity complains of OVERFLOW_BEFORE_WIDEN in
mask_and_ack_level_ioapic_irq(), which is ultimately because of v being
unsigned long, and (1U << ...) being 32 bits.

The reasoning isn't correct.  (1U << (x & 0x1f)) can't overflow, but the
complaint is really about having to expand the RHS.  While this can be fixed
by changing v to be unsigned int, take the opportunity to do better still.

Introduce a apic_tmr_read() helper like we already have for ISR and IRR, and
use it to remove the opencoded logic.  Introduce an is_level boolean to
improve the legibility of the surrounding logic.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/domctl: address a violation of MISRA C Rule 16.3
Federico Serafini [Wed, 24 Jul 2024 09:43:18 +0000 (11:43 +0200)]
x86/domctl: address a violation of MISRA C Rule 16.3

Add missing break statement to address a violation of
MISRA C Rule 16.3: "An unconditional `break' statement shall terminate
every switch-clause".

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/cpuid: use fallthrough pseudo keyword
Federico Serafini [Wed, 24 Jul 2024 09:42:53 +0000 (11:42 +0200)]
x86/cpuid: use fallthrough pseudo keyword

The current comment making explicit the fallthrough intention does
not follow the agreed syntax: replace it with the pseduo keyword.

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agoMAINTAINERS: Add me and Bertrand as device tree maintainers
Michal Orzel [Wed, 24 Jul 2024 09:38:13 +0000 (11:38 +0200)]
MAINTAINERS: Add me and Bertrand as device tree maintainers

With Arm port being the major recipient of dt related patches and the
future need of incorporating dt support into other ports, we'd like to
keep an eye on these changes.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
9 months agox86/p2m: guard altp2m routines
Sergiy Kibrik [Wed, 24 Jul 2024 09:37:34 +0000 (11:37 +0200)]
x86/p2m: guard altp2m routines

Initialize and bring down altp2m only when it is supported by the platform,
e.g. VMX. Also guard p2m_altp2m_propagate_change().
The purpose of that is the possibility to disable altp2m support and exclude its
code from the build completely, when it's not supported by the target platform.

Here hvm_altp2m_supported() is being used to check for ALTP2M availability,
which is only defined if HVM enabled, so a stub for that routine added for
!HVM configuration as well.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/xstate: Use compression check helper in xstate_all()
Alejandro Vallejo [Wed, 24 Jul 2024 09:36:55 +0000 (11:36 +0200)]
x86/xstate: Use compression check helper in xstate_all()

Minor refactor to make xstate_all() use a helper rather than poking directly
into the XSAVE header.

No functional change

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agoxen/riscv: introduce ANDN_INSN
Oleksii Kurochko [Wed, 24 Jul 2024 09:36:21 +0000 (11:36 +0200)]
xen/riscv: introduce ANDN_INSN

RISC-V does a conditional toolchain for the Zbb extension
(xen/arch/riscv/rules.mk), but unconditionally uses the
ANDN instruction in emulate_xchg_1_2().

Fixes: 51dabd6312c ("xen/riscv: introduce cmpxchg.h")
Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Suggested-By: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agohotplug: Restore block-tap phy compatibility (again)
Jason Andryuk [Wed, 24 Jul 2024 09:36:04 +0000 (11:36 +0200)]
hotplug: Restore block-tap phy compatibility (again)

"$dev" needs to be set correctly for backendtype=phy as well as
backendtype=tap.  Move the setting into the conditional, so it can be
handled properly for each.

(dev could be captured during tap-ctl allocate for blktap module, but it
would not be set properly for the find_device case.  The backendtype=tap
case would need to be handled regardless.)

Fixes: f16ac12bd418 ("hotplug: Restore block-tap phy compatibility")
Fixes: 76a484193dbb ("hotplug: Update block-tap")
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
9 months agotools/libxs: Stop playing with SIGPIPE
Andrew Cooper [Fri, 28 Jun 2024 15:33:56 +0000 (16:33 +0100)]
tools/libxs: Stop playing with SIGPIPE

It's very rude for a library to play with signals behind the back of the
application, no matter ones views on the default behaviour of SIGPIPE under
POSIX.  Even if the application doesn't care about the xenstored socket, it my
care about others.

This logic has existed since xenstore/xenstored was originally added in commit
29c9e570b1ed ("Add xenstore daemon and library") in 2005.

It's also unnecessary.  Pass MSG_NOSIGNAL when talking to xenstored over a
pipe (to avoid sucumbing to SIGPIPE if xenstored has crashed), and forgo any
playing with the signal disposition.

This has a side benefit of saving 2 syscalls per xenstore request.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
9 months agotools/libxs: Use writev()/sendmsg() instead of write()
Andrew Cooper [Thu, 18 Jul 2024 11:55:48 +0000 (12:55 +0100)]
tools/libxs: Use writev()/sendmsg() instead of write()

With the input data now conveniently arranged, use writev()/sendmsg() instead
of decomposing it into write() calls.

This causes all requests to be submitted with a single system call, rather
than at least two.  While in principle short writes can occur, the chances of
it happening are slim given that most xenbus comms are only a handful of
bytes.

Nevertheless, provide {writev,sendmsg}_exact() wrappers which take care of
resubmitting on EINTR or short write.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
9 months agotools/libxs: Track whether we're using a socket or file
Andrew Cooper [Fri, 28 Jun 2024 18:40:27 +0000 (19:40 +0100)]
tools/libxs: Track whether we're using a socket or file

It will determine whether to use writev() or sendmsg().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
9 months agotools/libxs: Rationalise the definition of struct xs_handle
Andrew Cooper [Thu, 18 Jul 2024 11:03:03 +0000 (12:03 +0100)]
tools/libxs: Rationalise the definition of struct xs_handle

Right now there are two completely different struct xs_handle definitions,
depend on #ifdef USE_PTHREAD.  One is quite well hidden, and often escapes
updates.

Rework struct xs_handle using some interior ifdefary.  It's slightly longer,
but much easier to follow.  Importanly, this makes it much harder to forget
the !PTHREAD case when adding a "common" variable.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
9 months agotools/libxs: Rework xs_talkv() to take xsd_sockmsg within the iovec
Andrew Cooper [Thu, 18 Jul 2024 09:13:04 +0000 (10:13 +0100)]
tools/libxs: Rework xs_talkv() to take xsd_sockmsg within the iovec

We would like to writev() the whole outgoing message, but this is hard given
the current need to prepend the locally-constructed xsd_sockmsg.

Instead, have the caller provide xsd_sockmsg in iovec[0].  This in turn drops
the 't' and 'type' parameters from xs_talkv().

Note that xs_talkv() may alter the iovec structure.  This may happen when
writev() is really used under the covers, and it's preferable to having the
lower levels need to duplicate the iovec to edit it upon encountering a short
write.  xs_directory_part() is the only function impacted by this, and it's
easy to rearrange to be compatible.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
9 months agotools/libxs: Fix length check in xs_talkv()
Andrew Cooper [Thu, 18 Jul 2024 09:23:00 +0000 (10:23 +0100)]
tools/libxs: Fix length check in xs_talkv()

If the sum of iov element lengths overflows, the XENSTORE_PAYLOAD_MAX can
pass, after which we'll write 4G of data with a good-looking length field, and
the remainder of the payload will be interpreted as subsequent commands.

Check each iov element length for XENSTORE_PAYLOAD_MAX before accmulating it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
9 months agox86/mctelem: address violations of MISRA C: 2012 Rule 5.3
Alessandro Zucchelli [Tue, 23 Jul 2024 12:00:46 +0000 (14:00 +0200)]
x86/mctelem: address violations of MISRA C: 2012 Rule 5.3

This addresses violations of MISRA C:2012 Rule 5.3 which states as
following: An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope.

In this case the variable being shadowed is the file scope struct mctctl
in this file, therefore the local variables are renamed to avoid this.

No functional change.

Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agocommon/softirq: address violation of MISRA C Rule 13.6
Alessandro Zucchelli [Tue, 23 Jul 2024 12:00:27 +0000 (14:00 +0200)]
common/softirq: address violation of MISRA C Rule 13.6

In the file common/softirq macro set_bit is called with argument
smp_processor_id.
Once expanded this set_bit's argument is used in sizeof operations
and thus 'smp_processor_id', being a macro that may expand to a
function call with potential side effects, generates a violation.

To address this violation the value of smp_processor_id is therefore
stored in a variable called 'cpu' before passing it to macro set_bit.

No functional change.

Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
9 months agox86/altcall: fix clang code-gen when using altcall in loop constructs
Roger Pau Monné [Tue, 23 Jul 2024 11:59:30 +0000 (13:59 +0200)]
x86/altcall: fix clang code-gen when using altcall in loop constructs

Yet another clang code generation issue when using altcalls.

The issue this time is with using loop constructs around alternative_{,v}call
instances using parameter types smaller than the register size.

Given the following example code:

static void bar(bool b)
{
    unsigned int i;

    for ( i = 0; i < 10; i++ )
    {
        int ret_;
        register union {
            bool e;
            unsigned long r;
        } di asm("rdi") = { .e = b };
        register unsigned long si asm("rsi");
        register unsigned long dx asm("rdx");
        register unsigned long cx asm("rcx");
        register unsigned long r8 asm("r8");
        register unsigned long r9 asm("r9");
        register unsigned long r10 asm("r10");
        register unsigned long r11 asm("r11");

        asm volatile ( "call %c[addr]"
                       : "+r" (di), "=r" (si), "=r" (dx),
                         "=r" (cx), "=r" (r8), "=r" (r9),
                         "=r" (r10), "=r" (r11), "=a" (ret_)
                       : [addr] "i" (&(func)), "g" (func)
                       : "memory" );
    }
}

See: https://godbolt.org/z/qvxMGd84q

Clang will generate machine code that only resets the low 8 bits of %rdi
between loop calls, leaving the rest of the register possibly containing
garbage from the use of %rdi inside the called function.  Note also that clang
doesn't truncate the input parameters at the callee, thus breaking the psABI.

Fix this by turning the `e` element in the anonymous union into an array that
consumes the same space as an unsigned long, as this forces clang to reset the
whole %rdi register instead of just the low 8 bits.

Fixes: 2ce562b2a413 ('x86/altcall: use a union as register type for function parameters on clang')
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
9 months agoxen/list: add LIST_HEAD_RO_AFTER_INIT
Marek Marczykowski-Górecki [Tue, 23 Jul 2024 11:59:12 +0000 (13:59 +0200)]
xen/list: add LIST_HEAD_RO_AFTER_INIT

Similar to LIST_HEAD_READ_MOSTLY.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agoAdd tools/fuzz/oss-fuzz/build.sh
Tamas K Lengyel [Tue, 23 Jul 2024 11:58:54 +0000 (13:58 +0200)]
Add tools/fuzz/oss-fuzz/build.sh

The build integration script for oss-fuzz targets. Future fuzzing targets can
be added to this script and those targets will be automatically picked up by
oss-fuzz without having to open separate PRs on the oss-fuzz repo.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agoAdd libfuzzer target to fuzz/x86_instruction_emulator
Tamas K Lengyel [Tue, 23 Jul 2024 11:58:07 +0000 (13:58 +0200)]
Add libfuzzer target to fuzz/x86_instruction_emulator

This target enables integration into oss-fuzz. Changing invalid input return
to -1 as values other then 0/-1 are reserved by libfuzzer. Also adding the
missing __wrap_vsnprintf wrapper which is required for successful oss-fuzz
build.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agoautomation: adjust paths to docker files in documentation
Olaf Hering [Wed, 17 Jul 2024 10:12:32 +0000 (12:12 +0200)]
automation: adjust paths to docker files in documentation

Use new location of dockerfiles.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
9 months agox86/mm: Move base_disallow_mask into __ro_after_init
Andrew Cooper [Thu, 28 Apr 2022 17:00:41 +0000 (18:00 +0100)]
x86/mm: Move base_disallow_mask into __ro_after_init

base_disallow_mask is calculated once in arch_init_memory() and doesn't change
thereafter.  Write-protect it at runtime.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/mm: Drop duplicate l1_disallow_mask() calls
Andrew Cooper [Thu, 28 Apr 2022 17:09:39 +0000 (18:09 +0100)]
x86/mm: Drop duplicate l1_disallow_mask() calls

Even in release builds where the message is omitted, gdprintk() evalues its
parameters for side effects, and l1_disallow_mask() is full of them.

Calculate the disallow mask once and reuse the variable, resulting in better
code generation:

  add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-207 (-207)
  Function                                     old     new   delta
  mod_l1_entry                                1947    1860     -87
  get_page_from_l1e                           1391    1271    -120

Also, render the bad flags message with a 0x prefix.

No practical change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agodocs: Fix install-man$(1)-pages if no manpages are generated
Andrew Cooper [Sat, 13 Jul 2024 16:14:16 +0000 (17:14 +0100)]
docs: Fix install-man$(1)-pages if no manpages are generated

All tools to build manpages are optional, and if none of them happen to be
present, the intermediate working directory may not even be created.

Treat this as non-fatal, bringing the behaviour in line with install-html.
Like the html side, it needs to be not-or to avoid Make thinking the rule has
failed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
9 months agoxen: Fix the figlet banner
Andrew Cooper [Mon, 22 Jul 2024 12:42:25 +0000 (13:42 +0100)]
xen: Fix the figlet banner

4.20 is just wide enough to cause figlet to split the banner onto two lines:

   __  __
   \ \/ /___ _ __
    \  // _ \ '_ \
    /  \  __/ | | |
   /_/\_\___|_| |_|

   _  _    ____   ___                     _        _     _
  | || |  |___ \ / _ \    _   _ _ __  ___| |_ __ _| |__ | | ___
  | || |_   __) | | | |__| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
  |__   _| / __/| |_| |__| |_| | | | \__ \ || (_| | |_) | |  __/
     |_|(_)_____|\___/    \__,_|_| |_|___/\__\__,_|_.__/|_|\___|

Instruct figlet to use 100 column width, rather than 80, resulting in:

   __  __            _  _    ____   ___                     _        _     _
   \ \/ /___ _ __   | || |  |___ \ / _ \    _   _ _ __  ___| |_ __ _| |__ | | ___
    \  // _ \ '_ \  | || |_   __) | | | |__| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
    /  \  __/ | | | |__   _| / __/| |_| |__| |_| | | | \__ \ || (_| | |_) | |  __/
   /_/\_\___|_| |_|    |_|(_)_____|\___/    \__,_|_| |_|___/\__\__,_|_.__/|_|\___|

While fixing this, also fix a rendering error in the non-figlet case; while a
leading space looks better for figlet, it looks very wrong for the simple
one-line case.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agoppc/shutdown: Implement machine_{halt,restart}()
Andrew Cooper [Fri, 5 Jul 2024 17:56:48 +0000 (18:56 +0100)]
ppc/shutdown: Implement machine_{halt,restart}()

OPAL has easy APIs for shutdown/reboot, so wire them up.

Then, use machine_halt() rather than an infinite loop at the end of
start_xen().  This avoids the Qemu smoke test needing to wait for the full
timeout in order to succeed.

  (XEN) 8e011600000000c0 is the result of PTE map
  Enabled radix in LPCR
  Flushed TLB
  Hello, ppc64le!
  [    6.341897656,5] OPAL: Shutdown request type 0x0...

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Shawn Anastasio <sanastasio@raptorengineering.com>
9 months agotools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP
Matthew Barnes [Fri, 5 Jul 2024 15:05:07 +0000 (16:05 +0100)]
tools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP

xen-hvmcrash would previously save records, overwrite the instruction
pointer with a bogus value, and then restore them to crash a domain
just enough to cause the guest OS to memdump.

This approach is found to be unreliable when tested on a guest running
Windows 10 x64, with some executions doing nothing at all.

Another approach would be to trigger NMIs. This approach is found to be
unreliable when tested on Linux (Ubuntu 22.04), as Linux will ignore
NMIs if it is not configured to handle such.

Injecting a double fault abort to all vCPUs is found to be more
reliable at crashing and invoking memdumps from Windows and Linux
domains.

This patch modifies the xen-hvmcrash tool to inject #DF to all vCPUs
belonging to the specified domain, instead of overwriting RIP.

Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 months agoxen/shutdown: Fix build issue with shutdown.h on PowerPC
Andrew Cooper [Fri, 5 Jul 2024 17:59:24 +0000 (18:59 +0100)]
xen/shutdown: Fix build issue with shutdown.h on PowerPC

The use of bool needs xen/types.h, which shutdown.h picks up by chance in all
other architectures.

While fixing this, swap u8 for unsigned char in hwdom_shutdown(), and move
opt_noreboot into __ro_after_init.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agoxen/ppc: Avoid using the legacy __read_mostly/__ro_after_init definitions
Andrew Cooper [Fri, 21 Jun 2024 18:23:11 +0000 (19:23 +0100)]
xen/ppc: Avoid using the legacy __read_mostly/__ro_after_init definitions

RISC-V wants to introduce a full build of Xen without using the legacy
definitions.  PPC64 has the most minimal full build of Xen right now, so make
it compile without the legacy definitions.

Mostly this is just including xen/sections.h in a variety of common files.  In
a couple of cases, we can drop an inclusion of {xen,asm}/cache.h, but almost
all files get the definitions transitively.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agotools/libxs: Drop XSTEST
Andrew Cooper [Fri, 28 Jun 2024 14:56:39 +0000 (15:56 +0100)]
tools/libxs: Drop XSTEST

This appears to been missed from the previous attempt in 2007.

Fixes: fed194611785 ("xenstore: Remove broken and unmaintained test code")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
9 months agoRevert "Add libfuzzer target to fuzz/x86_instruction_emulator"
Jan Beulich [Mon, 22 Jul 2024 09:17:17 +0000 (11:17 +0200)]
Revert "Add libfuzzer target to fuzz/x86_instruction_emulator"

This reverts commit af67ae49ce8f7298bf52345558490013a9d044b3 for
breaking the build with at least older gcc.

9 months agox86: don't open-code [gm]fn_to_[gm]addr()
Jan Beulich [Mon, 22 Jul 2024 07:41:03 +0000 (09:41 +0200)]
x86: don't open-code [gm]fn_to_[gm]addr()

At least in pure address calculation use the intended basic construct
instead of opend-coded left-shifting by PAGE_SHIFT. Leave alone page
table entry calculations for now, as those aren't really calculating
addresses.

No functional change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 months agox86/mm: drop gfn_to_paddr()
Jan Beulich [Mon, 22 Jul 2024 07:40:24 +0000 (09:40 +0200)]
x86/mm: drop gfn_to_paddr()

This really is gfn_to_gaddr() in disguise; no need to have two variants
of the same logic.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 months agox86: drop REX64_PREFIX
Jan Beulich [Mon, 22 Jul 2024 07:39:40 +0000 (09:39 +0200)]
x86: drop REX64_PREFIX

While we didn't copy the full Linux commentary, Linux commit
7180d4fb8308 ("x86_64: Fix 64bit FXSAVE encoding") is quite explicit
about gas 2.16 supporting FXSAVEQ / FXRSTORQ. As that's presently our
minimal required version, we can drop the workaround that was needed for
yet older gas.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 months agoAdd libfuzzer target to fuzz/x86_instruction_emulator
Tamas K Lengyel [Mon, 22 Jul 2024 07:38:28 +0000 (09:38 +0200)]
Add libfuzzer target to fuzz/x86_instruction_emulator

This target enables integration into oss-fuzz. Changing invalid input return
to -1 as values other then 0/-1 are reserved by libfuzzer. Also adding the
missing __wrap_vsnprintf wrapper which is required for successful oss-fuzz
build.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agocommon/sched: address a violation of MISRA C Rule 8.7
Victor Lira [Mon, 22 Jul 2024 07:37:45 +0000 (09:37 +0200)]
common/sched: address a violation of MISRA C Rule 8.7

Rule 8.7: "Functions and objects should not be defined with external
linkage if they are referenced in only one translation unit".

This patch fixes this by adding the static specifier.
No functional changes.

Reported-by: Stewart Hildebrand stewart.hildebrand@amd.com
Signed-off-by: Victor Lira <victorm.lira@amd.com>
Acked-by: George Dunlap <george.dunlap@cloud.com>
9 months agopublic/sysctl: address violations of MISRA C: 2012 Rule 7.3
Alessandro Zucchelli [Mon, 22 Jul 2024 07:37:11 +0000 (09:37 +0200)]
public/sysctl: address violations of MISRA C: 2012 Rule 7.3

This addresses violations of MISRA C:2012 Rule 7.3 which states as
following: The lowercase character `l' shall not be used in a literal
suffix.

Changed moreover suffixes 'u' in 'U' for better readability next to
the 'L's.

No functional change.

Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 months agox86/cpufreq: clean up stale powernow_cpufreq_init()
Sergiy Kibrik [Mon, 22 Jul 2024 07:36:35 +0000 (09:36 +0200)]
x86/cpufreq: clean up stale powernow_cpufreq_init()

Remove useless declaration, eliminating a MISRA C:2012 Rule 8.6
violation: The routine itself was removed by following commit long time
ago:

   222013114 x86: Fix RevF detection in powernow.c

No functional change.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 months agoSUPPORT.md: update Xen version
Juergen Gross [Mon, 22 Jul 2024 07:36:21 +0000 (09:36 +0200)]
SUPPORT.md: update Xen version

Update the Xen version to 4.20

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
9 months agoMAINTAINERS: drop CPU POOLS section
Juergen Gross [Mon, 22 Jul 2024 07:36:09 +0000 (09:36 +0200)]
MAINTAINERS: drop CPU POOLS section

The CPU POOLS sections in MAINTAINERS can be dropped, as the SCHEDULING
section has the same maintainers and it is covering the CPU POOLS files
as well.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 months agoMAINTAINERS: drop separate x86/mm section
Jan Beulich [Mon, 22 Jul 2024 07:35:42 +0000 (09:35 +0200)]
MAINTAINERS: drop separate x86/mm section

Let the subtree fall under general x86 maintainership instead, then also
properly reflecting Roger's role there.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
9 months agoxen/Makefile: Correct XEN_EXTERVERSION for unstable
Julien Grall [Fri, 19 Jul 2024 11:34:24 +0000 (12:34 +0100)]
xen/Makefile: Correct XEN_EXTERVERSION for unstable

Signed-off-by: Julien Grall <jgrall@amazon.com>
9 months agoCHANGELOG.md: Start new 4.20.0 section
Julien Grall [Thu, 18 Jul 2024 15:51:02 +0000 (16:51 +0100)]
CHANGELOG.md: Start new 4.20.0 section

Signed-off-by: Julien Grall <julien@xen.org>
9 months agoCHANGELOG.md: Set release date for 4.19
Julien Grall [Thu, 18 Jul 2024 15:48:06 +0000 (16:48 +0100)]
CHANGELOG.md: Set release date for 4.19

Signed-off-by: Julien Grall <jgrall@amazon.com>
9 months agoRe-run ./autogens.h for 4.20
Julien Grall [Thu, 18 Jul 2024 15:00:47 +0000 (16:00 +0100)]
Re-run ./autogens.h for 4.20

Signed-off-by: Julien Grall <julien@xen.org>
9 months agoSet version to 4.20; 4.19 has branched
Julien Grall [Thu, 18 Jul 2024 14:42:58 +0000 (15:42 +0100)]
Set version to 4.20; 4.19 has branched

Signed-off-by: Julien Grall <julien@xen.org>
9 months agoRevert "Config.mk pin QEMU_UPSTREAM_REVISION (prep for Xen 4.19 RC1)"
Julien Grall [Thu, 18 Jul 2024 14:40:44 +0000 (15:40 +0100)]
Revert "Config.mk pin QEMU_UPSTREAM_REVISION (prep for Xen 4.19 RC1)"

The branch is unstable again.

This reverts commit 7584e39986ef2cb4816892ffaefb26f4ad063468.

9 months agox86/IRQ: avoid double unlock in map_domain_pirq()
Jan Beulich [Tue, 16 Jul 2024 12:09:14 +0000 (14:09 +0200)]
x86/IRQ: avoid double unlock in map_domain_pirq()

Forever since its introduction the main loop in the function dealing
with multi-vector MSI had error exit points ("break") with different
properties: In one case no IRQ descriptor lock is being held.
Nevertheless the subsequent error cleanup path assumed such a lock would
uniformly need releasing. Identify the case by setting "desc" to NULL,
thus allowing the unlock to be skipped as necessary.

This is CVE-2024-31143 / XSA-458.

Coverity ID: 1605298
Fixes: d1b6d0a02489 ("x86: enable multi-vector MSI")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
9 months agoCI: Add Ubuntu 22.04 (Jammy) and 24.04 (Noble) testing
Andrew Cooper [Thu, 11 Jul 2024 15:09:58 +0000 (16:09 +0100)]
CI: Add Ubuntu 22.04 (Jammy) and 24.04 (Noble) testing

The containers are exactly as per 20.04 (Focal).  However, this now brings us
to 5 releases * 4 build jobs worth of Ubuntu testing, which is overkill.

The oldest and newest toolchains are the most likely to find problems with new
code, so reduce the middle 3 releases (18/20/22) to just a single smoke test
each.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Refresh Ubuntu Focal container as 20.04-x86_64
Andrew Cooper [Thu, 11 Jul 2024 15:09:22 +0000 (16:09 +0100)]
CI: Refresh Ubuntu Focal container as 20.04-x86_64

As with 16.04 (Xenial), with python3-setuptools included.  Having this package
only in some containers was intentional; see commit bbc72a7877d8 ("automation:
Add python3's setuptools to some containers") for the rational.

This saves ~500M:

  registry.gitlab.com/xen-project/xen/ubuntu    20.04-x86_64           1.06GB
  registry.gitlab.com/xen-project/xen/ubuntu    focal                  1.57GB

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Refresh Ubuntu Bionic container as 18.04-x86_64
Andrew Cooper [Thu, 11 Jul 2024 15:08:39 +0000 (16:08 +0100)]
CI: Refresh Ubuntu Bionic container as 18.04-x86_64

As with 16.04 (Xenial), except that ninja-build package is available so QEMU
can be built.

This halves the size of the container:

  registry.gitlab.com/xen-project/xen/ubuntu    18.04-x86_64           857MB
  registry.gitlab.com/xen-project/xen/ubuntu    bionic                 1.44GB

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Refresh Ubuntu Xenial container as 16.04-x86_64
Andrew Cooper [Thu, 11 Jul 2024 15:08:24 +0000 (16:08 +0100)]
CI: Refresh Ubuntu Xenial container as 16.04-x86_64

Rework the container to be non-root, use heredocs for legibility, and use
apt-get --no-install-recommends to keep the size down.

Ubuntu Xenial has no ninja-build package, so can't build the QEMU referenced
by Xen 4.16.  Therefore, drop the dependencies too.

This saves ~500M:

  registry.gitlab.com/xen-project/xen/ubuntu    16.04-x86_64           698MB
  registry.gitlab.com/xen-project/xen/ubuntu    xenial                 1.21GB

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Refresh OpenSUSE Leap container
Andrew Cooper [Wed, 10 Jul 2024 13:37:53 +0000 (14:37 +0100)]
CI: Refresh OpenSUSE Leap container

See prior patch for most discussion.

Despite appearing to be a fixed release (and therefore not marked as permitted
failure), the dockerfile references the `leap` tag which is rolling in
practice.  Switch to 15.6 explicitly, for better test stability.

Vs tumbleweed, use `zypper update` rather than dist-upgrade, and retain the
RomBIOS dependencies; bin86 and dev86.

In terms of size, this saves ~700M:

  registry.gitlab.com/xen-project/xen/opensuse  leap-15.6-x86_64       1.33GB
  registry.gitlab.com/xen-project/xen/suse      opensuse-leap          2.05GB

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Refresh OpenSUSE Tumbleweed container
Andrew Cooper [Wed, 10 Jul 2024 13:40:23 +0000 (14:40 +0100)]
CI: Refresh OpenSUSE Tumbleweed container

Existing as suse:opensuse-tumbleweed is a historical quirk, and adjusted for
consistency with all the other containers.

Make it non-root, use heredocs for legibility, and use the zypper long names
for the benefit of those wondering what was being referenced or duplicated.

Trim the dependencies substantially.  Testing docs isn't very interesting and
saves a lot of space.  Other savings come from removing a huge pile of
optional QEMU dependencies (QEMU just needs to build the Xen parts to be
useful here, not have a full GUI environment).

Finally, there where some packages such as bc, libssh2-devel, libtasn1-devel
and nasm that I'm not aware of any reason to have had, even historically.

This shaves 1G off the size of the container:

  registry.gitlab.com/xen-project/xen/opensuse  tumbleweed-x86_64      1.39GB
  registry.gitlab.com/xen-project/xen/suse      opensuse-tumbleweed    2.35GB

Furthermore, identify which components of the build use which dependencies,
which will help managing them in the future.

Thanks to Olaf Hering for dependency fixes that have been subsumed into this
total overhaul.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Refresh and upgrade the GCC-IBT container
Andrew Cooper [Tue, 9 Jul 2024 14:54:52 +0000 (15:54 +0100)]
CI: Refresh and upgrade the GCC-IBT container

Upgrade from Debian buster to bookworm, GCC 11.3 to 11.4 and to be a non-root
container.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Swap to debian for riscv64 build and test
Andrew Cooper [Tue, 9 Jul 2024 14:23:19 +0000 (15:23 +0100)]
CI: Swap to debian for riscv64 build and test

The containers are both much smaller, with stable toolchains over time, and
this at least means we're not doing all testing with a single compiler.

Rename the jobs to follow to sort coherently ($DISTRO-$VERSION-$ARCH-*) and
reposition the jobs to optimise starting the smoke test.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
9 months agoCI: Introduce debian:11/12-riscv64 containers
Andrew Cooper [Tue, 9 Jul 2024 14:10:07 +0000 (15:10 +0100)]
CI: Introduce debian:11/12-riscv64 containers

For starters, they're slightly smaller:

  $ docker image list <snip>
  registry.gitlab.com/xen-project/xen/debian      12-riscv64         772MB
  registry.gitlab.com/xen-project/xen/debian      11-riscv64         422MB
  registry.gitlab.com/xen-project/xen/archlinux   current-riscv64    2.32GB

They also not rolling distros, so will be more predicatable testing for the
stable trees in the future.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Refresh bullseye-ppc64le as debian:11-ppc64le
Andrew Cooper [Mon, 8 Jul 2024 17:18:22 +0000 (18:18 +0100)]
CI: Refresh bullseye-ppc64le as debian:11-ppc64le

... in the style of debian:12-ppc64le.

Rename the jobs and reposition them later as they're not a dependency for the
smoke testing any more.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Use debian:12-ppc64le for smoke testing
Andrew Cooper [Mon, 8 Jul 2024 17:17:25 +0000 (18:17 +0100)]
CI: Use debian:12-ppc64le for smoke testing

qemu-system-ppc64/8.1.0-ppc64 was added because bullseye's QEMU didn't
understand the powernv9 machine.  However bookworm's QEMU does and this is
preferable to maintaining a random build of QEMU ourselves.

Use the debian:12-ppc64le container and test the output of that build too.

Remove qemu-system-ppc64-8.1.0-ppc64-export which is unused now.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Introduce a debian:12-ppc64le container
Andrew Cooper [Mon, 8 Jul 2024 17:00:21 +0000 (18:00 +0100)]
CI: Introduce a debian:12-ppc64le container

... conforming to the new naming scheme; $DISTRO-$VERSION-$ARCH-* so the jobs
sort more coherently.

Make it non-root by default, and set XEN_TARGET_ARCH=ppc64.  Include QEMU too,
which will be used subsequently.

Add build jobs too, with debian-12-ppc64le-gcc-debug specifically early as it
will be used for smoke testing shortly.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Mark Archlinux/x86 as allowing failures
Andrew Cooper [Wed, 10 Jul 2024 12:38:52 +0000 (13:38 +0100)]
CI: Mark Archlinux/x86 as allowing failures

Archlinux is a rolling distro.  As a consequence, rebuilding the container
periodically changes the toolchain, and this affects all stable branches in
one go.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Drop Ubuntu Trusty testing
Andrew Cooper [Wed, 10 Jul 2024 00:01:13 +0000 (01:01 +0100)]
CI: Drop Ubuntu Trusty testing

This is also End of Life.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Drop Debian Stretch testing
Andrew Cooper [Tue, 9 Jul 2024 23:26:56 +0000 (00:26 +0100)]
CI: Drop Debian Stretch testing

Debian stretch is also End of Life.  Update a couple of test steps to use
bookworm instead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Drop Debian Jessie dockerfiles
Andrew Cooper [Tue, 9 Jul 2024 23:02:47 +0000 (00:02 +0100)]
CI: Drop Debian Jessie dockerfiles

These were removed from testing in Xen 4.18.

Fixes: 3817e3c1b4b8 ("automation: Remove testing on Debian Jessie")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Remove useless/misleading randconfig jobs
Andrew Cooper [Wed, 10 Jul 2024 23:38:58 +0000 (00:38 +0100)]
CI: Remove useless/misleading randconfig jobs

Randconfig builds pick CONFIG_DEBUG with 50% probability.  Therefore
$foo{,-debug}-randconfig are just two equivalent jobs with misleading names.

Furthermore, arm64 has randconfig jobs for both Alpine and Bookworm; Both
environments use GCC 12.2, so we have 4 equivalent jobs.  Delete 3 of them.

This leaves us with 4 primary randconfig jobs:

  gitlab-ci/build.yaml:381:debian-bookworm-gcc-arm32-randconfig:
  gitlab-ci/build.yaml:429:alpine-3.18-gcc-arm64-randconfig:
  gitlab-ci/build.yaml:495:archlinux-current-gcc-riscv64-randconfig:
  gitlab-ci/build.yaml:640:debian-bookworm-gcc-randconfig:

as PPC64 doesn't want randconfig right now, and buster-gcc-ibt is a special
job with a custom compiler.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Fix CONTAINER_UID0=1 scripts/containerize
Andrew Cooper [Mon, 8 Jul 2024 17:00:49 +0000 (18:00 +0100)]
CI: Fix CONTAINER_UID0=1 scripts/containerize

Right now, most build containers use root.  Archlinux, Fedora and Yocto set up
a regular user called `user`.

For those containers, trying to containerize as root fails, because
CONTAINER_UID0=1 does nothing, whereas CONTAINER_UID0=0 forces the user away
from root.

To make CONTAINER_UID0=1 work reliably, force to root if requested.

Fixes: 17fbe6504dfd ("automation: introduce a new variable to control container user")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoautomation: Use a different ImageBuilder repository URL
Michal Orzel [Wed, 10 Jul 2024 09:37:51 +0000 (11:37 +0200)]
automation: Use a different ImageBuilder repository URL

Switch to using https://gitlab.com/xen-project/imagebuilder.git which
should be considered official ImageBuilder repo.

Take the opportunity to truncate the git history when cloning using
--depth 1.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild: Drop xorg-x11 as a build dependency
Andrew Cooper [Thu, 4 Jul 2024 12:09:21 +0000 (13:09 +0100)]
build: Drop xorg-x11 as a build dependency

The history on this one is complicated.  The note to README was added in
commit 1f95747a4f16 ("Add openssl-dev and xorg-x11-dev to README") in 2007.

At the time, there was a vendered version of Qemu in xen.git with a local
modification using <X11/keysymdef.h> to access the monitor console over VNC.

The final reference to keysymdef.h was dropped in commit 85896a7c4dc7 ("build:
add autoconf to replace custom checks in tools/check") in 2012.  The next
prior mention was in 2009 with commit a8ccb671c377 ("tools: fix x11 check")
noting that x11 was not a direct dependcy of Xen; it was transitive through
SDL for Qemu for source-based distros.

It appears there may have been other unspecified dependencies on xorg,
e.g. the use of lndir by unmodified_drivers which are no longer relevant
either.

These days its only the Debian based dockerfiles which install xorg-x11, and
Qemu builds fine in these and others without x11.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild: Drop libiconv as a build dependecy
Andrew Cooper [Wed, 3 Jul 2024 20:35:36 +0000 (21:35 +0100)]
build: Drop libiconv as a build dependecy

The final user was blktap2, removed in Xen 4.13.

Strip out the ./configure check for it, and stop explicitly installing it in
the FreeBSD testing.

Fixes: 2a556b63a22d ("Drop blktap2")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild: Drop openssl as a build dependency
Andrew Cooper [Wed, 3 Jul 2024 19:25:22 +0000 (20:25 +0100)]
build: Drop openssl as a build dependency

The final user was blktap1, removed in Xen 4.6.

Fixes: f6bcc035084a ("tools: remove blktap1")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agotools/libxs: Fix fcntl() invocation in set_cloexec()
Andrew Cooper [Mon, 8 Jul 2024 14:56:14 +0000 (15:56 +0100)]
tools/libxs: Fix fcntl() invocation in set_cloexec()

set_cloexec() had a bit too much copy&pate from setnonblock(), and
insufficient testing on ancient versions of Linux...

As written (emulating ancient linux by undef'ing O_CLOEXEC), strace shows:

  open("/dev/xen/xenbus", O_RDWR)         = 3
  fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
  fcntl(3, 0x8003 /* F_??? */, 0x7ffe4a771d90) = -1 EINVAL (Invalid argument)
  close(3)                                = 0

which is obviously nonsense.

Switch F_GETFL -> F_GETFD, and fix the second invocation to use F_SETFD.  With
this, strace is rather happer:

  open("/dev/xen/xenbus", O_RDWR)         = 3
  fcntl(3, F_GETFD)                       = 0
  fcntl(3, F_SETFD, FD_CLOEXEC)           = 0

Fixes: bf7c1464706a ("tools/libxs: Fix CLOEXEC handling in get_dev()")
Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agostubdom: Remove more leftovers of caml-stubdom
Andrew Cooper [Tue, 9 Jul 2024 12:35:37 +0000 (13:35 +0100)]
stubdom: Remove more leftovers of caml-stubdom

Fixes: e536a497545f ("stubdom: Remove caml-stubdom")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Refresh the Coverity Github Action configuration
Andrew Cooper [Wed, 3 Jul 2024 20:02:20 +0000 (21:02 +0100)]
CI: Refresh the Coverity Github Action configuration

Update to Ubuntu 24.04, and checkout@v4 as v2 is deprecated.

The build step goes out of it's way to exclude docs and stubdom (but include
plain MiniOS), so disable those at the ./configure stage.

Refresh the package list.  libbz2-dev was in there twice, and e2fslibs-dev is
a a transitional package to libext2fs-dev.  I'm not aware of libtool ever
having been a Xen dependency.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild: Fix the version of python checked for by ./configure
Andrew Cooper [Thu, 4 Jul 2024 12:08:40 +0000 (13:08 +0100)]
build: Fix the version of python checked for by ./configure

We previously upped the minimum python version to 2.7, but neglected to
reflect this in ./configure

Fixes: 2a353c048c68 ("tools: Don't use distutils in configure or Makefile")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild: Regenerate ./configure with Autoconf 2.71
Andrew Cooper [Wed, 3 Jul 2024 17:21:09 +0000 (18:21 +0100)]
build: Regenerate ./configure with Autoconf 2.71

This is the version now found in Debian Bookworm.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agox86/physdev: Return pirq that irq was already mapped to
Jiqian Chen [Mon, 8 Jul 2024 08:04:56 +0000 (16:04 +0800)]
x86/physdev: Return pirq that irq was already mapped to

Fix bug introduced by 0762e2502f1f ("x86/physdev: factor out the code to allocate and
map a pirq"). After that re-factoring, when pirq<0 and current_pirq>0, it means
caller want to allocate a free pirq for irq but irq already has a mapped pirq, then
it returns the negative pirq, so it fails. However, the logic before that
re-factoring is different, it should return the current_pirq that irq was already
mapped to and make the call success.

Fixes: 0762e2502f1f ("x86/physdev: factor out the code to allocate and map a pirq")
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Rework the CentOS7 container
Andrew Cooper [Wed, 3 Jul 2024 11:06:46 +0000 (12:06 +0100)]
CI: Rework the CentOS7 container

CentOS 7 is fully End-of-life as of 2024-06-30, and the Yum repo configuration
points at URLs which have become non-existent.

First, start by using a heredoc RUN for legibility.  It's important to use
`set -e` to offset the fact that we're no longer chaining every command
together with an &&.

Also, because we're using a single RUN command to perform all RPM operations,
we no longer need to work around the OverlayFS bug.

Adjust the CentOS-*.repo files to point at vault.centos.org.  This also
involves swapping mirrorlist= for baseurl= in the yum config.

Use a minor bashism to express the dependenices more coherently, and identify
why we have certain dependencies.  Some adjustments are:

 * We need bzip2-devel for the dombuilder.  bzip2 needs retaining stubdom or
   `tar` fails to unpack the .bz2 archives.
 * {lzo,lz4,ztd}-devel are new optional dependency since the last time this
   package list was refreshed.
 * openssl-devel hasn't been a dependency since Xen 4.6.
 * We long ago ceased being able to build Qemu and SeaBIOS in this container,
   so drop their dependencies too.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Adjust the usage of inline files
Andrew Cooper [Wed, 3 Jul 2024 13:08:29 +0000 (14:08 +0100)]
CI: Adjust the usage of inline files

As per:

  https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#here-documents

For inline files, use COPY with a heredoc, rather than opencoding it through
/bin/sh.

No practical change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoCI: Formalise the use of heredocs
Andrew Cooper [Tue, 2 Jul 2024 13:34:36 +0000 (14:34 +0100)]
CI: Formalise the use of heredocs

Commit b5739330d7f4 introduced the use of heredocs in the jessie/stretch
dockerfiles.

It turns out this was introduced by BuildKit in 2018 along with a
standardisation of Dockerfile syntax, and has subsequently been adopted by the
docker community.

Annotate all dockerfiles with a statement of the syntax in use, and extend
README.md details including how to activate BuildKit when it's available but
off by default.

This allows the containers to be rebuilt following commit a0e29b316363 ("CI:
Drop glibc-i386 from the build containers").

Fixes: b5739330d7f4 ("automation: fix jessie/stretch images to use archive.debian.org apt repos")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild/mkheader: Fix Syntax/DeprecationWarnings
Andrew Cooper [Wed, 3 Jul 2024 20:57:19 +0000 (21:57 +0100)]
build/mkheader: Fix Syntax/DeprecationWarnings

With Python 3.11, the following is emitted during a build:

  tools/include/xen-foreign/mkheader.py:162: DeprecationWarning: invalid escape sequence '\s'
    regex = "#define\s+%s\\b" % define;
  tools/include/xen-foreign/mkheader.py:177: DeprecationWarning: invalid escape sequence '\*'
    input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
  tools/include/xen-foreign/mkheader.py:178: DeprecationWarning: invalid escape sequence '\s'
    input = re.compile("\n\s*\n", re.S).sub("\n", input);
  tools/include/xen-foreign/mkheader.py:182: DeprecationWarning: invalid escape sequence '\s'
    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
  tools/include/xen-foreign/mkheader.py:192: DeprecationWarning: invalid escape sequence '\s'
    regex = "(?:#ifdef ([A-Z_]+))?\nstruct\s+%s\s*\{(.*?)\n\};" % struct;
  tools/include/xen-foreign/mkheader.py:218: DeprecationWarning: invalid escape sequence '\s'
    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
  tools/include/xen-foreign/mkheader.py:222: DeprecationWarning: invalid escape sequence '\s'
    output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);

Python regexes should use raw strings.  Convert all regexes, and drop escaped
backslashes.  Note that regular escape sequences are interpreted normally when
parsing a regex, so \n even in a raw-string regex is a newline.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agobuild/mkheader: Remove C-isms from the code
Andrew Cooper [Wed, 3 Jul 2024 20:59:34 +0000 (21:59 +0100)]
build/mkheader: Remove C-isms from the code

This was clearly written by a C programmer, rather than a python programmer.
Drop all the useless semi-colons.

The very final line of the script simply references f.close, rather than
calling the function.  Switch to using a with: statement, as python does care
about unclosed files if you enable enough warnings.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agotools/xs-clients: Fix `make clean` rule
Andrew Cooper [Wed, 3 Jul 2024 22:01:11 +0000 (23:01 +0100)]
tools/xs-clients: Fix `make clean` rule

Prior to the split, "the clients" used tools/xenstored/Makefile.common whose
clean rule includes *.o whereas after the split, the removal of *.o was lost
by virtule of not including Makefile.common any more.

This is the bug behind the following build error:

  make[2]: Entering directory '/local/xen.git/tools/xs-clients'
  gcc     xenstore_client.o    (snip)
  /usr/bin/ld: xenstore_client.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: failed to set dynamic section sizes: bad value
  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:35: xenstore] Error 1

which was caused by `make clean` not properly cleaning the tree as I was
swapping between various build containers.

Switch to a plain single-colon clean rule.

Fixes: 5c293058b130 ("tools/xenstore: move xenstored sources into dedicated directory")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoxen/vmap: Document the vmap header
Alejandro Vallejo [Thu, 4 Jul 2024 07:31:35 +0000 (09:31 +0200)]
xen/vmap: Document the vmap header

In it's current form it's rather cryptic for uninitiated, so this patch
documents everything in there to make it more palatable.

No functional change.

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoxen/riscv: use .insn with operands to support the older gas
Oleksii Kurochko [Thu, 4 Jul 2024 07:30:46 +0000 (09:30 +0200)]
xen/riscv: use .insn with operands to support the older gas

Support for specifying "raw" insns was added only in 2.38.
To support older version it would be better switch to .insn
with operands.

The following compilation error occurs:
  ./arch/riscv/include/asm/processor.h: Assembler messages:
  ./arch/riscv/include/asm/processor.h:70: Error: unrecognized opcode `0x0100000F'
In case of the following Binutils:
  $ riscv64-linux-gnu-as --version
  GNU assembler (GNU Binutils for Debian) 2.35.2

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoxen: Fix XEN_EXTRAVERSION after 4.19-rc1
Andrew Cooper [Tue, 2 Jul 2024 13:34:54 +0000 (14:34 +0100)]
xen: Fix XEN_EXTRAVERSION after 4.19-rc1

Currently, the banner reports:

  __  __            _  _    _  ___   ___
  \ \/ /___ _ __   | || |  / |/ _ \ / _ \    _ __ ___
   \  // _ \ '_ \  | || |_ | | (_) | | | |__| '__/ __|
   /  \  __/ | | | |__   _|| |\__, | |_| |__| | | (__
  /_/\_\___|_| |_|    |_|(_)_|  /_/ \___/   |_|  \___|

and xl reports:

  # xl info xen_version
  4.190-rc

Drop the 0, which is in line with how we annotate RCs elsewhere.

Fixes: 4a73eb4c205d ("Update Xen version to 4.19-rc")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agocmdline: "extra_guest_irqs" is inapplicable to PVH
Jan Beulich [Wed, 3 Jul 2024 12:04:15 +0000 (14:04 +0200)]
cmdline: "extra_guest_irqs" is inapplicable to PVH

PVH in particular has no (externally visible) notion of pIRQ-s. Mention
that in the description of the respective command line option and have
arch_hwdom_irqs() also reflect this (thus suppressing the log message
there as well, as being pretty meaningless in this case anyway).

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoamend 'cmdline: document and enforce "extra_guest_irqs" upper bounds'
Jan Beulich [Wed, 3 Jul 2024 12:03:27 +0000 (14:03 +0200)]
amend 'cmdline: document and enforce "extra_guest_irqs" upper bounds'

Address late review comments for what is now commit 17f6d398f765:
- bound max_irqs right away against nr_irqs
- introduce a #define for a constant used twice

Requested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agoxen: avoid UB in guest handle field accessors
Jan Beulich [Tue, 2 Jul 2024 10:01:59 +0000 (12:01 +0200)]
xen: avoid UB in guest handle field accessors

Much like noted in 43d5c5d5f70b ("xen: avoid UB in guest handle
arithmetic"), address calculations involved in accessing a struct field
can overflow, too. Cast respective pointers to "unsigned long" and
convert type checking accordingly. Remaining arithmetic is, despite
there possibly being mathematical overflow, okay as per the C99 spec:
"A computation involving unsigned operands can never overflow, because a
result that cannot be represented by the resulting unsigned integer type
is reduced modulo the number that is one greater than the largest value
that can be represented by the resulting type." The overflow that we
need to guard against is checked for in array_access_ok().

While there add the missing (see {,__}copy_to_guest_offset()) is-not-
const checks to {,__}copy_field_to_guest().

Typically, but not always, no change to generated code; code generation
(register allocation) is different for at least common/grant_table.c.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agox86/entry: don't clear DF when raising #UD for lack of syscall handler
Jan Beulich [Tue, 2 Jul 2024 10:01:21 +0000 (12:01 +0200)]
x86/entry: don't clear DF when raising #UD for lack of syscall handler

While doing so is intentional when invoking the actual callback, to
mimic a hard-coded SYCALL_MASK / FMASK MSR, the same should not be done
when no handler is available and hence #UD is raised.

Fixes: ca6fcf4321b3 ("x86/pv: Inject #UD for missing SYSCALL callbacks")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agocmdline: document and enforce "extra_guest_irqs" upper bounds
Jan Beulich [Tue, 2 Jul 2024 10:00:27 +0000 (12:00 +0200)]
cmdline: document and enforce "extra_guest_irqs" upper bounds

PHYSDEVOP_pirq_eoi_gmfn_v<N> accepting just a single GFN implies that no
more than 32k pIRQ-s can be used by a domain on x86. Document this upper
bound.

To also enforce the limit, (ab)use both arch_hwdom_irqs() (changing its
parameter type) and setup_system_domains(). This is primarily to avoid
exposing the two static variables or introducing yet further arch hooks.

While touching arch_hwdom_irqs() also mark it hwdom-init.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
10 months agotools/libxs: Fix CLOEXEC handling in xs_fileno()
Andrew Cooper [Fri, 28 Jun 2024 13:04:30 +0000 (14:04 +0100)]
tools/libxs: Fix CLOEXEC handling in xs_fileno()

xs_fileno() opens a pipe on first use to communicate between the watch thread
and the main thread.  Nothing ever sets CLOEXEC on the file descriptors.

Check for the availability of the pipe2() function with configure.  Despite
starting life as Linux-only, FreeBSD and NetBSD have gained it.

When pipe2() isn't available, try our best with pipe() and set_cloexec().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>