Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1726792pxb; Wed, 2 Feb 2022 11:06:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLSMB2FHW9AFAq5Rki7i48mTfaoQTDOUbF+R/x0S79y5DU4v1jT4cRzvLGe21GyNwbgcQ5 X-Received: by 2002:a17:902:900b:: with SMTP id a11mr31943506plp.13.1643828791224; Wed, 02 Feb 2022 11:06:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643828791; cv=none; d=google.com; s=arc-20160816; b=0sOVGozs7PET5xC4xhgRy0xMqpceTz9tgSvcKJmlehYzKuzOetJU3mcBNdlvg8jd1x CrHnN6l7HoPL4HsHAnfJhPzh6UuTxdNzjGnyJ3fHZlRJ6DuII3vvoGq78ObPFM3AXAcv PukemvOxkLSj7vVZJtYZpvJXwNAynxQl8w/n9QCIIrvXPIl09Y4AG5/HCNWfjIcpmwXF 2afsvGrOkmFTwK4+K13MhaaVsMxsvdK4g5cB808LMKwC2M51Brq2ggWACDJgUliXQIvr vMYgcdeAGIWPPl/c3el02Gt71wf0plfPmifPcb7te2DEcMqEZ15FOUz0AMMuiyZbcwig /5+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kZpyNf+L5zMk2ms7a1aAx+i6+b91a8Er9PIFNT1alKc=; b=mZqwfGS3TygrfpLdtJLM3422KMgSeEFLlhmJRROnzm1FVvIrOtzFmp2VmO4SW975Is 6MhZ+JztVS9lzSj6LLCSvSMbXGsMTvB/cWPoRXC4r58ug+EbjdghOhSTqgcvJcYkYh4T tZcRKLwjmwqXP7788lF3c/xLw5SSadAC7wkABTYALctIuaTxjYmTPLnwME12fxJpn501 0kYvlK6x+ujYWfDbGUg8GuSj5NLMBw03zPujragkU8oHxmdrZ2ok/gH1BXrf/s4A+uyk c9/meiw3CPqK8wjjEyDzNFgpSnojRxSHlxr8OH5ult1kTQjBhmdsTnm7nnD5tg3UwqyK SVkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jQ82qm84; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24si18089889pll.11.2022.02.02.11.06.18; Wed, 02 Feb 2022 11:06:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jQ82qm84; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242249AbiBATBl (ORCPT + 99 others); Tue, 1 Feb 2022 14:01:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:52062 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242227AbiBATBi (ORCPT ); Tue, 1 Feb 2022 14:01:38 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDDEF61615; Tue, 1 Feb 2022 19:01:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 683C7C340F1; Tue, 1 Feb 2022 19:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643742097; bh=I5Ksu7TSv5OlmgMa0WaJLxD3mrYm2dJm/MON3Czbzb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQ82qm84m11Nng41jofXckgW27OfA/w2Hm4edQErKgZLb4z6UpZyBy+n5cVpzibpp Abi8XyCVEp2+PtlRd+6iNXAh9Yvs9mQjFJcnANc9zg/XJVm7BcFu60Ga68e0YiZ/Xi ngxXYR5CsuKYtPtG0lr+hvr5D+s5ZbFCe6/STaqkdtEnqyzdxPP5A3tk1sFZOuUdXv Cke9uxy8QG9Fm8Tkeyw+HUQdaPc+DoZvrdE0oQN/K5jfvjdm/3kWUQwA99uaUJqL5E 6hczOpd6kOuAYY5gmz0QKjT1Wx5Vu0pixs4oHmuqrDS6Gzg49FiAJ4uNa03yKrfgMx bCm5frnH6HIgQ== From: Keith Busch To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, martin.petersen@oracle.com, colyli@suse.de, Keith Busch , Arnd Bergmann Subject: [PATCHv2 5/7] asm-generic: introduce be48 unaligned accessors Date: Tue, 1 Feb 2022 11:01:26 -0800 Message-Id: <20220201190128.3075065-6-kbusch@kernel.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20220201190128.3075065-1-kbusch@kernel.org> References: <20220201190128.3075065-1-kbusch@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The NVMe protocol extended the data integrity fields with unaligned 48-bit reference tags. Provide some helper accessors in preparation for these. Acked-by: Arnd Bergmann Signed-off-by: Keith Busch --- include/asm-generic/unaligned.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h index 1c4242416c9f..8fc637379899 100644 --- a/include/asm-generic/unaligned.h +++ b/include/asm-generic/unaligned.h @@ -126,4 +126,30 @@ static inline void put_unaligned_le24(const u32 val, void *p) __put_unaligned_le24(val, p); } +static inline void __put_unaligned_be48(const u64 val, __u8 *p) +{ + *p++ = val >> 40; + *p++ = val >> 32; + *p++ = val >> 24; + *p++ = val >> 16; + *p++ = val >> 8; + *p++ = val; +} + +static inline void put_unaligned_be48(const u64 val, void *p) +{ + __put_unaligned_be48(val, p); +} + +static inline u64 __get_unaligned_be48(const u8 *p) +{ + return (u64)p[0] << 40 | (u64)p[1] << 32 | p[2] << 24 | + p[3] << 16 | p[4] << 8 | p[5]; +} + +static inline u64 get_unaligned_be48(const void *p) +{ + return __get_unaligned_be48(p); +} + #endif /* __ASM_GENERIC_UNALIGNED_H */ -- 2.25.4