powerpc/pseries/vas: sysfs interface to export capabilities

The hypervisor provides the available VAS GZIP capabilities such
as default or QoS window type and the target available credits in
each type. This patch creates sysfs entries and exports the target,
used and the available credits for each feature.

This interface can be used by the user space to determine the credits
usage or to set the target credits in the case of QoS type (for DLPAR).

/sys/devices/vas/vas0/gzip/default_capabilities (default GZIP capabilities)
	nr_total_credits /* Total credits available. Can be
			 /* changed with DLPAR operation */
	nr_used_credits  /* Used credits */

/sys/devices/vas/vas0/gzip/qos_capabilities (QoS GZIP capabilities)
	nr_total_credits
	nr_used_credits

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/702d8b626ebfac2b52f4995eebeafe1c9a6fcb75.camel@linux.ibm.com
This commit is contained in:
Haren Myneni
2022-02-28 17:15:36 -08:00
committed by Michael Ellerman
parent c656cfe571
commit b903737bc5
4 changed files with 239 additions and 1 deletions

View File

@@ -560,6 +560,10 @@ static int __init get_vas_capabilities(u8 feat, enum vas_cop_feat_type type,
}
}
rc = sysfs_add_vas_caps(caps);
if (rc)
return rc;
copypaste_feat = true;
return 0;
@@ -844,6 +848,8 @@ static int __init pseries_vas_init(void)
caps_all.descriptor = be64_to_cpu(hv_caps->descriptor);
caps_all.feat_type = be64_to_cpu(hv_caps->feat_type);
sysfs_pseries_vas_init(&caps_all);
hv_cop_caps = kmalloc(sizeof(*hv_cop_caps), GFP_KERNEL);
if (!hv_cop_caps) {
rc = -ENOMEM;