Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp145015pxb; Wed, 18 Nov 2020 00:10:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEWupClNFuBbwopcS9pQcVK/Drf2BRXMxnOBvKi2i6Hy/sIDoUl8AyDu6/xJ+Aj/sxf3PN X-Received: by 2002:a05:6402:3098:: with SMTP id de24mr24236096edb.155.1605687043707; Wed, 18 Nov 2020 00:10:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1605687043; cv=pass; d=google.com; s=arc-20160816; b=QLeoq/rAK+I3zEIpfFU2c0gfMD/ouII8h2FIGy1swLbyVk94u1bfMTVqLLdOd6406i L0I5laYT8YC6tWAm4taKk2tF1FivSOTcbPOCm+6hJyqyzY9Iv0eki9sQ3u0MhQGd4/o+ w9XbcfAreJJ59Zv3K3B+7GtHmRj5ij1gCnP5lkMITJB36aCETZD0UlGZmf9oE1w/uz8U H+KeRqSx/i+k7v0uLi3Dy+IK1kXCrLw0pQUDeMnv0dmrWyRu5gN+s1OhgJoBAvSQWrQF JQxPyIWtXUoneHaWF54VgW/lzQC9taxJVAmcc2GxTHMEwqBtuOe0AWCei1KduHqKi0EW azKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:envelope-to:dkim-signature; bh=s9/IsjCOTiTkt0pSphdZ4YBLSL+jBXL0pj09EddTBEY=; b=bepKvEej+2KPQwORYmMCI+010xXssfx4jqmmRskN4DK5CZMNTvCuOE1bqXZZLupe22 iOD5dMUJoj2qz3D9YTExn7NTCKqnwZAAQ2mcexJTX+Tut2xUBGLsEzXID9d7FBcagNss Sb0yPA4i0gP9b4jf2bBzpXHskzErso8f2kM4HHcuTUUci3LYYdrQ9/F9d6r5+6j+q7D/ ZGUqA7NRRgRjOTn/qB7R4h0F2tfJz5yiD34EBZ1yDokAy3Bulz0H3UNHS327LANwlk10 FrLTA2gZLwA23CTORtERGv+CojONqKFJSv7bopkVicbevHd7FTGMsvMgxukoA2K/Hb06 mvVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=LgRZ3aGN; arc=pass (i=1 spf=pass spfdomain=xilinx.com); 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di3si14704794edb.554.2020.11.18.00.10.21; Wed, 18 Nov 2020 00:10:43 -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=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=LgRZ3aGN; arc=pass (i=1 spf=pass spfdomain=xilinx.com); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727287AbgKRIHC (ORCPT + 99 others); Wed, 18 Nov 2020 03:07:02 -0500 Received: from mail-bn7nam10on2083.outbound.protection.outlook.com ([40.107.92.83]:60896 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727267AbgKRIHB (ORCPT ); Wed, 18 Nov 2020 03:07:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jrdq7UfTgd/stLO022lDR0tYLDNEufUCnHWdX2p6sKRJcZuezvycs7Cmx5x65uWUkYhBoJyFg1V65OODoN9xH9zxCPotqTVCUa0vFGjmnM1dheBxZFd6/gx3E8RUUOMC39hgS549Frr7UZj37mjmKiCuCcqdTp9iznqNdm8z28dymDVxkaRYaDXaWNNtAYoOiWUz3sC1BC5Y6DESf2swiS65bkjzEnjhz/T7tcEo+UOHMvQdfUTNFCU4hyevDKB+4i263NUH9ywqczx4+9eBrTbVga03e5jN9TEQb8iHfA7ypyGUompEVPt5XI8qE2SNJWDekruoHqEUhzcq00z7cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s9/IsjCOTiTkt0pSphdZ4YBLSL+jBXL0pj09EddTBEY=; b=RX98xBk2bShfGLRhPE/6z/RzfNFauRiR7uhOcoNzfHUZVpIG18SvM/OWM/tWdzZ14NUh26flkwHtqspIYSK5XvFtofdcFxXsInzjHWwSsNQQwe84/SWY6C5jclptZk/dZpMw+mAaVjET9UiCCZQdPG0/44g7v6NtHSawtfkXiNhG7lq7EacjsI/7IHpj3Jzk+MQf40JiW5RyptUrgkYoAuk+9MkFOauukEn8RtVxCJbwrhdBAUZp64XxmUZpLcgl716eJG9uvU3uZTG1MXwOgE8T8gF4/SL7MSD+uCWg98RsDWF+smobdPmNFby+9oiSU2agO815GNUFs3+Yi8BSmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s9/IsjCOTiTkt0pSphdZ4YBLSL+jBXL0pj09EddTBEY=; b=LgRZ3aGNK1s1lGInlTPFVyMXlMpbMz9YswaZsVii6/TuBc59NqefhhiwazsXVTvUENwy9dmWG0MdmzHl9KjH7+UFddy00N5gANAr8fuKxRtOnYRCrVZvZtAumKTnGU6rfcxSNiEeHFWniyzYaupaARSkMdXgGdgZyNcP6rOpz/M= Received: from SN1PR12CA0076.namprd12.prod.outlook.com (2603:10b6:802:20::47) by BL0PR02MB4914.namprd02.prod.outlook.com (2603:10b6:208:53::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.29; Wed, 18 Nov 2020 08:06:56 +0000 Received: from SN1NAM02FT041.eop-nam02.prod.protection.outlook.com (2603:10b6:802:20:cafe::b4) by SN1PR12CA0076.outlook.office365.com (2603:10b6:802:20::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Wed, 18 Nov 2020 08:06:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT041.mail.protection.outlook.com (10.152.72.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3564.22 via Frontend Transport; Wed, 18 Nov 2020 08:06:56 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 18 Nov 2020 00:06:33 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 18 Nov 2020 00:06:33 -0800 Envelope-to: michal.simek@xilinx.com, derek.kiernan@xilinx.com, dragan.cvetic@xilinx.com, rajan.vaja@xilinx.com, tejas.patel@xilinx.com, manish.narani@xilinx.com, ravi.patel@xilinx.com, nishad.saraf@xilinx.com, wendy.liang@xilinx.com, robh+dt@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org, sumit.semwal@linaro.org, christian.koenig@amd.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Received: from [172.19.2.167] (port=35936 helo=xsjjliang50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kfIU5-0000Nk-PY; Wed, 18 Nov 2020 00:06:33 -0800 From: Wendy Liang To: , , , , , , , , , , , CC: , , , , , , "Nishad Saraf" , Wendy Liang Subject: [PATCH 7/9] misc: xilinx-ai-engine: Add support to request device management services Date: Wed, 18 Nov 2020 00:06:18 -0800 Message-ID: <1605686780-17886-8-git-send-email-wendy.liang@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605686780-17886-1-git-send-email-wendy.liang@xilinx.com> References: <1605686780-17886-1-git-send-email-wendy.liang@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e6ab063-3b1f-4bcf-ed69-08d88b98eae9 X-MS-TrafficTypeDiagnostic: BL0PR02MB4914: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E+qdUDto7Esp+Q/GLK3x5V4f7UqpqcSIjHN9ipiZSdVaCuAHoJK96/z6tC65yv23k1HBxTTdV7/tmdV2V6843TNouesbmmF9QoSxvgXOe1nJ6NFoQsuVUwKXlBo70p4jrCkLGHn44sDTAca2vit5Qil1LWHapNTj13+4oBuMC4OrfOEmWTCae6CZspev/at/Ufj36oMzNQkuOdVGcecI/5aPg2IH1gVgLg4TgTw5HhuI4BbrgMRhNYcLMCSSBtgUbCMuPyyI++pdRbWwcCV0FPF3N2l+/+E4B9J4qQPnUv6dW+WTVFc9QpGdYAxteJYbHNLjCRUR6h6B8DtgPNkFTSv4wsZn92YJA4e++/IlTSlA5fgleBaMiwBB6Fem7Bvmo8PilUtzpKJZS4sNGDSUTdZrHqf2gP2nv6nJQIbc0hmCO4DEc0EVhL+DUxEQURf4 X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(396003)(39850400004)(376002)(136003)(346002)(46966005)(5660300002)(2616005)(36756003)(6636002)(9786002)(7696005)(186003)(83380400001)(7636003)(356005)(26005)(82740400003)(336012)(82310400003)(426003)(47076004)(8936002)(4326008)(36906005)(7416002)(107886003)(316002)(921005)(478600001)(110136005)(70586007)(8676002)(70206006)(44832011)(6666004)(2906002)(54906003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2020 08:06:56.4604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e6ab063-3b1f-4bcf-ed69-08d88b98eae9 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT041.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4914 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nishad Saraf Platform management services like device control, resets, power management, etc. are provided by Platform, Loader and Manager(PLM) through firmware driver APIs. For requesting some of these services, this change reads AI Engine platform management node ID from DT node. Some other features like clearing interrupts in the NoC interconnect might only be valid for particular silicon revisions. For supporting such silicon specific features, AI Engine driver will query and store this information in device instance. While at it, this change makes EEMI operations accessible to all the other source files in the driver. Signed-off-by: Nishad Saraf Signed-off-by: Wendy Liang --- drivers/misc/xilinx-ai-engine/ai-engine-dev.c | 25 +++++++++++++++++++++- drivers/misc/xilinx-ai-engine/ai-engine-internal.h | 6 ++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/misc/xilinx-ai-engine/ai-engine-dev.c b/drivers/misc/xilinx-ai-engine/ai-engine-dev.c index 7e69ff4..78eae90 100644 --- a/drivers/misc/xilinx-ai-engine/ai-engine-dev.c +++ b/drivers/misc/xilinx-ai-engine/ai-engine-dev.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -25,7 +26,8 @@ #include "ai-engine-internal.h" -#define AIE_DEV_MAX (MINORMASK + 1) +#define AIE_DEV_MAX (MINORMASK + 1) +#define VERSAL_SILICON_REV_MASK GENMASK(31, 28) static dev_t aie_major; struct class *aie_class; @@ -318,6 +320,7 @@ static int xilinx_ai_engine_probe(struct platform_device *pdev) { struct aie_device *adev; struct device *dev; + u32 idcode, version, pm_reg[2]; int ret; adev = devm_kzalloc(&pdev->dev, sizeof(*adev), GFP_KERNEL); @@ -345,6 +348,26 @@ static int xilinx_ai_engine_probe(struct platform_device *pdev) return ret; } + /* + * AI Engine platform management node ID is required for requesting + * services from firmware driver. + */ + ret = of_property_read_u32_array(pdev->dev.of_node, "power-domains", + pm_reg, ARRAY_SIZE(pm_reg)); + if (ret < 0) { + dev_err(&pdev->dev, + "Failed to read power management information\n"); + return ret; + } + adev->pm_node_id = pm_reg[1]; + + ret = zynqmp_pm_get_chipid(&idcode, &version); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to get chip ID\n"); + return ret; + } + adev->version = FIELD_GET(VERSAL_SILICON_REV_MASK, idcode); + dev = &adev->dev; device_initialize(dev); dev->class = aie_class; diff --git a/drivers/misc/xilinx-ai-engine/ai-engine-internal.h b/drivers/misc/xilinx-ai-engine/ai-engine-internal.h index 131d22a..b21b7025 100644 --- a/drivers/misc/xilinx-ai-engine/ai-engine-internal.h +++ b/drivers/misc/xilinx-ai-engine/ai-engine-internal.h @@ -41,6 +41,10 @@ #define AIE_REGS_ATTR_PERM_MASK GENMASK(15, \ AIE_REGS_ATTR_PERM_SHIFT) +/* Silicon Engineering Sample(ES) revision ID */ +#define VERSAL_ES1_REV_ID 0x0 +#define VERSAL_ES2_REV_ID 0x1 + /** * struct aie_tile_regs - contiguous range of AI engine register * within an AI engine tile @@ -173,6 +177,7 @@ struct aie_resource { * while columns are occupied by partitions. * @num_kernel_regs: number of kernel only registers range * @version: AI engine device version + * @pm_node_id: AI Engine platform management node ID */ struct aie_device { struct list_head partitions; @@ -193,6 +198,7 @@ struct aie_device { u32 row_shift; u32 num_kernel_regs; int version; + u32 pm_node_id; }; /** -- 2.7.4