/****************************************************************************** * Arch-specific sysctl.c * * System management operations. For use by node control stack. * * Copyright (c) 2002-2006, K Fraser */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) static long cpu_down_helper(void *data) { int cpu = (unsigned long)data; return cpu_down(cpu); } extern int __node_distance(int a, int b); long arch_do_sysctl( struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) { long ret = 0, status; switch ( sysctl->cmd ) { case XEN_SYSCTL_physinfo: { xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo; ret = xsm_physinfo(); if ( ret ) break; memset(pi, 0, sizeof(*pi)); pi->threads_per_core = cpus_weight(per_cpu(cpu_sibling_map, 0)); pi->cores_per_socket = cpus_weight(per_cpu(cpu_core_map, 0)) / pi->threads_per_core; pi->nr_cpus = num_online_cpus(); pi->nr_nodes = num_online_nodes(); pi->max_node_id = last_node(node_online_map); pi->max_cpu_id = last_cpu(cpu_online_map); pi->total_pages = total_pages; pi->free_pages = avail_domheap_pages(); pi->scrub_pages = 0; pi->cpu_khz = cpu_khz; memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4); if ( hvm_enabled ) pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm; if ( iommu_enabled ) pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio; if ( copy_to_guest(u_sysctl, sysctl, 1) ) ret = -EFAULT; } break; case XEN_SYSCTL_topologyinfo: { uint32_t i, max_cpu_index, last_online_cpu; xen_sysctl_topologyinfo_t *ti = &sysctl->u.topologyinfo; last_online_cpu = last_cpu(cpu_online_map); max_cpu_index = min_t(uint32_t, ti->max_cpu_index, last_online_cpu); ti->max_cpu_index = last_online_cpu; for ( i = 0; i <= max_cpu_index; i++ ) { if ( !guest_handle_is_null(ti->cpu_to_core) ) { uint32_t core = cpu_online(i) ? cpu_to_core(i) : ~0u; if ( copy_to_guest_offset(ti->cpu_to_core, i, &core, 1) ) break; } if ( !guest_handle_is_null(ti->cpu_to_socket) ) { uint32_t socket = cpu_online(i) ? cpu_to_socket(i) : ~0u; if ( copy_to_guest_offset(ti->cpu_to_socket, i, &socket, 1) ) break; } if ( !guest_handle_is_null(ti->cpu_to_node) ) { uint32_t node = cpu_online(i) ? cpu_to_node(i) : ~0u; if ( copy_to_guest_offset(ti->cpu_to_node, i, &node, 1) ) break; } } ret = ((i <= max_cpu_index) || copy_to_guest(u_sysctl, sysctl, 1)) ? -EFAULT : 0; } break; case XEN_SYSCTL_numainfo: { uint32_t i, j, max_node_index, last_online_node; xen_sysctl_numainfo_t *ni = &sysctl->u.numainfo; last_online_node = last_node(node_online_map); max_node_index = min_t(uint32_t, ni->max_node_index, last_online_node); ni->max_node_index = last_online_node; for ( i = 0; i <= max_node_index; i++ ) { if ( !guest_handle_is_null(ni->node_to_memsize) ) { uint64_t memsize = node_online(i) ? node_spanned_pages(i) << PAGE_SHIFT : 0ul; if ( copy_to_guest_offset(ni->node_to_memsize, i, &memsize, 1) ) break; } if ( !guest_handle_is_null(ni->node_to_memfree) ) { uint64_t memfree = node_online(i) ? avail_node_heap_pages(i) << PAGE_SHIFT : 0ul; if ( copy_to_guest_offset(ni->node_to_memfree, i, &memfree, 1) ) break; } if ( !guest_handle_is_null(ni->node_to_node_distance) ) { for ( j = 0; j <= max_node_index; j++) { uint32_t distance = ~0u; if ( node_online(i) && node_online(j) ) distance = __node_distance(i, j); if ( copy_to_guest_offset( ni->node_to_node_distance, i*(max_node_index+1) + j, &distance, 1) ) break; } if ( j <= max_node_index ) break; } } ret = ((i <= max_node_index) || copy_to_guest(u_sysctl, sysctl, 1)) ? -EFAULT : 0; } break; case XEN_SYSCTL_cpu_hotplug: { unsigned int cpu = sysctl->u.cpu_hotplug.cpu; if (cpu_present(cpu)) { status = cpu_online(cpu) ? XEN_CPU_HOTPLUG_STATUS_ONLINE : XEN_CPU_HOTPLUG_STATUS_OFFLINE; } else { status = -EINVAL; } switch ( sysctl->u.cpu_hotplug.op ) { case XEN_SYSCTL_CPU_HOTPLUG_ONLINE: ret = cpu_up(cpu); /*
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=cryptodev-linux
PKG_VERSION:=1.10
PKG_RELEASE:=1

PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=833ab7c5c88d2b700a7c702a151254c089a3058886a63cc7d12630e364b8ea83
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>

PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define KernelPackage/cryptodev
  SUBMENU:=Cryptographic API modules
  DEFAULT:=m if ALL
  TITLE:=Driver for cryptographic acceleration
  URL:=http://cryptodev-linux.org/
  VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
  DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash
  FILES:=$(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX)
  AUTOLOAD:=$(call AutoLoad,50,cryptodev)
  MODPARAMS.cryptodev:=cryptodev_verbosity=-1
endef

define KernelPackage/cryptodev/description
  This is a driver for that allows to use the Linux kernel supported
  hardware ciphers by user-space applications.
endef

define Build/Configure
endef

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR) \
		$(KERNEL_MAKE_FLAGS) \
		KERNEL_DIR="$(LINUX_DIR)"
endef

define Build/InstallDev
	$(INSTALL_DIR) $(STAGING_DIR)/usr/include/crypto
	$(CP) $(PKG_BUILD_DIR)/crypto/cryptodev.h $(STAGING_DIR)/usr/include/crypto/
endef

$(eval $(call KernelPackage,cryptodev))