Skip to content

Commit

Permalink
drm/xe: Move BAR definitions to dedicated file
Browse files Browse the repository at this point in the history
We should keep all hardware definitions separated from the driver
code. Move LMEM_BAR definition to new regs/xe_bars.h file and also
add there GTTMMADR_BAR definition to avoid using magic 0 resource.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240530133527.1328-3-michal.wajdeczko@intel.com
  • Loading branch information
Michal Wajdeczko committed May 30, 2024
1 parent 2adfc4e commit 2d8865b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions drivers/gpu/drm/xe/regs/xe_bars.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2024 Intel Corporation
*/
#ifndef _XE_BARS_H_
#define _XE_BARS_H_

#define GTTMMADR_BAR 0 /* MMIO + GTT */
#define LMEM_BAR 2 /* VRAM */

#endif
3 changes: 2 additions & 1 deletion drivers/gpu/drm/xe/xe_mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <drm/drm_managed.h>
#include <drm/xe_drm.h>

#include "regs/xe_bars.h"
#include "regs/xe_engine_regs.h"
#include "regs/xe_gt_regs.h"
#include "regs/xe_regs.h"
Expand Down Expand Up @@ -435,7 +436,7 @@ int xe_mmio_init(struct xe_device *xe)
* registers (0-4MB), reserved space (4MB-8MB) and GGTT (8MB-16MB).
*/
xe->mmio.size = pci_resource_len(pdev, mmio_bar);
xe->mmio.regs = pci_iomap(pdev, mmio_bar, 0);
xe->mmio.regs = pci_iomap(pdev, mmio_bar, GTTMMADR_BAR);
if (xe->mmio.regs == NULL) {
drm_err(&xe->drm, "failed to map registers\n");
return -EIO;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/xe/xe_mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
struct xe_device;
struct xe_reg;

#define LMEM_BAR 2

int xe_mmio_init(struct xe_device *xe);
int xe_mmio_probe_tiles(struct xe_device *xe);

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <generated/xe_wa_oob.h>

#include "regs/xe_bars.h"
#include "regs/xe_gt_regs.h"
#include "regs/xe_regs.h"
#include "xe_bo.h"
Expand Down

0 comments on commit 2d8865b

Please sign in to comment.