Commit 4eb42b81 authored by Andrey Smirnov's avatar Andrey Smirnov Committed by Peter Maydell
Browse files

pci: designware: Update MSI mapping unconditionally



Expression to calculate update_msi_mapping in code handling writes to
DESIGNWARE_PCIE_MSI_INTR0_ENABLE is missing an ! operator and should
be:

    !!root->msi.intr[0].enable ^ !!val;

so that MSI mapping is updated when enabled transitions from either
"none" -> "any" or "any" -> "none". Since that register shouldn't be
written to very often, change the code to update MSI mapping
unconditionally instead of trying to fix the update_msi_mapping logic.

Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 6ee51e96
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -297,16 +297,10 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
        root->msi.base |= (uint64_t)val << 32;
        break;

    case DESIGNWARE_PCIE_MSI_INTR0_ENABLE: {
        const bool update_msi_mapping = !root->msi.intr[0].enable ^ !!val;

    case DESIGNWARE_PCIE_MSI_INTR0_ENABLE:
        root->msi.intr[0].enable = val;

        if (update_msi_mapping) {
        designware_pcie_root_update_msi_mapping(root);
        }
        break;
    }

    case DESIGNWARE_PCIE_MSI_INTR0_MASK:
        root->msi.intr[0].mask = val;