[PATCH] hw/timer/pl031: Add warning "do not use as model to implement a RTC"

Philippe Mathieu-Daudé posted 1 patch 4 years, 6 months ago
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test docker-clang@ubuntu passed
Test asan passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190924141228.25009-1-philmd@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>
hw/timer/pl031.c | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH] hw/timer/pl031: Add warning "do not use as model to implement a RTC"
Posted by Philippe Mathieu-Daudé 4 years, 6 months ago
Peter said we should "not use the pl031 as a good model of how
to do an RTC, it has some definite flaws."
Add this information to the PL031 header for other developers.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/timer/pl031.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
index 2b3e261006..da453b5b04 100644
--- a/hw/timer/pl031.c
+++ b/hw/timer/pl031.c
@@ -1,6 +1,14 @@
 /*
  * ARM AMBA PrimeCell PL031 RTC
  *
+ * Note from the maintainer:
+ *
+ * Don't use the pl031 code as a good model of how to do an RTC,
+ * it has some definite flaws. x86 or ppc RTC handling is probably
+ * a better place to look.
+ *
+ * See https://lists.gnu.org/archive/html/qemu-devel/2019-09/msg05399.html
+ *
  * Copyright (c) 2007 CodeSourcery
  *
  * This file is free software; you can redistribute it and/or modify
-- 
2.20.1


Re: [PATCH] hw/timer/pl031: Add warning "do not use as model to implement a RTC"
Posted by Peter Maydell 4 years, 6 months ago
On Tue, 24 Sep 2019 at 15:12, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Peter said we should "not use the pl031 as a good model of how
> to do an RTC, it has some definite flaws."
> Add this information to the PL031 header for other developers.

Lots of our code is less than great. I'm not sure this
specific case really justifies blazoning it in a comment header
at the top of the file... (If you do want to put in a comment,
being more specific about exactly what the problems are would
be better.)

thanks
-- PMM