Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3132718pxb; Mon, 9 Nov 2020 03:34:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJza1hhn8x9W7928H/ZWSG5VxrpdaO9MTYsem5mKjlkCHCE5TacUVbrQmLTc42IpRh7R83vw X-Received: by 2002:a17:906:ccd3:: with SMTP id ot19mr15121190ejb.44.1604921689775; Mon, 09 Nov 2020 03:34:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604921689; cv=none; d=google.com; s=arc-20160816; b=Rc4jPi63stIJfx1MgecsHYwwX2RK/ykt60GwdZpVo7A8Klxv9Nxgg6XgoXIhfmf/b7 LWtGYJtAdqV0oOxwWdwJf6bsoSyIpyZY4Ck5NL1Zn33AYwSyjUasWMrX+8xK7Sqov/MF RUzjtcdf65uWHVtLgwnzZ7ZSigIjPqbZDOuwZZWKqVxftDC8rOQY+jFvTeWBCKgloaAq ZgDIbSetMusvoVCbLPXSpRW0AUH8LnM1DVeb+DVK05dW2zLoG74MLiRpzY6AorS5w+sJ ssZXonq+Ly1NVrj7AUFQCpgfJUag7sNtG8D5KgLwoeP7LBOdqmh1Sw8nM376xqS0BriH DNSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=MjsoubUsD+YFr+cvIMJH5nn/IF0/j0z+DdW/E8ChYvlGWbKfAzHBhVm1JCmLLYOFR3 9lsuJgjv5vi4cyy41fqV6F2JR2iUdbhhwZYIHwUqez1Dx9gqGM6qxFAP6NnNf59rMw7+ 7VUjs+6fK8W5sJ0TOyZCDKj0m2TlQYF2TukTWWvSLSJ7+JsvmcVqHKfbunCpGHTaHvGb V6nx3ssUt59hdASnAc0gOAeyBX1jKXUeBwp42BIghvCQf+dz2aR6m27h0zeDd5zJCxJH m1o872qNSK8O3Fj9UuVM7kH8hZgtj6KmEViGA5gsCo+vt9bD5qhGoh8GEYVoFg8+YTTK YlrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tKDv7a9R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si3963231ejc.249.2020.11.09.03.34.26; Mon, 09 Nov 2020 03:34:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tKDv7a9R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729491AbgKILcs (ORCPT + 99 others); Mon, 9 Nov 2020 06:32:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729442AbgKILcq (ORCPT ); Mon, 9 Nov 2020 06:32:46 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C80FC0613CF for ; Mon, 9 Nov 2020 03:32:45 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id d142so7642478wmd.4 for ; Mon, 09 Nov 2020 03:32:45 -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=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=tKDv7a9REysuwMcfZXBWv7HtDLUfJLSTc25Wz4yG+dYB9FiY+ZSpS20+jeI7ruPf4I /fRs+zUVAIUMH1v15ddDDay1fvfPcrhZMC5kpfB1XWwITdN/8S2pMA+But30yQSNFNB8 jXgP2h4bzV7gV3d+faa8zOcxytIQ75QP4e6KxzkSUI0fLT1OOhTj4AvNRjPQ6XdKxesG ND6CsW+tx1PrW/9Sz/H3LHqnbchMyHOUycxmZIOc1N/2GLN4ul752VNg35nnWTjEXdVH EK3JO5SzqaS0OeDrJpetOM5SGKT+6ZRfLDHKcoyYlwBds01zZYnphO02pxAGc+J+wzvK hRJw== 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=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=s+CM49ycF/rCAbtdUGBwpuj34E5OfUMWQ19YiDZLv2M4hvjvZo+4gQ0/c7YSfbKJFr +qeQe37NLoO4OLTx6T95mRoXXTjNaeaCMQnK7biptIu84d00Ot31VThm0TQU0k57eYRX 0p8BUoB5z+YQnu/x3bXi1/SCafmb0uK41Dtx5RdvrbEFF05lZYn9Smj4qQ6wZmxCxzmc lyQWmYGPS47NA16a3V4IySnoFKDO7UPuzRlmH9hSI8q3H866t7DAaDOdkX8dipfN5GAV NLG5MlbZ0nKFyRwVzME9funbKKA+J+miZeOJx1dwDVCLF0nia3KU0qJosFFQaF8HjV73 xBIQ== X-Gm-Message-State: AOAM531Y/nh7fUCWxEmE7g6XbKlhXeqnkg49hp3zrZGdvDA/0OFdAxyT Yidd8gieGUfi3ze+dTDb/Cz+qA== X-Received: by 2002:a1c:7dc8:: with SMTP id y191mr14412755wmc.118.1604921563823; Mon, 09 Nov 2020 03:32:43 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id h4sm12847197wrp.52.2020.11.09.03.32.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:32:42 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Quentin Perret , Andrew Scull , Andrew Walbran , kernel-team@android.com, David Brazdil Subject: [PATCH v1 02/24] psci: Accessor for configured PSCI function IDs Date: Mon, 9 Nov 2020 11:32:11 +0000 Message-Id: <20201109113233.9012-3-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the host is using PSCI v0.1, KVM's host PSCI proxy needs to use the same IDs. Expose the array holding the information with a read-only accessor. Signed-off-by: David Brazdil --- drivers/firmware/psci/psci.c | 14 ++++++-------- include/linux/psci.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index bc1b2d60fdbf..b67b2ba8a084 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -65,16 +65,14 @@ typedef unsigned long (psci_fn)(unsigned long, unsigned long, unsigned long, unsigned long); static psci_fn *invoke_psci_fn; -enum psci_function { - PSCI_FN_CPU_SUSPEND, - PSCI_FN_CPU_ON, - PSCI_FN_CPU_OFF, - PSCI_FN_MIGRATE, - PSCI_FN_MAX, -}; - static u32 psci_function_id[PSCI_FN_MAX]; +u32 psci_get_function_id(enum psci_function fn) +{ + WARN_ON(fn >= PSCI_FN_MAX); + return psci_function_id[fn]; +} + #define PSCI_0_2_POWER_STATE_MASK \ (PSCI_0_2_POWER_STATE_ID_MASK | \ PSCI_0_2_POWER_STATE_TYPE_MASK | \ diff --git a/include/linux/psci.h b/include/linux/psci.h index 5b5dcf176aa6..8fe681a7b43d 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -29,6 +29,16 @@ bool psci_has_osi_support(void); */ int psci_driver_version(void); +enum psci_function { + PSCI_FN_CPU_SUSPEND, + PSCI_FN_CPU_ON, + PSCI_FN_CPU_OFF, + PSCI_FN_MIGRATE, + PSCI_FN_MAX, +}; + +u32 psci_get_function_id(enum psci_function fn); + struct psci_operations { u32 (*get_version)(void); int (*cpu_suspend)(u32 state, unsigned long entry_point); -- 2.29.2.222.g5d2a92d10f8-goog