• E
    iommu: Introduce bind/unbind_guest_msi · 5eff20d8
    Eric Auger 提交于
    virt inclusion
    category: feature
    bugzilla: https://gitee.com/openeuler/kernel/issues/I401IF
    CVE: NA
    
    ------------------------------
    
    On ARM, MSI are translated by the SMMU. An IOVA is allocated
    for each MSI doorbell. If both the host and the guest are exposed
    with SMMUs, we end up with 2 different IOVAs allocated by each.
    guest allocates an IOVA (gIOVA) to map onto the guest MSI
    doorbell (gDB). The Host allocates another IOVA (hIOVA) to map
    onto the physical doorbell (hDB).
    
    So we end up with 2 untied mappings:
             S1            S2
    gIOVA    ->    gDB
                  hIOVA    ->    hDB
    
    Currently the PCI device is programmed by the host with hIOVA
    as MSI doorbell. So this does not work.
    
    This patch introduces an API to pass gIOVA/gDB to the host so
    that gIOVA can be reused by the host instead of re-allocating
    a new IOVA. So the goal is to create the following nested mapping:
    
             S1            S2
    gIOVA    ->    gDB     ->    hDB
    
    and program the PCI device with gIOVA MSI doorbell.
    
    In case we have several devices attached to this nested domain
    (devices belonging to the same group), they cannot be isolated
    on guest side either. So they should also end up in the same domain
    on guest side. We will enforce that all the devices attached to
    the host iommu domain use the same physical doorbell and similarly
    a single virtual doorbell mapping gets registered (1 single
    virtual doorbell is used on guest as well).
    Signed-off-by: NEric Auger <eric.auger@redhat.com>
    Signed-off-by: Kunkun Jiang<jiangkunkun@huawei.com>
    Reviewed-by: NKeqian Zhu <zhukeqian1@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    5eff20d8
iommu.c 88.7 KB