[PATCH v5 1/4] drm/xe: Define XE_REG_IS_VALID

Lucas De Marchi lucas.demarchi at intel.com
Thu Apr 4 16:07:52 UTC 2024


On Thu, Apr 04, 2024 at 04:01:56PM +0530, Riana Tauro wrote:
>Hi Karthik
>
>Add a general commit message and add the suggestions with names under 
>version history. For all patches.
>
>On 4/4/2024 9:24 AM, Karthik Poosa wrote:
>>Add macro to check if struct xe_reg has valid address. (Lucas, Badal).
>>
>>Signed-off-by: Karthik Poosa <karthik.poosa at intel.com>
>>---
>>  drivers/gpu/drm/xe/regs/xe_reg_defs.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>>diff --git a/drivers/gpu/drm/xe/regs/xe_reg_defs.h b/drivers/gpu/drm/xe/regs/xe_reg_defs.h
>>index c89ef2b79a3f..42078643be6b 100644
>>--- a/drivers/gpu/drm/xe/regs/xe_reg_defs.h
>>+++ b/drivers/gpu/drm/xe/regs/xe_reg_defs.h
>>@@ -131,4 +131,6 @@ struct xe_reg_mcr {
>>  				 .__reg = XE_REG_INITIALIZER(r_,  ##__VA_ARGS__, .mcr = 1)	\
>>  				 })
>>+#define XE_REG_IS_VALID(r)	((r.addr) ? true : false)
>Why use addr instead of raw?

because raw is wrong as it contains the flags for the register.

XE_REG(0) is invalid
XE_REG(0, XE_REG_OPTION_MASKED) is invalid as well, but .raw != 0.

It's the **address** that tells if the register is valid.

Lucas De Marchi

>
>Thanks,
>Riana
>>+
>>  #endif


More information about the Intel-xe mailing list