Re: [PATCH v3 2/2] x86: detect PIT aliasing on ports other than 0x4[0-3]

2024-05-22 Thread Jason Andryuk
_CH2); +if ( (val2 & ~(PIT_STATUS_OUT_PIN | PIT_STATUS_NULL_COUNT)) != + (PIT_RW_LSB_MSB | PIT_MODE_EOC | PIT_BINARY) ) +return; +} while ( val2 & (1 << 6) ); You can use PIT_STATUS_NULL_COUNT here. With that: Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH v3 1/2] x86/PIT: supply and use #define-s

2024-05-22 Thread Jason Andryuk
On 2024-05-22 08:59, Jan Beulich wrote: Help reading of code programming the PIT by introducing constants for control word, read back and latch commands, as well as status. Requested-by: Jason Andryuk Signed-off-by: Jan Beulich Reviewed-by: Jason Andryuk Thanks for making the switch

Re: [PATCH v3 7/8] tools: Introduce the "xl dt-overlay {attach,detach}" commands

2024-05-21 Thread Jason Andryuk
overlay {attach,detach}". Slightly rework the command option parsing logic. Signed-off-by: Henry Wang Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH v3 4/8] tools/arm: Introduce the "nr_spis" xl config entry

2024-05-21 Thread Jason Andryuk
wed-by: Jason Andryuk Thanks, Jason

Re: [PATCH] tools/xl: add suspend-to-ram and resume subcommands

2024-05-20 Thread Jason Andryuk
Hi Zithro, On 2024-04-24 10:03, Jason Andryuk wrote: On 2024-02-29 02:00, zithro / Cyril Rébert wrote: The xl command doesn't provide suspend/resume, so add them :    xl suspend-to-ram    xl resume This patch follows a discussion on XenDevel: when you want the virtualized equivalent

Re: [PATCH v2 7/8] tools: Introduce the "xl dt-overlay {attach,detach}" commands

2024-05-20 Thread Jason Andryuk
On 2024-05-16 06:03, Henry Wang wrote: With the XEN_DOMCTL_dt_overlay DOMCTL added, users should be able to attach/detach devices from the provided DT overlay to domains. Support this by introducing a new set of "xl dt-overlay" commands and related documentation, i.e. "xl dt-overlay

Re: [PATCH v2 4/8] tools/arm: Introduce the "nr_spis" xl config entry

2024-05-20 Thread Jason Andryuk
On 2024-05-16 06:03, Henry Wang wrote: Currently, the number of SPIs allocated to the domain is only configurable for Dom0less DomUs. Xen domains are supposed to be platform agnostics and therefore the numbers of SPIs for libxl guests should not be based on the hardware. Introduce a new xl

Re: [PATCH v2 2/8] tools/xl: Correct the help information and exit code of the dt-overlay command

2024-05-20 Thread Jason Andryuk
instead of ERROR_FAIL. Fixes: 61765a07e3d8 ("tools/xl: Add new xl command overlay for device tree overlay support") Suggested-by: Anthony PERARD Signed-off-by: Henry Wang Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH v3 3/4] tools/init-dom0less: Avoid hardcoding GUEST_MAGIC_BASE

2024-05-20 Thread Jason Andryuk
by the hypervisor. Take the opportunity to do some coding style improvements when possible. Reported-by: Alec Kwapis Signed-off-by: Henry Wang Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH] tools/libs/light: Fix nic->vlan memory allocation

2024-05-20 Thread Jason Andryuk
ecommended by Jason. Fixes: 3bc14e4fa4b9 ("tools/libs/light: Add vlan field to libxl_device_nic") Signed-off-by: Leigh Brown Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH v4 2/2] tools/examples: Example Linux bridge VLAN config

2024-05-19 Thread Jason Andryuk
es the the systemd man pages, so: Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH v4 1/2] tools/hotplug/Linux: Add bridge VLAN support

2024-05-18 Thread Jason Andryuk
r will be generated if the vlan parameter is > set and the bridge command is not available. > > Signed-off-by: Leigh Brown Reviewed-by: Jason Andryuk Thanks, Jason

Re: [PATCH v3] libxl: Enable stubdom cdrom changing

2024-05-16 Thread Jason Andryuk
On Wed, May 15, 2024 at 10:11 PM Jason Andryuk wrote: > > From: Jason Andryuk Sorry, I mess this up. This From is incorrect. > From: Jason Andryuk This is correct. > Signed-off-by: Jason Andryuk > Signed-off-by: Jason Andryuk These are correct. Regards, Jason

Re: [PATCH v3 3/4] tools/hotplug/Linux: Add bridge VLAN support

2024-05-16 Thread Jason Andryuk
On Thu, May 16, 2024 at 6:56 AM Leigh Brown wrote: > > Update add_to_bridge shell function to read the vlan parameter from > xenstore and set the bridge VLAN configuration for the VID. > > Add additional helper functions to parse the vlan specification, > which consists of one or more of the

Re: [PATCH] hotplug: Restore block-tap phy compatibility

2024-05-16 Thread Jason Andryuk
On 2024-05-16 03:41, Jan Beulich wrote: On 16.05.2024 04:22, Jason Andryuk wrote: From: Jason Andryuk From: Jason Andryuk Two identical From: (also in another patch of yours, while in yet another one you have two _different_ ones, when only one will survive into the eventual commit anyway

[PATCH] hotplug: Restore block-tap phy compatibility

2024-05-15 Thread Jason Andryuk
From: Jason Andryuk From: Jason Andryuk backendtype=phy using the blktap kernel module needs to use write_dev, but tapback can't support that. tapback should perform better, but make the script compatible with the old kernel module again. Signed-off-by: Jason Andryuk --- This is tested

[PATCH] CHANGELOG: Mention libxl blktap/tapback support

2024-05-15 Thread Jason Andryuk
From: Jason Andryuk From: Jason Andryuk Add entry for backendtype=tap support in libxl. blktap needs some changes to work with libxl, which haven't been merged. They are available from this PR: https://github.com/xapi-project/blktap/pull/394 Signed-off-by: Jason Andryuk --- CHANGELOG.md

[PATCH v3] libxl: Enable stubdom cdrom changing

2024-05-15 Thread Jason Andryuk
From: Jason Andryuk From: Jason Andryuk To change the cd-rom medium, libxl will: - QMP eject the medium from QEMU - block-detach the old PV disk - block-attach the new PV disk - QMP change the medium to the new PV disk by fdset-id The QMP code is reused, and remove and attach

Re: [RFC PATCH v2 5/5] tools/examples: Example Linux bridge VLAN config

2024-05-14 Thread Jason Andryuk
On Wed, May 8, 2024 at 6:08 PM Leigh Brown wrote:> > Add a new directory linux-bridge-vlan with examples files showing > how to configure systemd-networkd to support a bridge VLAN > configuration. > > Signed-off-by: Leigh Brown > --- > tools/examples/linux-bridge-vlan/README | 68

Re: [RFC PATCH v2 4/5] docs/man: document VIF vlan keyword

2024-05-14 Thread Jason Andryuk
On Wed, May 8, 2024 at 5:39 PM Leigh Brown wrote: > > Document the new `vlan' keyword in xl-network-configuration(5). > > Signed-off-by: Leigh Brown Reviewed-by: Jason Andryuk One nit below > --- > docs/man/xl-network-configuration.5.pod.in | 38 ++ >

Re: [RFC PATCH v2 3/5] tools/hotplug/Linux: Add bridge VLAN support

2024-05-14 Thread Jason Andryuk
On Wed, May 8, 2024 at 6:55 PM Leigh Brown wrote: > > Update add_to_bridge shell function to read the vlan parameter > from xenstore and set the bridge VLAN configuration for the VID. > > Add additional helper functions to parse the vlan specification, > which consists of one or more of the

Re: [PATCH v2 3/3] x86: detect PIT aliasing on ports other than 0x4[0-3]

2024-05-14 Thread Jason Andryuk
On 2024-05-14 03:43, Jan Beulich wrote: On 10.05.2024 19:40, Jason Andryuk wrote: On 2023-12-18 09:48, Jan Beulich wrote: --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -425,6 +425,72 @@ static struct platform_timesource __init .resume = resume_pit, }; +unsigned int

Re: [RFC PATCH v2 2/5] tools/xl: add vlan keyword to vif option

2024-05-12 Thread Jason Andryuk
inux). The vlan keyword will allow one or > more VLANs to be configured on the VIF when adding it to the bridge > port. This will be done by the vif-bridge script and functions. > > Signed-off-by: Leigh Brown Reviewed-by: Jason Andryuk

Re: [RFC PATCH v2 1/5] tools/libs/light: Add vlan field to libxl_device_nic

2024-05-12 Thread Jason Andryuk
re. > > This provides the capability for supported operating systems (e.g. > Linux) to perform VLAN filtering on bridge ports. The Xen > hotplug scripts need to be updated to read this information from > the xenstore and perform the required configuration. > > Signed-off-by: Le

Re: [PATCH v2 3/3] x86: detect PIT aliasing on ports other than 0x4[0-3]

2024-05-10 Thread Jason Andryuk
On 2023-12-18 09:48, Jan Beulich wrote: ... in order to also deny Dom0 access through the alias ports. Without this it is only giving the impression of denying access to PIT. Unlike for CMOS/RTC, do detection pretty early, to avoid disturbing normal operation later on (even if typically we won't

Re: [RFC PATCH v2 0/5] Add bridge VLAN support

2024-05-10 Thread Jason Andryuk
On Thu, May 9, 2024 at 12:10 PM Leigh Brown wrote: > > Hi Andrew, > > On 2024-05-09 16:53, Andrew Cooper wrote: > > On 08/05/2024 10:38 pm, Leigh Brown wrote: > > This is past the last-post date, so Oleksii will need to decide whether > > he's happy to make an exception for it. > > From my own

Re: [PATCH v2 2/3] x86: detect PIC aliasing on ports other than 0x[2A][01]

2024-05-09 Thread Jason Andryuk
a fundamental assumption of the probing is that reads from the probed alias port won't have side effects in case it does not alias the respective PIC's one. Signed-off-by: Jan Beulich Code-wise Reviewed-by: Jason Andryuk I appreciate what Jan is trying to achieve. I also share Roger's concern

Re: [PATCH v2 1/3] x86: allow to suppress port-alias probing

2024-05-08 Thread Jason Andryuk
it, default it to on when in shim mode, and gate RTC/CMOS port alias probing on it. Requested-by: Roger Pau Monné Signed-off-by: Jan Beulich Reviewed-by: Jason Andryuk

Re: [PATCH 1/3] x86/boot: Explain how moving mod[0] works

2024-04-29 Thread Jason Andryuk
adroom' is a guess for the decompressed size and + * decompressor overheads of mod[0] (the dom0 kernel). When we + * move mod[0], we incorperate this as extra space at the start. incorporate With that: Reviewed-by: Jason Andryuk Thanks,

[PATCH] xen/x86: Fix Syntax warning in gen-cpuid.py

2024-04-26 Thread Jason Andryuk
as literal '\' + 's'. This avoids escaping all the '\'s in the strings. Signed-off-by: Jason Andryuk --- xen/tools/gen-cpuid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index bf3f9ec01e..dadeb33080 100755 --- a/xen/tool

[PATCH] xen/xsm: Wire up get_dom0_console

2024-04-26 Thread Jason Andryuk
An XSM hook for get_dom0_console is currently missing. Using XSM with a PVH dom0 shows: (XEN) FLASK: Denying unknown platform_op: 64. Wire up the hook, and allow it for dom0. Fixes: 4dd160583c ("x86/platform: introduce hypercall to get initial video console settings") Signed-off

Re: [PATCH] tools/xl: add suspend-to-ram and resume subcommands

2024-04-24 Thread Jason Andryuk
On 2024-02-29 02:00, zithro / Cyril Rébert wrote: The xl command doesn't provide suspend/resume, so add them : xl suspend-to-ram xl resume This patch follows a discussion on XenDevel: when you want the virtualized equivalent of "sleep"-ing a host, it's better to suspend/resume than to

Re: [PATCH v2 1/3] hotplug: Update block-tap

2024-04-22 Thread Jason Andryuk
On Mon, Apr 22, 2024 at 11:11 AM Anthony PERARD wrote: > > On Sun, Apr 07, 2024 at 04:49:51PM -0400, Jason Andryuk wrote: > > diff --git a/tools/hotplug/Linux/block-tap b/tools/hotplug/Linux/block-tap > > index 89247921b9..126e472786 100755 > > --- a/tools/hotplug/Linux/b

Re: [PATCH v3] Input: xen-kbdfront - drop keys to shrink modalias

2024-04-21 Thread Jason Andryuk
Hi Dmitry, On Thu, Mar 28, 2024 at 2:05 PM Dmitry Torokhov wrote: > > Hi Jason, > > On Wed, Mar 20, 2024 at 01:42:27PM -0400, Jason Andryuk wrote: > > Hi Dmitry, > > > > Do you have any feedback, or can you pick up this patch? It solves a > > real issue affe

[PATCH] x86/PVH: Use unsigned int for dom0 e820 index

2024-04-18 Thread Jason Andryuk
Switch to unsigned int for the dom0 e820 index. This eliminates the potential for array underflows, and the compiler might be able to generate better code. Requested-by: Jan Beulich Signed-off-by: Jason Andryuk --- xen/arch/x86/hvm/dom0_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2

Re: [PATCH v7 2/2] x86/PVH: Support relocatable dom0 kernels

2024-04-18 Thread Jason Andryuk
On 2024-04-17 09:24, Jan Beulich wrote: On 08.04.2024 18:56, Jason Andryuk wrote: On 2024-04-08 03:00, Jan Beulich wrote: On 04.04.2024 23:25, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -537,6 +537,111 @@ static paddr_t __init find_memory

Re: [PATCH 2/5] x86/pvh: Make PVH entrypoint PIC for x86-64

2024-04-11 Thread Jason Andryuk
On 2024-04-10 17:00, Brian Gerst wrote: On Wed, Apr 10, 2024 at 3:50 PM Jason Andryuk wrote: /* 64-bit entry point. */ .code64 1: + UNWIND_HINT_END_OF_STACK + /* Set base address in stack canary descriptor. */ mov $MSR_GS_BASE,%ecx - mov $_pa

Re: [PATCH] x86/pat: fix W^X violation false-positives when running as Xen PV guest

2024-04-10 Thread Jason Andryuk
Hi Juergen, On Tue, Apr 9, 2024 at 5:47 AM Juergen Gross wrote: > > When running as Xen PV guest in some cases W^X violation WARN()s have > been observed. Those WARN()s are produced by verify_rwx(), which looks > into the PTE to verify that writable kernel pages have the NX bit set > in order to

[PATCH 4/5] x86/kernel: Move page table macros to new header

2024-04-10 Thread Jason Andryuk
The PVH entry point will need an additional set of prebuild page tables. Move the macros and defines to a new header so they can be re-used. Signed-off-by: Jason Andryuk --- checkpatch.pl gives an error: "ERROR: Macros with multiple statements should be enclosed in a do - while loop&q

[PATCH 5/5] x86/pvh: Add 64bit relocation page tables

2024-04-10 Thread Jason Andryuk
. It could be larger with more pages. Signed-off-by: Jason Andryuk --- Instead of adding 5 pages of prebuilt page tables, they could be contructed dynamically in the .bss area. They are then only used for PVH entry and until transitioning to init_top_pgt. The .bss is later cleared. It's safer

[PATCH 2/5] x86/pvh: Make PVH entrypoint PIC for x86-64

2024-04-10 Thread Jason Andryuk
. The UNWIND_HINT_END_OF_STACK is to silence: vmlinux.o: warning: objtool: pvh_start_xen+0x7f: unreachable instruction after the lret into 64bit code. Signed-off-by: Jason Andryuk --- --- arch/x86/platform/pvh/head.S | 44 1 file changed, 34 insertions(+), 10 deletions

[PATCH 1/5] xen: sync elfnote.h from xen tree

2024-04-10 Thread Jason Andryuk
Sync Xen's elfnote.h header from xen.git to pull in the XEN_ELFNOTE_PHYS32_RELOC define. xen commit dfc9fab00378 ("x86/PVH: Support relocatable dom0 kernels") This is a copy except for the removal of the emacs editor config at the end of the file. Signed-off-by: Jason Andryuk --- i

[PATCH 0/5] x86/pvh: Make PVH entry relocatable

2024-04-10 Thread Jason Andryuk
macro, so its not applicable. There are some false positive warnings "WARNING: space prohibited between function name and open parenthesis '('" about the macro, too. Jason Andryuk (5): xen: sync elfnote.h from xen tree x86/pvh: Make PVH entrypoint PIC for x86-64 x86/pvh: Set ph

[PATCH 3/5] x86/pvh: Set phys_base when calling xen_prepare_pvh()

2024-04-10 Thread Jason Andryuk
phys_base needs to be set for __pa() to work in xen_pvh_init() when finding the hypercall page. Set it before calling into xen_prepare_pvh(), which calls xen_pvh_init(). Clear it afterward to avoid __startup_64() adding to it and creating an incorrect value. Signed-off-by: Jason Andryuk

Re: [PATCH v7 2/2] x86/PVH: Support relocatable dom0 kernels

2024-04-08 Thread Jason Andryuk
On 2024-04-08 03:00, Jan Beulich wrote: On 04.04.2024 23:25, Jason Andryuk wrote: Xen tries to load a PVH dom0 kernel at the fixed guest physical address from the elf headers. For Linux, this defaults to 0x100 (16MB), but it can be configured. Unfortunately there exist firmwares that have

[PATCH v2] libxl: devd: Spawn QEMU for 9pfs

2024-04-07 Thread Jason Andryuk
, so the might be used by other tooling. Signed-off-by: Jason Andryuk Signed-off-by: Jason Andryuk --- v2: Retain xenstore qdisk-backend-pid and qdisk-%u logfile --- tools/libs/light/libxl_device.c | 22 -- tools/libs/light/libxl_dm.c | 5 +++-- tools/libs/light

[PATCH v2 1/3] hotplug: Update block-tap

2024-04-07 Thread Jason Andryuk
Signed-off-by: Jason Andryuk Signed-off-by: Jason Andryuk --- v2: Update usage string Use local more Don't use local for pid/minor Use tap-ctl destroy Use 4 space indent in count_using and check_tap_sharing --- tools/hotplug/Linux/block-tap | 169 +++--- 1 file changed

[PATCH v2 3/3] CHANGELOG: Mention libxl blktap/tapback support

2024-04-07 Thread Jason Andryuk
From: Jason Andryuk Add entry for backendtype=tap support in libxl. blktap needs some changes to work with libxl, which haven't been merged. They are available from this PR: https://github.com/xapi-project/blktap/pull/394 Signed-off-by: Jason Andryuk --- CHANGELOG.md | 1 + 1 file changed

[PATCH v2 0/3] libxl: blktap/tapback support

2024-04-07 Thread Jason Andryuk
From: Jason Andryuk This patch set re-introduces blktap support to libxl. Unlike earlier versions, it does not link against any blktap library. libxl changes are needed to write to the vbd3 backend XenStore nodes. blktap has three components. tapdisk is a daemon implementing the disk IO

[PATCH v2 2/3] libxl: Support blktap with HVM device model

2024-04-07 Thread Jason Andryuk
/NetworkBlockDevice/nbd/blob/master/doc/uri.md Reviewed-by: Anthony PERARD Signed-off-by: Jason Andryuk Signed-off-by: Jason Andryuk --- v2: Add Anthony's R-b Add matching { } to else --- tools/libs/light/libxl_disk.c | 18 ++ tools/libs/light/libxl_dm.c | 1 - 2 files changed, 14

Re: [PATCH v2] libxl: Enable stubdom cdrom changing

2024-04-07 Thread Jason Andryuk
On Sun, Apr 7, 2024 at 10:36 AM Jason Andryuk wrote: > > To change the cd-rom medium, libxl will: > - QMP eject the medium from QEMU > - block-detach the old PV disk > - block-attach the new PV disk > - QMP change the medium to the new PV disk by fdset-id > >

[PATCH v2] libxl: Enable stubdom cdrom changing

2024-04-07 Thread Jason Andryuk
. For cd-eject, we still need to attach the empty vbd. This is necessary since xenstore is used to determine that hdc exists. Otherwise after eject, hdc would be gone and the cd-insert would fail to find the drive to insert new media. Signed-off-by: Jason Andryuk Signed-off-by: Jason Andryuk

[PATCH v2] libxl: Use vkb=[] for HVMs

2024-04-07 Thread Jason Andryuk
end is in InitWait. Signed-off-by: Jason Andryuk Signed-off-by: Jason Andryuk Reviewed-by: Anthony PERARD --- v2: Check libxl__device_add() failure Add Anthony R-b Add CHANGELOG Add man xl.cfg --- CHANGELOG.md| 1 + docs/man/xl.cfg.5.pod.in| 2 ++ tools/libs/light/l

[PATCH v7] RFC: x86/pvh: Make Xen PVH entrypoint PIC for x86-64

2024-04-04 Thread Jason Andryuk
it afterwards. __startup_64() assumes phys_base is zero and adds load_delta to it. If phys_base is already set, the calculation results in an incorrect cr3. TODO: Sync elfnote.h from xen.git commit xx when it is commited. Signed-off-by: Jason Andryuk --- Put this out as an example for the Xen

[PATCH v7 1/2] libelf: Store maximum PHDR p_align

2024-04-04 Thread Jason Andryuk
While parsing the PHDRs, store the maximum p_align value. This may be consulted for moving a PVH image's load address. Signed-off-by: Jason Andryuk --- v6: New v7: Remove printing p_align. It may be confusing and is only useful when a PVH kernel needs to be moved. --- xen/common/libelf

[PATCH v7 0/2] x86/pvh: Support relocating dom0 kernel

2024-04-04 Thread Jason Andryuk
variable MB() usage tools: Move MB/GB() to common-macros.h The first patch stores the maximum p_align value from the ELF PHDRs. The second patch expands the pvh dom0 kernel placement code. I'll post an additional patch showing the Linux changes to make PVH relocatable. Jason Andryuk (2

[PATCH v7 2/2] x86/PVH: Support relocatable dom0 kernels

2024-04-04 Thread Jason Andryuk
, the fallback default is 2MB. libelf-private.h includes common-macros.h to satisfy the fuzzer build. Link: https://gitlab.com/xen-project/xen/-/issues/180 Signed-off-by: Jason Andryuk --- ELF Note printing looks like: (XEN) ELF: note: PHYS32_RELOC align: 0x20 min: 0x100 max: 0x3fff v2

Re: [PATCH v6 4/4] x86/PVH: Support relocatable dom0 kernels

2024-04-04 Thread Jason Andryuk
On 2024-04-02 10:34, Jan Beulich wrote: On 27.03.2024 22:51, Jason Andryuk wrote: v6: Select alignment from, in order, Note, PHDRs, then default The comment in the public header also needs to reflect this change. Yes. I'll update. I'm going to tweak the code from elf->palign > PAG

Re: [PATCH v6 3/4] libelf: Store maximum PHDR p_align

2024-04-04 Thread Jason Andryuk
On 2024-04-02 02:44, Jan Beulich wrote: On 29.03.2024 15:41, Jason Andryuk wrote: On 2024-03-28 12:47, Jan Beulich wrote: On 27.03.2024 22:51, Jason Andryuk wrote: --- a/xen/common/libelf/libelf-loader.c +++ b/xen/common/libelf/libelf-loader.c @@ -468,6 +468,7 @@ void elf_parse_binary(struct

Re: [PATCH v6 1/4] tools/init-xenstore-domain: Replace variable MB() usage

2024-04-04 Thread Jason Andryuk
On 2024-04-04 06:09, Jan Beulich wrote: On 27.03.2024 22:50, Jason Andryuk wrote: @@ -36,6 +35,11 @@ static xc_evtchn_port_or_error_t console_evtchn; static xentoollog_level minmsglevel = XTL_PROGRESS; static void *logger; +static inline uint64_t mb_to_bytes(int mem) +{ + return

Re: [PATCH v6 1/4] tools/init-xenstore-domain: Replace variable MB() usage

2024-04-03 Thread Jason Andryuk
On 2024-04-03 08:41, Anthony PERARD wrote: On Wed, Mar 27, 2024 at 05:50:59PM -0400, Jason Andryuk wrote: The local MB() & GB() macros will be replaced with a common implementation, but those only work with constant values. Introduce a By the way, this is not true, the macro intro

Re: [PATCH v6 3/4] libelf: Store maximum PHDR p_align

2024-03-29 Thread Jason Andryuk
On 2024-03-28 12:47, Jan Beulich wrote: On 27.03.2024 22:51, Jason Andryuk wrote: --- a/xen/common/libelf/libelf-loader.c +++ b/xen/common/libelf/libelf-loader.c @@ -468,6 +468,7 @@ void elf_parse_binary(struct elf_binary *elf) { ELF_HANDLE_DECL(elf_phdr) phdr; uint64_t low = -1

Re: Linux Xen PV CPA W^X violation false-positives

2024-03-28 Thread Jason Andryuk
On Thu, Mar 28, 2024 at 9:00 AM Jürgen Groß wrote: > > Hi Jason, > > On 28.03.24 02:24, Jason Andryuk wrote: > > On Wed, Mar 27, 2024 at 7:46 AM Jürgen Groß wrote: > >> > >> On 24.01.24 17:54, Jason Andryuk wrote: > >&

Re: Linux Xen PV CPA W^X violation false-positives

2024-03-27 Thread Jason Andryuk
On Wed, Mar 27, 2024 at 7:46 AM Jürgen Groß wrote: > > On 24.01.24 17:54, Jason Andryuk wrote: > > + > > + return new; > > + } > > + } > > + > > end = start + npg * PAGE_SIZE - 1; > > WARN_ONCE(1,

[PATCH v6] RFC: x86/pvh: Make Xen PVH entrypoint PIC for x86-64

2024-03-27 Thread Jason Andryuk
-by: Jason Andryuk --- Put this out as an example for the Xen modifications Instead of setting and clearing phys_base, add a dedicated variable? Clearing phys_base is a little weird, but it leaves the kernel more consistent when running non-entry code. Make __startup_64() exit if phys_base is already

[PATCH v6 3/4] libelf: Store maximum PHDR p_align

2024-03-27 Thread Jason Andryuk
While parsing the PHDRs, store the maximum p_align value. This may be consulted for moving a PVH image's load address. Signed-off-by: Jason Andryuk --- v6: New --- xen/common/libelf/libelf-loader.c | 15 +++ xen/include/xen/libelf.h | 1 + 2 files changed, 12 insertions

[PATCH v6 1/4] tools/init-xenstore-domain: Replace variable MB() usage

2024-03-27 Thread Jason Andryuk
The local MB() & GB() macros will be replaced with a common implementation, but those only work with constant values. Introduce a static inline mb_to_bytes() in place of the MB() macro to convert the variable values. Signed-off-by: Jason Andryuk --- v4: New --- tools/helpers/init-xens

[PATCH v6 4/4] x86/PVH: Support relocatable dom0 kernels

2024-03-27 Thread Jason Andryuk
, the fallback default is 2MB. libelf-private.h includes common-macros.h to satisfy the fuzzer build. Link: https://gitlab.com/xen-project/xen/-/issues/180 Signed-off-by: Jason Andryuk --- ELF Note printing looks like: (XEN) ELF: note: PHYS32_RELOC align: 0x20 min: 0x100 max: 0x3fff v2

[PATCH v6 0/4] x86/pvh: Support relocating dom0 kernel

2024-03-27 Thread Jason Andryuk
e pvh dom0 kernel placement code. I'll post an additional patch showing the Linux changes to make PVH relocatable. Jason Andryuk (4): tools/init-xenstore-domain: Replace variable MB() usage tools: Move MB/GB() to common-macros.h libelf: Store maximum PHDR p_align x86/PVH: Support reloca

[PATCH v6 2/4] tools: Move MB/GB() to common-macros.h

2024-03-27 Thread Jason Andryuk
Consolidate to a single set of common macros for tools. MB() will gain another use in libelf, so this movement makes it available. Requested-by: Jan Beulich Signed-off-by: Jason Andryuk Reviewed-by: Jan Beulich --- v4: New v5: Add Jan's R-b & Req-b --- tools/firmware/hvmloader/ut

Re: [PATCH v5 1/6] Revert "xen/x86: bzImage parse kernel_alignment"

2024-03-27 Thread Jason Andryuk
On 2024-03-27 10:19, Jan Beulich wrote: On 27.03.2024 15:08, Jason Andryuk wrote: On 2024-03-27 04:59, Roger Pau Monné wrote: On Wed, Mar 27, 2024 at 08:22:41AM +0100, Jan Beulich wrote: On 26.03.2024 22:38, Jason Andryuk wrote: A new ELF note will specify the alignment for a relocatable PVH

Re: [PATCH v5] RFC: x86/pvh: Make Xen PVH entrypoint PIC for x86-64

2024-03-27 Thread Jason Andryuk
On 2024-03-27 04:20, Jan Beulich wrote: On 26.03.2024 22:47, Jason Andryuk wrote: --- a/include/xen/interface/elfnote.h +++ b/include/xen/interface/elfnote.h @@ -185,9 +185,25 @@ */ #define XEN_ELFNOTE_PHYS32_ENTRY 18 +/* + * Physical loading constraints for PVH kernels + * + * Used

Re: [PATCH v5 1/6] Revert "xen/x86: bzImage parse kernel_alignment"

2024-03-27 Thread Jason Andryuk
On 2024-03-27 04:59, Roger Pau Monné wrote: On Wed, Mar 27, 2024 at 08:22:41AM +0100, Jan Beulich wrote: On 26.03.2024 22:38, Jason Andryuk wrote: A new ELF note will specify the alignment for a relocatable PVH kernel. ELF notes are suitable for vmlinux and other ELF files, so this Linux

[PATCH v5] RFC: x86/pvh: Make Xen PVH entrypoint PIC for x86-64

2024-03-26 Thread Jason Andryuk
-by: Jason Andryuk --- Put this out as an example for the Xen modifications Instead of setting and clearing phys_base, add a dedicated variable? Clearing phys_base is a little weird, but it leaves the kernel more consistent when running non-entry code. Make __startup_64() exit if phys_base is already

[PATCH v5 5/6] xen/elfnote: Specify ELF Notes are x86-specific

2024-03-26 Thread Jason Andryuk
dual notes. Signed-off-by: Jason Andryuk --- xen/include/public/elfnote.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/include/public/elfnote.h b/xen/include/public/elfnote.h index 8bf54d035b..1d84b05f44 100644 --- a/xen/include/public/elfnote.h +++ b/xen/include/public/elfnote.

[PATCH v5 6/6] x86/PVH: Support relocatable dom0 kernels

2024-03-26 Thread Jason Andryuk
is present, the alignment contraints can just be specified within the note instead of searching for an alignment value via a heuristic. libelf-private.h includes common-macros.h to satisfy the fuzzer build. Link: https://gitlab.com/xen-project/xen/-/issues/180 Signed-off-by: Jason Andryuk --- ELF Note

[PATCH v5 1/6] Revert "xen/x86: bzImage parse kernel_alignment"

2024-03-26 Thread Jason Andryuk
A new ELF note will specify the alignment for a relocatable PVH kernel. ELF notes are suitable for vmlinux and other ELF files, so this Linux-specific bzImage parsing in unnecessary. This reverts commit c44cac229067faeec8f49247d1cf281723ac2d40. Signed-off-by: Jason Andryuk --- xen/arch/x86

[PATCH v5 4/6] libelf: Expand ELF note printing

2024-03-26 Thread Jason Andryuk
ELFNOTE_NAME to only print the name without a value like: (XEN) ELF: note: L1_MFN_VALID Details can optionally be printed for specific notes. Signed-off-by: Jason Andryuk Reviewed-by: Jan Beulich --- v3: Remove fatal size check Don't print values - just the name for presence v4: Use switch Always print

[PATCH v5 2/6] tools/init-xenstore-domain: Replace variable MB() usage

2024-03-26 Thread Jason Andryuk
The local MB() & GB() macros will be replaced with a common implementation, but those only work with constant values. Introduce a static inline mb_to_bytes() in place of the MB() macro to convert the variable values. Signed-off-by: Jason Andryuk --- v4: New --- tools/helpers/init-xens

[PATCH v5 3/6] tools: Move MB/GB() to common-macros.h

2024-03-26 Thread Jason Andryuk
Consolidate to a single set of common macros for tools. MB() will gain another use in libelf, so this movement makes it available. Requested-by: Jan Beulich Signed-off-by: Jason Andryuk Reviewed-by: Jan Beulich --- v4: New v5: Add Jan's R-b & Req-b --- tools/firmware/hvmloader/ut

[PATCH v5 0/6] x86/pvh: Support relocating dom0 kernel

2024-03-26 Thread Jason Andryuk
s ELF note printing beyond just printing integers and strings. The fifth patch expands specifies the Xen ELF Notes are x86-specific. The sixth patch expands the pvh dom0 kernel placement code. I'll post an additional patch showing the Linux changes to make PVH relocatable. Jason Andryuk (6): Rever

Re: [PATCH v4 5/5] x86/PVH: Support relocatable dom0 kernels

2024-03-26 Thread Jason Andryuk
On 2024-03-26 09:40, Jan Beulich wrote: On 26.03.2024 14:24, Jason Andryuk wrote: On 2024-03-26 03:50, Jan Beulich wrote: On 25.03.2024 21:45, Jason Andryuk wrote: @@ -227,6 +239,27 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf, +} +if ( descsz >

Re: [PATCH v4 5/5] x86/PVH: Support relocatable dom0 kernels

2024-03-26 Thread Jason Andryuk
On 2024-03-26 03:50, Jan Beulich wrote: On 25.03.2024 21:45, Jason Andryuk wrote: +/* Find an e820 RAM region that fits the kernel at a suitable alignment. */ +static paddr_t __init find_kernel_memory( +const struct domain *d, struct elf_binary *elf, +const struct elf_dom_parms *parms

[PATCH v4 0/5] x86/pvh: Support relocating dom0 kernel

2024-03-25 Thread Jason Andryuk
s ELF note printing beyond just printing integers and strings. The fifth patch expands the pvh dom0 kernel placement code. I'll post an additional patch showing the Linux changes to make PVH relocatable. Jason Andryuk (5): Revert "xen/x86: bzImage parse kernel_alignment" tools/init-xens

[PATCH v4 3/5] tools: Move MB/GB() to common-macros.h

2024-03-25 Thread Jason Andryuk
Consolidate to a single set of common macros for tools. MB() will gain another use in libelf, so this movement makes it available. Signed-off-by: Jason Andryuk --- v4: New --- tools/firmware/hvmloader/util.h | 3 --- tools/helpers/init-xenstore-domain.c| 1 - tools/include/xen

[PATCH v4 4/5] libelf: Expand ELF note printing

2024-03-25 Thread Jason Andryuk
ELFNOTE_NAME to only print the name without a value like: (XEN) ELF: note: L1_MFN_VALID Details can optionally be printed for specific notes. Signed-off-by: Jason Andryuk --- v3: Remove fatal size check Don't print values - just the name for presence v4: Use switch Always print newline for ELFNOTE_NAME

[PATCH v4 2/5] tools/init-xenstore-domain: Replace variable MB() usage

2024-03-25 Thread Jason Andryuk
The local MB() & GB() macros will be replaced with a common implementation, but those only work with constant values. Introduce a static inline mb_to_bytes() in place of the MB() macro to convert the variable values. Signed-off-by: Jason Andryuk --- v4: New --- tools/helpers/init-xens

[PATCH v4 5/5] x86/PVH: Support relocatable dom0 kernels

2024-03-25 Thread Jason Andryuk
, the alignment contraints can just be specified within the note instead of searching for an alignment value via a heuristic. libelf-private.h includes common-macros.h to satisfy the fuzzer build. Link: https://gitlab.com/xen-project/xen/-/issues/180 Signed-off-by: Jason Andryuk --- ELF Note printing

[PATCH v4 1/5] Revert "xen/x86: bzImage parse kernel_alignment"

2024-03-25 Thread Jason Andryuk
A new ELF note will specify the alignment for a relocatable PVH kernel. ELF notes are suitable for vmlinux and other ELF files, so this Linux-specific bzImage parsing in unnecessary. This reverts commit c44cac229067faeec8f49247d1cf281723ac2d40. Signed-off-by: Jason Andryuk --- xen/arch/x86

Re: [PATCH v3 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-22 Thread Jason Andryuk
On 2024-03-21 09:45, Jason Andryuk wrote: On 2024-03-20 10:39, Jan Beulich wrote: On 19.03.2024 21:58, Jason Andryuk wrote: @@ -536,6 +565,10 @@ elf_errorstatus elf_xen_parse(struct elf_binary *elf,   parms->p2m_base = UNSET_ADDR;   parms->elf_paddr_offset = UNSET_ADDR;  

Re: [PATCH v3 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-21 Thread Jason Andryuk
On 2024-03-20 10:39, Jan Beulich wrote: On 19.03.2024 21:58, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -537,6 +537,97 @@ static paddr_t __init find_memory( return INVALID_PADDR; } +static bool __init check_load_address

Re: [PATCH v3] Input: xen-kbdfront - drop keys to shrink modalias

2024-03-20 Thread Jason Andryuk
Andryuk wrote: > > Hi Dmitry, > > Do you have any feedback or can you pick this up? > > Thanks, > Jason > > On Wed, Oct 11, 2023 at 3:34 PM Jason Andryuk wrote: > > > > xen kbdfront registers itself as being able to deliver *any* key since > > it d

[PATCH v3] RFC: x86/pvh: Make Xen PVH entrypoint PIC for x86-64

2024-03-19 Thread Jason Andryuk
-by: Jason Andryuk --- Put this out as an example for the Xen modifications Instead of setting and clearing phys_base, add a dedicated variable? Clearing phys_base is a little weird, but it leaves the kernel more consistent when running non-entry code. Make __startup_64() exit if phys_base is already

[PATCH v3 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-19 Thread Jason Andryuk
Signed-off-by: Jason Andryuk --- ELF Note printing looks like: (XEN) ELF: note: PHYS32_RELOC = max: 0x min: 0x100 align: 0x20 v2: Use elfnote for min, max & align - use 64bit values. Print original and relocated memory addresses Use check_and_adjust_load_address() name Return reloc

[PATCH v3 1/3] Revert "xen/x86: bzImage parse kernel_alignment"

2024-03-19 Thread Jason Andryuk
A new ELF note will specify the alignment for a relocatable PVH kernel. ELF notes are suitable for vmlinux and other ELF files, so this Linux-specific bzImage parsing in unnecessary. This reverts commit c44cac229067faeec8f49247d1cf281723ac2d40. Signed-off-by: Jason Andryuk --- xen/arch/x86

[PATCH v3 2/3] libelf: Expand ELF note printing

2024-03-19 Thread Jason Andryuk
ELFNOTE_NAME to only print the name without a value like: (XEN) ELF: note: L1_MFN_VALID Signed-off-by: Jason Andryuk --- v3: Remove fatal size check Don't print values - just the name for presence --- xen/common/libelf/libelf-dominfo.c | 50 +- 1 file changed, 29 insertions

[PATCH v3 0/3] x86/pvh: Support relocating dom0 kernel

2024-03-19 Thread Jason Andryuk
The third patch expands the pvh dom0 kernel placement code. I'll post an additional patch showing the Linux changes to make PVH relocatable. Jason Andryuk (3): Revert "xen/x86: bzImage parse kernel_alignment" libelf: Expand ELF note printing x86/PVH: Support relocatable dom0 ke

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-19 Thread Jason Andryuk
On 2024-03-19 04:15, Jan Beulich wrote: On 18.03.2024 22:21, Jason Andryuk wrote: On 2024-03-15 05:48, Jan Beulich wrote: On 14.03.2024 20:19, Jason Andryuk wrote: On 2024-03-14 09:31, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-18 Thread Jason Andryuk
On 2024-03-15 05:48, Jan Beulich wrote: On 14.03.2024 20:19, Jason Andryuk wrote: On 2024-03-14 09:31, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -537,6 +537,108 @@ static paddr_t __init find_memory

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-18 Thread Jason Andryuk
On 2024-03-14 10:19, Jan Beulich wrote: On 14.03.2024 15:13, Jason Andryuk wrote: On 2024-03-14 09:21, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/include/public/elfnote.h +++ b/xen/include/public/elfnote.h @@ -194,6 +194,17 @@ */ #define

  1   2   3   4   5   6   7   8   9   10   >