On 2/12/19 14:50, Jan Beulich wrote:
>>>> On 08.02.19 at 14:44, <[email protected]> wrote:
>> --- /dev/null
>> +++ b/xen/include/asm-x86/nospec.h
>> @@ -0,0 +1,39 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 
>> */
>> +
>> +#ifndef _ASM_X86_NOSPEC_H
>> +#define _ASM_X86_NOSPEC_H
>> +
>> +#include <asm/alternative.h>
>> +#include <asm/system.h>
>> +
>> +/* Allow to insert a read memory barrier into conditionals */
>> +static always_inline bool arch_barrier_nospec_true(void)
> Now that this is x86-specific (and not used by common code),
> I don't think the arch_ prefix is warranted anymore.
I will drop the prefix.
>> +{
>> +#if defined(CONFIG_HVM)
> Here and below I'd prefer if you used the shorter #ifdef.
I will use the short version.
>
>> +    alternative("", "lfence", X86_FEATURE_SC_L1TF_VULN);
>> +#endif
>> +    return true;
>> +}
>> +
>> +/* Allow to protect evaluation of conditionaasl with respect to speculation 
>> */
>> +#if defined(CONFIG_HVM)
>> +#define evaluate_nospec(condition)                                         \
>> +    ((condition) ? arch_barrier_nospec_true() : !arch_barrier_nospec_true())
>> +#else
>> +#define evaluate_nospec(condition) (condition)
>> +#endif
>> +
>> +/* Allow to block speculative execution in generic code */
>> +#define block_speculation() (void)arch_barrier_nospec_true()
> I'm pretty sure that I did point out before that this lacks an
> outer pair of parentheses.

You did. I will add them.

Best,
Norbert

>
> Jan
>
>



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to