Commit 5bf74682 authored by Andrea Parri (Microsoft)'s avatar Andrea Parri (Microsoft) Committed by Wei Liu

Drivers: hv: vmbus: Remove the target_vp field from the vmbus_channel struct

The field is read only in __vmbus_open() and it is already stored twice
(after a call to hv_cpu_number_to_vp_number()) in target_cpu_store() and
init_vp_index(); there is no need to "cache" its value in the channel
data structure.
Suggested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Signed-off-by: default avatarAndrea Parri (Microsoft) <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/20200617164642.37393-2-parri.andrea@gmail.comReviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Signed-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent b3a9e3b9
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/mshyperv.h>
#include "hyperv_vmbus.h" #include "hyperv_vmbus.h"
...@@ -176,7 +177,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel, ...@@ -176,7 +177,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel,
open_msg->child_relid = newchannel->offermsg.child_relid; open_msg->child_relid = newchannel->offermsg.child_relid;
open_msg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle; open_msg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle;
open_msg->downstream_ringbuffer_pageoffset = newchannel->ringbuffer_send_offset; open_msg->downstream_ringbuffer_pageoffset = newchannel->ringbuffer_send_offset;
open_msg->target_vp = newchannel->target_vp; open_msg->target_vp = hv_cpu_number_to_vp_number(newchannel->target_cpu);
if (userdatalen) if (userdatalen)
memcpy(open_msg->userdata, userdata, userdatalen); memcpy(open_msg->userdata, userdata, userdatalen);
......
...@@ -704,8 +704,6 @@ static void init_vp_index(struct vmbus_channel *channel) ...@@ -704,8 +704,6 @@ static void init_vp_index(struct vmbus_channel *channel)
*/ */
channel->numa_node = cpu_to_node(VMBUS_CONNECT_CPU); channel->numa_node = cpu_to_node(VMBUS_CONNECT_CPU);
channel->target_cpu = VMBUS_CONNECT_CPU; channel->target_cpu = VMBUS_CONNECT_CPU;
channel->target_vp =
hv_cpu_number_to_vp_number(VMBUS_CONNECT_CPU);
if (perf_chn) if (perf_chn)
hv_set_alloced_cpu(VMBUS_CONNECT_CPU); hv_set_alloced_cpu(VMBUS_CONNECT_CPU);
return; return;
...@@ -739,7 +737,6 @@ static void init_vp_index(struct vmbus_channel *channel) ...@@ -739,7 +737,6 @@ static void init_vp_index(struct vmbus_channel *channel)
cpumask_set_cpu(target_cpu, alloced_mask); cpumask_set_cpu(target_cpu, alloced_mask);
channel->target_cpu = target_cpu; channel->target_cpu = target_cpu;
channel->target_vp = hv_cpu_number_to_vp_number(target_cpu);
free_cpumask_var(available_mask); free_cpumask_var(available_mask);
} }
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/sched/task_stack.h> #include <linux/sched/task_stack.h>
#include <asm/mshyperv.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
...@@ -1779,7 +1778,6 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel, ...@@ -1779,7 +1778,6 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel,
*/ */
channel->target_cpu = target_cpu; channel->target_cpu = target_cpu;
channel->target_vp = hv_cpu_number_to_vp_number(target_cpu);
channel->numa_node = cpu_to_node(target_cpu); channel->numa_node = cpu_to_node(target_cpu);
/* See init_vp_index(). */ /* See init_vp_index(). */
......
...@@ -803,15 +803,14 @@ struct vmbus_channel { ...@@ -803,15 +803,14 @@ struct vmbus_channel {
u64 sig_event; u64 sig_event;
/* /*
* Starting with win8, this field will be used to specify * Starting with win8, this field will be used to specify the
* the target virtual processor on which to deliver the interrupt for * target CPU on which to deliver the interrupt for the host
* the host to guest communication. * to guest communication.
* Prior to win8, incoming channel interrupts would only *
* be delivered on cpu 0. Setting this value to 0 would * Prior to win8, incoming channel interrupts would only be
* preserve the earlier behavior. * delivered on CPU 0. Setting this value to 0 would preserve
* the earlier behavior.
*/ */
u32 target_vp;
/* The corresponding CPUID in the guest */
u32 target_cpu; u32 target_cpu;
int numa_node; int numa_node;
/* /*
......
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