1. 15 Aug, 2018 1 commit
    • Nicolai Stange's avatar
      x86: Don't include linux/irq.h from asm/hardirq.h · 18f891ef
      Nicolai Stange authored
      commit 447ae316 upstream
      The next patch in this series will have to make the definition of
      irq_cpustat_t available to entering_irq().
      Inclusion of asm/hardirq.h into asm/apic.h would cause circular header
      dependencies like
      and others.
      This causes compilation errors because of the header guards becoming
      effective in the second inclusion: symbols/macros that had been defined
      before wouldn't be available to intermediate headers in the #include chain
      A possible workaround would be to move the definition of irq_cpustat_t
      into its own header and include that from both, asm/hardirq.h and
      However, this wouldn't solve the real problem, namely asm/harirq.h
      unnecessarily pulling in all the linux/irq.h cruft: nothing in
      asm/hardirq.h itself requires it. Also, note that there are some other
      archs, like e.g. arm64, which don't have that #include in their
      Remove the linux/irq.h #include from x86' asm/hardirq.h.
      Fix resulting compilation errors by adding appropriate #includes to *.c
      files as needed.
      Note that some of these *.c files could be cleaned up a bit wrt. to their
      set of #includes, but that should better be done from separate patches, if
      at all.
      Signed-off-by: default avatarNicolai Stange <nstange@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  2. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      How this work was done:
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
      All documentation files were explicitly excluded.
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
         For non */uapi/* files that summary was:
         SPDX license identifier                            # files
         GPL-2.0                                              11139
         and resulted in the first patch in this series.
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
         SPDX license identifier                            # files
         GPL-2.0 WITH Linux-syscall-note                        930
         and resulted in the second patch in this series.
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
         SPDX license identifier                            # files
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
         and that resulted in the third patch in this series.
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  3. 14 Apr, 2017 1 commit
    • Hans de Goede's avatar
      x86: i8259: export legacy_pic symbol · 7ee06cb2
      Hans de Goede authored
      The classic PC rtc-coms driver has a workaround for broken ACPI device
      nodes for it which lack an irq resource. This workaround used to
      unconditionally hardcode the irq to 8 in these cases.
      This was causing irq conflict problems on systems without a legacy-pic
      so a recent patch added an if (nr_legacy_irqs()) guard to the
      workaround to avoid this irq conflict.
      nr_legacy_irqs() uses the legacy_pic symbol under the hood causing
      an undefined symbol error if the rtc-cmos code is build as a module.
      This commit exports the legacy_pic symbol to fix this.
      Cc: rtc-linux@googlegroups.com
      Cc: alexandre.belloni@free-electrons.com
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
  4. 07 Nov, 2015 1 commit
    • Vitaly Kuznetsov's avatar
      x86/irq: Probe for PIC presence before allocating descs for legacy IRQs · 8c058b0b
      Vitaly Kuznetsov authored
      Commit d32932d0 ("x86/irq: Convert IOAPIC to use hierarchical irqdomain
      interfaces") brought a regression for Hyper-V Gen2 instances. These
      instances don't have i8259 legacy PIC but they use legacy IRQs for serial
      port, rtc, and acpi. With this commit included we end up with these IRQs
      not initialized. Earlier, there was a special workaround for legacy IRQs
      in mp_map_pin_to_irq() doing mp_irqdomain_map() without looking at
      nr_legacy_irqs() and now we fail in __irq_domain_alloc_irqs() when
      irq_domain_alloc_descs() returns -EEXIST.
      The essence of the issue seems to be that early_irq_init() calls
      arch_probe_nr_irqs() to figure out the number of legacy IRQs before
      we probe for i8259 and gets 16. Later when init_8259A() is called we switch
      to NULL legacy PIC and nr_legacy_irqs() starts to return 0 but we already
      have 16 descs allocated.
      Solve the issue by separating i8259 probe from init and calling it in
      arch_probe_nr_irqs() before we actually use nr_legacy_irqs() information.
      Fixes: d32932d0 ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces")
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1446543614-3621-1-git-send-email-vkuznets@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
  5. 10 May, 2015 1 commit
  6. 28 Oct, 2014 1 commit
    • Maciej W. Rozycki's avatar
      x86/irq: Fix XT-PIC-XT-PIC in /proc/interrupts · 60e684f0
      Maciej W. Rozycki authored
      Fix duplicate XT-PIC seen in /proc/interrupts on x86 systems
      that make  use of 8259A Programmable Interrupt Controllers.
      Specifically convert  output like this:
        0:      76573    XT-PIC-XT-PIC    timer
        1:         11    XT-PIC-XT-PIC    i8042
        2:          0    XT-PIC-XT-PIC    cascade
        4:          8    XT-PIC-XT-PIC    serial
        6:          3    XT-PIC-XT-PIC    floppy
        7:          0    XT-PIC-XT-PIC    parport0
        8:          1    XT-PIC-XT-PIC    rtc0
       10:        448    XT-PIC-XT-PIC    fddi0
       12:         23    XT-PIC-XT-PIC    eth0
       14:       2464    XT-PIC-XT-PIC    ide0
      NMI:          0   Non-maskable interrupts
      ERR:          0
      to one like this:
        0:     122033    XT-PIC  timer
        1:         11    XT-PIC  i8042
        2:          0    XT-PIC  cascade
        4:          8    XT-PIC  serial
        6:          3    XT-PIC  floppy
        7:          0    XT-PIC  parport0
        8:          1    XT-PIC  rtc0
       10:        145    XT-PIC  fddi0
       12:         31    XT-PIC  eth0
       14:       2245    XT-PIC  ide0
      NMI:          0   Non-maskable interrupts
      ERR:          0
      that is one like we used to have from ~2.2 till it was changed
      The rationale is there is no value in this duplicate
      information, it  merely clutters output and looks ugly.  We only
      have one handler for  8259A interrupts so there is no need to
      give it a name separate from the  name already given to
      We could define meaningful names for handlers based on bits in
      the ELCR  register on systems that have it or the value of the
      LTIM bit we use in  ICW1 otherwise (hardcoded to 0 though with
      MCA support gone), to tell  edge-triggered and level-triggered
      inputs apart.  While that information  does not affect 8259A
      interrupt handlers it could help people determine  which lines
      are shareable and which are not.  That is material for a
      separate change though.
      Any tools that parse /proc/interrupts are supposed not to be
      affected  since it was many years we used the format this change
      converts back to.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/alpine.LFD.2.11.1410260147190.21390@eddie.linux-mips.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
  7. 14 Apr, 2014 1 commit
    • K. Y. Srinivasan's avatar
      x86, irq, pic: Probe for legacy PIC and set legacy_pic appropriately · e179f691
      K. Y. Srinivasan authored
      The legacy PIC may or may not be available and we need a mechanism to
      detect the existence of the legacy PIC that is applicable for all
      hardware (both physical as well as virtual) currently supported by
      On Hyper-V, when our legacy firmware presented to the guests, emulates
      the legacy PIC while when our EFI based firmware is presented we do
      not emulate the PIC. To support Hyper-V EFI firmware, we had to set
      the legacy_pic to the null_legacy_pic since we had to bypass PIC based
      calibration in the early boot code. While, on the EFI firmware, we
      know we don't emulate the legacy PIC, we need a generic mechanism to
      detect the presence of the legacy PIC that is not based on boot time
      state - this became apparent when we tried to get kexec to work on
      Hyper-V EFI firmware.
      This patch implements the proposal put forth by H. Peter Anvin
      <hpa@linux.intel.com>: Write a known value to the PIC data port and
      read it back. If the value read is the value written, we do have the
      PIC, if not there is no PIC and we can safely set the legacy_pic to
      null_legacy_pic. Since the read from an unconnected I/O port returns
      0xff, we will use ~(1 << PIC_CASCADE_IR) (0xfb: mask all lines except
      the cascade line) to probe for the existence of the PIC.
      In version V1 of the patch, I had cleaned up the code based on comments from Peter.
      In version V2 of the patch, I have addressed additional comments from Peter.
      In version V3 of the patch, I have addressed Jan's comments (JBeulich@suse.com).
      In version V4 of the patch, I have addressed additional comments from Peter.
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Link: http://lkml.kernel.org/r/1397501029-29286-1-git-send-email-kys@microsoft.com
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
  8. 04 Sep, 2013 1 commit
  9. 22 Aug, 2012 1 commit
  10. 28 Mar, 2012 1 commit
  11. 26 Jul, 2011 1 commit
  12. 23 Mar, 2011 1 commit
    • Rafael J. Wysocki's avatar
      x86: Use syscore_ops instead of sysdev classes and sysdevs · f3c6ea1b
      Rafael J. Wysocki authored
      Some subsystems in the x86 tree need to carry out suspend/resume and
      shutdown operations with one CPU on-line and interrupts disabled and
      they define sysdev classes and sysdevs or sysdev drivers for this
      purpose.  This leads to unnecessarily complicated code and excessive
      memory usage, so switch them to using struct syscore_ops objects for
      this purpose instead.
      Generally, there are three categories of subsystems that use
      sysdevs for implementing PM operations: (1) subsystems whose
      suspend/resume callbacks ignore their arguments entirely (the
      majority), (2) subsystems whose suspend/resume callbacks use their
      struct sys_device argument, but don't really need to do that,
      because they can be implemented differently in an arguably simpler
      way (io_apic.c), and (3) subsystems whose suspend/resume callbacks
      use their struct sys_device argument, but the value of that argument
      is always the same and could be ignored (microcode_core.c).  In all
      of these cases the subsystems in question may be readily converted to
      using struct syscore_ops objects for power management and shutdown.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
  13. 12 Mar, 2011 1 commit
  14. 12 Oct, 2010 1 commit
  15. 20 Jul, 2010 1 commit
  16. 30 Mar, 2010 1 commit
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      The script does the followings.
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
      The conversion was done in the following steps.
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
      6. percpu.h was updated not to include slab.h.
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
  17. 24 Feb, 2010 1 commit
  18. 20 Feb, 2010 2 commits
  19. 16 Feb, 2010 1 commit
  20. 22 Feb, 2009 1 commit
    • Ingo Molnar's avatar
      x86: refactor x86_quirks support · 8e6dafd6
      Ingo Molnar authored
      Impact: cleanup
      Make x86_quirks support more transparent. The highlevel
      methods are now named:
        extern void x86_quirk_pre_intr_init(void);
        extern void x86_quirk_intr_init(void);
        extern void x86_quirk_trap_init(void);
        extern void x86_quirk_pre_time_init(void);
        extern void x86_quirk_time_init(void);
      This makes it clear that if some platform extension has to
      do something here that it is considered ... weird, and is
      Also remove arch_hooks.h and move it into setup.h (and other
      header files where appropriate).
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  21. 04 Jan, 2009 1 commit
  22. 12 Jul, 2008 1 commit
  23. 02 Jun, 2008 1 commit
    • Pavel Machek's avatar
      i8259: fix final ugliness · c46e62f7
      Pavel Machek authored
      Introduce IRQx_VECTOR on 32-bit, so that #ifdef noise is kept
      down. There should be no object code change.
      [ mingo@elte.hu: merged to x86/irq not x86/i8259 due to x86/irq having
        restructured the vector code into asm-x86/irq_vectors.h, which this
        patch touches. ]
      Signed-off-by: default avatarPavel Machek <pavel@suse.cz>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  24. 24 May, 2008 6 commits
  25. 19 Feb, 2008 1 commit
  26. 30 Jan, 2008 3 commits
  27. 25 Jan, 2008 1 commit
  28. 19 Oct, 2007 1 commit
  29. 17 Oct, 2007 1 commit
  30. 12 Oct, 2007 1 commit
  31. 11 Oct, 2007 2 commits