Received: by 10.223.176.5 with SMTP id f5csp687256wra; Fri, 2 Feb 2018 04:35:22 -0800 (PST) X-Google-Smtp-Source: AH8x227fllonrWF+dM86+2fORd5Xb8QZLsvICdFAzx9gqViJnn2atBZuOnmt+eSAPQWb1uJhZTpl X-Received: by 10.98.129.194 with SMTP id t185mr39716043pfd.228.1517574922223; Fri, 02 Feb 2018 04:35:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517574922; cv=none; d=google.com; s=arc-20160816; b=FKaRrrwQgEhCYl+PWshJwQlTBd4kJVN3wiYzRJ5X+pVxDzz4rEGEKmPmaJcPV4j6v9 15KNJmJxodsKCYz0LOalugf3u2lcUVN6TvozfOUu7d2aw7jBO7Qu6jZBXZRAF8ZZ+JDQ DV9hHo48V+TdI+hmaZ/0X96h045RhniweMcyiXUIDWPUpL9QxssVuebSmUdAklbDEIGc Hna0fWCc4hD0ilF3O6vOrJm6DIVd7M9eU7/J76/uUcEAGAWOSD5Uhr4N8dI7YkU0ce5g /kFrLJMXHE7sXJkIW44J3BsntJ/iReiqf2/pUE7202ZQNz6KZpxUSHNfN3umYSAGHGwZ fMlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=gRy44P7PMevMWqfNnvHRgrfV/QxteUu1MRzeGsFUNdI=; b=Uo6YeutdqvJVueKVQxbobaghNd3Anc7R5FnJJrbsKL22IvwpFEBD2H9q05ZoXqxthq ni3QrDDKJDHCHxwZnPsOfag+9x4ltFKci9DNtdZGGgzB4CrVmF2Ny0mmzFE7MDgtU68S T1Zn13nDfkvOp6E2aAipMnvMm1mhmxSPscLN8+777VjV15ti0nrMkS0XJfYPRJBeh75t rOA30UJsbSZfhBAUmmjifDnVDw4eOjGI9bv1soCqfz2s6lUKt1IXUXdclVO1XyTFhInO 1MaACpoVdxB1XhvIkG57hEgCex0yneDp35wustIzh/clK9QxTcVkB6Dm0ZrpfEjEyVlJ p3TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYFEO0M8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m81si1739342pfk.168.2018.02.02.04.35.07; Fri, 02 Feb 2018 04:35:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYFEO0M8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751974AbeBBMdr (ORCPT + 99 others); Fri, 2 Feb 2018 07:33:47 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37720 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751853AbeBBMda (ORCPT ); Fri, 2 Feb 2018 07:33:30 -0500 Received: by mail-wm0-f68.google.com with SMTP id v71so12066456wmv.2 for ; Fri, 02 Feb 2018 04:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gRy44P7PMevMWqfNnvHRgrfV/QxteUu1MRzeGsFUNdI=; b=EYFEO0M8x5UDS5PyTS/i2m6zNCzZSZI82o62UX5Z5RWpBramNxZ3qo1tNLtlKHCsXp Tcr28A8PlYNQkLjT9MorHE8RxAJv7dglAAsdsfWGq+nHwi305douSGNNiYm7QYaFiMYw g2Rr6cqheLWWe5Ctin7vhHnGCSCrKGT1NLGe8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gRy44P7PMevMWqfNnvHRgrfV/QxteUu1MRzeGsFUNdI=; b=DXjmDGVCuKDMZQ2p0TN2S+jbEtpTxEBUdeaTYInZibr1V/7Qd+ut5F9F13rpVkgc98 xF4gN3JxDqXt5sMBCoS3a6/KDQ62XVP21/WYoARiT3E71HBN3pI7O8oBgV1wYPNQxqlo 86zkVyl1RJAcz7yUiLgH5I8U+xGAkHPsnu6OsTnlRKS3NLFrfM11dIGpva/gSIp2schq RcyqT0xSpFS5oTbK2lczLpWIRjpvVJK8fWhHCPeTEDovi4zRofgjmJ0j31DPU1lRhZcn UZBYeQrRiCVIzyfCWimuSD59+Gfx8hPw/dTlOKRYjBT4JTd57E3cUvFCz4iOVXtvZZWm k87w== X-Gm-Message-State: AKwxytchHaxkslaZcHy7lEhe1klfB7yz+1hc2FOJ/3KZ8yIMwSJTnd2C 4rJjNTbKC1BIPZxv0dbe7VhlpQ== X-Received: by 10.80.230.12 with SMTP id y12mr66539567edm.203.1517574808913; Fri, 02 Feb 2018 04:33:28 -0800 (PST) Received: from localhost (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id b46sm1533510edd.73.2018.02.02.04.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 04:33:28 -0800 (PST) Date: Fri, 2 Feb 2018 13:33:27 +0100 From: Christoffer Dall To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Catalin Marinas , Will Deacon , Peter Maydell , Lorenzo Pieralisi , Mark Rutland , Robin Murphy , Ard Biesheuvel , Andrew Jones , Hanjun Guo , Jayachandran C , Jon Masters , Russell King - ARM Linux Subject: Re: [PATCH v3 07/18] arm/arm64: KVM: Implement PSCI 1.0 support Message-ID: <20180202123327.GJ21802@cbox> References: <20180201114657.7323-1-marc.zyngier@arm.com> <20180201114657.7323-8-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180201114657.7323-8-marc.zyngier@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 11:46:46AM +0000, Marc Zyngier wrote: > PSCI 1.0 can be trivially implemented by having PSCI 0.2 and > the FEATURES call. Of, and returning 1.0 as the PSCI version. Of? (Oh ?) > > We happily ignore everything else, as it is optional. nit: Might be worth mentioning that there are other changes between v0.2 but they are clarifications or relaxations and therefore don't require additional changes. Reviewed-by: Christoffer Dall > > Signed-off-by: Marc Zyngier > --- > include/kvm/arm_psci.h | 1 + > virt/kvm/arm/psci.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 44 insertions(+) > > diff --git a/include/kvm/arm_psci.h b/include/kvm/arm_psci.h > index 5659343580a3..5446435457c2 100644 > --- a/include/kvm/arm_psci.h > +++ b/include/kvm/arm_psci.h > @@ -22,6 +22,7 @@ > > #define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1) > #define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2) > +#define KVM_ARM_PSCI_1_0 PSCI_VERSION(1, 0) > > int kvm_psci_version(struct kvm_vcpu *vcpu); > int kvm_psci_call(struct kvm_vcpu *vcpu); > diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c > index c41553d35110..291874cff85e 100644 > --- a/virt/kvm/arm/psci.c > +++ b/virt/kvm/arm/psci.c > @@ -313,6 +313,47 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) > return ret; > } > > +static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu) > +{ > + u32 psci_fn = smccc_get_function(vcpu); > + u32 feature; > + unsigned long val; > + int ret = 1; > + > + switch(psci_fn) { > + case PSCI_0_2_FN_PSCI_VERSION: > + val = KVM_ARM_PSCI_1_0; > + break; > + case PSCI_1_0_FN_PSCI_FEATURES: > + feature = smccc_get_arg1(vcpu); > + switch(feature) { > + case PSCI_0_2_FN_PSCI_VERSION: > + case PSCI_0_2_FN_CPU_SUSPEND: > + case PSCI_0_2_FN64_CPU_SUSPEND: > + case PSCI_0_2_FN_CPU_OFF: > + case PSCI_0_2_FN_CPU_ON: > + case PSCI_0_2_FN64_CPU_ON: > + case PSCI_0_2_FN_AFFINITY_INFO: > + case PSCI_0_2_FN64_AFFINITY_INFO: > + case PSCI_0_2_FN_MIGRATE_INFO_TYPE: > + case PSCI_0_2_FN_SYSTEM_OFF: > + case PSCI_0_2_FN_SYSTEM_RESET: > + case PSCI_1_0_FN_PSCI_FEATURES: > + val = 0; > + break; > + default: > + val = PSCI_RET_NOT_SUPPORTED; > + break; > + } > + break; > + default: > + return kvm_psci_0_2_call(vcpu); > + } > + > + smccc_set_retval(vcpu, val, 0, 0, 0); > + return ret; > +} > + > static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) > { > struct kvm *kvm = vcpu->kvm; > @@ -355,6 +396,8 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) > int kvm_psci_call(struct kvm_vcpu *vcpu) > { > switch (kvm_psci_version(vcpu)) { > + case KVM_ARM_PSCI_1_0: > + return kvm_psci_1_0_call(vcpu); > case KVM_ARM_PSCI_0_2: > return kvm_psci_0_2_call(vcpu); > case KVM_ARM_PSCI_0_1: > -- > 2.14.2 >