From nobody Mon Nov 17 01:31:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1602239465; cv=none; d=zohomail.com; s=zohoarc; b=gVkzbS6V5a9UIkijq3RvRsz0mJgHztvmDPimgBehufxPQ1tZzoazAI55p2KgY5nuE4x8VUilUY25t/EQ5i7xAIEmUYap4rxgBJ4Lzz28/I5kfaIrNaFJsyJ2qyXPI/1h7LEy08Li9jrI9OnBu3KWxkK/VKjpD24mFRAXyKNBSu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602239465; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cfCWc+dLaMwL49OgvWid6+pfTkRvfjFhBbdhRDUv9yo=; b=JS+taI+j6EHyHzRyS+YHSvt9IY6vbmxoeD/HHn6jCMKukaSJA8nZaFJZZkm8myqMHKrMk2pjfopKW4ILjxrawW/tjKfmRWWtRRSuJDnvg5uf3Uz2cfT0ZfnYNPV7WfkSgM300ptCjxbpYG0BMKcjmPvvqibvLGXWX2i9wDLvyaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602239465197110.90489203759887; Fri, 9 Oct 2020 03:31:05 -0700 (PDT) Received: from localhost ([::1]:41172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQpfz-00080o-N1 for importer@patchew.org; Fri, 09 Oct 2020 06:31:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQpVa-0005OG-PJ for qemu-devel@nongnu.org; Fri, 09 Oct 2020 06:20:18 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:34035 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQpVX-0001oO-VR for qemu-devel@nongnu.org; Fri, 09 Oct 2020 06:20:18 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4C73wd31h7z9sWV; Fri, 9 Oct 2020 21:20:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1602238801; bh=uCDy2eT032X0jjKEb/Bj7R46DtU4RECqXdUasI0Wcpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RX1FLq17ecaRylhVulE6gkOyDBnJVeo3XD0CsemeEJUC9nae6b407FEx2819rfe+w LVkvTBbKqX/bNZwE4/2aHeoMeln1LVa3jLVlEUtjDW5Qr9vWBO6LDZLbNLAiq/wNpz R06/8dr5IdCygs01uJBcfJilhHHGO9yC53svugOk= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 18/20] spapr_numa: change reference-points and maxdomain settings Date: Fri, 9 Oct 2020 21:19:49 +1100 Message-Id: <20201009101951.1569252-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009101951.1569252-1-david@gibson.dropbear.id.au> References: <20201009101951.1569252-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dbarboza@redhat.com, Daniel Henrique Barboza , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nonngu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza This is the first guest visible change introduced in spapr_numa.c. The previous settings of both reference-points and maxdomains were too restrictive, but enough for the existing associativity we're setting in the resources. We'll change that in the following patches, populating the associativity arrays based on user input. For those changes to be effective, reference-points and maxdomains must be more flexible. After this patch, we'll have 4 distinct levels of NUMA (0x4, 0x3, 0x2, 0x1) and maxdomains will allow for any type of configuration the user intends to do - under the scope and limitations of PAPR itself, of course. Reviewed-by: Greg Kurz Reviewed-by: David Gibson Signed-off-by: Daniel Henrique Barboza Message-Id: <20201007172849.302240-4-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_numa.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index fe395e80a3..16badb1f4b 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -178,24 +178,51 @@ int spapr_numa_write_assoc_lookup_arrays(SpaprMachine= State *spapr, void *fdt, */ void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rta= s) { + MachineState *ms =3D MACHINE(spapr); SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); uint32_t refpoints[] =3D { cpu_to_be32(0x4), - cpu_to_be32(0x4), + cpu_to_be32(0x3), cpu_to_be32(0x2), + cpu_to_be32(0x1), }; uint32_t nr_refpoints =3D ARRAY_SIZE(refpoints); - uint32_t maxdomain =3D cpu_to_be32(spapr->gpu_numa_id > 1 ? 1 : 0); + uint32_t maxdomain =3D ms->numa_state->num_nodes + spapr->gpu_numa_id; uint32_t maxdomains[] =3D { cpu_to_be32(4), - maxdomain, - maxdomain, - maxdomain, - cpu_to_be32(spapr->gpu_numa_id), + cpu_to_be32(maxdomain), + cpu_to_be32(maxdomain), + cpu_to_be32(maxdomain), + cpu_to_be32(maxdomain) }; =20 - if (smc->pre_5_1_assoc_refpoints) { - nr_refpoints =3D 2; + if (spapr_machine_using_legacy_numa(spapr)) { + uint32_t legacy_refpoints[] =3D { + cpu_to_be32(0x4), + cpu_to_be32(0x4), + cpu_to_be32(0x2), + }; + uint32_t legacy_maxdomain =3D spapr->gpu_numa_id > 1 ? 1 : 0; + uint32_t legacy_maxdomains[] =3D { + cpu_to_be32(4), + cpu_to_be32(legacy_maxdomain), + cpu_to_be32(legacy_maxdomain), + cpu_to_be32(legacy_maxdomain), + cpu_to_be32(spapr->gpu_numa_id), + }; + + G_STATIC_ASSERT(sizeof(legacy_refpoints) <=3D sizeof(refpoints)); + G_STATIC_ASSERT(sizeof(legacy_maxdomains) <=3D sizeof(maxdomains)); + + nr_refpoints =3D 3; + + memcpy(refpoints, legacy_refpoints, sizeof(legacy_refpoints)); + memcpy(maxdomains, legacy_maxdomains, sizeof(legacy_maxdomains)); + + /* pseries-5.0 and older reference-points array is {0x4, 0x4} */ + if (smc->pre_5_1_assoc_refpoints) { + nr_refpoints =3D 2; + } } =20 _FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points", --=20 2.26.2