fmb_timer is now started in 3 different places. The new function will encapsulate that to make sure mui is added in all cases.
Reviewed-by: Matthew Rosato <[email protected]> Signed-off-by: Konstantin Shkolnyy <[email protected]> --- hw/s390x/s390-pci-bus.c | 5 ++--- hw/s390x/s390-pci-inst.c | 14 ++++++++++---- include/hw/s390x/s390-pci-bus.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 655667482d..e568a8f4e4 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1745,9 +1745,8 @@ static int s390_pci_device_post_load(void *opaque, int version_id) assert(pbdev->pci_group); pbdev->fmb_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, fmb_update, pbdev); - timer_mod(pbdev->fmb_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + - pbdev->pci_group->zpci_group.mui); + s390_pci_schedule_fmb_timer(pbdev, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); } return 0; } diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 6b0742d143..89e4830dcd 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1122,9 +1122,16 @@ static int fmb_do_update(S390PCIBusDevice *pbdev, int offset, uint64_t val, return ret; } +void s390_pci_schedule_fmb_timer(S390PCIBusDevice *pbdev, uint64_t start) +{ + timer_mod(pbdev->fmb_timer, start + pbdev->pci_group->zpci_group.mui); +} + void fmb_update(void *opaque) { S390PCIBusDevice *pbdev = opaque; + + /* Must be read before updating U bit */ int64_t t = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); int i; @@ -1161,7 +1168,7 @@ void fmb_update(void *opaque) sizeof(pbdev->fmb.last_update))) { return; } - timer_mod(pbdev->fmb_timer, t + pbdev->pci_group->zpci_group.mui); + s390_pci_schedule_fmb_timer(pbdev, t); } static int mpcifc_reg_int_interp(S390PCIBusDevice *pbdev, ZpciFib *fib) @@ -1354,9 +1361,8 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar, timer_del(pbdev->fmb_timer); } pbdev->fmb_addr = fmb_addr; - timer_mod(pbdev->fmb_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + - pbdev->pci_group->zpci_group.mui); + s390_pci_schedule_fmb_timer(pbdev, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); break; } default: diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bus.h index 7386404ecc..95618f27de 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -422,5 +422,6 @@ S390PCIBusDevice *s390_pci_find_next_avail_dev(S390pciState *s, S390PCIBusDevice *pbdev); void s390_pci_ism_reset(void); void fmb_update(void *opaque); +void s390_pci_schedule_fmb_timer(S390PCIBusDevice *pbdev, uint64_t start); #endif -- 2.34.1
