From patchwork Mon Jul 15 11:46:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 18357 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A4A825E28 for ; Mon, 15 Jul 2013 11:47:03 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id hu16sf3685988qab.4 for ; Mon, 15 Jul 2013 04:47:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=2qtnq77pm1K7IhJCJXF1jFPzPki/6519wYX7tI2xURk=; b=Liqj+ZyN8o5ydVVh8wFG/vABXu82px9FuP9iO6lrnvC7qxGh+I5NzyAOZ8ZchAM0Lw 10BQx3dqmxQUHQNe3/CcNaUo/Zjd2890C8njoxh1ZKag9LlAMbTIW/ajxH/3EUGbPTr9 TnRdMEMflEI2UNpdCp6S4iP0JvmLHR8gIeIiIZfFjaUYSXb0wSu72Y2L/gYUgYCyCVNr /HmrAyzEyN6DIz58c3ZTR8BHEWar7KuU33UvxRdL15gPyIAa8BgiQrHA9vt0/dqcVGFg hS7K2a3p6ISePvprpWVNFanEoow6Y+hv/oquweovGiSTqIX7bFqTQ9RgId+xN2NDR4jb 94Eg== X-Received: by 10.236.201.19 with SMTP id a19mr27814630yho.24.1373888823017; Mon, 15 Jul 2013 04:47:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.212 with SMTP id de20ls4607548qeb.44.gmail; Mon, 15 Jul 2013 04:47:02 -0700 (PDT) X-Received: by 10.58.76.34 with SMTP id h2mr28190576vew.93.1373888822815; Mon, 15 Jul 2013 04:47:02 -0700 (PDT) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id h20si14700813vck.125.2013.07.15.04.47.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Jul 2013 04:47:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.44 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.44; Received: by mail-vb0-f44.google.com with SMTP id e15so3073532vbg.17 for ; Mon, 15 Jul 2013 04:47:02 -0700 (PDT) X-Received: by 10.220.198.133 with SMTP id eo5mr28444311vcb.24.1373888822708; Mon, 15 Jul 2013 04:47:02 -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.149.77 with SMTP id s13csp64679vcv; Mon, 15 Jul 2013 04:47:01 -0700 (PDT) X-Received: by 10.66.218.39 with SMTP id pd7mr55068629pac.148.1373888821521; Mon, 15 Jul 2013 04:47:01 -0700 (PDT) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id co1si32421457pbc.78.2013.07.15.04.47.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Jul 2013 04:47:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kl14so10996900pab.20 for ; Mon, 15 Jul 2013 04:47:00 -0700 (PDT) X-Received: by 10.66.7.164 with SMTP id k4mr20904130paa.142.1373888820682; Mon, 15 Jul 2013 04:47:00 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id iv4sm60560824pbc.9.2013.07.15.04.46.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Jul 2013 04:46:59 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, marc.zyngier@arm.com, catalin.marinas@arm.com, Anup Patel , Pranavkumar Sawargaonkar Subject: [PATCH] arm64: KVM: Support X-Gene guest VCPU on APM X-Gene host Date: Mon, 15 Jul 2013 17:16:27 +0530 Message-Id: <1373888788-8055-1-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlapAWhqkc/B0i1HBRlw7xS7OTsE37YnXESU2XQIAeD5qwSXMY1rSF8eYzW9hzByEjB8Bld X-Original-Sender: anup.patel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.44 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: , This patch allows us to have X-Gene guest VCPU when using KVM arm64 on APM X-Gene host. We add KVM_ARM_TARGET_XGENE_V8 for X-Gene compatible guest VCPU and we return KVM_ARM_TARGET_XGENE_V8 in kvm_target_cpu() when running on X-Gene host. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- arch/arm64/include/uapi/asm/kvm.h | 3 ++- arch/arm64/kvm/guest.c | 34 ++++++++++++++++++++++------------ arch/arm64/kvm/sys_regs_generic_v8.c | 3 +++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 5031f42..8194707 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -55,8 +55,9 @@ struct kvm_regs { #define KVM_ARM_TARGET_AEM_V8 0 #define KVM_ARM_TARGET_FOUNDATION_V8 1 #define KVM_ARM_TARGET_CORTEX_A57 2 +#define KVM_ARM_TARGET_XGENE_V8 3 -#define KVM_ARM_NUM_TARGETS 3 +#define KVM_ARM_NUM_TARGETS 4 /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ #define KVM_ARM_DEVICE_TYPE_SHIFT 0 diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 2c3ff67..e99b0a5 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -207,19 +207,29 @@ int __attribute_const__ kvm_target_cpu(void) unsigned long implementor = read_cpuid_implementor(); unsigned long part_number = read_cpuid_part_number(); - if (implementor != ARM_CPU_IMP_ARM) - return -EINVAL; - - switch (part_number) { - case ARM_CPU_PART_AEM_V8: - return KVM_ARM_TARGET_AEM_V8; - case ARM_CPU_PART_FOUNDATION: - return KVM_ARM_TARGET_FOUNDATION_V8; - case ARM_CPU_PART_CORTEX_A57: - /* Currently handled by the generic backend */ - return KVM_ARM_TARGET_CORTEX_A57; + switch (implementor) { + case ARM_CPU_IMP_ARM: + switch (part_number) { + case ARM_CPU_PART_AEM_V8: + return KVM_ARM_TARGET_AEM_V8; + case ARM_CPU_PART_FOUNDATION: + return KVM_ARM_TARGET_FOUNDATION_V8; + case ARM_CPU_PART_CORTEX_A57: + return KVM_ARM_TARGET_CORTEX_A57; + default: + return -EINVAL; + } + break; + case ARM_CPU_IMP_APM: + switch (part_number) { + case APM_CPU_PART_POTENZA: + return KVM_ARM_TARGET_XGENE_V8; + default: + return -EINVAL; + } + break; default: - return -EINVAL; + return -EINVAL; } } diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c index 4268ab9..87f0b3f4 100644 --- a/arch/arm64/kvm/sys_regs_generic_v8.c +++ b/arch/arm64/kvm/sys_regs_generic_v8.c @@ -90,6 +90,9 @@ static int __init sys_reg_genericv8_init(void) &genericv8_target_table); kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57, &genericv8_target_table); + kvm_register_target_sys_reg_table(KVM_ARM_TARGET_XGENE_V8, + &genericv8_target_table); + return 0; } late_initcall(sys_reg_genericv8_init);