Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating ISA-L changes into openzfs 2.0 ZFS-1091 #47

Merged
merged 5 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ find_package(OpenSSL REQUIRED)
#get_filename_component(rootPath "${OPENSSL_CRYPTO_LIBRARY}" DIRECTORY)
#message(STATUS "OpenSSL root: " ${rootPath})

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(ISAL isa-l_crypto_static HINTS "${CMAKE_SOURCE_DIR}/lib/ISA-L/Debug" REQUIRED)
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
find_library(ISAL isa-l_crypto_static HINTS "${CMAKE_SOURCE_DIR}/lib/ISA-L/Release" REQUIRED)
endif()

# Attempt to simulate scripts/make-gitrev.h and zfs_gitrev.h
include(GetGitRevisionDescription)
Expand Down
11 changes: 11 additions & 0 deletions include/os/windows/spl/sys/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ zfs_uio_segflg(zfs_uio_t *uio)
return (uio->uio_segflg);
}

static inline int
zfs_uio_isuserspace(zfs_uio_t *uio)
{
ASSERT(uio != NULL);

if (uio->uio_segflg == UIO_USERSPACE) {
return (1);
}
return (0);
}

static inline int
zfs_uio_iovcnt(zfs_uio_t *uio)
{
Expand Down
2 changes: 2 additions & 0 deletions include/os/windows/zfs/sys/kstat_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ typedef struct windows_kstat {
kstat_named_t zfs_autoimport_disable;
kstat_named_t zfs_total_memory_limit;
kstat_named_t zfs_removal_suspend_progress;
kstat_named_t cpu_avx_supported;
} windows_kstat_t;


Expand Down Expand Up @@ -257,6 +258,7 @@ extern uint64_t zfs_disable_removablemedia;
extern uint64_t zfs_initialize_value;
extern int zfs_autoimport_disable;
extern int zfs_removal_suspend_progress;
extern int cpu_avx_supported;

int kstat_windows_init(void *);
void kstat_windows_fini(void);
Expand Down
Binary file added lib/ISA-L/Debug/isa-l_crypto_static.lib
Binary file not shown.
Binary file added lib/ISA-L/Release/isa-l_crypto_static.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/libicp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ add_library(libicp


target_include_directories(libicp PRIVATE "${ICP_MODULE_DIR}/include")
target_link_libraries(libicp PUBLIC libspl libpthread)
target_link_libraries(libicp PUBLIC libspl libpthread ${ISAL})
12 changes: 12 additions & 0 deletions lib/libspl/include/sys/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,25 @@ typedef struct zfs_uio {
#define zfs_uio_iovlen(uio, idx) (uio)->uio_iov[(idx)].iov_len
#define zfs_uio_iovbase(uio, idx) (uio)->uio_iov[(idx)].iov_base


static inline void
zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len)
{
*base = zfs_uio_iovbase(uio, idx);
*len = zfs_uio_iovlen(uio, idx);
}

static inline int
zfs_uio_isuserspace(zfs_uio_t *uio)
{
ASSERT(uio != NULL);

if (uio->uio_segflg == UIO_USERSPACE) {
return (1);
}
return (0);
}

static inline void
zfs_uio_advance(zfs_uio_t *uio, size_t size)
{
Expand Down
2 changes: 1 addition & 1 deletion module/icp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ wdk_add_library(icpkern
spi/kcf_spi.c
)

target_link_libraries(icpkern PRIVATE splkern)
target_link_libraries(icpkern PRIVATE splkern PUBLIC ${ISAL})
target_include_directories(icpkern BEFORE PUBLIC "include")
12 changes: 12 additions & 0 deletions module/icp/include/modes/modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern "C" {
#include <sys/zfs_context.h>
#include <sys/crypto/common.h>
#include <sys/crypto/impl.h>
#include <sys/crypto/aes_gcm.h>

/*
* Does the build chain support all instructions needed for the GCM assembler
Expand Down Expand Up @@ -237,6 +238,16 @@ typedef struct gcm_ctx {
#endif
} gcm_ctx_t;

typedef struct gcm_ctx_avx {
struct gcm_key_data gkey;
struct gcm_context_data gctx;
} gcm_ctx_avx_t;

typedef enum avx_crypt_type {
DECRYPT,
ENCRYPT
} avx_crypt_type_t;

#define gcm_keysched gcm_common.cc_keysched
#define gcm_keysched_len gcm_common.cc_keysched_len
#define gcm_cb gcm_common.cc_iv
Expand All @@ -256,6 +267,7 @@ typedef struct aes_ctx {
ctr_ctx_t acu_ctr;
ccm_ctx_t acu_ccm;
gcm_ctx_t acu_gcm;
gcm_ctx_avx_t acu_gcm_avx;
} acu;
} aes_ctx_t;

Expand Down
Loading