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

Commit bc90923e authored by Alexander Graf's avatar Alexander Graf Committed by Marcelo Tosatti
Browse files

KVM: PPC: Get rid of unnecessary RFI



Using an RFI in IR=1 is dangerous. We need to set two SRRs and then do an RFI
without getting interrupted at all, because every interrupt could potentially
overwrite the SRR values.

Fortunately, we don't need to RFI in at least this particular case of the code,
so we can just replace it with an mtmsr and b.

Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent b4433a7c
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -221,15 +221,8 @@ no_dcbz32_off:
	mflr	r5
	mflr	r5
	std	r5, VCPU_LR(r7)
	std	r5, VCPU_LR(r7)


	/* XXX convert to safe function call */

	/* Restore host msr -> SRR1 */
	/* Restore host msr -> SRR1 */
	ld	r6, VCPU_HOST_MSR(r7)
	ld	r6, VCPU_HOST_MSR(r7)
	mtsrr1	r6

	/* Restore host IP -> SRR0 */
	ld	r5, VCPU_HOST_RETIP(r7)
	mtsrr0	r5


	/*
	/*
	 * For some interrupts, we need to call the real Linux
	 * For some interrupts, we need to call the real Linux
@@ -246,8 +239,9 @@ no_dcbz32_off:
	cmpwi	r12, BOOK3S_INTERRUPT_DECREMENTER
	cmpwi	r12, BOOK3S_INTERRUPT_DECREMENTER
	beq	call_linux_handler
	beq	call_linux_handler


	/* Back to Interruptable Mode! (goto kvm_return_point) */
	/* Back to EE=1 */
	RFI
	mtmsr	r6
	b	kvm_return_point


call_linux_handler:
call_linux_handler:


@@ -260,10 +254,16 @@ call_linux_handler:
	 * interrupt handler!
	 * interrupt handler!
	 *
	 *
	 * R3 still contains the exit code,
	 * R3 still contains the exit code,
	 * R6 VCPU_HOST_RETIP and
	 * R5 VCPU_HOST_RETIP and
	 * R7 VCPU_HOST_MSR
	 * R6 VCPU_HOST_MSR
	 */
	 */


	/* Restore host IP -> SRR0 */
	ld	r5, VCPU_HOST_RETIP(r7)

	/* XXX Better move to a safe function?
	 *     What if we get an HTAB flush in between mtsrr0 and mtsrr1? */

	mtlr	r12
	mtlr	r12


	ld	r4, VCPU_TRAMPOLINE_LOWMEM(r7)
	ld	r4, VCPU_TRAMPOLINE_LOWMEM(r7)