From patchwork Tue Dec 13 12:52:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 633511 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3057153pvb; Tue, 13 Dec 2022 04:54:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf5TsBJr6F7TMdfoheO2ngvu8OuRtAuwXuqOdPdigbN5NV53DcPQPlz1lXXcCf4XLN+2UqpB X-Received: by 2002:a05:622a:189b:b0:39c:da20:674 with SMTP id v27-20020a05622a189b00b0039cda200674mr37819655qtc.23.1670936043896; Tue, 13 Dec 2022 04:54:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670936043; cv=none; d=google.com; s=arc-20160816; b=QYSnz5UAFclMwd9UhhgmDorGWTQmSswaw/bLmtmaS1MWgqFL6a/w6rlhzrkuI/n6oA XSQG/yQwxPVRG2QtEp/OSCbtftlG+Lp0iuUUNrf/0uDI64lmSJMoL0n8vcYWVBj0g8vy Moeft0xdVJs4H9dfdJ2o45MABCZ5gpt8ySD3OT4puTbdPgKKnc1SnEwCmscn61mYWVXM Bhg4ljk+0UDWUb8k2Ih0u/eGJD+uC5WH5hauoaPlRrUBreiWFun35NSuuStxjoOuKyZi Lqvia4qlm/aIA5p8GL0mRSMa163RDYmom3I5aPqz8z3D5Nz1psFk+lXzHhECykgHcBhO QIag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9K2qPGrTReTYlsl4YSIfP//FNBSyIjWF7QnWmXpGYsA=; b=LuJzqFmzV4g0fvobYd6C6rWoaN9QhVfcgM0c19iSR89njwVaDT8ZRP8ADlEX4tTeV9 FPyt5hCDBzhCiyWvNAHF4b+LFrQAXr6A0sYsR33Kh9pc5svHIXs/gMeK9mXagsTmcGmB ExFd5TgDiv3vOk7rZlH9A2r1pG2+rPR4D79QFNG9M0VANEgksL0cMjkTB1H+vrZYLdZi cDBOZPe2e18AmZYGc0hMXK6EJx2ejHiBv0lcYamVLxehxG0pdRu5YP00rek+kT373J+b +r/WXvQOkHCbdNDSJbeWKaKizTSUMisMR+ZPebAtK9BqUkn3wCXXB9dB338pfIaT1gQZ OFIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yl5BCsoE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q2-20020a05620a0d8200b006eec7b3a184si6096518qkl.211.2022.12.13.04.54.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Dec 2022 04:54:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yl5BCsoE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p54lv-00006M-5n; Tue, 13 Dec 2022 07:52:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p54lt-000060-Oe for qemu-devel@nongnu.org; Tue, 13 Dec 2022 07:52:33 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p54ls-0002yb-6r for qemu-devel@nongnu.org; Tue, 13 Dec 2022 07:52:33 -0500 Received: by mail-wm1-x32c.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so7890876wms.2 for ; Tue, 13 Dec 2022 04:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=9K2qPGrTReTYlsl4YSIfP//FNBSyIjWF7QnWmXpGYsA=; b=yl5BCsoEDuxmjJkMLGADIVk+7r8BSL7oepnDFby7GNPpQfmQ5Bn+smmkNWKP7MY7nj CiCsBjoLiYR2B5BR/DQ2D2ziVZtoDFyQDJw5CcT9HrbV3cVjwevAC9DQYJtNxpBJWmDW qgw/WVDJhEt7ZK3FKPs6rJfcBSJbjP6N01bCBm56P3ru704eGUG02glHV194chqOhpoQ gtTSzLFX+XRxlAnO25y+QbyX/hw6j4SFRiQowJug01p5XQkGSuFCWlrRYfJ/cRy8saYc H3dTMZMz38AM4xGAXMO+0EGrukQLrdKiDssA0IIA02sd3JUpknCLHzUzpDcBe/ivAt3v vJ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=9K2qPGrTReTYlsl4YSIfP//FNBSyIjWF7QnWmXpGYsA=; b=1sHjKEkFfIDi6B7wMJe/EzmLm9wWMNbT7uyhV6RBHYU5hFQfbFzhk7YnqALi8MmxOL O8zQZxKmS7vbJwca0H8ylnErdf9cKY6FzQ02No7pCv43acV8uzdRi455t9dLiFcMWfmy dTDp+epTCz+Msl6EWEyzH5RaJREk3ub9xKZFpSSsVK+OdM1lT5gv+ror+/mz0BRHN3Cg fRYWm6FPx56DBWLCf1wKvlxZG5gy0BmEVYywj/p4/wC8lgElo1EUpVqIHfLL8K62CTx+ 0O1eM7dQyDSJ8UGId7+jiMi0yLFGMwdmi9JIU2ffm8lq+DdkUCUbRu/UKtcQxBplpjIb 0jVA== X-Gm-Message-State: ANoB5pmjRE+N/ppvZq/1abYr7hQ6raGu5x+wRjTSrPCz2aWmOOFjbasa vPNsr2gl9tQi/hSNy21hEXc+7Q9cHUQIaX28/rU= X-Received: by 2002:a05:600c:1e25:b0:3cf:9ac8:c4eb with SMTP id ay37-20020a05600c1e2500b003cf9ac8c4ebmr14901967wmb.24.1670935951219; Tue, 13 Dec 2022 04:52:31 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id g20-20020a05600c4ed400b003c71358a42dsm17603605wmq.18.2022.12.13.04.52.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Dec 2022 04:52:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Peter Maydell Cc: Daniel Henrique Barboza , BALATON Zoltan , =?utf-8?q?Alex_Benn=C3=A9e?= , Alistair Francis , David Gibson , Jason Wang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Greg Kurz , qemu-arm@nongnu.org, "Edgar E. Iglesias" , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE) Date: Tue, 13 Dec 2022 13:52:17 +0100 Message-Id: <20221213125218.39868-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221213125218.39868-1-philmd@linaro.org> References: <20221213125218.39868-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The tswap64() calls introduced in commit 4be21d561d ("pseries: savevm support for pseries machine") are used to store the HTAB in the migration stream (see savevm_htab_handlers) and are in big-endian format. Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/spapr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 66b414d2e9..8b1d5689d2 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -39,6 +39,7 @@ #include "sysemu/reset.h" #include "sysemu/runstate.h" #include "qemu/log.h" +#include "qemu/bswap.h" #include "hw/fw-path-provider.h" #include "elf.h" #include "net/net.h" @@ -1357,10 +1358,10 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu, } #define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2)) -#define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VALID) -#define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_HPTE_DIRTY) -#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &= tswap64(~HPTE64_V_HPTE_DIRTY)) -#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |= tswap64(HPTE64_V_HPTE_DIRTY)) +#define HPTE_VALID(_hpte) (be64_to_cpu(*((uint64_t *)(_hpte))) & HPTE64_V_VALID) +#define HPTE_DIRTY(_hpte) (be64_to_cpu(*((uint64_t *)(_hpte))) & HPTE64_V_HPTE_DIRTY) +#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &= cpu_to_be64(~HPTE64_V_HPTE_DIRTY)) +#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |= cpu_to_be64(HPTE64_V_HPTE_DIRTY)) /* * Get the fd to access the kernel htab, re-opening it if necessary