// SPDX-License-Identifier: GPL-2.0-or-later1/*2* Hypervisor Maintenance Interrupt (HMI) handling.3*4* Copyright 2015 IBM Corporation5* Author: Mahesh Salgaonkar <[email protected]>6*/78#undef DEBUG910#include <linux/types.h>11#include <linux/compiler.h>12#include <asm/paca.h>13#include <asm/hmi.h>14#include <asm/processor.h>1516void wait_for_subcore_guest_exit(void)17{18int i;1920/*21* NULL bitmap pointer indicates that KVM module hasn't22* been loaded yet and hence no guests are running, or running23* on POWER9 or newer CPU.24*25* If no KVM is in use, no need to co-ordinate among threads26* as all of them will always be in host and no one is going27* to modify TB other than the opal hmi handler.28*29* POWER9 and newer don't need this synchronisation.30*31* Hence, just return from here.32*/33if (!local_paca->sibling_subcore_state)34return;3536for (i = 0; i < MAX_SUBCORE_PER_CORE; i++)37while (local_paca->sibling_subcore_state->in_guest[i])38cpu_relax();39}4041void wait_for_tb_resync(void)42{43if (!local_paca->sibling_subcore_state)44return;4546while (test_bit(CORE_TB_RESYNC_REQ_BIT,47&local_paca->sibling_subcore_state->flags))48cpu_relax();49}505152