From nobody Thu May 2 12:09:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1585304559; cv=none; d=zohomail.com; s=zohoarc; b=NkyZ/rC2IMqdjtBvWR1p/QMN3HH3tSzKHjcplefAfFTan8FcEuDsChN7ESm5u2dMDpK/jJYViFFsZQfk/qL4OdMBjhdXeFth0Mzspi27XaFurAU8zI829o8IBMHE4wGoFo9/VCx3SWeBQErty00yxXgGyxdIje7UQ5qDb4LU1CY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585304559; 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=W7cccS5ai4QrPFDbl8CZpG8XQpQrLAT4DrKRC9k0LWQ=; b=IjPKduXTmn6U82DbZ/FKzsnAcVwr24OAd2oMs9VoQ4UfJm9WBUz3ScT1zSvwYJE3dblJczr+++pkCQxLq0HHBij4uQNDmYfe7U+KA8upO5xWsdac8PwEBFIcDBEoo2cOYyG+lz5cDh38e3mvxW89EdW5gEpLCuzCKEIYHpM/GSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585304559723800.8878594827312; Fri, 27 Mar 2020 03:22:39 -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-398-EIq9tpr8MRiXJeD_ra4PuQ-1; Fri, 27 Mar 2020 06:22:35 -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 6EF001403; Fri, 27 Mar 2020 10:22:26 +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 46AC596F94; Fri, 27 Mar 2020 10:22:26 +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 E29268A054; Fri, 27 Mar 2020 10:22:25 +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 02R8uPBG030081 for ; Fri, 27 Mar 2020 04:56:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02A4B2166B2D; Fri, 27 Mar 2020 08:56:25 +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 F221B2166B30 for ; Fri, 27 Mar 2020 08:56:21 +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 B95628007D4 for ; Fri, 27 Mar 2020 08:56:21 +0000 (UTC) Received: from qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-pxxixcjVPAWqhq-IVOnGWA-1; Fri, 27 Mar 2020 04:56:18 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza3.qq.com (NewEsmtp) with SMTP id D1E3CE25; Fri, 27 Mar 2020 16:52:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585304558; 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=W7cccS5ai4QrPFDbl8CZpG8XQpQrLAT4DrKRC9k0LWQ=; b=hHDuRiI65d2sT8rw8NkdoUJK1PdtZ5mxST7S0jv9s0AEmG3hQY8cD+BIfZNvAfZTJwNYxc 1lBr3nX5lnKo+IzD5P25bNGhC/eR6MC7923AMmbmzetKcfMEeSvZcBvVnKlz10JQfAamkh 0OXSjtR5eYE5ViaNhslml5eSqO/3d0g= X-MC-Unique: EIq9tpr8MRiXJeD_ra4PuQ-1 X-MC-Unique: pxxixcjVPAWqhq-IVOnGWA-1 X-QQ-mid: xmsmtpt1585299152tzcw6334z X-QQ-XMAILINFO: MrpTJeRShgb0d7URJIIUy/ETovkCuBxsrq3arVFGtJCrnYLpnSgHol+MLcDD4l ouC5CjQqH6b2GeoIIGBSIQstD9VpRJImlZ+dxtDMzPo0fIDI6JnPM/nETRBA7ADMoGCFh+z6j0S9 WFvB2m4inWkrbzccmnX0faizf8NHmpgXyfZ6qfGZY38h/amZhNX9BiPNaJdKw6L+nF2QQ4/39wnp 5QUkivXQb5h4p7k3FDmAyf4WzCXT64V5oNQGkIxi4LRFZH2+2Pvb0FljCir5N6Wj3Khur34nBTj7 GKB1fllUMTb0+6GROZdZU3H0sO8ug8o+3Joox1hwVNdzAGz7rENLZaQiRQ6dH8Z8WUdMuvjwUlz3 QjTB6o2FTcXws6xRFSnDSn/8GncE09aIAskx0p6Cyziv833yL7IpsqLpCq3wvnQiwwlLwGnZpinh JWyvcQ1g5U+d1EIn/v+jHUOoC4WckdJ8brY4tc1x8C014qn8fmBBlGe2UbSzorNwnD6GlYYMAJwb zPWDL9SloZgsdP34qcha2yDP3UN9qfPP/z8b2rEV/7sEEfI8aI4ORcsd+XL+eQ3pYg38avV5WzIB hgcKHMWLZDfV32JQTQW7N5qeXv+x4E75UgGTcLYnD2w8RLJZXwz/dGhwjn9VjYeFODBTE= From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH 1/5] cpu_map: Introduce arm CPU models Date: Fri, 27 Mar 2020 16:52:17 +0800 Message-Id: <20200327085220.1811-2-zheng.zhenyu@foxmail.com> In-Reply-To: <20200327085220.1811-1-zheng.zhenyu@foxmail.com> References: <20200327085220.1811-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 02R8uPBG030081 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 27 Mar 2020 06:21:59 -0400 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" From: Zhenyu Zheng Introduce vendors and models information for ARM arch, these will be used for virConnectGetCapabilities on ARM arch. Signed-off-by: Zhenyu Zheng --- src/cpu_map/Makefile.inc.am | 7 +++++++ src/cpu_map/arm_Falkor.xml | 15 +++++++++++++++ src/cpu_map/arm_Kunpeng-920.xml | 23 +++++++++++++++++++++++ src/cpu_map/arm_ThunderX299xx.xml | 15 +++++++++++++++ src/cpu_map/arm_cortex-a53.xml | 15 +++++++++++++++ src/cpu_map/arm_cortex-a57.xml | 14 ++++++++++++++ src/cpu_map/arm_cortex-a72.xml | 14 ++++++++++++++ src/cpu_map/arm_vendors.xml | 14 ++++++++++++++ src/cpu_map/index.xml | 16 ++++++++++++++++ 9 files changed, 133 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..2e987d1969 100644 --- a/src/cpu_map/Makefile.inc.am +++ b/src/cpu_map/Makefile.inc.am @@ -3,6 +3,13 @@ cpumapdir =3D $(pkgdatadir)/cpu_map cpumap_DATA =3D \ cpu_map/arm_features.xml \ + cpu_map/arm_vendors.xml \ + cpu_map/arm_cortex-a53.xml \ + cpu_map/arm_cortex-a57.xml \ + cpu_map/arm_cortex-a72.xml \ + cpu_map/arm_Falkor.xml \ + cpu_map/arm_Kunpeng-920.xml \ + cpu_map/arm_ThunderX299xx.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..5a8ba53644 --- /dev/null +++ b/src/cpu_map/arm_Falkor.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_Kunpeng-920.xml b/src/cpu_map/arm_Kunpeng-920.= xml new file mode 100644 index 0000000000..374e12cda6 --- /dev/null +++ b/src/cpu_map/arm_Kunpeng-920.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_ThunderX299xx.xml b/src/cpu_map/arm_ThunderX29= 9xx.xml new file mode 100644 index 0000000000..0357273738 --- /dev/null +++ b/src/cpu_map/arm_ThunderX299xx.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_cortex-a53.xml b/src/cpu_map/arm_cortex-a53.xml new file mode 100644 index 0000000000..3375e3f67d --- /dev/null +++ b/src/cpu_map/arm_cortex-a53.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_cortex-a57.xml b/src/cpu_map/arm_cortex-a57.xml new file mode 100644 index 0000000000..ae9c838e99 --- /dev/null +++ b/src/cpu_map/arm_cortex-a57.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/cpu_map/arm_cortex-a72.xml b/src/cpu_map/arm_cortex-a72.xml new file mode 100644 index 0000000000..5c46d32da2 --- /dev/null +++ b/src/cpu_map/arm_cortex-a72.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + 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..49a261f8f8 100644 --- a/src/cpu_map/index.xml +++ b/src/cpu_map/index.xml @@ -86,5 +86,21 @@ =20 + + + + + + + + + + + + + + + + --=20 2.26.0.windows.1 From nobody Thu May 2 12:09:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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=1585304536; cv=none; d=zohomail.com; s=zohoarc; b=ObVKqtCf+IXx3DLgsa8u63ELM+OGM/qR+3aiv7qWqxW2DYxf2eT14u/UJTSWytrGg11rHfGxNXjbcNHtBGJEMTK3fxnp0c6JnJYmYPQ20D5PQXdYHgMoGD9C83lRBK+a4dECUfA7XOZhnX2ELXFTZ2qplJCeGyDRexm4ROBP2dc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585304536; 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=R3F1pWR3Mv7WFywec846suEIFCJmt8xcEPWRf4lnYv4=; b=hy7uoGAeqKGgPd/ZLsPRPgdyI9bzeDyddHKZ6bsx1f6xLjLUgAS6XE8lE6URL1MdWIGyrgC1et4WyLfRArk4VIsrW+i+5XNEhvWbzr0Z/E1Zg+MmZvoVhsLFGjE0cg9A9CjUrHajDL9DQtn51/fFx/UkmXg9EjYisk2gtjP5n44= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 158530453677239.847564556386146; Fri, 27 Mar 2020 03:22:16 -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-155-SID0WKY6MLm58L3cHScdrA-1; Fri, 27 Mar 2020 06:22:11 -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 043FB800D48; Fri, 27 Mar 2020 10:22:06 +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 C86925C545; Fri, 27 Mar 2020 10:22:05 +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 21D4E18089CE; Fri, 27 Mar 2020 10:22:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02R8ssUk030037 for ; Fri, 27 Mar 2020 04:54:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id EAD8C2038B82; Fri, 27 Mar 2020 08:54:53 +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 E71A12038B80 for ; Fri, 27 Mar 2020 08:54:51 +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 2E3A6101A55E for ; Fri, 27 Mar 2020 08:54:51 +0000 (UTC) Received: from qq.com (out203-205-221-252.mail.qq.com [203.205.221.252]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-ZR0zCbZbMcGfCyUIWGEvkA-1; Fri, 27 Mar 2020 04:54:48 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza3.qq.com (NewEsmtp) with SMTP id D1E3CE25; Fri, 27 Mar 2020 16:52:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585304535; 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=R3F1pWR3Mv7WFywec846suEIFCJmt8xcEPWRf4lnYv4=; b=F8CCf4avDAOnLdLjuB+928op7ipQvHnrIhe4A5l/O1Sl8c3RbpXqeG7JlhCaTEr7Fba1F2 dPFuDx44ojZD3YCtyBIC7oatLSRma8VTpfix3uvEBfOI/G0bOF9DvomIXkp4jWIVFtcsRe pT8jgsoVl02Nj0yDW8qqp+wMKuSSI/A= X-MC-Unique: SID0WKY6MLm58L3cHScdrA-1 X-MC-Unique: ZR0zCbZbMcGfCyUIWGEvkA-1 X-QQ-mid: xmsmtpt1585299174tqopp7qf3 X-QQ-XMAILINFO: MLSNMIPdezDA66Ktkfj/4FehH7kY5i6oCpG7GGc2CjNoBrGt88sMe2FvBUFlVj IKhD693F9u3s5N0axjDJojAXa1GHZkvKagcvo1wKzoUZdR+cvr0yK3JzqsWIv7YDvQMBIL+aLmb+ S2QNFcBoI7oLkmuOUmSzrCOM8yrAfw1Ygc3FENQWmd1BzZyZcjAKs/GZEz0Y7+5krY7vUfC3cVEw 9tAqDvthFTcC1bwL8+cHnYy2/XsW6ZWAcimHSnKwuG9p4Ai0tRyGuu7U4CDR4hWSH7QmqtbdB1I0 tj5U9hZQHCuwPT3eqHjkTX2CUoKGaivWfZytmlUldMnLnb8R32iyR2+nH4D5+aG2tgKdS3J8UpnY Oqa8aayslqn5f8PCGc+EydH5gYrXN3pN7ak9+A2psvNWCD8r+lvRmXBmz2kua469YqzaAl85Vayc CCQSiyLrzVT/1HMx+rSlJM5TaxdECchzMryyF7n713zTPbwSxYevs3Gxz8D0BVbag+NsIR/f2vdT a9VWUhjzCL405VWdCEz2vxdpwlA/3J87S2fYjnJc27DmaCrvyAl8XAC00ASfRFXB65XSUWhrSve0 WNYziFZw6a18iGPwMw6LoZXFXOcWZg3XmtGHLZ4yd4L5TwRn49iRo1qbIrUsh4BZDoKhg= From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH 2/5] cpu: Introduce virCPUarmData to virCPUData Date: Fri, 27 Mar 2020 16:52:19 +0800 Message-Id: <20200327085220.1811-3-zheng.zhenyu@foxmail.com> In-Reply-To: <20200327085220.1811-1-zheng.zhenyu@foxmail.com> References: <20200327085220.1811-1-zheng.zhenyu@foxmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02R8ssUk030037 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 27 Mar 2020 06:21:59 -0400 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" Introduce virCPUarmData to virCPUData Signed-off-by: Zhenyu Zheng --- src/cpu/cpu.h | 2 ++ src/cpu/cpu_arm_data.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/cpu/cpu_arm_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..000a3c282f --- /dev/null +++ b/src/cpu/cpu_arm_data.h @@ -0,0 +1,32 @@ +/* + * cpu_arm_data.h: 64-bit arm CPU specific data + * + * Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. + * + * 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 { + char *vendor_id; + char *model_name; + char *features; +}; --=20 2.26.0.windows.1 From nobody Thu May 2 12:09:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1585304560; cv=none; d=zohomail.com; s=zohoarc; b=cFR1Klz8c21P7FwHGw2uHGjdOqh/3MhC54kddSraTPRMxSWbUYYJxl43Nvh26ncDo7/I5Vvmd9i9eO84yxkQcY5sYzMR4PU1Gw2WlMEi0lXfKw0S/BUWzm9qeSEMoyFkZVekvhh1krIhxd5OVTgLpTOgzxuHfIPxOEhNN5JJupc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585304560; 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=6UIFgtRySaj304OR0HrgOXoImpvgyMaUr8QaE88WgDs=; b=HXRk8Nq1wFyx/2afPlqGpm9ZLMNjYVcu5hGWQvSH8/YZhlIK+hxznwWzipcZnjmU0oPbV7QPD8/s5Q7U/2w5QswuWrGaKqx/iWhdEfHOWwF2f291skXCaTSd7oAp3sZ3iZenJU4+ZmEsp0xZAKbBRsjU2eRqCztmjVpafk0Z37w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585304560256185.63248580712423; Fri, 27 Mar 2020 03:22:40 -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-348-77RSeWpJNE27RbYBr_jzFw-1; Fri, 27 Mar 2020 06:22:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89B161B2C98C; Fri, 27 Mar 2020 10:22:22 +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 5A6DB19756; Fri, 27 Mar 2020 10:22:22 +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 D223E18089D0; Fri, 27 Mar 2020 10:22:21 +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 02R8tFjA030053 for ; Fri, 27 Mar 2020 04:55:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 33F2D120EC6; Fri, 27 Mar 2020 08:55:15 +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 EB64712115D for ; Fri, 27 Mar 2020 08:55:12 +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 42CA0800299 for ; Fri, 27 Mar 2020 08:55:12 +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-115--C_fLjtcOyiEegq-mq5fuQ-1; Fri, 27 Mar 2020 04:55:09 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza3.qq.com (NewEsmtp) with SMTP id D1E3CE25; Fri, 27 Mar 2020 16:52:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585304559; 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=6UIFgtRySaj304OR0HrgOXoImpvgyMaUr8QaE88WgDs=; b=Mq5ag4ph4BXYTH737qBZST+8uGuMdUMcGMYYJP5gY0rNv3po82rKbcqY4or6+/GdlbNEBt CwvuDepQb4S5SSpDr1sH+ZbTG6DPhcpX+aAWlgXDvxVZykITAPGP5u8hmCkXH9OoF102O6 PqQjAwPVlvbGM4RnAaAvLjm+NkF/7WI= X-MC-Unique: 77RSeWpJNE27RbYBr_jzFw-1 X-MC-Unique: -C_fLjtcOyiEegq-mq5fuQ-1 X-QQ-mid: xmsmtpt1585299208tiao16zjh X-QQ-XMAILINFO: NmQXtrk+Kov6qNMfh67RbqKRePpq6kNPNicXsbE7a22u1cunRfiZInRYAfWM+h WojEuj+3acgwLwlCaSSgQmQs3dPIpGGDgqoFbcy6QrqdbrzMxfKDSeW7yhUboRG56Z9/q0ntWzii ozBE8PiDGAbUV4wnbVn+sm1gPlUQX4OrDGZOyAWs6yWYq27awbVvGWRjmliU0SMNtwa9eVKMUyJP nRA0642dHoy1mmj3mYAufUpyNdBwXmVu40JiuV1scF3llfJcPQMcFPjEBB2dELp4rq/VGwFRDMNX yqNRFo+ckxYEUqQUpkDmvkaN0wAP5KW4fwQ7cvVSu28+AGzGkwQ1wISxk0NTfwM0OwxQ+xyrVMWK 3Q89M21LWr1l83e52S+NNMr9wTEgY6oDcqaEU8sqg4bIcWO48YrFPp+EdqToSta8/0AXj4LHgxTW 3MQXTGcrLV44+Mf98CpEHg/Zvy2x3a1NMFnH+QRc6okhQTPCD42m/3IKzkq8FRiNmbeHlHLHtpBL I0W9llYtczRbNUMRyImRu8U1kOOtxnrsIZnXpWUyJ1Zh3oahVopXzs5n4BOGoW7CrFiX6eFl4unu m/tBds3GaxNp78JnfrFnoWAqTVj4MKLFIXiLIEIcPpAt+hTS2QlbGsF5KN From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH 3/5] cpu: Introduce arm related structs Date: Fri, 27 Mar 2020 16:52:21 +0800 Message-Id: <20200327085220.1811-4-zheng.zhenyu@foxmail.com> In-Reply-To: <20200327085220.1811-1-zheng.zhenyu@foxmail.com> References: <20200327085220.1811-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 02R8tFjA030053 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 27 Mar 2020 06:21:59 -0400 Cc: 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.23 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 arm related structs cpu_arm.c --- src/cpu/cpu_arm.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index ee5802198f..2a05f43118 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -26,6 +26,8 @@ #include "cpu_map.h" #include "virstring.h" #include "virxml.h" +#include "cpu_map.h" +#include "cpu_arm.h" =20 #define VIR_FROM_THIS VIR_FROM_CPU =20 @@ -36,6 +38,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,9 +81,53 @@ 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 +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 virCPUarmMapPtr virCPUarmMapNew(void) { @@ -86,6 +147,16 @@ 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); =20 g_ptr_array_free(map->features, TRUE); =20 --=20 2.26.0.windows.1 From nobody Thu May 2 12:09:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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=1585304551; cv=none; d=zohomail.com; s=zohoarc; b=BmQbmwKJggBqIdngRR8yf1+vyn24wpbmmsutxEcqZwQExzI1Xh3tav2rSE31Z9LbIruL2cLLsQdt8tejKVbIxxL39e4RhbHgzs62UojLP+4urMYPjSvOPcGoarVbzZmiPyxyqgmggoPEeIY7Un5I+lbwCnWymvbTb0cq/5mKSZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585304551; 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=p1vzPHXg8q0PAKoCjwJJYAr9ixaRVYOgjVJU6NQbkzY=; b=DzmJ8BulKubbLH0juHvH4sqe4W4KdNv+EswMlvtX1KmtRXuK/MCfavoktMpCd8bB55Fe60I2c0sQmWnUTzaSro5fP7qEuVJdrSRa9uv2+kVvXNS4xLQe0Fo8uWisnblPcb/YeIj1T02BagDaOP4RwJ2IFm/DAarQu4AGts/W83w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585304551686919.9006688845997; Fri, 27 Mar 2020 03:22:31 -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-61-VJ1FC-bCPW-sLpYv_6x2tQ-1; Fri, 27 Mar 2020 06:22:28 -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 1B5DE107B7DE; Fri, 27 Mar 2020 10:22:23 +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 E5B9F5C545; Fri, 27 Mar 2020 10:22:22 +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 94BF38A04F; Fri, 27 Mar 2020 10:22:22 +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 02R8wnwh030141 for ; Fri, 27 Mar 2020 04:58:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA8542166B2C; Fri, 27 Mar 2020 08:58:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C686C2166B2B for ; Fri, 27 Mar 2020 08:58:47 +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 E2E928F7835 for ; Fri, 27 Mar 2020 08:58:46 +0000 (UTC) Received: from qq.com (out203-205-221-157.mail.qq.com [203.205.221.157]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-347-TpRDHh80PsWltMF0_LmdxQ-1; Fri, 27 Mar 2020 04:58:43 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza3.qq.com (NewEsmtp) with SMTP id D1E3CE25; Fri, 27 Mar 2020 16:52:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585304550; 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=p1vzPHXg8q0PAKoCjwJJYAr9ixaRVYOgjVJU6NQbkzY=; b=PIYH2GvHwiodOuMxG3i3jJQcm2+QyS61fzgX4WL6VkQ36wxKIz/mcD0wMsY2ATVj/M03d/ qACP6A3pnFVYkfSe0WvZxvvK9FuvjG2/S7DyLBSO6kmWz+3KCHSrPHI9cVwAwUaEjIoKQp E32OsvlladHJA0mWKAVJ48CHP5Wg/6I= X-MC-Unique: VJ1FC-bCPW-sLpYv_6x2tQ-1 X-MC-Unique: TpRDHh80PsWltMF0_LmdxQ-1 X-QQ-mid: xmsmtpt1585299239tvklkapqk X-QQ-XMAILINFO: OGylKZV5Pv8GgWhfqsM++TJbzmpxW56bu9MKSbiFDKIMs7r6Gwn/72/7zPB9xs 2dSmtpHD1qbO194U7rR43m5j1wsWXpLypqeGrEA4rAJKtoLss0g7Ht750VIfw3EcsjOBLoNuuY+Y 2mZXGmQ92+EeCmJqN5VnsIW9aA7mjGWVh9CJZ84hnw9nW1CdbmCxLICUdEQRMmp9kKsyZCbGaVlo OJDqFump4Bb7LHBLyVEl/vB2oW39lcyt3Mh8TsmWXG2rW5HBVB52WKeYBa0Aa0+DzF0lv5uTPvx7 eX2FmDHAT8G17dg7rLHIcMHptWklPWCIuTrf0Bnub0HltyCrScg0PDRKYzMJ6bg994mm9orNXU/p d4kAZXwD8gNsw1R2QFr8j+vXUlYpotXjdlIgukLPEEvMwpEL2n4ANK9n4imCbwxJPv9TmEbT5Wcw wgv/3yAd7YCwUDcgoJB4UYB7UTVvnEBEKvMYGokjHkNv4fp9UtriIuzQXLhNDeoTL12l/BYwCpLC szmuw1kAykpZ8dizKcQj+hN8WFCaJcT44iGfaNBZ2IK4xAV5imT1OUUSUu0/QGusr6WqFG18a3vo TzSpO4AD7YYGctBQAQTmqSCiY73bftadmkdN6YKcfw5kRfw2hZbX0r/8QnWmHM2S5p8qkw9cDmxt OR91xFq3DERTYg From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH 4/5] cpu: Add helper functions to parse vendor and model for ARM Date: Fri, 27 Mar 2020 16:52:23 +0800 Message-Id: <20200327085220.1811-5-zheng.zhenyu@foxmail.com> In-Reply-To: <20200327085220.1811-1-zheng.zhenyu@foxmail.com> References: <20200327085220.1811-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 02R8wnwh030141 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 27 Mar 2020 06:21:59 -0400 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 for ARM and use them as callback when load maps. Signed-of-by: Zhenyu Zheng --- src/cpu/cpu_arm.c | 143 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 1 deletion(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 2a05f43118..969025b5cf 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -181,6 +181,147 @@ virCPUarmMapFeatureFind(virCPUarmMapPtr map, return NULL; } =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"), vendo= r->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 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 (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 int virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, const char *name, @@ -210,7 +351,7 @@ virCPUarmLoadMap(void) =20 map =3D virCPUarmMapNew(); =20 - if (cpuMapLoad("arm", NULL, virCPUarmMapFeatureParse, NULL, map) < 0) + if (cpuMapLoad("arm", armVendorParse, virCPUarmMapFeatureParse, armMod= elParse, map) < 0) return NULL; =20 return g_steal_pointer(&map); --=20 2.26.0.windows.1 From nobody Thu May 2 12:09:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1585304558; cv=none; d=zohomail.com; s=zohoarc; b=KZNrLJ3dfyKzyBTTUPS1KH2HzSGEpSb/LPYhgAW3Prm/VCw1wD6MiJiVdC9L1lxsTVTFZe0l3/yxnRmYulkk7uPduM7dVesIKV/D/xkXKbTK6VO3oFKaOMlSw7dIC/oO/lESUrpkpl026LV2Fkjv3SjX4qMeZghtF+fhgRi+YOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585304558; 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=XNfODbHvsssTgvzQOQmWL8cJZorUckJa55XMRE+Qm58=; b=nkHxYmb3eRcDyMGIygZZlfnVVY6FfWEE/fZ/7ds0sM10NAbPoSluNQ8UjdPdYCYTeff5D3veKn++t6TNRlJbtnbjLXJrTSt+3FyH2q/q6Ix6XtdEvO02TX9ZZxKrY/LE5vAbb1P7jY/KdYEg0UPV1QfiWGhcTHAiV7b3wlS0xpU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585304558476525.696465240082; Fri, 27 Mar 2020 03:22:38 -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-Xb4_KiEcO-6HC0XG3WsxMQ-1; Fri, 27 Mar 2020 06:22:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F7A4801E66; Fri, 27 Mar 2020 10:22:27 +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 D662239E; Fri, 27 Mar 2020 10:22:26 +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 8D5881808855; Fri, 27 Mar 2020 10:22:26 +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 02R8x3ra030154 for ; Fri, 27 Mar 2020 04:59:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2044F2166B2D; Fri, 27 Mar 2020 08:59:03 +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 1B6292166B2B for ; Fri, 27 Mar 2020 08:59:03 +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 E01B2101A55D for ; Fri, 27 Mar 2020 08:59:02 +0000 (UTC) Received: from qq.com (out203-205-221-202.mail.qq.com [203.205.221.202]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-93-afy-sFkqMxOKNd4uoZtlAg-1; Fri, 27 Mar 2020 04:58:59 -0400 Received: from localhost.localdomain ([111.21.171.11]) by newxmesmtplogicsvrsza3.qq.com (NewEsmtp) with SMTP id D1E3CE25; Fri, 27 Mar 2020 16:52:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585304557; 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=XNfODbHvsssTgvzQOQmWL8cJZorUckJa55XMRE+Qm58=; b=JU9kIFfVmFZx2Fn0315tLbSAuDx9DuE+nuuTNqDUuo0+2BSElGyYHUThxUMgrmzngvYxKi Nlk8fSRQb8WU8N2LjAkcksIII8TKVR3zNlLXFHZf7h/xVvSXyQbVXT7m1NKHsMtPG3CJnx yYVTJtuvSTM3pmcc5RhlTeOnbyHDPTU= X-MC-Unique: Xb4_KiEcO-6HC0XG3WsxMQ-1 X-MC-Unique: afy-sFkqMxOKNd4uoZtlAg-1 X-QQ-mid: xmsmtpt1585299519tf9kyef94 X-QQ-XMAILINFO: M2FSV1/mBD+uV/g29D+WdquxJZnKYqY5gIpYiEBtAYssDIBGptlDrZvR/4qYgP 5OXiM9II8YwKI4nxIXxsC9AsC/dEA+9qbKDkTGabNFW+cPCBm/vrPz8nILz3bSWtv2v4hIU8Fvrj A54isOgruvltzPdRKavl3EKjV7ACdB/UBF0GMcJ5kMoqz2+73u8A9nVgpuWDdYhJ10+JLPanBSqh T2kU2mtYYqV8cEJJC6F1wJGSlxnsYfBaty/LnUcwQWOFe/pKdZs410FJBh0SOeCPArMee4aMNAZm 3kjwlWzSK7htUW/eAjM+VAr8l2sWEgJRhiFUZHvSZEysLN+TrRFV4fYQniC8iJ8cOpM/TM0v8ruU 60zjQBElQu/VdJaVeg81UCIhAex/p95zbZBVLoMXcFbOk1SHzKwPRwwXXxvddEV5oL3fDsoPLG++ M2EjjGQaMVfKEhBZfPSi67DJXDRNEaDkSwMqh74LNMYLnRC5QZFAIX6ARLWzVGXY66nIj0qQFDvh cfKGGH5UgFQ0zQXLKjLRVaBHroRuTTibdCeiHKuBNm9gvAc+06KiuJsrHvlVztoneQOaiU0dwCR4 hgs8Sa6JdgrIHDHC7bgMBUMSbo3El/elYZq4rGHg0aB9cBOFWgb/YEJ17VC8ArvZoPxHQ= From: Zhenyu Zheng To: libvir-list@redhat.com Subject: [PATCH 5/5] cpu: Introduce getHost supoort for ARM Date: Fri, 27 Mar 2020 16:52:25 +0800 Message-Id: <20200327085220.1811-6-zheng.zhenyu@foxmail.com> In-Reply-To: <20200327085220.1811-1-zheng.zhenyu@foxmail.com> References: <20200327085220.1811-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 02R8x3ra030154 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 27 Mar 2020 06:21:59 -0400 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.23 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, use data from 'lscpu' cmd result. 'util-linux/lscpu' provided a very good translation of ARM cpu data start from release v2.32, use it directly to avoid re-implement the translation. Signed-of-by: Zhenyu Zheng --- src/cpu/cpu_arm.c | 198 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 197 insertions(+), 1 deletion(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 969025b5cf..30d9c0ae2e 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -22,8 +22,11 @@ #include =20 #include "viralloc.h" +#include "virlog.h" #include "cpu.h" #include "cpu_map.h" +#include "vircommand.h" +#include "virfile.h" #include "virstring.h" #include "virxml.h" #include "cpu_map.h" @@ -31,6 +34,14 @@ =20 #define VIR_FROM_THIS VIR_FROM_CPU =20 +VIR_LOG_INIT("cpu.cpu_arm"); + +static const char *lsCpuPath =3D "/usr/bin/lscpu"; + +#define LSCPU lsCpuPath +#define MAX_LSCPU_SIZE =3D (1024*1024) /* 1MB limit for lscpu output */ + + static const virArch archs[] =3D { VIR_ARCH_ARMV6L, VIR_ARCH_ARMV7B, @@ -464,13 +475,198 @@ virCPUarmValidateFeatures(virCPUDefPtr cpu) return 0; } =20 +static int +armCpuDataFromLsCpu(virCPUarmData *data) +{ + int ret =3D -1; + char *outbuf =3D NULL; + char *eol =3D NULL; + const char *cur; + virCommandPtr cmd =3D NULL; + g_autofree char *lscpu =3D NULL; + + if (!data) + return ret; + + lscpu =3D virFindFileInPath("lscpu"); + cmd =3D virCommandNew(lscpu); + virCommandSetOutputBuffer(cmd, &outbuf); + + if (virCommandRun(cmd, NULL) < 0)=20 + goto cleanup; + + if ((cur =3D strstr(outbuf, "Vendor ID")) =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("there is no \"Vendor ID\" info in %s command res= ult"), LSCPU); + goto cleanup; + } + cur =3D strchr(cur, ':') + 1; + eol =3D strchr(cur, '\n'); + virSkipSpaces(&cur); + if (!eol) + goto cleanup; + + data->vendor_id =3D g_strndup(cur, eol - cur); + + if ((cur =3D strstr(outbuf, "Model name")) =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("there is no \"Model name\" info in %s command re= sult"), LSCPU); + goto cleanup; + } + cur =3D strchr(cur, ':') + 1; + eol =3D strchr(cur, '\n'); + virSkipSpaces(&cur); + if (!eol) + goto cleanup; + + data->model_name =3D g_strndup(cur, eol - cur); + + if ((cur =3D strstr(outbuf, "Flags")) =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("there is no \"Flags\" info in %s command result"= ), LSCPU); + goto cleanup; + } + cur =3D strchr(cur, ':') + 1; + eol =3D strchr(cur, '\n'); + virSkipSpaces(&cur); + if (!eol) + goto cleanup; + + data->features =3D g_strndup(cur, eol - cur); + + ret =3D 0; + + cleanup: + virCommandFree(cmd); + VIR_FREE(outbuf); + return ret; +} + +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 armModelFind(map, cpuData->model_name))) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Cannot find CPU model with name %s"), + cpuData->model_name); + 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 armVendorFindByName(map, cpuData->vendor_id))) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Cannot find CPU vendor with vendor id %s"), + 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 (armCpuDataFromLsCpu(&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