Skip to content

Commit

Permalink
accel/ivpu: Use generation based function and registers names
Browse files Browse the repository at this point in the history
Given that VPU generation can be used by multiple platforms, driver should
use VPU IP generation names instead of a platform.

Change naming for functions and registries.

Use 37XX format, where:
  3 - major VPU IP generation version
  7 - minor VPU IP generation version
  XX - postfix indicating this is an architecture and not marketing name

Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230731161258.2987564-3-stanislaw.gruszka@linux.intel.com
  • Loading branch information
Jacek Lawrynowicz authored and Stanislaw Gruszka committed Aug 9, 2023
1 parent 864a00b commit 51d66a7
Showing 6 changed files with 492 additions and 484 deletions.
6 changes: 3 additions & 3 deletions drivers/accel/ivpu/ivpu_drv.c
Original file line number Diff line number Diff line change
@@ -443,8 +443,8 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
/* Clear any pending errors */
pcie_capability_clear_word(pdev, PCI_EXP_DEVSTA, 0x3f);

/* VPU MTL does not require PCI spec 10m D3hot delay */
if (ivpu_is_mtl(vdev))
/* VPU 37XX does not require 10m D3hot delay */
if (ivpu_hw_gen(vdev) == IVPU_HW_37XX)
pdev->d3hot_delay = 0;

ret = pcim_enable_device(pdev);
@@ -482,7 +482,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
if (!vdev->pm)
return -ENOMEM;

vdev->hw->ops = &ivpu_hw_mtl_ops;
vdev->hw->ops = &ivpu_hw_37xx_ops;
vdev->hw->dma_bits = 38;

vdev->platform = IVPU_PLATFORM_INVALID;
18 changes: 13 additions & 5 deletions drivers/accel/ivpu/ivpu_drv.h
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@

#define PCI_DEVICE_ID_MTL 0x7d1d

#define IVPU_HW_37XX 37

#define IVPU_GLOBAL_CONTEXT_MMU_SSID 0
/* SSID 1 is used by the VPU to represent invalid context */
#define IVPU_USER_CONTEXT_MIN_SSID 2
@@ -146,11 +148,6 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link);
int ivpu_boot(struct ivpu_device *vdev);
int ivpu_shutdown(struct ivpu_device *vdev);

static inline bool ivpu_is_mtl(struct ivpu_device *vdev)
{
return to_pci_dev(vdev->drm.dev)->device == PCI_DEVICE_ID_MTL;
}

static inline u8 ivpu_revision(struct ivpu_device *vdev)
{
return to_pci_dev(vdev->drm.dev)->revision;
@@ -161,6 +158,17 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
return to_pci_dev(vdev->drm.dev)->device;
}

static inline int ivpu_hw_gen(struct ivpu_device *vdev)
{
switch (ivpu_device_id(vdev)) {
case PCI_DEVICE_ID_MTL:
return IVPU_HW_37XX;
default:
ivpu_err(vdev, "Unknown VPU device\n");
return 0;
}
}

static inline struct ivpu_device *to_ivpu_device(struct drm_device *dev)
{
return container_of(dev, struct ivpu_device, drm);
2 changes: 1 addition & 1 deletion drivers/accel/ivpu/ivpu_hw.h
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ struct ivpu_hw_info {
int dma_bits;
};

extern const struct ivpu_hw_ops ivpu_hw_mtl_ops;
extern const struct ivpu_hw_ops ivpu_hw_37xx_ops;

static inline int ivpu_hw_info_init(struct ivpu_device *vdev)
{
Loading

0 comments on commit 51d66a7

Please sign in to comment.