[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 05/14] x86/svm: move nestedsvm declarations used only by svm code to private header
- To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Fri, 24 Feb 2023 20:12:46 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7i/jt+KTi0wVe7bRfcDojkbjGN2u6/RVgMKjz5A+N/E=; b=VuTbF+ZeCJD9Jikih6W266lCsw7dV5d0V8Cp9AzKAe2atTwFTFTuJ5zqrvknvQ9yzt4OX0wT4dBjt3YDZbSQWrI5H81zY5k97axZi1MHFCrf1/6tAYOvU9vnqE0wOsiIYNlCzewJRpQKhV7BlAmROcNfTvAOLEzuU6YHZZIUssk8r8kvU+iIpweYBqy68zm2oqoPJF9lLbAfWPxAuE5MxmDl3xQHAPh/Xw+k5qQKLzaLtbENN7lsFuruj0eV7Ga/tjU/eHY5uiWS1M4vWC3Nrr1WRlGZlG3JRi2q5YH0YuBTtMU6iM0FgIYyJSqwsz/iWGaHIGUYddKN8SSOznwgyw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VlejUzrVtq14aL/3zo4dgTO8OeRRZA3jVhLRA9qylmW9upS05sUUOLrTg4LKWVyzbkal0SeWdFPKi2xRllmCCfu7pmTHhJnz/TQHD0kML2iJYnQ/qok2PlqSe5oJ6oSE2BEv/9D90Hy7DWvpY9yx0nKKd5ICl3XFsIG33GIAoIV0nlofuGYdr+UDWZLw593zjO8j6n4U0ND8CQsA6pnLNtKyAYIT6FARkHftSqz9PlxDus7f6Fl/81VxnCWHy1cw8ClzERmSlIFocNbaes9aI4hdZYNsvRZTJYMaATK5vKUx4v85jPIqLDFqjCUwZ2W0ytqSm5OqUSQDwUjSCFgL7Q==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Fri, 24 Feb 2023 20:13:06 +0000
- Ironport-data: A9a23:xLot2a1Qd5VXWaGO+fbD5ehwkn2cJEfYwER7XKvMYLTBsI5bpzRRy mFKDzzXParcN2Pzed8ga4+09UtT75TVmIJmTwBqpC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK6ULWeUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS93uDgNyo4GlD5gZkOagQ1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfKGIf2 KIAbyg2QxWq2d+E2bedcNs8r5F2RCXrFNt3VnBI6xj8VK9jbbWdBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxqvC6Kk1IZPLvFabI5fvSjQ8lPk1nej WXB52njWTkRNcCFyCrD+XWp7gPKtXKkCN5DReDknhJsqHrP92g9MQZIbn6mof+VoUG3WeB5D lNBr0LCqoB3riRHVOLVVQCisneAuRIbRNN4HOgz6QXLwa3Riy6JC25BQjNfZdgOsM4tWSdsx lKPh8nuBzFkrPuSU3313rWeoC62OCMVBXQffiJCRgwAi/H8pKkjgxSJScxseJNZlfXwEDD0h jyP8i43guxKidZRjvrlu1fanziru57FCBYv4RnaVX6k6QU/Y5O5Y4uv6h7Q6vMowJulc2Rtd UMsw6C2hN3ix7nU/MBRaI3hxI2U2ss=
- Ironport-hdrordr: A9a23:RpzoTqjzmVlb7ZO3WtZ65WLy6XBQXzp13DAbv31ZSRFFG/FwyP rFoB1L73TJYWgqME3IwerwXpVpQRvnlaKdkrNhRItKPTOWz1dASbsO0WKM+UyFJ8STzIBgPM RbAt5D4b/LfD9HZK/BiWXWLz9K+qjlzEncv5a6854bd3AJV0gP1WZEIzfeNnczaBhNBJI/Gp bZzNFAvSCcdXMeadn+LmUZXsDYzue73K7OUFojPVoK+QOOhTSn5PrRCB6DxCoTVDtJ3PML7X XFqQrk/a+u2svLgSM0llWjpai+quGRhuerN/b8xfT9Hw+cxzpAKr4RFYFq9wpF2N1HoGxa6+ Uk5S1QdvibokmhBF2dsF/j3RLt3y0p7GKnwViEgWH7qci8Xz4iDdFd7LgpACcxxnBQzO2U6p g7rF6xpt5SF1fNjS7979/HW1VjkVe1u2MrlaoWg2ZEWYUTZbdNpchHlXklZKsoDWb/8sQqAe NuBMbT6LJfdk6bdWnQui1qzMa3Vno+Ex+aSgwJu9CT0TJRgHdlpnFosfA3jzMF7tYwWpNE7+ PLPuBhk6xPVNYfaeZnCOIIUaKMex3wqNL3QRyvyHjcZd460ij22uPKCZ0OlZ2XRKA=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 24/02/2023 6:50 pm, Xenia Ragiadakou wrote:
> diff --git a/xen/arch/x86/hvm/svm/nestedhvm.h
> b/xen/arch/x86/hvm/svm/nestedhvm.h
> new file mode 100644
> index 0000000000..43245e13de
> --- /dev/null
> +++ b/xen/arch/x86/hvm/svm/nestedhvm.h
> @@ -0,0 +1,77 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * nestedsvm.h: Nested Virtualization
> + *
> + * Copyright (c) 2011, Advanced Micro Devices, Inc
> + */
> +
> +#ifndef __X86_HVM_SVM_NESTEDHVM_PRIV_H__
> +#define __X86_HVM_SVM_NESTEDHVM_PRIV_H__
> +
> +#include <xen/mm.h>
> +#include <xen/types.h>
> +
> +#include <asm/hvm/vcpu.h>
> +#include <asm/hvm/hvm.h>
> +#include <asm/hvm/nestedhvm.h>
> +#include <asm/msr-index.h>
> +
> +/* SVM specific intblk types, cannot be an enum because gcc 4.5 complains */
> +/* GIF cleared */
> +#define hvm_intblk_svm_gif hvm_intblk_arch
I know you're just moving code, but I simply don't believe this comment.
This additional delta seems to compile fine:
diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index dbb0022190a8..111b10673cf4 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -154,7 +154,7 @@ void svm_intr_assist(void)
return;
intblk = hvm_interrupt_blocked(v, intack);
- if ( intblk == hvm_intblk_svm_gif )
+ if ( intblk == hvm_intblk_arch ) /* GIF */
{
ASSERT(nestedhvm_enabled(v->domain));
return;
diff --git a/xen/arch/x86/hvm/svm/nestedhvm.h
b/xen/arch/x86/hvm/svm/nestedhvm.h
index 43245e13deb7..c7747daae24a 100644
--- a/xen/arch/x86/hvm/svm/nestedhvm.h
+++ b/xen/arch/x86/hvm/svm/nestedhvm.h
@@ -16,10 +16,6 @@
#include <asm/hvm/nestedhvm.h>
#include <asm/msr-index.h>
-/* SVM specific intblk types, cannot be an enum because gcc 4.5
complains */
-/* GIF cleared */
-#define hvm_intblk_svm_gif hvm_intblk_arch
-
#define vcpu_nestedsvm(v) (vcpu_nestedhvm(v).u.nsvm)
/* True when l1 guest enabled SVM in EFER */
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c
b/xen/arch/x86/hvm/svm/nestedsvm.c
index 92316c6624ce..1794eb2105be 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1247,7 +1247,7 @@ enum hvm_intblk cf_check nsvm_intr_blocked(struct
vcpu *v)
ASSERT(nestedhvm_enabled(v->domain));
if ( !nestedsvm_gif_isset(v) )
- return hvm_intblk_svm_gif;
+ return hvm_intblk_arch;
if ( nestedhvm_vcpu_in_guestmode(v) )
{
but the first hunk demonstrates an error in the original logic.
Architecturally, GIF can become set for SKINIT, and in systems where SVM
isn't available.
I'm unsure whether its better to fix this up in this patch, or defer it
for later.
> +
> +#define vcpu_nestedsvm(v) (vcpu_nestedhvm(v).u.nsvm)
> +
> +/* True when l1 guest enabled SVM in EFER */
> +#define nsvm_efer_svm_enabled(v) \
> + (!!((v)->arch.hvm.guest_efer & EFER_SVME))
This seems to be the only use of asm/msr-index.h, and it's a macro so
the header is actually unused.
I'd drop the include - its a very common header anyway.
~Andrew
|