[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/arm: Validate generic timer frequency
- To: Michal Orzel <michal.orzel@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Thu, 28 Sep 2023 14:02:17 +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=vU6B8YTkkRGNzno57AG1oohjFBYQQ410vcrX4AIZ8oE=; b=ShsiIIqGF5jQBu7PATzGEYlbpKm8iOUYdzNHPt9vvRbCJNH9F5OPWUCvNf8qj4TzGy0OkECI46zjgAGoZB0V9J8rWIvbC7XcPPjWbFpgLRBJu9xR9TmhWarFsLTS51tGkz1HM8admLL7adabfqo001qv5aYSzxz4NKnQXLPDzDshLP7IGdcRyIhZiucPRSDmgQJurCx4fjdntrpNLHad2K2hqD3ZxQ0tDO5mqw/0IA2AEHivsbgigbM0uW1Kc6+zgEyMYQxNBSljtGWx4P4j0cxQTpoWGRZjvMejnp09mlNrM6J5W0u+ao+9EjQ9I/3nGEi/m6isbGKi3f2LNpltHw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lh0OKXOi7+5UzODja08zgR3RFCsoMG9u49A6rPpNdK6I1+UJIwh6n0b2jm2IykyreAvRHe8r4nn73vCsjunr3/DSKp8cHzZZ6xlifj7XBPsNbmpThF0m5OjviUpQAfOPWEsPcSVtnVPdYBH7pz7tIgbYFJ4ZZYwAVZ7WoWlxssWDCJff8CXsrfrUJxKc5KVf4IzV5yyVEU1OEHPD+kzoRfvvPmKH5GY4LlA4uowOyhAA5rlDeZBSXE+7vf2QO+X4EhH7Bg78ZVV20ecSN401oD8KvBiuR9BRO+xBiZQ0WU8VP970IM+OEaRAideqlHz9KtgRodxXdG9VQ0gha0QALQ==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Thu, 28 Sep 2023 14:02:44 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHZ8ghdP0qqL8lJK0yXEjdflFNrbLAwRKqA
- Thread-topic: [PATCH] xen/arm: Validate generic timer frequency
> On 28 Sep 2023, at 13:34, Michal Orzel <michal.orzel@xxxxxxx> wrote:
>
> Generic timer dt node property "clock-frequency" (refer Linux dt binding
> Documentation/devicetree/bindings/timer/arm,arch_timer.yaml) is used to
> override the incorrect value set by firmware in CNTFRQ_EL0. If the value
> of this property is 0 (i.e. by mistake), Xen would continue to work and
> use the value from the sysreg instead. The logic is thus incorrect and
> results in inconsistency when creating timer node for domUs:
> - libxl domUs: clock_frequency member of struct xen_arch_domainconfig
> is set to 0 and libxl ignores setting the "clock-frequency" property,
> - dom0less domUs: "clock-frequency" property is taken from dt_host and
> thus set to 0.
>
> Property "clock-frequency" is used to override the value from sysreg,
> so if it is also invalid, there is nothing we can do and we shall panic
> to let user know about incorrect setting. Going even further, we operate
> under assumption that the frequency must be at least 1KHz (i.e. cpu_khz
> not 0) in order for Xen to boot. Therefore, introduce a new helper
> validate_timer_frequency() to verify this assumption and use it to check
> the frequency obtained either from dt property or from sysreg.
>
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
> ---
Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
|