From patchwork Mon Sep 30 12:53:21 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: 831562 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp1931176wrw; Mon, 30 Sep 2024 05:54:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWjMl5CUScTAi6MzSH0wGvyIpFSD9W+RWI6+5xuIf/DMs8N6A5dQ3EkYzEJ3YHlHYeRYJ4SRA==@linaro.org X-Google-Smtp-Source: AGHT+IFj/czS1L6u8fKjBueM09TkueWEcc2VQU26zZpRYawp6sgoYMTejoaQ5oNz4WdrnllZu6HI X-Received: by 2002:a05:620a:2a05:b0:7a9:b456:c5e6 with SMTP id af79cd13be357-7ae37955936mr1816504185a.42.1727700863257; Mon, 30 Sep 2024 05:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727700863; cv=none; d=google.com; s=arc-20240605; b=XW1RTNOcw4HQWm3U7V6p0TohlKoEMMaWW0XibPJZKqkXpDUcCX4zsZ4oj9EbUnwZdn r7Cf5TuJKxVwAsV0SqIayQSm883/Dic7y2ivdttEQdVBLg8JRPs25WJsl8lo9zu1yE/x 7wylY5pC1s3YSdEjHLNUQtMMEnJ4M32AfVSyZBk7q8/PjUhaWakKFpNxRMo99ezOXS1d Txk6QDN58kKrSCC/o78f84ZXfB+O6owWzD1omJeuvQRJAAr1bw2dJRDvLSGhfQDm266l OHzZPboJtny8TZQOthuKYDIFxFQySg59BFuAbVL5+jBtSqhQp0dfuZzJhcciqp6MPjN4 ipcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rooDbjFBHfskknaRJcxcqLhZU7vMreorn+2suTNR1/M=; fh=pIsvA++wNM3zvLRbteUQL1gnhGeE5D3wPSdvzpAWEQQ=; b=BS6c4s6V+jPTyRv0uOfgxQ0oaxeUldwjq9sFdsTSiD166UrC51H8qpo4CEYsxWHJUL gl85CCv0v9RfP94RRIaraPTUa+NG/JnaXhiLixLxpI1lAoMt5yv5fSs4gP41W1X1ehBp TghnXHNBEjQxtiTkoJ1f0VCatynmYdJU2mF2CG8N+GZUoqmLO4FjfNT2l0uR+BUXa4F/ 4btfbG7cwTxX6G4JX/wxF9okptcdPIUFtPH8JZ0xe3tPvouCM90WBtbzfeTxTDsW2o3a IGEd0dtoPWzUQ9il1jx/ufIWeYuOJ51EVhN/KcNASKUHnWILe0MtevcRn8DwWVaSTAdq MFug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y0cfUEHL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae37863033si831991285a.586.2024.09.30.05.54.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Sep 2024 05:54:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y0cfUEHL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svFuB-0007Lc-G5; Mon, 30 Sep 2024 08:53:35 -0400 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 1svFu9-0007E4-LN for qemu-devel@nongnu.org; Mon, 30 Sep 2024 08:53:33 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svFu8-0006WU-5e for qemu-devel@nongnu.org; Mon, 30 Sep 2024 08:53:33 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-37ccfbbd467so2515622f8f.0 for ; Mon, 30 Sep 2024 05:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700810; x=1728305610; 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=rooDbjFBHfskknaRJcxcqLhZU7vMreorn+2suTNR1/M=; b=y0cfUEHL5Ooc9asoLqL1bUV7dh49poavofxCK6bhWNMeBqIW/ShyaIQat6vXd85NDb W5YnuRg2mxY40Zqk8RvzZhbCIygtquH61uyfGuTU7JhTBQOxPEptyVvQHUPrOgvalaV7 r/i+BqfraHzavvdUTNBfep+pi0juEH89pyuUukosqVy1mpHUvq6sSlHMH/IcgCAyNllZ iKHbsJLko2B3vM9GjruGproeFC+ibhONtmri1KZAyAhP0Xdf+GJ6VYrNQ5WSgLzNMcHj EoSpwhlbKU0BtdaZo+OBiqYvE4o8Vv50vQJTCYqg3AgCYbWuoveuJH+YWVA2pq1QjLNh Dg0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700810; x=1728305610; 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=rooDbjFBHfskknaRJcxcqLhZU7vMreorn+2suTNR1/M=; b=IPWCQ+lXATCwKN5HizB0tYSRwSF2gqJpQi4oewBrzlYI4Qnbw6IyPEZmbTb8ZjckNn /qdZAAODGy24mW+WoQwNQxYwe+5/14c1/TpzFWXLvjU6NyyQIoTNiA/sA4c+dUMSxmgf guwfV6CJ/tlkU0Tk0784pCJ0kIfXYgjrvlUWc8fx3wJbUAlBLRZy23LeDfBUEebhP/7J jOL8IbpExSj59RXXIBTl5Tgld49TeFAp4ewXMpdjWyVtEztJ2ot+vaHhl9qJyIgwonqf NV/3t51KUi1Z9qpBlhl55RfShxulEQohWFWmrRnR1X0+zGyuFH/YU+oFg2AcdeipzCoQ +pEg== X-Gm-Message-State: AOJu0YzJeevab04X39BF7msju/w24HrhDfBf5MqRpkKCxyaNHaUJNBWk hkuRrAISjt1y3eI4MQUwgQTl5qDCDl140pdOTARx4bOERoaJ6eVRkBcZGDrSLqA75sHo+QjQqsO OlRs= X-Received: by 2002:adf:f60f:0:b0:374:b5fc:d31a with SMTP id ffacd0b85a97d-37cd5aaf0dcmr6187060f8f.25.1727700810335; Mon, 30 Sep 2024 05:53:30 -0700 (PDT) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd564d35bsm9034905f8f.21.2024.09.30.05.53.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 05:53:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Daniel Henrique Barboza , BALATON Zoltan , Nicholas Piggin , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/3] target/ppc: Expose ppc_cpu_is_big_endian() prototype in 'cpu.h' Date: Mon, 30 Sep 2024 14:53:21 +0200 Message-ID: <20240930125323.54671-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930125323.54671-1-philmd@linaro.org> References: <20240930125323.54671-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Expose ppc_cpu_is_big_endian() so it can be used by hw/ code. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu.h | 2 ++ target/ppc/cpu_init.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 321ed2da75..4a4911502d 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -3007,6 +3007,8 @@ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv) return ile; } + +bool ppc_cpu_is_big_endian(CPUState *cs); #endif void dump_mmu(CPUPPCState *env); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23881d09e9..00e0a8bf2c 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7343,7 +7343,7 @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type) #ifndef CONFIG_USER_ONLY -static bool ppc_cpu_is_big_endian(CPUState *cs) +bool ppc_cpu_is_big_endian(CPUState *cs) { cpu_synchronize_state(cs); From patchwork Mon Sep 30 12:53:22 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: 831561 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp1931101wrw; Mon, 30 Sep 2024 05:54:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWEypgvjW2KZfgge8ZmFOymxaSZ9ss8J/Hf0nV1BDCiicQzSOMlRXY41ACmxeHeLmakN1fkxA==@linaro.org X-Google-Smtp-Source: AGHT+IGRb/jQtYOz2gJQIS6AmMahCas7xX4+zLpw+/NXP6P58Fl5eDIveADurUH8QsD0yfo1QVv/ X-Received: by 2002:a05:6102:3f55:b0:494:3a01:e363 with SMTP id ada2fe7eead31-4a2cefc88c5mr8196806137.5.1727700847657; Mon, 30 Sep 2024 05:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727700847; cv=none; d=google.com; s=arc-20240605; b=D5fQZU8RMMKVAJYnQgnZ2r6Y1zUISDkca0CxnEihrKdnVb3T6Nqo5TzfmltUq5WF4B GLtKCR3QZjA/QrUrlbDCfFLKIsI6v+EiTAWQOsFPBz2EQVeMxMNwve57kW66gUr3POXh NibB9eC2x1X+cZIQz44KWLxNS9rURsmzUqgH8JDv8oPpf81Tldc1je0XGgFmPFXehNbs xvqWgGKj4039lVPt8yPrG1D/nWTr58g8Y16SysoeRcVN3kPYkUwIKnvHDd36yL6XcLYN 7tzXebeoaBfX4X0FHx83bo3LZKLI4Bqi1Mz8fAY6Q3qb2Asbj4+H4qcrkwERu2uNKr4L GSSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A54AZmXL2K4S/evyBU6Z+PuWbfLne3N1JrnXSUgIbU0=; fh=pIsvA++wNM3zvLRbteUQL1gnhGeE5D3wPSdvzpAWEQQ=; b=hqDTEvhHwd/eA8tgDzxmtQemBa9UeTGJPWAQJ7FlC9JKfs5GRQsG/aahqO1GCfnAcI 2lx4wLczpr4ppu7fWMINJD4tgrBuamhUA9LYi998AAyGlLPeXMAlj9smkKoB2m6NaHNx dDi4HS7KYkwvoMoy7HBNifPEaX8G4nk0zacPgcZjT58bFtuoonokBI7qOuDugd8EfPVg HnPgJXks5tB+eIEaAYb9WwgJkgW0Ofv/52MMy1rhtSlp9TphqHtMzrDGgRYrq+Jh/jiI +WMTh6ZhB8/vUKFM2lZDOK8sQYZzAbw/WCN5vAPtNbnJUb9sTNDoVECm0ykEZT1N5aOk lSLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HNdzUcD4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45c9f34c312si80972861cf.398.2024.09.30.05.54.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Sep 2024 05:54:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HNdzUcD4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svFuG-0007eh-Cy; Mon, 30 Sep 2024 08:53:40 -0400 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 1svFuE-0007W0-7x for qemu-devel@nongnu.org; Mon, 30 Sep 2024 08:53:38 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svFuC-0006Wu-Q2 for qemu-devel@nongnu.org; Mon, 30 Sep 2024 08:53:37 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-37cd831ab06so1418699f8f.0 for ; Mon, 30 Sep 2024 05:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700815; x=1728305615; 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=A54AZmXL2K4S/evyBU6Z+PuWbfLne3N1JrnXSUgIbU0=; b=HNdzUcD4gvsy9Ns/BR8ooXmFkvlNx2q/oMMNsz/qSsu8GHRUYoRpcOMeWUn3dXXHQg mf5piQpj5tuMcvWOOSkRl3340++lJ0d9DB4jrpXjoc9XgTl/Ni/5jvRCEllMWUeiUFoZ git3ZKWz1ipwDJCx02EGRNtZIWYTpiG4cFknajZr+fKpxkz7s4j56E/JeLoh7QGReEVx FlcWjyHVAeRkFCBYrj/1oW3awCmXhAxhqziwp5Xov8qaFA4HrDhr1SafPuCHmu5R8/Zp xxk6slTEBm9N2DqO/2sPPof9dk7tBrwHPV00HB7xtCgovrsbueZAWaBLTQotMwXvWgmI 3UmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700815; x=1728305615; 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=A54AZmXL2K4S/evyBU6Z+PuWbfLne3N1JrnXSUgIbU0=; b=mrfops0Ryaunqb1y7FFe2Cq12ViI8BWPezI1T5t0bR+SpL3jAfutvtb9nnvsE4YBub 0qU+ufLckH/DcCPfs5Z0eXngZYE0u7m7roO3X/dqZpA8agLiRZJAhA+YdgPZZNFAn7R4 RN1Iuj4zTr+K2CWeWwOlnrNJRUNahxKUJsMiNjnYMgui36Bq4ju/o6jRzfZjAT0UaN17 pAsYQMBqkrYMypEfyXIoutn1VUnB9jqUq3hJfBLLcWGXQLJhvDsV8EXR38R0ISLSqTJy KSlLrlHVwSe1oJRw+712zhRx6TK6dNjwgoGdK6Mqx+84kgR6oMZRf291s8c+kNdRduX9 siBA== X-Gm-Message-State: AOJu0YzJmxfm35f9OdHspeJNRUK/4O6hB1LFF4ZEWoL/Y5btpLIL0HW8 Jj5vQbi0Y64u8ZuIFUJBeZXzgljVG1/VLw7zYiBpCJI/VHW7iLA/UfFeK29Yk9lY4JritK4vAgY wzqs= X-Received: by 2002:adf:f1ce:0:b0:371:82ec:206f with SMTP id ffacd0b85a97d-37cd5aa9c14mr6128167f8f.16.1727700815008; Mon, 30 Sep 2024 05:53:35 -0700 (PDT) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd57450c7sm8943227f8f.101.2024.09.30.05.53.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 05:53:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Daniel Henrique Barboza , BALATON Zoltan , Nicholas Piggin , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/3] hw/ppc/sam460ex: Replace tswap32() by stl_endian_p() Date: Mon, 30 Sep 2024 14:53:22 +0200 Message-ID: <20240930125323.54671-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930125323.54671-1-philmd@linaro.org> References: <20240930125323.54671-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace the target-specific tswap32() call by stl_endian_p() which does the same but takes the endianness as argument, thus is target-agnostic. Get the vCPU endianness calling ppc_cpu_is_big_endian(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/sam460ex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 8dc75fb9f0..6257ddbec6 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -248,10 +248,11 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env, static void main_cpu_reset(void *opaque) { PowerPCCPU *cpu = opaque; + CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; struct boot_info *bi = env->load_info; - cpu_reset(CPU(cpu)); + cpu_reset(cs); /* either we have a kernel to boot or we jump to U-Boot */ if (bi->entry != UBOOT_ENTRY) { @@ -261,7 +262,7 @@ static void main_cpu_reset(void *opaque) /* Create a mapping for the kernel. */ mmubooke_create_initial_mapping(env, 0, 0); - env->gpr[6] = tswap32(EPAPR_MAGIC); + stl_endian_p(ppc_cpu_is_big_endian(cs), &env->gpr[6], EPAPR_MAGIC); env->gpr[7] = (16 * MiB) - 8; /* bi->ima_size; */ } else { From patchwork Mon Sep 30 12:53:23 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: 831564 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp1931235wrw; Mon, 30 Sep 2024 05:54:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWaH8yUyJGnP62x2tMkM7RH6e6SslLe66m3omkBluyFzTUyLIKMCKRECshy1Sr/XH4+45S8dA==@linaro.org X-Google-Smtp-Source: AGHT+IEYZXIoEHAwYgviFSofAKqLJXX7vRKdn6+w9tdB2fa01p0hgA/qWa8lBWZD3ryvHnOdRey3 X-Received: by 2002:a05:6870:14d6:b0:278:209d:49c8 with SMTP id 586e51a60fabf-28710adaa00mr7571531fac.27.1727700874487; Mon, 30 Sep 2024 05:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727700874; cv=none; d=google.com; s=arc-20240605; b=jnl+9aLHUQc0yLaUcvLRtoa3/uVwd+RmkyCpIrmFdF4LHh6dbKEVZucinjkUKgk93t 0GL15iNoif33+lij6ycs4Zc3jjhdhXjIw/HQ1uXloyvScSXf7g0eJlFA+3GYwhO3uND0 0GDdMGAyiZYuX3i0Yk4SoRYLeuAF3rIGwQuEIiLT7rmVmhh6gIpR8pMgwmRKfk7CLmN1 gwRO3OpWG6eyaZuyeaCGcBIo+L4ga15Y3COoJhH7ynLz+dNnfLTt/zvPhrzDsSWd/Zt5 b0BNIgyIn9y5Ml6aXHbjdP59B1XmcS9uladc23udxlAVPBXNePk0iIpS2yxMyj9+8649 yl8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gtv6IX/KV3JKuyckPwlUPbMBU1EPVCs+bl/6v1epcQg=; fh=pIsvA++wNM3zvLRbteUQL1gnhGeE5D3wPSdvzpAWEQQ=; b=Wb6yvoy+1Kw50UHyxe0lPlqRq5nI0mHAyRave00UeqMV9eX0rwgog0PfTxIJysfuLr Y3lZsyjR0tu/TOj7ljAcH+vhnAjzgufRikmC1dGOUL/mFMMlvNUr5JfVQq+qi6+vbgZW NOnRxMptejRnO/gABv4wWOufdITA0ekpNrDLJEDHKR/6ONwzeUqufyPg+s3YC4g3x4e4 RPfcHsOufLJWCfb4dWWlbIngOv+NnNAEizK2yDp3Q5lviu1dK9Ft5wQqFuxF6qS5JBLq XqO6VbJ8PfpdWD3zGMnRKD/rV3ciHMHYJrKOZKHh0bLj7buKRfsBgQJflErb6oSN+BbN OxHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i3VM0qHD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae378a0040si834771185a.730.2024.09.30.05.54.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Sep 2024 05:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i3VM0qHD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svFuL-0007zb-GC; Mon, 30 Sep 2024 08:53:45 -0400 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 1svFuJ-0007ro-Ll for qemu-devel@nongnu.org; Mon, 30 Sep 2024 08:53:43 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svFuH-0006XJ-Fo for qemu-devel@nongnu.org; Mon, 30 Sep 2024 08:53:43 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3770320574aso2876327f8f.2 for ; Mon, 30 Sep 2024 05:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700819; x=1728305619; 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=Gtv6IX/KV3JKuyckPwlUPbMBU1EPVCs+bl/6v1epcQg=; b=i3VM0qHDQ8Wzpow6zGMOrnoaOKnOGjXReO7NPUhYO1fqCAQPTLwcR8TvPIscWk2YAL U2+xtfTUaKSR83F+s/gt/rFE07001rb4CWsfk/AIYI7CN/BJjRjEe5eT2Uhw003A8Maq 1Pb6f9JXScG5LTsB3pF8/UJ0F5TWHlIUqtS+AuiptIEmIgPwRJMluJCDNIhBIiOCYOew aSOLODDs6gShLWcfJU3B22rWhMOJncJ4KHjCiMIXVm9AYJngw+G/ikrcT3FUSPS4pmKE uiTtvt+erbmY5MoItpSr0qq6lYzv4fBwafISh2tMLV5yJfGSuJvNcV9aFw6DvACtlTvG EBAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700819; x=1728305619; 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=Gtv6IX/KV3JKuyckPwlUPbMBU1EPVCs+bl/6v1epcQg=; b=S0r2TDw6xqze54siXMYL4e6dlTBEL7eYAuqdcsMR5kfEZNyfxJfOEYKT3VQNXTauQw ZOqB7XMIVuaoJDb2vCyZlqgdWJOnlLb4FCD4TqfLpGFy8ZrTomZnjd1ccccKNPYK0eiR lhAOPCXcfryK2Ts+nARIUCJK9sHHr3gYND8+Tv1Ig/CbQ0utkQJquoblDSY8Q5k7L/gb knVv34n9Wz15xfkhXpWCsVePv1Txw11j4J/zJeFHwS5jQMBQPBtf+p9l4YRAlgfS9bTN qk4cvU/8yx9KDfmtaL7c9ctqE5cnUW6HDYs3b2ejM5TsK7YBQJ2URMsEhjQgAgxqkzyT 0mww== X-Gm-Message-State: AOJu0YzdxvKjjN1qW9wLxB17tkapruGle6T0cg/is0L8dKLbVmfcuZah hgbE8C39jRRMaWeHgSNUck0JE3PxI3oRS9vDgD8GYhOMJPtCZX1bI+za/g4ViiE7GHCX/9jkRx1 zNwQ= X-Received: by 2002:a5d:4d0e:0:b0:374:cbe8:6f43 with SMTP id ffacd0b85a97d-37cd5a9c921mr6466471f8f.33.1727700819587; Mon, 30 Sep 2024 05:53:39 -0700 (PDT) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd56e6547sm9077147f8f.58.2024.09.30.05.53.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 05:53:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Daniel Henrique Barboza , BALATON Zoltan , Nicholas Piggin , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/3] hw/ppc/virtex_ml507: Replace tswap32() by stl_endian_p() Date: Mon, 30 Sep 2024 14:53:23 +0200 Message-ID: <20240930125323.54671-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930125323.54671-1-philmd@linaro.org> References: <20240930125323.54671-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace the target-specific tswap32() call by stl_endian_p() which does the same but takes the endianness as argument, thus is target-agnostic. Get the vCPU endianness calling ppc_cpu_is_big_endian(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/virtex_ml507.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index c49da1f46f..135dcbde06 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -141,7 +141,7 @@ static void main_cpu_reset(void *opaque) /* Create a mapping for the kernel. */ mmubooke_create_initial_mapping(env, 0, 0); - env->gpr[6] = tswap32(EPAPR_MAGIC); + stl_endian_p(ppc_cpu_is_big_endian(CPU(cpu)), &env->gpr[6], EPAPR_MAGIC); env->gpr[7] = bi->ima_size; }