提交 56a78de5 编写于 作者: C Changbin Du 提交者: Zhenyu Wang

drm/i915/gvt: Make mmio_attribute as type u8 to save 1.5MB memory

Type u8 is big enough to contain all MMIO attribute flags. As the
total MMIO size is 2MB so we saved 1.5MB memory.
Signed-off-by: NChangbin Du <changbin.du@intel.com>
Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
上级 d8d94ba3
...@@ -198,7 +198,7 @@ struct intel_gvt_fence { ...@@ -198,7 +198,7 @@ struct intel_gvt_fence {
#define INTEL_GVT_MMIO_HASH_BITS 9 #define INTEL_GVT_MMIO_HASH_BITS 9
struct intel_gvt_mmio { struct intel_gvt_mmio {
u32 *mmio_attribute; u8 *mmio_attribute;
DECLARE_HASHTABLE(mmio_info_table, INTEL_GVT_MMIO_HASH_BITS); DECLARE_HASHTABLE(mmio_info_table, INTEL_GVT_MMIO_HASH_BITS);
}; };
......
...@@ -105,7 +105,7 @@ static struct intel_gvt_mmio_info *find_mmio_info(struct intel_gvt *gvt, ...@@ -105,7 +105,7 @@ static struct intel_gvt_mmio_info *find_mmio_info(struct intel_gvt *gvt,
} }
static int new_mmio_info(struct intel_gvt *gvt, static int new_mmio_info(struct intel_gvt *gvt,
u32 offset, u32 flags, u32 size, u32 offset, u8 flags, u32 size,
u32 addr_mask, u32 ro_mask, u32 device, u32 addr_mask, u32 ro_mask, u32 device,
gvt_mmio_func read, gvt_mmio_func write) gvt_mmio_func read, gvt_mmio_func write)
{ {
...@@ -2922,9 +2922,10 @@ int intel_gvt_setup_mmio_info(struct intel_gvt *gvt) ...@@ -2922,9 +2922,10 @@ int intel_gvt_setup_mmio_info(struct intel_gvt *gvt)
{ {
struct intel_gvt_device_info *info = &gvt->device_info; struct intel_gvt_device_info *info = &gvt->device_info;
struct drm_i915_private *dev_priv = gvt->dev_priv; struct drm_i915_private *dev_priv = gvt->dev_priv;
int size = info->mmio_size / 4 * sizeof(*gvt->mmio.mmio_attribute);
int ret; int ret;
gvt->mmio.mmio_attribute = vzalloc(info->mmio_size); gvt->mmio.mmio_attribute = vzalloc(size);
if (!gvt->mmio.mmio_attribute) if (!gvt->mmio.mmio_attribute)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册