From: Alexander Graf <hidden> Date: 2013-01-31 13:21:13
On 30.01.2013, at 14:29, Mihai Caraman wrote:
VCPU's MMUCFG register initialization should not depend on =
KVM_CAP_SW_TLB
ioctl call. Move it earlier into tlb initalization phase.
Quite the contrary. The fact that there is an mfspr() in e500_mmu.c =
already tells us that the code is broken. The TLB guest code should only =
depend on input from the SW_TLB configuration. It's completely =
orthogonal to the host capabilities.
Alex
@@ -781,6 +779,8 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 =
*vcpu_e500)
if (!vcpu_e500->g2h_tlb1_map)
goto err;
=20
+ vcpu->arch.mmucfg =3D mfspr(SPRN_MMUCFG) & ~MMUCFG_LPIDSIZE;
+
/* Init TLB configuration register */
vcpu->arch.tlbcfg[0] =3D mfspr(SPRN_TLB0CFG) &
~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
--=20
1.7.4.1
=20
=20
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
So I suppose that means that user space doesn't tell us the possible TLB =
entry sizes through the SW_TLB config? Then we should add them there.
To not break untested code paths, we can still compare if the values =
user space asks for are identical to what physical hardware does. But =
eventually we shouldn't care.
Alex
From: Alexander Graf <hidden> Date: 2013-01-31 13:27:20
On 30.01.2013, at 14:29, Mihai Caraman wrote:
Embedded.Page Table (E.PT) category in VMs requires indirect tlb =
entries
emulation which is not supported yet. Configure TLBnCFG to remove E.PT
category from VCPUs.
=20
Signed-off-by: Mihai Caraman <redacted>
Please do this in a separate function that you call from these =
locations. That way the code is self-documenting on what it actually =
does.
Also add a comment to this one function that removes E.PT related bits =
from TLBCFG that our _guest_ mmu emulation currently doesn't handle =
E.PT.
Alex
vcpu->arch.tlbcfg[1] |=3D vcpu_e500->gtlb_params[1].entries;
vcpu->arch.tlbcfg[1] |=3D
vcpu_e500->gtlb_params[1].ways << TLBnCFG_ASSOC_SHIFT;
--=20
1.7.4.1
=20
=20
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
}
=20
+static inline unsigned int supports_page_tables(const struct kvm_vcpu =
*vcpu)
bool again. Can we generalize this a bit more? How about a small =
framework that allows us to differentiate across e.XX features?
if (has_feature(vcpu, FEATURE_E_PT))
...
@@ -799,6 +799,11 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 =
*vcpu_e500)
if (has_mmu_v2(vcpu)) {
vcpu->arch.tlbps[0] =3D mfspr(SPRN_TLB0PS);
vcpu->arch.tlbps[1] =3D mfspr(SPRN_TLB1PS);
+
+ if (supports_page_tables(vcpu))
+ vcpu->arch.eptcfg =3D mfspr(SPRN_EPTCFG);
Please don't introduce new mfspr()s here :). Just have user space set =
it.
Alex
+ else
+ vcpu->arch.eptcfg =3D 0;
}
=20
kvmppc_recalc_tlb1map_range(vcpu_e500);
--=20
1.7.4.1
=20
=20
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -172,6 +172,8 @@ int kvmppc_core_check_processor_compat(void)
r = 0;
else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0)
r = 0;
+ else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0)
+ r = 0;
else
r = -ENOTSUPP;
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Caraman Mihai Claudiu-B02008 <hidden> Date: 2013-01-31 14:56:58
-----Original Message-----
From: Alexander Graf [mailto:agraf@suse.de]
Sent: Thursday, January 31, 2013 3:21 PM
To: Caraman Mihai Claudiu-B02008
Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
dev@lists.ozlabs.org
Subject: Re: [PATCH 1/5] KVM: PPC: e500: Move VCPU's MMUCFG register
initialization earlier
=20
=20
On 30.01.2013, at 14:29, Mihai Caraman wrote:
=20
quoted
VCPU's MMUCFG register initialization should not depend on
KVM_CAP_SW_TLB
quoted
ioctl call. Move it earlier into tlb initalization phase.
=20
Quite the contrary. The fact that there is an mfspr() in e500_mmu.c
already tells us that the code is broken. The TLB guest code should only
depend on input from the SW_TLB configuration. It's completely orthogonal
to the host capabilities.
Then we have the same issue for TLBnCFG registers which need to be configur=
ed
via SW_TLB ioctl. What is the purpose of guest tlb initalization in e500_mm=
u.c
if we rely on SW_TLB?
-Mike
From: Caraman Mihai Claudiu-B02008 <hidden> Date: 2013-01-31 15:26:34
-----Original Message-----
From: Alexander Graf [mailto:agraf@suse.de]
Sent: Thursday, January 31, 2013 4:58 PM
To: Caraman Mihai Claudiu-B02008
Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
dev@lists.ozlabs.org
Subject: Re: [PATCH 1/5] KVM: PPC: e500: Move VCPU's MMUCFG register
initialization earlier
=20
=20
On 31.01.2013, at 15:56, Caraman Mihai Claudiu-B02008 wrote:
=20
quoted
quoted
-----Original Message-----
From: Alexander Graf [mailto:agraf@suse.de]
Sent: Thursday, January 31, 2013 3:21 PM
To: Caraman Mihai Claudiu-B02008
Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
dev@lists.ozlabs.org
Subject: Re: [PATCH 1/5] KVM: PPC: e500: Move VCPU's MMUCFG register
initialization earlier
On 30.01.2013, at 14:29, Mihai Caraman wrote:
quoted
VCPU's MMUCFG register initialization should not depend on
KVM_CAP_SW_TLB
quoted
ioctl call. Move it earlier into tlb initalization phase.
Quite the contrary. The fact that there is an mfspr() in e500_mmu.c
already tells us that the code is broken. The TLB guest code should
only
quoted
quoted
depend on input from the SW_TLB configuration. It's completely
orthogonal
quoted
quoted
to the host capabilities.
Then we have the same issue for TLBnCFG registers which need to be
configured
quoted
via SW_TLB ioctl. What is the purpose of guest tlb initalization in
e500_mmu.c
quoted
if we rely on SW_TLB?
=20
It's to provide a fallback to user space that doesn't implement SW_TLB
configuration yet.
Do we have such a case now or is it just hypothetical? For the fallback we
need to initialize the MMUCFG register which I intended to say in the commi=
t
message.
From: Scott Wood <hidden> Date: 2013-01-31 16:49:12
On 01/31/2013 09:26:20 AM, Caraman Mihai Claudiu-B02008 wrote:
quoted
-----Original Message-----
From: Alexander Graf [mailto:agraf@suse.de]
Sent: Thursday, January 31, 2013 4:58 PM
To: Caraman Mihai Claudiu-B02008
Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
dev@lists.ozlabs.org
Subject: Re: [PATCH 1/5] KVM: PPC: e500: Move VCPU's MMUCFG register
initialization earlier
On 31.01.2013, at 15:56, Caraman Mihai Claudiu-B02008 wrote:
quoted
quoted
-----Original Message-----
From: Alexander Graf [mailto:agraf@suse.de]
Sent: Thursday, January 31, 2013 3:21 PM
To: Caraman Mihai Claudiu-B02008
Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
dev@lists.ozlabs.org
Subject: Re: [PATCH 1/5] KVM: PPC: e500: Move VCPU's MMUCFG =20
register
quoted
quoted
quoted
initialization earlier
On 30.01.2013, at 14:29, Mihai Caraman wrote:
quoted
VCPU's MMUCFG register initialization should not depend on
KVM_CAP_SW_TLB
quoted
ioctl call. Move it earlier into tlb initalization phase.
Quite the contrary. The fact that there is an mfspr() in =20
e500_mmu.c
quoted
quoted
quoted
already tells us that the code is broken. The TLB guest code =20
should
quoted
only
quoted
quoted
depend on input from the SW_TLB configuration. It's completely
orthogonal
quoted
quoted
to the host capabilities.
Then we have the same issue for TLBnCFG registers which need to be
configured
quoted
via SW_TLB ioctl. What is the purpose of guest tlb initalization =20
in
quoted
e500_mmu.c
quoted
if we rely on SW_TLB?
It's to provide a fallback to user space that doesn't implement =20
SW_TLB
quoted
configuration yet.
=20
Do we have such a case now or is it just hypothetical? For the =20
fallback we
need to initialize the MMUCFG register which I intended to say in the =20
commit
message.
I don't think we need to support a fallback for e6500, since there's =20
nothing to be backwards compatible with.
As for use case, I don't see us ever supporting the guest being a =20
different CPU than the host. Page sizes probably aren't a problem, but =20
there are other barriers.
The main reasons that TLBnCFG are settable through SW_TLB are:
1. The guest TLB can be enlarged as a performance hack (like in Topaz, =20
though QEMU doesn't currently do this),
2. The legacy default in KVM is based on the e500v1 TLB0 size, which is =20
half of what e500v2/e500mc have, and
3. QEMU needs to know the exact geometry of the TLB so that it can =20
interpret the shared data properly.
#3 seems like a compelling reason here, to avoid silent weirdness if =20
there's a slight mismatch between what QEMU thinks it's modelling and =20
what we're actually running on.
-Scott=