[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN v2] xen/Arm: Enforce alignment check for atomic read/write
- To: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Fri, 4 Nov 2022 16:32:30 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=80AthlkCP9ESVYijKAHCQxARwimk0xrGDbtTfMDxJok=; b=LkuZcl66SYRb8ogCkV2OqgjHilB+gtQxx31q4nPTs9Oj+2puC0d5jMCg1T7IY8mizS8YqGyZshfdxE/XRepUSdxruSkSx/Yzemnz36zVNqQQqufFUkxtTQczRSF75DCVkwwcLfsnnAAvwg63xP7KC8pz9+TMJiOjIV4HydtD4katoK+QBv+Ur0gKbHRx0ycie0XYQMNVymi2VNTJ41EoHjpEgIvl+b+IH7TFx9NYCHhV/aAZYIhUnSm5625GifJwbn6nFm2/RRcBj+amJBAmUBVxXVODBmpzFyPsWpuVn+cNiofjSlkA3Nfiq0QzaQY94oXvSFsEjIJNmvclopsuHQ==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=80AthlkCP9ESVYijKAHCQxARwimk0xrGDbtTfMDxJok=; b=mI3mK7qj5GQKbILAF+puEUVfDbAcbIKJBIkJCkOjGQqO+J5jrNogulKPndMM5GNMWwdKirM54n/PRbjcKSqK92hoC+P7svWCgObp8/2BQ6XOeJVrF0+1mvIreWtK5zTfzK1CHxArc5HcYXY4ncupPvoQ/lVjb/nbYaf2Daf8wkXiHvo1i9mbIjtfwZAKGbopD2QVWyxoDsgiZnB558t8ATAgFrmncaDyx9iXUsxawI4ufRWZPfPDvFgco84T4WBiuDy4JSgh5PITEE8pY23V56WjJl9E1LL4EG48GwZl8Iv8t+8yL8XhHEF7f4jBWuTpx6XJJC+TuJNeG3cotGC2VQ==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=aZVqpJuZ1HYAgA1Y4VKdBE5PBiAx5edNoVkQDgaSbhHxymUyFT3oCXibiD5y1KI6yPHk1wTJUDUGcMTUwod5FBt+L9CA0h1w1j7IUr4bDY8WMybMeyynIzqM1d98dbT9EvceKy4KylWQIEuwLIqtwsluzOL6xwgpLQSDaknyERk0BnunUzoGOofU3sW5orHscmFppeyUsQl6cntRd1UQo3x7NB4n9yvfgB8WlzXYM/Ydad1UFqLh8qTHbYuIoJ+vqoydcLhNMzsClQVFlw++6tbBirRhAkmmP0Opv33A8xEjg+nX+yRatLKx/XfX9lvuFF72lzATWF2B1wvBLP+/hQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N6kx0H6/1GDouflvF4qBS89iYR/y6dMD7b9TZ/yKvHU8yuCNnHEN+sS3/9REeiWC47nDGX8NFKQFBlUznEZDq8M8KAaTXVIO+PfYuV3TJnygGXp4/cgi9hKch5F8M2LgF5Tw9qNK9PkIjE5dKQa7UGu8M7WaP6zNUh14PV67IMGFwRAERYOaP9fk0i7BVMG8zo7xmIhSJViu8Lg9sZRxKt6Wk6vk9XxCEeZl9PZjfctPUJ0fnN8Xj27r3uFYFj9vqU4hn5Ryq3GRdBfXdq5dg11j2AqXwYlKHorQU3WcdRhFnhVTVk7ltonKEC9FGtkD05HH7PGkZmbWZyXk/uYqhA==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Xen developer discussion <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "stefanos@xxxxxxxxxx" <stefanos@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, "michal.orzel@xxxxxxx" <michal.orzel@xxxxxxx>, Ayan Kumar Halder <ayankuma@xxxxxxx>
- Delivery-date: Fri, 04 Nov 2022 16:32:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHY8Gnh8hKxIKIkAUWHK4BT2/fYBK4u9TuA
- Thread-topic: [XEN v2] xen/Arm: Enforce alignment check for atomic read/write
Hi Ayan,
> On 4 Nov 2022, at 16:23, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx> wrote:
>
> From: Ayan Kumar Halder <ayankuma@xxxxxxx>
>
> Refer ARM DDI 0487I.a ID081822, B2.2.1
> "Requirements for single-copy atomicity
>
> - A read that is generated by a load instruction that loads a single
> general-purpose register and is aligned to the size of the read in the
> instruction is single-copy atomic.
>
> -A write that is generated by a store instruction that stores a single
> general-purpose register and is aligned to the size of the write in the
> instruction is single-copy atomic"
>
> On AArch32, the alignment check is enabled at boot time by setting HSCTLR.A
> bit.
> ("HSCTLR, Hyp System Control Register").
> However in AArch64, alignment check is not enabled at boot time.
>
> Thus, one needs to check for alignment when performing atomic operations.
>
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx
Seems like the R-B is missing a >
With that fixed (can be done on commit):
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Cheers
Bertrand
> ---
>
> Changes from :-
> v1 - 1. Referred to the latest Arm Architecture Reference Manual in the commit
> message.
>
> xen/arch/arm/include/asm/atomic.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/xen/arch/arm/include/asm/atomic.h
> b/xen/arch/arm/include/asm/atomic.h
> index 1f60c28b1b..64314d59b3 100644
> --- a/xen/arch/arm/include/asm/atomic.h
> +++ b/xen/arch/arm/include/asm/atomic.h
> @@ -78,6 +78,7 @@ static always_inline void read_atomic_size(const volatile
> void *p,
> void *res,
> unsigned int size)
> {
> + ASSERT(IS_ALIGNED((vaddr_t)p, size));
> switch ( size )
> {
> case 1:
> @@ -102,6 +103,7 @@ static always_inline void write_atomic_size(volatile void
> *p,
> void *val,
> unsigned int size)
> {
> + ASSERT(IS_ALIGNED((vaddr_t)p, size));
> switch ( size )
> {
> case 1:
> --
> 2.17.1
>
|