From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
andre.przywara@linaro.org, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 5/7] xen/arm32: Invalidate BTB on guest exit for Cortex A17 and 12
Date: Wed, 31 Jan 2018 17:39:58 +0000 [thread overview]
Message-ID: <0d5cb50f-45b5-ec4b-7d99-b7c19a56d57c@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1801310938220.11958@sstabellini-ThinkPad-X260>
On 31/01/18 17:39, Stefano Stabellini wrote:
> On Wed, 31 Jan 2018, Julien Grall wrote:
>> Hi,
>>
>> On 31/01/18 16:53, Julien Grall wrote:
>>> +GLOBAL(hyp_traps_vector_bp_inv)
>>> + /*
>>> + * We encode the exception entry in the bottom 3 bits of
>>> + * SP, and we have to guarantee to be 8 bytes aligned.
>>> + */
>>> + add sp, sp, #1 /* Reset 7 */
>>> + add sp, sp, #1 /* Undef 6 */
>>> + add sp, sp, #1 /* Hypervisor Call 5 */
>>> + add sp, sp, #1 /* Prefetch abort 4 */
>>> + add sp, sp, #1 /* Data abort 3 */
>>> + add sp, sp, #1 /* Hypervisor 2 */
>>> + add sp, sp, #1 /* IRQ 1 */
>>> + nop /* FIQ 0 */
>>> +
>>> + mcr p15, 0, r0, c7, c5, 6 /* BPIALL */
>>> + isb
>>> +
>>> + /*
>>> + * As we cannot use any temporary registers and cannot
>>> + * clobber SP, we can decode the exception entry using
>>> + * an unrolled binary search.
>>> + */
>>> + tst sp, #4
>>> + bne 1f
>>> +
>>> + tst sp, #2
>>> + bne 3f
>>> +
>>> + tst sp, #1
>>> + bic sp, sp, #0x7
>>> + bne trap_irq
>>> + b trap_fiq
>>> +
>>> +1:
>>> + tst sp, #2
>>> + bne 2f
>>> +
>>> + tst sp, #1
>>> + bic sp, sp, #0x7
>>> + bne trap_hypervisor_call
>>> + b trap_prefetch_abort
>>> +
>>> +2:
>>> + tst sp, #1
>>> + bic sp, sp, #0x7
>>> + bne trap_reset
>>> + b trap_undefined_instruction
>>> +
>>> +3:
>>> + tst sp, #1
>>> + bic sp, sp, #0x7
>>> + bne trap_data_abort
>>> + b trap_guest_sync
>>
>> Just after I hit the sent button Marc pointed me to a discussion on Linux ML
>> [1].
>>
>> They found a solution which would streamline the code, improve the readability
>> and prioritize exception.
>>
>> I would be tempt to use a similar solution on Xen. Stefano, do you have any
>> opinions? Shall I respin the series or do a follow-up?
>
> You forgot the link :-)
> I prefer if you respin, because it is going to make the backports
> slightly easier.
Here the link:
https://www.spinics.net/lists/arm-kernel/msg631860.html
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-01-31 17:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 16:53 [PATCH v2 0/7] xen/arm32: Branch predictor hardening (XSA-254 variant 2) Julien Grall
2018-01-31 16:53 ` [PATCH v2 1/7] xen/arm32: entry: Consolidate DEFINE_TRAP_ENTRY_* macros Julien Grall
2018-01-31 16:53 ` [PATCH v2 2/7] xen/arm32: Add missing MIDR values for Cortex-A17 and A12 Julien Grall
2018-01-31 16:53 ` [PATCH v2 3/7] xen/arm32: entry: Add missing trap_reset entry Julien Grall
2018-01-31 17:29 ` Stefano Stabellini
2018-01-31 16:53 ` [PATCH v2 4/7] xen/arm32: Add skeleton to harden branch predictor aliasing attacks Julien Grall
2018-01-31 17:30 ` Stefano Stabellini
2018-01-31 16:53 ` [PATCH v2 5/7] xen/arm32: Invalidate BTB on guest exit for Cortex A17 and 12 Julien Grall
2018-01-31 17:34 ` Julien Grall
2018-01-31 17:39 ` Stefano Stabellini
2018-01-31 17:39 ` Julien Grall [this message]
2018-01-31 16:53 ` [PATCH v2 6/7] xen/arm32: Invalidate icache on guest exist for Cortex-A15 Julien Grall
2018-01-31 16:53 ` [PATCH v2 7/7] xen/arm32: entry: Document the purpose of r11 in the traps handler Julien Grall
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=0d5cb50f-45b5-ec4b-7d99-b7c19a56d57c@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@linaro.org \
--cc=marc.zyngier@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xen.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).