Changeset f100a58 in rtems


Ignore:
Timestamp:
Sep 19, 2017, 12:35:02 PM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4c1f442
Parents:
31540bf
Message:

bsp/qoriq: Add hypervisor guest SMP support

Update #3085.

Location:
c/src/lib/libbsp/powerpc/qoriq
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/qoriq/irq/irq.c

    r31540bf rf100a58  
    3636#include <bsp/qoriq.h>
    3737
     38#ifdef RTEMS_SMP
     39#include <rtems/score/smpimpl.h>
     40#endif
     41
    3842RTEMS_INTERRUPT_LOCK_DEFINE(static, lock, "QorIQ IRQ")
    3943
     
    9498                return;
    9599        }
     100
     101#ifdef RTEMS_SMP
     102        if (exception_number == 36) {
     103                _SMP_Inter_processor_interrupt_handler();
     104                return;
     105        }
     106#endif
    96107
    97108        ev_int_iack(0, &vector);
  • c/src/lib/libbsp/powerpc/qoriq/start/start.S

    r31540bf rf100a58  
    490490#ifdef __PPC_CPU_E6500__
    491491        /* Processor doorbell interrupt */
    492         PPC_REG_STORE_UPDATE    r1, -EXC_GENERIC_SIZE(r1)
     492#if defined(QORIQ_IS_HYPERVISOR_GUEST) && defined(RTEMS_SMP)
     493        PPC_REG_STORE_UPDATE    r1, -PPC_EXC_INTERRUPT_FRAME_SIZE(r1)
     494#else
     495        PPC_REG_STORE_UPDATE    r1, -EXC_GENERIC_SIZE(r1)
     496#endif
    493497        PPC_REG_STORE   r3, GPR3_OFFSET(r1)
    494498        li      r3, 36
    495         b       ppc_exc_fatal_normal
     499#if defined(QORIQ_IS_HYPERVISOR_GUEST) && defined(RTEMS_SMP)
     500        b       ppc_exc_interrupt
     501#else
     502        b       ppc_exc_fatal_normal
     503#endif
    496504        START_NOP_FOR_LINKER_TOC_POINTER_RESTORE
    497505        /* Processor doorbell critical interrupt */
  • c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c

    r31540bf rf100a58  
    11/*
    2  * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2013, 2017 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    3939#define IPI_INDEX 0
    4040
    41 #define TLB_BEGIN (3 * QORIQ_TLB1_ENTRY_COUNT / 4)
    42 
    43 #define TLB_END QORIQ_TLB1_ENTRY_COUNT
    44 
    45 #define TLB_COUNT (TLB_END - TLB_BEGIN)
    46 
    4741#if QORIQ_THREAD_COUNT > 1
    4842static bool is_started_by_u_boot(uint32_t cpu_index)
     
    10599}
    106100
     101#ifndef QORIQ_IS_HYPERVISOR_GUEST
    107102static void bsp_inter_processor_interrupt(void *arg)
    108103{
    109104  _SMP_Inter_processor_interrupt_handler();
     105}
     106#endif
     107
     108static void setup_boot_page(void)
     109{
     110#ifdef QORIQ_IS_HYPERVISOR_GUEST
     111  qoriq_mmu_context mmu_context;
     112
     113  qoriq_mmu_context_init(&mmu_context);
     114  qoriq_mmu_add(
     115    &mmu_context,
     116    0xfffff000,
     117    0xffffffff,
     118    0,
     119    0,
     120    FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW,
     121    0
     122  );
     123  qoriq_mmu_partition(&mmu_context, 1);
     124  qoriq_mmu_write_to_tlb1(&mmu_context, QORIQ_TLB1_ENTRY_COUNT - 1);
     125#endif
    110126}
    111127
     
    140156
    141157  if (rtems_configuration_get_maximum_processors() > 0) {
     158    setup_boot_page();
    142159    cpu_count = discover_processors();
    143160  }
     
    197214void _CPU_SMP_Finalize_initialization(uint32_t cpu_count)
    198215{
     216#ifdef QORIQ_IS_HYPERVISOR_GUEST
     217  (void) cpu_count;
     218#else
    199219  if (cpu_count > 1) {
    200220    rtems_status_code sc;
     
    211231    }
    212232  }
     233#endif
    213234}
    214235
     
    220241void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
    221242{
     243#ifdef QORIQ_IS_HYPERVISOR_GUEST
     244  uint32_t msg;
     245
     246  /* DBELL message type */
     247  msg = (0U << (63 - 36)) | target_processor_index;
     248  __asm__ volatile ("msgsnd %0" : : "r" (msg));
     249#else
    222250  qoriq.pic.ipidr [IPI_INDEX].reg = 1U << target_processor_index;
    223 }
     251#endif
     252}
Note: See TracChangeset for help on using the changeset viewer.