From patchwork Tue Jan 9 17:00:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Chauhan X-Patchwork-Id: 1884581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=u901dSmI; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=Rw1WX28+; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=D6tDbIcQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T8fHq0sTBz1yPl for ; Wed, 10 Jan 2024 05:15:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tyBiysTSfIQQ4MYXtWQowoUma/zeUN2PPEw39lr4FcQ=; b=u901dSmIE/u3+X +v52LPUAaHAVnurPKArwdnhT/mKvkL8r+oZhXear5qlHxO8y0VLpokaSUBK6Xl4KPaqV9PHsLFMy8 htWGbzwZQrfoR/TonlBuHUotAvw+efW2Fx9WMAXn2lOJ6n46ubdAQDAVHPSWQ7Fh4fv6vDlaXK5Sx SkESkO/nopYilKkm3ag9M9855I+d9behl/9OlJL9UHWmCdpdqnkl1HfsqPB8jA9tiWIt0U6lU49Wx GagoAtTLGcGUevXv0chEq/c/la9pmeX3+Sii/Sjf9f99jgQgAGxMjNGSbCi+o3+DII5HvRB5EyAsv v/OKA8fhrHkzhU2LUArQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNGdU-0096o4-37; Tue, 09 Jan 2024 18:15:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNFSs-008w2j-1p for opensbi@bombadil.infradead.org; Tue, 09 Jan 2024 17:00:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=mNxniuTqEagLY+NfMQ/rC+XkXSykn62XF46OeJYRHEU=; b=Rw1WX28+K3jZtkQJFGpZfPfK3W 13nw6T+gdCz6y6CSAi6qCXxfC1uO47wsvSOqw/cydv3MrMSv2ku/FWFe3gTLAOPJIB65Q0vdQq2nn ktrV1ZU6CRIR48B6Rc326M1/y/N2LOVA0WIanVIvLDz9rRNc2HnAJ2SHBTtImI+D2to5tMpqRHVnO cibS04dBJZbbYQQ70T6V+QCeydGnsyhtoP8H0QRrq4O5tIaCDr9g3XZ+5+hXvItN0RvBz03f1oGc7 1aMaEqIUU5thmNTCzcsYI2d76iWz0DDzzzjHdWFIghxk+5KQXIH07yWwxpycLlXwMOXtyiI5mR2/T ogeNSBLg==; Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNFSn-008n4H-1P for opensbi@lists.infradead.org; Tue, 09 Jan 2024 17:00:33 +0000 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-58962bf3f89so411162a12.0 for ; Tue, 09 Jan 2024 09:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1704819625; x=1705424425; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mNxniuTqEagLY+NfMQ/rC+XkXSykn62XF46OeJYRHEU=; b=D6tDbIcQWIKT24zfiScVmKQIG9rpei6iRmrRSp2d6gGYOJXgCOBnLt5dTu7yeu08t3 q6RTEQVpZk++fn9P2Cc9KEQ/VQOwpyR8iMr/ZvtAZJRu5V7fEDpMoqkyS9AF5DmvegFe Qyzji5zHclMSQXmdAPafLLodLuy6UvfM5VKfaklLAHrAJoh0BH2W1u7IsQKqxUMMJKfP EePPJJIU9NVXDVIVsZrds+Xb7aPP2dRM9fTzWaNgDxuDF34GJG0EnJaE7fmFuDMMbdrJ +vABvwmB3T0/jvP3yPjwD0nazo70wqxoMHuftP5hPEciyXxCvjJuRgp6QIrFxpTudEcl IspA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704819625; x=1705424425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mNxniuTqEagLY+NfMQ/rC+XkXSykn62XF46OeJYRHEU=; b=llT/WDXDU/+73x6Sg2F0ICSU+v25p9C5dlmnAGFKwzJ1a8gFH58/c4HN0DV6ZDngTq R/qpdBK3c/8fi72P2wIegIQGjekjDeI7UflyzbjS3A4LioKups1yA+AO8gjJs5IZA9qm mQPV+b+uIlWsb82p5jkboHJ3GvIzu32/5uGNZP+bpzOkkvX1Ule1ewwPTVin1Nvpb0My a8eHJtFkBbFCG8/xXbqtaNhlcU4L/MOELDxSdNn+Jr3BQAAuU5423uZzS1rPXXDWTSt1 W3ZLKDFyXtWOGqLy2wLsyOOJKAnYWnfNkxd46QhI5eBhpT70O3LbMfOYF1mHouDXTBa2 +PUg== X-Gm-Message-State: AOJu0YyrpbQcjsFIsMpMymcz9QnxaG9PbXrNSyOYWnbnoEEkC2mO6s6u P3STWFq11GR2+m/wbTJQzWqVCQNW7Gt1jNz/uxMbRXGIjps= X-Google-Smtp-Source: AGHT+IG3/sfcSPpBqVPznp4CPkm7olU7iHy1gS32T9+Sm5oumySX5ArKF0vo8Q/cZvBMgHhFSIgctw== X-Received: by 2002:a05:6a20:1013:b0:196:16b0:c554 with SMTP id gs19-20020a056a20101300b0019616b0c554mr10460236pzc.5.1704819625473; Tue, 09 Jan 2024 09:00:25 -0800 (PST) Received: from brahaspati.localdomain ([49.37.250.161]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001d3dff2575fsm2024086plq.52.2024.01.09.09.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 09:00:25 -0800 (PST) From: Himanshu Chauhan To: opensbi@lists.infradead.org Cc: Anup Patel Subject: [PATCH v3 1/8] include: sbi: Introduce common endianess conversion macro Date: Tue, 9 Jan 2024 22:30:13 +0530 Message-Id: <20240109170020.1731282-2-hchauhan@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240109170020.1731282-1-hchauhan@ventanamicro.com> References: <20240109170020.1731282-1-hchauhan@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240109_170029_523217_3D70C965 X-CRM114-Status: UNSURE ( 7.42 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Introduce cpu_to_lle and lle_to_cpu macros which invoke correct word length cpu_to_le<64/32> conversion based on __riscv_xlen. Signed-off-by: Himanshu Chauhan Reviewed-by: Anup Patel --- include/sbi/sbi_byteorder.h | 10 ++++++++++ 1 file changed, 10 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:536 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Introduce cpu_to_lle and lle_to_cpu macros which invoke correct word length cpu_to_le<64/32> conversion based on __riscv_xlen. Signed-off-by: Himanshu Chauhan Reviewed-by: Anup Patel --- include/sbi/sbi_byteorder.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/sbi/sbi_byteorder.h b/include/sbi/sbi_byteorder.h index 15107e1..db6eb2b 100644 --- a/include/sbi/sbi_byteorder.h +++ b/include/sbi/sbi_byteorder.h @@ -58,4 +58,14 @@ #define le64_to_cpu(x) ((uint64_t)BSWAP64(x)) #endif +#if __riscv_xlen == 64 +#define cpu_to_lle cpu_to_le64 +#define lle_to_cpu le64_to_cpu +#elif __riscv_xlen == 32 +#define cpu_to_lle cpu_to_le32 +#define lle_to_cpu le32_to_cpu +#else +#error "Unknown __riscv_xlen" +#endif + #endif /* __SBI_BYTEORDER_H__ */