From: Kamlesh Gurudasani <kamlesh@xxxxxx> Sent: Sunday, February 4, 2024 3:50 PM To: Zeng, Xin <xin.zeng@xxxxxxxxx>; herbert@xxxxxxxxxxxxxxxxxxx; alex.williamson@xxxxxxxxxx; jgg@xxxxxxxxxx; yishaih@xxxxxxxxxx; shameerali.kolothum.thodi@xxxxxxxxxx; Tian, Kevin <kevin.tian@xxxxxxxxx> Cc: linux-crypto@xxxxxxxxxxxxxxx; kvm@xxxxxxxxxxxxxxx; qat-linux <qat-linux@xxxxxxxxx>; Wan, Siming <siming.wan@xxxxxxxxx>; Zeng, Xin <xin.zeng@xxxxxxxxx> Subject: Re: [EXTERNAL] [PATCH 07/10] crypto: qat - add bank save and restore flows Xin Zeng <xin.zeng@xxxxxxxxx> writes: > This message was sent from outside of Texas Instruments. > Do not click links or open attachments unless you recognize the source of this email and know the content is safe. > > From: Siming Wan <siming.wan@xxxxxxxxx> > > Add logic to save, restore, quiesce and drain a ring bank for QAT GEN4 > devices. > This allows to save and restore the state of a Virtual Function (VF) > and will be used to implement VM live migration. > > Signed-off-by: Siming Wan <siming.wan@xxxxxxxxx> > Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@xxxxxxxxx> > Reviewed-by: Xin Zeng <xin.zeng@xxxxxxxxx> > Signed-off-by: Xin Zeng <xin.zeng@xxxxxxxxx> ... > +#define CHECK_STAT(op, expect_val, name, args...) \ ({ \ > + u32 __expect_val = (expect_val); \ > + u32 actual_val = op(args); \ > + if (__expect_val != actual_val) \ > + pr_err("QAT: Fail to restore %s register. Expected 0x%x, but actual is 0x%x\n", \ > + name, __expect_val, actual_val); \ > + (__expect_val == actual_val) ? 0 : -EINVAL; \ I was wondering if this can be done like following, saves repeat comparison. (__expect_val == actual_val) ? 0 : (pr_err("QAT: Fail to restore %s \ register. Expected 0x%x, \ but actual is 0x%x\n", \ name, __expect_val, \ actual_val), -EINVAL); \ Regards, Kamlesh > +}) ... Thanks for your comments! Will update.