static void pci_msix_write(void *opaque, hwaddr addr,

                           uint64_t val, unsigned size)

{

    XenPCIPassthroughState *s = opaque;

    XenPTMSIX *msix = s->msix;

    XenPTMSIXEntry *entry;

    int entry_nr, offset;



    entry_nr = addr / PCI_MSIX_ENTRY_SIZE;

    if (entry_nr < 0 || entry_nr >= msix->total_entries) {

        XEN_PT_ERR(&s->dev, "asked MSI-X entry '%i' invalid!\n", entry_nr);

        return;

    }

    entry = &msix->msix_entry[entry_nr];

    offset = addr % PCI_MSIX_ENTRY_SIZE;



    if (offset != PCI_MSIX_ENTRY_VECTOR_CTRL) {

        const volatile uint32_t *vec_ctrl;



        if (get_entry_value(entry, offset) == val

            && entry->pirq != XEN_PT_UNASSIGNED_PIRQ) {

            return;

        }



        /*

         * If Xen intercepts the mask bit access, entry->vec_ctrl may not be

         * up-to-date. Read from hardware directly.

         */

        vec_ctrl = s->msix->phys_iomem_base + entry_nr * PCI_MSIX_ENTRY_SIZE

            + PCI_MSIX_ENTRY_VECTOR_CTRL;



        if (msix->enabled && !(*vec_ctrl & PCI_MSIX_ENTRY_CTRL_MASKBIT)) {

            XEN_PT_ERR(&s->dev, "Can't update msix entry %d since MSI-X is"

                       " already enabled.\n", entry_nr);

            return;

        }



        entry->updated = true;

    }



    set_entry_value(entry, offset, val);



    if (offset == PCI_MSIX_ENTRY_VECTOR_CTRL) {

        if (msix->enabled && !(val & PCI_MSIX_ENTRY_CTRL_MASKBIT)) {

            xen_pt_msix_update_one(s, entry_nr);

        }

    }

}

static void pci_msix_write(void *opaque, hwaddr addr,

                           uint64_t val, unsigned size)

{

    XenPCIPassthroughState *s = opaque;

    XenPTMSIX *msix = s->msix;

    XenPTMSIXEntry *entry;

    int entry_nr, offset;



    entry_nr = addr / PCI_MSIX_ENTRY_SIZE;

    if (entry_nr < 0 || entry_nr >= msix->total_entries) {

        XEN_PT_ERR(&s->dev, "asked MSI-X entry '%i' invalid!\n", entry_nr);

        return;

    }

    entry = &msix->msix_entry[entry_nr];

    offset = addr % PCI_MSIX_ENTRY_SIZE;



    if (offset != PCI_MSIX_ENTRY_VECTOR_CTRL) {

        const volatile uint32_t *vec_ctrl;



        if (get_entry_value(entry, offset) == val

            && entry->pirq != XEN_PT_UNASSIGNED_PIRQ) {

            return;

        }



        







        vec_ctrl = s->msix->phys_iomem_base + entry_nr * PCI_MSIX_ENTRY_SIZE

            + PCI_MSIX_ENTRY_VECTOR_CTRL;



        if (msix->enabled && !(*vec_ctrl & PCI_MSIX_ENTRY_CTRL_MASKBIT)) {

            XEN_PT_ERR(&s->dev, "Can't update msix entry %d since MSI-X is"

                       " already enabled.\n", entry_nr);

            return;

        }



        entry->updated = true;

    }



    set_entry_value(entry, offset, val);



    if (offset == PCI_MSIX_ENTRY_VECTOR_CTRL) {

        if (msix->enabled && !(val & PCI_MSIX_ENTRY_CTRL_MASKBIT)) {

            xen_pt_msix_update_one(s, entry_nr);

        }

    }

}

    int entry_nr, offset;     if (entry_nr < 0 || entry_nr >= msix->total_entries) {         XEN_PT_ERR(&s->dev, "asked MSI-X entry '%i' invalid!\n", entry_nr);             XEN_PT_ERR(&s->dev, "Can't update msix entry %d since MSI-X is"                        " already enabled.\n", entry_nr);
static void FUNC_0(void *VAR_0, hwaddr VAR_1,

                           uint64_t VAR_2, unsigned VAR_3)

{

    XenPCIPassthroughState *s = VAR_0;

    XenPTMSIX *msix = s->msix;

    XenPTMSIXEntry *entry;

    int VAR_4, VAR_5;



    VAR_4 = VAR_1 / PCI_MSIX_ENTRY_SIZE;

    if (VAR_4 < 0 || VAR_4 >= msix->total_entries) {

        XEN_PT_ERR(&s->dev, "asked MSI-X entry '%i' invalid!\n", VAR_4);

        return;

    }

    entry = &msix->msix_entry[VAR_4];

    VAR_5 = VAR_1 % PCI_MSIX_ENTRY_SIZE;



    if (VAR_5 != PCI_MSIX_ENTRY_VECTOR_CTRL) {

        const volatile uint32_t *VAR_6;



        if (get_entry_value(entry, VAR_5) == VAR_2

            && entry->pirq != XEN_PT_UNASSIGNED_PIRQ) {

            return;

        }



        







        VAR_6 = s->msix->phys_iomem_base + VAR_4 * PCI_MSIX_ENTRY_SIZE

            + PCI_MSIX_ENTRY_VECTOR_CTRL;



        if (msix->enabled && !(*VAR_6 & PCI_MSIX_ENTRY_CTRL_MASKBIT)) {

            XEN_PT_ERR(&s->dev, "Can't update msix entry %d since MSI-X is"

                       " already enabled.\n", VAR_4);

            return;

        }



        entry->updated = true;

    }



    set_entry_value(entry, VAR_5, VAR_2);



    if (VAR_5 == PCI_MSIX_ENTRY_VECTOR_CTRL) {

        if (msix->enabled && !(VAR_2 & PCI_MSIX_ENTRY_CTRL_MASKBIT)) {

            xen_pt_msix_update_one(s, VAR_4);

        }

    }

}

static void FUNC_0(void *VAR_0, hwaddr VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{ XenPCIPassthroughState *s = VAR_0; XenPTMSIX *msix = s->msix; XenPTMSIXEntry *entry; int VAR_4, VAR_5; VAR_4 = VAR_1 / PCI_MSIX_ENTRY_SIZE; if (VAR_4 < 0 || VAR_4 >= msix->total_entries) { XEN_PT_ERR(&s->dev, "asked MSI-X entry '%i' invalid!\n", VAR_4); return; } entry = &msix->msix_entry[VAR_4]; VAR_5 = VAR_1 % PCI_MSIX_ENTRY_SIZE; if (VAR_5 != PCI_MSIX_ENTRY_VECTOR_CTRL) { const volatile uint32_t *VAR_6; if (get_entry_value(entry, VAR_5) == VAR_2
&& entry->pirq != XEN_PT_UNASSIGNED_PIRQ) { return; } VAR_6 = s->msix->phys_iomem_base + VAR_4 * PCI_MSIX_ENTRY_SIZE
+ PCI_MSIX_ENTRY_VECTOR_CTRL; if (msix->enabled && !(*VAR_6 & PCI_MSIX_ENTRY_CTRL_MASKBIT)) { XEN_PT_ERR(&s->dev, "Can't update msix entry %d since MSI-X is"
" already enabled.\n", VAR_4); return; } entry->updated = true; } set_entry_value(entry, VAR_5, VAR_2); if (VAR_5 == PCI_MSIX_ENTRY_VECTOR_CTRL) { if (msix->enabled && !(VAR_2 & PCI_MSIX_ENTRY_CTRL_MASKBIT)) { xen_pt_msix_update_one(s, VAR_4); } } }