On Fri, Nov 04, 2016 at 05:12:04PM +0100, Andrew Jones wrote: [...] > > +#include "intel-iommu.h" > > + > > +#define ONE_BIT_ONLY(x) ((x) && !((x) & ((x) - 1))) > > How about instead adding > > static inline bool is_power_of_2(unsigned long n) > { > return (n && !(n & (n - 1))); > } > > to libcflat.h, because there's a few other places I've needed > this check myself. Sure. Will do. [...] > > +static void vtd_gcmd_or(uint32_t cmd) > > +{ > > + uint32_t status; > > + > > + /* We only allow set one bit for each time */ > > + assert(ONE_BIT_ONLY(cmd)); > > + > > + status = vtd_readl(DMAR_GSTS_REG); > > + vtd_writel(DMAR_GCMD_REG, status | cmd); > > + > > + if (cmd & VTD_GCMD_ONE_SHOT_BITS) > > + /* One-shot bits are taking effect immediately */ > > + return; > > Please use {} when adding comments between an if and its one line. Will fix. Thanks! -- peterx -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html