From patchwork Wed Jul 17 21:46:52 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: 813018 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp16876wro; Wed, 17 Jul 2024 14:49:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWyUdv6X0VGLZD7EPKl9bFPt5VxRCiEAmOerhjIqRrRoe+XTRUzt9eRhGDmnId6JwyGyaGSNjc0J9Bq/MgOa0nE X-Google-Smtp-Source: AGHT+IGA2HGrbzVNGzX/BozCavJVqutYjZPip20d/S8KUW6Vo6V/fDYFShhaQPNTkxe4iAo2XYUR X-Received: by 2002:a05:6214:2b0f:b0:6b5:ef1:72b with SMTP id 6a1803df08f44-6b78e442943mr40531826d6.50.1721252985052; Wed, 17 Jul 2024 14:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721252985; cv=none; d=google.com; s=arc-20160816; b=WSoCgcYN7B1T/lQy/nYNR7nHvr5OzQQGGXr0eQ/BD7zO181KzTg0HyQJ/wHheu6NTm 7kHapdKdUEGqzhHpIXDThCE/QBEsgQhMIE/9Ued+EA5SH07Phb+V+YLh5KoOfMwfJtM5 hKshePT1jj/Bt49UvnW5l4CUBH1wog4WBPQC0uB+0aFrp0yU/tzZZQu7ZcJ0jnCJbGbX TtU8LWqfrxt8nAKebNfYnAqsI4KKvGrtBWbmBWkjzMIeIXja+J9le52gHqPdV5J8gcbD kZMtlFtyIIilQbXZeQuBNICC+ZgpyORw+x8EAZ0/Jli0OSEFQG2TC062od7ec5FGPgqw KA5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rg0Rdjc81kCpKex+A4T6UVMbXK9hzcQBh67E0bOsYps=; fh=bQcnK/PZ+/s5abrQKdjDSzcdcDFOOKxQZBJETS0/0do=; b=EcnxUUgDNEiQGGvzDcqL7Huzt4OtdacbBoL0y5ojRw07ymujx0sdAe6RTH+fZKQhPc ir/+8MU+jWB05CN07ujaJtzSwSec6B/mlBvASu2jxVW5e+ENiGSisCFwNi7d+0k21enr bXzhZ2gpQGHAIEGzJrTPxC4AOnYSmwEdgwH1KHLlYxRjfhZitROzz/g6jC+fKmyNtJfr Jveqk092QCQazpNLWyDG+32T59frRA5Vfvi8u2hCWjPNTQarZC73SxxOD6lSaGCfoCc3 TTp0e7EcAkRRlSzIXOhNxoFwbYXjf5ieH5vDvy4vbRCS4TIv0eALcw8HF79wIIcpJk0b Amag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="P/SS0xeA"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b79ca7fd57si5319886d6.595.2024.07.17.14.49.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jul 2024 14:49:45 -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="P/SS0xeA"; 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 1sUCUn-00070Z-Gh; Wed, 17 Jul 2024 17:47:33 -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 1sUCUk-0006zG-NN for qemu-devel@nongnu.org; Wed, 17 Jul 2024 17:47:31 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUCUh-0001rp-Ue for qemu-devel@nongnu.org; Wed, 17 Jul 2024 17:47:30 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4266fcb311cso986325e9.1 for ; Wed, 17 Jul 2024 14:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721252840; x=1721857640; 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=rg0Rdjc81kCpKex+A4T6UVMbXK9hzcQBh67E0bOsYps=; b=P/SS0xeA89+Q2inGxgOoMES6/6knG7hD3lD1NjyrqpVtcH6GhRUGSjIxnl0V7DVVge ssbMEVnV6JAj0WdnCoApsNSIYYNjuwKVgy75Sv7TnTGqmC/plWo7cEdFUW3FYKHqC6zv IQm9QpixIQRQyGlhkZd13hJDRgdF6ArCD3QvplJIX4lr8yFFyrIK4dJNln/ECbiSwNUy XehY4fwZfNSiCGogoeHkFcp2uq6zqh2zhli1sSMCj5ck8BKFBV3PGKl8luWy+XA7CtDD Z5GcRUsHBXYhtYiid7jkXg4l8NJP4WGzvbP/Li6WT1p3n21fZqa/JxRqMfTC/W9t8fYK tUiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721252840; x=1721857640; 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=rg0Rdjc81kCpKex+A4T6UVMbXK9hzcQBh67E0bOsYps=; b=i7vdGkupP9iALc5GPp9BVwZwlp8SsnRowjtZG7vy30rHYIaSI9K30UZnagH2GR7JiH GnDoBR5qXnrkgRlhHcw7QRl0Pe73hMPYyI69BXnYODfSrjn407jwnLhnSDPkeI3ht/KV qyObqdeXFBmKKm8EBc3rEwZHNDKE3bwS9+CZnpmkYyYqzWGLq3ZVp4ui5Sbzc6GzfDde MlpHAOVDKVuTUImJUk5kQJLgai0WT8Vaw3wrYhmRGCU8v3K9gMqSDwcvzTrJ5wZyW8/Z 1fGfbvqcDIPQOXnGpYSIG4qRV8kd6GaGQW8QJcl68BNkh4OMlhTNEQkhl8xBSjZ3pw06 MeEA== X-Forwarded-Encrypted: i=1; AJvYcCUuWfR15EWm4iWw2I9w9scZyJ+rncl+0C7ZT1U3Y3q/mhTRbwtmahjzk/HOLI/w5LS2wzJBtup1aIL81vOV0dtdTdNubGE= X-Gm-Message-State: AOJu0Yxu9slCnKtUcz3XR+z3TNfe+/WIgd9NjhJfmoLuFURPbwRHq5DE rNbcIU2T1a2Or1z7pLN+UhZ/taGO0xFoWPtNlDVB+VVAeyhHRloV8oWJKw7SQOs= X-Received: by 2002:a05:600c:524e:b0:426:6822:855 with SMTP id 5b1f17b1804b1-427c2d42cdemr23173375e9.36.1721252840513; Wed, 17 Jul 2024 14:47:20 -0700 (PDT) Received: from localhost.localdomain ([176.187.208.21]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427c78194f0sm11476165e9.47.2024.07.17.14.47.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Jul 2024 14:47:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Bibo Mao , Jiaxun Yang , qemu-devel@nongnu.org Cc: Xianglai Li , Paolo Bonzini , Huacai Chen , Xiaojuan Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Song Gao Subject: [PATCH v3 01/17] hw/intc/loongson_ipi: Access memory in little endian Date: Wed, 17 Jul 2024 23:46:52 +0200 Message-ID: <20240717214708.78403-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240717214708.78403-1-philmd@linaro.org> References: <20240717214708.78403-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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 From: Bibo Mao Loongson IPI is only available in little-endian, so use that to access the guest memory (in case we run on a big-endian host). Signed-off-by: Bibo Mao Fixes: f6783e3438 ("hw/loongarch: Add LoongArch ipi interrupt support") [PMD: Extracted from bigger commit, added commit description] Signed-off-by: Philippe Mathieu-Daudé --- hw/intc/loongson_ipi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index e6a7142480..e7979dbdd8 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -14,6 +14,7 @@ #include "qapi/error.h" #include "qemu/log.h" #include "exec/address-spaces.h" +#include "exec/memory.h" #include "migration/vmstate.h" #ifdef TARGET_LOONGARCH64 #include "target/loongarch/cpu.h" @@ -102,7 +103,7 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr, * if the mask is 0, we need not to do anything. */ if ((val >> 27) & 0xf) { - data = address_space_ldl(iocsr_as, addr, attrs, NULL); + data = address_space_ldl_le(iocsr_as, addr, attrs, NULL); for (i = 0; i < 4; i++) { /* get mask for byte writing */ if (val & (0x1 << (27 + i))) { @@ -113,7 +114,7 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr, data &= mask; data |= (val >> 32) & ~mask; - address_space_stl(iocsr_as, addr, data, attrs, NULL); + address_space_stl_le(iocsr_as, addr, data, attrs, NULL); return MEMTX_OK; }