[PATCH 01/10] soc: fujitsu: hwb: Add hardware barrier driver init/exit code
Arnd Bergmann
arnd at kernel.org
Fri Jan 8 07:41:49 EST 2021
On Fri, Jan 8, 2021 at 11:32 AM Misono Tomohiro
<misono.tomohiro at jp.fujitsu.com> wrote:
> + *
> + * This hardware barrier (HWB) driver provides a set of ioctls to realize synchronization
> + * by PEs in the same Come Memory Group (CMG) by using implementation defined registers.
> + * On A64FX, CMG is the same as L3 cache domain.
> + *
> + * The main purpose of the driver is setting up registers which cannot be accessed
> + * from EL0. However, after initialization, BST_SYNC/LBSY_SYNC registers which is used
> + * in synchronization main logic can be accessed from EL0 (therefore it is fast).
> + *
> + * Simplified barrier operation flow of user application is as follows:
> + * (one PE)
> + * 1. Call IOC_BB_ALLOC to setup INIT_SYNC register which is shared in a CMG.
> + * This specifies which PEs join synchronization
> + * (on each PE joining synchronization)
> + * 2. Call IOC_BW_ASSIGN to setup ASSIGN_SYNC register per PE
> + * 3. Barrier main logic (all logic runs in EL0)
> + * a) Write 1 to BST_SYNC register
> + * b) Read LBSY_SYNC register
> + * c) If LBSY_SYNC value is 1, sync is finished, otherwise go back to b
> + * (If all PEs joining synchronization write 1 to BST_SYNC, LBSY_SYNC becomes 1)
> + * 4. Call IOC_BW_UNASSIGN to reset ASSIGN_SYNC register
> + * (one PE)
> + * 5. Call IOC_BB_FREE to reset INIT_SYNC register
> + */
On a very general note, I would like to see some background about how
specific this functionality is to the specific design of A64fx. If there are
other processors with a similar requirement, then it would be best to
define a more abstract user API that can work for any such product.
> +static int __init hwb_init(void)
> +{
> + int ret;
> +
> + ret = setup_hwinfo();
> + if (ret < 0) {
> + pr_err("Unsupported CPU type\n");
> + return ret;
> + }
Loading the module on a different machine should not print a warning:
In general, we want it to be possible to have all hardware specific
drivers built into the kernel, but not print any irritating messages
when they are simply not used on the hardware.
One way to avoid this would be to use a platform_driver() that
only gets loaded when a corresponding hardware device of some
sort is found, or ignored otherwise.
Arnd
More information about the linux-arm-kernel
mailing list