From patchwork Mon Sep 9 20:43:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 13797575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 297E1ECE587 for ; Mon, 9 Sep 2024 20:43:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B73C010E6A8; Mon, 9 Sep 2024 20:43:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="NgfnMsvx"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F85F10E6AA for ; Mon, 9 Sep 2024 20:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725914636; x=1757450636; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=43UIbCv9GMYgdvsbZKe04stCqmSJ97+aZo8OBnJBNJ0=; b=NgfnMsvxVtj6yt2VlEXfRTFu/9+KVv5SVLq5EhKuz8OktQlxzLhuXIie t09rt+Z4RRCBvfIOOqz9JQRaD0jvxtSx0xi+E4is84SHUrBeSlIWYqdg0 ev9jm0/jD+Ve2RcjJTU5K8PvKUCm0e7dUYmrdvmy1SiB2MKkdLuB79043 ZIqrrljkNQUQKlhhh9L9sZ77q6a7dCJ3fFatjHVRn9r9pWF3MRA+HMWzM GCyC1Hupg8QCWobMqC0dcHOou3kWDBJsDXJkqx25P4kurAnE6bOfoV5GB v4Utk8Xe+2j98+A7l9f3ygRxtsmfXvLY8HvdvvKj0VadMkbqMNxXooUXa g==; X-CSE-ConnectionGUID: zbI4PW05SmWOLnq8rCo27w== X-CSE-MsgGUID: 4r2+DQJOTCSRp+eacQnmkg== X-IronPort-AV: E=McAfee;i="6700,10204,11190"; a="24451319" X-IronPort-AV: E=Sophos;i="6.10,215,1719903600"; d="scan'208";a="24451319" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 13:43:56 -0700 X-CSE-ConnectionGUID: 8LIOopCMTLyG4p8Pylj0Ug== X-CSE-MsgGUID: bQj+c9ybSbCNhu29crfz3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,215,1719903600"; d="scan'208";a="71578747" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.196]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 13:43:57 -0700 From: Lucas De Marchi To: intel-gfx@lists.freedesktop.org Cc: Lucas De Marchi , Ashutosh Dixit Subject: [CI 1/2] drm/i915/pmu: Drop is_igp() Date: Mon, 9 Sep 2024 13:43:39 -0700 Message-ID: <20240909204340.3646458-1-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" There's no reason to hardcode checking for integrated graphics on a specific pci slot. That information is already available per platform an can be checked with IS_DGFX(). Reviewed-by: Ashutosh Dixit Signed-off-by: Lucas De Marchi --- drivers/gpu/drm/i915/i915_pmu.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 21eb0c5b320d5..34d798245fac9 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -1232,17 +1232,6 @@ static void i915_pmu_unregister_cpuhp_state(struct i915_pmu *pmu) cpuhp_state_remove_instance(cpuhp_slot, &pmu->cpuhp.node); } -static bool is_igp(struct drm_i915_private *i915) -{ - struct pci_dev *pdev = to_pci_dev(i915->drm.dev); - - /* IGP is 0000:00:02.0 */ - return pci_domain_nr(pdev->bus) == 0 && - pdev->bus->number == 0 && - PCI_SLOT(pdev->devfn) == 2 && - PCI_FUNC(pdev->devfn) == 0; -} - void i915_pmu_register(struct drm_i915_private *i915) { struct i915_pmu *pmu = &i915->pmu; @@ -1266,7 +1255,7 @@ void i915_pmu_register(struct drm_i915_private *i915) pmu->cpuhp.cpu = -1; init_rc6(pmu); - if (!is_igp(i915)) { + if (IS_DGFX(i915)) { pmu->name = kasprintf(GFP_KERNEL, "i915_%s", dev_name(i915->drm.dev)); @@ -1318,7 +1307,7 @@ void i915_pmu_register(struct drm_i915_private *i915) pmu->base.event_init = NULL; free_event_attributes(pmu); err_name: - if (!is_igp(i915)) + if (IS_DGFX(i915)) kfree(pmu->name); err: drm_notice(&i915->drm, "Failed to register PMU!\n"); @@ -1346,7 +1335,7 @@ void i915_pmu_unregister(struct drm_i915_private *i915) perf_pmu_unregister(&pmu->base); pmu->base.event_init = NULL; kfree(pmu->base.attr_groups); - if (!is_igp(i915)) + if (IS_DGFX(i915)) kfree(pmu->name); free_event_attributes(pmu); } From patchwork Mon Sep 9 20:43:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 13797576 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56F62ECE589 for ; Mon, 9 Sep 2024 20:43:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D2F9110E6AA; Mon, 9 Sep 2024 20:43:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mKGLSUL/"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61AC210E6A8 for ; Mon, 9 Sep 2024 20:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725914636; x=1757450636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JuFE7ZRDXMZ9lUpDeHGiw9jIwTYVBoJgpr0njb6cFiU=; b=mKGLSUL//CF60+pVNTgQXKmbfsB52VU5CjfVfVrhpBOq4qwv7esKmAZV t1UJXHuawSlyglBXvBiaxOmeGVTKDv1ifvMJnHXpjNSlOHOUA8ncpDpmH kQ2XN+jelxKzeqImh6l7m7bSWJT6wL+cqqZu5J+fIEC/w8+tppdR2Olru 2CcKZ+J3mFMWbQynpKHvBKsjC557en7brFEtQDacgMb9VBshxksC/OG// ty9AzBY5lzb4IyyLcrLltlYXBwlSJIrSvgIT0OR7GvktWN7Ml8Aj2r7hl faf/D+2YppEVnrTXYB1BaCmV6Wdaa+2Hg9Trz7GZ5heSfBoCrq8Z55A+C w==; X-CSE-ConnectionGUID: q/U9OLXdTWiFOLX7xwidDw== X-CSE-MsgGUID: DMTlnCwgTgyjjWPy7V/tfA== X-IronPort-AV: E=McAfee;i="6700,10204,11190"; a="24451320" X-IronPort-AV: E=Sophos;i="6.10,215,1719903600"; d="scan'208";a="24451320" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 13:43:56 -0700 X-CSE-ConnectionGUID: Wuz/JrbYTSWjF8pBi4IMEw== X-CSE-MsgGUID: r2MDCemyRXW9LjWwUVER9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,215,1719903600"; d="scan'208";a="71578750" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.196]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 13:43:57 -0700 From: Lucas De Marchi To: intel-gfx@lists.freedesktop.org Cc: Lucas De Marchi , Ashutosh Dixit Subject: [CI 2/2] drm/i915/pmu: Use event_to_pmu() Date: Mon, 9 Sep 2024 13:43:40 -0700 Message-ID: <20240909204340.3646458-2-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240909204340.3646458-1-lucas.demarchi@intel.com> References: <20240909204340.3646458-1-lucas.demarchi@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" i915 pointer is not needed in this function and all the others simply calculate the i915_pmu container based on the event->pmu. Follow the same logic as in other functions. Reviewed-by: Ashutosh Dixit Signed-off-by: Lucas De Marchi --- drivers/gpu/drm/i915/i915_pmu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 34d798245fac9..67b6cbdeff1da 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -834,15 +834,14 @@ static void i915_pmu_event_start(struct perf_event *event, int flags) static void i915_pmu_event_stop(struct perf_event *event, int flags) { - struct drm_i915_private *i915 = - container_of(event->pmu, typeof(*i915), pmu.base); - struct i915_pmu *pmu = &i915->pmu; + struct i915_pmu *pmu = event_to_pmu(event); if (pmu->closed) goto out; if (flags & PERF_EF_UPDATE) i915_pmu_event_read(event); + i915_pmu_disable(event); out: