Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp827208pxb; Thu, 17 Feb 2022 15:57:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1o1qV/Dqlx+1KT+lHIok7dJmg9eSROc90UiYgpAQn/btptSLG+uovObFfY3UQajuqbKl3 X-Received: by 2002:a17:90a:8046:b0:1b9:c7aa:fd66 with SMTP id e6-20020a17090a804600b001b9c7aafd66mr5537629pjw.82.1645142252136; Thu, 17 Feb 2022 15:57:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645142252; cv=none; d=google.com; s=arc-20160816; b=0fKjyLOrot0aVjTmgxj0EJrkOZ3Xm/HpWakgZT9XMR8OZRSUvDZ31VgfoghWXnsOaa GV7AGspnLmjApeGdnKqfotQWs8in9wQ155uRXE4yEJf7p0EDxOdoAXgd3dNyoauWIYfJ BfC3Xw7sD5FP3J/wCmJqN3YCIq2jyWl3eZat5xWeYNvjpaC5nkImSlDvVJQak+Mz7ke0 KQBo0pxfCsbG2iyHaKqMr7XuN7y0uRQ9t9shd9clPdEzTOi7vtIXFBfPT0TbfD+qj5SX tnZ1oCXGLHVSxJwPFHMnoKDYvVvzPRDxAk7PKooBcgeLTT/BDSRLo7aqWnfFbd6ICkl5 uqsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=jzi8R+nhf5rjLGHC3osyYipK+JLzcp7/3wSyGRoIYz8=; b=WCc0bzJCufqNxUzmwKbf9ryDcjNsArq1HK98WWV5BCpSOBaz2kWOkJ3WWJWoD0HTWl qPHdVXT+wm0YC3SMuaxlAKlFevaapvfwaKpaUQ2A2xc5I3YNd9Ij5FQKirJgoZuPFLPW KaYa39AmJcmXvi5E2xX2I6x+i7cEzACVxcM6O1EA/FhTmQZyzNtsWtW9V2KbLVg9NtPx Fu8yeulRdb0VmN3SWrYSpXEBhdFLekuTV5bkgFjV5/yscN8LvXAeCjfd790FQFjanYrU BZ70vjWWkKw5CPUTBPBlKqJPZzLWfBnOEe03KqX70xe8Wn/HGMCmlxZmYsHMmSUyzUve TYew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IsDG4rks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d70si9684535pgc.111.2022.02.17.15.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:57:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IsDG4rks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E461313227; Thu, 17 Feb 2022 15:27:30 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238621AbiBQJ0p (ORCPT + 99 others); Thu, 17 Feb 2022 04:26:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbiBQJ0l (ORCPT ); Thu, 17 Feb 2022 04:26:41 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF89634B for ; Thu, 17 Feb 2022 01:26:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645089985; x=1676625985; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=qceDIk6fShH4bjNsZhrpzgHMTaQ402bs+RNbTC98hLY=; b=IsDG4rksOPesQQdONd+qxESO+ZNYA5E87j8fQziVcq/cfh3PRNUif1V5 HoTH7u5Kcz+RZ6/RcvskYuhc+YDXrq0+0QKODAT21q+amGnsrtrpmInv1 OwgCEs1esZIjdRc6CJxgv7woatkq3YdLvAoNMqM64o1gYgBx2sjgb/bal uIF/hPQzTbiiKIeHuHddug63oSffCjRDOnqi3SSNmb5UpG8/32stXT70b rQNDsGhIMPtvNL2y0vOrH5U07DrMzfIQm6Ne2QcsS5YTfE83WsmplraZD bYv4gGwuchnsnbQtYmo3EcxEzlkXPjs8Ha4XVQ6IgUzXVY7QhUxUxPflw Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10260"; a="314103057" X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="314103057" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 01:26:24 -0800 X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="530070662" Received: from markorti-mobl.ger.corp.intel.com (HELO [10.213.216.21]) ([10.213.216.21]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 01:26:21 -0800 Message-ID: <9910e85e-334d-7ceb-f7f2-6fc25eaacf1e@linux.intel.com> Date: Thu, 17 Feb 2022 09:26:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [Intel-gfx] [PATCH v7 1/5] drm/i915/gsc: add gsc as a mei auxiliary device Content-Language: en-US To: "Usyskin, Alexander" , Greg Kroah-Hartman , Jani Nikula , Joonas Lahtinen , "Vivi, Rodrigo" , David Airlie , Daniel Vetter Cc: "linux-kernel@vger.kernel.org" , "Winkler, Tomas" , "Lubart, Vitaly" , "intel-gfx@lists.freedesktop.org" References: <20220213103215.2440248-1-alexander.usyskin@intel.com> <20220213103215.2440248-2-alexander.usyskin@intel.com> <7ed77377-1e6e-4329-1fda-87854f9bb938@linux.intel.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 16/02/2022 17:14, Usyskin, Alexander wrote: > > >> -----Original Message----- >> From: Tvrtko Ursulin >> Sent: Wednesday, February 16, 2022 14:04 >> To: Usyskin, Alexander ; Greg Kroah- >> Hartman ; Jani Nikula >> ; Joonas Lahtinen >> ; Vivi, Rodrigo ; >> David Airlie ; Daniel Vetter >> Cc: linux-kernel@vger.kernel.org; Winkler, Tomas >> ; Lubart, Vitaly ; intel- >> gfx@lists.freedesktop.org >> Subject: Re: [Intel-gfx] [PATCH v7 1/5] drm/i915/gsc: add gsc as a mei >> auxiliary device >> >> >> >> On 15/02/2022 15:22, Usyskin, Alexander wrote: >> >>>>> +{ >>>>> + irq_set_chip_and_handler_name(irq, &gsc_irq_chip, >>>>> + handle_simple_irq, "gsc_irq_handler"); >>>>> + >>>>> + return irq_set_chip_data(irq, dev_priv); >>>> >>>> I am not familiar with this interrupt scheme - does dev_priv get used at >>>> all by handle_simple_irq, or anyone, after being set here? >> >> What about this? Is dev_priv required or you could pass in NULL just as >> well? >> > > It is not used, will remove > >>>> >>>>> +} >>>>> + >>>>> +struct intel_gsc_def { >>>>> + const char *name; >>>>> + const unsigned long bar; >>>> >>>> Unusual, why const out of curiosity? And is it "bar" or "base" would be >>>> more accurate? >>>> >>> Some leftover, thanks for spotting this! >>> It is a base of bar. I prefer bar name here. But not really matter. >> >> Is it? >> >> + adev->bar.start = def->bar + pdev->resource[0].start; >> >> Looks like offset on top of BAR, no? >> > > Offset on top of DG bar; but start of HECI1/2 bar too. Ok. :) >>>>> +{ >>>>> + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); >>>>> + struct mei_aux_device *adev; >>>>> + struct auxiliary_device *aux_dev; >>>>> + const struct intel_gsc_def *def; >>>>> + int ret; >>>>> + >>>>> + intf->irq = -1; >>>>> + intf->id = intf_id; >>>>> + >>>>> + if (intf_id == 0 && !HAS_HECI_PXP(dev_priv)) >>>>> + return; >>>> >>>> Isn't inf_id == 0 always a bug with this patch, regardless of >>>> HAS_HECI_PXP, since the support is incomplete in this patch? If so I'd >>>> be more comfortable with a plain drm_WARN_ON_ONCE(intf_id == 0). >>>> >>> There will be patches for other cards that have pxp as soon as this is >> reviewed. >>> It is better to have infra prepared for two heads. >> >> My point is things are half-prepared since you don't have the id 0 in >> the array, regardless of the HAS_HECI_PXP. Yes it can't be true now, but >> if you add a patch which enables it to be true, you have to modify the >> array at the same time or risk a broken patch in the middle. >> >> I don't see the point of the condition making it sound like there are >> two criteria to enter below, while in fact there is only one in current >> code, and that it that it must not be entered because array is incomplete! >> > > We initialize both cells in gsc->intf array, the first one with defaults (two lines before this line) > for systems without working PXP, like DG1. > The code on GSC level does not know that we don't have PXP and don't want to know. By defaults you mean "-1" ? My point is intel_gsc_def_dg1[] does not contain anything valid for interface zero. If you change HAS_HECI_PXP to return true, the code below does: def = &intel_gsc_def_dg1[intf_id]; And points to template data not populated. So you have to change two in conjuction. Hence safest code for this patch would simply be: if (intf_id == 0) { drm_WARN_ON_ONCE(, "Code not implemented yet!\n"); return; } When you add entries to intel_gsc_def_dg1[] in a later series/patch, then you simply remove the above lines altogether. > >>>>> + >>>>> + if (!HAS_HECI_GSC(gt->i915)) >>>>> + return; >>>> >>>> Likewise? >>>> >>>>> + >>>>> + if (gt->gsc.intf[intf_id].irq <= 0) { >>>>> + DRM_ERROR_RATELIMITED("error handling GSC irq: irq not >>>> set"); >>>> >>>> Like this, but use logging functions which say which device please. >>>> >>> drm_err_ratelimited fits here? >> >> AFAICT it would be a programming bug and not something that can happen >> at runtime hence drm_warn_on_once sounds correct for both. >> > > Sure, will do > >>>>> } >>>>> @@ -182,6 +185,8 @@ void gen11_gt_irq_reset(struct intel_gt *gt) >>>>> /* Disable RCS, BCS, VCS and VECS class engines. */ >>>>> intel_uncore_write(uncore, GEN11_RENDER_COPY_INTR_ENABLE, >>>> 0); >>>>> intel_uncore_write(uncore, GEN11_VCS_VECS_INTR_ENABLE, 0); >>>>> + if (HAS_HECI_GSC(gt->i915)) >>>>> + intel_uncore_write(uncore, >>>> GEN11_GUNIT_CSME_INTR_ENABLE, 0); >>>>> >>>>> /* Restore masks irqs on RCS, BCS, VCS and VECS engines. */ >>>>> intel_uncore_write(uncore, GEN11_RCS0_RSVD_INTR_MASK, ~0); >>>>> @@ -195,6 +200,8 @@ void gen11_gt_irq_reset(struct intel_gt *gt) >>>>> intel_uncore_write(uncore, GEN11_VECS0_VECS1_INTR_MASK, >>>> ~0); >>>>> if (HAS_ENGINE(gt, VECS2) || HAS_ENGINE(gt, VECS3)) >>>>> intel_uncore_write(uncore, >>>> GEN12_VECS2_VECS3_INTR_MASK, ~0); >>>>> + if (HAS_HECI_GSC(gt->i915)) >>>>> + intel_uncore_write(uncore, >>>> GEN11_GUNIT_CSME_INTR_MASK, ~0); >>>>> >>>>> intel_uncore_write(uncore, >>>> GEN11_GPM_WGBOXPERF_INTR_ENABLE, 0); >>>>> intel_uncore_write(uncore, >>>> GEN11_GPM_WGBOXPERF_INTR_MASK, ~0); >>>>> @@ -209,6 +216,7 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt) >>>>> { >>>>> struct intel_uncore *uncore = gt->uncore; >>>>> u32 irqs = GT_RENDER_USER_INTERRUPT; >>>>> + const u32 gsc_mask = GSC_IRQ_INTF(0) | GSC_IRQ_INTF(1); >>>> >>>> Why enable the one which is not supported by the patch? No harm doing >> it? >>>> >>> No harm and the next patch will be soon, this patch unfortunately is long >> overdue. >> >> Just feels a bit lazy. You are adding two feature test macros to >> prepare, so why not use them. >> > > I've been told that better to enable them both from the HW perspective, > the real interrupt enable magic happens in GSC FW, not here. Well whatever.. As long as logging of spurious/unexpected interrupts is in place I can live with that. Regards, Tvrtko