Skip to content

Commit 9fe424d

Browse files
committed
x86/hyperv: Dispatch redirected proxy interrupts
Once a redirected proxy interrupt has been configured, the IOMMU at the host will post it directly to a hardware vector in the VTL2 guest. Calculate the index of the proxy interrupt based on the hardware interrupt vector and indicate that it needs to be asserted. We only read the redirected data structures during interrupts. Protect access using the provided seqcount. This allows lockless access for readers. Signed-off-by: Ricardo Neri <[email protected]> --- Changes since v1: * Used a seqcount for serialization
1 parent f6d968b commit 9fe424d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,32 @@ static seqcount_raw_spinlock_t redirected_proxy_intr_seq =
181181

182182
DEFINE_IDTENTRY_IRQ(hv_vtl_redirected_interrupt)
183183
{
184+
unsigned int seq;
185+
u32 proxy_intr;
186+
187+
if (!hv_redirected_proxy_intr_handler) {
188+
pr_err_ratelimited("redirected intr handler not defined. hw intr %u not handled\n", vector);
189+
goto out;
190+
}
191+
192+
if (vector < FIRST_HV_VTL_REDIRECTED_VECTOR || vector > FIRST_SYSTEM_VECTOR) {
193+
pr_err_ratelimited("redirected hw vector %u is invalid\n", vector);
194+
goto out;
195+
}
196+
197+
do {
198+
seq = read_seqcount_begin(&redirected_proxy_intr_seq);
199+
proxy_intr = redirected_proxy_intr[vector - FIRST_HV_VTL_REDIRECTED_VECTOR];
200+
} while (read_seqcount_retry(&redirected_proxy_intr_seq, seq));
201+
202+
if (proxy_intr == REDIRECTED_VECTOR_UNDEF) {
203+
pr_err_ratelimited("hw vector %u not redictected to proxy interrupt\n", vector);
204+
goto out;
205+
}
206+
207+
hv_redirected_proxy_intr_handler(proxy_intr);
208+
209+
out:
184210
apic_eoi();
185211
}
186212
#endif

0 commit comments

Comments
 (0)