1. 20 9月, 2016 1 次提交
    • P
      rtc: cmos: Initialize hpet timer before irq is registered · 970fc7f4
      Pratyush Anand 提交于
      We have observed on few x86 machines with rtc-cmos device that
      hpet_rtc_interrupt() is called just after irq registration and before
      cmos_do_probe() could call hpet_rtc_timer_init().
      
      So, neither hpet_default_delta nor hpet_t1_cmp is initialized by the time
      interrupt is raised in the given situation, and this results in NMI
      watchdog LOCKUP.
      
      It has only been observed sporadically on kdump secondary kernels.
      
      See the call trace:
      ---<-snip->---
      [   27.913194] Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 0
      [   27.915371] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-342.el7.x86_64 #1
      [   27.917503] Hardware name: HP ProLiant DL160 Gen8, BIOS J03 02/10/2014
      [   27.919455]  ffffffff8186a728 0000000059c82488 ffff880034e05af0 ffffffff81637bd4
      [   27.921870]  ffff880034e05b70 ffffffff8163144a 0000000000000010 ffff880034e05b80
      [   27.924257]  ffff880034e05b20 0000000059c82488 0000000000000000 0000000000000000
      [   27.926599] Call Trace:
      [   27.927352]  <NMI>  [<ffffffff81637bd4>] dump_stack+0x19/0x1b
      [   27.929080]  [<ffffffff8163144a>] panic+0xd8/0x1e7
      [   27.930588]  [<ffffffff8111d3e0>] ? restart_watchdog_hrtimer+0x50/0x50
      [   27.932502]  [<ffffffff8111d4a2>] watchdog_overflow_callback+0xc2/0xd0
      [   27.934427]  [<ffffffff811612c1>] __perf_event_overflow+0xa1/0x250
      [   27.936232]  [<ffffffff81161d94>] perf_event_overflow+0x14/0x20
      [   27.937957]  [<ffffffff81032ae8>] intel_pmu_handle_irq+0x1e8/0x470
      [   27.939799]  [<ffffffff8164164b>] perf_event_nmi_handler+0x2b/0x50
      [   27.941649]  [<ffffffff81640d99>] nmi_handle.isra.0+0x69/0xb0
      [   27.943348]  [<ffffffff81640f49>] do_nmi+0x169/0x340
      [   27.944802]  [<ffffffff816401d3>] end_repeat_nmi+0x1e/0x2e
      [   27.946424]  [<ffffffff81056ee5>] ? hpet_rtc_interrupt+0x85/0x380
      [   27.948197]  [<ffffffff81056ee5>] ? hpet_rtc_interrupt+0x85/0x380
      [   27.949992]  [<ffffffff81056ee5>] ? hpet_rtc_interrupt+0x85/0x380
      [   27.951816]  <<EOE>>  <IRQ>  [<ffffffff8108f5a3>] ? run_timer_softirq+0x43/0x340
      [   27.954114]  [<ffffffff8111e24e>] handle_irq_event_percpu+0x3e/0x1e0
      [   27.955962]  [<ffffffff8111e42d>] handle_irq_event+0x3d/0x60
      [   27.957635]  [<ffffffff811210c7>] handle_edge_irq+0x77/0x130
      [   27.959332]  [<ffffffff8101704f>] handle_irq+0xbf/0x150
      [   27.960949]  [<ffffffff8164a86f>] do_IRQ+0x4f/0xf0
      [   27.962434]  [<ffffffff8163faed>] common_interrupt+0x6d/0x6d
      [   27.964101]  <EOI>  [<ffffffff8163f43b>] ? _raw_spin_unlock_irqrestore+0x1b/0x40
      [   27.966308]  [<fffff8111ff07>] __setup_irq+0x2a7/0x570
      [   28.067859]  [<ffffffff81056e60>] ? hpet_cpuhp_notify+0x140/0x140
      [   28.069709]  [<ffffffff8112032c>] request_threaded_irq+0xcc/0x170
      [   28.071585]  [<ffffffff814b24a6>] cmos_do_probe+0x1e6/0x450
      [   28.073240]  [<ffffffff814b2710>] ? cmos_do_probe+0x450/0x450
      [   28.074911]  [<ffffffff814b27cb>] cmos_pnp_probe+0xbb/0xc0
      [   28.076533]  [<ffffffff8139b245>] pnp_device_probe+0x65/0xd0
      [   28.078198]  [<ffffffff813f8ca7>] driver_probe_device+0x87/0x390
      [   28.079971]  [<ffffffff813f9083>] __driver_attach+0x93/0xa0
      [   28.081660]  [<ffffffff813f8ff0>] ? __device_attach+0x40/0x40
      [   28.083662]  [<ffffffff813f6a13>] bus_for_each_dev+0x73/0xc0
      [   28.085370]  [<ffffffff813f86fe>] driver_attach+0x1e/0x20
      [   28.086974]  [<ffffffff813f8250>] bus_add_driver+0x200/0x2d0
      [   28.088634]  [<ffffffff81ade49a>] ? rtc_sysfs_init+0xe/0xe
      [   28.090349]  [<ffffffff813f9704>] driver_register+0x64/0xf0
      [   28.091989]  [<ffffffff8139b070>] pnp_register_driver+0x20/0x30
      [   28.093707]  [<ffffffff81ade4ab>] cmos_init+0x11/0x71
      ---<-snip->---
      
      This patch moves hpet_rtc_timer_init() before IRQ registration, so that we
      can gracefully handle such spurious interrupts. It also masks HPET RTC
      interrupts, in case IRQ registration fails.
      
      We were able to reproduce the problem in maximum 15 trials of kdump
      secondary kernel boot on an hp-dl160gen8 FCoE host machine without this
      patch.  However, more than 35 trials went fine after applying this patch.
      Suggested-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NPratyush Anand <panand@redhat.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      970fc7f4
  2. 09 7月, 2016 1 次提交
  3. 26 6月, 2016 1 次提交
  4. 04 6月, 2016 1 次提交
    • A
      rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h · 5ab788d7
      Arnd Bergmann 提交于
      Drivers should not really include stuff from asm-generic directly,
      and the PC-style cmos rtc driver does this in order to reuse the
      mc146818 implementation of get_rtc_time/set_rtc_time rather than
      the architecture specific one for the architecture it gets built for.
      
      To make it more obvious what is going on, this moves and renames the
      two functions into include/linux/mc146818rtc.h, which holds the
      other mc146818 specific code. Ideally it would be in a .c file,
      but that would require extra infrastructure as the functions are
      called by multiple drivers with conflicting dependencies.
      
      With this change, the asm-generic/rtc.h header also becomes much
      more generic, so it can be reused more easily across any architecture
      that still relies on the genrtc driver.
      
      The only caller of the internal __get_rtc_time/__set_rtc_time
      functions is in arch/alpha/kernel/rtc.c, and we just change those
      over to the new naming.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      5ab788d7
  5. 20 5月, 2016 1 次提交
  6. 12 1月, 2016 1 次提交
  7. 05 9月, 2015 3 次提交
    • V
      rtc: cmos: clean up cmos_nvram_read()/cmos_nvram_write() · a3781639
      Vladimir Zapolskiy 提交于
      The change removes redundant sysfs binary file boundary checks, since
      this task is already done on caller side in fs/sysfs/file.c
      Signed-off-by: NVladimir Zapolskiy <vz@mleia.com>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      a3781639
    • A
      rtc: cmos: Revert "rtc-cmos: Add an alarm disable quirk" · 8109d44f
      Adrian Huang 提交于
      Commit d5a1c7e3 ("rtc-cmos: Add an alarm disable quirk") that
      added a special quirk is not needed because [PATCH 1/2] of this
      patchset makes the kernel more robust:
      rtc-cmos: Cancel alarm timer if alarm time is equal to now+1 seconds
      Signed-off-by: NAdrian Huang <ahuang12@lenovo.com>
      Tested-by: NEgbert Eich <eich@suse.de>
      Tested-by: NDiego Ercolani <diego.ercolani@gmail.com>
      Cc: Borislav Petkov <bp@suse.de>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      8109d44f
    • A
      rtc: cmos: Cancel alarm timer if alarm time is equal to now+1 seconds · 88b8d33b
      Adrian Huang 提交于
      Steps to reproduce the problem:
      	1) Enable RTC wake-up option in BIOS Setup
      	2) Issue one of these commands in the OS: "poweroff"
      	   or "shutdown -h now"
      	3) System will shut down and then reboot automatically
      
      Root-cause of the issue:
      	1) During the shutdown process, the hwclock utility is used
      	   to save the system clock to hardware clock (RTC).
      	2) The hwclock utility invokes ioctl() with RTC_UIE_ON. The
      	   kernel configures the RTC alarm for the periodic interrupt
      	   (every 1 second).
      	3) The hwclock uitlity closes the /dev/rtc0 device, and the
      	   kernel disables the RTC alarm irq (AIE bit of Register B)
      	   via ioctl() with RTC_UIE_OFF. But, the configured alarm
      	   time is the current_time + 1.
      	4) After the next 1 second is elapsed, the AF (alarm
      	   interrupt flag) of Register C is set.
      	5) The S5 handler in BIOS is invoked to configure alarm
      	   registers (enable AIE bit and configure alarm date/time).
      	   But, BIOS does not clear the previous interrupt status
      	   during alarm configuration. Therefore, "AF=AIE=1" causes
      	   the rtc device to trigger an interrupt.
      	6) So, the machine reboots automatically right after shutdown.
      
      This patch cancels the alarm timer if the following condictions are
      met (suggested by Alexandre):
      	1) The configured alarm time is equal to current_time + 1
      	   seconds.
      	2) The AIE timer is not in use.
      
      The member 'alarm_expires' is introduced in struct cmos_rtc because
      of the following reasons:
      	1) The configured alarm time can be retrieved from
      	   cmos_read_alarm(), but we need to take the 'wrapped
      	   timestamp' and 'time rollover' into consideration. The
      	   function __rtc_read_alarm() eliminates the concerns. To
      	   avoid the duplicated code in the lower level RTC driver,
      	   invoking __rtc_read_alarm from the lower level RTC driver
      	   is not encouraged. Moreover, the compilation error 'the
      	   undefined __rtc_read_alarm" is observed if the lower level
      	   RTC driver is compiled as a kernel module.
      	2) The uie_rtctimer.node.expires and aie_timer.node.expires can
      	   be retrieved for the configured alarm time. But, the problem
      	   is that either of them might configure the CMOS alarm time.
      	   We cannot make sure UIE timer or AIE tiemr configured the
      	   CMOS alarm time before. (uie_rtctimer or aie_timer is enabled
      	   and then is disabled).
      	3) The patch introduces the member 'alarm_expires' to keep the
      	   newly configured alarm time, so the above-mentioned concerns
      	   can be eliminated.
      
      The issue goes away after 20-time shutdown tests.
      Signed-off-by: NAdrian Huang <ahuang12@lenovo.com>
      Tested-by: NEgbert Eich <eich@suse.de>
      Tested-by: NDiego Ercolani <diego.ercolani@gmail.com>
      Cc: Borislav Petkov <bp@suse.de>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      88b8d33b
  8. 17 4月, 2015 1 次提交
  9. 16 4月, 2015 1 次提交
  10. 14 10月, 2014 1 次提交
  11. 07 6月, 2014 1 次提交
    • M
      drivers/rtc/rtc-cmos.c: drivers/char/rtc.c features for DECstation support · 31632dbd
      Maciej W. Rozycki 提交于
      This brings in drivers/char/rtc.c functionality required for DECstation
      and, should the maintainers decide to switch, Alpha systems to use
      rtc-cmos.
      
      Specifically these features are made available:
      
      * RTC iomem rather than x86/PCI port I/O mapping, controlled with the
        RTC_IOMAPPED macro as with the original driver.  The DS1287A chip in all
        DECstation systems is mapped in the host bus address space as a
        contiguous block of 64 32-bit words of which the least significant byte
        accesses the RTC chip for both reads and writes.  All the address and
        data window register accesses are made transparently by the chipset glue
        logic so that the device appears directly mapped on the host bus.
      
      * A way to set the size of the address space explicitly with the
        newly-added `address_space' member of the platform part of the RTC
        device structure.  This avoids the unreliable heuristics that does not
        work in a setup where the RTC is not explicitly accessed with the usual
        address and data window register pair.
      
      * The ability to use the RTC periodic interrupt as a system clock
        device, which is implemented by arch/mips/kernel/cevt-ds1287.c for
        DECstation systems and takes the RTC interrupt away from the RTC driver.
         Eventually hooking back to the clock device's interrupt handler should
        be possible for the purpose of the alarm clock and possibly also
        update-in-progress interrupt, but this is not done by this change.
      
        o To avoid interfering with the clock interrupt all the places where
          the RTC interrupt mask is fiddled with are only executed if and IRQ
          has been assigned to the RTC driver.
      
        o To avoid changing the clock setup Register A is not fiddled with
          if CMOS_RTC_FLAGS_NOFREQ is set in the newly-added `flags' member of
          the platform part of the RTC device structure.  Originally, in
          drivers/char/rtc.c, this was keyed with the absence of the RTC
          interrupt, just like the interrupt mask, but there only the periodic
          interrupt frequency is set, whereas rtc-cmos also sets the divider
          bits.  Therefore a new flag is introduced so that systems where the
          RTC interrupt is not usable rather than used as a system clock device
          can fully initialise the RTC.
      
      * A small clean-up is made to the IRQ assignment code that makes the IRQ
        number hardcoded to -1 rather than arbitrary -ENXIO (or whatever error
        happens to be returned by platform_get_irq) where no IRQ has been
        assigned to the RTC driver (NO_IRQ might be another candidate, but it
        looks like this macro has inconsistent or missing definitions and
        limited use and might therefore be unsafe).
      
      Verified to work correctly with a DECstation 5000/240 system.
      
      [akpm@linux-foundation.org: fix weird code layout]
      Signed-off-by: NMaciej W. Rozycki <macro@linux-mips.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      31632dbd
  12. 04 4月, 2014 1 次提交
  13. 24 1月, 2014 2 次提交
  14. 24 12月, 2013 1 次提交
  15. 13 11月, 2013 2 次提交
  16. 12 9月, 2013 1 次提交
    • S
      rtc: convert rtc-cmos to dev_pm_ops from legacy pm_ops · a8a3808b
      Shuah Khan 提交于
      Convert drivers/rtc/rtc-cmos to use dev_pm_ops instead of legacy pm_ops.
      This patch depends on pnp driver bus ops change to invoke pnp_driver
      dev_pm_ops.
      Signed-off-by: NShuah Khan <shuah.kh@samsung.com>
      Cc: Matthew Garrett <matthew.garrett@nebula.com>
      Cc: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
      Cc: Ashley Lai <ashley@ashleylai.com>
      Cc: Rajiv Andrade <mail@srajiv.net>
      Cc: Marcel Selhorst <tpmdd@selhorst.net>
      Cc: Sirrix AG <tpmdd@sirrix.com>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Peter Hüwe <PeterHuewe@gmx.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a8a3808b
  17. 04 7月, 2013 2 次提交
  18. 13 6月, 2013 1 次提交
  19. 30 4月, 2013 1 次提交
  20. 22 2月, 2013 2 次提交
  21. 04 1月, 2013 1 次提交
    • G
      Drivers: rtc: remove __dev* attributes. · 5a167f45
      Greg Kroah-Hartman 提交于
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      __devinitconst, and __devexit from these drivers.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Mike Frysinger <vapier.adi@gmail.com>
      Cc: Wan ZongShun <mcuos.com@gmail.com>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a167f45
  22. 09 8月, 2012 1 次提交
    • N
      RTC: Avoid races between RTC alarm wakeup and suspend. · 7523ceed
      NeilBrown 提交于
      If an RTC alarm fires just as suspend is happening, it is possible for
      suspend to complete and the alarm to be missed.
      
      To avoid the race, we must register the event with the PM core.
      
      As the event is made visible to userspace through a thread which is
      only scheduled by the interrupt, we need a pm_stay_awake/pm_relax
      pair preventing suspend from the interrupt until the thread completes
      its work.
      
      This makes the pm_wakeup_event() call in cmos_interrupt unnecessary as
      it provides suspend protection for all RTCs that use rtc_update_irq.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      7523ceed
  23. 18 7月, 2012 1 次提交
  24. 30 5月, 2012 1 次提交
  25. 24 3月, 2012 1 次提交
  26. 11 1月, 2012 1 次提交
  27. 10 6月, 2011 1 次提交
  28. 10 3月, 2011 3 次提交
    • J
      RTC: Cleanup rtc_class_ops->update_irq_enable() · 51ba60c5
      John Stultz 提交于
      Now that the generic code handles UIE mode irqs via periodic
      alarm interrupts, no one calls the
      rtc_class_ops->update_irq_enable() method anymore.
      
      This patch removes the driver hooks and implementations of
      update_irq_enable if no one else is calling it.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: rtc-linux@googlegroups.com
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      51ba60c5
    • J
      RTC: Cleanup rtc_class_ops->irq_set_freq() · 696160fe
      John Stultz 提交于
      With the generic rtc code now emulating PIE mode irqs via an
      hrtimer, no one calls the rtc_class_ops->irq_set_freq call.
      
      This patch removes the hook and deletes the driver functions
      if no one else calls them.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: rtc-linux@googlegroups.com
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      696160fe
    • J
      RTC: Cleanup rtc_class_ops->irq_set_state · 80d4bb51
      John Stultz 提交于
      With PIE mode interrupts now emulated in generic code via an hrtimer,
      no one calls rtc_class_ops->irq_set_state(), so this patch removes it
      along with driver implementations.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: rtc-linux@googlegroups.com
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      80d4bb51
  29. 24 2月, 2011 1 次提交
    • S
      rtc: cmos: Add OF bindings · 3bcbaf6e
      Sebastian Andrzej Siewior 提交于
      This allows to load the OF driver based informations from the device
      tree. Systems without BIOS may need to perform some initialization.
      PowerPC creates a PNP device from the OF information and performs this
      kind of initialization in their private PCI quirk. This looks more
      generic.
      
      This patch also avoids registering the platform RTC driver on X86 if
      we have a device tree blob. Otherwise we would setup the device based
      on the hardcoded information in arch/x86 rather than the device tree
      based one.
      
      [ tglx: Changed "int of_have_populated_dt()" to bool as recommended by
              Grant ]
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NDirk Brandewie <dirk.brandewie@gmail.com>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: sodaville@linutronix.de
      Cc: devicetree-discuss@lists.ozlabs.org
      Cc: rtc-linux@googlegroups.com
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      LKML-Reference: <1298405266-1624-12-git-send-email-bigeasy@linutronix.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      3bcbaf6e
  30. 14 1月, 2011 1 次提交
  31. 29 11月, 2010 1 次提交
  32. 11 8月, 2010 1 次提交