From patchwork Tue Oct 8 13:49:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 20896 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3557A24697 for ; Tue, 8 Oct 2013 13:49:39 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id i13sf11145177qae.9 for ; Tue, 08 Oct 2013 06:49:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=wZxJmQoslxDAkbkFcimg5EdU+1jsued0rIhr9M7gOxQ=; b=SCn4rukxCz8icnGEhcEZsYLq0pBFIAip20RvB0dG0syw7PhpaSxvNZjwHXCebnvesp DTzGaBTundzFXsE4oF6zd4bbirDgOX+YXlUwoDzAE+9uZOCD3NbCnXic1EiVIzTWTEes xStV9am/BfcbQtW0AtoVp9SEb5usMcxr6kI+pYBWnLda0W8ckQxcQW1m610SToAmtRxX tpvpKFsrAIASZKdHdhVs5mQEUhC3OgSPMnUVdhg4UMDx82Nm5RNelFyum6dNANloUNYV 8TVFNuFf4bQ8oPTA35FFL/ivJDubqvWzpGHOcc8q/TxupYURBizg2vVm45/SyuFMvUuQ Mdfw== X-Received: by 10.236.18.196 with SMTP id l44mr1505975yhl.52.1381240178936; Tue, 08 Oct 2013 06:49:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.135 with SMTP id jw7ls223361qeb.58.gmail; Tue, 08 Oct 2013 06:49:38 -0700 (PDT) X-Received: by 10.52.33.147 with SMTP id r19mr953337vdi.37.1381240178727; Tue, 08 Oct 2013 06:49:38 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id g2si9554436vch.103.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Oct 2013 06:49:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id x14so4183945vbb.37 for ; Tue, 08 Oct 2013 06:49:38 -0700 (PDT) X-Gm-Message-State: ALoCoQnIX+TBsJ5bT7u/A/JEKPrzBL7Z7Y/vxRa6HqwSTCv2jrLeAaQUWd3XqQKZZ5QnWo2Bmql2 X-Received: by 10.220.48.194 with SMTP id s2mr348333vcf.43.1381240178622; Tue, 08 Oct 2013 06:49:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp206664vcz; Tue, 8 Oct 2013 06:49:37 -0700 (PDT) X-Received: by 10.66.218.226 with SMTP id pj2mr3806453pac.62.1381240177556; Tue, 08 Oct 2013 06:49:37 -0700 (PDT) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by mx.google.com with ESMTPS id vn5si26619780pbc.72.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Oct 2013 06:49:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.53 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.160.53; Received: by mail-pb0-f53.google.com with SMTP id up15so8620252pbc.26 for ; Tue, 08 Oct 2013 06:49:37 -0700 (PDT) X-Received: by 10.68.50.106 with SMTP id b10mr2164276pbo.152.1381240177002; Tue, 08 Oct 2013 06:49:37 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ha10sm40234559pbc.23.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Oct 2013 06:49:36 -0700 (PDT) From: Pranavkumar Sawargaonkar To: libvirt-list@redhat.com Cc: patches@linaro.org, crobinso@redhat.com, berrange@redhat.com, anup.patel@linaro.com, Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH 2/6] AArch64: CPU Support for AArch64 (ARMv8 64bit). Date: Tue, 8 Oct 2013 19:19:07 +0530 Message-Id: <1381240151-15060-3-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1381240151-15060-1-git-send-email-pranavkumar@linaro.org> References: <1381240151-15060-1-git-send-email-pranavkumar@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Adding CPU encoder/decoder for AArch64. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- src/Makefile.am | 1 + src/cpu/cpu.c | 2 ++ src/cpu/cpu_aarch64.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu_aarch64.h | 31 +++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 src/cpu/cpu_aarch64.c create mode 100644 src/cpu/cpu_aarch64.h diff --git a/src/Makefile.am b/src/Makefile.am index 201c268..d5e62d8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -900,6 +900,7 @@ CPU_SOURCES = \ cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ cpu/cpu_s390.h cpu/cpu_s390.c \ cpu/cpu_arm.h cpu/cpu_arm.c \ + cpu/cpu_aarch64.h cpu/cpu_aarch64.c \ cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \ cpu/cpu_powerpc.c cpu/cpu_ppc_data.h diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 31de857..e611452 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -32,6 +32,7 @@ #include "cpu_powerpc.h" #include "cpu_s390.h" #include "cpu_arm.h" +#include "cpu_aarch64.h" #include "cpu_generic.h" #include "util/virstring.h" @@ -44,6 +45,7 @@ static struct cpuArchDriver *drivers[] = { &cpuDriverPowerPC, &cpuDriverS390, &cpuDriverArm, + &cpuDriverAARCH64, /* generic driver must always be the last one */ &cpuDriverGeneric }; diff --git a/src/cpu/cpu_aarch64.c b/src/cpu/cpu_aarch64.c new file mode 100644 index 0000000..8c78eca --- /dev/null +++ b/src/cpu/cpu_aarch64.c @@ -0,0 +1,79 @@ +/* + * cpu_aarch64.c: CPU driver for AArch64 CPUs + * + * + * 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 + * . + * + * Authors: + * Anup Patel + * Pranavkumar Sawargaonkar + */ + +#include + +#include "viralloc.h" +#include "cpu.h" + +#define VIR_FROM_THIS VIR_FROM_CPU + +static const virArch archs[] = { VIR_ARCH_AARCH64 }; + +static virCPUDataPtr +AArch64NodeData(virArch arch) +{ + virCPUDataPtr data; + + if (VIR_ALLOC(data) < 0) + return NULL; + + data->arch = arch; + + return data; +} + +static int +AArch64Decode(virCPUDefPtr cpu ATTRIBUTE_UNUSED, + const virCPUDataPtr data ATTRIBUTE_UNUSED, + const char **models ATTRIBUTE_UNUSED, + unsigned int nmodels ATTRIBUTE_UNUSED, + const char *preferred ATTRIBUTE_UNUSED, + unsigned int flags) +{ + + virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1); + + return 0; +} + +static void +AArch64DataFree(virCPUDataPtr data) +{ + VIR_FREE(data); +} + +struct cpuArchDriver cpuDriverAARCH64 = { + .name = "aarch64", + .arch = archs, + .narch = ARRAY_CARDINALITY(archs), + .compare = NULL, + .decode = AArch64Decode, + .encode = NULL, + .free = AArch64DataFree, + .nodeData = AArch64NodeData, + .guestData = NULL, + .baseline = NULL, + .update = NULL, + .hasFeature = NULL, +}; diff --git a/src/cpu/cpu_aarch64.h b/src/cpu/cpu_aarch64.h new file mode 100644 index 0000000..8e48368 --- /dev/null +++ b/src/cpu/cpu_aarch64.h @@ -0,0 +1,31 @@ +/* + * cpu_aarch64.h: CPU driver for AArch64 CPUs + * + * + * 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 + * . + * + * Authors: + * Anup Patel + * Pravakumar Sawargaonkar + */ + +#ifndef __VIR_CPU_AARCH64_H__ +# define __VIR_CPU_AARCH64_H__ + +# include "cpu.h" + +extern struct cpuArchDriver cpuDriverAARCH64; + +#endif /* __VIR_CPU_AARCH64_H__ */