nitro_enclaves: Add support for Arm64
Subsystems (3)
v3 cover nitro_enclaves: Add support for Arm64
Update the kernel config of the Nitro Enclaves kernel driver to enable Arm64 support. Add Arm64 specific references to its documentation.
While at it, fix a set of reports from checkpatch and kernel-doc scripts.
Thank you,
Andra
---
Patch Series Changelog
The patch series is built on top of v5.14-rc7.
GitHub repo branch for the latest version of the patch series:
* https://github.com/andraprs/linux/tree/ne-driver-arm-support-v3
v1 -> v2
* Add information about supported architectures for the NE kernel driver.
* Update comments for send / receive buffer sizes for the NE PCI device.
* Split patch 3 that includes fixes for the checkpatch and kernel-doc reports into multiple ones.
* v1: https://lore.kernel.org/lkml/[email protected]/
v2 -> v3
* Move changelog after the "---" line in all commits from the patch series.
* v2: https://lore.kernel.org/lkml/[email protected]/
---
Andra Paraschiv (7):
nitro_enclaves: Enable Arm64 support
nitro_enclaves: Update documentation for Arm64 support
nitro_enclaves: Add fix for the kernel-doc report
nitro_enclaves: Update copyright statement to include 2021
nitro_enclaves: Add fixes for checkpatch match open parenthesis
reports
nitro_enclaves: Add fixes for checkpatch spell check reports
nitro_enclaves: Add fixes for checkpatch blank line reports
Documentation/virt/ne_overview.rst | 21 +++++++++++++-------- drivers/virt/nitro_enclaves/Kconfig | 8 ++------ drivers/virt/nitro_enclaves/ne_misc_dev.c | 17 +++++++++-------- drivers/virt/nitro_enclaves/ne_pci_dev.c | 2 +- drivers/virt/nitro_enclaves/ne_pci_dev.h | 8 ++++++-- include/uapi/linux/nitro_enclaves.h | 10 +++++----- samples/nitro_enclaves/ne_ioctl_sample.c | 7 +++---- 7 files changed, 39 insertions(+), 34 deletions(-)
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 1/7 nitro_enclaves: Enable Arm64 support
Update the kernel config to enable the Nitro Enclaves kernel driver for Arm64 support.
---
Changelog
v1 -> v2
* No changes.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/Kconfig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/virt/nitro_enclaves/Kconfig +2 -6
@@ -1,17 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Amazon Nitro Enclaves (NE) support. # Nitro is a hypervisor that has been developed by Amazon. -# TODO: Add dependency for ARM64 once NE is supported on Arm platforms. For now, -# the NE kernel driver can be built for aarch64 arch. -# depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP - config NITRO_ENCLAVES tristate "Nitro Enclaves Support" - depends on X86 && HOTPLUG_CPU && PCI && SMP + depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP help This driver consists of support for enclave lifetime management for Nitro Enclaves (NE).
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 1/7] nitro_enclaves: Enable Arm64 support
Quoted 46 lines · Andra Paraschiv
Update the kernel config to enable the Nitro Enclaves kernel driver for Arm64 support.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No changes.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/Kconfig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/virt/nitro_enclaves/Kconfig +2
-6@@ -1,17 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Amazon Nitro Enclaves (NE) support. # Nitro is a hypervisor that has been developed by Amazon. -# TODO: Add dependency for ARM64 once NE is supported on Arm platforms. For now, -# the NE kernel driver can be built for aarch64 arch. -# depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP - config NITRO_ENCLAVES tristate "Nitro Enclaves Support" - depends on X86 && HOTPLUG_CPU && PCI && SMP + depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP help This driver consists of support for enclave lifetime management for Nitro Enclaves (NE).Signature · 1 line
2.20.1 (Apple Git-117)
Awesome,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 1/7] nitro_enclaves: Enable Arm64 support
Quoted 33 lines · George-Aurelian Popescu
Quoted 32 lines · Andra Paraschiv
Update the kernel config to enable the Nitro Enclaves kernel driver for Arm64 support.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No changes.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/Kconfig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/virt/nitro_enclaves/Kconfig +1
-1@@ -1,17 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Amazon Nitro Enclaves (NE) support. # Nitro is a hypervisor that has been developed by Amazon.
Quoted 16 lines
Quoted 14 lines
drivers/virt/nitro_enclaves/Kconfig +1
-5-# TODO: Add dependency for ARM64 once NE is supported on Arm platforms. For now, -# the NE kernel driver can be built for aarch64 arch. -# depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP - config NITRO_ENCLAVES tristate "Nitro Enclaves Support" - depends on X86 && HOTPLUG_CPU && PCI && SMP + depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP help This driver consists of support for enclave lifetime management for Nitro Enclaves (NE).Signature · 1 line
2.20.1 (Apple Git-117)Reviewed-by George-Aurelian Popescu <[email protected]>
Thanks, George, for review.
Greg, let me know if other updates are needed for the patch series. Otherwise, please include the patches in the char-misc tree and we can target the current merge window, for v5.15. Thank you.
Andra
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 1/7] nitro_enclaves: Enable Arm64 support
Quoted 51 lines · Andra-Irina
Quoted 38 lines · George-Aurelian Popescu
Quoted 37 lines · Andra Paraschiv
Update the kernel config to enable the Nitro Enclaves kernel driver for Arm64 support.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No changes.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/Kconfig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/virt/nitro_enclaves/Kconfig +1
-6@@ -1,17 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Amazon Nitro Enclaves (NE) support. # Nitro is a hypervisor that has been developed by Amazon. -# TODO: Add dependency for ARM64 once NE is supported on Arm platforms. For now, -# the NE kernel driver can be built for aarch64 arch. -# depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP - config NITRO_ENCLAVES tristate "Nitro Enclaves Support" - depends on X86 && HOTPLUG_CPU && PCI && SMPQuoted 9 lines
drivers/virt/nitro_enclaves/Kconfig
Quoted 7 lines
drivers/virt/nitro_enclaves/Kconfig +1
-1+ depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP help This driver consists of support for enclave lifetime management for Nitro Enclaves (NE). -- 2.20.1 (Apple Git-117)Reviewed-by George-Aurelian Popescu <[email protected]>
Quoted 5 lines
Thanks, George, for review.
Greg, let me know if other updates are needed for the patch series. Otherwise, please include the patches in the char-misc tree and we can target the current merge window, for v5.15. Thank you.
It's too late for 5.15-rc1, I will queue them up after 5.15-rc1 is out, thanks.
greg k-h
Re: [PATCH v3 1/7] nitro_enclaves: Enable Arm64 support
Quoted 50 lines · Greg KH
Quoted 49 lines · Andra-Irina
Quoted 47 lines · George-Aurelian Popescu
Quoted 34 lines · Andra Paraschiv
Update the kernel config to enable the Nitro Enclaves kernel driver for Arm64 support.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No changes.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/Kconfig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/virt/nitro_enclaves/Kconfig +1
-4@@ -1,17 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Amazon Nitro Enclaves (NE) support. # Nitro is a hypervisor that has been developed by Amazon. -# TODO: Add dependency for ARM64 once NE is supported on Arm platforms. For now, -# the NE kernel driver can be built for aarch64 arch. -# depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMPdrivers/virt/nitro_enclaves/Kconfig line 12
Quoted 10 lines
drivers/virt/nitro_enclaves/Kconfig +1
-3- config NITRO_ENCLAVES tristate "Nitro Enclaves Support" - depends on X86 && HOTPLUG_CPU && PCI && SMP + depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP help This driver consists of support for enclave lifetime management for Nitro Enclaves (NE). -- 2.20.1 (Apple Git-117)Reviewed-by George-Aurelian Popescu <[email protected]>
Quoted 7 lines
Quoted 5 lines
Thanks, George, for review.
Greg, let me know if other updates are needed for the patch series. Otherwise, please include the patches in the char-misc tree and we can target the current merge window, for v5.15. Thank you.
It's too late for 5.15-rc1, I will queue them up after 5.15-rc1 is out, thanks.
Ack, thanks for info. Then would be the next rc, no functional codebase changes being included. Or just let me know if other release phase would be targeted.
Thanks,
Andra
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 1/7] nitro_enclaves: Enable Arm64 support
Quoted 58 lines · Andra-Irina
Quoted 55 lines · Greg KH
Quoted 54 lines · Andra-Irina
Quoted 41 lines · George-Aurelian Popescu
Quoted 40 lines · Andra Paraschiv
Update the kernel config to enable the Nitro Enclaves kernel driver for Arm64 support.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No changes.
v2 -> v3
* Move changelog after the "---" line.
---
drivers/virt/nitro_enclaves/Kconfig| 8 ++------1 file changed, 2 insertions(+), 6 deletions(-)drivers/virt/nitro_enclaves/Kconfig +0
-1@@ -1,17 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright 2020 Amazon.com, Inc. or its affiliates. All RightsReserved.
+# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Amazon Nitro Enclaves (NE) support.
# Nitro is a hypervisor that has been developed by Amazon. -# TODO: Add dependency for ARM64 once NE is supported on Arm platforms. For now,drivers/virt/nitro_enclaves/Kconfig +0
-3-# the NE kernel driver can be built for aarch64 arch. -# depends on (ARM64 || X86) && HOTPLUG_CPU && PCI && SMP -config
NITRO_ENCLAVES
tristate "Nitro Enclaves Support"
- depends on X86 &&HOTPLUG_CPU&& PCI && SMPQuoted 9 lines
Quoted 7 lines
+ depends on (ARM64 || X86) &&
HOTPLUG_CPU&& PCI && SMP
help
This driver consists of support for enclave lifetime management for Nitro Enclaves (NE).Signature · 1 line
2.20.1 (Apple Git-117)Reviewed-by George-Aurelian Popescu <[email protected]>Thanks, George, for review.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Greg, let me know if other updates are needed for the patch series. Otherwise, please include the patches in the char-misc tree and we can target the current merge window, for v5.15. Thank you.
It's too late for 5.15-rc1, I will queue them up after 5.15-rc1 is out, thanks.
Ack, thanks for info. Then would be the next rc, no functional codebase changes being included. Or just let me know if other release phase would be targeted.
I see the patch series has been merged into the mainline. Thanks, Greg.
Andra
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 2/7 nitro_enclaves: Update documentation for Arm64 support
In reply to Andra ParaschivAdd references for hugepages and booting steps for Arm64.
Include info about the current supported architectures for the NE kernel driver.
---
Changelog
v1 -> v2
* Add information about supported architectures for the NE kernel driver.
v2 -> v3
* Move changelog after the "---" line.
--- Documentation/virt/ne_overview.rst | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
Documentation/virt/ne_overview.rst +13 -8
@@ -14,12 +14,15 @@ instances [1]. For example, an application that processes sensitive data and runs in a VM, can be separated from other applications running in the same VM. This application then runs in a separate VM than the primary VM, namely an enclave. +It runs alongside the VM that spawned it. This setup matches low latency +applications needs. -An enclave runs alongside the VM that spawned it. This setup matches low latency -applications needs. The resources that are allocated for the enclave, such as -memory and CPUs, are carved out of the primary VM. Each enclave is mapped to a -process running in the primary VM, that communicates with the NE driver via an -ioctl interface. +The current supported architectures for the NE kernel driver, available in the +upstream Linux kernel, are x86 and ARM64. + +The resources that are allocated for the enclave, such as memory and CPUs, are +carved out of the primary VM. Each enclave is mapped to a process running in the +primary VM, that communicates with the NE kernel driver via an ioctl interface. In this sense, there are two components:
@@ -43,8 +46,8 @@ for the enclave VM. An enclave does not have persistent storage attached. The memory regions carved out of the primary VM and given to an enclave need to be aligned 2 MiB / 1 GiB physically contiguous memory regions (or multiple of this size e.g. 8 MiB). The memory can be allocated e.g. by using hugetlbfs from -user space [2][3]. The memory size for an enclave needs to be at least 64 MiB. -The enclave memory and CPUs need to be from the same NUMA node. +user space [2][3][7]. The memory size for an enclave needs to be at least +64 MiB. The enclave memory and CPUs need to be from the same NUMA node. An enclave runs on dedicated cores. CPU 0 and its CPU siblings need to remain available for the primary VM. A CPU pool has to be set for NE purposes by an
@@ -61,7 +64,7 @@ device is placed in memory below the typical 4 GiB. The application that runs in the enclave needs to be packaged in an enclave image together with the OS ( e.g. kernel, ramdisk, init ) that will run in the enclave VM. The enclave VM has its own kernel and follows the standard Linux -boot protocol [6]. +boot protocol [6][8]. The kernel bzImage, the kernel command line, the ramdisk(s) are part of the Enclave Image Format (EIF); plus an EIF header including metadata such as magic
@@ -93,3 +96,5 @@ enclave process can exit. [4] https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html [5] https://man7.org/linux/man-pages/man7/vsock.7.html [6] https://www.kernel.org/doc/html/latest/x86/boot.html +[7] https://www.kernel.org/doc/html/latest/arm64/hugetlbpage.html +[8] https://www.kernel.org/doc/html/latest/arm64/booting.html
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 2/7] nitro_enclaves: Update documentation for Arm64 support
Quoted 75 lines · Andra Paraschiv
Add references for hugepages and booting steps for Arm64.
Include info about the current supported architectures for the NE kernel driver.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* Add information about supported architectures for the NE kernel driver.
v2 -> v3
* Move changelog after the "---" line.
--- Documentation/virt/ne_overview.rst | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)Documentation/virt/ne_overview.rst +13
-8@@ -14,12 +14,15 @@ instances [1]. For example, an application that processes sensitive data and runs in a VM, can be separated from other applications running in the same VM. This application then runs in a separate VM than the primary VM, namely an enclave. +It runs alongside the VM that spawned it. This setup matches low latency +applications needs. -An enclave runs alongside the VM that spawned it. This setup matches low latency -applications needs. The resources that are allocated for the enclave, such as -memory and CPUs, are carved out of the primary VM. Each enclave is mapped to a -process running in the primary VM, that communicates with the NE driver via an -ioctl interface. +The current supported architectures for the NE kernel driver, available in the +upstream Linux kernel, are x86 and ARM64. + +The resources that are allocated for the enclave, such as memory and CPUs, are +carved out of the primary VM. Each enclave is mapped to a process running in the +primary VM, that communicates with the NE kernel driver via an ioctl interface. In this sense, there are two components:@@ -43,8 +46,8 @@ for the enclave VM. An enclave does not have persistent storage attached. The memory regions carved out of the primary VM and given to an enclave need to be aligned 2 MiB / 1 GiB physically contiguous memory regions (or multiple of this size e.g. 8 MiB). The memory can be allocated e.g. by using hugetlbfs from -user space [2][3]. The memory size for an enclave needs to be at least 64 MiB. -The enclave memory and CPUs need to be from the same NUMA node. +user space [2][3][7]. The memory size for an enclave needs to be at least +64 MiB. The enclave memory and CPUs need to be from the same NUMA node. An enclave runs on dedicated cores. CPU 0 and its CPU siblings need to remain available for the primary VM. A CPU pool has to be set for NE purposes by an@@ -61,7 +64,7 @@ device is placed in memory below the typical 4 GiB. The application that runs in the enclave needs to be packaged in an enclave image together with the OS ( e.g. kernel, ramdisk, init ) that will run in the enclave VM. The enclave VM has its own kernel and follows the standard Linux -boot protocol [6]. +boot protocol [6][8]. The kernel bzImage, the kernel command line, the ramdisk(s) are part of the Enclave Image Format (EIF); plus an EIF header including metadata such as magic@@ -93,3 +96,5 @@ enclave process can exit. [4] https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html [5] https://man7.org/linux/man-pages/man7/vsock.7.html [6] https://www.kernel.org/doc/html/latest/x86/boot.html +[7] https://www.kernel.org/doc/html/latest/arm64/hugetlbpage.html +[8] https://www.kernel.org/doc/html/latest/arm64/booting.htmlSignature · 1 line
2.20.1 (Apple Git-117)
Looks good,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 2/7] nitro_enclaves: Update documentation for Arm64 support
In reply to Andra ParaschivQuoted 14 lines · Andra Paraschiv
Add references for hugepages and booting steps for Arm64.
Include info about the current supported architectures for the NE kernel driver.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* Add information about supported architectures for the NE kernel driver.
Quoted 6 lines
v2 -> v3
* Move changelog after the "---" line.
---Documentation/virt/ne_overview.rst| 21 +++++++++++++--------1 file changed, 13 insertions(+), 8 deletions(-)
Re: [PATCH v3 2/7] nitro_enclaves: Update documentation for Arm64 support
Quoted 15 lines · Stefano Garzarella
Quoted 14 lines · Andra Paraschiv
Add references for hugepages and booting steps for Arm64.
Include info about the current supported architectures for the NE kernel driver.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* Add information about supported architectures for the NE kernel driver.
Quoted 9 lines
Quoted 6 lines
v2 -> v3
* Move changelog after the "---" line.
---Documentation/virt/ne_overview.rst| 21 +++++++++++++--------1 file changed, 13 insertions(+), 8 deletions(-)
Thank you, Stefano.
Andra
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 3/7 nitro_enclaves: Add fix for the kernel-doc report
In reply to Andra ParaschivFix the reported issue from the kernel-doc script, to have a comment per identifier.
---
Changelog
v1 -> v2
* Update comments for send / receive buffer sizes for the NE PCI device.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/ne_pci_dev.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/virt/nitro_enclaves/ne_pci_dev.h +6 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ #ifndef _NE_PCI_DEV_H_
@@ -84,9 +84,13 @@*/ /** -* NE_SEND_DATA_SIZE / NE_RECV_DATA_SIZE - 240 bytes for send / recv buffer. +* NE_SEND_DATA_SIZE - Size of the send buffer, in bytes. */ #define NE_SEND_DATA_SIZE (240) + +/** +* NE_RECV_DATA_SIZE - Size of the receive buffer, in bytes. +*/ #define NE_RECV_DATA_SIZE (240)/**
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 3/7] nitro_enclaves: Add fix for the kernel-doc report
Quoted 48 lines · Andra Paraschiv
Fix the reported issue from the kernel-doc script, to have a comment per identifier.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* Update comments for send / receive buffer sizes for the NE PCI device.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/ne_pci_dev.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/virt/nitro_enclaves/ne_pci_dev.h +6
-2@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ #ifndef _NE_PCI_DEV_H_@@ -84,9 +84,13 @@*/ /** -* NE_SEND_DATA_SIZE / NE_RECV_DATA_SIZE - 240 bytes for send / recv buffer. +* NE_SEND_DATA_SIZE - Size of the send buffer, in bytes. */ #define NE_SEND_DATA_SIZE (240) + +/** +* NE_RECV_DATA_SIZE - Size of the receive buffer, in bytes. +*/ #define NE_RECV_DATA_SIZE (240)/** Signature · 1 line
2.20.1 (Apple Git-117)
Looks good,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 4/7 nitro_enclaves: Update copyright statement to include 2021
In reply to Andra ParaschivUpdate the copyright statement to include 2021, as a change has been made over this year.
Check commit d874742f6a73 ("nitro_enclaves: Set Bus Master for the NE PCI device") for the codebase update from this file (ne_pci_dev.c).
---
Changelog
v1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/ne_pci_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/nitro_enclaves/ne_pci_dev.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /**
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 4/7] nitro_enclaves: Update copyright statement to include 2021
Quoted 37 lines · Andra Paraschiv
Update the copyright statement to include 2021, as a change has been made over this year.
Check commit
d874742f6a73("nitro_enclaves: Set Bus Master for the NE PCI device") for the codebase update from this file (ne_pci_dev.c).Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/ne_pci_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/virt/nitro_enclaves/ne_pci_dev.c +1
-1@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /** Signature · 1 line
2.20.1 (Apple Git-117)
Looks ok,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 5/7 nitro_enclaves: Add fixes for checkpatch match open parenthesis reports
In reply to Andra ParaschivUpdate the codebase formatting to fix the reports from the checkpatch script, to match the open parenthesis.
---
Changelog
v1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/ne_misc_dev.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/virt/nitro_enclaves/ne_misc_dev.c +9 -8
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /**
@@ -284,8 +284,8 @@ static int ne_setup_cpu_pool(const char *ne_cpu_list) ne_cpu_pool.nr_parent_vm_cores = nr_cpu_ids / ne_cpu_pool.nr_threads_per_core; ne_cpu_pool.avail_threads_per_core =kcalloc (ne_cpu_pool.nr_parent_vm_cores, -sizeof (*ne_cpu_pool.avail_threads_per_core), -GFP_KERNEL ); +sizeof (*ne_cpu_pool.avail_threads_per_core), +GFP_KERNEL );if (!ne_cpu_pool.avail_threads_per_core) { rc = -ENOMEM ;
@@ -735,7 +735,7 @@ static int ne_add_vcpu_ioctl(struct ne_enclave *ne_enclave, u32 vcpu_id)* * Negative return value on failure. */ static int ne_sanity_check_user_mem_region (struct ne_enclave *ne_enclave, -struct ne_user_memory_region mem_region) +struct ne_user_memory_region mem_region) {struct ne_mem_region *ne_mem_region =NULL ;
@@ -771,7 +771,7 @@ static int ne_sanity_check_user_mem_region(struct ne_enclave *ne_enclave,u64 userspace_addr = ne_mem_region->userspace_addr;if ((userspace_addr <= mem_region.userspace_addr && - mem_region.userspace_addr < (userspace_addr + memory_size)) || + mem_region.userspace_addr < (userspace_addr + memory_size)) || (mem_region.userspace_addr <= userspace_addr && (mem_region.userspace_addr + mem_region.memory_size) > userspace_addr)) { dev_err_ratelimited(ne_misc_dev.this_device,
@@ -836,7 +836,7 @@ static int ne_sanity_check_user_mem_region_page(struct ne_enclave *ne_enclave,* * Negative return value on failure. */ static int ne_set_user_memory_region_ioctl (struct ne_enclave *ne_enclave, -struct ne_user_memory_region mem_region) +struct ne_user_memory_region mem_region) {long gup_rc =0 ;unsigned long i =0 ;
@@ -1014,7 +1014,7 @@ static int ne_set_user_memory_region_ioctl(struct ne_enclave *ne_enclave,* * Negative return value on failure. */ static int ne_start_enclave_ioctl (struct ne_enclave *ne_enclave, -struct ne_enclave_start_info *enclave_start_info) +struct ne_enclave_start_info *enclave_start_info) {struct ne_pci_dev_cmd_reply cmd_reply = {};unsigned int cpu =0 ;
@@ -1574,7 +1574,8 @@ static int ne_create_vm_ioctl(struct ne_pci_dev *ne_pci_dev, u64 __user *slot_uimutex_unlock (&ne_cpu_pool.mutex); ne_enclave->threads_per_core =kcalloc (ne_enclave->nr_parent_vm_cores, -sizeof (*ne_enclave->threads_per_core),GFP_KERNEL ); +sizeof (*ne_enclave->threads_per_core), +GFP_KERNEL );if (!ne_enclave->threads_per_core) { rc = -ENOMEM ;
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 5/7] nitro_enclaves: Add fixes for checkpatch match open parenthesis reports
Quoted 91 lines · Andra Paraschiv
Update the codebase formatting to fix the reports from the checkpatch script, to match the open parenthesis.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- drivers/virt/nitro_enclaves/ne_misc_dev.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)drivers/virt/nitro_enclaves/ne_misc_dev.c +9
-8@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /** @@ -284,8 +284,8 @@ static int ne_setup_cpu_pool(const char *ne_cpu_list) ne_cpu_pool.nr_parent_vm_cores = nr_cpu_ids / ne_cpu_pool.nr_threads_per_core; ne_cpu_pool.avail_threads_per_core =kcalloc (ne_cpu_pool.nr_parent_vm_cores, -sizeof (*ne_cpu_pool.avail_threads_per_core), -GFP_KERNEL ); +sizeof (*ne_cpu_pool.avail_threads_per_core), +GFP_KERNEL );if (!ne_cpu_pool.avail_threads_per_core) { rc = -ENOMEM ;@@ -735,7 +735,7 @@ static int ne_add_vcpu_ioctl(struct ne_enclave *ne_enclave, u32 vcpu_id)* * Negative return value on failure. */ static int ne_sanity_check_user_mem_region (struct ne_enclave *ne_enclave, -struct ne_user_memory_region mem_region) +struct ne_user_memory_region mem_region) {struct ne_mem_region *ne_mem_region =NULL ;@@ -771,7 +771,7 @@ static int ne_sanity_check_user_mem_region(struct ne_enclave *ne_enclave,u64 userspace_addr = ne_mem_region->userspace_addr;if ((userspace_addr <= mem_region.userspace_addr && - mem_region.userspace_addr < (userspace_addr + memory_size)) || + mem_region.userspace_addr < (userspace_addr + memory_size)) || (mem_region.userspace_addr <= userspace_addr && (mem_region.userspace_addr + mem_region.memory_size) > userspace_addr)) { dev_err_ratelimited(ne_misc_dev.this_device,@@ -836,7 +836,7 @@ static int ne_sanity_check_user_mem_region_page(struct ne_enclave *ne_enclave,* * Negative return value on failure. */ static int ne_set_user_memory_region_ioctl (struct ne_enclave *ne_enclave, -struct ne_user_memory_region mem_region) +struct ne_user_memory_region mem_region) {long gup_rc =0 ;unsigned long i =0 ;@@ -1014,7 +1014,7 @@ static int ne_set_user_memory_region_ioctl(struct ne_enclave *ne_enclave,* * Negative return value on failure. */ static int ne_start_enclave_ioctl (struct ne_enclave *ne_enclave, -struct ne_enclave_start_info *enclave_start_info) +struct ne_enclave_start_info *enclave_start_info) {struct ne_pci_dev_cmd_reply cmd_reply = {};unsigned int cpu =0 ;@@ -1574,7 +1574,8 @@ static int ne_create_vm_ioctl(struct ne_pci_dev *ne_pci_dev, u64 __user *slot_uimutex_unlock (&ne_cpu_pool.mutex); ne_enclave->threads_per_core =kcalloc (ne_enclave->nr_parent_vm_cores, -sizeof (*ne_enclave->threads_per_core),GFP_KERNEL ); +sizeof (*ne_enclave->threads_per_core), +GFP_KERNEL );if (!ne_enclave->threads_per_core) { rc = -ENOMEM ;Signature · 1 line
2.20.1 (Apple Git-117)
Looks ok,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 6/7 nitro_enclaves: Add fixes for checkpatch spell check reports
In reply to Andra ParaschivFix the typos in the words spelling as per the checkpatch script reports.
---
Changelog
v1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- include/uapi/linux/nitro_enclaves.h | 10 +++++----- samples/nitro_enclaves/ne_ioctl_sample.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)
include/uapi/linux/nitro_enclaves.h +5 -5
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ #ifndef _UAPI_LINUX_NITRO_ENCLAVES_H_
@@ -60,7 +60,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure.
@@ -95,7 +95,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure.
@@ -118,7 +118,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() failure.
@@ -161,7 +161,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure.
samples/nitro_enclaves/ne_ioctl_sample.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /**
@@ -638,7 +638,7 @@ static int ne_start_enclave(int enclave_fd, struct ne_enclave_start_info *encla }/** -* ne_start_enclave_check_booted() - Start the enclave and wait for a hearbeat +* ne_start_enclave_check_booted() - Start the enclave and wait for a heartbeat * from it, on a newly created vsock channel, * to check it has booted. * @enclave_fd : The file descriptor associated with the enclave.
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 6/7] nitro_enclaves: Add fixes for checkpatch spell check reports
Quoted 92 lines · Andra Paraschiv
Fix the typos in the words spelling as per the checkpatch script reports.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- include/uapi/linux/nitro_enclaves.h | 10 +++++----- samples/nitro_enclaves/ne_ioctl_sample.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)include/uapi/linux/nitro_enclaves.h +5
-5@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ #ifndef _UAPI_LINUX_NITRO_ENCLAVES_H_@@ -60,7 +60,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure. @@ -95,7 +95,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure. @@ -118,7 +118,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() failure. @@ -161,7 +161,7 @@* * Context: Process context. * Return: -* * 0 - Logic succesfully completed. +* * 0 - Logic successfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure. samples/nitro_enclaves/ne_ioctl_sample.c +2
-2@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +* Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /** @@ -638,7 +638,7 @@ static int ne_start_enclave(int enclave_fd, struct ne_enclave_start_info *encla }/** -* ne_start_enclave_check_booted() - Start the enclave and wait for a hearbeat +* ne_start_enclave_check_booted() - Start the enclave and wait for a heartbeat * from it, on a newly created vsock channel, * to check it has booted. * @enclave_fd : The file descriptor associated with the enclave. Signature · 1 line
2.20.1 (Apple Git-117)
Looks ok,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
PATCH v3 7/7 nitro_enclaves: Add fixes for checkpatch blank line reports
In reply to Andra ParaschivRemove blank lines that are not necessary, fixing the checkpatch script reports. While at it, add a blank line after the switch default block, similar to the other parts of the codebase.
---
Changelog
v1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- samples/nitro_enclaves/ne_ioctl_sample.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
samples/nitro_enclaves/ne_ioctl_sample.c +1 -2
@@ -185,7 +185,6 @@ static int ne_create_vm(int ne_dev_fd, unsigned long *slot_uid, int *enclave_fd)return 0 ; } -/** * ne_poll_enclave_fd() - Thread function for polling the enclave fd. * @data: Argument provided for the polling function.
@@ -560,8 +559,8 @@ static int ne_add_vcpu(int enclave_fd, unsigned int *vcpu_id)default :printf ("Error in add vcpu [%m]\n" ); - } +return rc; }
Signature · 6 lines
2.20.1 (Apple Git-117) Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Re: [PATCH v3 7/7] nitro_enclaves: Add fixes for checkpatch blank line reports
Quoted 45 lines · Andra Paraschiv
Remove blank lines that are not necessary, fixing the checkpatch script reports. While at it, add a blank line after the switch default block, similar to the other parts of the codebase.
Signed-off-by Andra Paraschiv <[email protected]>---
Changelogv1 -> v2
* No codebase changes, it was split from the patch 3 in the v1 of the patch series.
v2 -> v3
* Move changelog after the "---" line.
--- samples/nitro_enclaves/ne_ioctl_sample.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)samples/nitro_enclaves/ne_ioctl_sample.c +1
-2@@ -185,7 +185,6 @@ static int ne_create_vm(int ne_dev_fd, unsigned long *slot_uid, int *enclave_fd)return 0 ; } -/** * ne_poll_enclave_fd() - Thread function for polling the enclave fd. * @data: Argument provided for the polling function. @@ -560,8 +559,8 @@ static int ne_add_vcpu(int enclave_fd, unsigned int *vcpu_id)default :printf ("Error in add vcpu [%m]\n" ); - } +return rc; }Signature · 1 line
2.20.1 (Apple Git-117)
Nice,
George
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.