powerpc/secvar: Handle max object size in the consumer

Currently the max object size is handled in the core secvar code with an
entirely OPAL-specific implementation, so create a new max_size() op and
move the existing implementation into the powernv platform.  Should be
no functional change.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230210080401.345462-9-ajd@linux.ibm.com
This commit is contained in:
Russell Currey
2023-02-10 19:03:43 +11:00
committed by Michael Ellerman
parent ec2f40bd00
commit e024079440
3 changed files with 26 additions and 14 deletions

View File

@@ -132,27 +132,16 @@ static struct kobj_type secvar_ktype = {
static int update_kobj_size(void)
{
struct device_node *node;
u64 varsize;
int rc = 0;
int rc = secvar_ops->max_size(&varsize);
node = of_find_compatible_node(NULL, NULL, "ibm,secvar-backend");
if (!of_device_is_available(node)) {
rc = -ENODEV;
goto out;
}
rc = of_property_read_u64(node, "max-var-size", &varsize);
if (rc)
goto out;
return rc;
data_attr.size = varsize;
update_attr.size = varsize;
out:
of_node_put(node);
return rc;
return 0;
}
static int secvar_sysfs_load(void)