All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Thomas Hellström (VMware)" <thomas_os@shipmail.org>
Cc: linux-kernel@vger.kernel.org, pv-drivers@vmware.com,
	linux-graphics-maintainer@vmware.com,
	Thomas Hellstrom <thellstrom@vmware.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, dri-devel@lists.freedesktop.org,
	Doug Covelli <dcovelli@vmware.com>
Subject: Re: [PATCH v2 2/4] x86/vmware: Add a header file for hypercall definitions
Date: Tue, 27 Aug 2019 17:44:22 +0200	[thread overview]
Message-ID: <20190827154422.GG29752@zn.tnic> (raw)
In-Reply-To: <20190823081316.28478-3-thomas_os@shipmail.org>

On Fri, Aug 23, 2019 at 10:13:14AM +0200, Thomas Hellström (VMware) wrote:
> +/*
> + * The high bandwidth out call. The low word of edx is presumed to have the
> + * HB and OUT bits set.
> + */
> +#define VMWARE_HYPERCALL_HB_OUT						\
> +	ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep outsb", \

Hmm, that looks fishy:

This call in vmw_port_hb_out(), for example, gets converted to the asm
below (I've left in the asm touching only rDX).

# drivers/gpu/drm/vmwgfx/vmwgfx_msg.c:160:              VMW_PORT_HB_OUT(
#NO_APP
        movzwl  0(%rbp), %edx   # channel_20(D)->channel_id, channel_20(D)->channel_id

	...

        sall    $16, %edx       #, tmp172
        orl     $3, %edx        #, tmp173

this is adding channel_id and flags:

                        VMWARE_HYPERVISOR_HB | (channel->channel_id << 16) |
                        VMWARE_HYPERVISOR_OUT,

the $3 being (VMWARE_HYPERVISOR_HB | VMWARE_HYPERVISOR_OUT).

        movslq  %edx, %rdx      # tmp173, tmp174

Here it is sign-extending it.

#APP
# 160 "drivers/gpu/drm/vmwgfx/vmwgfx_msg.c" 1
        push %rbp;mov %r8, %rbp;# ALT: oldinstr2        # bp
661:
        movw $0x5659, %dx; rep outsb

And now here you're overwriting the low word of %edx. And now it
contains:

0x[channel_id]5659

and the low word doesn't contain the 3, i.e., (VMWARE_HYPERVISOR_HB |
VMWARE_HYPERVISOR_OUT) anymore. And that's before you do the hypercall
so I'm guessing that cannot be right.

Or?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

  parent reply	other threads:[~2019-08-27 15:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  8:13 [PATCH v2 0/4] Add support for updated vmware hypercall instruction Thomas Hellström (VMware)
2019-08-23  8:13 ` [PATCH v2 1/4] x86/vmware: Update platform detection code for VMCALL/VMMCALL hypercalls Thomas Hellström (VMware)
2019-08-27 12:56   ` Borislav Petkov
2019-08-27 19:19     ` Thomas Hellström (VMware)
2019-08-27 19:48       ` Borislav Petkov
2019-08-28  7:45     ` Thomas Hellström (VMware)
2019-08-28  8:45       ` Borislav Petkov
2019-08-23  8:13 ` [PATCH v2 2/4] x86/vmware: Add a header file for hypercall definitions Thomas Hellström (VMware)
2019-08-27 13:10   ` Borislav Petkov
2019-08-27 15:44   ` Borislav Petkov [this message]
2019-08-27 19:19     ` Thomas Hellström (VMware)
2019-08-27 19:54       ` Borislav Petkov
2019-08-23  8:13 ` [PATCH v2 3/4] drm/vmwgfx: Update the backdoor call with support for new instructions Thomas Hellström (VMware)
2019-08-23  8:13   ` Thomas Hellström (VMware)
2019-08-26 17:09   ` Ack to take patch through x86? Thomas Hellström (VMware)
2019-08-26 20:12   ` [PATCH v2 3/4] drm/vmwgfx: Update the backdoor call with support for new instructions Dave Airlie
2019-08-23  8:13 ` [PATCH v2 4/4] input/vmmouse: " Thomas Hellström (VMware)
2019-08-27  8:33 ` [PATCH v2 0/4] Add support for updated vmware hypercall instruction Thomas Hellström (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190827154422.GG29752@zn.tnic \
    --to=bp@alien8.de \
    --cc=dcovelli@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hpa@zytor.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pv-drivers@vmware.com \
    --cc=tglx@linutronix.de \
    --cc=thellstrom@vmware.com \
    --cc=thomas_os@shipmail.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.