From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A4E4C4741F for ; Mon, 9 Nov 2020 11:35:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0EE7E206A4 for ; Mon, 9 Nov 2020 11:35:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VIdOZnU3"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="WWfakKwG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EE7E206A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jcj+hOb5S0PIrIaeRDt2t4v8x+Rj2WJeFKW1VfXbKek=; b=VIdOZnU3mJ57DS44l8jzxVa71 culnSWJSSlVli38+nyE1k/SssoFEywz2ayXtytd/6ONi8WfX7yqmLuAaRKEFZLwi0QKbDt81+tSud 4UygmTMiIvxWj1cQw4HGCf2+7oheRvsEHFvnLnPLXUuu+rqYTGAStJUU0p+CaqW144oufTyNhM8UO agDrUXEZO0N0PssSPbJHkp9nirVkHxCK8JG7ToUC9vnChj7bOU/kxGa5fvUicYD2Sne2Y/HFLOak5 7IPulX+4CbGxhT/OCqIxlWHRo+nsb5fuUmyBjiixB0/9zn+O22IVbYxaRRjLwyi9A4hFfe0nsgtgm t80du+o5g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5Pm-0004MI-6j; Mon, 09 Nov 2020 11:32:50 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5Pf-0004Jh-3Z for linux-arm-kernel@lists.infradead.org; Mon, 09 Nov 2020 11:32:44 +0000 Received: by mail-wr1-x442.google.com with SMTP id l1so3906044wrb.9 for ; Mon, 09 Nov 2020 03:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pzuHJ5pL7t9NbTEFogq/8Y23xeOn+spq7fy4sQhhUGw=; b=WWfakKwGe1YouBXlERhaEppVHXGHFfpGO6bW/qiGXsfrnx2X9Lb/WvrzQ1BmW5RS/5 zHLiFC7sJhMK2RlWUkklFx+QINQJt1MhJ3kSxKkvhs0XrDOB01DonqHn5Emvim+ioae0 mzXqV6OD7rZ1HSeAlSSDGTafFQGnM2ub6vcj/8Xmt2enbD8TouDTCyPN/DRyQDDtF59k mWUJLHIx+sJoEQIEa+cOmDc1ijKk+N4l7rd1M6uJti+h61k4Lpgatharg5X9b8N/s2tO 3ys6wT2kD/LsHwgKSgmM2snJbpUNI7giobddJY6xsKxnsjnqKVOAuK1ozzqZAQuNkoXW p8NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pzuHJ5pL7t9NbTEFogq/8Y23xeOn+spq7fy4sQhhUGw=; b=hx75ic/K5eMHMKwx/M+lphOsaT6i0jjmM7k3NRyrUQ/jNQpqmtGofSkV786Wq49dLz rB3WXSveo6f/w5cw3zU74Lm1mOuSjwgBgyUKAqZsC6iaISY0G6Q+/5Q/7NPjzf8GDXv8 7XbQTY+1cpaFYji3mh7S9qoqq1Dk3nrCya+eJQ0iBPIga69AUjUvYJyYkIhxe0ypoMNC 0cnAzNjYY2MXPpghGyuWIgj00Knj81AeXoPOjlMQbZcMn4SoO5H/E5BguvwDoPjo6Wfm k6QG9NzqO5vK+8gfxbKVEUjKNwBhTxKFYCxSZGlvt2qnFacK/SgSeVM/faMD82Kgzb6p mfqw== X-Gm-Message-State: AOAM532GhmFOhQdxImUhtBIfN6KtdV5luE0HsvCWoQu8OpYstGCBRIqW nATQMe3WDvJ5/gQAh6YGESJarS2HBCil3PJs X-Google-Smtp-Source: ABdhPJygvHSvFhOYazfMvt3AJzEQrYuyl6Z5s6RaM4KlhnPW6/ZF7ztOig2+Ano7PbZOzUl7hy8ELw== X-Received: by 2002:adf:ef48:: with SMTP id c8mr17832902wrp.399.1604921561816; Mon, 09 Nov 2020 03:32:41 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id y20sm12191934wma.15.2020.11.09.03.32.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:32:40 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v1 01/24] psci: Accessor for configured PSCI version Date: Mon, 9 Nov 2020 11:32:10 +0000 Message-Id: <20201109113233.9012-2-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109113233.9012-1-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_063243_221512_AC0ECD67 X-CRM114-Status: GOOD ( 20.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Suzuki K Poulose , Marc Zyngier , Quentin Perret , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Tejun Heo , Dennis Zhou , Christoph Lameter , David Brazdil , Will Deacon , Julien Thierry , Andrew Scull Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The version of PSCI that the kernel should use to communicate with firmware is typically obtained from probing PSCI_VERSION. However, that doesn't work for PSCI v0.1 where the host gets the information from DT/ACPI, or if PSCI is not supported / was disabled. KVM's host PSCI proxy needs to be configured with the same version used by the host driver. Expose the PSCI version used by the host with a read-only accessor. Signed-off-by: David Brazdil --- drivers/firmware/psci/psci.c | 11 +++++++++++ include/linux/psci.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 00af99b6f97c..bc1b2d60fdbf 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -49,6 +49,13 @@ static int resident_cpu = -1; struct psci_operations psci_ops; static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE; +static int driver_version = PSCI_VERSION(0, 0); + +int psci_driver_version(void) +{ + return driver_version; +} + bool psci_tos_resident_on(int cpu) { return cpu == resident_cpu; @@ -461,6 +468,8 @@ static int __init psci_probe(void) return -EINVAL; } + driver_version = ver; + psci_0_2_set_functions(); psci_init_migrate(); @@ -514,6 +523,8 @@ static int __init psci_0_1_init(struct device_node *np) pr_info("Using PSCI v0.1 Function IDs from DT\n"); + driver_version = PSCI_VERSION(0, 1); + if (!of_property_read_u32(np, "cpu_suspend", &id)) { psci_function_id[PSCI_FN_CPU_SUSPEND] = id; psci_ops.cpu_suspend = psci_cpu_suspend; diff --git a/include/linux/psci.h b/include/linux/psci.h index 2a1bfb890e58..5b5dcf176aa6 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -21,6 +21,14 @@ bool psci_power_state_is_valid(u32 state); int psci_set_osi_mode(bool enable); bool psci_has_osi_support(void); +/** + * The version of the PSCI specification followed by the driver. + * This is equivalent to calling PSCI_VERSION except: + * (a) it also works for PSCI v0.1, which does not support PSCI_VERSION, and + * (b) it is set to v0.0 if the PSCI driver was not initialized. + */ +int psci_driver_version(void); + struct psci_operations { u32 (*get_version)(void); int (*cpu_suspend)(u32 state, unsigned long entry_point); -- 2.29.2.222.g5d2a92d10f8-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel