Skip to content
  1. Sep 26, 2017
    • Thomas Gleixner's avatar
      Merge branch 'irq/core' into x86/apic · e4ae4c8e
      Thomas Gleixner authored
      Pick up the dependencies for the vector management rework series.
      e4ae4c8e
    • Thomas Gleixner's avatar
      genirq/matrix: Add tracepoints · ec0f7cd2
      Thomas Gleixner authored
      
      
      Add tracepoints for the irq bitmap matrix allocator.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213153.279468022@linutronix.de
      ec0f7cd2
    • Thomas Gleixner's avatar
      genirq: Implement bitmap matrix allocator · 2f75d9e1
      Thomas Gleixner authored
      
      
      Implement the infrastructure for a simple bitmap based allocator, which
      will replace the x86 vector allocator. It's in the core code as other
      architectures might be able to reuse/extend it. For now it only implements
      allocations for single CPUs, but it's simple to add multi CPU allocation
      support if required.
      
      The concept is rather simple:
      
       Global information:
       	system_vector bitmap
      	global accounting
      
       PerCPU information:
       	allocation bitmap
      	managed allocation bitmap
      	local accounting
      
      The system vector bitmap is used to exclude vectors system wide from the
      allocation space.
      
      The allocation bitmap is used to keep track of per cpu used vectors.
      
      The managed allocation bitmap is used to reserve vectors for managed
      interrupts.
      
      When a regular (non managed) interrupt allocation happens then the
      following rule applies:
      
            tmpmap = system_map | alloc_map | managed_map
            find_zero_bit(tmpmap)
      
      Oring the bitmaps together gives the real available space. The same rule
      applies for reserving a managed interrupt vector. But contrary to the
      regular interrupts the reservation only marks the bit in the managed map
      and therefor excludes it from the regular allocations. The managed map is
      only cleaned out when the a managed interrupt is completely released and it
      stays alive accross CPU offline/online operations.
      
      For managed interrupt allocations the rule is:
      
            tmpmap = managed_map & ~alloc_map
            find_first_bit(tmpmap)
      
      This returns the first bit which is in the managed map, but not yet
      allocated in the allocation map. The allocation marks it in the allocation
      map and hands it back to the caller for use.
      
      The rest of the code are helper functions to handle the various
      requirements and the accounting which are necessary to replace the x86
      vector allocation code. The result is a single patch as the evolution of
      this infrastructure cannot be represented in bits and pieces.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Chris Metcalf <cmetcalf@mellanox.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213153.185437174@linutronix.de
      2f75d9e1
    • Thomas Gleixner's avatar
      genirq/irqdomain: Add force reactivation flag to irq domains · 22d0b12f
      Thomas Gleixner authored
      
      
      Allow irqdomains to tell the core code, that after early activation the
      interrupt needs to be reactivated at request_irq() time.
      
      This allows reservation of vectors at early activation time and actual
      vector assignment at request_irq() time.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213153.106242536@linutronix.de
      22d0b12f
    • Thomas Gleixner's avatar
      genirq/irqdomain: Propagate early activation · 42e1cc2d
      Thomas Gleixner authored
      
      
      Propagate the early activation mode to the irqdomain activate()
      callbacks. This is required for the upcoming reservation, late vector
      assignment scheme, so that the early activation call can act accordingly.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213153.028353660@linutronix.de
      42e1cc2d
    • Thomas Gleixner's avatar
      genirq/irqdomain: Allow irq_domain_activate_irq() to fail · bb9b428a
      Thomas Gleixner authored
      
      
      Allow irq_domain_activate_irq() to fail. This is required to support a
      reservation and late vector assignment scheme.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.933882227@linutronix.de
      bb9b428a
    • Thomas Gleixner's avatar
      genirq/irqdomain: Update irq_domain_ops.activate() signature · 72491643
      Thomas Gleixner authored
      
      
      The irq_domain_ops.activate() callback has no return value and no way to
      tell the function that the activation is early.
      
      The upcoming changes to support a reservation scheme which allows to assign
      interrupt vectors on x86 only when the interrupt is actually requested
      requires:
      
        - A return value, so activation can fail at request_irq() time
        
        - Information that the activate invocation is early, i.e. before
          request_irq().
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.848490816@linutronix.de
      72491643
    • Thomas Gleixner's avatar
      genirq: Separate activation and startup · c942cee4
      Thomas Gleixner authored
      
      
      Activation of an interrupt and startup are currently a combo
      functionlity. That works so far, but upcoming changes require a strict
      separation because the activation can fail in future.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.754334077@linutronix.de
      c942cee4
    • Thomas Gleixner's avatar
      genirq: Set managed shut down flag at init · 239306fe
      Thomas Gleixner authored
      
      
      Managed interrupts should start up in managed shutdown mode. Set the status
      flag when initialising the irq descriptor.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.669687742@linutronix.de
      239306fe
    • Thomas Gleixner's avatar
      genirq: Make state consistent for !IRQ_DOMAIN_HIERARCHY · 457f6d35
      Thomas Gleixner authored
      
      
      In the !IRQ_DOMAIN_HIERARCHY cas the activation stubs are not
      setting/clearing the activation status bits. This is not a problem at the
      moment, but upcoming changes require a correct status.
      
      Add the set/clear incovations to the stub functions and move them to the
      core internal header to avoid duplication and visibility outside the core.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.591985591@linutronix.de
      457f6d35
    • Thomas Gleixner's avatar
      irqdomain/debugfs: Provide domain specific debug callback · c3e7239a
      Thomas Gleixner authored
      
      
      Some interrupt domains like the X86 vector domain has special requirements
      for debugging, like showing the vector usage on the CPUs.
      
      Add a callback to the irqdomain ops which can be filled in by domains which
      require it and add conditional invocations to the irqdomain and the per irq
      debug files.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.512937505@linutronix.de
      c3e7239a
    • Thomas Gleixner's avatar
      genirq/msi: Capture device name for debugfs · 07557ccb
      Thomas Gleixner authored
      
      
      For debugging the allocation of unused or potentially leaked interrupt
      descriptor it's helpful to have some information about the site which
      allocated them. In case of MSI this is simple because the caller hands the
      device struct pointer into the domain allocation function.
      
      Duplicate the device name and show it in the debugfs entry of the interrupt
      descriptor.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.433038426@linutronix.de
      07557ccb
    • Thomas Gleixner's avatar
      genirq/debugfs: Show debug information for all irq descriptors · e0b47794
      Thomas Gleixner authored
      
      
      Currently the debugfs shows only information about actively used interrupts
      like /proc/irq/ does. That's fine for most cases, but not helpful when
      internals of allocated, but unused interrupt descriptors have to
      debugged. It's also useful to provide information about all descriptors so
      leaks can be debugged in a simpler way.
      
      Move the debugfs registration to the descriptor allocation code.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Rui Zhang <rui.zhang@intel.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: https://lkml.kernel.org/r/20170913213152.355525908@linutronix.de
      e0b47794
  2. Sep 25, 2017
    • Alexandru Moise's avatar
      genirq: Check __free_irq() return value for NULL · 2827a418
      Alexandru Moise authored
      
      
      __free_irq() can return a NULL irqaction for example when trying to free
      already-free IRQ, but the callsite unconditionally dereferences the
      returned pointer.
      
      Fix this by adding a check and return NULL.
      
      Signed-off-by: default avatarAlexandru Moise <00moses.alexander00@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20170919200412.GA29985@gmail.com
      2827a418
    • Dou Liyang's avatar
      x86/apic: Use lapic_is_integrated() consistently · ae41a2a4
      Dou Liyang authored
      
      
      lapic_is_integrated() is a wrapper around APIC_INTEGRATED(), but not used
      consistently.
      
      Replace the direct usage of APIC_INTEGRATED() and fixup a hard to read tail
      comment. No functional change.
      
      [ tglx: Made it compile and work .... ]
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1504774161-7137-2-git-send-email-douly.fnst@cn.fujitsu.com
      ae41a2a4
    • Dou Liyang's avatar
      x86/apic: Remove duplicate X86_64 conditional in lapic_is_integrated() · e3cccbce
      Dou Liyang authored
      
      
      The macro APIC_INTEGRATED(x) is already wrapped by CONFIG_X86_32. So
      it can be invoked unconditionally.
      
      Remove the extra "#ifdef CONFIG_X86_64...". No functional change.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1504774161-7137-1-git-send-email-douly.fnst@cn.fujitsu.com
      e3cccbce
    • Dou Liyang's avatar
      x86/apic: Remove init_bsp_APIC() · b371ae0d
      Dou Liyang authored
      
      
      init_bsp_APIC() which works for the virtual wire mode is used in ISA irq
      initialization at boot time.
      
      With the new APIC interrupt delivery mode scheme, which initializes the
      APIC before the first interrupt is expected, init_bsp_APIC() is not longer
      required and can be removed.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-13-git-send-email-douly.fnst@cn.fujitsu.com
      b371ae0d
    • Dou Liyang's avatar
      x86/apic: Initialize interrupt mode after timer init · 935356ce
      Dou Liyang authored
      
      
      A cold or warm boot through BIOS sets the APIC in default interrupt
      delivery mode. A dump-capture kernel will not go through a BIOS reset and
      leave the interrupt delivery mode in the state which was active on the
      crashed kernel, but the dump kernel startup code assumes default delivery
      mode which can result in interrupt delivery/handling to fail.
      
      To solve this problem, it's required to set up the final interrupt delivery
      mode as soon as possible. As IOAPIC setup needs the timer initialized for
      verifying the timer interrupt delivery mode, the earliest point is right
      after timer setup in late_time_init().
      
      That results in the following init order:
      
        1) Set up the legacy timer, if applicable on the platform
      
        2) Set up APIC/IOAPIC which includes the verification of the legacy timer
           interrupt delivery.
      
        3) TSC calibration
      
        4) Local APIC timer setup
      
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-12-git-send-email-douly.fnst@cn.fujitsu.com
      935356ce
    • Dou Liyang's avatar
      x86/init: Add intr_mode_init to x86_init_ops · 34fba3e6
      Dou Liyang authored
      
      
      X86 and XEN initialize interrupt delivery mode in different way.
      
      To avoid conditionals, add a new x86_init_ops function which defaults to
      the standard function and can be overridden by the early XEN platform code.
      
      [ tglx: Folded the XEN part which was a separate patch to preserve
        	bisectability ]
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-10-git-send-email-douly.fnst@cn.fujitsu.com
      34fba3e6
    • Dou Liyang's avatar
      x86/ioapic: Refactor the delay logic in timer_irq_works() · ca7c6076
      Dou Liyang authored
      
      
      timer_irq_works() is used to detects the timer IRQs. It calls mdelay(10) to
      delay ten ticks and check whether the timer IRQ work or not.
      
      mdelay() depends on the loops_per_jiffy which is set up in
      calibrate_delay(), but the delay calibration depends on a working timer
      interrupt, which causes a chicken and egg problem.
      
      The correct solution is to set up the interrupt mode and making sure that
      the timer interrupt is delivered correctly before invoking calibrate_delay().
      That means that mdelay() cannot be used in timer_irq_works(). 
      
      Provide helper functions to make a rough delay estimate which is good enough
      to prove that the timer interrupt is working. Either use TSC or a simple
      delay loop and assume that 4GHz is the maximum CPU frequency to base the
      delay calculation on.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-9-git-send-email-douly.fnst@cn.fujitsu.com
      ca7c6076
    • Dou Liyang's avatar
      x86/apic: Unify interrupt mode setup for UP system · 0c759131
      Dou Liyang authored
      
      
      In UniProcessor kernel with UP_LATE_INIT=y, the interrupt delivery mode is
      initialized in up_late_init().
      
      Use the new unified apic_intr_mode_init() function and remove
      APIC_init_uniprocessor().
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-8-git-send-email-douly.fnst@cn.fujitsu.com
      0c759131
    • Dou Liyang's avatar
      x86/apic: Mark the apic_intr_mode extern for sanity check cleanup · 4f45ed9f
      Dou Liyang authored
      
      
      Calling native_smp_prepare_cpus() to prepare for SMP bootup, does some
      sanity checking, enables APIC mode and disables SMP feature.
      
      Now, APIC mode setup has been unified to apic_intr_mode_init(), some sanity
      checks are redundant and need to be cleanup.
      
      Mark the apic_intr_mode extern to refine the switch and remove the
      redundant sanity check.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-7-git-send-email-douly.fnst@cn.fujitsu.com
      4f45ed9f
    • Dou Liyang's avatar
      x86/apic: Unify interrupt mode setup for SMP-capable system · 3e730dad
      Dou Liyang authored
      
      
      On a SMP-capable system, the kernel enables and sets up the APIC interrupt
      delivery mode in native_smp_prepare_cpus(). The decision how to setup the
      APIC is intermingled with the decision of setting up SMP or not.
      
      Split the initialization of the APIC interrupt mode independent from other
      decisions and have a separate apic_intr_mode_init() function for it.
      
      The invocation time stays the same for now.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-6-git-send-email-douly.fnst@cn.fujitsu.com
      3e730dad
    • Dou Liyang's avatar
      x86/apic: Move logical APIC ID away from apic_bsp_setup() · 4b1244b4
      Dou Liyang authored
      
      
      apic_bsp_setup() sets and returns logical APIC ID for initializing
      cpu0_logical_apicid in a SMP-capable system.
      
      The id has nothing to do with the initialization of local APIC and I/O
      APIC. And apic_bsp_setup() should be called for interrupt mode setup only.
      
      Move the id setup into a separate helper function for cleanup and mark
      apic_bsp_setup() void.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-5-git-send-email-douly.fnst@cn.fujitsu.com
      4b1244b4
    • Dou Liyang's avatar
      x86/apic: Split local APIC timer setup from the APIC setup · a2510d15
      Dou Liyang authored
      
      
      apic_bsp_setup() sets up the local APIC, I/O APIC and APIC timer.
      
      The local APIC and I/O APIC setup belongs to interrupt delivery mode
      setup. Setting up the local APIC timer for booting CPU is another job
      and has nothing to do with interrupt delivery mode setup.
      
      Split local APIC timer setup from the APIC setup, keep it in the original
      position for SMP and UP kernel for now.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-4-git-send-email-douly.fnst@cn.fujitsu.com
      a2510d15
    • Dou Liyang's avatar
      x86/apic: Prepare for unifying the interrupt delivery modes setup · 4b1669e8
      Dou Liyang authored
      
      
      There are three places which initialize the interrupt delivery modes:
      
      1) init_bsp_APIC() which is called early might setup the through-local-APIC
         virtual wire mode on non SMP systems.
      
      2) In an SMP-capable system, native_smp_prepare_cpus() tries to switch to
         symmetric I/O model.
      
      3) In UP system with UP_LATE_INIT=y, the local APIC and I/O APIC are set up
         in smp_init().
      
      There is no technical reason to make these initializations at random places
      and run the kernel with the potentially wrong mode through the early boot
      stage, but it has a problematic side effect: The late switch to symmetric
      I/O mode causes dump-capture kernel to hang when the kernel command line
      option 'notsc' is active.
      
      Provide a new function to unify that three positions. Preparatory patch to
      initialize an interrupt mode directly.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-3-git-send-email-douly.fnst@cn.fujitsu.com
      4b1669e8
    • Dou Liyang's avatar
      x86/apic: Construct a selector for the interrupt delivery mode · 0114a8e8
      Dou Liyang authored
      
      
      There are quite some switches which are used to determine the final
      interrupt delivery mode, as shown below:
      
      1) Kconfig: CONFIG_X86_64; CONFIG_X86_LOCAL_APIC; CONFIG_x86_IO_APIC
      2) Command line options: disable_apic; skip_ioapic_setup
      3) CPU Capability: boot_cpu_has(X86_FEATURE_APIC)
      4) MP table: smp_found_config
      5) ACPI: acpi_lapic; acpi_ioapic; nr_ioapic
      
      These switches are disordered and scattered and there are also some
      dependencies between them. These make the code difficult to maintain and
      read.
      
      Construct a selector to unify them into a single function, then, Use this
      selector to get an interrupt delivery mode directly.
      
      Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: yinghai@kernel.org
      Cc: bhe@redhat.com
      Link: https://lkml.kernel.org/r/1505293975-26005-2-git-send-email-douly.fnst@cn.fujitsu.com
      0114a8e8
    • Linus Torvalds's avatar
      Linux 4.14-rc2 · e19b205b
      Linus Torvalds authored
      e19b205b
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 6e7f2538
      Linus Torvalds authored
      Pull DeviceTree fixes from Rob Herring:
      
       - fix build for !OF providing empty of_find_device_by_node
      
       - fix Abracon vendor prefix
      
       - sync dtx_diff include paths (again)
      
       - a stm32h7 clock binding doc fix
      
      * tag 'devicetree-fixes-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: clk: stm32h7: fix clock-cell size
        scripts/dtc: dtx_diff - 2nd update of include dts paths to match build
        dt-bindings: fix vendor prefix for Abracon
        of: provide inline helper for of_find_device_by_node
      6e7f2538
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a141fd55
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Another round of CR3/PCID related fixes (I think this addresses all
        but one of the known problems with PCID support), an objtool fix plus
        a Clang fix that (finally) solves all Clang quirks to build a bootable
        x86 kernel as-is"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/asm: Fix inline asm call constraints for Clang
        objtool: Handle another GCC stack pointer adjustment bug
        x86/mm/32: Load a sane CR3 before cpu_init() on secondary CPUs
        x86/mm/32: Move setup_clear_cpu_cap(X86_FEATURE_PCID) earlier
        x86/mm/64: Stop using CR3.PCID == 0 in ASID-aware code
        x86/mm: Factor out CR3-building code
      a141fd55
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 16528a3f
      Linus Torvalds authored
      Pull timer fix from Ingo Molnar:
       "A clocksource driver section mismatch fix"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource/integrator: Fix section mismatch warning
      16528a3f
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 43d368a1
      Linus Torvalds authored
      Pull irq fixes from Ingo Molnar:
       "Three irqchip driver fixes, and an affinity mask helper function bug
        fix affecting x86"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        Revert "genirq: Restrict effective affinity to interrupts actually using it"
        irqchip.mips-gic: Fix shared interrupt mask writes
        irqchip/gic-v4: Fix building with ancient gcc
        irqchip/gic-v3: Iterate over possible CPUs by for_each_possible_cpu()
      43d368a1
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a4306434
      Linus Torvalds authored
      Pull address-limit checking fixes from Ingo Molnar:
       "This fixes a number of bugs in the address-limit (USER_DS) checks that
        got introduced in the merge window, (mostly) affecting the ARM and
        ARM64 platforms"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        arm64/syscalls: Move address limit check in loop
        arm/syscalls: Optimize address limit check
        Revert "arm/syscalls: Check address limit on user-mode return"
        syscalls: Use CHECK_DATA_CORRUPTION for addr_limit_user_check
      a4306434
    • Linus Torvalds's avatar
      Merge branch 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · a3028247
      Linus Torvalds authored
      Pull misc security layer update from James Morris:
       "This is the remaining 'general' change in the security tree for v4.14,
        following the direct merging of SELinux (+ TOMOYO), AppArmor, and
        seccomp.
      
        That's everything now for the security tree except IMA, which will
        follow shortly (I've been traveling for the past week with patchy
        internet)"
      
      * 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        security: fix description of values returned by cap_inode_need_killpriv
      a3028247
    • Linus Torvalds's avatar
      Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 1436ab06
      Linus Torvalds authored
      Pull TPM updates from James Morris:
       "Here are the TPM updates from Jarkko for v4.14, which I've placed in
        their own branch (next-tpm). I ended up cherry-picking them as other
        changes had been made in Jarkko's branch after he sent me his original
        pull request.
      
        I plan on maintaining a separate branch for TPM (and other security
        subsystems) from now on.
      
        From Jarkko: 'Not much this time except a few fixes'"
      
      * 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        tpm: ibmvtpm: simplify crq initialization and document crq format
        tpm: replace msleep() with  usleep_range() in TPM 1.2/2.0 generic drivers
        Documentation: tpm: add powered-while-suspended binding documentation
        tpm: tpm_crb: constify acpi_device_id.
        tpm: vtpm: constify vio_device_id
      1436ab06
  3. Sep 24, 2017