Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3565019pxb; Mon, 16 Nov 2020 19:25:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDYavh32bpWC/a6gWEyd5CwqNGOPah7uTXBd/+7OR4NEo0Z+v+sHx3J7re2VseKUNGpEyg X-Received: by 2002:a17:906:b202:: with SMTP id p2mr16906479ejz.483.1605583504981; Mon, 16 Nov 2020 19:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605583504; cv=none; d=google.com; s=arc-20160816; b=r3KZBLBamdRhTXZvS7wLSAtXaKaYm0zlXUrz0tq1VCFgBxMFY1ofNBJujHv7kq5Mdm cdW55M+KMc7nwamdz6JjMBe1G+dp2Mk+Sda/3AuLwApwk2sDkLyv6KA89Y3Ml1J7S6n4 F6Zckicfso552Wi7A5hv36jaMg9FW1nfEzs8T+1WG56zJ+K24QO2mMoEQLuIvR5qgXVB ACUwdpjiIQlAHgjwuW9atNDefNP/e6JqL2YFr/M9Xg2VOHnDN88SEn/L8CoguNtawqBG CcgAhLbfR4MWvNi7XRnDuiCqMq2aKs6E6Y3rjUg31gR/tpoZtLpD2xrnYyvabLuReob/ /5OA== 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=HBK5eZkVMoQritbd0wCyBeq8n+u1kTTgyjfghI2qI2A=; b=lyg9QRBKy8srGo37Dzfc0ZLtAayBCLv+PI6n2ukNazgbDDPAU4DpGuaCz4aUJ4mJDU w5/rVlDZmnUEmsa+HCBF7s4jNIajEefollOJcEbHXs9OvK8aXrqUVkD7L+9AEwYxQXHF QCBLEksM63DTn5olO/kTcajUnBK8u6nGJHtUPDyhREZ/RA/Zfbbr4j/tw0U2RxvqgWK1 0PJosfeX9O9v5Lws1pJ98WlaM9qBL9jr8M1c9pks9prZ+RHbjAR0o5UrH03KIjSvNkBw BP+uw+PlQXlgcuoZSuzXe3mQWC25OrbABPhXlm9FjCAxL6EYW2rwd8NJhi/khv3Sr9Hr rJGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LpPgLYJo; 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 hd41si8232393ejc.168.2020.11.16.19.24.42; Mon, 16 Nov 2020 19:25:04 -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=LpPgLYJo; 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 S1733266AbgKPUna (ORCPT + 99 others); Mon, 16 Nov 2020 15:43:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbgKPUn2 (ORCPT ); Mon, 16 Nov 2020 15:43:28 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965C9C0613CF for ; Mon, 16 Nov 2020 12:43:28 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id m6so3096620wrg.7 for ; Mon, 16 Nov 2020 12:43:28 -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=HBK5eZkVMoQritbd0wCyBeq8n+u1kTTgyjfghI2qI2A=; b=LpPgLYJoCTv1oHKKJjTShTeJ0/jzOj8483R1CyGe1/2yiVHw7V+amuY2dvDpQHINYo B71XuITyMBPai4U5C6bwKeUbWwMyZoqtuG+ktdinJPefMIYT5OKiw4TZp1VA2qnS0Y7i qNcxpiT4Yiep08Ci0LKvyduGtf9H/28dn9zw9DWwG8kr7EwA668DtdnfK4Mnx7PrfUdl D2iNXtKU2gxvyT50AqnyqkyBUsEGaZHkJ6nfWFso5KbSeHu4i5iIOb/OtoKv+e4Nf+oI vzovOiJ+Q4vTPXfsSSvudXA8WMmsl8qtUik5L4t7/Oc1UtHytqTGpUI4dciQJHhRjFre TEjw== 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=HBK5eZkVMoQritbd0wCyBeq8n+u1kTTgyjfghI2qI2A=; b=EYXZUNUvdhjTnO8fy/MwXBX2K7EfVuAAdsUgq/5b2tX9W/S7mqGCUWUGpg5AqjyNXG 5+Y5J/ErSzZmiy8WLeChAiz/6q2jMDXD4QJBlwaOgKcXfBmjkkqi+092dzMLiwOo06JA b+3n9PbjbqHgwe+De9BLbQdC4ugTUlWZ1gL39QhHlDNDozc5b+MI9RG7AMc2xUKPPppy 5UuONpSoJc8PQ7XCWfBZfzjKrcJl7srF5k3AcmFx77c/0nSfXKUKlBch4d7pwcIIqOqy KwSWTdW4zXKySmkZYM4Liwt12Iyo4PAxxTNBFtJIotwepIbtOjP3YdKOCTlTQ8dzueeX OumQ== X-Gm-Message-State: AOAM5334nZ6Ho/r4LY5Rdh8zZGwYhz9txUxbU4TyUXOMIUt9k7QApd4Q RoEyFB+haGR7Uso4uHB4u+hm+g== X-Received: by 2002:adf:a40c:: with SMTP id d12mr21800321wra.154.1605559407257; Mon, 16 Nov 2020 12:43:27 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:bc40:bd71:373a:1b33]) by smtp.gmail.com with ESMTPSA id o10sm516959wma.47.2020.11.16.12.43.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Nov 2020 12:43:26 -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 v2 02/24] psci: Accessor for configured PSCI function IDs Date: Mon, 16 Nov 2020 20:42:56 +0000 Message-Id: <20201116204318.63987-3-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201116204318.63987-1-dbrazdil@google.com> References: <20201116204318.63987-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 213c68418a65..d835f3d8b121 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -58,16 +58,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 2a1bfb890e58..5b49a5c82d6f 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -21,6 +21,16 @@ bool psci_power_state_is_valid(u32 state); int psci_set_osi_mode(bool enable); bool psci_has_osi_support(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.299.gdc1121823c-goog