Commit 16ce771b authored by Radim Krčmář's avatar Radim Krčmář

Merge branch 'kvm-ppc-fixes' of...

Merge branch 'kvm-ppc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into next

Two bug fixes for HV KVM on POWER9 machines.
parents acc9ab60 4e5acdc2
...@@ -46,7 +46,7 @@ extern struct patb_entry *partition_tb; ...@@ -46,7 +46,7 @@ extern struct patb_entry *partition_tb;
/* Bits in patb0 field */ /* Bits in patb0 field */
#define PATB_HR (1UL << 63) #define PATB_HR (1UL << 63)
#define RPDB_MASK 0x0ffffffffffff00fUL #define RPDB_MASK 0x0fffffffffffff00UL
#define RPDB_SHIFT (1UL << 8) #define RPDB_SHIFT (1UL << 8)
#define RTS1_SHIFT 61 /* top 2 bits of radix tree size */ #define RTS1_SHIFT 61 /* top 2 bits of radix tree size */
#define RTS1_MASK (3UL << RTS1_SHIFT) #define RTS1_MASK (3UL << RTS1_SHIFT)
...@@ -57,6 +57,7 @@ extern struct patb_entry *partition_tb; ...@@ -57,6 +57,7 @@ extern struct patb_entry *partition_tb;
/* Bits in patb1 field */ /* Bits in patb1 field */
#define PATB_GR (1UL << 63) /* guest uses radix; must match HR */ #define PATB_GR (1UL << 63) /* guest uses radix; must match HR */
#define PRTS_MASK 0x1f /* process table size field */ #define PRTS_MASK 0x1f /* process table size field */
#define PRTB_MASK 0x0ffffffffffff000UL
/* /*
* Limit process table to PAGE_SIZE table. This * Limit process table to PAGE_SIZE table. This
......
...@@ -32,6 +32,7 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, ...@@ -32,6 +32,7 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
u32 pid; u32 pid;
int ret, level, ps; int ret, level, ps;
__be64 prte, rpte; __be64 prte, rpte;
unsigned long ptbl;
unsigned long root, pte, index; unsigned long root, pte, index;
unsigned long rts, bits, offset; unsigned long rts, bits, offset;
unsigned long gpa; unsigned long gpa;
...@@ -53,8 +54,8 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, ...@@ -53,8 +54,8 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
return -EINVAL; return -EINVAL;
/* Read partition table to find root of tree for effective PID */ /* Read partition table to find root of tree for effective PID */
ret = kvm_read_guest(kvm, kvm->arch.process_table + pid * 16, ptbl = (kvm->arch.process_table & PRTB_MASK) + (pid * 16);
&prte, sizeof(prte)); ret = kvm_read_guest(kvm, ptbl, &prte, sizeof(prte));
if (ret) if (ret)
return ret; return ret;
......
...@@ -1787,12 +1787,12 @@ kvmppc_hdsi: ...@@ -1787,12 +1787,12 @@ kvmppc_hdsi:
/* HPTE not found fault or protection fault? */ /* HPTE not found fault or protection fault? */
andis. r0, r6, (DSISR_NOHPTE | DSISR_PROTFAULT)@h andis. r0, r6, (DSISR_NOHPTE | DSISR_PROTFAULT)@h
beq 1f /* if not, send it to the guest */ beq 1f /* if not, send it to the guest */
andi. r0, r11, MSR_DR /* data relocation enabled? */
beq 3f
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
mfspr r5, SPRN_ASDR /* on POWER9, use ASDR to get VSID */ mfspr r5, SPRN_ASDR /* on POWER9, use ASDR to get VSID */
b 4f b 4f
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
andi. r0, r11, MSR_DR /* data relocation enabled? */
beq 3f
clrrdi r0, r4, 28 clrrdi r0, r4, 28
PPC_SLBFEE_DOT(R5, R0) /* if so, look up SLB */ PPC_SLBFEE_DOT(R5, R0) /* if so, look up SLB */
li r0, BOOK3S_INTERRUPT_DATA_SEGMENT li r0, BOOK3S_INTERRUPT_DATA_SEGMENT
...@@ -1879,12 +1879,12 @@ kvmppc_hisi: ...@@ -1879,12 +1879,12 @@ kvmppc_hisi:
bne .Lradix_hisi /* for radix, just save ASDR */ bne .Lradix_hisi /* for radix, just save ASDR */
andis. r0, r11, SRR1_ISI_NOPT@h andis. r0, r11, SRR1_ISI_NOPT@h
beq 1f beq 1f
andi. r0, r11, MSR_IR /* instruction relocation enabled? */
beq 3f
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
mfspr r5, SPRN_ASDR /* on POWER9, use ASDR to get VSID */ mfspr r5, SPRN_ASDR /* on POWER9, use ASDR to get VSID */
b 4f b 4f
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
andi. r0, r11, MSR_IR /* instruction relocation enabled? */
beq 3f
clrrdi r0, r10, 28 clrrdi r0, r10, 28
PPC_SLBFEE_DOT(R5, R0) /* if so, look up SLB */ PPC_SLBFEE_DOT(R5, R0) /* if so, look up SLB */
li r0, BOOK3S_INTERRUPT_INST_SEGMENT li r0, BOOK3S_INTERRUPT_INST_SEGMENT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment