linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: andre.przywara@linaro.org (Andre Przywara)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: KVM: iterate over all CPUs for CPU compatibility check
Date: Mon, 22 Apr 2013 12:36:58 +0200	[thread overview]
Message-ID: <517512CA.6070503@linaro.org> (raw)
In-Reply-To: <CAEDV+gL=rbxxBRgYdHxBj_C9ZBFbuORaG0jcSzEUJ7pO9-Fqkg@mail.gmail.com>

On 04/19/2013 06:13 PM, Christoffer Dall wrote:
> On Fri, Apr 19, 2013 at 5:58 AM, Andre Przywara
> <andre.przywara@linaro.org> wrote:
>> On 04/17/2013 11:12 AM, Christoffer Dall wrote:
>>>
>>>  ...
>>>
>>> You could also try installing a vector handler early and detect faults,
>>> and add an alternative return path from the init function with some
>>> error reporting value in r0 or something like that, just for debugging,
>>> naturally, but that could be a way to detect if we really are taking
>>> recursive faults here.
>>
>>
>> OK, I added code to return earlier on CPUs not from cluster 0.
>> Indeed it hangs in the HSCR write. The two A15s pass this instruction,
>> writing 0x30c5187F into the register.
>> This means all the fixed bits for A15 correctly, C,A,M and I set and WXN,
>> EE, TE cleared. FI was also cleared
>> The A7 wanted to write the very same value. I tried to set bit 21, which
>> kind of the A7 TRM hints to do: but no change.
>> Before the HSCLTR write, the register reads 0x30c50878, with SCTLR being
>> 0x30c5387d.
>> So the code wants to set M, A, C and I in HSCLTR. Interestingly SCTLR has
>> the V bits set, could that be an issue?
>>
> Can you try writing 0x30c50879 into the register instead? Basically
> check to see if enabling caches or alignment checks causes the issue,
> or if it is indeed enabling the MMU that's the issue... If that works,
> start a bisect on the remaining bits. Also, just for fun, could you
> try flushing the entire I-cache before writing into the HSCLTR?

OK, both clearing the I-bit and doing an "isb; ICIALLU" before the "isb; 
write HSCLTR; isb" worked, the kernel boots on and KVM is enabled.

I could easily make a patch, but I am not sure how to proceed from here:

1.) At least I don't have an understanding why this is only a problem on 
A7 and not on A15. I would feel better if we have an explanation for 
this. Mark, Will, Peter: any ideas?

2.) We still do not claim to support A7s. ARM_CPU_PART_CORTEX_A15 is the 
only MIDR content not returning -EINVAL. And there is no coproc_a7.c 
yet. From browsing through coproc_a15.c I sense it looks compatible to 
the A7, only handling L2CTLR[25:24] and ACTLR[SMP] explicitly. On pure 
A7 systems this should work, but in mixed (aka. b.L) systems guests 
would see inconsistent input depending on the current scheduling. This 
looks like we need a real solution, which needs some time and work 
(read: proper b.L support).

3.) Even if we would understand this fix and take it, the kernel 
currently still randomly enables or disables KVM - with only A15 
supported and the check routine running on one of the cores only.
And even if we add A7 to the list, I think we still need to iterate 
through all cores to catch unsupported cores in a different b.L 
configuration.

I suppose it is to late for 3.9 in any case right? Or should we try to 
push at least the ICIALLU fix?

> Why wouldn't the V bit be set in the SCTLR, Linus uses high vectors
> (at 0xffff0000) for exception handling on ARM.

Shame on me, didn't know this. I assumed that those high vectors are 
there for legacy reasons only. Good to know and thanks for telling me.


Regards,
Andre.

  reply	other threads:[~2013-04-22 10:36 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 13:04 [PATCH] ARM: KVM: iterate over all CPUs for CPU compatibility check Andre Przywara
2013-04-12 13:24 ` Marc Zyngier
2013-04-12 13:40   ` Peter Maydell
2013-04-12 13:49     ` Marc Zyngier
2013-04-17 10:19       ` Russell King - ARM Linux
2013-04-17 10:35         ` Marc Zyngier
2013-04-17 11:07           ` Christoffer Dall
2013-04-17 11:30             ` Marc Zyngier
2013-04-17 11:38               ` Peter Maydell
2013-04-17 11:42                 ` Alexander Graf
2013-04-17 11:45                   ` Christoffer Dall
2013-04-17 12:24                 ` Marc Zyngier
2013-04-17 12:25                   ` Peter Maydell
2013-04-17 12:28                     ` Marc Zyngier
2013-04-17 12:38                       ` Peter Maydell
2013-04-17 13:00                         ` Marc Zyngier
2013-04-17 19:28                           ` Christoffer Dall
2013-04-17 11:38               ` Christoffer Dall
2013-04-12 13:58   ` Andre Przywara
2013-04-12 14:14     ` Marc Zyngier
2013-04-15  4:57   ` Christoffer Dall
2013-04-15  7:50     ` Marc Zyngier
2013-04-15  8:28       ` Christoffer Dall
2013-04-15  8:43         ` Marc Zyngier
2013-04-15  8:54           ` Christoffer Dall
2013-04-15  9:14             ` Peter Maydell
2013-04-15  9:39               ` Andre Przywara
2013-04-15  9:45                 ` Peter Maydell
     [not found]                 ` <CAJRNFKJoBzgt4UhxsH65_LyhcGXPnzB_pg3q-zeYT2OVv59q4A@mail.gmail.com>
2013-04-15 13:13                   ` Andre Przywara
2013-04-15 13:48                     ` Will Deacon
2013-04-15 14:26                       ` Andre Przywara
2013-04-15 14:39                         ` Peter Maydell
2013-04-15 14:53                         ` Alexander Spyridakis
2013-04-16 16:26                       ` Christoffer Dall
2013-04-16 16:33                         ` Marc Zyngier
2013-04-17  8:08                           ` Andre Przywara
2013-04-17  8:16                             ` Marc Zyngier
     [not found]                               ` <CAEDV+g+3nkdvbLdj0m-ZdDKt0JY2vgzhP2AQA2nf=R3h4yTQmQ@mail.gmail.com>
2013-04-19 12:58                                 ` Andre Przywara
2013-04-19 16:13                                   ` Christoffer Dall
2013-04-22 10:36                                     ` Andre Przywara [this message]
2013-04-22 11:02                                       ` Marc Zyngier
2013-04-22 11:14                                         ` Marc Zyngier
2013-04-22 14:35                                           ` Andre Przywara
2013-04-16 15:59                   ` Christoffer Dall
2013-04-16 16:03                     ` Christoffer Dall
2013-04-16 18:37                     ` Alexander Spyridakis
2013-04-16 18:43                       ` Alexander Spyridakis
2013-04-16 23:13                       ` Christoffer Dall
2013-04-16  0:26     ` Geoff Levand
2013-04-16 16:24       ` Christoffer Dall
2013-04-16 16:40         ` Marc Zyngier
2013-04-17  8:01         ` Andre Przywara
  -- strict thread matches above, loose matches on Subject: below --
2013-04-17 10:52 Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517512CA.6070503@linaro.org \
    --to=andre.przywara@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).