From nobody Sun Apr 28 19:24:48 2024 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=1599542511; cv=none; d=zohomail.com; s=zohoarc; b=L+ygGXSAbMOs7jOBx7s0T1WgKuSgBBJlRRV/PH7n4iofgVWWesZw9g9eebBh52t/8L4uI4ak1DTLnTCELICrUrfsWru9g8HNV8YrFYk8nbfRPoxIE9GQKmfSf5YcuMub2xhjo0dZR5yw+n5Pl8GzTCYmnoVSIxpVPykpWxu4Ux4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542511; h=Content-Type: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=5AdetAakSmcZK9WLH6X4dL4JPiaqJhHjy1Jxj9HjbUw=; b=ZtlX2MLQ/KwcDcWIr1Kn0PlYJfBm++RLgL3ISBYFcaeNV5epat8g68KyWBM76KgROpY6HHgT63NnQ8Ns/Il0Gms8byeL9FpQFZ+LjjJRgXQW8TPuOAjB/tW5lWwuG/UnMXhkdSMbpY10otIU+43tMb7pFap4sy0gRmu+SEObZU8= 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 1599542510625664.2673261112327; Mon, 7 Sep 2020 22:21:50 -0700 (PDT) Received: from localhost ([::1]:33374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW4i-0007eo-JL for importer@patchew.org; Tue, 08 Sep 2020 01:21:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW39-0005iF-Vw; Tue, 08 Sep 2020 01:20:12 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:44289 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 1kFW37-0005rC-A2; Tue, 08 Sep 2020 01:20:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkj3MKgz9sR4; Tue, 8 Sep 2020 15:19:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542397; bh=qgx6z9rQQE1xqJs/Hitt+hn4TaVazW9OJAaF7qJoeT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOWPeh0uE4ZsIgDXKTVKNCJuKYVisgyOXC1PuLvCA7NLqEHvX8NfKmOG4iXoOdQ4n acnWeRDQLe92s5YOO9xlqI34gomMqmWANJhJckp5j1qI1swOyjAb8jxW0nEIYbktmC La97SEuWboYjiLI1Q5lFD2RFDYbflmRKLqHdIyiE= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 01/33] adb: Correct class size on TYPE_ADB_DEVICE Date: Tue, 8 Sep 2020 15:19:21 +1000 Message-Id: <20200908051953.1616885-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The TypeInfo incorrectly just lets the class size be inherited. It won't actually break things, since the class is abstract, but we should get it right. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/input/adb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/input/adb.c b/hw/input/adb.c index 013fcc9c54..84331b9fce 100644 --- a/hw/input/adb.c +++ b/hw/input/adb.c @@ -309,6 +309,7 @@ static void adb_device_class_init(ObjectClass *oc, void= *data) static const TypeInfo adb_device_type_info =3D { .name =3D TYPE_ADB_DEVICE, .parent =3D TYPE_DEVICE, + .class_size =3D sizeof(ADBDeviceClass), .instance_size =3D sizeof(ADBDevice), .abstract =3D true, .class_init =3D adb_device_class_init, --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542511; cv=none; d=zohomail.com; s=zohoarc; b=nyqWdZJfj9gcjoDSLg8O3+2UBWnleYlYigZpdJofHCrXVSMj0jPSWvu+jhtT8IcSblPfjnyZ3gHyOoTFQNI5c2fDB9XLZMiOqJp/mTBdXiYaqTxGuHL6J9zDb1z3bXOUuIdEjninoVSF8vA/RQ1fCy9kNG/x2Bvpy7gf8xsxK0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542511; h=Content-Type: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=o3x0R1+lEXxF8lCyY92BjMinWyRRzO2woKThWoAfmt4=; b=MPqmKzFDELOVpVP8+1CAsHz6aAxTiluELkng89vh5+penGJR/ta2FLNFe334dGSzDF7ZtpOVjSfwN3ybrYHYZ3AFxtQeJ2lK0R3Ywj9ajqKbcVii+/geC2tbEtuvaI9kiKpXlforqSsLbMurLS7p86/aw0qVSraIHb7MtiXRGQg= 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 1599542510911995.7356650736893; Mon, 7 Sep 2020 22:21:50 -0700 (PDT) Received: from localhost ([::1]:33396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW4j-0007fM-D3 for importer@patchew.org; Tue, 08 Sep 2020 01:21:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW39-0005iE-PF; Tue, 08 Sep 2020 01:20:11 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:55981 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 1kFW37-0005rD-5y; Tue, 08 Sep 2020 01:20:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkj4jgjz9sTX; Tue, 8 Sep 2020 15:19:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542397; bh=/JhSp1HFdD3zltLdv6KRNXQgS9TzRkKxf8RYmADUDS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FhnbYPkcSznfLdvj96tqwW+5QxTRd6R/9YlU4fO072EODZ7bgdIdDjkPHfaAEJoRG 31dXbXExJ/tF7PJtGZsr7+TqCGIlud8NJo5gFAIEZnp+9vpQwLzK5AvKY/XsOwBRRV MRBknqok/ma8S2Ok5uK7FMuQ6kHuVtF+AcLPnHOE= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 02/33] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class Date: Tue, 8 Sep 2020 15:19:22 +1000 Message-Id: <20200908051953.1616885-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: Eduardo Habkost , danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater It was missing the instance_size field. Cc: Eduardo Habkost Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200822083920.2668930-1-clg@kaod.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/ppc/pnv_lpc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c index b5ffa48dac..23f1e09492 100644 --- a/hw/ppc/pnv_lpc.c +++ b/hw/ppc/pnv_lpc.c @@ -646,7 +646,6 @@ static void pnv_lpc_power8_class_init(ObjectClass *klas= s, void *data) static const TypeInfo pnv_lpc_power8_info =3D { .name =3D TYPE_PNV8_LPC, .parent =3D TYPE_PNV_LPC, - .instance_size =3D sizeof(PnvLpcController), .class_init =3D pnv_lpc_power8_class_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_PNV_XSCOM_INTERFACE }, @@ -687,7 +686,6 @@ static void pnv_lpc_power9_class_init(ObjectClass *klas= s, void *data) static const TypeInfo pnv_lpc_power9_info =3D { .name =3D TYPE_PNV9_LPC, .parent =3D TYPE_PNV_LPC, - .instance_size =3D sizeof(PnvLpcController), .class_init =3D pnv_lpc_power9_class_init, }; =20 @@ -768,6 +766,7 @@ static void pnv_lpc_class_init(ObjectClass *klass, void= *data) static const TypeInfo pnv_lpc_info =3D { .name =3D TYPE_PNV_LPC, .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(PnvLpcController), .class_init =3D pnv_lpc_class_init, .class_size =3D sizeof(PnvLpcClass), .abstract =3D true, --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542619; cv=none; d=zohomail.com; s=zohoarc; b=m5fkuIJxkvwxU6vivhBaanOX3G+LhW6yXaLT8/1W6M9S3BWU9ZwEtYvnx4CRrBaFkt8dCkddxr5g3dVKeeKdid/lf5gv7deWS5TKBFCIyu4OKM+6j5bL3mH6dSC+tS/0lXihPw1BndCBLu17eArNbXrEm5wZuRgljhWFlFJYjbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542619; 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=cPPsBIu5XrtBkB7n0J47UhZBYDtCNvb0x0+PWiu0Av0=; b=XH6DmASfJpKJHJ+qWFhZK31d4c8tWuyjLUEVBaB15lDoFYXNQ95iJRUPAha6VZozbCK7sB2dynBil9VOLXJY3Cngk3eZtKrmofBn306+icXlL8LSaxnVnT4lH1JpYfww1AZfT7zyI37X+TCWzkPd/eLsCTONNMATUeGyegdPRrU= 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 1599542619275486.77664523555484; Mon, 7 Sep 2020 22:23:39 -0700 (PDT) Received: from localhost ([::1]:43568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW6U-0003IQ-0E for importer@patchew.org; Tue, 08 Sep 2020 01:23:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3B-0005ic-5r; Tue, 08 Sep 2020 01:20:13 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:45347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW37-0005rB-75; Tue, 08 Sep 2020 01:20:12 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkj5rc8z9sTg; Tue, 8 Sep 2020 15:19:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542397; bh=PGXTjEP4QoRFOn/jGOws1ISctNffp+geWnV5qJ570xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvG69/V9zKCVWtf3/3WKlchn98On+3TOi849MeyZHf8DdZqXwJlKSNeOp098tS8si 97YZVbbIs6jwJUServS8OBJ5A5UlxXgaAW8AzlujLLHarFx6ffqeyJBn8FKuc2hA60 OgKhH0AXUJG8VVlNsW50S8QjpgOxFNd+8CgBRV0w= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 03/33] spapr: Remove unnecessary DRC type-checker macros Date: Tue, 8 Sep 2020 15:19:23 +1000 Message-Id: <20200908051953.1616885-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 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.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UPPERCASE_50_75=0.008 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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" spapr_drc.h includes typechecker macro boilerplate for the many different DRC subclasses. However, most of these types don't actually have different data in their class and/or instance, making these unneeded, unused, and in fact a bad idea. Remove them. Signed-off-by: David Gibson Reviewed-by: Greg Kurz --- include/hw/ppc/spapr_drc.h | 43 +------------------------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h index 21af8deac1..f270860769 100644 --- a/include/hw/ppc/spapr_drc.h +++ b/include/hw/ppc/spapr_drc.h @@ -29,62 +29,21 @@ TYPE_SPAPR_DR_CONNECTOR) =20 #define TYPE_SPAPR_DRC_PHYSICAL "spapr-drc-physical" -#define SPAPR_DRC_PHYSICAL_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PHYSICAL) -#define SPAPR_DRC_PHYSICAL_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, \ - TYPE_SPAPR_DRC_PHYSICAL) #define SPAPR_DRC_PHYSICAL(obj) OBJECT_CHECK(SpaprDrcPhysical, (obj), \ TYPE_SPAPR_DRC_PHYSICAL) =20 #define TYPE_SPAPR_DRC_LOGICAL "spapr-drc-logical" -#define SPAPR_DRC_LOGICAL_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_LOGICAL) -#define SPAPR_DRC_LOGICAL_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, \ - TYPE_SPAPR_DRC_LOGICAL) -#define SPAPR_DRC_LOGICAL(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_LOGICAL) =20 #define TYPE_SPAPR_DRC_CPU "spapr-drc-cpu" -#define SPAPR_DRC_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_CPU) -#define SPAPR_DRC_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_CPU) -#define SPAPR_DRC_CPU(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_CPU) =20 #define TYPE_SPAPR_DRC_PCI "spapr-drc-pci" -#define SPAPR_DRC_PCI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PCI) -#define SPAPR_DRC_PCI_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PCI) -#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_PCI) =20 #define TYPE_SPAPR_DRC_LMB "spapr-drc-lmb" -#define SPAPR_DRC_LMB_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_LMB) -#define SPAPR_DRC_LMB_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_LMB) -#define SPAPR_DRC_LMB(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_LMB) =20 #define TYPE_SPAPR_DRC_PHB "spapr-drc-phb" -#define SPAPR_DRC_PHB_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PHB) -#define SPAPR_DRC_PHB_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PHB) -#define SPAPR_DRC_PHB(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_PHB) =20 #define TYPE_SPAPR_DRC_PMEM "spapr-drc-pmem" -#define SPAPR_DRC_PMEM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PMEM) -#define SPAPR_DRC_PMEM_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PMEM) -#define SPAPR_DRC_PMEM(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_PMEM) + /* * Various hotplug types managed by SpaprDrc * --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542513; cv=none; d=zohomail.com; s=zohoarc; b=jbznB39nemv7w+WV3pcMURDvnlD22APeMC0YtYmthw07dK6WlG5Z0e4AvfOBEAahS2nbZUXuRpFCF86rCVfQMDsyZSmAK/GPsR0eEZdgjbD7Cipnt7pgrLCLcDPYP2awVzim2os4unZOtYHma32zS1GQItcr8NuHjKn9aFVjSno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542513; h=Content-Type: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=9rmBbXfFAmSDjGfMxVmFdqUxKLRvfeiD2V5C2mnuDLI=; b=QTORk2QM/2adGwbyisb26QDMt4FngvHaBqY8v3HREOX2FL9AcpriJzduVJvDUYvkw/JwKLbxrYvjasYgIwbt7b7IbTdZDszQAb93t9MXqYQxH/vLL6l6ocOMffwKey/uTRBLrXLsWoJGC3l6RvDwDkT/OQsrGEWqaAjuj2Nsh8Q= 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 1599542513231395.19157878992644; Mon, 7 Sep 2020 22:21:53 -0700 (PDT) Received: from localhost ([::1]:33726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW4l-0007nE-P8 for importer@patchew.org; Tue, 08 Sep 2020 01:21:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3B-0005ib-5B; Tue, 08 Sep 2020 01:20:13 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:39765 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 1kFW37-0005rG-5r; Tue, 08 Sep 2020 01:20:12 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkj6l8sz9sTd; Tue, 8 Sep 2020 15:19:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542397; bh=Ly+A7bmRWGNf8fZ+NruNygvD6RuKDnSvOp12wEpcHVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HeACudztyNApH9C+lHHByCROip7z0eZtQWbL4sUU0On2IDrbJ/33S/P8g3qHw+sb4 om4jQJmMF1v2vdSj2SKnchKozJf80/Ybhy/MAhrQrUQV7Ps3HYfBIOuh4JFHvseDbZ w9n3xXmuteh1zjuPe29yXBl4TRHcS4oPJU9w3f1s= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 04/33] spapr/xive: Add a 'hv-prio' property to represent the KVM escalation priority Date: Tue, 8 Sep 2020 15:19:24 +1000 Message-Id: <20200908051953.1616885-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater On POWER9, the KVM XIVE device uses priority 7 for the escalation interrupts. On POWER10, the host can use a reduced set of priorities and KVM will configure the escalation priority to a lower number. In any case, the guest is allowed to use priorities in a single range : [ 0 .. (maxprio - 1) ]. Introduce a 'hv-prio' property to represent the escalation priority number and use it to compute the "ibm,plat-res-int-priorities" property defining the priority ranges reserved by the hypervisor. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200819130843.2230799-2-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/spapr_xive.c | 33 ++++++++++++++------------------- include/hw/ppc/spapr_xive.h | 2 ++ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 4bd0d606ba..1fa09f287a 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -595,6 +595,7 @@ static Property spapr_xive_properties[] =3D { DEFINE_PROP_UINT32("nr-ends", SpaprXive, nr_ends, 0), DEFINE_PROP_UINT64("vc-base", SpaprXive, vc_base, SPAPR_XIVE_VC_BASE), DEFINE_PROP_UINT64("tm-base", SpaprXive, tm_base, SPAPR_XIVE_TM_BASE), + DEFINE_PROP_UINT8("hv-prio", SpaprXive, hv_prio, 7), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -692,12 +693,13 @@ static void spapr_xive_dt(SpaprInterruptController *i= ntc, uint32_t nr_servers, cpu_to_be32(16), /* 64K */ }; /* - * The following array is in sync with the reserved priorities - * defined by the 'spapr_xive_priority_is_reserved' routine. + * QEMU/KVM only needs to define a single range to reserve the + * escalation priority. A priority bitmask would have been more + * appropriate. */ uint32_t plat_res_int_priorities[] =3D { - cpu_to_be32(7), /* start */ - cpu_to_be32(0xf8), /* count */ + cpu_to_be32(xive->hv_prio), /* start */ + cpu_to_be32(0xff - xive->hv_prio), /* count */ }; =20 /* Thread Interrupt Management Area : User (ring 3) and OS (ring 2) */ @@ -844,19 +846,12 @@ type_init(spapr_xive_register_types) */ =20 /* - * Linux hosts under OPAL reserve priority 7 for their own escalation - * interrupts (DD2.X POWER9). So we only allow the guest to use - * priorities [0..6]. + * On POWER9, the KVM XIVE device uses priority 7 for the escalation + * interrupts. So we only allow the guest to use priorities [0..6]. */ -static bool spapr_xive_priority_is_reserved(uint8_t priority) +static bool spapr_xive_priority_is_reserved(SpaprXive *xive, uint8_t prior= ity) { - switch (priority) { - case 0 ... 6: - return false; - case 7: /* OPAL escalation queue */ - default: - return true; - } + return priority >=3D xive->hv_prio; } =20 /* @@ -1053,7 +1048,7 @@ static target_ulong h_int_set_source_config(PowerPCCP= U *cpu, new_eas.w =3D eas.w & cpu_to_be64(~EAS_MASKED); } =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P4; @@ -1212,7 +1207,7 @@ static target_ulong h_int_get_queue_info(PowerPCCPU *= cpu, * This is not needed when running the emulation under QEMU */ =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P3; @@ -1299,7 +1294,7 @@ static target_ulong h_int_set_queue_config(PowerPCCPU= *cpu, * This is not needed when running the emulation under QEMU */ =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P3; @@ -1466,7 +1461,7 @@ static target_ulong h_int_get_queue_config(PowerPCCPU= *cpu, * This is not needed when running the emulation under QEMU */ =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P3; diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index a1c8540ab4..26c8d90d71 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -49,6 +49,8 @@ typedef struct SpaprXive { void *tm_mmap; MemoryRegion tm_mmio_kvm; VMChangeStateEntry *change; + + uint8_t hv_prio; } SpaprXive; =20 typedef struct SpaprXiveClass { --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542609; cv=none; d=zohomail.com; s=zohoarc; b=CbpKbPiLhcy1NcgxkVLjO6YZZwQi302SqznqqYzuapxjTqTIL1O0LaN4uEo1fXrc/no4FmHoZxmZzKA7k2/ZAw/ivFzGtUzFKtkjEAHvaySnFM4bK7PTVnNw96Wp2bWJWnkfFjZdbDyc1NNsvmTF5aLmBGwGK5dEU7gqaDT7r6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542609; h=Content-Type: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=yGKBaLrfTmX8xCw2ojOwtNXZDgGJOsX8dbA/GfQ34hE=; b=EEHf61PCwVIQUx2MK3Sn+CM1v9dttXCBwOm0Uess+xQt27xeXYY0Q2cKyWutDetCq0rSnqtd/5Is3Krao6WWbIUI+JaCt3ycrO+dTeVdS35mBpQWN2jkpOJrsDVGcL5rgN/ZuLHp4WH0EGQPlr5+hXSpjyUIEjJoNk6oFk0yEiU= 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 1599542609391176.87779503902004; Mon, 7 Sep 2020 22:23:29 -0700 (PDT) Received: from localhost ([::1]:42366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW6K-0002nZ-4o for importer@patchew.org; Tue, 08 Sep 2020 01:23:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3H-0005vB-HM; Tue, 08 Sep 2020 01:20:19 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:41377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3F-0005sJ-1D; Tue, 08 Sep 2020 01:20:19 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkk0f4zz9sTh; Tue, 8 Sep 2020 15:19:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542398; bh=qRvDkKeGN3ISEoYcHLWQNMPIJ9YGM+/j4ALri4j7g1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2u5xjAaH/qJHU3lR4WjkK6DYCqmepo1lUJp/8ar3fKmSZqwtVDujcd/U2MT1GcPB pZVJ6Pb4UZaVy2JF/lcDuqhbamgDXcUOUGMflaV3IBOZj2lMbEVisPpCjsYBFEeQcO nowMSrtZpQMurfHtOhkOdo+acSibUiWLI/3zX8zo= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 05/33] ppc/pnv: Add a HIOMAP erase command Date: Tue, 8 Sep 2020 15:19:25 +1000 Message-Id: <20200908051953.1616885-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: Corey Minyard , danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, Klaus Heinrich Kiwi , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater The OPAL test suite runs a read-erase-write test on the PNOR : https://github.com/open-power/op-test/blob/master/testcases/OpTestPNOR.py which revealed that the IPMI HIOMAP handlers didn't support HIOMAP_C_ERASE. Implement the sector erase command by writing 0xFF in the PNOR memory region. Cc: Corey Minyard Reported-by: Klaus Heinrich Kiwi Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200820164638.2515681-1-clg@kaod.org> Acked-by: Corey Minyard Signed-off-by: David Gibson --- hw/ppc/pnv_bmc.c | 29 ++++++++++++++++++++++++++++- include/hw/ipmi/ipmi.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c index 2e1a03daa4..67ebb16c4d 100644 --- a/hw/ppc/pnv_bmc.c +++ b/hw/ppc/pnv_bmc.c @@ -140,6 +140,27 @@ static uint16_t bytes_to_blocks(uint32_t bytes) return bytes >> BLOCK_SHIFT; } =20 +static uint32_t blocks_to_bytes(uint16_t blocks) +{ + return blocks << BLOCK_SHIFT; +} + +static int hiomap_erase(PnvPnor *pnor, uint32_t offset, uint32_t size) +{ + MemTxResult result; + int i; + + for (i =3D 0; i < size / 4; i++) { + result =3D memory_region_dispatch_write(&pnor->mmio, offset + i * = 4, + 0xFFFFFFFF, MO_32, + MEMTXATTRS_UNSPECIFIED); + if (result !=3D MEMTX_OK) { + return -1; + } + } + return 0; +} + static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, RspBuffer *rsp) { @@ -155,10 +176,16 @@ static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd,= unsigned int cmd_len, switch (cmd[2]) { case HIOMAP_C_MARK_DIRTY: case HIOMAP_C_FLUSH: - case HIOMAP_C_ERASE: case HIOMAP_C_ACK: break; =20 + case HIOMAP_C_ERASE: + if (hiomap_erase(pnor, blocks_to_bytes(cmd[5] << 8 | cmd[4]), + blocks_to_bytes(cmd[7] << 8 | cmd[6]))) { + rsp_buffer_set_error(rsp, IPMI_CC_UNSPECIFIED); + } + break; + case HIOMAP_C_GET_INFO: rsp_buffer_push(rsp, 2); /* Version 2 */ rsp_buffer_push(rsp, BLOCK_SHIFT); /* block size */ diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index 8a99d958bb..c1efdaa4cb 100644 --- a/include/hw/ipmi/ipmi.h +++ b/include/hw/ipmi/ipmi.h @@ -53,6 +53,7 @@ enum ipmi_op { #define IPMI_CC_INVALID_DATA_FIELD 0xcc #define IPMI_CC_BMC_INIT_IN_PROGRESS 0xd2 #define IPMI_CC_COMMAND_NOT_SUPPORTED 0xd5 +#define IPMI_CC_UNSPECIFIED 0xff =20 #define IPMI_NETFN_APP 0x06 #define IPMI_NETFN_OEM 0x3a --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542617; cv=none; d=zohomail.com; s=zohoarc; b=fQ+BkcXt/XL+0EaX4WNGqaVhQzQhyW/rR40PBcGS6N+moh5UNi66PMMzErstNN0sLpI9WAy8exre759xJmL5H9eS6el96i3ZNNPbyZA3LCUtD8ta40DVb5bg1Unu+LhRfOiWJo6dIb+MDcjPQQqOdhbtRCPS4G306Nds3KGUT2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542617; 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=6S2m2R5SLYMx8Tc6phoIgj5s0lrV/FIrJuQU4uTsTHY=; b=bxjrpafM20t9rVzTyWZRlrbnnb+k5tvhLVjd2fuspwr+gCycSwTLvevA7yDUyE6JW5ASRShWDW12+9xrHfsUrXJqRUnjXScglXxZbA5BJjtlOIqEzIhWYACiZTouzrPe++OSlV6Q611Y2tGoi7QO7lwvktHmznYbfNwEFI4yuNI= 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 1599542617171296.5147298535352; Mon, 7 Sep 2020 22:23:37 -0700 (PDT) Received: from localhost ([::1]:43408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW6R-0003EU-Rr for importer@patchew.org; Tue, 08 Sep 2020 01:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3I-0005xz-Tr; Tue, 08 Sep 2020 01:20:20 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:38209 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 1kFW3F-0005sO-LW; Tue, 08 Sep 2020 01:20:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkk269zz9sTr; Tue, 8 Sep 2020 15:19:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542398; bh=ugr0WxY1CRWShk3/UQfX+l/l8XSozOlyduL+5OhU5iA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGP+LUwtBPrX9IQ6uOGVUZBcIfKZePUHMGXKmJYassycaVxlpw35rZcH2pFnf72BZ FANnlqy6iuDsHTkbTVm/P7j4tQVe2vzAQC5Ed/nJkddvCnoXRj19DeZRBxv0QsLpeZ ossdawNQ9QOaEVHVKbFNLZ24orhSuIyDQnMqQ4AY= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 06/33] spapr_vscsi: do not allow device hotplug Date: Tue, 8 Sep 2020 15:19:26 +1000 Message-Id: <20200908051953.1616885-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 We do not implement hotplug in the vscsi bus, but we forgot to tell qdev about it. The result is that users are able to hotplug devices in the vscsi bus, the devices appear in qdev, but they aren't usable by the guest OS unless the user reboots it first. Setting qbus hotplug_handler to NULL will tell qdev-monitor, via qbus_is_hotpluggable(), that we do not support hotplug operations in spapr_vscsi. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1862059 Signed-off-by: Daniel Henrique Barboza Message-Id: <20200820190635.379657-1-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/scsi/spapr_vscsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index d17dc03c73..57f0a1336f 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -1219,6 +1219,9 @@ static void spapr_vscsi_realize(SpaprVioDevice *dev, = Error **errp) =20 scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), &vscsi_scsi_info, NULL); + + /* ibmvscsi SCSI bus does not allow hotplug. */ + qbus_set_hotplug_handler(BUS(&s->bus), NULL); } =20 void spapr_vscsi_create(SpaprVioBus *bus) --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542524; cv=none; d=zohomail.com; s=zohoarc; b=hoErYQFnw/tUFFTTcUVKaLTUWPF0tunEqAoSb/jR7nxozZjzsXNNUbO4PNons8TMThQ2zDy4oSGpBfZx589ICSF5RiExHetE7wKCpIkWyRgAhLt/42PWR2/8gTbABqzuA5cHvTk5VpFpS37ronUrEYZxFNHHLzIYmlKPvjXW5XU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542524; h=Content-Type: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=FCdjvJFYvyd/09ZENHoP8pYkQIycMRR+EveWsGqrWhQ=; b=camywoaRKXVAUXs7kncbzkv0P6LGOYScZesDSRb3Q5OKoERLfxPRlBH9fKIHYK+PTR8E0dsRwp7TFUoVrEL/d41oiunfT9XNBphPgKUsrcKg11AlQM5LXuAo/SKhNLpJRGHVBqd1AUTuBxGO7kW9/aHkBDAhXLss/KmXmgpz9d8= 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 1599542524955928.5999765192939; Mon, 7 Sep 2020 22:22:04 -0700 (PDT) Received: from localhost ([::1]:35086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW4x-0008Ke-FP for importer@patchew.org; Tue, 08 Sep 2020 01:22:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3I-0005xC-Gv; Tue, 08 Sep 2020 01:20:20 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:53943 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 1kFW3F-0005sN-G3; Tue, 08 Sep 2020 01:20:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkk2sJ6z9sTm; Tue, 8 Sep 2020 15:19:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542398; bh=L+ql0mFkJJ6RIqHIX4UIYSGet1NsQYu3ApRmEert8Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQ75FgFi1xMubHZ606Lgf+pH4K1oxB+8LApb6qIodqo68BOxXLOT48FMLr6yKt/qP kuMEUPZ3fFt8jfH5peve6T8hasNm+PstGJFUZWo2tHMKsX3w/jPrg3TNPErvruT5Xh W9y5OOyeAW5nLcj7goap7ZTq7iP37RoK+UaDMG1Q= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 07/33] spapr/xive: Use the xics flag to check for XIVE-only IRQ backends Date: Tue, 8 Sep 2020 15:19:27 +1000 Message-Id: <20200908051953.1616885-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater The sPAPR machine has four different IRQ backends, each implementing the XICS or XIVE interrupt mode or both in the case of the 'dual' backend. If a machine is started in P8 compat mode, QEMU should necessarily support the XICS interrupt mode and in that case, the XIVE-only IRQ backend is invalid. Currently, spapr_irq_check() tests the pointer value to the IRQ backend to check for this condition, instead use the 'xics' flag. It's equivalent and it will ease the introduction of new XIVE-only IRQ backends if needed. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200820140106.2357228-1-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 72bb938375..f59960339e 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -172,7 +172,7 @@ static int spapr_irq_check(SpaprMachineState *spapr, Er= ror **errp) * To cover both and not confuse the OS, add an early failure in * QEMU. */ - if (spapr->irq =3D=3D &spapr_irq_xive) { + if (!spapr->irq->xics) { error_setg(errp, "XIVE-only machines require a POWER9 CPU"); return -1; } --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542687; cv=none; d=zohomail.com; s=zohoarc; b=F29kqPlFc3GYNSu8LMFIqYDloRruBQ+aKp/TNI+ukMlXlhXiWpMh0F1QpWatx631vSkG3/xI91tC7O84XeAM7UP6ct7Rb9slAmy4ND+PWJqGUIPolHcEyanG+PlTa0R9jek94SnDcAEzySJE9KpSvB8KEGcOGMSQ2NKOAslKk5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542687; h=Content-Type: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=OvUYC1aU/OxTZZt1BhwhbD71OXuF5djLIbYY8WLE1Ks=; b=Ugx3qcJAMZIDPzFPyxpGGmFs9PO4jR2aLCm3uT1X6N9NLCqyPz5Fq4yOCP2p6BxPIghV6NccSUAgssYoHLpWvzbc+1M/RVYQZv6HklnWC02KPetyhocPtPhhqQtSBnQwpuYgCI/Xha2i3ZPqJbYTdp8Dz0wRBrCS601FppdtTnE= 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 1599542687895366.30108676593716; Mon, 7 Sep 2020 22:24:47 -0700 (PDT) Received: from localhost ([::1]:51112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW7a-0006Kf-H0 for importer@patchew.org; Tue, 08 Sep 2020 01:24:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3H-0005ud-7B; Tue, 08 Sep 2020 01:20:19 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:55913 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 1kFW3F-0005sL-Df; Tue, 08 Sep 2020 01:20:18 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkk3Y0Bz9sTs; Tue, 8 Sep 2020 15:19:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542398; bh=y0ekmLiv1v8gnLp4l1ENgIIfE7Ziu7hc7FMTdKVlGIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GOvW2WH4DHBpE4aJUxLi1aRVGUQ4RWEyne6dnxWJmqUfjyStdSUSoz9s3ztpv/B7i rT5tX/ShYDHF+Umt0MUDGD4hbiZZFgTXSFkpXH8H37MdYe+N316/Bpiu105VVaYQrc 2PehypPuQhS85SYeYkOIU3GVX5WA+fekzvURI+X0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 08/33] spapr/xive: Modify kvm_cpu_is_enabled() interface Date: Tue, 8 Sep 2020 15:19:28 +1000 Message-Id: <20200908051953.1616885-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater We will use to check if a vCPU IPI has been created. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200820134547.2355743-2-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/spapr_xive_kvm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index e8667ce5f6..0e834b4b71 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -36,10 +36,9 @@ typedef struct KVMEnabledCPU { static QLIST_HEAD(, KVMEnabledCPU) kvm_enabled_cpus =3D QLIST_HEAD_INITIALIZER(&kvm_enabled_cpus); =20 -static bool kvm_cpu_is_enabled(CPUState *cs) +static bool kvm_cpu_is_enabled(unsigned long vcpu_id) { KVMEnabledCPU *enabled_cpu; - unsigned long vcpu_id =3D kvm_arch_vcpu_id(cs); =20 QLIST_FOREACH(enabled_cpu, &kvm_enabled_cpus, node) { if (enabled_cpu->vcpu_id =3D=3D vcpu_id) { @@ -157,7 +156,7 @@ int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **err= p) assert(xive->fd !=3D -1); =20 /* Check if CPU was hot unplugged and replugged. */ - if (kvm_cpu_is_enabled(tctx->cs)) { + if (kvm_cpu_is_enabled(kvm_arch_vcpu_id(tctx->cs))) { return 0; } =20 --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542685; cv=none; d=zohomail.com; s=zohoarc; b=ULYfT2wl4b1HnaLqo74HXPG/z/y4r0SfgLmFihkGKoT3l8uxAi3k6kCMB2GHIod+v3TThPiG3EG+Ixc67/k0alqZkt1mfI8wxPZ1aIvRCYOndwPvqudqVwMntTKieyH/F7+8PsR1mPOLxqL+nLwIKuqMJLssPbTQ8jSb5Sn4aHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542685; h=Content-Type: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=qdxp2OEnCT9/h1QSa41YIrnGHRXke1da00x/1hdCB9g=; b=dxRdr17iWwwpaEbDz9GBXWyTCabJwDux6wTXDZqPeJKr9sxhjvkWR5mTKzV03XzZaH5M5/z315Fkzfn85Zh72xEiArFF1C/EF626fY2UWicvM7mTLtTr/qKf05wcebRh6x9Hodu1QfOLhSJDdsuNfd6d57kfk2owjzltPFv3ylA= 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 1599542685947859.8101670579061; Mon, 7 Sep 2020 22:24:45 -0700 (PDT) Received: from localhost ([::1]:50948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW7Y-0006GX-J2 for importer@patchew.org; Tue, 08 Sep 2020 01:24:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3J-0005zc-IF; Tue, 08 Sep 2020 01:20:21 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:46927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3H-0005tz-KV; Tue, 08 Sep 2020 01:20:21 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkk5SjTz9sV1; Tue, 8 Sep 2020 15:19:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542398; bh=+i8c6x+g1I/0BlMD1P5giE77/kh1mmlq1iXBC8Cnpfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdqL8FflGEO0x053PZmAdpiK7oRLhn7nr9zMw3fbHOc9biVh7aF3/EVVPuAPiVFZ0 1Qy0eRQ3+Or3R8h0lxoaFsqYvWIKtGHUPBeptKsXXgFQFcUPiIiLDbO+/EDhBVVj3i JEjoan4geZkGb1u002WPOGNTgmslrsow66HgD6jA= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 09/33] spapr/xive: Use kvmppc_xive_source_reset() in post_load Date: Tue, 8 Sep 2020 15:19:29 +1000 Message-Id: <20200908051953.1616885-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater This is doing an extra loop but should be equivalent. It also differentiate the reset of the sources from the restore of the sources configuration. This will help in allocating the vCPU IPIs independently. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200820134547.2355743-3-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/spapr_xive_kvm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 0e834b4b71..3e80ea0ce9 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -646,22 +646,22 @@ int kvmppc_xive_post_load(SpaprXive *xive, int versio= n_id) } } =20 + /* + * We can only restore the source config if the source has been + * previously set in KVM. Since we don't do that at reset time + * when restoring a VM, let's do it now. + */ + ret =3D kvmppc_xive_source_reset(&xive->source, &local_err); + if (ret < 0) { + goto fail; + } + /* Restore the EAT */ for (i =3D 0; i < xive->nr_irqs; i++) { if (!xive_eas_is_valid(&xive->eat[i])) { continue; } =20 - /* - * We can only restore the source config if the source has been - * previously set in KVM. Since we don't do that for all interrupts - * at reset time anymore, let's do it now. - */ - ret =3D kvmppc_xive_source_reset_one(&xive->source, i, &local_err); - if (ret < 0) { - goto fail; - } - ret =3D kvmppc_xive_set_source_config(xive, i, &xive->eat[i], &loc= al_err); if (ret < 0) { goto fail; --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542867; cv=none; d=zohomail.com; s=zohoarc; b=Jge8uVo7UXx3U2YyhschYHOuJdUYfrcTi//hXTdFiaOrPsquK/Wghvl62uPMVdN2g6fpSjyIVbNhnDZwJrL2OlU7LNV5TKzXt/oQeDXST2IqXyEHjtCGJdIjeKtRgDj2I2BS2n9OBoK7EDCgTvBpiRjQXmpsoZzzy44jjNMz2F0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542867; h=Content-Type: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=h5ZcncR0LpN1opjJ7Uwmz+qKHnEQ7MAKBrzkFIjsN2s=; b=IrfjDj1UyO4w0Ixuo3F3tF/NJdAbBE8CNOTEc5ngWq3Z3IYC6195RipetxM2E8Cnpu0/HJvLKD9OXnlSlN/l+YSjpFsZ5cK8TENrfdvz/w97W8CriqUjhm9NzcnOl5CnMiaT/zBz4PASJOn59chhhHbddSgdd9FrSMnfld0p6AQ= 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 159954286723142.11096880444916; Mon, 7 Sep 2020 22:27:47 -0700 (PDT) Received: from localhost ([::1]:60596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWAT-0001ug-2c for importer@patchew.org; Tue, 08 Sep 2020 01:27:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3K-00061K-9J; Tue, 08 Sep 2020 01:20:22 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:37829 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 1kFW3H-0005uK-Qm; Tue, 08 Sep 2020 01:20:21 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkk6T9nz9sTv; Tue, 8 Sep 2020 15:19:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542398; bh=jcnikD43TknD0h7PbZyyb0oDHmtpwlFiVMarcY7U0tU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=chLDAUSYC8tZNC5N2ocBoiIyV4j4otuXklbtEbRuhCGrheb7xmVlrC6HcYU5xzQjg i2dxkw+n+az2erHnwbVorCc0xfEEgMkaJyF4Z6xs88uj8/Edyi4Ccip7yKJr4leqfG pdEZKHbh5pYYS0Pgmw67193GrNG4mhxAkaQKg7bo= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 10/33] spapr/xive: Allocate IPIs independently from the other sources Date: Tue, 8 Sep 2020 15:19:30 +1000 Message-Id: <20200908051953.1616885-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater The vCPU IPIs are now allocated in kvmppc_xive_cpu_connect() when the vCPU connects to the KVM device and not when all the sources are reset in kvmppc_xive_source_reset() This requires extra care for hotplug vCPUs and VM restore. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200820134547.2355743-4-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/spapr_xive_kvm.c | 47 +++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 3e80ea0ce9..507637d51e 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -146,6 +146,15 @@ int kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx, = Error **errp) return s.ret; } =20 +static int kvmppc_xive_reset_ipi(SpaprXive *xive, CPUState *cs, Error **er= rp) +{ + unsigned long ipi =3D kvm_arch_vcpu_id(cs); + uint64_t state =3D 0; + + return kvm_device_access(xive->fd, KVM_DEV_XIVE_GRP_SOURCE, ipi, + &state, true, errp); +} + int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp) { ERRP_GUARD(); @@ -175,6 +184,12 @@ int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **er= rp) return ret; } =20 + /* Create/reset the vCPU IPI */ + ret =3D kvmppc_xive_reset_ipi(xive, tctx->cs, errp); + if (ret < 0) { + return ret; + } + kvm_cpu_enable(tctx->cs); return 0; } @@ -234,6 +249,12 @@ int kvmppc_xive_source_reset_one(XiveSource *xsrc, int= srcno, Error **errp) =20 assert(xive->fd !=3D -1); =20 + /* + * The vCPU IPIs are now allocated in kvmppc_xive_cpu_connect() + * and not with all sources in kvmppc_xive_source_reset() + */ + assert(srcno >=3D SPAPR_XIRQ_BASE); + if (xive_source_irq_is_lsi(xsrc, srcno)) { state |=3D KVM_XIVE_LEVEL_SENSITIVE; if (xsrc->status[srcno] & XIVE_STATUS_ASSERTED) { @@ -245,12 +266,28 @@ int kvmppc_xive_source_reset_one(XiveSource *xsrc, in= t srcno, Error **errp) true, errp); } =20 +/* + * To be valid, a source must have been claimed by the machine (valid + * entry in the EAS table) and if it is a vCPU IPI, the vCPU should + * have been enabled, which means the IPI has been allocated in + * kvmppc_xive_cpu_connect(). + */ +static bool xive_source_is_valid(SpaprXive *xive, int i) +{ + return xive_eas_is_valid(&xive->eat[i]) && + (i >=3D SPAPR_XIRQ_BASE || kvm_cpu_is_enabled(i)); +} + static int kvmppc_xive_source_reset(XiveSource *xsrc, Error **errp) { SpaprXive *xive =3D SPAPR_XIVE(xsrc->xive); int i; =20 - for (i =3D 0; i < xsrc->nr_irqs; i++) { + /* + * Skip the vCPU IPIs. These are created/reset when the vCPUs are + * connected in kvmppc_xive_cpu_connect() + */ + for (i =3D SPAPR_XIRQ_BASE; i < xsrc->nr_irqs; i++) { int ret; =20 if (!xive_eas_is_valid(&xive->eat[i])) { @@ -332,7 +369,7 @@ static void kvmppc_xive_source_get_state(XiveSource *xs= rc) for (i =3D 0; i < xsrc->nr_irqs; i++) { uint8_t pq; =20 - if (!xive_eas_is_valid(&xive->eat[i])) { + if (!xive_source_is_valid(xive, i)) { continue; } =20 @@ -515,7 +552,7 @@ static void kvmppc_xive_change_state_handler(void *opaq= ue, int running, uint8_t pq; uint8_t old_pq; =20 - if (!xive_eas_is_valid(&xive->eat[i])) { + if (!xive_source_is_valid(xive, i)) { continue; } =20 @@ -543,7 +580,7 @@ static void kvmppc_xive_change_state_handler(void *opaq= ue, int running, for (i =3D 0; i < xsrc->nr_irqs; i++) { uint8_t pq; =20 - if (!xive_eas_is_valid(&xive->eat[i])) { + if (!xive_source_is_valid(xive, i)) { continue; } =20 @@ -658,7 +695,7 @@ int kvmppc_xive_post_load(SpaprXive *xive, int version_= id) =20 /* Restore the EAT */ for (i =3D 0; i < xive->nr_irqs; i++) { - if (!xive_eas_is_valid(&xive->eat[i])) { + if (!xive_source_is_valid(xive, i)) { continue; } =20 --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542834; cv=none; d=zohomail.com; s=zohoarc; b=IKAjMUk1ynoVIHnLy2GMyOIPMzfa4TcGWfo/kEzLP5qD9wHKaOs9zogFX+AgLA0/G63BATUwY6WdeDUCL6lfOU+5o0nsWgL75uRC0N3SA85u1aSs5kym3fVVXJgGM1RWBTl3acLz1uzGaGVqivmHgYV+FPm8mzTi0/iZ5EPQDGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542834; h=Content-Type: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=wkco8SgERFlkSYFlL+b63cBFB614GtKlYYVRWtdbcPA=; b=XQD7w7n/szA2O9Cj1i0u2srgqhzXeRez487YmjzzDYW4TookpbQjakXH2kBZqpstNIVatRaMB2dlm4uszjUJMex1PNeyN6FP6w5eRQc+dEr++x9DeUE5VmskZjPcVRpaSdr7fhWSA0TCFlfdShax3gtPcv0vA50Xisr4Kd7JH4M= 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 159954283473058.571909536223984; Mon, 7 Sep 2020 22:27:14 -0700 (PDT) Received: from localhost ([::1]:59396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW9x-0001Qp-0G for importer@patchew.org; Tue, 08 Sep 2020 01:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3J-00060B-QF; Tue, 08 Sep 2020 01:20:21 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:56197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3H-0005uF-Mu; Tue, 08 Sep 2020 01:20:21 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkl1MqHz9sTK; Tue, 8 Sep 2020 15:19:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542399; bh=oNqINut4m7yPkBkTE4WEvkmXs8Ug4gFGqv9k3XWsOTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jEf0iqoCZmfuEs7XYs7lyDN/WUInOPYKlkSIJPiQlrtRoBArCLwf+g593yFsPqOqx obekzdzDyxKJMKqL84A3ucrHXn9Lpav2wEFxkh8BntCOPfiNloQbv17PVoZ9CXJcbJ n0f1NpZn8TvCrVwJFfvj/UCPb2IEW/u1hr4zN4Qk= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 11/33] spapr/xive: Allocate vCPU IPIs from the vCPU contexts Date: Tue, 8 Sep 2020 15:19:31 +1000 Message-Id: <20200908051953.1616885-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: C=C3=A9dric Le Goater When QEMU switches to the XIVE interrupt mode, it creates all the guest interrupts at the level of the KVM device. These interrupts are backed by real HW interrupts from the IPI interrupt pool of the XIVE controller. Currently, this is done from the QEMU main thread, which results in allocating all interrupts from the chip on which QEMU is running. IPIs are not distributed across the system and the load is not well balanced across the interrupt controllers. Change the vCPU IPI allocation to run from the vCPU context. The associated XIVE IPI interrupt will be allocated on the chip on which the vCPU is running and improve distribution of the IPIs in the system. When the vCPUs are pinned, this will make the IPI local to the chip of the vCPU. It will reduce rerouting between interrupt controllers and gives better performance. Device interrupts are still treated the same. To improve placement, we would need some information on the chip owning the virtual source or the HW source in case of a passthrough device but this reuires changes in PAPR. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20200820134547.2355743-5-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/spapr_xive_kvm.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 507637d51e..66bf4c06fe 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -146,13 +146,43 @@ int kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx,= Error **errp) return s.ret; } =20 -static int kvmppc_xive_reset_ipi(SpaprXive *xive, CPUState *cs, Error **er= rp) +/* + * Allocate the vCPU IPIs from the vCPU context. This will allocate + * the XIVE IPI interrupt on the chip on which the vCPU is running. + * This gives a better distribution of IPIs when the guest has a lot + * of vCPUs. When the vCPUs are pinned, this will make the IPI local + * to the chip of the vCPU. It will reduce rerouting between interrupt + * controllers and gives better performance. + */ +typedef struct { + SpaprXive *xive; + Error *err; + int rc; +} XiveInitIPI; + +static void kvmppc_xive_reset_ipi_on_cpu(CPUState *cs, run_on_cpu_data arg) { unsigned long ipi =3D kvm_arch_vcpu_id(cs); + XiveInitIPI *s =3D arg.host_ptr; uint64_t state =3D 0; =20 - return kvm_device_access(xive->fd, KVM_DEV_XIVE_GRP_SOURCE, ipi, - &state, true, errp); + s->rc =3D kvm_device_access(s->xive->fd, KVM_DEV_XIVE_GRP_SOURCE, ipi, + &state, true, &s->err); +} + +static int kvmppc_xive_reset_ipi(SpaprXive *xive, CPUState *cs, Error **er= rp) +{ + XiveInitIPI s =3D { + .xive =3D xive, + .err =3D NULL, + .rc =3D 0, + }; + + run_on_cpu(cs, kvmppc_xive_reset_ipi_on_cpu, RUN_ON_CPU_HOST_PTR(&s)); + if (s.err) { + error_propagate(errp, s.err); + } + return s.rc; } =20 int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp) --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542696; cv=none; d=zohomail.com; s=zohoarc; b=hkDpWnruCSvgrrzVyyqS9bFvpSe66iYKd6aukq7re3rXbdseDOna1roU0APoGSIEBcVxNs4FRhK3h3yaZe89ASGTvPj51I73iFovaccnzE8+qx/WWIS8mgoWEsemAJemuzoAtEXJesri/sDSKCjRHegqlfrfB4itOQe9mivL5q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542696; 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=7Kxd3+XMLZILKyhdtaGgNbVfouNtn9XIF6VnAP+jf/M=; b=XGqL0Dx5mHtOvmcpCfT1r1kr941I1ng1NQxbd4R8M9uhKd4PpXtuhh0j5lR0wA36ekS5ShfbrrU6KO8F5mArbMjbvab1cVjuHFoUsBAioigNg2YLeXN+5mWd65T8wHGeabsiDwJ7CSivULI7JuTTgxtW8xegghorYiyj2oL88uo= 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 1599542696167500.3060339391475; Mon, 7 Sep 2020 22:24:56 -0700 (PDT) Received: from localhost ([::1]:51834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW7h-0006c8-N3 for importer@patchew.org; Tue, 08 Sep 2020 01:24:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3J-00060G-RW; Tue, 08 Sep 2020 01:20:21 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:58799 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 1kFW3H-0005uT-PT; Tue, 08 Sep 2020 01:20:21 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkm0hn2z9sV6; Tue, 8 Sep 2020 15:19:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542400; bh=x72XkQdCKwl+nzDKBcPHb5FwlHCdlLNuP3qoPMFwXdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGsD970AblUuTuyaidpjv/Ps7rQrygMgT1wVDg3RAqtA4z1lwunBWJrWeWwLqImUk 8znkcBh1dgr0r7sV8sjDIlCbd+KZdZ5P5H8MHmilyaHn6gGMsV621838jgvTHLXxO+ +ri9jvCgVd2gO5JZ+l+6z42RZRvU7Ey5sFoW/pdk= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 12/33] ppc/spapr_nvdimm: use g_autofree in spapr_nvdimm_validate_opts() Date: Tue, 8 Sep 2020 15:19:32 +1000 Message-Id: <20200908051953.1616885-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 Since we're using the string just once, just use g_autofree and avoid leaking it without calling g_free(). Signed-off-by: Daniel Henrique Barboza Message-Id: <20200825215749.213536-2-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_nvdimm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index 81410aa63f..9a20a65640 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -33,7 +33,7 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size, Error **errp) { - char *uuidstr =3D NULL; + g_autofree char *uuidstr =3D NULL; QemuUUID uuid; int ret; =20 @@ -54,7 +54,6 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uin= t64_t size, &error_abort); ret =3D qemu_uuid_parse(uuidstr, &uuid); g_assert(!ret); - g_free(uuidstr); =20 if (qemu_uuid_is_null(&uuid)) { error_setg(errp, "NVDIMM device requires the uuid to be set"); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542954; cv=none; d=zohomail.com; s=zohoarc; b=htrT1MLI6VJM636SE5TWlAXra9h16ZT1b6bHOJBk+X1geqDdRZqCrkbAugqgkY/pHrOxcVjPq1U+3v7tZbTLnaBIKdYtUHdo9QAkZkNNiab/te59wpNE0Q4Kue8qxF4j58zzoY6ziJJ9wYxXL73P7koCESiuPJ1t2WA24PRWN58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542954; 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=mSIJQ/TspuDa2PAo5QMQ4208IlpFdzQnMQFqBhoTYFY=; b=JuRQd366/QdsTTXo6NnMs1hxAlxTaN3j88qcAct78+dNXP8ddcAE+Y4Ddf99GsUiQv2ST9DzsKkEVL7cKpP/xTt/0ZH35ITJ/GEoIgcPkzTZUOacIuIVXtiRiLnQC3f1RtAF/Jpk+M21sOn/UZ+AO20WEhKH0bFKaAm7n7eG+zA= 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 1599542954546895.0300965630088; Mon, 7 Sep 2020 22:29:14 -0700 (PDT) Received: from localhost ([::1]:40960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWBt-0005T9-9m for importer@patchew.org; Tue, 08 Sep 2020 01:29:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3O-0006Bz-AJ; Tue, 08 Sep 2020 01:20:26 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:44533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3M-0005xr-A7; Tue, 08 Sep 2020 01:20:25 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkm3Gp0z9sV5; Tue, 8 Sep 2020 15:20:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542400; bh=PeIhZBLtydKrEKfpTxjVJjL8zkvkMJjiCuSHLy0Dyv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZtncQTNjzI6CYgyaR3Qzd3u+WUOGUUPK6y+r5Kq+xd7BQDg4EcgHf6SwZ/MR6ocJP giTY5ZQsttrQwAUGiWa0/ADPMUqDqrZ+RXn4QAbsb+8BecOolCwddMcAr1VYNzfWrJ xZUhBp5CSbU6WHyFXVOAy7OhnVMcoXMpA7NDGKRI= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 13/33] spapr, spapr_nvdimm: fold NVDIMM validation in the same place Date: Tue, 8 Sep 2020 15:19:33 +1000 Message-Id: <20200908051953.1616885-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 NVDIMM has different contraints and conditions than the regular DIMM and we'll need to add at least one more. Instead of relying on 'if (nvdimm)' conditionals in the body of spapr_memory_pre_plug(), use the existing spapr_nvdimm_validate_opts() and put all NVDIMM handling code there. Rename it to spapr_nvdimm_validate() to reflect that the function is now checking more than the nvdimm device options. This makes spapr_memory_pre_plug() a bit easier to follow, and we can tune in NVDIMM parameters and validation in the same place. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200825215749.213536-3-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr.c | 18 ++++++------------ hw/ppc/spapr_nvdimm.c | 10 ++++++++-- include/hw/ppc/spapr_nvdimm.h | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index dd2fa4826b..b0a04443fb 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3520,7 +3520,6 @@ static void spapr_memory_pre_plug(HotplugHandler *hot= plug_dev, DeviceState *dev, { const SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(hotplug_dev); SpaprMachineState *spapr =3D SPAPR_MACHINE(hotplug_dev); - const MachineClass *mc =3D MACHINE_CLASS(smc); bool is_nvdimm =3D object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); PCDIMMDevice *dimm =3D PC_DIMM(dev); Error *local_err =3D NULL; @@ -3533,27 +3532,22 @@ static void spapr_memory_pre_plug(HotplugHandler *h= otplug_dev, DeviceState *dev, return; } =20 - if (is_nvdimm && !mc->nvdimm_supported) { - error_setg(errp, "NVDIMM hotplug not supported for this machine"); - return; - } - size =3D memory_device_get_region_size(MEMORY_DEVICE(dimm), &local_err= ); if (local_err) { error_propagate(errp, local_err); return; } =20 - if (!is_nvdimm && size % SPAPR_MEMORY_BLOCK_SIZE) { - error_setg(errp, "Hotplugged memory size must be a multiple of " - "%" PRIu64 " MB", SPAPR_MEMORY_BLOCK_SIZE / MiB); - return; - } else if (is_nvdimm) { - spapr_nvdimm_validate_opts(NVDIMM(dev), size, &local_err); + if (is_nvdimm) { + spapr_nvdimm_validate(hotplug_dev, NVDIMM(dev), size, &local_err); if (local_err) { error_propagate(errp, local_err); return; } + } else if (size % SPAPR_MEMORY_BLOCK_SIZE) { + error_setg(errp, "Hotplugged memory size must be a multiple of " + "%" PRIu64 " MB", SPAPR_MEMORY_BLOCK_SIZE / MiB); + return; } =20 memdev =3D object_property_get_link(OBJECT(dimm), PC_DIMM_MEMDEV_PROP, diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index 9a20a65640..bc2b65420c 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -30,13 +30,19 @@ #include "hw/ppc/fdt.h" #include "qemu/range.h" =20 -void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size, - Error **errp) +void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdi= mm, + uint64_t size, Error **errp) { + const MachineClass *mc =3D MACHINE_GET_CLASS(hotplug_dev); g_autofree char *uuidstr =3D NULL; QemuUUID uuid; int ret; =20 + if (!mc->nvdimm_supported) { + error_setg(errp, "NVDIMM hotplug not supported for this machine"); + return; + } + if (object_property_get_int(OBJECT(nvdimm), NVDIMM_LABEL_SIZE_PROP, &error_abort) =3D=3D 0) { error_setg(errp, "PAPR requires NVDIMM devices to have label-size = set"); diff --git a/include/hw/ppc/spapr_nvdimm.h b/include/hw/ppc/spapr_nvdimm.h index b3330cc485..fd1736634c 100644 --- a/include/hw/ppc/spapr_nvdimm.h +++ b/include/hw/ppc/spapr_nvdimm.h @@ -29,8 +29,8 @@ int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineSta= te *spapr, void *fdt, int *fdt_start_offset, Error **errp); int spapr_dt_nvdimm(void *fdt, int parent_offset, NVDIMMDevice *nvdimm); void spapr_dt_persistent_memory(void *fdt); -void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size, - Error **errp); +void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdi= mm, + uint64_t size, Error **errp); void spapr_add_nvdimm(DeviceState *dev, uint64_t slot, Error **errp); void spapr_create_nvdimm_dr_connectors(SpaprMachineState *spapr); =20 --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542778; cv=none; d=zohomail.com; s=zohoarc; b=NJYKvAzZPfpPX1XhD4vYgJ5sspfj5rSRLhJUnP23MGs6NcapwtbsgESTUuCyDgEDKkLBkfIbIpRCnuXiGESLHmhy4DB8kfNsCfY9Qn2eMOtRX/3m2MHJgcXqE6hIIzPSgAPMHoiq0UmeeOGo2WS+wPc4DRpyjot7FQxBEkumqIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542778; 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=ZrbupZIGBIFNM1FOdyFI6tgAOJEmVP8Lgpw1jIpbeGg=; b=NtzbmVVOnZn67A+aTwS2EHJeiMLfFs9UP2IjDQ3JDFF7Cn4nV+R+EjHvg/Azyd5YX+JK5hkSua8YZnFl/HSPUpUPfU4MeHswSdt/FnwEgoNFubZRmg+5yOUVA62J6uW/Yt3qirpjTpJZMkF6XlHRYW8GfS+QBtVR6TDMZXvhmLc= 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 159954277824064.10167879477888; Mon, 7 Sep 2020 22:26:18 -0700 (PDT) Received: from localhost ([::1]:56356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFW92-0008WI-VA for importer@patchew.org; Tue, 08 Sep 2020 01:26:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3O-0006CI-FB; Tue, 08 Sep 2020 01:20:26 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:36395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3M-0005y1-92; Tue, 08 Sep 2020 01:20:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkm6GNHz9sVF; Tue, 8 Sep 2020 15:20:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542400; bh=K/XOjeGYSlZyMS1PfORGCBWpuW2vS31qvW4gcdn1dfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XThN45UPri8jbVjiasQ/oHGBzHOiM7C+lDbHxCPo4iKsVS7HolQJM8PJn88yVS1Xn ymnH2jh6AMCDJd+2cPePrwXyI/g6Gw7gRudYUPdaL8oZxmHFHL7x2IiFZX+Pw0TB/E 7Shh33sxobssEflt0Uzy3Yywi2asEyEilgx5IbP8= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 14/33] ppc/spapr_nvdimm: do not enable support with 'nvdimm=off' Date: Tue, 8 Sep 2020 15:19:34 +1000 Message-Id: <20200908051953.1616885-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 The NVDIMM support for pSeries was introduced in 5.1, but it didn't contemplate the 'nvdimm' machine option that other archs uses. For every other arch, if no '-machine nvdimm(=3Don)' is present, it is assumed that the NVDIMM support is disabled. The user must explictly inform that the machine supports NVDIMM. For pseries-5.1 the 'nvdimm' option is completely ignored, and support is always assumed to exist. This leads to situations where the user is able to set 'nvdimm=3Doff' but the guest boots up with the NVDIMMs anyway. Fixing this now, after 5.1 launch, can put the overall NVDIMM support for pseries in a strange place regarding this 'nvdimm' machine option. If we force everything to be like other archs, existing pseries-5.1 guests that didn't use 'nvdimm' to use NVDIMM devices will break. If we attempt to make the newer pseries machines (5.2+) behave like everyone else, but keep pseries-5.1 untouched, we'll have consistency problems on machine upgrade (5.1 will have different default values for NVDIMM support than 5.2). The common ground here is, if the user sets 'nvdimm=3Doff', we must comply regardless of being 5.1 or 5.2+. This patch changes spapr_nvdimm_validate() to verify if the user set NVDIMM support off in the machine options and, in that case, error out if we have a NVDIMM device. The default value for 5.2+ pseries machines will still be 'nvdimm=3Don' when there is no 'nvdimm' option declared, just like it is today with pseries-5.1. In the end we'll have different default semantics from everyone else in the absence of the 'nvdimm' machine option, but this boat has sailed. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1848887 Signed-off-by: Daniel Henrique Barboza Message-Id: <20200825215749.213536-4-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_nvdimm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index bc2b65420c..95cbc30528 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -27,13 +27,17 @@ #include "hw/ppc/spapr_nvdimm.h" #include "hw/mem/nvdimm.h" #include "qemu/nvdimm-utils.h" +#include "qemu/option.h" #include "hw/ppc/fdt.h" #include "qemu/range.h" +#include "sysemu/sysemu.h" =20 void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdi= mm, uint64_t size, Error **errp) { const MachineClass *mc =3D MACHINE_GET_CLASS(hotplug_dev); + const MachineState *ms =3D MACHINE(hotplug_dev); + const char *nvdimm_opt =3D qemu_opt_get(qemu_get_machine_opts(), "nvdi= mm"); g_autofree char *uuidstr =3D NULL; QemuUUID uuid; int ret; @@ -43,6 +47,20 @@ void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, = NVDIMMDevice *nvdimm, return; } =20 + /* + * NVDIMM support went live in 5.1 without considering that, in + * other archs, the user needs to enable NVDIMM support with the + * 'nvdimm' machine option and the default behavior is NVDIMM + * support disabled. It is too late to roll back to the standard + * behavior without breaking 5.1 guests. What we can do is to + * ensure that, if the user sets nvdimm=3Doff, we error out + * regardless of being 5.1 or newer. + */ + if (!ms->nvdimms_state->is_enabled && nvdimm_opt) { + error_setg(errp, "nvdimm device found but 'nvdimm=3Doff' was set"); + return; + } + if (object_property_get_int(OBJECT(nvdimm), NVDIMM_LABEL_SIZE_PROP, &error_abort) =3D=3D 0) { error_setg(errp, "PAPR requires NVDIMM devices to have label-size = set"); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542948; cv=none; d=zohomail.com; s=zohoarc; b=ZaIdrPECyqb65te9/3UIrt9MtJcPZdL9xT+vdqKcwrPPYQFB/5rXxNhCnzg58p6rDSh87DWgIx8BFEK3Rk5PiF1Kh+2t0+VTqssDdcfrvrsUtnTnBcTy6MSzGMwCDMx/igeep6GLRbhpjFGnhQhOEyNSWFe20n0/3TXyhAyCvgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542948; h=Content-Type: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=Rq/29OMzNIu0PrzG/eXRPrRNC/tskIG9FtNVU9Z5gNU=; b=CiGQ40dXcAYs8Dw9D0nfP+xIRLSmBk8qwxt5Zg22CopAXtw/9rQKN63XJKr3DAbJMrmw0aBTuhsYSXkff2djVFXjnev6/eGLv3bkHgohKqNfmBaQdu6xh80vI55dDX2sS4/UI7+8UDTUCnoSkVX3BrFVlDQEmGfnlNo+ib+8UGU= 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 1599542948707604.0756907904735; Mon, 7 Sep 2020 22:29:08 -0700 (PDT) Received: from localhost ([::1]:40538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWBn-0005IK-Cw for importer@patchew.org; Tue, 08 Sep 2020 01:29:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3P-0006Ej-Nz; Tue, 08 Sep 2020 01:20:28 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:56169 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 1kFW3M-0005yR-G7; Tue, 08 Sep 2020 01:20:27 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkn4j7Cz9sVR; Tue, 8 Sep 2020 15:20:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542401; bh=gMiAtQjsk/Rf8aQpgZPjpS1b6eRF/e1DiGSzGhHBsJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERTwoItlbtHE23KmVMc7eyc7BYUJ3xoMAw836HTm+JyRm25dMGxW7T2iRsGzR2NaW YpmKT+U+hO4+aduS9B/aNF1Je1YDHzvtejwW/XaSYXXwEfi3ztfNwy01JNrH/Wwn5Q UF6XAqcZVOF6Ckqvd5FgAZPBMlfi1YINBQ8oFz7Q= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 15/33] target/arm: Move start-powered-off property to generic CPUState Date: Tue, 8 Sep 2020 15:19:35 +1000 Message-Id: <20200908051953.1616885-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: Eduardo Habkost , danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann There are other platforms which also have CPUs that start powered off, so generalize the start-powered-off property so that it can be used by them. Note that ARMv7MState also has a property of the same name but this patch doesn't change it because that class isn't a subclass of CPUState so it wouldn't be a trivial change. This change should not cause any change in behavior. Suggested-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-2-bauerman@linux.ibm.com> Signed-off-by: David Gibson --- exec.c | 1 + include/hw/core/cpu.h | 4 ++++ target/arm/cpu.c | 5 ++--- target/arm/cpu.h | 3 --- target/arm/kvm32.c | 2 +- target/arm/kvm64.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/exec.c b/exec.c index 7683afb6a8..e34b602bdf 100644 --- a/exec.c +++ b/exec.c @@ -899,6 +899,7 @@ Property cpu_common_props[] =3D { DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, MemoryRegion *), #endif + DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, fal= se), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 8f145733ce..9fc2696db5 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -374,6 +374,10 @@ struct CPUState { bool created; bool stop; bool stopped; + + /* Should CPU start in powered-off state? */ + bool start_powered_off; + bool unplug; bool crash_occurred; bool exit_request; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index c179e0752d..9f814194fb 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -174,8 +174,8 @@ static void arm_cpu_reset(DeviceState *dev) env->vfp.xregs[ARM_VFP_MVFR1] =3D cpu->isar.mvfr1; env->vfp.xregs[ARM_VFP_MVFR2] =3D cpu->isar.mvfr2; =20 - cpu->power_state =3D cpu->start_powered_off ? PSCI_OFF : PSCI_ON; - s->halted =3D cpu->start_powered_off; + cpu->power_state =3D s->start_powered_off ? PSCI_OFF : PSCI_ON; + s->halted =3D s->start_powered_off; =20 if (arm_feature(env, ARM_FEATURE_IWMMXT)) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] =3D 0x69051000 | 'Q'; @@ -2186,7 +2186,6 @@ static const ARMCPUInfo arm_cpus[] =3D { }; =20 static Property arm_cpu_properties[] =3D { - DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false= ), DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0), DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0), DEFINE_PROP_UINT64("mp-affinity", ARMCPU, diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a1c7d8ebae..6036f61d60 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -817,9 +817,6 @@ struct ARMCPU { */ uint32_t psci_version; =20 - /* Should CPU start in PSCI powered-off state? */ - bool start_powered_off; - /* Current power state, access guarded by BQL */ ARMPSCIState power_state; =20 diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c index 0af46b41c8..1f2b8f8b7a 100644 --- a/target/arm/kvm32.c +++ b/target/arm/kvm32.c @@ -218,7 +218,7 @@ int kvm_arch_init_vcpu(CPUState *cs) =20 /* Determine init features for this CPU */ memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features)); - if (cpu->start_powered_off) { + if (cs->start_powered_off) { cpu->kvm_init_features[0] |=3D 1 << KVM_ARM_VCPU_POWER_OFF; } if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index ef1e960285..987b35e33f 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -774,7 +774,7 @@ int kvm_arch_init_vcpu(CPUState *cs) =20 /* Determine init features for this CPU */ memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features)); - if (cpu->start_powered_off) { + if (cs->start_powered_off) { cpu->kvm_init_features[0] |=3D 1 << KVM_ARM_VCPU_POWER_OFF; } if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543044; cv=none; d=zohomail.com; s=zohoarc; b=BsV4Vcci74ULiDiiEyjIa+nrTppIT/co9ZrNB0fod+4+W68KVpZ6Jc7C3Ux4jnlgX2Rp6uutxCFRNXkjfHPm7c/SPe4gsI9GmbptALnJ7U3WRf92N00HiA+BmrRt/+IxkY4KZW5KeWrB9bqQYhL3wgYQdH+GCwyl61bpSStfphU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543044; h=Content-Type: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=oKYPjPisy0KS5GQ8+Vo32OSgvfkSVsfLmRrJLj2RfpE=; b=JgmdX0j9fkTt/MlgyPMEJb/kY1Lo9FXePII7Y1gx/AN2gDzKBq79NAeNsGmM/v4aJ5wOV9V+w/+mq8FHN06euoAkCOJS3V+Jyyi4ORVQPyYlrCBvv3W/EjTDQHSikD9+6AfKJ9Dh2R+8OzKuFVtXlo3E1Nz+lyuYVHPH7pMGlxQ= 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 1599543044494911.508224014302; Mon, 7 Sep 2020 22:30:44 -0700 (PDT) Received: from localhost ([::1]:48688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWDL-0000EW-3t for importer@patchew.org; Tue, 08 Sep 2020 01:30:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3P-0006Ek-O8; Tue, 08 Sep 2020 01:20:28 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:55593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3N-0005z9-2K; Tue, 08 Sep 2020 01:20:27 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkp0tTQz9sVL; Tue, 8 Sep 2020 15:20:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542402; bh=P6w2VcCYj0cQ8uhhqzjGXWRtMd9iDsSuS8MezV7lEKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XBL8rCT61cR/+oP9yxI9y4vaPkCDNLrgUq5S7Mvq9PaQv8ZU6l5CQIJ+MMpGMgd3L zeg89nfm4G/rHqEl1U21DtEc3xWGUuZLK1Lc91P9TJ+kiCuGnwHvxh56supugWKMXR TgeRP6OgJjgPMuCwxXwwK9G3066UdGtJbwzj3yLI= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 16/33] target/arm: Move setting of CPU halted state to generic code Date: Tue, 8 Sep 2020 15:19:36 +1000 Message-Id: <20200908051953.1616885-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: Eduardo Habkost , danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann This change is in a separate patch because it's not so obvious that it won't cause a regression. Suggested-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-3-bauerman@linux.ibm.com> Signed-off-by: David Gibson --- hw/core/cpu.c | 2 +- target/arm/cpu.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 22bc3f974a..8f65383ffb 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -258,7 +258,7 @@ static void cpu_common_reset(DeviceState *dev) } =20 cpu->interrupt_request =3D 0; - cpu->halted =3D 0; + cpu->halted =3D cpu->start_powered_off; cpu->mem_io_pc =3D 0; cpu->icount_extra =3D 0; atomic_set(&cpu->icount_decr_ptr->u32, 0); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9f814194fb..6b4e708c08 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -175,7 +175,6 @@ static void arm_cpu_reset(DeviceState *dev) env->vfp.xregs[ARM_VFP_MVFR2] =3D cpu->isar.mvfr2; =20 cpu->power_state =3D s->start_powered_off ? PSCI_OFF : PSCI_ON; - s->halted =3D s->start_powered_off; =20 if (arm_feature(env, ARM_FEATURE_IWMMXT)) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] =3D 0x69051000 | 'Q'; --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543017; cv=none; d=zohomail.com; s=zohoarc; b=GoTDp4nMXTzSW38vLvntJOeciCDEkc79yHmXqLrE03lRXQf+x9tQZvjLQI3G/F+7XG1Ydz6vxBkgOktsvAChdZRrONWLT2KAax9E/uny8PJ2T7JHBB001QhD3XR12ANE13gECg3SuBOZtYqkm5AASHJmIM9rUqN+TF2KuyFJOvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543017; 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=NfdZHn5hvSH7OulxUv36RUmL8bcujVkWtB6xouMT7bA=; b=FTJbE8PstmyeWEDJVilttzU8LuKC6Br22IWEa7pr+YJkfBKSBIObDTUqS5+GZ3J8D+zQCYCOigp04tSt+k+b5EIm5uhk4E5l2t8oJlH1huT+/sz1V6ZMvxv0g69xibO7zBGZW+94j5eVdCYB50nFmNOkEUyVC0pQEr5lm5wTNaU= 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 1599543017204561.8798481666145; Mon, 7 Sep 2020 22:30:17 -0700 (PDT) Received: from localhost ([::1]:46228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWCt-0007dp-UF for importer@patchew.org; Tue, 08 Sep 2020 01:30:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3V-0006Km-E0; Tue, 08 Sep 2020 01:20:36 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:54003 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 1kFW3S-0005zP-HU; Tue, 08 Sep 2020 01:20:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkp4gPKz9sVZ; Tue, 8 Sep 2020 15:20:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542402; bh=WHUZRE8xBkBhoLgTp8c17urX6r5gVdkN3abjLoZHMUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dw0GQw/DC9YzKmaQfkMBhm7UNb4l21xNe94YAqGA6ffU2UhZDtLEgUX634CMHBmok WS0j+b0Ds0vXTm+Q8dRr1Kwov/h8w29o8Vut07HdA2cg3stQwIvxYrgeIWLPJL3tun BDJrTDvfwrHdGCW7FG0UnmeXDl6RsmmsMb/C4YfY= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 17/33] ppc/spapr: Use start-powered-off CPUState property Date: Tue, 8 Sep 2020 15:19:37 +1000 Message-Id: <20200908051953.1616885-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: Eduardo Habkost , danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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: Thiago Jung Bauermann PowerPC sPAPR CPUs start in the halted state, and spapr_reset_vcpu() attempts to implement this by setting CPUState::halted to 1. But that's too late for the case of hotplugged CPUs in a machine configure with 2 or more threads per core. By then, other parts of QEMU have already caused the vCPU to run in an unitialized state a couple of times. For example, ppc_cpu_reset() calls ppc_tlb_invalidate_all(), which ends up calling async_run_on_cpu(). This kicks the new vCPU while it has CPUState::halted =3D 0, causing QEMU to iss= ue a KVM_RUN ioctl on the new vCPU before the guest is able to make the start-cpu RTAS call to initialize its register state. This problem doesn't seem to cause visible issues for regular guests, but on a secure guest running under the Ultravisor it does. The Ultravisor relies on being able to snoop on the start-cpu RTAS call to map vCPUs to guests, and this issue causes it to see a stray vCPU that doesn't belong to any guest. Fix by setting the start-powered-off CPUState property in spapr_create_vcpu(), which makes cpu_common_reset() initialize CPUState::halted to 1 at an earlier moment. Suggested-by: Eduardo Habkost Acked-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-4-bauerman@linux.ibm.com> Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index c4f47dcc04..2125fdac34 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -36,11 +36,6 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu) =20 cpu_reset(cs); =20 - /* All CPUs start halted. CPU0 is unhalted from the machine level - * reset code and the rest are explicitly started up by the guest - * using an RTAS call */ - cs->halted =3D 1; - env->spr[SPR_HIOR] =3D 0; =20 lpcr =3D env->spr[SPR_LPCR]; @@ -274,6 +269,11 @@ static PowerPCCPU *spapr_create_vcpu(SpaprCpuCore *sc,= int i, Error **errp) =20 cs =3D CPU(obj); cpu =3D POWERPC_CPU(obj); + /* + * All CPUs start halted. CPU0 is unhalted from the machine level rese= t code + * and the rest are explicitly started up by the guest using an RTAS c= all. + */ + cs->start_powered_off =3D true; cs->cpu_index =3D cc->core_id + i; spapr_set_vcpu_id(cpu, cs->cpu_index, &local_err); if (local_err) { --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542925; cv=none; d=zohomail.com; s=zohoarc; b=djs3jk5irted5TRBjIjrr+Fznf7cmsOZfSu9F2Jt0lrvWmsxqxyD0/fikBMk7Wka7MHUzqFIZfh+W+sN6rUOL9M6yJ2Zm4iZkndqqXiu5WjvtH5KNmPOPRtHrIZhAOPk9a5rnmrrgNJdA6ME31cF9S8l0dizgQBRRggBYK0A6y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542925; h=Content-Type: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=LTdL1SdvYh/d3FrvK0YpfxC+qEU1i/yW9n7g0B5rwQY=; b=kRcmqYLPmy6GPqNxDnDBDLlj0fKR1/d4K3dBCxoU80K/OjMZJUCaZXa3BhxvJVtwnsO5X7yglGlI+OQoTVyKvoVnE6lKgeEj0WNyBiGn+/6dYnKzcS8qqsbY1SgiGGpAG4MRZo6zYqLJAR7Zs+xaToO5fpVAjs9JSzF1fnhd3Yg= 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 1599542925033428.8616431195104; Mon, 7 Sep 2020 22:28:45 -0700 (PDT) Received: from localhost ([::1]:38226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWBP-0004Mh-Qu for importer@patchew.org; Tue, 08 Sep 2020 01:28:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3T-0006Hu-Gk; Tue, 08 Sep 2020 01:20:31 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:58895 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 1kFW3R-0005zU-PT; Tue, 08 Sep 2020 01:20:31 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkq4rc0z9sVg; Tue, 8 Sep 2020 15:20:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542403; bh=Ed8eNmI6TeOF00ug4vwXg3Ihw5WGZ2MpoWZJgwfPLvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CIrxmQDDwyU3wMzmvLD85H6VVZN7/VfAvb9h1awuk25OGBNAP6EYAw1AfAWfONfZ/ 2pu9//t33h8RgUG/s2e+dqX/KDDZzQFXFj46Ptgw/B4gD+wmwWyTNl2oQOM4jH2I8n PPriuP/xlRUzid0liMOPYG+2lmpQqOlXtX8cabUs= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 18/33] ppc/e500: Use start-powered-off CPUState property Date: Tue, 8 Sep 2020 15:19:38 +1000 Message-Id: <20200908051953.1616885-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann Instead of setting CPUState::halted to 1 in ppce500_cpu_reset_sec(), use the start-powered-off property which makes cpu_common_reset() initialize it to 1 in common code. Also change creation of CPU object from cpu_create() to object_new() and qdev_realize_and_unref() because cpu_create() realizes the CPU and it's not possible to set a property after the object is realized. Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-5-bauerman@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/ppc/e500.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index ab9884e315..ae39b9358e 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -704,9 +704,6 @@ static void ppce500_cpu_reset_sec(void *opaque) =20 cpu_reset(cs); =20 - /* Secondary CPU starts in halted state for now. Needs to change when - implementing non-kernel boot. */ - cs->halted =3D 1; cs->exception_index =3D EXCP_HLT; } =20 @@ -865,7 +862,7 @@ void ppce500_init(MachineState *machine) CPUState *cs; qemu_irq *input; =20 - cpu =3D POWERPC_CPU(cpu_create(machine->cpu_type)); + cpu =3D POWERPC_CPU(object_new(machine->cpu_type)); env =3D &cpu->env; cs =3D CPU(cpu); =20 @@ -875,6 +872,14 @@ void ppce500_init(MachineState *machine) exit(1); } =20 + /* + * Secondary CPU starts in halted state for now. Needs to change + * when implementing non-kernel boot. + */ + object_property_set_bool(OBJECT(cs), "start-powered-off", i !=3D 0, + &error_fatal); + qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal); + if (!firstenv) { firstenv =3D env; } --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599542903; cv=none; d=zohomail.com; s=zohoarc; b=PHVaHcc6kZtJSJ2txN+4mKDqAhXiB1wpqpQ1wkjCInHHE9lGtzjss4zHeV3ExIBakMsZqIITMBzeZgzoUEhcvBzDlSAJQr2D5fL5oeDbOFYTplDmyFAJRDqebzBGGqWzLPJqGErjoCRH1kHxlIkGWiftF9luD5UIbLFoAXEzL48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599542903; h=Content-Type: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=ZhEmR9miSo7svMLj3UcOYuOmoQJ1MXOOIw3AA67mxLI=; b=hLrpF8VwPQfo5Tlf3gdEjtIhJ/p37EknHr6SrUggm+CncgbtxNCf37LAwa9/wwMJr3RfbeVMrF8EWsTyrAng7Lb42iLGn1ZYOmVKRgN2eeRDUX1e5a2WCTFCH34PHnquHO6cqffGEkNybaNyBl/8HLundDC/VZnMQDfHelzP7zc= 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 1599542903456135.97765675068524; Mon, 7 Sep 2020 22:28:23 -0700 (PDT) Received: from localhost ([::1]:36314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWB4-0003ZQ-4e for importer@patchew.org; Tue, 08 Sep 2020 01:28:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3V-0006Kj-E7; Tue, 08 Sep 2020 01:20:36 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:53557 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 1kFW3S-0005zX-6f; Tue, 08 Sep 2020 01:20:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkr0mkPz9sVb; Tue, 8 Sep 2020 15:20:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542404; bh=nJoBs/BV0XUu7Aj0kMHw1zqSmXlXG1x5Ion9wGnErAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B8AmnqFdGJtHlrznZNwvoM26upOjUjG7C9zuW6YnpYGGSJvnxnWlAl/NiD8EfGAbj q14NRFcfvsQVQrH6i8eONSYAoL8MmnSipMT5K+jzBY5WugdkmC46NBYZBYf/ouiTxD px3oRVPZJivWei6hNiOUSwnqjlErGudeoR4uZQuo= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 19/33] mips/cps: Use start-powered-off CPUState property Date: Tue, 8 Sep 2020 15:19:39 +1000 Message-Id: <20200908051953.1616885-20-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann Instead of setting CPUState::halted to 1 in main_cpu_reset(), use the start-powered-off property which makes cpu_common_reset() initialize it to 1 in common code. Also change creation of CPU object from cpu_create() to object_new() and qdev_realize_and_unref() because cpu_create() realizes the CPU and it's not possible to set a property after the object is realized. Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-6-bauerman@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- hw/mips/cps.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 615e1a1ad2..23c0f87e41 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -52,9 +52,6 @@ static void main_cpu_reset(void *opaque) CPUState *cs =3D CPU(cpu); =20 cpu_reset(cs); - - /* All VPs are halted on reset. Leave powering up to CPC. */ - cs->halted =3D 1; } =20 static bool cpu_mips_itu_supported(CPUMIPSState *env) @@ -76,7 +73,17 @@ static void mips_cps_realize(DeviceState *dev, Error **e= rrp) bool saar_present =3D false; =20 for (i =3D 0; i < s->num_vp; i++) { - cpu =3D MIPS_CPU(cpu_create(s->cpu_type)); + cpu =3D MIPS_CPU(object_new(s->cpu_type)); + + /* All VPs are halted on reset. Leave powering up to CPC. */ + if (!object_property_set_bool(OBJECT(cpu), "start-powered-off", tr= ue, + errp)) { + return; + } + + if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) { + return; + } =20 /* Init internal devices */ cpu_mips_irq_init_cpu(cpu); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543058; cv=none; d=zohomail.com; s=zohoarc; b=Us2owgqn5YO5Wp3+xVZMeOQDgDrlWpOwiknpJ0WeUoWCeOy+kyRPbcGGcp4YVSoXcMAgR3b+3VkZOAhr133k1FdXqLXmVUwxv9sJ5HeEy1StUU8ISRNkSNpPWfUXqZZZZHw3WeRAxKs0kNqy/lj7dM++71irF+y4vxYtvbtDqo4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543058; h=Content-Type: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=xncsUk1VofAHIvgGAYiCwNiOKuWsPLIcWgllIK5ltxM=; b=DZxFoGdwclQvCYopWfDCGjxXPYRZYzwuzU+in7irK1z8j0815QTg4KgzhpxzCBMd9eJaViaXJAN25isPFP0EX4g/KsWmB06yYSm9P6ijSosd4DhHpKjlJJqvf1G6js5bMpctLX16EqzTzytopHpwOnnoZC9Z4e7T7/0xMinercw= 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 1599543058918794.7376264848047; Mon, 7 Sep 2020 22:30:58 -0700 (PDT) Received: from localhost ([::1]:49268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWDY-0000W7-Jq for importer@patchew.org; Tue, 08 Sep 2020 01:30:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3T-0006Hr-DH; Tue, 08 Sep 2020 01:20:31 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:55013 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 1kFW3R-0005zc-Lo; Tue, 08 Sep 2020 01:20:31 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkr3dgvz9sVl; Tue, 8 Sep 2020 15:20:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542404; bh=dJYbB/H9k9W6ajF6ItZ9vfEbGgJTvyYQif11q+Ws2WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lru9Htk6y9XTI8GUW7RPj6p5m/qzR6VVcTmq/mH1LSb7mCTw6KlUfPUa/FR7ajFxb oBCfONu4nJiQhCTK1QN5MBVNkDV2gomQY+EqYktCG7cLMnbLbwFrnXZfNIuTClpG4x 7CBcll9uld0T64Rkr/PUfY2dlwRMqIUIzcdUUQC0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 20/33] sparc/sun4m: Don't set cs->halted = 0 in main_cpu_reset() Date: Tue, 8 Sep 2020 15:19:40 +1000 Message-Id: <20200908051953.1616885-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann We rely on cpu_common_reset() to set cs->halted to 0, it's redundant to do it in main_cpu_reset(). Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-7-bauerman@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/sparc/sun4m.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index cf7dfa4af5..7484aa4438 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -224,7 +224,6 @@ static void main_cpu_reset(void *opaque) CPUState *cs =3D CPU(cpu); =20 cpu_reset(cs); - cs->halted =3D 0; } =20 static void secondary_cpu_reset(void *opaque) --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543143; cv=none; d=zohomail.com; s=zohoarc; b=Z9pHjlNX0bx6Ft9dtCkA02KFSZtrcS4SFuzWQjUwIeM553/60KspQVR4YXimgwS73OeVhDHpKtVtZEFV1Edu69GJNhIHs+hA6nvBmnP0s6wP23CAk6gkyklmFZl+h7An2xRZ4hPiWKakJ2u28orXlV0UVPhMrFpkxTbStKZLcds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543143; h=Content-Type: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=bmNk8mkf7ahCTe+o9yTlZ8M+bNnKyNDnJQNZ3jED1GU=; b=eZko2cCAPBAmFRIq5cBPlKWUBpBqM7KdCMk0/CEa1AYS7IxX8OUQvcgUgCD74zw4xw7bAoA1/KB0Wpx1hjdSkzqelX2+NShOPkPWk8FTYq/PLM8UVw5VeknHqx7ttjmlZP2uX25RKN8fPkveEazDr4mvoSUCDfi9YrAw2TJI8/k= 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 1599543143547598.4001676263028; Mon, 7 Sep 2020 22:32:23 -0700 (PDT) Received: from localhost ([::1]:56876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWEw-0003sZ-3m for importer@patchew.org; Tue, 08 Sep 2020 01:32:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3V-0006Kq-Eb; Tue, 08 Sep 2020 01:20:36 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:52433) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3T-00062t-2J; Tue, 08 Sep 2020 01:20:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltks570Tz9sVn; Tue, 8 Sep 2020 15:20:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542405; bh=+wRMb4x4M1I0zN16EWCl1WpIOSHPqee5UeeBLhwlsQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hAYt+RG2GsDHJoPB9kdbLSL1x67bIcLEaxQwPMiKF9h/e8sebQ5BBoD2FppWzS1hX JLsw68vUgmfX2QuhiKlbSvmGsLMP2d8mFGhx6UEgKFWImXf6Gqkk4nQdVCF0BokvTe 3dWga0ELmgDziq3mPZowazUN3+0VcO4dNRjdgf7k= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 21/33] sparc/sun4m: Use start-powered-off CPUState property Date: Tue, 8 Sep 2020 15:19:41 +1000 Message-Id: <20200908051953.1616885-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann Instead of setting CPUState::halted to 1 in secondary_cpu_reset(), use the start-powered-off property which makes cpu_common_reset() initialize it to 1 in common code. Now secondary_cpu_reset() becomes equivalent to main_cpu_reset() so rename the function to sun4m_cpu_reset(). Also remove setting of cs->halted from cpu_devinit(), which seems out of place when compared to similar code in other architectures (e.g., ppce500_init() in hw/ppc/e500.c). Finally, change creation of CPU object from cpu_create() to object_new() and qdev_realize_and_unref() because cpu_create() realizes the CPU and it's not possible to set a property after the object is realized. Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-8-bauerman@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/sparc/sun4m.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 7484aa4438..6bf9d27d8a 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -218,7 +218,7 @@ static void dummy_cpu_set_irq(void *opaque, int irq, in= t level) { } =20 -static void main_cpu_reset(void *opaque) +static void sun4m_cpu_reset(void *opaque) { SPARCCPU *cpu =3D opaque; CPUState *cs =3D CPU(cpu); @@ -226,15 +226,6 @@ static void main_cpu_reset(void *opaque) cpu_reset(cs); } =20 -static void secondary_cpu_reset(void *opaque) -{ - SPARCCPU *cpu =3D opaque; - CPUState *cs =3D CPU(cpu); - - cpu_reset(cs); - cs->halted =3D 1; -} - static void cpu_halt_signal(void *opaque, int irq, int level) { if (level && current_cpu) { @@ -818,21 +809,17 @@ static const TypeInfo ram_info =3D { static void cpu_devinit(const char *cpu_type, unsigned int id, uint64_t prom_addr, qemu_irq **cpu_irqs) { - CPUState *cs; SPARCCPU *cpu; CPUSPARCState *env; =20 - cpu =3D SPARC_CPU(cpu_create(cpu_type)); + cpu =3D SPARC_CPU(object_new(cpu_type)); env =3D &cpu->env; =20 cpu_sparc_set_id(env, id); - if (id =3D=3D 0) { - qemu_register_reset(main_cpu_reset, cpu); - } else { - qemu_register_reset(secondary_cpu_reset, cpu); - cs =3D CPU(cpu); - cs->halted =3D 1; - } + qemu_register_reset(sun4m_cpu_reset, cpu); + object_property_set_bool(OBJECT(cpu), "start-powered-off", id !=3D 0, + &error_fatal); + qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); *cpu_irqs =3D qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS); env->prom_addr =3D prom_addr; } --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543116; cv=none; d=zohomail.com; s=zohoarc; b=eawKxQ1jeTbC55SM5gcNCWxyXLPoNXCkUmyiZRVhbQG0Gi7TgF0pawME8piecvW/o7OwjlPojqWulltIIvPzA1QaubTlkx/hcJMPsM8GAwZFyS1rLUwn72bpwFXhkkHb32+uj3D0Z6WpIGDDrilMZtafFNK/0Gr95KhxKI+6/eI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543116; h=Content-Type: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=zfWgp7Bwu78sXdE3ADjeDPXg60t6itujCsS5A5ZBrk4=; b=AB7YO58tHNHaOy9wnoQb854CxbGsqkpBSm7TCi0f/tyHyACCqIsA+l93qW/IWL1dXTdLcPmB1X6zGdVvNoFnO0Usx4/ncnwI1pPXzheBFF/hGjo+a/xpf+80qFp6R4Oapj80TACK+D811QcficTh6QUBtlS35K6xTPpnouSvwS4= 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 1599543116597654.4521716128938; Mon, 7 Sep 2020 22:31:56 -0700 (PDT) Received: from localhost ([::1]:54404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWEU-0002gZ-0B for importer@patchew.org; Tue, 08 Sep 2020 01:31:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3V-0006Kr-E7; Tue, 08 Sep 2020 01:20:36 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:41433) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3T-00062w-4M; Tue, 08 Sep 2020 01:20:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkt1S8lz9sVm; Tue, 8 Sep 2020 15:20:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542406; bh=oeTwfet2JM4g+Thw1qR7fessfnR6Qs0F3YzSLDUcLJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GTPr9hdFlk4wEAG7l8WiBj+s+Ej+XgIq0h0Ym1Mo3waOYbsZkk88n//1yzWpBo0H9 97a0jdezjUgPsbsLSZs1eMBT9xPzIl9etllT/JlqUpPMYa4mCiYFkNUxYhuHdpPiqS 56xVm2lMUK0qtWhG3fd8Dp2jXzI+skO941F/0/g0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 22/33] target/s390x: Use start-powered-off CPUState property Date: Tue, 8 Sep 2020 15:19:42 +1000 Message-Id: <20200908051953.1616885-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, Cornelia Huck , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thiago Jung Bauermann Instead of setting CPUState::halted to 1 in s390_cpu_initfn(), use the start-powered-off property which makes cpu_common_reset() initialize it to 1 in common code. Note that this changes behavior by setting cs->halted to 1 on reset, which didn't happen before. Acked-by: Cornelia Huck Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thiago Jung Bauermann Message-Id: <20200826055535.951207-9-bauerman@linux.ibm.com> [dwg: Fix from Laurent Vivier for user only case] Signed-off-by: David Gibson --- target/s390x/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 08eb674d22..749cd548f0 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -291,9 +291,9 @@ static void s390_cpu_initfn(Object *obj) S390CPU *cpu =3D S390_CPU(obj); =20 cpu_set_cpustate_pointers(cpu); - cs->halted =3D 1; cs->exception_index =3D EXCP_HLT; #if !defined(CONFIG_USER_ONLY) + cs->start_powered_off =3D true; object_property_add(obj, "crash-information", "GuestPanicInformation", s390_cpu_get_crash_info_qom, NULL, NULL, NULL); cpu->env.tod_timer =3D --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543289; cv=none; d=zohomail.com; s=zohoarc; b=aVDRdfoTtOTE4wIzcN+N+Dfgqwf81dyT26WFtCMrwQG/oPMEt4ix2TipVx0NqMKmvGJgfbbcR59nBKA4IOrCx0FR9rJJeYciF8uxP6cJ7jw5m0psvM17+YWSE7pMqm0V2QX7lwL1gLKGJSK+gvw6mTksVglZcOA2Dn5nTdxm9iU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543289; h=Content-Type: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=xZdIkEc0Pe26TqtgAJYAhNe/Ut86voDoFS2LklEwOGE=; b=JVQVHNDMixspgWsviBDdMC+djsfRDjwok48Qrw01FuPZ91qlJ44OwxPj4P5FDMDbEgqLuAVuc9fv+ubTYW9TRe6VJtrzSJ1AdxEhzTuKVcKF/YR9BHg8QdbavWJt2KVfhA4VPI2IuHZTtMjpgPormrl63dgO+tttEeIMRt1szDU= 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 1599543289040399.3792285619087; Mon, 7 Sep 2020 22:34:49 -0700 (PDT) Received: from localhost ([::1]:43952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWHH-0001kW-RU for importer@patchew.org; Tue, 08 Sep 2020 01:34:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3q-0006py-0K; Tue, 08 Sep 2020 01:20:54 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:55565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3o-00063c-84; Tue, 08 Sep 2020 01:20:53 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkt3MfTz9sVt; Tue, 8 Sep 2020 15:20:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542406; bh=xuFY3bXkzkBea1Tgmyi1BGotOMR2WR1yFAUIQhfgKzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HkGPu1clMi1DpcpIuOs9JvdH6C9C6X8YYGFUnmn5dr9mvOqYYelSUYapyFFe02uSH eVrB71UGawGzemgpcmsUW6git8LDMyIyvMzEVqKX2pnlchzrJLk7qyiqMpkACrPAU3 gux6CXCLHkcj4Dx1KE8v08hXsoXFhj3l7sviFQPE= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 23/33] hw/ppc/ppc4xx_pci: Use ARRAY_SIZE() instead of magic value Date: Tue, 8 Sep 2020 15:19:43 +1000 Message-Id: <20200908051953.1616885-24-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.249, 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: danielhb413@gmail.com, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Replace the magic '4' by ARRAY_SIZE(s->irq) which is more explicit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200901104043.91383-4-f4bug@amsat.org> Reviewed-by: Richard Henderson Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/ppc/ppc4xx_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c index 3ea47df71f..cd3f192a13 100644 --- a/hw/ppc/ppc4xx_pci.c +++ b/hw/ppc/ppc4xx_pci.c @@ -320,7 +320,8 @@ static void ppc4xx_pcihost_realize(DeviceState *dev, Er= ror **errp) =20 b =3D pci_register_root_bus(dev, NULL, ppc4xx_pci_set_irq, ppc4xx_pci_map_irq, s->irq, get_system_memor= y(), - get_system_io(), 0, 4, TYPE_PCI_BUS); + get_system_io(), 0, ARRAY_SIZE(s->irq), + TYPE_PCI_BUS); h->bus =3D b; =20 pci_create_simple(b, 0, "ppc4xx-host-bridge"); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543214; cv=none; d=zohomail.com; s=zohoarc; b=Rs84KdsuGD6R7cxtll7CixHw+xbTMU5nyViiW68eyowFef7wGjKt7DF4b7b4tb9IW+Pu2gTxNkOrwQ1wuHklRllOCLEzKbJgHyP2+IYqLTIO2XtJoufD9/mg30nPApokwJMa2Is3JupgfOdAm7UydA2rHgT7Bl/5MZnzDF0hxCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543214; h=Content-Type: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=o0tU18fMExzu7qA7VWBNeZXlI9dJN9oGrqpqV294rGI=; b=fBc+6CMIiJ8jUSj6+QLUkI87RWgcstiHjD47QMQupk0KeOdNcp7XWJ4ziqVRERPeBvVEX0I+TQr5aErWVYYeEepCoF0smuVkx9rZAzw78Y2rtLKhHEcmlBGFi0Qcty7UwjrZNH/p26GillUyBrlQUUbjo+BYMT6r30VwD1Qtvbk= 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 159954321408828.027790493063094; Mon, 7 Sep 2020 22:33:34 -0700 (PDT) Received: from localhost ([::1]:36710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWG4-0007Ch-LU for importer@patchew.org; Tue, 08 Sep 2020 01:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3W-0006MB-JN; Tue, 08 Sep 2020 01:20:36 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:50473 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 1kFW3U-00063e-4G; Tue, 08 Sep 2020 01:20:34 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkv1hXWz9sVy; Tue, 8 Sep 2020 15:20:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542407; bh=cdhL0/jPVxK+ALKqIw6+psSZs6LOfD1nDBLYAnFnOOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUaTilZNDaurjgBZrjktu5/AIct4K/MDAezaJGOMageJZH/xegWHQ5EgiUjAWzeOo W1yIw8EU7nd/Vrb8DCFGz3ZjQOoGSjMbmmzjV0P3zH4EzJ1wYjWLlxY6iryD9eRWHo +NTaf9A8NHvCUXqJ3wrepDm144Td4AzBbFrEeZyI= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 24/33] hw/ppc/ppc4xx_pci: Replace pointless warning by assert() Date: Tue, 8 Sep 2020 15:19:44 +1000 Message-Id: <20200908051953.1616885-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 We call pci_register_root_bus() to register 4 IRQs with the ppc4xx_pci_set_irq() handler. As it can only be called with values in the [0-4[ range, replace the pointless warning by an assert(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200901104043.91383-5-f4bug@amsat.org> Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- hw/ppc/ppc4xx_pci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c index cd3f192a13..503ef46b39 100644 --- a/hw/ppc/ppc4xx_pci.c +++ b/hw/ppc/ppc4xx_pci.c @@ -256,10 +256,7 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_n= um, int level) qemu_irq *pci_irqs =3D opaque; =20 trace_ppc4xx_pci_set_irq(irq_num); - if (irq_num < 0) { - fprintf(stderr, "%s: PCI irq %d\n", __func__, irq_num); - return; - } + assert(irq_num >=3D 0); qemu_set_irq(pci_irqs[irq_num], level); } =20 --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543016; cv=none; d=zohomail.com; s=zohoarc; b=hV5yj7VDXkkeN3Se3nLfSVWIJuukxeHnsmH+4ZJE5zi/a0b3g8IhcQ1P5X7otRZXr+RfaE44riKrlQ3UCF32fhqFR6liXXV3IFt5WuOvdzRmayeIXx8nNSdgnwg+sNiE/I6UwOHJMPQhG9khjue3aW3IrpZWUbge3LZK7AygF3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543016; 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=hVHKBgn6kS6I6zqUB3Jzbme8sZu8vPYJAarbZReSlEg=; b=L8ncZ/XCR7mmTsdtV/OMhFuSUgcfYeOSZZiOZezVkOeq6wbxFk46VSewsgP4rapMv08kXDAf78nsaPGAvvABJpSs5L4X34tDkm0+2gjwJCdm/ZrwRwS0UJQFKaGXTZ/A5jo8BFBa/BmecvM5qX4Coj+pFb5XwYyXLwUZiQJyChs= 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 159954301676086.3238493884229; Mon, 7 Sep 2020 22:30:16 -0700 (PDT) Received: from localhost ([::1]:46156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWCt-0007bv-DH for importer@patchew.org; Tue, 08 Sep 2020 01:30:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3r-0006tM-Rs; Tue, 08 Sep 2020 01:20:56 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:47691 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 1kFW3p-00065u-QC; Tue, 08 Sep 2020 01:20:55 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkv4Rywz9sVw; Tue, 8 Sep 2020 15:20:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542407; bh=w0gaD0fnoCPcwqc7oF2cauElCoYD0AjnH+kJtJ0zhA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHvyhnV8kj/UJaICsSjBzp97z5WXPoV0msLraiTP+9/bHq/lk3mzxBsIIaOeO5gZ5 BJP6Zot/XKopOkWno4TYhG3CtO+R2tJtEkTHsgPFC1bpCKBRBu1FVlDPr71a/i/BQH EQaE4EPVzRgzXqYOa+xJq3DhMEnTt0TVB1RVGye0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 25/33] ppc: introducing spapr_numa.c NUMA code helper Date: Tue, 8 Sep 2020 15:19:45 +1000 Message-Id: <20200908051953.1616885-26-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 We're going to make changes in how spapr handles all ibm,associativity* related properties to enhance our current NUMA support. At this moment we have associativity code scattered all around spapr_* files, with hardcoded values and array sizes. This makes it harder to change any NUMA specific parameters in the future. Having everything in the same place allows not only for easier tuning, but also easier understanding since all NUMA related code is on the same file. This patch introduces a new file to gather all NUMA/associativity handling code in spapr, spapr_numa.c. To get things started, let's remove associativity-reference-points and max-associativity-domains code from spapr_dt_rtas() to a new helper called spapr_numa_write_rtas_dt(). This will decouple spapr_dt_rtas() from the NUMA changes that are going to happen in those two properties. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200901125645.118026-2-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/meson.build | 3 ++- hw/ppc/spapr.c | 26 ++----------------- hw/ppc/spapr_numa.c | 50 +++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr_numa.h | 20 +++++++++++++++ 4 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 hw/ppc/spapr_numa.c create mode 100644 include/hw/ppc/spapr_numa.h diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build index 918969b320..ffa2ec37fa 100644 --- a/hw/ppc/meson.build +++ b/hw/ppc/meson.build @@ -25,7 +25,8 @@ ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files( 'spapr_irq.c', 'spapr_tpm_proxy.c', 'spapr_nvdimm.c', - 'spapr_rtas_ddw.c' + 'spapr_rtas_ddw.c', + 'spapr_numa.c', )) ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c')) ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files( diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b0a04443fb..a45912acac 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -81,6 +81,7 @@ #include "hw/mem/memory-device.h" #include "hw/ppc/spapr_tpm_proxy.h" #include "hw/ppc/spapr_nvdimm.h" +#include "hw/ppc/spapr_numa.h" =20 #include "monitor/monitor.h" =20 @@ -891,16 +892,9 @@ static int spapr_dt_rng(void *fdt) static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt) { MachineState *ms =3D MACHINE(spapr); - SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(ms); int rtas; GString *hypertas =3D g_string_sized_new(256); GString *qemu_hypertas =3D g_string_sized_new(256); - uint32_t refpoints[] =3D { - cpu_to_be32(0x4), - cpu_to_be32(0x4), - cpu_to_be32(0x2), - }; - uint32_t nr_refpoints =3D ARRAY_SIZE(refpoints); uint64_t max_device_addr =3D MACHINE(spapr)->device_memory->base + memory_region_size(&MACHINE(spapr)->device_memory->mr); uint32_t lrdr_capacity[] =3D { @@ -910,14 +904,6 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, vo= id *fdt) cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE & 0xffffffff), cpu_to_be32(ms->smp.max_cpus / ms->smp.threads), }; - uint32_t maxdomain =3D cpu_to_be32(spapr->gpu_numa_id > 1 ? 1 : 0); - uint32_t maxdomains[] =3D { - cpu_to_be32(4), - maxdomain, - maxdomain, - maxdomain, - cpu_to_be32(spapr->gpu_numa_id), - }; =20 _FDT(rtas =3D fdt_add_subnode(fdt, 0, "rtas")); =20 @@ -953,15 +939,7 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, vo= id *fdt) qemu_hypertas->str, qemu_hypertas->len)); g_string_free(qemu_hypertas, TRUE); =20 - if (smc->pre_5_1_assoc_refpoints) { - nr_refpoints =3D 2; - } - - _FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points", - refpoints, nr_refpoints * sizeof(refpoints[0]))); - - _FDT(fdt_setprop(fdt, rtas, "ibm,max-associativity-domains", - maxdomains, sizeof(maxdomains))); + spapr_numa_write_rtas_dt(spapr, fdt, rtas); =20 /* * FWNMI reserves RTAS_ERROR_LOG_MAX for the machine check error log, diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c new file mode 100644 index 0000000000..cdf3288cbd --- /dev/null +++ b/hw/ppc/spapr_numa.c @@ -0,0 +1,50 @@ +/* + * QEMU PowerPC pSeries Logical Partition NUMA associativity handling + * + * Copyright IBM Corp. 2020 + * + * Authors: + * Daniel Henrique Barboza + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "hw/ppc/spapr_numa.h" +#include "hw/ppc/fdt.h" + +/* + * Helper that writes ibm,associativity-reference-points and + * max-associativity-domains in the RTAS pointed by @rtas + * in the DT @fdt. + */ +void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rta= s) +{ + SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); + uint32_t refpoints[] =3D { + cpu_to_be32(0x4), + cpu_to_be32(0x4), + cpu_to_be32(0x2), + }; + uint32_t nr_refpoints =3D ARRAY_SIZE(refpoints); + uint32_t maxdomain =3D cpu_to_be32(spapr->gpu_numa_id > 1 ? 1 : 0); + uint32_t maxdomains[] =3D { + cpu_to_be32(4), + maxdomain, + maxdomain, + maxdomain, + cpu_to_be32(spapr->gpu_numa_id), + }; + + if (smc->pre_5_1_assoc_refpoints) { + nr_refpoints =3D 2; + } + + _FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points", + refpoints, nr_refpoints * sizeof(refpoints[0]))); + + _FDT(fdt_setprop(fdt, rtas, "ibm,max-associativity-domains", + maxdomains, sizeof(maxdomains))); +} diff --git a/include/hw/ppc/spapr_numa.h b/include/hw/ppc/spapr_numa.h new file mode 100644 index 0000000000..7a370a8768 --- /dev/null +++ b/include/hw/ppc/spapr_numa.h @@ -0,0 +1,20 @@ +/* + * QEMU PowerPC pSeries Logical Partition NUMA associativity handling + * + * Copyright IBM Corp. 2020 + * + * Authors: + * Daniel Henrique Barboza + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef HW_SPAPR_NUMA_H +#define HW_SPAPR_NUMA_H + +#include "hw/ppc/spapr.h" + +void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rta= s); + +#endif /* HW_SPAPR_NUMA_H */ --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543218; cv=none; d=zohomail.com; s=zohoarc; b=jpEddJN9k+K6jD7VPjhnzYYI3xhj3juDmDUaOunD8L2tbKmFasFN6MreMvXDAyXJsQrnMIKtgNWaXdj4Sa5z1f7yQcitACLaMge7YQy3oe7kTfTf7XrAyhnyB08dUVtrdY4oyMSMEhUUjfFSYKt/DjrxoUkHn65M3fIfW12PWvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543218; 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=jyEmt79XlO+gytlQjqBArOi6F2D58GJNN9OtrIxNAvk=; b=bwVksdWw2feUMl+sAxYuzFOBDhNCKa0e62XG3AZ8Ak++r3m3NElcq78okeGv1EKYZmFsTYqIeVPvt8YGfBmb9VxQCOXeMVvF7atjYoauT9ealkOZQRh5LBUcJ3MpnXjKHL94tyrW5r7/8XHdbUlMq/So/TsUjhUkZTYtOOb9yFI= 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 159954321879970.76037649454793; Mon, 7 Sep 2020 22:33:38 -0700 (PDT) Received: from localhost ([::1]:37190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWG9-0007Ot-Cq for importer@patchew.org; Tue, 08 Sep 2020 01:33:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3r-0006tK-Pv; Tue, 08 Sep 2020 01:20:56 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:37349 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 1kFW3p-00065x-V7; Tue, 08 Sep 2020 01:20:55 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkv6Jmkz9sW3; Tue, 8 Sep 2020 15:20:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542407; bh=lcJl+18AADR+U6YFsMe0OcdCykc44CX/5zvHrK7DkR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c7fm2uoGpER5oD+5kN4oiYuUgUujuUiQzjS8ANiV0JKND+E8u5wF6KEEpu0H3Hmri RjvAv47gXLkkZqDYLUCTfDnjOqI7VjDeh1+wDZWL+4/wgZ7rNxfgwYPC1Hc156L3kR vDgzLWeLyjCoXonqHwZ5raVeudkm6v4T4pekmPPc= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 26/33] ppc/spapr_nvdimm: turn spapr_dt_nvdimm() static Date: Tue, 8 Sep 2020 15:19:46 +1000 Message-Id: <20200908051953.1616885-27-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 function is only used inside spapr_nvdimm.c. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200901125645.118026-3-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_nvdimm.c | 22 +++++++++++----------- include/hw/ppc/spapr_nvdimm.h | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index 95cbc30528..5188e2f503 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -106,16 +106,6 @@ void spapr_add_nvdimm(DeviceState *dev, uint64_t slot,= Error **errp) } } =20 -int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, - void *fdt, int *fdt_start_offset, Error **errp) -{ - NVDIMMDevice *nvdimm =3D NVDIMM(drc->dev); - - *fdt_start_offset =3D spapr_dt_nvdimm(fdt, 0, nvdimm); - - return 0; -} - void spapr_create_nvdimm_dr_connectors(SpaprMachineState *spapr) { MachineState *machine =3D MACHINE(spapr); @@ -127,7 +117,7 @@ void spapr_create_nvdimm_dr_connectors(SpaprMachineStat= e *spapr) } =20 =20 -int spapr_dt_nvdimm(void *fdt, int parent_offset, +static int spapr_dt_nvdimm(void *fdt, int parent_offset, NVDIMMDevice *nvdimm) { int child_offset; @@ -184,6 +174,16 @@ int spapr_dt_nvdimm(void *fdt, int parent_offset, return child_offset; } =20 +int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, + void *fdt, int *fdt_start_offset, Error **errp) +{ + NVDIMMDevice *nvdimm =3D NVDIMM(drc->dev); + + *fdt_start_offset =3D spapr_dt_nvdimm(fdt, 0, nvdimm); + + return 0; +} + void spapr_dt_persistent_memory(void *fdt) { int offset =3D fdt_subnode_offset(fdt, 0, "persistent-memory"); diff --git a/include/hw/ppc/spapr_nvdimm.h b/include/hw/ppc/spapr_nvdimm.h index fd1736634c..10a6d9dbbc 100644 --- a/include/hw/ppc/spapr_nvdimm.h +++ b/include/hw/ppc/spapr_nvdimm.h @@ -27,7 +27,6 @@ QEMU_BUILD_BUG_ON(SPAPR_MINIMUM_SCM_BLOCK_SIZE % SPAPR_ME= MORY_BLOCK_SIZE); =20 int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, void *fdt, int *fdt_start_offset, Error **errp); -int spapr_dt_nvdimm(void *fdt, int parent_offset, NVDIMMDevice *nvdimm); void spapr_dt_persistent_memory(void *fdt); void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdi= mm, uint64_t size, Error **errp); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543163; cv=none; d=zohomail.com; s=zohoarc; b=dUhTcqq4GwtAHDToS8OQV5q3JwSpCr78YTHYYfQN0NnDiCbbJkvKDfLiomIulmsdCbn2ELjMgZH3MCmo6+7fssPwMPsvCLKzIbf+CARS9aJYLjRtwjws6XAooXS8kH+dDFl1FKUeY/AUIT1IDXWK2MFkZZItKWmUwT07QqdC5lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543163; 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=tI3kWYpFycLBTcBLiTUv6HtR3lJFpkl0kib+ZVlpt7c=; b=YAWPhqqKUGKjfUrRP6pSvlggXN54GKPF18vmANLB+8gTfmXGqfbz0gCSX5rPF26brBGUyG+cTaFVYKvtwuS1i1E1vJfC1jZJjMDq+iiQqgEdM0B6qGnuyd1tosPjxzx2YZfl9VpeDUmuQnZNRbKsRzqV0+/iClsrpabzNyNA+ag= 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 1599543163909200.58320583672082; Mon, 7 Sep 2020 22:32:43 -0700 (PDT) Received: from localhost ([::1]:59242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWFG-0004s2-Fb for importer@patchew.org; Tue, 08 Sep 2020 01:32:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3w-0006xN-CU; Tue, 08 Sep 2020 01:21:00 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:45399 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 1kFW3r-00067B-ST; Tue, 08 Sep 2020 01:21:00 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkw4bdpz9sWC; Tue, 8 Sep 2020 15:20:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542408; bh=EMhX4EaQtYbgZPvdJDLhYZH3ThfzDd5O94XDFPoOgFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMmv9tKqGKNDPPalay0OcbDzST3ZGh2gD198kPxgat9JCe33olmt0e36etfJKU9Fh pHruTpBkapcUshtvyHkC/UA4KZ6uFAM8/XUz4mWfhKERUu6RATz0Y4pfni3Nlv7YyD Jr0ps42cqp4couO6kvJJXUwCt7r4VV9yFVh9utJw= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 27/33] spapr: introduce SpaprMachineState::numa_assoc_array Date: Tue, 8 Sep 2020 15:19:47 +1000 Message-Id: <20200908051953.1616885-28-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 The next step to centralize all NUMA/associativity handling in the spapr machine is to create a 'one stop place' for all things ibm,associativity. This patch introduces numa_assoc_array, a 2 dimensional array that will store all ibm,associativity arrays of all NUMA nodes. This array is initialized in a new spapr_numa_associativity_init() function, called in spapr_machine_init(). It is being initialized with the same values used in other ibm,associativity properties around spapr files (i.e. all zeros, last value is node_id). The idea is to remove all hardcoded definitions and FDT writes of ibm,associativity arrays, doing instead a call to the new helper spapr_numa_write_associativity_dt() helper, that will be able to write the DT with the correct values. We'll start small, handling the trivial cases first. The remaining instances of ibm,associativity will be handled next. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200903220639.563090-2-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr.c | 23 ++++++++++------------- hw/ppc/spapr_numa.c | 30 ++++++++++++++++++++++++++++++ hw/ppc/spapr_nvdimm.c | 19 +++++++------------ hw/ppc/spapr_pci.c | 9 ++------- include/hw/ppc/spapr.h | 12 ++++++++++++ include/hw/ppc/spapr_numa.h | 11 +++++++++++ include/hw/ppc/spapr_nvdimm.h | 2 +- 7 files changed, 73 insertions(+), 33 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a45912acac..1ad6f59863 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -314,14 +314,9 @@ static void add_str(GString *s, const gchar *s1) g_string_append_len(s, s1, strlen(s1) + 1); } =20 -static int spapr_dt_memory_node(void *fdt, int nodeid, hwaddr start, - hwaddr size) +static int spapr_dt_memory_node(SpaprMachineState *spapr, void *fdt, int n= odeid, + hwaddr start, hwaddr size) { - uint32_t associativity[] =3D { - cpu_to_be32(0x4), /* length */ - cpu_to_be32(0x0), cpu_to_be32(0x0), - cpu_to_be32(0x0), cpu_to_be32(nodeid) - }; char mem_name[32]; uint64_t mem_reg_property[2]; int off; @@ -335,8 +330,7 @@ static int spapr_dt_memory_node(void *fdt, int nodeid, = hwaddr start, _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg_property, sizeof(mem_reg_property)))); - _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, - sizeof(associativity)))); + spapr_numa_write_associativity_dt(spapr, fdt, off, nodeid); return off; } =20 @@ -649,7 +643,7 @@ static int spapr_dt_memory(SpaprMachineState *spapr, vo= id *fdt) if (!mem_start) { /* spapr_machine_init() checks for rma_size <=3D node0_size * already */ - spapr_dt_memory_node(fdt, i, 0, spapr->rma_size); + spapr_dt_memory_node(spapr, fdt, i, 0, spapr->rma_size); mem_start +=3D spapr->rma_size; node_size -=3D spapr->rma_size; } @@ -661,7 +655,7 @@ static int spapr_dt_memory(SpaprMachineState *spapr, vo= id *fdt) sizetmp =3D 1ULL << ctzl(mem_start); } =20 - spapr_dt_memory_node(fdt, i, mem_start, sizetmp); + spapr_dt_memory_node(spapr, fdt, i, mem_start, sizetmp); node_size -=3D sizetmp; mem_start +=3D sizetmp; } @@ -1275,7 +1269,7 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool = reset, size_t space) =20 /* NVDIMM devices */ if (mc->nvdimm_supported) { - spapr_dt_persistent_memory(fdt); + spapr_dt_persistent_memory(spapr, fdt); } =20 return fdt; @@ -2810,6 +2804,9 @@ static void spapr_machine_init(MachineState *machine) */ spapr->gpu_numa_id =3D MAX(1, machine->numa_state->num_nodes); =20 + /* Init numa_assoc_array */ + spapr_numa_associativity_init(spapr, machine); + if ((!kvm_enabled() || kvmppc_has_cap_mmu_radix()) && ppc_type_check_compat(machine->cpu_type, CPU_POWERPC_LOGICAL_3_00,= 0, spapr->max_compat_pvr)) { @@ -3394,7 +3391,7 @@ int spapr_lmb_dt_populate(SpaprDrc *drc, SpaprMachine= State *spapr, addr =3D spapr_drc_index(drc) * SPAPR_MEMORY_BLOCK_SIZE; node =3D object_property_get_uint(OBJECT(drc->dev), PC_DIMM_NODE_PROP, &error_abort); - *fdt_start_offset =3D spapr_dt_memory_node(fdt, node, addr, + *fdt_start_offset =3D spapr_dt_memory_node(spapr, fdt, node, addr, SPAPR_MEMORY_BLOCK_SIZE); return 0; } diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index cdf3288cbd..f6b6fe648f 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -15,6 +15,36 @@ #include "hw/ppc/spapr_numa.h" #include "hw/ppc/fdt.h" =20 + +void spapr_numa_associativity_init(SpaprMachineState *spapr, + MachineState *machine) +{ + int nb_numa_nodes =3D machine->numa_state->num_nodes; + int i; + + /* + * For all associativity arrays: first position is the size, + * position MAX_DISTANCE_REF_POINTS is always the numa_id, + * represented by the index 'i'. + * + * This will break on sparse NUMA setups, when/if QEMU starts + * to support it, because there will be no more guarantee that + * 'i' will be a valid node_id set by the user. + */ + for (i =3D 0; i < nb_numa_nodes; i++) { + spapr->numa_assoc_array[i][0] =3D cpu_to_be32(MAX_DISTANCE_REF_POI= NTS); + spapr->numa_assoc_array[i][MAX_DISTANCE_REF_POINTS] =3D cpu_to_be3= 2(i); + } +} + +void spapr_numa_write_associativity_dt(SpaprMachineState *spapr, void *fdt, + int offset, int nodeid) +{ + _FDT((fdt_setprop(fdt, offset, "ibm,associativity", + spapr->numa_assoc_array[nodeid], + sizeof(spapr->numa_assoc_array[nodeid])))); +} + /* * Helper that writes ibm,associativity-reference-points and * max-associativity-domains in the RTAS pointed by @rtas diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index 5188e2f503..63872054f3 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -31,6 +31,7 @@ #include "hw/ppc/fdt.h" #include "qemu/range.h" #include "sysemu/sysemu.h" +#include "hw/ppc/spapr_numa.h" =20 void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdi= mm, uint64_t size, Error **errp) @@ -117,8 +118,8 @@ void spapr_create_nvdimm_dr_connectors(SpaprMachineStat= e *spapr) } =20 =20 -static int spapr_dt_nvdimm(void *fdt, int parent_offset, - NVDIMMDevice *nvdimm) +static int spapr_dt_nvdimm(SpaprMachineState *spapr, void *fdt, + int parent_offset, NVDIMMDevice *nvdimm) { int child_offset; char *buf; @@ -128,11 +129,6 @@ static int spapr_dt_nvdimm(void *fdt, int parent_offse= t, &error_abort); uint64_t slot =3D object_property_get_uint(OBJECT(nvdimm), PC_DIMM_SLO= T_PROP, &error_abort); - uint32_t associativity[] =3D { - cpu_to_be32(0x4), /* length */ - cpu_to_be32(0x0), cpu_to_be32(0x0), - cpu_to_be32(0x0), cpu_to_be32(node) - }; uint64_t lsize =3D nvdimm->label_size; uint64_t size =3D object_property_get_int(OBJECT(nvdimm), PC_DIMM_SIZE= _PROP, NULL); @@ -152,8 +148,7 @@ static int spapr_dt_nvdimm(void *fdt, int parent_offset, _FDT((fdt_setprop_string(fdt, child_offset, "compatible", "ibm,pmemory= "))); _FDT((fdt_setprop_string(fdt, child_offset, "device_type", "ibm,pmemor= y"))); =20 - _FDT((fdt_setprop(fdt, child_offset, "ibm,associativity", associativit= y, - sizeof(associativity)))); + spapr_numa_write_associativity_dt(spapr, fdt, child_offset, node); =20 buf =3D qemu_uuid_unparse_strdup(&nvdimm->uuid); _FDT((fdt_setprop_string(fdt, child_offset, "ibm,unit-guid", buf))); @@ -179,12 +174,12 @@ int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachin= eState *spapr, { NVDIMMDevice *nvdimm =3D NVDIMM(drc->dev); =20 - *fdt_start_offset =3D spapr_dt_nvdimm(fdt, 0, nvdimm); + *fdt_start_offset =3D spapr_dt_nvdimm(spapr, fdt, 0, nvdimm); =20 return 0; } =20 -void spapr_dt_persistent_memory(void *fdt) +void spapr_dt_persistent_memory(SpaprMachineState *spapr, void *fdt) { int offset =3D fdt_subnode_offset(fdt, 0, "persistent-memory"); GSList *iter, *nvdimms =3D nvdimm_get_device_list(); @@ -202,7 +197,7 @@ void spapr_dt_persistent_memory(void *fdt) for (iter =3D nvdimms; iter; iter =3D iter->next) { NVDIMMDevice *nvdimm =3D iter->data; =20 - spapr_dt_nvdimm(fdt, offset, nvdimm); + spapr_dt_nvdimm(spapr, fdt, offset, nvdimm); } g_slist_free(nvdimms); =20 diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 0a418f1e67..4d97ff6c70 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -52,6 +52,7 @@ #include "sysemu/kvm.h" #include "sysemu/hostmem.h" #include "sysemu/numa.h" +#include "hw/ppc/spapr_numa.h" =20 /* Copied from the kernel arch/powerpc/platforms/pseries/msi.c */ #define RTAS_QUERY_FN 0 @@ -2321,11 +2322,6 @@ int spapr_dt_phb(SpaprMachineState *spapr, SpaprPhbS= tate *phb, cpu_to_be32(1), cpu_to_be32(RTAS_IBM_RESET_PE_DMA_WINDOW) }; - uint32_t associativity[] =3D {cpu_to_be32(0x4), - cpu_to_be32(0x0), - cpu_to_be32(0x0), - cpu_to_be32(0x0), - cpu_to_be32(phb->numa_node)}; SpaprTceTable *tcet; SpaprDrc *drc; Error *err =3D NULL; @@ -2358,8 +2354,7 @@ int spapr_dt_phb(SpaprMachineState *spapr, SpaprPhbSt= ate *phb, =20 /* Advertise NUMA via ibm,associativity */ if (phb->numa_node !=3D -1) { - _FDT(fdt_setprop(fdt, bus_off, "ibm,associativity", associativity, - sizeof(associativity))); + spapr_numa_write_associativity_dt(spapr, fdt, bus_off, phb->numa_n= ode); } =20 /* Build the interrupt-map, this must matches what is done diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index a1e230ad39..9a63380801 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -105,6 +105,16 @@ typedef enum { =20 #define FDT_MAX_SIZE 0x100000 =20 +/* + * NUMA related macros. MAX_DISTANCE_REF_POINTS was taken + * from Taken from Linux kernel arch/powerpc/mm/numa.h. + * + * NUMA_ASSOC_SIZE is the base array size of an ibm,associativity + * array for any non-CPU resource. + */ +#define MAX_DISTANCE_REF_POINTS 4 +#define NUMA_ASSOC_SIZE (MAX_DISTANCE_REF_POINTS + 1) + typedef struct SpaprCapabilities SpaprCapabilities; struct SpaprCapabilities { uint8_t caps[SPAPR_CAP_NUM]; @@ -231,6 +241,8 @@ struct SpaprMachineState { unsigned gpu_numa_id; SpaprTpmProxy *tpm_proxy; =20 + uint32_t numa_assoc_array[MAX_NODES][NUMA_ASSOC_SIZE]; + Error *fwnmi_migration_blocker; }; =20 diff --git a/include/hw/ppc/spapr_numa.h b/include/hw/ppc/spapr_numa.h index 7a370a8768..a2a4df55f7 100644 --- a/include/hw/ppc/spapr_numa.h +++ b/include/hw/ppc/spapr_numa.h @@ -13,8 +13,19 @@ #ifndef HW_SPAPR_NUMA_H #define HW_SPAPR_NUMA_H =20 +#include "hw/boards.h" #include "hw/ppc/spapr.h" =20 +/* + * Having both SpaprMachineState and MachineState as arguments + * feels odd, but it will spare a MACHINE() call inside the + * function. spapr_machine_init() is the only caller for it, and + * it has both pointers resolved already. + */ +void spapr_numa_associativity_init(SpaprMachineState *spapr, + MachineState *machine); void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rta= s); +void spapr_numa_write_associativity_dt(SpaprMachineState *spapr, void *fdt, + int offset, int nodeid); =20 #endif /* HW_SPAPR_NUMA_H */ diff --git a/include/hw/ppc/spapr_nvdimm.h b/include/hw/ppc/spapr_nvdimm.h index 10a6d9dbbc..3eb344e8e9 100644 --- a/include/hw/ppc/spapr_nvdimm.h +++ b/include/hw/ppc/spapr_nvdimm.h @@ -27,7 +27,7 @@ QEMU_BUILD_BUG_ON(SPAPR_MINIMUM_SCM_BLOCK_SIZE % SPAPR_ME= MORY_BLOCK_SIZE); =20 int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, void *fdt, int *fdt_start_offset, Error **errp); -void spapr_dt_persistent_memory(void *fdt); +void spapr_dt_persistent_memory(SpaprMachineState *spapr, void *fdt); void spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdi= mm, uint64_t size, Error **errp); void spapr_add_nvdimm(DeviceState *dev, uint64_t slot, Error **errp); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543292; cv=none; d=zohomail.com; s=zohoarc; b=UY8lpYH6qcn7SXDvZhmjZES4NH9bq9HZEz7SE+zoPVIoww8p7AIICCoPIh4HO8/tQzF3binOGaFS2KDNaR9QC/ylhHf9ellJ06eQQTpWRNUEsUzlVHuFlj0uV+ltC2MkTEqKBdnOpjWNDOa+a4Fq+9buEKK0jD6yRMpAm0+DMqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543292; 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=AA5r1dHH9cDe/Kgu+51fb2OJXGf9rIEH7LzpMZLv4sE=; b=ZpVwPVyyY1LwBU4Bk/G5E2ziSdRL9CXhAaRSMvngSchggiUFE9YasUDbP7sKYBTqj0wDh1TaM+yPJJfLu2FSGVyTnrx7tVRLuSf8TGUPDZ6Rydb09rSYLBRfoiT/behxZ87GI01b3dwUWWH540X0D9QUPjKklS1rPN8dhfErAac= 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 1599543292133734.0750012349084; Mon, 7 Sep 2020 22:34:52 -0700 (PDT) Received: from localhost ([::1]:44130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWHK-0001oy-K2 for importer@patchew.org; Tue, 08 Sep 2020 01:34:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3u-0006uP-Gw; Tue, 08 Sep 2020 01:20:58 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:56761 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 1kFW3r-00067C-V1; Tue, 08 Sep 2020 01:20:58 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkw6p75z9sW4; Tue, 8 Sep 2020 15:20:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542408; bh=9NQAqnoONh9rFKU8TUpYRJUuT2TBxdaAhdIQ+VP3cgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JlvIJpPhz+KoyJ1HSGTbSFUdzz8hB9Um1edUOYm4yn0nOB/7+zAiOJ6IG2FZnoRwe 9FbJO397ZHp86wQ6DRfMl1HMusvx2a14pAYPem0q1hKxdqwsadx0IXEi4vlNJAqkRr S8XIWi0ezi7OtygDU9zzecenS8idOD4LeWyqPMRE= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 28/33] spapr, spapr_numa: handle vcpu ibm,associativity Date: Tue, 8 Sep 2020 15:19:48 +1000 Message-Id: <20200908051953.1616885-29-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 Vcpus have an additional paramenter to be appended, vcpu_id. This also changes the size of the of property itself, which is being represented in index 0 of numa_assoc_array[cpu->node_id], and defaults to MAX_DISTANCE_REF_POINTS for all cases but vcpus. All this logic makes more sense in spapr_numa.c, where we handle everything NUMA and associativity. A new helper spapr_numa_fixup_cpu_dt() was added, and spapr.c uses it the same way as it was using the former spapr_fixup_cpu_numa_dt(). Signed-off-by: Daniel Henrique Barboza Message-Id: <20200903220639.563090-3-danielhb413@gmail.com> [dwg: Correct uint to int type, which can break windows builds] Signed-off-by: David Gibson --- hw/ppc/spapr.c | 17 +---------------- hw/ppc/spapr_numa.c | 27 +++++++++++++++++++++++++++ include/hw/ppc/spapr_numa.h | 2 ++ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 1ad6f59863..badfa86319 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -202,21 +202,6 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offse= t, PowerPCCPU *cpu, return ret; } =20 -static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu) -{ - int index =3D spapr_get_vcpu_id(cpu); - uint32_t associativity[] =3D {cpu_to_be32(0x5), - cpu_to_be32(0x0), - cpu_to_be32(0x0), - cpu_to_be32(0x0), - cpu_to_be32(cpu->node_id), - cpu_to_be32(index)}; - - /* Advertise NUMA via ibm,associativity */ - return fdt_setprop(fdt, offset, "ibm,associativity", associativity, - sizeof(associativity)); -} - static void spapr_dt_pa_features(SpaprMachineState *spapr, PowerPCCPU *cpu, void *fdt, int offset) @@ -785,7 +770,7 @@ static void spapr_dt_cpu(CPUState *cs, void *fdt, int o= ffset, pft_size_prop, sizeof(pft_size_prop)))); =20 if (ms->numa_state->num_nodes > 1) { - _FDT(spapr_fixup_cpu_numa_dt(fdt, offset, cpu)); + _FDT(spapr_numa_fixup_cpu_dt(spapr, fdt, offset, cpu)); } =20 _FDT(spapr_fixup_cpu_smt_dt(fdt, offset, cpu, compat_smt)); diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index f6b6fe648f..523801fb14 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -45,6 +45,33 @@ void spapr_numa_write_associativity_dt(SpaprMachineState= *spapr, void *fdt, sizeof(spapr->numa_assoc_array[nodeid])))); } =20 +int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, void *fdt, + int offset, PowerPCCPU *cpu) +{ + int vcpu_assoc_size =3D NUMA_ASSOC_SIZE + 1; + uint32_t vcpu_assoc[vcpu_assoc_size]; + int index =3D spapr_get_vcpu_id(cpu); + int i; + + /* + * VCPUs have an extra 'cpu_id' value in ibm,associativity + * compared to other resources. Increment the size at index + * 0, copy all associativity domains already set, then put + * cpu_id last. + */ + vcpu_assoc[0] =3D cpu_to_be32(MAX_DISTANCE_REF_POINTS + 1); + + for (i =3D 1; i <=3D MAX_DISTANCE_REF_POINTS; i++) { + vcpu_assoc[i] =3D spapr->numa_assoc_array[cpu->node_id][i]; + } + + vcpu_assoc[vcpu_assoc_size - 1] =3D cpu_to_be32(index); + + /* Advertise NUMA via ibm,associativity */ + return fdt_setprop(fdt, offset, "ibm,associativity", + vcpu_assoc, sizeof(vcpu_assoc)); +} + /* * Helper that writes ibm,associativity-reference-points and * max-associativity-domains in the RTAS pointed by @rtas diff --git a/include/hw/ppc/spapr_numa.h b/include/hw/ppc/spapr_numa.h index a2a4df55f7..43c6a16fe3 100644 --- a/include/hw/ppc/spapr_numa.h +++ b/include/hw/ppc/spapr_numa.h @@ -27,5 +27,7 @@ void spapr_numa_associativity_init(SpaprMachineState *spa= pr, void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rta= s); void spapr_numa_write_associativity_dt(SpaprMachineState *spapr, void *fdt, int offset, int nodeid); +int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, void *fdt, + int offset, PowerPCCPU *cpu); =20 #endif /* HW_SPAPR_NUMA_H */ --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543117; cv=none; d=zohomail.com; s=zohoarc; b=RI+WmhbjWeNy0eh9hQD9iqRyrj6b6NttID9rv6QxOFbLyuYvGlJqR/YrcUugAKfrb7SFrz3ZCKr6EWZQ89l35EvV+ESd9M4h6/SBkDwem2XSi4zzFBLcv094Lf/hcobO9oWIYAHb1DE97bhyzvztkNL9TdsemslRAa7cKrMD39U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543117; 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=dcI+605Fycyg1jTYbE/tAl5HVCYr6HUdprSL4SpTF+w=; b=TehNYowKc26TRxyrOPeggmt62yGn4cLAnmtdw658rlNgm/+ya5vNqA8FVO6++uYtTtSdg62/9vTPUjyze0pRCg7OOnD5dOvEi7231OCo5ZxFonhpscbPswoS9RMfiGC5sG+mXi4Ug89THCqhKWB0yWyut9N7djcrGOm38EkBd6w= 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 1599543117266115.76892057418456; Mon, 7 Sep 2020 22:31:57 -0700 (PDT) Received: from localhost ([::1]:54392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWEU-0002gK-V9 for importer@patchew.org; Tue, 08 Sep 2020 01:31:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3u-0006uN-HA; Tue, 08 Sep 2020 01:20:58 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:45295 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 1kFW3s-00067F-3n; Tue, 08 Sep 2020 01:20:58 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkx2MX0z9sW6; Tue, 8 Sep 2020 15:20:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542409; bh=uXD1j989gi+UqljwaBJ4eXP5DEHu3m3tC+F0UdnctWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIGTpnh6gor0+Lfku1LL+LZRdWUs2u648aT5SkCsURWHKGjhJWtEduHu5B9yYVN/v D24V+tBhtW0BEXG0rYBOP3FX7YPvkWCWRbO1560mnna4gnqAhAY6cW5N1+MOI+Mkc6 /uVMlKi70BL08ICYv/eSHr1JT3S5XhY2qHp6Rz1c= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 29/33] spapr, spapr_numa: move lookup-arrays handling to spapr_numa.c Date: Tue, 8 Sep 2020 15:19:49 +1000 Message-Id: <20200908051953.1616885-30-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 In a similar fashion as the previous patch, let's move the handling of ibm,associativity-lookup-arrays from spapr.c to spapr_numa.c. A spapr_numa_write_assoc_lookup_arrays() helper was created, and spapr_dt_dynamic_reconfiguration_memory() can now use it to advertise the lookup-arrays. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200903220639.563090-4-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr.c | 25 ++----------------------- hw/ppc/spapr_numa.c | 34 ++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr_numa.h | 2 ++ 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index badfa86319..9bce1892b5 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -535,13 +535,10 @@ static int spapr_dt_dynamic_reconfiguration_memory(Sp= aprMachineState *spapr, void *fdt) { MachineState *machine =3D MACHINE(spapr); - int nb_numa_nodes =3D machine->numa_state->num_nodes; - int ret, i, offset; + int ret, offset; uint64_t lmb_size =3D SPAPR_MEMORY_BLOCK_SIZE; uint32_t prop_lmb_size[] =3D {cpu_to_be32(lmb_size >> 32), cpu_to_be32(lmb_size & 0xffffffff)}; - uint32_t *int_buf, *cur_index, buf_len; - int nr_nodes =3D nb_numa_nodes ? nb_numa_nodes : 1; MemoryDeviceInfoList *dimms =3D NULL; =20 /* @@ -582,25 +579,7 @@ static int spapr_dt_dynamic_reconfiguration_memory(Spa= prMachineState *spapr, return ret; } =20 - /* ibm,associativity-lookup-arrays */ - buf_len =3D (nr_nodes * 4 + 2) * sizeof(uint32_t); - cur_index =3D int_buf =3D g_malloc0(buf_len); - int_buf[0] =3D cpu_to_be32(nr_nodes); - int_buf[1] =3D cpu_to_be32(4); /* Number of entries per associativity = list */ - cur_index +=3D 2; - for (i =3D 0; i < nr_nodes; i++) { - uint32_t associativity[] =3D { - cpu_to_be32(0x0), - cpu_to_be32(0x0), - cpu_to_be32(0x0), - cpu_to_be32(i) - }; - memcpy(cur_index, associativity, sizeof(associativity)); - cur_index +=3D 4; - } - ret =3D fdt_setprop(fdt, offset, "ibm,associativity-lookup-arrays", in= t_buf, - (cur_index - int_buf) * sizeof(uint32_t)); - g_free(int_buf); + ret =3D spapr_numa_write_assoc_lookup_arrays(spapr, fdt, offset); =20 return ret; } diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 523801fb14..42394f36e9 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -72,6 +72,40 @@ int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, vo= id *fdt, vcpu_assoc, sizeof(vcpu_assoc)); } =20 + +int spapr_numa_write_assoc_lookup_arrays(SpaprMachineState *spapr, void *f= dt, + int offset) +{ + MachineState *machine =3D MACHINE(spapr); + int nb_numa_nodes =3D machine->numa_state->num_nodes; + int nr_nodes =3D nb_numa_nodes ? nb_numa_nodes : 1; + uint32_t *int_buf, *cur_index, buf_len; + int ret, i; + + /* ibm,associativity-lookup-arrays */ + buf_len =3D (nr_nodes * MAX_DISTANCE_REF_POINTS + 2) * sizeof(uint32_t= ); + cur_index =3D int_buf =3D g_malloc0(buf_len); + int_buf[0] =3D cpu_to_be32(nr_nodes); + /* Number of entries per associativity list */ + int_buf[1] =3D cpu_to_be32(MAX_DISTANCE_REF_POINTS); + cur_index +=3D 2; + for (i =3D 0; i < nr_nodes; i++) { + /* + * For the lookup-array we use the ibm,associativity array, + * from numa_assoc_array. without the first element (size). + */ + uint32_t *associativity =3D spapr->numa_assoc_array[i]; + memcpy(cur_index, ++associativity, + sizeof(uint32_t) * MAX_DISTANCE_REF_POINTS); + cur_index +=3D MAX_DISTANCE_REF_POINTS; + } + ret =3D fdt_setprop(fdt, offset, "ibm,associativity-lookup-arrays", in= t_buf, + (cur_index - int_buf) * sizeof(uint32_t)); + g_free(int_buf); + + return ret; +} + /* * Helper that writes ibm,associativity-reference-points and * max-associativity-domains in the RTAS pointed by @rtas diff --git a/include/hw/ppc/spapr_numa.h b/include/hw/ppc/spapr_numa.h index 43c6a16fe3..b3fd950634 100644 --- a/include/hw/ppc/spapr_numa.h +++ b/include/hw/ppc/spapr_numa.h @@ -29,5 +29,7 @@ void spapr_numa_write_associativity_dt(SpaprMachineState = *spapr, void *fdt, int offset, int nodeid); int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, void *fdt, int offset, PowerPCCPU *cpu); +int spapr_numa_write_assoc_lookup_arrays(SpaprMachineState *spapr, void *f= dt, + int offset); =20 #endif /* HW_SPAPR_NUMA_H */ --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543427; cv=none; d=zohomail.com; s=zohoarc; b=JzrUyfyLrDBzr43WKm0bJNCo1OHqq4troAlVhQTqqBmS2Vyk7RyT4KoMpQyYaUsbn4fpwIz/EBcSJaeJCwZ97qS0SCM9N3ue5h5GCLspujnZMiTwqaZmgVglQ5cBoDiGSsQLV/cL82Nohf9D7wOBUZFuBNYy1sF6lv6f7hmuYWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543427; 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=sdPguIs9+nIaOqZ1t0Dpz9JJSflN5YaDAxB9IpFA8Xs=; b=nd92SRfbXDfbOcIE/DPriJGTj66crQ1i3xiBZEqLa8BGQgC2/MnlQH3J/z8Z0l04Xj2QKMzgFo2YnSra90HmxBy4IGA4Ro39W/Lb4atCTja+wRMXioYDTOY6+/f3LUtGbf9dn5EkU9at5TYn1oX6u2pXxMDlm6o/Go8sQu/K1uU= 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 15995434272101009.7663988829629; Mon, 7 Sep 2020 22:37:07 -0700 (PDT) Received: from localhost ([::1]:51132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWJU-0004qt-UH for importer@patchew.org; Tue, 08 Sep 2020 01:37:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3v-0006ww-Rk; Tue, 08 Sep 2020 01:21:00 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:32773 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 1kFW3s-00067G-6Z; Tue, 08 Sep 2020 01:20:59 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkx683Zz9sW7; Tue, 8 Sep 2020 15:20:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542409; bh=JYn0WjdIsU8E0JJgKyIIVGtKu4ngDBYEc+FPNNcKcg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+1HskbSuviYCuDPLZ21H8y9l7AwfgGh5g42ce9IzEbLFoBZky4WEbNZ5blBTYKUt ZFbGLs/Pp7CXDwrXyQRlr1fthrm4kdMQlo64s+f1wyuGL7grrXt5uJ5d+M7lxdNJ3L kTa6bNfm1yUcdEkWv1TmAa2mXXbbzSwkVHNyoJxM= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 30/33] spapr_numa: move NVLink2 associativity handling to spapr_numa.c Date: Tue, 8 Sep 2020 15:19:50 +1000 Message-Id: <20200908051953.1616885-31-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 01:19:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 The NVLink2 GPUs works like a regular NUMA node with its own associativity values, regardless of user input. This can be handled inside spapr_numa_associativity_init(), initializing NVGPU_MAX_NUM associativity arrays that can be used by the GPUs. Signed-off-by: Daniel Henrique Barboza Message-Id: <20200903220639.563090-5-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_numa.c | 28 +++++++++++++++++++++++++++- hw/ppc/spapr_pci_nvlink2.c | 20 +++----------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 42394f36e9..9073dbbceb 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -13,14 +13,18 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "hw/ppc/spapr_numa.h" +#include "hw/pci-host/spapr.h" #include "hw/ppc/fdt.h" =20 +/* Moved from hw/ppc/spapr_pci_nvlink2.c */ +#define SPAPR_GPU_NUMA_ID (cpu_to_be32(1)) =20 void spapr_numa_associativity_init(SpaprMachineState *spapr, MachineState *machine) { + SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); int nb_numa_nodes =3D machine->numa_state->num_nodes; - int i; + int i, j, max_nodes_with_gpus; =20 /* * For all associativity arrays: first position is the size, @@ -35,6 +39,28 @@ void spapr_numa_associativity_init(SpaprMachineState *sp= apr, spapr->numa_assoc_array[i][0] =3D cpu_to_be32(MAX_DISTANCE_REF_POI= NTS); spapr->numa_assoc_array[i][MAX_DISTANCE_REF_POINTS] =3D cpu_to_be3= 2(i); } + + /* + * Initialize NVLink GPU associativity arrays. We know that + * the first GPU will take the first available NUMA id, and + * we'll have a maximum of NVGPU_MAX_NUM GPUs in the machine. + * At this point we're not sure if there are GPUs or not, but + * let's initialize the associativity arrays and allow NVLink + * GPUs to be handled like regular NUMA nodes later on. + */ + max_nodes_with_gpus =3D nb_numa_nodes + NVGPU_MAX_NUM; + + for (i =3D nb_numa_nodes; i < max_nodes_with_gpus; i++) { + spapr->numa_assoc_array[i][0] =3D cpu_to_be32(MAX_DISTANCE_REF_POI= NTS); + + for (j =3D 1; j < MAX_DISTANCE_REF_POINTS; j++) { + uint32_t gpu_assoc =3D smc->pre_5_1_assoc_refpoints ? + SPAPR_GPU_NUMA_ID : cpu_to_be32(i); + spapr->numa_assoc_array[i][j] =3D gpu_assoc; + } + + spapr->numa_assoc_array[i][MAX_DISTANCE_REF_POINTS] =3D cpu_to_be3= 2(i); + } } =20 void spapr_numa_write_associativity_dt(SpaprMachineState *spapr, void *fdt, diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c index 76ae77ebc8..8ef9b40a18 100644 --- a/hw/ppc/spapr_pci_nvlink2.c +++ b/hw/ppc/spapr_pci_nvlink2.c @@ -26,6 +26,7 @@ #include "qemu-common.h" #include "hw/pci/pci.h" #include "hw/pci-host/spapr.h" +#include "hw/ppc/spapr_numa.h" #include "qemu/error-report.h" #include "hw/ppc/fdt.h" #include "hw/pci/pci_bridge.h" @@ -37,8 +38,6 @@ #define PHANDLE_NVLINK(phb, gn, nn) (0x00130000 | (((phb)->index) << 8) |= \ ((gn) << 4) | (nn)) =20 -#define SPAPR_GPU_NUMA_ID (cpu_to_be32(1)) - typedef struct SpaprPhbPciNvGpuSlot { uint64_t tgt; uint64_t gpa; @@ -360,13 +359,6 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sp= hb, void *fdt) Object *nv_mrobj =3D object_property_get_link(OBJECT(nvslot->gpdev= ), "nvlink2-mr[0]", &error_abort); - uint32_t associativity[] =3D { - cpu_to_be32(0x4), - cpu_to_be32(nvslot->numa_id), - cpu_to_be32(nvslot->numa_id), - cpu_to_be32(nvslot->numa_id), - cpu_to_be32(nvslot->numa_id) - }; uint64_t size =3D object_property_get_uint(nv_mrobj, "size", NULL); uint64_t mem_reg[2] =3D { cpu_to_be64(nvslot->gpa), cpu_to_be64(si= ze) }; char *mem_name =3D g_strdup_printf("memory@%"PRIx64, nvslot->gpa); @@ -376,14 +368,8 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sp= hb, void *fdt) _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); _FDT((fdt_setprop(fdt, off, "reg", mem_reg, sizeof(mem_reg)))); =20 - if (sphb->pre_5_1_assoc) { - associativity[1] =3D SPAPR_GPU_NUMA_ID; - associativity[2] =3D SPAPR_GPU_NUMA_ID; - associativity[3] =3D SPAPR_GPU_NUMA_ID; - } - - _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, - sizeof(associativity)))); + spapr_numa_write_associativity_dt(SPAPR_MACHINE(qdev_get_machine()= ), + fdt, off, nvslot->numa_id); =20 _FDT((fdt_setprop_string(fdt, off, "compatible", "ibm,coherent-device-memory"))); --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543394; cv=none; d=zohomail.com; s=zohoarc; b=MetPhRiIU4mA1Gqb3KhUaeZCrQZt+UFsrwYyc/1AJVm+SsmC1jGqXVXiIe3mHNqoM9jdXBhcKXMv8iftNyFTUHNuUvlHgur3y05ORYy6wZDoMkW+9zds71I6ufKZOXKVTLvNTzjctNR/u7fgEg0nKtXIClElyzix5O/MZliVG5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543394; 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=CEALA9sj3Gcg1qeq64swZv3HwI1Sun9g7DrPKbGoy28=; b=Ae0935y3ali2qwDgufC3RG/U3QDkRDqVarrz+85+zYvtav2+eXE6IkDd8DeR0YlvCnwgguLREVj3UMlfgJrcnuRH+2ZiIRtOihUSvOlL1wUk3fKkH5JcRcVOTDkMYqjJ37FrB0vM2VUejx0tDUvNSJFmOsfRbgb7MNmjgStuZ+U= 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 1599543394827512.9110453561804; Mon, 7 Sep 2020 22:36:34 -0700 (PDT) Received: from localhost ([::1]:48704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWIz-0003pM-Iz for importer@patchew.org; Tue, 08 Sep 2020 01:36:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW3v-0006wv-Pt; Tue, 08 Sep 2020 01:20:59 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:57399 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 1kFW3t-00067X-3y; Tue, 08 Sep 2020 01:20:59 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltky1CjRz9sW5; Tue, 8 Sep 2020 15:20:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542410; bh=fX7QZUTUPtMUGDf7k2tQmbRB6kOC1ryf16ziqC76d/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IU+WPk9pBQDvfZ6nMZhzuIapv5BzMbavSmitvae2W9Dwibrn97CN3iyjq5JmoBwRm qOtuzo+LYx6F5ecTJuKm+y0ik01vGJ0iYWROBFqqtxqenk7k54UrR+QgYXK7qrQEIH nSrI3cz4tBCYGNwJC8xb8JVKP4MVUrivTLsVDzNg= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 31/33] spapr: move h_home_node_associativity to spapr_numa.c Date: Tue, 8 Sep 2020 15:19:51 +1000 Message-Id: <20200908051953.1616885-32-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 The implementation of this hypercall will be modified to use spapr->numa_assoc_arrays input. Moving it to spapr_numa.c makes make more sense. Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Message-Id: <20200904172422.617460-2-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_hcall.c | 40 --------------------------------------- hw/ppc/spapr_numa.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index c1d01228c6..c2776b6a7d 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1873,42 +1873,6 @@ static target_ulong h_client_architecture_support(Po= werPCCPU *cpu, return ret; } =20 -static target_ulong h_home_node_associativity(PowerPCCPU *cpu, - SpaprMachineState *spapr, - target_ulong opcode, - target_ulong *args) -{ - target_ulong flags =3D args[0]; - target_ulong procno =3D args[1]; - PowerPCCPU *tcpu; - int idx; - - /* only support procno from H_REGISTER_VPA */ - if (flags !=3D 0x1) { - return H_FUNCTION; - } - - tcpu =3D spapr_find_cpu(procno); - if (tcpu =3D=3D NULL) { - return H_P2; - } - - /* sequence is the same as in the "ibm,associativity" property */ - - idx =3D 0; -#define ASSOCIATIVITY(a, b) (((uint64_t)(a) << 32) | \ - ((uint64_t)(b) & 0xffffffff)) - args[idx++] =3D ASSOCIATIVITY(0, 0); - args[idx++] =3D ASSOCIATIVITY(0, tcpu->node_id); - args[idx++] =3D ASSOCIATIVITY(procno, -1); - for ( ; idx < 6; idx++) { - args[idx] =3D -1; - } -#undef ASSOCIATIVITY - - return H_SUCCESS; -} - static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, @@ -2139,10 +2103,6 @@ static void hypercall_register_types(void) spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support); =20 spapr_register_hypercall(KVMPPC_H_UPDATE_DT, h_update_dt); - - /* Virtual Processor Home Node */ - spapr_register_hypercall(H_HOME_NODE_ASSOCIATIVITY, - h_home_node_associativity); } =20 type_init(hypercall_register_types) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 9073dbbceb..e60587ce81 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -165,3 +165,48 @@ void spapr_numa_write_rtas_dt(SpaprMachineState *spapr= , void *fdt, int rtas) _FDT(fdt_setprop(fdt, rtas, "ibm,max-associativity-domains", maxdomains, sizeof(maxdomains))); } + +static target_ulong h_home_node_associativity(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong opcode, + target_ulong *args) +{ + target_ulong flags =3D args[0]; + target_ulong procno =3D args[1]; + PowerPCCPU *tcpu; + int idx; + + /* only support procno from H_REGISTER_VPA */ + if (flags !=3D 0x1) { + return H_FUNCTION; + } + + tcpu =3D spapr_find_cpu(procno); + if (tcpu =3D=3D NULL) { + return H_P2; + } + + /* sequence is the same as in the "ibm,associativity" property */ + + idx =3D 0; +#define ASSOCIATIVITY(a, b) (((uint64_t)(a) << 32) | \ + ((uint64_t)(b) & 0xffffffff)) + args[idx++] =3D ASSOCIATIVITY(0, 0); + args[idx++] =3D ASSOCIATIVITY(0, tcpu->node_id); + args[idx++] =3D ASSOCIATIVITY(procno, -1); + for ( ; idx < 6; idx++) { + args[idx] =3D -1; + } +#undef ASSOCIATIVITY + + return H_SUCCESS; +} + +static void spapr_numa_register_types(void) +{ + /* Virtual Processor Home Node */ + spapr_register_hypercall(H_HOME_NODE_ASSOCIATIVITY, + h_home_node_associativity); +} + +type_init(spapr_numa_register_types) --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543242; cv=none; d=zohomail.com; s=zohoarc; b=Lpuz3OuDZOmYh//MGWz9JVvYQ8U+g05dp3jvty5N/nGFh3cvIumJMKPGTZ9CVncb2VSbG6owDPnSejWZMbyCz3yBn72hW43/MtnENlUpZbd2NMh/VaI9JYKOhAHC5IArH7c+0zL2oI5JWZax0IBhRXtF9zTQAl/UNbVXyjfNFT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543242; 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=KmQvxTf8TXdpMhSAuELnSOR5OhGBlspQNSUts5zOfOw=; b=HcZnju9RJkzcRILnIV5QvRlBYOjxANmUgkV8wH6/1i3EcnF9hDvknYloUBrk9X+qVVE+tLsivVaz8TJNhSj1w42SDqRhMr40dJi2rQtfcDstj+FzgtqW9So9irgrb6hIMF2lFHC2iUqduP1vSa6yE+zOWeRS02BHF7fBNMOjWX0= 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 1599543242532614.8237004070892; Mon, 7 Sep 2020 22:34:02 -0700 (PDT) Received: from localhost ([::1]:40006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWGX-0008WV-6z for importer@patchew.org; Tue, 08 Sep 2020 01:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW4E-00078D-7o; Tue, 08 Sep 2020 01:21:18 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:42307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW4C-00069Q-Dn; Tue, 08 Sep 2020 01:21:17 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltky3N0vz9sW8; Tue, 8 Sep 2020 15:20:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542410; bh=2aC+dbpWPHXzmmzWXPNnUhq2/bQ7N61TboTErZgIzVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yl1sDALQnIDlK+L0PXKtnj16VH0eyP2zFocoroTm9HNrcSitri4jgOQDD22Kt3xwb 4srwZdkq8jl8nTJB0Fgu1XNbU8glqi8X5QfG2c/F1S/JpAk5QHWjPFZ258t1Qj72EG iY3yG39T11q+q7/ZpaeyZuaEEfzdMsq3CPVmIOnw= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 32/33] spapr_numa: create a vcpu associativity helper Date: Tue, 8 Sep 2020 15:19:52 +1000 Message-Id: <20200908051953.1616885-33-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 The work to be done in h_home_node_associativity() intersects with what is already done in spapr_numa_fixup_cpu_dt(). This patch creates a new helper, spapr_numa_get_vcpu_assoc(), to be used for both spapr_numa_fixup_cpu_dt() and h_home_node_associativity(). While we're at it, use memcpy() instead of loop assignment to created the returned array. Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Message-Id: <20200904172422.617460-3-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_numa.c | 31 ++++++++++++++++++------------- include/hw/ppc/spapr.h | 7 ++++++- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index e60587ce81..066ffc2a5f 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -71,31 +71,36 @@ void spapr_numa_write_associativity_dt(SpaprMachineStat= e *spapr, void *fdt, sizeof(spapr->numa_assoc_array[nodeid])))); } =20 -int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, void *fdt, - int offset, PowerPCCPU *cpu) +static uint32_t *spapr_numa_get_vcpu_assoc(SpaprMachineState *spapr, + PowerPCCPU *cpu) { - int vcpu_assoc_size =3D NUMA_ASSOC_SIZE + 1; - uint32_t vcpu_assoc[vcpu_assoc_size]; + uint32_t *vcpu_assoc =3D g_new(uint32_t, VCPU_ASSOC_SIZE); int index =3D spapr_get_vcpu_id(cpu); - int i; =20 /* * VCPUs have an extra 'cpu_id' value in ibm,associativity * compared to other resources. Increment the size at index - * 0, copy all associativity domains already set, then put - * cpu_id last. + * 0, put cpu_id last, then copy the remaining associativity + * domains. */ vcpu_assoc[0] =3D cpu_to_be32(MAX_DISTANCE_REF_POINTS + 1); + vcpu_assoc[VCPU_ASSOC_SIZE - 1] =3D cpu_to_be32(index); + memcpy(vcpu_assoc + 1, spapr->numa_assoc_array[cpu->node_id] + 1, + (VCPU_ASSOC_SIZE - 2) * sizeof(uint32_t)); =20 - for (i =3D 1; i <=3D MAX_DISTANCE_REF_POINTS; i++) { - vcpu_assoc[i] =3D spapr->numa_assoc_array[cpu->node_id][i]; - } + return vcpu_assoc; +} + +int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, void *fdt, + int offset, PowerPCCPU *cpu) +{ + g_autofree uint32_t *vcpu_assoc =3D NULL; =20 - vcpu_assoc[vcpu_assoc_size - 1] =3D cpu_to_be32(index); + vcpu_assoc =3D spapr_numa_get_vcpu_assoc(spapr, cpu); =20 /* Advertise NUMA via ibm,associativity */ - return fdt_setprop(fdt, offset, "ibm,associativity", - vcpu_assoc, sizeof(vcpu_assoc)); + return fdt_setprop(fdt, offset, "ibm,associativity", vcpu_assoc, + VCPU_ASSOC_SIZE * sizeof(uint32_t)); } =20 =20 diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 9a63380801..e50a2672e3 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -107,13 +107,18 @@ typedef enum { =20 /* * NUMA related macros. MAX_DISTANCE_REF_POINTS was taken - * from Taken from Linux kernel arch/powerpc/mm/numa.h. + * from Linux kernel arch/powerpc/mm/numa.h. It represents the + * amount of associativity domains for non-CPU resources. * * NUMA_ASSOC_SIZE is the base array size of an ibm,associativity * array for any non-CPU resource. + * + * VCPU_ASSOC_SIZE represents the size of ibm,associativity array + * for CPUs, which has an extra element (vcpu_id) in the end. */ #define MAX_DISTANCE_REF_POINTS 4 #define NUMA_ASSOC_SIZE (MAX_DISTANCE_REF_POINTS + 1) +#define VCPU_ASSOC_SIZE (NUMA_ASSOC_SIZE + 1) =20 typedef struct SpaprCapabilities SpaprCapabilities; struct SpaprCapabilities { --=20 2.26.2 From nobody Sun Apr 28 19:24:48 2024 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=1599543502; cv=none; d=zohomail.com; s=zohoarc; b=HQau43Ca8WlA9QO3co8JOyzneJ+pFdueGTau4n//z7uCyDBGPtY6te2GffSjNiahKwix4y1CXrA3vzuXc/bR7IM5p/LFRE/V5SCi3IMWL35wszVDB3JAj6OPHGAg6jRs+t2CfqJNFfZN1TT4vwK1vcD11T5YErDr4noNn0vWJ50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599543502; 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=uHCHtHJsCODXzdTrea9lAj4pE8htfArRLvZX7nNNIGM=; b=NcjZxQSh/ceJfDcmaPZ++mBZA+Wv5JBpHCFrtsMLvqk6e/VtsNIVJBSX67nThXKZrwgntW7yE1io/gUyg9mrIZHWvJTlzaDOe3gRNzP1W+KNuHxEv1nTPGscH3xcrZu7PWrPSB8Aie3Bt2DtUS6Y3TkzRTvbVvWAJ2vtgs8em9s= 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 1599543502689505.9248476793291; Mon, 7 Sep 2020 22:38:22 -0700 (PDT) Received: from localhost ([::1]:55314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFWKj-0006cc-A7 for importer@patchew.org; Tue, 08 Sep 2020 01:38:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW4G-0007AV-6l; Tue, 08 Sep 2020 01:21:20 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:45191) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFW4E-00069c-FV; Tue, 08 Sep 2020 01:21:19 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4Bltkz2Nkcz9sWB; Tue, 8 Sep 2020 15:20:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1599542411; bh=qGDKszCu7L1a5W4LErh5xaKIlShUztA7IfBe8gYA/fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RmtPuAR2NgKD+Y10K7GgIhmWGAi2NwX47Kn7awWU02zxbKkEk0/voXGVrtgT/cW6Z +Hzrs3zbPempiYnTa0GnxYQRZYCfNAuApWz+02zqLlDq99fZ3xiCZmGrW+Dvyg8itY qf79sPgkZ6+QxfFzdpnOo2gJxFZysdT2wezpioIU= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 33/33] spapr_numa: use spapr_numa_get_vcpu_assoc() in home_node hcall Date: Tue, 8 Sep 2020 15:19:53 +1000 Message-Id: <20200908051953.1616885-34-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908051953.1616885-1-david@gibson.dropbear.id.au> References: <20200908051953.1616885-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.249, 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: danielhb413@gmail.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bauerman@linux.ibm.com, 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 The current implementation of h_home_node_associativity hard codes the values of associativity domains of the vcpus. Let's make it consider the values already initialized in spapr->numa_assoc_array, via the spapr_numa_get_vcpu_assoc() helper. We want to set it and forget it, and for that we also need to assert that we don't overflow the registers of the hypercall. >From R4 to R9 we can squeeze in 12 associativity domains for vcpus, so let's assert that VCPU_ASSOC_SIZE -1 isn't greater than that. Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza Message-Id: <20200904172422.617460-4-danielhb413@gmail.com> Signed-off-by: David Gibson --- hw/ppc/spapr_numa.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 066ffc2a5f..64fe567f5d 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -176,10 +176,11 @@ static target_ulong h_home_node_associativity(PowerPC= CPU *cpu, target_ulong opcode, target_ulong *args) { + g_autofree uint32_t *vcpu_assoc =3D NULL; target_ulong flags =3D args[0]; target_ulong procno =3D args[1]; PowerPCCPU *tcpu; - int idx; + int idx, assoc_idx; =20 /* only support procno from H_REGISTER_VPA */ if (flags !=3D 0x1) { @@ -191,16 +192,40 @@ static target_ulong h_home_node_associativity(PowerPC= CPU *cpu, return H_P2; } =20 - /* sequence is the same as in the "ibm,associativity" property */ + /* + * Given that we want to be flexible with the sizes and indexes, + * we must consider that there is a hard limit of how many + * associativities domain we can fit in R4 up to R9, which would be + * 12 associativity domains for vcpus. Assert and bail if that's + * not the case. + */ + G_STATIC_ASSERT((VCPU_ASSOC_SIZE - 1) <=3D 12); + + vcpu_assoc =3D spapr_numa_get_vcpu_assoc(spapr, tcpu); + /* assoc_idx starts at 1 to skip associativity size */ + assoc_idx =3D 1; =20 - idx =3D 0; #define ASSOCIATIVITY(a, b) (((uint64_t)(a) << 32) | \ ((uint64_t)(b) & 0xffffffff)) - args[idx++] =3D ASSOCIATIVITY(0, 0); - args[idx++] =3D ASSOCIATIVITY(0, tcpu->node_id); - args[idx++] =3D ASSOCIATIVITY(procno, -1); - for ( ; idx < 6; idx++) { - args[idx] =3D -1; + + for (idx =3D 0; idx < 6; idx++) { + int32_t a, b; + + /* + * vcpu_assoc[] will contain the associativity domains for tcpu, + * including tcpu->node_id and procno, meaning that we don't + * need to use these variables here. + * + * We'll read 2 values at a time to fill up the ASSOCIATIVITY() + * macro. The ternary will fill the remaining registers with -1 + * after we went through vcpu_assoc[]. + */ + a =3D assoc_idx < VCPU_ASSOC_SIZE ? + be32_to_cpu(vcpu_assoc[assoc_idx++]) : -1; + b =3D assoc_idx < VCPU_ASSOC_SIZE ? + be32_to_cpu(vcpu_assoc[assoc_idx++]) : -1; + + args[idx] =3D ASSOCIATIVITY(a, b); } #undef ASSOCIATIVITY =20 --=20 2.26.2