ppc patch queue 2012-08-16 for 3.6
Subsystems (3)
Hi Avi,
This is my patch queue for ppc patches that should go into 3.6. Please pull.
* Fix memset in e500_tlb
* Fix icache flush when mapping executable pages
* Fix wrong branch in book3s hv code
Alex
The following changes since commit 439793d4b3c99e550daebd868bbd58967c93d0b3:
Gleb Natapov (1):
KVM: x86: update KVM_SAVE_MSRS_BEGIN to correct value
are available in the git repository at:
git://github.com/agraf/linux-2.6.git for-upstream-master
Alan Cox (1):
ppc: e500_tlb memset clears nothing
Alexander Graf (1):
KVM: PPC: Add cache flush on page map
Paul Mackerras (1):
KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code
arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/include/asm/kvm_ppc.h | 12 ++++++++++++ arch/powerpc/kvm/book3s_32_mmu_host.c | 3 +++ arch/powerpc/kvm/book3s_64_mmu_host.c | 2 ++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 +++++++----- arch/powerpc/kvm/e500_tlb.c | 11 +++++++---- arch/powerpc/mm/mem.c | 1 + 7 files changed, 33 insertions(+), 9 deletions(-)
PATCH 1/3 KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code
From: Paul Mackerras <[email protected]>
In handling the H_CEDE hypercall, if this vcpu has already been prodded (with the H_PROD hypercall, which Linux guests don't in fact use), we branch to a numeric label '1f'. Unfortunately there is another '1:' label before the one that we want to jump to. This fixes the problem by using a textual label, 'kvm_cede_prodded'. It also changes the label for another longish branch from '2:' to 'kvm_cede_exit' to avoid a possible future problem if code modifications add another numeric '2:' label in between.
--- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +7 -5
@@ -1421,13 +1421,13 @@ _GLOBAL(kvmppc_h_cede) sync /* order setting ceded vs. testing prodded */ lbz r5,VCPU_PRODDED(r3) cmpwi r5,0 - bne 1f + bne kvm_cede_prodded li r0,0 /* set trap to 0 to say hcall is handled */ stw r0,VCPU_TRAP(r3) li r0,H_SUCCESS std r0,VCPU_GPR(R3)(r3) BEGIN_FTR_SECTION - b 2f /* just send it up to host on 970 */ + b kvm_cede_exit /* just send it up to host on 970 */ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) /*
@@ -1446,7 +1446,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) or r4,r4,r0 PPC_POPCNTW(R7,R4) cmpw r7,r8 - bge 2f + bge kvm_cede_exit stwcx. r4,0,r6 bne 31b li r0,1
@@ -1555,7 +1555,8 @@ kvm_end_cede: b hcall_real_fallback /* cede when already previously prodded case */ -1: li r0,0 +kvm_cede_prodded: + li r0,0 stb r0,VCPU_PRODDED(r3) sync /* order testing prodded vs. clearing ceded */ stb r0,VCPU_CEDED(r3)
@@ -1563,7 +1564,8 @@ kvm_end_cede: blr /* we've ceded but we want to give control to the host */ -2: li r3,H_TOO_HARD +kvm_cede_exit: + li r3,H_TOO_HARD blr secondary_too_late:
Signature · 1 line
1.6.0.2
PATCH 2/3 KVM: PPC: Add cache flush on page map
In reply to Alexander GrafWhen we map a page that wasn't icache cleared before, do so when first mapping it in KVM using the same information bits as the Linux mapping logic. That way we are 100% sure that any page we map does not have stale entries in the icache.
--- arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/include/asm/kvm_ppc.h | 12 ++++++++++++ arch/powerpc/kvm/book3s_32_mmu_host.c | 3 +++ arch/powerpc/kvm/book3s_64_mmu_host.c | 2 ++ arch/powerpc/kvm/e500_tlb.c | 3 +++ arch/powerpc/mm/mem.c | 1 + 6 files changed, 22 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/kvm_host.h +1 -0
@@ -33,6 +33,7 @@#include <asm/kvm_asm.h> #include <asm/processor.h> #include <asm/page.h> +#include <asm/cacheflush.h> #define KVM_MAX_VCPUS NR_CPUS#define KVM_MAX_VCORES NR_CPUS
arch/powerpc/include/asm/kvm_ppc.h +12 -0
@@ -219,4 +219,16 @@ void kvmppc_claim_lpid(long lpid);void kvmppc_free_lpid (long lpid);void kvmppc_init_lpid (unsigned long nr_lpids); +static inline void kvmppc_mmu_flush_icache (pfn_t pfn) +{ +/* Clear i-cache for new pages */ +struct page *page; + page =pfn_to_page (pfn); +if (!test_bit (PG_arch_1, &page->flags)) { +flush_dcache_icache_page (page); +set_bit (PG_arch_1, &page->flags); + } +} + +#endif /* __POWERPC_KVM_PPC_H__ */
arch/powerpc/kvm/book3s_32_mmu_host.c +3 -0
@@ -211,6 +211,9 @@ next_pteg: pteg1 |=PP_RWRX ; } +if (orig_pte->may_execute) +kvmppc_mmu_flush_icache (hpaddr >>PAGE_SHIFT ); +local_irq_disable ();if (pteg[rr]) {
arch/powerpc/kvm/book3s_64_mmu_host.c +2 -0
@@ -126,6 +126,8 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)if (!orig_pte->may_execute) rflags |=HPTE_R_N ; +else +kvmppc_mmu_flush_icache (hpaddr >>PAGE_SHIFT ); hash =hpt_hash (va,PTE_SIZE ,MMU_SEGSIZE_256M );
arch/powerpc/kvm/e500_tlb.c +3 -0
@@ -539,6 +539,9 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,kvmppc_e500_setup_stlbe (&vcpu_e500->vcpu, gtlbe, tsize, ref, gvaddr, stlbe); + +/* Clear i-cache for new pages */ +kvmppc_mmu_flush_icache (pfn); }/* XXX only map the one-one case, for now use TLB0 */
arch/powerpc/mm/mem.c +1 -0
@@ -469,6 +469,7 @@ void flush_dcache_icache_page(struct page *page)__flush_dcache_icache_phys (page_to_pfn (page) <<PAGE_SHIFT );#endif } +EXPORT_SYMBOL (flush_dcache_icache_page);void clear_user_page (void *page,unsigned long vaddr,struct page *pg) {
Signature · 1 line
1.6.0.2
PATCH 3/3 ppc: e500_tlb memset clears nothing
In reply to Alexander GrafFrom: Alan Cox <[email protected]>
Put the parameters the right way around
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44031
--- arch/powerpc/kvm/e500_tlb.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kvm/e500_tlb.c +4 -4
@@ -322,11 +322,11 @@ static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref)static void clear_tlb1_bitmap (struct kvmppc_vcpu_e500 *vcpu_e500) {if (vcpu_e500->g2h_tlb1_map) -memset (vcpu_e500->g2h_tlb1_map, -sizeof (u64) * vcpu_e500->gtlb_params[1 ].entries,0 ); +memset (vcpu_e500->g2h_tlb1_map,0 , +sizeof (u64) * vcpu_e500->gtlb_params[1 ].entries);if (vcpu_e500->h2g_tlb1_rmap) -memset (vcpu_e500->h2g_tlb1_rmap, -sizeof (unsigned int ) * host_tlb_params[1 ].entries,0 ); +memset (vcpu_e500->h2g_tlb1_rmap,0 , +sizeof (unsigned int ) * host_tlb_params[1 ].entries); }static void clear_tlb_privs (struct kvmppc_vcpu_e500 *vcpu_e500)
Signature · 1 line
1.6.0.2
Quoted 28 lines · Alexander Graf
Hi Avi,
This is my patch queue for ppc patches that should go into 3.6. Please pull.
* Fix memset in
e500_tlb
* Fix icache flush when mapping executable pages
* Fix wrong branch in book3s hv codeAlex
The following changes since commit
439793d4b3c99e550daebd868bbd58967c93d0b3:
Gleb Natapov (1):
KVM: x86: updateKVM_SAVE_MSRS_BEGINto correct valueare available in the git repository at:
git://github.com/agraf/linux-2.6.gitfor-upstream-masterAlan Cox (1):
ppc:e500_tlbmemset clears nothingAlexander Graf (1):
KVM: PPC: Add cache flush on page mapPaul Mackerras (1):
KVM: PPC: Book3S HV: Fix incorrect branch inH_CEDEcode
Quoted 8 lines
arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/include/asm/kvm_ppc.h | 12 ++++++++++++ arch/powerpc/kvm/book3s_32_mmu_host.c | 3 +++ arch/powerpc/kvm/book3s_64_mmu_host.c | 2 ++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 +++++++----- arch/powerpc/kvm/e500_tlb.c | 11 +++++++---- arch/powerpc/mm/mem.c | 1 + 7 files changed, 33 insertions(+), 9 deletions(-)
Pulled, thanks.