* [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers
@ 2019-06-20 12:06 Andrew Cooper
2019-06-21 10:12 ` Jan Beulich
2019-06-28 15:59 ` Woods, Brian
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Cooper @ 2019-06-20 12:06 UTC (permalink / raw)
To: Xen-devel
Cc: Jan Beulich, Wei Liu, Andrew Cooper, Suravee Suthikulpanit,
Boris Ostrovsky, Brian Woods, Roger Pau Monné
Following on from c/s 7d161f6537 "x86/svm: Fix svm_vmcb_dump() when used in
current context", there is now only a single user of svm_vmsave() remaining in
the tree, with all users moved to svm_vm{load,save}_pa().
nv->nv_n1vmcx has a matching nv->nv_n1vmcx_pa which is always correct, and
avoids a redundant __pa() translation behind the scenes.
With this gone, all VM{LOAD,SAVE} operations are using paddr_t's which is more
efficient, so drop the svm_vm{load,save}() helpers to avoid uses of them
reappearing in the future.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
CC: Brian Woods <brian.woods@amd.com>
It turns out I was mistaken about how complicated this was.
---
xen/arch/x86/hvm/svm/nestedsvm.c | 2 +-
xen/include/asm-x86/hvm/svm/svm.h | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 35c1a04..fef124f 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1030,7 +1030,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
struct vmcb_struct *n2vmcb = nv->nv_n2vmcx;
- svm_vmsave(nv->nv_n1vmcx);
+ svm_vmsave_pa(nv->nv_n1vmcx_pa);
/* Cache guest physical address of virtual vmcb
* for VMCB Cleanbit emulation.
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index 6e688a8..16a994e 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -22,9 +22,6 @@
#include <xen/types.h>
-#define svm_vmload(x) svm_vmload_pa(__pa(x))
-#define svm_vmsave(x) svm_vmsave_pa(__pa(x))
-
static inline void svm_vmload_pa(paddr_t vmcb)
{
asm volatile (
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers
2019-06-20 12:06 [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers Andrew Cooper
@ 2019-06-21 10:12 ` Jan Beulich
2019-06-28 15:59 ` Woods, Brian
1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2019-06-21 10:12 UTC (permalink / raw)
To: Andrew Cooper
Cc: WeiLiu, Suravee Suthikulpanit, xen-devel, Boris Ostrovsky,
Brian Woods, Roger Pau Monne
>>> On 20.06.19 at 14:06, <andrew.cooper3@citrix.com> wrote:
> Following on from c/s 7d161f6537 "x86/svm: Fix svm_vmcb_dump() when used in
> current context", there is now only a single user of svm_vmsave() remaining in
> the tree, with all users moved to svm_vm{load,save}_pa().
>
> nv->nv_n1vmcx has a matching nv->nv_n1vmcx_pa which is always correct, and
> avoids a redundant __pa() translation behind the scenes.
>
> With this gone, all VM{LOAD,SAVE} operations are using paddr_t's which is more
> efficient, so drop the svm_vm{load,save}() helpers to avoid uses of them
> reappearing in the future.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
> It turns out I was mistaken about how complicated this was.
That was my hope, but it has been too long since I had last looked
at the nesting code in any level of detail.
> --- a/xen/include/asm-x86/hvm/svm/svm.h
> +++ b/xen/include/asm-x86/hvm/svm/svm.h
> @@ -22,9 +22,6 @@
>
> #include <xen/types.h>
>
> -#define svm_vmload(x) svm_vmload_pa(__pa(x))
> -#define svm_vmsave(x) svm_vmsave_pa(__pa(x))
> -
> static inline void svm_vmload_pa(paddr_t vmcb)
Down the road we may want to consider dropping the now
pointless _pa suffixes.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers
2019-06-20 12:06 [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers Andrew Cooper
2019-06-21 10:12 ` Jan Beulich
@ 2019-06-28 15:59 ` Woods, Brian
1 sibling, 0 replies; 3+ messages in thread
From: Woods, Brian @ 2019-06-28 15:59 UTC (permalink / raw)
To: Andrew Cooper
Cc: Jan Beulich, Wei Liu, Suthikulpanit, Suravee, Xen-devel,
Boris Ostrovsky, Woods, Brian, Roger Pau Monné
On Thu, Jun 20, 2019 at 01:06:21PM +0100, Andy Cooper wrote:
> Following on from c/s 7d161f6537 "x86/svm: Fix svm_vmcb_dump() when used in
> current context", there is now only a single user of svm_vmsave() remaining in
> the tree, with all users moved to svm_vm{load,save}_pa().
>
> nv->nv_n1vmcx has a matching nv->nv_n1vmcx_pa which is always correct, and
> avoids a redundant __pa() translation behind the scenes.
>
> With this gone, all VM{LOAD,SAVE} operations are using paddr_t's which is more
> efficient, so drop the svm_vm{load,save}() helpers to avoid uses of them
> reappearing in the future.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Brian Woods <brian.woods@amd.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wl@xen.org>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> CC: Brian Woods <brian.woods@amd.com>
>
> It turns out I was mistaken about how complicated this was.
> ---
> xen/arch/x86/hvm/svm/nestedsvm.c | 2 +-
> xen/include/asm-x86/hvm/svm/svm.h | 3 ---
> 2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
> index 35c1a04..fef124f 100644
> --- a/xen/arch/x86/hvm/svm/nestedsvm.c
> +++ b/xen/arch/x86/hvm/svm/nestedsvm.c
> @@ -1030,7 +1030,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
> struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
> struct vmcb_struct *n2vmcb = nv->nv_n2vmcx;
>
> - svm_vmsave(nv->nv_n1vmcx);
> + svm_vmsave_pa(nv->nv_n1vmcx_pa);
>
> /* Cache guest physical address of virtual vmcb
> * for VMCB Cleanbit emulation.
> diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
> index 6e688a8..16a994e 100644
> --- a/xen/include/asm-x86/hvm/svm/svm.h
> +++ b/xen/include/asm-x86/hvm/svm/svm.h
> @@ -22,9 +22,6 @@
>
> #include <xen/types.h>
>
> -#define svm_vmload(x) svm_vmload_pa(__pa(x))
> -#define svm_vmsave(x) svm_vmsave_pa(__pa(x))
> -
> static inline void svm_vmload_pa(paddr_t vmcb)
> {
> asm volatile (
> --
> 2.1.4
>
--
Brian Woods
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-28 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 12:06 [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers Andrew Cooper
2019-06-21 10:12 ` Jan Beulich
2019-06-28 15:59 ` Woods, Brian
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.