Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1335946ybg; Tue, 2 Jun 2020 07:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVi7NGlUhfNeUBy83+VRxW9la2yHZ9zTHC86Np4CCrYu+QJj0RtdYNhmaq8e47Sl3AsKPR X-Received: by 2002:a17:906:3590:: with SMTP id o16mr17814666ejb.506.1591107820146; Tue, 02 Jun 2020 07:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591107820; cv=none; d=google.com; s=arc-20160816; b=u47S71qWnopT2z8bXd2mp2nPxODJ3SzqPHz9zzIanaLFoWB38s/QEiT23VPS4vx9I3 F4dOPpHw60Ut/fZBtyBn7fxHMpVbAu/WV44s76H04vrBBBnN2n2qc5FShIcSpL7Gu5Ny UAkkjaOR0qFWBePDIfMqGvfSkKBQU5KJzTPqK1Bcny4roJqsWDcYBBnMvCfQv7OTSP41 wYeUZpmHsj0XV7UsII7gJXX3AslxEy9Aw54AF+PAC6UnPePXHULl6cubEcRZ9XGP47Al vKJuzsHe6IfVyBQuF0VyqkQ6h/qodArIOHVyiPUC58KmlxlgihgXG252L7Fe7rUQFK7l H1xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=4GBFKi4AE0Zui6AvlkZAGUYSPOB17V3NVuaNVtHxfg8=; b=w69yBX6RmyHAR2tmm/Xsr4hAK/I3P2eijJoPF+ZrS9yYc34cYNdyf1hZcDKbRZ1Qef XA1kWRpfkASrH3I+B+m0zqEFfoqYcIsFLVAACUUvFIiAcHE8tHFej2pvzmaGJDr6ChD1 C0P+XRxBNFrP5DnNrCEHjmB6RRTL3X9nDlfiW2Rc8rRJ92fr7yd9p/0647ihci0JRxGm 3nFiuYHZtnlya4yc62y5x+CWU9uPhd/ekB77oZk6WE6UNHOpb9o5HmzlcDYp+H+pD83o vnehUsMp4IefVUlxS74GZdcl9Z5YdLqi3nTw7Sx8flJGeWEFKe9DMDuMIFsDY71uhwwA WcUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iDu5SHMR; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si1475088ejr.300.2020.06.02.07.23.17; Tue, 02 Jun 2020 07:23:40 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=iDu5SHMR; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbgFBOV0 (ORCPT + 99 others); Tue, 2 Jun 2020 10:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbgFBOV0 (ORCPT ); Tue, 2 Jun 2020 10:21:26 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DCE0C08C5C0 for ; Tue, 2 Jun 2020 07:21:25 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id v19so3129407wmj.0 for ; Tue, 02 Jun 2020 07:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=4GBFKi4AE0Zui6AvlkZAGUYSPOB17V3NVuaNVtHxfg8=; b=iDu5SHMRXV9p8WONfSFl2dlTGUryo+ZFiH/JA8c+BGpC0QU91UUvpFSqaIUDjwglhJ +yHCvrxwjM2SKBwJwKYa1GbRuovooFIfzoTCF1yl2ITib0CXGS1Wo55BhIedjUGxf4vx RG3eMkMSlDO2j3hjTVY5//OWrK6qpsshclWS/Qv5yLsvOaeSolKJbGUB+khoj/r74KkQ I2vw01NGl+huCDwhWUg0CQZssrqjSa/WN+ITveeRJgNZRro0WURSoglT5zeA200cars1 PrtMq6YXBy9H/+RDUKJTr9cn+1Nbv3AFR3KzoMoRCs+U2F21+pZUjx6mwCqDr0z0eaar KyUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=4GBFKi4AE0Zui6AvlkZAGUYSPOB17V3NVuaNVtHxfg8=; b=lYRgLVLbPPz2UK9LkMHOgCnvebB/5hLOgiWExrgzvCbGf87ortuSNmRoMKBMzAS7Du /84xwEKMXtPBmEmkoo245julgSuvEiWb3CAW/USAViJEDw4x2I8HN4YVGiO/kn2PFVbf 3ctfNiJSVmsi0UqvM7GdPzF6NAuQLqGpDlUkpAP6JTdL3jmqduo9z5FdHz2scbdwHKAQ KEN5I+DB1A/NRCtGLF+OqXvWlLPE7VF1fsFUCrshQ6/aN4XkaTSQCz6wMNon2XSLg6A5 aFmCxcFRzRpwYdIDDd3F9iROBpcaOr1qlwLw/Vv8GvRaeb2xJVZiY+XIysbZQuNFeE36 bWnQ== X-Gm-Message-State: AOAM532w4LiXQaDGMAgDmRtGQoep4YoRHk6nnI76LTyroon/xzSk7VAZ uJ5f6N7jqVR49kpCTEUQK0gxMbiiapeo1W1/crU= X-Received: by 2002:a05:600c:2201:: with SMTP id z1mr4316621wml.70.1591107684025; Tue, 02 Jun 2020 07:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20200602092030.31966-1-piotr.stankiewicz@intel.com> <14063C7AD467DE4B82DEDB5C278E8663010E23E538@FMSMSX108.amr.corp.intel.com> In-Reply-To: From: Alex Deucher Date: Tue, 2 Jun 2020 10:21:12 -0400 Message-ID: Subject: Re: [PATCH 07/15] drm/amdgpu: use PCI_IRQ_MSI_TYPES where appropriate To: Andy Shevchenko Cc: "Ruhl, Michael J" , David Airlie , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Stankiewicz, Piotr" , "amd-gfx@lists.freedesktop.org" , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 2, 2020 at 10:00 AM Andy Shevchenko wrote: > > On Tue, Jun 2, 2020 at 4:38 PM Ruhl, Michael J = wrote: > > >-----Original Message----- > > >From: dri-devel On Behalf Of > > >Piotr Stankiewicz > > >Sent: Tuesday, June 2, 2020 5:21 AM > > >To: Alex Deucher ; Christian K=C3=B6nig > > >; David Zhou ; David > > >Airlie ; Daniel Vetter > > >Cc: Stankiewicz, Piotr ; dri- > > >devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux- > > >kernel@vger.kernel.org > > >Subject: [PATCH 07/15] drm/amdgpu: use PCI_IRQ_MSI_TYPES where > > >appropriate > > ... > > > > int nvec =3D pci_msix_vec_count(adev->pdev); > > > unsigned int flags; > > > > > >- if (nvec <=3D 0) { > > >+ if (nvec > 0) > > >+ flags =3D PCI_IRQ_MSI_TYPES; > > >+ else > > > flags =3D PCI_IRQ_MSI; > > >- } else { > > >- flags =3D PCI_IRQ_MSI | PCI_IRQ_MSIX; > > >- } > > > > Minor nit: > > > > Is it really necessary to set do this check? Can flags just > > be set? > > > > I.e.: > > flags =3D PCI_IRQ_MSI_TYPES; > > > > pci_alloc_irq_vector() tries stuff in order. If MSIX is not available, > > it will try MSI. > > That's also what I proposed earlier. But I suggested as well to wait > for AMD people to confirm that neither pci_msix_vec_count() nor flags > is needed and we can directly supply MSI_TYPES to the below call. > I think it was leftover from debugging and just to be careful. We had some issues when we originally enabled MSI-X on certain boards. The fix was to just allocate a single vector (since that is all we use anyway) and we were using the wrong irq (pdev->irq vs pci_irq_vector(pdev, 0)). For reference, the original patch to add MSI-X: commit bd660f4f111161f60392dd02424c3a3d2240dc2f Author: shaoyunl Date: Tue Oct 1 15:52:31 2019 -0400 drm/amdgpu : enable msix for amdgpu driver We might used out of the msi resources in some cloud project which have a lot gpu devices(including PF and VF), msix can provide enough resources from system level view Signed-off-by: shaoyunl Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher And the fix: commit 8a745c7ff2ddb8511ef760b4d9cb4cf56a15fc8d Author: Alex Deucher Date: Thu Oct 3 10:34:30 2019 -0500 drm/amdgpu: improve MSI-X handling (v3) Check the number of supported vectors and fall back to MSI if we return or error or 0 MSI-X vectors. v2: only allocate one vector. We can't currently use more than one anyway. v3: install the irq on vector 0. Tested-by: Tom St Denis Reviewed-by: Shaoyun liu Signed-off-by: Alex Deucher Alex