From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> This reverts commit 8b92e9cc04e71afb2be09f78af1de5492a0af4a4 which is commit c9be85dabb376299504e0d391d15662c0edf8273 upstream. It should not have been applied. Link: https://lore.kernel.org/r/CABgObfb5U9zwTQBPkPB=mKu-vMrRspPCm4wfxoQpB+SyAnb5WQ@xxxxxxxxxxxxxx Reported-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/powerpc/kvm/e500_mmu_host.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c @@ -242,7 +242,7 @@ static inline int tlbe_is_writable(struc return tlbe->mas7_3 & (MAS3_SW|MAS3_UW); } -static inline bool kvmppc_e500_ref_setup(struct tlbe_ref *ref, +static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref, struct kvm_book3e_206_tlb_entry *gtlbe, kvm_pfn_t pfn, unsigned int wimg) { @@ -252,7 +252,11 @@ static inline bool kvmppc_e500_ref_setup /* Use guest supplied MAS2_G and MAS2_E */ ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg; - return tlbe_is_writable(gtlbe); + /* Mark the page accessed */ + kvm_set_pfn_accessed(pfn); + + if (tlbe_is_writable(gtlbe)) + kvm_set_pfn_dirty(pfn); } static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref) @@ -333,7 +337,6 @@ static inline int kvmppc_e500_shadow_map unsigned int wimg = 0; pgd_t *pgdir; unsigned long flags; - bool writable = false; /* used to check for invalidations in progress */ mmu_seq = kvm->mmu_invalidate_seq; @@ -487,9 +490,7 @@ static inline int kvmppc_e500_shadow_map goto out; } } - writable = kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg); - if (writable) - kvm_set_pfn_dirty(pfn); + kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg); kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize, ref, gvaddr, stlbe); Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-6.1/ksmbd-fix-bug-on-trap-in-smb2_lock.patch queue-6.1/bluetooth-add-check-for-mgmt_alloc_skb-in-mgmt_device_connected.patch queue-6.1/hid-appleir-fix-potential-null-dereference-at-raw-event-handle.patch queue-6.1/mptcp-fix-scheduling-while-atomic-in-mptcp_pm_nl_append_new_local_addr.patch queue-6.1/drm-amd-display-fix-null-check-for-pipe_ctx-plane_state-in-resource_build_scaling_params.patch queue-6.1/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch queue-6.1/mei-me-add-panther-lake-p-did.patch queue-6.1/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch queue-6.1/dma-kmsan-export-kmsan_handle_dma-for-modules.patch queue-6.1/drm-radeon-fix-rs400_gpu_init-for-ati-mobility-radeon-xpress-200m.patch queue-6.1/revert-kvm-e500-always-restore-irqs.patch queue-6.1/mm-page_alloc-fix-uninitialized-variable.patch queue-6.1/x86-cpu-validate-cpuid-leaf-0x2-edx-output.patch queue-6.1/iio-adc-at91-sama5d2_adc-fix-sama7g5-realbits-value.patch queue-6.1/gpio-rcar-use-raw_spinlock-to-protect-register-access.patch queue-6.1/revert-of-reserved-memory-fix-using-wrong-number-of-cells-to-get-property-alignment.patch queue-6.1/eeprom-digsy_mtc-make-gpio-lookup-table-match-the-device.patch queue-6.1/rapidio-add-check-for-rio_add_net-in-rio_scan_alloc_net.patch queue-6.1/usb-dwc3-set-suspendenable-soon-after-phy-init.patch queue-6.1/alsa-hda-realtek-update-alc222-depop-optimize.patch queue-6.1/x86-cacheinfo-validate-cpuid-leaf-0x2-edx-output.patch queue-6.1/alsa-hda-realtek-fix-incorrect-is_reachable-usage.patch queue-6.1/block-fix-conversion-of-gpt-partition-name-to-7-bit.patch queue-6.1/drivers-virt-acrn-hsm-use-kzalloc-to-avoid-info-leak-in-pmcmd_ioctl.patch queue-6.1/usb-renesas_usbhs-use-devm_usb_get_phy.patch queue-6.1/iio-dac-ad3552r-clear-reset-status-flag.patch queue-6.1/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch queue-6.1/platform-x86-thinkpad_acpi-add-battery-quirk-for-thinkpad-x131e.patch queue-6.1/wifi-cfg80211-regulatory-improve-invalid-hints-checking.patch queue-6.1/kvm-svm-drop-debugctl-from-guest-s-effective-value.patch queue-6.1/usb-hub-lack-of-clearing-xhc-resources.patch queue-6.1/ksmbd-fix-type-confusion-via-race-condition-when-using-ipc_msg_send_request.patch queue-6.1/slimbus-messaging-free-transaction-id-in-delayed-interrupt-scenario.patch queue-6.1/intel_th-pci-add-panther-lake-p-u-support.patch queue-6.1/xhci-pci-fix-indentation-in-the-pci-device-id-definitions.patch queue-6.1/revert-kvm-ppc-e500-mark-struct-page-dirty-in-kvmppc_e500_shadow_map.patch queue-6.1/iio-filter-admv8818-force-initialization-of-sdo.patch queue-6.1/revert-kvm-ppc-e500-use-__kvm_faultin_pfn-to-handle-page-faults.patch queue-6.1/bus-mhi-host-pci_generic-use-pci_try_reset_function-to-avoid-deadlock.patch queue-6.1/intel_th-pci-add-arrow-lake-support.patch queue-6.1/drivers-core-fix-device-leak-in-__fw_devlink_relax_cycles.patch queue-6.1/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch queue-6.1/gpio-aggregator-protect-driver-attr-handlers-against-module-unload.patch queue-6.1/usb-renesas_usbhs-call-clk_put.patch queue-6.1/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch queue-6.1/revert-kvm-ppc-e500-mark-struct-page-pfn-accessed-before-dropping-mmu_lock.patch queue-6.1/x86-cpu-properly-parse-cpuid-leaf-0x2-tlb-descriptor-0x63.patch queue-6.1/wifi-nl80211-reject-cooked-mode-if-it-is-set-along-with-other-flags.patch queue-6.1/usb-xhci-enable-the-trb-overfetch-quirk-on-via-vl805.patch queue-6.1/intel_th-pci-add-panther-lake-h-support.patch queue-6.1/alsa-hda-intel-add-dell-alc3271-to-power_save-denylist.patch queue-6.1/alsa-hda-realtek-add-supported-mic-mute-led-for-lenovo-platform.patch queue-6.1/rapidio-fix-an-api-misues-when-rio_add_net-fails.patch queue-6.1/s390-traps-fix-test_monitor_call-inline-assembly.patch queue-6.1/loongarch-convert-unreachable-to-bug.patch queue-6.1/ksmbd-fix-use-after-free-in-smb2_lock.patch queue-6.1/x86-amd_nb-use-rdmsr_safe-in-amd_get_mmconfig_range.patch queue-6.1/bluetooth-add-check-for-mgmt_alloc_skb-in-mgmt_remote_name.patch queue-6.1/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch queue-6.1/mm-don-t-skip-arch_sync_kernel_mappings-in-error-paths.patch queue-6.1/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch queue-6.1/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch queue-6.1/usb-gadget-fix-setting-self-powered-state-on-suspend.patch queue-6.1/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch queue-6.1/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch