powerpc/pseries: Use lparcfg to reconfig VAS windows for DLPAR CPU
The hypervisor assigns VAS (Virtual Accelerator Switchboard) windows depends on cores configured in LPAR. The kernel uses OF reconfig notifier to reconfig VAS windows for DLPAR CPU event. In the case of shared CPU mode partition, the hypervisor assigns VAS windows depends on CPU entitled capacity, not based on vcpus. When the user changes CPU entitled capacity for the partition, drmgr uses /proc/ppc64/lparcfg interface to notify the kernel. This patch adds the following changes to update VAS resources for shared mode: - Call vas reconfig windows from lparcfg_write() - Ignore reconfig changes in the VAS notifier Signed-off-by: Haren Myneni <haren@linux.ibm.com> [mpe: Rework error handling, report any errors as EIO] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/efa9c16e4a78dda4567a16f13dabfd73cb4674a2.camel@linux.ibm.com
This commit is contained in:
Родитель
89ed0b769d
Коммит
2147783d6b
|
@ -35,6 +35,7 @@
|
|||
#include <asm/drmem.h>
|
||||
|
||||
#include "pseries.h"
|
||||
#include "vas.h" /* pseries_vas_dlpar_cpu() */
|
||||
|
||||
/*
|
||||
* This isn't a module but we expose that to userspace
|
||||
|
@ -748,6 +749,16 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
|
|||
return -EINVAL;
|
||||
|
||||
retval = update_ppp(new_entitled_ptr, NULL);
|
||||
|
||||
if (retval == H_SUCCESS || retval == H_CONSTRAINED) {
|
||||
/*
|
||||
* The hypervisor assigns VAS resources based
|
||||
* on entitled capacity for shared mode.
|
||||
* Reconfig VAS windows based on DLPAR CPU events.
|
||||
*/
|
||||
if (pseries_vas_dlpar_cpu() != 0)
|
||||
retval = H_HARDWARE;
|
||||
}
|
||||
} else if (!strcmp(kbuf, "capacity_weight")) {
|
||||
char *endp;
|
||||
*new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
|
||||
|
|
|
@ -852,6 +852,25 @@ int vas_reconfig_capabilties(u8 type, int new_nr_creds)
|
|||
mutex_unlock(&vas_pseries_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int pseries_vas_dlpar_cpu(void)
|
||||
{
|
||||
int new_nr_creds, rc;
|
||||
|
||||
rc = h_query_vas_capabilities(H_QUERY_VAS_CAPABILITIES,
|
||||
vascaps[VAS_GZIP_DEF_FEAT_TYPE].feat,
|
||||
(u64)virt_to_phys(&hv_cop_caps));
|
||||
if (!rc) {
|
||||
new_nr_creds = be16_to_cpu(hv_cop_caps.target_lpar_creds);
|
||||
rc = vas_reconfig_capabilties(VAS_GZIP_DEF_FEAT_TYPE, new_nr_creds);
|
||||
}
|
||||
|
||||
if (rc)
|
||||
pr_err("Failed reconfig VAS capabilities with DLPAR\n");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Total number of default credits available (target_credits)
|
||||
* in LPAR depends on number of cores configured. It varies based on
|
||||
|
@ -866,7 +885,15 @@ static int pseries_vas_notifier(struct notifier_block *nb,
|
|||
struct of_reconfig_data *rd = data;
|
||||
struct device_node *dn = rd->dn;
|
||||
const __be32 *intserv = NULL;
|
||||
int new_nr_creds, len, rc = 0;
|
||||
int len;
|
||||
|
||||
/*
|
||||
* For shared CPU partition, the hypervisor assigns total credits
|
||||
* based on entitled core capacity. So updating VAS windows will
|
||||
* be called from lparcfg_write().
|
||||
*/
|
||||
if (is_shared_processor())
|
||||
return NOTIFY_OK;
|
||||
|
||||
if ((action == OF_RECONFIG_ATTACH_NODE) ||
|
||||
(action == OF_RECONFIG_DETACH_NODE))
|
||||
|
@ -878,19 +905,7 @@ static int pseries_vas_notifier(struct notifier_block *nb,
|
|||
if (!intserv)
|
||||
return NOTIFY_OK;
|
||||
|
||||
rc = h_query_vas_capabilities(H_QUERY_VAS_CAPABILITIES,
|
||||
vascaps[VAS_GZIP_DEF_FEAT_TYPE].feat,
|
||||
(u64)virt_to_phys(&hv_cop_caps));
|
||||
if (!rc) {
|
||||
new_nr_creds = be16_to_cpu(hv_cop_caps.target_lpar_creds);
|
||||
rc = vas_reconfig_capabilties(VAS_GZIP_DEF_FEAT_TYPE,
|
||||
new_nr_creds);
|
||||
}
|
||||
|
||||
if (rc)
|
||||
pr_err("Failed reconfig VAS capabilities with DLPAR\n");
|
||||
|
||||
return rc;
|
||||
return pseries_vas_dlpar_cpu();
|
||||
}
|
||||
|
||||
static struct notifier_block pseries_vas_nb = {
|
||||
|
|
|
@ -141,10 +141,15 @@ int __init sysfs_pseries_vas_init(struct vas_all_caps *vas_caps);
|
|||
|
||||
#ifdef CONFIG_PPC_VAS
|
||||
int vas_migration_handler(int action);
|
||||
int pseries_vas_dlpar_cpu(void);
|
||||
#else
|
||||
static inline int vas_migration_handler(int action)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int pseries_vas_dlpar_cpu(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* _VAS_H */
|
||||
|
|
Загрузка…
Ссылка в новой задаче