[PATCH v3 i-g-t 4/4] lib/xe/xe_sriov_provisioning: Iterate only within valid PTE offsets
Laguna, Lukasz
lukasz.laguna at intel.com
Fri Nov 22 10:43:34 UTC 2024
On 11/21/2024 15:18, Marcin Bernatowicz wrote:
> Update range-checking logic to iterate only within valid PTE offsets
> based on MAX_WOPCM_SIZE and GUC_GGTT_TOP.
>
> Closes:https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3507
> Signed-off-by: Marcin Bernatowicz<marcin.bernatowicz at linux.intel.com>
> Cc: Adam Miszczak<adam.miszczak at linux.intel.com>
> Cc: C V Narasimha<narasimha.c.v at intel.com>
> Cc: Jakub Kolakowski<jakub1.kolakowski at intel.com>
> Cc: K V P Satyanarayana<satyanarayana.k.v.p at intel.com>
> Cc: Lukasz Laguna<lukasz.laguna at intel.com>
> Cc: Michał Wajdeczko<michal.wajdeczko at intel.com>
> Cc: Michał Winiarski<michal.winiarski at intel.com>
> Cc: Piotr Piórkowski<piotr.piorkowski at intel.com>
> Cc: Tomasz Lis<tomasz.lis at intel.com>
> ---
> lib/xe/xe_sriov_provisioning.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c
> index d448a53d8..67ae9cf54 100644
> --- a/lib/xe/xe_sriov_provisioning.c
> +++ b/lib/xe/xe_sriov_provisioning.c
> @@ -39,6 +39,10 @@ const char *xe_sriov_shared_res_to_string(enum xe_sriov_shared_res res)
> #define PRE_1250_IP_VER_GGTT_PTE_VFID_MASK GENMASK_ULL(4, 2)
> #define GGTT_PTE_VFID_MASK GENMASK_ULL(11, 2)
> #define GGTT_PTE_VFID_SHIFT 2
> +#define GUC_GGTT_TOP 0xFEE00000
> +#define MAX_WOPCM_SIZE SZ_8M
> +#define START_PTE_OFFSET (MAX_WOPCM_SIZE / SZ_4K * sizeof(xe_ggtt_pte_t))
> +#define MAX_PTE_OFFSET (GUC_GGTT_TOP / SZ_4K * sizeof(xe_ggtt_pte_t))
>
> static uint64_t get_vfid_mask(int fd)
> {
> @@ -112,7 +116,8 @@ int xe_sriov_find_ggtt_provisioned_pte_offsets(int pf_fd, int gt, struct xe_mmio
> *ranges = NULL;
> *nr_ranges = 0;
>
> - for (uint32_t offset = 0; offset < SZ_8M; offset += sizeof(xe_ggtt_pte_t)) {
> + for (uint32_t offset = START_PTE_OFFSET; offset < MAX_PTE_OFFSET;
> + offset += sizeof(xe_ggtt_pte_t)) {
> pte = xe_mmio_ggtt_read(mmio, gt, offset);
> vf_id = (pte & vfid_mask) >> GGTT_PTE_VFID_SHIFT;
>
LGTM,
Reviewed-by: Lukasz Laguna <lukasz.laguna at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20241122/79930d14/attachment.htm>
More information about the igt-dev
mailing list