Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5993607rwp; Mon, 17 Jul 2023 12:59:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlEI4k2IfJgrZ3uU+efc37pxwtEItNCx4fc4rCnFE9oE6unzM4wWzz9ovPmvz3X+H6hkpc8q X-Received: by 2002:aa7:d1d9:0:b0:51e:1bf3:f4ac with SMTP id g25-20020aa7d1d9000000b0051e1bf3f4acmr11029622edp.27.1689623944921; Mon, 17 Jul 2023 12:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689623944; cv=none; d=google.com; s=arc-20160816; b=z9VeoZKpdqy5pIMiWoRWbsT8kH5pP6iIjQpm1i43LzYvY4tTpI6T0fOoDVI5+PqkYz GMXX+6n3A2YwofxTp/wN3c84t9ichoLzOcXLlVWRMcnPkRk5uQIjnZOozL2K6E5bk/NG e26aWqq7GfT/5h0+ntJWQDUVnGHfE3icOS7vwD0OOiGFgy3C4hfqCZGPeyotz/55un0z PQiDnucLLdYppgDXx32IUBLLo8+YRseN2dTxk1jyONgg1hPzXqebEw88vk1xqzn2E1kG EwVp5f1DU3QEuawbWRGbzo84qgC8YrwZ4d4fMd9wAZKBhq2mQ5Yg+xXeQ9L6JC0RT9Zd NbaA== 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=1t688MEC9y/XlIThwEs+L6CYJEKpsH2ABOJ08GM6hyM=; fh=R4ZvNZWGg6IlKgk5n1zDvyneOEgr4zAUEpOHZQoDJ/M=; b=kY8pXataJQIgp5ykDXJIqGRUPivt1XECkkN9xR6MSDdcMve2YGOKNHdPmwLbH2/eQp vdVsAbK/S+Q/57+/4dIuPB4RtnFLQGHvO33FIbpcHp1LZSyaoFPLGB8JA9RspOE52H/q +goiWuF6FION0Pn50VmOSxKqeZmw8AGeKsVQ+wHpTUuidBi5Xl4lY1c07pt0dZ5k6mcs sr24/tTOfGirMlEZN1PLtr3mhjymRrWmt7jh+0UYicfpcrAb2Ifd+/Dk72yAYZZHCnGn R6mw5XMVJrBszE0qDWTceiN8EE+KGkbFzBVFoam79dyzGmzwMkFzPAje/B7aTFo8gA+U R7aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JhQ3cDb4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a056402516700b0051dd4e2847csi52957ede.660.2023.07.17.12.58.40; Mon, 17 Jul 2023 12:59:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JhQ3cDb4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbjGQTzP (ORCPT + 99 others); Mon, 17 Jul 2023 15:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbjGQTzH (ORCPT ); Mon, 17 Jul 2023 15:55:07 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83AA5134; Mon, 17 Jul 2023 12:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689623698; x=1721159698; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8SCVtq0jwJnIgDEqSUfdMECCxn6Y1V/lCZdkQvBUQFQ=; b=JhQ3cDb4CepQ1TI6LNZVwwll9qkPsUNy+OlEFYn6wQckhmJs6MPi7+wA Muw+nXNfwnZGIcoqsqrUGjNH3wi5ienB4gbaEYuLkX7jlZotsW64QDg9/ NIQ9y7h711I7upAa+4pUGfJhJHdIDgQ3K98A98BNcYYR5tjuD2jhiNtde 9u7zjnfWrbXiwwsBtl4uFp8ZtB/PGA+CcLgjORD0UHGMNwAsfPU4tozkw 5RIoHAqO/BVMvvl4zEmV4BaXbeJLfqR+/ydFrjhilT4mv7atCpcyrpjjU g2a5crmasFpNs+96R9j8OL4X2/mGoCgQjBvJmsCT81MOMu0OvlK40AC5h Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366064615" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366064615" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 12:54:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="788770763" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="788770763" Received: from spandruv-desk.jf.intel.com ([10.54.75.8]) by fmsmga008.fm.intel.com with ESMTP; 17 Jul 2023 12:54:55 -0700 From: Srinivas Pandruvada To: daniel.lezcano@linaro.org, rafael@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 6/7] thermal/drivers/int340x: Support workload hint interrupts Date: Mon, 17 Jul 2023 12:54:04 -0700 Message-Id: <20230717195405.730869-7-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230717195405.730869-1-srinivas.pandruvada@linux.intel.com> References: <20230717195405.730869-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On thermal device interrupt, if the interrupt is generated for passing workload hint, call the callback to pass notification to the user space. First call proc_thermal_check_wlt_intr() to check interrupt, if this callback returns true, wake IRQ thread. Call proc_thermal_wlt_intr_callback() to notify user space. While here remove function pkg_thermal_schedule_work() and move the processing to the caller. The function pkg_thermal_schedule_work() just called schedule_delayed_work(). Signed-off-by: Srinivas Pandruvada --- v2: No change .../processor_thermal_device_pci.c | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index ee5a4c227d96..83177ed9db49 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -115,27 +115,40 @@ static void proc_thermal_threshold_work_fn(struct work_struct *work) proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 1); } -static void pkg_thermal_schedule_work(struct delayed_work *work) +static irqreturn_t proc_thermal_irq_thread_handler(int irq, void *devid) { - unsigned long ms = msecs_to_jiffies(notify_delay_ms); + struct proc_thermal_pci *pci_info = devid; + + proc_thermal_wlt_intr_callback(pci_info->pdev, pci_info->proc_priv); - schedule_delayed_work(work, ms); + return IRQ_HANDLED; } static irqreturn_t proc_thermal_irq_handler(int irq, void *devid) { struct proc_thermal_pci *pci_info = devid; + struct proc_thermal_device *proc_priv; + int ret = IRQ_HANDLED; u32 status; + proc_priv = pci_info->proc_priv; + + if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_WLT_HINT) { + if (proc_thermal_check_wlt_intr(pci_info->proc_priv)) + ret = IRQ_WAKE_THREAD; + } + proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_INT_STATUS_0, &status); + if (status) { + unsigned long ms = msecs_to_jiffies(notify_delay_ms); - /* Disable enable interrupt flag */ - proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0); + /* Disable enable interrupt flag */ + proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0); + schedule_delayed_work(&pci_info->work, ms); + } pci_write_config_byte(pci_info->pdev, 0xdc, 0x01); - pkg_thermal_schedule_work(&pci_info->work); - - return IRQ_HANDLED; + return ret; } static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) @@ -269,7 +282,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ } ret = devm_request_threaded_irq(&pdev->dev, irq, - proc_thermal_irq_handler, NULL, + proc_thermal_irq_handler, proc_thermal_irq_thread_handler, irq_flag, KBUILD_MODNAME, pci_info); if (ret) { dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq); @@ -383,6 +396,8 @@ static struct pci_driver proc_thermal_pci_driver = { module_pci_driver(proc_thermal_pci_driver); +MODULE_IMPORT_NS(INT340X_THERMAL); + MODULE_AUTHOR("Srinivas Pandruvada "); MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver"); MODULE_LICENSE("GPL v2"); -- 2.38.1