Skip to content

Commit 5cf5240

Browse files
committed
Merge tag 'for-linus-6.16-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen updates from Juergen Gross: - A fix for running as a Xen dom0 on the iMX8QXP Arm platform - An update of the xen.config adding XEN_UNPOPULATED_ALLOC for better support of PVH dom0 - A fix of the Xen balloon driver when running without CONFIG_XEN_UNPOPULATED_ALLOC - A fix of the dm_op Xen hypercall on Arm needed to pass user space buffers to the hypervisor in certain configurations * tag 'for-linus-6.16-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/arm: call uaccess_ttbr0_enable for dm_op hypercall xen/x86: fix initial memory balloon target xen: enable XEN_UNPOPULATED_ALLOC as part of xen.config xen: swiotlb: Wire up map_resource callback
2 parents 23022f5 + 7f9bbc1 commit 5cf5240

4 files changed

Lines changed: 32 additions & 6 deletions

File tree

arch/arm64/xen/hypercall.S

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,26 @@ HYPERCALL3(vcpu_op);
8383
HYPERCALL1(platform_op_raw);
8484
HYPERCALL2(multicall);
8585
HYPERCALL2(vm_assist);
86-
HYPERCALL3(dm_op);
86+
87+
SYM_FUNC_START(HYPERVISOR_dm_op)
88+
mov x16, #__HYPERVISOR_dm_op; \
89+
/*
90+
* dm_op hypercalls are issued by the userspace. The kernel needs to
91+
* enable access to TTBR0_EL1 as the hypervisor would issue stage 1
92+
* translations to user memory via AT instructions. Since AT
93+
* instructions are not affected by the PAN bit (ARMv8.1), we only
94+
* need the explicit uaccess_enable/disable if the TTBR0 PAN emulation
95+
* is enabled (it implies that hardware UAO and PAN disabled).
96+
*/
97+
uaccess_ttbr0_enable x6, x7, x8
98+
hvc XEN_IMM
99+
100+
/*
101+
* Disable userspace access from kernel once the hyp call completed.
102+
*/
103+
uaccess_ttbr0_disable x6, x7
104+
ret
105+
SYM_FUNC_END(HYPERVISOR_dm_op);
87106

88107
SYM_FUNC_START(privcmd_call)
89108
mov x16, x0

drivers/xen/balloon.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,15 +704,18 @@ static int __init balloon_add_regions(void)
704704

705705
/*
706706
* Extra regions are accounted for in the physmap, but need
707-
* decreasing from current_pages to balloon down the initial
708-
* allocation, because they are already accounted for in
709-
* total_pages.
707+
* decreasing from current_pages and target_pages to balloon
708+
* down the initial allocation, because they are already
709+
* accounted for in total_pages.
710710
*/
711-
if (extra_pfn_end - start_pfn >= balloon_stats.current_pages) {
711+
pages = extra_pfn_end - start_pfn;
712+
if (pages >= balloon_stats.current_pages ||
713+
pages >= balloon_stats.target_pages) {
712714
WARN(1, "Extra pages underflow current target");
713715
return -ERANGE;
714716
}
715-
balloon_stats.current_pages -= extra_pfn_end - start_pfn;
717+
balloon_stats.current_pages -= pages;
718+
balloon_stats.target_pages -= pages;
716719
}
717720

718721
return 0;

drivers/xen/swiotlb-xen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,4 +426,5 @@ const struct dma_map_ops xen_swiotlb_dma_ops = {
426426
.alloc_pages_op = dma_common_alloc_pages,
427427
.free_pages = dma_common_free_pages,
428428
.max_mapping_size = swiotlb_max_mapping_size,
429+
.map_resource = dma_direct_map_resource,
429430
};

kernel/configs/xen.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ CONFIG_SCSI=y
1313
CONFIG_FB=y
1414
CONFIG_INPUT_MISC=y
1515
CONFIG_MEMORY_HOTPLUG=y
16+
CONFIG_MEMORY_HOTREMOVE=y
17+
CONFIG_ZONE_DEVICE=y
1618
CONFIG_TTY=y
1719
# Technically not required but otherwise produces
1820
# pretty useless systems starting from allnoconfig
@@ -47,3 +49,4 @@ CONFIG_XEN_GNTDEV=m
4749
CONFIG_XEN_GRANT_DEV_ALLOC=m
4850
CONFIG_SWIOTLB_XEN=y
4951
CONFIG_XEN_PRIVCMD=m
52+
CONFIG_XEN_UNPOPULATED_ALLOC=y

0 commit comments

Comments
 (0)