Commit ee518148 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fixes from Heiko Carstens:

 - fix reference counting for ap devices

 - fix paes selftest

 - fix pmd_deref()/pud_deref() so they can also handle large pages

 - remove unused vdso file and defines

 - update defconfigs

 - call rcu_cpu_starting() early in smp init code to avoid lockdep
   warnings

 - fix hotplug of PCI function missing bus

* tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/pci: fix hot-plug of PCI function missing bus
  s390/smp: move rcu_cpu_starting() earlier
  s390/pkey: fix paes selftest failure with paes and pkey static build
  s390: update defconfigs
  s390/vdso: remove unused constants
  s390/vdso: remove empty unused file
  s390/mm: make pmd/pud_deref() large page aware
  s390/ap: fix ap devices reference counting
parents 41f16530 0b2ca2c7
...@@ -93,9 +93,10 @@ CONFIG_CLEANCACHE=y ...@@ -93,9 +93,10 @@ CONFIG_CLEANCACHE=y
CONFIG_FRONTSWAP=y CONFIG_FRONTSWAP=y
CONFIG_CMA_DEBUG=y CONFIG_CMA_DEBUG=y
CONFIG_CMA_DEBUGFS=y CONFIG_CMA_DEBUGFS=y
CONFIG_CMA_AREAS=7
CONFIG_MEM_SOFT_DIRTY=y CONFIG_MEM_SOFT_DIRTY=y
CONFIG_ZSWAP=y CONFIG_ZSWAP=y
CONFIG_ZSMALLOC=m CONFIG_ZSMALLOC=y
CONFIG_ZSMALLOC_STAT=y CONFIG_ZSMALLOC_STAT=y
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
CONFIG_IDLE_PAGE_TRACKING=y CONFIG_IDLE_PAGE_TRACKING=y
...@@ -378,7 +379,6 @@ CONFIG_NETLINK_DIAG=m ...@@ -378,7 +379,6 @@ CONFIG_NETLINK_DIAG=m
CONFIG_CGROUP_NET_PRIO=y CONFIG_CGROUP_NET_PRIO=y
CONFIG_BPF_JIT=y CONFIG_BPF_JIT=y
CONFIG_NET_PKTGEN=m CONFIG_NET_PKTGEN=m
# CONFIG_NET_DROP_MONITOR is not set
CONFIG_PCI=y CONFIG_PCI=y
# CONFIG_PCIEASPM is not set # CONFIG_PCIEASPM is not set
CONFIG_PCI_DEBUG=y CONFIG_PCI_DEBUG=y
...@@ -386,7 +386,7 @@ CONFIG_HOTPLUG_PCI=y ...@@ -386,7 +386,7 @@ CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_S390=y CONFIG_HOTPLUG_PCI_S390=y
CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS=y
CONFIG_CONNECTOR=y CONFIG_CONNECTOR=y
CONFIG_ZRAM=m CONFIG_ZRAM=y
CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_CRYPTOLOOP=m
CONFIG_BLK_DEV_DRBD=m CONFIG_BLK_DEV_DRBD=m
...@@ -689,6 +689,7 @@ CONFIG_CRYPTO_TEST=m ...@@ -689,6 +689,7 @@ CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_DH=m
CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDH=m
CONFIG_CRYPTO_ECRDSA=m CONFIG_CRYPTO_ECRDSA=m
CONFIG_CRYPTO_SM2=m
CONFIG_CRYPTO_CURVE25519=m CONFIG_CRYPTO_CURVE25519=m
CONFIG_CRYPTO_GCM=y CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_CHACHA20POLY1305=m CONFIG_CRYPTO_CHACHA20POLY1305=m
...@@ -709,7 +710,6 @@ CONFIG_CRYPTO_RMD160=m ...@@ -709,7 +710,6 @@ CONFIG_CRYPTO_RMD160=m
CONFIG_CRYPTO_RMD256=m CONFIG_CRYPTO_RMD256=m
CONFIG_CRYPTO_RMD320=m CONFIG_CRYPTO_RMD320=m
CONFIG_CRYPTO_SHA3=m CONFIG_CRYPTO_SHA3=m
CONFIG_CRYPTO_SM3=m
CONFIG_CRYPTO_TGR192=m CONFIG_CRYPTO_TGR192=m
CONFIG_CRYPTO_WP512=m CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_AES_TI=m CONFIG_CRYPTO_AES_TI=m
...@@ -753,6 +753,7 @@ CONFIG_CRYPTO_DES_S390=m ...@@ -753,6 +753,7 @@ CONFIG_CRYPTO_DES_S390=m
CONFIG_CRYPTO_AES_S390=m CONFIG_CRYPTO_AES_S390=m
CONFIG_CRYPTO_GHASH_S390=m CONFIG_CRYPTO_GHASH_S390=m
CONFIG_CRYPTO_CRC32_S390=y CONFIG_CRYPTO_CRC32_S390=y
CONFIG_CRYPTO_DEV_VIRTIO=m
CONFIG_CORDIC=m CONFIG_CORDIC=m
CONFIG_CRC32_SELFTEST=y CONFIG_CRC32_SELFTEST=y
CONFIG_CRC4=m CONFIG_CRC4=m
...@@ -829,6 +830,7 @@ CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m ...@@ -829,6 +830,7 @@ CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
CONFIG_FAULT_INJECTION=y CONFIG_FAULT_INJECTION=y
CONFIG_FAILSLAB=y CONFIG_FAILSLAB=y
CONFIG_FAIL_PAGE_ALLOC=y CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAULT_INJECTION_USERCOPY=y
CONFIG_FAIL_MAKE_REQUEST=y CONFIG_FAIL_MAKE_REQUEST=y
CONFIG_FAIL_IO_TIMEOUT=y CONFIG_FAIL_IO_TIMEOUT=y
CONFIG_FAIL_FUTEX=y CONFIG_FAIL_FUTEX=y
......
...@@ -87,9 +87,10 @@ CONFIG_KSM=y ...@@ -87,9 +87,10 @@ CONFIG_KSM=y
CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CLEANCACHE=y CONFIG_CLEANCACHE=y
CONFIG_FRONTSWAP=y CONFIG_FRONTSWAP=y
CONFIG_CMA_AREAS=7
CONFIG_MEM_SOFT_DIRTY=y CONFIG_MEM_SOFT_DIRTY=y
CONFIG_ZSWAP=y CONFIG_ZSWAP=y
CONFIG_ZSMALLOC=m CONFIG_ZSMALLOC=y
CONFIG_ZSMALLOC_STAT=y CONFIG_ZSMALLOC_STAT=y
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
CONFIG_IDLE_PAGE_TRACKING=y CONFIG_IDLE_PAGE_TRACKING=y
...@@ -371,7 +372,6 @@ CONFIG_NETLINK_DIAG=m ...@@ -371,7 +372,6 @@ CONFIG_NETLINK_DIAG=m
CONFIG_CGROUP_NET_PRIO=y CONFIG_CGROUP_NET_PRIO=y
CONFIG_BPF_JIT=y CONFIG_BPF_JIT=y
CONFIG_NET_PKTGEN=m CONFIG_NET_PKTGEN=m
# CONFIG_NET_DROP_MONITOR is not set
CONFIG_PCI=y CONFIG_PCI=y
# CONFIG_PCIEASPM is not set # CONFIG_PCIEASPM is not set
CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI=y
...@@ -379,7 +379,7 @@ CONFIG_HOTPLUG_PCI_S390=y ...@@ -379,7 +379,7 @@ CONFIG_HOTPLUG_PCI_S390=y
CONFIG_UEVENT_HELPER=y CONFIG_UEVENT_HELPER=y
CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS=y
CONFIG_CONNECTOR=y CONFIG_CONNECTOR=y
CONFIG_ZRAM=m CONFIG_ZRAM=y
CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_CRYPTOLOOP=m
CONFIG_BLK_DEV_DRBD=m CONFIG_BLK_DEV_DRBD=m
...@@ -680,6 +680,7 @@ CONFIG_CRYPTO_TEST=m ...@@ -680,6 +680,7 @@ CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_DH=m
CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDH=m
CONFIG_CRYPTO_ECRDSA=m CONFIG_CRYPTO_ECRDSA=m
CONFIG_CRYPTO_SM2=m
CONFIG_CRYPTO_CURVE25519=m CONFIG_CRYPTO_CURVE25519=m
CONFIG_CRYPTO_GCM=y CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_CHACHA20POLY1305=m CONFIG_CRYPTO_CHACHA20POLY1305=m
...@@ -701,7 +702,6 @@ CONFIG_CRYPTO_RMD160=m ...@@ -701,7 +702,6 @@ CONFIG_CRYPTO_RMD160=m
CONFIG_CRYPTO_RMD256=m CONFIG_CRYPTO_RMD256=m
CONFIG_CRYPTO_RMD320=m CONFIG_CRYPTO_RMD320=m
CONFIG_CRYPTO_SHA3=m CONFIG_CRYPTO_SHA3=m
CONFIG_CRYPTO_SM3=m
CONFIG_CRYPTO_TGR192=m CONFIG_CRYPTO_TGR192=m
CONFIG_CRYPTO_WP512=m CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_AES_TI=m CONFIG_CRYPTO_AES_TI=m
...@@ -745,6 +745,7 @@ CONFIG_CRYPTO_DES_S390=m ...@@ -745,6 +745,7 @@ CONFIG_CRYPTO_DES_S390=m
CONFIG_CRYPTO_AES_S390=m CONFIG_CRYPTO_AES_S390=m
CONFIG_CRYPTO_GHASH_S390=m CONFIG_CRYPTO_GHASH_S390=m
CONFIG_CRYPTO_CRC32_S390=y CONFIG_CRYPTO_CRC32_S390=y
CONFIG_CRYPTO_DEV_VIRTIO=m
CONFIG_CORDIC=m CONFIG_CORDIC=m
CONFIG_PRIME_NUMBERS=m CONFIG_PRIME_NUMBERS=m
CONFIG_CRC4=m CONFIG_CRC4=m
......
...@@ -17,11 +17,11 @@ CONFIG_HZ_100=y ...@@ -17,11 +17,11 @@ CONFIG_HZ_100=y
# CONFIG_CHSC_SCH is not set # CONFIG_CHSC_SCH is not set
# CONFIG_SCM_BUS is not set # CONFIG_SCM_BUS is not set
CONFIG_CRASH_DUMP=y CONFIG_CRASH_DUMP=y
# CONFIG_SECCOMP is not set
# CONFIG_PFAULT is not set # CONFIG_PFAULT is not set
# CONFIG_S390_HYPFS_FS is not set # CONFIG_S390_HYPFS_FS is not set
# CONFIG_VIRTUALIZATION is not set # CONFIG_VIRTUALIZATION is not set
# CONFIG_S390_GUEST is not set # CONFIG_S390_GUEST is not set
# CONFIG_SECCOMP is not set
CONFIG_PARTITION_ADVANCED=y CONFIG_PARTITION_ADVANCED=y
CONFIG_IBM_PARTITION=y CONFIG_IBM_PARTITION=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
......
...@@ -692,16 +692,6 @@ static inline int pud_large(pud_t pud) ...@@ -692,16 +692,6 @@ static inline int pud_large(pud_t pud)
return !!(pud_val(pud) & _REGION3_ENTRY_LARGE); return !!(pud_val(pud) & _REGION3_ENTRY_LARGE);
} }
static inline unsigned long pud_pfn(pud_t pud)
{
unsigned long origin_mask;
origin_mask = _REGION_ENTRY_ORIGIN;
if (pud_large(pud))
origin_mask = _REGION3_ENTRY_ORIGIN_LARGE;
return (pud_val(pud) & origin_mask) >> PAGE_SHIFT;
}
#define pmd_leaf pmd_large #define pmd_leaf pmd_large
static inline int pmd_large(pmd_t pmd) static inline int pmd_large(pmd_t pmd)
{ {
...@@ -747,16 +737,6 @@ static inline int pmd_none(pmd_t pmd) ...@@ -747,16 +737,6 @@ static inline int pmd_none(pmd_t pmd)
return pmd_val(pmd) == _SEGMENT_ENTRY_EMPTY; return pmd_val(pmd) == _SEGMENT_ENTRY_EMPTY;
} }
static inline unsigned long pmd_pfn(pmd_t pmd)
{
unsigned long origin_mask;
origin_mask = _SEGMENT_ENTRY_ORIGIN;
if (pmd_large(pmd))
origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT;
}
#define pmd_write pmd_write #define pmd_write pmd_write
static inline int pmd_write(pmd_t pmd) static inline int pmd_write(pmd_t pmd)
{ {
...@@ -1238,11 +1218,39 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) ...@@ -1238,11 +1218,39 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
#define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN)
#define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN) #define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN)
#define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN)
static inline unsigned long pmd_deref(pmd_t pmd)
{
unsigned long origin_mask;
origin_mask = _SEGMENT_ENTRY_ORIGIN;
if (pmd_large(pmd))
origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
return pmd_val(pmd) & origin_mask;
}
static inline unsigned long pmd_pfn(pmd_t pmd)
{
return pmd_deref(pmd) >> PAGE_SHIFT;
}
static inline unsigned long pud_deref(pud_t pud)
{
unsigned long origin_mask;
origin_mask = _REGION_ENTRY_ORIGIN;
if (pud_large(pud))
origin_mask = _REGION3_ENTRY_ORIGIN_LARGE;
return pud_val(pud) & origin_mask;
}
static inline unsigned long pud_pfn(pud_t pud)
{
return pud_deref(pud) >> PAGE_SHIFT;
}
/* /*
* The pgd_offset function *always* adds the index for the top-level * The pgd_offset function *always* adds the index for the top-level
* region/segment table. This is done to get a sequence like the * region/segment table. This is done to get a sequence like the
......
...@@ -61,14 +61,6 @@ int main(void) ...@@ -61,14 +61,6 @@ int main(void)
BLANK(); BLANK();
OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val); OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val);
BLANK(); BLANK();
/* constants used by the vdso */
DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC);
BLANK();
/* idle data offsets */ /* idle data offsets */
OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter); OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter);
OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit); OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit);
......
...@@ -855,13 +855,14 @@ void __init smp_detect_cpus(void) ...@@ -855,13 +855,14 @@ void __init smp_detect_cpus(void)
static void smp_init_secondary(void) static void smp_init_secondary(void)
{ {
int cpu = smp_processor_id(); int cpu = raw_smp_processor_id();
S390_lowcore.last_update_clock = get_tod_clock(); S390_lowcore.last_update_clock = get_tod_clock();
restore_access_regs(S390_lowcore.access_regs_save_area); restore_access_regs(S390_lowcore.access_regs_save_area);
set_cpu_flag(CIF_ASCE_PRIMARY); set_cpu_flag(CIF_ASCE_PRIMARY);
set_cpu_flag(CIF_ASCE_SECONDARY); set_cpu_flag(CIF_ASCE_SECONDARY);
cpu_init(); cpu_init();
rcu_cpu_starting(cpu);
preempt_disable(); preempt_disable();
init_cpu_timer(); init_cpu_timer();
vtime_init(); vtime_init();
......
...@@ -101,6 +101,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) ...@@ -101,6 +101,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
if (ret) if (ret)
break; break;
/* the PCI function will be scanned once function 0 appears */
if (!zdev->zbus->bus)
break;
pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
if (!pdev) if (!pdev)
break; break;
......
...@@ -680,7 +680,10 @@ static int ap_device_probe(struct device *dev) ...@@ -680,7 +680,10 @@ static int ap_device_probe(struct device *dev)
{ {
struct ap_device *ap_dev = to_ap_dev(dev); struct ap_device *ap_dev = to_ap_dev(dev);
struct ap_driver *ap_drv = to_ap_drv(dev->driver); struct ap_driver *ap_drv = to_ap_drv(dev->driver);
int card, queue, devres, drvres, rc; int card, queue, devres, drvres, rc = -ENODEV;
if (!get_device(dev))
return rc;
if (is_queue_dev(dev)) { if (is_queue_dev(dev)) {
/* /*
...@@ -697,7 +700,7 @@ static int ap_device_probe(struct device *dev) ...@@ -697,7 +700,7 @@ static int ap_device_probe(struct device *dev)
mutex_unlock(&ap_perms_mutex); mutex_unlock(&ap_perms_mutex);
drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT;
if (!!devres != !!drvres) if (!!devres != !!drvres)
return -ENODEV; goto out;
} }
/* Add queue/card to list of active queues/cards */ /* Add queue/card to list of active queues/cards */
...@@ -718,6 +721,9 @@ static int ap_device_probe(struct device *dev) ...@@ -718,6 +721,9 @@ static int ap_device_probe(struct device *dev)
ap_dev->drv = NULL; ap_dev->drv = NULL;
} }
out:
if (rc)
put_device(dev);
return rc; return rc;
} }
...@@ -744,6 +750,8 @@ static int ap_device_remove(struct device *dev) ...@@ -744,6 +750,8 @@ static int ap_device_remove(struct device *dev)
hash_del(&to_ap_queue(dev)->hnode); hash_del(&to_ap_queue(dev)->hnode);
spin_unlock_bh(&ap_queues_lock); spin_unlock_bh(&ap_queues_lock);
put_device(dev);
return 0; return 0;
} }
...@@ -1371,6 +1379,8 @@ static inline void ap_scan_domains(struct ap_card *ac) ...@@ -1371,6 +1379,8 @@ static inline void ap_scan_domains(struct ap_card *ac)
__func__, ac->id, dom); __func__, ac->id, dom);
goto put_dev_and_continue; goto put_dev_and_continue;
} }
/* get it and thus adjust reference counter */
get_device(dev);
if (decfg) if (decfg)
AP_DBF_INFO("%s(%d,%d) new (decfg) queue device created\n", AP_DBF_INFO("%s(%d,%d) new (decfg) queue device created\n",
__func__, ac->id, dom); __func__, ac->id, dom);
......
...@@ -35,9 +35,6 @@ MODULE_DESCRIPTION("s390 protected key interface"); ...@@ -35,9 +35,6 @@ MODULE_DESCRIPTION("s390 protected key interface");
#define PROTKEYBLOBBUFSIZE 256 /* protected key buffer size used internal */ #define PROTKEYBLOBBUFSIZE 256 /* protected key buffer size used internal */
#define MAXAPQNSINLIST 64 /* max 64 apqns within a apqn list */ #define MAXAPQNSINLIST 64 /* max 64 apqns within a apqn list */
/* mask of available pckmo subfunctions, fetched once at module init */
static cpacf_mask_t pckmo_functions;
/* /*
* debug feature data and functions * debug feature data and functions
*/ */
...@@ -91,6 +88,9 @@ static int pkey_clr2protkey(u32 keytype, ...@@ -91,6 +88,9 @@ static int pkey_clr2protkey(u32 keytype,
const struct pkey_clrkey *clrkey, const struct pkey_clrkey *clrkey,
struct pkey_protkey *protkey) struct pkey_protkey *protkey)
{ {
/* mask of available pckmo subfunctions */
static cpacf_mask_t pckmo_functions;
long fc; long fc;
int keysize; int keysize;
u8 paramblock[64]; u8 paramblock[64];
...@@ -114,11 +114,13 @@ static int pkey_clr2protkey(u32 keytype, ...@@ -114,11 +114,13 @@ static int pkey_clr2protkey(u32 keytype,
return -EINVAL; return -EINVAL;
} }
/* /* Did we already check for PCKMO ? */
* Check if the needed pckmo subfunction is available. if (!pckmo_functions.bytes[0]) {
* These subfunctions can be enabled/disabled by customers /* no, so check now */
* in the LPAR profile or may even change on the fly. if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
*/ return -ENODEV;
}
/* check for the pckmo subfunction we need now */
if (!cpacf_test_func(&pckmo_functions, fc)) { if (!cpacf_test_func(&pckmo_functions, fc)) {
DEBUG_ERR("%s pckmo functions not available\n", __func__); DEBUG_ERR("%s pckmo functions not available\n", __func__);
return -ENODEV; return -ENODEV;
...@@ -2058,7 +2060,7 @@ static struct miscdevice pkey_dev = { ...@@ -2058,7 +2060,7 @@ static struct miscdevice pkey_dev = {
*/ */
static int __init pkey_init(void) static int __init pkey_init(void)
{ {
cpacf_mask_t kmc_functions; cpacf_mask_t func_mask;
/* /*
* The pckmo instruction should be available - even if we don't * The pckmo instruction should be available - even if we don't
...@@ -2066,15 +2068,15 @@ static int __init pkey_init(void) ...@@ -2066,15 +2068,15 @@ static int __init pkey_init(void)
* is also the minimum level for the kmc instructions which * is also the minimum level for the kmc instructions which
* are able to work with protected keys. * are able to work with protected keys.
*/ */
if (!cpacf_query(CPACF_PCKMO, &pckmo_functions)) if (!cpacf_query(CPACF_PCKMO, &func_mask))
return -ENODEV; return -ENODEV;
/* check for kmc instructions available */ /* check for kmc instructions available */
if (!cpacf_query(CPACF_KMC, &kmc_functions)) if (!cpacf_query(CPACF_KMC, &func_mask))
return -ENODEV; return -ENODEV;
if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) || if (!cpacf_test_func(&func_mask, CPACF_KMC_PAES_128) ||
!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) || !cpacf_test_func(&func_mask, CPACF_KMC_PAES_192) ||
!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256)) !cpacf_test_func(&func_mask, CPACF_KMC_PAES_256))
return -ENODEV; return -ENODEV;
pkey_debug_init(); pkey_debug_init();
......
...@@ -157,11 +157,6 @@ int zcrypt_card_register(struct zcrypt_card *zc) ...@@ -157,11 +157,6 @@ int zcrypt_card_register(struct zcrypt_card *zc)
{ {
int rc; int rc;
rc = sysfs_create_group(&zc->card->ap_dev.device.kobj,
&zcrypt_card_attr_group);
if (rc)
return rc;
spin_lock(&zcrypt_list_lock); spin_lock(&zcrypt_list_lock);
list_add_tail(&zc->list, &zcrypt_card_list); list_add_tail(&zc->list, &zcrypt_card_list);
spin_unlock(&zcrypt_list_lock); spin_unlock(&zcrypt_list_lock);
...@@ -170,6 +165,14 @@ int zcrypt_card_register(struct zcrypt_card *zc) ...@@ -170,6 +165,14 @@ int zcrypt_card_register(struct zcrypt_card *zc)
ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id); ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id);
rc = sysfs_create_group(&zc->card->ap_dev.device.kobj,
&zcrypt_card_attr_group);
if (rc) {
spin_lock(&zcrypt_list_lock);
list_del_init(&zc->list);
spin_unlock(&zcrypt_list_lock);
}
return rc; return rc;
} }
EXPORT_SYMBOL(zcrypt_card_register); EXPORT_SYMBOL(zcrypt_card_register);
......
...@@ -180,7 +180,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) ...@@ -180,7 +180,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq)
&zcrypt_queue_attr_group); &zcrypt_queue_attr_group);
if (rc) if (rc)
goto out; goto out;
get_device(&zq->queue->ap_dev.device);
if (zq->ops->rng) { if (zq->ops->rng) {
rc = zcrypt_rng_device_add(); rc = zcrypt_rng_device_add();
...@@ -192,7 +191,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) ...@@ -192,7 +191,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq)
out_unregister: out_unregister:
sysfs_remove_group(&zq->queue->ap_dev.device.kobj, sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
&zcrypt_queue_attr_group); &zcrypt_queue_attr_group);
put_device(&zq->queue->ap_dev.device);
out: out:
spin_lock(&zcrypt_list_lock); spin_lock(&zcrypt_list_lock);
list_del_init(&zq->list); list_del_init(&zq->list);
...@@ -220,12 +218,10 @@ void zcrypt_queue_unregister(struct zcrypt_queue *zq) ...@@ -220,12 +218,10 @@ void zcrypt_queue_unregister(struct zcrypt_queue *zq)
list_del_init(&zq->list); list_del_init(&zq->list);
zcrypt_device_count--; zcrypt_device_count--;
spin_unlock(&zcrypt_list_lock); spin_unlock(&zcrypt_list_lock);
zcrypt_card_put(zc);
if (zq->ops->rng) if (zq->ops->rng)
zcrypt_rng_device_remove(); zcrypt_rng_device_remove();
sysfs_remove_group(&zq->queue->ap_dev.device.kobj, sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
&zcrypt_queue_attr_group); &zcrypt_queue_attr_group);
put_device(&zq->queue->ap_dev.device); zcrypt_card_put(zc);
zcrypt_queue_put(zq);
} }
EXPORT_SYMBOL(zcrypt_queue_unregister); EXPORT_SYMBOL(zcrypt_queue_unregister);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment