Re: [PATCH v9 6/7] drm/i915/guc: Check the locking status of GuC WOPCM registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/08/2018 03:31 PM, Chris Wilson wrote:
Quoting Jackie Li (2018-02-08 23:03:54)
@@ -95,7 +97,11 @@ struct intel_guc_wopcm {
         u32 offset;
         u32 size;
         u32 top;
-       u32 valid;
+
+       /* GuC WOPCM flags below. */
+       u32 valid:1;
+       u32 hw_updated:1;
+       u32 need_load_huc_fw:1;
bool need_load_huc_fw:1; etc

@@ -147,6 +211,8 @@ int intel_guc_wopcm_init(struct intel_guc_wopcm *guc_wopcm, u32 guc_fw_size,
         guc->wopcm.offset = offset;
         guc->wopcm.size = size;
         guc->wopcm.top = top;
+       /* Use GuC to load HuC firmware if HuC firmware is present. */
+       guc->wopcm.need_load_huc_fw = huc_fw_size ? 1 : 0;
Then the compiler will do the right thing with

	guc->wopcm.need_load_huc_fw = huc_fw_size;

bools, use them ;)
Thanks Chris!

To be honest, I would still end up with *guc->wopcm.need_load_huc_fw = huc_fw_size ? 1 : 0* even if I had used bool for these flags.However, my main consideration to use *u32* instead of *bool* was to make it flexible to add to flags bits,  e.g. easy to append new flags/fields which needs more than 1-bit (may be overthinking here). we sure can use u8/16/32 for such new flags,
but it's a little bit odd to have something like:
    bool flag1:1;
    u8 flag2:2;

Plus, the mysterious bool size was another reason I was reluctant to use bool in struct (even through
I always got size = 1 byte for a bool type :-[).

Appreciate for more insights on the use of bool.

Regards,
-Jackie

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux