tegra: hwpm: update aperture mmio details

HWPM components (PMA, RTR, perfmon) have MMIO address space and a
corresponding virtual address region. It is possible that both MMIO and
virtual addresses are same for an aperture.
MMIO address of an aperture is used in device node to enable the
aperture and further to map HWPM component in the driver.
Virtual addresses are used by the applications to execute regops on HWPM
apertures. Virtual addresses are also used to fake aperture address
space in simulation.
This patch updates
- HWPM aperture structures to include MMIO address.
- aperture ioremap function to use MMIO address values.
- fake register allocation to use virtual address values.

Jira THWPM-41

Change-Id: I05acb68dcb278722cd333e1187b2355d1d739e93
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
(cherry picked from commit 1c0e8107b4cddad7532c10dddc22bb30cef2540b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2853213
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2023-01-09 13:26:43 -08:00
committed by mobile promotions
parent 1bbda26d7d
commit e115e1da2f
21 changed files with 353 additions and 318 deletions

View File

@@ -206,12 +206,6 @@ struct hwpm_ip_aperture {
*/
u32 element_index;
/* MMIO device tree aperture - only populated for perfmon */
void __iomem *dt_mmio;
/* DT tree name */
char name[64];
/*
* Device index corresponding to device node aperture address index
* in Device tree or ACPI table.
@@ -219,22 +213,44 @@ struct hwpm_ip_aperture {
*/
u32 device_index;
/* Allowlist */
struct allowlist *alist;
u64 alist_size;
/* MMIO device tree aperture - only populated for perfmon */
void __iomem *dt_mmio;
/* Physical aperture */
u64 start_abs_pa;
u64 end_abs_pa;
/* DT tree name */
char name[64];
/* MMIO aperture */
/*
* MMIO address for the aperture. This address range is present
* in the device node.
* MMIO addresses can be same as virtual aperture addresses.
*/
u64 start_pa;
u64 end_pa;
/* Base address: used to calculate register offset */
/*
* Virtual aperture address
* Regops addresses should be in this range.
*/
u64 start_abs_pa;
u64 end_abs_pa;
/*
* Base address of Perfmon Block
* All perfmon apertures have identical placement of registers
* HWPM read/write logic for perfmons refers to registers in the first
* perfmon block. Use this base address value to compute register
* offset in HWPM read/write functions.
*/
u64 base_pa;
/* Fake registers for VDK which doesn't have a SOC HWPM fmodel */
/* Allowlist */
u64 alist_size;
struct allowlist *alist;
/*
* Fake registers for simulation where SOC HWPM is not implemented
* Use virtual aperture address values for allocation.
*/
u32 *fake_registers;
};