hyperv/vmbus: Git rid of sc version of pcpu data extraction macro
MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6503
This commit is contained in:
parent
0408d8b80a
commit
bcc9e3e995
@ -337,9 +337,9 @@ vmbus_event_proc(struct vmbus_softc *sc, int cpu)
|
||||
* On Host with Win8 or above, the event page can be checked directly
|
||||
* to get the id of the channel that has the pending interrupt.
|
||||
*/
|
||||
event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT;
|
||||
event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT;
|
||||
vmbus_event_flags_proc(event->flagsul,
|
||||
VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu));
|
||||
VMBUS_PCPU_GET(sc, event_flag_cnt, cpu));
|
||||
}
|
||||
|
||||
void
|
||||
@ -347,7 +347,7 @@ vmbus_event_proc_compat(struct vmbus_softc *sc __unused, int cpu)
|
||||
{
|
||||
hv_vmbus_synic_event_flags *event;
|
||||
|
||||
event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT;
|
||||
event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT;
|
||||
if (atomic_testandclear_int(&event->flags32[0], 0)) {
|
||||
vmbus_event_flags_proc(
|
||||
hv_vmbus_g_connection.recv_interrupt_page,
|
||||
@ -415,7 +415,8 @@ vmbus_on_channel_open(const struct hv_vmbus_channel *chan)
|
||||
int flag_cnt;
|
||||
|
||||
flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1;
|
||||
flag_cnt_ptr = VMBUS_PCPU_PTR(event_flag_cnt, chan->target_cpu);
|
||||
flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flag_cnt,
|
||||
chan->target_cpu);
|
||||
|
||||
for (;;) {
|
||||
int old_flag_cnt;
|
||||
|
@ -78,7 +78,7 @@ vmbus_msg_task(void *xsc, int pending __unused)
|
||||
struct vmbus_softc *sc = xsc;
|
||||
hv_vmbus_message *msg;
|
||||
|
||||
msg = VMBUS_SC_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT;
|
||||
msg = VMBUS_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT;
|
||||
for (;;) {
|
||||
const hv_vmbus_channel_msg_table_entry *entry;
|
||||
hv_vmbus_channel_msg_header *hdr;
|
||||
@ -141,7 +141,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu)
|
||||
sc->vmbus_event_proc(sc, cpu);
|
||||
|
||||
/* Check if there are actual msgs to be process */
|
||||
msg_base = VMBUS_SC_PCPU_GET(sc, message, cpu);
|
||||
msg_base = VMBUS_PCPU_GET(sc, message, cpu);
|
||||
msg = msg_base + HV_VMBUS_TIMER_SINT;
|
||||
|
||||
/* we call eventtimer process the message */
|
||||
@ -196,7 +196,7 @@ hv_vector_handler(struct trapframe *trap_frame)
|
||||
/*
|
||||
* Do a little interrupt counting.
|
||||
*/
|
||||
(*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++;
|
||||
(*VMBUS_PCPU_GET(sc, intr_cnt, cpu))++;
|
||||
|
||||
hv_vmbus_isr(sc, trap_frame, cpu);
|
||||
|
||||
@ -231,7 +231,7 @@ vmbus_synic_setup(void *arg __unused)
|
||||
simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP);
|
||||
simp.u.simp_enabled = 1;
|
||||
simp.u.base_simp_gpa =
|
||||
VMBUS_SC_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT;
|
||||
VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT;
|
||||
|
||||
wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t);
|
||||
|
||||
@ -241,7 +241,7 @@ vmbus_synic_setup(void *arg __unused)
|
||||
siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP);
|
||||
siefp.u.siefp_enabled = 1;
|
||||
siefp.u.base_siefp_gpa =
|
||||
VMBUS_SC_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT;
|
||||
VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT;
|
||||
|
||||
wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t);
|
||||
|
||||
@ -328,13 +328,13 @@ vmbus_dma_alloc(struct vmbus_softc *sc)
|
||||
/*
|
||||
* Per-cpu messages and event flags.
|
||||
*/
|
||||
VMBUS_SC_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc(
|
||||
VMBUS_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc(
|
||||
bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE,
|
||||
VMBUS_SC_PCPU_PTR(sc, message_dma, cpu),
|
||||
VMBUS_PCPU_PTR(sc, message_dma, cpu),
|
||||
BUS_DMA_WAITOK | BUS_DMA_ZERO);
|
||||
VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc(
|
||||
VMBUS_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc(
|
||||
bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE,
|
||||
VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu),
|
||||
VMBUS_PCPU_PTR(sc, event_flag_dma, cpu),
|
||||
BUS_DMA_WAITOK | BUS_DMA_ZERO);
|
||||
}
|
||||
}
|
||||
@ -345,17 +345,17 @@ vmbus_dma_free(struct vmbus_softc *sc)
|
||||
int cpu;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
if (VMBUS_SC_PCPU_GET(sc, message, cpu) != NULL) {
|
||||
if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) {
|
||||
hyperv_dmamem_free(
|
||||
VMBUS_SC_PCPU_PTR(sc, message_dma, cpu),
|
||||
VMBUS_SC_PCPU_GET(sc, message, cpu));
|
||||
VMBUS_SC_PCPU_GET(sc, message, cpu) = NULL;
|
||||
VMBUS_PCPU_PTR(sc, message_dma, cpu),
|
||||
VMBUS_PCPU_GET(sc, message, cpu));
|
||||
VMBUS_PCPU_GET(sc, message, cpu) = NULL;
|
||||
}
|
||||
if (VMBUS_SC_PCPU_GET(sc, event_flag, cpu) != NULL) {
|
||||
if (VMBUS_PCPU_GET(sc, event_flag, cpu) != NULL) {
|
||||
hyperv_dmamem_free(
|
||||
VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu),
|
||||
VMBUS_SC_PCPU_GET(sc, event_flag, cpu));
|
||||
VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = NULL;
|
||||
VMBUS_PCPU_PTR(sc, event_flag_dma, cpu),
|
||||
VMBUS_PCPU_GET(sc, event_flag, cpu));
|
||||
VMBUS_PCPU_GET(sc, event_flag, cpu) = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -548,7 +548,7 @@ vmbus_bus_init(void)
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu);
|
||||
intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu));
|
||||
intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -65,12 +65,8 @@ vmbus_get_device(void)
|
||||
return vmbus_sc->vmbus_dev;
|
||||
}
|
||||
|
||||
#define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field
|
||||
#define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field
|
||||
#define VMBUS_PCPU_GET(field, cpu) \
|
||||
VMBUS_SC_PCPU_GET(vmbus_get_softc(), field, (cpu))
|
||||
#define VMBUS_PCPU_PTR(field, cpu) \
|
||||
VMBUS_SC_PCPU_PTR(vmbus_get_softc(), field, (cpu))
|
||||
#define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field
|
||||
#define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field
|
||||
|
||||
void vmbus_on_channel_open(const struct hv_vmbus_channel *);
|
||||
void vmbus_event_proc(struct vmbus_softc *, int);
|
||||
|
Loading…
x
Reference in New Issue
Block a user