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: 13914022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49F71E77187 for ; Wed, 18 Dec 2024 18:22:30 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHEdm+bDsnTz5HW7BI+jRIW1PJWkJJnAaW7u/k5SsOMXVQj63h/0YyYZb4XCxJNT6yo1moD9g== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13914023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81CD6E77188 for ; Wed, 18 Dec 2024 18:22:36 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHO7kuM9U5L/s/IgxGV4vT2MKyYSreP82VK+LFrdQL8+aKfmwocL5nJmp0m/eZ8h3mA7GAQSA== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13914027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 920E2E77188 for ; Wed, 18 Dec 2024 18:22:53 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IGvYhbxFQ4IVWBKqV530skCMjTTdodD+ByKJR3BtlBvTFN4oBGb7Q99ju7/LpK7NPCK84RKZg== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13914026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10B15E77187 for ; Wed, 18 Dec 2024 18:22:53 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IEXmpGC9n4kckt6+1Pm4QUWP6DVGZJJ+J8B6/WjU+d+E5TUGwaGdhbsQ48AFQEmtdK0k8r/cg== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13914024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42C65E7718B for ; Wed, 18 Dec 2024 18:22:46 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IGh3MuKwwak3fbod0s54NHlSaR8+MiLVhr7B8vWBXrEBjGfuxo2ewnNQTYjM4AvogSTpM2vgg== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13914025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D8D1E7718A for ; Wed, 18 Dec 2024 18:22:53 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IFbd4r9DltG1/C6zUZNFz1g0Ag+9OaCCpr3WZLo4yCOf86bBCAKE9fD0qJO/utrgMPFPFiLLw== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13914028 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DD7DE77188 for ; Wed, 18 Dec 2024 18:23:11 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHcOA/mFH0pC3dk8ATzniYKNpM3Xw+8gIBr18L7eT2HqQkYzJMqWczacjPLwXSbyG3O4jfPww== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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; }