From patchwork Wed Dec 18 18:21:00 2024 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: 851751 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078051wrq; Wed, 18 Dec 2024 10:22:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWNk1WGVHo18O0Qj8aAzKtuBiAjXKB4HMR+AjR7bAh+sLcA9DTNAcZOymMqYXn4UOijxESG/g==@linaro.org X-Google-Smtp-Source: AGHT+IEnl4wuYObokm4/nW4X/ikXqeaVvjQ97XDGVyFQhjZETA/A01XHzabcj5b/h9MEb6JINYL3 X-Received: by 2002:a05:6102:a48:b0:4b1:1565:f4f1 with SMTP id ada2fe7eead31-4b2ae7010f1mr3619383137.3.1734546150208; Wed, 18 Dec 2024 10:22:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546150; cv=none; d=google.com; s=arc-20240605; b=Etn7zhcn4uJatzlo4NSOZntF+rqNA6YIdsQMgsNP0DrB9FouhdBBCH7+Q5FDtWdBbZ 5tNK5RXQnCLUltIkolF2ecU5HCPrjJd3zAnay8KXS2gTO/m1R5a6vv7Wp+2GoDnTbk5l B1MvXnkSBjlqW/ggZBjwCw29zJcRvD5KRODe9QEStyYjmulGWZMroPUbK7hdtYx0DEt9 1ZdbIQO8dG5yjOZhHm6R3wJW4GH6ZdbUTdHLY6AO4Y4pJ+nkIp+v/lOIz2RsNjbODdyY vfwfplz9RMKr/3nUeWKhaM+SlisjWx8V0/x6K+uvDpqOfvrkS2xubFZk4jBn2fbANIVu iruQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=exZ5QnwADXlGe9wvGwI3Js3yOyhSQnQyZpyAMP6GlqA=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=hijS11JsiL/EMYS03vulmjpI5NgbRfUR8kYcvvkl4QqXCaF8n+pTe1NX6VFfhKVhRv 7VwZy0OrMdmxouBwec0U5Tc5NIM4f+AoWyo0CihFOOyQTQlZuXWOpztELql5btGi4KMP lMi5keZTVH/qqx6Tuu/zAuCuPSITAlqg8vGZzSUxTvc9EWnWYoI2x7U4pvNGatBGOLGh HEs/XURwg4mrrTzlyYd6IBBCP8waYfe98jLBKMU/qSRtO7/lMh1CkTz7zeGoQkaBqhfQ fKDgutbJ7WUMcT/1i/6xxWxYZk/2Di+Qg99OIoTvnOW0ESqZgyXjHvZATBR3ZaWJVsiM IeQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=od5Fl3mW; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4b2702048ccsi3856778137.33.2024.12.18.10.22.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:22:30 -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=od5Fl3mW; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyfe-00009f-PY; Wed, 18 Dec 2024 13:21:18 -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 1tNyfd-00008Z-I1 for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:17 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyfb-0001kz-Ua for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:17 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3863703258fso719349f8f.1 for ; Wed, 18 Dec 2024 10:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546074; x=1735150874; darn=nongnu.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=exZ5QnwADXlGe9wvGwI3Js3yOyhSQnQyZpyAMP6GlqA=; b=od5Fl3mWnYbf/F/CfuE7Lg9LGoJq3yZQk2kQKLI2UTWJg/MoP7a6vqo/DKYwBPummN AExXNP02oci6M1KAgnOr5SLEkbiaCppiuSOd+lQNb9O3xxYcdARTVdnQrEUlGwWQQdCz wdRmkFVC3FmoHo+i+JqqU/PnHhMbyK9RvMXfFhfxEW1irELikxmnKAwi6vxnAi+Uuq80 YOuzWSDkMAmoMCV9DbRLvrSAKh+whux0EQobbntNmk0UTYvEBVro/Rpnx7EeChZRqh01 2W7Y5mSLlk46XpPQgjLkHtnaiZhp4gXazYyEXl8q+TQiwGO0GHFv0uWjg9IWOPTJAqJ1 9nOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546074; x=1735150874; 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=exZ5QnwADXlGe9wvGwI3Js3yOyhSQnQyZpyAMP6GlqA=; b=jxCRCosTT05r7hMR7AAxuAKMNKectXWUy56bpxpy6PBB1ESRwshqHWfeYfS1DDxkmB 9PQ80tmIxFyzCEu3CnQEOZrlp+5puk0SlNkz+sUk47Wa1q1JSWs18fOhn5UCIlbXcHrg M9kxZCo2E5U4zfbiEeQSlSnCfeKggalXUjh0JEQaUelDbzCmRtMZEuMjMNjg66/fNTZM 724Ythweu7kZNIDGNtQ0QF5JjyMjlWgrVo4xctg0U7TvNkzaEMEBq6l2jMgwc/bNCtCh kox7uQv/Ce5xUJFVaZZBlg6v50ebUkObRn4r5vjoVNQelI5jXfT47eIm1/+zZzj0lYUK nflA== X-Gm-Message-State: AOJu0YwrQ6LG5EZ6m//DZLXUUeIml/qDjyxJEf4yswRo8t+ijqbUhATB Dg8gKQGV6SowBpFxzVCIgOQdMtcnAiVlVyhH245reOe11ymzYOrVttlLRL1mpgycm7496b+AdHd / X-Gm-Gg: ASbGncsneFs/acua35eOJjmo6l2hv6q0CajdfO8pxWSfJCfEs629cPA3kDngOlMztmA QrhnnEH2O7ejex3X6CgtzFyN4rpIa+/pKijMhmeNK5ozLeuF8Os2ONX73gnRDa1Zd4WcW5iXwId Dcd4Du/8hoUZBaSNRHKDLjT4X/PTm9Yuo1cd+mgUh40fl2x6sAJ3fM64LTGOLOVU7r0R5CQ6S0V /5Z9aY0EIZr5OvNw5u+TFd+dC1hEmVURzrtLOXxAqBpGp/F+Lmm21oUWqSkNhYxrynFyh2r7eAl GUtD X-Received: by 2002:a5d:64c4:0:b0:386:321e:f124 with SMTP id ffacd0b85a97d-38a1a20e85bmr286357f8f.13.1734546073746; Wed, 18 Dec 2024 10:21:13 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4364a379d69sm54592225e9.0.2024.12.18.10.21.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 1/7] meson: Run some compiler checks using -Wno-unused-value Date: Wed, 18 Dec 2024 19:21:00 +0100 Message-ID: <20241218182106.78800-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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=unavailable 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 When running Clang static analyzer on macOS I'm getting: include/qemu/osdep.h:634:8: error: redefinition of 'iovec' 634 | struct iovec { | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_iovec_t.h:31:8: note: previous definition is here 31 | struct iovec { | ^ 1 error generated. Looking at meson-logs.txt, the analyzer enables -Wunused-value making meson generated code to fail: Code: #include void bar(void) { sizeof(struct iovec); } ----------- stderr: meson-private/tmpe8_1b_00/testfile.c:3:13: error: expression result unused [-Werror,-Wunused-value] 3 | sizeof(struct iovec); | ^~~~~~~~~~~~~~~~~~~~ 1 error generated. ----------- Checking for type "struct iovec" : NO Code: #include void bar(void) { sizeof(struct utmpx); } ----------- stderr: meson-private/tmp3n0u490p/testfile.c:3:13: error: expression result unused [-Werror,-Wunused-value] 3 | sizeof(struct utmpx); | ^~~~~~~~~~~~~~~~~~~~ 1 error generated. ----------- Checking for type "struct utmpx" : NO Code: #include int main(void) { /* If it's not defined as a macro, try to use as a symbol */ #ifndef optreset optreset; #endif return 0; } ----------- stderr: meson-private/tmp1rzob_os/testfile.c:6:17: error: expression result unused [-Werror,-Wunused-value] 6 | optreset; | ^~~~~~~~ 1 error generated. ----------- Header "getopt.h" has symbol "optreset" : NO Code: #include int main(void) { /* If it's not defined as a macro, try to use as a symbol */ #ifndef VMNET_BRIDGED_MODE VMNET_BRIDGED_MODE; #endif return 0; } ----------- stderr: meson-private/tmpl9jgsxpt/testfile.c:6:17: error: expression result unused [-Werror,-Wunused-value] 6 | VMNET_BRIDGED_MODE; | ^~~~~~~~~~~~~~~~~~ 1 error generated. ----------- Header "vmnet/vmnet.h" has symbol "VMNET_BRIDGED_MODE" with dependency appleframeworks: NO ../meson.build:1174: WARNING: vmnet.framework API is outdated, disabling Fix by explicitly disabling -Wunused-value from these meson checks. Signed-off-by: Philippe Mathieu-Daudé --- RFC: Probably meson should do that in has_header_symbol() / has_type()? --- meson.build | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 85f74854735..9d93dcd95d7 100644 --- a/meson.build +++ b/meson.build @@ -1189,7 +1189,8 @@ cocoa = dependency('appleframeworks', vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet')) if vmnet.found() and not cc.has_header_symbol('vmnet/vmnet.h', 'VMNET_BRIDGED_MODE', - dependencies: vmnet) + dependencies: vmnet, + args: '-Wno-unused-value') vmnet = not_found if get_option('vmnet').enabled() error('vmnet.framework API is outdated') @@ -2713,7 +2714,7 @@ config_host_data.set('CONFIG_RTNETLINK', config_host_data.set('CONFIG_SYSMACROS', cc.has_header_symbol('sys/sysmacros.h', 'makedev')) config_host_data.set('HAVE_OPTRESET', - cc.has_header_symbol('getopt.h', 'optreset')) + cc.has_header_symbol('getopt.h', 'optreset', args: '-Wno-unused-value')) config_host_data.set('HAVE_IPPROTO_MPTCP', cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP')) @@ -2731,10 +2732,12 @@ config_host_data.set('HAVE_BLK_ZONE_REP_CAPACITY', # has_type config_host_data.set('CONFIG_IOVEC', cc.has_type('struct iovec', - prefix: '#include ')) + prefix: '#include ', + args: '-Wno-unused-value')) config_host_data.set('HAVE_UTMPX', cc.has_type('struct utmpx', - prefix: '#include ')) + prefix: '#include ', + args: '-Wno-unused-value')) config_host_data.set('CONFIG_EVENTFD', cc.links(''' #include From patchwork Wed Dec 18 18:21:01 2024 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: 851752 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078116wrq; Wed, 18 Dec 2024 10:22:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVqQiX1GNM/HcvuDZSXw0qCH6VkrJP2WADhAYkVPnPKWnIoGsemZc1z6g1cy5R9Gs4/RvcXTw==@linaro.org X-Google-Smtp-Source: AGHT+IGvEj/pEXoINJXfBjx1TdQVROKN0Ao0jaN5EGmFSPSuogzcqBF1AMTa7478IwRkYZwY3S/0 X-Received: by 2002:a05:620a:1992:b0:7b3:3657:9e5b with SMTP id af79cd13be357-7b9aaa681b4mr53250185a.26.1734546156357; Wed, 18 Dec 2024 10:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546156; cv=none; d=google.com; s=arc-20240605; b=FSxJpfHP3TIWVexnYcOOzndIjOaDf6cXQvqfHAAKyu7Cu8gtMMM0Tm3Yh7e4lF5Wsn lu4J0WlldFysrSpFAtYw2XXWQ1HmbPo8Dr+OwmXCP7UUapZygNyxfqr4q2BUDEwfHsQq ba6WGJyLJXoNiLABLitRdpSC2mTZy4Scxog4ZzfdPQGJWZjy5/5HH2EoTcgGf0lUPFrl 5Z0PTzt7J89EA3R9E+wRE8Ew617Q087dfvbJTkzTgASbkOHq4fVyu3xxpKjyoqcOZwcw TcqMy+wju/cazncL3+Dd9pMsA81YKB3AsAUyoXHJABDvHBkoZ8JKFSnuRYbRrtWrBgnH 5OuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=eQzhvPTiN3ivier5WU2Y9S2wBlcJwBk1Bj+vHdELx1w=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=IN2IX7LzVNd7+ym5BQV+NixiX2p3pKjJiyaK/APLdc3/GtCH2qUTt8NnbhmIlb6yQO E7jF9/MDP0CwBP34pcTKJMcNPTYdP8k8CWLgEITfgP6dTGXeG6/nAciiY6TnrhPALCi3 PAvc2kWJKEH1YC1OSYfBh19SlCRfQlvGRkHahPYplTpV1ErBJeTShnZCDaqW1giWlXOy rYXPCq5IgjYiuqe7OIznxPn/TBE9ydzxmXRaGjYJrKoT41K7f3HYuQVL7w3mjvX9t2oc 6KmRZqplzqqily+jKkAwETnvja64CN8uJNdoLyCDOHIzhWQUfSnlnpzyWphSj0v0s89W aIjw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pCZ52Q0X; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b7048cc789si1247596085a.372.2024.12.18.10.22.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:22:36 -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=pCZ52Q0X; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyfk-0000Aw-CP; Wed, 18 Dec 2024 13:21:24 -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 1tNyfi-0000AQ-9Z for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:22 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyfg-0001lW-CO for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:21 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361f796586so75055425e9.3 for ; Wed, 18 Dec 2024 10:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546078; x=1735150878; darn=nongnu.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=eQzhvPTiN3ivier5WU2Y9S2wBlcJwBk1Bj+vHdELx1w=; b=pCZ52Q0XA4V4Zhs2dMpJETiMJZDmnulUfl5FOdn7+7yp6JPG8ci3Z6o2O5AKPYpSFE SjyT990rWaAqpB+NWCjOZualCeMp0Or37Gd3g4uXMurkMBwAq1Q3r0lxBwmpRXGwr8CV JLALKRB7rReh0IO+aTc/jEfd4OqN7b76MnHUV4jRWS9BfTwmbUDwG395PiJjxzwy1KvY /HullH9rniHli/fGJPogkW/N9ZgCHvkAwogz7B53BnQZgRTOQudt7gaTfgXuAxkmykxn OYmOOTBBlW7NbycikHfxws+8rxPRbksoIV2WKSmCgmLoWLWzs97IUb8WhUUIGh9qcZel NqQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546078; x=1735150878; 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=eQzhvPTiN3ivier5WU2Y9S2wBlcJwBk1Bj+vHdELx1w=; b=ffAgubOz30fUpEbcSdatEJYJPUT2h3QANq6SqcoV4M47d5WZ6HHGFTVTtH8UBnakTs s7fuKFcTHS64/IHPSiAZu2dSp1HLixJpy7Kem7YGbWZKmfHYoxvmurkAsI5WZ/cXs9uM nNL8OpMB8fKgPlLzEF8lcCisbi7QclxMGFbsRECwDchVzeFjsJHdFEhCCg7EeuYF6e0k zGSd8Zq8B5py/AklWYyGNCFHxPoP0Mx3AlotZCTWx0fAiRxf2jh7ovZfkkKPUVRIj6Et IKarlzCJuFeftq88Wax1URFvGGSrrWGzEsiQH1BJ/b29HaSNrNId5ul9oc2jsAlg6iHG xF5g== X-Gm-Message-State: AOJu0Yyk0JTKSzf8uxj0EP0CyrR115o+cZUmzuZAjXWT3syU/IHp64K8 vC9RoHyz+xVg9r9aGly9El53u5ut3SLS2I7Q7pzJwrV4AudKt+gs7uEICSQ+KZNT/zXO8T7H4dL N X-Gm-Gg: ASbGnctCYqemzcYKUMasa/n8mnRgvxOEKWnv2755iGSZydQbxgMjna58RERJpdiqHTi CvTky3UNKCq0BlqKypOgxCv8vSTta2s4c/cQY+viWGXa8JILMcLX5x+ZhOs7/4WtdztinVtfuhs 2wP33zMSCYz4btACCZVsO09hRgEW3RklLX1RVuhBSa98zA0Dts/4OZaFp1ZZS83z9+lB5qahmte X3SAxtZNW+izKrgSRGlYItdAkB4a6O+RDo6RggXutcFplYlw3zucZ5X0PDUs9XKKid2kbVaGLnG sUeN X-Received: by 2002:a05:600c:1c21:b0:434:f131:1e71 with SMTP id 5b1f17b1804b1-4365c780d16mr3163225e9.8.1734546078401; Wed, 18 Dec 2024 10:21:18 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4365d116d8fsm1106755e9.17.2024.12.18.10.21.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 2/7] hw/ppc/spapr: Convert HPTE() macro as hpte_get() method Date: Wed, 18 Dec 2024 19:21:01 +0100 Message-ID: <20241218182106.78800-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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=unavailable 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 Convert HPTE() macro as hpte_get() method. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- hw/ppc/spapr.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3b022e8da9e..4845bf3244b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1399,7 +1399,13 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu, } } -#define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2)) +static uint64_t *hpte_get(SpaprMachineState *s, unsigned index) +{ + uint64_t *table = s->htab; + + return &table[2 * index]; +} + #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)) @@ -1614,7 +1620,7 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, int shift, Error **errp) spapr->htab_shift = shift; for (i = 0; i < size / HASH_PTE_SIZE_64; i++) { - DIRTY_HPTE(HPTE(spapr->htab, i)); + DIRTY_HPTE(hpte_get(spapr->htab, i)); } } /* We're setting up a hash table, so that means we're not radix */ @@ -2172,7 +2178,7 @@ static void htab_save_chunk(QEMUFile *f, SpaprMachineState *spapr, qemu_put_be32(f, chunkstart); qemu_put_be16(f, n_valid); qemu_put_be16(f, n_invalid); - qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), + qemu_put_buffer(f, (void *)hpte_get(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); } @@ -2198,16 +2204,16 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume invalid HPTEs */ while ((index < htabslots) - && !HPTE_VALID(HPTE(spapr->htab, index))) { - CLEAN_HPTE(HPTE(spapr->htab, index)); + && !HPTE_VALID(hpte_get(spapr->htab, index))) { + CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; } /* Consume valid HPTEs */ chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_VALID(HPTE(spapr->htab, index))) { - CLEAN_HPTE(HPTE(spapr->htab, index)); + && HPTE_VALID(hpte_get(spapr->htab, index))) { + CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; } @@ -2247,7 +2253,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume non-dirty HPTEs */ while ((index < htabslots) - && !HPTE_DIRTY(HPTE(spapr->htab, index))) { + && !HPTE_DIRTY(hpte_get(spapr->htab, index))) { index++; examined++; } @@ -2255,9 +2261,9 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, chunkstart = index; /* Consume valid dirty HPTEs */ while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_DIRTY(HPTE(spapr->htab, index)) - && HPTE_VALID(HPTE(spapr->htab, index))) { - CLEAN_HPTE(HPTE(spapr->htab, index)); + && HPTE_DIRTY(hpte_get(spapr->htab, index)) + && HPTE_VALID(hpte_get(spapr->htab, index))) { + CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; examined++; } @@ -2265,9 +2271,9 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, invalidstart = index; /* Consume invalid dirty HPTEs */ while ((index < htabslots) && (index - invalidstart < USHRT_MAX) - && HPTE_DIRTY(HPTE(spapr->htab, index)) - && !HPTE_VALID(HPTE(spapr->htab, index))) { - CLEAN_HPTE(HPTE(spapr->htab, index)); + && HPTE_DIRTY(hpte_get(spapr->htab, index)) + && !HPTE_VALID(hpte_get(spapr->htab, index))) { + CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; examined++; } @@ -2449,11 +2455,11 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id) if (spapr->htab) { if (n_valid) { - qemu_get_buffer(f, HPTE(spapr->htab, index), + qemu_get_buffer(f, (void *)hpte_get(spapr->htab, index), HASH_PTE_SIZE_64 * n_valid); } if (n_invalid) { - memset(HPTE(spapr->htab, index + n_valid), 0, + memset(hpte_get(spapr->htab, index + n_valid), 0, HASH_PTE_SIZE_64 * n_invalid); } } else { From patchwork Wed Dec 18 18:21:02 2024 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: 851756 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078269wrq; Wed, 18 Dec 2024 10:22:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVMDVehkzcwzaiMoOR8+d4WVigNRgSRd9HkMoniunTO/H/Ehm7BhSTqaL4zIDp0sL3BDyx/5Q==@linaro.org X-Google-Smtp-Source: AGHT+IEK8IY3B/WbYWZ7hW+1ezoH6bRJ06Nt9mSUmsM5NQCOx8dDalU25vZvXLThZcerhegpIzzB X-Received: by 2002:a05:6214:4b03:b0:6d8:aea3:e27 with SMTP id 6a1803df08f44-6dd14c97aa2mr11160866d6.44.1734546173443; Wed, 18 Dec 2024 10:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546173; cv=none; d=google.com; s=arc-20240605; b=ZnZ5+XdnB4+hd3md+YjRS1LpxuaujPqhdDjAfq9BlAu5GBTp+8rw4CGC+ROVXXxZW1 IvhLUr3yCLX6/c2wTg2ljFDBQcVtYu2PQ9IGx/jusitHiCb3kZMgUcWUaQ9LJcb46JE6 fIcEZffc9H3xNnQeOMpjiUHaVfxsDc7ya341Qab/LUi2usS6CSznXzesBXhtv1y7MleL vAQ6DzVtKWy5HztEmdZUtoKYItWZEyyTP9YqtrgOONjtuexRWfi8DOwPPXBEuDLqOyCi gTqo+pGx6fIrHK2emM8Kko8yMH4rTmNhPYAlltA8IW8AweMNDwo5/QVS/JJj2d35dtop VcoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=O5jlRNCwvAALfsOlYNnOtkyFgySWMX0tusYOjYmCCCw=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=X3KgWbF7Vnr6AZTfs/m9JFnIBo2bGnBr9f3jySXpLTy0XlBpw2KPjdT9bwEbZOPBAc dlw84g6kyWz459Ck2jySf/99RqJbJJnvE1P62K/b1d8b2cE6apBZSgZA8utQl2JteLIP 0l/adJIHWzHNoEIX586Q99j2pypKBmL9lKPuintBUEP0RruwUBM2hYbpmPNzYxU1zqAF BQegEgly8am5yBREJAfl6115R3ryom6Zq1JpFgH1M0/a4HhvsZmJQxiUER084XyeCqtl 3vDwOQf6NSqe7yaVHcsBD8D7lgkGgIe3CKmuOlumGTQqhju7OV7A/bxfbY1PkqwJrGoh gCcg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mz1hhEWe; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dccd3b7fedsi133223166d6.528.2024.12.18.10.22.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:22:53 -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=mz1hhEWe; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyfn-0000Bo-Mg; Wed, 18 Dec 2024 13:21:27 -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 1tNyfm-0000BH-9k for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:26 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyfk-0001mF-Qe for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:26 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4363ae65100so45282595e9.0 for ; Wed, 18 Dec 2024 10:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546083; x=1735150883; darn=nongnu.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=O5jlRNCwvAALfsOlYNnOtkyFgySWMX0tusYOjYmCCCw=; b=mz1hhEWepn1UPaXIdlP/XwfiHzK0xu2LRs34VJg8nxEog9JIckjBNHk+suenW+DEvU 0hqBjG5/rhwQZ7K9ucw4c0j4/sW+YVdrZzDX2JkrKM5tem+8zFvB6oUiQdIUFtOi4Vt7 WOVZpSzvt5YZLx/tWauD/w9AvWDPULqEKU7TfWO588EMAz2wXaKwgsQg/UKoFzv42S6f x7roVjvBpPkGWix5vpcxkRkDnYz7KeIMBfpMBnfsiZqDrMM+mLf2IaPsoRfqTviG/I1K t8fqHnpbbeeOnvNwZc5W4XWAUhwjFF+BJ03kFU0xh1+4Ai0vKRYSNd/s/aZzL7/nIeuG YlzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546083; x=1735150883; 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=O5jlRNCwvAALfsOlYNnOtkyFgySWMX0tusYOjYmCCCw=; b=LgQhm9LYOkM5Lq1QH10/z2p5Tt3xWYfNhzViDqZQbeaBQ/3E6rnSaGfAS+FuGfLoIy OAT9ujDc96ZtCWKS1+pDUklI9WYuP0um7APht8P2L38WsGdlv9UzBJUjijFjR60dQBu3 1jWZD1QMsmJ8che33kukIUOhfFj9Lycb7iO19Mra2sL15zuacJmuU/nHA9vdm653qNBL g7yxoMVq22fxtiZB2lJypdr8+Bz2ja4wozaXODiAlQGNc/A7F0XIC/4zJ2nMBpavuD/w WmU4tCFehC8Smkn3/aSViIVQDIqWRxmYhwQXRsZgrFMPXtZ++KodOSuMO2/hv0FvyjyA Z1Zw== X-Gm-Message-State: AOJu0YwXLcUyoOAsLqKAA1IRfluZyQPIBYVVuix6Fxa6PgzOdbIKGXFN OAMrJunf3xMRjLsUbG4ymMrO+zG/GpN74pcWkJ5sCS3ej8SS9kd086Scf7zT5Pa4f3Py5L7zERo T X-Gm-Gg: ASbGncsPdo5VfRB1RES2pdTo6JoM+uoyvGHBJZmPTxRxUQsUEbXR9NkJLjXdyjBEzp/ 56v5tI/itz5WWXyaNXNf1t7PBAPshQGWVh800KwnSbBB4fGiLANAQynoJ6jfpxR8OgXm+XbcWFq uc7kVD5P3hpOgm/+sVXS/ZDFnbdu2na7bud6R+0tkU8uvTyg2DnHuv4r4rll/E615CsxBtYociL aQRnhP/xRGWFKMgf3RL62DqNXs5McO+s9u8TdYy2bdPnVdWIYX13YNjqsVHWl8Mr06DX6XOgd/r nVpv X-Received: by 2002:a5d:584a:0:b0:385:f062:c2d4 with SMTP id ffacd0b85a97d-38a19b34bfbmr656937f8f.37.1734546083045; Wed, 18 Dec 2024 10:21:23 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c806086dsm14570843f8f.91.2024.12.18.10.21.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 3/7] hw/ppc/spapr: Convert HPTE_VALID() macro as hpte_is_valid() method Date: Wed, 18 Dec 2024 19:21:02 +0100 Message-ID: <20241218182106.78800-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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=unavailable 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 Convert HPTE_VALID() macro as hpte_is_valid() method. Since sPAPR is in big endian configuration at reset, use the big endian LD/ST API to access the hash PTEs. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- hw/ppc/spapr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4845bf3244b..b67ab1ee685 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1406,7 +1406,11 @@ static uint64_t *hpte_get(SpaprMachineState *s, unsigned index) return &table[2 * index]; } -#define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VALID) +static bool hpte_is_valid(SpaprMachineState *s, unsigned index) +{ + return ldq_be_p(hpte_get(s, index)) & 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)) @@ -2204,7 +2208,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume invalid HPTEs */ while ((index < htabslots) - && !HPTE_VALID(hpte_get(spapr->htab, index))) { + && !hpte_is_valid(spapr->htab, index)) { CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; } @@ -2212,7 +2216,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume valid HPTEs */ chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_VALID(hpte_get(spapr->htab, index))) { + && hpte_is_valid(spapr->htab, index)) { CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; } @@ -2262,7 +2266,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume valid dirty HPTEs */ while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && HPTE_DIRTY(hpte_get(spapr->htab, index)) - && HPTE_VALID(hpte_get(spapr->htab, index))) { + && hpte_is_valid(spapr->htab, index)) { CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; examined++; @@ -2272,7 +2276,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume invalid dirty HPTEs */ while ((index < htabslots) && (index - invalidstart < USHRT_MAX) && HPTE_DIRTY(hpte_get(spapr->htab, index)) - && !HPTE_VALID(hpte_get(spapr->htab, index))) { + && !hpte_is_valid(spapr->htab, index)) { CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; examined++; From patchwork Wed Dec 18 18:21:03 2024 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: 851754 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078264wrq; Wed, 18 Dec 2024 10:22:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWSg4L4shr+qqADxnKLZfOvLozy4cVZTCHkEK8IFEUCmZUAlnu9OvaUYQ7c38A/J8YwQnjddQ==@linaro.org X-Google-Smtp-Source: AGHT+IFPJmmwIsUmBrNMrWOvk3CDa05axsgVHtjfl/pi8hH8J6FXw19UzxOA8k1G8GE0BpVIvTJn X-Received: by 2002:ad4:5dc8:0:b0:6d4:1425:6d2d with SMTP id 6a1803df08f44-6dd09259bf5mr56369196d6.43.1734546173051; Wed, 18 Dec 2024 10:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546173; cv=none; d=google.com; s=arc-20240605; b=KnKaMLkRp1clS8VhvIoFpLx37tLXjrTr4oB+oXnMbnHAUl/vPQoCEFlmfZ95aQYGcT 5XpYHe021prkhqZovQNzQiPa36AhkMrt9I21opsbqRsneYOsqoogW+BTmXW6lwJyD5gU DJCvrpJ3Km8WB3PH4410ekkLnKVYdkzuPf1PJu2Kz8KHggcHvwsa0GYImGEMqmCXsrxE SkGDN/vL0QBooJXZRzAkQRvP3WkXoSU2N6WHRU84cFy2MuoKbaxUqijc+VkFLgSPHNiV 1HaH1kDAdOm7MyaxslZOePr22xT2VL1DBRg5E46aDOZoAKcxmmZWcqWFLtwG/U3UN5Kt IiMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=XIyUHiJKQfSfPVBPMnG+jU4xHnWZoadB6o95UeG1dIA=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=NhQxu6qB+XQAklGTyCyLOPUHd/E/qITwTpNJpMeNWpY6iPTRjFUCUTjxxhPSWVsfdC u7vYthxPa4eQk1P7WXLmjLBhQdnhYeR+lDMVgjLCPgLqlzweVFoFzsvWADrbeAQ/lslI f7QeStewscBsB3XuA1RtU8A/7Y5cqbwycTTUBa/gH6Rnc2MKc7VCd2Qo70urReP6aByv Ra/+Z8Kj0zFu9lit9KZTdL9WKD2QzOze/4RUx6V2irNkb++ixIr0taU+cRsqwThqEri9 9Nsg7+9i8cKmn/cPDi/bpO52AXUrfepzbjrbxB5cX5GJ1vVBbChBpWJ4hiVbxwaTu2lK SHOw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IhM0eBqH; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dccd1cb22bsi133964606d6.175.2024.12.18.10.22.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:22:53 -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=IhM0eBqH; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyfv-0000Fa-Ea; Wed, 18 Dec 2024 13:21:37 -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 1tNyfs-0000CL-Lx for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:33 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyfr-0001mt-4D for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:32 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-432d86a3085so45895075e9.2 for ; Wed, 18 Dec 2024 10:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546088; x=1735150888; darn=nongnu.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=XIyUHiJKQfSfPVBPMnG+jU4xHnWZoadB6o95UeG1dIA=; b=IhM0eBqHPQ5tF+gnDsIiMo3neml6cC7Cxcu8mKAOM1UMp+Wi7PXQzGssjUrEBrbXoK 2JHzMORsyuwcOiESV4n1A8c1vwsmN7ezC9haK3E5AMlwO5wlVSPJXkhvm4hmGDkB4Eff 4ADjkrmYm1MJDle3xoYzF/SyRaWX+kjYfYqC9pjk6qxQgv7fmQ47KgOdEi7w0l/xSt3b 9Kxp0mznQq5qtlpJpAo3ZrIJQIutJpI3KmlKNyP5DLexC2WaxqKhrPX0f6yeDxUZG4nP KSQsC7nnMlwhw7PfN1WjXj1QTG5eAp5ZYEqZhbBOZzXWQJnBinBMPwV4XbUdyn4TWovd R0IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546088; x=1735150888; 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=XIyUHiJKQfSfPVBPMnG+jU4xHnWZoadB6o95UeG1dIA=; b=L9adO3oZ2t3w/Run8l+w0BFUzpmSOFi6pAlyPzSeyr9RteRx8KRRkpPCOZWnpW5cS+ Ga3N72EE/v6J2TBo9u2cGsaijp9lhuAd6t7oOd4W1bWKijM5Afl3SfGu7INhgaYEgU9/ E5tCOXTTBYSvS5NC8JOpmqypp+T/XHXGS1H4Dae1oBxvYvdDZSXGn9bWvDuBYxaH8kjr uayei6IGfDGo46hmAMhYwL3kkuQk8fSY7gjR+UGAp6+W4LzYdXY+FVK8Uo0QRSQ4WjzV 5HiF+Mtd5Fo7jTOgE1IlmwT3/8kmE5A+MkDYL8QKhcyZMxbnahjUs4XMB8H83sikEOot VWsg== X-Gm-Message-State: AOJu0Ywf9vbl9F8dPVohPsEgXEE6Ndaq16DhciB+qTil0/COSoVGKcst /wWUoT4LGqNwyWh34WaTHY8PYLZbKmRuxJEE8yXI6Lnlq7fVNzAVH3n5WAhXHZlVLwy7SaVH+NS S X-Gm-Gg: ASbGncsOmBx24nMC6uvku8HWVodwTAZbpIioSI8ojeuEGgvhf6hCyC9BlopdzYeX1iW LmOsWUrcwWc1AqYhbE3bTr3W/Ix1UcX9d0xsP2Zr62wYTbFFsMQG+9eDTgQ7TD9vWb3Wc8LA7UZ +nuHDA+esFWHNNmyKHMuYPnGRvUAye9hbfPWy06jU22jBOjd8FTXZwq7SsDQfNdZNMQC/z/cTeu wXKccU8ptW7b5hx/uW4nT3y7b0NCMCDbSC9j90BiKo9/OQ8huur7XXDJaldaR9bGlPK1NKfB/22 umtY X-Received: by 2002:a05:600c:1c9f:b0:434:ff25:1988 with SMTP id 5b1f17b1804b1-4365cbb450fmr2189095e9.32.1734546088499; Wed, 18 Dec 2024 10:21:28 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b013e1sm27190955e9.12.2024.12.18.10.21.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 4/7] hw/ppc/spapr: Convert HPTE_DIRTY() macro as hpte_is_dirty() method Date: Wed, 18 Dec 2024 19:21:03 +0100 Message-ID: <20241218182106.78800-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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 Convert HPTE_DIRTY() macro as hpte_is_dirty() method. Since sPAPR is in big endian configuration at reset, use the big endian LD/ST API to access the HPTEs. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- hw/ppc/spapr.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b67ab1ee685..5bc49598a97 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1411,7 +1411,11 @@ static bool hpte_is_valid(SpaprMachineState *s, unsigned index) return ldq_be_p(hpte_get(s, index)) & HPTE64_V_VALID; } -#define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_HPTE_DIRTY) +static bool hpte_is_dirty(SpaprMachineState *s, unsigned index) +{ + return ldq_be_p(hpte_get(s, index)) & 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)) @@ -2257,7 +2261,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume non-dirty HPTEs */ while ((index < htabslots) - && !HPTE_DIRTY(hpte_get(spapr->htab, index))) { + && !hpte_is_dirty(spapr->htab, index)) { index++; examined++; } @@ -2265,7 +2269,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, chunkstart = index; /* Consume valid dirty HPTEs */ while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_DIRTY(hpte_get(spapr->htab, index)) + && hpte_is_dirty(spapr->htab, index) && hpte_is_valid(spapr->htab, index)) { CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; @@ -2275,7 +2279,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, invalidstart = index; /* Consume invalid dirty HPTEs */ while ((index < htabslots) && (index - invalidstart < USHRT_MAX) - && HPTE_DIRTY(hpte_get(spapr->htab, index)) + && hpte_is_dirty(spapr->htab, index) && !hpte_is_valid(spapr->htab, index)) { CLEAN_HPTE(hpte_get(spapr->htab, index)); index++; From patchwork Wed Dec 18 18:21:04 2024 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: 851753 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078216wrq; Wed, 18 Dec 2024 10:22:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV/CnNnyPywSjX3F2ZzfRfHzuuvkJkjyFvQu3hXBbvgPPnos/kSHLg02vCIR4JOx6TpZ1XyMg==@linaro.org X-Google-Smtp-Source: AGHT+IHWraQol9hF5ypyHIHsE/qWmdg6mr3mQAHBpAcZKGhE7e4hNnruiuIDyYAxsYRJU/sz4I/c X-Received: by 2002:ad4:5742:0:b0:6d8:8e16:7c29 with SMTP id 6a1803df08f44-6dd14b9c3ccmr10580756d6.14.1734546166087; Wed, 18 Dec 2024 10:22:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546166; cv=none; d=google.com; s=arc-20240605; b=D7gri03L/eli4XgVR/+oqFYD238omLSvjw84/0hm6dEHKkIdW/5t3NkEi9cunuvVoJ qx89ggnqxQp15LOkd2JLkFo5WBewkUigGZ+PqVgmRgukSW9ZX5ZhWC/Ai6aeVnBkg1EF YRUXGgQgziJoBTcMrDyZz8FBQBsgGkHX4WUM2w0kHDTjLGJYGEDb7+VpHCRTvY/5O8Sy Ag+GbVvcqLqCqfPWuA34lne4w0fCSFcGrRdy0KnLyYTLyK3bTZYHPZqPLuPn72rJfFRq L/l2QipeW0mU6YfokAcII19vbmbX7N/GDtBRmCTp+k0sWHyKOz3bIPuFZZH/A+aFcedG FssA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=ORsHx8jiVKr/JQ5fOHZz0x6Kt4tSSuHxrz6OZHh7sx0=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=WIEmYjb2FydIRpSmJg9nLtJBTLAgblVfrIvB8ToOwPyXUt2jfvkBdlruYV2J0atwlM I2yoIAI+wXtILNgMw5Rk+J1CX9O0EVWMfz1oQ6rEc89kGUMx+8EwYDjDp+4fK7MM+95B pEERvIY/OPTuv1qUvdWE8rgKRZUD4oo8MYVGayo2l7zgkZnErpylU4bflyb+w3X1szgj YlVB4neh7sqvam5wp+eUEHeAf3CBF9QJ7EiVhpY6YI33kBbZqk49H4NiqxgiVbXLWjd2 WP7VcXfNQPfKae13jSB1FRs8TKUTBuxvfQ33GeBIeDzPEThuuy8UXKRiN30p+ceYN+Fg RqSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B2TLQ3N7; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dccd1c66bcsi136311996d6.118.2024.12.18.10.22.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:22:46 -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=B2TLQ3N7; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNyg5-0000P8-E7; Wed, 18 Dec 2024 13:21:47 -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 1tNyfx-0000HL-46 for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:37 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyfv-0001nR-HI for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:36 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-385e06af753so3536167f8f.2 for ; Wed, 18 Dec 2024 10:21:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546093; x=1735150893; darn=nongnu.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=ORsHx8jiVKr/JQ5fOHZz0x6Kt4tSSuHxrz6OZHh7sx0=; b=B2TLQ3N7HoIBH9zrdYHi6Rfb5UYqTjnK10QN85KtmDbEjlWT5bRf4iPXCZMdPE21Wj xBwV+J9OZErVSuJxqFXgJrROyjUSea2J+HZJBlbzwsuPtNfJFoK5xKxIL0+EMLs+GRBL QjQ3KaBofe9opnNf0h5rtegBjFBg25uc9C95lnZWPSQNzpUCanx4AO33qPQdSAbU9rvH TfL7SwXuV2NWFqQVP5nEic6RWSl9GpZWnIxK5Bm33g5ETqc0DMA4NMt/4rMXWvGx3ARr Qz3RLsrvUNKSefB6Xq2P0L6AwITo95wDvf4ghv6y/8Gkmi6SyjCTxr3HATTwSJDprrJl 4Fyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546093; x=1735150893; 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=ORsHx8jiVKr/JQ5fOHZz0x6Kt4tSSuHxrz6OZHh7sx0=; b=Ya8R2Abymn2wspVItTVA9uaUVmGoraF0mYIAedwDRTT3n+EtvYD9cEpGPHCYurqJPB 8CXBFfVDtj3VtCwrCYwSUXYORnANtyESiVmpxujD9spE6c1vXqKWhdO9C+8aL8XI9nAX H/OjTs82z7ax6c/JBMqm/WmSrC/9/tK5otsmcw9RcKoGBVcsFy6GrlzbLtfjABO75tl4 XEOScDSogl6x0kODUqFslR0Orzaqm+fJ9lou3M89RrA+VUq9OZMG8WKb1pT9mlqmmwxP 2+Rw+eG3uvZ4gswrJderKOS8bR7FQvQfIe0atVY4D5zstN0RdN6C29s98h1UDj54Y5cg gGIg== X-Gm-Message-State: AOJu0YykntNmarYILLIQyyHmTNs3cco3LsHm3VWorbCD1ECkSU8XE6ow 1uYjVTROOfIVjLok6gxguY9golZb8ukyytuhmkkXH2XAex6Tcx/8F64PHYYnZlmR8wSqkLJw8TJ q X-Gm-Gg: ASbGncsEgGvrufNbEvM9flMKzNuHK0OlQ9NtzKOAXJGN3sjj+DenyFwi26HvOv5GqYS /TCHhIdAMo973D1ykolFxY3mgKIzQUSr8GdN9G8iiaL2lHxuZ7pb0iF0tL5EoZapyUNAJWrZ48u 5XAMjbLl2AHUb5L6oHSI+Nv4ADbE2p+qopoJ+Ian6ztKP63T9u2+5qj0nw6iFs9Lun9r91dajKz PciIg5a/Jxz5/CUhZQR9MNYgUBe8O33WkdShFXyoaXS2Kh51W55YBoXaE1093XRf0IF7PtvTyE7 07yh X-Received: by 2002:a5d:59ac:0:b0:385:f840:e613 with SMTP id ffacd0b85a97d-388e4db57a9mr4069597f8f.51.1734546093119; Wed, 18 Dec 2024 10:21:33 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c8060679sm14498648f8f.105.2024.12.18.10.21.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 5/7] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clean() method Date: Wed, 18 Dec 2024 19:21:04 +0100 Message-ID: <20241218182106.78800-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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=unavailable 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 Convert CLEAN_HPTE() macro as hpte_set_clean() method. Since sPAPR is in big endian configuration at reset, use the big endian LD/ST API to access the HPTEs. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- hw/ppc/spapr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 5bc49598a97..4e1fe832c29 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1416,7 +1416,12 @@ static bool hpte_is_dirty(SpaprMachineState *s, unsigned index) return ldq_be_p(hpte_get(s, index)) & HPTE64_V_HPTE_DIRTY; } -#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &= tswap64(~HPTE64_V_HPTE_DIRTY)) +static void hpte_set_clean(SpaprMachineState *s, unsigned index) +{ + stq_be_p(hpte_get(s, index), + ldq_be_p(hpte_get(s, index)) & ~HPTE64_V_HPTE_DIRTY); +} + #define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |= tswap64(HPTE64_V_HPTE_DIRTY)) /* @@ -2213,7 +2218,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMachineState *spapr, /* Consume invalid HPTEs */ while ((index < htabslots) && !hpte_is_valid(spapr->htab, index)) { - CLEAN_HPTE(hpte_get(spapr->htab, index)); + hpte_set_clean(spapr->htab, index); index++; } @@ -2221,7 +2226,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMachineState *spapr, chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && hpte_is_valid(spapr->htab, index)) { - CLEAN_HPTE(hpte_get(spapr->htab, index)); + hpte_set_clean(spapr->htab, index); index++; } @@ -2271,7 +2276,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && hpte_is_dirty(spapr->htab, index) && hpte_is_valid(spapr->htab, index)) { - CLEAN_HPTE(hpte_get(spapr->htab, index)); + hpte_set_clean(spapr->htab, index); index++; examined++; } @@ -2281,7 +2286,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMachineState *spapr, while ((index < htabslots) && (index - invalidstart < USHRT_MAX) && hpte_is_dirty(spapr->htab, index) && !hpte_is_valid(spapr->htab, index)) { - CLEAN_HPTE(hpte_get(spapr->htab, index)); + hpte_set_clean(spapr->htab, index); index++; examined++; } From patchwork Wed Dec 18 18:21:05 2024 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: 851755 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078266wrq; Wed, 18 Dec 2024 10:22:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUW+fWbnRVHRQWAenMKLdzpojq7FgF+9EZeDwA+SS+4AowIk2E4nLlFaMh1KPqR1GONYQPlZg==@linaro.org X-Google-Smtp-Source: AGHT+IHIZd+9RNbxpXbp+coGfEkHE9bh7pN/nyWtAbYmBQhkxVZkg/CcOhr1tFC9n0em8AHhjngX X-Received: by 2002:a05:620a:4491:b0:7b6:7030:511a with SMTP id af79cd13be357-7b9aa9148ccmr60908385a.37.1734546173155; Wed, 18 Dec 2024 10:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546173; cv=none; d=google.com; s=arc-20240605; b=TXd9P6aky5A3/vuBz83n1SdKDOgaW52gK1hl3Ky+FVbpFUXHLOrwv3jhmhpDhfXgKe mepoYm2DrEI6rGv/qHU5f5RwBEC3NSm2XgjFiHdHW5b/qIQ3C9rmssAO9hSOiOeiDAFE RywVXRbJ7QO37yDzrqkdsHB8DSbYG8zykI/agVCrL5ek9k6mypbz5jP3Opr49yXDeA+7 uqikMlOa1tfYKG4Fc7fsv/NbAx2kskVSM9lT1s7yrdbZvQCI90d/KC2fa35g4uB5F5Ms XG7fkFOgmI8EtqMgk8zh7x5BKB/jOm0x6qMqFvx92Gqeg8f7FaSns17T+dwAjF09sdwe 0QZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=vRCJLMdgZW3KLUCMhAufUiGlbDH+xCju65D/z9uiuwI=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=W0Sarx61F6Qm3xDd/jDA+030rZRxlf2jXu2EjG979JEbIOABtovh/mEefMp4ppPK7c 6RPcxb4bS66nWHEK2BxKvRDaQNjj6z1+1v+pu76KWm0MS7r48KEw+K0hTPE7dFa54Z+U +WYseRRyjyOXCz0RQ5uKtDkvrwt5rgwIzzhUaOrzi2Sc0ZOgfb5nbdS8UGNIGeZ+csdZ Dd0P/065FE6hNVDe0vGAA3v1xoD1IrOagSYtzIRHKbxpH7prIe0S09BcJrXMVUJfVbve k8MnwGrX4sm/+AWVM6j61pJwYeZ3+p9vbZztmOQI13/xHp/MbLXsyoXVVt+OnbyEeKCL jKDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aq4QcoGq; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b7048f251csi1447003985a.633.2024.12.18.10.22.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:22:53 -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=Aq4QcoGq; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNygB-0000WO-KB; Wed, 18 Dec 2024 13:21:51 -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 1tNyg1-0000Nt-7H for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:41 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyfz-0001o2-Nz for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:40 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-385ef8b64b3so1965f8f.0 for ; Wed, 18 Dec 2024 10:21:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546098; x=1735150898; darn=nongnu.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=vRCJLMdgZW3KLUCMhAufUiGlbDH+xCju65D/z9uiuwI=; b=Aq4QcoGqVi4GYDg4+PgknSGWQ/RJNaAQbRlrPB64WeGiT//h9EqIZlJdiT9cbldJXN WEUQK1IwDIWjh6aqkqEw/clTTVJumZ2ZULIJLz5nKJvzrgnECKMUbVQNggeTXpi1L3h/ ir8vqQl4hmDSLghm4hz0bGvqVk4HtPLNdyJANEbHP7ZexYJGzHGgiyQysJGwtqhQXaJl +jQGhJRa93xkqYaotxk46K913na6S1Zwe1QXUGsIDHKhyYGJp86F15z1e/c8piD/DXBt XywNEf/1pugEgt1wJ/WQ2Uq2zrRj48sX+gGmFccFomm7CNJLU4wzXxX6l1GztoSq0Hyu ZqKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546098; x=1735150898; 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=vRCJLMdgZW3KLUCMhAufUiGlbDH+xCju65D/z9uiuwI=; b=cRbKm3lzZvuIOE/s9AwddBKip1Mb0kb+ZNAMk4hh/1GGBqAZ+9JW8hqezQPyfWXAQn qeHLgGOj+Y+Eu1Iwp5+31Feu8h7SCRmeG42SIdOHhYKpCEVdN9Ey7fFPKyOjy9VX0219 bqRdvpwE13Jspo5WmqFffJVnIePI20ern8GdOHGHXmDDA9ohsGnw4Ol6ZEgIsDykzU5a EGUE2IS7QVmGPDjc9fhD24lWAGl6M32KeA+ys14OsHCyWRbM8W4csAvJjk7vKTclDSNX 5sagMym2xYJL+InWQkQ/fuxWtWfKy/yUTK1oNH6unmmYtHelGokTGbRhMG/ILAdl8fSU JwZw== X-Gm-Message-State: AOJu0Yy5mE/0OiMgUh+d9qjeiEtRdwvhdx0/OL+/vstFXX1qvfagrU0A 92R/H+40XGZr2Xe3VNxcWuANCzKQY3rY52WP+tiq9KLRB4I24QhA0K0u5WzLNXhe70wShtH0DbG e X-Gm-Gg: ASbGncvagP4YaAHq498+2NM8+w4p60M4FzOFIkhaOYNGE83vYs+ekHnhhISLThW93GH CRsxLMDXOvIGTxbzMGOq/tQU3NyFbRBNOC8Lf1ETQH+7KtXQQdIXAgaXZupKtrTvkjhiO8h0YZ3 r5ljf2KBNpw6M/1IJnCOLES72KaPDEeoRjUhT67gpgp9CcLUBr59hQbyvhFQvILHGovt+BBGxEP QtLqhd0K7wRBtd4GuJSbtKcrgdmA32jCgU4e9h6JPGAEV2bKQjONzSUCypkpLXobqZzZvFntpP4 uCfA X-Received: by 2002:a5d:6d02:0:b0:382:3efc:c6d8 with SMTP id ffacd0b85a97d-388e4d2dfedmr3282820f8f.12.1734546097835; Wed, 18 Dec 2024 10:21:37 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801a628sm14968029f8f.47.2024.12.18.10.21.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 6/7] hw/ppc/spapr: Convert DIRTY_HPTE() macro as hpte_set_dirty() method Date: Wed, 18 Dec 2024 19:21:05 +0100 Message-ID: <20241218182106.78800-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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 Convert DIRTY_HPTE() macro as hpte_set_dirty() method. Since sPAPR is in big endian configuration at reset, use the big endian LD/ST API to access the HPTEs. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- hw/ppc/spapr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4e1fe832c29..dedf6fb2916 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1422,7 +1422,11 @@ static void hpte_set_clean(SpaprMachineState *s, unsigned index) ldq_be_p(hpte_get(s, index)) & ~HPTE64_V_HPTE_DIRTY); } -#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |= tswap64(HPTE64_V_HPTE_DIRTY)) +static void hpte_set_dirty(SpaprMachineState *s, unsigned index) +{ + stq_be_p(hpte_get(s, index), + ldq_be_p(hpte_get(s, index)) | HPTE64_V_HPTE_DIRTY); +} /* * Get the fd to access the kernel htab, re-opening it if necessary @@ -1633,7 +1637,7 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, int shift, Error **errp) spapr->htab_shift = shift; for (i = 0; i < size / HASH_PTE_SIZE_64; i++) { - DIRTY_HPTE(hpte_get(spapr->htab, i)); + hpte_set_dirty(spapr->htab, i); } } /* We're setting up a hash table, so that means we're not radix */ From patchwork Wed Dec 18 18:21:06 2024 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: 851757 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1078428wrq; Wed, 18 Dec 2024 10:23:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVSeQGaQvjoPpHrmrltIZIvm2IyOnQ9/3DjR9LKIR22AsNepNR8PJKNrUq8+DJfKO6JIzMRAQ==@linaro.org X-Google-Smtp-Source: AGHT+IHV58AaTvSMWjAec2PCITt6qZS3EvmL1ASEY4lf3dXwsEdoroeuDV47uTOI+1mcXTNzptfl X-Received: by 2002:a05:620a:2492:b0:7b1:4fba:b02e with SMTP id af79cd13be357-7b9aa8b4f41mr47767085a.12.1734546191360; Wed, 18 Dec 2024 10:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734546191; cv=none; d=google.com; s=arc-20240605; b=A4vvaeqvVO81FyhYKnH4Xb80vtMbqUdOC0zWOfW2XRDwFxT9KMLf3hd/ARhQ8QnZW8 pxUNiuOQ0yhv+7mWi57xGqX7YGFO373cZqSubtHaVdj97djBDRDeedwf7O/XnGZyUBYj RIcFDtrKvqecp8qT64+cHdlKBKFVnYAAmpLKM6gtvf7YZ021P/I1h84HWOH3yLTfnrpS d+7YjkhL7aWVQQCfeJNURaoFrX4R/wzgFvbn5nM51pxsXGsJ/SoIan7W3v69QDTsjvFA VV0yp5Db3Ot74XyxVGG17Rdk3hBhuXQ82zhFI6EDUYzK+x54YdnHJ6YSmHm+W9O/5doS Xdug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=wByjU5ClK1ME+AZ2OTGYKkBeJBTU4EpbHV73WRFFne8=; fh=aDK3AYW/tYhipRsN4fimbcHK1l9GCjVTlWyiAdYPq8A=; b=csy2X9jKTEz6q9lMVUpnZnEfM91sGZdfiWXeHyfoIgbbrFpDVLD+h+yBLSm8O2+H7q D8X5XzUqfAWIEzTLbBCy5gtAadoBJ4kDdc8uPFUyVLCSQ44lSGhwbbbghp4RHHYW9HoE /Eo0s9in6rRy9xDMCx0CPw3da/mq5BcLYsHEW1f23fr01tz+3Cs48GuPeI+1xZD2g9Eg 3NNRVps1k0W+jRss21tFcZFVNM8LqDiCQhkml/VeFIpueDb3awgxV4Kf8Tz8dH1Upyyl uBkCb9XUf04/882TB8S1gLI2WvufSNIP1SHdSYxRj6b/Vdsbih2kTTXRhwA7gg7ieFmL WQUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MGyYA0X5; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b7048c0250si1230327285a.213.2024.12.18.10.23.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 10:23:11 -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=MGyYA0X5; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNygB-0000Vj-9l; Wed, 18 Dec 2024 13:21:51 -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 1tNyg6-0000Pe-SL for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:47 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyg4-0001pA-7Y for qemu-devel@nongnu.org; Wed, 18 Dec 2024 13:21:46 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-434b3e32e9dso73321125e9.2 for ; Wed, 18 Dec 2024 10:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734546102; x=1735150902; darn=nongnu.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=wByjU5ClK1ME+AZ2OTGYKkBeJBTU4EpbHV73WRFFne8=; b=MGyYA0X5iPFczs+R/0YE3fuxq8mCs8eDC22X3mXKzGrdAhL4MoiDgXwD+I+XtNlkbE vN0IxugRsQ49eFQeeDj0553MUwWjWEWCuXVQgUpgv1c5XW4CvabVMAaqamsEkuct5hZ9 8apzjaXKNS0RRgoQbOZaQvQYxaV08ah1FBQbc8YlryIpjFspZLjnwsh8PdyYwirq8fNd HPlTIpJ4rVcvnyk+Oa05vjjzcCMyY40+TWhiCR6BlXud0wHi8ZvpcQBuIUz9zdjnpeX3 MjrkQ8JOPBf7VrghVcFBSqIW3B2wCua1M+SE/bUjENPMGDSHCgwkgefiwn9dyZBeLA6t wvWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546102; x=1735150902; 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=wByjU5ClK1ME+AZ2OTGYKkBeJBTU4EpbHV73WRFFne8=; b=h7ChY1RMvOBzF7J/3aQJC5cmtj6Jux4S5KDkr2m9FpD6OezQeBpIhzjqGnOT+7sXH3 LWAJLqzpm066US1uE8L9R/CrMY5sR4+o7Dp24ybmTAhOb0Wsb9t6+JxWpHWCyyg5KH0M Lo49LBDvxeVR7vcYOwTxqBbfV5l44tZMD1DuLlH5jNnSUEHfrckOQrqjFxU4XGpaSETB mvvu0c93yR9Gf6wN7IjqK3e+BhcUqVW+ZojXp/zcgDZXHSWnva//KoM2IOFlrdxyFKNp GvbiTNEVL3o87l9Lq8oveGv2fo6zFiiQ2TQFq7TlepfCzDLdGP72THkEyh0s2smhNwMF Uv5Q== X-Gm-Message-State: AOJu0Yzu6438ph/QNXngQBH+dSTXPDx7gIPW/YOQ2SsJrZR2cF1TXZfB 00djEeX4maEBAR+eJ+owx+Upj+pUVCI3vg+Jkk+2P79g7xjTsN7Fv81R88vuObvArslAZ3HrWa2 1 X-Gm-Gg: ASbGncuhUdbhN6W4zqBb8MyzB1Rv0kBcs8oovGSdHYslGv8IYm2jHRNNAH9C5oencsh OG442JLklwImNC5O2xq17JDSn/NEyQk+8qg+njkUNBXJ3LjgsxO1v0hiilRtpw0zWnB8bU+fjG5 LbOb8zNDa7ELLnx5oV52omieFPTDDPqRBmpDkMsj9qW0AyWRYLMbX+V3W6d/Nx7wQP0VU8Yrr6K ynTJmp9TvSaD8jgpp9IU8EtMlSgKz9vlTe3+qcSZJiC3qR8hs+k092/k0Bo9+nW3PcoGyNSaeCa Rout X-Received: by 2002:a7b:c392:0:b0:434:a802:43d with SMTP id 5b1f17b1804b1-4365aa5a397mr20136245e9.27.1734546102430; Wed, 18 Dec 2024 10:21:42 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c80120e8sm14927833f8f.6.2024.12.18.10.21.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 10:21:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , BALATON Zoltan , qemu-ppc@nongnu.org, =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 7/7] hw/ppc/epapr: Do not swap ePAPR magic value Date: Wed, 18 Dec 2024 19:21:06 +0100 Message-ID: <20241218182106.78800-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241218182106.78800-1-philmd@linaro.org> References: <20241218182106.78800-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 ePAPR magic value in $r6 doesn't need to be byte swapped. See ePAPR-v1.1.pdf chapter 5.4.1 "Boot CPU Initial Register State" and the following mailing-list thread: https://lore.kernel.org/qemu-devel/CAFEAcA_NR4XW5DNL4nq7vnH4XRH5UWbhQCxuLyKqYk6_FCBrAA@mail.gmail.com/ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Nicholas Piggin --- hw/ppc/sam460ex.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 78e2a46e753..db9c8f3fa6e 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -234,7 +234,7 @@ static void main_cpu_reset(void *opaque) /* Create a mapping for the kernel. */ booke_set_tlb(&env->tlb.tlbe[0], 0, 0, 1 << 31); - env->gpr[6] = tswap32(EPAPR_MAGIC); + env->gpr[6] = EPAPR_MAGIC; env->gpr[7] = (16 * MiB) - 8; /* bi->ima_size; */ } else { diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index f378e5c4a90..6197d31d88f 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -119,7 +119,7 @@ static void main_cpu_reset(void *opaque) /* Create a mapping spanning the 32bit addr space. */ booke_set_tlb(&env->tlb.tlbe[0], 0, 0, 1U << 31); booke_set_tlb(&env->tlb.tlbe[1], 0x80000000, 0x80000000, 1U << 31); - env->gpr[6] = tswap32(EPAPR_MAGIC); + env->gpr[6] = EPAPR_MAGIC; env->gpr[7] = bi->ima_size; }