From nobody Mon Dec 23 23:26:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734730291; cv=none; d=zohomail.com; s=zohoarc; b=AHSKUA23bjW9+Zop5wHPp5MtZXkNiKxOOHjCXm2QTRhWQ1DPF+Wp0ZhfaSMVqCr/8JeOead+3ae96yc2x8Z6MIBj4mkN1id6ICkG3kDJdnBzOjZcofnmo3JIyNKhdoxwI4sAsfGwDX8xJO0z4TJBG2d62vBUBgA/T4QXIdGixTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734730291; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GkSthXKkX+HHwTs+cSajLM5Uw0R3OgK0kOG1f54cJh4=; b=D59Jubyam1Nfm1GTcydTchZJw8qpIjUh9xN/KXlUt8aBqFFwAuPitTgPDVaHmkl2Xv3UTKZGZ889dcwpBR3ZbofakRFvtlVzrlrXe5Bbc3Tp1XTyrBYoXgZkJLyIXhpKN1k/GDSg0T4GvNJKHi2730DyWj22IAvhK4j+I9ngMAk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734730291822457.005368863159; Fri, 20 Dec 2024 13:31:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOkaa-0004aI-0v; Fri, 20 Dec 2024 16:31:16 -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 1tOkaX-0004V1-SO for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:14 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOkaW-00073X-8l for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:13 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-436202dd730so17238375e9.2 for ; Fri, 20 Dec 2024 13:31:11 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b4432dsm88922455e9.41.2024.12.20.13.31.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 13:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734730270; x=1735335070; 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=GkSthXKkX+HHwTs+cSajLM5Uw0R3OgK0kOG1f54cJh4=; b=ivXAGaDk5D3Q3oX97BIDhDRAJKlxXj/VRF6XXQG/sKMowY0bckx/xDkT+uFf0ia7le 8NOMRwpS5fPL5wXHD72QtGoXjtOZTeMAYtxLzdG+Fqgj2XYQKcpNuS4euZvoaX5PQUWD Xc7wpXIUZPwAt54/6brht4xWU+LhRzOr5POaZutBJtf4IEPbs+nGaF4fNTYvq8bv7r9t belTpmaat1rU4oywY21IlEMckzVDwNob+zDnhuWkRvEbWHprp+Cet+4xlpFcK4dboCdw efE6eDs9g/685Dd/olWTK0rpzHdUHieVvIaduRhn90LQDSScsEp/OABMffhRq/sAV03q ADQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734730270; x=1735335070; 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=GkSthXKkX+HHwTs+cSajLM5Uw0R3OgK0kOG1f54cJh4=; b=nJE9BpuS8VF60k5tjaU8MRRDPkzf5Njngb56sHFCV0pSxuCyP4rJ8SrGQhqCPkHXN7 CTS28mtdFD4mezdc+6Y+N8sj3qDaaJCcfwrsU5XRsYDwqLB5vo2nGpb4q61PGzqLjLtM EdA+yaolhK4PEdcR8te1kC7nqOqrsakap5L1P9/8Qjzhw82GQTB9DaIiSvB8FTe5IIMx A2ebr1YmaPpGXrt/0hmN/rhaI4XoaNtPK3mhHVO6lGJtXtVV8Aov4eFUYNlriIMKoVav 78ZT+Ic1MYBDK+kSYFOabNKV5V8erVOosIdP20CsATnjQ1UB2yqtn8Y7uqOcMIfyvNXD yGtw== X-Gm-Message-State: AOJu0YwXT1n2RPog7priGfsZQUFqAGmbtd4BHFX1e1yB1mnRksPjKVgG slFd3+cCcMR9+5qquNeNS0LHg0delC0JJYdil8G0yRrVN2AHNYERCBIO5uhfxk1WMu8L13QXF+z 2 X-Gm-Gg: ASbGnct7D/J+cJnS+IiMn97NW4BXwqGm+kKIqx7/mjMgeLchKY+kJnVimFbZ55gsJni F7mMNITZYUX2DuA2rT2hIhERWL3ZuXgs4buwlclnrVvivcyRNjgzVLUQKqCqNu/gnRZBGHzqEtu T68bba2gj9YdSeeKrENGYL1BLFEC4Zk2GtC/VSKqXb7lZ9SrIHcs5A80nXK23Jd5mLb+sYlSAWT cWjx9Tr+6mwOn9ITPaY7V6GTq5xZTzTIOc7V8Y8R95ix4mFN58AavpAUPqDj49GfJMcgadJHg0= X-Google-Smtp-Source: AGHT+IF46ZQ5LvDcAz5bMC3DiTZhBzoWk5EBQOgWKBMOnzB33OYLDCCr8vojqn4mA3VHjg5qR6oJ/Q== X-Received: by 2002:a05:600c:45cf:b0:434:fbd5:2f0a with SMTP id 5b1f17b1804b1-43668642e7bmr43838545e9.9.1734730270562; Fri, 20 Dec 2024 13:31:10 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , BALATON Zoltan , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/6] hw/ppc/spapr: Convert HPTE() macro as hpte_get_ptr() method Date: Fri, 20 Dec 2024 22:30:58 +0100 Message-ID: <20241220213103.6314-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220213103.6314-1-philmd@linaro.org> References: <20241220213103.6314-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734730294842116600 Convert HPTE() macro as hpte_get_ptr() method. Reviewed-by: Nicholas Piggin Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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..bed60afbe22 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1399,7 +1399,13 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhy= p, PowerPCCPU *cpu, } } =20 -#define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2)) +static uint64_t *hpte_get_ptr(SpaprMachineState *s, unsigned index) +{ + uint64_t *table =3D s->htab; + + return &table[2 * index]; +} + #define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VAL= ID) #define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_HPT= E_DIRTY) #define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=3D tswap64(~HPTE64_V_= HPTE_DIRTY)) @@ -1614,7 +1620,7 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, in= t shift, Error **errp) spapr->htab_shift =3D shift; =20 for (i =3D 0; i < size / HASH_PTE_SIZE_64; i++) { - DIRTY_HPTE(HPTE(spapr->htab, i)); + DIRTY_HPTE(hpte_get_ptr(spapr, 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, SpaprMachine= State *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_ptr(spapr, chunkstart), HASH_PTE_SIZE_64 * n_valid); } =20 @@ -2198,16 +2204,16 @@ static void htab_save_first_pass(QEMUFile *f, Spapr= MachineState *spapr, =20 /* Consume invalid HPTEs */ while ((index < htabslots) - && !HPTE_VALID(HPTE(spapr->htab, index))) { - CLEAN_HPTE(HPTE(spapr->htab, index)); + && !HPTE_VALID(hpte_get_ptr(spapr, index))) { + CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; } =20 /* Consume valid HPTEs */ chunkstart =3D index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_VALID(HPTE(spapr->htab, index))) { - CLEAN_HPTE(HPTE(spapr->htab, index)); + && HPTE_VALID(hpte_get_ptr(spapr, index))) { + CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; } =20 @@ -2247,7 +2253,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, =20 /* Consume non-dirty HPTEs */ while ((index < htabslots) - && !HPTE_DIRTY(HPTE(spapr->htab, index))) { + && !HPTE_DIRTY(hpte_get_ptr(spapr, index))) { index++; examined++; } @@ -2255,9 +2261,9 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, chunkstart =3D 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_ptr(spapr, index)) + && HPTE_VALID(hpte_get_ptr(spapr, index))) { + CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; examined++; } @@ -2265,9 +2271,9 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, invalidstart =3D 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_ptr(spapr, index)) + && !HPTE_VALID(hpte_get_ptr(spapr, index))) { + CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; examined++; } @@ -2449,11 +2455,11 @@ static int htab_load(QEMUFile *f, void *opaque, int= version_id) =20 if (spapr->htab) { if (n_valid) { - qemu_get_buffer(f, HPTE(spapr->htab, index), + qemu_get_buffer(f, (void *)hpte_get_ptr(spapr, index), HASH_PTE_SIZE_64 * n_valid); } if (n_invalid) { - memset(HPTE(spapr->htab, index + n_valid), 0, + memset(hpte_get_ptr(spapr, index + n_valid), 0, HASH_PTE_SIZE_64 * n_invalid); } } else { --=20 2.47.1 From nobody Mon Dec 23 23:26:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734730334; cv=none; d=zohomail.com; s=zohoarc; b=PToTA+KE/kTwuxiNx6/SeJU4DH5zkL5aXwCZ1AldexTkxUdCI38n399gDpaTdCMOeWx8JtkFzyyZevmYXcozm5hWa+IMm3g+QYsOCCLOXVdr4JnqeVma92V1ij3OeXBl8f4HUIkCcrCMU0OyvJJwYBhFH/ZoSg8OgrR4q2kACA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734730334; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aYPfEaXLXgiDntyIsctMYItfQ3K/JB1eh75nxaA67GU=; b=TXzBpHjU/12VfxB+2pH2pnnznPJpnpvIjQh2qKPkM6ItzUyb/xq7DyGDScOtJZ6NSrXtV6LXFyjsD7J0dvJqNpS9w+ko0wYT2fitKX+A2Zno7maiYomgkLGK3F7LTsjbiQ+KeqhymbUS9JEjG4F/ozUHYJ+8R0f8RGge0iOz+jg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734730334412881.8305633586547; Fri, 20 Dec 2024 13:32:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOkbN-0005QS-K0; Fri, 20 Dec 2024 16:32:05 -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 1tOkae-0004fi-BJ for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:24 -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 1tOkab-000746-TG for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:19 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43618283d48so17501305e9.1 for ; Fri, 20 Dec 2024 13:31:16 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43661200ae5sm55589035e9.17.2024.12.20.13.31.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 13:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734730275; x=1735335075; 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=aYPfEaXLXgiDntyIsctMYItfQ3K/JB1eh75nxaA67GU=; b=GqQ1K9V3Sa2BZuRoTrWKGCcmXpF6XGfyS3GAzrkuafaZoeqTeo7Y8QKWdIV0ebo/k3 sEVrRDhVThlVUsJ2X31Gism1tG6mDf9uXVVQ1lIJSBce+P/50JkPzaTedaqPeum5kvGz /fAgdrkdOxcfPLtyT3N2y3wFF33N/amBMmxVhEftQczp3XMze25qrgCREQOoGL6nYEGL gEHJfQGcBzlORmsZTkxIUnRa2wxGyw1DPkuQAPExzS0j4Qkcymh/Ezno7Zcuhxjo7dho b/3+VEnu1X5u+W0HRM5cbJFeTbK7iUIR+8XBqYLD2IzXPC5EMX7N9b5Mg1n6NH2L7oax o0Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734730275; x=1735335075; 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=aYPfEaXLXgiDntyIsctMYItfQ3K/JB1eh75nxaA67GU=; b=E4wtKXUtJJQNGZlq1rtZMRfye1PssJbVQxMnP7UKI199/+hhBApyRR3ZpyawhCgULt Y3Pg4uXUT7Vx3Tx8Yx8+X6A+YDnjXPs43EzYBw4z1IK6PQ21TeHhXU27EO6wYeLBefSR +ydiKJ/vXwidFsmHQhgWA21dP9Il207SpyjlIpLZQ8uIlCgMwCGP2X2H0kDAk++05+LV IOfH1auJTMeGJaGngnFotX6xlOekSsLgg3LStyGTUJeS8XPt2pQ720vWKgtca4VxbDoT MQW8OCFdUbFckNrNP52K2TvtMqTFUpAm11oyj5G3+9EPqBgIFQuDvRssQPbMjVEpEoKO Yovw== X-Gm-Message-State: AOJu0YzkWjxLIYFJN+P0LfR6yk3o3r3m7/ykNXki3EEk9rpU3AXRaAKL qcTWyYPkqqi4L6WNuRvA8ti5Xq0KkqLE9OoGY2Pys1DjJFN+WZubGCKJ0QnzcQKhuVJhZsxixI+ F X-Gm-Gg: ASbGncsxtapshCKXkIl+rOQPIL0fbL4RQoylJhKjre5z5E/ru/Cicnni/qL18SrWs9/ +7zaRzY12svdc5cCqDmoKWRW1BQW2Z+6OQdHS9Ou5sKtwakOETqezTStvHSF9pIlC7tKkXozgRL 4q6kOj27z1s/oHNw717P6c7Z5tRPhzh3R+EOiA4AHRv+9X5xBkzdhBSMYwz39cv9C8sqv3/FjTu uzLsg0/JkARdWlJdOZIQdi2nQbk2tloz3DQbiDpufeghmcjc/w+2T5HgOBAJbOHJsmuzp7qO5g= X-Google-Smtp-Source: AGHT+IF8W7UQ92zAwegU2Lq3isyluZMCvD1GgayPqxaC1aU/a40Q9S1OSWRkWib1ugmHTBDTW9LWOw== X-Received: by 2002:a05:600c:19c6:b0:434:f2bf:1708 with SMTP id 5b1f17b1804b1-4366854740fmr35398435e9.7.1734730275144; Fri, 20 Dec 2024 13:31:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , BALATON Zoltan , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 2/6] hw/ppc/spapr: Convert HPTE_VALID() macro as hpte_is_valid() method Date: Fri, 20 Dec 2024 22:30:59 +0100 Message-ID: <20241220213103.6314-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220213103.6314-1-philmd@linaro.org> References: <20241220213103.6314-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734730335976116600 Convert HPTE_VALID() macro as hpte_is_valid() method. sPAPR data structures including the hash page table are big-endian regardless of current CPU endian mode, so use the big-endian LD/ST API to access the hash PTEs. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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 bed60afbe22..43220e93c4b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1406,7 +1406,11 @@ static uint64_t *hpte_get_ptr(SpaprMachineState *s, = unsigned index) return &table[2 * index]; } =20 -#define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VAL= ID) +static bool hpte_is_valid(SpaprMachineState *s, unsigned index) +{ + return ldq_be_p(hpte_get_ptr(s, index)) & HPTE64_V_VALID; +} + #define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_HPT= E_DIRTY) #define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=3D tswap64(~HPTE64_V_= HPTE_DIRTY)) #define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=3D tswap64(HPTE64_V_H= PTE_DIRTY)) @@ -2204,7 +2208,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMa= chineState *spapr, =20 /* Consume invalid HPTEs */ while ((index < htabslots) - && !HPTE_VALID(hpte_get_ptr(spapr, index))) { + && !hpte_is_valid(spapr, index)) { CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; } @@ -2212,7 +2216,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMa= chineState *spapr, /* Consume valid HPTEs */ chunkstart =3D index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_VALID(hpte_get_ptr(spapr, index))) { + && hpte_is_valid(spapr, index)) { CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; } @@ -2262,7 +2266,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, /* Consume valid dirty HPTEs */ while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && HPTE_DIRTY(hpte_get_ptr(spapr, index)) - && HPTE_VALID(hpte_get_ptr(spapr, index))) { + && hpte_is_valid(spapr, index)) { CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; examined++; @@ -2272,7 +2276,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, /* Consume invalid dirty HPTEs */ while ((index < htabslots) && (index - invalidstart < USHRT_MAX) && HPTE_DIRTY(hpte_get_ptr(spapr, index)) - && !HPTE_VALID(hpte_get_ptr(spapr, index))) { + && !hpte_is_valid(spapr, index)) { CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; examined++; --=20 2.47.1 From nobody Mon Dec 23 23:26:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734730313; cv=none; d=zohomail.com; s=zohoarc; b=TjLNx8rM/vEWj3hme2b6Xs01y3MvZRGBWcjiABJFxh0IAjg6VPJrVOIJ+x2oq7fFVcV9169QzGUoO4WLRvmU+xjQA40juUy+wTGZIbPzXf7uv/0ChsVdG6Qi4bt5VDAIcBUBbkP8f3MvFMcektoiD7eKxJbdnDqOaPHfQHW/9nM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734730313; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UW2DurBRFq8X0rj+tQILJDXJHVLhDrQlFsO7ozj6g7Y=; b=PmFm0HY35KfuBMtj2FUmqn1Pw5lW6NPXqvuTo2tQ61yEmKQ8SDuWSQljLpk+6VtsbqYu+vfoeWP5tiwb6VGr7wgqU4mtSEj/Q/k7rll9sr5i6yu9vhkK+IxwifDAoQ4w0LoOB+GJVWs4jT0VXmU0zQ24Uqf1kb4m+cPNl+u4Z2U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734730313945180.65235969711216; Fri, 20 Dec 2024 13:31:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOkas-0004uQ-5O; Fri, 20 Dec 2024 16:31:39 -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 1tOkai-0004hy-Iv for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:25 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOkag-00074X-HS for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:24 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso16523725e9.0 for ; Fri, 20 Dec 2024 13:31:21 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b442dasm89469085e9.42.2024.12.20.13.31.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 13:31:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734730280; x=1735335080; 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=UW2DurBRFq8X0rj+tQILJDXJHVLhDrQlFsO7ozj6g7Y=; b=Gr217UP6cud+regX0TGffjI2+oqxyDSEZUOHqmueS2mcas2LLHwLfcg4jbXCmatmS3 Do/KCq62i+hA0sW168zsFsnsm9S26bBKjsypr53TQbgaxevB58S8BEDITQ2MctM3UAR6 x6UMHfoaUoTNGP4lJO/CmqNFVEgKLAE70gPmftVPYiDt+rr9KbMv+tJ5w2yziR1bnDQM 1X6471wTJQOKo5iDSnB5t7am2hun8aS3dmQO5mnRAzlBChv3J0frD842THC2LTOshZ0p +TReXX2kZS6Ks7eIMYYz8YIaB0L9LmqCBfAtXRJarcDc7gk/JLyQ3jyqxQlbLMN7g+nw pZIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734730280; x=1735335080; 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=UW2DurBRFq8X0rj+tQILJDXJHVLhDrQlFsO7ozj6g7Y=; b=wCQbuzFUgoZMcmwlRszmkW+VNW3cAH0QSbTN9TUNrzfkcz70YWU5aA7JakxdvQGDPW YdymsvjmP241RpDkScMPug/5VV2YkEPCsdCF1Z7ku/KE8fVHORCESoGpkcLj4ITSvfM9 RFfTePmNBioegluey+adnTa6i/Az2UQSx2l4ZeXGEkG1Iqe8oUEt4heXURHSS7HEENZe HXZTbcuaKbMbvncfTVmu7AMNslZfU+6NH68SL5xmJn2DiDBidJzYb6zM6jVJ5FEO3MLZ vw5iWnzb54F9ZfsKde6aQFz4N/eibZBUtAo8h4rX4Y6DcMQNtgF/TZIYidbld+BA0+Xl RDfA== X-Gm-Message-State: AOJu0YxE+pfB23gsXexED3hZhK7V2nlpGj8RYMIdFEhPRK9Tw/Yk04LU VpAR6/YqqxQq1RWSFQlAIC6StcTcfQsupA6/4D7FvLTbIIg7FWehKwaeRb7HJ7iNZ/7ViIPq3uv G X-Gm-Gg: ASbGncu/FA0vIZ/nMCdeG6IEyomj++O5DrWOKO6oSKQBg62h/q/wDqQ2wGlIJaj3g9X Kz+qxMSo9afKaEIsEKX8w7SIAGWHVQ2phmVhk66LmbZiyfCmq5vlyTmeSPvkhP3iWEuO5uvgqrY 8/1J3f/M6Sr3YTQRfSbKCc76BMdlZLNdkxtC7QOKrkLF+3ghhjEyHpjEoZGYKX5+SLLLxG5a+Rk oOpJmNLAqhyfJ47Zi0UifuwRE3lcTO2OhxBiEGJCz1ZKlTo06p3yWlN7RgxEVWbm/I6TQjSHrc= X-Google-Smtp-Source: AGHT+IG6MuKlPerVPzWqn6Bmhy5nHwoVIUzwBmccYDsy7r+CtdLD5SGPTn6dWpHJvLdzKGFa4Qe/Jg== X-Received: by 2002:a05:600c:1550:b0:434:a468:4a57 with SMTP id 5b1f17b1804b1-43668b5f6a5mr35405245e9.26.1734730279727; Fri, 20 Dec 2024 13:31:19 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , BALATON Zoltan , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 3/6] hw/ppc/spapr: Convert HPTE_DIRTY() macro as hpte_is_dirty() method Date: Fri, 20 Dec 2024 22:31:00 +0100 Message-ID: <20241220213103.6314-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220213103.6314-1-philmd@linaro.org> References: <20241220213103.6314-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734730315913116600 Convert HPTE_DIRTY() macro as hpte_is_dirty() method. sPAPR data structures including the hash page table are big-endian regardless of current CPU endian mode, so use the big-endian LD/ST API to access the hash PTEs. Reviewed-by: Nicholas Piggin Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 43220e93c4b..31df6fdc40c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1411,7 +1411,11 @@ static bool hpte_is_valid(SpaprMachineState *s, unsi= gned index) return ldq_be_p(hpte_get_ptr(s, index)) & HPTE64_V_VALID; } =20 -#define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_HPT= E_DIRTY) +static bool hpte_is_dirty(SpaprMachineState *s, unsigned index) +{ + return ldq_be_p(hpte_get_ptr(s, index)) & HPTE64_V_HPTE_DIRTY; +} + #define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=3D tswap64(~HPTE64_V_= HPTE_DIRTY)) #define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=3D tswap64(HPTE64_V_H= PTE_DIRTY)) =20 @@ -2257,7 +2261,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, =20 /* Consume non-dirty HPTEs */ while ((index < htabslots) - && !HPTE_DIRTY(hpte_get_ptr(spapr, index))) { + && !hpte_is_dirty(spapr, index)) { index++; examined++; } @@ -2265,7 +2269,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, chunkstart =3D index; /* Consume valid dirty HPTEs */ while ((index < htabslots) && (index - chunkstart < USHRT_MAX) - && HPTE_DIRTY(hpte_get_ptr(spapr, index)) + && hpte_is_dirty(spapr, index) && hpte_is_valid(spapr, index)) { CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; @@ -2275,7 +2279,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, invalidstart =3D index; /* Consume invalid dirty HPTEs */ while ((index < htabslots) && (index - invalidstart < USHRT_MAX) - && HPTE_DIRTY(hpte_get_ptr(spapr, index)) + && hpte_is_dirty(spapr, index) && !hpte_is_valid(spapr, index)) { CLEAN_HPTE(hpte_get_ptr(spapr, index)); index++; --=20 2.47.1 From nobody Mon Dec 23 23:26:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734730333; cv=none; d=zohomail.com; s=zohoarc; b=ClcXq+MCkNqGIqhHFHSKHQPBx2Zc4X0jHvmky638oaTwePElTjAXQyWNI2Wrdho42AaXm5NZtvXwbWr1KZmfa9kK2DsBmniacZkY2ncyMFzkenhUJNabjzW7D7qkpW+V/xkz6m4aZ28svb4yBJazlXO3eDBtHUlfQ1MfITRo13k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734730333; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rmgHhStl2mquI6PQjM+NbLeomfI+w1HT5yYsX9HFVBk=; b=cbsbFJ+iH4Bhv6BUN8nFSPQhAboxAT3WwrNGtBle0iPucuNmvFvMCiy6G0EUN6wW7+fkeHi8rM2xIXV/8Qrhu0dVZqX9L/JKoIOBduarp7nuurS1agqJKQgOOkkTWSgWvmptyalA7DGahIhTb4VbrWdM/3bZNYLU8vgn+8T5CSk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17347303334041008.1144826094954; Fri, 20 Dec 2024 13:32:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOkbQ-0005hY-I0; Fri, 20 Dec 2024 16:32:08 -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 1tOkas-00051W-BY for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:39 -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 1tOkam-00075A-LD for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:32 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso16392265e9.3 for ; Fri, 20 Dec 2024 13:31:27 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b417afsm90555595e9.36.2024.12.20.13.31.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 13:31:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734730286; x=1735335086; 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=rmgHhStl2mquI6PQjM+NbLeomfI+w1HT5yYsX9HFVBk=; b=weIYuoRw1weuaqbG4iyd11vmz14NKfDcaLWFaQLWnKC0g9e3co9vP5JElmvecBEHJY 0CDrnAaV6RMblhQQo9JxbJOsxZlOis9PLVkG9UBJaB2b/eHUwm0lLNYF2RyDBF9Z1neQ Xp5NCZPm582MPJiDCn6OjSc8rW6ttBpg9sDmVw55hW4APGU0MbNRGU1P4saZhrgO3zKl TTDDG/Rgohw80XMLHHmF842oHvSeoZKZ1V4JMzZDofn1IhGLtgsuquTAHhr86OQYQn/P SDlhKYwAD5VtLgIOTOsyC4iwv9jJ52u+075fhRbQUOIAGWZ4KWZ6wIvQQLXcEAlAq/4/ v6Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734730286; x=1735335086; 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=rmgHhStl2mquI6PQjM+NbLeomfI+w1HT5yYsX9HFVBk=; b=hp7vOUa1Dxbykvxcfbzo3xtY4Z7jMdKJLSSsvv+z+jVF7+adITuTzgNupKTaVL0PAH a+nFKkGn8yfKiqQvpBIQaJmJbNFUweOFmNcuprcD311uOCeGTj5lW1TTjpTyPlHz9GYn np2zUpOntX9nR3HvsAQGIQPUKsStElsHZWl/4odRvxwv6A1D2/qM7S1RLy6X/R1kWFyO ZNGA6VhpNTc4kOzbr0lkSz2RCGgV26es9qx91PxiXLTLtvbSsqpEKoNo8qbGJYWXVTaO ufdLqGKV39TddyvN69mwkPDjQZzcDLeRxAAAcVaU4EuT6113JD1z+yLrYukjAMxKG/6i WXVQ== X-Gm-Message-State: AOJu0YwrKjEnk+PqjiA5+taIG63p8vIPQAZhVpjDfY185Q6tXJ5Px/TJ c58b9/HR6vrwd8k0HXcKYxUYwszWq7WeSjJTJZBcob8y5PeMtGZ0ZHzwg42TdBYNfwUUu1cBnRC Z X-Gm-Gg: ASbGncvPZpa+KCKnmAKeK6Nww6wfF7zeZfHRnfHKiifhB6wm88Hl4dcwK9SKtG33XnO wVmLVLb2knE98Vy3hIcpkbVV78pKlOyULsI6HeV07oiBRLQrbI9Vrh/qlXNGy8UEjZ5Xxmmw5ch 55ZGmL1awRylxgsSJl3WXN6iCFVvxbj1Sep8BGvsOKkjxLKxmypTqpD/YexyARQ2T+VXD9C2odf 0hGhjnQqQ6aexYayA10fMQtdmQi1HNJTPcKAe/FAsvDl6SFiZaumBCorbjah+U0uoJQenwXVq0= X-Google-Smtp-Source: AGHT+IFKwHq+5Sl5U3hzBhJq2R4YEuTbu0CSBPl2GbvslBniWV2AEu4KS5PgXz6RPyP/qCw8cXme8w== X-Received: by 2002:a05:600c:1c09:b0:434:9e46:5bc with SMTP id 5b1f17b1804b1-43668643750mr50992655e9.10.1734730285805; Fri, 20 Dec 2024 13:31:25 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , BALATON Zoltan , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 4/6] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clean() method Date: Fri, 20 Dec 2024 22:31:01 +0100 Message-ID: <20241220213103.6314-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220213103.6314-1-philmd@linaro.org> References: <20241220213103.6314-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734730334147116600 Convert CLEAN_HPTE() macro as hpte_set_clean() method. sPAPR data structures including the hash page table are big-endian regardless of current CPU endian mode, so use the big-endian LD/ST API to access the hash PTEs. Reviewed-by: Nicholas Piggin Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 31df6fdc40c..e68e8c320f4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1416,7 +1416,12 @@ static bool hpte_is_dirty(SpaprMachineState *s, unsi= gned index) return ldq_be_p(hpte_get_ptr(s, index)) & HPTE64_V_HPTE_DIRTY; } =20 -#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=3D tswap64(~HPTE64_V_= HPTE_DIRTY)) +static void hpte_set_clean(SpaprMachineState *s, unsigned index) +{ + stq_be_p(hpte_get_ptr(s, index), + ldq_be_p(hpte_get_ptr(s, index)) & ~HPTE64_V_HPTE_DIRTY); +} + #define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=3D tswap64(HPTE64_V_H= PTE_DIRTY)) =20 /* @@ -2213,7 +2218,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMa= chineState *spapr, /* Consume invalid HPTEs */ while ((index < htabslots) && !hpte_is_valid(spapr, index)) { - CLEAN_HPTE(hpte_get_ptr(spapr, index)); + hpte_set_clean(spapr, index); index++; } =20 @@ -2221,7 +2226,7 @@ static void htab_save_first_pass(QEMUFile *f, SpaprMa= chineState *spapr, chunkstart =3D index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && hpte_is_valid(spapr, index)) { - CLEAN_HPTE(hpte_get_ptr(spapr, index)); + hpte_set_clean(spapr, index); index++; } =20 @@ -2271,7 +2276,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && hpte_is_dirty(spapr, index) && hpte_is_valid(spapr, index)) { - CLEAN_HPTE(hpte_get_ptr(spapr, index)); + hpte_set_clean(spapr, index); index++; examined++; } @@ -2281,7 +2286,7 @@ static int htab_save_later_pass(QEMUFile *f, SpaprMac= hineState *spapr, while ((index < htabslots) && (index - invalidstart < USHRT_MAX) && hpte_is_dirty(spapr, index) && !hpte_is_valid(spapr, index)) { - CLEAN_HPTE(hpte_get_ptr(spapr, index)); + hpte_set_clean(spapr, index); index++; examined++; } --=20 2.47.1 From nobody Mon Dec 23 23:26:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734730346; cv=none; d=zohomail.com; s=zohoarc; b=SXa+4EiXSYjK9xPWeRKRVmgpvirKosS0x+sHNnz6AxaR6FgaXW8MSsNERM7lqwe6GV3yHpf6s9697zmoo6z/M3vWmdh/vXQaIIGhI3+vHFZZOVSa2lAftUEtfIafImdebGkj375Od9tmu69xHemH1HMRhxXMSE1WgKYlVh6rczQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734730346; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L5uOCTnfptaobXEglt5cStPbt9vyDRGLhNNrWNvGhsU=; b=BRY/Pwc22rZSbAdrGDcMJBvoKXfsA9q5nLSKEvZTkQMYPjNWHx8zQDjKdUR+Mv4BkZ3uL2uepaYtxcJkEzDltr6h5p8y49AzGs357wt6CyQANoJmBtFFvmHy6FmomGZTApnZpTVXz04EOdCpC+WwkMNfUenN/4J4jk1hmKI54Uk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17347303461431020.4789231162686; Fri, 20 Dec 2024 13:32:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOkbP-0005dv-KN; Fri, 20 Dec 2024 16:32:08 -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 1tOkat-00051j-Rz for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:45 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOkas-00075i-4S for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:35 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-434b3e32e9dso25419455e9.2 for ; Fri, 20 Dec 2024 13:31:31 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43661218f43sm56226125e9.19.2024.12.20.13.31.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 13:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734730290; x=1735335090; 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=L5uOCTnfptaobXEglt5cStPbt9vyDRGLhNNrWNvGhsU=; b=U2/Br1r2hfUYi7lsGqJ1X9F2qPFqbG2+oATygC1AJTnOy124azbuHFRCSxjc7KPRtl Adiqj9K+5+0KmR0bc0cLLKymBa7agjy/2yF2B/x7ts/U9NpwpxbgloMm07tFSJ80UGii fThjcFTxNGu1JHZRTLWLNlm7NxnhoV/7NTN8tdEiz1iVM42BqFPx3lkenVR5Lo2IVZyY F4x9ObbQ3veUsdNGvnmNSk1OUhyAt6w6zF4IrXXwYxPJcD4N12wG/Uif1IkEBMAol/Yo eWxOSLjhNRLRP7buBa2kj7eHZOXP5nP0fFBggZHAsDJiCuTZNGuwOijw3Rzb1BiDPI+3 DSMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734730290; x=1735335090; 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=L5uOCTnfptaobXEglt5cStPbt9vyDRGLhNNrWNvGhsU=; b=Hjz99EAU+womYyMc4pE3axMVUQKhh+/J8onkxjX+0H4uTzbcHIZj3k2MFhgfgRYVSg i7xDFgyk/Zy6CUxg5Cmn+VheJJeu6LoDwiXqMf07WHDEq3CFPf3PSLhfqnkdm/eoLVXO ImDufbYQuAWK17uMBeeIJoQht39+Bqlfkq+cwzxtiA9KxRSTPyNBced4J6qTGFMRDm9s K/gOiRcmm+GM9Xllqn/dualcohR4WxxC9nKuV1ic3TG9wJI/z1XLpXrXLyKoQeT7sCgF bb5KC3R4UAerXlQDK4dIk/g1gtlgR2MeMaxX7hljzV47y5UpZLGmYLVi0klz+aArZaU7 H35g== X-Gm-Message-State: AOJu0Yz9h2EWFJyCX1nkB/WtyrVkZZaVzWCj7z++He2diguzihKem7F4 yzU8dcb3IlkeSaKebYDx81jj6628phAUTtvabJcVPEOphUkERKp/56iWqDoz32JpOw7xRYNLZKP 1 X-Gm-Gg: ASbGncuWE06cKMUGA8y9w2fDe5OL75g6S6rj6JSNHoWxF5kgNgE5YcJhUyhRXvozoYU aC569sRsFlgmhaYj4Ebl3eTeaZQGUKO8B3gfr11pVSYEgCG6JL/QaB8xl88UvwLBM3s2SUW4BWh yMpi4hfg2QCfWIPqNuUZQfR3tpUKGXySWGhaHWWmItgBsPdBEfkzXFkhInYNnw4uwoAtvj2uRkC OKNU4rYoOr/jtHCavkizlie4eQdsGnPmauDCULYHlgBYgfosgqnajgzq6oerLO05sMCmh9N7wQ= X-Google-Smtp-Source: AGHT+IGnmY2UiuFVMNv3LgvgikWxiAkTFg3eCUgPM74DjA4Iv1VX7TaEdoezu2I885pay3fjAzfcYw== X-Received: by 2002:a05:600c:1c1a:b0:436:1b81:b65c with SMTP id 5b1f17b1804b1-43668646aebmr44268215e9.15.1734730290287; Fri, 20 Dec 2024 13:31:30 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , BALATON Zoltan , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 5/6] hw/ppc/spapr: Convert DIRTY_HPTE() macro as hpte_set_dirty() method Date: Fri, 20 Dec 2024 22:31:02 +0100 Message-ID: <20241220213103.6314-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220213103.6314-1-philmd@linaro.org> References: <20241220213103.6314-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734730348050116600 Convert DIRTY_HPTE() macro as hpte_set_dirty() method. sPAPR data structures including the hash page table are big-endian regardless of current CPU endian mode, so use the big-endian LD/ST API to access the hash PTEs. Reviewed-by: Nicholas Piggin Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 e68e8c320f4..d318ce2a350 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1422,7 +1422,11 @@ static void hpte_set_clean(SpaprMachineState *s, uns= igned index) ldq_be_p(hpte_get_ptr(s, index)) & ~HPTE64_V_HPTE_DIRTY); } =20 -#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=3D tswap64(HPTE64_V_H= PTE_DIRTY)) +static void hpte_set_dirty(SpaprMachineState *s, unsigned index) +{ + stq_be_p(hpte_get_ptr(s, index), + ldq_be_p(hpte_get_ptr(s, index)) | HPTE64_V_HPTE_DIRTY); +} =20 /* * Get the fd to access the kernel htab, re-opening it if necessary @@ -1633,7 +1637,7 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, in= t shift, Error **errp) spapr->htab_shift =3D shift; =20 for (i =3D 0; i < size / HASH_PTE_SIZE_64; i++) { - DIRTY_HPTE(hpte_get_ptr(spapr, i)); + hpte_set_dirty(spapr, i); } } /* We're setting up a hash table, so that means we're not radix */ --=20 2.47.1 From nobody Mon Dec 23 23:26:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734730336; cv=none; d=zohomail.com; s=zohoarc; b=M1Y1kLHIP+QblxvOndcyFae0auF6rEncM7rdkbzOvSOxKkfwkD843mo5YEDm7egFR4g+s88QX+810f1EPFgjsJQr9DbgFU6hvJa7DvUIG1RQp7SJm10JFblGByFy/cIXxX/fuzv4QyrK3cKIgVB2rE+F311Y2wkRvPWxC+2qM4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734730336; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XZhntQKj+2np0onfD6fTX3Bv/LcXZGFrE8GH8VrgUt8=; b=IVwgTC7B5cEFgonDwYoL1F7nOC74rfAGEJPeXqDBwbYQOcGnpqbialq9kgfgkxhEpZjTlf8WkBZFXwKynEt9h8BoOqOgxx6uk6rJSXnFWIVI+0ATMZR5TDIFgI3/nkMceHoHbsDaGKPB0mm7s06Bg1k6DK93lXwXrAV58INuafw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734730336129882.0618904778254; Fri, 20 Dec 2024 13:32:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOkbT-0005t5-3V; Fri, 20 Dec 2024 16:32:11 -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 1tOkax-00052K-Gp for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:46 -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 1tOkav-00076r-Hl for qemu-devel@nongnu.org; Fri, 20 Dec 2024 16:31:38 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43626213fffso21636925e9.1 for ; Fri, 20 Dec 2024 13:31:36 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e2f9sm5048149f8f.81.2024.12.20.13.31.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 13:31:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734730295; x=1735335095; 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=XZhntQKj+2np0onfD6fTX3Bv/LcXZGFrE8GH8VrgUt8=; b=HXhuzy9po3Ob7mpGjGnypMbqH1ej1FR33bDcjlHH2qpQJeyEnAfuKpP/zc14QQC3Bf pAXgg+lh3oM2XAW/dOiQL7Hkt3cVyDEt2N6y1nX+PiPFSqG7FFJVlLRiHXSPdBlE/FRL DQpXkQATEWyXLMFhzZLjHki6slV7h+Ank3mLwtBmbeD4W+DY7CJxBo7oy+qwFzpRXFX9 yaWSFPT5dKdAOQngh+VxPeDHWQZhV+gwtBxzoe7IY8uxURot70qVeNF8AUX1KSGT6gS/ mdSz4CRXZS+YX8iVILQ+xh5IRyQBVQxgH/Etdr9mzymJ/3LgTGSYoFosRcrwTuJs6E5V 3Sew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734730295; x=1735335095; 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=XZhntQKj+2np0onfD6fTX3Bv/LcXZGFrE8GH8VrgUt8=; b=NlJQ3pyIAZOvAcfEPieKv0/Ii301l5AFO5KxkfBiaDzSPGqzrPs+NJVnkF830xHEy9 ArDEWhiweZ1JVPDjn4zQ38CHoeFz/PcDUo3NzShpK3YShfioafHb4iNpdZgcn9xbdihZ EHifSC8rzsbVit5Qz8VZW30lQkl4yOOgWDMBBLGPbdmiVM7jQv00KUhq0Qr41nPkHK0r FXIIxqibJMH3IJjPkQaPxdJT/B5aNJvKEbX3HU/RuqCgZDv+ihv586qELS+hvbJ17fRH 8R/B2H+EwztsozVVJm91eRFi5c0pJz7pRSY1URwmXdraB6y8Eiu8zGwPT3QCwbbt5A0r 8U8w== X-Gm-Message-State: AOJu0YwwzqvrkzZWj7SpPv1yvGA6CVdo9AjpU4QjxOzA2T9FfPUYYG9m tWX+envS/hEs6rz8UmqFnVTqPy5p8GQCGe0K0U7nXtLSPxAlkAw/l8ybJDx/vHfySl8SvSyxKXk D X-Gm-Gg: ASbGncs2ezJSPIkDUWM9rzlj1/vOy5oA83uxZYz/GQG6SvuSf6jsn0LXFuNVXtl40/N v6PhXcW2/L+I+/j+otBlQIMaRXvU2LzpA1EeggQNrVOt0kSD5/4pxZh+riWHw0mI9E6FZKAlOd4 IyTcZTLyxNm8fXgrWyl6d5nDJgpE6O2KULewBi4JpzZ28+DQnZleQKChERcxHnI3dMH8ImjWfu5 L+Y5zSTdDXjW3EwOak9yRFJnn65ZXl4KVQ69HgVN85zJTk0TGbyfGHAL2mThExRirT9u4bz1qU= X-Google-Smtp-Source: AGHT+IEawfv1eDKEtcfbktjs2UsUWawD1Ka1LOi05Oo6TrO5ZY4shNl1aExzD8czo2IbsqtVfIVMHg== X-Received: by 2002:a05:600c:5850:b0:436:1b0b:2633 with SMTP id 5b1f17b1804b1-436699ffa24mr36251915e9.9.1734730294794; Fri, 20 Dec 2024 13:31:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , BALATON Zoltan , Daniel Henrique Barboza , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 6/6] hw/ppc/epapr: Do not swap ePAPR magic value Date: Fri, 20 Dec 2024 22:31:03 +0100 Message-ID: <20241220213103.6314-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220213103.6314-1-philmd@linaro.org> References: <20241220213103.6314-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734730337940116600 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 threads: https://lore.kernel.org/qemu-devel/CAFEAcA_NR4XW5DNL4nq7vnH4XRH5UWbhQCxuLyK= qYk6_FCBrAA@mail.gmail.com/ https://lore.kernel.org/qemu-devel/D6F93NM6OW2L.2FDO88L38PABR@gmail.com/ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Nicholas Piggin Tested-by: BALATON Zoltan --- 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) =20 /* Create a mapping for the kernel. */ booke_set_tlb(&env->tlb.tlbe[0], 0, 0, 1 << 31); - env->gpr[6] =3D tswap32(EPAPR_MAGIC); + env->gpr[6] =3D EPAPR_MAGIC; env->gpr[7] =3D (16 * MiB) - 8; /* bi->ima_size; */ =20 } 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] =3D tswap32(EPAPR_MAGIC); + env->gpr[6] =3D EPAPR_MAGIC; env->gpr[7] =3D bi->ima_size; } =20 --=20 2.47.1