From nobody Thu May 16 19:32:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=foxmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585818304; cv=none; d=zohomail.com; s=zohoarc; b=iGH/crFYO+3iRKKEBw80PFX+4TI0zgAtolB72PP1DJf+sAI2/k+eQ6bk+Nw9oFk2zP2/Ac1MfmN/fh3zqA5UgMVPK8S3W6qFGtfO7TnqQdwTkmfcTmdvHOqVkFGeWKGqXCx2iQ0/9/Z4N8MPEQCyS+lD4MeQoqaGAJO8/Ita8k0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585818304; 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=kp0R2efVg35DTFzKnVJdkHd1JyLN77RntSacizuQBEo=; b=I2xP7jjDI3KXNhmsfSnEcKEjIt2+j3rZXbp/v/E5W0rTYaFH3L9g7BVXLTzHWXLaK8S17HXhMgWj6Jw6/jbe4swK3BScL1z01d7ouK7Bq1K0yL/CHK3urQks8p0/QCXUPgs+2LqT20UZmq6CxKFD7VQhb7Azj/bIBDAR7KSEhsI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 15858183046411006.8854775564306; Thu, 2 Apr 2020 02:05:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-APpSjP8UPQuhgosYfJhlUw-1; Thu, 02 Apr 2020 05:04:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 936DD100550D; Thu, 2 Apr 2020 09:04:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63482100EBAF; Thu, 2 Apr 2020 09:04:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C3701809567; Thu, 2 Apr 2020 09:04:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03294e5V009171 for ; Thu, 2 Apr 2020 05:04:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8FE8B11F4BB; Thu, 2 Apr 2020 09:04:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54BD111F4CD for ; Thu, 2 Apr 2020 09:04:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0C029101A55A for ; Thu, 2 Apr 2020 09:04:38 +0000 (UTC) Received: from qq.com (out203-205-251-26.mail.qq.com [203.205.251.26]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-kb_cW6MsNC-3QTmnC0tqFQ-1; Thu, 02 Apr 2020 05:04:35 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza6.qq.com (NewEsmtp) with SMTP id 107BACA1; Thu, 02 Apr 2020 17:04:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585818303; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kp0R2efVg35DTFzKnVJdkHd1JyLN77RntSacizuQBEo=; b=PKDBYQYy6YoF0dHYwVQLEIOPS9Q47+y5oKWqA0HVyge8DPAucrAKjvU6yfH0rSei54ZMtA YGc2bHd9c+3GSniN50oG99AUSCNn5nwhTHjSgc8b5cWVbnLEyl2EK+odMRO7vlOQcayVIp MC9HY8iL3Zx934YYyOyoYOlQDrlicMo= X-MC-Unique: APpSjP8UPQuhgosYfJhlUw-1 X-MC-Unique: kb_cW6MsNC-3QTmnC0tqFQ-1 X-QQ-mid: xmsmtpt1585818249ted2iyijw X-QQ-XMAILINFO: OKRWQGTGCrnK53ovclOGRaoE6XH7Uu6AjwmruTqkCW/DICKjLpBJ59xSEIoBDS GAf7l/4ii+TM86Dd4VP3gaAbXr26p5UVtbczvqnHL4btV30Z9+PNi8nyKyOXIPxNfFNHCzMcIeyG /1ENz/dGQp/NS3yJlBAa66QkcI77KnAFCYMTXwN/L5wYP4A+UHD8rP/uwvudlO2tGV4zDkCYKrEo xmCDN0UapZWLd4dxUvalIgWr8ulH9IrofO7YM+6Fqq0vzHWYb1OvvQN9OYcGxJDEoAVCQQy1La5D NTjlRWzpLFHepn2/lCAiGKQ4kh1wRD3HDYZYCNbM2WZ2rsvFLU73L7zdINzTmbDzF1WgnoI46j6q fmFHP9IY1RE+MsdY4hPSW5rjfxBkg1BT05JLB/PGmiwhW8TBGanAcvCL/TPUNy6rNX44QRiSZ6mw 6mc0hvD22RhRzV5WT3obruBhnsVp8faR4diaxq45zF43zeztm3MnUyHgJPDC3SzyC78VDjmt1erd mwFWZNKCGsuAppPqWGBN7pir9DsHwV93hj4yB5xBlGDIwnisa+mwVmIly/L8LNnWHZBQeNk3jLAo fY/LopjVX6iCwt/5TchhRtZV6SGfKMoT1opPap5k5IKoTZmQ== From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V2 1/5] cpu_map: Introduce ARM cpu models Date: Thu, 2 Apr 2020 17:03:51 +0800 Message-Id: <20200402090354.2193-2-zheng.zhenyu@foxmail.com> In-Reply-To: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> References: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03294e5V009171 X-loop: libvir-list@redhat.com Cc: Zhenyu Zheng , Zhenyu Zheng X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce vendors and some commonly used models for ARM arch, these will be used for virConnectionGetCapabilities for ARM CPUs. Signed-off-by: Zhenyu Zheng Reviewed-by: Daniel P. Berrang=C3=A9 --- src/cpu_map/Makefile.inc.am | 7 +++++++ src/cpu_map/arm_Falkor.xml | 16 ++++++++++++++++ src/cpu_map/arm_Kunpeng-920.xml | 24 ++++++++++++++++++++++++ src/cpu_map/arm_ThunderX299xx.xml | 16 ++++++++++++++++ src/cpu_map/arm_cortex-a53.xml | 16 ++++++++++++++++ src/cpu_map/arm_cortex-a57.xml | 15 +++++++++++++++ src/cpu_map/arm_cortex-a72.xml | 15 +++++++++++++++ src/cpu_map/arm_vendors.xml | 14 ++++++++++++++ src/cpu_map/index.xml | 15 +++++++++++++++ 9 files changed, 138 insertions(+) create mode 100644 src/cpu_map/arm_Falkor.xml create mode 100644 src/cpu_map/arm_Kunpeng-920.xml create mode 100644 src/cpu_map/arm_ThunderX299xx.xml create mode 100644 src/cpu_map/arm_cortex-a53.xml create mode 100644 src/cpu_map/arm_cortex-a57.xml create mode 100644 src/cpu_map/arm_cortex-a72.xml create mode 100644 src/cpu_map/arm_vendors.xml diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am index be64c9a0d4..5d9190e27d 100644 --- a/src/cpu_map/Makefile.inc.am +++ b/src/cpu_map/Makefile.inc.am @@ -2,7 +2,14 @@ =20 cpumapdir =3D $(pkgdatadir)/cpu_map cpumap_DATA =3D \ + cpu_map/arm_cortex-a53.xml \ + cpu_map/arm_cortex-a57.xml \ + cpu_map/arm_cortex-a72.xml \ cpu_map/arm_features.xml \ + cpu_map/arm_Kunpeng-920.xml \ + cpu_map/arm_ThunderX299xx.xml \ + cpu_map/arm_Falkor.xml \ + cpu_map/arm_vendors.xml \ cpu_map/index.xml \ cpu_map/ppc64_vendors.xml \ cpu_map/ppc64_POWER7.xml \ diff --git a/src/cpu_map/arm_Falkor.xml b/src/cpu_map/arm_Falkor.xml new file mode 100644 index 0000000000..902ed2b6ba --- /dev/null +++ b/src/cpu_map/arm_Falkor.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_Kunpeng-920.xml b/src/cpu_map/arm_Kunpeng-920.= xml new file mode 100644 index 0000000000..668b8b50dc --- /dev/null +++ b/src/cpu_map/arm_Kunpeng-920.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_ThunderX299xx.xml b/src/cpu_map/arm_ThunderX29= 9xx.xml new file mode 100644 index 0000000000..9ab3d939e9 --- /dev/null +++ b/src/cpu_map/arm_ThunderX299xx.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_cortex-a53.xml b/src/cpu_map/arm_cortex-a53.xml new file mode 100644 index 0000000000..963d6d36e3 --- /dev/null +++ b/src/cpu_map/arm_cortex-a53.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_cortex-a57.xml b/src/cpu_map/arm_cortex-a57.xml new file mode 100644 index 0000000000..92a044ea92 --- /dev/null +++ b/src/cpu_map/arm_cortex-a57.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_cortex-a72.xml b/src/cpu_map/arm_cortex-a72.xml new file mode 100644 index 0000000000..9664eacd7b --- /dev/null +++ b/src/cpu_map/arm_cortex-a72.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_vendors.xml b/src/cpu_map/arm_vendors.xml new file mode 100644 index 0000000000..703c2112b1 --- /dev/null +++ b/src/cpu_map/arm_vendors.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml index 50b030de29..20646a031c 100644 --- a/src/cpu_map/index.xml +++ b/src/cpu_map/index.xml @@ -85,6 +85,21 @@ =20 + + + + + + + + + + + + + + + --=20 2.26.0.windows.1 From nobody Thu May 16 19:32:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=foxmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585818308; cv=none; d=zohomail.com; s=zohoarc; b=P3w5gYpjsGaZAX4QBYguPsMJ8f+1j/374J4RTCURpkUWSZWnOyUjfE69M7asnMDRXVIoIm6QwwUHq+QJ9A+eyJS9FcQ3YgZgbQNfUucdJGEsPTOy7U/RQEQoBsuvd/ui6uTukplTRiu0kVQVDOwaYkjpirTUAr8KBZqlAF6kEA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585818308; 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=l7fWcbRa5LNrPXH6vGhaTQ9HVEF+2APNH8iT+cY3764=; b=lJBpsQOXx7KI+rCTFuVX+OF2/2cH6ITU1l4nF2HnztoNPiOjzMj7QP4c0x1q4me0Nj12o97/9KhHFrmMRDco3xfs17Q8CysYwzMwgTmYVFkG4KhypqfDUPytdTlUyqxEq1q7uLnvvXxYY87mTr9EJ1QasovPeyJ2rxcJcf+BHGs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1585818308506557.934244667401; Thu, 2 Apr 2020 02:05:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-113-PAZRyf3dN4azvOkVvKnTeg-1; Thu, 02 Apr 2020 05:05:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24A531005509; Thu, 2 Apr 2020 09:04:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D538399DFA; Thu, 2 Apr 2020 09:04:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 56CED18089CF; Thu, 2 Apr 2020 09:04:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03294tFx009195 for ; Thu, 2 Apr 2020 05:04:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 315462166B2F; Thu, 2 Apr 2020 09:04:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D0422166B2B for ; Thu, 2 Apr 2020 09:04:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A85A4800298 for ; Thu, 2 Apr 2020 09:04:52 +0000 (UTC) Received: from qq.com (out203-205-221-250.mail.qq.com [203.205.221.250]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-HAcwmp7LNiakNnH5055uwg-1; Thu, 02 Apr 2020 05:04:49 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza6.qq.com (NewEsmtp) with SMTP id 107BACA1; Thu, 02 Apr 2020 17:04:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585818306; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=l7fWcbRa5LNrPXH6vGhaTQ9HVEF+2APNH8iT+cY3764=; b=Xc6OS9Zro60LX3bKQVd42xw7ZCeq2cgfz4QcgyPBv6gaqwxYZWB7Ogw3bVSMrPs07jg1Ln J59qWIuroP5B10E6UYU3nTD40bFLjFReHcK0d7eqlcZWJZG9HQHir6Qz7xN6P9eFTic522 vJRi459KEYJ9Gom2z63fxf9mZ4oaO8U= X-MC-Unique: PAZRyf3dN4azvOkVvKnTeg-1 X-MC-Unique: HAcwmp7LNiakNnH5055uwg-1 X-QQ-mid: xmsmtpt1585818270trmvzy7bj X-QQ-XMAILINFO: MEzYI2LLVdOMA/1V3Dy8vLh7jNIGRgdFyRhWm1C9oDoSJ8UTkU+WXC2W4N45uJ O0bkfCxw+CLTgbWWpkGVixl34jmXh6zvmJVKcAlxJlcPSl5aXNdsZFFql3zEA+5/tE1kSp2gE9pz ok3wSJ7Y+i1LDcvNxOTAEFGqpe1sekefbJqeTNG9XNm6lf1B8FjVuVecF32GH1NbDLMyVTDrxZnu Io5aiHqGTPxtDa93Hh+dJ1nXlcV0SEQOGG8g5kIyKYNSw1M8iGOdtCJBYOkvc815gkOQPcVmI6jd l3wD84A4UgDd5JbKN9Pa4a0Ntb5kloUd8lj7yIZBzIS7eiS9XGhM4iQkOuTJmxq9oUcFsevMUCRk CmuBvTZzvhNgNiwtbPFYSk6Ld66z7EDxwzzQi8dqqPWGyyUN4mHB9ftbvvsIthwKEykfnKrLgCnz A9bpMfYOgdPTawKRom/yyY93HKvoDtIGcm0EHZKI/Xo7lq7dX9Kjf5WUuJeQms2GQq77jg1OAptA NBBFMNTAlpgPae91abamNqJdzvxBUPOPRaVXB1AqLym2zdi0rP98YYs3/QObQoi281swryKAc0Cs qxwETKKw9N0wOCySeDeveHj6bP/QIapOBP8LBE+3AV6JYcaaPBvjCYJn5O From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V2 2/5] cpu: Introduce virCPUarmData to virCPUData Date: Thu, 2 Apr 2020 17:03:53 +0800 Message-Id: <20200402090354.2193-3-zheng.zhenyu@foxmail.com> In-Reply-To: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> References: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03294tFx009195 X-loop: libvir-list@redhat.com Cc: Zhenyu Zheng , Zhenyu Zheng X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce virCPUarmData to virCPUData Signed-off-by: Zhenyu Zheng Reviewed-by: Daniel P. Berrang=C3=A9 --- src/cpu/Makefile.inc.am | 1 + src/cpu/cpu.h | 2 ++ src/cpu/cpu_arm_data.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/cpu/cpu_arm_data.h diff --git a/src/cpu/Makefile.inc.am b/src/cpu/Makefile.inc.am index 0abeee87b6..bea203fb5c 100644 --- a/src/cpu/Makefile.inc.am +++ b/src/cpu/Makefile.inc.am @@ -10,6 +10,7 @@ CPU_SOURCES =3D \ cpu/cpu_s390.c \ cpu/cpu_arm.h \ cpu/cpu_arm.c \ + cpu/cpu_arm_data.h \ cpu/cpu_ppc64.h \ cpu/cpu_ppc64.c \ cpu/cpu_ppc64_data.h \ diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index f779d2be17..ec22a183a1 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -27,6 +27,7 @@ #include "cpu_conf.h" #include "cpu_x86_data.h" #include "cpu_ppc64_data.h" +#include "cpu_arm_data.h" =20 =20 typedef struct _virCPUData virCPUData; @@ -36,6 +37,7 @@ struct _virCPUData { union { virCPUx86Data x86; virCPUppc64Data ppc64; + virCPUarmData arm; /* generic driver needs no data */ } data; }; diff --git a/src/cpu/cpu_arm_data.h b/src/cpu/cpu_arm_data.h new file mode 100644 index 0000000000..cf12ca8c2e --- /dev/null +++ b/src/cpu/cpu_arm_data.h @@ -0,0 +1,31 @@ +/* + * cpu_arm_data.h: 64-bit arm CPU specific data + * + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; If not, see + * . + * + */ + +#pragma once + +#define VIR_CPU_ARM_DATA_INIT { 0 } + +typedef struct _virCPUarmData virCPUarmData; +struct _virCPUarmData { + unsigned long vendor_id; + unsigned long pvr; + char *features; +}; --=20 2.26.0.windows.1 From nobody Thu May 16 19:32:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=foxmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585818319; cv=none; d=zohomail.com; s=zohoarc; b=G9skfGo4X4T2uKNwA1902TO74qgi0ofB/JJxpanPb1mDgIOalJVO9fL0gby3PLiRCKikwYuLttirvckL3gRXxypgR3xv4sPXIj6ZeRODTmwxKus65TCWLg7LeWshfA+eiyTDaM8i70l0XHVlsV+vM/c8fHKKrH/axhZxA10bw7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585818319; 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=8CAPMzc/IKBQkmVYYATEJl4s//77bx6WJGGeLPTi68c=; b=CTsID6NQlM+NHT+oIb+r4nD0LKdUKP8dPdR0CRmN6d/oHq2FM9xjkg5otASMgeZtO8DCpWyJe3Vl82XbvfpD7m7FUI/Yig5Bh3VfnwkDnKcsJ5QCgnshEuPJCp4fsn1iCcFbukJNs0Cm7IC6otMm15YXVrjWByr1V3zkqgFnSnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1585818319982868.086515788711; Thu, 2 Apr 2020 02:05:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-104-nBQknbj5NmiEQlcu0wL6JA-1; Thu, 02 Apr 2020 05:05:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5C52DB22; Thu, 2 Apr 2020 09:05:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EC5E5DA66; Thu, 2 Apr 2020 09:05:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F1FBF18089D5; Thu, 2 Apr 2020 09:05:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 032958wF009219 for ; Thu, 2 Apr 2020 05:05:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64EA211F4C4; Thu, 2 Apr 2020 09:05:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6124411F4C9 for ; Thu, 2 Apr 2020 09:05:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2198E1019E0D for ; Thu, 2 Apr 2020 09:05:06 +0000 (UTC) Received: from qq.com (out203-205-221-247.mail.qq.com [203.205.221.247]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-vX6hN5jbNTmOzxEVDjErsw-1; Thu, 02 Apr 2020 05:05:03 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza6.qq.com (NewEsmtp) with SMTP id 107BACA1; Thu, 02 Apr 2020 17:04:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585818318; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8CAPMzc/IKBQkmVYYATEJl4s//77bx6WJGGeLPTi68c=; b=WHXuPYazV0xYEX0L9vvmPT7Bi2LBOuvaLffQlBruUx+Mki2I1XgyePn42SOReuH5rAubbv q/vg7h/afJwvVqjkbBDe57a+6At3ihWq0jJ5Rdc8pph+BiSEHbf1kc5v0Sp8lQgBhxrFDH 2NPdFgQDpLnNSLgKLzgUQoT8FQ0Vm3k= X-MC-Unique: nBQknbj5NmiEQlcu0wL6JA-1 X-MC-Unique: vX6hN5jbNTmOzxEVDjErsw-1 X-QQ-mid: xmsmtpt1585818284tk2l7o8wi X-QQ-XMAILINFO: MFZPeigTIzMtEb0PwUhBEJcMZX1KhPqBv/YVMG3HTf1ta0NSqv4sXZs0RCYcEM A0DRyLbcX3c1EOzdDMtjRzX441VaqaPoMA1XGwrLS6daHfNtA76Pxcu48qj1Z3Bgx4aQvkRJ+LvJ cbbZadpnFDAZvo315dc5uapD2EnjHm3iH5VBHRdE1YredDnidnqJtgTne+GBmjqvJfWWUYX1hB8T d3W3Tt9sTonpCCVhYg6t0Nc+do6DSK1WsbJlH8DxbQ21GyzO+/bwNjewu+OP6or4L9NgEQxS6YWL xcwMu6ztpkBqwlx9M7jeA7aJnuOe3jdfZNk7e8r4G9+GBKC+Qd53bsiWwaGU+O/hpFqqEckjV4+k U14YSIpBVBSBybhHiXheBC3bbq+0Ap81fEo5M2IhS9tBEImp3H7OArJMzgLMORwrB6TqjYb4f+di XZ0SNij5ZGQ4LL6GOsfyrLBu2zJcBAUg2U6ixxUEoK1dx0NYLyX533gDW/VX+ic33PdAt1RdWlP4 3d+/NM4tdEKs1kzOFQe6LvBEGbTbzFzGMn3v0wx8KMkZsRsPTonjufZc5Qi4SoQTYF5rwFJQ00sG SR6tpcCBxd1+wXKtdhLO1LtDLrWG3sHRnH+mYAYElTPn1qjA== From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V2 3/5] cpu: Introduce ARM related structs Date: Thu, 2 Apr 2020 17:03:55 +0800 Message-Id: <20200402090354.2193-4-zheng.zhenyu@foxmail.com> In-Reply-To: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> References: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 032958wF009219 X-loop: libvir-list@redhat.com Cc: Zhenyu Zheng , Zhenyu Zheng X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce vendor and model struct and related cleanup functions for ARM cpu. Signed-off-by: Zhenyu Zheng Reviewed-by: Daniel P. Berrang=C3=A9 --- src/cpu/cpu_arm.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index ee5802198f..c757c24a37 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -1,6 +1,7 @@ /* * cpu_arm.c: CPU driver for arm CPUs * + * Copyright (C) 2020 Huawei Technologies Co., Ltd. * Copyright (C) 2013 Red Hat, Inc. * Copyright (C) Canonical Ltd. 2012 * @@ -23,12 +24,16 @@ =20 #include "viralloc.h" #include "cpu.h" +#include "cpu_arm.h" #include "cpu_map.h" +#include "virlog.h" #include "virstring.h" #include "virxml.h" =20 #define VIR_FROM_THIS VIR_FROM_CPU =20 +VIR_LOG_INIT("cpu.cpu_arm"); + static const virArch archs[] =3D { VIR_ARCH_ARMV6L, VIR_ARCH_ARMV7B, @@ -36,6 +41,21 @@ static const virArch archs[] =3D { VIR_ARCH_AARCH64, }; =20 +typedef struct _virCPUarmVendor virCPUarmVendor; +typedef virCPUarmVendor *virCPUarmVendorPtr; +struct _virCPUarmVendor { + char *name; + unsigned long value; +}; + +typedef struct _virCPUarmModel virCPUarmModel; +typedef virCPUarmModel *virCPUarmModelPtr; +struct _virCPUarmModel { + char *name; + virCPUarmVendorPtr vendor; + virCPUarmData data; +}; + typedef struct _virCPUarmFeature virCPUarmFeature; typedef virCPUarmFeature *virCPUarmFeaturePtr; struct _virCPUarmFeature { @@ -64,6 +84,10 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmFeature, virCPUar= mFeatureFree); typedef struct _virCPUarmMap virCPUarmMap; typedef virCPUarmMap *virCPUarmMapPtr; struct _virCPUarmMap { + size_t nvendors; + virCPUarmVendorPtr *vendors; + size_t nmodels; + virCPUarmModelPtr *models; GPtrArray *features; }; =20 @@ -81,12 +105,62 @@ virCPUarmMapNew(void) return map; } =20 +static void +virCPUarmDataClear(virCPUarmData *data) +{ + if (!data) + return; + + VIR_FREE(data->features); +} + +static void +virCPUarmDataFree(virCPUDataPtr cpuData) +{ + if (!cpuData) + return; + + virCPUarmDataClear(&cpuData->data.arm); + VIR_FREE(cpuData); +} + +static void +armModelFree(virCPUarmModelPtr model) +{ + if (!model) + return; + + virCPUarmDataClear(&model->data); + g_free(model->name); + g_free(model); +} + +static void +armVendorFree(virCPUarmVendorPtr vendor) +{ + if (!vendor) + return; + + g_free(vendor->name); + g_free(vendor); +} + static void virCPUarmMapFree(virCPUarmMapPtr map) { if (!map) return; =20 + size_t i; + + for (i =3D 0; i < map->nmodels; i++) + armModelFree(map->models[i]); + g_free(map->models); + + for (i =3D 0; i < map->nvendors; i++) + armVendorFree(map->vendors[i]); + g_free(map->vendors); + g_ptr_array_free(map->features, TRUE); =20 g_free(map); @@ -259,6 +333,7 @@ struct cpuArchDriver cpuDriverArm =3D { .compare =3D virCPUarmCompare, .decode =3D NULL, .encode =3D NULL, + .dataFree =3D virCPUarmDataFree, .baseline =3D virCPUarmBaseline, .update =3D virCPUarmUpdate, .validateFeatures =3D virCPUarmValidateFeatures, --=20 2.26.0.windows.1 From nobody Thu May 16 19:32:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=foxmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585818330; cv=none; d=zohomail.com; s=zohoarc; b=TkKs5EwBn9nF4IvBTLHYibONGLCUXnRY1W35462rM0Sb3X0F6/zimBXKZFZsF6ss00ioCYYxLMkglFAiAVK+FZC/0gPRZ1PXC71H7jbKgZtYSs0Dk53kBzdvZmScCugISBYdDW4foclEq2LJxENplgjIzKcMJc0NOY0GyWbWQ3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585818330; 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=/SdPrP1SF3N0tRQ2+lbcTHcWsD/dzfEJtpKIypH+n2g=; b=gaIHTe9E0AyuvXmYyXc7T6jY89jnI4Tpi3qeYW4AhgIw7TyC4z545m18QrLIcpUXnWkeIGw6BpLWfokJWZ5H+HiGEZjdVXNwT+kFeTxxopuKmAdIYni2HYOwQ9enGNRoQzR8STxWVnjQsmbeNEIn1NfBK27Pm4Staj4mHi4S1+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 158581833002144.196309183554035; Thu, 2 Apr 2020 02:05:30 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-Jw7qmD_bO8unBieTL-qXUw-1; Thu, 02 Apr 2020 05:05:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6063800D6C; Thu, 2 Apr 2020 09:05:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 932D75C1B0; Thu, 2 Apr 2020 09:05:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3BD89942AD; Thu, 2 Apr 2020 09:05:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03295HRT009234 for ; Thu, 2 Apr 2020 05:05:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id F2B9C11F4C4; Thu, 2 Apr 2020 09:05:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EEC7611F4A4 for ; Thu, 2 Apr 2020 09:05:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5ABE8007A4 for ; Thu, 2 Apr 2020 09:05:16 +0000 (UTC) Received: from qq.com (out203-205-251-60.mail.qq.com [203.205.251.60]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-MzIUXgPrPWmKuheWkAx5eA-1; Thu, 02 Apr 2020 05:05:14 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza6.qq.com (NewEsmtp) with SMTP id 107BACA1; Thu, 02 Apr 2020 17:04:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585818326; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/SdPrP1SF3N0tRQ2+lbcTHcWsD/dzfEJtpKIypH+n2g=; b=EPYEtveHAdmbQNCv/ukkwpoJL6MiC6F9li/MLRfbXv3dA3yYR2LZbsz4fycBsZ1T/L4fUV X2GYmuOoLqT7YpBSnQs9Fxu/Q0yWrWbii05RdnJ/ANi6SBD3tjjqYS6jBhV+qi81ldGeA6 xG00wpzuDsrBHwNSbWw2kckjFzwuV7M= X-MC-Unique: Jw7qmD_bO8unBieTL-qXUw-1 X-MC-Unique: MzIUXgPrPWmKuheWkAx5eA-1 X-QQ-mid: xmsmtpt1585818298tnbk6q752 X-QQ-XMAILINFO: M9rbca973ADiOk5ILSrbPOcGSVa3dUPTl7+3qNLHqvaDEQJdpD1bW4Zf2RzBuH xH+FquXvplMLF94CBmDJDm77bYbdHTJkIHT2wmd6yhJpLAPNXf+JR0nZeCIM+Scnvvq2tR5nbXe8 yuBKrU+GfVVgJOkMJv5Ju8vsXv08SeRaGR33ORLn7/uSri3M0H4Q7xVbQmQYb8V4eJTnEzr6GIq1 hg8HpYI/XgyN5BFK6TpYCtMYE6Bf/EplQ2Nvw5tNjf99VGuZumWF2qls0tUTzVCGYE87ycxca9fA KEpO0EDek4hJczInxQs3W8ZrbSTem+v/WiAbI9chIfvDVhGpCrUXU3V+ogwCGXevhk6p5D9GC6DA S6nKdSi9gQvpsbUjd90yaeHJktbhhuH7T/9StF2jRjNZKEkET90NTRKBevo2Oa2ZRcBVhLTIr46n 7MgexilXesIO67O2eYe9ndedWi1VFJYchpmGc7lQsHsLwgTrRAGbAh2uvodQkKCV4zhFaASiG2S2 S5cD7pRU8Fj12IiIiehYcZYFgMWrQJzfP8vpcp/5a8twq7sitnu/TZrRzE/Xx0L1FLl08zduMi4k PTeYul0MVeG0Wbb+HZQlubgn1UVDBTorH4LKLHjNcDv0+A+TQda3+czG5VqDHTLqbCLTc= From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V2 4/5] cpu: Add helper funtions to parse vendor and model Date: Thu, 2 Apr 2020 17:03:57 +0800 Message-Id: <20200402090354.2193-5-zheng.zhenyu@foxmail.com> In-Reply-To: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> References: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03295HRT009234 X-loop: libvir-list@redhat.com Cc: Zhenyu Zheng , Zhenyu Zheng X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add helper functions to parse vendor and model from xml for ARM arch, and use them as callbacks when load cpu maps. Signed-off-by: Zhenyu Zheng --- src/cpu/cpu_arm.c | 176 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 174 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index c757c24a37..88b4d91946 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -206,6 +206,178 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GN= UC_UNUSED, return 0; } =20 +static virCPUarmVendorPtr +armVendorFindByID(virCPUarmMapPtr map, + unsigned long vendor_id) +{ + size_t i; + + for (i =3D 0; i < map->nvendors; i++) { + if (map->vendors[i]->value =3D=3D vendor_id) + return map->vendors[i]; + } + + return NULL; +} + + +static virCPUarmVendorPtr +armVendorFindByName(virCPUarmMapPtr map, + const char *name) +{ + size_t i; + + for (i =3D 0; i < map->nvendors; i++) { + if (STREQ(map->vendors[i]->name, name)) + return map->vendors[i]; + } + + return NULL; +} + + +static int +armVendorParse(xmlXPathContextPtr ctxt, + const char *name, + void *data) +{ + virCPUarmMapPtr map =3D (virCPUarmMapPtr)data; + virCPUarmVendorPtr vendor =3D NULL; + int ret =3D -1; + + if (VIR_ALLOC(vendor) < 0) + return ret; + + vendor->name =3D g_strdup(name); + + if (armVendorFindByName(map, vendor->name)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU vendor %s already defined"), + vendor->name); + goto cleanup; + } + + if (virXPathULongHex("string(@value)", ctxt, &vendor->value) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU vendor value")); + goto cleanup; + } + + if (armVendorFindByID(map, vendor->value)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU vendor value 0x%2lx already defined"), + vendor->value); + goto cleanup; + } + + if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + armVendorFree(vendor); + return ret; + +} + +static virCPUarmModelPtr +armModelFind(virCPUarmMapPtr map, + const char *name) +{ + size_t i; + + for (i =3D 0; i < map->nmodels; i++) { + if (STREQ(map->models[i]->name, name)) + return map->models[i]; + } + + return NULL; +} + +static virCPUarmModelPtr +armModelFindByPVR(virCPUarmMapPtr map, + unsigned long pvr) +{ + size_t i; + + for (i =3D 0; i < map->nmodels; i++) { + if (map->models[i]->data.pvr =3D=3D pvr) + return map->models[i]; + } + + return NULL; +} + +static int +armModelParse(xmlXPathContextPtr ctxt, + const char *name, + void *data) +{ + virCPUarmMapPtr map =3D (virCPUarmMapPtr)data; + virCPUarmModel *model; + xmlNodePtr *nodes =3D NULL; + char *vendor =3D NULL; + int ret =3D -1; + + if (VIR_ALLOC(model) < 0) + goto error; + + model->name =3D g_strdup(name); + + if (armModelFind(map, model->name)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU model %s already defined"), + model->name); + goto error; + } + + if (virXPathBoolean("boolean(./vendor)", ctxt)) { + vendor =3D virXPathString("string(./vendor/@name)", ctxt); + if (!vendor) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid vendor element in CPU model %s"), + model->name); + goto error; + } + + if (!(model->vendor =3D armVendorFindByName(map, vendor))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown vendor %s referenced by CPU model %s= "), + vendor, model->name); + goto error; + } + } + + if (!virXPathBoolean("boolean(./pvr)", ctxt)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing PVR information for CPU model %s"), + model->name); + goto error; + } + + if (virXPathULongHex("string(./pvr/@value)", ctxt, &model->data.pvr) <= 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing or invalid PVR value in CPU model %s"), + model->name); + goto error; + } + + if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0) + goto error; + + ret =3D 0; + + cleanup: + VIR_FREE(vendor); + VIR_FREE(nodes); + return ret; + + error: + armModelFree(model); + goto cleanup; +} + static virCPUarmMapPtr virCPUarmLoadMap(void) { @@ -213,8 +385,8 @@ virCPUarmLoadMap(void) =20 map =3D virCPUarmMapNew(); =20 - if (cpuMapLoad("arm", NULL, virCPUarmMapFeatureParse, NULL, map) < 0) - return NULL; + if (cpuMapLoad("arm", armVendorParse, virCPUarmMapFeatureParse, + armModelParse, map) < 0) =20 return g_steal_pointer(&map); } --=20 2.26.0.windows.1 From nobody Thu May 16 19:32:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=foxmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585818343; cv=none; d=zohomail.com; s=zohoarc; b=f7aRUzdZQbLmOsSHJQY8f4/O8Ed8xcG59K+K4a0ip4h+/ELY3lwYZFvCgJRJ9kE2ESe47bWvaYdKJgEMBZsVH3VnQHifmE6hp3aGIyYXfWt3Y7Xs0V15IIfm2iZvhHXS90hS94gdYPgwnlQBVJw22fpHI580upFtaWwp8kdFvIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585818343; 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=2Sw7+E9jX30ILPgIswJXXQjmawWTsW03lb27PqHEsAY=; b=NeR3nTC5O8ICnZhV4kgW8MgWLpER00gWjrfv51T3fH1BO0im2dfS7EJceRPtkVSobJVKABWeUA/ziLrVtDL8dAkslZsC7iTG2y4zMuLdvp/2Rx58s74504kZYg1n+w+lxU0QT0iZvrRMSelCQAf1JLOfInD4syrj3cSjAtJ2CS4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1585818343222903.4341351539503; Thu, 2 Apr 2020 02:05:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-hMJ8oYxKNxOLV4GhQKsQhQ-1; Thu, 02 Apr 2020 05:05:39 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5FFD107ACC9; Thu, 2 Apr 2020 09:05:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C07110002D0; Thu, 2 Apr 2020 09:05:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0478118089CE; Thu, 2 Apr 2020 09:05:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03295V27009254 for ; Thu, 2 Apr 2020 05:05:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E9EC10054F7; Thu, 2 Apr 2020 09:05:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A8981005E35 for ; Thu, 2 Apr 2020 09:05:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 468EE185A78F for ; Thu, 2 Apr 2020 09:05:29 +0000 (UTC) Received: from qq.com (out203-205-221-239.mail.qq.com [203.205.221.239]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-JdQh3XYcMB2L3iDQLfZFrg-1; Thu, 02 Apr 2020 05:05:26 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza6.qq.com (NewEsmtp) with SMTP id 107BACA1; Thu, 02 Apr 2020 17:04:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585818342; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2Sw7+E9jX30ILPgIswJXXQjmawWTsW03lb27PqHEsAY=; b=Bf94p1ZFVTWKc2s17xmKA7+WAczuILtQDCW/V5Wz1h2zLGtl43uG3l2WfPU7RESD/lVsud BBX43XuPMe8/JHBJzauyKyXkxBHtmIbbN//RI9hTrIiIUNjJC9Y42j4LrgHbeHG81qg1mX jmlKqzm5vzRhQmFivxMw19qC4294hA8= X-MC-Unique: hMJ8oYxKNxOLV4GhQKsQhQ-1 X-MC-Unique: JdQh3XYcMB2L3iDQLfZFrg-1 X-QQ-mid: xmsmtpt1585818310tb1gn0j0g X-QQ-XMAILINFO: MPvmt1q43iPRQMYK6Duc/EJW3MdJmaE5fRmhtqJ0zj2OI5/tjGvjfK3xM1UvDl 6BhwKiK/4oo51zpJt+owb3TnLQ8jNS5j0kf7lfsPLb+XoFJyHNMeZpGPa/77D0CHTtFms4ze92qC /1BgyP5Wfb0pKsFYFKZNLXvtpoqaoXjvTZw6eenrsNZVbQ3PhN1IgqY9om9NeE1BcqHiQuNHEBg5 mHI3TLnO6qBbyXQOHmSdTzObdNW4gXBNM9oOEwYdccXtr+mku18kiJkrxFRuyuGiPemAhNQduMv9 51AmicDqP1VIr6JjorETT5TLpVCpCMz0RMgsujy+BOg+H/SJafX8WjQpDMYDd2nZpKRUvafLV199 J2IjDQ5cDtWK7nwPvRCgOua4LTewKVZAdesjHuj+2LqXzAm+BQVhfQhFferWHrAZJUaGDvmfu9t5 h81qOAvO5m2gfxgq49tZDBPtYpSlLUB1CuP232HPCvIm6yKt2T2Ov3/1usU2nQYIH8KKOHR3iStb 1tXCM86SghIRFiDVQeeKcedNDM5B9unehZOYKOBZKmQT+qddG7TjAm1xZDr7ca8mco2jK5wMrS8a 2EqYCveTxcUKE/aCWU5m+vq92hpLl6YIXtoZ7wqBrRocCHonExQV31KpLUUvaGqxejK6c= From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH V2 5/5] cpu: Introduce getHost support for ARM CPU driver Date: Thu, 2 Apr 2020 17:03:59 +0800 Message-Id: <20200402090354.2193-6-zheng.zhenyu@foxmail.com> In-Reply-To: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> References: <20200402090354.2193-1-zheng.zhenyu@foxmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03295V27009254 X-loop: libvir-list@redhat.com Cc: Zhenyu Zheng , Zhenyu Zheng X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce getHost support for ARM CPU driver, read CPU vendor_id, part_id and flags from registers directly. Signed-off-by: Zhenyu Zheng --- src/cpu/cpu_arm.c | 194 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 193 insertions(+), 1 deletion(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 88b4d91946..c8f5ce7e8a 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -21,6 +21,8 @@ */ =20 #include +#include +#include =20 #include "viralloc.h" #include "cpu.h" @@ -31,6 +33,10 @@ #include "virxml.h" =20 #define VIR_FROM_THIS VIR_FROM_CPU +/* Shift bit mask for parsing cpu flags */ +#define BIT_SHIFTS(n) (1UL << (n)) +/* The current max number of cpu flags on ARM is 32 */ +#define MAX_CPU_FLAGS 32 =20 VIR_LOG_INIT("cpu.cpu_arm"); =20 @@ -498,14 +504,200 @@ virCPUarmValidateFeatures(virCPUDefPtr cpu) return 0; } =20 +/** + * armCpuDataFromRegs: + * + * @data: 64-bit arm CPU specific data + * + * Fetches CPU vendor_id and part_id from MIDR_EL1 register, parse CPU + * flags from AT_HWCAP. There are currently 32 valid flags on ARM arch + * represented by each bit. + */ +static int +armCpuDataFromRegs(virCPUarmData *data) +{ + /* Generate human readable flag list according to the order of */ + /* AT_HWCAP bit map */ + const char *flag_list[MAX_CPU_FLAGS] =3D { + "fp", "asimd", "evtstrm", "aes", "pmull", "sha1", "sha2", + "crc32", "atomics", "fphp", "asimdhp", "cpuid", "asimdrdm", + "jscvt", "fcma", "lrcpc", "dcpop", "sha3", "sm3", "sm4", + "asimddp", "sha512", "sve", "asimdfhm", "dit", "uscat", + "ilrcpc", "flagm", "ssbs", "sb", "paca", "pacg"}; + unsigned long cpuid, hwcaps; + char **features =3D NULL; + char *cpu_feature_str =3D NULL; + int cpu_feature_index =3D 0; + size_t i; + + if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("CPUID registers unavailable")); + return -1; + } + + /* read the cpuid data from MIDR_EL1 register */ + asm("mrs %0, MIDR_EL1" : "=3Dr" (cpuid)); + VIR_DEBUG("CPUID read from register: 0x%016lx", cpuid); + + /* parse the coresponding part_id bits */ + data->pvr =3D cpuid>>4&0xFFF; + /* parse the coresponding vendor_id bits */ + data->vendor_id =3D cpuid>>24&0xFF; + + hwcaps =3D getauxval(AT_HWCAP); + VIR_DEBUG("CPU flags read from register: 0x%016lx", hwcaps); + + if (VIR_ALLOC_N(features, MAX_CPU_FLAGS) < 0) + return -1; + + /* shift bit map mask to parse for CPU flags */ + for (i =3D 0; i< MAX_CPU_FLAGS; i++) { + if (hwcaps & BIT_SHIFTS(i)) { + features[cpu_feature_index] =3D g_strdup(flag_list[i]); + cpu_feature_index++; + } + } + + if (cpu_feature_index > 1) { + cpu_feature_str =3D virStringListJoin((const char **)features, " "= ); + if (!cpu_feature_str) + goto cleanup; + } + data->features =3D g_strdup(cpu_feature_str); + + return 0; + + cleanup: + virStringListFree(features); + VIR_FREE(cpu_feature_str); + return -1; +} + +static int +armCpuDataParseFeatures(virCPUDefPtr cpu, + const virCPUarmData *cpuData) +{ + int ret =3D -1; + size_t i; + char **features; + + if (!cpu || !cpuData) + return ret; + + if (!(features =3D virStringSplitCount(cpuData->features, " ", + 0, &cpu->nfeatures))) + return ret; + if (cpu->nfeatures) { + if (VIR_ALLOC_N(cpu->features, cpu->nfeatures) < 0) + goto error; + + for (i =3D 0; i < cpu->nfeatures; i++) { + cpu->features[i].policy =3D VIR_CPU_FEATURE_REQUIRE; + cpu->features[i].name =3D g_strdup(features[i]); + } + } + + ret =3D 0; + + cleanup: + virStringListFree(features); + return ret; + + error: + for (i =3D 0; i < cpu->nfeatures; i++) + VIR_FREE(cpu->features[i].name); + VIR_FREE(cpu->features); + cpu->nfeatures =3D 0; + goto cleanup; +} + +static int +armDecode(virCPUDefPtr cpu, + const virCPUarmData *cpuData, + virDomainCapsCPUModelsPtr models) +{ + virCPUarmMapPtr map; + virCPUarmModelPtr model; + virCPUarmVendorPtr vendor =3D NULL; + + if (!cpuData || !(map =3D virCPUarmGetMap())) + return -1; + + if (!(model =3D armModelFindByPVR(map, cpuData->pvr))) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Cannot find CPU model with PVR 0x%03lx"), + cpuData->pvr); + return -1; + } + + if (!virCPUModelIsAllowed(model->name, models)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU model %s is not supported by hypervisor"), + model->name); + return -1; + } + + cpu->model =3D g_strdup(model->name); + + if (cpuData->vendor_id && + !(vendor =3D armVendorFindByID(map, cpuData->vendor_id))) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Cannot find CPU vendor with vendor id 0x%02lx"), + cpuData->vendor_id); + return -1; + } + + if (vendor) + cpu->vendor =3D g_strdup(vendor->name); + + if (cpuData->features && + armCpuDataParseFeatures(cpu, cpuData) < 0) + return -1; + + return 0; +} + +static int +armDecodeCPUData(virCPUDefPtr cpu, + const virCPUData *data, + virDomainCapsCPUModelsPtr models) +{ + return armDecode(cpu, &data->data.arm, models); +} + +static int +virCPUarmGetHost(virCPUDefPtr cpu, + virDomainCapsCPUModelsPtr models) +{ + virCPUDataPtr cpuData =3D NULL; + int ret =3D -1; + + if (virCPUarmDriverInitialize() < 0) + goto cleanup; + + if (!(cpuData =3D virCPUDataNew(archs[0]))) + goto cleanup; + + if (armCpuDataFromRegs(&cpuData->data.arm) < 0) + goto cleanup; + + ret =3D armDecodeCPUData(cpu, cpuData, models); + + cleanup: + virCPUarmDataFree(cpuData); + return ret; +} + struct cpuArchDriver cpuDriverArm =3D { .name =3D "arm", .arch =3D archs, .narch =3D G_N_ELEMENTS(archs), .compare =3D virCPUarmCompare, - .decode =3D NULL, + .decode =3D armDecodeCPUData, .encode =3D NULL, .dataFree =3D virCPUarmDataFree, + .getHost =3D virCPUarmGetHost, .baseline =3D virCPUarmBaseline, .update =3D virCPUarmUpdate, .validateFeatures =3D virCPUarmValidateFeatures, --=20 2.26.0.windows.1