Skip to content

Commit a10e997

Browse files
dcuihargar19
authored andcommitted
Drivers: hv: mshv_vtl: Fix TDX VTL0 boot
In the case of __xfer_to_guest_mode_work_pending() being false, we should test mshv_pull_proxy_irr(): if it returns true, the execution should not be witched to VTL0, and instead the ioctl should return to the openvmm user-space: see the comment before mshv_pull_proxy_irr(). Signed-off-by: Dexuan Cui <decui@microsoft.com>
1 parent 09c8209 commit a10e997

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

drivers/hv/mshv_vtl_main.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,31 +1870,21 @@ static int mshv_vtl_ioctl_return_to_lower_vtl(void)
18701870
reenter = reenter_mode(mode);
18711871

18721872
for (;;) {
1873-
const unsigned long VTL0_WORK= _TIF_SIGPENDING | _TIF_NEED_RESCHED |
1874-
_TIF_NOTIFY_RESUME | _TIF_NOTIFY_SIGNAL;
18751873
unsigned long irq_flags;
18761874
struct hv_vp_assist_page *hvp;
1877-
unsigned long ti_work;
1878-
u32 cancel;
18791875
int ret;
18801876

18811877
if (__xfer_to_guest_mode_work_pending()) {
1882-
local_irq_save(irq_flags);
1883-
ti_work = READ_ONCE(current_thread_info()->flags);
1884-
cancel = READ_ONCE(mshv_vtl_this_run()->cancel);
1885-
cancel |= mshv_pull_proxy_irr(mshv_vtl_this_run());
1886-
if (unlikely((ti_work & VTL0_WORK) || cancel)) {
1887-
local_irq_restore(irq_flags);
1888-
preempt_enable();
1889-
ret = xfer_to_guest_mode_handle_work();
1890-
if (ret)
1891-
return ret;
1892-
preempt_disable();
1893-
}
1878+
preempt_enable();
1879+
ret = xfer_to_guest_mode_handle_work();
1880+
if (ret)
1881+
return ret;
1882+
preempt_disable();
18941883
}
18951884

18961885
local_irq_save(irq_flags);
1897-
if (READ_ONCE(mshv_vtl_this_run()->cancel)) {
1886+
if (READ_ONCE(mshv_vtl_this_run()->cancel) ||
1887+
mshv_pull_proxy_irr(mshv_vtl_this_run())) {
18981888
local_irq_restore(irq_flags);
18991889
preempt_enable();
19001890
return -EINTR;

0 commit comments

Comments
 (0)