[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/9] x86/svm: move declarations used only by svm code from svm.h to private header


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 23 Feb 2023 11:16:44 +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=MkjRO/Pbtgh/t1ljFsXxHEnaouyQBRJRA1Jk2XtJCYM=; b=AosQsqqQM6mc3mm3p9rabiVZXGV40n4UV3aoB3NY9pki5dobAeV8fcCyFF2xW2xLLPra6bTBGnocR0vBBAU7jAsv/euxlwxXsrghU2I5eeL3hcQRfHuQdprnac6VzYNRFoj6qCsz5aKopWDPUxUE7QJRQWB15Nd7ykryD4MD/cGyH0GbzU5Xn15J/8kvUHR8gWTZk9ifky82qYc1XzfQVflYtuvnnpemwzyKkYuI4D0kWipR+hNtCeYhnD7zsH11nzK2AOkpqaeFGGtEm4LBSFTgXaGqRAWBSiihIUxhO1zKi3yw/69DvzO8tV9bu+yS0uBWWPl1xvSD/DTT/NRvtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PgXpnV3u8L9tHg+pTqwc4m7VUgaetX2O+NMj4VvYN+0xufwuHjAWxEQFUsuAAyK8HJSYQq2so6BOi+TjTiPVH+5PEyO1hwy+jHMts0UnVb1hYFCAoUy6Ih40KY3hx9FUYdYn/vjEsTF4o3pz1tW7g11hxD3RFhd1wlQQ9aeJ9DRMTsbN98DvT7S3clyZy92fhrstEG6NDs2Xy2lTSmDgj0bKsYgkZmHtS7zTAuqMR2VKmniKyVk+mEpqWBzjvBTngfZRIcwmK//McnFLFF3+K23gKQtekSV0njavDXTZ9A/MW52r+B0ObwPjtfoH0HuLr7yIzm3QnZY97kVdqdSi1g==
  • 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: Thu, 23 Feb 2023 11:17:09 +0000
  • Ironport-data: A9a23:VkX7kqDLL82k+xVW/xLiw5YqxClBgxIJ4kV8jS/XYbTApG5z32FRz mpKD2uOPqqOZGr0ett0a9+1p05Q78XUm9IyQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFtMpvlDs15K6p4GlC5QRkDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw4rx6AnNu5 6AkJm4DbgiHqLioxLWnRbw57igjBJGD0II3nFhFlGmcIdN4BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTI9exuuza7IA9ZidABNPL8fNCQSNoTtUGfv m/cpEzyAw0ANczZwj2Amp6prr6fx3uqBN9JfFG+3tBmpgLIw2sWMjwLe0qniP2DkRL5Zs0Kf iT4/QJr98De7neDRMTnTRS8p3KDoRc0VN9ZEul84waIooLE7gDcCmUaQzppbN09qNRwVTEsz kWOnd7iGXpoqrL9YXCX+6qQrDiyETMINmJEbigBJSMa5/HzrYd1iQjAJuuPC4awh9zxXD31n TaDqXFmg61J1JZVkaKm4VrAnjSg4IDTSRI47RnWWWTj6R5lYImiZMqj7l2zAet8Ebt1h2Kp5 BAs8/VyJshXZX1RvERhmNkwIYw=
  • Ironport-hdrordr: A9a23:qsWkaKoIIteU3EQZAJ0SIKoaV5oleYIsimQD101hICG9E/b1qy nKpp8mPHDP5wr5NEtPpTnjAsm9qALnlKKdiLN5Vd3OYOCMghrKEGgN1/qG/xTQXwH46+5Bxe NBXsFFebnN5IFB/KTH3DU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/02/2023 12:00 pm, Xenia Ragiadakou wrote:
> Create a new private header in arch/x86/hvm/svm called svm.h and move there
> all definitions and declarations that are used solely by svm code.
>
> The function svm_invlpga() stays in arch/x86/hvm/svm/svm.h because it is used
> by arch/x86/hvm/svm/asid.h.

I'm reasonably sure that all headers in arch/x86/hvm/svm/ other than
svm.h can move to being private easily.

>
> Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
> ---
>
> Changes in v2:
>  - new patch, the creation of a private header was suggested by Andrew and Jan
>
> I have not added #ifndef guards as it is a private and it should not be
> included by other headers. However, this is considered a MISRA-C violation
> ... I 'm not sure what to do.

Always have guards.  Firstly because that is the decision taken by the
MISRA working group.

But more importantly, because life is too short to deal with the
shooting yourself in the foot which will occur from trying to take
shortcuts like these.


> diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
> new file mode 100644
> index 0000000000..b2ec293078
> --- /dev/null
> +++ b/xen/arch/x86/hvm/svm/svm.h
> @@ -0,0 +1,40 @@
> +#include <xen/types.h>

Elsewhere, we're retrofitting SPDX tags to all source files, but we're
already putting tags in new source files.

This one needs to be /* SPDX-License-Identifier: GPL-2.0 */ I think.

> +
> +static inline void svm_vmload_pa(paddr_t vmcb)
> +{
> +    asm volatile (
> +        ".byte 0x0f,0x01,0xda" /* vmload */
> +        : : "a" (vmcb) : "memory" );
> +}
> +
> +static inline void svm_vmsave_pa(paddr_t vmcb)
> +{
> +    asm volatile (
> +        ".byte 0x0f,0x01,0xdb" /* vmsave */
> +        : : "a" (vmcb) : "memory" );
> +}
> +
> +struct cpu_user_regs;

Looking at this, you could fold patch 1 into this patch and reduce the
net churn.  It would be fine to say "delete used forward declaration" in
the commit message, seeing as you're deleting that block of code anyway
from svm.h

If you want to do this, then I'll skip committing patch 1.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.