From: Dave Airlie <airlied@gmail.com>
To: "Thomas Hellström (VMware)" <thomas_os@shipmail.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas Hellstrom <thellstrom@vmware.com>,
pv-drivers@vmware.com,
"the arch/x86 maintainers" <x86@kernel.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
Doug Covelli <dcovelli@vmware.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Linux-graphics-maintainer <linux-graphics-maintainer@vmware.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2 3/4] drm/vmwgfx: Update the backdoor call with support for new instructions
Date: Tue, 27 Aug 2019 06:12:23 +1000 [thread overview]
Message-ID: <CAPM=9txEHSv8M4Q7A38JQpUoQJjess5vvwkXbJmk=0XgNhEJ9g@mail.gmail.com> (raw)
In-Reply-To: <20190823081316.28478-4-thomas_os@shipmail.org>
Acked-by: Dave Airlie <airlied@redhat.com>
(for merging via x86 trees).
Dave.
On Fri, 23 Aug 2019 at 18:13, Thomas Hellström (VMware)
<thomas_os@shipmail.org> wrote:
>
> From: Thomas Hellstrom <thellstrom@vmware.com>
>
> Use the definition provided by include/asm/vmware.h
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: <x86@kernel.org>
> Cc: <dri-devel@lists.freedesktop.org>
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Reviewed-by: Doug Covelli <dcovelli@vmware.com>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 21 +++++++++--------
> drivers/gpu/drm/vmwgfx/vmwgfx_msg.h | 35 +++++++++++++++--------------
> 2 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> index 81a86c3b77bc..1281e52898ee 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> @@ -45,8 +45,6 @@
> #define RETRIES 3
>
> #define VMW_HYPERVISOR_MAGIC 0x564D5868
> -#define VMW_HYPERVISOR_PORT 0x5658
> -#define VMW_HYPERVISOR_HB_PORT 0x5659
>
> #define VMW_PORT_CMD_MSG 30
> #define VMW_PORT_CMD_HB_MSG 0
> @@ -92,7 +90,7 @@ static int vmw_open_channel(struct rpc_channel *channel, unsigned int protocol)
>
> VMW_PORT(VMW_PORT_CMD_OPEN_CHANNEL,
> (protocol | GUESTMSG_FLAG_COOKIE), si, di,
> - VMW_HYPERVISOR_PORT,
> + 0,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
>
> @@ -125,7 +123,7 @@ static int vmw_close_channel(struct rpc_channel *channel)
>
> VMW_PORT(VMW_PORT_CMD_CLOSE_CHANNEL,
> 0, si, di,
> - (VMW_HYPERVISOR_PORT | (channel->channel_id << 16)),
> + channel->channel_id << 16,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
>
> @@ -159,7 +157,8 @@ static unsigned long vmw_port_hb_out(struct rpc_channel *channel,
> VMW_PORT_HB_OUT(
> (MESSAGE_STATUS_SUCCESS << 16) | VMW_PORT_CMD_HB_MSG,
> msg_len, si, di,
> - VMW_HYPERVISOR_HB_PORT | (channel->channel_id << 16),
> + VMWARE_HYPERVISOR_HB | (channel->channel_id << 16) |
> + VMWARE_HYPERVISOR_OUT,
> VMW_HYPERVISOR_MAGIC, bp,
> eax, ebx, ecx, edx, si, di);
>
> @@ -180,7 +179,7 @@ static unsigned long vmw_port_hb_out(struct rpc_channel *channel,
>
> VMW_PORT(VMW_PORT_CMD_MSG | (MSG_TYPE_SENDPAYLOAD << 16),
> word, si, di,
> - VMW_HYPERVISOR_PORT | (channel->channel_id << 16),
> + channel->channel_id << 16,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
> }
> @@ -212,7 +211,7 @@ static unsigned long vmw_port_hb_in(struct rpc_channel *channel, char *reply,
> VMW_PORT_HB_IN(
> (MESSAGE_STATUS_SUCCESS << 16) | VMW_PORT_CMD_HB_MSG,
> reply_len, si, di,
> - VMW_HYPERVISOR_HB_PORT | (channel->channel_id << 16),
> + VMWARE_HYPERVISOR_HB | (channel->channel_id << 16),
> VMW_HYPERVISOR_MAGIC, bp,
> eax, ebx, ecx, edx, si, di);
>
> @@ -229,7 +228,7 @@ static unsigned long vmw_port_hb_in(struct rpc_channel *channel, char *reply,
>
> VMW_PORT(VMW_PORT_CMD_MSG | (MSG_TYPE_RECVPAYLOAD << 16),
> MESSAGE_STATUS_SUCCESS, si, di,
> - VMW_HYPERVISOR_PORT | (channel->channel_id << 16),
> + channel->channel_id << 16,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
>
> @@ -268,7 +267,7 @@ static int vmw_send_msg(struct rpc_channel *channel, const char *msg)
>
> VMW_PORT(VMW_PORT_CMD_SENDSIZE,
> msg_len, si, di,
> - VMW_HYPERVISOR_PORT | (channel->channel_id << 16),
> + channel->channel_id << 16,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
>
> @@ -326,7 +325,7 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
>
> VMW_PORT(VMW_PORT_CMD_RECVSIZE,
> 0, si, di,
> - (VMW_HYPERVISOR_PORT | (channel->channel_id << 16)),
> + channel->channel_id << 16,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
>
> @@ -370,7 +369,7 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
>
> VMW_PORT(VMW_PORT_CMD_RECVSTATUS,
> MESSAGE_STATUS_SUCCESS, si, di,
> - (VMW_HYPERVISOR_PORT | (channel->channel_id << 16)),
> + channel->channel_id << 16,
> VMW_HYPERVISOR_MAGIC,
> eax, ebx, ecx, edx, si, di);
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h
> index 4907e50fb20a..f685c7071dec 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h
> @@ -32,6 +32,7 @@
> #ifndef _VMWGFX_MSG_H
> #define _VMWGFX_MSG_H
>
> +#include <asm/vmware.h>
>
> /**
> * Hypervisor-specific bi-directional communication channel. Should never
> @@ -44,7 +45,7 @@
> * @in_ebx: [IN] Message Len, through EBX
> * @in_si: [IN] Input argument through SI, set to 0 if not used
> * @in_di: [IN] Input argument through DI, set ot 0 if not used
> - * @port_num: [IN] port number + [channel id]
> + * @flags: [IN] hypercall flags + [channel id]
> * @magic: [IN] hypervisor magic value
> * @eax: [OUT] value of EAX register
> * @ebx: [OUT] e.g. status from an HB message status command
> @@ -54,10 +55,10 @@
> * @di: [OUT]
> */
> #define VMW_PORT(cmd, in_ebx, in_si, in_di, \
> - port_num, magic, \
> + flags, magic, \
> eax, ebx, ecx, edx, si, di) \
> ({ \
> - asm volatile ("inl %%dx, %%eax;" : \
> + asm volatile (VMWARE_HYPERCALL : \
> "=a"(eax), \
> "=b"(ebx), \
> "=c"(ecx), \
> @@ -67,7 +68,7 @@
> "a"(magic), \
> "b"(in_ebx), \
> "c"(cmd), \
> - "d"(port_num), \
> + "d"(flags), \
> "S"(in_si), \
> "D"(in_di) : \
> "memory"); \
> @@ -85,7 +86,7 @@
> * @in_ecx: [IN] Message Len, through ECX
> * @in_si: [IN] Input argument through SI, set to 0 if not used
> * @in_di: [IN] Input argument through DI, set to 0 if not used
> - * @port_num: [IN] port number + [channel id]
> + * @flags: [IN] hypercall flags + [channel id]
> * @magic: [IN] hypervisor magic value
> * @bp: [IN]
> * @eax: [OUT] value of EAX register
> @@ -98,12 +99,12 @@
> #ifdef __x86_64__
>
> #define VMW_PORT_HB_OUT(cmd, in_ecx, in_si, in_di, \
> - port_num, magic, bp, \
> + flags, magic, bp, \
> eax, ebx, ecx, edx, si, di) \
> ({ \
> asm volatile ("push %%rbp;" \
> "mov %12, %%rbp;" \
> - "rep outsb;" \
> + VMWARE_HYPERCALL_HB_OUT \
> "pop %%rbp;" : \
> "=a"(eax), \
> "=b"(ebx), \
> @@ -114,7 +115,7 @@
> "a"(magic), \
> "b"(cmd), \
> "c"(in_ecx), \
> - "d"(port_num), \
> + "d"(flags), \
> "S"(in_si), \
> "D"(in_di), \
> "r"(bp) : \
> @@ -123,12 +124,12 @@
>
>
> #define VMW_PORT_HB_IN(cmd, in_ecx, in_si, in_di, \
> - port_num, magic, bp, \
> + flags, magic, bp, \
> eax, ebx, ecx, edx, si, di) \
> ({ \
> asm volatile ("push %%rbp;" \
> "mov %12, %%rbp;" \
> - "rep insb;" \
> + VMWARE_HYPERCALL_HB_IN \
> "pop %%rbp" : \
> "=a"(eax), \
> "=b"(ebx), \
> @@ -139,7 +140,7 @@
> "a"(magic), \
> "b"(cmd), \
> "c"(in_ecx), \
> - "d"(port_num), \
> + "d"(flags), \
> "S"(in_si), \
> "D"(in_di), \
> "r"(bp) : \
> @@ -157,13 +158,13 @@
> * just pushed it.
> */
> #define VMW_PORT_HB_OUT(cmd, in_ecx, in_si, in_di, \
> - port_num, magic, bp, \
> + flags, magic, bp, \
> eax, ebx, ecx, edx, si, di) \
> ({ \
> asm volatile ("push %12;" \
> "push %%ebp;" \
> "mov 0x04(%%esp), %%ebp;" \
> - "rep outsb;" \
> + VMWARE_HYPERCALL_HB_OUT \
> "pop %%ebp;" \
> "add $0x04, %%esp;" : \
> "=a"(eax), \
> @@ -175,7 +176,7 @@
> "a"(magic), \
> "b"(cmd), \
> "c"(in_ecx), \
> - "d"(port_num), \
> + "d"(flags), \
> "S"(in_si), \
> "D"(in_di), \
> "m"(bp) : \
> @@ -184,13 +185,13 @@
>
>
> #define VMW_PORT_HB_IN(cmd, in_ecx, in_si, in_di, \
> - port_num, magic, bp, \
> + flags, magic, bp, \
> eax, ebx, ecx, edx, si, di) \
> ({ \
> asm volatile ("push %12;" \
> "push %%ebp;" \
> "mov 0x04(%%esp), %%ebp;" \
> - "rep insb;" \
> + VMWARE_HYPERCALL_HB_IN \
> "pop %%ebp;" \
> "add $0x04, %%esp;" : \
> "=a"(eax), \
> @@ -202,7 +203,7 @@
> "a"(magic), \
> "b"(cmd), \
> "c"(in_ecx), \
> - "d"(port_num), \
> + "d"(flags), \
> "S"(in_si), \
> "D"(in_di), \
> "m"(bp) : \
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-08-26 20:12 UTC|newest]
Thread overview: 16+ 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
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-26 20:12 ` Dave Airlie [this message]
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='CAPM=9txEHSv8M4Q7A38JQpUoQJjess5vvwkXbJmk=0XgNhEJ9g@mail.gmail.com' \
--to=airlied@gmail.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).