s390/barrier: Use alternative instead of ifdef for bcr_serialize()

Use an alternative to implement bcr_serialize() and use alternative
patching to select between serialization and fast-serialization
depending on the corresponding facility bit.

Reviewed-by: Jan Polensky <japo@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
Heiko Carstens 2026-05-08 17:02:46 +02:00 committed by Alexander Gordeev
parent 29f23176e7
commit a77ec04920

View File

@ -8,6 +8,7 @@
#ifndef __ASM_BARRIER_H
#define __ASM_BARRIER_H
#include <asm/alternative.h>
#include <asm/march.h>
/*
@ -16,16 +17,11 @@
* to devices.
*/
#ifdef MARCH_HAS_Z196_FEATURES
/* Fast-BCR without checkpoint synchronization */
#define __ASM_BCR_SERIALIZE "bcr 14,0"
#else
#define __ASM_BCR_SERIALIZE "bcr 15,0"
#endif
static __always_inline void bcr_serialize(void)
{
asm volatile(__ASM_BCR_SERIALIZE : : : "memory");
asm_inline volatile(
ALTERNATIVE("bcr 15,0", "bcr 14,0", ALT_FACILITY(45))
: : : "memory");
}
#define __mb() bcr_serialize()