All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haren Myneni <haren@linux.ibm.com>
To: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com
Subject: [PATCH v3 02/10] powerpc/pseries/vas: Add notifier for DLPAR core removal/add
Date: Fri, 21 Jan 2022 11:54:57 -0800	[thread overview]
Message-ID: <68ec2a354a932670fabd600a18eccbfcacd84464.camel@linux.ibm.com> (raw)
In-Reply-To: <7d175313528ea7aae20d9141f0efa2e57f44c9f4.camel@linux.ibm.com>


The hypervisor assigns credits for each LPAR based on number of
cores configured in that system. So expects to release credits
(means windows) when the core is removed. This patch adds notifier
for core removal/add so that the OS closes windows if the system
looses credits due to core removal and reopen windows when the
credits available later.

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/vas.c | 37 ++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c
index c0737379cc7b..d2c8292bfb33 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -538,6 +538,39 @@ static int __init get_vas_capabilities(u8 feat, enum vas_cop_feat_type type,
 	return 0;
 }
 
+/*
+ * Total number of default credits available (target_credits)
+ * in LPAR depends on number of cores configured. It varies based on
+ * whether processors are in shared mode or dedicated mode.
+ * Get the notifier when CPU configuration is changed with DLPAR
+ * operation so that get the new target_credits (vas default capabilities)
+ * and then update the existing windows usage if needed.
+ */
+static int pseries_vas_notifier(struct notifier_block *nb,
+				unsigned long action, void *data)
+{
+	struct of_reconfig_data *rd = data;
+	struct device_node *dn = rd->dn;
+	const __be32 *intserv = NULL;
+	int len, rc = 0;
+
+	if ((action == OF_RECONFIG_ATTACH_NODE) ||
+		(action == OF_RECONFIG_DETACH_NODE))
+		intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s",
+					  &len);
+	/*
+	 * Processor config is not changed
+	 */
+	if (!intserv)
+		return NOTIFY_OK;
+
+	return rc;
+}
+
+static struct notifier_block pseries_vas_nb = {
+	.notifier_call = pseries_vas_notifier,
+};
+
 static int __init pseries_vas_init(void)
 {
 	struct hv_vas_cop_feat_caps *hv_cop_caps;
@@ -591,6 +624,10 @@ static int __init pseries_vas_init(void)
 			goto out_cop;
 	}
 
+	/* Processors can be added/removed only on LPAR */
+	if (copypaste_feat && firmware_has_feature(FW_FEATURE_LPAR))
+		of_reconfig_notifier_register(&pseries_vas_nb);
+
 	pr_info("GZIP feature is available\n");
 
 out_cop:
-- 
2.27.0



  parent reply	other threads:[~2022-01-21 19:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 19:52 [PATCH v3 00/10] powerpc/pseries/vas: NXGZIP support with DLPAR Haren Myneni
2022-01-21 19:54 ` [PATCH v3 01/10] powerpc/pseries/vas: Use common names in VAS capability structure Haren Myneni
2022-02-14  2:14   ` Nicholas Piggin
2022-02-15 18:32     ` Haren Myneni
2022-01-21 19:54 ` Haren Myneni [this message]
2022-02-14  2:27   ` [PATCH v3 02/10] powerpc/pseries/vas: Add notifier for DLPAR core removal/add Nicholas Piggin
2022-02-16  1:07     ` Haren Myneni
2022-01-21 19:55 ` [PATCH v3 03/10] powerpc/pseries/vas: Save LPID in pseries_vas_window struct Haren Myneni
2022-02-14  2:41   ` Nicholas Piggin
2022-02-16  1:09     ` Haren Myneni
2022-01-21 19:56 ` [PATCH v3 04/10] powerpc/pseries/vas: Reopen windows with DLPAR core add Haren Myneni
2022-02-14  3:08   ` Nicholas Piggin
2022-02-16  1:38     ` Haren Myneni
2022-01-21 19:57 ` [PATCH v3 05/10] powerpc/pseries/vas: Close windows with DLPAR core removal Haren Myneni
2022-02-14  3:17   ` Nicholas Piggin
2022-02-16  1:48     ` Haren Myneni
2022-01-21 19:58 ` [PATCH v3 06/10] powerpc/vas: Map paste address only if window is active Haren Myneni
2022-02-14  3:20   ` Nicholas Piggin
2022-02-16  1:58     ` Haren Myneni
2022-01-21 19:59 ` [PATCH v3 07/10] powerpc/vas: Add paste address mmap fault handler Haren Myneni
2022-02-14  3:37   ` Nicholas Piggin
2022-02-16  2:21     ` Haren Myneni
2022-01-21 19:59 ` [PATCH v3 08/10] powerpc/vas: Return paste instruction failure if no active window Haren Myneni
2022-02-14  3:41   ` Nicholas Piggin
2022-01-21 20:00 ` [PATCH v3 09/10] powerpc/pseries/vas: sysfs interface to export capabilities Haren Myneni
2022-02-14  3:49   ` Nicholas Piggin
2022-01-21 20:01 ` [PATCH v3 10/10] powerpc/pseries/vas: Write 'target_creds' for QoS credits change Haren Myneni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68ec2a354a932670fabd600a18eccbfcacd84464.camel@linux.ibm.com \
    --to=haren@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.