mbox series

[0/2] Sanitycheck PCI BARs

Message ID 20220725194105.4054734-1-piotr.piorkowski@intel.com (mailing list archive)
Headers show
Series Sanitycheck PCI BARs | expand

Message

Piotr Piórkowski July 25, 2022, 7:41 p.m. UTC
From: Piotr Piórkowski <piotr.piorkowski@intel.com>

When initializing the i915, we want to be sure that the PCI
BARs have been properly initialized.
As part of this series, I have prepared two patches,
one that introduces BARs names to use in code instead of numbers,
and another that adds function to validate BARs before use.
This is an evolution of the concept I presented in the patch:
https://patchwork.freedesktop.org/patch/470184/?series=99094
The main difference between the original patch and what I have
prepared here is that previously I checked all BARs at the beginning
of i915 initialization, and now I only check BAR 0 at beginning.
This is due to the fact that I have noticed that it can happen that only
BAR 0 is available (I have observed this in the case of virtualization,
on some platforms).
Therefore, at the beginning, let's verify only BAR 0, and the others only
before the first use.

Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>

Piotr Piórkowski (2):
  drm/i915: Use of BARs names instead of numbers
  drm/i915: Sanitycheck PCI BARs

 .../gpu/drm/i915/display/intel_lpe_audio.c    |  5 ++--
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c    | 11 +++++---
 drivers/gpu/drm/i915/gt/intel_ggtt.c          | 16 +++++++++---
 drivers/gpu/drm/i915/gt/intel_gt.c            |  3 ++-
 drivers/gpu/drm/i915/gt/intel_region_lmem.c   | 17 +++++++------
 drivers/gpu/drm/i915/gvt/cfg_space.c          |  4 +--
 drivers/gpu/drm/i915/i915_pci.c               | 25 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_pci.h               |  4 +++
 drivers/gpu/drm/i915/intel_pci_config.h       |  7 ++++++
 9 files changed, 73 insertions(+), 19 deletions(-)

Comments

Piotr Piórkowski July 26, 2022, 10:21 a.m. UTC | #1
Patchwork <patchwork@emeril.freedesktop.org> wrote on pon [2022-lip-25 19:45:33 +0000]:
> == Series Details ==
> 
> Series: Sanitycheck PCI BARs
> URL   : https://patchwork.freedesktop.org/series/106686/
> State : failure
> 
> == Summary ==
> 
> Error: make failed
>   CALL    scripts/checksyscalls.sh
>   CALL    scripts/atomic/check-atomics.sh
>   DESCEND objtool
>   CHK     include/generated/compile.h
>   LD [M]  drivers/gpu/drm/i915/i915.o
>   CC [M]  drivers/gpu/drm/i915/gvt/cfg_space.o
> In file included from ./drivers/gpu/drm/i915/display/intel_opregion.h:29,
>                  from ./drivers/gpu/drm/i915/i915_drv.h:50,
>                  from drivers/gpu/drm/i915/gvt/cfg_space.c:34:
> drivers/gpu/drm/i915/gvt/cfg_space.c: In function ‘intel_vgpu_init_cfg_space’:
> drivers/gpu/drm/i915/gvt/cfg_space.c:356:26: error: ‘GTTMMADR_BAR’ undeclared (first use in this function)
>    pci_resource_len(pdev, GTTMMADR_BAR);
>                           ^~~~~~~~~~~~
> ./include/linux/pci.h:1951:54: note: in definition of macro ‘pci_resource_end’
>  #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
>                                                       ^~~
> drivers/gpu/drm/i915/gvt/cfg_space.c:356:3: note: in expansion of macro ‘pci_resource_len’
>    pci_resource_len(pdev, GTTMMADR_BAR);
>    ^~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gvt/cfg_space.c:356:26: note: each undeclared identifier is reported only once for each function it appears in
>    pci_resource_len(pdev, GTTMMADR_BAR);
>                           ^~~~~~~~~~~~
> ./include/linux/pci.h:1951:54: note: in definition of macro ‘pci_resource_end’
>  #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
>                                                       ^~~
> drivers/gpu/drm/i915/gvt/cfg_space.c:356:3: note: in expansion of macro ‘pci_resource_len’
>    pci_resource_len(pdev, GTTMMADR_BAR);
>    ^~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gvt/cfg_space.c:358:26: error: ‘GTT_APERTURE_BAR’ undeclared (first use in this function); did you mean ‘GVT_PORT_MAX’?
>    pci_resource_len(pdev, GTT_APERTURE_BAR);
>                           ^~~~~~~~~~~~~~~~
> ./include/linux/pci.h:1951:54: note: in definition of macro ‘pci_resource_end’
>  #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
>                                                       ^~~
> drivers/gpu/drm/i915/gvt/cfg_space.c:358:3: note: in expansion of macro ‘pci_resource_len’
>    pci_resource_len(pdev, GTT_APERTURE_BAR);
>    ^~~~~~~~~~~~~~~~

ohhh... I test it with disabled DRM_I915_GVT and I forgot to add one header:

diff --git a/drivers/gpu/drm/i915/gvt/cfg_space.c b/drivers/gpu/drm/i915/gvt/cfg_space.c
index c22d3a388aa5..eef3bba8a41b 100644
--- a/drivers/gpu/drm/i915/gvt/cfg_space.c
+++ b/drivers/gpu/drm/i915/gvt/cfg_space.c
@@ -33,6 +33,7 @@
 
 #include "i915_drv.h"
 #include "gvt.h"
+#include "intel_pci_config.h"
 
 enum {
        INTEL_GVT_PCI_BAR_GTTMMIO = 0,


I will send the corrected series in the next version

Thanks
Piotr
> scripts/Makefile.build:249: recipe for target 'drivers/gpu/drm/i915/gvt/cfg_space.o' failed
> make[4]: *** [drivers/gpu/drm/i915/gvt/cfg_space.o] Error 1
> scripts/Makefile.build:466: recipe for target 'drivers/gpu/drm/i915' failed
> make[3]: *** [drivers/gpu/drm/i915] Error 2
> scripts/Makefile.build:466: recipe for target 'drivers/gpu/drm' failed
> make[2]: *** [drivers/gpu/drm] Error 2
> scripts/Makefile.build:466: recipe for target 'drivers/gpu' failed
> make[1]: *** [drivers/gpu] Error 2
> Makefile:1843: recipe for target 'drivers' failed
> make: *** [drivers] Error 2
> 
> 

--