Skip to contentSkip to conversation

drm/amdkfd: Change pasid's type to unsigned int

DISCUSSION Fenghua Yu 3 participants 4 messages May 22, 2020 – May 23, 2020

lore
Share & tools
lore
#1 lore raw
In reply to Fenghua Yu

Hi Fenghua,

The PASID width in KFD is currently limited to 16 bits. I believe this reflects what our hardware can handle. KFD will never allocate a PASID bigger than 16 bits. That said, I'm OK with changing this field in the kfd_process structure to unsigned int. Generally, I find uint16_t in structures not very useful except in tightly packed structures such as packet formats or ioctl arguments.

Regards,
  Felix

Am 2020-05-22 um 3:25 p.m. schrieb Fenghua Yu:

Quoted 14 lines

Hi, Yong,

In commit: 6027b1bf6071fc61a5aa11b9922a2e0e91bff1ea
drm/amdkfd: Use hex print format for pasid

pasid's type was change to "uint16_t" from "unsigned int" in struct kfd_process.

But, pasid is a 20-bit value according to PCIe spec and other places in amdkfd (plus other iommu code) define pasid as "unsigned int". If defined as uint16_t, pasid will overflow if its value is bigger than 16-bit.

Did I miss anything? Should we change pasid's type back to "unsigned int"?

Quoted 7 lines

[a little background: pasid is defined as various types including "int", "unsigned int", "u32" in iommu. I'm changing pasid's types to "unsigned int" so that the types are consistent in iommu]

Thanks.

-Fenghua

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Fenghua Yu

author
#0 lore raw

Hi, Yong,

In commit: 6027b1bf6071fc61a5aa11b9922a2e0e91bff1ea
drm/amdkfd: Use hex print format for pasid

pasid's type was change to "uint16_t" from "unsigned int" in struct kfd_process.

But, pasid is a 20-bit value according to PCIe spec and other places in amdkfd (plus other iommu code) define pasid as "unsigned int". If defined as uint16_t, pasid will overflow if its value is bigger than 16-bit.

Did I miss anything? Should we change pasid's type back to "unsigned int"?

[a little background: pasid is defined as various types including "int", "unsigned int", "u32" in iommu. I'm changing pasid's types to "unsigned int" so that the types are consistent in iommu]

Thanks.

-Fenghua
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#2 lore raw
In reply to Felix Kuehling

Hi, Felix,

Quoted 8 lines · Felix Kuehling

Hi Fenghua,

The PASID width in KFD is currently limited to 16 bits. I believe this reflects what our hardware can handle. KFD will never allocate a PASID bigger than 16 bits. That said, I'm OK with changing this field in the kfd_process structure to unsigned int. Generally, I find uint16_t in structures not very useful except in tightly packed structures such as packet formats or ioctl arguments.

Thank you very much for your insight!

I'm writing the patch set to define pasid as "unsigned int" consistently in iommu. I'll put the amdkfd changes (only a few changes including this pasid change in struct kfd_processin) one patch and send it to you for review.

-Fenghua
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi Fenghua,

I am okay with the idea.

Regards,
Yong
________________________________
From: Fenghua Yu <[email protected]>
Sent: Friday, May 22, 2020 5:21 PM
To: Kuehling, Felix <[email protected]>
Cc: Zhao, Yong <[email protected]>; [email protected] <[email protected]>
Subject: Re: drm/amdkfd: Change pasid's type to unsigned int

Hi, Felix,

Quoted 8 lines · Felix Kuehling

Hi Fenghua,

The PASID width in KFD is currently limited to 16 bits. I believe this reflects what our hardware can handle. KFD will never allocate a PASID bigger than 16 bits. That said, I'm OK with changing this field in the kfd_process structure to unsigned int. Generally, I find uint16_t in structures not very useful except in tightly packed structures such as packet formats or ioctl arguments.

Thank you very much for your insight!

I'm writing the patch set to define pasid as "unsigned int" consistently in iommu. I'll put the amdkfd changes (only a few changes including this pasid change in struct kfd_processin) one patch and send it to you for review.

-Fenghua

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx