• Huisong Li's avatar
    mailbox: pcc: Support shared interrupt for multiple subspaces · 3db174e4
    Huisong Li authored
    If the platform acknowledge interrupt is level triggered, then it can
    be shared by multiple subspaces provided each one has a unique platform
    interrupt ack preserve and ack set masks.
    
    If it can be shared, then we can request the irq with IRQF_SHARED and
    IRQF_ONESHOT flags. The first one indicating it can be shared and the
    latter one to keep the interrupt disabled until the hardirq handler
    finished.
    
    Further, since there is no way to detect if the interrupt is for a given
    channel as the interrupt ack preserve and ack set masks are for clearing
    the interrupt and not for reading the status(in case Irq Ack register
    may be write-only on some platforms), we need a way to identify if the
    given channel is in use and expecting the interrupt.
    
    PCC type0, type1 and type5 do not support shared level triggered interrupt.
    The methods of determining whether a given channel for remaining types
    should respond to an interrupt are as follows:
     - type2: Whether the interrupt belongs to a given channel is only
              determined by the status field in Generic Communications Channel
              Shared Memory Region, which is done in rx_callback of PCC client.
     - type3: This channel checks chan_in_use flag first and then checks the
              command complete bit(value '1' indicates that the command has
              been completed).
     - type4: Platform ensure that the default value of the command complete
              bit corresponding to the type4 channel is '1'. This command
              complete bit is '0' when receive a platform notification.
    
    The new field, 'chan_in_use' is used by the type only support the
    communication from OSPM to Platform (like type3) and should be completely
    ignored by other types so as to avoid too many type unnecessary checks in
    IRQ handler.
    Signed-off-by: default avatarHuisong Li <lihuisong@huawei.com>
    Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
    Link: https://lore.kernel.org/r/20230801063827.25336-3-lihuisong@huawei.comSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    3db174e4
pcc.c 22 KB