Changeset 350 for soft/giet_vm


Ignore:
Timestamp:
Jun 29, 2014, 12:53:25 PM (10 years ago)
Author:
alain
Message:

Introducing two modifications regarding the locks protecting
exclusive access to BDV and TTY peripherals channels:

  • use the giet_lock_t type to have only one lock per cache line.
  • store these locks in the seg_kernel_data or in seg_kernel_uncdata, depending on the GIET_NO HARD_CC configuration parameter, to have cacheable locks when it is possible.
Location:
soft/giet_vm/giet_drivers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/bdv_driver.c

    r333 r350  
    6363#include <ctx_handler.h>
    6464
     65#if !defined(GIET_NO_HARD_CC)
     66# error: You must define GIET_NO_HARD_CC in the giet_config.h file
     67#endif
     68
    6569///////////////////////////////////////////////////////////////////////////////
    6670// BDV global variables
     
    6872
    6973#define in_unckdata __attribute__((section (".unckdata")))
    70 
    71 in_unckdata unsigned int          _bdv_lock = 0;
    72 in_unckdata volatile unsigned int _bdv_status = 0;
     74#define in_kdata __attribute__((section (".kdata")))
     75
     76#if GIET_NO_HARD_CC
     77in_unckdata giet_lock_t           _bdv_lock __attribute__((aligned(64)));
     78in_unckdata volatile unsigned int _bdv_status;
    7379in_unckdata volatile unsigned int _bdv_gtid;
     80#else
     81in_kdata giet_lock_t           _bdv_lock __attribute__((aligned(64)));
     82in_kdata volatile unsigned int _bdv_status;
     83in_kdata volatile unsigned int _bdv_gtid;
     84#endif
    7485
    7586///////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/bdv_driver.h

    r295 r350  
    1010#define _GIET_BDV_DRIVER_H_
    1111
     12#include "utils.h"
     13
    1214///////////////////////////////////////////////////////////////////////////////////
    1315// BDV global variables
    1416///////////////////////////////////////////////////////////////////////////////////
    1517
    16 extern unsigned int          _bdv_lock;    // BDV is a shared ressource
     18extern giet_lock_t           _bdv_lock;    // BDV is a shared ressource
    1719extern volatile unsigned int _bdv_status;  // required for IRQ signaling
    1820extern volatile unsigned int _bdv_gtid;    // descheduled task id = gpid<<16 + ltid
  • soft/giet_vm/giet_drivers/ioc_driver.c

    r343 r350  
    183183    unsigned int flags;            // page protection flags
    184184    unsigned int ix2;              // page index in IOMMU PT1 page table
    185     unsigned int ppn_first;        // first physical page number for user buffer
     185    unsigned int ppn_first = 0;    // first physical page number for user buffer
    186186    unsigned int buf_xaddr = 0;    // user buffer virtual address in IO space (if IOMMU)
    187187    paddr_t      buf_paddr = 0;    // user buffer physical address (if no IOMMU),
     
    308308
    309309#if       ( USE_IOC_BDV )
    310 
    311 #if GIET_DEBUG_IOC_DRIVER
    312 _printf("\n[IOC DEBUG] Calling BDV driver\n");
    313 #endif
    314310        if (to_mem) error = _bdv_read ( mode, lba, buf_paddr, count);
    315311        else        error = _bdv_write( mode, lba, buf_paddr, count);
    316 
    317312#elif ( USE_IOC_SPI )
    318 
    319 #if GIET_DEBUG_IOC_DRIVER
    320 _printf("\n[IOC DEBUG] Calling SPI driver\n");
    321 #endif
    322313        if (to_mem) error = _sdc_read (mode, lba, buf_paddr, count);
    323314        else        error = _sdc_write(mode, lba, buf_paddr, count);
    324 
    325315#elif ( USE_IOC_HBA )
    326 
    327 #if GIET_DEBUG_IOC_DRIVER
    328 _printf("\n[IOC DEBUG] Calling HBA driver\n");
    329 #endif
    330316        if (to_mem) error = _hba_read (channel, mode, lba, buf_paddr, count);
    331317        else        error = _hba_write(channel, mode, lba, buf_paddr, count);
    332 
    333318#elif ( USE_IOC_RDK )
    334 
    335 #if GIET_DEBUG_IOC_DRIVER
    336 _printf("\n[IOC DEBUG] Calling RDK driver\n");
    337 #endif
    338319        if (to_mem) error = _rdk_read (lba, buf_vaddr, count);
    339320        else        error = _rdk_write(lba, buf_vaddr, count);
    340 
    341321#endif
    342322
  • soft/giet_vm/giet_drivers/tty_driver.c

    r345 r350  
    3939#endif
    4040
     41#if !defined(GIET_NO_HARD_CC)
     42# error: You must define GIET_NO_HARD_CC in the giet_config.h file
     43#endif
     44
    4145#if (NB_TTY_CHANNELS < 1)
    4246# error: NB_TTY_CHANNELS cannot be smaller than 1!
    4347#endif
    4448
     49//////////////////////////////////////////////////////////////////////////////
     50//   TTY global variables
     51//////////////////////////////////////////////////////////////////////////////
     52
    4553#define in_unckdata __attribute__((section (".unckdata")))
    4654#define in_kdata    __attribute__((section (".kdata")))
    4755
    48 //////////////////////////////////////////////////////////////////////////////
    49 //   TTY global variables
    50 //////////////////////////////////////////////////////////////////////////////
    51 
     56#if GIET_NO_HARD_CC
    5257in_unckdata volatile unsigned int _tty_rx_buf[NB_TTY_CHANNELS];
    53 
    54 in_unckdata volatile unsigned int _tty_rx_full[NB_TTY_CHANNELS]
    55     = { [0 ... NB_TTY_CHANNELS - 1] = 0 };
    56 
    57 in_unckdata unsigned int _tty_lock[NB_TTY_CHANNELS]
    58     = { [0 ... NB_TTY_CHANNELS - 1] = 0 };
     58in_unckdata volatile unsigned int _tty_rx_full[NB_TTY_CHANNELS];
     59in_unckdata giet_lock_t _tty_lock[NB_TTY_CHANNELS] __attribute__((aligned(64)));
     60#else
     61in_kdata volatile unsigned int _tty_rx_buf[NB_TTY_CHANNELS];
     62in_kdata volatile unsigned int _tty_rx_full[NB_TTY_CHANNELS];
     63in_kdata giet_lock_t _tty_lock[NB_TTY_CHANNELS] __attribute__((aligned(64)));
     64#endif
    5965
    6066//////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/tty_driver.h

    r295 r350  
    88#ifndef _GIET_TTY_DRIVERS_H_
    99#define _GIET_TTY_DRIVERS_H_
     10
     11#include "utils.h"
    1012
    1113///////////////////////////////////////////////////////////////////////////////////
     
    2729///////////////////////////////////////////////////////////////////////////////////
    2830
    29 extern volatile unsigned char _tty_get_buf[];
     31extern volatile unsigned int _tty_rx_buf[];
    3032
    31 extern volatile unsigned char _tty_get_full[];
     33extern volatile unsigned int _tty_rx_full[];
     34
     35extern giet_lock_t _tty_lock[];
    3236
    3337//////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.