* [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6
@ 2012-08-16 12:16 Alexander Graf
2012-08-16 12:16 ` [PATCH 1/3] KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code Alexander Graf
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Alexander Graf @ 2012-08-16 12:16 UTC (permalink / raw)
To: kvm-ppc; +Cc: KVM list
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(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code
2012-08-16 12:16 [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Alexander Graf
@ 2012-08-16 12:16 ` Alexander Graf
2012-08-16 12:16 ` [PATCH 2/3] KVM: PPC: Add cache flush on page map Alexander Graf
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2012-08-16 12:16 UTC (permalink / raw)
To: kvm-ppc; +Cc: KVM list, Paul Mackerras
From: Paul Mackerras <paulus@samba.org>
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.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 5a84c8d..44b72fe 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -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:
--
1.6.0.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] KVM: PPC: Add cache flush on page map
2012-08-16 12:16 [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Alexander Graf
2012-08-16 12:16 ` [PATCH 1/3] KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code Alexander Graf
@ 2012-08-16 12:16 ` Alexander Graf
2012-08-16 12:16 ` [PATCH 3/3] ppc: e500_tlb memset clears nothing Alexander Graf
2012-08-17 0:13 ` [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Marcelo Tosatti
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2012-08-16 12:16 UTC (permalink / raw)
To: kvm-ppc; +Cc: KVM list
When 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.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
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(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 50ea12f..a8bf5c6 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -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
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 0124937..e006f0b 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -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__ */
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index f922c29..837f13e 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -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]) {
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 10fc8ec..0688b6b 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -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);
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index c510fc9..fb3bb3a 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -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 */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index baaafde..fbdad0e 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -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)
{
--
1.6.0.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] ppc: e500_tlb memset clears nothing
2012-08-16 12:16 [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Alexander Graf
2012-08-16 12:16 ` [PATCH 1/3] KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code Alexander Graf
2012-08-16 12:16 ` [PATCH 2/3] KVM: PPC: Add cache flush on page map Alexander Graf
@ 2012-08-16 12:16 ` Alexander Graf
2012-08-17 0:13 ` [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Marcelo Tosatti
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2012-08-16 12:16 UTC (permalink / raw)
To: kvm-ppc; +Cc: KVM list, Alan Cox, Andrew Morton
From: Alan Cox <alan@linux.intel.com>
Put the parameters the right way around
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44031
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/kvm/e500_tlb.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index fb3bb3a..a2b6671 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -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)
--
1.6.0.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6
2012-08-16 12:16 [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Alexander Graf
` (2 preceding siblings ...)
2012-08-16 12:16 ` [PATCH 3/3] ppc: e500_tlb memset clears nothing Alexander Graf
@ 2012-08-17 0:13 ` Marcelo Tosatti
3 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2012-08-17 0:13 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm-ppc, KVM list
On Thu, Aug 16, 2012 at 02:16:50PM +0200, Alexander Graf wrote:
> 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(-)
Pulled, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-17 13:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 12:16 [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Alexander Graf
2012-08-16 12:16 ` [PATCH 1/3] KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code Alexander Graf
2012-08-16 12:16 ` [PATCH 2/3] KVM: PPC: Add cache flush on page map Alexander Graf
2012-08-16 12:16 ` [PATCH 3/3] ppc: e500_tlb memset clears nothing Alexander Graf
2012-08-17 0:13 ` [PULL 3.6 0/3] ppc patch queue 2012-08-16 for 3.6 Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).