summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2018-02-02 18:15:00 +0100
committerMarek Olšák <marek.olsak@amd.com>2018-02-09 20:30:16 +0100
commitad5b702fec3f9cb54feeb403e7b31c10ebc0ca7c (patch)
treeacc913e75267852b1e6030093146ce84700e96a9
parentdeb59781fcc1183e19cca67e2db35c2e21f40ed5 (diff)
amdgpu: add amdgpu_query_sw_info for querying high bits of 32-bit address space
Reviewed-by: Christian König <christian.koenig@amd.com>
-rw-r--r--amdgpu/amdgpu.h21
-rw-r--r--amdgpu/amdgpu_device.c14
-rw-r--r--amdgpu/amdgpu_internal.h1
3 files changed, 36 insertions, 0 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 2eb03bf1..928b2a68 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -94,6 +94,10 @@ enum amdgpu_gpu_va_range
amdgpu_gpu_va_range_general = 0
};
+enum amdgpu_sw_info {
+ amdgpu_sw_info_address32_hi = 0,
+};
+
/*--------------------------------------------------------------------------*/
/* -------------------------- Datatypes ----------------------------------- */
/*--------------------------------------------------------------------------*/
@@ -1086,6 +1090,23 @@ int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
unsigned size, void *value);
/**
+ * Query hardware or driver information.
+ *
+ * The return size is query-specific and depends on the "info_id" parameter.
+ * No more than "size" bytes is returned.
+ *
+ * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
+ * \param info - \c [in] amdgpu_sw_info_*
+ * \param value - \c [out] Pointer to the return value.
+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX error code
+ *
+*/
+int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
+ void *value);
+
+/**
* Query information about GDS
*
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index f34e27a9..6ee25a9e 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -275,6 +275,7 @@ int amdgpu_device_initialize(int fd,
max = MIN2(max, (start & ~0xffffffffULL) + 0x100000000ULL);
amdgpu_vamgr_init(&dev->vamgr_32, start, max,
dev->dev_info.virtual_address_alignment);
+ dev->address32_hi = start >> 32;
start = max;
if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max)
@@ -312,3 +313,16 @@ const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
{
return dev->marketing_name;
}
+
+int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
+ void *value)
+{
+ uint32_t *val32 = (uint32_t*)value;
+
+ switch (info) {
+ case amdgpu_sw_info_address32_hi:
+ *val32 = dev->address32_hi;
+ return 0;
+ }
+ return -EINVAL;
+}
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 75276a99..dd0c3a61 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -73,6 +73,7 @@ struct amdgpu_device {
int flink_fd;
unsigned major_version;
unsigned minor_version;
+ uint32_t address32_hi;
char *marketing_name;
/** List of buffer handles. Protected by bo_table_mutex. */