Skip to content

Commit 9d70ef7

Browse files
jinankjainliuw
authored andcommitted
mshv: adjust interrupt control structure for ARM64
Interrupt control structure (union hv_interupt_control) has different fields when it comes to x86 vs ARM64. Bring in the correct structure from HyperV header files and adjust the existing interrupt routing code accordingly. Signed-off-by: Jinank Jain <jinankjain@microsoft.com> Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent b5110ea commit 9d70ef7

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

drivers/hv/mshv_eventfd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ static int mshv_try_assert_irq_fast(struct mshv_irqfd *irqfd)
163163
if (hv_scheduler_type != HV_SCHEDULER_TYPE_ROOT)
164164
return -EOPNOTSUPP;
165165

166+
#if IS_ENABLED(CONFIG_X86)
166167
if (irq->lapic_control.logical_dest_mode)
167168
return -EOPNOTSUPP;
169+
#endif
168170

169171
vp = partition->pt_vp_array[irq->lapic_apic_id];
170172

@@ -196,8 +198,10 @@ static void mshv_assert_irq_slow(struct mshv_irqfd *irqfd)
196198
unsigned int seq;
197199
int idx;
198200

201+
#if IS_ENABLED(CONFIG_X86)
199202
WARN_ON(irqfd->irqfd_resampler &&
200203
!irq->lapic_control.level_triggered);
204+
#endif
201205

202206
idx = srcu_read_lock(&partition->pt_irq_srcu);
203207
if (irqfd->irqfd_girq_ent.guest_irq_num) {
@@ -469,6 +473,7 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
469473
init_poll_funcptr(&irqfd->irqfd_polltbl, mshv_irqfd_queue_proc);
470474

471475
spin_lock_irq(&pt->pt_irqfds_lock);
476+
#if IS_ENABLED(CONFIG_X86)
472477
if (args->flags & BIT(MSHV_IRQFD_BIT_RESAMPLE) &&
473478
!irqfd->irqfd_lapic_irq.lapic_control.level_triggered) {
474479
/*
@@ -479,6 +484,7 @@ static int mshv_irqfd_assign(struct mshv_partition *pt,
479484
ret = -EINVAL;
480485
goto fail;
481486
}
487+
#endif
482488
ret = 0;
483489
hlist_for_each_entry(tmp, &pt->pt_irqfds_list, irqfd_hnode) {
484490
if (irqfd->irqfd_eventfd_ctx != tmp->irqfd_eventfd_ctx)

drivers/hv/mshv_irq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ void mshv_copy_girq_info(struct mshv_guest_irq_ent *ent,
119119
lirq->lapic_vector = ent->girq_irq_data & 0xFF;
120120
lirq->lapic_apic_id = (ent->girq_addr_lo >> 12) & 0xFF;
121121
lirq->lapic_control.interrupt_type = (ent->girq_irq_data & 0x700) >> 8;
122+
#if IS_ENABLED(CONFIG_X86)
122123
lirq->lapic_control.level_triggered = (ent->girq_irq_data >> 15) & 0x1;
123124
lirq->lapic_control.logical_dest_mode = (ent->girq_addr_lo >> 2) & 0x1;
125+
#elif IS_ENABLED(CONFIG_ARM64)
126+
lirq->lapic_control.asserted = 1;
127+
#endif
124128
}

drivers/hv/mshv_root_hv_call.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,13 @@ int hv_call_assert_virtual_interrupt(u64 partition_id, u32 vector,
388388
memset(input, 0, sizeof(*input));
389389
input->partition_id = partition_id;
390390
input->vector = vector;
391+
/*
392+
* NOTE: dest_addr only needs to be provided while asserting an
393+
* interrupt on x86 platform
394+
*/
395+
#if IS_ENABLED(CONFIG_X86)
391396
input->dest_addr = dest_addr;
397+
#endif
392398
input->control = control;
393399
status = hv_do_hypercall(HVCALL_ASSERT_VIRTUAL_INTERRUPT, input, NULL);
394400
local_irq_restore(flags);

include/hyperv/hvhdk.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,15 @@ union hv_interrupt_control {
579579
u64 as_uint64;
580580
struct {
581581
u32 interrupt_type; /* enum hv_interrupt_type */
582+
#if IS_ENABLED(CONFIG_X86)
582583
u32 level_triggered : 1;
583584
u32 logical_dest_mode : 1;
584585
u32 rsvd : 30;
586+
#elif IS_ENABLED(CONFIG_ARM64)
587+
u32 rsvd1 : 2;
588+
u32 asserted : 1;
589+
u32 rsvd2 : 29;
590+
#endif
585591
} __packed;
586592
};
587593

0 commit comments

Comments
 (0)