Commit Graph
45656 Commits
Author SHA1 Message Date
Andrew Cooper 2dd06b4ea1 x86/cpu-policy: Hide CLWB by default on SKX/CLX/CPX
The August 2023 microcode for GDS has an impact on the CLWB instruction.  See
code comments for full details.

This is part of XSA-435 / CVE-2022-40982

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2023-08-08 15:19:49 +01:00
Andrew Cooper 220c06e6fe x86/spec-ctrl: Mitigate Speculative Return Stack Overflow
On native, synthesise the SRSO bits by probing various hardware properties as
given by AMD.

Extend the IBPB-on-entry mitigations to Zen3/4 CPUs.  There is a microcode
prerequisite to make this an effective mitigation.

This is part of XSA-434 / CVE-2023-20569

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2023-08-08 15:19:49 +01:00
Andrew Cooper 2280b0ee2a x86/spec-ctrl: Enumerations for Speculative Return Stack Overflow
AMD have specified new CPUID bits relating to SRSO.

 * SRSO_NO indicates that hardware is no longer vulnerable to SRSO.
 * IBPB_BRTYPE indicates that IBPB flushes branch type information too.
 * SBPB indicates support for a relaxed form of IBPB that does not flush
   branch type information.

Current CPUs (Zen4 and older) are not expected to enumerate these bits.
Native software is expected to synthesise them for guests using model and
microcode revision checks.

Two are just status bits, and SBPB is trivial to support for guests by
tweaking the reserved bit calculation in guest_wrmsr() and feature
dependencies.  Expose all by default to guests, so they start showing up when
Xen synthesises them.

While adding feature dependenies for IBPB, fix up an overlooked issue from
XSA-422.  It's inappropriate to advertise that IBPB flushes RET predictions if
IBPB is unavailable itself.

This is part of XSA-434 / CVE-2023-20569

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2023-08-08 15:19:49 +01:00
Andrew Cooper 292f68fb77 x86/spec-ctrl: Rework ibpb_calculations()
... in order to make the SRSO mitigations easier to integrate.

 * Check for AMD/Hygon CPUs directly, rather than assuming based on IBPB.
   In particular, Xen supports synthesising the IBPB bit to guests on Intel to
   allow IBPB while dissuading the use of (legacy) IBRS.
 * Collect def_ibpb_entry rather than opencoding the BTC_NO calculation for
   both opt_ibpb_entry_{pv,hvm}.

No functional change.

This is part of XSA-434 / CVE-2023-20569

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2023-08-08 15:19:49 +01:00
Andrew Cooper 46c5ef609b subdom: Fix -Werror=address failure in tmp_emulator
The opensuse-tumbleweed build jobs currently fail with:

  /builds/xen-project/xen/stubdom/tpm_emulator-x86_64/crypto/rsa.c: In function 'rsa_private':
  /builds/xen-project/xen/stubdom/tpm_emulator-x86_64/crypto/rsa.c:56:7: error: the comparison will always evaluate as 'true' for the address of 'p' will never be NULL [-Werror=address]
     56 |   if (!key->p || !key->q || !key->u) {
        |       ^
  In file included from /builds/xen-project/xen/stubdom/tpm_emulator-x86_64/crypto/rsa.c:17:
  /builds/xen-project/xen/stubdom/tpm_emulator-x86_64/crypto/rsa.h:28:12: note: 'p' declared here
     28 |   tpm_bn_t p;
        |            ^

This is because all tpm_bn_t's are 1-element arrays (of either a GMP or
OpenSSL BIGNUM flavour).

Adjust it to compile.  No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
2023-08-08 12:24:17 +01:00
Luca Fancellu bd3ddaf6ee xen/arm: Add Cortex-A77 erratum 1508412 handling
Cortex-A77 cores (r0p0, r1p0) could deadlock on a sequence of a
store-exclusive or read of PAR_EL1 and a load with device or non-cacheable
memory attributes.
A workaround is available, but it depends on a firmware counterpart.

The proposed workaround from the errata document is to modify the software
running at EL1 and above to include a DMB SY before and after accessing
PAR_EL1.

In conjunction to the above, the firmware needs to use a specific write
sequence to several IMPLEMENTATION DEFINED registers to have the hardware
insert a DMB SY after all load-exclusive and store-exclusive instructions.

Apply the workaround to Xen where PAR_EL1 is read, implementing an helper
function to do that.
Since Xen can be interrupted by irqs in any moment, add a barrier on
entry/exit when we are running on the affected cores.

A guest without the workaround can deadlock the system, so warn the users
of Xen with the above type of cores to use only trusted guests, by
printing a message on Xen startup.

This is XSA-436 / CVE-2023-34320.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
2023-08-08 08:50:17 +01:00
Federico Serafini cb827e7a19 x86/cpu: Address a violation of MISRA C:2012 Rule 8.3
A missing change to the type in 'opt_arat' declaration introduced a new
violation of MISRA C:2012 Rule 8.3 ("All declarations of an object or
function shall use the same names and type qualifiers").
Change the type to restore the consistency between all declarations of
the object and drop a further usage of 'bool_t'.

Fixes: 202a341f ("x86: Address violations of MISRA C:2012 by replacing bool_t uses")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-08 09:45:46 +02:00
Anthony PERARD ad89640ad7 libxl: Use XEN_LIB_DIR to store bootloader from pygrub
In osstest, the jobs using pygrub on arm64 on the branch linux-linus
started to fails with:
    [Errno 28] No space left on device
    Error writing temporary copy of ramdisk

This is because /var/run is small when dom0 has only 512MB to work
with, /var/run is only 40MB. The size of both kernel and ramdisk on
this jobs is now about 42MB, so not enough space in /var/run.

So, to avoid writing a big binary in ramfs, we will use /var/lib
instead, like we already do when saving the device model state on
migration.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
2023-08-08 09:45:20 +02:00
Shawn Anastasio 83ea97ecc0 xen/ppc: Implement early serial console on PowerNV
Implement the OPAL firmware calls required to write to the serial
console on PowerNV systems. Unlike pseries/Open Firmware, the OPAL
firmware interface can be used past early boot and as such the relevant
functions are not marked as __init.

Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-08 09:44:46 +02:00
Shawn Anastasio 6fc15ec32b xen/ppc: Parse device tree for OPAL node on PowerNV
Communication with firmware boot services on PowerNV requires parsing
the fdt blob passed by the bootloader in order to obtain the firmware
entrypoint. Use Xen's libfdt to do this and store the information
required for firmware calls, to be implemented in a future patch.

The full xen/common build doesn't yet work, but libfdt and its xen/lib
dependency can be made to build by defining a few stub headers.

Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-08 09:41:03 +02:00
Shawn Anastasio c99f57a783 xen/ppc: Add OPAL API definition header file
OPAL (OpenPower Abstraction Layer) is the interface exposed by firmware
on PowerNV (bare metal) systems. Import Linux's header definining the
API and related information.

From Linux commit 5321d1b1afb9a17302c6cec79f0cbf823eb0d3fc

Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-08 09:39:37 +02:00
Gianluca Luparini d3be806dae xen/x86: address violations of MISRA C:2012 Rule 7.3
The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:20:18 -07:00
Gianluca Luparini 84df4fd56d x86/mm: address violations of MISRA C:2012 Rule 7.3
The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:20:05 -07:00
Gianluca Luparini 2cb7d006b5 x86/IOMMU: address violations of MISRA C:2012 Rule 7.3
The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca	Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:19:51 -07:00
Gianluca Luparini 854c63f82c x86/svm: address violations of MISRA C:2012 Rule 7.3
The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca	Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:19:20 -07:00
Gianluca Luparini c44cf8f584 AMD/IOMMU: address violations of MISRA C:2012 Rule 7.3
The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:19:06 -07:00
Michal Orzel 7d5ef63f08 automation: Advertise that ECLAIR jobs do not need prerequisites
While not required today (ECLAIR jobs come first), add "needs: []" for
future-proofing and consistency with other jobs in the pipeline.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-07 13:18:19 -07:00
Federico Serafini 5e7a0614a4 x86/mce: Address violations of MISRA C:2012 Rules 8.2 and 8.3
Give a name to unnamed parameters to address violations of
MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
named parameters").
Keep consistency between parameter types used in function
declarations and the ones used in the corresponding function
definitions, thus addressing violations of MISRA C:2012 Rule 8.3
("All declarations of an object or function shall use the same names
and type qualifiers").

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:18:04 -07:00
Nicola Vetrini 6456661cd0 x86/mtrr: address MISRA C:2012 Rule 5.3
Rename variables to avoid shadowing and thus address
MISRA C:2012 Rule 5.3:
"An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope".

The shadowing happens between the global variable 'mtrr_state' declared
in 'xen/arch/x86/include/asm/mtrr.h' and local variable names.  The
latter are renamed to 'm', which is used elsewhere in
'xen/arch/x86/hvm/mtrr.c' for the same purpose.

No functional changes.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
[stefano: improve commit description]
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:16:59 -07:00
Nicola Vetrini 48627540a1 x86/mce: address MISRA C:2012 Rule 5.3
Suitable mechanical renames are made to avoid shadowing
the function identifier 'wait' declared in 'xen/include/xen/wait.h',
thus addressing violations of MISRA C:2012 Rule 5.3:
"An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope"

The parameter name 'bar' is added as well to comply with MISRA C:2012
Rules 8.2 and 8.3.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-07 13:14:52 -07:00
Federico Serafini 6759b42fcb xen: change parameter name in monitor_domctl() declaration
Change parameter name in monitor_domctl() declaration for
consistency with the corresponding definition.
This addresses a violation of MISRA C:2012 Rule 8.3: "All declarations
of an object or function shall use the same names and type qualifiers".

No functional changes.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
2023-08-07 13:14:01 -07:00
Andrew Cooper 65f0d6fc80 x86: Drop opt_pku entirely
This option is particularly dubious as Xen does not use Protection Keys, owing
to the sharing of pagetables with PV guests.  All this option does is hide PKU
by default from HVM guests, and is therefore redundant with the more generic
cpuid=no-pku.

The variable ought to be in __initdata given it's single user, but deleting it
entirely looks to be a better course of action.

Visibility of PKU to guests should be handled via its vm.cfg file.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Henry Wang <Henry.Wang@arm.com>
2023-08-07 15:30:18 +01:00
Alejandro Vallejo 767d1a2cfd arm/mm: Document the differences between arm32 and arm64 directmaps
arm32 merely covers the XENHEAP, whereas arm64 currently covers anything in
the frame table. These comments highlight why arm32 doesn't need to account for PDX
compression in its __va() implementation while arm64 does.

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
2023-08-07 14:45:18 +01:00
Nicola Vetrini d63ea6c46b libelf: address MISRA C:2012 Rule 5.3
The types u{8,16,32,64} defined in 'xen/arch/x86/include/asm/types.h'
shadow the variables in the modified function, hence violating Rule 5.3.
Therefore, the rename takes care of the shadowing.

No functional changes.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-07 11:26:43 +02:00
Federico Serafini 202a341fd4 x86: Address violations of MISRA C:2012 by replacing bool_t uses
Give a name to unnamed parameters to address violations of
MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
named parameters").
Keep consistency between object and function declarations thus
addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an
object or function shall use the same names and type qualifiers").
Replace the occurrences of bool_t with bool.

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>
2023-08-07 11:24:28 +02:00
Gianluca Luparini 0c8d77e117 xen/include: address violations of MISRA C:2012 Rule 7.3
From: Gianluca Luparini <gianluca.luparini@bugseng.com>

The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-07 11:23:54 +02:00
Gianluca Luparini 6ad7563727 xen/common: address violations of MISRA C:2012 Rule 7.3
From: Gianluca Luparini <gianluca.luparini@bugseng.com>

The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-07 11:23:29 +02:00
Gianluca Luparini b89d204ee0 xen/arm: address violations of MISRA C:2012 Rule 7.3
The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca	Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-07 11:22:58 +02:00
Federico Serafini 680e66544c xen/sched: address violations of MISRA C:2012 Rules 8.2 and 8.3
Give a name to unnamed parameters to address violations of
MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
named parameters").
Keep consistency between parameter names and types used in function
declarations and the ones used in the corresponding function
definitions, thus addressing violations of MISRA C:2012 Rule 8.3
("All declarations of an object or function shall use the same names
and type qualifiers").

No functional changes.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Dario Faggioli <dfaggioli@suse.com>
2023-08-07 11:22:24 +02:00
Nicola Vetrini e26230a349 xen/sched: mechanical renaming to address MISRA C:2012 Rule 5.3
Rule 5.3 has the following headline:
"An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope"

The renaming s/sched_id/scheduler_id/ of the function defined in
'xen/common/sched/core.c' prevents any hiding of that function
by the instances of homonymous function parameters that
are defined in inner scopes.

Similarly, the renames
- s/ops/operations/ for the static variable in 'xen/common/sched/core.c'
- s/do_softirq/needs_softirq/
are introduced for variables, to avoid any conflict with homonymous
parameters or function identifiers.

Moreover, the variable 'loop' defined at 'xen/common/sched/credit2.c:3887'
has been dropped, in favour of the homonymous variable declared in the
outer scope. This in turn requires a modification of the printk call that
involves it.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Dario Faggioli <dfaggioli@suse.com>
2023-08-07 11:21:24 +02:00
Jan Beulich a628e73de1 x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()
In the latter case the variable altogether is then unused and hence gets
dropped, eliminating a Misra Rule 5.3 violation. I'm afraid I mistakenly
introduced both assignments in 57a57465da ("x86/HVM: use available
linear->phys translations in REP MOVS/STOS handling"), likely as a
result of some re-work on the patch.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Paul Durrant <paul@xen.org>
2023-08-07 11:20:15 +02:00
Stefano Stabellini e55146071d automation: add missing "needs"
The test artifacts export jobs don't need prerequisites, so we should
specify "needs" with an empty array for them. That way, they are not
going to fruitlessly wait for previous jobs (ECLAIR jobs) to complete
before continuing.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
2023-08-04 14:35:16 -07:00
Simone Ballarin 4a6448fd64 automation/eclair: avoid failure in case of missing merge point
In the context of an auto pull request, when a common merge point
is not found the integration will continue the analysis without
failing.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-03 18:17:14 -07:00
Simone Ballarin 0d3d7eb82f automation/eclair: add scheduled pipelines
This patch introduces six new ECLAIR jobs that run only
when triggered by a GitLab scheduled pipeline.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-03 18:17:14 -07:00
Simone Ballarin 5499c75c21 automation/eclair: add direct link to reports
This patch adds direct links to the analysis findings in the
console log.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-03 18:17:13 -07:00
Simone Ballarin 4d687adc8c automation/eclair: add support for tag pipelines
The ECLAIR jobs fail when triggered by tag pipelines (e.g.
xen-project/patchew/xen).

This patch extends the integration to support such pipelines.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-03 18:17:13 -07:00
Julien Grall 092cae024a xen/x86: Constify the vCPU parameter for expand_xsave_states()
expand_xsave_states() is not meant to modify the vCPU. So the parameter
can be const.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-03 17:41:41 +01:00
Jan Beulich 1aa5acbbec libxl: allow building with old gcc again
We can't use initializers of unnamed struct/union members just yet.

Fixes: d638fe233c ("libxl: use the cpuid feature names from cpufeatureset.h")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2023-08-03 17:35:39 +02:00
Jan Beulich 4f6afde88b libxl: avoid shadowing of index()
Because of -Wshadow the build otherwise fails with old enough glibc.

While there also obey line length limits for msr_add().

Fixes: 6d21cedbaa ("libxl: add support for parsing MSR features")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2023-08-03 17:35:26 +02:00
Khem Raj dfc490a374 arm: Avoid using solaris syntax for .section directive
Assembler from binutils 2.41 will rejects ([1], [2]) the following
syntax

.section "name", #alloc

for any other any target other than ELF SPARC. This means we can't use
it in the Arm code.

So switch to the GNU syntax

.section name [, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
[jgrall: Reword commit message]
Acked-by: Julien Grall <jgrall@amazon.com>
2023-08-02 22:29:52 +01:00
Andrew Cooper da55d9dc91 x86/gen-cpuid: Avoid violations of Misra rule 1.3
Add the script to the X86 section in ./MAINTAINERS.

Structures or unions without any named members aren't liked by Misra
(nor the C standard). Avoid emitting such for leaves without any known
bits.

The placeholders are affected similarly, but are only visible to MISRA in the
middle of a patch series adding a new leaf.  The absence of a name was
intentional as these defines need to not duplicate names.

As that's not deemed acceptable any more, move placeholder processing into the
main loop and append the the word number to generate unique names.

  $ diff cpuid-autogen-{before,after}.h
  @@ -1034,7 +1034,7 @@
       bool intel_psfd:1, ipred_ctrl:1, rrsba_ctrl:1, ddp_ctrl:1,     ...

   #define CPUID_BITFIELD_14 \
  -    bool :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1,   ...
  +    uint32_t _placeholder_14

   #define CPUID_BITFIELD_15 \
       bool :1, :1, :1, :1, avx_vnni_int8:1, avx_ne_convert:1, :1,    ...
  @@ -1043,19 +1043,19 @@
       bool rdcl_no:1, eibrs:1, rsba:1, skip_l1dfl:1, intel_ssb_no:1, ...

   #define CPUID_BITFIELD_17 \
  -    bool :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1, :1,   ...
  +    uint32_t _placeholder_17

   #define CPUID_BITFIELD_18 \
  -    uint32_t :32 /* placeholder */
  +    uint32_t _placeholder_18

   #define CPUID_BITFIELD_19 \
  -    uint32_t :32 /* placeholder */
  +    uint32_t _placeholder_19

   #define CPUID_BITFIELD_20 \
  -    uint32_t :32 /* placeholder */
  +    uint32_t _placeholder_20

   #define CPUID_BITFIELD_21 \
  -    uint32_t :32 /* placeholder */
  +    uint32_t _placeholder_21

   #endif /* __XEN_X86__FEATURESET_DATA__ */

No functional change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2023-08-02 16:25:24 +01:00
Andrew Cooper 73aea9ada8 x86: Delete str()
This is used in an assertion only, which is somewhat dubious to begin with and
isn't expected to surivive the x86-S work (where TR is expected to become
become be a NUL selector).

Delete it now.  This avoids many cases where as a global symbol, it shadows
local string variables.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
2023-08-02 16:25:24 +01:00
Andrew Cooper abe93fc8aa x86/entry: Rename the exception entrypoints
This makes the names match the architectural short names that we use
elsewhere.  This avoids 'debug' in particular from being a global symbol
shadowed by many local parameter names.

Remove the DECLARE_TRAP_HANDLER{,_CONST}() infrastructure.  Only NMI/#MC are
referenced externally (and NMI will cease to be soon, as part of adding FRED
support).  Move the entrypoint declarations into the respective traps.c where
they're used, rather than keeping them visible across ~all of Xen.

Drop the long-stale comment at the top of init_idt_traps().  It's mostly
discussing a 32bit Xen, and bogus otherwise as it's impossible to use trap
gates correctly for these purposes.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
2023-08-02 16:25:24 +01:00
Andrew Cooper 26638cd9ef x86/traps: Move do_general_protection() earlier
... in order to clean up the declarations without needing to forward declare
it for handle_gdt_ldt_mapping_fault()

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-02 16:25:24 +01:00
Shawn Anastasio 51588938e0 xen/ppc: Switch to medium PIC code model
Switch Xen to the medium PIC code model on Power. Among other things,
this allows us to be load address agnostic and will open the door to
booting on bare metal PowerNV systems that don't use OpenFirmware.

Also update XEN_VIRT_START to 0xc000000000000000, which is equivalent to
address 0x0 when the MMU is off. This prevents Open Firmware from
loading Xen at an offset from its base load address, so the DECL_SECTION
hack in xen.lds.S is no longer required.

Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-02 10:53:46 +02:00
Nicola Vetrini c6dc0ee76d arm/efi: address MISRA C:2012 Rule 5.3
Rule 5.3 has the following headline:
"An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope"

The file-scope variable 'fdt' is shadowed by function parameters,
and thus violates the rule, hence it's renamed to 'fdt_efi'

No functional changes.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2023-08-02 10:53:12 +02:00
Nicola Vetrini b3f817a6c5 drivers/char: address MISRA C:2012 Rule 5.3
The following strategies are adopted to deal with violations
of MISRA C:2012 Rule 5.3:
"An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope".

Local variable 'ctrl' shadows a variable defined in an outer scope.
Since the innermost variable is used only once after being set, it is safe
to remove it entirely.

The enum constant 'baud' is shadowed by local a local variable at line
1476, and renaming the enum constant avoid such conflicts.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2023-08-02 10:52:44 +02:00
Nicola Vetrini 8d75d8069b xen/common: address MISRA C:2012 Rule 5.3
The following strategies are adopted to deal with violations
of MISRA C:2012 Rule 5.3:
"An identifier declared in an inner scope shall not hide an
identifier declared in an outer scope".

- s/nodes/numa_nodes/ for the file-scope variable in 'common/numa.c';
- move the variable 'struct compat_remove_from_physmap cmp' inside
  the outer union variable 'cmp' to avoid shadowing it.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-02 10:52:17 +02:00
Jan Beulich e35944f37b common: move simple_strto{,u}l{,l}() to lib/
Convert style from a Xen/Linux mix to pure Xen while doing the move. No
other changes, despite having been heavily tempted to do some - at the
very least to make simple_strtoul() and simple_strtoull() the same in
how they deal with non-numeric digits.

Requested-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Shawn Anastasio <sanastasio@raptorengineering.com>
2023-08-02 10:51:39 +02:00
Federico Serafini fe212797d7 xen/spinlock: address violations of MISRA C:2012 Rules 8.2 and 8.3
Give a name to unnamed parameters to address violations of
MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
named parameters").
Keep consistency between parameter names and types used in function
declarations and the ones used in the corresponding function
definitions, thus addressing violations of MISRA C:2012 Rule 8.3
("All declarations of an object or function shall use the same names
and type qualifiers").

No functional changes.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2023-08-02 10:50:21 +02:00