From patchwork Fri Mar 2 17:06:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 10255227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE8E960211 for ; Fri, 2 Mar 2018 17:13:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6E4627B81 for ; Fri, 2 Mar 2018 17:13:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A50372785D; Fri, 2 Mar 2018 17:13:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 18E3627F98 for ; Fri, 2 Mar 2018 17:12:18 +0000 (UTC) Received: from localhost ([::1]:36466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eroED-0004yp-8b for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Mar 2018 12:12:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eroD4-00046a-04 for qemu-devel@nongnu.org; Fri, 02 Mar 2018 12:11:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eroCz-0007LY-Vb for qemu-devel@nongnu.org; Fri, 02 Mar 2018 12:11:05 -0500 Received: from mail-bl2nam02on0047.outbound.protection.outlook.com ([104.47.38.47]:33616 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eroCz-0007LR-Lv for qemu-devel@nongnu.org; Fri, 02 Mar 2018 12:11:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=X60oj75hC/pnFxyZxXrcP4VHSfQ+a0TpMvMzK6Zy3c8=; b=hNw5cgkXR7qdXuDGXlLE00uSABwgV8YfmSAIkYDlnE1M/nM/a7xpAIVeHQWtCdi5FJ56otlF5gxe7454JKm/pOw+EeB6aZaNmDR8aoTtL+lUqiaVOsRpg00iWus9G0tuJS5svQUnD9EcnACJPzwRg9rxq+Hft4udytC9BKAIRX4= Received: from SN4PR0201CA0059.namprd02.prod.outlook.com (10.171.31.149) by DM5PR02MB2267.namprd02.prod.outlook.com (10.168.174.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Fri, 2 Mar 2018 17:10:59 +0000 Received: from SN1NAM02FT038.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::209) by SN4PR0201CA0059.outlook.office365.com (2603:10b6:803:20::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.548.13 via Frontend Transport; Fri, 2 Mar 2018 17:10:59 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT038.mail.protection.outlook.com (10.152.72.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.506.19 via Frontend Transport; Fri, 2 Mar 2018 17:10:57 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:38252 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1eroCu-0005Ao-Mw; Fri, 02 Mar 2018 09:10:56 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eroCu-0008LJ-KG; Fri, 02 Mar 2018 09:10:56 -0800 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w22HAsLj026474; Fri, 2 Mar 2018 09:10:54 -0800 Received: from [172.19.2.220] (helo=xsjalistai50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eroCs-0008L1-Ab; Fri, 02 Mar 2018 09:10:54 -0800 From: Alistair Francis To: , Date: Fri, 2 Mar 2018 09:06:12 -0800 Message-ID: <94eef4a24e618d73f9f23a88dd270123d48954d4.1520010339.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(39380400002)(39850400004)(2980300002)(438002)(189003)(199004)(63266004)(478600001)(8936002)(4326008)(48376002)(76176011)(106002)(2906002)(36756003)(106466001)(356003)(336012)(39060400002)(50226002)(110136005)(7696005)(16586007)(316002)(54906003)(47776003)(305945005)(2950100002)(5660300001)(9786002)(51416003)(50466002)(36386004)(81156014)(77096007)(81166006)(118296001)(26005)(186003)(8676002)(6666003)(107986001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR02MB2267; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT038; 1:9LIfnrSUdbkA9N18kJ5Q/qUvct1ZurzOmSD1zSq5MJ2fxIS0QBXlSL1gOWquoGdMoUP/6kcN+ZHPJ2/FqbMCkpXfhdERIFPVfmfXtBmfi4dV1jGoSmEwXxZHVaOXjrhv MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4292983-8513-4c94-5595-08d580609162 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:DM5PR02MB2267; X-Microsoft-Exchange-Diagnostics: 1; DM5PR02MB2267; 3:3C+y2mIwMI7Vb6fvmRzk7y3ZBMxjCPWKiiMCQJTd2UTZz5tw6V+m60lxUyOXEt7U7yPrZekPX1B81/mQGdWeXqzSZq/sdQIaqxz1IRxgmw7FDNV7cLzAYYtI/h8Jhc7xFi0CPJvqdaKCLPAAZdtd0r6kwlZX7+n/uQuukSyTeEhkPzBstD0OaPYDylY+0EWWrN+x1kFSkV01dYliIUQ2GfMgrZICeSjSHztOjbSVVtmsY5iiPQsc8OV9ptTFa5U/IBaT6sBGztV3FxC/9A1WyXL1dc9c22l3TcZ2pTYkzZh0bT+T0u2/auvZqhM+febGSE1IHhEOMfBqiLwdT8lnyjC/KqqX8HsKNE+uomZVXSE=; 25:y2TidmzQWTKFr3dgwJoZ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U90Ltya4PG6lhVjkCiB4/9U1kYmMQu9jmC6ehcucagQNt9LykRVyBydczWgA5T+zl1MzC X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3002001)(93006095)(93004095)(3231220)(944501241)(52105095)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR02MB2267; BCL:0; PCL:0; RULEID:; SRVR:DM5PR02MB2267; X-Microsoft-Exchange-Diagnostics: 1; DM5PR02MB2267; 4:G++M8ETe9CLcXcUiEGJTK00UeCCotGaqxrQ0xS4QqgelXzs6Nb29eRSfgjauJ0/L1jpyY8ORU2LX+iXm0tX6vakP79yKsUgGwQXQOfhAx8/JNtEffKCx83nW/mmSLb4Pd45KkOJU7Z0BPYZRF9k8QgF7LvcDG0Sc50XEtUxdZJRLzhjYsQs5yTuBmcFWtaVKU8eZ3DYDZD/Nda0wf+XiDTMNtkDzTXg0N+BkD4WA7dK/d+6tCatIU8WYDeupyQ5ozsm+TLGg02lfBSUZO27W0pXr8yQXNNCU/A6wfqwkhP5VIl1qj+4orkWADktcDcq4 X-Forefront-PRVS: 05991796DF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR02MB2267; 23:Pt8ysVaeY5EATUVWaxe4SCl/gTwZrDFGNVGGjwoWF?= =?us-ascii?Q?iw7aKz+uHzdjynrWnxd9b9T5mcvwiv0qPaQPwqv65KxR20bNWdrhAxANF1nu?= =?us-ascii?Q?mPMU71ExAXpyiEYhPJF3JGrA6k5/T4l/brOj4l4LtBvfDBIBdkvbGhg96TvH?= =?us-ascii?Q?chsb5TyObzxgogJf1YXacIXL1IvvXaEjZlzx+Fmsrh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9M9WfErWAzXOtaDnopIyk1?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR02MB2267; 6:EsmitGhiVxLx3p0zhUj0X9yihXa43Yj08iacWbroxkJqATp+Y1MSz2O8FuCvclrX+b6Ajxf7aun3Ai3xi0kSGT+JYsgM49x+VKhG7jYlMPp0IlzcAoI3cIaa0Km1j+VhMPr2bARFqzu1Leq1D/934gFOMNPoN4gYIaaHxCpeZvqJBNlPLVVymTPKvwkF6GFCZgPtNEF45o1/d5U62os7Z9qZuJTBXOsr6WTK/RE5eBaF4nLgveUgfPsA7orye3WhQJ/JDde75XgtN2u30WWUnYqyDO5tIdiDIIzfuzew9W4xdTdYNpIvLNWMgAge37DXfoQGmco7l56SzyV5Gr6xqTw5EzxjiXFrMm3M2qwL14w=; 5:MNFlQxQhdRiiwjgkAIfDqMq91piw6TnZ14NJrpVluEarqXq7B6Md7y/5+TGQlN+XdT7uIqIEjTjYrNQjeWGhgGmkbG+DmtdhC50JaBMjLHkoMWMf7E8JUwYDlAZf1cM2Pu7Vl1c8azRRZ2Kl01vL2h8aksUxaELzMkAQ+lqfEGM=; 24:rbtRkjlFaurtRADP1H4raDUwnJtkKS+jnbdU4POCoaZ5LeUrIdWA+ifTjBZ/zOtGiDABBQnjKiQsIqZv33wXTjuoC52WDgGAy9Hj4NoLX+o=; 7:LVyOloRfKiX62wA+VibguR2wxGvjiGO1/E1+1cIGtBQHoZucDPEfNqHq3dVILfKSmsNErwN1eLog4h9d2zFaVgJrHs/oq1zjEClBilcK8jznkHmXwB8T8tZ6976FQ4Lt85frLo8wj+F8U6uJg8y8gXSv6R/m8PHsaHAD63Xc4XEM2fL75DoTEgpZXfrj1YfoJt38puiRPH9+npvosxYKmnKDfoqO99Po0wvnV/lMRhQNBFzkopRjdU1kAa0+7q2z SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2018 17:10:57.5586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4292983-8513-4c94-5595-08d580609162 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2267 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.47 Subject: [Qemu-devel] [PATCH v1 1/2] target/arm: Add a cluster size property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The cortex A53 TRM specifices that bits 24 and 25 of the L2CTLR register specify the number of cores present and not the number of processors. To report this correctly on machines with multiple CPU clusters (ARM's big.LITTLE or Xilinx's ZynqMP) we need to allow the machine to overwrite this value. To do this let's add an optional property. Signed-off-by: Alistair Francis --- target/arm/cpu.h | 5 +++++ target/arm/cpu.c | 1 + target/arm/cpu64.c | 11 +++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 8dd6b788df..3fa8fdad21 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -745,6 +745,11 @@ struct ARMCPU { /* Uniprocessor system with MP extensions */ bool mp_is_up; + /* Specify the number of cores in this CPU cluster. Used for the L2CTLR + * register. + */ + int32_t core_count; + /* The instance init functions for implementation-specific subclasses * set these fields to specify the implementation-dependent values of * various constant registers and reset values of non-constant diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 6b77aaa445..7a17ba1418 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1765,6 +1765,7 @@ static Property arm_cpu_properties[] = { DEFINE_PROP_UINT64("mp-affinity", ARMCPU, mp_affinity, ARM64_AFFINITY_INVALID), DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID), + DEFINE_PROP_INT32("core-count", ARMCPU, core_count, -1), DEFINE_PROP_END_OF_LIST() }; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 4228713b19..5e5ae44aeb 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -42,8 +42,15 @@ static inline void unset_feature(CPUARMState *env, int feature) #ifndef CONFIG_USER_ONLY static uint64_t a57_a53_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) { - /* Number of processors is in [25:24]; otherwise we RAZ */ - return (smp_cpus - 1) << 24; + ARMCPU *cpu = arm_env_get_cpu(env); + + /* Number of cores is in [25:24]; otherwise we RAZ */ + if (cpu->core_count == -1) { + /* No core_count specified, default to smp_cpus. */ + return (smp_cpus - 1) << 24; + } else { + return (cpu->core_count - 1) << 24; + } } #endif