Skip to content

Commit a09b1d7

Browse files
committed
Merge tag 'for-linus-5.10b-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen updates from Juergen Gross: - two small cleanup patches - avoid error messages when initializing MCA banks in a Xen dom0 - a small series for converting the Xen gntdev driver to use pin_user_pages*() instead of get_user_pages*() - intermediate fix for running as a Xen guest on Arm with KPTI enabled (the final solution will need new Xen functionality) * tag 'for-linus-5.10b-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: x86/xen: Fix typo in xen_pagetable_p2m_free() x86/xen: disable Firmware First mode for correctable memory errors xen/arm: do not setup the runstate info page if kpti is enabled xen: remove redundant initialization of variable ret xen/gntdev.c: Convert get_user_pages*() to pin_user_pages*() xen/gntdev.c: Mark pages as dirty
2 parents 4907a43 + 32118f9 commit a09b1d7

7 files changed

Lines changed: 35 additions & 12 deletions

File tree

arch/arm/include/asm/xen/page.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
#include <xen/arm/page.h>
2+
3+
static inline bool xen_kernel_unmapped_at_usr(void)
4+
{
5+
return false;
6+
}

arch/arm/xen/enlighten.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ static int xen_starting_cpu(unsigned int cpu)
158158
BUG_ON(err);
159159
per_cpu(xen_vcpu, cpu) = vcpup;
160160

161-
xen_setup_runstate_info(cpu);
161+
if (!xen_kernel_unmapped_at_usr())
162+
xen_setup_runstate_info(cpu);
162163

163164
after_register_vcpu_info:
164165
enable_percpu_irq(xen_events_irq, 0);
@@ -387,7 +388,8 @@ static int __init xen_guest_init(void)
387388
return -EINVAL;
388389
}
389390

390-
xen_time_setup_guest();
391+
if (!xen_kernel_unmapped_at_usr())
392+
xen_time_setup_guest();
391393

392394
if (xen_initial_domain())
393395
pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);

arch/arm64/include/asm/xen/page.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
#include <xen/arm/page.h>
2+
#include <asm/mmu.h>
3+
4+
static inline bool xen_kernel_unmapped_at_usr(void)
5+
{
6+
return arm64_kernel_unmapped_at_el0();
7+
}

arch/x86/xen/enlighten_pv.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,15 @@ asmlinkage __visible void __init xen_start_kernel(void)
13701370
x86_init.mpparse.get_smp_config = x86_init_uint_noop;
13711371

13721372
xen_boot_params_init_edd();
1373+
1374+
#ifdef CONFIG_ACPI
1375+
/*
1376+
* Disable selecting "Firmware First mode" for correctable
1377+
* memory errors, as this is the duty of the hypervisor to
1378+
* decide.
1379+
*/
1380+
acpi_disable_cmcff = 1;
1381+
#endif
13731382
}
13741383

13751384
if (!boot_params.screen_info.orig_video_isVGA)

arch/x86/xen/mmu_pv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ static void __init xen_pagetable_p2m_free(void)
11421142
* We could be in __ka space.
11431143
* We roundup to the PMD, which means that if anybody at this stage is
11441144
* using the __ka address of xen_start_info or
1145-
* xen_start_info->shared_info they are in going to crash. Fortunatly
1145+
* xen_start_info->shared_info they are in going to crash. Fortunately
11461146
* we have already revectored in xen_setup_kernel_pagetable.
11471147
*/
11481148
size = roundup(size, PMD_SIZE);

drivers/xen/gntdev.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -720,17 +720,18 @@ struct gntdev_copy_batch {
720720
s16 __user *status[GNTDEV_COPY_BATCH];
721721
unsigned int nr_ops;
722722
unsigned int nr_pages;
723+
bool writeable;
723724
};
724725

725726
static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,
726-
bool writeable, unsigned long *gfn)
727+
unsigned long *gfn)
727728
{
728729
unsigned long addr = (unsigned long)virt;
729730
struct page *page;
730731
unsigned long xen_pfn;
731732
int ret;
732733

733-
ret = get_user_pages_fast(addr, 1, writeable ? FOLL_WRITE : 0, &page);
734+
ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page);
734735
if (ret < 0)
735736
return ret;
736737

@@ -744,11 +745,9 @@ static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,
744745

745746
static void gntdev_put_pages(struct gntdev_copy_batch *batch)
746747
{
747-
unsigned int i;
748-
749-
for (i = 0; i < batch->nr_pages; i++)
750-
put_page(batch->pages[i]);
748+
unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable);
751749
batch->nr_pages = 0;
750+
batch->writeable = false;
752751
}
753752

754753
static int gntdev_copy(struct gntdev_copy_batch *batch)
@@ -837,8 +836,9 @@ static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch,
837836
virt = seg->source.virt + copied;
838837
off = (unsigned long)virt & ~XEN_PAGE_MASK;
839838
len = min(len, (size_t)XEN_PAGE_SIZE - off);
839+
batch->writeable = false;
840840

841-
ret = gntdev_get_page(batch, virt, false, &gfn);
841+
ret = gntdev_get_page(batch, virt, &gfn);
842842
if (ret < 0)
843843
return ret;
844844

@@ -856,8 +856,9 @@ static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch,
856856
virt = seg->dest.virt + copied;
857857
off = (unsigned long)virt & ~XEN_PAGE_MASK;
858858
len = min(len, (size_t)XEN_PAGE_SIZE - off);
859+
batch->writeable = true;
859860

860-
ret = gntdev_get_page(batch, virt, true, &gfn);
861+
ret = gntdev_get_page(batch, virt, &gfn);
861862
if (ret < 0)
862863
return ret;
863864

drivers/xen/pvcalls-front.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int alloc_active_ring(struct sock_mapping *map)
371371
static int create_active(struct sock_mapping *map, evtchn_port_t *evtchn)
372372
{
373373
void *bytes;
374-
int ret = -ENOMEM, irq = -1, i;
374+
int ret, irq = -1, i;
375375

376376
*evtchn = 0;
377377
init_waitqueue_head(&map->active.inflight_conn_req);

0 commit comments

Comments
 (0)