[PATCH] main-loop: Avoid some unnecessary poll calls

2024-02-12 Thread Ross Lagerwall via
A common pattern is seen where a timer fires, the callback does some work, then rearms the timer which implicitly calls qemu_notify_event(). qemu_notify_event() is supposed to interrupt the main loop's poll() by calling qemu_bh_schedule(). In the case that this is being called from a main loop cal

[PATCH] xen/pt: Emulate multifunction bit in header type

2023-11-03 Thread Ross Lagerwall via
The intention of the code appears to have been to unconditionally set the multifunction bit but since the emulation mask is 0x00 it has no effect. Instead, emulate the bit and set it based on the multifunction property of the PCIDevice (which can be set using QAPI). This allows making passthrough

[PATCH] ps2: Don't send key release event for Lang1, Lang2 keys

2023-02-27 Thread Ross Lagerwall via
The scancodes for the Lang1 and Lang2 keys (i.e. Hangeul, Hanja) are special since they already have the 0x80 bit set which is commonly used to indicate a key release in AT set 1. Reportedly, real hardware does not send a key release scancode. So, skip sending a release for these keys. This ensures

[PATCH] tpm_crb: Avoid backend startup just before shutdown under Xen

2022-08-26 Thread Ross Lagerwall via
When running under Xen and the guest reboots, it boots into a new domain with a new QEMU process (and a new swtpm process if using the emulator backend). The existing reset function is triggered just before the old QEMU process exists which causes QEMU to startup the TPM backend and then immediatel

[PATCH] tpm_emulator: Avoid double initialization during migration

2022-08-01 Thread Ross Lagerwall via
When resuming after a migration, the backend sends CMD_INIT to the emulator from the startup callback, then it sends the migration state from the vmstate to the emulator, then it sends CMD_INIT again. Skip the first CMD_INIT during a migration to avoid initializing the TPM twice. Signed-off-by: Ro

[PATCH] xen/pt: Avoid initializing BARs from the host ones

2022-04-27 Thread Ross Lagerwall via
The BAR emulated register definition does not set emu_mask because it varies depending on bar_flag. If emu_mask is not set, then the BAR is initialized based on the host value which causes the BAR to be initially mapped at whatever value the host device was using. Although it does eventually get m

[PATCH v2] xen-mapcache: Avoid entry->lock overflow

2022-01-24 Thread Ross Lagerwall via
In some cases, a particular mapcache entry may be mapped 256 times causing the lock field to wrap to 0. For example, this may happen when using emulated NVME and the guest submits a large scatter-gather write. At this point, the entry map be remapped causing QEMU to write the wrong data or crash (s

[PATCH] xen-mapcache: Avoid entry->lock overflow

2022-01-21 Thread Ross Lagerwall via
In some cases, a particular mapcache entry may be mapped 256 times causing the lock field to wrap to 0. For example, this may happen when using emulated NVME and the guest submits a large scatter-gather write. At this point, the entry map be remapped causing QEMU to write the wrong data or crash (s