Commit b8dfb264 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by Greg Kroah-Hartman

staging: hv: Convert camel cased local variables in hv.c to lower cases

staging: hv: Convert camel cased local variables in hv.c to lower cases
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6a0aaa18
...@@ -65,7 +65,7 @@ static int HvQueryHypervisorInfo(void) ...@@ -65,7 +65,7 @@ static int HvQueryHypervisorInfo(void)
unsigned int ebx; unsigned int ebx;
unsigned int ecx; unsigned int ecx;
unsigned int edx; unsigned int edx;
unsigned int maxLeaf; unsigned int max_leaf;
unsigned int op; unsigned int op;
/* /*
...@@ -93,7 +93,7 @@ static int HvQueryHypervisorInfo(void) ...@@ -93,7 +93,7 @@ static int HvQueryHypervisorInfo(void)
((edx >> 16) & 0xFF), ((edx >> 16) & 0xFF),
((edx >> 24) & 0xFF)); ((edx >> 24) & 0xFF));
maxLeaf = eax; max_leaf = eax;
eax = 0; eax = 0;
ebx = 0; ebx = 0;
ecx = 0; ecx = 0;
...@@ -107,7 +107,7 @@ static int HvQueryHypervisorInfo(void) ...@@ -107,7 +107,7 @@ static int HvQueryHypervisorInfo(void)
((eax >> 16) & 0xFF), ((eax >> 16) & 0xFF),
((eax >> 24) & 0xFF)); ((eax >> 24) & 0xFF));
if (maxLeaf >= HVCPUID_VERSION) { if (max_leaf >= HVCPUID_VERSION) {
eax = 0; eax = 0;
ebx = 0; ebx = 0;
ecx = 0; ecx = 0;
...@@ -122,61 +122,61 @@ static int HvQueryHypervisorInfo(void) ...@@ -122,61 +122,61 @@ static int HvQueryHypervisorInfo(void)
edx >> 24, edx >> 24,
edx & 0xFFFFFF); edx & 0xFFFFFF);
} }
return maxLeaf; return max_leaf;
} }
/* /*
* HvDoHypercall - Invoke the specified hypercall * HvDoHypercall - Invoke the specified hypercall
*/ */
static u64 HvDoHypercall(u64 Control, void *Input, void *Output) static u64 HvDoHypercall(u64 control, void *input, void *output)
{ {
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
u64 hvStatus = 0; u64 hv_status = 0;
u64 inputAddress = (Input) ? virt_to_phys(Input) : 0; u64 input_address = (input) ? virt_to_phys(input) : 0;
u64 outputAddress = (Output) ? virt_to_phys(Output) : 0; u64 output_address = (output) ? virt_to_phys(output) : 0;
volatile void *hypercallPage = hv_context.hypercall_page; volatile void *hypercall_page = hv_context.hypercall_page;
DPRINT_DBG(VMBUS, "Hypercall <control %llx input phys %llx virt %p " DPRINT_DBG(VMBUS, "Hypercall <control %llx input phys %llx virt %p "
"output phys %llx virt %p hypercall %p>", "output phys %llx virt %p hypercall %p>",
Control, inputAddress, Input, control, input_address, input,
outputAddress, Output, hypercallPage); output_address, output, hypercall_page);
__asm__ __volatile__("mov %0, %%r8" : : "r" (outputAddress) : "r8"); __asm__ __volatile__("mov %0, %%r8" : : "r" (output_address) : "r8");
__asm__ __volatile__("call *%3" : "=a" (hvStatus) : __asm__ __volatile__("call *%3" : "=a" (hv_status) :
"c" (Control), "d" (inputAddress), "c" (control), "d" (input_address),
"m" (hypercallPage)); "m" (hypercall_page));
DPRINT_DBG(VMBUS, "Hypercall <return %llx>", hvStatus); DPRINT_DBG(VMBUS, "Hypercall <return %llx>", hv_status);
return hvStatus; return hv_status;
#else #else
u32 controlHi = Control >> 32; u32 control_hi = control >> 32;
u32 controlLo = Control & 0xFFFFFFFF; u32 control_lo = control & 0xFFFFFFFF;
u32 hvStatusHi = 1; u32 hv_status_hi = 1;
u32 hvStatusLo = 1; u32 hv_status_lo = 1;
u64 inputAddress = (Input) ? virt_to_phys(Input) : 0; u64 input_address = (input) ? virt_to_phys(input) : 0;
u32 inputAddressHi = inputAddress >> 32; u32 input_address_hi = input_address >> 32;
u32 inputAddressLo = inputAddress & 0xFFFFFFFF; u32 input_address_lo = input_address & 0xFFFFFFFF;
u64 outputAddress = (Output) ? virt_to_phys(Output) : 0; u64 output_address = (output) ? virt_to_phys(output) : 0;
u32 outputAddressHi = outputAddress >> 32; u32 output_address_hi = output_address >> 32;
u32 outputAddressLo = outputAddress & 0xFFFFFFFF; u32 output_address_lo = output_address & 0xFFFFFFFF;
volatile void *hypercallPage = hv_context.hypercall_page; volatile void *hypercall_page = hv_context.hypercall_page;
DPRINT_DBG(VMBUS, "Hypercall <control %llx input %p output %p>", DPRINT_DBG(VMBUS, "Hypercall <control %llx input %p output %p>",
Control, Input, Output); control, input, output);
__asm__ __volatile__ ("call *%8" : "=d"(hvStatusHi), __asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi),
"=a"(hvStatusLo) : "d" (controlHi), "=a"(hv_status_lo) : "d" (control_hi),
"a" (controlLo), "b" (inputAddressHi), "a" (control_lo), "b" (input_address_hi),
"c" (inputAddressLo), "D"(outputAddressHi), "c" (input_address_lo), "D"(output_address_hi),
"S"(outputAddressLo), "m" (hypercallPage)); "S"(output_address_lo), "m" (hypercall_page));
DPRINT_DBG(VMBUS, "Hypercall <return %llx>", DPRINT_DBG(VMBUS, "Hypercall <return %llx>",
hvStatusLo | ((u64)hvStatusHi << 32)); hv_status_lo | ((u64)hv_status_hi << 32));
return hvStatusLo | ((u64)hvStatusHi << 32); return hv_status_lo | ((u64)hv_status_hi << 32);
#endif /* !x86_64 */ #endif /* !x86_64 */
} }
...@@ -188,9 +188,9 @@ static u64 HvDoHypercall(u64 Control, void *Input, void *Output) ...@@ -188,9 +188,9 @@ static u64 HvDoHypercall(u64 Control, void *Input, void *Output)
int HvInit(void) int HvInit(void)
{ {
int ret = 0; int ret = 0;
int maxLeaf; int max_leaf;
union hv_x64_msr_hypercall_contents hypercallMsr; union hv_x64_msr_hypercall_contents hypercall_msr;
void *virtAddr = NULL; void *virtaddr = NULL;
memset(hv_context.synic_event_page, 0, sizeof(void *) * MAX_NUM_CPUS); memset(hv_context.synic_event_page, 0, sizeof(void *) * MAX_NUM_CPUS);
memset(hv_context.synic_message_page, 0, memset(hv_context.synic_message_page, 0,
...@@ -204,7 +204,7 @@ int HvInit(void) ...@@ -204,7 +204,7 @@ int HvInit(void)
DPRINT_INFO(VMBUS, DPRINT_INFO(VMBUS,
"Windows hypervisor detected! Retrieving more info..."); "Windows hypervisor detected! Retrieving more info...");
maxLeaf = HvQueryHypervisorInfo(); max_leaf = HvQueryHypervisorInfo();
/* HvQueryHypervisorFeatures(maxLeaf); */ /* HvQueryHypervisorFeatures(maxLeaf); */
/* /*
...@@ -223,39 +223,39 @@ int HvInit(void) ...@@ -223,39 +223,39 @@ int HvInit(void)
hv_context.guestid = HV_LINUX_GUEST_ID; hv_context.guestid = HV_LINUX_GUEST_ID;
/* See if the hypercall page is already set */ /* See if the hypercall page is already set */
rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
/* /*
* Allocate the hypercall page memory * Allocate the hypercall page memory
* virtAddr = osd_PageAlloc(1); * virtaddr = osd_PageAlloc(1);
*/ */
virtAddr = osd_VirtualAllocExec(PAGE_SIZE); virtaddr = osd_VirtualAllocExec(PAGE_SIZE);
if (!virtAddr) { if (!virtaddr) {
DPRINT_ERR(VMBUS, DPRINT_ERR(VMBUS,
"unable to allocate hypercall page!!"); "unable to allocate hypercall page!!");
goto Cleanup; goto Cleanup;
} }
hypercallMsr.enable = 1; hypercall_msr.enable = 1;
hypercallMsr.guest_physical_address = vmalloc_to_pfn(virtAddr); hypercall_msr.guest_physical_address = vmalloc_to_pfn(virtaddr);
wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
/* Confirm that hypercall page did get setup. */ /* Confirm that hypercall page did get setup. */
hypercallMsr.as_uint64 = 0; hypercall_msr.as_uint64 = 0;
rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
if (!hypercallMsr.enable) { if (!hypercall_msr.enable) {
DPRINT_ERR(VMBUS, "unable to set hypercall page!!"); DPRINT_ERR(VMBUS, "unable to set hypercall page!!");
goto Cleanup; goto Cleanup;
} }
hv_context.hypercall_page = virtAddr; hv_context.hypercall_page = virtaddr;
DPRINT_INFO(VMBUS, "Hypercall page VA=%p, PA=0x%0llx", DPRINT_INFO(VMBUS, "Hypercall page VA=%p, PA=0x%0llx",
hv_context.hypercall_page, hv_context.hypercall_page,
(u64)hypercallMsr.guest_physical_address << PAGE_SHIFT); (u64)hypercall_msr.guest_physical_address << PAGE_SHIFT);
/* Setup the global signal event param for the signal event hypercall */ /* Setup the global signal event param for the signal event hypercall */
hv_context.signal_event_buffer = hv_context.signal_event_buffer =
...@@ -278,13 +278,13 @@ int HvInit(void) ...@@ -278,13 +278,13 @@ int HvInit(void)
return ret; return ret;
Cleanup: Cleanup:
if (virtAddr) { if (virtaddr) {
if (hypercallMsr.enable) { if (hypercall_msr.enable) {
hypercallMsr.as_uint64 = 0; hypercall_msr.as_uint64 = 0;
wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
} }
vfree(virtAddr); vfree(virtaddr);
} }
ret = -1; ret = -1;
return ret; return ret;
...@@ -297,15 +297,15 @@ int HvInit(void) ...@@ -297,15 +297,15 @@ int HvInit(void)
*/ */
void HvCleanup(void) void HvCleanup(void)
{ {
union hv_x64_msr_hypercall_contents hypercallMsr; union hv_x64_msr_hypercall_contents hypercall_msr;
kfree(hv_context.signal_event_buffer); kfree(hv_context.signal_event_buffer);
hv_context.signal_event_buffer = NULL; hv_context.signal_event_buffer = NULL;
hv_context.signal_event_param = NULL; hv_context.signal_event_param = NULL;
if (hv_context.hypercall_page) { if (hv_context.hypercall_page) {
hypercallMsr.as_uint64 = 0; hypercall_msr.as_uint64 = 0;
wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
vfree(hv_context.hypercall_page); vfree(hv_context.hypercall_page);
hv_context.hypercall_page = NULL; hv_context.hypercall_page = NULL;
} }
...@@ -316,35 +316,35 @@ void HvCleanup(void) ...@@ -316,35 +316,35 @@ void HvCleanup(void)
* *
* This involves a hypercall. * This involves a hypercall.
*/ */
u16 HvPostMessage(union hv_connection_id connectionId, u16 HvPostMessage(union hv_connection_id connection_id,
enum hv_message_type messageType, enum hv_message_type message_type,
void *payload, size_t payloadSize) void *payload, size_t payload_size)
{ {
struct alignedInput { struct aligned_input {
u64 alignment8; u64 alignment8;
struct hv_input_post_message msg; struct hv_input_post_message msg;
}; };
struct hv_input_post_message *alignedMsg; struct hv_input_post_message *aligned_msg;
u16 status; u16 status;
unsigned long addr; unsigned long addr;
if (payloadSize > HV_MESSAGE_PAYLOAD_BYTE_COUNT) if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
return -1; return -1;
addr = (unsigned long)kmalloc(sizeof(struct alignedInput), GFP_ATOMIC); addr = (unsigned long)kmalloc(sizeof(struct aligned_input), GFP_ATOMIC);
if (!addr) if (!addr)
return -1; return -1;
alignedMsg = (struct hv_input_post_message *) aligned_msg = (struct hv_input_post_message *)
(ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); (ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN));
alignedMsg->connectionid = connectionId; aligned_msg->connectionid = connection_id;
alignedMsg->message_type = messageType; aligned_msg->message_type = message_type;
alignedMsg->payload_size = payloadSize; aligned_msg->payload_size = payload_size;
memcpy((void *)alignedMsg->payload, payload, payloadSize); memcpy((void *)aligned_msg->payload, payload, payload_size);
status = HvDoHypercall(HVCALL_POST_MESSAGE, alignedMsg, NULL) & 0xFFFF; status = HvDoHypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) & 0xFFFF;
kfree((void *)addr); kfree((void *)addr);
...@@ -379,10 +379,10 @@ void HvSynicInit(void *irqarg) ...@@ -379,10 +379,10 @@ void HvSynicInit(void *irqarg)
u64 version; u64 version;
union hv_synic_simp simp; union hv_synic_simp simp;
union hv_synic_siefp siefp; union hv_synic_siefp siefp;
union hv_synic_sint sharedSint; union hv_synic_sint shared_sint;
union hv_synic_scontrol sctrl; union hv_synic_scontrol sctrl;
u32 irqVector = *((u32 *)(irqarg)); u32 irq_vector = *((u32 *)(irqarg));
int cpu = smp_processor_id(); int cpu = smp_processor_id();
if (!hv_context.hypercall_page) if (!hv_context.hypercall_page)
...@@ -436,17 +436,17 @@ void HvSynicInit(void *irqarg) ...@@ -436,17 +436,17 @@ void HvSynicInit(void *irqarg)
/* interceptionSint.as_uint64); */ /* interceptionSint.as_uint64); */
/* Setup the shared SINT. */ /* Setup the shared SINT. */
rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
sharedSint.as_uint64 = 0; shared_sint.as_uint64 = 0;
sharedSint.vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ shared_sint.vector = irq_vector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */
sharedSint.masked = false; shared_sint.masked = false;
sharedSint.auto_eoi = true; shared_sint.auto_eoi = true;
DPRINT_DBG(VMBUS, "HV_X64_MSR_SINT1 msr set to: %llx", DPRINT_DBG(VMBUS, "HV_X64_MSR_SINT1 msr set to: %llx",
sharedSint.as_uint64); shared_sint.as_uint64);
wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
/* Enable the global synic bit */ /* Enable the global synic bit */
rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
...@@ -471,7 +471,7 @@ void HvSynicInit(void *irqarg) ...@@ -471,7 +471,7 @@ void HvSynicInit(void *irqarg)
*/ */
void HvSynicCleanup(void *arg) void HvSynicCleanup(void *arg)
{ {
union hv_synic_sint sharedSint; union hv_synic_sint shared_sint;
union hv_synic_simp simp; union hv_synic_simp simp;
union hv_synic_siefp siefp; union hv_synic_siefp siefp;
int cpu = smp_processor_id(); int cpu = smp_processor_id();
...@@ -479,13 +479,13 @@ void HvSynicCleanup(void *arg) ...@@ -479,13 +479,13 @@ void HvSynicCleanup(void *arg)
if (!hv_context.synic_initialized) if (!hv_context.synic_initialized)
return; return;
rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
sharedSint.masked = 1; shared_sint.masked = 1;
/* Need to correctly cleanup in the case of SMP!!! */ /* Need to correctly cleanup in the case of SMP!!! */
/* Disable the interrupt */ /* Disable the interrupt */
wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64);
simp.simp_enabled = 0; simp.simp_enabled = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment