Re: [PATCH 06/17] mshv: SynIC port and connection hypercalls

From: Wei Liu
Date: Tue Jun 29 2021 - 08:55:26 EST


On Thu, Jun 10, 2021 at 02:19:28PM +0200, Vitaly Kuznetsov wrote:
> Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx> writes:
>
> > Hyper-V enables inter-partition communication through the port and
> > connection constructs. More details about ports and connections in
> > TLFS chapter 11.
> >
> > Implement hypercalls related to ports and connections for enabling
> > inter-partiion communication.
> >
> > Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
> > ---
> > drivers/hv/hv_call.c | 161 +++++++++++++++++++++++++
> > drivers/hv/mshv.h | 12 ++
> > include/asm-generic/hyperv-tlfs.h | 55 +++++++++
> > include/linux/hyperv.h | 9 --
> > include/uapi/asm-generic/hyperv-tlfs.h | 76 ++++++++++++
> > 5 files changed, 304 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/hv/hv_call.c b/drivers/hv/hv_call.c
> > index 025d4e2b892f..57db3a8ac94a 100644
> > --- a/drivers/hv/hv_call.c
> > +++ b/drivers/hv/hv_call.c
> > @@ -742,3 +742,164 @@ int hv_call_translate_virtual_address(
> > return hv_status_to_errno(status);
> > }
> >
> > +
> > +int
> > +hv_call_create_port(u64 port_partition_id, union hv_port_id port_id,
> > + u64 connection_partition_id,
> > + struct hv_port_info *port_info,
> > + u8 port_vtl, u8 min_connection_vtl, int node)
> > +{
> > + struct hv_create_port *input;
> > + unsigned long flags;
> > + int ret = 0;
> > + int status;
> > +
> > + do {
> > + local_irq_save(flags);
> > + input = (struct hv_create_port *)(*this_cpu_ptr(
> > + hyperv_pcpu_input_arg));
> > + memset(input, 0, sizeof(*input));
> > +
> > + input->port_partition_id = port_partition_id;
> > + input->port_id = port_id;
> > + input->connection_partition_id = connection_partition_id;
> > + input->port_info = *port_info;
> > + input->port_vtl = port_vtl;
> > + input->min_connection_vtl = min_connection_vtl;
> > + input->proximity_domain_info =
> > + numa_node_to_proximity_domain_info(node);
> > + status = hv_do_hypercall(HVCALL_CREATE_PORT, input,
> > + NULL) & HV_HYPERCALL_RESULT_MASK;
> > + local_irq_restore(flags);
> > + if (status == HV_STATUS_SUCCESS)
> > + break;
> > +
> > + if (status != HV_STATUS_INSUFFICIENT_MEMORY) {
> > + pr_err("%s: %s\n",
> > + __func__, hv_status_to_string(status));
> > + ret = -hv_status_to_errno(status);
>
> In Nuno's "x86/hyperv: convert hyperv statuses to linux error codes"
> patch, hv_status_to_errno() already returns negatives:

Yes, this needs to be fixed otherwise one of the following patch has the
error handling check reversed.

Wei.