diff mbox

[4/6] Implement minimal sysinfo for AArch64 platforms.

Message ID 1381240151-15060-5-git-send-email-pranavkumar@linaro.org
State New
Headers show

Commit Message

PranavkumarSawargaonkar Oct. 8, 2013, 1:49 p.m. UTC
Implement the bare minimal sysinfo for AArch64 platforms by
reading the CPU models from /proc/cpuinfo.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
---
 src/util/virsysinfo.c                   |    3 ++-
 tests/sysinfodata/aarch64cpuinfo.data   |   10 ++++++++++
 tests/sysinfodata/aarch64sysinfo.expect |   10 ++++++++++
 tests/sysinfotest.c                     |   14 +++++++++++++-
 4 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 tests/sysinfodata/aarch64cpuinfo.data
 create mode 100644 tests/sysinfodata/aarch64sysinfo.expect

Comments

Cole Robinson Oct. 9, 2013, 1:56 p.m. UTC | #1
On 10/08/2013 09:49 AM, Pranavkumar Sawargaonkar wrote:
> Implement the bare minimal sysinfo for AArch64 platforms by
> reading the CPU models from /proc/cpuinfo.
> 
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> ---
>  src/util/virsysinfo.c                   |    3 ++-
>  tests/sysinfodata/aarch64cpuinfo.data   |   10 ++++++++++
>  tests/sysinfodata/aarch64sysinfo.expect |   10 ++++++++++
>  tests/sysinfotest.c                     |   14 +++++++++++++-
>  4 files changed, 35 insertions(+), 2 deletions(-)
>  create mode 100644 tests/sysinfodata/aarch64cpuinfo.data
>  create mode 100644 tests/sysinfodata/aarch64sysinfo.expect
> 
> diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
> index 0802124..1c8cae5 100644
> --- a/src/util/virsysinfo.c
> +++ b/src/util/virsysinfo.c
> @@ -244,7 +244,7 @@ no_memory:
>      return NULL;
>  }
>  
> -#elif defined(__arm__)
> +#elif defined(__arm__) || defined(__aarch64__)
>  static int
>  virSysinfoParseSystem(const char *base, virSysinfoDefPtr ret)
>  {
> @@ -505,6 +505,7 @@ no_memory:
>        defined(__i386__) ||   \
>        defined(__amd64__) || \
>        defined(__arm__) || \
> +      defined(__aarch64__) || \
>        defined(__powerpc__))
>  virSysinfoDefPtr
>  virSysinfoRead(void) {
> diff --git a/tests/sysinfodata/aarch64cpuinfo.data b/tests/sysinfodata/aarch64cpuinfo.data
> new file mode 100644
> index 0000000..0d63139
> --- /dev/null
> +++ b/tests/sysinfodata/aarch64cpuinfo.data
> @@ -0,0 +1,10 @@
> +Processor	: AArch64 Processor rev 0 (aarch64)
> +BogoMIPS	: 100.00
> +
> +Features	: fp asimd
> +CPU architecture: AArch64
> +CPU variant	: 0x0
> +CPU part	: 0x000
> +CPU revision	: 0
> +
> +Hardware	: Generic AArch64
> diff --git a/tests/sysinfodata/aarch64sysinfo.expect b/tests/sysinfodata/aarch64sysinfo.expect
> new file mode 100644
> index 0000000..518434d
> --- /dev/null
> +++ b/tests/sysinfodata/aarch64sysinfo.expect
> @@ -0,0 +1,10 @@
> +<sysinfo type='smbios'>
> +  <processor>
> +    <entry name='socket_destination'>0</entry>
> +    <entry name='type'>AArch64 Processor rev 0 (aarch64) </entry>
> +  </processor>
> +  <processor>
> +    <entry name='socket_destination'>1</entry>
> +    <entry name='type'>AArch64 Processor rev 0 (aarch64)</entry>
> +  </processor>
> +</sysinfo>
> diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
> index ba57a7a..a88328f 100644
> --- a/tests/sysinfotest.c
> +++ b/tests/sysinfotest.c
> @@ -43,7 +43,7 @@
>  # if defined(__s390__) || defined(__s390x__) || \
>       defined(__powerpc__) || defined(__powerpc64__) || \
>       defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \
> -     defined(__arm__)
> +     defined(__arm__) || defined(__aarch64__)
>  
>  /* from sysinfo.c */
>  void virSysinfoSetup(const char *decoder,
> @@ -179,6 +179,18 @@ test_arm(void)
>  }
>  
>  VIRT_TEST_MAIN(test_arm)
> +# elif defined(__aarch64__)
> +static int
> +test_aarch64(void)
> +{
> +    return sysinfotest_run("aarch64 sysinfo",
> +                           NULL,
> +                           NULL,
> +                           "/sysinfodata/aarch64cpuinfo.data",
> +                           "/sysinfodata/aarch64sysinfo.expect");
> +}
> +
> +VIRT_TEST_MAIN(test_aarch64)
>  # else
>  int
>  main(void)
> 

ACK

- Cole
Daniel P. Berrangé Oct. 9, 2013, 2:49 p.m. UTC | #2
On Tue, Oct 08, 2013 at 07:19:09PM +0530, Pranavkumar Sawargaonkar wrote:
> Implement the bare minimal sysinfo for AArch64 platforms by
> reading the CPU models from /proc/cpuinfo.
> 
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> ---
>  src/util/virsysinfo.c                   |    3 ++-
>  tests/sysinfodata/aarch64cpuinfo.data   |   10 ++++++++++
>  tests/sysinfodata/aarch64sysinfo.expect |   10 ++++++++++
>  tests/sysinfotest.c                     |   14 +++++++++++++-
>  4 files changed, 35 insertions(+), 2 deletions(-)
>  create mode 100644 tests/sysinfodata/aarch64cpuinfo.data
>  create mode 100644 tests/sysinfodata/aarch64sysinfo.expect

ACK


Daniel
diff mbox

Patch

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 0802124..1c8cae5 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -244,7 +244,7 @@  no_memory:
     return NULL;
 }
 
-#elif defined(__arm__)
+#elif defined(__arm__) || defined(__aarch64__)
 static int
 virSysinfoParseSystem(const char *base, virSysinfoDefPtr ret)
 {
@@ -505,6 +505,7 @@  no_memory:
       defined(__i386__) ||   \
       defined(__amd64__) || \
       defined(__arm__) || \
+      defined(__aarch64__) || \
       defined(__powerpc__))
 virSysinfoDefPtr
 virSysinfoRead(void) {
diff --git a/tests/sysinfodata/aarch64cpuinfo.data b/tests/sysinfodata/aarch64cpuinfo.data
new file mode 100644
index 0000000..0d63139
--- /dev/null
+++ b/tests/sysinfodata/aarch64cpuinfo.data
@@ -0,0 +1,10 @@ 
+Processor	: AArch64 Processor rev 0 (aarch64)
+BogoMIPS	: 100.00
+
+Features	: fp asimd
+CPU architecture: AArch64
+CPU variant	: 0x0
+CPU part	: 0x000
+CPU revision	: 0
+
+Hardware	: Generic AArch64
diff --git a/tests/sysinfodata/aarch64sysinfo.expect b/tests/sysinfodata/aarch64sysinfo.expect
new file mode 100644
index 0000000..518434d
--- /dev/null
+++ b/tests/sysinfodata/aarch64sysinfo.expect
@@ -0,0 +1,10 @@ 
+<sysinfo type='smbios'>
+  <processor>
+    <entry name='socket_destination'>0</entry>
+    <entry name='type'>AArch64 Processor rev 0 (aarch64) </entry>
+  </processor>
+  <processor>
+    <entry name='socket_destination'>1</entry>
+    <entry name='type'>AArch64 Processor rev 0 (aarch64)</entry>
+  </processor>
+</sysinfo>
diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
index ba57a7a..a88328f 100644
--- a/tests/sysinfotest.c
+++ b/tests/sysinfotest.c
@@ -43,7 +43,7 @@ 
 # if defined(__s390__) || defined(__s390x__) || \
      defined(__powerpc__) || defined(__powerpc64__) || \
      defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \
-     defined(__arm__)
+     defined(__arm__) || defined(__aarch64__)
 
 /* from sysinfo.c */
 void virSysinfoSetup(const char *decoder,
@@ -179,6 +179,18 @@  test_arm(void)
 }
 
 VIRT_TEST_MAIN(test_arm)
+# elif defined(__aarch64__)
+static int
+test_aarch64(void)
+{
+    return sysinfotest_run("aarch64 sysinfo",
+                           NULL,
+                           NULL,
+                           "/sysinfodata/aarch64cpuinfo.data",
+                           "/sysinfodata/aarch64sysinfo.expect");
+}
+
+VIRT_TEST_MAIN(test_aarch64)
 # else
 int
 main(void)