[PATCH v5 04/10] vpci: Refactor REGISTER_VPCI_INIT

2025-05-26 Thread Jiqian Chen
Refactor REGISTER_VPCI_INIT to contain more capability specific information, this is benefit for follow-on changes to hide capability when initialization fails. What's more, change the definition of init_header() since it is not a capability and it is needed for all devices' PCI config space. Aft

[PATCH v5 08/10] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-05-26 Thread Jiqian Chen
When init_rebar() fails, current logic return fail and free Rebar-related resources in vpci_deassign_device(). But the previous new changes will hide Rebar capability and return success, it can't reach vpci_deassign_device() to remove resources if hiding success, so those resources must be removed

[PATCH v5 00/10] Support hiding capability when its initialization fails

2025-05-26 Thread Jiqian Chen
Hi, This series is to emulate legacy and extended capability list for dom0, including patch #1, #2, #3. hide legacy and extended capability when its initialization fails, including patch #4, #5, #6. remove all related registers and other resources when initializing capability fails, including p

[PATCH v5 06/10] vpci: Hide extended capability when it fails to initialize

2025-05-26 Thread Jiqian Chen
When vpci fails to initialize a extended capability of device, it just returns an error and vPCI gets disabled for the whole device. So, add function to hide extended capability when initialization fails. And remove the failed extended capability handler from vpci extended capability list. Signed

[PATCH v5 07/10] vpci: Refactor vpci_remove_register to remove matched registers

2025-05-26 Thread Jiqian Chen
vpci_remove_register() only supports removing a register in a time, but the follow-on changes need to remove all registers within a range. So, refactor it to support removing all matched registers in a calling time. And it is no matter to remove a non exist register, so remove the __must_check pre

[PATCH v5 01/10] vpci/header: Move emulating cap list logic into new function

2025-05-26 Thread Jiqian Chen
No functional changes. Follow-on changes will benifit from this. Signed-off-by: Jiqian Chen Acked-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v4->v5 changes: No. v3->v4 changes: * Add Acked-by of Roger. v2->v3 changes: new patch. Best regards, Jiqian Chen. --- xen/drivers/vpci/header.

Re: [PATCH] arm/vgic-v3: Fix GICD_ICPENDR read access in __vgic_v3_distr_common_mmio_read()

2025-05-26 Thread Orzel, Michal
On 27/05/2025 02:11, Oleksandr Tyshchenko wrote: > An attempt to read access the GICD_ICPENDR register (where n > 0) > which should be RAZ (as not supported) causes the guest data abort > due to incorrect end offset (GICD_ICPENDR) in the case range. > Fix that by using the proper end offset (GIC

[PATCH] arm/vgic-v3: Fix GICD_ICPENDR read access in __vgic_v3_distr_common_mmio_read()

2025-05-26 Thread Oleksandr Tyshchenko
An attempt to read access the GICD_ICPENDR register (where n > 0) which should be RAZ (as not supported) causes the guest data abort due to incorrect end offset (GICD_ICPENDR) in the case range. Fix that by using the proper end offset (GICD_ICPENDRN). Fixes: a2b83f95bfa ("xen/arm: vgic: Properly e

Re: [PATCH] tools: Add install/uninstall targets to tests/x86_emulator

2025-05-26 Thread Anthony PERARD
On Tue, May 20, 2025 at 10:02:05PM +0100, Andrew Cooper wrote: > On 16/05/2024 12:07 pm, Alejandro Vallejo wrote: > > Bring test_x86_emulator in line with other tests by adding > > install/uninstall rules. > > > > Signed-off-by: Alejandro Vallejo > > --- > > tools/tests/x86_emulator/Makefile | 11

Re: [PATCH v1 1/5] console: add relocation hook

2025-05-26 Thread Marek Marczykowski-Górecki
On Mon, May 26, 2025 at 04:08:17PM +0100, Andrew Cooper wrote: > On 25/05/2025 3:15 pm, Marek Marczykowski-Górecki wrote: > > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > > index 25189541244d..3ef819a252e4 100644 > > --- a/xen/arch/x86/setup.c > > +++ b/xen/arch/x86/setup.c > > @@ -14

[PATCH v5 02/10] vpci/header: Emulate legacy capability list for dom0

2025-05-26 Thread Jiqian Chen
Current logic of emulating legacy capability list is only for domU. So, expand it to emulate for dom0 too. Then it will be easy to hide a capability whose initialization fails in a function. And restrict adding PCI_STATUS register only for domU since dom0 has no limitation to access that register.

Re: [PATCH] hw/xen: Fix trace_xs_node_read() params

2025-05-26 Thread Anthony PERARD
On Fri, May 23, 2025 at 04:01:34PM +, Liam Merwick wrote: > When the '--enable-trace-backends=syslog' build option is configured, > the following compilation error is encountered. > > In file included from /usr/include/sys/syslog.h:207, > from /usr/include/syslog.h:1, >

Re: [PATCH 1/3] tools/tests: Drop depriv-fd-checker

2025-05-26 Thread Anthony PERARD
On Tue, May 20, 2025 at 09:52:37PM +0100, Andrew Cooper wrote: > Unlike the other tests, this is not standalone. It requires poking at a live > system, making it unweildly to use. > > It hasn't been touched in 7 years, despite changes in libraries and kernel > devices using the deprivilege infras

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

2025-05-26 Thread Andrew Cooper
On 20/05/2025 9:52 pm, Andrew Cooper wrote: > diff --git a/automation/scripts/run-tools-tests > b/automation/scripts/run-tools-tests > index 770e97c3e943..8d7aa8fa5140 100755 > --- a/automation/scripts/run-tools-tests > +++ b/automation/scripts/run-tools-tests > @@ -12,30 +12,25 @@ printf '\n' >

Re: [PATCH 2/3] tools/tests: Install tests into $(LIBEXEC)/tests

2025-05-26 Thread Anthony PERARD
On Tue, May 20, 2025 at 09:52:38PM +0100, Andrew Cooper wrote: > $(LIBEXEC_BIN) is a dumping ground of many things. Separate the "clearly > tests" from everything else so we can clean up how they're run in CI. > > Signed-off-by: Andrew Cooper Acked-by: Anthony PERARD Thanks, -- Anthony PERA

Re: [PATCH v1 1/5] console: add relocation hook

2025-05-26 Thread Andrew Cooper
On 25/05/2025 3:15 pm, Marek Marczykowski-Górecki wrote: > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > index 25189541244d..3ef819a252e4 100644 > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -1481,6 +1481,8 @@ void asmlinkage __init noreturn __start_xen(void) >

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

2025-05-26 Thread Andrew Cooper
On 26/05/2025 6:22 pm, Anthony PERARD wrote: > On Mon, May 26, 2025 at 05:45:29PM +0100, Andrew Cooper wrote: >> On 20/05/2025 9:52 pm, Andrew Cooper wrote: >>> diff --git a/automation/scripts/run-tools-tests >>> b/automation/scripts/run-tools-tests >>> index 770e97c3e943..8d7aa8fa5140 100755 >>>

Re: [PATCH v6 1/6] xen/arm: Create tee command line parameter

2025-05-26 Thread Julien Grall
Hi Bertrand, On 22/05/2025 16:08, Bertrand Marquis wrote: Add a new command line parameter "tee=" to be used to explicitly select what tee mediator is to be used by Xen and fail if it does not exist or the probe function for it failed. Without specifying which tee is to be used, Xen will use th

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

2025-05-26 Thread Anthony PERARD
On Mon, May 26, 2025 at 05:45:29PM +0100, Andrew Cooper wrote: > On 20/05/2025 9:52 pm, Andrew Cooper wrote: > > diff --git a/automation/scripts/run-tools-tests > > b/automation/scripts/run-tools-tests > > index 770e97c3e943..8d7aa8fa5140 100755 > > --- a/automation/scripts/run-tools-tests > > +++

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Andrew Cooper
On 26/05/2025 6:59 pm, Manuel Bouyer wrote: > Hello, > since I updated to Xen 4.18.5 (from 4.18.4), NetBSD's dbregs-related tests > are failing. Only for PV; PVH and HVM guests are fine. They are > failing for both 32bits and 64bits guests. > > I tracked it down to dr6 being 0x0ff0 after the tr

Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
Hello, since I updated to Xen 4.18.5 (from 4.18.4), NetBSD's dbregs-related tests are failing. Only for PV; PVH and HVM guests are fine. They are failing for both 32bits and 64bits guests. I tracked it down to dr6 being 0x0ff0 after the trace trap, when at last one of the lower bits should be

Re: [PATCH] hw/xen: Fix trace_xs_node_read() params

2025-05-26 Thread Philippe Mathieu-Daudé
On 23/5/25 18:01, Liam Merwick wrote: When the '--enable-trace-backends=syslog' build option is configured, the following compilation error is encountered. In file included from /usr/include/sys/syslog.h:207, from /usr/include/syslog.h:1, from ./trace/trace-hw

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Andrew Cooper
On 26/05/2025 7:06 pm, Andrew Cooper wrote: > On 26/05/2025 6:59 pm, Manuel Bouyer wrote: >> Hello, >> since I updated to Xen 4.18.5 (from 4.18.4), NetBSD's dbregs-related tests >> are failing. Only for PV; PVH and HVM guests are fine. They are >> failing for both 32bits and 64bits guests. >> >> I

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
On Mon, May 26, 2025 at 07:06:04PM +0100, Andrew Cooper wrote: > On 26/05/2025 6:59 pm, Manuel Bouyer wrote: > > Hello, > > since I updated to Xen 4.18.5 (from 4.18.4), NetBSD's dbregs-related tests > > are failing. Only for PV; PVH and HVM guests are fine. They are > > failing for both 32bits and

Re: [PATCH v3 08/14] xen/riscv: imsic_init() implementation

2025-05-26 Thread Oleksii Kurochko
On 5/22/25 4:46 PM, Jan Beulich wrote: On 21.05.2025 18:03, Oleksii Kurochko wrote: --- /dev/null +++ b/xen/arch/riscv/imsic.c @@ -0,0 +1,354 @@ +/* SPDX-License-Identifier: MIT */ + +/* + * xen/arch/riscv/imsic.c + * + * RISC-V Incoming MSI Controller support + * + * (c) Microchip Technology I

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
On Mon, May 26, 2025 at 07:17:13PM +0100, Andrew Cooper wrote: > On 26/05/2025 7:06 pm, Andrew Cooper wrote: > > On 26/05/2025 6:59 pm, Manuel Bouyer wrote: > >> Hello, > >> since I updated to Xen 4.18.5 (from 4.18.4), NetBSD's dbregs-related tests > >> are failing. Only for PV; PVH and HVM guests

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Andrew Cooper
On 26/05/2025 7:46 pm, Manuel Bouyer wrote: > On Mon, May 26, 2025 at 07:17:13PM +0100, Andrew Cooper wrote: >> On 26/05/2025 7:06 pm, Andrew Cooper wrote: >>> On 26/05/2025 6:59 pm, Manuel Bouyer wrote: Hello, since I updated to Xen 4.18.5 (from 4.18.4), NetBSD's dbregs-related tests >>>

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
On Mon, May 26, 2025 at 07:50:14PM +0100, Andrew Cooper wrote: > [...] > Well, that range does include the aforementioned commit. > > Can you bisect around d32c77f471fb8400b6512c171a14cdd58f04f0a3 which is > the backport of ^ in 4.18 ? Sure, with 0d5f15e and d32c77f the test pass, with cecee35 it

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Andrew Cooper
On 26/05/2025 9:13 pm, Manuel Bouyer wrote: > On Mon, May 26, 2025 at 07:50:14PM +0100, Andrew Cooper wrote: >> [...] >> Well, that range does include the aforementioned commit. >> >> Can you bisect around d32c77f471fb8400b6512c171a14cdd58f04f0a3 which is >> the backport of ^ in 4.18 ? > Sure, > wi

Re: [Eclair false positive] Re: [PATCH] x86/msr: Rework wrmsr_safe() using asm goto()

2025-05-26 Thread Nicola Vetrini
On 2025-05-25 15:36, Nicola Vetrini wrote: On 2025-05-25 12:52, Andrew Cooper wrote: On 25/05/2025 8:34 am, Nicola Vetrini wrote: On 2025-05-22 15:49, Andrew Cooper wrote: On 22/05/2025 1:45 pm, Nicola Vetrini wrote: On 2025-05-21 20:00, Andrew Cooper wrote: On 21/05/2025 3:36 pm, Andrew Coo

[PATCH] x86/pv: Fix breakpoint reporting

2025-05-26 Thread Andrew Cooper
x86_merge_dr6() is not a no-op when 0 is passed in; it will discard the previously latched breakpoint bits. The combination of do_debug()'s manual call to x86_merge_dr6() for external debuggers, and pv_inject_DB() calling pv_inject_event(), results in two x86_merge_dr6() calls. Feed the same pend

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
On Mon, May 26, 2025 at 09:30:53PM +0100, Andrew Cooper wrote: > On 26/05/2025 9:13 pm, Manuel Bouyer wrote: > > On Mon, May 26, 2025 at 07:50:14PM +0100, Andrew Cooper wrote: > >> [...] > >> Well, that range does include the aforementioned commit. > >> > >> Can you bisect around d32c77f471fb8400b6

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
On Mon, May 26, 2025 at 10:56:41PM +0200, Manuel Bouyer wrote: > On Mon, May 26, 2025 at 09:30:53PM +0100, Andrew Cooper wrote: > > On 26/05/2025 9:13 pm, Manuel Bouyer wrote: > > > On Mon, May 26, 2025 at 07:50:14PM +0100, Andrew Cooper wrote: > > >> [...] > > >> Well, that range does include the

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Andrew Cooper
On 26/05/2025 10:10 pm, Manuel Bouyer wrote: > On Mon, May 26, 2025 at 10:56:41PM +0200, Manuel Bouyer wrote: >> On Mon, May 26, 2025 at 09:30:53PM +0100, Andrew Cooper wrote: >>> On 26/05/2025 9:13 pm, Manuel Bouyer wrote: On Mon, May 26, 2025 at 07:50:14PM +0100, Andrew Cooper wrote: > [

Re: Xen 4.18.5 PV dbregs fail

2025-05-26 Thread Manuel Bouyer
On Mon, May 26, 2025 at 10:17:06PM +0100, Andrew Cooper wrote: > On 26/05/2025 10:10 pm, Manuel Bouyer wrote: > > On Mon, May 26, 2025 at 10:56:41PM +0200, Manuel Bouyer wrote: > >> On Mon, May 26, 2025 at 09:30:53PM +0100, Andrew Cooper wrote: > >>> On 26/05/2025 9:13 pm, Manuel Bouyer wrote: > >>

[PATCH v5 03/10] vpci/header: Emulate extended capability list for dom0

2025-05-26 Thread Jiqian Chen
Add a new function to emulate extended capability list for dom0, and call it in init_header(). So that it will be easy to hide a extended capability whose initialization fails. As for the extended capability list of domU, just move the logic into above function and keep hiding it for domU. Signed

Re: [PATCH v3 2/2] tools/arm: exclude iomem from domU extended regions

2025-05-26 Thread Anthony PERARD
On Tue, May 13, 2025 at 03:54:50PM -0400, Stewart Hildebrand wrote: > diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c > index 75c811053c7c..8ae16a1726fc 100644 > --- a/tools/libs/light/libxl_arm.c > +++ b/tools/libs/light/libxl_arm.c > @@ -1542,20 +1556,90 @@ static int fin

[PATCH v5 10/10] vpci/msix: Free MSIX resources when init_msix() fails

2025-05-26 Thread Jiqian Chen
When init_msix() fails, current logic return fail and free MSIX-related resources in vpci_deassign_device(). But the previous new changes will hide MSIX capability and return success, it can't reach vpci_deassign_device() to remove resources if hiding success, so those resources must be removed in

[PATCH v5 05/10] vpci: Hide legacy capability when it fails to initialize

2025-05-26 Thread Jiqian Chen
When vpci fails to initialize a legacy capability of device, it just returns an error and vPCI gets disabled for the whole device. That most likely renders the device unusable, plus possibly causing issues to Xen itself if guest attempts to program the native MSI or MSI-X capabilities if present.

[PATCH v2] arm/irq: Reduce size of irq_desc array to exclude local IRQs

2025-05-26 Thread Mykola Kvach
SGI and PPI descriptors are banked and stored in the per-CPU local_irq_desc array, so not all elements of the global irq_desc array are used. This is already accounted for in the descriptor lookup logic inside __irq_to_desc: return &irq_desc[irq - NR_LOCAL_IRQS]; Therefore, the size of the irq

Re: [PATCH v2 4/5] libxc/PM: Ensure pxstat buffers are correctly sized

2025-05-26 Thread Anthony PERARD
On Mon, May 12, 2025 at 03:46:55PM +0100, Ross Lagerwall wrote: > diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c > index ff7b5ada053f..cffbd1b8a955 100644 > --- a/tools/libs/ctrl/xc_pm.c > +++ b/tools/libs/ctrl/xc_pm.c > @@ -46,35 +46,33 @@ int xc_pm_get_pxstat(xc_interface *xch, in

Re: [PATCH v2 5/5] libxc/PM: Retry get_pxstat if data is incomplete

2025-05-26 Thread Anthony PERARD
On Mon, May 12, 2025 at 03:46:56PM +0100, Ross Lagerwall wrote: > If the total returned by Xen is more than the number of elements > allocated, it means that the buffer was too small and so the data is > incomplete. Retry to get all the data. > > Signed-off-by: Ross Lagerwall Reviewed-by: Anthon

Re: [PATCH v3 06/14] xen/riscv: dt_processor_hartid() implementation

2025-05-26 Thread Oleksii Kurochko
On 5/22/25 9:50 AM, Jan Beulich wrote: On 21.05.2025 18:03, Oleksii Kurochko wrote: --- a/xen/arch/riscv/smpboot.c +++ b/xen/arch/riscv/smpboot.c @@ -1,5 +1,8 @@ #include +#include +#include #include +#include #include Nit: The latter insertion wants to move one line down. Yet then

Re: [PATCH 08/16] xen/arm: add watchdog domain suspend/resume helpers

2025-05-26 Thread Mykola Kvach
Hi, @Julien Grall On Tue, Mar 11, 2025 at 11:04 PM Julien Grall wrote: > > Hi Mykola, > > On 05/03/2025 09:11, Mykola Kvach wrote: > > From: Mykola Kvach > > > > This patch implements suspend/resume helpers for the watchdog. > > While a domain is suspended its watchdogs must be paused. Otherwise

Re: [PATCH v3 06/14] xen/riscv: dt_processor_hartid() implementation

2025-05-26 Thread Oleksii Kurochko
On 5/26/25 12:46 PM, Oleksii Kurochko wrote: On 5/22/25 9:50 AM, Jan Beulich wrote: On 21.05.2025 18:03, Oleksii Kurochko wrote: --- a/xen/arch/riscv/smpboot.c +++ b/xen/arch/riscv/smpboot.c @@ -1,5 +1,8 @@ #include +#include +#include #include +#include #include Nit: The latter

[PATCH v5 09/10] vpci/msi: Free MSI resources when init_msi() fails

2025-05-26 Thread Jiqian Chen
When init_msi() fails, current logic return fail and free MSI-related resources in vpci_deassign_device(). But the previous new changes will hide MSI capability and return success, it can't reach vpci_deassign_device() to remove resources if hiding success, so those resources must be removed in cle