1 /* adi_64.c: support for ADI (Application Data Integrity) feature on
2 * sparc m7 and newer processors. This feature is also known as
3 * SSM (Silicon Secured Memory).
5 * Copyright (C) 2016 Oracle and/or its affiliates. All rights reserved.
6 * Author: Khalid Aziz (khalid.aziz@oracle.com)
8 * This work is licensed under the terms of the GNU GPL, version 2.
10 #include <linux/init.h>
11 #include <asm/mdesc.h>
12 #include <asm/adi_64.h>
14 struct adi_config adi_state;
16 /* mdesc_adi_init() : Parse machine description provided by the
17 * hypervisor to detect ADI capabilities
19 * Hypervisor reports ADI capabilities of platform in "hwcap-list" property
20 * for "cpu" node. If the platform supports ADI, "hwcap-list" property
21 * contains the keyword "adp". If the platform supports ADI, "platform"
22 * node will contain "adp-blksz", "adp-nbits" and "ue-on-adp" properties
23 * to describe the ADI capabilities.
25 void __init mdesc_adi_init(void)
27 struct mdesc_handle *hp = mdesc_grab();
35 pn = mdesc_node_by_name(hp, MDESC_NODE_NULL, "cpu");
36 if (pn == MDESC_NODE_NULL)
39 prop = mdesc_get_property(hp, pn, "hwcap-list", &len);
44 * Look for "adp" keyword in hwcap-list which would indicate
47 adi_state.enabled = false;
51 if (!strcmp(prop, "adp")) {
52 adi_state.enabled = true;
56 plen = strlen(prop) + 1;
61 if (!adi_state.enabled)
64 /* Find the ADI properties in "platform" node. If all ADI
65 * properties are not found, ADI support is incomplete and
66 * do not enable ADI in the kernel.
68 pn = mdesc_node_by_name(hp, MDESC_NODE_NULL, "platform");
69 if (pn == MDESC_NODE_NULL)
72 val = (u64 *) mdesc_get_property(hp, pn, "adp-blksz", &len);
75 adi_state.caps.blksz = *val;
77 val = (u64 *) mdesc_get_property(hp, pn, "adp-nbits", &len);
80 adi_state.caps.nbits = *val;
82 val = (u64 *) mdesc_get_property(hp, pn, "ue-on-adp", &len);
85 adi_state.caps.ue_on_adi = *val;
91 adi_state.enabled = false;
92 adi_state.caps.blksz = 0;
93 adi_state.caps.nbits = 0;