Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 541d8f4d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull KVM fixes from Paolo Bonzini:
 "Miscellaneous bugfixes.

  The ARM and s390 fixes are for new regressions from the merge window,
  others are usual stable material"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  compiler-gcc: disable -ftracer for __noclone functions
  kvm: x86: make lapic hrtimer pinned
  s390/mm/kvm: fix mis-merge in gmap handling
  kvm: set page dirty only if page has been writable
  KVM: x86: reduce default value of halt_poll_ns parameter
  KVM: Hyper-V: do not do hypercall userspace exits if SynIC is disabled
  KVM: x86: Inject pending interrupt even if pending nmi exist
  arm64: KVM: Register CPU notifiers when the kernel runs at HYP
  arm64: kvm: 4.6-rc1: Fix VTCR_EL2 VS setting
parents 5003bc6c 95272c29
Loading
Loading
Loading
Loading
+33 −19
Original line number Diff line number Diff line
@@ -1061,15 +1061,27 @@ static void cpu_init_hyp_mode(void *dummy)
	kvm_arm_init_debug();
}

static void cpu_hyp_reinit(void)
{
	if (is_kernel_in_hyp_mode()) {
		/*
		 * cpu_init_stage2() is safe to call even if the PM
		 * event was cancelled before the CPU was reset.
		 */
		cpu_init_stage2(NULL);
	} else {
		if (__hyp_get_vectors() == hyp_default_vectors)
			cpu_init_hyp_mode(NULL);
	}
}

static int hyp_init_cpu_notify(struct notifier_block *self,
			       unsigned long action, void *cpu)
{
	switch (action) {
	case CPU_STARTING:
	case CPU_STARTING_FROZEN:
		if (__hyp_get_vectors() == hyp_default_vectors)
			cpu_init_hyp_mode(NULL);
		break;
		cpu_hyp_reinit();
	}

	return NOTIFY_OK;
@@ -1084,9 +1096,8 @@ static int hyp_init_cpu_pm_notifier(struct notifier_block *self,
				    unsigned long cmd,
				    void *v)
{
	if (cmd == CPU_PM_EXIT &&
	    __hyp_get_vectors() == hyp_default_vectors) {
		cpu_init_hyp_mode(NULL);
	if (cmd == CPU_PM_EXIT) {
		cpu_hyp_reinit();
		return NOTIFY_OK;
	}

@@ -1127,6 +1138,22 @@ static int init_subsystems(void)
{
	int err;

	/*
	 * Register CPU Hotplug notifier
	 */
	cpu_notifier_register_begin();
	err = __register_cpu_notifier(&hyp_init_cpu_nb);
	cpu_notifier_register_done();
	if (err) {
		kvm_err("Cannot register KVM init CPU notifier (%d)\n", err);
		return err;
	}

	/*
	 * Register CPU lower-power notifier
	 */
	hyp_cpu_pm_init();

	/*
	 * Init HYP view of VGIC
	 */
@@ -1270,19 +1297,6 @@ static int init_hyp_mode(void)
	free_boot_hyp_pgd();
#endif

	cpu_notifier_register_begin();

	err = __register_cpu_notifier(&hyp_init_cpu_nb);

	cpu_notifier_register_done();

	if (err) {
		kvm_err("Cannot register HYP init CPU notifier (%d)\n", err);
		goto out_err;
	}

	hyp_cpu_pm_init();

	/* set size of VMID supported by CPU */
	kvm_vmid_bits = kvm_get_vmid_bits();
	kvm_info("%d-bit VMID\n", kvm_vmid_bits);
+3 −1
Original line number Diff line number Diff line
@@ -124,7 +124,9 @@
#define VTCR_EL2_SL0_LVL1	(1 << 6)
#define VTCR_EL2_T0SZ_MASK	0x3f
#define VTCR_EL2_T0SZ_40B	24
#define VTCR_EL2_VS		19
#define VTCR_EL2_VS_SHIFT	19
#define VTCR_EL2_VS_8BIT	(0 << VTCR_EL2_VS_SHIFT)
#define VTCR_EL2_VS_16BIT	(1 << VTCR_EL2_VS_SHIFT)

/*
 * We configure the Stage-2 page tables to always restrict the IPA space to be
+3 −0
Original line number Diff line number Diff line
@@ -141,6 +141,9 @@
#define ID_AA64MMFR1_VMIDBITS_SHIFT	4
#define ID_AA64MMFR1_HADBS_SHIFT	0

#define ID_AA64MMFR1_VMIDBITS_8		0
#define ID_AA64MMFR1_VMIDBITS_16	2

/* id_aa64mmfr2 */
#define ID_AA64MMFR2_UAO_SHIFT		4

+4 −2
Original line number Diff line number Diff line
@@ -36,8 +36,10 @@ void __hyp_text __init_stage2_translation(void)
	 * Read the VMIDBits bits from ID_AA64MMFR1_EL1 and set the VS
	 * bit in VTCR_EL2.
	 */
	tmp = (read_sysreg(id_aa64mmfr1_el1) >> 4) & 0xf;
	val |= (tmp == 2) ? VTCR_EL2_VS : 0;
	tmp = (read_sysreg(id_aa64mmfr1_el1) >> ID_AA64MMFR1_VMIDBITS_SHIFT) & 0xf;
	val |= (tmp == ID_AA64MMFR1_VMIDBITS_16) ?
			VTCR_EL2_VS_16BIT :
			VTCR_EL2_VS_8BIT;

	write_sysreg(val, vtcr_el2);
}
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
/**
 * gmap_alloc - allocate a guest address space
 * @mm: pointer to the parent mm_struct
 * @limit: maximum size of the gmap address space
 * @limit: maximum address of the gmap address space
 *
 * Returns a guest address space structure.
 */
@@ -292,7 +292,7 @@ int gmap_map_segment(struct gmap *gmap, unsigned long from,
	if ((from | to | len) & (PMD_SIZE - 1))
		return -EINVAL;
	if (len == 0 || from + len < from || to + len < to ||
	    from + len > TASK_MAX_SIZE || to + len > gmap->asce_end)
	    from + len - 1 > TASK_MAX_SIZE || to + len - 1 > gmap->asce_end)
		return -EINVAL;

	flush = 0;
Loading