From patchwork Thu Nov 14 15:20:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 21509 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6734D23FDD for ; Thu, 14 Nov 2013 15:20:35 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id k1sf4977135oag.2 for ; Thu, 14 Nov 2013 07:20:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=J25f3UB4JmIAShn6icNQ+YZ6v5LUnpxVu3eg3ocgvss=; b=UiRvCWDTBCrL+Sm1H3bWfN4V3URC+aHTlnjYffUV2nLAiytFFfVs2B+l7KCDL4KebB L0qr+K9fxRnbvg8zCk869ScblHmlavDXxswwOnGX4bWi8RU4/6c+7BsHKOTxXYpRfRN3 tsX1krmM4Tghtxtr8O9PJ92XYlr9sc7cbVTkW9SHy+3RUkquyoLAc33kEOiED0p8V9PE 877BdR/weZ6zjusA0x29Rsj1AXh6SSwL7m71BfwoUwqciJLREOTwSYm23ji28JXihD35 VyK+FsJpBYOk277H0WL1C8Xt2ahtAbKDdfFvkaciLfKfUcvcWWGWFApFrKn6slIgkCMW mH2Q== X-Gm-Message-State: ALoCoQk3q7F+V8SZ1DTrDiZvdM/MMyfR/eCBFefTFjabCGlxBtH930/wLF1OaNa7BY7LNVyNp2xY X-Received: by 10.182.246.39 with SMTP id xt7mr765102obc.40.1384442434599; Thu, 14 Nov 2013 07:20:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.231 with SMTP id b7ls980321qec.55.gmail; Thu, 14 Nov 2013 07:20:34 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr1214477vcb.14.1384442434451; Thu, 14 Nov 2013 07:20:34 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id st7si17239572vdc.107.2013.11.14.07.20.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Nov 2013 07:20:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 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.45; Received: by mail-vb0-f45.google.com with SMTP id p6so923796vbe.18 for ; Thu, 14 Nov 2013 07:20:34 -0800 (PST) X-Received: by 10.220.95.201 with SMTP id e9mr1980vcn.71.1384442434359; Thu, 14 Nov 2013 07:20:34 -0800 (PST) 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 u4csp323848vcz; Thu, 14 Nov 2013 07:20:33 -0800 (PST) X-Received: by 10.66.221.8 with SMTP id qa8mr1922942pac.188.1384442433179; Thu, 14 Nov 2013 07:20:33 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id vs7si27882896pbc.325.2013.11.14.07.20.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Nov 2013 07:20:33 -0800 (PST) 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 ld10so2209193pab.6 for ; Thu, 14 Nov 2013 07:20:32 -0800 (PST) X-Received: by 10.66.248.202 with SMTP id yo10mr1791558pac.177.1384442432487; Thu, 14 Nov 2013 07:20:32 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id qn1sm37828088pbc.34.2013.11.14.07.20.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Nov 2013 07:20:31 -0800 (PST) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Cc: Marc Zyngier , linaro-kernel@lists.linaro.org, patches@linaro.org, Catalin Marinas , linux-arm-kernel , Jitendra Kanitkar , ksankaran@apm.com, Jon Masters , Anup Patel , Pranavkumar Sawargaonkar Subject: [PATCH RESEND v4] arm64: KVM: Support X-Gene guest VCPU on APM X-Gene host Date: Thu, 14 Nov 2013 20:50:08 +0530 Message-Id: <1384442408-13286-1-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: anup.patel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 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_POTENZA for X-Gene Potenza compatible guest VCPU and we return KVM_ARM_TARGET_XGENE_POTENZA in kvm_target_cpu() when running on X-Gene host with Potenza core. V4: - Remove default case from switch statments in kvm_target_cpu() V3: - Reduce multiple "return -EINVAL" in kvm_target_cpu() V2: - Renamed KVM_ARM_TARGET_XGENE_V8 to KVM_ARM_TARGET_XGENE_POTENZA V1: - Initial patch with target named as KVM_ARM_TARGET_XGENE_V8 Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- arch/arm64/include/uapi/asm/kvm.h | 3 ++- arch/arm64/kvm/guest.c | 32 +++++++++++++++++++------------- arch/arm64/kvm/sys_regs_generic_v8.c | 3 +++ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 5031f42..d9f026b 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_POTENZA 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..d7bf7d6 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -207,20 +207,26 @@ 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 (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; + }; + break; + case ARM_CPU_IMP_APM: + switch (part_number) { + case APM_CPU_PART_POTENZA: + return KVM_ARM_TARGET_XGENE_POTENZA; + }; + break; + }; - 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; - default: - return -EINVAL; - } + return -EINVAL; } int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c index 4268ab9..8fe6f76 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_POTENZA, + &genericv8_target_table); + return 0; } late_initcall(sys_reg_genericv8_init);