Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 May 2016 06:10:21 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300573 - head/sys/dev/hyperv/vmbus
Message-ID:  <201605240610.u4O6ALXV054825@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Tue May 24 06:10:21 2016
New Revision: 300573
URL: https://svnweb.freebsd.org/changeset/base/300573

Log:
  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

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_connection.c	Tue May 24 06:01:39 2016	(r300572)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c	Tue May 24 06:10:21 2016	(r300573)
@@ -337,9 +337,9 @@ vmbus_event_proc(struct vmbus_softc *sc,
 	 * 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_sof
 {
 	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_vm
 	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;

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Tue May 24 06:01:39 2016	(r300572)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Tue May 24 06:10:21 2016	(r300573)
@@ -78,7 +78,7 @@ vmbus_msg_task(void *xsc, int pending __
 	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, str
 	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
 	/*
 	 * 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));
 	}
 
 	/*

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h	Tue May 24 06:01:39 2016	(r300572)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h	Tue May 24 06:10:21 2016	(r300573)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605240610.u4O6ALXV054825>