All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Julien Grall <julien.grall@arm.com>
Cc: sstabellini@kernel.org, xen-devel@lists.xen.org
Subject: Re: [PATCH v5 3/7] xen/arm: Detect silicon revision and set cap bits accordingly
Date: Fri, 22 Jul 2016 10:24:33 -0400	[thread overview]
Message-ID: <20160722142433.GD21054@char.us.oracle.com> (raw)
In-Reply-To: <1469028360-20907-4-git-send-email-julien.grall@arm.com>

On Wed, Jul 20, 2016 at 04:25:56PM +0100, Julien Grall wrote:
> After each CPU has been started, we iterate through a list of CPU
> errata to detect CPUs which need from hypervisor code patches.
> 
> For each bug there is a function which check if that a particular CPU is
s/check/checks/
> affected. This needs to be done on every CPUs to cover heterogenous
s/CPUs/CPU/
> system properly.
s/system/systems/ ? (not sure)
> 
> If a certain erratum has been detected, the capability bit will be set.
> In the case the erratum requires code patching, this will be triggered
> by the call to apply_alternatives.
s/the///

> 
> The code is based on the file arch/arm64/kernel/cpu_errata.c in Linux
> v4.6-rc3.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> ---
>     Changes in v4:
>         - Add missing emacs magic blocks
>         - Add Stefano's acked-by
> 
>     Changes in v3:
>         - Move update_cpu_capabilities in a separate patch
>         - Update the commit message to mention that workaround may
>         not require code patching.
> 
>     Changes in v2:
>         - Use XENLOG_INFO for the loglevel of the message
> ---
>  xen/arch/arm/Makefile            |  1 +
>  xen/arch/arm/cpuerrata.c         | 34 ++++++++++++++++++++++++++++++++++
>  xen/arch/arm/setup.c             |  3 +++
>  xen/arch/arm/smpboot.c           |  3 +++
>  xen/include/asm-arm/cpuerrata.h  | 14 ++++++++++++++
>  xen/include/asm-arm/cpufeature.h |  6 ++++++
>  6 files changed, 61 insertions(+)
>  create mode 100644 xen/arch/arm/cpuerrata.c
>  create mode 100644 xen/include/asm-arm/cpuerrata.h
> 
> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
> index 74bd7b8..23aaf52 100644
> --- a/xen/arch/arm/Makefile
> +++ b/xen/arch/arm/Makefile
> @@ -7,6 +7,7 @@ subdir-$(CONFIG_ACPI) += acpi
>  obj-$(CONFIG_ALTERNATIVE) += alternative.o
>  obj-y += bootfdt.o
>  obj-y += cpu.o
> +obj-y += cpuerrata.o
>  obj-y += cpufeature.o
>  obj-y += decode.o
>  obj-y += device.o
> diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
> new file mode 100644
> index 0000000..03ae7b4
> --- /dev/null
> +++ b/xen/arch/arm/cpuerrata.c
> @@ -0,0 +1,34 @@
> +#include <xen/config.h>
> +#include <asm/cpufeature.h>
> +#include <asm/cpuerrata.h>
> +
> +#define MIDR_RANGE(model, min, max)     \
> +    .matches = is_affected_midr_range,  \
> +    .midr_model = model,                \
> +    .midr_range_min = min,              \
> +    .midr_range_max = max
> +
> +static bool_t __maybe_unused
> +is_affected_midr_range(const struct arm_cpu_capabilities *entry)
> +{
> +    return MIDR_IS_CPU_MODEL_RANGE(boot_cpu_data.midr.bits, entry->midr_model,
> +                                   entry->midr_range_min,
> +                                   entry->midr_range_max);
> +}
> +
> +static const struct arm_cpu_capabilities arm_errata[] = {
> +    {},
> +};
> +
> +void check_local_cpu_errata(void)
> +{
> +    update_cpu_capabilities(arm_errata, "enabled workaround for");
> +}
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 97b3214..38eb888 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -43,6 +43,7 @@
>  #include <asm/current.h>
>  #include <asm/setup.h>
>  #include <asm/gic.h>
> +#include <asm/cpuerrata.h>
>  #include <asm/cpufeature.h>
>  #include <asm/platform.h>
>  #include <asm/procinfo.h>
> @@ -171,6 +172,8 @@ static void __init processor_id(void)
>      }
>  
>      processor_setup();
> +
> +    check_local_cpu_errata();
>  }
>  
>  void dt_unreserved_regions(paddr_t s, paddr_t e,
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 3a962f7..d56b91d 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -29,6 +29,7 @@
>  #include <xen/timer.h>
>  #include <xen/irq.h>
>  #include <xen/console.h>
> +#include <asm/cpuerrata.h>
>  #include <asm/gic.h>
>  #include <asm/psci.h>
>  #include <asm/acpi.h>
> @@ -316,6 +317,8 @@ void start_secondary(unsigned long boot_phys_offset,
>      local_irq_enable();
>      local_abort_enable();
>  
> +    check_local_cpu_errata();
> +
>      printk(XENLOG_DEBUG "CPU %u booted.\n", smp_processor_id());
>  
>      startup_cpu_idle_loop();
> diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h
> new file mode 100644
> index 0000000..fe93beb
> --- /dev/null
> +++ b/xen/include/asm-arm/cpuerrata.h
> @@ -0,0 +1,14 @@
> +#ifndef __ARM_CPUERRATA_H

Sorry about having engaged the pedantic review mode, but this caught my
eye.

I thought the style was to prefix it with __ and also postfix it with __:

$ grep "__" *.h
decode.h:#ifndef __ARCH_ARM_DECODE_H_
decode.h:#define __ARCH_ARM_DECODE_H_
decode.h:#endif /* __ARCH_ARM_DECODE_H_ */
kernel.h:#ifndef __ARCH_ARM_KERNEL_H__
kernel.h:#define __ARCH_ARM_KERNEL_H__
kernel.h:#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */
vtimer.h:#ifndef __ARCH_ARM_VTIMER_H__
vtimer.h:#define __ARCH_ARM_VTIMER_H__
vuart.h:#ifndef __ARCH_ARM_VUART_H__
vuart.h:#define __ARCH_ARM_VUART_H__
vuart.h:#endif /* __ARCH_ARM_VUART_H__ */

And the include/asm also has have this in in surplus.

It really is minor and I am sorry for even picking up on this, but
could you add the __ at the end?

> +#define __ARM_CPUERRATA_H
> +
> +void check_local_cpu_errata(void);
> +
> +#endif /* __ARM_CPUERRATA_H */
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
> index be2414c..fb57295 100644
> --- a/xen/include/asm-arm/cpufeature.h
> +++ b/xen/include/asm-arm/cpufeature.h
> @@ -66,6 +66,12 @@ struct arm_cpu_capabilities {
>      const char *desc;
>      u16 capability;
>      bool_t (*matches)(const struct arm_cpu_capabilities *);
> +    union {
> +        struct {    /* To be used for eratum handling only */
> +            u32 midr_model;
> +            u32 midr_range_min, midr_range_max;
> +        };
> +    };
>  };
>  
>  void update_cpu_capabilities(const struct arm_cpu_capabilities *caps,
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-07-22 14:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 15:25 [PATCH v5 0/7] xen/arm: Introduce alternative runtime patching for ARM64 Julien Grall
2016-07-20 15:25 ` [PATCH v5 1/7] xen/arm: Introduce alternative runtime patching Julien Grall
2016-07-21  0:32   ` [PATCH v5 1/7] xen/arm: Introduce alternative runtime patchingo Stefano Stabellini
2016-07-22 14:15   ` [PATCH v5 1/7] xen/arm: Introduce alternative runtime patching Konrad Rzeszutek Wilk
2016-07-22 15:29     ` Julien Grall
2016-07-22 15:38       ` Konrad Rzeszutek Wilk
2016-07-22 15:47         ` Julien Grall
2016-07-20 15:25 ` [PATCH v5 2/7] xen/arm: cpufeature: Provide an helper to check if a capability is supported Julien Grall
2016-07-22 14:18   ` Konrad Rzeszutek Wilk
2016-07-22 15:31     ` Julien Grall
2016-07-22 15:39       ` Konrad Rzeszutek Wilk
2016-07-20 15:25 ` [PATCH v5 3/7] xen/arm: Detect silicon revision and set cap bits accordingly Julien Grall
2016-07-22 14:24   ` Konrad Rzeszutek Wilk [this message]
2016-07-27 16:09     ` Julien Grall
2016-07-20 15:25 ` [PATCH v5 4/7] xen/arm: Document the errata implemented in Xen Julien Grall
2016-07-22 14:25   ` Konrad Rzeszutek Wilk
2016-07-20 15:25 ` [PATCH v5 5/7] xen/arm: arm64: Add Cortex-A53 cache errata workaround Julien Grall
2016-07-20 15:25 ` [PATCH v5 6/7] xen/arm: arm64: Add cortex-A57 erratum 832075 workaround Julien Grall
2016-07-20 15:26 ` [PATCH v5 7/7] xen/arm: traps: Don't inject a fault if the translation VA -> IPA fails Julien Grall
2016-07-22 14:29 ` [PATCH v5 0/7] xen/arm: Introduce alternative runtime patching for ARM64 Konrad Rzeszutek Wilk

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=20160722142433.GD21054@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=julien.grall@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.