[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/3] xen/arm: Check for PMU platform support


  • To: Michal Orzel <Michal.Orzel@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 8 Oct 2021 08:31:44 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dpWulWwwnr2zmixwpIZOKIoxsGUD2NJ+ijLqHHq3QbE=; b=VkPEI6NPHWYR0dsP4H5lLmNoNCXwGT2ukvs49+ghEiVD1chRWR8KYh05X5gPZnWBXW70ERuN229194XjsUkbKL28YLAhJIC2h1orykxavRQVpyUfyg6MTAW/JnLNhQGg3Ov05eSGQyXAj1oaqqzwZkqhk/urGr833U+5tOTkT06xzCcrfvFbDnC2yus6ilru7vSnzqku1+4n+90cqO9eEKugDMTwpYBjhayol8iHVdkyDD7/BTu6GFpY+CWxJ4le6nWf/D5s9O0wX7p6pE2ryAPAOyCP2uaepruxZPufLS9oEoH+TfrDbpHHdXVHrhZlyt1Y6Llffjp3uR/U3BvAmA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NBlxecIgbKl7pBlD9U/QoZqF7lzCBevTvL/Kfol+SH2QAL9Vag355uGS3XcuEXeeFXEe+fN0nU3E1W0cmKnl7ZagoeHCtZSEnbQE+YCMkoqxYr2JY5T0YGn6AOLBpjQTL+PNkCkDAfKvpvWkInB5ZCcohB4NEmKt5B7Yph0fi2ig2ySNvCN6sxR4EXBzC503ZLnKRkrtYXJzONk+Wp+D15yeZiZEy9ldEIUOeJe7qntdmAO9nQ65ABJm1136xzO/f79LKPzk5v1HJpPmmalZiiV70LdP8a+prY1v9lhkAP/9NxJBLey4MhXOuq8uMVDUGfoQE3XE9iveKUWAO5Xm2w==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 08 Oct 2021 08:32:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXvB1V0VFSwEt/Q0SfrOAbW/sfCavIxZ2A
  • Thread-topic: [PATCH v3 2/3] xen/arm: Check for PMU platform support

Hi Michal,

> On 8 Oct 2021, at 09:19, Michal Orzel <Michal.Orzel@xxxxxxx> wrote:
> 
> ID_AA64DFR0_EL1/ID_DFR0_EL1 registers provide
> information about PMU support. Replace structure
> dbg64/dbg32 with a union and fill in all the
> register fields according to document:
> ARM Architecture Registers(DDI 0595, 2021-06).
> 
> Add macros boot_dbg_feature64/boot_dbg_feature32
> to check for a debug feature. Add macro
> cpu_has_pmu to check for PMU support.
> 
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> Changes since v2:
> -none
> Changes since v1:
> -new in v2
> ---
> xen/include/asm-arm/cpufeature.h | 49 ++++++++++++++++++++++++++++++--
> 1 file changed, 47 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/include/asm-arm/cpufeature.h 
> b/xen/include/asm-arm/cpufeature.h
> index 5ca09b0bff..4fce23844d 100644
> --- a/xen/include/asm-arm/cpufeature.h
> +++ b/xen/include/asm-arm/cpufeature.h
> @@ -4,6 +4,7 @@
> #ifdef CONFIG_ARM_64
> #define cpu_feature64(c, feat)         ((c)->pfr64.feat)
> #define boot_cpu_feature64(feat)       (system_cpuinfo.pfr64.feat)
> +#define boot_dbg_feature64(feat)       (system_cpuinfo.dbg64.feat)
> 
> #define cpu_feature64_has_el0_32(c)    (cpu_feature64(c, el0) == 2)
> 
> @@ -22,6 +23,7 @@
> 
> #define cpu_feature32(c, feat)         ((c)->pfr32.feat)
> #define boot_cpu_feature32(feat)       (system_cpuinfo.pfr32.feat)
> +#define boot_dbg_feature32(feat)       (system_cpuinfo.dbg32.feat)
> 
> #define cpu_has_arm       (boot_cpu_feature32(arm) == 1)
> #define cpu_has_thumb     (boot_cpu_feature32(thumb) >= 1)
> @@ -32,8 +34,10 @@
> 
> #ifdef CONFIG_ARM_32
> #define cpu_has_gentimer  (boot_cpu_feature32(gentimer) == 1)
> +#define cpu_has_pmu       (boot_dbg_feature32(perfmon) >= 1)
> #else
> #define cpu_has_gentimer  (1)
> +#define cpu_has_pmu       (boot_dbg_feature64(pmu_ver) >= 1)
> #endif
> #define cpu_has_security  (boot_cpu_feature32(security) > 0)
> 
> @@ -181,8 +185,28 @@ struct cpuinfo_arm {
>         };
>     } pfr64;
> 
> -    struct {
> +    union {
>         register_t bits[2];
> +        struct {
> +            /* DFR0 */
> +            unsigned long debug_ver:4;
> +            unsigned long trace_ver:4;
> +            unsigned long pmu_ver:4;
> +            unsigned long brps:4;
> +            unsigned long __res0:4;
> +            unsigned long wrps:4;
> +            unsigned long __res1:4;
> +            unsigned long ctx_cmps:4;
> +            unsigned long pms_ver:4;
> +            unsigned long double_lock:4;
> +            unsigned long trace_filt:4;
> +            unsigned long __res2:4;
> +            unsigned long mtpmu:4;
> +            unsigned long __res3:12;
> +
> +            /* DFR1 */
> +            unsigned long __res4:64;
> +        };
>     } dbg64;
> 
>     struct {
> @@ -321,8 +345,29 @@ struct cpuinfo_arm {
>         };
>     } pfr32;
> 
> -    struct {
> +    union {
>         register_t bits[2];
> +        struct {
> +            /* DFR0 */
> +            unsigned long copdbg:4;
> +            unsigned long copsdbg:4;
> +            unsigned long mmapdbg:4;
> +            unsigned long coptrc:4;
> +            unsigned long mmaptrc:4;
> +            unsigned long mprofdbg:4;
> +            unsigned long perfmon:4;
> +            unsigned long tracefilt:4;
> +#ifdef CONFIG_ARM_64
> +            unsigned long __res0:32;
> +#endif
> +
> +            /* DFR1 */
> +            unsigned long mtpmu:4;
> +            unsigned long __res1:28;
> +#ifdef CONFIG_ARM_64
> +            unsigned long __res2:32;
> +#endif
> +        };
>     } dbg32;
> 
>     struct {
> -- 
> 2.29.0
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.