Re: [PATCH v2] x86/APIC: Switch flat driver to use phys dst for ext ints

2024-10-08 Thread Matthew Barnes
On Tue, Oct 08, 2024 at 03:47:41PM +0200, Jan Beulich wrote: > On 07.10.2024 16:34, Matthew Barnes wrote: > > --- a/xen/arch/x86/include/asm/genapic.h > > +++ b/xen/arch/x86/include/asm/genapic.h > > @@ -44,29 +44,11 @@ extern const struct genapic apic_bigsm

[PATCH v2] x86/APIC: Switch flat driver to use phys dst for ext ints

2024-10-07 Thread Matthew Barnes
/194 Signed-off-by: Matthew Barnes --- Changes in v2: - Reword commit message - Expand and delete GENAPIC_* macros - Bundle patch series into one patch --- xen/arch/x86/genapic/bigsmp.c | 8 +++- xen/arch/x86/genapic/default.c | 8 +++- xen/arch/x86/genapic/delivery.c| 10

[PATCH 1/3] x86/APIC: Switch flat driver to use phys dst for ext ints

2024-10-02 Thread Matthew Barnes
Resolves: https://gitlab.com/xen-project/xen/-/issues/194 Signed-off-by: Matthew Barnes --- xen/arch/x86/include/asm/genapic.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h index

[PATCH 2/3] x86/APIC: Remove unnecessary logical flat functions

2024-10-02 Thread Matthew Barnes
Now that GENAPIC_FLAT uses physical destination for external interrupts, these functions implementing logical flat for external interrupts are no longer used. No functional change. Signed-off-by: Matthew Barnes --- xen/arch/x86/genapic/delivery.c| 10 -- xen/arch/x86/include/asm

[PATCH 0/3] Switch flat driver to use phys dst for ext ints

2024-10-02 Thread Matthew Barnes
This patch series switches the apic_default APIC driver from using logical flat destination mode for external interrupts, to using physical destination mode for external interrupts. This is followed up by two non-functional cleanup commits. Matthew Barnes (3): x86/APIC: Switch flat driver to

[PATCH 3/3] x86/APIC: Refactor GENAPIC_FLAT -> GENAPIC_MIXED

2024-10-02 Thread Matthew Barnes
The macro name is changed to somewhat mirror x2apic driver code, as logical flat is no longer used for external interrupts for this mode. No functional change. Signed-off-by: Matthew Barnes --- xen/arch/x86/genapic/default.c | 2 +- xen/arch/x86/include/asm/genapic.h | 2 +- 2 files

[PATCH] x86/APIC: Remove x2APIC pure cluster mode

2024-09-23 Thread Matthew Barnes
https://gitlab.com/xen-project/xen/-/issues/189 Signed-off-by: Matthew Barnes --- CHANGELOG.md | 1 + docs/misc/xen-command-line.pandoc | 4 +-- xen/arch/x86/Kconfig | 12 xen/arch/x86/genapic/x2apic.c | 50 +++ 4 files chang

[PATCH v2] x86/cpufeatures: Add new cpuid features in SPR to featureset

2024-08-21 Thread Matthew Barnes
Upon running `xen-cpuid -v` on a host machine with Sapphire Rapids within Dom0, there exist unrecognised features. This patch adds these features as macros to the CPU featureset, disabled by default. Signed-off-by: Matthew Barnes --- Changes in v2: - Remove MONITOR / UMONITOR features in

[PATCH] x86/cpufeatures: Add new cpuid features in SPR to featureset

2024-08-14 Thread Matthew Barnes
Upon running `xen-cpuid -d` on a host machine with Sapphire Rapids within Dom0, there exist unrecognised features. This patch adds these features as macros to the CPU featureset, disabled by default. Signed-off-by: Matthew Barnes --- xen/include/public/arch-x86/cpufeatureset.h | 12

[XEN PATCH v2] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests

2024-08-07 Thread Matthew Barnes
breakpoints for PV guests such that they reproduce the same behaviour as hardware. Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints") Signed-off-by: Matthew Barnes --- Changes in v2: - Refactor breakpoint port masking to be more succinct - Add 'Fixes' line to com

[XEN PATCH] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests

2024-08-05 Thread Matthew Barnes
breakpoints for PV guests such that they reproduce the same behaviour as hardware. Signed-off-by: Matthew Barnes --- xen/arch/x86/pv/emul-priv-op.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index

[XEN PATCH v7] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-07-31 Thread Matthew Barnes
distinguish between hypercall errors, and continue event channel enumeration if the hypercall error is not critical to enumeration. Signed-off-by: Matthew Barnes --- Changes in v7: - All error paths return error code 1 from lsevtchn - Simplify perror message to failing function "xc_evtchn_s

[XEN PATCH v6] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-07-29 Thread Matthew Barnes
distinguish between hypercall errors, and continue event channel enumeration if the hypercall error is not critical to enumeration. Signed-off-by: Matthew Barnes --- Changes in v6: - Add blank space before label Changes in v5: - Code style changes to switch statement Changes in v4: - Catch non

[XEN PATCH v5] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-07-29 Thread Matthew Barnes
distinguish between hypercall errors, and continue event channel enumeration if the hypercall error is not critical to enumeration. Signed-off-by: Matthew Barnes --- Changes in v5: - Code style changes to switch statement Changes in v4: - Catch non-critical errors and fail on everything else, instead

Re: [XEN PATCH v4] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-07-29 Thread Matthew Barnes
On Mon, Jul 29, 2024 at 09:58:46AM +0200, Jan Beulich wrote: > On 26.07.2024 18:40, Matthew Barnes wrote: > > @@ -24,7 +25,23 @@ int main(int argc, char **argv) > > status.port = port; > > rc = xc_evtchn_status(xch, &status); > > if (

[XEN PATCH v4] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-07-26 Thread Matthew Barnes
distinguish between hypercall errors, and continue event channel enumeration if the hypercall error is not critical to enumeration. Signed-off-by: Matthew Barnes --- Changes in v4: - Catch non-critical errors and fail on everything else, instead of catching few known critical errors and ignoring

Re: [RFC XEN PATCH v2] x86/cpuid: Expose max_vcpus field in HVM hypervisor leaf

2024-07-24 Thread Matthew Barnes
On Wed, Jul 24, 2024 at 07:42:19AM +0200, Jan Beulich wrote: > (re-adding xen-devel@) > > On 23.07.2024 14:57, Matthew Barnes wrote: > > On Mon, Jul 22, 2024 at 01:37:11PM +0200, Jan Beulich wrote: > >> On 19.07.2024 16:21, Matthew Barnes wrote: > >>> Curre

[RFC XEN PATCH v2] x86/cpuid: Expose max_vcpus field in HVM hypervisor leaf

2024-07-19 Thread Matthew Barnes
itself up appropriately at run-time. GitLab ticket: https://gitlab.com/xen-project/xen/-/issues/191 For OVMF to access the maximum vCPU count, this patch has Xen expose the maximum vCPU ID via cpuid on the HVM hypervisor leaf in edx. Signed-off-by: Matthew Barnes --- Changes in v2: - Tweak value

Re: [RFC XEN PATCH] x86/cpuid: Expose max_vcpus field in HVM hypervisor leaf

2024-07-16 Thread Matthew Barnes
On Tue, Jul 09, 2024 at 08:40:18AM +0200, Jan Beulich wrote: > On 08.07.2024 17:42, Matthew Barnes wrote: > > Currently, OVMF is hard-coded to set up a maximum of 64 vCPUs on > > startup. > > > > There are efforts to support a maximum of 128 vCPUs, which would i

[XEN PATCH v3 RESEND] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-07-15 Thread Matthew Barnes
vtchn missing potential relevant event channels with higher port numbers. Use the errno macro to distinguish between hypercall errors, and continue event channel enumeration if the hypercall error is not critical to enumeration. Signed-off-by: Matthew Barnes --- tools/xcutils/lsevtchn.c

[RFC XEN PATCH] x86/cpuid: Expose max_vcpus field in HVM hypervisor leaf

2024-07-08 Thread Matthew Barnes
: https://gitlab.com/xen-project/xen/-/issues/191 Signed-off-by: Matthew Barnes --- xen/arch/x86/traps.c| 4 xen/include/public/arch-x86/cpuid.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index ee91fc56b125..b439ee94f562

[XEN PATCH v3] tools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP

2024-07-05 Thread Matthew Barnes
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 --- Changes in v3: - Keep xc_domain_{un,}pause() calls - Update xen-hvmcrash comment to

[XEN PATCH v2] tools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP

2024-07-01 Thread Matthew Barnes
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 --- Changes in v2: - Use xendevicemodel API instead of legacy devicemodel API - Return

Re: [XEN PATCH] tools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP

2024-06-26 Thread Matthew Barnes
On Tue, Jun 25, 2024 at 10:02:42PM +0100, Andrew Cooper wrote: > On 03/06/2024 3:59 pm, Matthew Barnes wrote: > > 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

[XEN PATCH] tools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP

2024-06-25 Thread Matthew Barnes
On Fri, Jun 21, 2024 at 03:38:36PM +, Anthony PERARD wrote: > On Mon, Jun 03, 2024 at 03:59:18PM +0100, Matthew Barnes wrote: > > diff --git a/tools/misc/xen-hvmcrash.c b/tools/misc/xen-hvmcrash.c > > index 1d058fa40a47..8ef1beb388f8 100644 > > --- a/tools/misc/xen-hvmcr

[XEN PATCH v2] x86/apic: Fix signed shift in io_apic.c

2024-06-20 Thread Matthew Barnes
There exists bitshifts in the IOAPIC code where signed integers are shifted to the left by up to 31 bits, which is undefined behaviour. This patch fixes this by changing the integers from signed to unsigned. Signed-off-by: Matthew Barnes Reviewed-by: Jan Beulich --- Changes in v2: - Correct

[XEN PATCH] x86/apic: Fix signing in left bitshift

2024-06-20 Thread Matthew Barnes
: Matthew Barnes --- xen/arch/x86/io_apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index b48a64246548..ae88b1b898fe 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1756,7 +1756,7 @@ static void cf_check

[XEN PATCH] tools/misc: xen-hvmcrash: Inject #DF instead of overwriting RIP

2024-06-03 Thread Matthew Barnes
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 --- tools/misc/xen-hvmcrash.c | 77 +++ 1 file changed

[XEN PATCH v3] tools/lsevtchn: Use errno macro to handle hypercall error cases

2024-05-08 Thread Matthew Barnes
vtchn missing potential relevant event channels with higher port numbers. Use the errno macro to distinguish between hypercall errors, and continue event channel enumeration if the hypercall error is not critical to enumeration. Signed-off-by: Matthew Barnes --- tools/xcutils/lsevtchn.c

[XEN PATCH v2 1/2] evtchn: Add error status indicators for evtchn_status hypercall

2024-04-29 Thread Matthew Barnes
. Add error status indicators for the eventchn_status hypercall for lsevtchn to terminate its loop on, and keep other errors as failed hypercalls. Signed-off-by: Matthew Barnes --- xen/common/event_channel.c | 12 +++- xen/include/public/event_channel.h | 2 ++ 2 files changed, 13

[XEN PATCH v2 0/2] Enumerate all allocated evtchns in lsevtchn

2024-04-29 Thread Matthew Barnes
over. Matthew Barnes (2): evtchn: Add error status indicators for evtchn_status hypercall tools/lsevtchn: Use new status identifiers in loop tools/xcutils/lsevtchn.c | 11 ++- xen/common/event_channel.c | 12 +++- xen/include/public/event_channel.h | 2 ++ 3

[XEN PATCH v2 2/2] tools/lsevtchn: Use new status identifiers in loop

2024-04-29 Thread Matthew Barnes
" and "domain invalid", to determine when to break the loop. Signed-off-by: Matthew Barnes --- tools/xcutils/lsevtchn.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c index d1710613ddc5..4a48620cd72

[XEN PATCH 2/2] tools/lsevtchn: Use evtchn port upper bound for evtchn enumeration

2024-04-11 Thread Matthew Barnes
over. Signed-off-by: Matthew Barnes --- tools/xcutils/lsevtchn.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c index d1710613ddc5..7f8ad7c8e7ce 100644 --- a/tools/xcutils/lsevtchn.c +++ b/tools/xcutils/lsevtchn.c

[XEN PATCH 0/2] Enumerate all allocated evtchns in lsevtchn

2024-04-11 Thread Matthew Barnes
mbers. This patch series adds the highest allocated event channel port for a given domain in the xen_domctl_getdomaininfo hypercall struct, and uses that value as an upper bound in the lsevtchn loop. Matthew Barnes (2): xen/domctl: Add highest allocated evtchn port to getdomaininfo tools/lse

[XEN PATCH 1/2] xen/domctl: Add highest allocated evtchn port to getdomaininfo

2024-04-11 Thread Matthew Barnes
. Signed-off-by: Matthew Barnes --- xen/common/domctl.c | 1 + xen/include/public/domctl.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 43b0b074c3a6..1d1ee17f6f91 100644 --- a/xen/common/domctl.c +++ b/xen/common

Re: [XEN PATCH] tools: add x2APIC entries in MADT based on APIC ID

2024-03-26 Thread Matthew Barnes
On Tue, Mar 26, 2024 at 05:15:46PM +0100, Jan Beulich wrote: > On 26.03.2024 16:57, Matthew Barnes wrote: > >>> This patch scans each APIC ID before constructing the MADT, and uses the > >>> x2APIC entry for each vCPU whose APIC ID exceeds the size limit imposed &g

Re: [XEN PATCH] tools: add x2APIC entries in MADT based on APIC ID

2024-03-26 Thread Matthew Barnes
> > This patch scans each APIC ID before constructing the MADT, and uses the > > x2APIC entry for each vCPU whose APIC ID exceeds the size limit imposed > > by regular APIC entries. > > It is my understanding that if you use any x2APIC entry, every CPU needs > to have one. In the ACPI 6.4 specifi

[XEN PATCH 2/2] x86: Refactor LBR feature to MSR_DEBUGCTL feature

2024-03-15 Thread Matthew Barnes
Last Branch Record and Bus Lock Detect both belong to the same MSR. The same mechanism that restores LBR also restores BLD. Therefore, the name of the feature that enables this mechanism should reflect restoring the MSR, instead of one field. No functional change. Signed-off-by: Matthew Barnes

[XEN PATCH 0/2] Enable Bus Lock Detect as rate limiter

2024-03-15 Thread Matthew Barnes
generally restoring the MSR, instead of only one field. Matthew Barnes (2): x86: Enable BLD and handle #DB traps x86: Refactor LBR feature into general MSR_DEBUGCTL feature xen/arch/x86/cpu/common.c | 5 + xen/arch/x86/hvm/vmx/entry.S | 6 +++--- xen/arch/x86/include

[XEN PATCH 1/2] x86: Enable BLD and handle #DB traps

2024-03-15 Thread Matthew Barnes
-coding it. Signed-off-by: Matthew Barnes --- xen/arch/x86/cpu/common.c| 5 + xen/arch/x86/hvm/vmx/entry.S | 2 +- xen/arch/x86/include/asm/debugreg.h | 1 + xen/arch/x86/include/asm/msr-index.h | 1 + xen/arch/x86/include/asm/msr.h | 2 ++ xen/arch/x86/msr.c

[XEN PATCH] tools: add x2APIC entries in MADT based on APIC ID

2024-03-13 Thread Matthew Barnes
, but not so for sufficiently large x2APIC IDs. This patch scans each APIC ID before constructing the MADT, and uses the x2APIC entry for each vCPU whose APIC ID exceeds the size limit imposed by regular APIC entries. Signed-off-by: Matthew Barnes --- tools/libacpi/acpi2_0.h | 13 +++ tools