1. 02 9月, 2017 3 次提交
    • C
      powerpc/xive: rename xive_poke_esb() in xive_esb_read() · 59fc2724
      Cédric Le Goater 提交于
      xive_poke_esb() is performing a load/read so it is better named as
      xive_esb_read() as we will need to introduce a xive_esb_write()
      routine. Also use the XIVE_ESB_LOAD_EOI offset when EOI'ing LSI
      interrupts.
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      59fc2724
    • C
      powerpc/xive: guest exploitation of the XIVE interrupt controller · eac1e731
      Cédric Le Goater 提交于
      This is the framework for using XIVE in a PowerVM guest. The support
      is very similar to the native one in a much simpler form.
      
      Each source is associated with an Event State Buffer (ESB). This is a
      two bit state machine which is used to trigger events. The bits are
      named "P" (pending) and "Q" (queued) and can be controlled by MMIO.
      The Guest OS registers event (or notifications) queues on which the HW
      will post event data for a target to notify.
      
      Instead of OPAL calls, a set of Hypervisors call are used to configure
      the interrupt sources and the event/notification queues of the guest:
      
       - H_INT_GET_SOURCE_INFO
      
         used to obtain the address of the MMIO page of the Event State
         Buffer (PQ bits) entry associated with the source.
      
       - H_INT_SET_SOURCE_CONFIG
      
         assigns a source to a "target".
      
       - H_INT_GET_SOURCE_CONFIG
      
         determines to which "target" and "priority" is assigned to a source
      
       - H_INT_GET_QUEUE_INFO
      
         returns the address of the notification management page associated
         with the specified "target" and "priority".
      
       - H_INT_SET_QUEUE_CONFIG
      
         sets or resets the event queue for a given "target" and "priority".
         It is also used to set the notification config associated with the
         queue, only unconditional notification for the moment.  Reset is
         performed with a queue size of 0 and queueing is disabled in that
         case.
      
       - H_INT_GET_QUEUE_CONFIG
      
         returns the queue settings for a given "target" and "priority".
      
       - H_INT_RESET
      
         resets all of the partition's interrupt exploitation structures to
         their initial state, losing all configuration set via the hcalls
         H_INT_SET_SOURCE_CONFIG and H_INT_SET_QUEUE_CONFIG.
      
       - H_INT_SYNC
      
         issue a synchronisation on a source to make sure sure all
         notifications have reached their queue.
      
      As for XICS, the XIVE interface for the guest is described in the
      device tree under the "interrupt-controller" node. A couple of new
      properties are specific to XIVE :
      
       - "reg"
      
         contains the base address and size of the thread interrupt
         managnement areas (TIMA), also called rings, for the User level and
         for the Guest OS level. Only the Guest OS level is taken into
         account today.
      
       - "ibm,xive-eq-sizes"
      
         the size of the event queues. One cell per size supported, contains
         log2 of size, in ascending order.
      
       - "ibm,xive-lisn-ranges"
      
         the interrupt numbers ranges assigned to the guest. These are
         allocated using a simple bitmap.
      
      and also :
      
       - "/ibm,plat-res-int-priorities"
      
         contains a list of priorities that the hypervisor has reserved for
         its own use.
      
      Tested with a QEMU XIVE model for pseries and with the Power hypervisor.
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      eac1e731
    • C
      powerpc/xive: introduce a common routine xive_queue_page_alloc() · 994ea2f4
      Cédric Le Goater 提交于
      This routine will be used in the spapr backend. Also introduce a short
      xive_alloc_order() helper.
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      994ea2f4
  2. 24 8月, 2017 1 次提交
    • C
      powerpc/xive: Fix the size of the cpumask used in xive_find_target_in_mask() · a9dadc1c
      Cédric Le Goater 提交于
      When called from xive_irq_startup(), the size of the cpumask can be
      larger than nr_cpu_ids. This can result in a WARN_ON such as:
      
        WARNING: CPU: 10 PID: 1 at ../arch/powerpc/sysdev/xive/common.c:476 xive_find_target_in_mask+0x110/0x2f0
        ...
        NIP [c00000000008a310] xive_find_target_in_mask+0x110/0x2f0
        LR [c00000000008a2e4] xive_find_target_in_mask+0xe4/0x2f0
        Call Trace:
          xive_find_target_in_mask+0x74/0x2f0 (unreliable)
          xive_pick_irq_target.isra.1+0x200/0x230
          xive_irq_startup+0x60/0x180
          irq_startup+0x70/0xd0
          __setup_irq+0x7bc/0x880
          request_threaded_irq+0x14c/0x2c0
          request_event_sources_irqs+0x100/0x180
          __machine_initcall_pseries_init_ras_IRQ+0x104/0x134
          do_one_initcall+0x68/0x1d0
          kernel_init_freeable+0x290/0x374
          kernel_init+0x24/0x170
          ret_from_kernel_thread+0x5c/0x74
      
      This happens because we're being called with our affinity mask set to
      irq_default_affinity. That in turn was populated using
      cpumask_setall(), which sets NR_CPUs worth of bits, not nr_cpu_ids
      worth. Finally cpumask_weight() will return > nr_cpu_ids when passed a
      mask which has > nr_cpu_ids bits set.
      
      Fix it by limiting the value returned by cpumask_weight().
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      [mpe: Add change log details on actual cause]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a9dadc1c
  3. 15 8月, 2017 1 次提交
  4. 10 8月, 2017 2 次提交
  5. 15 6月, 2017 1 次提交
  6. 05 6月, 2017 1 次提交
  7. 27 4月, 2017 1 次提交
  8. 13 4月, 2017 1 次提交
    • N
      powerpc: Change the doorbell IPI calling convention · b866cc21
      Nicholas Piggin 提交于
      Change the doorbell callers to know about their msgsnd addressing,
      rather than have them set a per-cpu target data tag at boot that gets
      sent to the cause_ipi functions. The data is only used for doorbell IPI
      functions, no other IPI types, so it makes sense to keep that detail
      local to doorbell.
      
      Have the platform code understand doorbell IPIs, rather than the
      interrupt controller code understand them. Platform code can look at
      capabilities it has available and decide which to use.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b866cc21
  9. 10 4月, 2017 1 次提交
    • B
      powerpc/xive: Native exploitation of the XIVE interrupt controller · 243e2511
      Benjamin Herrenschmidt 提交于
      The XIVE interrupt controller is the new interrupt controller
      found in POWER9. It supports advanced virtualization capabilities
      among other things.
      
      Currently we use a set of firmware calls that simulate the old
      "XICS" interrupt controller but this is fairly inefficient.
      
      This adds the framework for using XIVE along with a native
      backend which OPAL for configuration. Later, a backend allowing
      the use in a KVM or PowerVM guest will also be provided.
      
      This disables some fast path for interrupts in KVM when XIVE is
      enabled as these rely on the firmware emulation code which is no
      longer available when the XIVE is used natively by Linux.
      
      A latter patch will make KVM also directly exploit the XIVE, thus
      recovering the lost performance (and more).
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [mpe: Fixup pr_xxx("XIVE:"...), don't split pr_xxx() strings,
       tweak Kconfig so XIVE_NATIVE selects XIVE and depends on POWERNV,
       fix build errors when SMP=n, fold in fixes from Ben:
         Don't call cpu_online() on an invalid CPU number
         Fix irq target selection returning out of bounds cpu#
         Extra sanity checks on cpu numbers
       ]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      243e2511