drm/imagination: Ensure PVR_MIPS_PT_PAGE_COUNT is never zero
When the host page size was more than 4 times larger than the FW page
size, this macro evaluated to zero resulting in zero-sized arrays.
Use DIV_ROUND_UP() to ensure the correct behavior.
Reported-by: 20240228012313.5934-1-yaolu@kylinos.cn
Closes: https://lore.kernel.org/dri-devel/20240228012313.5934-1-yaolu@kylinos.cn
Link: https://lore.kernel.org/dri-devel/20240228012313.5934-1-yaolu@kylinos.cn
Fixes: 927f3e0253
("drm/imagination: Implement MIPS firmware processor and MMU support")
Cc: stable@vger.kernel.org
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
This commit is contained in:
parent
27906e5d78
commit
e4236b14fe
@ -7,13 +7,14 @@
|
|||||||
#include "pvr_rogue_mips.h"
|
#include "pvr_rogue_mips.h"
|
||||||
|
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
|
#include <linux/math.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
/* Forward declaration from pvr_gem.h. */
|
/* Forward declaration from pvr_gem.h. */
|
||||||
struct pvr_gem_object;
|
struct pvr_gem_object;
|
||||||
|
|
||||||
#define PVR_MIPS_PT_PAGE_COUNT ((ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K) \
|
#define PVR_MIPS_PT_PAGE_COUNT DIV_ROUND_UP(ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K, PAGE_SIZE)
|
||||||
>> PAGE_SHIFT)
|
|
||||||
/**
|
/**
|
||||||
* struct pvr_fw_mips_data - MIPS-specific data
|
* struct pvr_fw_mips_data - MIPS-specific data
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user